2015-05-19 21:32:05 +02:00
|
|
|
/* -*- 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/RemoteFilesDialog.hxx>
|
2015-06-06 17:15:59 +02:00
|
|
|
#include "../contnr/contentenumeration.hxx"
|
2015-05-19 21:32:05 +02:00
|
|
|
|
2015-06-25 11:55:48 +02:00
|
|
|
class FolderTree : public SvTreeListBox
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
Reference< XCommandEnvironment > m_xEnv;
|
|
|
|
::osl::Mutex m_aMutex;
|
|
|
|
|
|
|
|
public:
|
|
|
|
FolderTree( vcl::Window* pParent, WinBits nBits )
|
|
|
|
: SvTreeListBox( pParent, nBits )
|
|
|
|
{
|
|
|
|
Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext();
|
|
|
|
Reference< XInteractionHandler > xInteractionHandler(
|
|
|
|
InteractionHandler::createWithParent( xContext, 0 ), UNO_QUERY_THROW );
|
|
|
|
m_xEnv = new ::ucbhelper::CommandEnvironment( xInteractionHandler, Reference< XProgressHandler >() );
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void RequestingChildren( SvTreeListEntry* pEntry )
|
|
|
|
{
|
|
|
|
FillTreeEntry( pEntry );
|
|
|
|
}
|
|
|
|
|
|
|
|
void FillTreeEntry( SvTreeListEntry* pEntry )
|
|
|
|
{
|
|
|
|
// fill only empty entries
|
|
|
|
if( pEntry && GetChildCount( pEntry ) == 0 )
|
|
|
|
{
|
|
|
|
::std::vector< SortingData_Impl* > aContent;
|
|
|
|
|
|
|
|
FileViewContentEnumerator* pContentEnumerator = new FileViewContentEnumerator(
|
|
|
|
m_xEnv, aContent, m_aMutex, NULL );
|
|
|
|
|
|
|
|
OUString* pURL = static_cast< OUString* >( pEntry->GetUserData() );
|
|
|
|
|
|
|
|
if( pURL )
|
|
|
|
{
|
|
|
|
FolderDescriptor aFolder( *pURL );
|
|
|
|
Sequence< OUString > aBlackList;
|
|
|
|
|
|
|
|
EnumerationResult eResult =
|
|
|
|
pContentEnumerator->enumerateFolderContentSync( aFolder, aBlackList );
|
|
|
|
|
|
|
|
if ( SUCCESS == eResult )
|
|
|
|
{
|
|
|
|
for( unsigned int i = 0; i < aContent.size(); i++ )
|
|
|
|
{
|
|
|
|
if( aContent[i]->mbIsFolder )
|
|
|
|
{
|
|
|
|
SvTreeListEntry* pNewEntry = InsertEntry( aContent[i]->GetTitle(), pEntry, true );
|
|
|
|
|
|
|
|
OUString* sData = new OUString( aContent[i]->maTargetURL );
|
|
|
|
pNewEntry->SetUserData( static_cast< void* >( sData ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetTreePath( OUString sUrl )
|
|
|
|
{
|
|
|
|
INetURLObject aUrl( sUrl );
|
|
|
|
aUrl.setFinalSlash();
|
|
|
|
|
|
|
|
OUString sPath = aUrl.GetURLPath( INetURLObject::DECODE_WITH_CHARSET );
|
|
|
|
|
|
|
|
SvTreeListEntry* pEntry = First();
|
|
|
|
bool end = false;
|
|
|
|
|
|
|
|
while( pEntry && !end )
|
|
|
|
{
|
|
|
|
if( pEntry->GetUserData() )
|
|
|
|
{
|
|
|
|
OUString sNodeUrl = *static_cast< OUString* >( pEntry->GetUserData() );
|
|
|
|
|
|
|
|
INetURLObject aUrlObj( sNodeUrl );
|
|
|
|
aUrlObj.setFinalSlash();
|
|
|
|
|
|
|
|
sNodeUrl = aUrlObj.GetURLPath( INetURLObject::DECODE_WITH_CHARSET );
|
|
|
|
|
|
|
|
if( sPath == sNodeUrl )
|
|
|
|
{
|
|
|
|
Select( pEntry );
|
|
|
|
|
|
|
|
if( !IsExpanded( pEntry ) )
|
|
|
|
Expand( pEntry );
|
|
|
|
|
|
|
|
end = true;
|
|
|
|
}
|
|
|
|
else if( sPath.startsWith( sNodeUrl ) )
|
|
|
|
{
|
|
|
|
if( !IsExpanded( pEntry ) )
|
|
|
|
Expand( pEntry );
|
|
|
|
|
|
|
|
pEntry = FirstChild( pEntry );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pEntry = NextSibling( pEntry );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2015-06-04 14:59:20 +02:00
|
|
|
class FileViewContainer : public vcl::Window
|
|
|
|
{
|
|
|
|
private:
|
2015-06-25 11:55:48 +02:00
|
|
|
VclPtr< SvtFileView > m_pFileView;
|
|
|
|
VclPtr< FolderTree > m_pTreeView;
|
|
|
|
VclPtr< Splitter > m_pSplitter;
|
2015-06-04 14:59:20 +02:00
|
|
|
|
2015-06-22 09:28:09 +02:00
|
|
|
int m_nCurrentFocus;
|
|
|
|
vcl::Window* m_pFocusWidgets[4];
|
|
|
|
|
2015-06-04 14:59:20 +02:00
|
|
|
public:
|
2015-06-25 11:55:48 +02:00
|
|
|
FileViewContainer( vcl::Window *pParent )
|
|
|
|
: Window( pParent, WB_TABSTOP )
|
|
|
|
, m_pFileView( NULL )
|
|
|
|
, m_pTreeView( NULL )
|
|
|
|
, m_pSplitter( NULL )
|
2015-06-04 14:59:20 +02:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual ~FileViewContainer()
|
|
|
|
{
|
|
|
|
disposeOnce();
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void dispose() SAL_OVERRIDE
|
|
|
|
{
|
|
|
|
m_pFileView.clear();
|
2015-06-04 18:58:11 +02:00
|
|
|
m_pSplitter.clear();
|
2015-06-04 14:59:20 +02:00
|
|
|
vcl::Window::dispose();
|
|
|
|
}
|
|
|
|
|
2015-06-25 11:55:48 +02:00
|
|
|
void init( SvtFileView* pFileView,
|
2015-06-04 18:58:11 +02:00
|
|
|
Splitter* pSplitter,
|
2015-06-25 11:55:48 +02:00
|
|
|
FolderTree* pTreeView,
|
2015-06-22 09:28:09 +02:00
|
|
|
vcl::Window* pPrevSibling,
|
2015-06-25 11:55:48 +02:00
|
|
|
vcl::Window* pNextSibling )
|
2015-06-04 14:59:20 +02:00
|
|
|
{
|
|
|
|
m_pFileView = pFileView;
|
2015-06-04 18:58:11 +02:00
|
|
|
m_pTreeView = pTreeView;
|
|
|
|
m_pSplitter = pSplitter;
|
2015-06-22 09:28:09 +02:00
|
|
|
m_pFocusWidgets[0] = pPrevSibling;
|
|
|
|
m_pFocusWidgets[1] = pTreeView;
|
|
|
|
m_pFocusWidgets[2] = pFileView;
|
|
|
|
m_pFocusWidgets[3] = pNextSibling;
|
2015-06-04 14:59:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
virtual void Resize() SAL_OVERRIDE
|
|
|
|
{
|
|
|
|
Window::Resize();
|
|
|
|
|
2015-06-25 11:55:48 +02:00
|
|
|
if( !m_pFileView || !m_pTreeView )
|
2015-06-04 14:59:20 +02:00
|
|
|
return;
|
|
|
|
|
|
|
|
Size aSize = GetSizePixel();
|
2015-06-04 18:58:11 +02:00
|
|
|
Point aPos( m_pFileView->GetPosPixel() );
|
2015-06-25 11:55:48 +02:00
|
|
|
Size aNewSize( aSize.Width() - aPos.X(), aSize.Height() );
|
2015-06-04 18:58:11 +02:00
|
|
|
|
|
|
|
m_pFileView->SetSizePixel( aNewSize );
|
|
|
|
|
|
|
|
// Resize the Splitter to fit the height
|
2015-06-25 11:55:48 +02:00
|
|
|
Size splitterNewSize = m_pSplitter->GetSizePixel();
|
2015-06-04 18:58:11 +02:00
|
|
|
splitterNewSize.Height() = aSize.Height();
|
|
|
|
m_pSplitter->SetSizePixel( splitterNewSize );
|
2015-06-25 11:55:48 +02:00
|
|
|
sal_Int32 nMinX = m_pTreeView->GetPosPixel().X();
|
|
|
|
sal_Int32 nMaxX = m_pFileView->GetPosPixel().X() + m_pFileView->GetSizePixel().Width() - nMinX;
|
2015-06-04 18:58:11 +02:00
|
|
|
m_pSplitter->SetDragRectPixel( Rectangle( Point( nMinX, 0 ), Size( nMaxX, aSize.Width() ) ) );
|
|
|
|
|
|
|
|
// Resize the tree list box to fit the height of the FileView
|
2015-06-25 11:55:48 +02:00
|
|
|
Size placesNewSize( m_pTreeView->GetSizePixel() );
|
2015-06-04 18:58:11 +02:00
|
|
|
placesNewSize.Height() = aSize.Height();
|
|
|
|
m_pTreeView->SetSizePixel( placesNewSize );
|
2015-06-04 14:59:20 +02:00
|
|
|
}
|
2015-06-22 09:28:09 +02:00
|
|
|
|
2015-06-25 11:55:48 +02:00
|
|
|
void changeFocus( bool bReverse )
|
2015-06-22 09:28:09 +02:00
|
|
|
{
|
2015-06-25 11:55:48 +02:00
|
|
|
if( !bReverse && m_nCurrentFocus < 4 )
|
2015-06-22 09:28:09 +02:00
|
|
|
{
|
2015-06-25 11:55:48 +02:00
|
|
|
m_pFocusWidgets[++m_nCurrentFocus]->SetFakeFocus( true );
|
2015-06-22 09:28:09 +02:00
|
|
|
m_pFocusWidgets[m_nCurrentFocus]->GrabFocus();
|
|
|
|
}
|
2015-06-25 11:55:48 +02:00
|
|
|
else if( m_nCurrentFocus > 0 )
|
2015-06-22 09:28:09 +02:00
|
|
|
{
|
2015-06-25 11:55:48 +02:00
|
|
|
m_pFocusWidgets[--m_nCurrentFocus]->SetFakeFocus( true );
|
2015-06-22 09:28:09 +02:00
|
|
|
m_pFocusWidgets[m_nCurrentFocus]->GrabFocus();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void GetFocus() SAL_OVERRIDE
|
|
|
|
{
|
|
|
|
m_nCurrentFocus = 1;
|
2015-06-25 11:55:48 +02:00
|
|
|
m_pFocusWidgets[m_nCurrentFocus]->SetFakeFocus( true );
|
2015-06-22 09:28:09 +02:00
|
|
|
m_pFocusWidgets[m_nCurrentFocus]->GrabFocus();
|
|
|
|
}
|
|
|
|
|
2015-06-25 11:55:48 +02:00
|
|
|
virtual bool Notify( NotifyEvent& rNEvt )
|
2015-06-22 09:28:09 +02:00
|
|
|
{
|
2015-06-25 11:55:48 +02:00
|
|
|
if( rNEvt.GetType() == MouseNotifyEvent::KEYINPUT )
|
2015-06-22 09:28:09 +02:00
|
|
|
{
|
|
|
|
const KeyEvent* pKeyEvent = rNEvt.GetKeyEvent();
|
|
|
|
const vcl::KeyCode& rCode = pKeyEvent->GetKeyCode();
|
|
|
|
bool bShift = rCode.IsShift();
|
2015-06-25 11:55:48 +02:00
|
|
|
if( rCode.GetCode() == KEY_TAB )
|
2015-06-22 09:28:09 +02:00
|
|
|
{
|
2015-06-25 11:55:48 +02:00
|
|
|
changeFocus( bShift );
|
2015-06-22 09:28:09 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
2015-06-25 11:55:48 +02:00
|
|
|
return Window::Notify( rNEvt );
|
2015-06-22 09:28:09 +02:00
|
|
|
}
|
2015-06-04 14:59:20 +02:00
|
|
|
};
|
|
|
|
|
2015-06-25 12:10:54 +02:00
|
|
|
RemoteFilesDialog::RemoteFilesDialog( vcl::Window* pParent, WinBits nBits )
|
2015-06-30 15:31:30 +02:00
|
|
|
: SvtFileDialog_Base( pParent, "RemoteFilesDialog", "svt/ui/remotefilesdialog.ui" )
|
2015-06-25 12:10:54 +02:00
|
|
|
, m_context( comphelper::getProcessComponentContext() )
|
|
|
|
, m_aFolderImage( SvtResId( IMG_SVT_FOLDER ) )
|
|
|
|
, m_pSplitter( NULL )
|
|
|
|
, m_pFileView( NULL )
|
|
|
|
, m_pContainer( NULL )
|
2015-05-19 21:32:05 +02:00
|
|
|
{
|
2015-06-25 12:10:54 +02:00
|
|
|
get( m_pOpen_btn, "open" );
|
|
|
|
get( m_pSave_btn, "save" );
|
|
|
|
get( m_pCancel_btn, "cancel" );
|
|
|
|
get( m_pAddService_btn, "add_service_btn" );
|
|
|
|
get( m_pServices_lb, "services_lb" );
|
|
|
|
get( m_pFilter_lb, "filter_lb" );
|
|
|
|
get( m_pName_ed, "name_ed" );
|
|
|
|
|
|
|
|
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 & WB_MULTISELECTION ) ? true : false;
|
2015-05-26 17:42:04 +02:00
|
|
|
m_bIsUpdated = false;
|
2015-05-19 21:32:05 +02:00
|
|
|
|
2015-06-05 17:40:40 +02:00
|
|
|
m_pOpen_btn->Enable( false );
|
|
|
|
m_pSave_btn->Enable( false );
|
|
|
|
m_pFilter_lb->Enable( false );
|
|
|
|
m_pName_ed->Enable( false );
|
|
|
|
|
2015-06-25 12:10:54 +02:00
|
|
|
if( m_eMode == REMOTEDLG_MODE_OPEN )
|
2015-05-19 21:32:05 +02:00
|
|
|
{
|
|
|
|
m_pSave_btn->Hide();
|
|
|
|
m_pOpen_btn->Show();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_pSave_btn->Show();
|
|
|
|
m_pOpen_btn->Hide();
|
|
|
|
}
|
|
|
|
|
2015-06-24 18:15:26 +02:00
|
|
|
m_pOpen_btn->SetClickHdl( LINK( this, RemoteFilesDialog, OkHdl ) );
|
|
|
|
|
2015-06-25 12:10:54 +02:00
|
|
|
m_pPath = VclPtr<Breadcrumb>::Create( get< vcl::Window >( "breadcrumb_container" ) );
|
|
|
|
m_pPath->set_hexpand( true );
|
2015-06-09 18:46:53 +02:00
|
|
|
m_pPath->SetClickHdl( LINK( this, RemoteFilesDialog, SelectBreadcrumbHdl ) );
|
2015-06-10 17:24:12 +02:00
|
|
|
m_pPath->SetMode( SvtBreadcrumbMode::ALL_VISITED );
|
2015-06-09 18:46:53 +02:00
|
|
|
m_pPath->Show();
|
|
|
|
|
2015-06-25 12:10:54 +02:00
|
|
|
m_pContainer = VclPtr< FileViewContainer >::Create( get< vcl::Window >("container") );
|
2015-06-04 14:59:20 +02:00
|
|
|
|
2015-06-25 12:10:54 +02:00
|
|
|
m_pContainer->set_hexpand( true );
|
|
|
|
m_pContainer->set_vexpand( true );
|
2015-06-04 14:59:20 +02:00
|
|
|
|
2015-06-25 12:10:54 +02:00
|
|
|
m_pFileView = VclPtr< SvtFileView >::Create( m_pContainer, WB_BORDER | WB_TABSTOP,
|
2015-06-04 14:59:20 +02:00
|
|
|
REMOTEDLG_TYPE_PATHDLG == m_eType,
|
|
|
|
m_bMultiselection );
|
|
|
|
|
|
|
|
m_pFileView->Show();
|
|
|
|
m_pFileView->EnableAutoResize();
|
|
|
|
m_pFileView->SetDoubleClickHdl( LINK( this, RemoteFilesDialog, DoubleClickHdl ) );
|
2015-06-04 16:39:44 +02:00
|
|
|
m_pFileView->SetSelectHdl( LINK( this, RemoteFilesDialog, SelectHdl ) );
|
2015-06-04 14:59:20 +02:00
|
|
|
|
2015-06-25 12:10:54 +02:00
|
|
|
m_pSplitter = VclPtr< Splitter >::Create( m_pContainer, WB_HSCROLL );
|
|
|
|
m_pSplitter->SetBackground( Wallpaper( Application::GetSettings().GetStyleSettings().GetFaceColor() ) );
|
2015-06-04 18:58:11 +02:00
|
|
|
m_pSplitter->SetSplitHdl( LINK( this, RemoteFilesDialog, SplitHdl ) );
|
|
|
|
m_pSplitter->Show();
|
|
|
|
|
2015-06-25 12:10:54 +02:00
|
|
|
m_pTreeView = VclPtr< FolderTree >::Create( m_pContainer, WB_BORDER | WB_SORT | WB_TABSTOP );
|
|
|
|
Size aSize( 100, 200 );
|
|
|
|
m_pTreeView->set_height_request( aSize.Height() );
|
|
|
|
m_pTreeView->set_width_request( aSize.Width() );
|
|
|
|
m_pTreeView->SetSizePixel( aSize );
|
2015-06-04 18:58:11 +02:00
|
|
|
m_pTreeView->Show();
|
2015-06-25 12:10:54 +02:00
|
|
|
m_pTreeView->SetDefaultCollapsedEntryBmp( m_aFolderImage );
|
|
|
|
m_pTreeView->SetDefaultExpandedEntryBmp( m_aFolderImage );
|
2015-06-06 17:15:59 +02:00
|
|
|
|
|
|
|
m_pTreeView->SetSelectHdl( LINK( this, RemoteFilesDialog, TreeSelectHdl ) );
|
2015-06-04 18:58:11 +02:00
|
|
|
|
|
|
|
sal_Int32 nPosX = m_pTreeView->GetSizePixel().Width();
|
2015-06-25 12:10:54 +02:00
|
|
|
m_pSplitter->SetPosPixel( Point( nPosX, 0 ) );
|
2015-06-04 18:58:11 +02:00
|
|
|
nPosX += m_pSplitter->GetSizePixel().Width();
|
2015-06-25 12:10:54 +02:00
|
|
|
m_pFileView->SetPosPixel( Point( nPosX, 0 ) );
|
2015-06-04 18:58:11 +02:00
|
|
|
|
2015-06-22 09:28:09 +02:00
|
|
|
m_pContainer->init( m_pFileView, m_pSplitter, m_pTreeView, m_pAddService_btn, m_pFilter_lb );
|
2015-06-04 14:59:20 +02:00
|
|
|
m_pContainer->Show();
|
2015-06-05 17:40:40 +02:00
|
|
|
m_pContainer->Enable( false );
|
2015-06-04 14:59:20 +02:00
|
|
|
|
2015-06-22 09:28:09 +02:00
|
|
|
m_pAddService_btn->SetMenuMode( MENUBUTTON_MENUMODE_TIMED );
|
2015-05-25 21:59:01 +02:00
|
|
|
m_pAddService_btn->SetClickHdl( LINK( this, RemoteFilesDialog, AddServiceHdl ) );
|
|
|
|
m_pAddService_btn->SetSelectHdl( LINK( this, RemoteFilesDialog, EditServiceMenuHdl ) );
|
2015-05-19 21:32:05 +02:00
|
|
|
|
2015-05-26 17:42:04 +02:00
|
|
|
FillServicesListbox();
|
2015-06-03 10:03:07 +02:00
|
|
|
|
|
|
|
m_pServices_lb->SetSelectHdl( LINK( this, RemoteFilesDialog, SelectServiceHdl ) );
|
2015-06-04 16:39:44 +02:00
|
|
|
|
2015-06-05 17:40:40 +02:00
|
|
|
m_pFilter_lb->SetSelectHdl( LINK( this, RemoteFilesDialog, SelectFilterHdl ) );
|
2015-05-19 21:32:05 +02:00
|
|
|
}
|
|
|
|
|
2015-06-04 14:59:20 +02:00
|
|
|
RemoteFilesDialog::~RemoteFilesDialog()
|
|
|
|
{
|
|
|
|
disposeOnce();
|
|
|
|
}
|
|
|
|
|
2015-05-26 17:42:04 +02:00
|
|
|
void RemoteFilesDialog::dispose()
|
|
|
|
{
|
2015-06-04 18:58:11 +02:00
|
|
|
m_pFileView->SetSelectHdl( Link<>() );
|
|
|
|
|
2015-06-25 12:10:54 +02:00
|
|
|
if( m_bIsUpdated )
|
2015-05-26 17:42:04 +02:00
|
|
|
{
|
2015-06-25 12:10:54 +02:00
|
|
|
Sequence< OUString > placesUrlsList( m_aServices.size() );
|
|
|
|
Sequence< OUString > placesNamesList( m_aServices.size() );
|
2015-05-26 17:42:04 +02:00
|
|
|
|
|
|
|
int i = 0;
|
2015-06-25 12:10:54 +02:00
|
|
|
for( std::vector< ServicePtr >::const_iterator it = m_aServices.begin(); it != m_aServices.end(); ++it )
|
2015-05-26 17:42:04 +02:00
|
|
|
{
|
2015-06-25 12:10:54 +02:00
|
|
|
placesUrlsList[i] = ( *it )->GetUrl();
|
|
|
|
placesNamesList[i] = ( *it )->GetName();
|
2015-05-26 17:42:04 +02:00
|
|
|
++i;
|
|
|
|
}
|
|
|
|
|
2015-06-25 12:10:54 +02:00
|
|
|
std::shared_ptr< comphelper::ConfigurationChanges > batch( comphelper::ConfigurationChanges::create( m_context ) );
|
|
|
|
officecfg::Office::Common::Misc::FilePickerPlacesUrls::set( placesUrlsList, batch );
|
|
|
|
officecfg::Office::Common::Misc::FilePickerPlacesNames::set( placesNamesList, batch );
|
2015-05-26 17:42:04 +02:00
|
|
|
batch->commit();
|
|
|
|
}
|
|
|
|
|
2015-06-04 18:58:11 +02:00
|
|
|
m_pTreeView.disposeAndClear();
|
|
|
|
m_pFileView.disposeAndClear();
|
|
|
|
m_pSplitter.disposeAndClear();
|
|
|
|
m_pContainer.disposeAndClear();
|
2015-06-09 18:46:53 +02:00
|
|
|
m_pPath.disposeAndClear();
|
2015-06-04 18:58:11 +02:00
|
|
|
|
|
|
|
m_pOpen_btn.clear();
|
|
|
|
m_pSave_btn.clear();
|
|
|
|
m_pCancel_btn.clear();
|
|
|
|
m_pAddService_btn.clear();
|
|
|
|
m_pServices_lb.clear();
|
|
|
|
m_pFilter_lb.clear();
|
|
|
|
m_pName_ed.clear();
|
|
|
|
|
2015-05-26 17:42:04 +02:00
|
|
|
ModalDialog::dispose();
|
|
|
|
}
|
|
|
|
|
2015-06-04 14:59:20 +02:00
|
|
|
void RemoteFilesDialog::Resize()
|
|
|
|
{
|
|
|
|
ModalDialog::Resize();
|
|
|
|
|
2015-06-25 12:10:54 +02:00
|
|
|
if( m_pFileView && m_pContainer )
|
2015-06-04 14:59:20 +02:00
|
|
|
{
|
|
|
|
Size aSize = m_pContainer->GetSizePixel();
|
2015-06-25 12:10:54 +02:00
|
|
|
m_pFileView->SetSizePixel( aSize );
|
2015-06-04 14:59:20 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-06-25 12:10:54 +02:00
|
|
|
OUString lcl_GetServiceType( ServicePtr pService )
|
2015-06-22 10:31:06 +02:00
|
|
|
{
|
|
|
|
INetProtocol aProtocol = pService->GetUrlObject().GetProtocol();
|
2015-06-25 12:10:54 +02:00
|
|
|
switch( aProtocol )
|
2015-06-22 10:31:06 +02:00
|
|
|
{
|
|
|
|
case INetProtocol::Ftp:
|
2015-06-25 12:10:54 +02:00
|
|
|
return OUString( "FTP" );
|
2015-06-22 10:31:06 +02:00
|
|
|
case INetProtocol::Cmis:
|
2015-06-22 10:55:21 +02:00
|
|
|
{
|
|
|
|
OUString sHost = pService->GetUrlObject().GetHost( INetURLObject::DECODE_WITH_CHARSET );
|
|
|
|
|
2015-06-25 12:10:54 +02:00
|
|
|
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" );
|
2015-06-22 10:55:21 +02:00
|
|
|
|
2015-06-25 12:10:54 +02:00
|
|
|
return OUString( "CMIS" );
|
2015-06-22 10:55:21 +02:00
|
|
|
}
|
2015-06-22 10:31:06 +02:00
|
|
|
case INetProtocol::Smb:
|
2015-06-25 12:10:54 +02:00
|
|
|
return OUString( "Windows Share" );
|
2015-06-22 10:31:06 +02:00
|
|
|
case INetProtocol::File:
|
2015-06-25 12:10:54 +02:00
|
|
|
return OUString( "SSH" );
|
2015-06-22 10:31:06 +02:00
|
|
|
case INetProtocol::Http:
|
2015-06-25 12:10:54 +02:00
|
|
|
return OUString( "WebDAV" );
|
2015-06-22 10:31:06 +02:00
|
|
|
case INetProtocol::Https:
|
2015-06-25 12:10:54 +02:00
|
|
|
return OUString( "WebDAV" );
|
2015-06-22 10:31:06 +02:00
|
|
|
case INetProtocol::Generic:
|
2015-06-25 12:10:54 +02:00
|
|
|
return OUString( "SSH" );
|
2015-06-22 10:31:06 +02:00
|
|
|
default:
|
2015-06-25 12:10:54 +02:00
|
|
|
return OUString( "" );
|
2015-06-22 10:31:06 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-05-26 17:42:04 +02:00
|
|
|
void RemoteFilesDialog::FillServicesListbox()
|
2015-05-19 21:32:05 +02:00
|
|
|
{
|
|
|
|
m_pServices_lb->Clear();
|
2015-05-25 21:59:01 +02:00
|
|
|
m_aServices.clear();
|
2015-05-19 21:32:05 +02:00
|
|
|
|
|
|
|
// Load from user settings
|
2015-06-25 12:10:54 +02:00
|
|
|
Sequence< OUString > placesUrlsList( officecfg::Office::Common::Misc::FilePickerPlacesUrls::get( m_context ) );
|
|
|
|
Sequence< OUString > placesNamesList( officecfg::Office::Common::Misc::FilePickerPlacesNames::get( m_context ) );
|
2015-05-19 21:32:05 +02:00
|
|
|
|
2015-06-25 12:10:54 +02:00
|
|
|
for( sal_Int32 nPlace = 0; nPlace < placesUrlsList.getLength() && nPlace < placesNamesList.getLength(); ++nPlace )
|
2015-05-19 21:32:05 +02:00
|
|
|
{
|
2015-06-25 12:10:54 +02:00
|
|
|
ServicePtr pService( new Place( placesNamesList[nPlace], placesUrlsList[nPlace], true ) );
|
|
|
|
m_aServices.push_back( pService );
|
2015-05-19 21:32:05 +02:00
|
|
|
|
2015-05-26 17:42:04 +02:00
|
|
|
// Add to the listbox only remote services, not local bookmarks
|
2015-06-25 12:10:54 +02:00
|
|
|
if( !pService->IsLocal() )
|
2015-05-26 17:42:04 +02:00
|
|
|
{
|
2015-06-25 12:10:54 +02:00
|
|
|
OUString sPrefix = lcl_GetServiceType( pService );
|
2015-06-22 10:31:06 +02:00
|
|
|
|
2015-06-25 12:10:54 +02:00
|
|
|
if( !sPrefix.isEmpty() )
|
2015-06-22 10:31:06 +02:00
|
|
|
sPrefix += ": ";
|
|
|
|
|
2015-06-25 12:10:54 +02:00
|
|
|
m_pServices_lb->InsertEntry( sPrefix + placesNamesList[nPlace] );
|
2015-05-19 21:32:05 +02:00
|
|
|
}
|
2015-05-26 17:42:04 +02:00
|
|
|
}
|
2015-05-19 21:32:05 +02:00
|
|
|
|
2015-06-25 12:10:54 +02:00
|
|
|
if( m_pServices_lb->GetEntryCount() > 0 )
|
|
|
|
m_pServices_lb->SelectEntryPos( 0 );
|
2015-05-19 21:32:05 +02:00
|
|
|
else
|
2015-06-25 12:10:54 +02:00
|
|
|
m_pServices_lb->Enable( false );
|
2015-05-26 17:42:04 +02:00
|
|
|
}
|
|
|
|
|
2015-06-03 10:03:07 +02:00
|
|
|
int RemoteFilesDialog::GetSelectedServicePos()
|
2015-05-26 17:42:04 +02:00
|
|
|
{
|
|
|
|
int nSelected = m_pServices_lb->GetSelectEntryPos();
|
2015-06-03 10:03:07 +02:00
|
|
|
int nPos = 0;
|
2015-05-26 17:42:04 +02:00
|
|
|
int i = -1;
|
|
|
|
|
2015-06-25 12:10:54 +02:00
|
|
|
if( m_aServices.size() == 0 )
|
2015-06-03 10:03:07 +02:00
|
|
|
return -1;
|
|
|
|
|
2015-06-25 12:10:54 +02:00
|
|
|
while( nPos < ( int )m_aServices.size() )
|
2015-05-26 17:42:04 +02:00
|
|
|
{
|
2015-06-25 12:10:54 +02:00
|
|
|
while( m_aServices[nPos]->IsLocal() )
|
2015-05-26 17:42:04 +02:00
|
|
|
nPos++;
|
|
|
|
i++;
|
2015-06-25 12:10:54 +02:00
|
|
|
if( i == nSelected )
|
2015-05-26 17:42:04 +02:00
|
|
|
break;
|
|
|
|
nPos++;
|
2015-05-19 21:32:05 +02:00
|
|
|
}
|
2015-05-26 17:42:04 +02:00
|
|
|
|
|
|
|
return nPos;
|
2015-05-19 21:32:05 +02:00
|
|
|
}
|
|
|
|
|
2015-06-30 15:31:30 +02:00
|
|
|
void RemoteFilesDialog::AddFilter( const OUString& rFilter, const OUString& rType )
|
2015-06-05 17:40:40 +02:00
|
|
|
{
|
2015-06-30 15:31:30 +02:00
|
|
|
m_aFilters.push_back( rType );
|
|
|
|
m_pFilter_lb->InsertEntry( rFilter );
|
2015-06-05 17:40:40 +02:00
|
|
|
|
2015-06-25 12:10:54 +02:00
|
|
|
if( m_pFilter_lb->GetSelectEntryPos() == LISTBOX_ENTRY_NOTFOUND )
|
2015-06-05 17:40:40 +02:00
|
|
|
m_pFilter_lb->SelectEntryPos( 0 );
|
|
|
|
}
|
|
|
|
|
2015-06-24 16:23:54 +02:00
|
|
|
OUString RemoteFilesDialog::GetPath() const
|
|
|
|
{
|
|
|
|
return m_sPath;
|
|
|
|
}
|
|
|
|
|
2015-06-25 12:10:54 +02:00
|
|
|
OUString RemoteFilesDialog::GetCurrentFilter()
|
2015-06-04 16:39:44 +02:00
|
|
|
{
|
|
|
|
OUString sFilter;
|
|
|
|
|
2015-06-05 17:40:40 +02:00
|
|
|
int nPos = m_pFilter_lb->GetSelectEntryPos();
|
|
|
|
|
2015-06-25 12:10:54 +02:00
|
|
|
if( nPos != LISTBOX_ENTRY_NOTFOUND )
|
2015-06-05 17:40:40 +02:00
|
|
|
sFilter = m_aFilters[nPos];
|
|
|
|
else
|
|
|
|
sFilter = FILTER_ALL;
|
2015-06-04 16:39:44 +02:00
|
|
|
|
|
|
|
return sFilter;
|
|
|
|
}
|
|
|
|
|
2015-06-06 17:15:59 +02:00
|
|
|
FileViewResult RemoteFilesDialog::OpenURL( OUString sURL )
|
2015-06-04 14:59:20 +02:00
|
|
|
{
|
2015-06-06 17:15:59 +02:00
|
|
|
FileViewResult eResult = eFailure;
|
|
|
|
|
2015-06-25 12:10:54 +02:00
|
|
|
if( m_pFileView )
|
2015-06-04 14:59:20 +02:00
|
|
|
{
|
|
|
|
OUStringList BlackList;
|
2015-06-25 12:10:54 +02:00
|
|
|
OUString sFilter = GetCurrentFilter();
|
2015-06-04 14:59:20 +02:00
|
|
|
|
|
|
|
m_pFileView->EndInplaceEditing( false );
|
2015-06-04 16:39:44 +02:00
|
|
|
eResult = m_pFileView->Initialize( sURL, sFilter, NULL, BlackList );
|
2015-06-05 17:40:40 +02:00
|
|
|
|
|
|
|
if( eResult == eSuccess )
|
|
|
|
{
|
2015-06-09 18:46:53 +02:00
|
|
|
m_pPath->SetURL( sURL );
|
2015-06-25 11:55:48 +02:00
|
|
|
m_pTreeView->SetTreePath( sURL );
|
2015-06-05 17:40:40 +02:00
|
|
|
m_pFilter_lb->Enable( true );
|
|
|
|
m_pName_ed->Enable( true );
|
|
|
|
m_pContainer->Enable( true );
|
|
|
|
}
|
2015-06-04 14:59:20 +02:00
|
|
|
}
|
2015-06-06 17:15:59 +02:00
|
|
|
|
|
|
|
return eResult;
|
|
|
|
}
|
|
|
|
|
2015-05-19 21:32:05 +02:00
|
|
|
IMPL_LINK_NOARG ( RemoteFilesDialog, AddServiceHdl )
|
|
|
|
{
|
2015-06-25 12:10:54 +02:00
|
|
|
ScopedVclPtrInstance< PlaceEditDialog > aDlg( this );
|
2015-05-19 21:32:05 +02:00
|
|
|
short aRetCode = aDlg->Execute();
|
|
|
|
|
2015-06-25 12:10:54 +02:00
|
|
|
switch( aRetCode )
|
2015-05-25 21:59:01 +02:00
|
|
|
{
|
2015-05-19 21:32:05 +02:00
|
|
|
case RET_OK :
|
|
|
|
{
|
|
|
|
ServicePtr newService = aDlg->GetPlace();
|
2015-06-25 12:10:54 +02:00
|
|
|
m_aServices.push_back( newService );
|
|
|
|
m_pServices_lb->Enable( true );
|
2015-06-22 10:31:06 +02:00
|
|
|
|
2015-06-25 12:10:54 +02:00
|
|
|
OUString sPrefix = lcl_GetServiceType( newService );
|
2015-06-22 10:31:06 +02:00
|
|
|
|
|
|
|
if(!sPrefix.isEmpty())
|
|
|
|
sPrefix += ": ";
|
|
|
|
|
2015-06-25 12:10:54 +02:00
|
|
|
m_pServices_lb->InsertEntry( sPrefix + newService->GetName() );
|
|
|
|
m_pServices_lb->SelectEntryPos( m_pServices_lb->GetEntryCount() - 1 );
|
2015-05-19 21:32:05 +02:00
|
|
|
|
2015-05-26 17:42:04 +02:00
|
|
|
m_bIsUpdated = true;
|
2015-05-19 21:32:05 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case RET_CANCEL :
|
|
|
|
default :
|
|
|
|
// Do Nothing
|
|
|
|
break;
|
|
|
|
};
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2015-06-03 10:03:07 +02:00
|
|
|
IMPL_LINK_NOARG ( RemoteFilesDialog, SelectServiceHdl )
|
|
|
|
{
|
|
|
|
int nPos = GetSelectedServicePos();
|
|
|
|
|
2015-06-25 11:55:48 +02:00
|
|
|
if( nPos > 0 )
|
2015-06-03 10:03:07 +02:00
|
|
|
{
|
|
|
|
OUString sURL = m_aServices[nPos]->GetUrl();
|
2015-06-10 11:06:04 +02:00
|
|
|
OUString sName = m_aServices[nPos]->GetName();
|
2015-06-03 10:03:07 +02:00
|
|
|
|
2015-06-06 17:15:59 +02:00
|
|
|
if( OpenURL( sURL ) == eSuccess )
|
|
|
|
{
|
2015-06-10 11:06:04 +02:00
|
|
|
m_pPath->SetRootName( sName );
|
2015-06-06 17:15:59 +02:00
|
|
|
m_pTreeView->Clear();
|
|
|
|
|
2015-06-10 11:06:04 +02:00
|
|
|
SvTreeListEntry* pRoot = m_pTreeView->InsertEntry( sName, NULL, true );
|
2015-06-06 17:15:59 +02:00
|
|
|
OUString* sData = new OUString( sURL );
|
|
|
|
pRoot->SetUserData( static_cast< void* >( sData ) );
|
|
|
|
|
|
|
|
m_pTreeView->Expand( pRoot );
|
|
|
|
}
|
2015-06-03 10:03:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2015-05-25 21:59:01 +02:00
|
|
|
IMPL_LINK_TYPED ( RemoteFilesDialog, EditServiceMenuHdl, MenuButton *, pButton, void )
|
|
|
|
{
|
2015-06-25 12:10:54 +02:00
|
|
|
OString sIdent( pButton->GetCurItemIdent() );
|
|
|
|
if( sIdent == "edit_service" && m_pServices_lb->GetEntryCount() > 0 )
|
2015-05-25 21:59:01 +02:00
|
|
|
{
|
|
|
|
unsigned int nSelected = m_pServices_lb->GetSelectEntryPos();
|
2015-06-03 10:03:07 +02:00
|
|
|
int nPos = GetSelectedServicePos();
|
2015-05-25 21:59:01 +02:00
|
|
|
|
2015-06-25 12:10:54 +02:00
|
|
|
if( nPos > 0 )
|
2015-05-25 21:59:01 +02:00
|
|
|
{
|
2015-06-25 12:10:54 +02:00
|
|
|
ScopedVclPtrInstance< PlaceEditDialog > aDlg( this, m_aServices[nPos] );
|
2015-06-03 10:03:07 +02:00
|
|
|
short aRetCode = aDlg->Execute();
|
2015-05-25 21:59:01 +02:00
|
|
|
|
2015-06-25 12:10:54 +02:00
|
|
|
switch( aRetCode )
|
2015-06-03 10:03:07 +02:00
|
|
|
{
|
|
|
|
case RET_OK :
|
|
|
|
{
|
|
|
|
ServicePtr pEditedService = aDlg->GetPlace();
|
|
|
|
|
|
|
|
m_aServices[nPos] = pEditedService;
|
2015-06-25 12:10:54 +02:00
|
|
|
m_pServices_lb->RemoveEntry( nSelected );
|
|
|
|
m_pServices_lb->InsertEntry( pEditedService->GetName(), nSelected );
|
|
|
|
m_pServices_lb->SelectEntryPos( nSelected );
|
2015-06-03 10:03:07 +02:00
|
|
|
|
|
|
|
m_bIsUpdated = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case RET_CANCEL :
|
|
|
|
default :
|
|
|
|
// Do Nothing
|
|
|
|
break;
|
|
|
|
};
|
|
|
|
}
|
2015-05-25 21:59:01 +02:00
|
|
|
}
|
2015-06-25 12:10:54 +02:00
|
|
|
else if( sIdent == "delete_service" && m_pServices_lb->GetEntryCount() > 0 )
|
2015-05-26 18:11:41 +02:00
|
|
|
{
|
|
|
|
unsigned int nSelected = m_pServices_lb->GetSelectEntryPos();
|
2015-06-03 10:03:07 +02:00
|
|
|
int nPos = GetSelectedServicePos();
|
2015-05-26 18:11:41 +02:00
|
|
|
|
2015-06-25 12:10:54 +02:00
|
|
|
if( nPos > 0 )
|
2015-06-03 10:03:07 +02:00
|
|
|
{
|
|
|
|
// TODO: Confirm dialog
|
2015-05-26 18:11:41 +02:00
|
|
|
|
2015-06-25 12:10:54 +02:00
|
|
|
m_aServices.erase( m_aServices.begin() + nPos );
|
|
|
|
m_pServices_lb->RemoveEntry( nSelected );
|
2015-05-26 18:11:41 +02:00
|
|
|
|
2015-06-25 12:10:54 +02:00
|
|
|
if( m_pServices_lb->GetEntryCount() > 0 )
|
2015-06-03 10:03:07 +02:00
|
|
|
{
|
2015-06-25 12:10:54 +02:00
|
|
|
m_pServices_lb->SelectEntryPos( 0 );
|
2015-06-03 10:03:07 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_pServices_lb->SetNoSelection();
|
2015-06-25 12:10:54 +02:00
|
|
|
m_pServices_lb->Enable( false );
|
2015-06-03 10:03:07 +02:00
|
|
|
}
|
2015-05-26 18:11:41 +02:00
|
|
|
|
2015-06-03 10:03:07 +02:00
|
|
|
m_bIsUpdated = true;
|
|
|
|
}
|
2015-05-26 18:11:41 +02:00
|
|
|
}
|
2015-05-25 21:59:01 +02:00
|
|
|
}
|
|
|
|
|
2015-06-04 14:59:20 +02:00
|
|
|
IMPL_LINK_NOARG ( RemoteFilesDialog, DoubleClickHdl )
|
|
|
|
{
|
2015-06-25 12:48:27 +02:00
|
|
|
SvTreeListEntry* pEntry = m_pFileView->FirstSelected();
|
|
|
|
SvtContentEntry* pData = static_cast< SvtContentEntry* >( pEntry->GetUserData() );
|
|
|
|
|
|
|
|
if( pData->mbIsFolder )
|
|
|
|
{
|
|
|
|
OUString sURL = m_pFileView->GetCurrentURL();
|
2015-06-04 14:59:20 +02:00
|
|
|
|
2015-06-25 12:48:27 +02:00
|
|
|
OpenURL( sURL );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
EndDialog( RET_OK );
|
|
|
|
}
|
2015-06-04 14:59:20 +02:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2015-06-04 16:39:44 +02:00
|
|
|
IMPL_LINK_NOARG ( RemoteFilesDialog, SelectHdl )
|
|
|
|
{
|
|
|
|
SvTreeListEntry* pEntry = m_pFileView->FirstSelected();
|
2015-06-24 15:48:58 +02:00
|
|
|
SvtContentEntry* pData = static_cast< SvtContentEntry* >( pEntry->GetUserData() );
|
2015-06-04 16:39:44 +02:00
|
|
|
|
2015-06-24 16:07:08 +02:00
|
|
|
if( ( pData->mbIsFolder && ( m_eType == REMOTEDLG_TYPE_PATHDLG ) )
|
|
|
|
|| ( !pData->mbIsFolder && ( m_eType == REMOTEDLG_TYPE_FILEDLG ) ) )
|
|
|
|
{
|
|
|
|
INetURLObject aURL( pData->maURL );
|
2015-06-24 16:23:54 +02:00
|
|
|
m_sPath = pData->maURL;
|
|
|
|
|
2015-06-24 16:07:08 +02:00
|
|
|
m_pName_ed->SetText( INetURLObject::decode( aURL.GetLastName(), INetURLObject::DECODE_WITH_CHARSET ) );
|
2015-06-24 18:15:26 +02:00
|
|
|
|
|
|
|
m_pOpen_btn->Enable( true );
|
2015-06-24 16:07:08 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-06-24 18:15:26 +02:00
|
|
|
m_pOpen_btn->Enable( false );
|
2015-06-24 16:23:54 +02:00
|
|
|
m_sPath = "";
|
2015-06-24 16:07:08 +02:00
|
|
|
m_pName_ed->SetText( "" );
|
|
|
|
}
|
2015-06-04 16:39:44 +02:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2015-06-04 18:58:11 +02:00
|
|
|
IMPL_LINK_NOARG ( RemoteFilesDialog, SplitHdl )
|
|
|
|
{
|
|
|
|
sal_Int32 nSplitPos = m_pSplitter->GetSplitPosPixel();
|
|
|
|
|
|
|
|
// Resize the tree list box
|
2015-06-25 12:10:54 +02:00
|
|
|
sal_Int32 nPlaceX = m_pTreeView->GetPosPixel().X();
|
|
|
|
Size placeSize = m_pTreeView->GetSizePixel();
|
2015-06-04 18:58:11 +02:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2015-06-05 17:40:40 +02:00
|
|
|
IMPL_LINK_NOARG ( RemoteFilesDialog, SelectFilterHdl )
|
|
|
|
{
|
|
|
|
OUString sCurrentURL = m_pFileView->GetViewURL();
|
|
|
|
|
|
|
|
if( !sCurrentURL.isEmpty() )
|
|
|
|
OpenURL( sCurrentURL );
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2015-06-25 11:55:48 +02:00
|
|
|
IMPL_LINK ( RemoteFilesDialog, TreeSelectHdl, FolderTree *, pBox )
|
2015-06-06 17:15:59 +02:00
|
|
|
{
|
|
|
|
OUString* sURL = static_cast< OUString* >( pBox->GetHdlEntry()->GetUserData() );
|
|
|
|
|
|
|
|
if( sURL )
|
|
|
|
OpenURL( *sURL );
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2015-06-09 18:46:53 +02:00
|
|
|
IMPL_LINK ( RemoteFilesDialog, SelectBreadcrumbHdl, Breadcrumb*, pPtr )
|
|
|
|
{
|
|
|
|
if( pPtr )
|
|
|
|
{
|
|
|
|
OpenURL( pPtr->GetHdlURL() );
|
|
|
|
}
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2015-06-24 18:15:26 +02:00
|
|
|
IMPL_LINK_NOARG ( RemoteFilesDialog, OkHdl )
|
|
|
|
{
|
|
|
|
EndDialog( RET_OK );
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2015-06-30 15:31:30 +02:00
|
|
|
// SvtFileDialog_Base
|
|
|
|
|
|
|
|
SvtFileView* RemoteFilesDialog::GetView()
|
|
|
|
{
|
|
|
|
return m_pFileView;
|
|
|
|
}
|
|
|
|
|
|
|
|
void RemoteFilesDialog::SetHasFilename( bool bHasFilename )
|
|
|
|
{
|
|
|
|
// TODO
|
|
|
|
}
|
|
|
|
|
|
|
|
void RemoteFilesDialog::SetBlackList( const ::com::sun::star::uno::Sequence< OUString >& rBlackList )
|
|
|
|
{
|
|
|
|
// TODO
|
|
|
|
}
|
|
|
|
|
|
|
|
const ::com::sun::star::uno::Sequence< OUString >& RemoteFilesDialog::GetBlackList() const
|
|
|
|
{
|
|
|
|
// TODO
|
|
|
|
::com::sun::star::uno::Sequence< OUString > aSequence( 0 );
|
|
|
|
return aSequence;
|
|
|
|
}
|
|
|
|
|
|
|
|
void RemoteFilesDialog::SetStandardDir( const OUString& rStdDir )
|
|
|
|
{
|
|
|
|
// TODO
|
|
|
|
}
|
|
|
|
|
|
|
|
const OUString& RemoteFilesDialog::GetStandardDir() const
|
|
|
|
{
|
|
|
|
// TODO
|
|
|
|
return OUString( "" );
|
|
|
|
}
|
|
|
|
|
|
|
|
void RemoteFilesDialog::SetPath( const OUString& rNewURL )
|
|
|
|
{
|
|
|
|
m_sPath = rNewURL;
|
|
|
|
}
|
|
|
|
|
|
|
|
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 );
|
|
|
|
}
|
|
|
|
|
|
|
|
void RemoteFilesDialog::SetCurFilter( const OUString& rFilter )
|
|
|
|
{
|
|
|
|
// TODO
|
|
|
|
}
|
|
|
|
|
|
|
|
void RemoteFilesDialog::SetFileCallback( ::svt::IFilePickerListener *pNotifier )
|
|
|
|
{
|
|
|
|
// TODO
|
|
|
|
}
|
|
|
|
|
|
|
|
void RemoteFilesDialog::EnableAutocompletion( bool _bEnable )
|
|
|
|
{
|
|
|
|
// TODO
|
|
|
|
}
|
|
|
|
|
|
|
|
const OUString& RemoteFilesDialog::GetPath()
|
|
|
|
{
|
|
|
|
return m_sPath;
|
|
|
|
}
|
|
|
|
|
|
|
|
std::vector<OUString> RemoteFilesDialog::GetPathList() const
|
|
|
|
{
|
|
|
|
std::vector<OUString> aPaths;
|
|
|
|
aPaths.push_back(m_sPath);
|
|
|
|
return aPaths;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool RemoteFilesDialog::ContentIsFolder( const OUString& rURL )
|
|
|
|
{
|
|
|
|
// TODO
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
sal_Int32 RemoteFilesDialog::getTargetColorDepth()
|
|
|
|
{
|
|
|
|
// TODO
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
sal_Int32 RemoteFilesDialog::getAvailableWidth()
|
|
|
|
{
|
|
|
|
// TODO
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
sal_Int32 RemoteFilesDialog::getAvailableHeight()
|
|
|
|
{
|
|
|
|
// TODO
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void RemoteFilesDialog::setImage( sal_Int16 aImageFormat, const ::com::sun::star::uno::Any& rImage )
|
|
|
|
{
|
|
|
|
// TODO
|
|
|
|
}
|
|
|
|
|
|
|
|
bool RemoteFilesDialog::getShowState()
|
|
|
|
{
|
|
|
|
// TODO
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
OUString RemoteFilesDialog::GetCurFilter() const
|
|
|
|
{
|
|
|
|
// TODO
|
|
|
|
return OUString( "" );
|
|
|
|
}
|
|
|
|
|
|
|
|
Control* RemoteFilesDialog::getControl( sal_Int16 _nControlId, bool _bLabelControl) const
|
|
|
|
{
|
|
|
|
// TODO
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
void RemoteFilesDialog::enableControl( sal_Int16 _nControlId, bool _bEnable )
|
|
|
|
{
|
|
|
|
// TODO
|
|
|
|
}
|
|
|
|
|
|
|
|
OUString RemoteFilesDialog::getCurFilter( ) const
|
|
|
|
{
|
|
|
|
// TODO
|
|
|
|
return OUString("");
|
|
|
|
}
|
|
|
|
|
2015-05-19 21:32:05 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|