diff options
author | Szymon Kłos <eszkadev@gmail.com> | 2015-05-19 21:32:05 +0200 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2015-10-18 23:48:59 +0200 |
commit | bf86643b3e71519ae20620fb816b04bba2d99bdb (patch) | |
tree | f37b8afc6cd27407bc8738f6599e0c2201c120bc | |
parent | 6cc58b9fa7ed6b5781963427df47b03417f17973 (diff) |
RemoteFilesDialog
Change-Id: I296ce6233287dac5447462faa4b7404c25297f8b
(cherry picked from commit 87297284782adbf1fcb73663ad2d2a38b5ae1872)
101 files changed, 4409 insertions, 924 deletions
diff --git a/accessibility/inc/accessibility/extended/AccessibleGridControlBase.hxx b/accessibility/inc/accessibility/extended/AccessibleGridControlBase.hxx index 789f6a321d42..dacd8fa21ff1 100644 --- a/accessibility/inc/accessibility/extended/AccessibleGridControlBase.hxx +++ b/accessibility/inc/accessibility/extended/AccessibleGridControlBase.hxx @@ -271,9 +271,6 @@ protected: /** Changes the name of the object (flat assignment, no notify). @attention This method requires a locked mutex. */ inline void implSetName( const OUString& rName ); - /** Changes the description of the object (flat assignment, no notify). - @attention This method requires a locked mutex. */ - inline void implSetDescription( const OUString& rDescription ); /** Locks all mutex's and calculates the bounding box relative to the parent window. @@ -369,13 +366,6 @@ inline void AccessibleGridControlBase::implSetName( m_aName = rName; } -inline void AccessibleGridControlBase::implSetDescription( - const OUString& rDescription ) -{ - m_aDescription = rDescription; -} - - } // namespace accessibility diff --git a/accessibility/inc/accessibility/extended/AccessibleGridControlHeaderCell.hxx b/accessibility/inc/accessibility/extended/AccessibleGridControlHeaderCell.hxx index 0debdbb8072b..6a10f9f1edd7 100644 --- a/accessibility/inc/accessibility/extended/AccessibleGridControlHeaderCell.hxx +++ b/accessibility/inc/accessibility/extended/AccessibleGridControlHeaderCell.hxx @@ -64,11 +64,6 @@ namespace accessibility getAccessibleContext() throw ( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE; - inline bool isRowBarCell() const - { - return getType() == ::svt::table::TCTYPE_ROWHEADERCELL; - } - /** @return The name of this class. */ diff --git a/accessibility/inc/accessibility/extended/accessibletablistboxtable.hxx b/accessibility/inc/accessibility/extended/accessibletablistboxtable.hxx index 8c47222f2ff2..21c2838fb66c 100644 --- a/accessibility/inc/accessibility/extended/accessibletablistboxtable.hxx +++ b/accessibility/inc/accessibility/extended/accessibletablistboxtable.hxx @@ -65,12 +65,8 @@ private: /** Returns the row index from cell index. */ inline sal_Int32 implGetRow( sal_Int32 _nIndex ) const { return _nIndex / implGetColumnCount(); } - /** Returns the column index from cell index. */ - inline sal_Int32 implGetColumn( sal_Int32 _nIndex ) const { return _nIndex % implGetColumnCount(); } /** Returns the absolute row index of the nSelRow-th selected row. */ sal_Int32 implGetSelRow( sal_Int32 _nSelRow ) const; - /** Returns the child index from cell position. */ - inline sal_Int32 implGetIndex( sal_Int32 _nRow, sal_Int32 _nColumn ) const { return _nRow * implGetColumnCount() + _nColumn; } public: /** ctor() diff --git a/accessibility/inc/accessibility/helper/IComboListBoxHelper.hxx b/accessibility/inc/accessibility/helper/IComboListBoxHelper.hxx index c218d0e59ee2..c3910b59fdc7 100644 --- a/accessibility/inc/accessibility/helper/IComboListBoxHelper.hxx +++ b/accessibility/inc/accessibility/helper/IComboListBoxHelper.hxx @@ -42,7 +42,6 @@ namespace accessibility virtual Rectangle GetDropDownPosSizePixel( ) const = 0; virtual Rectangle GetBoundingRectangle( sal_uInt16 nItem ) const = 0; virtual Rectangle GetWindowExtentsRelative( vcl::Window* pRelativeWindow ) = 0; - virtual bool IsActive() const = 0; virtual bool IsEnabled() const = 0; virtual bool IsEntryVisible( sal_Int32 nPos ) const = 0; virtual sal_uInt16 GetDisplayLineCount() const = 0; diff --git a/accessibility/inc/accessibility/helper/listboxhelper.hxx b/accessibility/inc/accessibility/helper/listboxhelper.hxx index 98ee64ddcfde..89c5b0cc762b 100644 --- a/accessibility/inc/accessibility/helper/listboxhelper.hxx +++ b/accessibility/inc/accessibility/helper/listboxhelper.hxx @@ -81,11 +81,6 @@ public: return m_aComboListBox.GetWindowExtentsRelative( pRelativeWindow ); } - virtual bool IsActive() const SAL_OVERRIDE - { - return m_aComboListBox.IsActive(); - } - virtual bool IsEnabled() const SAL_OVERRIDE { return m_aComboListBox.IsEnabled(); diff --git a/accessibility/inc/accessibility/standard/accessiblemenubasecomponent.hxx b/accessibility/inc/accessibility/standard/accessiblemenubasecomponent.hxx index 3a2b6b9aa950..fe772e47d724 100644 --- a/accessibility/inc/accessibility/standard/accessiblemenubasecomponent.hxx +++ b/accessibility/inc/accessibility/standard/accessiblemenubasecomponent.hxx @@ -64,19 +64,17 @@ protected: AccessibleChildren m_aAccessibleChildren; Menu* m_pMenu; - bool m_bEnabled; - bool m_bFocused; - bool m_bVisible; - bool m_bSelected; - bool m_bChecked; - - Menu* GetMenu() { return m_pMenu; } - - virtual bool IsEnabled(); - virtual bool IsFocused(); - virtual bool IsVisible(); - virtual bool IsSelected(); - virtual bool IsChecked(); + bool m_bEnabled; + bool m_bFocused; + bool m_bVisible; + bool m_bSelected; + bool m_bChecked; + + virtual bool IsEnabled(); + virtual bool IsFocused(); + virtual bool IsVisible(); + virtual bool IsSelected(); + virtual bool IsChecked(); void SetEnabled( bool bEnabled ); void SetFocused( bool bFocused ); diff --git a/accessibility/inc/accessibility/standard/vclxaccessiblebox.hxx b/accessibility/inc/accessibility/standard/vclxaccessiblebox.hxx index 3e35bfc78598..110cf9fbb432 100644 --- a/accessibility/inc/accessibility/standard/vclxaccessiblebox.hxx +++ b/accessibility/inc/accessibility/standard/vclxaccessiblebox.hxx @@ -137,8 +137,6 @@ public: virtual ::com::sun::star::uno::Any SAL_CALL getMinimumValue( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; - bool IsDropDownBox() {return m_bIsDropDownBox;}; - BoxType GetBoxType() { return m_aBoxType;}; protected: /** Specifies whether the box is a combo box or a list box. List boxes have multi selection. diff --git a/accessibility/inc/accessibility/standard/vclxaccessiblelistitem.hxx b/accessibility/inc/accessibility/standard/vclxaccessiblelistitem.hxx index 87db9bea130f..efeeac9585cf 100644 --- a/accessibility/inc/accessibility/standard/vclxaccessiblelistitem.hxx +++ b/accessibility/inc/accessibility/standard/vclxaccessiblelistitem.hxx @@ -116,8 +116,6 @@ public: inline bool IsSelected() const { return m_bSelected; } void SetSelected( bool _bSelected ); void SetVisible( bool _bVisible ); - inline bool DecrementIndexInParent() { OSL_ENSURE(m_nIndexInParent != 0,"Invalid call!");--m_nIndexInParent; return true;} - inline bool IncrementIndexInParent() { ++m_nIndexInParent; return true;} // XInterface virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; diff --git a/accessibility/inc/accessibility/standard/vclxaccessibletoolboxitem.hxx b/accessibility/inc/accessibility/standard/vclxaccessibletoolboxitem.hxx index a05f31b89d1f..7c7d605af802 100644 --- a/accessibility/inc/accessibility/standard/vclxaccessibletoolboxitem.hxx +++ b/accessibility/inc/accessibility/standard/vclxaccessibletoolboxitem.hxx @@ -83,9 +83,7 @@ public: void SetFocus( bool _bFocus ); inline bool HasFocus() const { return m_bHasFocus; } void SetChecked( bool _bCheck ); - inline bool IsChecked() const { return m_bIsChecked; } void SetIndeterminate( bool _bIndeterminate ); - inline bool IsIndeterminate() const { return m_bIndeterminate; } inline void ReleaseToolBox() { m_pToolBox = NULL; } void NameChanged(); void SetChild( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _xChild ); diff --git a/fpicker/Library_fps_office.mk b/fpicker/Library_fps_office.mk index c109dce3a978..6c484a0a4a31 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/UIConfig_fps.mk b/fpicker/UIConfig_fps.mk index c5582587bda5..ee8fea50d663 100644 --- a/fpicker/UIConfig_fps.mk +++ b/fpicker/UIConfig_fps.mk @@ -12,6 +12,7 @@ $(eval $(call gb_UIConfig_UIConfig,fps)) $(eval $(call gb_UIConfig_add_uifiles,fps,\ fpicker/uiconfig/ui/explorerfiledialog \ fpicker/uiconfig/ui/foldernamedialog \ + fpicker/uiconfig/ui/remotefilesdialog \ )) # vim: set noet sw=4 ts=4: diff --git a/fpicker/source/office/OfficeFilePicker.cxx b/fpicker/source/office/OfficeFilePicker.cxx index 6fd28edfd242..5fb8edc351ea 100644 --- a/fpicker/source/office/OfficeFilePicker.cxx +++ b/fpicker/source/office/OfficeFilePicker.cxx @@ -20,6 +20,7 @@ #include "OfficeFilePicker.hxx" #include "iodlg.hxx" +#include "RemoteFilesDialog.hxx" #include <list> #include <functional> @@ -463,7 +464,7 @@ sal_Int16 SvtFilePicker::implExecutePicker( ) } -VclPtr<SvtFileDialog> SvtFilePicker::implCreateDialog( vcl::Window* _pParent ) +VclPtr<SvtFileDialog_Base> SvtFilePicker::implCreateDialog( vcl::Window* _pParent ) { WinBits nExtraBits; WinBits nBits = getWinBits( nExtraBits ); @@ -491,6 +492,13 @@ IMPLEMENT_FORWARD_XINTERFACE2( SvtFilePicker, OCommonPicker, SvtFilePicker_Base IMPLEMENT_FORWARD_XTYPEPROVIDER2( SvtFilePicker, OCommonPicker, SvtFilePicker_Base ) +IMPLEMENT_FORWARD_XINTERFACE3( SvtRemoteFilePicker, SvtFilePicker, OCommonPicker, SvtFilePicker_Base ) + + +// disambiguate XTypeProvider + +IMPLEMENT_FORWARD_XTYPEPROVIDER3( SvtRemoteFilePicker, SvtFilePicker, OCommonPicker, SvtFilePicker_Base ) + // XExecutableDialog functions @@ -1165,4 +1173,73 @@ Reference< XInterface > SAL_CALL SvtFilePicker::impl_createInstance( return Reference< XInterface >( *new SvtFilePicker( xServiceManager ) ); } +// SvtRemoteFilePicker + +SvtRemoteFilePicker::SvtRemoteFilePicker( const Reference < XMultiServiceFactory >& xFactory ) + :SvtFilePicker( xFactory ) +{ +} + +VclPtr<SvtFileDialog_Base> SvtRemoteFilePicker::implCreateDialog( vcl::Window* _pParent ) +{ + WinBits nExtraBits; + WinBits nBits = getWinBits( nExtraBits ); + + VclPtrInstance<RemoteFilesDialog> dialog( _pParent, nBits); // TODO: extrabits + + // Set StandardDir if present + if ( !m_aStandardDir.isEmpty()) + { + OUString sStandardDir = m_aStandardDir; + dialog->SetStandardDir( sStandardDir ); + dialog->SetBlackList( m_aBlackList ); + } + + return dialog; +} + +// XServiceInfo + + +/* XServiceInfo */ +OUString SAL_CALL SvtRemoteFilePicker::getImplementationName() throw( RuntimeException, std::exception ) +{ + return impl_getStaticImplementationName(); +} + +/* XServiceInfo */ +sal_Bool SAL_CALL SvtRemoteFilePicker::supportsService( const OUString& sServiceName ) throw( RuntimeException, std::exception ) +{ + return cppu::supportsService(this, sServiceName); +} + +/* XServiceInfo */ +Sequence< OUString > SAL_CALL SvtRemoteFilePicker::getSupportedServiceNames() throw( RuntimeException, std::exception ) +{ + return impl_getStaticSupportedServiceNames(); +} + +/* Helper for XServiceInfo */ +Sequence< OUString > SvtRemoteFilePicker::impl_getStaticSupportedServiceNames() +{ + Sequence< OUString > seqServiceNames( 1 ); + OUString* pArray = seqServiceNames.getArray(); + pArray[0] = "com.sun.star.ui.dialogs.RemoteFilePicker"; + return seqServiceNames ; +} + +/* Helper for XServiceInfo */ +OUString SvtRemoteFilePicker::impl_getStaticImplementationName() +{ + return OUString( "com.sun.star.svtools.RemoteFilePicker" ); +} + +/* Helper for registry */ +Reference< XInterface > SAL_CALL SvtRemoteFilePicker::impl_createInstance( + const Reference< XComponentContext >& rxContext) throw( Exception ) +{ + Reference< XMultiServiceFactory > xServiceManager (rxContext->getServiceManager(), UNO_QUERY_THROW); + return Reference< XInterface >( *new SvtRemoteFilePicker( xServiceManager ) ); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/office/OfficeFilePicker.hxx b/fpicker/source/office/OfficeFilePicker.hxx index fa8313e16a85..df6ad1c7b195 100644 --- a/fpicker/source/office/OfficeFilePicker.hxx +++ b/fpicker/source/office/OfficeFilePicker.hxx @@ -61,7 +61,7 @@ class SvtFilePicker :public SvtFilePicker_Base ,public ::svt::OCommonPicker ,public ::svt::IFilePickerListener { -private: +protected: FilterList* m_pFilterList; ElementList* m_pElemList; @@ -205,14 +205,14 @@ protected: // OCommonPicker overridables - virtual VclPtr<SvtFileDialog> implCreateDialog( vcl::Window* _pParent ) SAL_OVERRIDE; + virtual VclPtr<SvtFileDialog_Base> implCreateDialog( vcl::Window* _pParent ) SAL_OVERRIDE; virtual sal_Int16 implExecutePicker( ) SAL_OVERRIDE; virtual bool implHandleInitializationArgument( const OUString& _rName, const ::com::sun::star::uno::Any& _rValue ) SAL_OVERRIDE; -private: +protected: WinBits getWinBits( WinBits& rExtraBits ); virtual void notify( sal_Int16 _nEventId, sal_Int16 _nControlId ) SAL_OVERRIDE; @@ -226,6 +226,39 @@ private: DECL_LINK( DialogClosedHdl, Dialog* ); }; +// SvtRemoteFilePicker + +class SvtRemoteFilePicker : public SvtFilePicker +{ +public: + SvtRemoteFilePicker( const ::com::sun::star::uno::Reference < ::com::sun::star::lang::XMultiServiceFactory >& xFactory ); + + virtual VclPtr<SvtFileDialog_Base> implCreateDialog( vcl::Window* _pParent ) SAL_OVERRIDE; + + // disambiguate XInterface + + DECLARE_XINTERFACE( ) + + // disambiguate XTypeProvider + + DECLARE_XTYPEPROVIDER( ) + + /* XServiceInfo */ + virtual OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE; + virtual sal_Bool SAL_CALL supportsService( const OUString& sServiceName ) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE; + virtual com::sun::star::uno::Sequence< OUString > SAL_CALL + getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE; + + /* Helper for XServiceInfo */ + static com::sun::star::uno::Sequence< OUString > impl_getStaticSupportedServiceNames(); + static OUString impl_getStaticImplementationName(); + + /* Helper for registry */ + static ::com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL impl_createInstance ( + const ::com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext ) + throw( com::sun::star::uno::Exception ); +}; + #endif // INCLUDED_FPICKER_SOURCE_OFFICE_OFFICEFILEPICKER_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/office/OfficeFolderPicker.cxx b/fpicker/source/office/OfficeFolderPicker.cxx index 8f524856884c..33a3e53d2245 100644 --- a/fpicker/source/office/OfficeFolderPicker.cxx +++ b/fpicker/source/office/OfficeFolderPicker.cxx @@ -69,7 +69,7 @@ void SAL_CALL SvtFolderPicker::startExecuteModal( const Reference< ::com::sun::s getDialog()->StartExecuteModal( LINK( this, SvtFolderPicker, DialogClosedHdl ) ); } -VclPtr<SvtFileDialog> SvtFolderPicker::implCreateDialog( vcl::Window* _pParent ) +VclPtr<SvtFileDialog_Base> SvtFolderPicker::implCreateDialog( vcl::Window* _pParent ) { return VclPtr<SvtFileDialog>::Create( _pParent, SFXWB_PATHDIALOG ); } diff --git a/fpicker/source/office/OfficeFolderPicker.hxx b/fpicker/source/office/OfficeFolderPicker.hxx index 266c99cbef8a..b2697aef43e5 100644 --- a/fpicker/source/office/OfficeFolderPicker.hxx +++ b/fpicker/source/office/OfficeFolderPicker.hxx @@ -99,7 +99,7 @@ protected: // OCommonPicker overridables - virtual VclPtr<SvtFileDialog> implCreateDialog( vcl::Window* _pParent ) SAL_OVERRIDE; + virtual VclPtr<SvtFileDialog_Base> implCreateDialog( vcl::Window* _pParent ) SAL_OVERRIDE; virtual sal_Int16 implExecutePicker( ) SAL_OVERRIDE; }; diff --git a/fpicker/source/office/RemoteFilesDialog.cxx b/fpicker/source/office/RemoteFilesDialog.cxx new file mode 100644 index 000000000000..94f6f3fccb0e --- /dev/null +++ b/fpicker/source/office/RemoteFilesDialog.cxx @@ -0,0 +1,1498 @@ +/* -*- 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 "RemoteFilesDialog.hxx" + +class FileViewContainer : public vcl::Window +{ + enum FocusState + { + Prev = 0, + TreeView, + FileView, + Next, + FocusCount + }; + + private: + VclPtr< SvtFileView > m_pFileView; + VclPtr< FolderTree > m_pTreeView; + VclPtr< Splitter > m_pSplitter; + + int m_nCurrentFocus; + VclPtr<vcl::Window> m_pFocusWidgets[FocusState::FocusCount]; + + public: + FileViewContainer( vcl::Window *pParent ) + : Window( pParent, WB_TABSTOP ) + , m_pFileView( NULL ) + , m_pTreeView( NULL ) + , m_pSplitter( NULL ) + , m_nCurrentFocus( 0 ) + { + } + + virtual ~FileViewContainer() + { + disposeOnce(); + } + + virtual void dispose() SAL_OVERRIDE + { + m_pFileView.clear(); + m_pTreeView.clear(); + m_pSplitter.clear(); + vcl::Window::dispose(); + } + + void init( SvtFileView* pFileView, + Splitter* pSplitter, + FolderTree* pTreeView, + vcl::Window* pPrevSibling, + vcl::Window* pNextSibling ) + { + m_pFileView = pFileView; + m_pTreeView = pTreeView; + m_pSplitter = pSplitter; + m_pFocusWidgets[FocusState::Prev] = pPrevSibling; + m_pFocusWidgets[FocusState::TreeView] = pTreeView; + m_pFocusWidgets[FocusState::FileView] = pFileView; + m_pFocusWidgets[FocusState::Next] = pNextSibling; + } + + virtual void Resize() SAL_OVERRIDE + { + Window::Resize(); + + if( !m_pFileView || !m_pTreeView ) + return; + + Size aSize = GetSizePixel(); + Point aPos( m_pFileView->GetPosPixel() ); + Size aNewSize( aSize.Width() - aPos.X(), aSize.Height() ); + + m_pFileView->SetSizePixel( aNewSize ); + + // Resize the Splitter to fit the height + Size splitterNewSize = m_pSplitter->GetSizePixel(); + splitterNewSize.Height() = aSize.Height(); + m_pSplitter->SetSizePixel( splitterNewSize ); + sal_Int32 nMinX = m_pTreeView->GetPosPixel().X(); + sal_Int32 nMaxX = m_pFileView->GetPosPixel().X() + m_pFileView->GetSizePixel().Width() - nMinX; + m_pSplitter->SetDragRectPixel( Rectangle( Point( nMinX, 0 ), Size( nMaxX, aSize.Width() ) ) ); + + // Resize the tree list box to fit the height of the FileView + Size placesNewSize( m_pTreeView->GetSizePixel() ); + placesNewSize.Height() = aSize.Height(); + m_pTreeView->SetSizePixel( placesNewSize ); + } + + void changeFocus( bool bReverse ) + { + if( !m_pFileView || !m_pTreeView ) + return; + + if( bReverse && m_nCurrentFocus > FocusState::Prev && m_nCurrentFocus <= FocusState::Next ) + { + m_pFocusWidgets[m_nCurrentFocus]->SetFakeFocus(false); + m_pFocusWidgets[m_nCurrentFocus]->LoseFocus(); + + m_pFocusWidgets[--m_nCurrentFocus]->SetFakeFocus( true ); + m_pFocusWidgets[m_nCurrentFocus]->GrabFocus(); + } + else if( !bReverse && m_nCurrentFocus >= FocusState::Prev && m_nCurrentFocus < FocusState::Next ) + { + m_pFocusWidgets[m_nCurrentFocus]->SetFakeFocus(false); + m_pFocusWidgets[m_nCurrentFocus]->LoseFocus(); + + m_pFocusWidgets[++m_nCurrentFocus]->SetFakeFocus( true ); + m_pFocusWidgets[m_nCurrentFocus]->GrabFocus(); + } + } + + virtual void GetFocus() SAL_OVERRIDE + { + if( !m_pFileView || !m_pTreeView ) + return; + + sal_uInt16 aFlags = GetGetFocusFlags(); + + if( aFlags & GETFOCUS_FORWARD ) + m_nCurrentFocus = FocusState::TreeView; + else if( aFlags & GETFOCUS_BACKWARD ) + m_nCurrentFocus = FocusState::FileView; + + if( m_nCurrentFocus >= FocusState::Prev && m_nCurrentFocus <= FocusState::Next ) + { + m_pFocusWidgets[m_nCurrentFocus]->SetFakeFocus( true ); + m_pFocusWidgets[m_nCurrentFocus]->GrabFocus(); + } + } + + virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE + { + if( rNEvt.GetType() == MouseNotifyEvent::GETFOCUS ) + { + // we must also update counter when user change focus using mouse + for(int i = FocusState::Prev; i <= FocusState::Next; i++) + { + if( rNEvt.GetWindow() == m_pFocusWidgets[i] ) + { + m_nCurrentFocus = i; + return true; + } + } + + // GETFOCUS for one of FileView's subcontrols + m_nCurrentFocus = FocusState::FileView; + return true; + } + if( rNEvt.GetType() == MouseNotifyEvent::KEYINPUT ) + { + const KeyEvent* pKeyEvent = rNEvt.GetKeyEvent(); + const vcl::KeyCode& rCode = pKeyEvent->GetKeyCode(); + bool bShift = rCode.IsShift(); + if( rCode.GetCode() == KEY_TAB ) + { + changeFocus( bShift ); + return true; + } + } + return Window::Notify( rNEvt ); + } +}; + +RemoteFilesDialog::RemoteFilesDialog( vcl::Window* pParent, WinBits nBits ) + : SvtFileDialog_Base( pParent, "RemoteFilesDialog", "fps/ui/remotefilesdialog.ui" ) + , m_xContext( comphelper::getProcessComponentContext() ) + , m_xMasterPasswd( PasswordContainer::create( m_xContext ) ) + , m_nWidth( 0 ) + , m_nHeight( 0 ) + , m_pCurrentAsyncAction( NULL ) + , m_pFileNotifier( NULL ) + , m_pSplitter( NULL ) + , m_pFileView( NULL ) + , m_pContainer( NULL ) + , m_pAddMenu( NULL ) +{ + get( m_pCancel_btn, "cancel" ); + get( m_pAddService_btn, "add_service_btn" ); + get( m_pServices_lb, "services_lb" ); + get( m_pFilter_lb, "filter_lb" ); + get( m_pNewFolder, "new_folder" ); + + m_eMode = ( nBits & WB_SAVEAS ) ? REMOTEDLG_MODE_SAVE : REMOTEDLG_MODE_OPEN; + m_eType = ( nBits & WB_PATH ) ? REMOTEDLG_TYPE_PATHDLG : REMOTEDLG_TYPE_FILEDLG; + m_bMultiselection = ( nBits & SFXWB_MULTISELECTION ) != 0; + m_bIsUpdated = false; + m_bIsConnected = false; + m_bServiceChanged = false; + m_nCurrentFilter = LISTBOX_ENTRY_NOTFOUND; + + m_pName_ed = VclPtr< AutocompleteEdit >::Create( get< vcl::Window >( "filename_container" ) ); + m_pName_ed->Show(); + + m_pFilter_lb->Enable( false ); + m_pName_ed->Enable( false ); + + if( m_eMode == REMOTEDLG_MODE_OPEN ) + { + get( m_pOk_btn, "open" ); + + m_pNewFolder->Hide(); + } + else + { + get( m_pOk_btn, "save" ); + + m_aImages = ImageList( fpicker::SvtResId( RID_FILEPICKER_IMAGES ) ); + m_pNewFolder->SetModeImage( m_aImages.GetImage( IMG_FILEDLG_CREATEFOLDER ) ); + m_pNewFolder->SetClickHdl( LINK( this, RemoteFilesDialog, NewFolderHdl ) ); + } + + m_pOk_btn->Show(); + m_pOk_btn->Enable( false ); + + m_pOk_btn->SetClickHdl( LINK( this, RemoteFilesDialog, OkHdl ) ); + m_pCancel_btn->SetClickHdl( LINK( this, RemoteFilesDialog, CancelHdl ) ); + + m_sRootLabel = fpicker::SvtResId( STR_SVT_ROOTLABEL ); + m_pPath = VclPtr<Breadcrumb>::Create( get< vcl::Window >( "breadcrumb_container" ) ); + m_pPath->set_hexpand( true ); + m_pPath->SetClickHdl( LINK( this, RemoteFilesDialog, SelectBreadcrumbHdl ) ); + m_pPath->SetMode( SvtBreadcrumbMode::ALL_VISITED ); + m_pPath->Show(); + + m_pContainer = VclPtr< FileViewContainer >::Create( get< vcl::Window >("container") ); + + m_pContainer->set_hexpand( true ); + m_pContainer->set_vexpand( true ); + + m_pFileView = VclPtr< SvtFileView >::Create( m_pContainer, WB_BORDER | WB_TABSTOP, + REMOTEDLG_TYPE_PATHDLG == m_eType, + m_bMultiselection, false ); + + m_pFileView->Show(); + m_pFileView->EnableAutoResize(); + m_pFileView->SetDoubleClickHdl( LINK( this, RemoteFilesDialog, DoubleClickHdl ) ); + m_pFileView->SetSelectHdl( LINK( this, RemoteFilesDialog, SelectHdl ) ); + m_pFileView->EnableDelete( true ); + + m_pSplitter = VclPtr< Splitter >::Create( m_pContainer, WB_HSCROLL ); + m_pSplitter->SetBackground( Wallpaper( Application::GetSettings().GetStyleSettings().GetFaceColor() ) ); + m_pSplitter->SetSplitHdl( LINK( this, RemoteFilesDialog, SplitHdl ) ); + m_pSplitter->Show(); + + m_pTreeView = VclPtr< FolderTree >::Create( m_pContainer, WB_BORDER ); + Size aSize( 150, 200 ); + m_pTreeView->set_height_request( aSize.Height() ); + m_pTreeView->set_width_request( aSize.Width() ); + m_pTreeView->SetSizePixel( aSize ); + m_pTreeView->Show(); + + m_pTreeView->SetSelectHdl( LINK( this, RemoteFilesDialog, TreeSelectHdl ) ); + + sal_Int32 nPosX = m_pTreeView->GetSizePixel().Width(); + m_pSplitter->SetPosPixel( Point( nPosX, 0 ) ); + nPosX += m_pSplitter->GetSizePixel().Width(); + m_pFileView->SetPosPixel( Point( nPosX, 0 ) ); + + m_pContainer->init( m_pFileView, m_pSplitter, m_pTreeView, m_pAddService_btn, m_pFilter_lb ); + m_pContainer->Show(); + m_pContainer->Enable( false ); + + m_sIniKey = "RemoteFilesDialog"; + InitSize(); + + m_pName_ed->SetGetFocusHdl( LINK( this, RemoteFilesDialog, FileNameGetFocusHdl ) ); + m_pName_ed->SetModifyHdl( LINK( this, RemoteFilesDialog, FileNameModifyHdl ) ); + + m_pAddService_btn->SetMenuMode( MENUBUTTON_MENUMODE_TIMED ); + m_pAddMenu = m_pAddService_btn->GetPopupMenu(); + m_pAddService_btn->SetClickHdl( LINK( this, RemoteFilesDialog, AddServiceHdl ) ); + m_pAddService_btn->SetSelectHdl( LINK( this, RemoteFilesDialog, EditServiceMenuHdl ) ); + + FillServicesListbox(); + + m_pServices_lb->SetSelectHdl( LINK( this, RemoteFilesDialog, SelectServiceHdl ) ); + + m_pFilter_lb->SetSelectHdl( LINK( this, RemoteFilesDialog, SelectFilterHdl ) ); +} + +RemoteFilesDialog::~RemoteFilesDialog() +{ + disposeOnce(); +} + +void RemoteFilesDialog::dispose() +{ + m_pFileView->SetSelectHdl( Link<>() ); + + // save window state + if( !m_sIniKey.isEmpty() ) + { + SvtViewOptions aDlgOpt( E_DIALOG, m_sIniKey ); + aDlgOpt.SetWindowState( OStringToOUString( GetWindowState(), osl_getThreadTextEncoding() ) ); + + Size aSize( GetSizePixel() ); + + OUString sSize = OUString::number( aSize.Width() ) + "|"; + sSize = sSize + OUString::number( aSize.Height() ) + "|"; + + OUString sUserData = m_pFileView->GetConfigString(); + aDlgOpt.SetUserItem( OUString( "UserData" ), + makeAny( sSize + sUserData ) ); + } + + // save services + std::shared_ptr< comphelper::ConfigurationChanges > batch( comphelper::ConfigurationChanges::create( m_xContext ) ); + + officecfg::Office::Common::Misc::FilePickerLastService::set( m_sLastServiceUrl, batch ); + + if( m_bIsUpdated ) + { + Sequence< OUString > placesUrlsList( m_aServices.size() ); + Sequence< OUString > placesNamesList( m_aServices.size() ); + + int i = 0; + for( std::vector< ServicePtr >::const_iterator it = m_aServices.begin(); it != m_aServices.end(); ++it ) + { + placesUrlsList[i] = ( *it )->GetUrl(); + placesNamesList[i] = ( *it )->GetName(); + ++i; + } + + officecfg::Office::Common::Misc::FilePickerPlacesUrls::set( placesUrlsList, batch ); + officecfg::Office::Common::Misc::FilePickerPlacesNames::set( placesNamesList, batch ); + } + + batch->commit(); + + m_pTreeView.disposeAndClear(); + m_pFileView.disposeAndClear(); + m_pSplitter.disposeAndClear(); + m_pContainer.disposeAndClear(); + m_pPath.disposeAndClear(); + + m_pOk_btn.clear(); + m_pCancel_btn.clear(); + m_pAddService_btn.clear(); + m_pServices_lb.clear(); + m_pFilter_lb.clear(); + m_pName_ed.clear(); + m_pNewFolder.clear(); + + ModalDialog::dispose(); +} + +void RemoteFilesDialog::Resize() +{ + ModalDialog::Resize(); + + if( m_pFileView && m_pContainer ) + { + Size aSize = m_pContainer->GetSizePixel(); + m_pFileView->SetSizePixel( aSize ); + } + Invalidate(INVALIDATE_UPDATE); +} + +short RemoteFilesDialog::Execute() +{ + if( m_pServices_lb->GetEntryCount() == 0 ) + { + Show(); + AddServiceHdl( NULL ); + } + if( m_pServices_lb->GetEntryCount() > 0 ) + { + Show(); + SelectServiceHdl( NULL ); + } + if( !m_bIsConnected ) + { + m_pServices_lb->SetNoSelection(); + } + + short nRet = SvtFileDialog_Base::Execute(); + + return nRet; +} + +void RemoteFilesDialog::Show() +{ + SvtFileDialog_Base::Show(true, 0); + + if( m_nWidth > 0 && m_nHeight > 0 ) + { + Size aSize( m_nWidth, m_nHeight ); + SetSizePixel( aSize ); + } +} + +OUString lcl_GetServiceType( ServicePtr pService ) +{ + INetProtocol aProtocol = pService->GetUrlObject().GetProtocol(); + switch( aProtocol ) + { + case INetProtocol::Ftp: + return OUString( "FTP" ); + case INetProtocol::Cmis: + { + OUString sHost = pService->GetUrlObject().GetHost( INetURLObject::DECODE_WITH_CHARSET ); + + if( sHost.startsWith( GDRIVE_BASE_URL ) ) + return OUString( "Google Drive" ); + else if( sHost.startsWith( ALFRESCO_CLOUD_BASE_URL ) ) + return OUString( "Alfresco Cloud" ); + else if( sHost.startsWith( ONEDRIVE_BASE_URL ) ) + return OUString( "OneDrive" ); + + return OUString( "CMIS" ); + } + case INetProtocol::Smb: + return OUString( "Windows Share" ); + case INetProtocol::File: + return OUString( "SSH" ); + case INetProtocol::Http: + return OUString( "WebDAV" ); + case INetProtocol::Https: + return OUString( "WebDAV" ); + case INetProtocol::Generic: + return OUString( "SSH" ); + default: + return OUString( "" ); + } +} + +void RemoteFilesDialog::InitSize() +{ + if( m_sIniKey.isEmpty() ) + return; + + // initialize from config + SvtViewOptions aDlgOpt( E_DIALOG, m_sIniKey ); + + if( aDlgOpt.Exists() ) + { + SetWindowState( OUStringToOString( aDlgOpt.GetWindowState(), osl_getThreadTextEncoding() ) ); + + Any aUserData = aDlgOpt.GetUserItem( OUString( "UserData" ) ); + OUString sCfgStr; + if( aUserData >>= sCfgStr ) + { + int nPos = sCfgStr.indexOf( "|" ); + if( nPos != -1 ) + { + nPos = sCfgStr.indexOf( "|", nPos + 1 ); + if( nPos != -1 ) + { + sal_Int32 nIdx = 0; + m_nWidth = sCfgStr.getToken( 0, '|', nIdx ).toInt32(); + m_nHeight = sCfgStr.getToken( 0, '|', nIdx ).toInt32(); + + m_pFileView->SetConfigString( sCfgStr.copy( nPos + 1) ); + } + } + } + } +} + +void RemoteFilesDialog::FillServicesListbox() +{ + m_pServices_lb->Clear(); + m_aServices.clear(); + + // Load from user settings + Sequence< OUString > placesUrlsList( officecfg::Office::Common::Misc::FilePickerPlacesUrls::get( m_xContext ) ); + Sequence< OUString > placesNamesList( officecfg::Office::Common::Misc::FilePickerPlacesNames::get( m_xContext ) ); + + unsigned int nPos = 0; + unsigned int i = 0; + + m_sLastServiceUrl = officecfg::Office::Common::Misc::FilePickerLastService::get( m_xContext ); + + for( sal_Int32 nPlace = 0; nPlace < placesUrlsList.getLength() && nPlace < placesNamesList.getLength(); ++nPlace ) + { + ServicePtr pService( new Place( placesNamesList[nPlace], placesUrlsList[nPlace], true ) ); + m_aServices.push_back( pService ); + + // Add to the listbox only remote services, not local bookmarks + if( !pService->IsLocal() ) + { + OUString sPrefix = lcl_GetServiceType( pService ); + + 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( nPos ); + m_pAddService_btn->SetPopupMenu( m_pAddMenu ); + } + else + m_pAddService_btn->SetPopupMenu( NULL ); + + EnableControls(); +} + +int RemoteFilesDialog::GetSelectedServicePos() +{ + int nSelected = m_pServices_lb->GetSelectEntryPos(); + int nPos = 0; + int i = -1; + + if( m_aServices.size() == 0 ) + return -1; + + while( nPos < ( int )m_aServices.size() ) + { + while( m_aServices[nPos]->IsLocal() ) + nPos++; + i++; + if( i == nSelected ) + break; + nPos++; + } + + return nPos; +} + +void RemoteFilesDialog::AddFilter( const OUString& rFilter, const OUString& rType ) +{ + OUString sName = rFilter; + + if ( rType.isEmpty() ) + sName = "------------------------------------------"; + + m_aFilters.push_back( std::pair< OUString, OUString >( rFilter, rType ) ); + m_pFilter_lb->InsertEntry( sName ); + + if( m_pFilter_lb->GetSelectEntryPos() == LISTBOX_ENTRY_NOTFOUND ) + m_pFilter_lb->SelectEntryPos( 0 ); +} + +OUString RemoteFilesDialog::GetPath() const +{ + return m_sPath; +} + +FileViewResult RemoteFilesDialog::OpenURL( OUString const & sURL ) +{ + FileViewResult eResult = eFailure; + + if( m_pFileView ) + { + m_pTreeView->EndSelection(); + DisableControls(); + + EnableChildPointerOverwrite( true ); + SetPointer( PointerStyle::Wait ); + Invalidate(INVALIDATE_UPDATE); + + if( !sURL.isEmpty() ) + { + OUString sFilter = FILEDIALOG_FILTER_ALL; + + if( m_nCurrentFilter != LISTBOX_ENTRY_NOTFOUND ) + { + sFilter = m_aFilters[m_nCurrentFilter].second; + } + + m_pFileView->EndInplaceEditing( false ); + + DBG_ASSERT( !m_pCurrentAsyncAction.is(), "SvtFileDialog::executeAsync: previous async action not yet finished!" ); + + m_pCurrentAsyncAction = new AsyncPickerAction( this, m_pFileView, AsyncPickerAction::Action::eOpenURL ); + + // -1 timeout - sync + m_pCurrentAsyncAction->execute( sURL, sFilter, -1, -1, GetBlackList() ); + + if( m_eMode != REMOTEDLG_MODE_SAVE ) + m_pName_ed->SetText( "" ); + + m_pFileView->GrabFocus(); + } + else + { + SetPointer( PointerStyle::Arrow ); + EnableChildPointerOverwrite( false ); + + // content doesn't exist + ErrorHandler::HandleError( ERRCODE_IO_NOTEXISTS ); + + EnableControls(); + return eFailure; + } + + SetPointer( PointerStyle::Arrow ); + EnableChildPointerOverwrite( false ); + } + + 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 ) + { + m_pServices_lb->Enable( true ); + + if( m_pServices_lb->GetSelectEntryCount() ) + { + m_pAddMenu->EnableItem( "change_password", false ); + + try + { + if( m_xMasterPasswd->isPersistentStoringAllowed() ) + { + int nPos = GetSelectedServicePos(); + + if( nPos >= 0 ) + { + OUString sUrl( m_aServices[nPos]->GetUrl() ); + + UrlRecord aURLEntries = m_xMasterPasswd->find( sUrl, Reference< XInteractionHandler>() ); + + if( aURLEntries.UserList.getLength() ) + { + m_pAddMenu->EnableItem( "change_password" ); + } + } + } + } + catch( const Exception& ) + {} + } + } + 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 ); + } + + m_pPath->EnableFields( true ); + m_pAddService_btn->Enable( true ); + + Invalidate(INVALIDATE_UPDATE); +} + +void RemoteFilesDialog::DisableControls() +{ + m_pServices_lb->Enable( false ); + m_pFilter_lb->Enable( false ); + m_pAddService_btn->Enable( false ); + m_pName_ed->Enable( false ); + m_pContainer->Enable( false ); + m_pOk_btn->Enable( false ); + m_pPath->EnableFields( false ); + + m_pCancel_btn->Enable( true ); +} + +void RemoteFilesDialog::SavePassword( const OUString& rURL, const OUString& rUser + , const OUString& rPassword, bool bPersistent ) +{ + if( rURL.isEmpty() || rUser.isEmpty() || rPassword.isEmpty() ) + return; + + try + { + if( !bPersistent || + ( m_xMasterPasswd->isPersistentStoringAllowed() + && m_xMasterPasswd->authorizateWithMasterPassword( Reference< XInteractionHandler>() ) ) + ) + { + Reference< XInteractionHandler > xInteractionHandler( + InteractionHandler::createWithParent( m_xContext, 0 ), + UNO_QUERY ); + + Sequence< OUString > aPasswd( 1 ); + aPasswd[0] = rPassword; + + if( bPersistent ) + m_xMasterPasswd->addPersistent( + rURL, rUser, aPasswd, xInteractionHandler ); + else + m_xMasterPasswd->add( rURL, rUser, aPasswd, xInteractionHandler ); + } + } + catch( const Exception& ) + {} +} + +IMPL_LINK_NOARG ( RemoteFilesDialog, AddServiceHdl ) +{ + ScopedVclPtrInstance< PlaceEditDialog > aDlg( this ); + aDlg->ShowPasswordControl(); + short aRetCode = aDlg->Execute(); + + switch( aRetCode ) + { + case RET_OK : + { + ServicePtr newService = aDlg->GetPlace(); + m_aServices.push_back( newService ); + + OUString sPassword = aDlg->GetPassword(); + OUString sUser = aDlg->GetUser(); + if( !sUser.isEmpty() && !sPassword.isEmpty() ) + { + bool bPersistent = aDlg->IsRememberChecked(); + SavePassword( newService->GetUrl(), sUser, sPassword, bPersistent ); + } + + OUString sPrefix = lcl_GetServiceType( newService ); + + if(!sPrefix.isEmpty()) + sPrefix += ": "; + + m_pServices_lb->InsertEntry( sPrefix + newService->GetName() ); + m_pServices_lb->SelectEntryPos( m_pServices_lb->GetEntryCount() - 1 ); + m_pAddService_btn->SetPopupMenu( m_pAddMenu ); + SelectServiceHdl( NULL ); + + m_bIsUpdated = true; + + EnableControls(); + break; + } + case RET_CANCEL : + default : + // Do Nothing + break; + }; + + return 1; +} + +IMPL_LINK_NOARG ( RemoteFilesDialog, SelectServiceHdl ) +{ + int nPos = GetSelectedServicePos(); + + if( nPos >= 0 ) + { + OUString sURL = m_aServices[nPos]->GetUrl(); + m_pAddService_btn->SetPopupMenu( m_pAddMenu ); + + m_bServiceChanged = true; + OpenURL( sURL ); + } + + return 1; +} + +IMPL_LINK_TYPED ( RemoteFilesDialog, EditServiceMenuHdl, MenuButton *, pButton, void ) +{ + OString sIdent( pButton->GetCurItemIdent() ); + if( sIdent == "edit_service" && m_pServices_lb->GetEntryCount() > 0 ) + { + unsigned int nSelected = m_pServices_lb->GetSelectEntryPos(); + int nPos = GetSelectedServicePos(); + + if( nPos >= 0 ) + { + ScopedVclPtrInstance< PlaceEditDialog > aDlg( this, m_aServices[nPos] ); + short aRetCode = aDlg->Execute(); + + switch( aRetCode ) + { + case RET_OK : + { + ServicePtr pEditedService = aDlg->GetPlace(); + + m_aServices[nPos] = pEditedService; + m_pServices_lb->RemoveEntry( 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; + break; + } + case RET_NO: + sIdent = "delete_service"; + break; + case RET_CANCEL : + default : + // Do Nothing + break; + }; + } + } + if( sIdent == "delete_service" && m_pServices_lb->GetEntryCount() > 0 ) + { + unsigned int nSelected = m_pServices_lb->GetSelectEntryPos(); + int nPos = GetSelectedServicePos(); + + if( nPos >= 0 ) + { + OUString sMsg = fpicker::SvtResId( STR_SVT_DELETESERVICE ); + sMsg = sMsg.replaceFirst( "$servicename$", m_pServices_lb->GetSelectEntry() ); + ScopedVclPtrInstance< MessageDialog > aBox( this, sMsg, VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO ); + + if( aBox->Execute() == RET_YES ) + { + // remove password + try + { + if( m_xMasterPasswd->isPersistentStoringAllowed() ) + { + OUString sUrl( m_aServices[nPos]->GetUrl() ); + + Reference< XInteractionHandler > xInteractionHandler( + InteractionHandler::createWithParent( m_xContext, 0 ), + UNO_QUERY ); + + UrlRecord aURLEntries = m_xMasterPasswd->find( sUrl, xInteractionHandler ); + + if( aURLEntries.Url == sUrl && aURLEntries.UserList.getLength() ) + { + OUString sUserName = aURLEntries.UserList[0].UserName; + + m_xMasterPasswd->removePersistent( sUrl, sUserName ); + } + } + } + catch( const Exception& ) + {} + + m_aServices.erase( m_aServices.begin() + nPos ); + m_pServices_lb->RemoveEntry( nSelected ); + + m_pServices_lb->SetNoSelection(); + m_pAddService_btn->SetPopupMenu( NULL ); + + m_bIsUpdated = true; + + m_bIsConnected = false; + EnableControls(); + } + } + } + else if( sIdent == "change_password" ) + { + try + { + if( m_xMasterPasswd->isPersistentStoringAllowed() && m_xMasterPasswd->authorizateWithMasterPassword( Reference< XInteractionHandler>() ) ) + { + int nPos = GetSelectedServicePos(); + + if( nPos >= 0 ) + { + OUString sUrl( m_aServices[nPos]->GetUrl() ); + + Reference< XInteractionHandler > xInteractionHandler( + InteractionHandler::createWithParent( m_xContext, 0 ), + UNO_QUERY ); + + UrlRecord aURLEntries = m_xMasterPasswd->find( sUrl, xInteractionHandler ); + + if( aURLEntries.Url == sUrl && aURLEntries.UserList.getLength() ) + { + OUString sUserName = aURLEntries.UserList[0].UserName; + + ::comphelper::SimplePasswordRequest* pPasswordRequest + = new ::comphelper::SimplePasswordRequest( PasswordRequestMode_PASSWORD_CREATE ); + Reference< XInteractionRequest > rRequest( pPasswordRequest ); + + xInteractionHandler->handle( rRequest ); + + if ( pPasswordRequest->isPassword() ) + { + OUString aNewPass = pPasswordRequest->getPassword(); + Sequence< OUString > aPasswd( 1 ); + aPasswd[0] = aNewPass; + + m_xMasterPasswd->addPersistent( + sUrl, sUserName, aPasswd, xInteractionHandler ); + } + } + } + } + } + catch( const Exception& ) + {} + } + + EnableControls(); +} + +IMPL_LINK_NOARG ( RemoteFilesDialog, DoubleClickHdl ) +{ + if( m_pFileView->GetSelectionCount() ) + { + SvTreeListEntry* pEntry = m_pFileView->FirstSelected(); + + if( pEntry ) + { + SvtContentEntry* pData = static_cast< SvtContentEntry* >( pEntry->GetUserData() ); + + if( pData ) + { + if( !pData->mbIsFolder ) + { + EndDialog( RET_OK ); + } + else + { + OpenURL( pData->maURL ); + } + } + } + } + + return 1; +} + +IMPL_LINK_NOARG ( RemoteFilesDialog, SelectHdl ) +{ + SvTreeListEntry* pEntry = m_pFileView->FirstSelected(); + + if( pEntry ) + { + SvtContentEntry* pData = static_cast< SvtContentEntry* >( pEntry->GetUserData() ); + + if( pData ) + { + if( ( pData->mbIsFolder && ( m_eType == REMOTEDLG_TYPE_PATHDLG ) ) + || ( !pData->mbIsFolder && ( m_eType == REMOTEDLG_TYPE_FILEDLG ) ) ) + { + // url must contain user info, because we need this info in recent files entry + // (to fill user field in login box by default) + INetURLObject aURL( pData->maURL ); + INetURLObject aCurrentURL( m_sLastServiceUrl ); + aURL.SetUser( aCurrentURL.GetUser() ); + + m_sPath = aURL.GetMainURL( INetURLObject::NO_DECODE ); + + m_pName_ed->SetText( INetURLObject::decode( aURL.GetLastName(), INetURLObject::DECODE_WITH_CHARSET ) ); + } + else + { + if( m_eMode == REMOTEDLG_MODE_OPEN ) + { + m_sPath.clear(); + m_pName_ed->SetText( "" ); + } + } + + EnableControls(); + } + } + + return 1; +} + +IMPL_LINK_NOARG( RemoteFilesDialog, FileNameGetFocusHdl ) +{ + m_pFileView->SetNoSelection(); + return 1; +} + +IMPL_LINK_NOARG( RemoteFilesDialog, FileNameModifyHdl ) +{ + m_pFileView->SetNoSelection(); + if( !m_pOk_btn->IsEnabled() ) + EnableControls(); + + return 1; +} + +IMPL_LINK_NOARG ( RemoteFilesDialog, SplitHdl ) +{ + sal_Int32 nSplitPos = m_pSplitter->GetSplitPosPixel(); + + // Resize the tree list box + sal_Int32 nPlaceX = m_pTreeView->GetPosPixel().X(); + Size placeSize = m_pTreeView->GetSizePixel(); + placeSize.Width() = nSplitPos - nPlaceX; + m_pTreeView->SetSizePixel( placeSize ); + + // Change Pos and size of the fileview + Point fileViewPos = m_pFileView->GetPosPixel(); + sal_Int32 nOldX = fileViewPos.X(); + sal_Int32 nNewX = nSplitPos + m_pSplitter->GetSizePixel().Width(); + fileViewPos.X() = nNewX; + Size fileViewSize = m_pFileView->GetSizePixel(); + fileViewSize.Width() -= ( nNewX - nOldX ); + m_pFileView->SetPosSizePixel( fileViewPos, fileViewSize ); + + m_pSplitter->SetPosPixel( Point( placeSize.Width(), m_pSplitter->GetPosPixel().Y() ) ); + + return 1; +} + +IMPL_LINK_NOARG ( RemoteFilesDialog, SelectFilterHdl ) +{ + unsigned int nPos = m_pFilter_lb->GetSelectEntryPos(); + + if( nPos != LISTBOX_ENTRY_NOTFOUND && !m_aFilters[nPos].second.isEmpty() ) + { + m_nCurrentFilter = nPos; + + OUString sCurrentURL = m_pFileView->GetViewURL(); + + if( !sCurrentURL.isEmpty() && m_bIsConnected ) + OpenURL( sCurrentURL ); + } + + return 1; +} + +IMPL_LINK ( RemoteFilesDialog, TreeSelectHdl, FolderTree *, pBox ) +{ + OUString* sURL = static_cast< OUString* >( pBox->GetHdlEntry()->GetUserData() ); + + if( sURL ) + { + OpenURL( *sURL ); + m_pFileView->GrabFocus(); + } + + return 1; +} + +IMPL_LINK ( RemoteFilesDialog, SelectBreadcrumbHdl, Breadcrumb*, pPtr ) +{ + if( pPtr ) + { + OpenURL( pPtr->GetHdlURL() ); + } + + return 1; +} + +IMPL_LINK_NOARG ( RemoteFilesDialog, NewFolderHdl ) +{ + m_pFileView->EndInplaceEditing( false ); + + SmartContent aContent( m_pFileView->GetViewURL() ); + OUString aTitle; + aContent.getTitle( aTitle ); + ScopedVclPtrInstance< QueryFolderNameDialog > aDlg( this, aTitle, fpicker::SVT_RESSTR( STR_SVT_NEW_FOLDER ) ); + bool bHandled = false; + + while( !bHandled ) + { + if( aDlg->Execute() == RET_OK ) + { + OUString aUrl = aContent.createFolder( aDlg->GetName() ); + if( !aUrl.isEmpty() ) + { + m_pFileView->CreatedFolder( aUrl, aDlg->GetName() ); + bHandled = true; + } + } + else + bHandled = true; + } + + return 1; +} + +IMPL_LINK_NOARG ( RemoteFilesDialog, OkHdl ) +{ + OUString sNameNoExt = m_pName_ed->GetText(); + OUString sPathNoExt; + + // auto extension + if( m_eMode == REMOTEDLG_MODE_SAVE ) + AddFileExtension(); + + // check if file/path exists + + OUString sCurrentPath = m_pFileView->GetViewURL(); + OUString sSelectedItem = m_pFileView->GetCurrentURL(); + OUString sName = m_pName_ed->GetText(); + + bool bFileDlg = ( m_eType == REMOTEDLG_TYPE_FILEDLG ); + bool bSelected = ( m_pFileView->GetSelectionCount() > 0 ); + + if( !sCurrentPath.endsWith("/") ) + sCurrentPath += "/"; + + if( !bSelected ) + { + m_sPath = sCurrentPath + INetURLObject::encode( sName, INetURLObject::PART_FPATH, INetURLObject::ENCODE_ALL ); + sPathNoExt = sCurrentPath + INetURLObject::encode( sNameNoExt, INetURLObject::PART_FPATH, INetURLObject::ENCODE_ALL ); + } + else + { + if( m_eType == REMOTEDLG_TYPE_PATHDLG ) + m_sPath = sCurrentPath; + else + m_sPath = sSelectedItem; + + // url must contain user info, because we need this info in recent files entry + // (to fill user field in login box by default) + INetURLObject aURL( m_sPath ); + INetURLObject aCurrentURL( m_sLastServiceUrl ); + aURL.SetUser( aCurrentURL.GetUser() ); + + m_sPath = aURL.GetMainURL( INetURLObject::NO_DECODE ); + } + + bool bExists = false; + + if( bFileDlg ) + bExists = ContentIsDocument( m_sPath ); + else + bExists = ContentIsFolder( m_sPath ); + + if( bExists ) + { + if( m_eMode == REMOTEDLG_MODE_SAVE ) + { + OUString sMsg = fpicker::SvtResId( STR_SVT_ALREADYEXISTOVERWRITE ); + 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( ContentIsFolder( sPathNoExt ) ) + { + OpenURL( sPathNoExt ); + m_pName_ed->SetText( "" ); + + if( !bSelected ) + m_pName_ed->GrabFocus(); + + return 0; + } + + if( m_eMode == REMOTEDLG_MODE_OPEN ) + return 0; + } + + EndDialog( RET_OK ); + return 1; +} + +IMPL_LINK_NOARG ( RemoteFilesDialog, CancelHdl ) +{ + if( m_pCurrentAsyncAction.is() ) + { + m_pCurrentAsyncAction->cancel(); + onAsyncOperationFinished(); + } + else + { + EndDialog( RET_CANCEL ); + } + return 1; +} + +// SvtFileDialog_Base + +SvtFileView* RemoteFilesDialog::GetView() +{ + return m_pFileView; +} + +void RemoteFilesDialog::SetHasFilename( bool ) +{ +} + +void RemoteFilesDialog::SetBlackList( const ::com::sun::star::uno::Sequence< OUString >& rBlackList ) +{ + m_aBlackList = rBlackList; + m_pTreeView->SetBlackList( rBlackList ); +} + +const ::com::sun::star::uno::Sequence< OUString >& RemoteFilesDialog::GetBlackList() const +{ + return m_aBlackList; +} + +void RemoteFilesDialog::SetStandardDir( const OUString& rStdDir ) +{ + m_sStdDir = rStdDir; +} + +const OUString& RemoteFilesDialog::GetStandardDir() const +{ + return m_sStdDir; +} + +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 ); + } +} + +OUString RemoteFilesDialog::getCurrentFileText() const +{ + OUString sReturn; + if( m_pName_ed ) + sReturn = m_pName_ed->GetText(); + return sReturn; +} + +void RemoteFilesDialog::setCurrentFileText( const OUString& rText, bool bSelectAll ) +{ + if( m_pName_ed ) + { + m_pName_ed->SetText( rText ); + if( bSelectAll ) + m_pName_ed->SetSelection( Selection( 0, rText.getLength() ) ); + } +} + +void RemoteFilesDialog::AddFilterGroup( + const OUString& rFilter, + const com::sun::star::uno::Sequence< com::sun::star::beans::StringPair >& rFilters ) +{ + AddFilter( rFilter, OUString() ); + const StringPair* pSubFilters = rFilters.getConstArray(); + const StringPair* pSubFiltersEnd = pSubFilters + rFilters.getLength(); + for ( ; pSubFilters != pSubFiltersEnd; ++pSubFilters ) + AddFilter( pSubFilters->First, pSubFilters->Second ); +} + +OUString RemoteFilesDialog::GetCurFilter() const +{ + OUString sFilter; + + if( m_nCurrentFilter != LISTBOX_ENTRY_NOTFOUND ) + { + sFilter = m_aFilters[m_nCurrentFilter].first; + } + + return sFilter; +} + +OUString RemoteFilesDialog::getCurFilter( ) const +{ + return GetCurFilter(); +} + +void RemoteFilesDialog::SetCurFilter( const OUString& rFilter ) +{ + DBG_ASSERT( !IsInExecute(), "SvtFileDialog::SetCurFilter: currently executing!" ); + + // look for corresponding filter + sal_uInt16 nPos = m_aFilters.size(); + + while ( nPos-- ) + { + if ( m_aFilters[nPos].first == rFilter ) + { + m_nCurrentFilter = nPos; + m_pFilter_lb->SelectEntryPos( m_nCurrentFilter ); + break; + } + } +} + +void RemoteFilesDialog::FilterSelect() +{ +} + +void RemoteFilesDialog::SetFileCallback( ::svt::IFilePickerListener *pNotifier ) +{ + m_pFileNotifier = pNotifier; +} + +void RemoteFilesDialog::onAsyncOperationStarted() +{ + DisableControls(); +} + +void RemoteFilesDialog::onAsyncOperationFinished() +{ + m_pCurrentAsyncAction = NULL; + EnableControls(); +} + +void RemoteFilesDialog::UpdateControls( const OUString& rURL ) +{ + int nPos = GetSelectedServicePos(); + + if( nPos >= 0 && m_bServiceChanged && rURL == m_aServices[nPos]->GetUrl() ) + { + OUString sURL = m_aServices[nPos]->GetUrl(); + + m_pPath->SetRootName( m_sRootLabel ); + m_pTreeView->Clear(); + + SvTreeListEntry* pRoot = m_pTreeView->InsertEntry( m_sRootLabel, NULL, true ); + OUString* sData = new OUString( rURL ); + pRoot->SetUserData( static_cast< void* >( sData ) ); + + m_pName_ed->GrabFocus(); + + m_sLastServiceUrl = sURL; + + m_bServiceChanged = false; + } + + m_pPath->SetURL( rURL ); + + m_pTreeView->SetSelectHdl( Link<>() ); + + // read cached data for this url and fill the tree + const ::std::vector< SvtContentEntry >& rFolders = m_pFileView->GetContent(); + ::std::vector< std::pair< OUString, OUString > > aFolders; + + m_pName_ed->ClearEntries(); + + for( ::std::vector< SvtContentEntry >::size_type i = 0; i < rFolders.size(); i++ ) + { + int nTitleStart = rFolders[i].maURL.lastIndexOf( '/' ); + if( nTitleStart != -1 ) + { + OUString sTitle( INetURLObject::decode( + rFolders[i].maURL.copy( nTitleStart + 1 ), + INetURLObject::DECODE_WITH_CHARSET ) ); + + if( rFolders[i].mbIsFolder ) + { + aFolders.push_back( std::pair< OUString, OUString > ( sTitle, rFolders[i].maURL ) ); + } + + // add entries to the autocompletion mechanism + m_pName_ed->AddEntry( sTitle ); + } + } + + m_pTreeView->FillTreeEntry( rURL, aFolders ); + + m_pTreeView->SetSelectHdl( LINK( this, RemoteFilesDialog, TreeSelectHdl ) ); + + m_bIsConnected = true; + EnableControls(); +} + +void RemoteFilesDialog::EnableAutocompletion( bool ) +{ + // This dialog contains Breadcrumb, not Edit +} + +const OUString& RemoteFilesDialog::GetPath() +{ + return m_sPath; +} + +std::vector<OUString> RemoteFilesDialog::GetPathList() const +{ + std::vector<OUString> aList; + sal_uLong nCount = m_pFileView->GetSelectionCount(); + SvTreeListEntry* pEntry = nCount ? m_pFileView->FirstSelected() : NULL; + + while( pEntry ) + { + // url must contain user info, because we need this info in recent files entry + // (to fill user field in login box by default) + INetURLObject aURL( SvtFileView::GetURL( pEntry ) ); + INetURLObject aCurrentURL( m_sLastServiceUrl ); + aURL.SetUser( aCurrentURL.GetUser() ); + + aList.push_back( aURL.GetMainURL( INetURLObject::NO_DECODE ) ); + pEntry = m_pFileView->NextSelected( pEntry ); + } + + if( aList.size() == 0 && !m_sPath.isEmpty() ) + aList.push_back( m_sPath ); + + return aList; +} + +bool RemoteFilesDialog::ContentIsFolder( const OUString& rURL ) +{ + try + { + Reference< XInteractionHandler > xInteractionHandler( + InteractionHandler::createWithParent( m_xContext, 0 ), UNO_QUERY_THROW ); + Reference< XCommandEnvironment > xEnv = new ::ucbhelper::CommandEnvironment( xInteractionHandler, Reference< XProgressHandler >() ); + ::ucbhelper::Content aContent( rURL, xEnv, m_xContext ); + + return aContent.isFolder(); + } + catch( const Exception& ) + { + // a content doesn't exist + } + + return false; +} + +bool RemoteFilesDialog::ContentIsDocument( const OUString& rURL ) +{ + try + { + Reference< XInteractionHandler > xInteractionHandler( + InteractionHandler::createWithParent( m_xContext, 0 ), UNO_QUERY_THROW ); + Reference< XCommandEnvironment > xEnv = new ::ucbhelper::CommandEnvironment( xInteractionHandler, Reference< XProgressHandler >() ); + ::ucbhelper::Content aContent( rURL, xEnv, m_xContext ); + + return aContent.isDocument(); + } + catch( const Exception& ) + { + // a content doesn't exist + } + + return false; +} + +sal_Int32 RemoteFilesDialog::getTargetColorDepth() +{ + // This dialog doesn't contain preview + return 0; +} + +sal_Int32 RemoteFilesDialog::getAvailableWidth() +{ + // This dialog doesn't contain preview + return 0; +} + +sal_Int32 RemoteFilesDialog::getAvailableHeight() +{ + // This dialog doesn't contain preview + return 0; +} + +void RemoteFilesDialog::setImage( sal_Int16, const ::com::sun::star::uno::Any& ) +{ + // This dialog doesn't contain preview +} + +bool RemoteFilesDialog::getShowState() +{ + // This dialog doesn't contain preview + return false; +} + +Control* RemoteFilesDialog::getControl( sal_Int16, bool) const +{ + return NULL; +} +void RemoteFilesDialog::enableControl( sal_Int16, bool ) +{ +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/office/RemoteFilesDialog.hxx b/fpicker/source/office/RemoteFilesDialog.hxx new file mode 100644 index 000000000000..10dc3ba6d1cb --- /dev/null +++ b/fpicker/source/office/RemoteFilesDialog.hxx @@ -0,0 +1,215 @@ +/* -*- 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_REMOTEFILESDIALOG_HXX +#define INCLUDED_SVTOOLS_REMOTEFILESDIALOG_HXX + +#include <comphelper/docpasswordrequest.hxx> + +#include <svtools/autocmpledit.hxx> +#include <svtools/foldertree.hxx> +#include <svtools/place.hxx> +#include <svtools/PlaceEditDialog.hxx> +#include <svtools/breadcrumb.hxx> +#include <svtools/fileview.hxx> + +#include <tools/errinf.hxx> +#include <tools/resid.hxx> + +#include <unotools/viewoptions.hxx> + +#include <vcl/button.hxx> +#include <vcl/fpicker.hrc> +#include <vcl/menubtn.hxx> +#include <vcl/dialog.hxx> +#include <vcl/vclptr.hxx> +#include <vcl/split.hxx> +#include <vcl/svapp.hxx> + +#include <officecfg/Office/Common.hxx> +#include <com/sun/star/beans/StringPair.hpp> +#include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/task/PasswordContainer.hpp> +#include <com/sun/star/task/XPasswordContainer2.hpp> + +#include <vector> + +#include "fpdialogbase.hxx" +#include "fpsofficeResMgr.hxx" +#include "OfficeFilePicker.hrc" +#include "QueryFolderName.hxx" +#include "iodlg.hrc" + +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::task; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::ui::dialogs; + +enum SvtRemoteDlgMode +{ + REMOTEDLG_MODE_OPEN = 0, + REMOTEDLG_MODE_SAVE = 1 +}; + +enum SvtRemoteDlgType +{ + REMOTEDLG_TYPE_FILEDLG = 0, + REMOTEDLG_TYPE_PATHDLG = 1 +}; + +typedef std::shared_ptr< Place > ServicePtr; +typedef ::com::sun::star::uno::Sequence< OUString > OUStringList; + +class FileViewContainer; + +class RemoteFilesDialog : public SvtFileDialog_Base +{ +public: + RemoteFilesDialog( vcl::Window* pParent, WinBits nBits ); + virtual ~RemoteFilesDialog(); + + virtual void dispose() SAL_OVERRIDE; + virtual void Resize() SAL_OVERRIDE; + virtual short Execute() SAL_OVERRIDE; + virtual void Show(); + + OUString GetPath() const; + + // SvtFileDialog_Base + + virtual SvtFileView* GetView() SAL_OVERRIDE; + + virtual void SetHasFilename( bool ) SAL_OVERRIDE; + virtual void SetBlackList( const ::com::sun::star::uno::Sequence< OUString >& rBlackList ) SAL_OVERRIDE; + virtual const ::com::sun::star::uno::Sequence< OUString >& GetBlackList() const SAL_OVERRIDE; + virtual void SetStandardDir( const OUString& rStdDir ) SAL_OVERRIDE; + virtual const OUString& GetStandardDir() const SAL_OVERRIDE; + virtual void SetPath( const OUString& rNewURL ) SAL_OVERRIDE; + virtual const OUString& GetPath() SAL_OVERRIDE; + virtual std::vector<OUString> GetPathList() const SAL_OVERRIDE; + virtual bool ContentIsFolder( const OUString& rURL ) SAL_OVERRIDE; + virtual bool ContentIsDocument( const OUString& rURL ); + + virtual OUString getCurrentFileText() const SAL_OVERRIDE; + virtual void setCurrentFileText( const OUString& rText, bool bSelectAll = false ) SAL_OVERRIDE; + + virtual void AddFilter( const OUString& rFilter, const OUString& rType ) SAL_OVERRIDE; + virtual void AddFilterGroup( const OUString& _rFilter, + const com::sun::star::uno::Sequence< com::sun::star::beans::StringPair >& rFilters ) SAL_OVERRIDE; + virtual OUString GetCurFilter() const SAL_OVERRIDE; + virtual void SetCurFilter( const OUString& rFilter ) SAL_OVERRIDE; + virtual void FilterSelect() SAL_OVERRIDE; + + virtual void SetFileCallback( ::svt::IFilePickerListener *pNotifier ) SAL_OVERRIDE; + virtual void onAsyncOperationStarted() SAL_OVERRIDE; + virtual void onAsyncOperationFinished() SAL_OVERRIDE; + virtual void UpdateControls( const OUString& rURL ) SAL_OVERRIDE; + + virtual void EnableAutocompletion( bool ) SAL_OVERRIDE; + + virtual sal_Int32 getTargetColorDepth() SAL_OVERRIDE; + virtual sal_Int32 getAvailableWidth() SAL_OVERRIDE; + virtual sal_Int32 getAvailableHeight() SAL_OVERRIDE; + + virtual void setImage( sal_Int16 aImageFormat, const ::com::sun::star::uno::Any& rImage ) SAL_OVERRIDE; + + virtual bool getShowState() SAL_OVERRIDE; + + virtual Control* getControl( sal_Int16 nControlId, bool bLabelControl = false ) const SAL_OVERRIDE; + virtual void enableControl( sal_Int16 nControlId, bool bEnable ) SAL_OVERRIDE; + virtual OUString getCurFilter( ) const SAL_OVERRIDE; + +private: + Reference< XComponentContext > m_xContext; + Reference< XPasswordContainer2 > m_xMasterPasswd; + + SvtRemoteDlgMode m_eMode; + SvtRemoteDlgType m_eType; + bool m_bMultiselection; + bool m_bIsUpdated; + bool m_bIsConnected; + bool m_bServiceChanged; + + OUString m_sIniKey; + int m_nWidth; + int m_nHeight; + + OUString m_sPath; + OUString m_sStdDir; + OUString m_sRootLabel; + OUString m_sLastServiceUrl; + unsigned int m_nCurrentFilter; + + ::rtl::Reference< ::svt::AsyncPickerAction > m_pCurrentAsyncAction; + + ::com::sun::star::uno::Sequence< OUString > m_aBlackList; + ::svt::IFilePickerListener* m_pFileNotifier; + + VclPtr< PushButton > m_pOk_btn; + VclPtr< CancelButton > m_pCancel_btn; + VclPtr< MenuButton > m_pAddService_btn; + VclPtr< ListBox > m_pServices_lb; + VclPtr< Breadcrumb > m_pPath; + VclPtr<PushButton> m_pNewFolder; + VclPtr< Splitter > m_pSplitter; + VclPtr< FolderTree > m_pTreeView; + VclPtr< SvtFileView > m_pFileView; + VclPtr< FileViewContainer > m_pContainer; + VclPtr< ListBox > m_pFilter_lb; + VclPtr< AutocompleteEdit > m_pName_ed; + PopupMenu* m_pAddMenu; + + ImageList m_aImages; + + std::vector< ServicePtr > m_aServices; + std::vector< std::pair< OUString, OUString > > m_aFilters; + + void InitSize(); + + void FillServicesListbox(); + + /* If failure returns < 0 */ + int GetSelectedServicePos(); + + FileViewResult OpenURL( OUString const & sURL ); + + void AddFileExtension(); + + void EnableControls(); + void DisableControls(); + + void SavePassword( const OUString& rURL, const OUString& rUser + , const OUString& rPassword, bool bPersistent ); + + DECL_LINK ( AddServiceHdl, void * ); + DECL_LINK ( SelectServiceHdl, void * ); + DECL_LINK_TYPED ( EditServiceMenuHdl, MenuButton *, void ); + + DECL_LINK( DoubleClickHdl, void * ); + DECL_LINK( SelectHdl, void * ); + + DECL_LINK( FileNameGetFocusHdl, void * ); + DECL_LINK( FileNameModifyHdl, void * ); + + DECL_LINK( SplitHdl, void * ); + + DECL_LINK( SelectFilterHdl, void * ); + + DECL_LINK( TreeSelectHdl, FolderTree * ); + + DECL_LINK( SelectBreadcrumbHdl, Breadcrumb * ); + + DECL_LINK( NewFolderHdl, void * ); + + DECL_LINK( OkHdl, void * ); + DECL_LINK( CancelHdl, void * ); +}; + +#endif // INCLUDED_SVTOOLS_REMOTEFILESDIALOG_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/office/asyncfilepicker.cxx b/fpicker/source/office/asyncfilepicker.cxx index cf6b17b07c8f..8e4c9e3d2ff6 100644 --- a/fpicker/source/office/asyncfilepicker.cxx +++ b/fpicker/source/office/asyncfilepicker.cxx @@ -28,7 +28,7 @@ namespace svt { - AsyncPickerAction::AsyncPickerAction( SvtFileDialog* _pDialog, SvtFileView* _pView, const Action _eAction ) + AsyncPickerAction::AsyncPickerAction( SvtFileDialog_Base* _pDialog, SvtFileView* _pView, const Action _eAction ) :m_eAction ( _eAction ) ,m_pView ( _pView ) ,m_pDialog ( _pDialog ) diff --git a/fpicker/source/office/asyncfilepicker.hxx b/fpicker/source/office/asyncfilepicker.hxx index 2174eb50e6ca..bd40153ea8a8 100644 --- a/fpicker/source/office/asyncfilepicker.hxx +++ b/fpicker/source/office/asyncfilepicker.hxx @@ -28,7 +28,7 @@ #include <vcl/vclptr.hxx> class SvtFileView; -class SvtFileDialog; +class SvtFileDialog_Base; typedef ::com::sun::star::uno::Sequence< OUString > OUStringList; @@ -54,13 +54,13 @@ namespace svt private: Action m_eAction; VclPtr<SvtFileView> m_pView; - VclPtr<SvtFileDialog> m_pDialog; + VclPtr<SvtFileDialog_Base> m_pDialog; OUString m_sURL; OUString m_sFileName; bool m_bRunning; public: - AsyncPickerAction( SvtFileDialog* _pDialog, SvtFileView* _pView, const Action _eAction ); + AsyncPickerAction( SvtFileDialog_Base* _pDialog, SvtFileView* _pView, const Action _eAction ); /** executes the action diff --git a/fpicker/source/office/commonpicker.hxx b/fpicker/source/office/commonpicker.hxx index a08c31ee2ba0..b74f1a906b7c 100644 --- a/fpicker/source/office/commonpicker.hxx +++ b/fpicker/source/office/commonpicker.hxx @@ -35,7 +35,7 @@ #include <tools/link.hxx> #include <vcl/vclptr.hxx> -class SvtFileDialog; +class SvtFileDialog_Base; namespace vcl { class Window; } struct ImplSVEvent; @@ -65,7 +65,7 @@ namespace svt ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > m_xWindow; // </properties> - VclPtr<SvtFileDialog> m_pDlg; + VclPtr<SvtFileDialog_Base> m_pDlg; ImplSVEvent * m_nCancelEvent; bool m_bExecuting; @@ -79,7 +79,7 @@ namespace svt OUString m_aDisplayDirectory; protected: - inline SvtFileDialog* getDialog() { return m_pDlg; } + inline SvtFileDialog_Base* getDialog() { return m_pDlg; } inline const ::cppu::OBroadcastHelper& GetBroadcastHelper() const { return OCommonPicker_Base::rBHelper; } inline ::cppu::OBroadcastHelper& GetBroadcastHelper() { return OCommonPicker_Base::rBHelper; } @@ -93,7 +93,7 @@ namespace svt // overridables // will be called with locked SolarMutex - virtual VclPtr<SvtFileDialog> implCreateDialog( vcl::Window* _pParent ) = 0; + virtual VclPtr<SvtFileDialog_Base> implCreateDialog( vcl::Window* _pParent ) = 0; virtual sal_Int16 implExecutePicker( ) = 0; // do NOT override XExecutableDialog::execute! We need to do some stuff there ourself ... diff --git a/fpicker/source/office/fpdialogbase.hxx b/fpicker/source/office/fpdialogbase.hxx new file mode 100644 index 000000000000..19a26a41890d --- /dev/null +++ b/fpicker/source/office/fpdialogbase.hxx @@ -0,0 +1,120 @@ +/* -*- 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 . + */ +#ifndef INCLUDED_FPICKER_SOURCE_OFFICE_FPDIALOGBASE_HXX +#define INCLUDED_FPICKER_SOURCE_OFFICE_FPDIALOGBASE_HXX + +#include <vcl/dialog.hxx> +#include <com/sun/star/beans/StringPair.hpp> +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/uno/Reference.hxx> +#include "svl/inettype.hxx" +#include "asyncfilepicker.hxx" +#include "OfficeControlAccess.hxx" +#include "fpsmartcontent.hxx" + +#include <set> + +// @@@ using namespace com::sun::star::ucb; + + + +class SvTabListBox; +class SvtFileView; +class SvtFileDialogFilter_Impl; + + +#define SFXWB_INSERT ( 0x04000000L | WB_OPEN ) +#define SFXWB_PASSWORD WB_PASSWORD +#define SFXWB_READONLY WB_READONLY +#define SFXWB_PATHDIALOG WB_PATH +#define SFXWB_CLASSPATH ( 0x08000000L | SFXWB_PATHDIALOG ) +#define SFXWB_MULTISELECTION 0x20000000L // activate Multiselection +#define SFXWB_NOREMOTE 0x40000000L + +#define SFX_EXTRA_AUTOEXTENSION 0x00000001L +#define SFX_EXTRA_FILTEROPTIONS 0x00000002L +#define SFX_EXTRA_SHOWVERSIONS 0x00000004L +#define SFX_EXTRA_INSERTASLINK 0x00000008L +#define SFX_EXTRA_SHOWPREVIEW 0x00000010L +#define SFX_EXTRA_TEMPLATES 0x00000020L +#define SFX_EXTRA_PLAYBUTTON 0x00000040L +#define SFX_EXTRA_SELECTION 0x00000080L +#define SFX_EXTRA_IMAGE_TEMPLATE 0x00000100L + +#define FILEDIALOG_FILTER_ALL "*.*" + +// SvtFileDialog_Base + +class SvtFileDialog_Base : public ModalDialog, public ::svt::IFilePickerController +{ +public: + SvtFileDialog_Base( vcl::Window* pParent, const OUString& rID, const OUString& rUIXMLDescription ) + : ModalDialog( pParent, rID, rUIXMLDescription ) + { + } + + virtual SvtFileView* GetView() = 0; + + virtual void SetHasFilename( bool bHasFilename ) = 0; + virtual void SetBlackList( const ::com::sun::star::uno::Sequence< OUString >& rBlackList ) = 0; + virtual const ::com::sun::star::uno::Sequence< OUString >& GetBlackList() const = 0; + virtual void SetStandardDir( const OUString& rStdDir ) = 0; + virtual const OUString& GetStandardDir() const = 0; + virtual void SetPath( const OUString& rNewURL ) = 0; + virtual const OUString& GetPath() = 0; + virtual std::vector<OUString> GetPathList() const = 0; + virtual bool ContentIsFolder( const OUString& rURL ) = 0; + + virtual OUString getCurrentFileText() const = 0; + virtual void setCurrentFileText( const OUString& rText, bool bSelectAll = false ) = 0; + + virtual void AddFilter( const OUString& rFilter, const OUString& rType ) = 0; + virtual void AddFilterGroup( const OUString& _rFilter, + const com::sun::star::uno::Sequence< com::sun::star::beans::StringPair >& rFilters ) = 0; + virtual OUString GetCurFilter() const = 0; + virtual void SetCurFilter( const OUString& rFilter ) = 0; + virtual void FilterSelect() = 0; + + virtual void SetFileCallback( ::svt::IFilePickerListener *pNotifier ) = 0; + virtual void onAsyncOperationStarted() = 0; + virtual void onAsyncOperationFinished() = 0; + virtual void UpdateControls( const OUString& rURL ) = 0; + + virtual void EnableAutocompletion( bool _bEnable = true ) = 0; + + virtual sal_Int32 getTargetColorDepth() = 0; + virtual sal_Int32 getAvailableWidth() = 0; + virtual sal_Int32 getAvailableHeight() = 0; + + virtual void setImage( sal_Int16 aImageFormat, const ::com::sun::star::uno::Any& rImage ) = 0; + + virtual bool getShowState() = 0; +}; + +#define FILE_SELECTION_CHANGED 1 +#define DIRECTORY_CHANGED 2 +#define HELP_REQUESTED 3 +#define CTRL_STATE_CHANGED 4 +#define DIALOG_SIZE_CHANGED 5 + + +#endif // INCLUDED_FPICKER_SOURCE_OFFICE_IODLG_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/office/fps_office.component b/fpicker/source/office/fps_office.component index 8804be2a91e9..b76edc61b401 100644 --- a/fpicker/source/office/fps_office.component +++ b/fpicker/source/office/fps_office.component @@ -22,6 +22,9 @@ <implementation name="com.sun.star.svtools.OfficeFilePicker"> <service name="com.sun.star.ui.dialogs.OfficeFilePicker"/> </implementation> + <implementation name="com.sun.star.svtools.RemoteFilePicker"> + <service name="com.sun.star.ui.dialogs.RemoteFilePicker"/> + </implementation> <implementation name="com.sun.star.svtools.OfficeFolderPicker"> <service name="com.sun.star.ui.dialogs.OfficeFolderPicker"/> </implementation> diff --git a/fpicker/source/office/fps_office.cxx b/fpicker/source/office/fps_office.cxx index c98b21f3c095..5e33e83fe2a4 100644 --- a/fpicker/source/office/fps_office.cxx +++ b/fpicker/source/office/fps_office.cxx @@ -28,6 +28,12 @@ static const cppu::ImplementationEntry g_entries[] = { { + SvtRemoteFilePicker::impl_createInstance, + SvtRemoteFilePicker::impl_getStaticImplementationName, + SvtRemoteFilePicker::impl_getStaticSupportedServiceNames, + cppu::createSingleComponentFactory, 0, 0 + }, + { SvtFilePicker::impl_createInstance, SvtFilePicker::impl_getStaticImplementationName, SvtFilePicker::impl_getStaticSupportedServiceNames, diff --git a/fpicker/source/office/fpsmartcontent.hxx b/fpicker/source/office/fpsmartcontent.hxx index cce20ec5061e..b6ffd7281848 100644 --- a/fpicker/source/office/fpsmartcontent.hxx +++ b/fpicker/source/office/fpsmartcontent.hxx @@ -198,8 +198,6 @@ namespace svt } inline bool isFolder( ) { return isFolder( getURL() ); } - inline bool isDocument( ) { return isDocument( getURL() ); } - inline bool is( ) { return is( getURL() ); } }; diff --git a/fpicker/source/office/fpsofficeResMgr.hxx b/fpicker/source/office/fpsofficeResMgr.hxx index 76b45385a5ec..359fc8867f04 100644 --- a/fpicker/source/office/fpsofficeResMgr.hxx +++ b/fpicker/source/office/fpsofficeResMgr.hxx @@ -13,7 +13,7 @@ #include <osl/getglobalmutex.hxx> #include <tools/resmgr.hxx> -namespace +namespace fpicker { struct ResMgrHolder { diff --git a/fpicker/source/office/iodlg.cxx b/fpicker/source/office/iodlg.cxx index 4e0d5f721cbb..a1ac408313d0 100644 --- a/fpicker/source/office/iodlg.cxx +++ b/fpicker/source/office/iodlg.cxx @@ -100,6 +100,7 @@ using namespace ::com::sun::star::ucb; using namespace ::com::sun::star::container; using namespace ::com::sun::star::task; using namespace ::com::sun::star::sdbc; +using namespace ::fpicker; using namespace ::utl; using namespace ::svt; @@ -303,7 +304,7 @@ SvtFileDialog::SvtFileDialog WinBits nBits, WinBits nExtraBits ) : - ModalDialog( _pParent, "ExplorerFileDialog", "fps/ui/explorerfiledialog.ui" ) + SvtFileDialog_Base( _pParent, "ExplorerFileDialog", "fps/ui/explorerfiledialog.ui" ) ,_pCbReadOnly( NULL ) ,_pCbLinkBox( NULL) @@ -327,7 +328,7 @@ SvtFileDialog::SvtFileDialog SvtFileDialog::SvtFileDialog ( vcl::Window* _pParent, WinBits nBits ) - :ModalDialog( _pParent, "ExplorerFileDialog", "fps/ui/explorerfiledialog.ui" ) + :SvtFileDialog_Base( _pParent, "ExplorerFileDialog", "fps/ui/explorerfiledialog.ui" ) ,_pCbReadOnly( NULL ) ,_pCbLinkBox( NULL) ,_pCbPreviewBox( NULL ) diff --git a/fpicker/source/office/iodlg.hxx b/fpicker/source/office/iodlg.hxx index bf01b492d9a9..385613926d26 100644 --- a/fpicker/source/office/iodlg.hxx +++ b/fpicker/source/office/iodlg.hxx @@ -39,6 +39,7 @@ #include "fpsmartcontent.hxx" #include <comphelper/configuration.hxx> #include <comphelper/processfactory.hxx> +#include "fpdialogbase.hxx" #include <set> @@ -50,36 +51,13 @@ class SvTabListBox; class SvtFileView; class SvtFileDialogFilter_Impl; - - -#define SFXWB_INSERT ( 0x04000000L | WB_OPEN ) -#define SFXWB_PASSWORD WB_PASSWORD -#define SFXWB_READONLY WB_READONLY -#define SFXWB_PATHDIALOG WB_PATH -#define SFXWB_CLASSPATH ( 0x08000000L | SFXWB_PATHDIALOG ) -#define SFXWB_MULTISELECTION 0x20000000L // activate Multiselection -#define SFXWB_NOREMOTE 0x40000000L - -#define SFX_EXTRA_AUTOEXTENSION 0x00000001L -#define SFX_EXTRA_FILTEROPTIONS 0x00000002L -#define SFX_EXTRA_SHOWVERSIONS 0x00000004L -#define SFX_EXTRA_INSERTASLINK 0x00000008L -#define SFX_EXTRA_SHOWPREVIEW 0x00000010L -#define SFX_EXTRA_TEMPLATES 0x00000020L -#define SFX_EXTRA_PLAYBUTTON 0x00000040L -#define SFX_EXTRA_SELECTION 0x00000080L -#define SFX_EXTRA_IMAGE_TEMPLATE 0x00000100L - -#define FILEDIALOG_FILTER_ALL "*.*" - - // SvtFileDialog class SvtExpFileDlg_Impl; class CustomContainer; -class SvtFileDialog : public ModalDialog, public ::svt::IFilePickerController +class SvtFileDialog : public SvtFileDialog_Base { private: VclPtr<CheckBox> _pCbReadOnly; @@ -162,7 +140,6 @@ private: protected: virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE; - void EnableInternet( bool bInternet ); // originally from VclFileDialog Link<> _aOKHdl; @@ -201,23 +178,23 @@ public: virtual void StartExecuteModal( const Link<>& rEndDialogHdl ) SAL_OVERRIDE; void FileSelect(); - void FilterSelect(); + void FilterSelect() SAL_OVERRIDE; - void SetBlackList( const ::com::sun::star::uno::Sequence< OUString >& rBlackList ); - const ::com::sun::star::uno::Sequence< OUString >& GetBlackList() const; - void SetStandardDir( const OUString& rStdDir ); - const OUString& GetStandardDir() const; - std::vector<OUString> GetPathList() const; // for MultiSelection + void SetBlackList( const ::com::sun::star::uno::Sequence< OUString >& rBlackList ) SAL_OVERRIDE; + const ::com::sun::star::uno::Sequence< OUString >& GetBlackList() const SAL_OVERRIDE; + void SetStandardDir( const OUString& rStdDir ) SAL_OVERRIDE; + const OUString& GetStandardDir() const SAL_OVERRIDE; + std::vector<OUString> GetPathList() const SAL_OVERRIDE; // for MultiSelection void AddFilter( const OUString& rFilter, - const OUString& rType ); + const OUString& rType ) SAL_OVERRIDE; void AddFilterGroup( const OUString& _rFilter, - const com::sun::star::uno::Sequence< com::sun::star::beans::StringPair >& rFilters ); + const com::sun::star::uno::Sequence< com::sun::star::beans::StringPair >& rFilters ) SAL_OVERRIDE; - void SetCurFilter( const OUString& rFilter ); - OUString GetCurFilter() const; + void SetCurFilter( const OUString& rFilter ) SAL_OVERRIDE; + OUString GetCurFilter() const SAL_OVERRIDE; sal_uInt16 GetFilterCount() const; const OUString& GetFilterName( sal_uInt16 nPos ) const; @@ -227,49 +204,42 @@ public: void PrevLevel_Impl(); void OpenURL_Impl( const OUString& rURL ); - inline SvtFileView* GetView() const; + SvtFileView* GetView() SAL_OVERRIDE; - void DisableSaveLastDirectory(); void InitSize(); - void UpdateControls( const OUString& rURL ); - void EnableAutocompletion( bool _bEnable = true ); + void UpdateControls( const OUString& rURL ) SAL_OVERRIDE; + void EnableAutocompletion( bool _bEnable = true ) SAL_OVERRIDE; - void SetFileCallback( ::svt::IFilePickerListener *pNotifier ) { _pFileNotifier = pNotifier; } + void SetFileCallback( ::svt::IFilePickerListener *pNotifier ) SAL_OVERRIDE { _pFileNotifier = pNotifier; } - sal_Int32 getTargetColorDepth(); - sal_Int32 getAvailableWidth(); - sal_Int32 getAvailableHeight(); - void setImage( sal_Int16 aImageFormat, const ::com::sun::star::uno::Any& rImage ); - bool getShowState(); + sal_Int32 getTargetColorDepth() SAL_OVERRIDE; + sal_Int32 getAvailableWidth() SAL_OVERRIDE; + sal_Int32 getAvailableHeight() SAL_OVERRIDE; + void setImage( sal_Int16 aImageFormat, const ::com::sun::star::uno::Any& rImage ) SAL_OVERRIDE; + bool getShowState() SAL_OVERRIDE; bool isAutoExtensionEnabled(); - OUString getCurrentFileText( ) const; - void setCurrentFileText( const OUString& _rText, bool _bSelectAll = false ); + OUString getCurrentFileText( ) const SAL_OVERRIDE; + void setCurrentFileText( const OUString& _rText, bool _bSelectAll = false ) SAL_OVERRIDE; - void onAsyncOperationStarted(); - void onAsyncOperationFinished(); + void onAsyncOperationStarted() SAL_OVERRIDE; + void onAsyncOperationFinished() SAL_OVERRIDE; void RemovablePlaceSelected(bool enable = true); static void displayIOException( const OUString& _rURL, ::com::sun::star::ucb::IOErrorCode _eCode ); // inline - inline void SetPath( const OUString& rNewURL ); - inline void SetHasFilename( bool bHasFilename ); - inline const OUString& GetPath() const; + inline void SetPath( const OUString& rNewURL ) SAL_OVERRIDE; + inline void SetHasFilename( bool bHasFilename ) SAL_OVERRIDE; + inline const OUString& GetPath() SAL_OVERRIDE; inline void SetDefaultExt( const OUString& rExt ); inline void EraseDefaultExt( sal_Int32 _nIndex = 0 ); inline const OUString& GetDefaultExt() const; - inline void SetOKHdl( const Link<>& rLink ); - inline const Link<>& GetOKHdl() const; - inline void SetFileSelectHdl( const Link<>& rLink ); - inline const Link<>& GetFileSelectHdl() const; - inline void SetFilterSelectHdl( const Link<>& rLink ); - inline const Link<>& GetFilterSelectHdl() const; inline Image GetButtonImage( sal_uInt16 _nButtonId ) const { return m_aImages.GetImage( _nButtonId ); } - bool ContentIsFolder( const OUString& rURL ) { return m_aContent.isFolder( rURL ) && m_aContent.isValid(); } + bool ContentIsFolder( const OUString& rURL ) SAL_OVERRIDE { return m_aContent.isFolder( rURL ) && m_aContent.isValid(); } bool ContentHasParentFolder( const OUString& rURL ); bool ContentCanMakeFolder( const OUString& rURL ); bool ContentGetTitle( const OUString& rURL, OUString& rTitle ); @@ -345,7 +315,7 @@ inline void SvtFileDialog::SetHasFilename( bool bHasFilename ) -inline const OUString& SvtFileDialog::GetPath() const +inline const OUString& SvtFileDialog::GetPath() { return _aPath; } @@ -368,74 +338,12 @@ inline const OUString& SvtFileDialog::GetDefaultExt() const } - -inline void SvtFileDialog::SetOKHdl -( - const Link<>& rLink -) -{ - _aOKHdl = rLink; -} - - - -inline const Link<>& SvtFileDialog::GetOKHdl() const -{ - return _aOKHdl; -} - - - -inline void SvtFileDialog::SetFileSelectHdl -( - const Link<>& rLink -) -{ - _aFileSelectHdl = rLink; -} - - - -inline const Link<>& SvtFileDialog::GetFileSelectHdl() const -{ - return _aFileSelectHdl; -} - - - -inline void SvtFileDialog::SetFilterSelectHdl -( - const Link<>& rLink -) -{ - _aFilterSelectHdl = rLink; -} - - - -inline const Link<>& SvtFileDialog::GetFilterSelectHdl() const -{ - return _aFilterSelectHdl; -} - - - -inline SvtFileView* SvtFileDialog::GetView() const +inline SvtFileView* SvtFileDialog::GetView() { return _pFileView; } - - - -#define FILE_SELECTION_CHANGED 1 -#define DIRECTORY_CHANGED 2 -#define HELP_REQUESTED 3 -#define CTRL_STATE_CHANGED 4 -#define DIALOG_SIZE_CHANGED 5 - - #endif // INCLUDED_FPICKER_SOURCE_OFFICE_IODLG_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/office/iodlg.src b/fpicker/source/office/iodlg.src index e09fe0b14165..775b6eef4c69 100644 --- a/fpicker/source/office/iodlg.src +++ b/fpicker/source/office/iodlg.src @@ -105,6 +105,16 @@ String STR_SVT_ALREADYEXISTOVERWRITE Text [ en-US ] = "A file named \"$filename$\" already exists.\n\nDo you want to replace it?" ; }; +String STR_SVT_DELETESERVICE +{ + Text [ en-US ] = "Are you sure you want to delete the service?\n\"$servicename$\"" ; +}; + +String STR_SVT_ROOTLABEL +{ + Text [ en-US ] = "Root" ; +}; + String STR_SVT_NEW_FOLDER { Text [ en-US ] = "Folder" ; diff --git a/fpicker/source/office/iodlgimp.hxx b/fpicker/source/office/iodlgimp.hxx index dd6244b4fe21..243f6afa620e 100644 --- a/fpicker/source/office/iodlgimp.hxx +++ b/fpicker/source/office/iodlgimp.hxx @@ -217,7 +217,6 @@ public: inline const SvtFileDialogFilter_Impl* GetCurFilter( ) const; inline const OUString& GetCurFilterDisplayName() const; void SetCurFilter( SvtFileDialogFilter_Impl* _pFilter, const OUString& _rDisplayName ); - inline void SetCurFilter( SvtFileDialogFilter_Impl* _pFilter ); }; inline void SvtExpFileDlg_Impl::SetFilterListSelectHdl( const Link<>& _rHandler ) @@ -261,11 +260,6 @@ inline const OUString& SvtExpFileDlg_Impl::GetCurFilterDisplayName() const return m_sCurrentFilterDisplayName; } -inline void SvtExpFileDlg_Impl::SetCurFilter( SvtFileDialogFilter_Impl* pFilter ) -{ - SetCurFilter( pFilter, pFilter->GetName() ); -} - #endif // INCLUDED_FPICKER_SOURCE_OFFICE_IODLGIMP_HXX diff --git a/fpicker/uiconfig/ui/remotefilesdialog.ui b/fpicker/uiconfig/ui/remotefilesdialog.ui new file mode 100644 index 000000000000..5a439a778554 --- /dev/null +++ b/fpicker/uiconfig/ui/remotefilesdialog.ui @@ -0,0 +1,285 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Generated with glade 3.18.3 --> +<interface> + <requires lib="gtk+" version="3.12"/> + <object class="GtkDialog" id="RemoteFilesDialog"> + <property name="can_focus">False</property> + <property name="border_width">6</property> + <property name="title" translatable="yes">Remote Files</property> + <property name="type_hint">dialog</property> + <child internal-child="vbox"> + <object class="GtkBox" id="dialog-vbox1"> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <property name="spacing">12</property> + <child internal-child="action_area"> + <object class="GtkButtonBox" id="dialog-action_area1"> + <property name="can_focus">False</property> + <property name="layout_style">end</property> + <child> + <object class="GtkButton" id="cancel"> + <property name="label">gtk-cancel</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="can_default">True</property> + <property name="receives_default">False</property> + <property name="use_stock">True</property> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkButton" id="open"> + <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> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkButton" id="save"> + <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> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">4</property> + </packing> + </child> + <child> + <object class="GtkBox" id="box1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="spacing">6</property> + <child> + <object class="GtkLabel" id="label1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Service:</property> + <accessibility> + <relation type="label-for" target="services_lb"/> + </accessibility> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkComboBox" id="services_lb"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <accessibility> + <relation type="labelled-by" target="label1"/> + </accessibility> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkButton" id="add_service_btn:service_edit_menu"> + <property name="label" translatable="yes">Add service</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkBox" id="box2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="spacing">6</property> + <child> + <object class="GtkBox" id="breadcrumb_container"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="valign">center</property> + <property name="hexpand">True</property> + <child> + <placeholder/> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkButton" id="new_folder"> + <property name="use_action_appearance">False</property> + <property name="width_request">25</property> + <property name="height_request">25</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="has_tooltip">True</property> + <property name="tooltip_markup" translatable="yes">Create New Folder</property> + <property name="tooltip_text" translatable="yes">Create New Folder</property> + <property name="margin_left">6</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkBox" id="container"> + <property name="width_request">555</property> + <property name="height_request">200</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="orientation">vertical</property> + <child> + <placeholder/> + </child> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + <child> + <object class="GtkGrid" id="grid1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="row_spacing">6</property> + <property name="column_spacing">6</property> + <child> + <object class="GtkLabel" id="filterLabel"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">Filter</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="nameLabel"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">File name</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">1</property> + </packing> + </child> + <child> + <object class="GtkComboBox" id="filter_lb"> + <property name="width_request">200</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">0</property> + </packing> + </child> + <child> + <object class="GtkBox" id="filename_container"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <child> + <placeholder/> + </child> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">3</property> + </packing> + </child> + </object> + </child> + </object> + <object class="GtkMenu" id="service_edit_menu"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child> + <object class="GtkMenuItem" id="edit_service"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">_Edit service</property> + <property name="use_underline">True</property> + </object> + </child> + <child> + <object class="GtkMenuItem" id="delete_service"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">_Delete service</property> + <property name="use_underline">True</property> + </object> + </child> + <child> + <object class="GtkMenuItem" id="change_password"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">_Change password</property> + <property name="use_underline">True</property> + </object> + </child> + </object> +</interface> diff --git a/framework/Library_fwk.mk b/framework/Library_fwk.mk index 74e72a9cf136..b47d2ada9264 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 8d2337156bfb..c7fc3946aa78 100644 --- a/framework/inc/classes/resource.hrc +++ b/framework/inc/classes/resource.hrc @@ -50,6 +50,9 @@ #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) +#define STR_REMOTE_FILE (RID_STR_START+27) +#define STR_REMOTE_TITLE (RID_STR_START+28) #define POPUPMENU_TOOLBAR_QUICKCUSTOMIZATION (RID_MENU_START+0) diff --git a/framework/source/classes/resource.src b/framework/source/classes/resource.src index c54eaa327265..570e2884b713 100644 --- a/framework/source/classes/resource.src +++ b/framework/source/classes/resource.src @@ -114,6 +114,21 @@ String STR_CLEAR_RECENT_FILES_HELP Text [ en-US ] = "Clears the list with the most recently opened files. This action can not be undone."; }; +String STR_OPEN_REMOTE +{ + Text [ en-US ] = "Open remote file"; +}; + +String STR_REMOTE_FILE +{ + Text [ en-US ] = "Save Remote File..."; +}; + +String STR_REMOTE_TITLE +{ + Text [ en-US ] = " (Remote)"; +}; + String STR_TOOLBAR_TITLE_ADDON { Text [ en-US ] = "Add-On %num%"; diff --git a/framework/source/fwe/helper/titlehelper.cxx b/framework/source/fwe/helper/titlehelper.cxx index d8c44d37b74b..64d547ee4fd6 100644 --- a/framework/source/fwe/helper/titlehelper.cxx +++ b/framework/source/fwe/helper/titlehelper.cxx @@ -18,6 +18,8 @@ */ #include <framework/titlehelper.hxx> +#include <classes/fwkresid.hxx> +#include <classes/resource.hrc> #include <services.h> #include <properties.h> @@ -409,6 +411,7 @@ void TitleHelper::impl_updateTitleForController (const css::uno::Reference< css: nLeasedNumber = xNumbers->leaseNumber (xOwner); css::uno::Reference< css::frame::XTitle > xModelTitle(xController->getModel (), css::uno::UNO_QUERY); + css::uno::Reference< css::frame::XModel > xModel(xController->getModel (), css::uno::UNO_QUERY); if (!xModelTitle.is ()) xModelTitle.set(xController, css::uno::UNO_QUERY); if (xModelTitle.is ()) @@ -419,6 +422,16 @@ void TitleHelper::impl_updateTitleForController (const css::uno::Reference< css: sTitle.appendAscii (" : "); sTitle.append ((::sal_Int32)nLeasedNumber); } + if (xModel.is ()) + { + INetURLObject aURL (xModel->getURL ()); + if (aURL.GetProtocol () != INetProtocol::File + && aURL.GetProtocol () != INetProtocol::NotValid) + { + OUString sRemoteText (FwkResId (STR_REMOTE_TITLE)); + sTitle.append (sRemoteText); + } + } } else { diff --git a/framework/source/uielement/recentfilesmenucontroller.cxx b/framework/source/uielement/recentfilesmenucontroller.cxx index 1ea02d21dc63..9ea96216206d 100644 --- a/framework/source/uielement/recentfilesmenucontroller.cxx +++ b/framework/source/uielement/recentfilesmenucontroller.cxx @@ -44,6 +44,7 @@ using namespace framework; namespace { static const char CMD_CLEAR_LIST[] = ".uno:ClearRecentFileList"; +static const char CMD_OPEN_REMOTE[] = ".uno:OpenRemote"; static const char CMD_PREFIX[] = "vnd.sun.star.popup:RecentFileList?entry="; static const char MENU_SHORTCUT[] = "~N. "; @@ -224,6 +225,12 @@ void RecentFilesMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu > OUString( CMD_CLEAR_LIST ) ); pVCLPopupMenu->SetHelpText( sal_uInt16( nCount + 1 ), FWK_RESSTR(STR_CLEAR_RECENT_FILES_HELP) ); + + // Open remote menu entry + pVCLPopupMenu->InsertItem( sal_uInt16( nCount + 2 ), + FWK_RESSTR(STR_OPEN_REMOTE) ); + pVCLPopupMenu->SetItemCommand( sal_uInt16( nCount + 2 ), + OUString( CMD_OPEN_REMOTE ) ); } else { @@ -232,6 +239,14 @@ void RecentFilesMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu > // Do not disable it, otherwise the Toolbar controller and MenuButton // will display SV_RESID_STRING_NOSELECTIONPOSSIBLE instead of STR_NODOCUMENT pVCLPopupMenu->SetItemBits( 1, pVCLPopupMenu->GetItemBits( 1 ) | MenuItemBits::NOSELECT ); + + pVCLPopupMenu->InsertSeparator(); + + // Open remote menu entry + pVCLPopupMenu->InsertItem( sal_uInt16( 2 ), + FWK_RESSTR(STR_OPEN_REMOTE) ); + pVCLPopupMenu->SetItemCommand( sal_uInt16( 2 ), + OUString( CMD_OPEN_REMOTE ) ); } } } @@ -331,6 +346,11 @@ void SAL_CALL RecentFilesMenuController::itemSelected( const css::awt::MenuEvent "vnd.org.libreoffice.recentdocs:ClearRecentFileList", ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >() ); } + else if ( aCommand == CMD_OPEN_REMOTE ) + { + Sequence< PropertyValue > aArgsList( 0 ); + dispatchCommand( CMD_OPEN_REMOTE, aArgsList ); + } else executeEntry( rEvent.MenuId-1 ); } diff --git a/framework/source/uielement/saveasmenucontroller.cxx b/framework/source/uielement/saveasmenucontroller.cxx new file mode 100644 index 000000000000..646001397ba7 --- /dev/null +++ b/framework/source/uielement/saveasmenucontroller.cxx @@ -0,0 +1,192 @@ +/* -*- 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:SaveAsRemote"; + +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( 1 ), + FWK_RESSTR( STR_REMOTE_FILE ) ); + pVCLPopupMenu->SetItemCommand( sal_uInt16( 1 ), + 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 6541f1406f3f..1eaf2d04a447 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/icon-themes/breeze/links.txt b/icon-themes/breeze/links.txt index 35ebf92940d1..6d15b9ff961b 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 @@ -118,3 +120,6 @@ cmd/sc_showgraphics.png cmd/sc_graphic.png # split cells duplicates svx/res/zetlhor2.png /sw/res/zetlhor2.png svx/res/zetlver2.png /sw/res/zetlver2.png + +# FolderTree expanded icon +svtools/res/folderop.png formula/res/fapopen.png diff --git a/icon-themes/galaxy/links.txt b/icon-themes/galaxy/links.txt index 8043b0c5e577..5b9b99495b63 100644 --- a/icon-themes/galaxy/links.txt +++ b/icon-themes/galaxy/links.txt @@ -64,3 +64,6 @@ cmd/sc_view3d.png sfx2/res/symphony/sidebar-3d-small.png # text background colour Impress/Draw cmd/sc_charbackcolor.png cmd/sc_backcolor.png cmd/lc_charbackcolor.png cmd/lc_backcolor.png + +# FolderTree expanded icon +svtools/res/folderop.png formula/res/fapopen.png diff --git a/icon-themes/hicontrast/links.txt b/icon-themes/hicontrast/links.txt index 3c9fd1741310..ea11b2abd70c 100644 --- a/icon-themes/hicontrast/links.txt +++ b/icon-themes/hicontrast/links.txt @@ -5,3 +5,7 @@ cmd/sc_linespacing.png cmd/sc_spacepara15.png # text background colour Impress/Draw cmd/sc_charbackcolor.png cmd/sc_backcolor.png cmd/lc_charbackcolor.png cmd/lc_backcolor.png + +# FolderTree icons +svtools/res/folder.png formula/res/fapclose.png +svtools/res/folderop.png formula/res/fapopen.png diff --git a/icon-themes/human/links.txt b/icon-themes/human/links.txt index 3e7c8a7ab955..5b1aca0d60d8 100644 --- a/icon-themes/human/links.txt +++ b/icon-themes/human/links.txt @@ -8,3 +8,6 @@ cmd/sc_linespacing.png cmd/sc_spacepara15.png # text background colour Impress/Draw cmd/sc_charbackcolor.png cmd/sc_backcolor.png cmd/lc_charbackcolor.png cmd/lc_backcolor.png + +# FolderTree expanded icon +svtools/res/folderop.png formula/res/fapopen.png diff --git a/icon-themes/tango/links.txt b/icon-themes/tango/links.txt index d5036a328ffb..b71336f10931 100644 --- a/icon-themes/tango/links.txt +++ b/icon-themes/tango/links.txt @@ -271,8 +271,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 @@ -383,6 +385,7 @@ res/sc10712.png cmd/sc_sortdescending.png res/reload.png cmd/sc_reload.png res/sc05501.png cmd/sc_open.png svtools/res/folder.png formula/res/fapclose.png +svtools/res/folderop.png formula/res/fapopen.png fpicker/res/fp011.png res/sc06303.png sfx2/res/styfam1.png sw/imglst/sf01.png sfx2/res/styfam2.png sw/imglst/sf02.png diff --git a/include/sfx2/app.hxx b/include/sfx2/app.hxx index cf2b13227a06..e8de473906d7 100644 --- a/include/sfx2/app.hxx +++ b/include/sfx2/app.hxx @@ -218,6 +218,7 @@ public: SAL_DLLPRIVATE void NewDocDirectExec_Impl(SfxRequest &); SAL_DLLPRIVATE void NewDocExec_Impl(SfxRequest &); SAL_DLLPRIVATE void OpenDocExec_Impl(SfxRequest &); + SAL_DLLPRIVATE void OpenRemoteExec_Impl(SfxRequest &); SAL_DLLPRIVATE void MiscExec_Impl(SfxRequest &); SAL_DLLPRIVATE void MiscState_Impl(SfxItemSet &); SAL_DLLPRIVATE void PropExec_Impl(SfxRequest &); diff --git a/include/sfx2/filedlghelper.hxx b/include/sfx2/filedlghelper.hxx index 53a4fc3fafc5..2e55cd9836a0 100644 --- a/include/sfx2/filedlghelper.hxx +++ b/include/sfx2/filedlghelper.hxx @@ -236,6 +236,7 @@ public: #define SFX2_IMPL_DIALOG_CONFIG 0 #define SFX2_IMPL_DIALOG_SYSTEM 1 #define SFX2_IMPL_DIALOG_OOO 2 +#define SFX2_IMPL_DIALOG_REMOTE 3 ErrCode FileOpenDialog_Impl( sal_Int16 nDialogType, sal_Int64 nFlags, diff --git a/include/sfx2/sfxsids.hrc b/include/sfx2/sfxsids.hrc index a0f72b7526bb..1755eb5ad712 100644 --- a/include/sfx2/sfxsids.hrc +++ b/include/sfx2/sfxsids.hrc @@ -96,11 +96,13 @@ // default-ids for document #define SID_NEWDOC (SID_SFX_START + 500) #define SID_OPENDOC (SID_SFX_START + 501) +#define SID_OPENREMOTE (SID_SFX_START + 517) #define SID_OPENURL (SID_SFX_START + 596) #define SID_SAVEASURL (SID_SFX_START + 643) #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) @@ -137,6 +139,7 @@ #define SID_FORCERELOAD (SID_SFX_START + 1502) #define SID_FILE_DIALOG (SID_SFX_START + 304) +#define SID_REMOTE_DIALOG (SID_SFX_START + 305) #define SID_PATH (SID_SFX_START + 308) #define SID_SAVEDOCS (SID_SFX_START + 309) #define SID_STANDARD_DIR (SID_SFX_START + 450) diff --git a/include/sfx2/tbxctrl.hxx b/include/sfx2/tbxctrl.hxx index 11da16c4e0ff..57ab4047a173 100644 --- a/include/sfx2/tbxctrl.hxx +++ b/include/sfx2/tbxctrl.hxx @@ -329,6 +329,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/include/svtools/PlaceEditDialog.hxx b/include/svtools/PlaceEditDialog.hxx index a3e4c2caa77b..cc5aa3ee5522 100644 --- a/include/svtools/PlaceEditDialog.hxx +++ b/include/svtools/PlaceEditDialog.hxx @@ -21,6 +21,8 @@ #include <svtools/inettbc.hxx> #include <svtools/place.hxx> +#include <config_oauth2.h> + #include <memory> #include <vector> @@ -32,11 +34,18 @@ private : std::shared_ptr< DetailsContainer > m_xCurrentDetails; VclPtr<Edit> m_pEDUsername; + VclPtr<CheckBox> m_pCBPassword; + VclPtr<Edit> m_pEDPassword; + VclPtr<FixedText> m_pFTPasswordLabel; VclPtr<OKButton> m_pBTOk; VclPtr<CancelButton> m_pBTCancel; VclPtr<PushButton> m_pBTDelete; + VclPtr<Button> m_pBTRepoRefresh; + + VclPtr<VclGrid> m_pTypeGrid; + /** Vector holding the details UI control for each server type. The elements in this vector need to match the order in the type listbox, e.g. @@ -45,6 +54,11 @@ private : */ std::vector< std::shared_ptr< DetailsContainer > > m_aDetailsContainers; + unsigned int m_nCurrentType; + + bool bLabelChanged; + bool m_bShowPassword; + public : PlaceEditDialog( vcl::Window* pParent); @@ -57,15 +71,23 @@ public : OUString GetServerName() { return m_pEDServerName->GetText(); } OUString GetServerUrl(); + OUString GetPassword() { return m_pEDPassword->GetText(); }; + OUString GetUser() { return m_pEDUsername->GetText(); }; + bool IsRememberChecked() { return m_pCBPassword->IsChecked(); } + + void ShowPasswordControl( bool bShow = true ) { m_bShowPassword = bShow; } private: void InitDetails( ); + void UpdateLabel( ); DECL_LINK ( OKHdl, Button * ); DECL_LINK ( DelHdl, Button * ); - DECL_LINK ( EditHdl, void * ); + DECL_LINK_TYPED ( EditHdl, DetailsContainer*, void ); + DECL_LINK ( ModifyHdl, void* ); DECL_LINK ( SelectTypeHdl, void * ); + DECL_LINK ( EditLabelHdl, void * ); DECL_LINK ( EditUsernameHdl, void * ); }; diff --git a/include/svtools/ServerDetailsControls.hxx b/include/svtools/ServerDetailsControls.hxx index 83444ea0788c..ca66b8385016 100644 --- a/include/svtools/ServerDetailsControls.hxx +++ b/include/svtools/ServerDetailsControls.hxx @@ -12,6 +12,8 @@ #include <map> #include <com/sun/star/ucb/XCommandEnvironment.hpp> +#include <com/sun/star/task/PasswordContainer.hpp> +#include <com/sun/star/task/XPasswordContainer2.hpp> #include <tools/urlobj.hxx> #include <vcl/builder.hxx> @@ -20,18 +22,27 @@ #include <vcl/field.hxx> #include <vcl/fixed.hxx> #include <vcl/layout.hxx> +#include <vcl/msgbox.hxx> class DetailsContainer { - private: - Link<> m_aChangeHdl; - VclPtr<VclFrame> m_pFrame; + protected: + Link<DetailsContainer*,void> m_aChangeHdl; + VclPtr<VclGrid> m_pDetailsGrid; + VclPtr<VclHBox> m_pHostBox; + VclPtr<Edit> m_pEDHost; + VclPtr<FixedText> m_pFTHost; + VclPtr<NumericField> m_pEDPort; + VclPtr<FixedText> m_pFTPort; + VclPtr<Edit> m_pEDRoot; + VclPtr<FixedText> m_pFTRoot; + bool m_bIsActive; public: - DetailsContainer( VclBuilderContainer* pBuilder, const OString& rFrame ); + DetailsContainer( VclBuilderContainer* pBuilder ); virtual ~DetailsContainer( ); - void setChangeHdl( const Link<>& rLink ) { m_aChangeHdl = rLink; } + void setChangeHdl( const Link<DetailsContainer*,void>& rLink ) { m_aChangeHdl = rLink; } virtual void show( bool bShow = true ); virtual INetURLObject getUrl( ); @@ -44,6 +55,9 @@ class DetailsContainer virtual bool setUrl( const INetURLObject& rUrl ); virtual void setUsername( const OUString& /*rUsername*/ ) { }; + virtual void setPassword( const OUString& ) { }; + + virtual void setActive( bool bActive = true ); protected: void notifyChange( ); @@ -55,11 +69,7 @@ class HostDetailsContainer : public DetailsContainer private: sal_uInt16 m_nDefaultPort; OUString m_sScheme; - - protected: - VclPtr<Edit> m_pEDHost; - VclPtr<NumericField> m_pEDPort; - VclPtr<Edit> m_pEDPath; + OUString m_sHost; public: HostDetailsContainer( VclBuilderContainer* pBuilder, sal_uInt16 nPort, const OUString& sScheme ); @@ -99,9 +109,8 @@ class DavDetailsContainer : public HostDetailsContainer class SmbDetailsContainer : public DetailsContainer { private: - VclPtr<Edit> m_pEDHost; VclPtr<Edit> m_pEDShare; - VclPtr<Edit> m_pEDPath; + VclPtr<FixedText> m_pFTShare; public: SmbDetailsContainer( VclBuilderContainer* pBuilder ); @@ -109,34 +118,36 @@ class SmbDetailsContainer : public DetailsContainer virtual INetURLObject getUrl( ) SAL_OVERRIDE; virtual bool setUrl( const INetURLObject& rUrl ) SAL_OVERRIDE; + virtual void show( bool bShow = true ) SAL_OVERRIDE; }; class CmisDetailsContainer : public DetailsContainer { private: OUString m_sUsername; + OUString m_sPassword; com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment > m_xCmdEnv; - std::vector< OUString > m_aServerTypesURLs; std::vector< OUString > m_aRepoIds; OUString m_sRepoId; + OUString m_sBinding; - VclPtr<Edit> m_pEDBinding; + VclPtr<VclHBox> m_pRepositoryBox; + VclPtr<FixedText> m_pFTRepository; VclPtr<ListBox> m_pLBRepository; VclPtr<Button> m_pBTRepoRefresh; - VclPtr<ListBox> m_pLBServerType; - VclPtr<Edit> m_pEDPath; public: - CmisDetailsContainer( VclBuilderContainer* pBuilder ); + CmisDetailsContainer( VclBuilderContainer* pBuilder, OUString const & sBinding ); virtual ~CmisDetailsContainer( ) { }; + virtual void show( bool bShow = true ); virtual INetURLObject getUrl( ) SAL_OVERRIDE; virtual bool setUrl( const INetURLObject& rUrl ) SAL_OVERRIDE; virtual void setUsername( const OUString& rUsername ) SAL_OVERRIDE; + virtual void setPassword( const OUString& rPass ) SAL_OVERRIDE; private: void selectRepository( ); - DECL_LINK ( SelectServerTypeHdl, void * ); DECL_LINK ( RefreshReposHdl, void * ); DECL_LINK ( SelectRepoHdl, void * ); }; diff --git a/include/svtools/autocmpledit.hxx b/include/svtools/autocmpledit.hxx new file mode 100644 index 000000000000..49407d44d55a --- /dev/null +++ b/include/svtools/autocmpledit.hxx @@ -0,0 +1,39 @@ +/* -*- 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_AUTOCMPLEDIT_HXX +#define INCLUDED_SVTOOLS_AUTOCMPLEDIT_HXX + +#include <svtools/svtdllapi.h> + +#include <vcl/edit.hxx> + +#include <vector> + +class SVT_DLLPUBLIC AutocompleteEdit : public Edit +{ +private: + std::vector< OUString > m_aEntries; + std::vector< OUString > m_aMatching; + std::vector< OUString >::size_type m_nCurrent; + + void AutoCompleteHandler( Edit* ); + bool Match( const OUString& rText ); + bool PreNotify( NotifyEvent& rNEvt ); + +public: + AutocompleteEdit( vcl::Window* pParent ); + + void AddEntry( const OUString& rEntry ); + void ClearEntries(); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svtools/breadcrumb.hxx b/include/svtools/breadcrumb.hxx new file mode 100644 index 000000000000..c1a94d973223 --- /dev/null +++ b/include/svtools/breadcrumb.hxx @@ -0,0 +1,68 @@ +/* -*- 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_BREADCRUMB_HXX +#define INCLUDED_SVTOOLS_BREADCRUMB_HXX + +#include <svtools/svtdllapi.h> + +#include <tools/urlobj.hxx> + +#include <vcl/fixedhyper.hxx> +#include <vcl/layout.hxx> + +#include <vector> + +#define SPACING 6 + +enum SvtBreadcrumbMode +{ + ONLY_CURRENT_PATH = 0, + ALL_VISITED = 1 +}; + +class CustomLink; + +class SVT_DLLPUBLIC Breadcrumb : public VclHBox +{ + private: + std::vector< VclPtr< CustomLink > > m_aLinks; + std::vector< VclPtr< FixedText > > m_aSeparators; + + OUString m_sRootName; + OUString m_sClickedURL; + OUString m_aCurrentURL; + + SvtBreadcrumbMode m_eMode; + + Link<> m_aClickHdl; + + void appendField(); + bool showField( unsigned int nIndex, unsigned int nWidthMax ); + + DECL_LINK ( ClickLinkHdl, FixedHyperlink* ); + + public: + Breadcrumb( vcl::Window* pParent, WinBits nWinStyle = 0 ); + virtual ~Breadcrumb(); + + void dispose() SAL_OVERRIDE; + void EnableFields( bool bEnable ); + + void SetClickHdl( const Link<>& rLink ); + OUString GetHdlURL(); + + void SetRootName( const OUString& rURL ); + void SetURL( const OUString& rURL ); + void SetMode( SvtBreadcrumbMode eMode ); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svtools/fileview.hxx b/include/svtools/fileview.hxx index 09affbebaf75..eb737eb32f40 100644 --- a/include/svtools/fileview.hxx +++ b/include/svtools/fileview.hxx @@ -36,6 +36,7 @@ class ViewTabListBox_Impl; class SvtFileView_Impl; class SvTreeListEntry; class HeaderBar; +struct SvtContentEntry; /// the result of an action in the FileView enum FileViewResult @@ -74,7 +75,7 @@ protected: virtual void GetFocus() SAL_OVERRIDE; public: - SvtFileView( vcl::Window* pParent, WinBits nBits, bool bOnlyFolder, bool bMultiSelection ); + SvtFileView( vcl::Window* pParent, WinBits nBits, bool bOnlyFolder, bool bMultiSelection, bool bShowType = true ); virtual ~SvtFileView(); virtual void dispose() SAL_OVERRIDE; @@ -174,6 +175,8 @@ public: void EndInplaceEditing( bool _bCancel ); + ::std::vector< SvtContentEntry > GetContent(); + protected: virtual void StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE; }; diff --git a/include/svtools/foldertree.hxx b/include/svtools/foldertree.hxx new file mode 100644 index 000000000000..ccf0382ad35d --- /dev/null +++ b/include/svtools/foldertree.hxx @@ -0,0 +1,60 @@ +/* -*- 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; + Image m_aFolderExpandedImage; + + OUString m_sLastUpdatedDir; + +public: + FolderTree( vcl::Window* pParent, WinBits nBits ); + + virtual void RequestingChildren( SvTreeListEntry* pEntry ) SAL_OVERRIDE; + + void FillTreeEntry( SvTreeListEntry* pEntry ); + void FillTreeEntry( const OUString & rUrl, const ::std::vector< std::pair< OUString, OUString > >& rFolders ); + void SetTreePath( OUString const & sUrl ); + void SetBlackList( const ::com::sun::star::uno::Sequence< OUString >& rBlackList ); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svtools/svtools.hrc b/include/svtools/svtools.hrc index 23cf007a7139..570809b61ec3 100644 --- a/include/svtools/svtools.hrc +++ b/include/svtools/svtools.hrc @@ -51,6 +51,9 @@ #define STR_SVT_ESTIMATED_SIZE_VEC (RID_SVTOOLS_START + 41) // FREE + +#define STR_SVT_DEFAULT_SERVICE_LABEL (RID_SVTOOLS_START+57) + #define STRARY_SVT_DOCINFO (RID_SVTOOLS_START+58) #define STR_BASICKEY_FORMAT_ON (RID_SVTOOLS_START+103) @@ -260,6 +263,7 @@ #define IMG_TRIANGLE_DOWN (RID_SVTOOLS_START + 20) #define IMG_SVT_FOLDER (RID_SVTOOLS_START + 42) +#define IMG_SVT_FOLDER_OPEN (RID_SVTOOLS_START + 43) #define RID_IMG_PRNDLG_NOCOLLATE (STR_SVT_PRNDLG_START + 30) diff --git a/include/vcl/fpicker.hrc b/include/vcl/fpicker.hrc index 387b38981f85..896d9c8d48c2 100644 --- a/include/vcl/fpicker.hrc +++ b/include/vcl/fpicker.hrc @@ -27,6 +27,8 @@ #define STR_SVT_FOLDERPICKER_DEFAULT_TITLE (STR_SVT_FILEPICKER_START+12) #define STR_SVT_FOLDERPICKER_DEFAULT_DESCRIPTION (STR_SVT_FILEPICKER_START+13) #define STR_SVT_ALREADYEXISTOVERWRITE (STR_SVT_FILEPICKER_START+14) +#define STR_SVT_DELETESERVICE (STR_SVT_FILEPICKER_START+15) +#define STR_SVT_ROOTLABEL (STR_SVT_FILEPICKER_START+16) #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/officecfg/registry/data/org/openoffice/Office/Common.xcu b/officecfg/registry/data/org/openoffice/Office/Common.xcu index 50131769e304..7fa851bc8c44 100644 --- a/officecfg/registry/data/org/openoffice/Office/Common.xcu +++ b/officecfg/registry/data/org/openoffice/Office/Common.xcu @@ -575,10 +575,16 @@ <prop oor:name="FilePickerPlacesNames"> <value/> </prop> + <prop oor:name="FilePickerLastService"> + <value/> + </prop> <prop oor:name="CmisServersUrls"> <value> - <it>http://<host:port>/alfresco/cmisatom</it> + <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> <it>http://<host>/servlet/cmis/repository/_P<Quickr place name>_RMain.nsf/servicedoc</it> @@ -586,15 +592,18 @@ <it>https://<host>/cmis/atom</it> <it>http://ec2-184-72-233-127.compute-1.amazonaws.com/ot-cmis/services/RepositoryService?wsdl</it> <it>http://<host>/_vti_bin/CMISSoapwsdl.aspx</it> - <it>https://www.googleapis.com/drive/v2</it> - <it>https://apis.live.net/v5.0</it> <it>http://<host>/_api/Web</it> + <it>http://<host>/</it> + <it></it> </value> </prop> <prop oor:name="CmisServersNames"> <value> - <it>Alfresco 4</it> + <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> <it>Lotus Quickr Domino</it> @@ -602,9 +611,9 @@ <it>OpenDataSpace</it> <it>OpenText ELS 10.2.0</it> <it>SharePoint 2010</it> - <it>Google Drive</it> - <it>OneDrive</it> <it>SharePoint 2013</it> + <it>Other CMIS</it> + <it>--------------------</it> </value> </prop> </node> diff --git a/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu b/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu index 74acecb4a710..4fb73a7f6ec8 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="c1" oor:op="replace"> diff --git a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu index 91aa01123ad2..802e68b57e1b 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu @@ -1942,6 +1942,22 @@ <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:SaveAsRemote" oor:op="replace"> + <prop oor:name="Label" oor:type="xs:string"> + <value xml:lang="en-US">~Save to Remote Server</value> + </prop> + <prop oor:name="Properties" oor:type="xs:int"> + <value>1</value> + </prop> + </node> <node oor:name=".uno:CircleCut" oor:op="replace"> <prop oor:name="Label" oor:type="xs:string"> <value xml:lang="en-US">Circle Segment</value> diff --git a/officecfg/registry/data/org/openoffice/Setup.xcu b/officecfg/registry/data/org/openoffice/Setup.xcu index 9b17125b66f1..2a77ab18b877 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 3c1f592a2a8c..c523680d3676 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs @@ -5825,6 +5825,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="xs:string" 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> diff --git a/sc/source/ui/app/scdll.cxx b/sc/source/ui/app/scdll.cxx index 384ae4c40bcb..aebc8b2091a8 100644 --- a/sc/source/ui/app/scdll.cxx +++ b/sc/source/ui/app/scdll.cxx @@ -153,6 +153,7 @@ void ScDLL::Init() ScPageBreakShell ::RegisterInterface(pMod); SfxRecentFilesToolBoxControl::RegisterControl(SID_OPEN_CALC, pMod); + SfxSaveAsToolBoxControl::RegisterControl(SID_SAVEDOC, pMod ); // Own Controller ScTbxInsertCtrl ::RegisterControl(SID_TBXCTL_INSERT, pMod); diff --git a/sc/uiconfig/scalc/menubar/menubar.xml b/sc/uiconfig/scalc/menubar/menubar.xml index 46d3da4dcf7a..7ad58f2f4427 100644 --- a/sc/uiconfig/scalc/menubar/menubar.xml +++ b/sc/uiconfig/scalc/menubar/menubar.xml @@ -21,6 +21,7 @@ <menu:menupopup> <menu:menuitem menu:id=".uno:AddDirect"/> <menu:menuitem menu:id=".uno:OpenFromCalc"/> + <menu:menuitem menu:id=".uno:OpenRemote"/> <menu:menuitem menu:id=".uno:RecentFileList"/> <menu:menuseparator/> <menu:menuitem menu:id=".uno:AutoPilotMenu"/> @@ -34,6 +35,7 @@ <menu:menuseparator/> <menu:menuitem menu:id=".uno:CloseDoc"/> <menu:menuitem menu:id=".uno:Save"/> + <menu:menuitem menu:id=".uno:SaveAsRemote"/> <menu:menuitem menu:id=".uno:SaveAs"/> <menu:menuitem menu:id=".uno:SaveACopy"/> <menu:menuitem menu:id=".uno:SaveAll"/> diff --git a/sc/uiconfig/scalc/toolbar/standardbar.xml b/sc/uiconfig/scalc/toolbar/standardbar.xml index ea357fe45bd2..b16c2d85910b 100644 --- a/sc/uiconfig/scalc/toolbar/standardbar.xml +++ b/sc/uiconfig/scalc/toolbar/standardbar.xml @@ -22,7 +22,8 @@ <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:Save"/> + <toolbar:toolbaritem xlink:href=".uno:OpenRemote"/> + <toolbar:toolbaritem xlink:href=".uno:Save" toolbar:style="dropdown"/> <toolbar:toolbaritem xlink:href=".uno:SaveAs"/> <toolbar:toolbaritem xlink:href=".uno:SendMail" toolbar:visible="false"/> <toolbar:toolbarseparator/> diff --git a/sd/source/ui/app/sddll.cxx b/sd/source/ui/app/sddll.cxx index 1a4c79712532..c93606dbdf4b 100644 --- a/sd/source/ui/app/sddll.cxx +++ b/sd/source/ui/app/sddll.cxx @@ -270,7 +270,8 @@ void SdDLL::RegisterControllers() SvxFrameLineStyleToolBoxControl::RegisterControl(SID_FRAME_LINESTYLE, pMod ); SvxColorToolBoxControl::RegisterControl(SID_FRAME_LINECOLOR, pMod ); SvxFrameToolBoxControl::RegisterControl(SID_ATTR_BORDER, pMod ); - SvxSubToolBoxControl::RegisterControl(SID_OPTIMIZE_TABLE, pMod); + + SfxSaveAsToolBoxControl::RegisterControl(SID_SAVEDOC, pMod ); } void SdDLL::Init() diff --git a/sd/uiconfig/sdraw/menubar/menubar.xml b/sd/uiconfig/sdraw/menubar/menubar.xml index f12287b0b5f6..d91edba0292e 100644 --- a/sd/uiconfig/sdraw/menubar/menubar.xml +++ b/sd/uiconfig/sdraw/menubar/menubar.xml @@ -21,6 +21,7 @@ <menu:menupopup> <menu:menuitem menu:id=".uno:AddDirect"/> <menu:menuitem menu:id=".uno:Open"/> + <menu:menuitem menu:id=".uno:OpenRemote"/> <menu:menuitem menu:id=".uno:RecentFileList"/> <menu:menuseparator/> <menu:menuitem menu:id=".uno:AutoPilotMenu"/> @@ -34,6 +35,7 @@ <menu:menuseparator/> <menu:menuitem menu:id=".uno:CloseDoc"/> <menu:menuitem menu:id=".uno:Save"/> + <menu:menuitem menu:id=".uno:SaveAsRemote"/> <menu:menuitem menu:id=".uno:SaveAs"/> <menu:menuitem menu:id=".uno:SaveACopy"/> <menu:menuitem menu:id=".uno:SaveAll"/> diff --git a/sd/uiconfig/sdraw/toolbar/standardbar.xml b/sd/uiconfig/sdraw/toolbar/standardbar.xml index 5dcb170aaa94..e811b80e060d 100644 --- a/sd/uiconfig/sdraw/toolbar/standardbar.xml +++ b/sd/uiconfig/sdraw/toolbar/standardbar.xml @@ -22,7 +22,8 @@ <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:Open" toolbar:style="dropdown"/> - <toolbar:toolbaritem xlink:href=".uno:Save" toolbar:helpid="5505"/> + <toolbar:toolbaritem xlink:href=".uno:OpenRemote"/> + <toolbar:toolbaritem xlink:href=".uno:Save" toolbar:style="dropdown" toolbar:helpid="5505"/> <toolbar:toolbaritem xlink:href=".uno:SaveAs" toolbar:helpid="5502"/> <toolbar:toolbaritem xlink:href=".uno:SendMail" toolbar:visible="false" toolbar:helpid="5331"/> <toolbar:toolbarseparator/> diff --git a/sd/uiconfig/simpress/menubar/menubar.xml b/sd/uiconfig/simpress/menubar/menubar.xml index 9e700b89e25f..3204131995e3 100644 --- a/sd/uiconfig/simpress/menubar/menubar.xml +++ b/sd/uiconfig/simpress/menubar/menubar.xml @@ -21,6 +21,7 @@ <menu:menupopup> <menu:menuitem menu:id=".uno:AddDirect"/> <menu:menuitem menu:id=".uno:Open"/> + <menu:menuitem menu:id=".uno:OpenRemote"/> <menu:menuitem menu:id=".uno:RecentFileList"/> <menu:menuseparator/> <menu:menuitem menu:id=".uno:AutoPilotMenu"/> @@ -34,6 +35,7 @@ <menu:menuseparator/> <menu:menuitem menu:id=".uno:CloseDoc"/> <menu:menuitem menu:id=".uno:Save"/> + <menu:menuitem menu:id=".uno:SaveAsRemote"/> <menu:menuitem menu:id=".uno:SaveAs"/> <menu:menuitem menu:id=".uno:SaveACopy"/> <menu:menuitem menu:id=".uno:SaveAll"/> diff --git a/sd/uiconfig/simpress/toolbar/standardbar.xml b/sd/uiconfig/simpress/toolbar/standardbar.xml index b50a57d73681..1d595066c2d8 100644 --- a/sd/uiconfig/simpress/toolbar/standardbar.xml +++ b/sd/uiconfig/simpress/toolbar/standardbar.xml @@ -22,7 +22,8 @@ <toolbar:toolbaritem xlink:href=".uno:AddDirect" toolbar:style="dropdown"/> <toolbar:toolbaritem xlink:href=".uno:NewDoc" toolbar:visible="false"/> <toolbar:toolbaritem xlink:href=".uno:Open" toolbar:style="dropdown"/> - <toolbar:toolbaritem xlink:href=".uno:Save"/> + <toolbar:toolbaritem xlink:href=".uno:OpenRemote"/> + <toolbar:toolbaritem xlink:href=".uno:Save" toolbar:style="dropdown"/> <toolbar:toolbaritem xlink:href=".uno:SaveAs"/> <toolbar:toolbaritem xlink:href=".uno:SendMail" toolbar:visible="false"/> <toolbar:toolbarseparator/> diff --git a/sfx2/sdi/docslots.sdi b/sfx2/sdi/docslots.sdi index c2c3a153f46a..9398f72f519f 100644 --- a/sfx2/sdi/docslots.sdi +++ b/sfx2/sdi/docslots.sdi @@ -29,6 +29,10 @@ interface Documents [ ExecMethod = OpenDocExec_Impl ; ] + SID_OPENREMOTE + [ + ExecMethod = OpenRemoteExec_Impl ; + ] SID_OPENHYPERLINK // ole(no) api(final/play/rec) [ ExecMethod = OpenDocExec_Impl ; @@ -144,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 13a2afa8fe89..fbb8f60750b7 100644 --- a/sfx2/sdi/sfx.sdi +++ b/sfx2/sdi/sfx.sdi @@ -3800,6 +3800,30 @@ SfxObjectItem Open SID_OPENDOC GroupId = GID_APPLICATION; ] +SfxObjectItem OpenRemote SID_OPENREMOTE +(SfxStringItem URL SID_FILE_NAME,SfxStringItem FilterName SID_FILTER_NAME,SfxStringItem OpenFlags SID_OPTIONS,SfxStringItem Password SID_PASSWORD,SfxStringItem FilterOptions SID_FILE_FILTEROPTIONS,SfxInt16Item Version SID_VERSION,SfxStringItem Referer SID_REFERER,SfxStringItem SuggestedSaveAsDir SID_DEFAULTFILEPATH,SfxStringItem SuggestedSaveAsName SID_DEFAULTFILENAME) +[ + /* flags: */ + AutoUpdate = FALSE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = TRUE, + ReadOnlyDoc = TRUE, + Toggle = FALSE, + Container = TRUE, + RecordAbsolute = FALSE, + RecordPerSet; + Asynchron; + + /* config: */ + AccelConfig = TRUE, + MenuConfig = TRUE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_APPLICATION; +] + SfxObjectItem WebHtml SID_WEBHTML () [ @@ -4989,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/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx index bdba6e2f5bd2..7ff3e313e235 100644 --- a/sfx2/source/appl/appopen.cxx +++ b/sfx2/source/appl/appopen.cxx @@ -624,6 +624,10 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) if ( pSystemDialogItem ) nDialog = pSystemDialogItem->GetValue() ? SFX2_IMPL_DIALOG_SYSTEM : SFX2_IMPL_DIALOG_OOO; + SFX_REQUEST_ARG( rReq, pRemoteDialogItem, SfxBoolItem, SID_REMOTE_DIALOG, false ); + if ( pRemoteDialogItem && pRemoteDialogItem->GetValue()) + nDialog = SFX2_IMPL_DIALOG_REMOTE; + OUString sStandardDir; SFX_REQUEST_ARG( rReq, pStandardDirItem, SfxStringItem, SID_STANDARD_DIR, false ); @@ -1124,4 +1128,10 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) } } +void SfxApplication::OpenRemoteExec_Impl( SfxRequest& rReq ) +{ + rReq.AppendItem( SfxBoolItem( SID_REMOTE_DIALOG, true ) ); + GetDispatcher_Impl()->Execute( SID_OPENDOC, SfxCallMode::SYNCHRON, *rReq.GetArgs() ); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/appl/appuno.cxx b/sfx2/source/appl/appuno.cxx index 29e0892dce4c..27abb609e811 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 diff --git a/sfx2/source/dialog/backingwindow.cxx b/sfx2/source/dialog/backingwindow.cxx index e58505be0837..dabfeaf82ff1 100644 --- a/sfx2/source/dialog/backingwindow.cxx +++ b/sfx2/source/dialog/backingwindow.cxx @@ -69,6 +69,7 @@ const char BASE_URL[] = "private:factory/sdatabase?Interactive"; const char MATH_URL[] = "private:factory/smath"; const char TEMPLATE_URL[] = ".uno:NewDoc"; const char OPEN_URL[] = ".uno:Open"; +const char REMOTE_URL[] = ".uno:OpenRemote"; const char SERVICENAME_CFGREADACCESS[] = "com.sun.star.configuration.ConfigurationAccess"; // increase size of the text in the buttons on the left fMultiplier-times @@ -103,6 +104,7 @@ BackingWindow::BackingWindow( vcl::Window* i_pParent ) : m_pUIBuilder = new VclBuilder(this, getUIRootDir(), "sfx/ui/startcenter.ui", "StartCenter" ); get(mpOpenButton, "open_all"); + get(mpRemoteButton, "open_remote"); get(mpRecentButton, "open_recent"); get(mpTemplateButton, "templates_all"); @@ -215,6 +217,7 @@ void BackingWindow::dispose() } disposeBuilder(); mpOpenButton.clear(); + mpRemoteButton.clear(); mpRecentButton.clear(); mpTemplateButton.clear(); mpCreateLabel.clear(); @@ -291,6 +294,7 @@ void BackingWindow::initControls() mpLocalView->setOpenTemplateHdl(LINK(this,BackingWindow,OpenTemplateHdl)); setupButton( mpOpenButton ); + setupButton( mpRemoteButton ); setupButton( mpRecentButton ); setupButton( mpTemplateButton ); setupButton( mpWriterAllButton ); @@ -577,6 +581,14 @@ IMPL_LINK( BackingWindow, ClickHdl, Button*, pButton ) dispatchURL( OPEN_URL, OUString(), xFrame, aArgs ); } + else if( pButton == mpRemoteButton ) + { + Reference< XDispatchProvider > xFrame( mxFrame, UNO_QUERY ); + + Sequence< com::sun::star::beans::PropertyValue > aArgs(0); + + dispatchURL( REMOTE_URL, OUString(), xFrame, aArgs ); + } else if( pButton == mpRecentButton ) { mpLocalView->Hide(); diff --git a/sfx2/source/dialog/backingwindow.hxx b/sfx2/source/dialog/backingwindow.hxx index c2c146220502..1adc6e1be1a2 100644 --- a/sfx2/source/dialog/backingwindow.hxx +++ b/sfx2/source/dialog/backingwindow.hxx @@ -61,6 +61,7 @@ class BackingWindow : public vcl::Window, public VclBuilderContainer VclPtr<PushButton> mpOpenButton; VclPtr<PushButton> mpRecentButton; + VclPtr<PushButton> mpRemoteButton; VclPtr<MenuButton> mpTemplateButton; VclPtr<FixedText> mpCreateLabel; diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx index a1a38f542c4e..d4d9e14b2c94 100644 --- a/sfx2/source/dialog/filedlghelper.cxx +++ b/sfx2/source/dialog/filedlghelper.cxx @@ -863,6 +863,8 @@ FileDialogHelper_Impl::FileDialogHelper_Impl( pServiceName = FILE_OPEN_SERVICE_NAME_OOO; else if ( nDialog == SFX2_IMPL_DIALOG_OOO ) pServiceName = FILE_OPEN_SERVICE_NAME_OOO; + else if ( nDialog == SFX2_IMPL_DIALOG_REMOTE ) + pServiceName = "com.sun.star.ui.dialogs.RemoteFilePicker"; else pServiceName = "com.sun.star.ui.dialogs.FilePicker"; OUString aService = OUString::createFromAscii( pServiceName ); diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx index 33579954fe9f..e2ad5895b347 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 @@ -542,12 +547,15 @@ 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 ); 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 ); @@ -880,6 +888,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 = @@ -1394,7 +1405,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 = @@ -1548,17 +1567,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( bRemote ) + { + nDialog = SFX2_IMPL_DIALOG_REMOTE; + } + else { - bool bUseSystemDialog = true; - if ( aDlgIter->second >>= bUseSystemDialog ) + ::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 f35c470dbaed..bc1a668f5f12 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 @@ -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))); diff --git a/sfx2/source/toolbox/tbxitem.cxx b/sfx2/source/toolbox/tbxitem.cxx index 5119f608b4e4..d29910967de4 100644 --- a/sfx2/source/toolbox/tbxitem.cxx +++ b/sfx2/source/toolbox/tbxitem.cxx @@ -107,6 +107,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 ) { @@ -1429,4 +1430,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/sfx2/uiconfig/ui/startcenter.ui b/sfx2/uiconfig/ui/startcenter.ui index 57b71986bbd8..d69e4a3c0fa5 100644 --- a/sfx2/uiconfig/ui/startcenter.ui +++ b/sfx2/uiconfig/ui/startcenter.ui @@ -136,6 +136,26 @@ </packing> </child> <child> + <object class="GtkButton" id="open_remote"> + <property name="label" translatable="yes">_Open Remote File</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="margin_left">6</property> + <property name="margin_right">6</property> + <property name="margin_top">6</property> + <property name="image">open_all_image</property> + <property name="relief">none</property> + <property name="use_underline">True</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> <object class="GtkButton" id="open_recent"> <property name="label" translatable="yes">_Recent Files</property> <property name="visible">True</property> @@ -151,7 +171,7 @@ <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">1</property> + <property name="position">2</property> </packing> </child> <child> @@ -170,7 +190,7 @@ <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">2</property> + <property name="position">3</property> </packing> </child> <child> @@ -183,7 +203,7 @@ <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">3</property> + <property name="position">4</property> </packing> </child> <child> @@ -198,7 +218,7 @@ <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">4</property> + <property name="position">5</property> </packing> </child> <child> @@ -218,7 +238,7 @@ <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">5</property> + <property name="position">6</property> </packing> </child> <child> @@ -238,7 +258,7 @@ <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">6</property> + <property name="position">7</property> </packing> </child> <child> @@ -258,7 +278,7 @@ <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">7</property> + <property name="position">8</property> </packing> </child> <child> @@ -278,7 +298,7 @@ <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">8</property> + <property name="position">9</property> </packing> </child> <child> @@ -298,7 +318,7 @@ <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">9</property> + <property name="position">10</property> </packing> </child> <child> @@ -318,7 +338,7 @@ <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">10</property> + <property name="position">11</property> </packing> </child> <child> @@ -329,7 +349,7 @@ <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">11</property> + <property name="position">12</property> </packing> </child> <child> @@ -342,7 +362,7 @@ <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">12</property> + <property name="position">13</property> </packing> </child> </object> diff --git a/svtools/Library_svt.mk b/svtools/Library_svt.mk index 07dc321e6314..b877d463e66d 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 \ @@ -106,6 +107,8 @@ $(eval $(call gb_Library_add_exception_objects,svt,\ svtools/source/contnr/viewdataentry \ svtools/source/control/accessibleruler \ svtools/source/control/asynclink \ + svtools/source/control/autocmpledit \ + svtools/source/control/breadcrumb \ svtools/source/control/calendar \ svtools/source/control/collatorres \ svtools/source/control/ctrlbox \ diff --git a/svtools/source/contnr/fileview.cxx b/svtools/source/contnr/fileview.cxx index ada14a38cf21..f8f19c0ac54e 100644 --- a/svtools/source/contnr/fileview.cxx +++ b/svtools/source/contnr/fileview.cxx @@ -101,6 +101,7 @@ enum class FileViewFlags NONE = 0x00, ONLYFOLDER = 0x01, MULTISELECTION = 0x02, + SHOW_TYPE = 0x04, SHOW_ONLYTITLE = 0x10, SHOW_NONE = 0x20, }; @@ -425,10 +426,10 @@ protected: Link<> m_aSelectHandler; ::rtl::Reference< ::svt::FileViewContentEnumerator > - m_pContentEnumerator; + m_xContentEnumerator; Link<> m_aCurrentAsyncActionHandler; ::osl::Condition m_aAsyncActionFinished; - ::rtl::Reference< ::salhelper::Timer > m_pCancelAsyncTimer; + ::rtl::Reference< ::salhelper::Timer > m_xCancelAsyncTimer; ::svt::EnumerationResult m_eAsyncActionResult; bool m_bRunningAsyncAction; bool m_bAsyncActionCancelled; @@ -616,7 +617,10 @@ ViewTabListBox_Impl::ViewTabListBox_Impl( vcl::Window* pParentWin, SetTabJustify(2, AdjustRight); // column "Size" mpHeaderBar->InsertItem(COLUMN_TITLE, SVT_RESSTR(STR_SVT_FILEVIEW_COLUMN_TITLE), 180, nBits | HeaderBarItemBits::UPARROW); - mpHeaderBar->InsertItem(COLUMN_TYPE, SVT_RESSTR(STR_SVT_FILEVIEW_COLUMN_TYPE), 140, nBits); + if (nFlags & FileViewFlags::SHOW_TYPE) + { + mpHeaderBar->InsertItem(COLUMN_TYPE, SVT_RESSTR(STR_SVT_FILEVIEW_COLUMN_TYPE), 140, nBits); + } mpHeaderBar->InsertItem(COLUMN_SIZE, SVT_RESSTR(STR_SVT_FILEVIEW_COLUMN_SIZE), 80, nBits); mpHeaderBar->InsertItem(COLUMN_DATE, SVT_RESSTR(STR_SVT_FILEVIEW_COLUMN_DATE), 500, nBits); } @@ -1083,7 +1087,7 @@ bool ViewTabListBox_Impl::Kill( const OUString& rContent ) // class SvtFileView ----------------------------------------------------- SvtFileView::SvtFileView( vcl::Window* pParent, WinBits nBits, - bool bOnlyFolder, bool bMultiSelection ) : + bool bOnlyFolder, bool bMultiSelection, bool bShowType ) : Control( pParent, nBits ) { @@ -1092,6 +1096,8 @@ SvtFileView::SvtFileView( vcl::Window* pParent, WinBits nBits, nFlags |= FileViewFlags::ONLYFOLDER; if ( bMultiSelection ) nFlags |= FileViewFlags::MULTISELECTION; + if ( bShowType ) + nFlags |= FileViewFlags::SHOW_TYPE; Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext(); Reference< XInteractionHandler > xInteractionHandler( @@ -1472,6 +1478,18 @@ OUString SvtFileView::GetConfigString() const return sRet; } +::std::vector< SvtContentEntry > SvtFileView::GetContent() +{ + ::std::vector< SvtContentEntry > aContent; + + for( ::std::vector< SortingData_Impl* >::size_type i = 0; i < mpImp->maContent.size(); i++ ) + { + SvtContentEntry aEntry( mpImp->maContent[i]->maTargetURL, mpImp->maContent[i]->mbIsFolder ); + aContent.push_back( aEntry ); + } + + return aContent; +} void SvtFileView::SetConfigString( const OUString& rCfgStr ) { @@ -1644,21 +1662,21 @@ FileViewResult SvtFileView_Impl::GetFolderContent_Impl( DBG_TESTSOLARMUTEX(); ::osl::ClearableMutexGuard aGuard( maMutex ); - OSL_ENSURE( !m_pContentEnumerator.is(), "SvtFileView_Impl::GetFolderContent_Impl: still running another enumeration!" ); - m_pContentEnumerator = new ::svt::FileViewContentEnumerator( - mpView->GetCommandEnvironment(), maContent, maMutex, mbReplaceNames ? mpNameTrans : NULL ); + OSL_ENSURE( !m_xContentEnumerator.is(), "SvtFileView_Impl::GetFolderContent_Impl: still running another enumeration!" ); + m_xContentEnumerator.set(new ::svt::FileViewContentEnumerator( + mpView->GetCommandEnvironment(), maContent, maMutex, mbReplaceNames ? mpNameTrans : NULL)); // TODO: should we cache and re-use this thread? if ( !pAsyncDescriptor ) { - ::svt::EnumerationResult eResult = m_pContentEnumerator->enumerateFolderContentSync( _rFolder, rBlackList ); + ::svt::EnumerationResult eResult = m_xContentEnumerator->enumerateFolderContentSync( _rFolder, rBlackList ); if ( ::svt::SUCCESS == eResult ) { implEnumerationSuccess(); - m_pContentEnumerator.clear(); + m_xContentEnumerator.clear(); return eSuccess; } - m_pContentEnumerator.clear(); + m_xContentEnumerator.clear(); return eFailure; } @@ -1681,7 +1699,7 @@ FileViewResult SvtFileView_Impl::GetFolderContent_Impl( pTimeout->Seconds = nMinTimeout / 1000L; pTimeout->Nanosec = ( nMinTimeout % 1000L ) * 1000000L; - m_pContentEnumerator->enumerateFolderContent( _rFolder, this ); + m_xContentEnumerator->enumerateFolderContent( _rFolder, this ); // wait until the enumeration is finished // for this, release our own mutex (which is used by the enumerator thread) @@ -1702,16 +1720,16 @@ FileViewResult SvtFileView_Impl::GetFolderContent_Impl( if ( ::osl::Condition::result_timeout == eResult ) { // maximum time to wait - OSL_ENSURE( !m_pCancelAsyncTimer.get(), "SvtFileView_Impl::GetFolderContent_Impl: there's still a previous timer!" ); - m_pCancelAsyncTimer = new CallbackTimer( this ); + OSL_ENSURE( !m_xCancelAsyncTimer.get(), "SvtFileView_Impl::GetFolderContent_Impl: there's still a previous timer!" ); + m_xCancelAsyncTimer.set(new CallbackTimer(this)); sal_Int32 nMaxTimeout = pAsyncDescriptor->nMaxTimeout; OSL_ENSURE( nMaxTimeout > nMinTimeout, "SvtFileView_Impl::GetFolderContent_Impl: invalid maximum timeout!" ); if ( nMaxTimeout <= nMinTimeout ) nMaxTimeout = nMinTimeout + 5000; - m_pCancelAsyncTimer->setRemainingTime( salhelper::TTimeValue( nMaxTimeout - nMinTimeout ) ); + m_xCancelAsyncTimer->setRemainingTime( salhelper::TTimeValue( nMaxTimeout - nMinTimeout ) ); // we already waited for nMinTimeout milliseconds, so take this into account - m_pCancelAsyncTimer->start(); + m_xCancelAsyncTimer->start(); m_aCurrentAsyncActionHandler = pAsyncDescriptor->aFinishHandler; DBG_ASSERT( m_aCurrentAsyncActionHandler.IsSet(), "SvtFileView_Impl::GetFolderContent_Impl: nobody interested when it's finished?" ); @@ -1909,17 +1927,17 @@ void SvtFileView_Impl::CancelRunningAsyncAction() { DBG_TESTSOLARMUTEX(); ::osl::MutexGuard aGuard( maMutex ); - if ( !m_pContentEnumerator.is() ) + if ( !m_xContentEnumerator.is() ) return; m_bAsyncActionCancelled = true; - m_pContentEnumerator->cancel(); + m_xContentEnumerator->cancel(); m_bRunningAsyncAction = false; - m_pContentEnumerator.clear(); - if ( m_pCancelAsyncTimer.is() && m_pCancelAsyncTimer->isTicking() ) - m_pCancelAsyncTimer->stop(); - m_pCancelAsyncTimer = NULL; + m_xContentEnumerator.clear(); + if ( m_xCancelAsyncTimer.is() && m_xCancelAsyncTimer->isTicking() ) + m_xCancelAsyncTimer->stop(); + m_xCancelAsyncTimer.clear(); } @@ -1946,10 +1964,10 @@ void SvtFileView_Impl::enumerationDone( ::svt::EnumerationResult eResult ) SolarMutexGuard aSolarGuard; ::osl::MutexGuard aGuard( maMutex ); - m_pContentEnumerator.clear(); - if ( m_pCancelAsyncTimer.is() && m_pCancelAsyncTimer->isTicking() ) - m_pCancelAsyncTimer->stop(); - m_pCancelAsyncTimer = NULL; + m_xContentEnumerator.clear(); + if ( m_xCancelAsyncTimer.is() && m_xCancelAsyncTimer->isTicking() ) + m_xCancelAsyncTimer->stop(); + m_xCancelAsyncTimer.clear(); if ( m_bAsyncActionCancelled ) // this is to prevent race conditions @@ -2022,7 +2040,7 @@ void SvtFileView_Impl::CreateDisplayText_Impl() const LocaleDataWrapper& rLocaleData = aSysLocale.GetLocaleData(); aValue += rLocaleData.getDate( (*aIt)->maModDate ); aValue += aDateSep; - aValue += rLocaleData.getTime( (*aIt)->maModDate ); + aValue += rLocaleData.getTime( (*aIt)->maModDate, false ); } (*aIt)->maDisplayText = aValue; diff --git a/svtools/source/contnr/fileview.src b/svtools/source/contnr/fileview.src index c64573717c4e..54119f394d2e 100644 --- a/svtools/source/contnr/fileview.src +++ b/svtools/source/contnr/fileview.src @@ -76,6 +76,12 @@ Image IMG_SVT_FOLDER MaskColor = Color { Red = 0xFFFF ; Green = 0x0000 ; Blue = 0xFFFF ; }; }; +Image IMG_SVT_FOLDER_OPEN +{ + ImageBitmap = Bitmap { File = "folderop.png" ; }; + MaskColor = Color { Red = 0xFFFF ; Green = 0x0000 ; Blue = 0xFFFF ; }; +}; + // Menus ----------------------------------------------------------------- Menu RID_FILEVIEW_CONTEXTMENU diff --git a/svtools/source/contnr/foldertree.cxx b/svtools/source/contnr/foldertree.cxx new file mode 100644 index 000000000000..daeb9e7fd389 --- /dev/null +++ b/svtools/source/contnr/foldertree.cxx @@ -0,0 +1,161 @@ +/* -*- 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 ) ) + , m_aFolderExpandedImage( SvtResId( IMG_SVT_FOLDER_OPEN ) ) +{ + 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_aFolderExpandedImage ); +} + +void FolderTree::RequestingChildren( SvTreeListEntry* pEntry ) +{ + EnableChildPointerOverwrite( true ); + SetPointer( PointerStyle::Wait ); + Invalidate(INVALIDATE_UPDATE); + + FillTreeEntry( pEntry ); + + SetPointer( PointerStyle::Arrow ); + EnableChildPointerOverwrite( false ); +} + +void FolderTree::FillTreeEntry( SvTreeListEntry* pEntry ) +{ + if( pEntry ) + { + OUString* pURL = static_cast< OUString* >( pEntry->GetUserData() ); + + if( pURL && m_sLastUpdatedDir != *pURL ) + { + while (SvTreeListEntry* pChild = FirstChild(pEntry)) + { + GetModel()->Remove(pChild); + } + + ::std::vector< SortingData_Impl* > aContent; + + ::rtl::Reference< ::svt::FileViewContentEnumerator > + xContentEnumerator(new FileViewContentEnumerator( + m_xEnv, aContent, m_aMutex, NULL)); + + FolderDescriptor aFolder( *pURL ); + + EnumerationResult eResult = + xContentEnumerator->enumerateFolderContentSync( aFolder, m_aBlackList ); + + if ( SUCCESS == eResult ) + { + for( std::vector<SortingData_Impl *>::size_type 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 ) ); + } + } + } + } + else + { + // this dir was updated recently + // next time read this remote folder + m_sLastUpdatedDir = ""; + } + } +} + +void FolderTree::FillTreeEntry( const OUString & rUrl, const ::std::vector< std::pair< OUString, OUString > >& rFolders ) +{ + SetTreePath( rUrl ); + + SvTreeListEntry* pParent = GetCurEntry(); + + if( pParent && !IsExpanded( pParent ) ) + { + while( GetChildCount( pParent ) > 0 ) + { + SvTreeListEntry* pChild = FirstChild( pParent ); + GetModel()->Remove( pChild ); + } + + for(::std::vector< std::pair< OUString, OUString > >::const_iterator it = rFolders.begin(); it != rFolders.end() ; ++it) + { + SvTreeListEntry* pNewEntry = InsertEntry( it->first, pParent, true ); + OUString* sData = new OUString( it->second ); + pNewEntry->SetUserData( static_cast< void* >( sData ) ); + } + + m_sLastUpdatedDir = rUrl; + Expand( pParent ); + } +} + +void FolderTree::SetTreePath( OUString const & 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/control/autocmpledit.cxx b/svtools/source/control/autocmpledit.cxx new file mode 100644 index 000000000000..70df7408cd3d --- /dev/null +++ b/svtools/source/control/autocmpledit.cxx @@ -0,0 +1,111 @@ +/* -*- 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/autocmpledit.hxx> +#include <vcl/svapp.hxx> + +AutocompleteEdit::AutocompleteEdit( vcl::Window* pParent ) + : Edit( pParent ) + , m_nCurrent( 0 ) +{ +/* SignalConnectAutocomplete( nullptr, + [this] ( Edit *const pEdit ) { this->AutoCompleteHandler( pEdit ); } ); */ + autocompleteSignal.connect( [this] ( Edit *const pEdit ) { this->AutoCompleteHandler( pEdit ); }); +} + +void AutocompleteEdit::AddEntry( const OUString& rEntry ) +{ + m_aEntries.push_back( rEntry ); +} + +void AutocompleteEdit::ClearEntries() +{ + m_aEntries.clear(); + m_aMatching.clear(); +} + +void AutocompleteEdit::AutoCompleteHandler( Edit* ) +{ + if( GetAutocompleteAction() != AUTOCOMPLETE_KEYINPUT ) + return; + + if( Application::AnyInput( VclInputFlags::KEYBOARD ) ) + return; + + OUString aCurText = GetText(); + Selection aSelection( GetSelection() ); + + if( aSelection.Max() != aCurText.getLength() ) + return; + + sal_uInt16 nLen = ( sal_uInt16 )aSelection.Min(); + aCurText = aCurText.copy( 0, nLen ); + if( !aCurText.isEmpty() ) + { + if( m_aEntries.size() ) + { + if( Match( aCurText ) ) + { + m_nCurrent = 0; + SetText( m_aMatching[0] ); + sal_uInt16 nNewLen = m_aMatching[0].getLength(); + + Selection aSel( nLen, nNewLen ); + SetSelection( aSel ); + } + } + } +} + +bool AutocompleteEdit::Match( const OUString& rText ) +{ + bool bRet = false; + + m_aMatching.clear(); + + for( std::vector< OUString >::size_type i = 0; i < m_aEntries.size(); ++i ) + { + if( m_aEntries[i].startsWithIgnoreAsciiCase( rText ) ) + { + m_aMatching.push_back( m_aEntries[i] ); + bRet = true; + } + } + + return bRet; +} + +bool AutocompleteEdit::PreNotify( NotifyEvent& rNEvt ) +{ + if( rNEvt.GetType() == MouseNotifyEvent::KEYINPUT ) + { + const KeyEvent& rEvent = *rNEvt.GetKeyEvent(); + const vcl::KeyCode& rKey = rEvent.GetKeyCode(); + vcl::KeyCode aCode( rKey.GetCode() ); + + if( ( aCode == KEY_UP || aCode == KEY_DOWN ) && !rKey.IsMod2() ) + { + Selection aSelection( GetSelection() ); + sal_uInt16 nLen = ( sal_uInt16 )aSelection.Min(); + + if( m_aMatching.size() && + ( ( aCode == KEY_DOWN && m_nCurrent + 1 < m_aMatching.size() ) + || ( aCode == KEY_UP && m_nCurrent > 0 ) ) ) + { + SetText( m_aMatching[ aCode == KEY_DOWN ? ++m_nCurrent : --m_nCurrent ] ); + SetSelection( Selection( nLen, GetText().getLength() ) ); + return true; + } + } + } + + return Edit::PreNotify( rNEvt ); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/control/breadcrumb.cxx b/svtools/source/control/breadcrumb.cxx new file mode 100644 index 000000000000..7d4f9178b8fe --- /dev/null +++ b/svtools/source/control/breadcrumb.cxx @@ -0,0 +1,284 @@ +/* -*- 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/breadcrumb.hxx> + +class CustomLink : public FixedHyperlink +{ +public: + CustomLink( vcl::Window* pParent, WinBits nWinStyle ) + : FixedHyperlink( pParent, nWinStyle ) + { + vcl::Font aFont = GetControlFont( ); + aFont.SetUnderline( UNDERLINE_NONE ); + SetControlFont( aFont ); + } + +protected: + virtual void MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE + { + // changes the style if the control is enabled + if ( !rMEvt.IsLeaveWindow() && IsEnabled() ) + { + vcl::Font aFont = GetControlFont( ); + aFont.SetUnderline( UNDERLINE_SINGLE ); + SetControlFont( aFont ); + } + else + { + vcl::Font aFont = GetControlFont( ); + aFont.SetUnderline( UNDERLINE_NONE ); + SetControlFont( aFont ); + } + + FixedHyperlink::MouseMove( rMEvt ); + } +}; + +Breadcrumb::Breadcrumb( vcl::Window* pParent, WinBits nWinStyle ) : VclHBox( pParent, nWinStyle ) +{ + m_eMode = SvtBreadcrumbMode::ONLY_CURRENT_PATH; + set_spacing( SPACING ); + appendField(); // root +} + +Breadcrumb::~Breadcrumb() +{ + disposeOnce(); +} + +void Breadcrumb::dispose() +{ + for( unsigned int i = 0; i < m_aLinks.size(); i++ ) + { + m_aSeparators[i].disposeAndClear(); + m_aLinks[i].disposeAndClear(); + } + + VclHBox::dispose(); +} + +void Breadcrumb::EnableFields( bool bEnable ) +{ + VclHBox::Enable( bEnable, true ); + if( bEnable ) + { + INetURLObject aURL( m_aCurrentURL ); + int nSegments = aURL.getSegmentCount(); + m_aLinks[nSegments]->Enable( false ); + } +} + +void Breadcrumb::SetClickHdl( const Link<>& rLink ) +{ + m_aClickHdl = rLink; +} + +OUString Breadcrumb::GetHdlURL() +{ + return m_sClickedURL; +} + +void Breadcrumb::SetRootName( const OUString& rURL ) +{ + m_sRootName = rURL; + + // we changed root - clear all fields + for( std::vector<VclPtr<FixedHyperlink>>::size_type i = 1; i < m_aLinks.size(); i++ ) + { + m_aLinks[i]->SetText( "" ); + + m_aLinks[i]->Hide(); + m_aSeparators[i]->Hide(); + m_aLinks[i]->Enable( true ); + } +} + +void Breadcrumb::SetURL( const OUString& rURL ) +{ + m_aCurrentURL = rURL; + INetURLObject aURL( rURL ); + aURL.setFinalSlash(); + + OUString sUser = aURL.GetUser( INetURLObject::NO_DECODE ); + OUString sPath = aURL.GetURLPath(INetURLObject::DECODE_WITH_CHARSET); + OUString sRootPath = INetURLObject::GetScheme( aURL.GetProtocol() ) + + sUser + + ( sUser.isEmpty() ? OUString() : "@" ) + + aURL.GetHost(); + + int nSegments = aURL.getSegmentCount(); + unsigned int nPos = 0; + + bool bClear = ( m_eMode == SvtBreadcrumbMode::ONLY_CURRENT_PATH ); + + // root field + + m_aLinks[0]->SetText( m_sRootName ); + m_aLinks[0]->Enable( true ); + m_aLinks[0]->SetURL( sRootPath ); + + // fill the other fields + + for( unsigned int i = 1; i < (unsigned int)nSegments + 1; i++ ) + { + if( i >= m_aLinks.size() ) + appendField(); + + unsigned int nEnd = sPath.indexOf( '/', nPos + 1 ); + OUString sLabel = OUString( sPath.getStr() + nPos + 1, nEnd - nPos - 1 ); + + if( m_eMode == SvtBreadcrumbMode::ALL_VISITED ) + { + if( m_aLinks[i]->GetText() != sLabel ) + bClear = true; + } + + m_aLinks[i]->SetText( sLabel ); + m_aLinks[i]->SetURL( sRootPath + OUString( sPath.getStr(), nEnd ) ); + m_aLinks[i]->Hide(); + m_aLinks[i]->Enable( true ); + + m_aSeparators[i]->Hide(); + + nPos = nEnd; + } + + // clear unused fields + + for( unsigned int i = nSegments + 1; i < m_aLinks.size(); i++ ) + { + if( bClear ) + m_aLinks[i]->SetText( "" ); + + m_aLinks[i]->Hide(); + m_aSeparators[i]->Hide(); + m_aLinks[i]->Enable( true ); + } + + // show fields + + Resize(); + unsigned int nMaxWidth = GetSizePixel().Width(); + unsigned int nSeparatorWidth = m_aSeparators[0]->GetSizePixel().Width(); + unsigned int nCurrentWidth = 0; + unsigned int nLastVisible = nSegments; + + bool bRight = ( m_eMode == SvtBreadcrumbMode::ALL_VISITED ); + bool bLeft = true; + + int i = 0; + + while( bLeft || bRight ) + { + if( nSegments - i == -1 ) + bLeft = false; + + if( bLeft ) + { + unsigned int nIndex = nSegments - i; + + if( showField( nIndex, nMaxWidth - nCurrentWidth ) ) + { + nCurrentWidth += m_aLinks[nIndex]->GetSizePixel().Width() + + nSeparatorWidth + 2*SPACING; + } + else + { + // label is too long + if( nSegments != 0 ) + { + m_aLinks[0]->SetText( "..." ); + m_aLinks[0]->Enable( false ); + } + bLeft = false; + } + } + + if( nSegments + i == (int)m_aLinks.size() ) + bRight = false; + + if( i != 0 && bRight ) + { + unsigned int nIndex = nSegments + i; + + if( m_aLinks[nIndex]->GetText() == "" ) + { + bRight = false; + } + else if( showField( nIndex, nMaxWidth - nCurrentWidth ) ) + { + nCurrentWidth += m_aLinks[nIndex]->GetSizePixel().Width() + + nSeparatorWidth + 3*SPACING; + nLastVisible = nIndex; + } + else + { + bRight = false; + } + } + + i++; + } + + // current dir should be inactive + m_aLinks[nSegments]->Enable( false ); + + // hide last separator + m_aSeparators[nLastVisible]->Hide(); +} + +void Breadcrumb::SetMode( SvtBreadcrumbMode eMode ) +{ + m_eMode = eMode; +} + +void Breadcrumb::appendField() +{ + m_aLinks.push_back( VclPtr< CustomLink >::Create( this, WB_TABSTOP ) ); + m_aLinks[m_aLinks.size() - 1]->Hide(); + m_aLinks[m_aLinks.size() - 1]->SetClickHdl( LINK( this, Breadcrumb, ClickLinkHdl ) ); + + m_aSeparators.push_back( VclPtr< FixedText >::Create( this ) ); + m_aSeparators[m_aLinks.size() - 1]->SetText( ">" ); + m_aSeparators[m_aLinks.size() - 1]->Hide(); +} + +bool Breadcrumb::showField( unsigned int nIndex, unsigned int nWidthMax ) +{ + m_aLinks[nIndex]->Show(); + m_aSeparators[nIndex]->Show(); + + unsigned int nSeparatorWidth = m_aSeparators[0]->GetSizePixel().Width(); + unsigned int nWidth = m_aLinks[nIndex]->GetSizePixel().Width() + + nSeparatorWidth + 3*SPACING; + + if( nWidth > nWidthMax ) + { + if( nIndex != 0 ) + { + m_aLinks[nIndex]->Hide(); + m_aSeparators[nIndex]->Hide(); + } + + return false; + } + + return true; +} + +IMPL_LINK ( Breadcrumb, ClickLinkHdl, FixedHyperlink*, pLink ) +{ + m_sClickedURL = pLink->GetURL(); + m_aClickHdl.Call( this ); + + return 1; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/dialogs/PlaceEditDialog.cxx b/svtools/source/dialogs/PlaceEditDialog.cxx index 90fdea7b0a92..9422a7b55db2 100644 --- a/svtools/source/dialogs/PlaceEditDialog.cxx +++ b/svtools/source/dialogs/PlaceEditDialog.cxx @@ -10,13 +10,20 @@ #include <svtools/PlaceEditDialog.hxx> #include <svtools/ServerDetailsControls.hxx> +#include <com/sun/star/uno/Sequence.hxx> #include <officecfg/Office/Common.hxx> #include <svtools/svtresid.hxx> +#include <svtools/svtools.hrc> #include <vcl/msgbox.hxx> +using namespace com::sun::star::uno; + PlaceEditDialog::PlaceEditDialog(vcl::Window* pParent) : ModalDialog(pParent, "PlaceEditDialog", "svt/ui/placeedit.ui") , m_xCurrentDetails() + , m_nCurrentType( 0 ) + , bLabelChanged( false ) + , m_bShowPassword( true ) { get( m_pEDServerName, "name" ); get( m_pLBServerType, "type" ); @@ -24,11 +31,15 @@ PlaceEditDialog::PlaceEditDialog(vcl::Window* pParent) get( m_pBTOk, "ok" ); get( m_pBTCancel, "cancel" ); get( m_pBTDelete, "delete" ); + get( m_pBTRepoRefresh, "repositoriesRefresh" ); + get( m_pCBPassword, "rememberPassword" ); + get( m_pEDPassword, "password" ); + get( m_pFTPasswordLabel, "passwordLabel" ); m_pBTOk->SetClickHdl( LINK( this, PlaceEditDialog, OKHdl) ); m_pBTOk->Enable( false ); - m_pEDServerName->SetModifyHdl( LINK( this, PlaceEditDialog, EditHdl) ); + m_pEDServerName->SetModifyHdl( LINK( this, PlaceEditDialog, EditLabelHdl) ); // This constructor is called when user request a place creation, so // delete button is hidden. @@ -36,6 +47,7 @@ PlaceEditDialog::PlaceEditDialog(vcl::Window* pParent) m_pLBServerType->SetSelectHdl( LINK( this, PlaceEditDialog, SelectTypeHdl ) ); m_pEDUsername->SetModifyHdl( LINK( this, PlaceEditDialog, EditUsernameHdl ) ); + m_pEDPassword->SetModifyHdl( LINK( this, PlaceEditDialog, EditUsernameHdl ) ); InitDetails( ); } @@ -43,6 +55,8 @@ PlaceEditDialog::PlaceEditDialog(vcl::Window* pParent) PlaceEditDialog::PlaceEditDialog(vcl::Window* pParent, const std::shared_ptr<Place>& rPlace) : ModalDialog(pParent, "PlaceEditDialog", "svt/ui/placeedit.ui") , m_xCurrentDetails( ) + , bLabelChanged( true ) + , m_bShowPassword( false ) { get( m_pEDServerName, "name" ); get( m_pLBServerType, "type" ); @@ -50,11 +64,19 @@ PlaceEditDialog::PlaceEditDialog(vcl::Window* pParent, const std::shared_ptr<Pla get( m_pBTOk, "ok" ); get( m_pBTCancel, "cancel" ); get( m_pBTDelete, "delete" ); + get( m_pTypeGrid, "TypeGrid" ); + get( m_pCBPassword, "rememberPassword" ); + get( m_pEDPassword, "password" ); + get( m_pFTPasswordLabel, "passwordLabel" ); + + m_pEDPassword->Hide(); + m_pFTPasswordLabel->Hide(); + m_pCBPassword->Hide(); m_pBTOk->SetClickHdl( LINK( this, PlaceEditDialog, OKHdl) ); m_pBTDelete->SetClickHdl ( LINK( this, PlaceEditDialog, DelHdl) ); - m_pEDServerName->SetModifyHdl( LINK( this, PlaceEditDialog, EditHdl) ); + m_pEDServerName->SetModifyHdl( LINK( this, PlaceEditDialog, ModifyHdl) ); m_pLBServerType->SetSelectHdl( LINK( this, PlaceEditDialog, SelectTypeHdl ) ); InitDetails( ); @@ -74,9 +96,13 @@ PlaceEditDialog::PlaceEditDialog(vcl::Window* pParent, const std::shared_ptr<Pla // Fill the Username field if ( rUrl.HasUserData( ) ) - m_pEDUsername->SetText( rUrl.GetUser( ) ); + m_pEDUsername->SetText( INetURLObject::decode( rUrl.GetUser( ), + INetURLObject::DECODE_WITH_CHARSET ) ); } } + + // In edit mode user can't change connection type + m_pTypeGrid->Hide(); } PlaceEditDialog::~PlaceEditDialog() @@ -92,6 +118,8 @@ void PlaceEditDialog::dispose() m_pBTOk.clear(); m_pBTCancel.clear(); m_pBTDelete.clear(); + m_pEDPassword.clear(); + m_pFTPasswordLabel.clear(); ModalDialog::dispose(); } @@ -118,6 +146,41 @@ std::shared_ptr<Place> PlaceEditDialog::GetPlace() void PlaceEditDialog::InitDetails( ) { + // Create CMIS controls for each server type + + Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + + // Load the ServerType entries + bool bSkipGDrive = OUString( GDRIVE_CLIENT_ID ).isEmpty() || + OUString( GDRIVE_CLIENT_SECRET ).isEmpty(); + bool bSkipAlfresco = OUString( ALFRESCO_CLOUD_CLIENT_ID ).isEmpty() || + OUString( ALFRESCO_CLOUD_CLIENT_SECRET ).isEmpty(); + bool bSkipOneDrive= OUString( ONEDRIVE_CLIENT_ID ).isEmpty() || + OUString( ONEDRIVE_CLIENT_SECRET ).isEmpty(); + + Sequence< OUString > aTypesUrlsList( officecfg::Office::Common::Misc::CmisServersUrls::get( xContext ) ); + Sequence< OUString > aTypesNamesList( officecfg::Office::Common::Misc::CmisServersNames::get( xContext ) ); + + unsigned int nPos = 0; + for ( sal_Int32 i = 0; i < aTypesUrlsList.getLength( ) && aTypesNamesList.getLength( ); ++i ) + { + OUString sUrl = aTypesUrlsList[i]; + nPos = m_pLBServerType->InsertEntry( aTypesNamesList[i], nPos ); + + std::shared_ptr<DetailsContainer> xCmisDetails(std::make_shared<CmisDetailsContainer>(this, sUrl)); + xCmisDetails->setChangeHdl( LINK( this, PlaceEditDialog, EditHdl ) ); + m_aDetailsContainers.push_back(xCmisDetails); + + if ( ( sUrl == GDRIVE_BASE_URL && bSkipGDrive ) || + ( sUrl.startsWith( ALFRESCO_CLOUD_BASE_URL ) && bSkipAlfresco ) || + ( sUrl == ONEDRIVE_BASE_URL && bSkipOneDrive ) ) + { + xCmisDetails->setActive( false ); + } + + nPos++; + } + // Create WebDAV / FTP / SSH details control std::shared_ptr<DetailsContainer> xDavDetails(std::make_shared<DavDetailsContainer>(this)); xDavDetails->setChangeHdl( LINK( this, PlaceEditDialog, EditHdl ) ); @@ -136,19 +199,75 @@ void PlaceEditDialog::InitDetails( ) xSmbDetails->setChangeHdl( LINK( this, PlaceEditDialog, EditHdl ) ); m_aDetailsContainers.push_back(xSmbDetails); - // Create CMIS control - std::shared_ptr<DetailsContainer> xCmisDetails(std::make_shared<CmisDetailsContainer>(this)); - xCmisDetails->setChangeHdl( LINK( this, PlaceEditDialog, EditHdl ) ); - m_aDetailsContainers.push_back(xCmisDetails); - // Set default to first value m_pLBServerType->SelectEntryPos( 0 ); + + if ( m_pLBServerType->GetSelectEntry() == "--------------------" ) + m_pLBServerType->SelectEntryPos( 1 ); + SelectTypeHdl( m_pLBServerType ); } +void PlaceEditDialog::UpdateLabel( ) +{ + if( !bLabelChanged ) + { + if( !m_pEDUsername->GetText().isEmpty( ) ) + { + OUString sLabel = SvtResId( STR_SVT_DEFAULT_SERVICE_LABEL ); + OUString sUser = m_pEDUsername->GetText(); + + int nLength = sUser.indexOf( '@' ); + if( nLength < 0 ) + nLength = sUser.getLength(); + + sLabel = sLabel.replaceFirst( "$user$", sUser.copy( 0, nLength ) ); + sLabel = sLabel.replaceFirst( "$service$", m_pLBServerType->GetSelectEntry() ); + + m_pEDServerName->SetText( sLabel ); + bLabelChanged = false; + } + else + { + m_pEDServerName->SetText( m_pLBServerType->GetSelectEntry( ) ); + } + } +} + IMPL_LINK ( PlaceEditDialog, OKHdl, Button *, ) { - EndDialog( RET_OK ); + if ( m_xCurrentDetails.get() ) + { + OUString sUrl = m_xCurrentDetails->getUrl().GetHost( INetURLObject::DECODE_WITH_CHARSET ); + OUString sGDriveHost( GDRIVE_BASE_URL ); + OUString sAlfrescoHost( ALFRESCO_CLOUD_BASE_URL ); + OUString sOneDriveHost( ONEDRIVE_BASE_URL ); + + if ( sUrl.compareTo( sGDriveHost, sGDriveHost.getLength() ) == 0 + || sUrl.compareTo( sAlfrescoHost, sAlfrescoHost.getLength() ) == 0 + || sUrl.compareTo( sOneDriveHost, sOneDriveHost.getLength() ) == 0 ) + { + m_pBTRepoRefresh->Click(); + + sUrl = m_xCurrentDetails->getUrl().GetHost( INetURLObject::DECODE_WITH_CHARSET ); + INetURLObject aHostUrl( sUrl ); + OUString sRepoId = aHostUrl.GetMark(); + + if ( !sRepoId.isEmpty() ) + { + EndDialog( RET_OK ); + } + else + { + // TODO: repository id missing. Auth error? + } + } + else + { + EndDialog( RET_OK ); + } + } + return 1; } @@ -159,11 +278,26 @@ IMPL_LINK ( PlaceEditDialog, DelHdl, Button *, ) return 1; } -IMPL_LINK_NOARG( PlaceEditDialog, EditHdl ) +IMPL_LINK_NOARG_TYPED( PlaceEditDialog, EditHdl, DetailsContainer*, void ) { + UpdateLabel( ); + OUString sUrl = GetServerUrl( ); OUString sName = OUString( m_pEDServerName->GetText() ).trim( ); m_pBTOk->Enable( !sName.isEmpty( ) && !sUrl.isEmpty( ) ); +} + +IMPL_LINK_NOARG( PlaceEditDialog, ModifyHdl ) +{ + EditHdl(nullptr); + return 1; +} + +IMPL_LINK_NOARG( PlaceEditDialog, EditLabelHdl ) +{ + bLabelChanged = true; + EditHdl(NULL); + return 1; } @@ -173,21 +307,43 @@ IMPL_LINK_NOARG( PlaceEditDialog, EditUsernameHdl ) it != m_aDetailsContainers.end( ); ++it ) { ( *it )->setUsername( OUString( m_pEDUsername->GetText() ) ); + ( *it )->setPassword( m_pEDPassword->GetText() ); } + + EditHdl(NULL); + return 1; } 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); + m_xCurrentDetails->show(); + + m_pCBPassword->Show( m_bShowPassword ); + m_pEDPassword->Show( m_bShowPassword ); + m_pFTPasswordLabel->Show( m_bShowPassword ); SetSizePixel(GetOptimalSize()); + + EditHdl(NULL); + return 0; } diff --git a/svtools/source/dialogs/ServerDetailsControls.cxx b/svtools/source/dialogs/ServerDetailsControls.cxx index 7a17bfde68c6..54c8e0404617 100644 --- a/svtools/source/dialogs/ServerDetailsControls.cxx +++ b/svtools/source/dialogs/ServerDetailsControls.cxx @@ -31,18 +31,30 @@ using namespace com::sun::star::task; using namespace com::sun::star::ucb; using namespace com::sun::star::uno; -DetailsContainer::DetailsContainer( VclBuilderContainer* pBuilder, const OString& rFrame ) +DetailsContainer::DetailsContainer( VclBuilderContainer* pBuilder ) : + m_bIsActive ( true ) { - pBuilder->get( m_pFrame, rFrame ); + pBuilder->get( m_pDetailsGrid, "Details" ); + pBuilder->get( m_pHostBox, "HostDetails" ); + pBuilder->get( m_pEDHost, "host" ); + pBuilder->get( m_pFTHost, "hostLabel" ); + pBuilder->get( m_pEDPort, "port-nospin" ); + pBuilder->get( m_pFTPort, "portLabel" ); + pBuilder->get( m_pEDRoot, "path" ); + pBuilder->get( m_pFTRoot, "pathLabel" ); } DetailsContainer::~DetailsContainer( ) { } -void DetailsContainer::show( bool bShow ) +void DetailsContainer::show( bool ) { - m_pFrame->Show( bShow ); + m_pDetailsGrid->Enable( m_bIsActive ); + + m_pEDHost->SetModifyHdl( LINK( this, DetailsContainer, ValueChangeHdl ) ); + m_pEDPort->SetModifyHdl( LINK( this, DetailsContainer, ValueChangeHdl ) ); + m_pEDRoot->SetModifyHdl( LINK( this, DetailsContainer, ValueChangeHdl ) ); } INetURLObject DetailsContainer::getUrl( ) @@ -63,6 +75,11 @@ void DetailsContainer::notifyChange( ) m_aChangeHdl.Call( this ); } +void DetailsContainer::setActive( bool bActive ) +{ + m_bIsActive = bActive; +} + IMPL_LINK_NOARG( DetailsContainer, ValueChangeHdl ) { notifyChange( ); @@ -70,34 +87,34 @@ IMPL_LINK_NOARG( DetailsContainer, ValueChangeHdl ) } HostDetailsContainer::HostDetailsContainer( VclBuilderContainer* pBuilder, sal_uInt16 nPort, const OUString& sScheme ) : - DetailsContainer( pBuilder, "HostDetails" ), + DetailsContainer( pBuilder ), m_nDefaultPort( nPort ), m_sScheme( sScheme ) { - pBuilder->get( m_pEDHost, "host" ); - m_pEDHost->SetModifyHdl( LINK( this, DetailsContainer, ValueChangeHdl ) ); - - pBuilder->get( m_pEDPort, "port" ); - m_pEDPort->SetModifyHdl( LINK( this, DetailsContainer, ValueChangeHdl ) ); - - pBuilder->get( m_pEDPath, "path" ); - m_pEDPath->SetModifyHdl( LINK( this, DetailsContainer, ValueChangeHdl ) ); - show( false ); } void HostDetailsContainer::show( bool bShow ) { + m_pFTHost->Show( bShow ); + m_pHostBox->Show( bShow ); + m_pEDRoot->Show( bShow ); + m_pFTRoot->Show( bShow ); + DetailsContainer::show( bShow ); + if ( bShow ) + { m_pEDPort->SetValue( m_nDefaultPort ); + m_pEDHost->SetText( m_sHost ); + } } INetURLObject HostDetailsContainer::getUrl( ) { OUString sHost = m_pEDHost->GetText().trim( ); sal_Int64 nPort = m_pEDPort->GetValue(); - OUString sPath = m_pEDPath->GetText().trim( ); + OUString sPath = m_pEDRoot->GetText().trim( ); OUString sUrl; if ( !sHost.isEmpty( ) ) @@ -122,7 +139,7 @@ bool HostDetailsContainer::setUrl( const INetURLObject& rUrl ) { m_pEDHost->SetText( rUrl.GetHost( ) ); m_pEDPort->SetValue( rUrl.GetPort( ) ); - m_pEDPath->SetText( rUrl.GetURLPath() ); + m_pEDRoot->SetText( rUrl.GetURLPath() ); } return bSuccess; @@ -188,17 +205,13 @@ IMPL_LINK( DavDetailsContainer, ToggledDavsHdl, CheckBox*, pCheckBox ) } SmbDetailsContainer::SmbDetailsContainer( VclBuilderContainer* pBuilder ) : - DetailsContainer( pBuilder, "SmbDetails" ) + DetailsContainer( pBuilder ) { - pBuilder->get( m_pEDHost, "smbHost" ); - m_pEDHost->SetModifyHdl( LINK( this, DetailsContainer, ValueChangeHdl ) ); + pBuilder->get( m_pEDShare, "share" ); + pBuilder->get( m_pFTShare, "shareLabel" ); - pBuilder->get( m_pEDShare, "smbShare" ); m_pEDShare->SetModifyHdl( LINK( this, DetailsContainer, ValueChangeHdl ) ); - pBuilder->get( m_pEDPath, "smbPath" ); - m_pEDPath->SetModifyHdl( LINK( this, DetailsContainer, ValueChangeHdl ) ); - show( false ); } @@ -206,7 +219,7 @@ INetURLObject SmbDetailsContainer::getUrl( ) { OUString sHost = m_pEDHost->GetText().trim( ); OUString sShare = m_pEDShare->GetText().trim( ); - OUString sPath = m_pEDPath->GetText().trim( ); + OUString sPath = m_pEDRoot->GetText().trim( ); OUString sUrl; if ( !sHost.isEmpty( ) ) @@ -242,73 +255,98 @@ bool SmbDetailsContainer::setUrl( const INetURLObject& rUrl ) m_pEDHost->SetText( rUrl.GetHost( ) ); m_pEDShare->SetText( sShare ); - m_pEDPath->SetText( sPath ); + m_pEDRoot->SetText( sPath ); } return bSuccess; } -CmisDetailsContainer::CmisDetailsContainer( VclBuilderContainer* pBuilder ) : - DetailsContainer( pBuilder, "CmisDetails" ), +void SmbDetailsContainer::show( bool bShow ) +{ + m_pEDShare->Show( bShow ); + m_pFTShare->Show( bShow ); + m_pEDRoot->Show( bShow ); + m_pFTRoot->Show( bShow ); + + m_pFTHost->Show( bShow ); + m_pHostBox->Show( bShow ); + m_pEDPort->Enable( !bShow ); + m_pFTPort->Enable( !bShow ); +} + +CmisDetailsContainer::CmisDetailsContainer( VclBuilderContainer* pBuilder, OUString const & sBinding ) : + DetailsContainer( pBuilder ), m_sUsername( ), m_xCmdEnv( ), - m_aServerTypesURLs( ), m_aRepoIds( ), - m_sRepoId( ) + m_sRepoId( ), + m_sBinding( sBinding ) { Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext(); Reference< XInteractionHandler > xGlobalInteractionHandler( InteractionHandler::createWithParent(xContext, 0), UNO_QUERY ); m_xCmdEnv = new ucbhelper::CommandEnvironment( xGlobalInteractionHandler, Reference< XProgressHandler >() ); - pBuilder->get( m_pLBServerType, "serverType" ); - m_pLBServerType->SetSelectHdl( LINK( this, CmisDetailsContainer, SelectServerTypeHdl ) ); - - pBuilder->get( m_pEDBinding, "binding" ); - m_pEDBinding->SetModifyHdl( LINK( this, DetailsContainer, ValueChangeHdl ) ); - + pBuilder->get( m_pFTRepository, "repositoryLabel" ); pBuilder->get( m_pLBRepository, "repositories" ); - m_pLBRepository->SetSelectHdl( LINK( this, CmisDetailsContainer, SelectRepoHdl ) ); - pBuilder->get( m_pBTRepoRefresh, "repositoriesRefresh" ); - m_pBTRepoRefresh->SetClickHdl( LINK( this, CmisDetailsContainer, RefreshReposHdl ) ); - - pBuilder->get( m_pEDPath, "cmisPath" ); - m_pEDPath->SetModifyHdl( LINK( this, DetailsContainer, ValueChangeHdl ) ); + pBuilder->get( m_pRepositoryBox, "RepositoryDetails" ); show( false ); +} - // Load the ServerType entries - bool bSkipGDrive = OUString( GDRIVE_CLIENT_ID ).isEmpty() || - OUString( GDRIVE_CLIENT_SECRET ).isEmpty(); - bool bSkipAlfresco = OUString( ALFRESCO_CLOUD_CLIENT_ID ).isEmpty() || - OUString( ALFRESCO_CLOUD_CLIENT_SECRET ).isEmpty(); - bool bSkipOneDrive= OUString( ONEDRIVE_CLIENT_ID ).isEmpty() || - OUString( ONEDRIVE_CLIENT_SECRET ).isEmpty(); +void CmisDetailsContainer::show( bool bShow ) +{ + m_pLBRepository->SetSelectHdl( LINK( this, CmisDetailsContainer, SelectRepoHdl ) ); + m_pBTRepoRefresh->SetClickHdl( LINK( this, CmisDetailsContainer, RefreshReposHdl ) ); + m_pEDHost->SetText( m_sBinding ); - Sequence< OUString > aTypesUrlsList( officecfg::Office::Common::Misc::CmisServersUrls::get( xContext ) ); - Sequence< OUString > aTypesNamesList( officecfg::Office::Common::Misc::CmisServersNames::get( xContext ) ); - for ( sal_Int32 i = 0; i < aTypesUrlsList.getLength( ) && aTypesNamesList.getLength( ); ++i ) + if( ( m_sBinding == GDRIVE_BASE_URL ) + || m_sBinding.startsWith( ALFRESCO_CLOUD_BASE_URL ) + || ( m_sBinding == ONEDRIVE_BASE_URL ) ) { - OUString sUrl = aTypesUrlsList[i]; - if ( !( sUrl == GDRIVE_BASE_URL && bSkipGDrive ) && - !( sUrl.startsWith( ALFRESCO_CLOUD_BASE_URL ) && bSkipAlfresco ) && - !( sUrl == ONEDRIVE_BASE_URL && bSkipOneDrive ) ) - { - m_pLBServerType->InsertEntry( aTypesNamesList[i] ); - m_aServerTypesURLs.push_back( sUrl ); - } + m_pFTHost->Show( false ); + m_pHostBox->Show( false ); + m_pFTRepository->Show( false ); + m_pRepositoryBox->Show( false ); + m_pEDRoot->Show( false ); + m_pFTRoot->Show( false ); + } + else + { + m_pFTHost->Show( bShow ); + m_pHostBox->Show( bShow ); + m_pFTRepository->Show( bShow ); + m_pRepositoryBox->Show( bShow ); + m_pEDRoot->Show( bShow ); + m_pFTRoot->Show( bShow ); } + + DetailsContainer::show( bShow ); + m_pEDPort->Enable( !bShow ); + m_pFTPort->Enable( !bShow ); } INetURLObject CmisDetailsContainer::getUrl( ) { - OUString sBindingUrl = m_pEDBinding->GetText().trim( ); - OUString sPath = m_pEDPath->GetText().trim( ); + OUString sBindingUrl = m_pEDHost->GetText().trim( ); + OUString sPath = m_pEDRoot->GetText().trim( ); + + bool bSkip = true; + if( ( m_sBinding == GDRIVE_BASE_URL ) + || m_sBinding.startsWith( ALFRESCO_CLOUD_BASE_URL ) + || ( m_sBinding == ONEDRIVE_BASE_URL ) ) + { + bSkip = m_sUsername.isEmpty(); + } + else + { + bSkip = m_sRepoId.isEmpty(); + } OUString sUrl; - if ( !sBindingUrl.isEmpty( ) && !m_sRepoId.isEmpty() ) + if ( !sBindingUrl.isEmpty( ) && !bSkip ) { OUString sEncodedBinding = rtl::Uri::encode( sBindingUrl + "#" + m_sRepoId, @@ -328,16 +366,13 @@ bool CmisDetailsContainer::setUrl( const INetURLObject& rUrl ) if ( bSuccess ) { - OUString sBindingUrl; - OUString sRepositoryId; - OUString sDecodedHost = rUrl.GetHost( INetURLObject::DECODE_WITH_CHARSET ); INetURLObject aHostUrl( sDecodedHost ); - sBindingUrl = aHostUrl.GetURLNoMark( ); - sRepositoryId = aHostUrl.GetMark( ); + m_sBinding = aHostUrl.GetURLNoMark( ); + m_sRepoId = aHostUrl.GetMark( ); - m_pEDBinding->SetText( sBindingUrl ); - m_pEDPath->SetText( rUrl.GetURLPath() ); + m_pEDHost->SetText( m_sBinding ); + m_pEDRoot->SetText( rUrl.GetURLPath() ); } return bSuccess; } @@ -347,26 +382,40 @@ void CmisDetailsContainer::setUsername( const OUString& rUsername ) m_sUsername = rUsername; } -void CmisDetailsContainer::selectRepository( ) +void CmisDetailsContainer::setPassword( const OUString& rPass ) { - // Get the repo ID and call the Change listener - sal_uInt16 nPos = m_pLBRepository->GetSelectEntryPos( ); - m_sRepoId = m_aRepoIds[nPos]; - - notifyChange( ); + m_sPassword = rPass; } -IMPL_LINK_NOARG( CmisDetailsContainer, SelectServerTypeHdl ) +void CmisDetailsContainer::selectRepository( ) { - // Set a sample URL for the server - sal_uInt16 nId = m_pLBServerType->GetSelectEntryPos( ); - m_pEDBinding->SetText( m_aServerTypesURLs[nId] ); - return 0; + // Get the repo ID and call the Change listener + sal_uInt16 nPos = m_pLBRepository->GetSelectEntryPos( ); + if( nPos < m_aRepoIds.size() ) + { + m_sRepoId = m_aRepoIds[nPos]; + notifyChange( ); + } } IMPL_LINK_NOARG( CmisDetailsContainer, RefreshReposHdl ) { - OUString sBindingUrl = m_pEDBinding->GetText().trim( ); + Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + Reference< XPasswordContainer2 > xMasterPasswd = PasswordContainer::create( xContext ); + + + OUString sBindingUrl = m_pEDHost->GetText().trim( ); + + OUString sEncodedUsername = ""; + + if ( !m_sUsername.isEmpty( ) ) + { + sEncodedUsername = rtl::Uri::encode(m_sUsername, + rtl_UriCharClassUserinfo, + rtl_UriEncodeKeepEscapes, + RTL_TEXTENCODING_UTF8 ); + sEncodedUsername += "@"; + } // Clean the listbox m_pLBRepository->Clear( ); @@ -381,8 +430,27 @@ IMPL_LINK_NOARG( CmisDetailsContainer, RefreshReposHdl ) rtl_UriCharClassRelSegment, rtl_UriEncodeKeepEscapes, RTL_TEXTENCODING_UTF8 ); - sUrl = "vnd.libreoffice.cmis://" + sEncodedBinding; + sUrl = "vnd.libreoffice.cmis://" + sEncodedUsername + sEncodedBinding; + } + + // temporary remember the password + try + { + if( !sUrl.isEmpty() && !m_sUsername.isEmpty() && !m_sPassword.isEmpty() ) + { + Reference< XInteractionHandler > xInteractionHandler( + InteractionHandler::createWithParent( xContext, 0 ), + UNO_QUERY ); + + Sequence< OUString > aPasswd( 1 ); + aPasswd[0] = m_sPassword; + + xMasterPasswd->add( + sUrl, m_sUsername, aPasswd, xInteractionHandler ); + } } + catch( const Exception& ) + {} // Get the Content ::ucbhelper::Content aCnt( sUrl, m_xCmdEnv, comphelper::getProcessComponentContext() ); @@ -417,6 +485,11 @@ IMPL_LINK_NOARG( CmisDetailsContainer, RefreshReposHdl ) selectRepository( ); } + // remove temporary password + { + xMasterPasswd->remove( sUrl, m_sUsername ); + } + return 0; } diff --git a/svtools/source/dialogs/filedlg2.src b/svtools/source/dialogs/filedlg2.src index 6e68db0ff4c1..795da0e54362 100644 --- a/svtools/source/dialogs/filedlg2.src +++ b/svtools/source/dialogs/filedlg2.src @@ -18,6 +18,7 @@ */ #include <svtools/filedlg2.hrc> +#include <svtools/svtools.hrc> String STR_FILEDLG_OPEN { @@ -32,4 +33,9 @@ String STR_FILEDLG_SAVE Text [ en-US ] = "Save" ; }; +String STR_SVT_DEFAULT_SERVICE_LABEL +{ + Text [ en-US ] = "$user$'s $service$" ; +}; + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/uiconfig/ui/placeedit.ui b/svtools/uiconfig/ui/placeedit.ui index 3941f06e3e66..e3c0d3cd64c0 100644 --- a/svtools/uiconfig/ui/placeedit.ui +++ b/svtools/uiconfig/ui/placeedit.ui @@ -30,12 +30,10 @@ <row> <col id="0" translatable="yes">Windows Share</col> </row> - <row> - <col id="0" translatable="yes">CMIS</col> - </row> </data> </object> <object class="GtkDialog" id="PlaceEditDialog"> + <property name="width_request">400</property> <property name="can_focus">False</property> <property name="border_width">6</property> <property name="title" translatable="yes">File Services</property> @@ -115,98 +113,46 @@ <property name="expand">False</property> <property name="fill">True</property> <property name="pack_type">end</property> - <property name="position">3</property> + <property name="position">0</property> </packing> </child> <child> - <object class="GtkFrame" id="FileServices"> + <object class="GtkGrid" id="TypeGrid"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label_xalign">0</property> - <property name="shadow_type">none</property> + <property name="row_spacing">6</property> + <property name="column_spacing">12</property> <child> - <object class="GtkAlignment" id="alignment5"> + <object class="GtkLabel" id="typeLabel"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="top_padding">6</property> - <property name="left_padding">12</property> - <child> - <object class="GtkGrid" id="grid1"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="row_spacing">6</property> - <property name="column_spacing">12</property> - <child> - <object class="GtkLabel" id="label2"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="xalign">1</property> - <property name="label" translatable="yes">Name:</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">name</property> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">0</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label6"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="xalign">1</property> - <property name="label" translatable="yes">Type:</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">type</property> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">1</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="name"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="hexpand">True</property> - <property name="invisible_char">●</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">0</property> - </packing> - </child> - <child> - <object class="GtkComboBox" id="type"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="hexpand">True</property> - <property name="model">liststore1</property> - <child> - <object class="GtkCellRendererText" id="cellrenderertext1"/> - <attributes> - <attribute name="text">0</attribute> - </attributes> - </child> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">1</property> - </packing> - </child> - </object> - </child> + <property name="xalign">1</property> + <property name="label" translatable="yes">Type:</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">type</property> </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + </packing> </child> - <child type="label"> - <object class="GtkLabel" id="label1"> + <child> + <object class="GtkComboBox" id="type"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label" translatable="yes">File Service</property> - <attributes> - <attribute name="weight" value="bold"/> - </attributes> + <property name="hexpand">True</property> + <property name="model">liststore1</property> + <child> + <object class="GtkCellRendererText" id="cellrenderertext1"/> + <attributes> + <attribute name="text">0</attribute> + </attributes> + </child> </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">0</property> + </packing> </child> </object> <packing> @@ -216,492 +162,300 @@ </packing> </child> <child> - <object class="GtkFrame" id="HostDetails"> + <object class="GtkGrid" id="Details"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label_xalign">0</property> - <property name="shadow_type">none</property> + <property name="row_spacing">6</property> + <property name="column_spacing">12</property> <child> - <object class="GtkAlignment" id="alignment1"> + <object class="GtkLabel" id="hostLabel"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="top_padding">6</property> - <property name="left_padding">12</property> - <child> - <object class="GtkGrid" id="grid2"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="row_spacing">6</property> - <property name="column_spacing">12</property> - <child> - <object class="GtkLabel" id="hostLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="xalign">1</property> - <property name="label" translatable="yes">Host:</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">host</property> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">0</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="pathLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="xalign">1</property> - <property name="label" translatable="yes">Path:</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">path</property> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">1</property> - </packing> - </child> - <child> - <object class="GtkGrid" id="grid3"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="column_spacing">12</property> - <child> - <object class="GtkEntry" id="host"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="hexpand">True</property> - <property name="invisible_char">●</property> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">0</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="portLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Port:</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">port</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">0</property> - </packing> - </child> - <child> - <object class="GtkSpinButton" id="port"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="invisible_char">●</property> - <property name="adjustment">adjustment1</property> - <property name="numeric">True</property> - </object> - <packing> - <property name="left_attach">2</property> - <property name="top_attach">0</property> - </packing> - </child> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">0</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="path"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="hexpand">True</property> - <property name="invisible_char">●</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">1</property> - </packing> - </child> - <child> - <object class="GtkCheckButton" id="webdavs"> - <property name="label" translatable="yes">Secured WebDAV (HTTPS)</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="hexpand">True</property> - <property name="xalign">0</property> - <property name="draw_indicator">True</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">2</property> - </packing> - </child> - <child> - <placeholder/> - </child> - </object> - </child> + <property name="xalign">0</property> + <property name="label" translatable="yes">Host:</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">host</property> </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + </packing> </child> - <child type="label"> - <object class="GtkLabel" id="label4"> + <child> + <object class="GtkLabel" id="pathLabel"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label" translatable="yes">Server Details</property> - <attributes> - <attribute name="weight" value="bold"/> - </attributes> + <property name="xalign">0</property> + <property name="label" translatable="yes">Root:</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">path</property> </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">8</property> + </packing> </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkFrame" id="CmisDetails"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label_xalign">0</property> - <property name="shadow_type">none</property> <child> - <object class="GtkAlignment" id="alignment3"> + <object class="GtkEntry" id="path"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hexpand">True</property> + <property name="invisible_char">●</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">8</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="shareLabel"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="top_padding">6</property> - <property name="left_padding">12</property> - <child> - <object class="GtkGrid" id="grid5"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="row_spacing">6</property> - <property name="column_spacing">12</property> - <child> - <object class="GtkLabel" id="bindingLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="xalign">1</property> - <property name="label" translatable="yes">Binding URL:</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">binding</property> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">1</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="repositoryLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="xalign">1</property> - <property name="label" translatable="yes">Repository:</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">repositories</property> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">2</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="binding"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="hexpand">True</property> - <property name="invisible_char">●</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">1</property> - </packing> - </child> - <child> - <object class="GtkGrid" id="grid6"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="column_spacing">6</property> - <child> - <object class="GtkComboBox" id="repositories"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="hexpand">True</property> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">0</property> - </packing> - </child> - <child> - <object class="GtkButton" id="repositoriesRefresh"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="image">image1</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">0</property> - </packing> - </child> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">2</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label3"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="xalign">1</property> - <property name="label" translatable="yes">Server type:</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">serverType</property> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">0</property> - </packing> - </child> - <child> - <object class="GtkComboBox" id="serverType"> - <property name="visible">True</property> - <property name="can_focus">False</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">0</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label5"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="xalign">1</property> - <property name="label" translatable="yes">Path:</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">cmisPath</property> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">3</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="cmisPath"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="invisible_char">●</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">3</property> - </packing> - </child> - </object> - </child> + <property name="xalign">0</property> + <property name="label" translatable="yes">Share:</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">share</property> </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">2</property> + </packing> </child> - <child type="label"> - <object class="GtkLabel" id="label12"> + <child> + <object class="GtkEntry" id="share"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hexpand">True</property> + <property name="invisible_char">●</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">2</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="repositoryLabel"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label" translatable="yes">Server Details</property> - <attributes> - <attribute name="weight" value="bold"/> - </attributes> + <property name="xalign">0</property> + <property name="label" translatable="yes">Repository:</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">repositories</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">6</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="webdavs"> + <property name="label" translatable="yes">Secure connection</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="hexpand">True</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">1</property> + </packing> </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">3</property> - </packing> - </child> - <child> - <object class="GtkFrame" id="SmbDetails"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label_xalign">0</property> - <property name="shadow_type">none</property> <child> - <object class="GtkAlignment" id="alignment2"> + <object class="GtkLabel" id="loginLabel"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="top_padding">6</property> - <property name="left_padding">12</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">User:</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">login</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">3</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="login"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hexpand">True</property> + <property name="invisible_char">●</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">3</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="nameLabel"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">Label:</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">name</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">7</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="name"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hexpand">True</property> + <property name="invisible_char">●</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">7</property> + </packing> + </child> + <child> + <object class="GtkBox" id="HostDetails"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="spacing">6</property> + <child> + <object class="GtkEntry" id="host"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hexpand">True</property> + <property name="invisible_char">●</property> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> <child> - <object class="GtkGrid" id="grid4"> + <object class="GtkLabel" id="portLabel"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="row_spacing">6</property> - <property name="column_spacing">12</property> - <child> - <object class="GtkLabel" id="label9"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="xalign">1</property> - <property name="label" translatable="yes">Host:</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">smbHost</property> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">0</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label10"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="xalign">1</property> - <property name="label" translatable="yes">Share:</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">smbShare</property> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">1</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label11"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="xalign">1</property> - <property name="label" translatable="yes">Path:</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">smbPath</property> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">2</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="smbHost"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="hexpand">True</property> - <property name="invisible_char">●</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">0</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="smbShare"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="hexpand">True</property> - <property name="invisible_char">●</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">1</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="smbPath"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="hexpand">True</property> - <property name="invisible_char">●</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">2</property> - </packing> - </child> + <property name="xalign">0</property> + <property name="label" translatable="yes">Port:</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">port-nospin</property> </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkSpinButton" id="port-nospin"> + <property name="width_request">50</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="max_length">4</property> + <property name="invisible_char">●</property> + <property name="max_width_chars">4</property> + <property name="text" translatable="yes">0</property> + <property name="adjustment">adjustment1</property> + <property name="numeric">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> </child> </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">0</property> + </packing> </child> - <child type="label"> - <object class="GtkLabel" id="label8"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">Server Details</property> - <attributes> - <attribute name="weight" value="bold"/> - </attributes> - </object> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">3</property> - </packing> - </child> - <child> - <object class="GtkFrame" id="UserDetails"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label_xalign">0</property> - <property name="shadow_type">none</property> <child> - <object class="GtkAlignment" id="alignment4"> + <object class="GtkBox" id="RepositoryDetails"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="top_padding">6</property> - <property name="left_padding">12</property> + <property name="spacing">6</property> <child> - <object class="GtkGrid" id="grid7"> + <object class="GtkComboBox" id="repositories"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="column_spacing">12</property> - <child> - <object class="GtkLabel" id="label16"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="xalign">1</property> - <property name="label" translatable="yes">Login:</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">login</property> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">0</property> - </packing> - </child> - <child> - <object class="GtkEntry" id="login"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="hexpand">True</property> - <property name="invisible_char">●</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">0</property> - </packing> - </child> + <property name="hexpand">True</property> </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkButton" id="repositoriesRefresh"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="image">image1</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> </child> </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">6</property> + </packing> </child> - <child type="label"> - <object class="GtkLabel" id="label15"> + <child> + <object class="GtkLabel" id="passwordLabel"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label" translatable="yes">User Details</property> - <attributes> - <attribute name="weight" value="bold"/> - </attributes> + <property name="xalign">0</property> + <property name="label" translatable="yes">Password:</property> + <property name="mnemonic_widget">password</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">4</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="password"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="visibility">False</property> + <property name="invisible_char">●</property> </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">4</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="rememberPassword"> + <property name="label" translatable="yes">Remember password</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">5</property> + </packing> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> </child> </object> <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">5</property> + <property name="position">1</property> </packing> </child> </object> diff --git a/svx/source/dialog/imapdlg.cxx b/svx/source/dialog/imapdlg.cxx index 772f9708fc44..bc4a04671e1a 100644 --- a/svx/source/dialog/imapdlg.cxx +++ b/svx/source/dialog/imapdlg.cxx @@ -220,6 +220,8 @@ SvxIMapDlg::~SvxIMapDlg() void SvxIMapDlg::dispose() { + pIMapWnd->SetUpdateLink( Link<>() ); + // Delete URL-List pIMapWnd.disposeAndClear(); DELETEZ( pOwnData ); diff --git a/sw/source/uibase/app/swmodule.cxx b/sw/source/uibase/app/swmodule.cxx index f945531e79c0..1175968f15f1 100644 --- a/sw/source/uibase/app/swmodule.cxx +++ b/sw/source/uibase/app/swmodule.cxx @@ -307,6 +307,7 @@ void SwDLL::RegisterControls() SvxColorToolBoxControl::RegisterControl( SID_EXTRUSION_3D_COLOR, pMod ); svx::FontWorkShapeTypeControl::RegisterControl( SID_FONTWORK_SHAPE_TYPE, pMod ); + SfxSaveAsToolBoxControl::RegisterControl(SID_SAVEDOC, pMod ); SvxClipBoardControl::RegisterControl(SID_PASTE, pMod ); SvxUndoRedoControl::RegisterControl(SID_UNDO, pMod ); SvxUndoRedoControl::RegisterControl(SID_REDO, pMod ); diff --git a/sw/uiconfig/swriter/menubar/menubar.xml b/sw/uiconfig/swriter/menubar/menubar.xml index a7184c387160..f3f3726bed64 100644 --- a/sw/uiconfig/swriter/menubar/menubar.xml +++ b/sw/uiconfig/swriter/menubar/menubar.xml @@ -21,6 +21,7 @@ <menu:menupopup> <menu:menuitem menu:id=".uno:AddDirect"/> <menu:menuitem menu:id=".uno:OpenFromWriter"/> + <menu:menuitem menu:id=".uno:OpenRemote"/> <menu:menuitem menu:id=".uno:RecentFileList"/> <menu:menuitem menu:id=".uno:CloseDoc"/> <menu:menuseparator/> @@ -34,6 +35,7 @@ </menu:menu> <menu:menuseparator/> <menu:menuitem menu:id=".uno:Save"/> + <menu:menuitem menu:id=".uno:SaveAsRemote"/> <menu:menuitem menu:id=".uno:SaveAs"/> <menu:menuitem menu:id=".uno:SaveACopy"/> <menu:menuitem menu:id=".uno:SaveAll"/> diff --git a/sw/uiconfig/swriter/toolbar/standardbar.xml b/sw/uiconfig/swriter/toolbar/standardbar.xml index 9366b92f513b..b374aae5c49b 100644 --- a/sw/uiconfig/swriter/toolbar/standardbar.xml +++ b/sw/uiconfig/swriter/toolbar/standardbar.xml @@ -22,7 +22,8 @@ <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:Save" toolbar:helpid="5505"/> + <toolbar:toolbaritem xlink:href=".uno:OpenRemote"/> + <toolbar:toolbaritem xlink:href=".uno:Save" toolbar:style="dropdown" toolbar:helpid="5505"/> <toolbar:toolbaritem xlink:href=".uno:SaveAs" toolbar:helpid="5502"/> <toolbar:toolbaritem xlink:href=".uno:SendMail" toolbar:visible="false" toolbar:helpid="5331"/> <toolbar:toolbarseparator/> diff --git a/ucb/source/ucp/cmis/cmis_content.cxx b/ucb/source/ucp/cmis/cmis_content.cxx index 34f5b9f8018b..9c21bff12b21 100644 --- a/ucb/source/ucp/cmis/cmis_content.cxx +++ b/ucb/source/ucp/cmis/cmis_content.cxx @@ -253,6 +253,32 @@ namespace return property; } + + uno::Sequence< uno::Any > generateErrorArguments( const cmis::URL & rURL ) + { + uno::Sequence< uno::Any > aArguments(3); + + size_t i = 0; + aArguments[i++] <<= beans::PropertyValue( + OUString( "Binding URL" ), + - 1, + uno::makeAny( rURL.getBindingUrl() ), + beans::PropertyState_DIRECT_VALUE ); + + aArguments[i++] <<= beans::PropertyValue( + OUString( "Username" ), + -1, + uno::makeAny( rURL.getUsername() ), + beans::PropertyState_DIRECT_VALUE ); + + aArguments[i++] <<= beans::PropertyValue( + OUString( "Repository Id" ), + -1, + uno::makeAny( rURL.getRepositoryId() ), + beans::PropertyState_DIRECT_VALUE ); + + return aArguments; + } } namespace cmis @@ -313,7 +339,7 @@ namespace cmis // Look for a cached session, key is binding url + repo id OUString sSessionId = m_aURL.getBindingUrl( ) + m_aURL.getRepositoryId( ); if ( NULL == m_pSession ) - m_pSession = m_pProvider->getSession( sSessionId ); + m_pSession = m_pProvider->getSession( sSessionId, m_aURL.getUsername( ) ); if ( NULL == m_pSession ) { @@ -365,18 +391,37 @@ namespace cmis m_pSession = libcmis::SessionFactory::createSession( OUSTR_TO_STDSTR( m_aURL.getBindingUrl( ) ), rUsername, rPassword, OUSTR_TO_STDSTR( m_aURL.getRepositoryId( ) ), false, oauth2Data ); - if ( m_pSession == NULL ) + if ( m_pSession == nullptr ) + { + // Fail: session was not created ucbhelper::cancelCommandExecution( - ucb::IOErrorCode_INVALID_DEVICE, - uno::Sequence< uno::Any >( 0 ), - xEnv, - OUString( ) ); + ucb::IOErrorCode_INVALID_DEVICE, + generateErrorArguments(m_aURL), + xEnv, + OUString()); + } + else if ( m_pSession->getRepository() == nullptr ) + { + // Fail: no repository or repository is invalid + ucbhelper::cancelCommandExecution( + ucb::IOErrorCode_INVALID_DEVICE, + generateErrorArguments(m_aURL), + xEnv, + OUString("error accessing a repository")); + } else - m_pProvider->registerSession( sSessionId, m_pSession ); + { + m_pProvider->registerSession(sSessionId, m_aURL.getUsername( ), m_pSession); + } } else { // Silently fail as the user cancelled the authentication + ucbhelper::cancelCommandExecution( + ucb::IOErrorCode_ABORT, + uno::Sequence< uno::Any >( 0 ), + xEnv, + OUString( ) ); throw uno::RuntimeException( ); } } @@ -1974,14 +2019,20 @@ namespace cmis { // TODO Cache the objects + INetURLObject aURL( m_sURL ); + OUString sUser = aURL.GetUser( INetURLObject::NO_DECODE ); + URL aUrl( m_sURL ); OUString sPath( m_sObjectPath ); if ( !sPath.endsWith("/") ) sPath += "/"; sPath += STD_TO_OUSTR( ( *it )->getName( ) ); OUString sId = STD_TO_OUSTR( ( *it )->getId( ) ); + aUrl.setObjectId( sId ); aUrl.setObjectPath( sPath ); + aUrl.setUsername( sUser ); + uno::Reference< ucb::XContentIdentifier > xId = new ucbhelper::ContentIdentifier( aUrl.asString( ) ); uno::Reference< ucb::XContent > xContent = new Content( m_xContext, m_pProvider, xId, *it ); diff --git a/ucb/source/ucp/cmis/cmis_provider.cxx b/ucb/source/ucp/cmis/cmis_provider.cxx index a41b52c9cf94..c9819b51c423 100644 --- a/ucb/source/ucp/cmis/cmis_provider.cxx +++ b/ucb/source/ucp/cmis/cmis_provider.cxx @@ -59,10 +59,11 @@ ContentProvider::queryContent( return xContent; } -libcmis::Session* ContentProvider::getSession( const OUString& sBindingUrl ) +libcmis::Session* ContentProvider::getSession( const OUString& sBindingUrl, const OUString& sUsername ) { libcmis::Session* pSession = NULL; - std::map< OUString, libcmis::Session* >::iterator it = m_aSessionCache.find( sBindingUrl ); + std::map< std::pair< OUString, OUString >, libcmis::Session* >::iterator it + = m_aSessionCache.find( std::pair< OUString, OUString >( sBindingUrl, sUsername ) ); if ( it != m_aSessionCache.end( ) ) { pSession = it->second; @@ -70,9 +71,13 @@ libcmis::Session* ContentProvider::getSession( const OUString& sBindingUrl ) return pSession; } -void ContentProvider::registerSession( const OUString& sBindingUrl, libcmis::Session* pSession ) +void ContentProvider::registerSession( const OUString& sBindingUrl, const OUString& sUsername, libcmis::Session* pSession ) { - m_aSessionCache.insert( std::pair< OUString, libcmis::Session* >( sBindingUrl, pSession ) ); + m_aSessionCache.insert( std::pair< std::pair< OUString, OUString >, libcmis::Session* > + ( + std::pair< OUString, OUString >( sBindingUrl, sUsername ), + pSession + ) ); } ContentProvider::ContentProvider( diff --git a/ucb/source/ucp/cmis/cmis_provider.hxx b/ucb/source/ucp/cmis/cmis_provider.hxx index b0e7fecce969..4a9ba5f9209c 100644 --- a/ucb/source/ucp/cmis/cmis_provider.hxx +++ b/ucb/source/ucp/cmis/cmis_provider.hxx @@ -20,7 +20,7 @@ namespace cmis class ContentProvider : public ::ucbhelper::ContentProviderImplHelper { private: - std::map< OUString, libcmis::Session* > m_aSessionCache; + std::map< std::pair< OUString, OUString >, libcmis::Session* > m_aSessionCache; public: ContentProvider( const ::com::sun::star::uno::Reference< @@ -64,8 +64,8 @@ public: throw( ::com::sun::star::ucb::IllegalIdentifierException, ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE; - libcmis::Session* getSession( const OUString& sBindingUrl ); - void registerSession( const OUString& sBindingUrl, libcmis::Session* pSession ); + libcmis::Session* getSession( const OUString& sBindingUrl, const OUString& sUsername ); + void registerSession( const OUString& sBindingUrl, const OUString& sUsername, libcmis::Session* pSession ); }; } diff --git a/ucb/source/ucp/cmis/cmis_repo_content.cxx b/ucb/source/ucp/cmis/cmis_repo_content.cxx index 86be92cd8865..82ca6b30c619 100644 --- a/ucb/source/ucp/cmis/cmis_repo_content.cxx +++ b/ucb/source/ucp/cmis/cmis_repo_content.cxx @@ -202,6 +202,11 @@ namespace cmis catch (const libcmis::Exception& e) { SAL_INFO( "ucb.ucp.cmis", "Error getting repositories: " << e.what() ); + ucbhelper::cancelCommandExecution( + ucb::IOErrorCode_INVALID_DEVICE, + uno::Sequence< uno::Any >( 0 ), + xEnv, + OUString( ) ); } } else diff --git a/ucb/source/ucp/cmis/cmis_url.cxx b/ucb/source/ucp/cmis/cmis_url.cxx index ff0763c829f3..533ebf2e4b11 100644 --- a/ucb/source/ucp/cmis/cmis_url.cxx +++ b/ucb/source/ucp/cmis/cmis_url.cxx @@ -53,6 +53,11 @@ namespace cmis m_sId = sId; } + void URL::setUsername( const OUString& sUser ) + { + m_sUser = sUser; + } + OUString URL::asString( ) { OUString sUrl; @@ -61,7 +66,9 @@ namespace cmis rtl_UriCharClassRelSegment, rtl_UriEncodeKeepEscapes, RTL_TEXTENCODING_UTF8 ); - sUrl = "vnd.libreoffice.cmis://" + sEncodedBinding; + sUrl = "vnd.libreoffice.cmis://" + + ( m_sUser.isEmpty() ? OUString( ) : (m_sUser + "@") ) + + sEncodedBinding; if ( !m_sPath.isEmpty( ) ) { diff --git a/ucb/source/ucp/cmis/cmis_url.hxx b/ucb/source/ucp/cmis/cmis_url.hxx index 0e687f5ae100..bb4c7926c27e 100644 --- a/ucb/source/ucp/cmis/cmis_url.hxx +++ b/ucb/source/ucp/cmis/cmis_url.hxx @@ -30,14 +30,15 @@ namespace cmis public: URL( OUString const & urlStr ); - OUString& getObjectPath( ) { return m_sPath; } - OUString& getObjectId( ) { return m_sId; } - OUString& getBindingUrl( ) { return m_sBindingUrl; } - OUString& getRepositoryId( ) { return m_sRepositoryId; } - OUString& getUsername( ) { return m_sUser; } - OUString& getPassword( ) { return m_sPass; } + const OUString& getObjectPath() const { return m_sPath; } + const OUString& getObjectId() const { return m_sId; } + const OUString& getBindingUrl() const { return m_sBindingUrl; } + const OUString& getRepositoryId() const { return m_sRepositoryId; } + const OUString& getUsername() const { return m_sUser; } + const OUString& getPassword() const { return m_sPass; } void setObjectPath( const OUString& sPath ); void setObjectId( const OUString& sId ); + void setUsername( const OUString& sUser ); OUString asString( ); }; diff --git a/uui/source/logindlg.hxx b/uui/source/logindlg.hxx index cc32d5e94ae9..96304a0359ed 100644 --- a/uui/source/logindlg.hxx +++ b/uui/source/logindlg.hxx @@ -70,23 +70,19 @@ public: LoginDialog(vcl::Window* pParent, sal_uInt16 nFlags, const OUString& rServer, const OUString &rRealm); virtual ~LoginDialog(); - virtual void dispose() SAL_OVERRIDE; + virtual void dispose() SAL_OVERRIDE; - OUString GetPath() const { return m_pPathED->GetText(); } - void SetPath( const OUString& rNewPath ) { m_pPathED->SetText( rNewPath ); } OUString GetName() const { return m_pNameED->GetText(); } void SetName( const OUString& rNewName ) { m_pNameED->SetText( rNewName ); } OUString GetPassword() const { return m_pPasswordED->GetText(); } void SetPassword( const OUString& rNew ) { m_pPasswordED->SetText( rNew ); } OUString GetAccount() const { return m_pAccountED->GetText(); } - void SetAccount( const OUString& rNew ) { m_pAccountED->SetText( rNew ); } bool IsSavePassword() const { return m_pSavePasswdBtn->IsChecked(); } void SetSavePassword( bool bSave ) { m_pSavePasswdBtn->Check( bSave ); } void SetSavePasswordText( const OUString& rTxt ) { m_pSavePasswdBtn->SetText( rTxt ); } - bool IsUseSystemCredentials() const { return m_pUseSysCredsCB->IsChecked(); } + bool IsUseSystemCredentials() const { return m_pUseSysCredsCB->IsChecked(); } void SetUseSystemCredentials( bool bUse ); void SetErrorText( const OUString& rTxt ) { m_pErrorInfo->SetText( rTxt ); } - void SetLoginRequestText( const OUString& rTxt ) { m_pRequestInfo->SetText( rTxt ); } void ClearPassword(); void ClearAccount(); }; diff --git a/uui/source/loginerr.hxx b/uui/source/loginerr.hxx index 81c3769a2c1c..793b965ac5e7 100644 --- a/uui/source/loginerr.hxx +++ b/uui/source/loginerr.hxx @@ -55,7 +55,6 @@ public: { } - const OUString& GetTitle() const { return m_aTitle; } const OUString& GetServer() const { return m_aServer; } const OUString& GetAccount() const { return m_aAccount; } const OUString& GetUserName() const { return m_aUserName; } @@ -90,12 +89,8 @@ public: { m_aPasswordToModify = aPassword; } void SetRecommendToOpenReadonly( bool bVal ) { m_bRecommendToOpenReadonly = bVal; } - void SetPath( const OUString& aPath ) - { m_aPath = aPath; } void SetErrorText( const OUString& aErrorText ) { m_aErrorText = aErrorText; } - void SetFlags( sal_uInt8 nFlags ) - { m_nFlags = nFlags; } inline void SetCanRememberPassword( bool bSet ); inline void SetIsRememberPassword( bool bSet ); diff --git a/uui/uiconfig/ui/logindialog.ui b/uui/uiconfig/ui/logindialog.ui index 6ce2deac7735..ca47ea5066ed 100644 --- a/uui/uiconfig/ui/logindialog.ui +++ b/uui/uiconfig/ui/logindialog.ui @@ -123,7 +123,7 @@ <object class="GtkLabel" id="accountft"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">1</property> + <property name="xalign">0</property> <property name="label" translatable="yes">A_ccount:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">accounted</property> @@ -137,7 +137,7 @@ <object class="GtkLabel" id="passwordft"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">1</property> + <property name="xalign">0</property> <property name="label" translatable="yes">Pass_word:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">passworded</property> @@ -176,7 +176,7 @@ <object class="GtkLabel" id="nameft"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">1</property> + <property name="xalign">0</property> <property name="label" translatable="yes">_User name:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">nameed</property> @@ -190,7 +190,7 @@ <object class="GtkLabel" id="pathft"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">1</property> + <property name="xalign">0</property> <property name="label" translatable="yes">_Path:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">pathed</property> |