fpicker/Library_fps_office.mk | 1 fpicker/source/office/OfficeFilePicker.cxx | 79 fpicker/source/office/OfficeFilePicker.hxx | 39 fpicker/source/office/OfficeFolderPicker.cxx | 2 fpicker/source/office/OfficeFolderPicker.hxx | 2 fpicker/source/office/RemoteFilesDialog.cxx | 980 ++++++++++ fpicker/source/office/RemoteFilesDialog.hxx | 171 + fpicker/source/office/commonpicker.hxx | 8 fpicker/source/office/fpdialogbase.hxx | 113 + fpicker/source/office/fps_office.component | 3 fpicker/source/office/fps_office.cxx | 6 fpicker/source/office/iodlg.cxx | 4 fpicker/source/office/iodlg.hxx | 41 framework/Library_fwk.mk | 1 framework/inc/classes/resource.hrc | 2 framework/source/classes/resource.src | 10 framework/source/uielement/recentfilesmenucontroller.cxx | 20 framework/source/uielement/saveasmenucontroller.cxx | 192 + framework/util/fwk.component | 4 icon-themes/breeze/links.txt | 2 icon-themes/tango/links.txt | 2 include/sfx2/app.hxx | 1 include/sfx2/filedlghelper.hxx | 1 include/sfx2/sfxsids.hrc | 3 include/sfx2/tbxctrl.hxx | 15 include/svtools/PlaceEditDialog.hxx | 8 include/svtools/ServerDetailsControls.hxx | 12 include/svtools/breadcrumb.hxx | 64 include/svtools/foldertree.hxx | 56 include/ucbhelper/simpleauthenticationrequest.hxx | 8 officecfg/registry/data/org/openoffice/Office/Common.xcu | 21 officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu | 8 officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu | 11 officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu | 8 officecfg/registry/data/org/openoffice/Setup.xcu | 1 officecfg/registry/schema/org/openoffice/Office/Common.xcs | 5 sc/source/ui/app/scdll.cxx | 1 sc/uiconfig/scalc/toolbar/standardbar.xml | 3 sfx2/sdi/docslots.sdi | 9 sfx2/sdi/sfx.sdi | 51 sfx2/source/appl/appopen.cxx | 10 sfx2/source/appl/appuno.cxx | 2 sfx2/source/dialog/backingwindow.cxx | 12 sfx2/source/dialog/backingwindow.hxx | 1 sfx2/source/dialog/filedlghelper.cxx | 2 sfx2/source/doc/guisaveas.cxx | 47 sfx2/source/doc/objserv.cxx | 6 sfx2/source/toolbox/tbxitem.cxx | 50 sfx2/uiconfig/ui/startcenter.ui | 44 svtools/Library_svt.mk | 2 svtools/UIConfig_svt.mk | 1 svtools/source/contnr/foldertree.cxx | 116 + svtools/source/control/breadcrumb.cxx | 225 ++ svtools/source/dialogs/PlaceEditDialog.cxx | 99 - svtools/source/dialogs/ServerDetailsControls.cxx | 107 - svtools/uiconfig/ui/placeedit.ui | 826 +++----- svtools/uiconfig/ui/remotefilesdialog.ui | 241 ++ sw/source/uibase/app/swmodule.cxx | 1 sw/uiconfig/swriter/toolbar/standardbar.xml | 3 ucb/source/ucp/cmis/auth_provider.cxx | 2 ucb/source/ucp/cmis/cmis_content.cxx | 9 ucb/source/ucp/cmis/cmis_repo_content.cxx | 5 ucbhelper/source/provider/simpleauthenticationrequest.cxx | 32 63 files changed, 3159 insertions(+), 652 deletions(-)
New commits: commit c09512c30bdaede606547a246d755cda0154cf33 Author: Szymon KÅos <eszka...@gmail.com> Date: Tue Jul 14 20:55:52 2015 +0200 question about overwriting the file only in the save mode Change-Id: Iabb3bc12a8efae65a1c3d221a31c2214de8f6c90 diff --git a/fpicker/source/office/RemoteFilesDialog.cxx b/fpicker/source/office/RemoteFilesDialog.cxx index 6c200ae..ec34e96 100644 --- a/fpicker/source/office/RemoteFilesDialog.cxx +++ b/fpicker/source/office/RemoteFilesDialog.cxx @@ -777,11 +777,14 @@ IMPL_LINK_NOARG ( RemoteFilesDialog, OkHdl ) if ( bExists ) { - OUString sMsg = ResId( STR_SVT_ALREADYEXISTOVERWRITE, *ResMgrHolder::getOrCreate() ); - sMsg = sMsg.replaceFirst( "$filename$", sName ); - ScopedVclPtrInstance< MessageDialog > aBox( this, sMsg, VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO ); - if( aBox->Execute() != RET_YES ) - return 0; + if( m_eMode == REMOTEDLG_MODE_SAVE ) + { + OUString sMsg = ResId( STR_SVT_ALREADYEXISTOVERWRITE, *ResMgrHolder::getOrCreate() ); + sMsg = sMsg.replaceFirst( "$filename$", sName ); + ScopedVclPtrInstance< MessageDialog > aBox( this, sMsg, VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO ); + if( aBox->Execute() != RET_YES ) + return 0; + } } else { commit 84e8159ada9a63ac4fd690406e4295860912ebea Author: Szymon KÅos <eszka...@gmail.com> Date: Tue Jul 14 16:16:06 2015 +0200 FilePickerLastService as a string, not string-list 2 Change-Id: If100617ef968fde94178528327135e15f64c1542 diff --git a/fpicker/source/office/RemoteFilesDialog.cxx b/fpicker/source/office/RemoteFilesDialog.cxx index 5ea0658..6c200ae 100644 --- a/fpicker/source/office/RemoteFilesDialog.cxx +++ b/fpicker/source/office/RemoteFilesDialog.cxx @@ -227,10 +227,7 @@ void RemoteFilesDialog::dispose() std::shared_ptr< comphelper::ConfigurationChanges > batch( comphelper::ConfigurationChanges::create( m_context ) ); - Sequence< OUString > lastService( 1 ); - lastService[0] = m_sLastServiceUrl; - - officecfg::Office::Common::Misc::FilePickerLastService::set( lastService, batch ); + officecfg::Office::Common::Misc::FilePickerLastService::set( m_sLastServiceUrl, batch ); if( m_bIsUpdated ) { @@ -324,10 +321,8 @@ void RemoteFilesDialog::FillServicesListbox() unsigned int nPos = 0; unsigned int i = 0; - Sequence< OUString > lastService( officecfg::Office::Common::Misc::FilePickerLastService::get( m_context ) ); - if( lastService.getLength() > 0 ) - m_sLastServiceUrl = lastService[0]; + m_sLastServiceUrl = officecfg::Office::Common::Misc::FilePickerLastService::get( m_context ); for( sal_Int32 nPlace = 0; nPlace < placesUrlsList.getLength() && nPlace < placesNamesList.getLength(); ++nPlace ) { commit f587314d8d03cc6ac6e112955b401f098e231223 Author: Szymon KÅos <eszka...@gmail.com> Date: Tue Jul 14 16:02:02 2015 +0200 FilePickerLastService as a string, not string-list Change-Id: I7c379e797250be2f61791f5f3260d23ad24d26b3 diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs index 5109e66..220a989 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs @@ -5828,7 +5828,7 @@ <desc>List of names of the places the user bookmarked in the file picker dialog.</desc> </info> </prop> - <prop oor:name="FilePickerLastService" oor:type="oor:string-list" oor:nillable="false"> + <prop oor:name="FilePickerLastService" oor:type="xs:string" oor:nillable="false"> <info> <desc>URL of the last used service in the remote file picker.</desc> </info> commit 84d266fa838a3df1cedbcde5ab98c8a8b23f6b48 Author: Szymon KÅos <eszka...@gmail.com> Date: Tue Jul 14 13:10:53 2015 +0200 RemoteFilesDialog: remember last used service Change-Id: I494b1d43d28d8e6c37ce9d391b37580be6a9be31 diff --git a/fpicker/source/office/RemoteFilesDialog.cxx b/fpicker/source/office/RemoteFilesDialog.cxx index 533940d..5ea0658 100644 --- a/fpicker/source/office/RemoteFilesDialog.cxx +++ b/fpicker/source/office/RemoteFilesDialog.cxx @@ -225,6 +225,13 @@ void RemoteFilesDialog::dispose() { m_pFileView->SetSelectHdl( Link<>() ); + std::shared_ptr< comphelper::ConfigurationChanges > batch( comphelper::ConfigurationChanges::create( m_context ) ); + + Sequence< OUString > lastService( 1 ); + lastService[0] = m_sLastServiceUrl; + + officecfg::Office::Common::Misc::FilePickerLastService::set( lastService, batch ); + if( m_bIsUpdated ) { Sequence< OUString > placesUrlsList( m_aServices.size() ); @@ -238,12 +245,12 @@ void RemoteFilesDialog::dispose() ++i; } - std::shared_ptr< comphelper::ConfigurationChanges > batch( comphelper::ConfigurationChanges::create( m_context ) ); officecfg::Office::Common::Misc::FilePickerPlacesUrls::set( placesUrlsList, batch ); officecfg::Office::Common::Misc::FilePickerPlacesNames::set( placesNamesList, batch ); - batch->commit(); } + batch->commit(); + m_pContainer.disposeAndClear(); // container must be first! m_pTreeView.disposeAndClear(); m_pFileView.disposeAndClear(); @@ -315,6 +322,13 @@ void RemoteFilesDialog::FillServicesListbox() Sequence< OUString > placesUrlsList( officecfg::Office::Common::Misc::FilePickerPlacesUrls::get( m_context ) ); Sequence< OUString > placesNamesList( officecfg::Office::Common::Misc::FilePickerPlacesNames::get( m_context ) ); + unsigned int nPos = 0; + unsigned int i = 0; + Sequence< OUString > lastService( officecfg::Office::Common::Misc::FilePickerLastService::get( m_context ) ); + + if( lastService.getLength() > 0 ) + m_sLastServiceUrl = lastService[0]; + for( sal_Int32 nPlace = 0; nPlace < placesUrlsList.getLength() && nPlace < placesNamesList.getLength(); ++nPlace ) { ServicePtr pService( new Place( placesNamesList[nPlace], placesUrlsList[nPlace], true ) ); @@ -328,12 +342,19 @@ void RemoteFilesDialog::FillServicesListbox() if( !sPrefix.isEmpty() ) sPrefix += ": "; + if( placesUrlsList[nPlace] == m_sLastServiceUrl ) + nPos = i; + m_pServices_lb->InsertEntry( sPrefix + placesNamesList[nPlace] ); + + i++; } } if( m_pServices_lb->GetEntryCount() > 0 ) - m_pServices_lb->SelectEntryPos( 0 ); + { + m_pServices_lb->SelectEntryPos( nPos ); + } EnableControls(); } @@ -507,6 +528,8 @@ IMPL_LINK_NOARG ( RemoteFilesDialog, SelectServiceHdl ) m_pTreeView->Expand( pRoot ); m_pName_ed->GrabFocus(); + + m_sLastServiceUrl = sURL; } } diff --git a/fpicker/source/office/RemoteFilesDialog.hxx b/fpicker/source/office/RemoteFilesDialog.hxx index 3462305..05f9ca1 100644 --- a/fpicker/source/office/RemoteFilesDialog.hxx +++ b/fpicker/source/office/RemoteFilesDialog.hxx @@ -114,6 +114,7 @@ private: OUString m_sPath; OUString m_sStdDir; + OUString m_sLastServiceUrl; unsigned int m_nCurrentFilter; ::com::sun::star::uno::Sequence< OUString > m_aBlackList; diff --git a/officecfg/registry/data/org/openoffice/Office/Common.xcu b/officecfg/registry/data/org/openoffice/Office/Common.xcu index 6394722..8940778 100644 --- a/officecfg/registry/data/org/openoffice/Office/Common.xcu +++ b/officecfg/registry/data/org/openoffice/Office/Common.xcu @@ -568,6 +568,9 @@ <prop oor:name="FilePickerPlacesNames"> <value/> </prop> + <prop oor:name="FilePickerLastService"> + <value/> + </prop> <prop oor:name="CmisServersUrls"> <value> <it>https://www.googleapis.com/drive/v2</it> diff --git a/officecfg/registry/data/org/openoffice/Setup.xcu b/officecfg/registry/data/org/openoffice/Setup.xcu index 9b17125..2a77ab1 100644 --- a/officecfg/registry/data/org/openoffice/Setup.xcu +++ b/officecfg/registry/data/org/openoffice/Setup.xcu @@ -898,6 +898,7 @@ <it>/org.openoffice.Office.Common/Misc/UseSystemPrintDialog</it> <it>/org.openoffice.Office.Common/Misc/FilePickerPlacesNames</it> <it>/org.openoffice.Office.Common/Misc/FilePickerPlacesUrls</it> + <it>/org.openoffice.Office.Common/Misc/FilePickerLastService</it> <it>/org.openoffice.Office.Common/ODF</it> <it>/org.openoffice.Office.Common/Passwords</it> <it>/org.openoffice.Office.Common/Path</it> diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs index 87aa3ed..5109e66 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs @@ -5828,6 +5828,11 @@ <desc>List of names of the places the user bookmarked in the file picker dialog.</desc> </info> </prop> + <prop oor:name="FilePickerLastService" oor:type="oor:string-list" oor:nillable="false"> + <info> + <desc>URL of the last used service in the remote file picker.</desc> + </info> + </prop> <prop oor:name="CmisServersUrls" oor:type="oor:string-list" oor:nillable="false"> <info> <desc>List of sample URLs of the CMIS servers in the place edition dialog.</desc> commit 871d770378809d49c49369faf7fd2ebfe9dc3881 Author: Szymon KÅos <eszka...@gmail.com> Date: Mon Jul 13 16:32:07 2015 +0200 Separators between services types Change-Id: Ibd26abdb83b86256197311bc7a120b4b025ae814 diff --git a/include/svtools/PlaceEditDialog.hxx b/include/svtools/PlaceEditDialog.hxx index de321a2..9cba4d5 100644 --- a/include/svtools/PlaceEditDialog.hxx +++ b/include/svtools/PlaceEditDialog.hxx @@ -51,6 +51,8 @@ private : */ std::vector< std::shared_ptr< DetailsContainer > > m_aDetailsContainers; + unsigned int m_nCurrentType; + public : PlaceEditDialog( vcl::Window* pParent); diff --git a/officecfg/registry/data/org/openoffice/Office/Common.xcu b/officecfg/registry/data/org/openoffice/Office/Common.xcu index a9b1bf7..6394722 100644 --- a/officecfg/registry/data/org/openoffice/Office/Common.xcu +++ b/officecfg/registry/data/org/openoffice/Office/Common.xcu @@ -573,6 +573,7 @@ <it>https://www.googleapis.com/drive/v2</it> <it>https://apis.live.net/v5.0</it> <it>https://api.alfresco.com/cmis/versions/1.0/atom/</it> + <it></it> <it>http://<host:port>/alfresco/cmisatom</it> <it>http://<host>/p8cmis/wsdl</it> <it>https://apps.lotuslive.com/files/basic/cmis/my/servicedoc</it> @@ -583,6 +584,7 @@ <it>http://<host>/_vti_bin/CMISSoapwsdl.aspx</it> <it>http://<host>/_api/Web</it> <it>http://<host>/</it> + <it></it> </value> </prop> <prop oor:name="CmisServersNames"> @@ -590,6 +592,7 @@ <it>Google Drive</it> <it>OneDrive</it> <it>Alfresco Cloud</it> + <it>--------------------</it> <it>Alfresco 4</it> <it>IBM FileNet P8</it> <it>Lotus Live Files</it> @@ -600,6 +603,7 @@ <it>SharePoint 2010</it> <it>SharePoint 2013</it> <it>Other CMIS</it> + <it>--------------------</it> </value> </prop> </node> diff --git a/svtools/source/dialogs/PlaceEditDialog.cxx b/svtools/source/dialogs/PlaceEditDialog.cxx index 0d1dced..482b763 100644 --- a/svtools/source/dialogs/PlaceEditDialog.cxx +++ b/svtools/source/dialogs/PlaceEditDialog.cxx @@ -20,6 +20,7 @@ using namespace com::sun::star::uno; PlaceEditDialog::PlaceEditDialog(vcl::Window* pParent) : ModalDialog(pParent, "PlaceEditDialog", "svt/ui/placeedit.ui") , m_xCurrentDetails() + , m_nCurrentType( 0 ) { get( m_pEDServerName, "name" ); get( m_pLBServerType, "type" ); @@ -249,11 +250,22 @@ IMPL_LINK_NOARG( PlaceEditDialog, EditUsernameHdl ) IMPL_LINK_NOARG( PlaceEditDialog, SelectTypeHdl ) { + if ( m_pLBServerType->GetSelectEntry() == "--------------------" ) + { + if( !m_pLBServerType->IsTravelSelect() ) + m_pLBServerType->SelectEntryPos( m_nCurrentType ); + else + m_pLBServerType->SetNoSelection(); + + return 0; + } + if (m_xCurrentDetails.get()) m_xCurrentDetails->show(false); sal_uInt16 nPos = m_pLBServerType->GetSelectEntryPos( ); m_xCurrentDetails = m_aDetailsContainers[nPos]; + m_nCurrentType = nPos; m_xCurrentDetails->show(true); commit 289eb8a70d8be87e9768f48d3d28cf4f0d47709a Author: Szymon KÅos <eszka...@gmail.com> Date: Mon Jul 13 14:31:15 2015 +0200 removed comment Change-Id: Ia74226be5f7d0776d60f04945c23a5b94cdc11b6 diff --git a/fpicker/source/office/iodlg.hxx b/fpicker/source/office/iodlg.hxx index bb63729..414da3e 100644 --- a/fpicker/source/office/iodlg.hxx +++ b/fpicker/source/office/iodlg.hxx @@ -57,8 +57,7 @@ class SvtFileDialogFilter_Impl; class SvtExpFileDlg_Impl; class CustomContainer; -class SvtFileDialog : //public ModalDialog, public ::svt::IFilePickerController, -public SvtFileDialog_Base +class SvtFileDialog : public SvtFileDialog_Base { private: VclPtr<CheckBox> _pCbReadOnly; commit 2239b486bffaeffafc24ed1b135aa70f3cdd8b1a Author: Szymon KÅos <eszka...@gmail.com> Date: Mon Jul 13 14:29:09 2015 +0200 RemoteFilesDialog moved to fpicker Change-Id: I8e978d40ee022d15f482aec4567c3171b75b9720 diff --git a/fpicker/Library_fps_office.mk b/fpicker/Library_fps_office.mk index c109dce..6c484a0 100644 --- a/fpicker/Library_fps_office.mk +++ b/fpicker/Library_fps_office.mk @@ -49,6 +49,7 @@ $(eval $(call gb_Library_add_exception_objects,fps_office,\ fpicker/source/office/OfficeFilePicker \ fpicker/source/office/OfficeFolderPicker \ fpicker/source/office/PlacesListBox \ + fpicker/source/office/RemoteFilesDialog \ )) # vim: set noet sw=4 ts=4: diff --git a/fpicker/source/office/OfficeFilePicker.cxx b/fpicker/source/office/OfficeFilePicker.cxx index 5846e58..917a520 100644 --- a/fpicker/source/office/OfficeFilePicker.cxx +++ b/fpicker/source/office/OfficeFilePicker.cxx @@ -20,7 +20,7 @@ #include "OfficeFilePicker.hxx" #include "iodlg.hxx" -#include <svtools/RemoteFilesDialog.hxx> +#include "RemoteFilesDialog.hxx" #include <list> #include <functional> diff --git a/svtools/source/dialogs/RemoteFilesDialog.cxx b/fpicker/source/office/RemoteFilesDialog.cxx similarity index 98% rename from svtools/source/dialogs/RemoteFilesDialog.cxx rename to fpicker/source/office/RemoteFilesDialog.cxx index 2eea459..533940d 100644 --- a/svtools/source/dialogs/RemoteFilesDialog.cxx +++ b/fpicker/source/office/RemoteFilesDialog.cxx @@ -7,7 +7,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include <svtools/RemoteFilesDialog.hxx> +#include "RemoteFilesDialog.hxx" class FileViewContainer : public vcl::Window { @@ -757,7 +757,15 @@ IMPL_LINK_NOARG ( RemoteFilesDialog, OkHdl ) bExists = false; } - if ( !bExists ) + if ( bExists ) + { + OUString sMsg = ResId( STR_SVT_ALREADYEXISTOVERWRITE, *ResMgrHolder::getOrCreate() ); + sMsg = sMsg.replaceFirst( "$filename$", sName ); + ScopedVclPtrInstance< MessageDialog > aBox( this, sMsg, VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO ); + if( aBox->Execute() != RET_YES ) + return 0; + } + else { if( m_eMode == REMOTEDLG_MODE_OPEN ) return 0; diff --git a/include/svtools/RemoteFilesDialog.hxx b/fpicker/source/office/RemoteFilesDialog.hxx similarity index 96% rename from include/svtools/RemoteFilesDialog.hxx rename to fpicker/source/office/RemoteFilesDialog.hxx index db61e17..3462305 100644 --- a/include/svtools/RemoteFilesDialog.hxx +++ b/fpicker/source/office/RemoteFilesDialog.hxx @@ -11,13 +11,15 @@ #define INCLUDED_SVTOOLS_REMOTEFILESDIALOG_HXX #include <svtools/foldertree.hxx> -#include <svtools/svtdllapi.h> #include <svtools/place.hxx> #include <svtools/PlaceEditDialog.hxx> #include <svtools/breadcrumb.hxx> #include <svtools/fileview.hxx> +#include <tools/resid.hxx> + #include <vcl/button.hxx> +#include <vcl/fpicker.hrc> #include <vcl/menubtn.hxx> #include <vcl/dialog.hxx> #include <vcl/vclptr.hxx> @@ -30,7 +32,8 @@ #include <vector> -#include "../../../fpicker/source/office/fpdialogbase.hxx" +#include "fpdialogbase.hxx" +#include "fpsofficeResMgr.hxx" using namespace ::com::sun::star::beans; using namespace ::com::sun::star::uno; @@ -53,7 +56,7 @@ typedef ::com::sun::star::uno::Sequence< OUString > OUStringList; class FileViewContainer; -class SVT_DLLPUBLIC RemoteFilesDialog : public SvtFileDialog_Base +class RemoteFilesDialog : public SvtFileDialog_Base { public: RemoteFilesDialog( vcl::Window* pParent, WinBits nBits ); diff --git a/svtools/Library_svt.mk b/svtools/Library_svt.mk index 20a4c2f..f6c834d 100644 --- a/svtools/Library_svt.mk +++ b/svtools/Library_svt.mk @@ -139,7 +139,6 @@ $(eval $(call gb_Library_add_exception_objects,svt,\ svtools/source/dialogs/mcvmath \ svtools/source/dialogs/PlaceEditDialog \ svtools/source/dialogs/prnsetup \ - svtools/source/dialogs/RemoteFilesDialog \ svtools/source/dialogs/restartdialog \ svtools/source/dialogs/roadmapwizard \ svtools/source/dialogs/ServerDetailsControls \ commit 1abade4f92a6d1c70ab3e333770e1cb242f29063 Author: Szymon KÅos <eszka...@gmail.com> Date: Mon Jul 13 12:01:12 2015 +0200 moved the FolderTree class Change-Id: I3231b32d3e3ade7dc3b366f03d6e189f5bc4d431 diff --git a/include/svtools/RemoteFilesDialog.hxx b/include/svtools/RemoteFilesDialog.hxx index fd12f39..db61e17 100644 --- a/include/svtools/RemoteFilesDialog.hxx +++ b/include/svtools/RemoteFilesDialog.hxx @@ -10,18 +10,15 @@ #ifndef INCLUDED_SVTOOLS_REMOTEFILESDIALOG_HXX #define INCLUDED_SVTOOLS_REMOTEFILESDIALOG_HXX +#include <svtools/foldertree.hxx> #include <svtools/svtdllapi.h> #include <svtools/place.hxx> #include <svtools/PlaceEditDialog.hxx> -#include <svtools/svtools.hrc> -#include <svtools/svtresid.hxx> #include <svtools/breadcrumb.hxx> #include <svtools/fileview.hxx> -#include <svtools/treelistentry.hxx> #include <vcl/button.hxx> #include <vcl/menubtn.hxx> -#include <vcl/lstbox.hxx> #include <vcl/dialog.hxx> #include <vcl/vclptr.hxx> #include <vcl/split.hxx> @@ -30,11 +27,6 @@ #include <officecfg/Office/Common.hxx> #include <com/sun/star/beans/StringPair.hpp> #include <com/sun/star/uno/Sequence.hxx> -#include <com/sun/star/ucb/XCommandEnvironment.hpp> -#include <com/sun/star/ucb/XProgressHandler.hpp> -#include <com/sun/star/task/XInteractionHandler.hpp> -#include <com/sun/star/task/InteractionHandler.hpp> -#include <ucbhelper/commandenvironment.hxx> #include <vector> @@ -42,11 +34,7 @@ using namespace ::com::sun::star::beans; using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::ucb; -using namespace ::com::sun::star::task; using namespace ::com::sun::star::ui::dialogs; -using namespace ::comphelper; -using namespace ::svt; enum SvtRemoteDlgMode { @@ -64,8 +52,6 @@ typedef std::shared_ptr< Place > ServicePtr; typedef ::com::sun::star::uno::Sequence< OUString > OUStringList; class FileViewContainer; -class Breadcrumb; -class FolderTree; class SVT_DLLPUBLIC RemoteFilesDialog : public SvtFileDialog_Base { diff --git a/include/svtools/foldertree.hxx b/include/svtools/foldertree.hxx new file mode 100644 index 0000000..213c254 --- /dev/null +++ b/include/svtools/foldertree.hxx @@ -0,0 +1,56 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef INCLUDED_SVTOOLS_FOLDERTREE_HXX +#define INCLUDED_SVTOOLS_FOLDERTREE_HXX + +#include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/ucb/XCommandEnvironment.hpp> +#include <com/sun/star/task/InteractionHandler.hpp> + +#include <officecfg/Office/Common.hxx> + +#include <svtools/svtdllapi.h> +#include <svtools/svtools.hrc> +#include <svtools/svtresid.hxx> +#include <svtools/treelistentry.hxx> + +#include <tools/urlobj.hxx> + +#include <ucbhelper/commandenvironment.hxx> + +#include <vcl/image.hxx> +#include <vcl/lstbox.hxx> + +using namespace ::com::sun::star::ucb; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::task; +using namespace ::svt; + +class SVT_DLLPUBLIC FolderTree : public SvTreeListBox +{ +private: + Reference< XCommandEnvironment > m_xEnv; + ::osl::Mutex m_aMutex; + Sequence< OUString > m_aBlackList; + Image m_aFolderImage; + +public: + FolderTree( vcl::Window* pParent, WinBits nBits ); + + virtual void RequestingChildren( SvTreeListEntry* pEntry ); + + void FillTreeEntry( SvTreeListEntry* pEntry ); + void SetTreePath( OUString sUrl ); + void SetBlackList( const ::com::sun::star::uno::Sequence< OUString >& rBlackList ); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/Library_svt.mk b/svtools/Library_svt.mk index e3ce0a0..20a4c2f 100644 --- a/svtools/Library_svt.mk +++ b/svtools/Library_svt.mk @@ -92,6 +92,7 @@ $(eval $(call gb_Library_add_exception_objects,svt,\ svtools/source/contnr/DocumentInfoPreview \ svtools/source/contnr/contentenumeration \ svtools/source/contnr/fileview \ + svtools/source/contnr/foldertree \ svtools/source/contnr/imivctl1 \ svtools/source/contnr/imivctl2 \ svtools/source/contnr/ivctrl \ diff --git a/svtools/source/contnr/foldertree.cxx b/svtools/source/contnr/foldertree.cxx new file mode 100644 index 0000000..b4c27fd --- /dev/null +++ b/svtools/source/contnr/foldertree.cxx @@ -0,0 +1,116 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include <svtools/foldertree.hxx> + +#include "contentenumeration.hxx" + +FolderTree::FolderTree( vcl::Window* pParent, WinBits nBits ) + : SvTreeListBox( pParent, nBits | WB_SORT | WB_TABSTOP ) + , m_aFolderImage( SvtResId( IMG_SVT_FOLDER ) ) +{ + Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + Reference< XInteractionHandler > xInteractionHandler( + InteractionHandler::createWithParent( xContext, 0 ), UNO_QUERY_THROW ); + m_xEnv = new ::ucbhelper::CommandEnvironment( xInteractionHandler, Reference< XProgressHandler >() ); + + SetDefaultCollapsedEntryBmp( m_aFolderImage ); + SetDefaultExpandedEntryBmp( m_aFolderImage ); +} + +void FolderTree::RequestingChildren( SvTreeListEntry* pEntry ) +{ + FillTreeEntry( pEntry ); +} + +void FolderTree::FillTreeEntry( SvTreeListEntry* pEntry ) +{ + // fill only empty entries + if( pEntry && GetChildCount( pEntry ) == 0 ) + { + ::std::vector< SortingData_Impl* > aContent; + + FileViewContentEnumerator* pContentEnumerator = new FileViewContentEnumerator( + m_xEnv, aContent, m_aMutex, NULL ); + + OUString* pURL = static_cast< OUString* >( pEntry->GetUserData() ); + + if( pURL ) + { + FolderDescriptor aFolder( *pURL ); + + EnumerationResult eResult = + pContentEnumerator->enumerateFolderContentSync( aFolder, m_aBlackList ); + + if ( SUCCESS == eResult ) + { + for( unsigned int i = 0; i < aContent.size(); i++ ) + { + if( aContent[i]->mbIsFolder ) + { + SvTreeListEntry* pNewEntry = InsertEntry( aContent[i]->GetTitle(), pEntry, true ); + + OUString* sData = new OUString( aContent[i]->maTargetURL ); + pNewEntry->SetUserData( static_cast< void* >( sData ) ); + } + } + } + } + } +} + +void FolderTree::SetTreePath( OUString sUrl ) +{ + INetURLObject aUrl( sUrl ); + aUrl.setFinalSlash(); + + OUString sPath = aUrl.GetURLPath( INetURLObject::DECODE_WITH_CHARSET ); + + SvTreeListEntry* pEntry = First(); + bool end = false; + + while( pEntry && !end ) + { + if( pEntry->GetUserData() ) + { + OUString sNodeUrl = *static_cast< OUString* >( pEntry->GetUserData() ); + + INetURLObject aUrlObj( sNodeUrl ); + aUrlObj.setFinalSlash(); + + sNodeUrl = aUrlObj.GetURLPath( INetURLObject::DECODE_WITH_CHARSET ); + + if( sPath == sNodeUrl ) + { + Select( pEntry ); + end = true; + } + else if( sPath.startsWith( sNodeUrl ) ) + { + if( !IsExpanded( pEntry ) ) + Expand( pEntry ); + + pEntry = FirstChild( pEntry ); + } + else + { + pEntry = NextSibling( pEntry ); + } + } + else + break; + } +} + +void FolderTree::SetBlackList( const ::com::sun::star::uno::Sequence< OUString >& rBlackList ) +{ + m_aBlackList = rBlackList; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/dialogs/RemoteFilesDialog.cxx b/svtools/source/dialogs/RemoteFilesDialog.cxx index 41391e7..2eea459 100644 --- a/svtools/source/dialogs/RemoteFilesDialog.cxx +++ b/svtools/source/dialogs/RemoteFilesDialog.cxx @@ -8,119 +8,6 @@ */ #include <svtools/RemoteFilesDialog.hxx> -#include "../contnr/contentenumeration.hxx" - -class FolderTree : public SvTreeListBox -{ -private: - Reference< XCommandEnvironment > m_xEnv; - ::osl::Mutex m_aMutex; - Sequence< OUString > m_aBlackList; - Image m_aFolderImage; - -public: - FolderTree( vcl::Window* pParent, WinBits nBits ) - : SvTreeListBox( pParent, nBits | WB_SORT | WB_TABSTOP ) - , m_aFolderImage( SvtResId( IMG_SVT_FOLDER ) ) - { - Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext(); - Reference< XInteractionHandler > xInteractionHandler( - InteractionHandler::createWithParent( xContext, 0 ), UNO_QUERY_THROW ); - m_xEnv = new ::ucbhelper::CommandEnvironment( xInteractionHandler, Reference< XProgressHandler >() ); - - SetDefaultCollapsedEntryBmp( m_aFolderImage ); - SetDefaultExpandedEntryBmp( m_aFolderImage ); - } - - virtual void RequestingChildren( SvTreeListEntry* pEntry ) - { - FillTreeEntry( pEntry ); - } - - void FillTreeEntry( SvTreeListEntry* pEntry ) - { - // fill only empty entries - if( pEntry && GetChildCount( pEntry ) == 0 ) - { - ::std::vector< SortingData_Impl* > aContent; - - FileViewContentEnumerator* pContentEnumerator = new FileViewContentEnumerator( - m_xEnv, aContent, m_aMutex, NULL ); - - OUString* pURL = static_cast< OUString* >( pEntry->GetUserData() ); - - if( pURL ) - { - FolderDescriptor aFolder( *pURL ); - - EnumerationResult eResult = - pContentEnumerator->enumerateFolderContentSync( aFolder, m_aBlackList ); - - if ( SUCCESS == eResult ) - { - for( unsigned int i = 0; i < aContent.size(); i++ ) - { - if( aContent[i]->mbIsFolder ) - { - SvTreeListEntry* pNewEntry = InsertEntry( aContent[i]->GetTitle(), pEntry, true ); - - OUString* sData = new OUString( aContent[i]->maTargetURL ); - pNewEntry->SetUserData( static_cast< void* >( sData ) ); - } - } - } - } - } - } - - void SetTreePath( OUString sUrl ) - { - INetURLObject aUrl( sUrl ); - aUrl.setFinalSlash(); - - OUString sPath = aUrl.GetURLPath( INetURLObject::DECODE_WITH_CHARSET ); - - SvTreeListEntry* pEntry = First(); - bool end = false; - - while( pEntry && !end ) - { - if( pEntry->GetUserData() ) - { - OUString sNodeUrl = *static_cast< OUString* >( pEntry->GetUserData() ); - - INetURLObject aUrlObj( sNodeUrl ); - aUrlObj.setFinalSlash(); - - sNodeUrl = aUrlObj.GetURLPath( INetURLObject::DECODE_WITH_CHARSET ); - - if( sPath == sNodeUrl ) - { - Select( pEntry ); - end = true; - } - else if( sPath.startsWith( sNodeUrl ) ) - { - if( !IsExpanded( pEntry ) ) - Expand( pEntry ); - - pEntry = FirstChild( pEntry ); - } - else - { - pEntry = NextSibling( pEntry ); - } - } - else - break; - } - } - - void SetBlackList( const ::com::sun::star::uno::Sequence< OUString >& rBlackList ) - { - m_aBlackList = rBlackList; - } -}; class FileViewContainer : public vcl::Window { commit 1c25093f8abf518e9983b9d23f6f3964001a1aac Author: Szymon KÅos <eszka...@gmail.com> Date: Mon Jul 13 11:08:36 2015 +0200 tree settings moved inside class Change-Id: I1cf0eb30f143e311a6a8c731f6dcc8e7ad7e4e5d diff --git a/include/svtools/RemoteFilesDialog.hxx b/include/svtools/RemoteFilesDialog.hxx index f1dc755..fd12f39 100644 --- a/include/svtools/RemoteFilesDialog.hxx +++ b/include/svtools/RemoteFilesDialog.hxx @@ -122,7 +122,6 @@ private: bool m_bMultiselection; bool m_bIsUpdated; bool m_bIsConnected; - Image m_aFolderImage; OUString m_sPath; OUString m_sStdDir; diff --git a/svtools/source/dialogs/RemoteFilesDialog.cxx b/svtools/source/dialogs/RemoteFilesDialog.cxx index b3aaaed..41391e7 100644 --- a/svtools/source/dialogs/RemoteFilesDialog.cxx +++ b/svtools/source/dialogs/RemoteFilesDialog.cxx @@ -16,15 +16,20 @@ private: Reference< XCommandEnvironment > m_xEnv; ::osl::Mutex m_aMutex; Sequence< OUString > m_aBlackList; + Image m_aFolderImage; public: FolderTree( vcl::Window* pParent, WinBits nBits ) - : SvTreeListBox( pParent, nBits ) + : SvTreeListBox( pParent, nBits | WB_SORT | WB_TABSTOP ) + , m_aFolderImage( SvtResId( IMG_SVT_FOLDER ) ) { Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext(); Reference< XInteractionHandler > xInteractionHandler( InteractionHandler::createWithParent( xContext, 0 ), UNO_QUERY_THROW ); m_xEnv = new ::ucbhelper::CommandEnvironment( xInteractionHandler, Reference< XProgressHandler >() ); + + SetDefaultCollapsedEntryBmp( m_aFolderImage ); + SetDefaultExpandedEntryBmp( m_aFolderImage ); } virtual void RequestingChildren( SvTreeListEntry* pEntry ) @@ -237,7 +242,6 @@ class FileViewContainer : public vcl::Window RemoteFilesDialog::RemoteFilesDialog( vcl::Window* pParent, WinBits nBits ) : SvtFileDialog_Base( pParent, "RemoteFilesDialog", "svt/ui/remotefilesdialog.ui" ) , m_context( comphelper::getProcessComponentContext() ) - , m_aFolderImage( SvtResId( IMG_SVT_FOLDER ) ) , m_pSplitter( NULL ) , m_pFileView( NULL ) , m_pContainer( NULL ) @@ -293,14 +297,12 @@ RemoteFilesDialog::RemoteFilesDialog( vcl::Window* pParent, WinBits nBits ) m_pSplitter->SetSplitHdl( LINK( this, RemoteFilesDialog, SplitHdl ) ); m_pSplitter->Show(); - m_pTreeView = VclPtr< FolderTree >::Create( m_pContainer, WB_BORDER | WB_SORT | WB_TABSTOP ); + m_pTreeView = VclPtr< FolderTree >::Create( m_pContainer, WB_BORDER ); Size aSize( 100, 200 ); m_pTreeView->set_height_request( aSize.Height() ); m_pTreeView->set_width_request( aSize.Width() ); m_pTreeView->SetSizePixel( aSize ); m_pTreeView->Show(); - m_pTreeView->SetDefaultCollapsedEntryBmp( m_aFolderImage ); - m_pTreeView->SetDefaultExpandedEntryBmp( m_aFolderImage ); m_pTreeView->SetSelectHdl( LINK( this, RemoteFilesDialog, TreeSelectHdl ) ); commit 1ccb11bc32265ce9916ca594adae727c685d0b32 Author: Szymon KÅos <eszka...@gmail.com> Date: Fri Jul 10 21:35:02 2015 +0200 don't expand last url level in the tree Change-Id: Iea4f650374921f1c50d8edeac384841113640d5e diff --git a/svtools/source/dialogs/RemoteFilesDialog.cxx b/svtools/source/dialogs/RemoteFilesDialog.cxx index 6b4e39b..b3aaaed 100644 --- a/svtools/source/dialogs/RemoteFilesDialog.cxx +++ b/svtools/source/dialogs/RemoteFilesDialog.cxx @@ -92,10 +92,6 @@ public: if( sPath == sNodeUrl ) { Select( pEntry ); - - if( !IsExpanded( pEntry ) ) - Expand( pEntry ); - end = true; } else if( sPath.startsWith( sNodeUrl ) ) commit 353a8cf59c5cc76444dd0692f0ab7c7f66f45493 Author: Szymon KÅos <eszka...@gmail.com> Date: Fri Jul 10 18:11:11 2015 +0200 Open/Save button should be the default button Change-Id: If2dc98beaff9cefcaf87be8773077524e2f5cb90 diff --git a/svtools/uiconfig/ui/remotefilesdialog.ui b/svtools/uiconfig/ui/remotefilesdialog.ui index 0ba817b..cd73846 100644 --- a/svtools/uiconfig/ui/remotefilesdialog.ui +++ b/svtools/uiconfig/ui/remotefilesdialog.ui @@ -22,8 +22,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="can_default">True</property> - <property name="has_default">True</property> - <property name="receives_default">True</property> + <property name="receives_default">False</property> <property name="use_stock">True</property> </object> <packing> @@ -37,6 +36,7 @@ <property name="label">gtk-open</property> <property name="can_focus">True</property> <property name="can_default">True</property> + <property name="has_default">True</property> <property name="receives_default">True</property> <property name="use_stock">True</property> </object> @@ -51,6 +51,7 @@ <property name="label">gtk-save</property> <property name="can_focus">True</property> <property name="can_default">True</property> + <property name="has_default">True</property> <property name="receives_default">True</property> <property name="use_stock">True</property> </object> commit 35e3defe9ab17494fa1f240e46fc2bd9bc043c1c Author: Szymon KÅos <eszka...@gmail.com> Date: Fri Jul 10 17:38:04 2015 +0200 Container should be disposed before childs Change-Id: Ia6feb9c57ce574236e4763c61484fb5a14e55ff4 diff --git a/svtools/source/dialogs/RemoteFilesDialog.cxx b/svtools/source/dialogs/RemoteFilesDialog.cxx index 4d5c619..6b4e39b 100644 --- a/svtools/source/dialogs/RemoteFilesDialog.cxx +++ b/svtools/source/dialogs/RemoteFilesDialog.cxx @@ -196,6 +196,9 @@ class FileViewContainer : public vcl::Window void changeFocus( bool bReverse ) { + if( !m_pFileView || !m_pTreeView ) + return; + if( !bReverse && m_nCurrentFocus < 4 ) { m_pFocusWidgets[++m_nCurrentFocus]->SetFakeFocus( true ); @@ -210,6 +213,9 @@ class FileViewContainer : public vcl::Window virtual void GetFocus() SAL_OVERRIDE { + if( !m_pFileView || !m_pTreeView ) + return; + m_nCurrentFocus = 1; m_pFocusWidgets[m_nCurrentFocus]->SetFakeFocus( true ); m_pFocusWidgets[m_nCurrentFocus]->GrabFocus(); @@ -353,10 +359,10 @@ void RemoteFilesDialog::dispose() batch->commit(); } + m_pContainer.disposeAndClear(); // container must be first! m_pTreeView.disposeAndClear(); m_pFileView.disposeAndClear(); m_pSplitter.disposeAndClear(); - m_pContainer.disposeAndClear(); m_pPath.disposeAndClear(); m_pOk_btn.clear(); commit 0207ef8930cf047d8e1894e12148addbf27e70f1 Author: Szymon KÅos <eszka...@gmail.com> Date: Fri Jul 10 16:21:41 2015 +0200 If user cancels authorization, don't show login dialog again Change-Id: I4b110c041f1b8908fdfeeec3b4544f8607f23ddb diff --git a/ucb/source/ucp/cmis/cmis_content.cxx b/ucb/source/ucp/cmis/cmis_content.cxx index 664ddfc..7be8c45 100644 --- a/ucb/source/ucp/cmis/cmis_content.cxx +++ b/ucb/source/ucp/cmis/cmis_content.cxx @@ -377,6 +377,11 @@ namespace cmis else { // Silently fail as the user cancelled the authentication + ucbhelper::cancelCommandExecution( + ucb::IOErrorCode_ABORT, + uno::Sequence< uno::Any >( 0 ), + xEnv, + OUString( ) ); throw uno::RuntimeException( ); } } commit bfbfdc95c68a6ba985daa174b8c30c28c89f9853 Author: Szymon KÅos <eszka...@gmail.com> Date: Fri Jul 10 15:31:48 2015 +0200 PlaceEditDialog: only one error after failed auth Change-Id: I215de03282b3692ebfdc6a7a0e9fd02ecc04f722 diff --git a/svtools/source/dialogs/ServerDetailsControls.cxx b/svtools/source/dialogs/ServerDetailsControls.cxx index 46b5b05..e2f3ddc 100644 --- a/svtools/source/dialogs/ServerDetailsControls.cxx +++ b/svtools/source/dialogs/ServerDetailsControls.cxx @@ -411,10 +411,6 @@ IMPL_LINK_NOARG( CmisDetailsContainer, RefreshReposHdl ) } catch ( const Exception& ) { - ScopedVclPtrInstance< ErrorBox > pErrorBox( static_cast< vcl::Window* >( NULL ), - WB_OK, - "Auth failed!" ); - pErrorBox->Execute( ); } // Auto-select the first one diff --git a/ucb/source/ucp/cmis/cmis_repo_content.cxx b/ucb/source/ucp/cmis/cmis_repo_content.cxx index 5128b70..82ca6b3 100644 --- a/ucb/source/ucp/cmis/cmis_repo_content.cxx +++ b/ucb/source/ucp/cmis/cmis_repo_content.cxx @@ -202,7 +202,11 @@ namespace cmis catch (const libcmis::Exception& e) { SAL_INFO( "ucb.ucp.cmis", "Error getting repositories: " << e.what() ); - throw uno::Exception( ); + ucbhelper::cancelCommandExecution( + ucb::IOErrorCode_INVALID_DEVICE, + uno::Sequence< uno::Any >( 0 ), + xEnv, + OUString( ) ); } } else commit 331c1633b49f6c2110fb249709c9430a4f2efd89 Author: Szymon KÅos <eszka...@gmail.com> Date: Fri Jul 10 13:20:06 2015 +0200 Check if OK button should be enabled after changing service type Change-Id: I64ce981846f4107c8f38e413f1e6eb9e5616ef87 diff --git a/svtools/source/dialogs/PlaceEditDialog.cxx b/svtools/source/dialogs/PlaceEditDialog.cxx index bbc1f43..0d1dced 100644 --- a/svtools/source/dialogs/PlaceEditDialog.cxx +++ b/svtools/source/dialogs/PlaceEditDialog.cxx @@ -258,6 +258,9 @@ IMPL_LINK_NOARG( PlaceEditDialog, SelectTypeHdl ) m_xCurrentDetails->show(true); SetSizePixel(GetOptimalSize()); + + EditHdl(NULL); + return 0; } commit d58582a6ce0b85fd6cf699d3c935fe4c7257c5b4 Author: Szymon KÅos <eszka...@gmail.com> Date: Fri Jul 10 12:58:58 2015 +0200 Add prefix to the name after editing service Change-Id: Icca2436e5a3782829971bf9e672bbddab81cc97f diff --git a/svtools/source/dialogs/RemoteFilesDialog.cxx b/svtools/source/dialogs/RemoteFilesDialog.cxx index d27fccc..4d5c619 100644 --- a/svtools/source/dialogs/RemoteFilesDialog.cxx +++ b/svtools/source/dialogs/RemoteFilesDialog.cxx @@ -643,7 +643,13 @@ IMPL_LINK_TYPED ( RemoteFilesDialog, EditServiceMenuHdl, MenuButton *, pButton, m_aServices[nPos] = pEditedService; m_pServices_lb->RemoveEntry( nSelected ); - m_pServices_lb->InsertEntry( pEditedService->GetName(), nSelected ); + + OUString sPrefix = lcl_GetServiceType( pEditedService ); + + if(!sPrefix.isEmpty()) + sPrefix += ": "; + + m_pServices_lb->InsertEntry( sPrefix + pEditedService->GetName(), nSelected ); m_pServices_lb->SelectEntryPos( nSelected ); m_bIsUpdated = true; commit e211999cdf2e54bf15670a89607622737e4acf44 Author: Szymon KÅos <eszka...@gmail.com> Date: Fri Jul 10 12:46:58 2015 +0200 PlaceEditDialog: Remember the repository id if wasn't changed Change-Id: Ib5e63bec0b6b3c2d7d0dc2c114656737979ef6d0 diff --git a/svtools/source/dialogs/ServerDetailsControls.cxx b/svtools/source/dialogs/ServerDetailsControls.cxx index 3fc26c4..46b5b05 100644 --- a/svtools/source/dialogs/ServerDetailsControls.cxx +++ b/svtools/source/dialogs/ServerDetailsControls.cxx @@ -329,12 +329,10 @@ bool CmisDetailsContainer::setUrl( const INetURLObject& rUrl ) if ( bSuccess ) { - OUString sRepositoryId; - OUString sDecodedHost = rUrl.GetHost( INetURLObject::DECODE_WITH_CHARSET ); INetURLObject aHostUrl( sDecodedHost ); m_sBinding = aHostUrl.GetURLNoMark( ); - sRepositoryId = aHostUrl.GetMark( ); + m_sRepoId = aHostUrl.GetMark( ); m_pEDBinding->SetText( m_sBinding ); m_pEDRoot->SetText( rUrl.GetURLPath() ); commit c7079800dd584ca1d3bd34a6e3fe6bb5402cb31e Author: Szymon KÅos <eszka...@gmail.com> Date: Fri Jul 10 11:52:17 2015 +0200 RemoteFilesDialog: safe doubleclick on file view Change-Id: I651c8274dfb2776e63c32f0b45d9daf57e5970c6 diff --git a/svtools/source/dialogs/RemoteFilesDialog.cxx b/svtools/source/dialogs/RemoteFilesDialog.cxx index 869fcdf..d27fccc 100644 --- a/svtools/source/dialogs/RemoteFilesDialog.cxx +++ b/svtools/source/dialogs/RemoteFilesDialog.cxx @@ -687,17 +687,24 @@ IMPL_LINK_TYPED ( RemoteFilesDialog, EditServiceMenuHdl, MenuButton *, pButton, IMPL_LINK_NOARG ( RemoteFilesDialog, DoubleClickHdl ) { SvTreeListEntry* pEntry = m_pFileView->FirstSelected(); - SvtContentEntry* pData = static_cast< SvtContentEntry* >( pEntry->GetUserData() ); - if( pData->mbIsFolder ) + if( pEntry ) { - OUString sURL = m_pFileView->GetCurrentURL(); + SvtContentEntry* pData = static_cast< SvtContentEntry* >( pEntry->GetUserData() ); - OpenURL( sURL ); - } - else - { - EndDialog( RET_OK ); + if( pData ) + { + if( pData->mbIsFolder ) + { + OUString sURL = m_pFileView->GetCurrentURL(); + + OpenURL( sURL ); + } + else + { + EndDialog( RET_OK ); + } + } } return 1; commit 31664660b2e1b3fec79ef7ae259be0d2e0e34861 Author: Szymon KÅos <eszka...@gmail.com> Date: Fri Jul 10 11:33:23 2015 +0200 RemoteFilesDialog: auto file extension in the save mode Change-Id: I7b1dd5cc330de0c1ad713d68d93e7d12375033c6 diff --git a/include/svtools/RemoteFilesDialog.hxx b/include/svtools/RemoteFilesDialog.hxx index 44fce0c..f1dc755 100644 --- a/include/svtools/RemoteFilesDialog.hxx +++ b/include/svtools/RemoteFilesDialog.hxx @@ -153,6 +153,8 @@ private: FileViewResult OpenURL( OUString sURL ); + void AddFileExtension(); + void EnableControls(); DECL_LINK ( AddServiceHdl, void * ); diff --git a/svtools/source/dialogs/RemoteFilesDialog.cxx b/svtools/source/dialogs/RemoteFilesDialog.cxx index 03fa023..869fcdf 100644 --- a/svtools/source/dialogs/RemoteFilesDialog.cxx +++ b/svtools/source/dialogs/RemoteFilesDialog.cxx @@ -517,6 +517,23 @@ FileViewResult RemoteFilesDialog::OpenURL( OUString sURL ) return eResult; } +void RemoteFilesDialog::AddFileExtension() +{ + if( m_nCurrentFilter != LISTBOX_ENTRY_NOTFOUND ) + { + OUString sExt = m_aFilters[m_nCurrentFilter].second; + OUString sFileName = m_pName_ed->GetText(); + + sal_Int32 nDotPos = sFileName.lastIndexOf( '.' ); + + if ( nDotPos == -1 ) + { + sFileName += sExt.copy( 1 ); // without '*' + m_pName_ed->SetText( sFileName ); + } + } +} + void RemoteFilesDialog::EnableControls() { if( m_pServices_lb->GetEntryCount() > 0 ) @@ -787,6 +804,10 @@ IMPL_LINK ( RemoteFilesDialog, SelectBreadcrumbHdl, Breadcrumb*, pPtr ) IMPL_LINK_NOARG ( RemoteFilesDialog, OkHdl ) { + // auto extension + if( m_eMode == REMOTEDLG_MODE_SAVE ) + AddFileExtension(); + // check if file/path exists OUString sCurrentPath = m_pFileView->GetViewURL(); commit 16ba8ede0af90516c9293b76f2f3a534e944b832 Author: Szymon KÅos <eszka...@gmail.com> Date: Thu Jul 9 17:01:11 2015 +0200 RemoteFilesDialog: fixes needed for saving documents Change-Id: I3134f82d81ed2c2de7d6197fbec5610b53814e1e diff --git a/svtools/source/dialogs/RemoteFilesDialog.cxx b/svtools/source/dialogs/RemoteFilesDialog.cxx index 05f1ac9..03fa023 100644 --- a/svtools/source/dialogs/RemoteFilesDialog.cxx +++ b/svtools/source/dialogs/RemoteFilesDialog.cxx @@ -494,7 +494,12 @@ FileViewResult RemoteFilesDialog::OpenURL( OUString sURL ) if( m_pFileView ) { - OUString sFilter = GetCurFilter(); + OUString sFilter = FILEDIALOG_FILTER_ALL; + + if( m_nCurrentFilter != LISTBOX_ENTRY_NOTFOUND ) + { + sFilter = m_aFilters[m_nCurrentFilter].second; + } m_pFileView->EndInplaceEditing( false ); eResult = m_pFileView->Initialize( sURL, sFilter, NULL, GetBlackList() ); @@ -791,9 +796,12 @@ IMPL_LINK_NOARG ( RemoteFilesDialog, OkHdl ) bool bFileDlg = ( m_eType == REMOTEDLG_TYPE_FILEDLG ); bool bSelected = ( m_pFileView->GetSelectionCount() > 0 ); + if( !sCurrentPath.endsWith( OUString( "/" ) ) ) + sCurrentPath += OUString( "/" ); + if( !bSelected ) { - m_sPath = sCurrentPath + "/" + INetURLObject::encode( sName, INetURLObject::PART_FPATH, INetURLObject::ENCODE_ALL ); + m_sPath = sCurrentPath + INetURLObject::encode( sName, INetURLObject::PART_FPATH, INetURLObject::ENCODE_ALL ); } else { @@ -826,14 +834,11 @@ IMPL_LINK_NOARG ( RemoteFilesDialog, OkHdl ) if ( !bExists ) { - // TODO - - return 0; + if( m_eMode == REMOTEDLG_MODE_OPEN ) + return 0; } - if( bExists ) - EndDialog( RET_OK ); - + EndDialog( RET_OK ); return 1; } @@ -899,11 +904,7 @@ OUString RemoteFilesDialog::GetCurFilter() const if( m_nCurrentFilter != LISTBOX_ENTRY_NOTFOUND ) { - sFilter = m_aFilters[m_nCurrentFilter].second; - } - else - { - sFilter = FILEDIALOG_FILTER_ALL; + sFilter = m_aFilters[m_nCurrentFilter].first; } return sFilter; @@ -967,12 +968,22 @@ std::vector<OUString> RemoteFilesDialog::GetPathList() const bool RemoteFilesDialog::ContentIsFolder( const OUString& rURL ) { - Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext(); - Reference< XInteractionHandler > xInteractionHandler( - InteractionHandler::createWithParent( xContext, 0 ), UNO_QUERY_THROW ); - Reference< XCommandEnvironment > xEnv = new ::ucbhelper::CommandEnvironment( xInteractionHandler, Reference< XProgressHandler >() ); - ::ucbhelper::Content aContent( rURL, xEnv, xContext ); - return aContent.isFolder(); + try + { + Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + Reference< XInteractionHandler > xInteractionHandler( + InteractionHandler::createWithParent( xContext, 0 ), UNO_QUERY_THROW ); + Reference< XCommandEnvironment > xEnv = new ::ucbhelper::CommandEnvironment( xInteractionHandler, Reference< XProgressHandler >() ); + ::ucbhelper::Content aContent( rURL, xEnv, xContext ); + + return aContent.isFolder(); + } + catch( const Exception& ) + { + // a content doesn't exist + } + + return false; } sal_Int32 RemoteFilesDialog::getTargetColorDepth() commit 2a6cec2caae7a04f9dc16d05aa2402536678c4c1 Author: Szymon KÅos <eszka...@gmail.com> Date: Thu Jul 9 13:13:09 2015 +0200 Default focus on filename field after selecting service Change-Id: I1c1d2855925b3d04b18a0401156b0a8c6e38d8dd diff --git a/svtools/source/dialogs/RemoteFilesDialog.cxx b/svtools/source/dialogs/RemoteFilesDialog.cxx index 129dcee..05f1ac9 100644 --- a/svtools/source/dialogs/RemoteFilesDialog.cxx +++ b/svtools/source/dialogs/RemoteFilesDialog.cxx @@ -592,6 +592,8 @@ IMPL_LINK_NOARG ( RemoteFilesDialog, SelectServiceHdl ) pRoot->SetUserData( static_cast< void* >( sData ) ); m_pTreeView->Expand( pRoot ); + + m_pName_ed->GrabFocus(); } } commit 1fbe4809e07d9ef3b38116368012451ca773e16c Author: Szymon KÅos <eszka...@gmail.com> Date: Thu Jul 9 13:03:35 2015 +0200 RemoteFilesDialog: enable controls in one place Change-Id: I21aab300a71c96308bc335ea4ac641f02ec2a4fc diff --git a/include/svtools/RemoteFilesDialog.hxx b/include/svtools/RemoteFilesDialog.hxx index 8bd9361..44fce0c 100644 --- a/include/svtools/RemoteFilesDialog.hxx +++ b/include/svtools/RemoteFilesDialog.hxx @@ -121,6 +121,7 @@ private: SvtRemoteDlgType m_eType; bool m_bMultiselection; bool m_bIsUpdated; + bool m_bIsConnected; Image m_aFolderImage; OUString m_sPath; @@ -152,6 +153,8 @@ private: FileViewResult OpenURL( OUString sURL ); + void EnableControls(); + DECL_LINK ( AddServiceHdl, void * ); DECL_LINK ( SelectServiceHdl, void * ); DECL_LINK_TYPED ( EditServiceMenuHdl, MenuButton *, void ); diff --git a/svtools/source/dialogs/RemoteFilesDialog.cxx b/svtools/source/dialogs/RemoteFilesDialog.cxx index 069973b..129dcee 100644 --- a/svtools/source/dialogs/RemoteFilesDialog.cxx +++ b/svtools/source/dialogs/RemoteFilesDialog.cxx @@ -250,6 +250,7 @@ RemoteFilesDialog::RemoteFilesDialog( vcl::Window* pParent, WinBits nBits ) m_eType = ( nBits & WB_PATH ) ? REMOTEDLG_TYPE_PATHDLG : REMOTEDLG_TYPE_FILEDLG; m_bMultiselection = ( nBits & SFXWB_MULTISELECTION ) ? true : false; m_bIsUpdated = false; + m_bIsConnected = false; m_nCurrentFilter = LISTBOX_ENTRY_NOTFOUND; m_pFilter_lb->Enable( false ); @@ -442,8 +443,8 @@ void RemoteFilesDialog::FillServicesListbox() if( m_pServices_lb->GetEntryCount() > 0 ) m_pServices_lb->SelectEntryPos( 0 ); - else - m_pServices_lb->Enable( false ); + + EnableControls(); } int RemoteFilesDialog::GetSelectedServicePos() @@ -502,18 +503,42 @@ FileViewResult RemoteFilesDialog::OpenURL( OUString sURL ) { m_pPath->SetURL( sURL ); m_pTreeView->SetTreePath( sURL ); - m_pFilter_lb->Enable( true ); - m_pName_ed->Enable( true ); - m_pContainer->Enable( true ); - if( !m_pName_ed->GetText().isEmpty() ) - m_pOk_btn->Enable( true ); + m_bIsConnected = true; + EnableControls(); } } return eResult; } +void RemoteFilesDialog::EnableControls() +{ + if( m_pServices_lb->GetEntryCount() > 0 ) + m_pServices_lb->Enable( true ); + else + m_pServices_lb->Enable( false ); + + if( m_bIsConnected ) + { + m_pFilter_lb->Enable( true ); + m_pName_ed->Enable( true ); + m_pContainer->Enable( true ); + + if( !m_pName_ed->GetText().isEmpty() ) + m_pOk_btn->Enable( true ); + else + m_pOk_btn->Enable( false ); + } + else + { + m_pFilter_lb->Enable( false ); + m_pName_ed->Enable( false ); + m_pContainer->Enable( false ); + m_pOk_btn->Enable( false ); + } +} + IMPL_LINK_NOARG ( RemoteFilesDialog, AddServiceHdl ) { ScopedVclPtrInstance< PlaceEditDialog > aDlg( this ); @@ -525,7 +550,6 @@ IMPL_LINK_NOARG ( RemoteFilesDialog, AddServiceHdl ) { ServicePtr newService = aDlg->GetPlace(); m_aServices.push_back( newService ); - m_pServices_lb->Enable( true ); OUString sPrefix = lcl_GetServiceType( newService ); @@ -536,6 +560,8 @@ IMPL_LINK_NOARG ( RemoteFilesDialog, AddServiceHdl ) m_pServices_lb->SelectEntryPos( m_pServices_lb->GetEntryCount() - 1 ); m_bIsUpdated = true; + + EnableControls(); break; } case RET_CANCEL : @@ -625,12 +651,13 @@ IMPL_LINK_TYPED ( RemoteFilesDialog, EditServiceMenuHdl, MenuButton *, pButton, else { m_pServices_lb->SetNoSelection(); - m_pServices_lb->Enable( false ); } m_bIsUpdated = true; } } + + EnableControls(); } IMPL_LINK_NOARG ( RemoteFilesDialog, DoubleClickHdl ) @@ -664,16 +691,15 @@ IMPL_LINK_NOARG ( RemoteFilesDialog, SelectHdl ) m_sPath = pData->maURL; m_pName_ed->SetText( INetURLObject::decode( aURL.GetLastName(), INetURLObject::DECODE_WITH_CHARSET ) ); - - m_pOk_btn->Enable( true ); } else { - m_pOk_btn->Enable( false ); m_sPath = ""; m_pName_ed->SetText( "" ); } + EnableControls(); + return 1; } @@ -686,11 +712,7 @@ IMPL_LINK_NOARG( RemoteFilesDialog, FileNameGetFocusHdl ) IMPL_LINK_NOARG( RemoteFilesDialog, FileNameModifyHdl ) { m_pFileView->SetNoSelection(); - - if( !m_pName_ed->GetText().isEmpty() ) - m_pOk_btn->Enable( true ); - else - m_pOk_btn->Enable( false ); + EnableControls(); return 1; } commit 37928c2a5e7dce68f2027b1a6a47d85f2dc0d533 Author: Szymon KÅos <eszka...@gmail.com> Date: Thu Jul 9 12:36:35 2015 +0200 RemoteFilesDialog: enable OK button when file name isn't empty Change-Id: Idf84d4d46a72c3fb339e28c1f3923cd2f0f3c12d diff --git a/svtools/source/dialogs/RemoteFilesDialog.cxx b/svtools/source/dialogs/RemoteFilesDialog.cxx index 574acc5..069973b 100644 --- a/svtools/source/dialogs/RemoteFilesDialog.cxx +++ b/svtools/source/dialogs/RemoteFilesDialog.cxx @@ -505,6 +505,9 @@ FileViewResult RemoteFilesDialog::OpenURL( OUString sURL ) m_pFilter_lb->Enable( true ); m_pName_ed->Enable( true ); m_pContainer->Enable( true ); + + if( !m_pName_ed->GetText().isEmpty() ) + m_pOk_btn->Enable( true ); } } commit 6f694a6d3b64c9792ef99846b445e38d5be59ee5 Author: Szymon KÅos <eszka...@gmail.com> Date: Thu Jul 9 12:25:13 2015 +0200 RemoteFilesDialog: set default filename in the save mode Change-Id: I4739c101ac6b57e5c17e912515b1c8bccce33b68 diff --git a/svtools/source/dialogs/RemoteFilesDialog.cxx b/svtools/source/dialogs/RemoteFilesDialog.cxx index 704f287..574acc5 100644 --- a/svtools/source/dialogs/RemoteFilesDialog.cxx +++ b/svtools/source/dialogs/RemoteFilesDialog.cxx @@ -845,6 +845,14 @@ const OUString& RemoteFilesDialog::GetStandardDir() const void RemoteFilesDialog::SetPath( const OUString& rNewURL ) { m_sPath = rNewURL; + + if( m_eMode == REMOTEDLG_MODE_SAVE ) + { + INetURLObject aUrl( m_sPath ); + OUString sFileName = aUrl.GetLastName( INetURLObject::DECODE_WITH_CHARSET ); + + m_pName_ed->SetText( sFileName ); + } } void RemoteFilesDialog::AddFilterGroup( commit c98402270676c3adb232f9c795540b33179f1cc6 Author: Szymon KÅos <eszka...@gmail.com> Date: Thu Jul 9 12:07:26 2015 +0200 RemoteFilesDialog: handled save button Change-Id: Iec9129eac618d21370b8e5ecb331eb9518ecf082 diff --git a/include/svtools/RemoteFilesDialog.hxx b/include/svtools/RemoteFilesDialog.hxx index 1e9afcb..8bd9361 100644 --- a/include/svtools/RemoteFilesDialog.hxx +++ b/include/svtools/RemoteFilesDialog.hxx @@ -110,8 +110,8 @@ public: virtual bool getShowState(); - virtual Control* getControl( sal_Int16 _nControlId, bool _bLabelControl = false ) const SAL_OVERRIDE; - virtual void enableControl( sal_Int16 _nControlId, bool _bEnable ); + virtual Control* getControl( sal_Int16 nControlId, bool bLabelControl = false ) const SAL_OVERRIDE; + virtual void enableControl( sal_Int16 nControlId, bool bEnable ); virtual OUString getCurFilter( ) const; private: @@ -130,8 +130,7 @@ private: ::com::sun::star::uno::Sequence< OUString > m_aBlackList; ::svt::IFilePickerListener* m_pFileNotifier; - VclPtr< PushButton > m_pOpen_btn; - VclPtr< PushButton > m_pSave_btn; + VclPtr< PushButton > m_pOk_btn; VclPtr< CancelButton > m_pCancel_btn; VclPtr< MenuButton > m_pAddService_btn; VclPtr< ListBox > m_pServices_lb; diff --git a/svtools/source/dialogs/RemoteFilesDialog.cxx b/svtools/source/dialogs/RemoteFilesDialog.cxx index 03c7bcf..704f287 100644 --- a/svtools/source/dialogs/RemoteFilesDialog.cxx +++ b/svtools/source/dialogs/RemoteFilesDialog.cxx @@ -240,8 +240,6 @@ RemoteFilesDialog::RemoteFilesDialog( vcl::Window* pParent, WinBits nBits ) , m_pFileView( NULL ) , m_pContainer( NULL ) { - get( m_pOpen_btn, "open" ); - get( m_pSave_btn, "save" ); get( m_pCancel_btn, "cancel" ); get( m_pAddService_btn, "add_service_btn" ); get( m_pServices_lb, "services_lb" ); @@ -254,23 +252,18 @@ RemoteFilesDialog::RemoteFilesDialog( vcl::Window* pParent, WinBits nBits ) m_bIsUpdated = false; m_nCurrentFilter = LISTBOX_ENTRY_NOTFOUND; - m_pOpen_btn->Enable( false ); - m_pSave_btn->Enable( false ); m_pFilter_lb->Enable( false ); m_pName_ed->Enable( false ); if( m_eMode == REMOTEDLG_MODE_OPEN ) - { - m_pSave_btn->Hide(); - m_pOpen_btn->Show(); - } + get( m_pOk_btn, "open" ); else - { - m_pSave_btn->Show(); - m_pOpen_btn->Hide(); - } + get( m_pOk_btn, "save" ); + + m_pOk_btn->Show(); + m_pOk_btn->Enable( false ); - m_pOpen_btn->SetClickHdl( LINK( this, RemoteFilesDialog, OkHdl ) ); + m_pOk_btn->SetClickHdl( LINK( this, RemoteFilesDialog, OkHdl ) ); m_pPath = VclPtr<Breadcrumb>::Create( get< vcl::Window >( "breadcrumb_container" ) ); m_pPath->set_hexpand( true ); @@ -365,8 +358,7 @@ void RemoteFilesDialog::dispose() m_pContainer.disposeAndClear(); m_pPath.disposeAndClear(); - m_pOpen_btn.clear(); - m_pSave_btn.clear(); + m_pOk_btn.clear(); m_pCancel_btn.clear(); m_pAddService_btn.clear(); m_pServices_lb.clear(); @@ -670,11 +662,11 @@ IMPL_LINK_NOARG ( RemoteFilesDialog, SelectHdl ) m_pName_ed->SetText( INetURLObject::decode( aURL.GetLastName(), INetURLObject::DECODE_WITH_CHARSET ) ); - m_pOpen_btn->Enable( true ); + m_pOk_btn->Enable( true ); } else { - m_pOpen_btn->Enable( false ); + m_pOk_btn->Enable( false ); m_sPath = ""; m_pName_ed->SetText( "" ); } @@ -693,9 +685,9 @@ IMPL_LINK_NOARG( RemoteFilesDialog, FileNameModifyHdl ) m_pFileView->SetNoSelection(); if( !m_pName_ed->GetText().isEmpty() ) - m_pOpen_btn->Enable( true ); + m_pOk_btn->Enable( true ); else - m_pOpen_btn->Enable( false ); + m_pOk_btn->Enable( false ); return 1; } diff --git a/svtools/uiconfig/ui/remotefilesdialog.ui b/svtools/uiconfig/ui/remotefilesdialog.ui index f4a591f..0ba817b 100644 --- a/svtools/uiconfig/ui/remotefilesdialog.ui +++ b/svtools/uiconfig/ui/remotefilesdialog.ui @@ -35,7 +35,6 @@ <child> <object class="GtkButton" id="open"> <property name="label">gtk-open</property> - <property name="visible">True</property> <property name="can_focus">True</property> <property name="can_default">True</property> <property name="receives_default">True</property> commit a26defa1e54c9a5016948b4a987f47530a311647 Author: Szymon KÅos <eszka...@gmail.com> Date: Thu Jul 9 10:53:30 2015 +0200 removed warning: 'Unknown item detected' Change-Id: I36b2faca9205aba870aa993214d0c062ae4f83d9 diff --git a/sfx2/source/appl/appuno.cxx b/sfx2/source/appl/appuno.cxx index 28e826c..876cf34 100644 --- a/sfx2/source/appl/appuno.cxx +++ b/sfx2/source/appl/appuno.cxx @@ -922,7 +922,7 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, uno::Sequence<b if ( nSlotId == SID_OPENURL ) nSlotId = SID_OPENDOC; - if ( nSlotId == SID_SAVEASURL ) + if ( nSlotId == SID_SAVEASURL || nSlotId == SID_SAVEASREMOTE ) nSlotId = SID_SAVEASDOC; // find number of properties to avoid permanent reallocations in the sequence commit d9fcfef9981a48ddd4472df71fc469884a426baa Author: Szymon KÅos <eszka...@gmail.com> Date: Thu Jul 9 10:43:26 2015 +0200 SaveAsRemote: corresponding dialog type Change-Id: I5face9064bafc3c99b9a7af7809bd40a105b11bd diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx index 247c2f4..6a204fa 100644 --- a/sfx2/source/doc/guisaveas.cxx +++ b/sfx2/source/doc/guisaveas.cxx @@ -544,6 +544,9 @@ uno::Sequence< beans::PropertyValue > ModelData_Impl::GetDocServiceAnyFilter( Sf uno::Sequence< beans::PropertyValue > ModelData_Impl::GetPreselectedFilter_Impl( sal_Int8 nStoreMode ) { + if ( nStoreMode == SAVEASREMOTE_REQUESTED ) + nStoreMode = SAVEAS_REQUESTED; + uno::Sequence< beans::PropertyValue > aFilterProps; SfxFilterFlags nMust = getMustFlags( nStoreMode ); @@ -882,6 +885,9 @@ bool ModelData_Impl::OutputFileDialog( sal_Int8 nStoreMode, const OUString& rStandardDir, const ::com::sun::star::uno::Sequence< OUString >& rBlackList) { + if ( nStoreMode == SAVEASREMOTE_REQUESTED ) + nStoreMode = SAVEAS_REQUESTED; + bool bUseFilterOptions = false; ::comphelper::SequenceAsHashMap::const_iterator aOverwriteIter = @@ -1396,7 +1402,15 @@ bool SfxStoringHelper::GUIStoreModel( uno::Reference< frame::XModel > xModel, bool bSetStandardName = false; // can be set only for SaveAs // parse the slot name + bool bRemote = false; sal_Int8 nStoreMode = getStoreModeFromSlotName( aSlotName ); + + if ( nStoreMode == SAVEASREMOTE_REQUESTED ) + { + nStoreMode = SAVEAS_REQUESTED; + bRemote = true; + } + sal_Int8 nStatusSave = STATUS_NO_ACTION; ::comphelper::SequenceAsHashMap::const_iterator aSaveACopyIter = @@ -1551,7 +1565,7 @@ bool SfxStoringHelper::GUIStoreModel( uno::Reference< frame::XModel > xModel, { sal_Int16 nDialog = SFX2_IMPL_DIALOG_CONFIG; - if( nStoreMode == SAVEASREMOTE_REQUESTED ) + if( bRemote ) { nDialog = SFX2_IMPL_DIALOG_REMOTE; } diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index c510710..bc1a668 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -561,7 +561,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) { SfxErrorContext aEc( ERRCTX_SFX_SAVEASDOC, GetTitle() ); // ??? - if ( nId == SID_SAVEASDOC ) + if ( nId == SID_SAVEASDOC || nId == SID_SAVEASREMOTE ) { // in case of plugin mode the SaveAs operation means SaveTo SFX_ITEMSET_ARG( GetMedium()->GetItemSet(), pViewOnlyItem, SfxBoolItem, SID_VIEWONLY, false ); @@ -726,7 +726,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) nErrorCode = ( lErr != ERRCODE_IO_ABORT ) && ( nErrorCode == ERRCODE_NONE ) ? nErrorCode : lErr; } - if ( nId == SID_SAVEASDOC && nErrorCode == ERRCODE_NONE ) + if ( ( nId == SID_SAVEASDOC || nId == SID_SAVEASREMOTE ) && nErrorCode == ERRCODE_NONE ) { SfxBoolItem const * saveTo = static_cast<SfxBoolItem const *>( rReq.GetArg(SID_SAVETO, false, TYPE(SfxBoolItem))); commit 548313840238eb3dcbdeb2bcfeec3fbdd9c293f7 Author: Szymon KÅos <eszka...@gmail.com> Date: Wed Jul 8 23:17:53 2015 +0200 Working toolbar entry: Save As > Remote file Change-Id: I5601c7847f30a7d5fb7ede5f90b2a6a89f4c8693 diff --git a/framework/source/uielement/saveasmenucontroller.cxx b/framework/source/uielement/saveasmenucontroller.cxx index 7e4fd92..6460013 100644 --- a/framework/source/uielement/saveasmenucontroller.cxx +++ b/framework/source/uielement/saveasmenucontroller.cxx @@ -41,7 +41,7 @@ using namespace framework; namespace { -static const char CMD_SAVE_REMOTE[] = ".uno:OpenRemote"; // TODO +static const char CMD_SAVE_REMOTE[] = ".uno:SaveAsRemote"; class SaveAsMenuController : public svt::PopupMenuControllerBase { @@ -115,9 +115,9 @@ void SaveAsMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu >& rPo if ( pVCLPopupMenu ) { // Open remote menu entry - pVCLPopupMenu->InsertItem( sal_uInt16( 0 ), + pVCLPopupMenu->InsertItem( sal_uInt16( 1 ), FWK_RESSTR( STR_REMOTE_FILE ) ); - pVCLPopupMenu->SetItemCommand( sal_uInt16( 0 ), + pVCLPopupMenu->SetItemCommand( sal_uInt16( 1 ), OUString( CMD_SAVE_REMOTE ) ); } } @@ -160,6 +160,7 @@ void SAL_CALL SaveAsMenuController::itemSelected( const css::awt::MenuEvent& rEv if ( aCommand == CMD_SAVE_REMOTE ) { Sequence< PropertyValue > aArgsList( 0 ); + dispatchCommand( CMD_SAVE_REMOTE, aArgsList ); } } diff --git a/include/sfx2/sfxsids.hrc b/include/sfx2/sfxsids.hrc index 0f4344e..1755eb5 100644 --- a/include/sfx2/sfxsids.hrc +++ b/include/sfx2/sfxsids.hrc @@ -102,6 +102,7 @@ #define SID_JUMPTOMARK (SID_SFX_START + 598) #define SID_OPENTEMPLATE (SID_SFX_START + 594) #define SID_SAVEASDOC (SID_SFX_START + 502) +#define SID_SAVEASREMOTE (SID_SFX_START + 516) #define SID_SAVEACOPY (SID_SFX_START + 999) #define SID_SAVEACOPYITEM (SID_SFX_START + 998) #define SID_CLOSING (SID_SFX_START +1539) diff --git a/sfx2/sdi/docslots.sdi b/sfx2/sdi/docslots.sdi index be17f43..9398f72 100644 --- a/sfx2/sdi/docslots.sdi +++ b/sfx2/sdi/docslots.sdi @@ -148,6 +148,11 @@ interface OfficeDocument : Document ExecMethod = ExecFile_Impl ; StateMethod = GetState_Impl ; ] + SID_SAVEASREMOTE // ole(req) api(final/play/rec) + [ + ExecMethod = ExecFile_Impl ; + StateMethod = GetState_Impl ; + ] SID_DOCTEMPLATE // ole(no) api(final/play/rec) [ ExecMethod = ExecFile_Impl ; diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi index 8ccc619..fbb8f60 100644 --- a/sfx2/sdi/sfx.sdi +++ b/sfx2/sdi/sfx.sdi @@ -5013,6 +5013,33 @@ SfxBoolItem SaveAs SID_SAVEASDOC GroupId = GID_DOCUMENT; ] +SfxBoolItem SaveAsRemote SID_SAVEASREMOTE +(SfxStringItem URL SID_FILE_NAME,SfxStringItem FilterName SID_FILTER_NAME,SfxStringItem Password SID_PASSWORD,SfxBoolItem PasswordInteraction SID_PASSWORDINTERACTION,SfxStringItem FilterOptions SID_FILE_FILTEROPTIONS,SfxStringItem VersionComment SID_DOCINFO_COMMENTS,SfxStringItem VersionAuthor SID_DOCINFO_AUTHOR,SfxBoolItem Overwrite SID_OVERWRITE,SfxBoolItem Unpacked SID_UNPACK,SfxBoolItem SaveTo SID_SAVETO) +[ + /* flags: */ + AutoUpdate = FALSE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = TRUE, + ReadOnlyDoc = TRUE, + Toggle = FALSE, + Container = TRUE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + /* status: */ + SlotType = SfxStringItem + + /* config: */ + AccelConfig = TRUE, + MenuConfig = TRUE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_DOCUMENT; +] + SfxBoolItem SaveAsTemplate SID_DOCTEMPLATE (SfxStringItem TemplateRegion SID_TEMPLATE_REGIONNAME,SfxStringItem TemplateName SID_TEMPLATE_NAME) diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx index 869ec68..247c2f4 100644 --- a/sfx2/source/doc/guisaveas.cxx +++ b/sfx2/source/doc/guisaveas.cxx @@ -105,6 +105,7 @@ #define SAVE_REQUESTED 16 #define SAVEAS_REQUESTED 32 #define SAVEACOPY_REQUESTED 64 +#define SAVEASREMOTE_REQUESTED -1 // possible statuses of save operation #define STATUS_NO_ACTION 0 @@ -136,6 +137,8 @@ static sal_uInt16 getSlotIDFromMode( sal_Int8 nStoreMode ) nResult = SID_DIRECTEXPORTDOCASPDF; else if ( nStoreMode == SAVEAS_REQUESTED || nStoreMode == ( EXPORT_REQUESTED | WIDEEXPORT_REQUESTED ) ) nResult = SID_SAVEASDOC; + else if ( nStoreMode == SAVEASREMOTE_REQUESTED ) + nResult = SID_SAVEASREMOTE; else { DBG_ASSERT( false, "Unacceptable slot name is provided!\n" ); } @@ -157,6 +160,8 @@ static sal_uInt8 getStoreModeFromSlotName( const OUString& aSlotName ) nResult = SAVE_REQUESTED; else if ( aSlotName == "SaveAs" ) nResult = SAVEAS_REQUESTED; + else if ( aSlotName == "SaveAsRemote" ) + nResult = SAVEASREMOTE_REQUESTED; else throw task::ErrorCodeIOException( ("getStoreModeFromSlotName(\"" + aSlotName @@ -544,7 +549,7 @@ uno::Sequence< beans::PropertyValue > ModelData_Impl::GetPreselectedFilter_Impl( SfxFilterFlags nMust = getMustFlags( nStoreMode ); SfxFilterFlags nDont = getDontFlags( nStoreMode ); - if ( nStoreMode & PDFEXPORT_REQUESTED ) + if ( ( nStoreMode != SAVEASREMOTE_REQUESTED ) && ( nStoreMode & PDFEXPORT_REQUESTED ) ) { // Preselect PDF-Filter for EXPORT uno::Sequence< beans::NamedValue > aSearchRequest( 2 ); @@ -1545,17 +1550,25 @@ bool SfxStoringHelper::GUIStoreModel( uno::Reference< frame::XModel > xModel, if ( aFileNameIter == aModelData.GetMediaDescr().end() ) { sal_Int16 nDialog = SFX2_IMPL_DIALOG_CONFIG; - ::comphelper::SequenceAsHashMap::const_iterator aDlgIter = - aModelData.GetMediaDescr().find( OUString("UseSystemDialog") ); - if ( aDlgIter != aModelData.GetMediaDescr().end() ) + + if( nStoreMode == SAVEASREMOTE_REQUESTED ) { - bool bUseSystemDialog = true; - if ( aDlgIter->second >>= bUseSystemDialog ) + nDialog = SFX2_IMPL_DIALOG_REMOTE; + } + else + { + ::comphelper::SequenceAsHashMap::const_iterator aDlgIter = + aModelData.GetMediaDescr().find( OUString("UseSystemDialog") ); + if ( aDlgIter != aModelData.GetMediaDescr().end() ) { - if ( bUseSystemDialog ) - nDialog = SFX2_IMPL_DIALOG_SYSTEM; - else - nDialog = SFX2_IMPL_DIALOG_OOO; + bool bUseSystemDialog = true; + if ( aDlgIter->second >>= bUseSystemDialog ) + { + if ( bUseSystemDialog ) + nDialog = SFX2_IMPL_DIALOG_SYSTEM; + else + nDialog = SFX2_IMPL_DIALOG_OOO; + } } } diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index f35c470..c510710 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -528,13 +528,13 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - case SID_EXPORTDOCASPDF: case SID_DIRECTEXPORTDOCASPDF: bIsPDFExport = true; //fall-through case SID_EXPORTDOC: case SID_SAVEASDOC: + case SID_SAVEASREMOTE: case SID_SAVEDOC: { // derived class may decide to abort this diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h index 7e5bcec..4f77923 100644 --- a/sw/inc/cmdid.h +++ b/sw/inc/cmdid.h @@ -62,7 +62,6 @@ // Region: File #define FN_NEW_GLOBAL_DOC (FN_FILE + 4 ) /* Create Global Document */ -#define FN_SAVE_FILE_AS (FN_FILE + 5 ) /* Save As */ #define FN_OPEN_FILE (FN_FILE + 7 ) /* Open */ #define FN_OUTLINE_TO_IMPRESS (FN_FILE + 36) /* Send outline to impress */ diff --git a/sw/sdi/docsh.sdi b/sw/sdi/docsh.sdi index 5e9fe78..9085bdf 100644 --- a/sw/sdi/docsh.sdi +++ b/sw/sdi/docsh.sdi @@ -59,11 +59,6 @@ interface TextDocument : BaseTextDocument ExecMethod = Execute; StateMethod = GetState; ] - FN_SAVE_FILE_AS - [ - ExecMethod = Execute; - StateMethod = GetState; - ] } shell SwDocShell diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi index 4059198..6ecfbb8 100644 --- a/sw/sdi/swriter.sdi +++ b/sw/sdi/swriter.sdi @@ -10124,33 +10124,6 @@ SfxVoidItem OpenFromWriter FN_OPEN_FILE GroupId = GID_APPLICATION; ] -SfxVoidItem SaveAs FN_SAVE_FILE_AS -() -[ - /* flags: */ - AutoUpdate = FALSE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = FALSE, - ReadOnlyDoc = TRUE, - Toggle = FALSE, - Container = FALSE, - RecordAbsolute = FALSE, - RecordPerSet; - Synchron; - - /* status: */ - SlotType = SfxStringItem - - /* config: */ - AccelConfig = TRUE, - MenuConfig = TRUE, - StatusBarConfig = FALSE, - ToolBoxConfig = TRUE, - GroupId = GID_APPLICATION; -] - SfxInt16Item PageColumnType SID_ATTR_PAGE_COLUMN [ diff --git a/sw/source/uibase/app/swmodule.cxx b/sw/source/uibase/app/swmodule.cxx index 8095e43..7d01854 100644 --- a/sw/source/uibase/app/swmodule.cxx +++ b/sw/source/uibase/app/swmodule.cxx @@ -296,7 +296,7 @@ void SwDLL::RegisterControls() SvxColorToolBoxControl::RegisterControl( SID_EXTRUSION_3D_COLOR, pMod ); svx::FontWorkShapeTypeControl::RegisterControl( SID_FONTWORK_SHAPE_TYPE, pMod ); - SfxSaveAsToolBoxControl::RegisterControl(FN_SAVE_FILE_AS, pMod ); + SfxSaveAsToolBoxControl::RegisterControl(SID_SAVEASDOC, pMod ); SvxClipBoardControl::RegisterControl(SID_PASTE, pMod ); SvxUndoRedoControl::RegisterControl(SID_UNDO, pMod ); SvxUndoRedoControl::RegisterControl(SID_REDO, pMod ); commit 92f32585708a251526492f1eb576744bee8d5a5f Author: Szymon KÅos <eszka...@gmail.com> Date: Tue Jul 7 17:41:09 2015 +0200 'Save As' popup menu in the Calc's toolbar Change-Id: I5e7d5594062bb722b1076450c1e6e633183279b3 diff --git a/sc/source/ui/app/scdll.cxx b/sc/source/ui/app/scdll.cxx index be95d7d..e920cc5 100644 --- a/sc/source/ui/app/scdll.cxx +++ b/sc/source/ui/app/scdll.cxx @@ -151,6 +151,7 @@ void ScDLL::Init() ScPageBreakShell ::RegisterInterface(pMod); SfxRecentFilesToolBoxControl::RegisterControl(SID_OPEN_CALC, pMod); + SfxSaveAsToolBoxControl::RegisterControl(SID_SAVEASDOC, pMod ); // Own Controller ScZoomSliderControl ::RegisterControl(SID_PREVIEW_SCALINGFACTOR, pMod); diff --git a/sc/uiconfig/scalc/toolbar/standardbar.xml b/sc/uiconfig/scalc/toolbar/standardbar.xml index 9e2cbca..4368218 100644 --- a/sc/uiconfig/scalc/toolbar/standardbar.xml +++ b/sc/uiconfig/scalc/toolbar/standardbar.xml @@ -24,7 +24,7 @@ <toolbar:toolbaritem xlink:href=".uno:OpenFromCalc" toolbar:style="dropdown"/> <toolbar:toolbaritem xlink:href=".uno:OpenRemote"/> <toolbar:toolbaritem xlink:href=".uno:Save"/> - <toolbar:toolbaritem xlink:href=".uno:SaveAs"/> + <toolbar:toolbaritem xlink:href=".uno:SaveAs" toolbar:style="dropdown"/> <toolbar:toolbaritem xlink:href=".uno:SendMail" toolbar:visible="false"/> <toolbar:toolbarseparator/> <toolbar:toolbaritem xlink:href=".uno:EditDoc" toolbar:visible="false"/> commit ce722af0cce170a2aac3a5e01cd66e6c24fba63c Author: Szymon KÅos <eszka...@gmail.com> Date: Tue Jul 7 16:44:59 2015 +0200 'Save As' popup menu in the Writer's toolbar Change-Id: I1b1cb7fcd2ae0e0f50e4d8e3900bc416435e60bf diff --git a/framework/Library_fwk.mk b/framework/Library_fwk.mk index 1979101..d07f8b9 100644 --- a/framework/Library_fwk.mk +++ b/framework/Library_fwk.mk @@ -144,6 +144,7 @@ $(eval $(call gb_Library_add_exception_objects,fwk,\ framework/source/uielement/popuptoolbarcontroller \ framework/source/uielement/progressbarwrapper \ framework/source/uielement/recentfilesmenucontroller \ + framework/source/uielement/saveasmenucontroller \ framework/source/uielement/spinfieldtoolbarcontroller \ framework/source/uielement/statusbar \ framework/source/uielement/statusbaritem \ diff --git a/framework/inc/classes/resource.hrc b/framework/inc/classes/resource.hrc index 6620c99..2b1ea1c 100644 --- a/framework/inc/classes/resource.hrc +++ b/framework/inc/classes/resource.hrc @@ -51,6 +51,7 @@ #define STR_CLEAR_RECENT_FILES_HELP (RID_STR_START+24) #define STR_LANGSTATUS_HINT (RID_STR_START+25) #define STR_OPEN_REMOTE (RID_STR_START+26) +#define STR_REMOTE_FILE (RID_STR_START+27) #define POPUPMENU_TOOLBAR_QUICKCUSTOMIZATION (RID_MENU_START+0) diff --git a/framework/source/classes/resource.src b/framework/source/classes/resource.src index 0ef53ae..4f8ce0e 100644 --- a/framework/source/classes/resource.src +++ b/framework/source/classes/resource.src @@ -119,6 +119,11 @@ String STR_OPEN_REMOTE Text [ en-US ] = "Open remote file"; }; +String STR_REMOTE_FILE +{ + Text [ en-US ] = "Remote file"; +}; + String STR_TOOLBAR_TITLE_ADDON { Text [ en-US ] = "Add-On %num%"; diff --git a/framework/source/uielement/saveasmenucontroller.cxx b/framework/source/uielement/saveasmenucontroller.cxx new file mode 100644 index 0000000..7e4fd92 --- /dev/null +++ b/framework/source/uielement/saveasmenucontroller.cxx @@ -0,0 +1,191 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include <classes/resource.hrc> +#include <classes/fwkresid.hxx> + +#include <cppuhelper/implbase1.hxx> +#include <cppuhelper/supportsservice.hxx> +#include <osl/file.hxx> +#include <osl/mutex.hxx> +#include <rtl/ref.hxx> +#include <svtools/popupmenucontrollerbase.hxx> +#include <tools/urlobj.hxx> +#include <unotools/historyoptions.hxx> +#include <vcl/menu.hxx> +#include <vcl/svapp.hxx> + +using namespace css; +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace com::sun::star::frame; +using namespace com::sun::star::beans; +using namespace com::sun::star::util; +using namespace framework; + +namespace { + +static const char CMD_SAVE_REMOTE[] = ".uno:OpenRemote"; // TODO + +class SaveAsMenuController : public svt::PopupMenuControllerBase +{ + using svt::PopupMenuControllerBase::disposing; + +public: + SaveAsMenuController( const uno::Reference< uno::XComponentContext >& xContext ); + virtual ~SaveAsMenuController(); + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() + throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE + { + return OUString("com.sun.star.comp.framework.SaveAsMenuController"); + } + + virtual sal_Bool SAL_CALL supportsService(OUString const & ServiceName) + throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE + { + return cppu::supportsService(this, ServiceName); + } + + virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() + throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE + { + css::uno::Sequence< OUString > aSeq(1); + aSeq[0] = "com.sun.star.frame.PopupMenuController"; + return aSeq; + } + + // XStatusListener + virtual void SAL_CALL statusChanged( const frame::FeatureStateEvent& Event ) throw ( uno::RuntimeException, std::exception ) SAL_OVERRIDE; + + // XMenuListener + virtual void SAL_CALL itemSelected( const awt::MenuEvent& rEvent ) throw (uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual void SAL_CALL itemActivated( const awt::MenuEvent& rEvent ) throw (uno::RuntimeException, std::exception) SAL_OVERRIDE; + + // XEventListener + virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw ( uno::RuntimeException, std::exception ) SAL_OVERRIDE; + +private: + virtual void impl_setPopupMenu() SAL_OVERRIDE; + + void fillPopupMenu( com::sun::star::uno::Reference< com::sun::star::awt::XPopupMenu >& rPopupMenu ); + + bool m_bDisabled : 1; +}; + +SaveAsMenuController::SaveAsMenuController( const uno::Reference< uno::XComponentContext >& xContext ) : + svt::PopupMenuControllerBase( xContext ), + m_bDisabled( false ) +{ +} + +SaveAsMenuController::~SaveAsMenuController() +{ +} + +// private function +void SaveAsMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu >& rPopupMenu ) +{ + VCLXPopupMenu* pPopupMenu = static_cast<VCLXPopupMenu *>(VCLXMenu::GetImplementation( rPopupMenu )); + PopupMenu* pVCLPopupMenu = 0; + + SolarMutexGuard aSolarMutexGuard; + + resetPopupMenu( rPopupMenu ); + if ( pPopupMenu ) + pVCLPopupMenu = static_cast<PopupMenu *>(pPopupMenu->GetMenu()); + + if ( pVCLPopupMenu ) + { + // Open remote menu entry + pVCLPopupMenu->InsertItem( sal_uInt16( 0 ), + FWK_RESSTR( STR_REMOTE_FILE ) ); + pVCLPopupMenu->SetItemCommand( sal_uInt16( 0 ), + OUString( CMD_SAVE_REMOTE ) ); + } +} + +// XEventListener +void SAL_CALL SaveAsMenuController::disposing( const EventObject& ) throw ( RuntimeException, std::exception ) +{ + Reference< css::awt::XMenuListener > xHolder(( OWeakObject *)this, UNO_QUERY ); + + osl::MutexGuard aLock( m_aMutex ); + m_xFrame.clear(); + m_xDispatch.clear(); + + if ( m_xPopupMenu.is() ) + m_xPopupMenu->removeMenuListener( Reference< css::awt::XMenuListener >(( OWeakObject *)this, UNO_QUERY )); + m_xPopupMenu.clear(); +} + +// XStatusListener +void SAL_CALL SaveAsMenuController::statusChanged( const FeatureStateEvent& Event ) throw ( RuntimeException, std::exception ) +{ + osl::MutexGuard aLock( m_aMutex ); + m_bDisabled = !Event.IsEnabled; +} + +void SAL_CALL SaveAsMenuController::itemSelected( const css::awt::MenuEvent& rEvent ) throw (RuntimeException, std::exception) +{ + Reference< css::awt::XPopupMenu > xPopupMenu; + + osl::ClearableMutexGuard aLock( m_aMutex ); + xPopupMenu = m_xPopupMenu; + aLock.clear(); + + if ( xPopupMenu.is() ) + { + const OUString aCommand( xPopupMenu->getCommand( rEvent.MenuId ) ); + OSL_TRACE( "SaveAsMenuController::itemSelected() - Command : %s", + OUStringToOString( aCommand, RTL_TEXTENCODING_UTF8 ).getStr() ); + + if ( aCommand == CMD_SAVE_REMOTE ) + { + Sequence< PropertyValue > aArgsList( 0 ); + dispatchCommand( CMD_SAVE_REMOTE, aArgsList ); + } + } +} + +void SAL_CALL SaveAsMenuController::itemActivated( const css::awt::MenuEvent& ) throw (RuntimeException, std::exception) +{ + osl::MutexGuard aLock( m_aMutex ); + impl_setPopupMenu(); +} + +// XPopupMenuController +void SaveAsMenuController::impl_setPopupMenu() +{ + if ( m_xPopupMenu.is() ) + fillPopupMenu( m_xPopupMenu ); +} + +} + +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL +com_sun_star_comp_framework_SaveAsMenuController_get_implementation( + css::uno::XComponentContext *context, + css::uno::Sequence<css::uno::Any> const &) +{ + return cppu::acquire(new SaveAsMenuController(context)); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/util/fwk.component b/framework/util/fwk.component index 477d524..ad16782 100644 --- a/framework/util/fwk.component +++ b/framework/util/fwk.component @@ -117,6 +117,10 @@ constructor="com_sun_star_comp_framework_RecentFilesMenuController_get_implementation"> <service name="com.sun.star.frame.PopupMenuController"/> </implementation> + <implementation name="com.sun.star.comp.framework.SaveAsMenuController" + constructor="com_sun_star_comp_framework_SaveAsMenuController_get_implementation"> + <service name="com.sun.star.frame.PopupMenuController"/> + </implementation> <implementation name="com.sun.star.comp.framework.StatusBarControllerFactory" constructor="com_sun_star_comp_framework_StatusBarControllerFactory_get_implementation"> <service name="com.sun.star.frame.StatusbarControllerFactory"/> diff --git a/include/sfx2/tbxctrl.hxx b/include/sfx2/tbxctrl.hxx index 49b69bb..fe1453a 100644 --- a/include/sfx2/tbxctrl.hxx +++ b/include/sfx2/tbxctrl.hxx @@ -315,6 +315,21 @@ protected: virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE; }; +class SfxSaveAsToolBoxControl : public SfxToolBoxControl +{ +public: + // We don't use SFX_DECL_TOOLBOX_CONTROL() here as we need to have this + // RegisterControl() marked as SFX2_DLLPUBLIC + static SfxToolBoxControl* CreateImpl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox &rTbx ); + static void SFX2_DLLPUBLIC RegisterControl(sal_uInt16 nSlotId = 0, SfxModule *pMod=NULL); + + SfxSaveAsToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rBox ); + virtual ~SfxSaveAsToolBoxControl(); + +protected: + virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE; +}; + class SfxReloadToolBoxControl_Impl : public SfxToolBoxControl { protected: diff --git a/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu b/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu index 20fc41e..46f5d96 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu @@ -174,6 +174,17 @@ <value>com.sun.star.comp.framework.LanguageSelectionMenuController</value> </prop> </node> + <node oor:name="c16" oor:op="replace"> + <prop oor:name="Command"> + <value>.uno:SaveAsMenu</value> + </prop> + <prop oor:name="Module"> + <value/> + </prop> + <prop oor:name="Controller"> + <value>com.sun.star.comp.framework.SaveAsMenuController</value> + </prop> + </node> </node> <node oor:name="ToolBar"> <node oor:name="GraphicFilterControl" oor:op="replace"> diff --git a/sfx2/source/toolbox/tbxitem.cxx b/sfx2/source/toolbox/tbxitem.cxx index 99c466c..aae7ef3 100644 --- a/sfx2/source/toolbox/tbxitem.cxx +++ b/sfx2/source/toolbox/tbxitem.cxx @@ -106,6 +106,7 @@ using namespace ::com::sun::star::ui; SFX_IMPL_TOOLBOX_CONTROL_ARG(SfxToolBoxControl, SfxStringItem, true); SFX_IMPL_TOOLBOX_CONTROL(SfxRecentFilesToolBoxControl, SfxStringItem); +SFX_IMPL_TOOLBOX_CONTROL(SfxSaveAsToolBoxControl, SfxStringItem); static vcl::Window* GetTopMostParentSystemWindow( vcl::Window* pWindow ) { @@ -1403,4 +1404,53 @@ VclPtr<SfxPopupWindow> SfxRecentFilesToolBoxControl::CreatePopupWindow() return 0; } +SfxSaveAsToolBoxControl::SfxSaveAsToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rBox ) + : SfxToolBoxControl( nSlotId, nId, rBox ) +{ + rBox.SetItemBits( nId, rBox.GetItemBits( nId ) | ToolBoxItemBits::DROPDOWN); +} + +SfxSaveAsToolBoxControl::~SfxSaveAsToolBoxControl() +{ +} + +VclPtr<SfxPopupWindow> SfxSaveAsToolBoxControl::CreatePopupWindow() +{ + ToolBox& rBox = GetToolBox(); + sal_uInt16 nItemId = GetId(); + ::Rectangle aRect( rBox.GetItemRect( nItemId ) ); + + Sequence< Any > aArgs( 2 ); + PropertyValue aPropValue; + + aPropValue.Name = "CommandURL"; + aPropValue.Value <<= OUString( ".uno:SaveAsMenu" ); + aArgs[0] <<= aPropValue; + + aPropValue.Name = "Frame"; + aPropValue.Value <<= m_xFrame; + aArgs[1] <<= aPropValue; + + uno::Reference< frame::XPopupMenuController > xPopupController( m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext( + "com.sun.star.comp.framework.SaveAsMenuController", aArgs, m_xContext ), UNO_QUERY ); + + uno::Reference< awt::XPopupMenu > xPopupMenu( m_xContext->getServiceManager()->createInstanceWithContext( + "com.sun.star.awt.PopupMenu", m_xContext ), uno::UNO_QUERY ); + + if ( xPopupController.is() && xPopupMenu.is() ) + { + xPopupController->setPopupMenu( xPopupMenu ); + + rBox.SetItemDown( nItemId, true ); + Reference< awt::XWindowPeer > xPeer( getParent(), uno::UNO_QUERY ); + + if ( xPeer.is() ) + xPopupMenu->execute( xPeer, VCLUnoHelper::ConvertToAWTRect( aRect ), 0 ); + + rBox.SetItemDown( nItemId, false ); + } + + return 0; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h index 4f77923..7e5bcec 100644 --- a/sw/inc/cmdid.h +++ b/sw/inc/cmdid.h @@ -62,6 +62,7 @@ // Region: File #define FN_NEW_GLOBAL_DOC (FN_FILE + 4 ) /* Create Global Document */ +#define FN_SAVE_FILE_AS (FN_FILE + 5 ) /* Save As */ #define FN_OPEN_FILE (FN_FILE + 7 ) /* Open */ #define FN_OUTLINE_TO_IMPRESS (FN_FILE + 36) /* Send outline to impress */ diff --git a/sw/sdi/docsh.sdi b/sw/sdi/docsh.sdi index 9085bdf..5e9fe78 100644 --- a/sw/sdi/docsh.sdi +++ b/sw/sdi/docsh.sdi @@ -59,6 +59,11 @@ interface TextDocument : BaseTextDocument ExecMethod = Execute; StateMethod = GetState; ] + FN_SAVE_FILE_AS + [ + ExecMethod = Execute; + StateMethod = GetState; + ] } shell SwDocShell diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi index 6ecfbb8..4059198 100644 --- a/sw/sdi/swriter.sdi +++ b/sw/sdi/swriter.sdi @@ -10124,6 +10124,33 @@ SfxVoidItem OpenFromWriter FN_OPEN_FILE GroupId = GID_APPLICATION; ] +SfxVoidItem SaveAs FN_SAVE_FILE_AS +() +[ + /* flags: */ + AutoUpdate = FALSE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = TRUE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + /* status: */ + SlotType = SfxStringItem + + /* config: */ + AccelConfig = TRUE, + MenuConfig = TRUE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_APPLICATION; +] + SfxInt16Item PageColumnType SID_ATTR_PAGE_COLUMN [ diff --git a/sw/source/uibase/app/swmodule.cxx b/sw/source/uibase/app/swmodule.cxx index 779732b..8095e43 100644 --- a/sw/source/uibase/app/swmodule.cxx +++ b/sw/source/uibase/app/swmodule.cxx @@ -296,6 +296,7 @@ void SwDLL::RegisterControls() SvxColorToolBoxControl::RegisterControl( SID_EXTRUSION_3D_COLOR, pMod ); svx::FontWorkShapeTypeControl::RegisterControl( SID_FONTWORK_SHAPE_TYPE, pMod ); + SfxSaveAsToolBoxControl::RegisterControl(FN_SAVE_FILE_AS, pMod ); SvxClipBoardControl::RegisterControl(SID_PASTE, pMod ); SvxUndoRedoControl::RegisterControl(SID_UNDO, pMod ); SvxUndoRedoControl::RegisterControl(SID_REDO, pMod ); diff --git a/sw/uiconfig/swriter/toolbar/standardbar.xml b/sw/uiconfig/swriter/toolbar/standardbar.xml index 7912789..39dd890 100644 --- a/sw/uiconfig/swriter/toolbar/standardbar.xml +++ b/sw/uiconfig/swriter/toolbar/standardbar.xml @@ -24,7 +24,7 @@ <toolbar:toolbaritem xlink:href=".uno:OpenFromWriter" toolbar:style="dropdown"/> <toolbar:toolbaritem xlink:href=".uno:OpenRemote"/> <toolbar:toolbaritem xlink:href=".uno:Save" toolbar:helpid="5505"/> - <toolbar:toolbaritem xlink:href=".uno:SaveAs" toolbar:helpid="5502"/> + <toolbar:toolbaritem xlink:href=".uno:SaveAs" toolbar:style="dropdown" toolbar:helpid="5502"/> <toolbar:toolbaritem xlink:href=".uno:SendMail" toolbar:visible="false" toolbar:helpid="5331"/> <toolbar:toolbarseparator/> <toolbar:toolbaritem xlink:href=".uno:EditDoc" toolbar:helpid="6312" toolbar:visible="false"/> commit 1ceb7bc53b347deb93e7cca415b90e71057cfac5 Author: Szymon KÅos <eszka...@gmail.com> Date: Mon Jul 6 17:42:29 2015 +0200 open remote button in sc toolbar Change-Id: I3ad382e246cf16270bc78d57726107fe72b0fac3 diff --git a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu index 66566f1..3221162 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu @@ -1829,6 +1829,14 @@ <value>1</value> </prop> </node> + <node oor:name=".uno:OpenRemote" oor:op="replace"> + <prop oor:name="Label" oor:type="xs:string"> + <value xml:lang="en-US">~Open Remote File...</value> + </prop> + <prop oor:name="Properties" oor:type="xs:int"> + <value>1</value> + </prop> + </node> <node oor:name=".uno:ConvertFormulaToValue" oor:op="replace"> <prop oor:name="Label" oor:type="xs:string"> <value xml:lang="en-US">Formula to Value</value> diff --git a/sc/uiconfig/scalc/toolbar/standardbar.xml b/sc/uiconfig/scalc/toolbar/standardbar.xml index e61b068..9e2cbca 100644 --- a/sc/uiconfig/scalc/toolbar/standardbar.xml +++ b/sc/uiconfig/scalc/toolbar/standardbar.xml @@ -22,6 +22,7 @@ <toolbar:toolbaritem xlink:href=".uno:AddDirect"/> <toolbar:toolbaritem xlink:href=".uno:NewDoc" toolbar:visible="false"/> <toolbar:toolbaritem xlink:href=".uno:OpenFromCalc" toolbar:style="dropdown"/> + <toolbar:toolbaritem xlink:href=".uno:OpenRemote"/> <toolbar:toolbaritem xlink:href=".uno:Save"/> <toolbar:toolbaritem xlink:href=".uno:SaveAs"/> <toolbar:toolbaritem xlink:href=".uno:SendMail" toolbar:visible="false"/> commit 32088cd00df1ca5c0a939fe707b55361c77a7f97 Author: Szymon KÅos <eszka...@gmail.com> Date: Mon Jul 6 17:14:55 2015 +0200 open remote button in sw standard toolbar Change-Id: I7e702da5d4ecc8c32d91e86bd209ec4b7d4f4431 diff --git a/icon-themes/breeze/links.txt b/icon-themes/breeze/links.txt index 1a2de77..7ba9f85 100644 --- a/icon-themes/breeze/links.txt +++ b/icon-themes/breeze/links.txt @@ -1,8 +1,10 @@ # Open cmd/lc_openfromwriter.png cmd/lc_open.png cmd/lc_openfromcalc.png cmd/lc_open.png +cmd/lc_openremote.png cmd/lc_open.png cmd/sc_openfromwriter.png cmd/sc_open.png cmd/sc_openfromcalc.png cmd/sc_open.png +cmd/sc_openremote.png cmd/sc_open.png # Hyperlink cmd/lc_hyperlinkdialog.png cmd/lc_inserthyperlink.png diff --git a/icon-themes/tango/links.txt b/icon-themes/tango/links.txt index 7ee19c8..2fc1b96 100644 --- a/icon-themes/tango/links.txt +++ b/icon-themes/tango/links.txt @@ -269,8 +269,10 @@ cmd/sc_nextpage.png cmd/sc_navigateforward.png res/sc06300.png cmd/sc_navigateforward.png cmd/lc_openfromwriter.png cmd/lc_open.png cmd/lc_openfromcalc.png cmd/lc_open.png +cmd/lc_openremote.png cmd/lc_open.png cmd/sc_openfromwriter.png cmd/sc_open.png cmd/sc_openfromcalc.png cmd/sc_open.png +cmd/sc_openremote.png cmd/sc_open.png sc/imglst/lc26048.png cmd/lc_autosum.png sc/imglst/sc26048.png cmd/sc_autosum.png cmd/lc_fontcolor.png cmd/lc_color.png diff --git a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu index f9a866e..c8546eb 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu @@ -2317,6 +2317,14 @@ <value>1</value> </prop> </node> + <node oor:name=".uno:OpenRemote" oor:op="replace"> + <prop oor:name="Label" oor:type="xs:string"> + <value xml:lang="en-US">~Open Remote File...</value> + </prop> + <prop oor:name="Properties" oor:type="xs:int"> + <value>1</value> + </prop> + </node> </node> <node oor:name="Popups"> <node oor:name=".uno:TableMenu" oor:op="replace"> diff --git a/sw/uiconfig/swriter/toolbar/standardbar.xml b/sw/uiconfig/swriter/toolbar/standardbar.xml index 9366b92..7912789 100644 --- a/sw/uiconfig/swriter/toolbar/standardbar.xml +++ b/sw/uiconfig/swriter/toolbar/standardbar.xml @@ -22,6 +22,7 @@ <toolbar:toolbaritem xlink:href=".uno:AddDirect" toolbar:helpid="5537"/> <toolbar:toolbaritem xlink:href=".uno:NewDoc" toolbar:visible="false" toolbar:helpid="5500"/> <toolbar:toolbaritem xlink:href=".uno:OpenFromWriter" toolbar:style="dropdown"/> + <toolbar:toolbaritem xlink:href=".uno:OpenRemote"/> <toolbar:toolbaritem xlink:href=".uno:Save" toolbar:helpid="5505"/> <toolbar:toolbaritem xlink:href=".uno:SaveAs" toolbar:helpid="5502"/> <toolbar:toolbaritem xlink:href=".uno:SendMail" toolbar:visible="false" toolbar:helpid="5331"/> commit 0cfec3d3bd77d9f19d0dc74ff2516a2460a3ea89 Author: Szymon KÅos <eszka...@gmail.com> Date: Mon Jul 6 16:01:26 2015 +0200 open remote entry in the open drop down menu Change-Id: Idebc8a926c6653c476c2507606d4a89b22e2eaaf diff --git a/framework/inc/classes/resource.hrc b/framework/inc/classes/resource.hrc index 8d23371..6620c99 100644 --- a/framework/inc/classes/resource.hrc +++ b/framework/inc/classes/resource.hrc @@ -50,6 +50,7 @@ #define STR_CLEAR_RECENT_FILES (RID_STR_START+23) #define STR_CLEAR_RECENT_FILES_HELP (RID_STR_START+24) #define STR_LANGSTATUS_HINT (RID_STR_START+25) +#define STR_OPEN_REMOTE (RID_STR_START+26) ... etc. - the rest is truncated
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits