From 5e301969bf1c8818b5c737757363c31584823485 Mon Sep 17 00:00:00 2001 From: Martin Richard Date: Tue, 31 Jan 2012 00:44:34 +0100 Subject: fpicker: a list of bookmarks in the file picker under dual licences MPLv1+/LGPLv3+ Authors: Martin Richard Julien Levesy --- fpicker/Library_fps_office.mk | 2 + fpicker/source/office/PlacesListBox.cxx | 161 +++++++++++++ fpicker/source/office/PlacesListBox.hxx | 109 +++++++++ fpicker/source/office/SvtPlaceDialog.cxx | 143 +++++++++++ fpicker/source/office/SvtPlaceDialog.hxx | 85 +++++++ fpicker/source/office/fpsofficeResMgr.hxx | 60 +++++ fpicker/source/office/iodlg.cxx | 261 ++++++++++++++++----- fpicker/source/office/iodlg.hrc | 26 +- fpicker/source/office/iodlg.hxx | 17 +- fpicker/source/office/iodlg.src | 154 +++++++++++- fpicker/source/office/iodlgimp.cxx | 12 +- fpicker/source/office/iodlgimp.hxx | 9 +- .../registry/data/org/openoffice/Office/Common.xcu | 3 + .../schema/org/openoffice/Office/Common.xcs | 5 + svtools/inc/svtools/svtools.hrc | 1 + 15 files changed, 972 insertions(+), 76 deletions(-) create mode 100644 fpicker/source/office/PlacesListBox.cxx create mode 100644 fpicker/source/office/PlacesListBox.hxx create mode 100644 fpicker/source/office/SvtPlaceDialog.cxx create mode 100644 fpicker/source/office/SvtPlaceDialog.hxx create mode 100644 fpicker/source/office/fpsofficeResMgr.hxx diff --git a/fpicker/Library_fps_office.mk b/fpicker/Library_fps_office.mk index 1d5b6a18a54a..a98efe15709c 100644 --- a/fpicker/Library_fps_office.mk +++ b/fpicker/Library_fps_office.mk @@ -60,6 +60,8 @@ $(eval $(call gb_Library_add_exception_objects,fps_office,\ fpicker/source/office/OfficeControlAccess \ fpicker/source/office/OfficeFilePicker \ fpicker/source/office/OfficeFolderPicker \ + fpicker/source/office/PlacesListBox \ + fpicker/source/office/SvtPlaceDialog \ )) # vim: set noet sw=4 ts=4: diff --git a/fpicker/source/office/PlacesListBox.cxx b/fpicker/source/office/PlacesListBox.cxx new file mode 100644 index 000000000000..5d08e1a552be --- /dev/null +++ b/fpicker/source/office/PlacesListBox.cxx @@ -0,0 +1,161 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License or as specified alternatively below. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * Major Contributor(s): + * [ Copyright (C) 2011 Cedric Bosdonnat (initial developer) ] + * + * All Rights Reserved. + * + * For minor contributions see the git repository. + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#include +#include +#include "SvtPlaceDialog.hxx" + +#include +#include + +namespace css = com::sun::star; +using rtl::OUString; + +PlacesListBox::PlacesListBox( SvtFileDialog* pFileDlg, const ResId& rResId ) : + ListBox( pFileDlg, rResId ), + maPlaces( ), + mpDlg( pFileDlg ), + mnNbEditables( 0 ), + mbUpdated( false ) +{ + SetSelectHdl( LINK( this, PlacesListBox, SelectHdl ) ); + SetDoubleClickHdl( LINK( this, PlacesListBox, DoubleClickHdl ) ) ; +} + +PlacesListBox::~PlacesListBox( ) +{ +} + +void PlacesListBox::AppendPlace( PlacePtr pPlace ) +{ + maPlaces.push_back( pPlace ); + InsertEntry( pPlace->GetName( ), getEntryIcon( pPlace->GetType( ) )); + + if(pPlace->IsEditable()) { + ++mnNbEditables; + mbUpdated = true; + } +} + +sal_Int32 PlacesListBox::GetNbPlaces() { + return maPlaces.size(); +} + +sal_Int32 PlacesListBox::GetNbEditablePlaces() { + return mnNbEditables; +} + +bool PlacesListBox::IsUpdated() { + if(mbUpdated) { + mbUpdated = false; + return true; + } + return false; +} + +const std::vector& PlacesListBox::GetPlaces() { + return maPlaces; +} + +void PlacesListBox::RemovePlace( sal_uInt16 nPos ) +{ + if ( nPos < maPlaces.size() ) + { + if(maPlaces[nPos]->IsEditable()) { + --mnNbEditables; + mbUpdated = true; + } + maPlaces.erase( maPlaces.begin() + nPos ); + RemoveEntry( nPos ); + } +} + +void PlacesListBox::RemoveSelectedPlace() { + RemovePlace(GetSelectEntryPos()); +} + +Image PlacesListBox::getEntryIcon(Place::ePlaceType aType) +{ + Image theImage; + switch (aType) { + case Place::e_PlaceCmis: + theImage = mpDlg->GetButtonImage( IMG_FILEDLG_BTN_UP ); + break; + case Place::e_PlaceFtp: + theImage = mpDlg->GetButtonImage( IMG_FILEDLG_BTN_UP ); + break; + case Place::e_PlaceLocal: + default: + theImage = mpDlg->GetButtonImage( IMG_FILEDLG_BTN_UP ); + break; + }; + return theImage; +} + +IMPL_LINK( PlacesListBox, SelectHdl, ListBox* , EMPTYARG ) +{ + sal_uInt16 nSelected = GetSelectEntryPos(); + PlacePtr pPlace = maPlaces[nSelected]; + mpDlg->OpenURL_Impl( pPlace->GetUrl() ); + + if(pPlace->IsEditable()) + mpDlg->RemovablePlaceSelected(); + else + mpDlg->RemovablePlaceSelected(false); + + return 0; +} + +IMPL_LINK ( PlacesListBox, DoubleClickHdl, ListBox*, EMPTYARG ) +{ + sal_uInt16 nSelected = GetSelectEntryPos(); + PlacePtr pPlace = maPlaces[nSelected]; + if ( pPlace->IsEditable() == true ) + { + SvtPlaceDialog aDlg(mpDlg,pPlace); + short aRetCode = aDlg.Execute(); + switch(aRetCode) { + case RET_OK : + { + pPlace->SetName ( aDlg.GetServerName() ); + pPlace->SetUrl( aDlg.GetServerUrl() ); + break; + } + case RET_NO : + { + RemovePlace(nSelected); + break; + } + default: + break; + }; + } + return 0; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/office/PlacesListBox.hxx b/fpicker/source/office/PlacesListBox.hxx new file mode 100644 index 000000000000..f7f718b27faa --- /dev/null +++ b/fpicker/source/office/PlacesListBox.hxx @@ -0,0 +1,109 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License or as specified alternatively below. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * Major Contributor(s): + * [ Copyright (C) 2011 Cedric Bosdonnat (initial developer) ] + * + * All Rights Reserved. + * + * For minor contributions see the git repository. + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ +#ifndef _PLACESLISTBOX_HXX_ +#define _PLACESLISTBOX_HXX_ + +#include +#include +#include +#include + +/** Class representing a file location: it mainly consist of display attributes and a URL. + */ +class Place +{ + public: + enum ePlaceType { + e_PlaceLocal = 0, + e_PlaceFtp, + e_PlaceCmis + }; + + private: + rtl::OUString msName; + rtl::OUString msUrl; + ePlaceType meType; + + sal_Bool mbEditable; + + public: + + Place( rtl::OUString sName, rtl::OUString sUrl, ePlaceType eType, sal_Bool bEditable = false) : + msName( sName ), + msUrl( sUrl ), + meType( eType ), + mbEditable( bEditable ) {}; + + ~Place( ) {}; + + Place( const Place& rCopy ) : msName( rCopy.msName ), msUrl( rCopy.msUrl ), meType( rCopy.meType ){ }; + + void SetName(const rtl::OUString& aName ) { msName = aName; } + void SetUrl(const rtl::OUString& aUrl ) { msUrl = aUrl; } + + rtl::OUString& GetName( ) { return msName; } + rtl::OUString& GetUrl( ) { return msUrl; } + ePlaceType& GetType( ) { return meType; } + sal_Bool& IsEditable( ) { return mbEditable; } +}; + +typedef boost::shared_ptr< Place > PlacePtr; + +/** ListBox to handle Places. + */ +class PlacesListBox : public ListBox +{ + private: + std::vector< PlacePtr > maPlaces; + SvtFileDialog* mpDlg; + sal_Int32 mnNbEditables; + bool mbUpdated; + + public: + PlacesListBox( SvtFileDialog* pFileDlg, const ResId& rResId ); + ~PlacesListBox( ); + + void AppendPlace( PlacePtr pPlace ); + void RemovePlace( sal_uInt16 nPos ); + void RemoveSelectedPlace(); + sal_Int32 GetNbPlaces(); + sal_Int32 GetNbEditablePlaces(); + bool IsUpdated(); + const std::vector& GetPlaces(); + + private: + Image getEntryIcon( Place::ePlaceType eType); + + DECL_LINK( SelectHdl, ListBox* ); + DECL_LINK( DoubleClickHdl, ListBox* ); + +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/office/SvtPlaceDialog.cxx b/fpicker/source/office/SvtPlaceDialog.cxx new file mode 100644 index 000000000000..5de6bde15d63 --- /dev/null +++ b/fpicker/source/office/SvtPlaceDialog.cxx @@ -0,0 +1,143 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License or as specified alternatively below. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * Major Contributor(s): + * [ Copyright (C) 2012 Julien Levesy (initial developer) ] + * + * All Rights Reserved. + * + * For minor contributions see the git repository. + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#include "iodlg.hrc" +#include +#include + +#include "fpsofficeResMgr.hxx" +#include "PlacesListBox.hxx" +#include "SvtPlaceDialog.hxx" + + +SvtPlaceDialog::SvtPlaceDialog( Window* pParent ) : + ModalDialog( pParent, SvtResId( DLG_SVT_ADDPLACE ) ), + m_aFTServerUrl( this, SvtResId( FT_ADDPLACE_SERVERURL ) ), + m_aFTServerName( this, SvtResId( FT_ADDPLACE_SERVERNAME ) ), + m_aFTServerType( this, SvtResId( FT_ADDPLACE_SERVERTYPE ) ), + m_aFTServerLogin( this, SvtResId( FT_ADDPLACE_SERVERLOGIN ) ), + m_aFTServerPassword( this, SvtResId( FT_ADDPLACE_SERVERPASSWORD) ), + m_aEDServerUrl ( this, SvtResId( ED_ADDPLACE_SERVERURL ) ), + m_aEDServerName ( this, SvtResId( ED_ADDPLACE_SERVERNAME ) ), + m_aEDServerType ( this, SvtResId( ED_ADDPLACE_SERVERTYPE ) ), + m_aEDServerLogin ( this, SvtResId( ED_ADDPLACE_SERVERLOGIN ) ), + m_aEDServerPassword ( this, SvtResId( ED_ADDPLACE_SERVERPASSWORD ) ), + m_aBTOk( this, SvtResId( BT_ADDPLACE_OK ) ), + m_aBTCancel ( this, SvtResId ( BT_ADDPLACE_CANCEL ) ), + m_aBTDelete ( this, SvtResId (BT_ADDPLACE_DELETE ) ) +{ + // This constructor is called when user request a place creation, so + // delete button is hidden. + m_aBTOk.SetClickHdl( LINK( this, SvtPlaceDialog, OKHdl) ); + m_aBTOk.Enable( sal_False ); + + m_aEDServerName.SetModifyHdl( LINK( this, SvtPlaceDialog, EditHdl) ); + m_aEDServerUrl.SetModifyHdl( LINK( this, SvtPlaceDialog, EditHdl) ); + + m_aEDServerUrl.SetUrlFilter( &m_UrlFilter ); + Edit aDummyEdit ( this, SvtResId( ED_ADDPLACE_SERVERURL ) ); + m_aEDServerUrl.SetPosSizePixel( aDummyEdit.GetPosPixel(), aDummyEdit.GetSizePixel() ); + m_aEDServerUrl.Show(); + m_aBTDelete.Hide(); +} + +SvtPlaceDialog::SvtPlaceDialog( Window* pParent, PlacePtr pPlace ) : + ModalDialog( pParent, SvtResId( DLG_SVT_ADDPLACE ) ), + m_aFTServerUrl( this, SvtResId( FT_ADDPLACE_SERVERURL ) ), + m_aFTServerName( this, SvtResId( FT_ADDPLACE_SERVERNAME ) ), + m_aFTServerType( this, SvtResId( FT_ADDPLACE_SERVERTYPE ) ), + m_aFTServerLogin( this, SvtResId( FT_ADDPLACE_SERVERLOGIN ) ), + m_aFTServerPassword( this, SvtResId( FT_ADDPLACE_SERVERPASSWORD) ), + m_aEDServerUrl ( this, SvtResId( ED_ADDPLACE_SERVERURL ) ), + m_aEDServerName ( this, SvtResId( ED_ADDPLACE_SERVERNAME ) ), + m_aEDServerType ( this, SvtResId( ED_ADDPLACE_SERVERTYPE ) ), + m_aEDServerLogin ( this, SvtResId( ED_ADDPLACE_SERVERLOGIN ) ), + m_aEDServerPassword ( this, SvtResId( ED_ADDPLACE_SERVERPASSWORD ) ), + m_aBTOk( this, SvtResId( BT_ADDPLACE_OK ) ), + m_aBTCancel ( this, SvtResId ( BT_ADDPLACE_CANCEL ) ), + m_aBTDelete ( this, SvtResId (BT_ADDPLACE_DELETE ) ) +{ + m_aBTOk.SetClickHdl( LINK( this, SvtPlaceDialog, OKHdl) ); + m_aBTDelete.SetClickHdl ( LINK( this, SvtPlaceDialog, DelHdl) ); + + m_aEDServerName.SetModifyHdl( LINK( this, SvtPlaceDialog, EditHdl) ); + m_aEDServerUrl.SetModifyHdl( LINK( this, SvtPlaceDialog, EditHdl) ); + + m_aEDServerUrl.SetUrlFilter( &m_UrlFilter ); + Edit aDummyEdit ( this, SvtResId( ED_ADDPLACE_SERVERURL ) ); + m_aEDServerUrl.SetPosSizePixel( aDummyEdit.GetPosPixel(), aDummyEdit.GetSizePixel() ); + m_aEDServerUrl.Show(); + + m_aEDServerName.SetText( pPlace->GetName() ); + m_aEDServerUrl.SetText( pPlace->GetUrl() ); +} + +SvtPlaceDialog::~SvtPlaceDialog() +{ +} + +PlacePtr SvtPlaceDialog::GetPlace() +{ + PlacePtr newPlace( new Place( m_aEDServerName.GetText(), m_aEDServerUrl.GetURL(), Place::e_PlaceLocal, true) ); + return newPlace; +} + +IMPL_LINK ( SvtPlaceDialog, OKHdl, Button *, EMPTYARG ) +{ + EndDialog( RET_OK ); + return 1; +} + +IMPL_LINK ( SvtPlaceDialog, DelHdl, Button *, EMPTYARG ) +{ + // ReUsing existing symbols... + EndDialog( RET_NO ); + return 1; +} + +IMPL_LINK ( SvtPlaceDialog, EditHdl, Edit *, EMPTYARG ) +{ + String anUrl = m_aEDServerUrl.GetText(); + anUrl.EraseLeadingChars().EraseTrailingChars(); + String aName = m_aEDServerName.GetText(); + aName.EraseLeadingChars().EraseTrailingChars(); + if ( ( anUrl.Len() ) && ( aName.Len() ) ) + { + if ( !m_aBTOk.IsEnabled() ) + m_aBTOk.Enable( sal_True ); + } + else + { + if ( m_aBTOk.IsEnabled() ) + m_aBTOk.Enable( sal_False ); + } + return 1; +} + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/office/SvtPlaceDialog.hxx b/fpicker/source/office/SvtPlaceDialog.hxx new file mode 100644 index 000000000000..d7861674b259 --- /dev/null +++ b/fpicker/source/office/SvtPlaceDialog.hxx @@ -0,0 +1,85 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License or as specified alternatively below. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * Major Contributor(s): + * [ Copyright (C) 2012 Julien Levesy (initial developer) ] + * + * All Rights Reserved. + * + * For minor contributions see the git repository. + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ +#ifndef _SVTPLACEDIALOG_HXX +#define _SVTPLACEDIALOG_HXX + +#include +#include +#include +#include + +#include + +#include + +class Place; +class SvtPlaceDialog : public ModalDialog +{ +private : + + FixedText m_aFTServerUrl; + FixedText m_aFTServerName; + FixedText m_aFTServerType; + FixedText m_aFTServerLogin; + FixedText m_aFTServerPassword; + + SvtURLBox m_aEDServerUrl; + + Edit m_aEDServerName; + Edit m_aEDServerType; + Edit m_aEDServerLogin; + Edit m_aEDServerPassword; + + OKButton m_aBTOk; + CancelButton m_aBTCancel; + + PushButton m_aBTDelete; + + ::svt::RestrictedPaths m_UrlFilter; + + DECL_LINK( OKHdl, Button *); + DECL_LINK ( DelHdl, Button *); + + DECL_LINK ( EditHdl, Edit *); + +public : + + SvtPlaceDialog( Window* pParent); + SvtPlaceDialog( Window* pParent, PlacePtr pPlace ); + ~SvtPlaceDialog(); + + // Returns a place instance with given informations + PlacePtr GetPlace(); + + rtl::OUString GetServerName() { return m_aEDServerName.GetText(); } + rtl::OUString GetServerUrl() { return m_aEDServerUrl.GetText(); } + +}; + +#endif //_SVTPLACEDIALOG_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/office/fpsofficeResMgr.hxx b/fpicker/source/office/fpsofficeResMgr.hxx new file mode 100644 index 000000000000..1318a29b3831 --- /dev/null +++ b/fpicker/source/office/fpsofficeResMgr.hxx @@ -0,0 +1,60 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License or as specified alternatively below. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * Major Contributor(s): + * [ Copyright (C) 2012 Cédric Bosdonnat (initial developer) ] + * + * All Rights Reserved. + * + * For minor contributions see the git repository. + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ +#ifndef _FPS_OFFICE_RESMGR_HXX_ +#define _FPS_OFFICE_RESMGR_HXX_ + +#include +#include + +namespace +{ + struct ResMgrHolder + { + ResMgr * operator ()() + { + return ResMgr::CreateResMgr ("fps_office"); + } + + static ResMgr * getOrCreate() + { + return rtl_Instance< + ResMgr, ResMgrHolder, + osl::MutexGuard, osl::GetGlobalMutex >::create ( + ResMgrHolder(), osl::GetGlobalMutex()); + } + }; + + struct SvtResId : public ResId + { + SvtResId (sal_uInt16 nId) : ResId (nId, *ResMgrHolder::getOrCreate()) {} + }; +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/office/iodlg.cxx b/fpicker/source/office/iodlg.cxx index 5290c785bccd..5d1916a45630 100644 --- a/fpicker/source/office/iodlg.cxx +++ b/fpicker/source/office/iodlg.cxx @@ -28,6 +28,8 @@ #include #include "iodlg.hxx" +#include "PlacesListBox.hxx" +#include "fpsofficeResMgr.hxx" #include #include #include @@ -52,7 +54,6 @@ #include "svtools/svtools.hrc" #include "svtools/helpid.hrc" #include "iodlg.hrc" -#include "rtl/instance.hxx" #include "asyncfilepicker.hxx" #include "iodlgimp.hxx" #include "svtools/inettbc.hxx" @@ -86,8 +87,12 @@ #include "fpinteraction.hxx" #include +#include +#include "SvtPlaceDialog.hxx" + #include #include +#include //#define AUTOSELECT_USERFILTER // define this for the experimental feature of user-filter auto selection @@ -419,33 +424,6 @@ ControlChain_Impl::~ControlChain_Impl() delete _pNext; } -//***************************************************************************** -// ResMgrHolder -//***************************************************************************** -namespace -{ - struct ResMgrHolder - { - ResMgr * operator ()() - { - return ResMgr::CreateResMgr ("fps_office"); - } - - static ResMgr * getOrCreate() - { - return rtl_Instance< - ResMgr, ResMgrHolder, - osl::MutexGuard, osl::GetGlobalMutex >::create ( - ResMgrHolder(), osl::GetGlobalMutex()); - } - }; - - struct SvtResId : public ResId - { - SvtResId (sal_uInt16 nId) : ResId (nId, *ResMgrHolder::getOrCreate()) {} - }; -} - //***************************************************************************** // SvtFileDialog //***************************************************************************** @@ -472,6 +450,7 @@ SvtFileDialog::SvtFileDialog ,_bIsInExecute( sal_False ) ,m_bInExecuteAsync( false ) ,m_bHasFilename( false ) + ,m_context(comphelper::getProcessComponentContext()) { Init_Impl( nBits ); } @@ -514,6 +493,23 @@ SvtFileDialog::~SvtFileDialog() _pFileView->SetSelectHdl( Link() ); + // Save bookmarked places + if(_pImp->_pPlaces->IsUpdated()) { + const std::vector aPlaces = _pImp->_pPlaces->GetPlaces(); + Sequence< ::rtl::OUString > placesList(_pImp->_pPlaces->GetNbEditablePlaces()); + int i(0); + for(std::vector::const_iterator it = aPlaces.begin(); it != aPlaces.end(); ++it) { + if((*it)->IsEditable()) { + placesList[i] = (*it)->GetUrl(); + ++i; + } + } + + boost::shared_ptr batch(comphelper::ConfigurationChanges::create(m_context)); + officecfg::Office::Common::Misc::FilePickerPlaces::set(placesList, batch, m_context); + batch->commit(); + } + delete _pImp; delete _pFileView; @@ -598,15 +594,27 @@ void SvtFileDialog::Init_Impl } } - _pImp->_pFtCurrentPath = new FixedText( this, SvtResId( FT_EXPLORERFILE_CURRENTPATH ) ); - WinBits nTmpStyle = _pImp->_pFtCurrentPath->GetStyle(); - nTmpStyle |= WB_PATHELLIPSIS; - _pImp->_pFtCurrentPath->SetStyle( nTmpStyle ); + Edit anOtherDummy( this, SvtResId( ED_EXPLORERFILE_CURRENTPATH ) ); + _pImp->_pEdCurrentPath = new SvtURLBox( this, SvtResId(ED_EXPLORERFILE_CURRENTPATH) ); + _pImp->_pEdCurrentPath->SetUrlFilter( &m_aURLFilter ); + _pImp->_pEdCurrentPath->SetPosSizePixel( anOtherDummy.GetPosPixel(), anOtherDummy.GetSizePixel() ); + _pImp->_pEdCurrentPath->Show(); _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->_pBtnConnectToServer = new PushButton ( this, SvtResId ( BTN_EXPLORERFILE_CONNECT_TO_SERVER ) ); + _pImp->_pBtnConnectToServer->SetAccessibleName( _pImp->_pBtnConnectToServer->GetQuickHelpText() ); + + _pImp->_pBtnAddPlace = new PushButton ( this, SvtResId ( BTN_EXPLORERFILE_ADD_PLACE ) ); + _pImp->_pBtnAddPlace->SetAccessibleName( _pImp->_pBtnAddPlace->GetQuickHelpText() ); + _pImp->_pBtnAddPlace->SetClickHdl( STATIC_LINK ( this, SvtFileDialog, AddPlacePressed_Hdl ) ); + + _pImp->_pBtnRemovePlace = new PushButton ( this, SvtResId ( BTN_EXPLORERFILE_REMOVE_PLACE ) ); + _pImp->_pBtnRemovePlace->SetAccessibleName( _pImp->_pBtnRemovePlace->GetQuickHelpText() ); + _pImp->_pBtnRemovePlace->SetClickHdl( STATIC_LINK ( this, SvtFileDialog, RemovePlacePressed_Hdl ) ); + _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 ); @@ -628,7 +636,7 @@ void SvtFileDialog::Init_Impl _pFileView->SetHelpId( HID_FILEDLG_STANDARD ); _pFileView->SetStyle( _pFileView->GetStyle() | WB_TABSTOP ); - // determine the positions and size of the buttons + // determine the size of the buttons Image aNewFolderImg( GetButtonImage( IMG_FILEDLG_CREATEFOLDER ) ); _pImp->_pBtnNewFolder->SetModeImage( aNewFolderImg ); @@ -639,40 +647,61 @@ void SvtFileDialog::Init_Impl _pImp->_pBtnUp->SetSizePixel( aSize ); _pImp->_pBtnStandard->SetSizePixel( aSize ); + // set position of the buttons Size aDlgSize = GetOutputSizePixel(); long n6AppFontInPixel = LogicToPixel( Size( 6, 0 ), MAP_APPFONT ).Width(); long n3AppFontInPixel = LogicToPixel( Size( 3, 0 ), MAP_APPFONT ).Width(); + long nHalf3AppFontInPixel = n3AppFontInPixel/2; - // calculate the length of all buttons - const sal_uInt16 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 + // nDelta is the space between the right border and the left border of the + // component currently positioned + long nDelta = n6AppFontInPixel; + // Standard dir + nDelta += aSize.Width(); Point aPos( aDlgSize.Width() - nDelta, - _pImp->_pBtnUp->GetPosPixel().Y() + _pImp->_pBtnStandard->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 ); + _pImp->_pBtnStandard->SetPosPixel(aPos); + + // New folder + nDelta += aSize.Width() + nHalf3AppFontInPixel; + aPos.X() = aDlgSize.Width() - nDelta; + _pImp->_pBtnNewFolder->SetPosPixel(aPos); + + // Previous level (up) + nDelta += aSize.Width() + nHalf3AppFontInPixel; + aPos.X() = aDlgSize.Width() - nDelta; + _pImp->_pBtnUp->SetPosPixel(aPos); + + // Connect to server ("...") + nDelta += _pImp->_pBtnConnectToServer->GetSizePixel().Width() + n3AppFontInPixel; + aPos.X() = aDlgSize.Width() - nDelta; + + // Height of this button is URL bar's height + long nBtnHeight = aSize.Height(); + aSize = _pImp->_pBtnConnectToServer->GetSizePixel(); + aSize.Height() = _pImp->_pEdCurrentPath->GetOutputSizePixel().Height(); + // Keep the same height as for the other buttons + _pImp->_pBtnConnectToServer->SetSizePixel( aSize ); + + // Repositon the URL bar and the "..." button in order to have it vertically + // aligned with the buttons + aPos.Y() += (nBtnHeight - aSize.Height()) / 2; + _pImp->_pBtnConnectToServer->SetPosPixel(aPos); + + // Set the size of the URL bar + nDelta += nHalf3AppFontInPixel; // right margin of the URL bar + aSize.Width() = aDlgSize.Width() + - _pImp->_pEdCurrentPath->GetPosPixel().X() + - nDelta; + _pImp->_pEdCurrentPath->SetOutputSizePixel(aSize); + + aPos.X() = _pImp->_pEdCurrentPath->GetPosPixel().X(); + _pImp->_pEdCurrentPath->SetPosPixel(aPos); if ( nStyle & SFXWB_READONLY ) { @@ -703,12 +732,16 @@ void SvtFileDialog::Init_Impl aPos.Y() += LogicToPixel( Size( 0, 6 ), MAP_APPFONT ).Height(); long nYOffset = aPos.Y(); aPos = _pFileView->GetPosPixel(); + + aPos.Y() = nYOffset; nYOffset -= aPos.Y(); // Adjust the position of the other elements. - aPos.Y() += nYOffset; _pFileView->SetPosPixel( aPos ); + aPos.X() = _pImp->_pPlaces->GetPosPixel().X(); + _pImp->_pPlaces->SetPosPixel( aPos ); + lcl_MoveControl( _pImp->_pFtFileName, 0, nYOffset ); lcl_MoveControl( _pImp->_pEdFileName, 0, nYOffset ); @@ -770,6 +803,10 @@ void SvtFileDialog::Init_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 ) ); + _pImp->_pEdCurrentPath->SetOpenHdl ( STATIC_LINK( this, SvtFileDialog, URLBoxModifiedHdl_Impl ) ); + _pImp->_pBtnConnectToServer->SetClickHdl( STATIC_LINK ( this, SvtFileDialog, ConnectToServerPressed_Hdl ) ); + + _pFileView->SetSelectHdl( LINK( this, SvtFileDialog, SelectHdl_Impl ) ); _pFileView->SetDoubleClickHdl( LINK( this, SvtFileDialog, DblClickHdl_Impl ) ); _pFileView->SetOpenDoneHdl( LINK( this, SvtFileDialog, OpenDoneHdl_Impl ) ); @@ -1060,7 +1097,7 @@ IMPL_STATIC_LINK( SvtFileDialog, OpenHdl_Impl, void*, pVoid ) // 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(); + aFileName = pThis->_pImp->_pEdCurrentPath->GetText(); nLen = aFileName.Len(); } else @@ -1417,6 +1454,63 @@ IMPL_STATIC_LINK( SvtFileDialog, FileNameModifiedHdl_Impl, void*, EMPTYARG ) //***************************************************************************** +IMPL_STATIC_LINK ( SvtFileDialog, URLBoxModifiedHdl_Impl, void*, EMPTYARG ) +{ + String _aPath = pThis->_pImp->_pEdCurrentPath->GetURL(); + pThis->OpenURL_Impl(_aPath); + return 0; +} + +//***************************************************************************** + +IMPL_STATIC_LINK ( SvtFileDialog, ConnectToServerPressed_Hdl, void*, EMPTYARG ) +{ + pThis->_pFileView->EndInplaceEditing( false ); + + SvtPlaceDialog aDlg( pThis ); + short aRetCode = aDlg.Execute(); + + switch (aRetCode) { + case RET_OK : + { + PlacePtr newPlace = aDlg.GetPlace(); + pThis->_pImp->_pPlaces->AppendPlace(newPlace); + + break; + } + case RET_CANCEL : + default : + // Do Nothing + break; + }; + + return 0; +} + +//***************************************************************************** + +IMPL_STATIC_LINK ( SvtFileDialog, AddPlacePressed_Hdl, void*, EMPTYARG ) +{ + // Maybe open the PlacesDialog would have been a better idea + // there is an ux choice to make we did not make... + PlacePtr newPlace(new Place(::rtl::OUString(pThis->_pFileView->GetViewURL()), + ::rtl::OUString(pThis->_pFileView->GetViewURL()), + Place::e_PlaceLocal, true)); + pThis->_pImp->_pPlaces->AppendPlace(newPlace); + return 0; +} + +//***************************************************************************** + +IMPL_STATIC_LINK ( SvtFileDialog, RemovePlacePressed_Hdl, void*, EMPTYARG ) +{ + pThis->_pImp->_pPlaces->RemoveSelectedPlace(); + + return 0; +} + +//***************************************************************************** + SvtFileDialogFilter_Impl* SvtFileDialog::FindFilter_Impl ( const String& _rFilter, @@ -1558,7 +1652,7 @@ void SvtFileDialog::UpdateControls( const String& rURL ) if ( !sText.Len() && rURL.Len() ) // happens, for instance, for URLs which the INetURLObject does not know to belong to a hierarchical scheme sText = rURL; - _pImp->_pFtCurrentPath->SetText( sText ); + _pImp->_pEdCurrentPath->SetText( sText ); } //========================================================================= @@ -1937,6 +2031,17 @@ void SvtFileDialog::onAsyncOperationFinished() _pImp->_pEdFileName->GrabFocus(); // (if m_bInExecuteAsync is true, then the operation was finished within the minium wait time, // and to the user, the operation appears to be synchronous) + + _pImp->_pBtnRemovePlace->Disable(); +} + +//----------------------------------------------------------------------------- +void SvtFileDialog::RemovablePlaceSelected(bool enable) +{ + if(enable) + _pImp->_pBtnRemovePlace->Enable(); + else + _pImp->_pBtnRemovePlace->Disable(); } //------------------------------------------------------------------------- @@ -2485,8 +2590,9 @@ void SvtFileDialog::implArrangeControls() // pb: #136070# new order so all LabeledBy relations are correct now Control* pControls[] = { - _pImp->_pFtCurrentPath, + _pImp->_pEdCurrentPath, _pImp->_pBtnConnectToServer, _pImp->_pBtnUp, _pImp->_pBtnNewFolder, _pImp->_pBtnStandard, // image buttons + _pImp->_pPlaces, _pImp->_pBtnAddPlace, _pImp->_pBtnRemovePlace, // list of places _pFileView, // the file view _pImp->_pFtFileName, _pImp->_pEdFileName, _pImp->_pFtFileVersion, _pImp->_pLbFileVersion, @@ -2655,6 +2761,11 @@ void SvtFileDialog::Resize() _pFileView->SetSizePixel( aNewSize ); + // Resize the places list box to fit the height of the FileView + Size placesNewSize(_pImp->_pPlaces->GetSizePixel()); + placesNewSize.Height() += nDeltaY; + _pImp->_pPlaces->SetSizePixel( placesNewSize ); + if ( !nDeltaY && !nDeltaX ) // This resize was only called to show or hide the indicator. return; @@ -2669,7 +2780,8 @@ void SvtFileDialog::Resize() _pImp->_pFtFileName, _pImp->_pEdFileName, _pImp->_pFtFileVersion, _pImp->_pLbFileVersion, _pImp->_pFtTemplates, _pImp->_pLbTemplates, _pImp->_pFtImageTemplates, _pImp->_pLbImageTemplates, _pImp->_pFtFileType, _pImp->GetFilterListControl(), _pCbReadOnly, _pCbLinkBox, _pCbPreviewBox, - _pPbPlay, _pImp->_pCbPassword, _pImp->_pCbAutoExtension, _pImp->_pCbOptions, _pCbSelection + _pPbPlay, _pImp->_pCbPassword, _pImp->_pCbAutoExtension, _pImp->_pCbOptions, _pCbSelection, + _pImp->_pBtnAddPlace, _pImp->_pBtnRemovePlace }; Control** ppMoveControls = aMoveControlsVert; Control** ppMoveControlsEnd = ppMoveControls + SAL_N_ELEMENTS( aMoveControlsVert ); @@ -2693,6 +2805,7 @@ void SvtFileDialog::Resize() { Control* aMoveControlsHor[] = { + _pImp->_pBtnConnectToServer, _pImp->_pBtnUp, _pImp->_pBtnNewFolder, _pImp->_pBtnStandard }; Control** ppMoveControls = aMoveControlsHor; @@ -2707,7 +2820,7 @@ void SvtFileDialog::Resize() Control* aSizeControls[] = { _pImp->_pEdFileName, _pImp->_pLbFileVersion, _pImp->_pLbTemplates, _pImp->_pLbImageTemplates, - _pImp->GetFilterListControl(), _pImp->_pFtCurrentPath, + _pImp->GetFilterListControl(), _pImp->_pEdCurrentPath, }; sal_Int32 nSizeControls = SAL_N_ELEMENTS( aSizeControls ); Control** ppSizeControls = aSizeControls; @@ -2804,7 +2917,7 @@ Control* SvtFileDialog::getControl( sal_Int16 _nControlId, sal_Bool _bLabelContr break; case FIXEDTEXT_CURRENTFOLDER: - pReturn = _pImp->_pFtCurrentPath; + pReturn = _pImp->_pEdCurrentPath; break; case LISTBOX_VERSION: @@ -2993,6 +3106,9 @@ void SvtFileDialog::AddControls_Impl( ) _pImp->_pLbImageTemplates = new ListBox( this, SvtResId( LB_EXPLORERFILE_SHARED_LISTBOX ) ); _pImp->_pLbImageTemplates->SetHelpId( HID_FILEOPEN_IMAGE_TEMPLATE ); } + + _pImp->_pPlaces = new PlacesListBox( this, SvtResId( LB_EXPLORERFILE_PLACES_LISTBOX ) ); + initDefaultPlaces(); } // ----------------------------------------------------------------------- @@ -3317,6 +3433,23 @@ void SvtFileDialog::appendDefaultExtension(String& _rFileName, } } +void SvtFileDialog::initDefaultPlaces( ) +{ + PlacePtr pRootPlace( new Place( ResId::toString( SvtResId( STR_MY_DOCUMENTS ) ), GetStandardDir(), Place::e_PlaceLocal ) ); + _pImp->_pPlaces->AppendPlace( pRootPlace ); + + // Load from user settings + Sequence< ::rtl::OUString > placesList(officecfg::Office::Common::Misc::FilePickerPlaces::get(m_context)); + + for(sal_Int32 nPlace = 0; nPlace < placesList.getLength(); ++nPlace) { + PlacePtr pPlace(new Place(placesList[nPlace], placesList[nPlace], Place::e_PlaceLocal, true)); + _pImp->_pPlaces->AppendPlace(pPlace); + } + + // Reset the placesList "updated" state + _pImp->_pPlaces->IsUpdated(); +} + // QueryFolderNameDialog ------------------------------------------------------- namespace svtools { diff --git a/fpicker/source/office/iodlg.hrc b/fpicker/source/office/iodlg.hrc index 353314e565c9..e54c7029c56d 100644 --- a/fpicker/source/office/iodlg.hrc +++ b/fpicker/source/office/iodlg.hrc @@ -33,7 +33,7 @@ // ModalDialog DLG_SVT_EXPLORERFILE -#define FT_EXPLORERFILE_CURRENTPATH 10 +#define ED_EXPLORERFILE_CURRENTPATH 10 #define BTN_EXPLORERFILE_NEWFOLDER 11 #define BTN_EXPLORERFILE_UP 12 #define BTN_EXPLORERFILE_STANDARD 13 @@ -59,6 +59,11 @@ #define CB_AUTO_EXTENSION 42 #define CB_OPTIONS 43 +#define LB_EXPLORERFILE_PLACES_LISTBOX 50 +#define BTN_EXPLORERFILE_CONNECT_TO_SERVER 51 +#define BTN_EXPLORERFILE_ADD_PLACE 52 +#define BTN_EXPLORERFILE_REMOVE_PLACE 53 + // ----------------------------------------------- #define STR_EXPLORERFILE_OPEN 1 @@ -68,7 +73,24 @@ #define STR_PATHSELECT 5 #define STR_BUTTONSELECT 6 #define STR_ACTUALVERSION 7 -#define STR_PREVIEW 8 +#define STR_PREVIEW 8 +#define STR_MY_DOCUMENTS 9 + +// DLG_SVT_ADDPLACE ------------------------------ + +#define FT_ADDPLACE_SERVERURL 10 +#define FT_ADDPLACE_SERVERNAME 11 +#define FT_ADDPLACE_SERVERTYPE 12 +#define FT_ADDPLACE_SERVERLOGIN 13 +#define FT_ADDPLACE_SERVERPASSWORD 14 +#define ED_ADDPLACE_SERVERURL 15 +#define ED_ADDPLACE_SERVERNAME 16 +#define ED_ADDPLACE_SERVERTYPE 17 +#define ED_ADDPLACE_SERVERLOGIN 18 +#define ED_ADDPLACE_SERVERPASSWORD 19 +#define BT_ADDPLACE_OK 20 +#define BT_ADDPLACE_CANCEL 21 +#define BT_ADDPLACE_DELETE 22 // DLG_SVT_QUERYFOLDERNAME ----------------------- diff --git a/fpicker/source/office/iodlg.hxx b/fpicker/source/office/iodlg.hxx index 9a9da4b047d8..4b325de39e3b 100644 --- a/fpicker/source/office/iodlg.hxx +++ b/fpicker/source/office/iodlg.hxx @@ -1,5 +1,5 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* +/*********** ************************************************************** * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -37,6 +37,7 @@ #include #include #include +#include #include #include #include @@ -46,6 +47,8 @@ #include "asyncfilepicker.hxx" #include "OfficeControlAccess.hxx" #include "fpsmartcontent.hxx" +#include +#include #include @@ -122,6 +125,7 @@ private: m_xListener; bool m_bInExecuteAsync; bool m_bHasFilename; + ::com::sun::star::uno::Reference < com::sun::star::uno::XComponentContext > m_context; DECL_STATIC_LINK( SvtFileDialog, FilterSelectHdl_Impl, ListBox* ); DECL_STATIC_LINK( SvtFileDialog, NewFolderHdl_Impl, PushButton* ); @@ -131,6 +135,12 @@ private: DECL_STATIC_LINK( SvtFileDialog, FileNameGetFocusHdl_Impl, void* ); DECL_STATIC_LINK( SvtFileDialog, FileNameModifiedHdl_Impl, void* ); + DECL_STATIC_LINK( SvtFileDialog, URLBoxModifiedHdl_Impl, void* ); + DECL_STATIC_LINK( SvtFileDialog, ConnectToServerPressed_Hdl, void* ); + + DECL_STATIC_LINK( SvtFileDialog, AddPlacePressed_Hdl, void* ); + DECL_STATIC_LINK( SvtFileDialog, RemovePlacePressed_Hdl, void* ); + void Init_Impl( WinBits nBits ); /** find a filter with the given wildcard @param _rFilter @@ -158,6 +168,7 @@ private: DECL_LINK( ClickHdl_Impl, CheckBox* ); DECL_LINK(PlayButtonHdl_Impl, void *); + // removes a filter with wildcards from the path and returns it sal_Bool IsolateFilterFromPath_Impl( String& rPath, String& rFilter ); @@ -256,6 +267,8 @@ public: void onAsyncOperationStarted(); void onAsyncOperationFinished(); + void RemovablePlaceSelected(bool enable = true); + void displayIOException( const String& _rURL, ::com::sun::star::ucb::IOErrorCode _eCode ); void simulateAccessDenied( const String& _rURL ) { @@ -357,6 +370,8 @@ private: String& _rFileName, const String& _rFilterDefaultExtension, const String& _rFilterExtensions); + + void initDefaultPlaces( ); }; //*************************************************************************** diff --git a/fpicker/source/office/iodlg.src b/fpicker/source/office/iodlg.src index b30bf7e7bd13..819694a53dbf 100644 --- a/fpicker/source/office/iodlg.src +++ b/fpicker/source/office/iodlg.src @@ -64,11 +64,11 @@ ModalDialog DLG_SVT_EXPLORERFILE Sizeable = TRUE; HelpId = HID_EXPLORERDLG_FILE ; Size = MAP_APPFONT ( 280 , 174 ) ; - FixedText FT_EXPLORERFILE_CURRENTPATH + Edit ED_EXPLORERFILE_CURRENTPATH { Pos = MAP_APPFONT ( 6 , 6 ) ; - Size = MAP_APPFONT ( 100 , 10 ) ; - NoLabel = TRUE ; + Size = MAP_APPFONT ( 90 , 14 ) ; + Border = TRUE ; }; ImageButton BTN_EXPLORERFILE_NEWFOLDER { @@ -92,11 +92,45 @@ ModalDialog DLG_SVT_EXPLORERFILE Pos = MAP_APPFONT ( 59 , 6 ) ; QuickHelpText [ en-US ] = "Default Directory" ; }; + ListBox LB_EXPLORERFILE_PLACES_LISTBOX + { + HelpID = "fpicker:ListBox:DLG_SVT_EXPLORERFILE:LB_EXPLORERFILE_PLACES_LISTBOX"; + Pos = MAP_APPFONT ( 6 , 26 ) ; + Size = MAP_APPFONT ( 50 , 75 ) ; + DropDown = FALSE ; + AutoSize = FALSE ; + AutoHScroll = TRUE ; + Border = TRUE ; + }; + PushButton BTN_EXPLORERFILE_CONNECT_TO_SERVER + { + HelpID = "fpicker:PushButton:DLG_SVT_EXPLORERFILE:BTN_EXPLORERFILE_CONNECT_TO_SERVER"; + Pos = MAP_APPFONT ( 94 , 6 ) ; + Size = MAP_APPFONT ( 15 , 10 ) ; + Text [ en-US ] = "..." ; + QuickHelpText [ en-US ] = "Connect To Server" ; + }; + PushButton BTN_EXPLORERFILE_ADD_PLACE + { + HelpID = "fpicker:PushButton:DLG_SVT_EXPLORERFILE:BTN_EXPLORERFILE_ADD_PLACE"; + Pos = MAP_APPFONT ( 6 , 101 ) ; + Size = MAP_APPFONT ( 10 , 10 ) ; + Text [ en-US ] = "+" ; + QuickHelpText [ en-US ] = "Bookmark This Place" ; + }; + PushButton BTN_EXPLORERFILE_REMOVE_PLACE + { + HelpID = "fpicker:PushButton:DLG_SVT_EXPLORERFILE:BTN_EXPLORERFILE_REMOVE_PLACE"; + Pos = MAP_APPFONT ( 19 , 101 ) ; + Size = MAP_APPFONT ( 10 , 10 ) ; + Text [ en-US ] = "-" ; + QuickHelpText [ en-US ] = "Remove Selected Bookmark" ; + }; Control CTL_EXPLORERFILE_FILELIST { TabStop = TRUE ; - Pos = MAP_APPFONT ( 6 , 26 ) ; - Size = MAP_APPFONT ( 268 , 85 ) ; + Pos = MAP_APPFONT ( 59 , 26 ) ; + Size = MAP_APPFONT ( 215 , 85 ) ; Border = TRUE ; }; FixedText FT_EXPLORERFILE_FILENAME @@ -218,9 +252,117 @@ ModalDialog DLG_SVT_EXPLORERFILE { Text [ en-US ] = "File Preview"; }; + String STR_MY_DOCUMENTS + { + Text [ en-US ] = "My Documents" ; + }; +}; + +// Add Place Dialog -------------------------------------------------------------- + +ModalDialog DLG_SVT_ADDPLACE +{ + OutputSize = TRUE ; + Border = TRUE ; + SVLook = TRUE ; + Moveable = TRUE ; + Closeable = TRUE ; + Sizeable = TRUE; + HelpId = HID_EXPLORERDLG_FILE ; + Size = MAP_APPFONT ( 200 , 140 ) ; + FixedText FT_ADDPLACE_SERVERURL + { + Pos = MAP_APPFONT ( 12 , 14 ) ; + Size = MAP_APPFONT ( 40 , 10 ) ; + Text [ en-US ] = "Server Url" ; + }; + FixedText FT_ADDPLACE_SERVERNAME + { + Pos = MAP_APPFONT ( 12 , 34 ) ; + Size = MAP_APPFONT ( 40 , 10 ) ; + Text [ en-US ] = "Server Name" ; + }; + FixedText FT_ADDPLACE_SERVERTYPE + { + Pos = MAP_APPFONT ( 12 , 54 ) ; + Size = MAP_APPFONT ( 40 , 10 ) ; + Text [ en-US ] = "Type" ; + }; + FixedText FT_ADDPLACE_SERVERLOGIN + { + Pos = MAP_APPFONT ( 12 , 74 ) ; + Size = MAP_APPFONT ( 30 , 10 ) ; + Text [ en-US ] = "Login" ; + }; + FixedText FT_ADDPLACE_SERVERPASSWORD + { + Pos = MAP_APPFONT ( 12 , 94 ) ; + Size = MAP_APPFONT ( 40 , 10 ) ; + Text [ en-US ] = "Password" ; + }; + Edit ED_ADDPLACE_SERVERURL + { + //HelpID = "fpicker:Edit:DLG_SVT_QUERYFOLDERNAME:ED_SVT_QUERYFOLDERNAME_DLG_NAME"; + Pos = MAP_APPFONT ( 62, 12 ) ; + Size = MAP_APPFONT ( 130 , 12 ) ; + Border = TRUE ; + //Left = TRUE ; + }; + Edit ED_ADDPLACE_SERVERNAME + { + //HelpID = "fpicker:Edit:DLG_SVT_QUERYFOLDERNAME:ED_SVT_QUERYFOLDERNAME_DLG_NAME"; + Pos = MAP_APPFONT ( 62, 32 ) ; + Size = MAP_APPFONT ( 130 , 12 ) ; + Border = TRUE ; + //Left = TRUE ; + }; + Edit ED_ADDPLACE_SERVERTYPE + { + //HelpID = "fpicker:Edit:DLG_SVT_QUERYFOLDERNAME:ED_SVT_QUERYFOLDERNAME_DLG_NAME"; + Pos = MAP_APPFONT ( 62, 52 ) ; + Size = MAP_APPFONT ( 130 , 12 ) ; + Border = TRUE ; + //Left = TRUE ; + }; + Edit ED_ADDPLACE_SERVERLOGIN + { + //HelpID = "fpicker:Edit:DLG_SVT_QUERYFOLDERNAME:ED_SVT_QUERYFOLDERNAME_DLG_NAME"; + Pos = MAP_APPFONT ( 62, 72 ) ; + Size = MAP_APPFONT ( 130 , 12 ) ; + Border = TRUE ; + //Left = TRUE ; + }; + Edit ED_ADDPLACE_SERVERPASSWORD + { + //HelpID = "fpicker:Edit:DLG_SVT_QUERYFOLDERNAME:ED_SVT_QUERYFOLDERNAME_DLG_NAME"; + Pos = MAP_APPFONT ( 62, 92 ) ; + Size = MAP_APPFONT ( 130 , 12 ) ; + Border = TRUE ; + //Left = TRUE ; + }; + OKButton BT_ADDPLACE_OK + { + Pos = MAP_APPFONT ( 80 , 120 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + DefButton = TRUE ; + }; + CancelButton BT_ADDPLACE_CANCEL + { + Pos = MAP_APPFONT ( 140, 120 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + }; + PushButton BT_ADDPLACE_DELETE + { + //HelpID = "fpicker:PushButton:DLG_SVT_EXPLORERFILE:BTN_EXPLORERFILE_CONNECT_TO_SERVER"; + Pos = MAP_APPFONT ( 10 , 120 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + Text [ en-US ] = "Delete" ; + //QuickHelpText [ en-US ] = "Connect To Server" ; + }; }; // QueryFolderNameDialog ---------------------------------------------------------- + ModalDialog DLG_SVT_QUERYFOLDERNAME { HelpID = "fpicker:ModalDialog:DLG_SVT_QUERYFOLDERNAME"; @@ -229,7 +371,7 @@ ModalDialog DLG_SVT_QUERYFOLDERNAME OutputSize = TRUE ; SVLook = TRUE ; Text = "Ordner" ; - Size = MAP_APPFONT ( 218 , 45 ) ; + Size = MAP_APPFONT ( 100 , 45 ) ; FixedText FT_SVT_QUERYFOLDERNAME_DLG_NAME { Pos = MAP_APPFONT ( 12 , 14 ) ; diff --git a/fpicker/source/office/iodlgimp.cxx b/fpicker/source/office/iodlgimp.cxx index 73dcbccdc247..4a7ffc5e8cec 100644 --- a/fpicker/source/office/iodlgimp.cxx +++ b/fpicker/source/office/iodlgimp.cxx @@ -360,9 +360,13 @@ SvtExpFileDlg_Impl::SvtExpFileDlg_Impl( WinBits ) : _pBtnNewFolder ( NULL ), _pBtnStandard ( NULL ), _pCbPassword ( NULL ), - _pFtCurrentPath ( NULL ), + _pEdCurrentPath ( NULL ), _pCbAutoExtension ( NULL ), _pCbOptions ( NULL ), + _pPlaces ( NULL ), + _pBtnConnectToServer( NULL ), + _pBtnAddPlace ( NULL ), + _pBtnRemovePlace ( NULL ), _nState ( FILEDLG_STATE_REMOTE ), _nStyle ( 0 ), _bDoubleClick ( sal_False ), @@ -378,7 +382,7 @@ SvtExpFileDlg_Impl::SvtExpFileDlg_Impl( WinBits ) : SvtExpFileDlg_Impl::~SvtExpFileDlg_Impl() { - delete _pFtCurrentPath; + delete _pEdCurrentPath; delete _pCbPassword; delete _pCbAutoExtension; delete _pCbOptions; @@ -400,6 +404,10 @@ SvtExpFileDlg_Impl::~SvtExpFileDlg_Impl() delete _pFtFileName; delete _pUserFilter; delete _pFilter; + delete _pPlaces; + delete _pBtnConnectToServer; + delete _pBtnAddPlace; + delete _pBtnRemovePlace; } //***************************************************************************** diff --git a/fpicker/source/office/iodlgimp.hxx b/fpicker/source/office/iodlgimp.hxx index e0a99a819a81..de9df3be7152 100644 --- a/fpicker/source/office/iodlgimp.hxx +++ b/fpicker/source/office/iodlgimp.hxx @@ -28,6 +28,8 @@ #ifndef _IODLGIMP_HXX #define _IODLGIMP_HXX +#include + #include #include #include @@ -184,10 +186,15 @@ public: ImageButton* _pBtnNewFolder; SvtTravelButton_Impl* _pBtnStandard; CheckBox* _pCbPassword; - FixedText* _pFtCurrentPath; + SvtURLBox* _pEdCurrentPath; CheckBox* _pCbAutoExtension; CheckBox* _pCbOptions; + PlacesListBox* _pPlaces; + PushButton* _pBtnConnectToServer; + PushButton* _pBtnAddPlace; + PushButton* _pBtnRemovePlace; + SvtFileDlgMode _eMode; SvtFileDlgType _eDlgType; SvtFileDlgState _nState; diff --git a/officecfg/registry/data/org/openoffice/Office/Common.xcu b/officecfg/registry/data/org/openoffice/Office/Common.xcu index 7ea1461e5905..46554ba5020c 100644 --- a/officecfg/registry/data/org/openoffice/Office/Common.xcu +++ b/officecfg/registry/data/org/openoffice/Office/Common.xcu @@ -590,6 +590,9 @@ + + + diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs index 483fc2d3aa7a..d86f89f3e814 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs @@ -6755,6 +6755,11 @@ true + + + List of the places the user bookmarked in the file picker dialog. + + diff --git a/svtools/inc/svtools/svtools.hrc b/svtools/inc/svtools/svtools.hrc index c6e05f2ad5d3..466b978c16bd 100644 --- a/svtools/inc/svtools/svtools.hrc +++ b/svtools/inc/svtools/svtools.hrc @@ -43,6 +43,7 @@ #define DLG_SVT_EXPLORERFILE (RID_SVTOOLS_START+4) #define DLG_SVT_QUERYFOLDERNAME (RID_SVTOOLS_START+5) #define DLG_SVT_QUERYDELETE (RID_SVTOOLS_START+6) +#define DLG_SVT_ADDPLACE (RID_SVTOOLS_START+7) #define STR_SVT_AUTOMATIC_COLOR (RID_SVTOOLS_START+16) -- cgit v1.2.3