From 51802df73230d08fe13bba58936da810100cc4d1 Mon Sep 17 00:00:00 2001 From: Rafael Dominguez Date: Fri, 3 Aug 2012 18:12:51 -0430 Subject: Move PlaceEditDialog class and resources to svtools. - Update fpicker files that include them. - Separate Place class into its own header and move it to svtools. Change-Id: I83a285d4c7fc21d6e76e4d7e47e347dac2bb4344 --- fpicker/source/office/PlaceEditDialog.cxx | 330 ------------------ fpicker/source/office/PlaceEditDialog.hrc | 63 ---- fpicker/source/office/PlaceEditDialog.hxx | 119 ------- fpicker/source/office/PlaceEditDialog.src | 224 ------------- fpicker/source/office/PlacesListBox.cxx | 6 +- fpicker/source/office/PlacesListBox.hxx | 36 +- fpicker/source/office/ServerDetailsControls.cxx | 428 ------------------------ fpicker/source/office/ServerDetailsControls.hxx | 148 -------- fpicker/source/office/iodlg.cxx | 46 +-- 9 files changed, 27 insertions(+), 1373 deletions(-) delete mode 100644 fpicker/source/office/PlaceEditDialog.cxx delete mode 100644 fpicker/source/office/PlaceEditDialog.hrc delete mode 100644 fpicker/source/office/PlaceEditDialog.hxx delete mode 100644 fpicker/source/office/PlaceEditDialog.src delete mode 100644 fpicker/source/office/ServerDetailsControls.cxx delete mode 100644 fpicker/source/office/ServerDetailsControls.hxx (limited to 'fpicker/source/office') diff --git a/fpicker/source/office/PlaceEditDialog.cxx b/fpicker/source/office/PlaceEditDialog.cxx deleted file mode 100644 index 7480553465d1..000000000000 --- a/fpicker/source/office/PlaceEditDialog.cxx +++ /dev/null @@ -1,330 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * Version: MPL 1.1 / GPLv3+ / LGPLv3+ - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License or as specified alternatively below. You may obtain a copy of - * the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * Major Contributor(s): - * [ Copyright (C) 2012 Julien Levesy (initial developer) ] - * - * All Rights Reserved. - * - * For minor contributions see the git repository. - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 3 or later (the "GPLv3+"), or - * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), - * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable - * instead of those above. - */ - -#include "OfficeFilePicker.hrc" -#include "PlaceEditDialog.hrc" -#include "fpsofficeResMgr.hxx" -#include "PlacesListBox.hxx" -#include "PlaceEditDialog.hxx" -#include "ServerDetailsControls.hxx" - -#include -#include - -using namespace boost; - -PlaceEditDialog::PlaceEditDialog( Window* pParent ) : - ModalDialog( pParent, SvtResId( DLG_FPICKER_PLACE_EDIT ) ), - m_aFTServerName( this, SvtResId( FT_ADDPLACE_SERVERNAME ) ), - m_aFTServerType( this, SvtResId( FT_ADDPLACE_SERVERTYPE ) ), - m_aEDServerName ( this, SvtResId( ED_ADDPLACE_SERVERNAME ) ), - m_aLBServerType ( this, SvtResId( LB_ADDPLACE_SERVERTYPE ) ), - m_pCurrentDetails( ), - m_aFTHost( this, SvtResId( FT_ADDPLACE_HOST ) ), - m_aEDHost( this, SvtResId( ED_ADDPLACE_HOST ) ), - m_aFTPort( this, SvtResId( FT_ADDPLACE_PORT ) ), - m_aEDPort( this, SvtResId( ED_ADDPLACE_PORT ) ), - m_aFTPath( this, SvtResId( FT_ADDPLACE_PATH ) ), - m_aEDPath( this, SvtResId( ED_ADDPLACE_PATH ) ), - m_aCBDavs( this, SvtResId( CB_ADDPLACE_DAVS ) ), - m_aEDSmbHost( this, SvtResId( ED_ADDPLACE_SMBHOST ) ), - m_aFTShare( this, SvtResId( FT_ADDPLACE_SHARE ) ), - m_aEDShare( this, SvtResId( ED_ADDPLACE_SHARE ) ), - m_aFTSmbPath( this, SvtResId( FT_ADDPLACE_SMBPATH ) ), - m_aEDSmbPath( this, SvtResId( ED_ADDPLACE_SMBPATH ) ), - m_aFTCmisBinding( this, SvtResId( FT_ADDPLACE_CMIS_BINDING ) ), - m_aEDCmisBinding( this, SvtResId( ED_ADDPLACE_CMIS_BINDING ) ), - m_aFTCmisRepository( this, SvtResId( FT_ADDPLACE_CMIS_REPOSITORY ) ), - m_aLBCmisRepository( this, SvtResId( LB_ADDPLACE_CMIS_REPOSITORY ) ), - m_aBTCmisRepoRefresh( this, SvtResId( BT_ADDPLACE_CMIS_REPOREFRESH ) ), - m_aFTUsername( this, SvtResId( FT_ADDPLACE_USERNAME ) ), - m_aEDUsername( this, SvtResId( ED_ADDPLACE_USERNAME ) ), - m_aBTOk( this, SvtResId( BT_ADDPLACE_OK ) ), - m_aBTCancel ( this, SvtResId ( BT_ADDPLACE_CANCEL ) ), - m_aBTDelete ( this, SvtResId (BT_ADDPLACE_DELETE ) ) -{ - m_aBTOk.SetClickHdl( LINK( this, PlaceEditDialog, OKHdl) ); - m_aBTOk.Enable( sal_False ); - - m_aEDServerName.SetModifyHdl( LINK( this, PlaceEditDialog, EditHdl) ); - - // This constructor is called when user request a place creation, so - // delete button is hidden. - m_aBTDelete.Hide(); - - m_aLBServerType.SetSelectHdl( LINK( this, PlaceEditDialog, SelectTypeHdl ) ); - m_aEDUsername.SetModifyHdl( LINK( this, PlaceEditDialog, EditUsernameHdl ) ); - - InitDetails( ); -} - -PlaceEditDialog::PlaceEditDialog( Window* pParent, const PlacePtr& pPlace ) : - ModalDialog( pParent, SvtResId( DLG_FPICKER_PLACE_EDIT ) ), - m_aFTServerName( this, SvtResId( FT_ADDPLACE_SERVERNAME ) ), - m_aFTServerType( this, SvtResId( FT_ADDPLACE_SERVERTYPE ) ), - m_aEDServerName ( this, SvtResId( ED_ADDPLACE_SERVERNAME ) ), - m_aLBServerType ( this, SvtResId( LB_ADDPLACE_SERVERTYPE ) ), - m_pCurrentDetails( ), - m_aFTHost( this, SvtResId( FT_ADDPLACE_HOST ) ), - m_aEDHost( this, SvtResId( ED_ADDPLACE_HOST ) ), - m_aFTPort( this, SvtResId( FT_ADDPLACE_PORT ) ), - m_aEDPort( this, SvtResId( ED_ADDPLACE_PORT ) ), - m_aFTPath( this, SvtResId( FT_ADDPLACE_PATH ) ), - m_aEDPath( this, SvtResId( ED_ADDPLACE_PATH ) ), - m_aCBDavs( this, SvtResId( CB_ADDPLACE_DAVS ) ), - m_aEDSmbHost( this, SvtResId( ED_ADDPLACE_SMBHOST ) ), - m_aFTShare( this, SvtResId( FT_ADDPLACE_SHARE ) ), - m_aEDShare( this, SvtResId( ED_ADDPLACE_SHARE ) ), - m_aFTSmbPath( this, SvtResId( FT_ADDPLACE_SMBPATH ) ), - m_aEDSmbPath( this, SvtResId( ED_ADDPLACE_SMBPATH ) ), - m_aFTCmisBinding( this, SvtResId( FT_ADDPLACE_CMIS_BINDING ) ), - m_aEDCmisBinding( this, SvtResId( ED_ADDPLACE_CMIS_BINDING ) ), - m_aFTCmisRepository( this, SvtResId( FT_ADDPLACE_CMIS_REPOSITORY ) ), - m_aLBCmisRepository( this, SvtResId( LB_ADDPLACE_CMIS_REPOSITORY ) ), - m_aBTCmisRepoRefresh( this, SvtResId( BT_ADDPLACE_CMIS_REPOREFRESH ) ), - m_aFTUsername( this, SvtResId( FT_ADDPLACE_USERNAME ) ), - m_aEDUsername( this, SvtResId( ED_ADDPLACE_USERNAME ) ), - m_aBTOk( this, SvtResId( BT_ADDPLACE_OK ) ), - m_aBTCancel ( this, SvtResId ( BT_ADDPLACE_CANCEL ) ), - m_aBTDelete ( this, SvtResId (BT_ADDPLACE_DELETE ) ) -{ - m_aBTOk.SetClickHdl( LINK( this, PlaceEditDialog, OKHdl) ); - m_aBTDelete.SetClickHdl ( LINK( this, PlaceEditDialog, DelHdl) ); - - m_aEDServerName.SetModifyHdl( LINK( this, PlaceEditDialog, EditHdl) ); - m_aLBServerType.SetSelectHdl( LINK( this, PlaceEditDialog, SelectTypeHdl ) ); - - InitDetails( ); - - m_aEDServerName.SetText( pPlace->GetName() ); - - // Fill the boxes with the URL parts - bool bSuccess = false; - for ( size_t i = 0 ; i < m_aDetailsContainers.size( ) && !bSuccess; ++i ) - { - INetURLObject& rUrl = pPlace->GetUrlObject( ); - bSuccess = m_aDetailsContainers[i]->setUrl( rUrl ); - if ( bSuccess ) - { - m_aLBServerType.SelectEntryPos( i ); - SelectTypeHdl( &m_aLBServerType ); - - // Fill the Username field - if ( rUrl.HasUserData( ) ) - m_aEDUsername.SetText( rUrl.GetUser( ) ); - } - } -} - -PlaceEditDialog::~PlaceEditDialog() -{ -} - -rtl::OUString PlaceEditDialog::GetServerUrl() -{ - rtl::OUString sUrl; - if ( m_pCurrentDetails.get( ) ) - { - INetURLObject aUrl = m_pCurrentDetails->getUrl(); - rtl::OUString sUsername = rtl::OUString( m_aEDUsername.GetText( ) ).trim( ); - if ( !sUsername.isEmpty( ) ) - aUrl.SetUser( sUsername ); - if ( !aUrl.HasError( ) ) - sUrl = aUrl.GetMainURL( INetURLObject::NO_DECODE ); - } - - return sUrl; -} - -PlacePtr PlaceEditDialog::GetPlace() -{ - PlacePtr newPlace( new Place( m_aEDServerName.GetText(), GetServerUrl(), true ) ); - return newPlace; -} - -void PlaceEditDialog::InitDetails( ) -{ - // Create WebDAV / FTP / SSH details control - shared_ptr< DetailsContainer > pDavDetails( new DavDetailsContainer( ) ); - pDavDetails->addControl( FT_ADDPLACE_HOST, &m_aFTHost ); - pDavDetails->addControl( ED_ADDPLACE_HOST, &m_aEDHost ); - pDavDetails->addControl( FT_ADDPLACE_PORT, &m_aFTPort ); - pDavDetails->addControl( ED_ADDPLACE_PORT, &m_aEDPort ); - pDavDetails->addControl( FT_ADDPLACE_PATH, &m_aFTPath ); - pDavDetails->addControl( ED_ADDPLACE_PATH, &m_aEDPath ); - pDavDetails->addControl( CB_ADDPLACE_DAVS, &m_aCBDavs ); - pDavDetails->setChangeHdl( LINK( this, PlaceEditDialog, EditHdl ) ); - m_aDetailsContainers.push_back( pDavDetails ); - - shared_ptr< DetailsContainer > pFtpDetails( new HostDetailsContainer( 21, "ftp" ) ); - pFtpDetails->addControl( FT_ADDPLACE_HOST, &m_aFTHost ); - pFtpDetails->addControl( ED_ADDPLACE_HOST, &m_aEDHost ); - pFtpDetails->addControl( FT_ADDPLACE_PORT, &m_aFTPort ); - pFtpDetails->addControl( ED_ADDPLACE_PORT, &m_aEDPort ); - pFtpDetails->addControl( FT_ADDPLACE_PATH, &m_aFTPath ); - pFtpDetails->addControl( ED_ADDPLACE_PATH, &m_aEDPath ); - pFtpDetails->setChangeHdl( LINK( this, PlaceEditDialog, EditHdl ) ); - m_aDetailsContainers.push_back( pFtpDetails ); - - shared_ptr< DetailsContainer > pSshDetails( new HostDetailsContainer( 22, "ssh" ) ); - pSshDetails->addControl( FT_ADDPLACE_HOST, &m_aFTHost ); - pSshDetails->addControl( ED_ADDPLACE_HOST, &m_aEDHost ); - pSshDetails->addControl( FT_ADDPLACE_PORT, &m_aFTPort ); - pSshDetails->addControl( ED_ADDPLACE_PORT, &m_aEDPort ); - pSshDetails->addControl( FT_ADDPLACE_PATH, &m_aFTPath ); - pSshDetails->addControl( ED_ADDPLACE_PATH, &m_aEDPath ); - pSshDetails->setChangeHdl( LINK( this, PlaceEditDialog, EditHdl ) ); - m_aDetailsContainers.push_back( pSshDetails ); - - // Create Windows Share control - shared_ptr< DetailsContainer > pSmbDetails( new SmbDetailsContainer( ) ); - pSmbDetails->addControl( FT_ADDPLACE_HOST, &m_aFTHost ); - pSmbDetails->addControl( ED_ADDPLACE_SMBHOST, &m_aEDSmbHost ); - pSmbDetails->addControl( FT_ADDPLACE_SHARE, &m_aFTShare ); - pSmbDetails->addControl( ED_ADDPLACE_SHARE, &m_aEDShare ); - pSmbDetails->addControl( FT_ADDPLACE_SMBPATH, &m_aFTSmbPath ); - pSmbDetails->addControl( ED_ADDPLACE_SMBPATH, &m_aEDSmbPath ); - pSmbDetails->setChangeHdl( LINK( this, PlaceEditDialog, EditHdl ) ); - m_aDetailsContainers.push_back( pSmbDetails ); - - // Create CMIS control - shared_ptr< DetailsContainer > pCmisDetails( new CmisDetailsContainer( ) ); - pCmisDetails->addControl( FT_ADDPLACE_CMIS_BINDING, &m_aFTCmisBinding ); - pCmisDetails->addControl( ED_ADDPLACE_CMIS_BINDING, &m_aEDCmisBinding ); - pCmisDetails->addControl( FT_ADDPLACE_CMIS_REPOSITORY, &m_aFTCmisRepository ); - pCmisDetails->addControl( LB_ADDPLACE_CMIS_REPOSITORY, &m_aLBCmisRepository ); - pCmisDetails->addControl( BT_ADDPLACE_CMIS_REPOREFRESH, &m_aBTCmisRepoRefresh ); - pCmisDetails->setChangeHdl( LINK( this, PlaceEditDialog, EditHdl ) ); - - if ( officecfg::Office::Common::Misc::ExperimentalMode::get() ) - m_aDetailsContainers.push_back( pCmisDetails ); - else - { - // Remove the CMIS entry, left it in src file for l10n - m_aLBServerType.RemoveEntry( m_aLBServerType.GetEntryCount( ) - 1 ); - } - - // Set default to first value - m_aLBServerType.SelectEntryPos( 0 ); - SelectTypeHdl( &m_aLBServerType ); -} - -IMPL_LINK ( PlaceEditDialog, OKHdl, Button *, EMPTYARG ) -{ - EndDialog( RET_OK ); - return 1; -} - -IMPL_LINK ( PlaceEditDialog, DelHdl, Button *, EMPTYARG ) -{ - // ReUsing existing symbols... - EndDialog( RET_NO ); - return 1; -} - -IMPL_LINK ( PlaceEditDialog, EditHdl, void *, EMPTYARG ) -{ - rtl::OUString sUrl = GetServerUrl( ); - rtl::OUString sName = rtl::OUString( m_aEDServerName.GetText() ).trim( ); - m_aBTOk.Enable( !sName.isEmpty( ) && !sUrl.isEmpty( ) ); - return 1; -} - -IMPL_LINK ( PlaceEditDialog, EditUsernameHdl, void *, EMPTYARG ) -{ - for ( std::vector< boost::shared_ptr< DetailsContainer > >::iterator it = m_aDetailsContainers.begin( ); - it != m_aDetailsContainers.end( ); ++it ) - { - ( *it )->setUsername( rtl::OUString( m_aEDUsername.GetText() ) ); - } - return 1; -} - -IMPL_LINK( PlaceEditDialog, SelectTypeHdl, void*, EMPTYARG ) -{ - // Compute the vertical space between two rows - long nRowDelta = m_aLBServerType.GetPosPixel().getY() - m_aEDServerName.GetPosPixel().getY(); - long nRowSpace = nRowDelta - m_aEDServerName.GetSizePixel().getHeight(); - - long nOldHeight = 0; - if ( m_pCurrentDetails.get( ) ) - { - m_pCurrentDetails->show( false ); - Rectangle aOldBounds = m_pCurrentDetails->getBounds( ); - if ( !aOldBounds.IsEmpty() ) - nOldHeight = aOldBounds.getHeight(); - } - - sal_uInt16 nPos = m_aLBServerType.GetSelectEntryPos( ); - m_pCurrentDetails = m_aDetailsContainers[nPos]; - - m_pCurrentDetails->show( true ); - Rectangle aNewBounds = m_pCurrentDetails->getBounds(); - - long nNewHeight = 0; - if ( !aNewBounds.IsEmpty() ) - { - nNewHeight = aNewBounds.getHeight(); - - // Add row space if old height was 0 - if ( nOldHeight == 0 ) - nNewHeight += nRowSpace; - } - - // If the new height is 0, but not the old one, then remove the doubled row space - if ( nNewHeight == 0 && nOldHeight > 0 ) - nNewHeight -= nRowSpace; - - long nHeightDelta = nNewHeight - nOldHeight; - Control* pToMove[] = - { - &m_aFTUsername, - &m_aEDUsername, - &m_aBTOk, - &m_aBTCancel, - &m_aBTDelete - }; - - Control** pCurrent = pToMove; - for ( sal_Int32 i = 0; i < sal_Int32(SAL_N_ELEMENTS( pToMove )); ++i, ++pCurrent ) - { - Point aPos = ( *pCurrent )->GetPosPixel( ); - aPos.setY( aPos.getY( ) + nHeightDelta ); - ( *pCurrent )->SetPosPixel( aPos ); - } - - // Resize the dialog too - Size aDlgSize = GetSizePixel( ); - aDlgSize.setHeight( aDlgSize.getHeight( ) + nHeightDelta ); - SetSizePixel( aDlgSize ); - - - return 0; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/office/PlaceEditDialog.hrc b/fpicker/source/office/PlaceEditDialog.hrc deleted file mode 100644 index 738d19d66b4a..000000000000 --- a/fpicker/source/office/PlaceEditDialog.hrc +++ /dev/null @@ -1,63 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * Version: MPL 1.1 / GPLv3+ / LGPLv3+ - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License or as specified alternatively below. You may obtain a copy of - * the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * Major Contributor(s): - * [ Copyright (C) 2012 SUSE (initial developer) ] - * - * All Rights Reserved. - * - * For minor contributions see the git repository. - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 3 or later (the "GPLv3+"), or - * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), - * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable - * instead of those above. - */ - -#ifndef _FPICKER_PLACEEDITDLG_HRC -#define _FPICKER_PLACEEDITDLG_HRC - -#include - -// DLG_FPICKER_PLACE_EDIT ------------------------------ -#define FT_ADDPLACE_SERVERNAME 10 -#define FT_ADDPLACE_SERVERTYPE 11 -#define ED_ADDPLACE_SERVERNAME 12 -#define LB_ADDPLACE_SERVERTYPE 13 -#define BT_ADDPLACE_OK 14 -#define BT_ADDPLACE_CANCEL 15 -#define BT_ADDPLACE_DELETE 16 -#define FT_ADDPLACE_HOST 17 -#define ED_ADDPLACE_HOST 18 -#define FT_ADDPLACE_PORT 19 -#define ED_ADDPLACE_PORT 20 -#define FT_ADDPLACE_PATH 21 -#define ED_ADDPLACE_PATH 22 -#define CB_ADDPLACE_DAVS 23 -#define FT_ADDPLACE_USERNAME 24 -#define ED_ADDPLACE_USERNAME 25 -#define ED_ADDPLACE_SMBHOST 26 -#define FT_ADDPLACE_SHARE 27 -#define ED_ADDPLACE_SHARE 28 -#define FT_ADDPLACE_SMBPATH 29 -#define ED_ADDPLACE_SMBPATH 30 -#define FT_ADDPLACE_CMIS_BINDING 31 -#define ED_ADDPLACE_CMIS_BINDING 32 -#define FT_ADDPLACE_CMIS_REPOSITORY 33 -#define LB_ADDPLACE_CMIS_REPOSITORY 34 -#define BT_ADDPLACE_CMIS_REPOREFRESH 35 - -#endif -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/office/PlaceEditDialog.hxx b/fpicker/source/office/PlaceEditDialog.hxx deleted file mode 100644 index b74eb617300f..000000000000 --- a/fpicker/source/office/PlaceEditDialog.hxx +++ /dev/null @@ -1,119 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * Version: MPL 1.1 / GPLv3+ / LGPLv3+ - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License or as specified alternatively below. You may obtain a copy of - * the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * Major Contributor(s): - * [ Copyright (C) 2012 Julien Levesy (initial developer) ] - * - * All Rights Reserved. - * - * For minor contributions see the git repository. - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 3 or later (the "GPLv3+"), or - * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), - * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable - * instead of those above. - */ -#ifndef _PLACEEDITDIALOG_HXX -#define _PLACEEDITDIALOG_HXX - -#include "fpsofficeResMgr.hxx" -#include "PlacesListBox.hxx" -#include "ServerDetailsControls.hxx" - -#include -#include -#include -#include -#include - -#include - -#include -#include - -class PlaceEditDialog : public ModalDialog -{ -private : - - FixedText m_aFTServerName; - FixedText m_aFTServerType; - - Edit m_aEDServerName; - ListBox m_aLBServerType; - boost::shared_ptr< DetailsContainer > m_pCurrentDetails; - - FixedText m_aFTHost; - Edit m_aEDHost; - FixedText m_aFTPort; - NumericField m_aEDPort; - FixedText m_aFTPath; - Edit m_aEDPath; - CheckBox m_aCBDavs; - - Edit m_aEDSmbHost; - FixedText m_aFTShare; - Edit m_aEDShare; - FixedText m_aFTSmbPath; - Edit m_aEDSmbPath; - - FixedText m_aFTCmisBinding; - Edit m_aEDCmisBinding; - FixedText m_aFTCmisRepository; - ListBox m_aLBCmisRepository; - ImageButton m_aBTCmisRepoRefresh; - - FixedText m_aFTUsername; - Edit m_aEDUsername; - OKButton m_aBTOk; - CancelButton m_aBTCancel; - - PushButton m_aBTDelete; - - /** 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. - the m_aDetailsContainer[0] will be shown for the type corresponding to entry 0 - in the listbox. - */ - std::vector< boost::shared_ptr< DetailsContainer > > m_aDetailsContainers; - -public : - - PlaceEditDialog( Window* pParent); - PlaceEditDialog( Window* pParent, const PlacePtr& pPlace ); - ~PlaceEditDialog(); - - // Returns a place instance with given informations - PlacePtr GetPlace(); - - rtl::OUString GetServerName() { return m_aEDServerName.GetText(); } - rtl::OUString GetServerUrl(); - - ResId GetResId( sal_uInt16 nId ) { return SvtResId( nId ); }; - -private: - - void InitDetails( ); - - DECL_LINK ( OKHdl, Button * ); - DECL_LINK ( DelHdl, Button * ); - DECL_LINK ( EditHdl, void * ); - DECL_LINK ( SelectTypeHdl, void * ); - DECL_LINK ( EditUsernameHdl, void * ); - -}; - -#endif //_PLACEEDITDIALOG_HXX -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/office/PlaceEditDialog.src b/fpicker/source/office/PlaceEditDialog.src deleted file mode 100644 index 0c312d552456..000000000000 --- a/fpicker/source/office/PlaceEditDialog.src +++ /dev/null @@ -1,224 +0,0 @@ - -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * Version: MPL 1.1 / GPLv3+ / LGPLv3+ - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License or as specified alternatively below. You may obtain a copy of - * the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * Major Contributor(s): - * [ Copyright (C) 2012 SUSE (initial developer) ] - * - * All Rights Reserved. - * - * For minor contributions see the git repository. - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 3 or later (the "GPLv3+"), or - * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), - * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable - * instead of those above. - */ - -#include "PlaceEditDialog.hrc" -#include "OfficeFilePicker.hrc" - -// Place Edit Dialog -------------------------------------------------------------- - -ModalDialog DLG_FPICKER_PLACE_EDIT -{ - OutputSize = TRUE ; - Border = TRUE ; - SVLook = TRUE ; - Moveable = TRUE ; - Closeable = TRUE ; - Sizeable = TRUE; - Size = MAP_APPFONT ( 200 , 76 ) ; - FixedText FT_ADDPLACE_SERVERNAME - { - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 40 , 10 ) ; - Text [ en-US ] = "Name" ; - }; - FixedText FT_ADDPLACE_SERVERTYPE - { - Pos = MAP_APPFONT ( 12 , 30 ) ; - Size = MAP_APPFONT ( 40 , 10 ) ; - Text [ en-US ] = "Type" ; - }; - FixedText FT_ADDPLACE_HOST - { - Pos = MAP_APPFONT ( 12 , 46 ) ; - Size = MAP_APPFONT ( 40 , 10 ) ; - Text [ en-US ] = "Host" ; - }; - Edit ED_ADDPLACE_HOST - { - Pos = MAP_APPFONT ( 55, 44 ) ; - Size = MAP_APPFONT ( 71 , 12 ) ; - Border = TRUE ; - }; - FixedText FT_ADDPLACE_PORT - { - Pos = MAP_APPFONT ( 129 , 46 ) ; - Size = MAP_APPFONT ( 20 , 10 ) ; - Text [ en-US ] = "Port" ; - }; - NumericField ED_ADDPLACE_PORT - { - Pos = MAP_APPFONT ( 152, 44 ) ; - Size = MAP_APPFONT ( 40 , 12 ) ; - Border = TRUE ; - Spin = TRUE ; - Minimum = 0 ; - Maximum = 65535 ; - }; - FixedText FT_ADDPLACE_PATH - { - Pos = MAP_APPFONT ( 12 , 62 ) ; - Size = MAP_APPFONT ( 40 , 10 ) ; - Text [ en-US ] = "Path" ; - }; - Edit ED_ADDPLACE_PATH - { - Pos = MAP_APPFONT ( 55, 60 ) ; - Size = MAP_APPFONT ( 137 , 12 ) ; - Border = TRUE ; - }; - CheckBox CB_ADDPLACE_DAVS - { - Pos = MAP_APPFONT ( 55, 74 ) ; - Size = MAP_APPFONT ( 137 , 10 ) ; - Text[ en-US ] = "Secured WebDAV (HTTPS)" ; - }; - Edit ED_ADDPLACE_SMBHOST - { - Pos = MAP_APPFONT ( 55, 44 ) ; - Size = MAP_APPFONT ( 137 , 12 ) ; - Border = TRUE ; - }; - FixedText FT_ADDPLACE_SHARE - { - Pos = MAP_APPFONT ( 12 , 62 ) ; - Size = MAP_APPFONT ( 40 , 10 ) ; - Text [ en-US ] = "Share" ; - }; - Edit ED_ADDPLACE_SHARE - { - Pos = MAP_APPFONT ( 55, 60 ) ; - Size = MAP_APPFONT ( 137 , 12 ) ; - Border = TRUE ; - }; - FixedText FT_ADDPLACE_SMBPATH - { - Pos = MAP_APPFONT ( 12 , 78 ) ; - Size = MAP_APPFONT ( 40 , 10 ) ; - Text [ en-US ] = "Path" ; - }; - Edit ED_ADDPLACE_SMBPATH - { - Pos = MAP_APPFONT ( 55, 76 ) ; - Size = MAP_APPFONT ( 137 , 12 ) ; - Border = TRUE ; - }; - Edit ED_ADDPLACE_SERVERNAME - { - Pos = MAP_APPFONT ( 55, 12 ) ; - Size = MAP_APPFONT ( 137 , 12 ) ; - Border = TRUE ; - }; - FixedText FT_ADDPLACE_CMIS_BINDING - { - Pos = MAP_APPFONT ( 12 , 46 ) ; - Size = MAP_APPFONT ( 40 , 10 ) ; - Text [ en-US ] = "Binding URL" ; - }; - Edit ED_ADDPLACE_CMIS_BINDING - { - Pos = MAP_APPFONT ( 55, 44 ) ; - Size = MAP_APPFONT ( 137 , 12 ) ; - Border = TRUE ; - }; - FixedText FT_ADDPLACE_CMIS_REPOSITORY - { - Pos = MAP_APPFONT ( 12 , 62 ) ; - Size = MAP_APPFONT ( 40 , 10 ) ; - Text [ en-US ] = "Repository" ; - }; - ListBox LB_ADDPLACE_CMIS_REPOSITORY - { - Pos = MAP_APPFONT ( 55, 60 ) ; - Size = MAP_APPFONT ( 122 , 75 ) ; - Border = TRUE ; - DropDown = TRUE; - }; - ImageButton BT_ADDPLACE_CMIS_REPOREFRESH - { - Pos = MAP_APPFONT ( 180, 60 ) ; - Size = MAP_APPFONT ( 12, 12 ); - TabStop = FALSE ; - QuickHelpText [ en-US ] = "Refresh" ; - ButtonImage = Image - { - ImageBitmap = Bitmap - { - File = "reload.png" ; - }; - MaskColor = Color { Red = 0xFF00; Green = 0x0000; Blue = 0xFF00; } ; - }; - }; - ListBox LB_ADDPLACE_SERVERTYPE - { - Pos = MAP_APPFONT ( 55, 28 ) ; - Size = MAP_APPFONT ( 137 , 75 ) ; - Border = TRUE ; - DropDown = TRUE; - StringList [ en-US ] = - { - < "WebDAV" ; >; - < "FTP" ; >; - < "SSH" ; >; - < "Windows Share" ; >; - < "CMIS (Atom Binding)" ; >; - }; - }; - FixedText FT_ADDPLACE_USERNAME - { - Pos = MAP_APPFONT ( 12 , 46 ) ; - Size = MAP_APPFONT ( 40 , 10 ) ; - Text [ en-US ] = "Login" ; - }; - Edit ED_ADDPLACE_USERNAME - { - Pos = MAP_APPFONT ( 55, 44 ) ; - Size = MAP_APPFONT ( 137 , 12 ) ; - Border = TRUE ; - }; - OKButton BT_ADDPLACE_OK - { - Pos = MAP_APPFONT ( 80 , 60 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - DefButton = TRUE ; - }; - CancelButton BT_ADDPLACE_CANCEL - { - Pos = MAP_APPFONT ( 140, 60 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - }; - PushButton BT_ADDPLACE_DELETE - { - Pos = MAP_APPFONT ( 10 , 60 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "Delete" ; - }; -}; - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/office/PlacesListBox.cxx b/fpicker/source/office/PlacesListBox.cxx index efcf50670712..f514296673d0 100644 --- a/fpicker/source/office/PlacesListBox.cxx +++ b/fpicker/source/office/PlacesListBox.cxx @@ -28,7 +28,7 @@ #include #include -#include "PlaceEditDialog.hxx" +#include #include #include @@ -182,10 +182,10 @@ void PlacesListBox::SetSizePixel( const Size& rNewSize ) Image PlacesListBox::getEntryIcon( PlacePtr pPlace ) { - Image theImage = mpDlg->GetButtonImage( IMG_FILEDLG_PLACE_LOCAL ); + Image theImage = mpDlg->GetButtonImage( IMG_FILEDLG_PLACE_LOCAL ); if ( !pPlace->IsLocal( ) ) theImage = mpDlg->GetButtonImage( IMG_FILEDLG_PLACE_REMOTE ); - return theImage; + return theImage; } IMPL_LINK( PlacesListBox, Selection, void* , EMPTYARG ) diff --git a/fpicker/source/office/PlacesListBox.hxx b/fpicker/source/office/PlacesListBox.hxx index f115aba78c85..7185da8bd07c 100644 --- a/fpicker/source/office/PlacesListBox.hxx +++ b/fpicker/source/office/PlacesListBox.hxx @@ -31,45 +31,11 @@ #include #include +#include #include -#include #include -/** Class representing a file location: it mainly consist of display attributes and a URL. - */ -class Place -{ - private: - rtl::OUString msName; - INetURLObject maUrl; - - bool mbEditable; - - public: - - Place( rtl::OUString sName, rtl::OUString sUrl, bool bEditable = false ) : - msName( sName ), - maUrl( sUrl ), - mbEditable( bEditable ) {}; - - ~Place( ) {}; - - Place( const Place& rCopy ) : - msName( rCopy.msName ), - maUrl( rCopy.maUrl ), - mbEditable( rCopy.mbEditable ) { }; - - void SetName(const rtl::OUString& aName ) { msName = aName; } - void SetUrl(const rtl::OUString& aUrl ) { maUrl.SetURL( aUrl ); } - - rtl::OUString& GetName( ) { return msName; } - rtl::OUString GetUrl( ) { return maUrl.GetMainURL( INetURLObject::NO_DECODE ); } - INetURLObject& GetUrlObject( ) { return maUrl; } - bool IsLocal( ) { return maUrl.GetProtocol() == INET_PROT_FILE; } - bool IsEditable( ) { return mbEditable; } -}; - typedef boost::shared_ptr< Place > PlacePtr; class PlacesListBox; diff --git a/fpicker/source/office/ServerDetailsControls.cxx b/fpicker/source/office/ServerDetailsControls.cxx deleted file mode 100644 index 93e02f8cf520..000000000000 --- a/fpicker/source/office/ServerDetailsControls.cxx +++ /dev/null @@ -1,428 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * Version: MPL 1.1 / GPLv3+ / LGPLv3+ - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License or as specified alternatively below. You may obtain a copy of - * the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * Major Contributor(s): - * [ Copyright (C) 2012 SUSE (initial developer) ] - * - * All Rights Reserved. - * - * For minor contributions see the git repository. - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 3 or later (the "GPLv3+"), or - * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), - * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable - * instead of those above. - */ - -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include "PlaceEditDialog.hrc" - -#include "fpsofficeResMgr.hxx" -#include "PlaceEditDialog.hxx" -#include "ServerDetailsControls.hxx" - -using namespace std; -using namespace com::sun::star::lang; -using namespace com::sun::star::sdbc; -using namespace com::sun::star::task; -using namespace com::sun::star::ucb; -using namespace com::sun::star::uno; - -DetailsContainer::DetailsContainer( ) : - m_aControls( ), - m_bShown( false ) -{ -} - -DetailsContainer::~DetailsContainer( ) -{ - m_aControls.clear( ); -} - -void DetailsContainer::addControl( sal_uInt16 nId, Control* pControl ) -{ - m_aControls.insert( pair< sal_uInt16, Control* >( nId, pControl ) ); - pControl->Show( m_bShown ); - - if ( pControl->GetType( ) == WINDOW_EDIT ) - static_cast< Edit* >( pControl )->SetModifyHdl( LINK( this, DetailsContainer, ValueChangeHdl ) ); - else if ( pControl->GetType( ) == WINDOW_NUMERICFIELD ) - static_cast< NumericField* >( pControl )->SetModifyHdl( LINK( this, DetailsContainer, ValueChangeHdl ) ); - else if ( pControl->GetType( ) == WINDOW_CHECKBOX ) - static_cast< CheckBox* >( pControl )->SetToggleHdl( LINK( this, DetailsContainer, ValueChangeHdl ) ); -} - -Control* DetailsContainer::getControl( sal_uInt16 nId ) -{ - Control* pControl = NULL; - map< sal_uInt16, Control* >::iterator it = m_aControls.find( nId ); - if ( it != m_aControls.end( ) ) - pControl = it->second; - return pControl; -} - -Rectangle DetailsContainer::getBounds( ) -{ - Rectangle aBounds; - for ( map< sal_uInt16, Control* >::iterator it = m_aControls.begin( ); it != m_aControls.end( ); ++it ) - { - Rectangle aControlBounds( it->second->GetPosPixel(), it->second->GetSizePixel() ); - aBounds = aBounds.GetUnion( aControlBounds ); - } - - return aBounds; -} - -void DetailsContainer::show( bool bShow ) -{ - m_bShown = bShow; - for ( map< sal_uInt16, Control* >::iterator it = m_aControls.begin( ); it != m_aControls.end( ); ++it ) - { - it->second->Show( m_bShown ); - } -} - -INetURLObject DetailsContainer::getUrl( ) -{ - // Don't use that class directly: make it smarter by subclassing it. - return INetURLObject( ); -} - -bool DetailsContainer::setUrl( const INetURLObject& ) -{ - // That class doesn't contain any logic... it defers the dirty work - // to the sub classes. - return false; -} - -void DetailsContainer::notifyChange( ) -{ - m_aChangeHdl.Call( this ); -} - -IMPL_LINK( DetailsContainer, ValueChangeHdl, void *, EMPTYARG ) -{ - notifyChange( ); - return 0; -} - -HostDetailsContainer::HostDetailsContainer( sal_uInt16 nPort, rtl::OUString sScheme ) : - DetailsContainer( ), - m_nDefaultPort( nPort ), - m_sScheme( sScheme ) -{ -} - -void HostDetailsContainer::show( bool bShow ) -{ - DetailsContainer::show( bShow ); - if ( bShow ) - static_cast< NumericField* >( getControl( ED_ADDPLACE_PORT ) )->SetValue( m_nDefaultPort ); -} - -INetURLObject HostDetailsContainer::getUrl( ) -{ - rtl::OUString sHost = rtl::OUString( static_cast< Edit* >( getControl( ED_ADDPLACE_HOST ) )->GetText() ).trim( ); - sal_Int64 nPort = static_cast< NumericField* >( getControl( ED_ADDPLACE_PORT ) )->GetValue(); - rtl::OUString sPath = rtl::OUString( static_cast< Edit* >( getControl( ED_ADDPLACE_PATH ) )->GetText() ).trim( ); - - rtl::OUString sUrl; - if ( !sHost.isEmpty( ) ) - { - sUrl = m_sScheme + "://" + sHost; - if ( nPort != m_nDefaultPort ) - sUrl += ":" + rtl::OUString::valueOf( nPort ); - if ( !sPath.isEmpty( ) ) - if ( sPath.indexOf( '/' ) != 0 ) - sUrl += "/"; - sUrl += sPath; - } - - return INetURLObject( sUrl ); -} - -bool HostDetailsContainer::setUrl( const INetURLObject& rUrl ) -{ - bool bSuccess = false; - - bSuccess = verifyScheme( INetURLObject::GetScheme( rUrl.GetProtocol( ) ) ); - - if ( bSuccess ) - { - static_cast< Edit* >( getControl( ED_ADDPLACE_HOST ) )->SetText( rUrl.GetHost( ) ); - static_cast< NumericField* >( getControl( ED_ADDPLACE_PORT ) )->SetValue( rUrl.GetPort( ) ); - static_cast< Edit* >( getControl( ED_ADDPLACE_PATH ) )->SetText( rUrl.GetURLPath() ); - } - - return bSuccess; -} - -bool HostDetailsContainer::verifyScheme( const rtl::OUString& sScheme ) -{ - return sScheme.equals( m_sScheme + "://" ); -} - -DavDetailsContainer::DavDetailsContainer( ) : - HostDetailsContainer( 80, "http" ) -{ -} - -void DavDetailsContainer::addControl( sal_uInt16 nId, Control* pControl ) -{ - DetailsContainer::addControl( nId, pControl ); - - // Add listener on CB_ADDPLACE_DAVS - if ( nId == CB_ADDPLACE_DAVS ) - static_cast< CheckBox* >( pControl )->SetToggleHdl( LINK( this, DavDetailsContainer, ToggledDavsHdl ) ); -} - -void DavDetailsContainer::show( bool bShow ) -{ - HostDetailsContainer::show( bShow ); - if ( bShow ) - static_cast< CheckBox* >( getControl( CB_ADDPLACE_DAVS ) )->Check( false ); -} - -bool DavDetailsContainer::verifyScheme( const rtl::OUString& rScheme ) -{ - bool bValid = false; - if ( rScheme.equals( "http://" ) ) - { - bValid = true; - static_cast< CheckBox* >( getControl( CB_ADDPLACE_DAVS ) )->Check( false ); - } - else if ( rScheme.equals( "https://" ) ) - { - bValid = true; - static_cast< CheckBox* >( getControl( CB_ADDPLACE_DAVS ) )->Check( true ); - } - return bValid; -} - -IMPL_LINK( DavDetailsContainer, ToggledDavsHdl, CheckBox*, pCheckBox ) -{ - // Change default port if needed - sal_Bool bCheckedDavs = pCheckBox->IsChecked(); - NumericField* pPortField = static_cast< NumericField* >( getControl( ED_ADDPLACE_PORT ) ); - if ( pPortField->GetValue() == 80 && bCheckedDavs == sal_True) - pPortField->SetValue( 443 ); - else if ( pPortField->GetValue() == 443 && bCheckedDavs == sal_False ) - pPortField->SetValue( 80 ); - - rtl::OUString sScheme( "http" ); - if ( bCheckedDavs ) - sScheme = "https"; - setScheme( sScheme ); - - notifyChange( ); - - return 0; -} - -INetURLObject SmbDetailsContainer::getUrl( ) -{ - rtl::OUString sHost = rtl::OUString( static_cast< Edit* >( getControl( ED_ADDPLACE_SMBHOST ) )->GetText() ).trim( ); - rtl::OUString sShare = rtl::OUString( static_cast< Edit* >( getControl( ED_ADDPLACE_SHARE ) )->GetText() ).trim( ); - rtl::OUString sPath = rtl::OUString( static_cast< Edit* >( getControl( ED_ADDPLACE_SMBPATH ) )->GetText() ).trim( ); - - rtl::OUString sUrl; - if ( !sHost.isEmpty( ) ) - { - sUrl = "smb://" + sHost + "/"; - if ( !sShare.isEmpty( ) ) - sUrl += sShare; - if ( !sPath.isEmpty( ) ) - if ( sPath.indexOf( '/' ) != 0 ) - sUrl += "/"; - sUrl += sPath; - } - - return INetURLObject( sUrl ); -} - -bool SmbDetailsContainer::setUrl( const INetURLObject& rUrl ) -{ - bool bSuccess = rUrl.GetProtocol() == INET_PROT_SMB; - - if ( bSuccess ) - { - rtl::OUString sShare = rUrl.getName( 0 ); - rtl::OUString sFullPath = rUrl.GetURLPath( ); - rtl::OUString sPath; - if ( sFullPath.getLength( ) > sShare.getLength( ) ) - { - sal_Int32 nPos = sShare.getLength( ); - if ( nPos != 0 ) - ++nPos; - sPath = sFullPath.copy( nPos ); - } - - static_cast< Edit* >( getControl( ED_ADDPLACE_SMBHOST ) )->SetText( rUrl.GetHost( ) ); - static_cast< Edit* >( getControl( ED_ADDPLACE_SHARE ) )->SetText( sShare ); - static_cast< Edit* >( getControl( ED_ADDPLACE_SMBPATH ) )->SetText( sPath ); - } - - return bSuccess; -} - -CmisDetailsContainer::CmisDetailsContainer( ) : - DetailsContainer( ), - m_sUsername( ), - m_xCmdEnv( ) -{ - Reference< XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory(); - Reference< XInteractionHandler > xGlobalInteractionHandler = Reference< XInteractionHandler >( - xFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.task.InteractionHandler") ) ), UNO_QUERY ); - m_xCmdEnv = new ucbhelper::CommandEnvironment( xGlobalInteractionHandler, Reference< XProgressHandler >() ); -} - -INetURLObject CmisDetailsContainer::getUrl( ) -{ - rtl::OUString sBindingUrl = rtl::OUString( static_cast< Edit* >( getControl( ED_ADDPLACE_CMIS_BINDING ) )->GetText() ).trim( ); - - rtl::OUString sUrl; - if ( !sBindingUrl.isEmpty( ) && !m_sRepoId.isEmpty() ) - { - rtl::OUString sEncodedBinding = rtl::Uri::encode( - sBindingUrl + "#" + m_sRepoId, - rtl_UriCharClassRelSegment, - rtl_UriEncodeKeepEscapes, - RTL_TEXTENCODING_UTF8 ); - sUrl = "vnd.libreoffice.cmis+atom://" + sEncodedBinding; - } - - return INetURLObject( sUrl ); -} - -bool CmisDetailsContainer::setUrl( const INetURLObject& rUrl ) -{ - bool bSuccess = rUrl.GetProtocol() == INET_PROT_CMIS_ATOM; - - if ( bSuccess ) - { - rtl::OUString sBindingUrl; - rtl::OUString sRepositoryId; - - rtl::OUString sDecodedHost = rUrl.GetHost( INetURLObject::DECODE_WITH_CHARSET ); - INetURLObject aHostUrl( sDecodedHost ); - sBindingUrl = aHostUrl.GetURLNoMark( ); - sRepositoryId = aHostUrl.GetMark( ); - - static_cast< Edit* >( getControl( ED_ADDPLACE_CMIS_BINDING ) )->SetText( sBindingUrl ); - } - - return bSuccess; -} - -void CmisDetailsContainer::setUsername( const rtl::OUString& rUsername ) -{ - m_sUsername = rtl::OUString( rUsername ); -} - -void CmisDetailsContainer::addControl( sal_uInt16 nId, Control* pControl ) -{ - DetailsContainer::addControl( nId, pControl ); - - // Add listener on BT_ADDPLACE_CMIS_REPOREFRESH - if ( nId == BT_ADDPLACE_CMIS_REPOREFRESH ) - static_cast< ImageButton* >( pControl )->SetClickHdl( LINK( this, CmisDetailsContainer, RefreshReposHdl ) ); - if ( nId == LB_ADDPLACE_CMIS_REPOSITORY ) - static_cast< ListBox* >( pControl )->SetSelectHdl( LINK( this, CmisDetailsContainer, SelectRepoHdl ) ); -} - -void CmisDetailsContainer::selectRepository( ) -{ - // Get the repo ID and call the Change listener - ListBox* pReposList = static_cast< ListBox* >( getControl( LB_ADDPLACE_CMIS_REPOSITORY ) ); - sal_uInt16 nPos = pReposList->GetSelectEntryPos( ); - m_sRepoId = m_aRepoIds[nPos]; - - notifyChange( ); -} - -IMPL_LINK( CmisDetailsContainer, RefreshReposHdl, void *, EMPTYARG ) -{ - rtl::OUString sBindingUrl = rtl::OUString( static_cast< Edit* >( getControl( ED_ADDPLACE_CMIS_BINDING ) )->GetText() ).trim( ); - - // Clean the listbox - ListBox* pReposList = static_cast< ListBox* >( getControl( LB_ADDPLACE_CMIS_REPOSITORY ) ); - pReposList->Clear( ); - m_aRepoIds.clear( ); - - // Compute the URL - rtl::OUString sUrl; - if ( !sBindingUrl.isEmpty( ) ) - { - rtl::OUString sEncodedBinding = rtl::Uri::encode( - sBindingUrl, - rtl_UriCharClassRelSegment, - rtl_UriEncodeKeepEscapes, - RTL_TEXTENCODING_UTF8 ); - sUrl = "vnd.libreoffice.cmis+atom://" + sEncodedBinding; - } - - // Get the Content - ::ucbhelper::Content aCnt( sUrl, m_xCmdEnv ); - Sequence< rtl::OUString > aProps( 1 ); - aProps[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Title" ) ); - - try - { - Reference< XResultSet > xResultSet( aCnt.createCursor( aProps ), UNO_QUERY_THROW ); - Reference< XContentAccess > xAccess( xResultSet, UNO_QUERY_THROW ); - while ( xResultSet->next() ) - { - rtl::OUString sURL = xAccess->queryContentIdentifierString( ); - INetURLObject aURL( sURL ); - rtl::OUString sId = aURL.GetURLPath( INetURLObject::DECODE_WITH_CHARSET ); - sId = sId.copy( 1 ); - m_aRepoIds.push_back( sId ); - - Reference< XRow > xRow( xResultSet, UNO_QUERY ); - rtl::OUString sName = xRow->getString( 1 ); - pReposList->InsertEntry( sName ); - } - } - catch ( const Exception& ) - { - } - - // Auto-select the first one - if ( pReposList->GetEntryCount( ) > 0 ) - { - pReposList->SelectEntryPos( 0 ); - selectRepository( ); - } - - return 0; -} - -IMPL_LINK( CmisDetailsContainer, SelectRepoHdl, void *, EMPTYARG ) -{ - selectRepository( ); - return 0; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/office/ServerDetailsControls.hxx b/fpicker/source/office/ServerDetailsControls.hxx deleted file mode 100644 index 206f1aaa5870..000000000000 --- a/fpicker/source/office/ServerDetailsControls.hxx +++ /dev/null @@ -1,148 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * Version: MPL 1.1 / GPLv3+ / LGPLv3+ - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License or as specified alternatively below. You may obtain a copy of - * the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * Major Contributor(s): - * [ Copyright (C) 2012 SUSE (initial developer) ] - * - * All Rights Reserved. - * - * For minor contributions see the git repository. - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 3 or later (the "GPLv3+"), or - * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), - * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable - * instead of those above. - */ -#ifndef _SERVERDETAILSCONTROLS_HXX -#define _SERVERDETAILSCONTROLS_HXX - -#include - -#include -#include -#include -#include -#include - -class DetailsContainer -{ - private: - std::map< sal_uInt16, Control* > m_aControls; - bool m_bShown; - Link m_aChangeHdl; - - public: - DetailsContainer( ); - virtual ~DetailsContainer( ); - - virtual void addControl( sal_uInt16 nId, Control* pControl ); - Control* getControl( sal_uInt16 nId ); - Rectangle getBounds( ); - - void setChangeHdl( const Link& rLink ) { m_aChangeHdl = rLink; } - - virtual void show( bool bShow = true ); - virtual INetURLObject getUrl( ); - - /** Try to split the URL in the controls of that container. - - \param sUrl the URL to split - \return true if the split worked, false otherwise. - */ - virtual bool setUrl( const INetURLObject& rUrl ); - - virtual void setUsername( const rtl::OUString& /*rUsername*/ ) { }; - - protected: - void notifyChange( ); - - private: - DECL_LINK ( ValueChangeHdl, void * ); -}; - -class HostDetailsContainer : public DetailsContainer -{ - private: - sal_uInt16 m_nDefaultPort; - rtl::OUString m_sScheme; - - public: - HostDetailsContainer( sal_uInt16 nPort, rtl::OUString sScheme ); - virtual ~HostDetailsContainer( ) { }; - - virtual void show( bool bShow = true ); - virtual INetURLObject getUrl( ); - virtual bool setUrl( const INetURLObject& rUrl ); - - protected: - void setScheme( rtl::OUString sScheme ) { m_sScheme = sScheme; } - - /** Verifies that the schement split from the URL can be handled by - the container and set the proper controls accordingly if needed. - */ - virtual bool verifyScheme( const rtl::OUString& rScheme ); -}; - -class DavDetailsContainer : public HostDetailsContainer -{ - public: - DavDetailsContainer( ); - ~DavDetailsContainer( ) { }; - - virtual void addControl( sal_uInt16 nId, Control* pControl ); - virtual void show( bool bShow = true ); - - protected: - virtual bool verifyScheme( const rtl::OUString& rScheme ); - - private: - DECL_LINK ( ToggledDavsHdl, CheckBox * pCheckBox ); -}; - -class SmbDetailsContainer : public DetailsContainer -{ - public: - SmbDetailsContainer( ) : DetailsContainer( ) { }; - ~SmbDetailsContainer( ) { }; - - virtual INetURLObject getUrl( ); - virtual bool setUrl( const INetURLObject& rUrl ); -}; - -class CmisDetailsContainer : public DetailsContainer -{ - private: - rtl::OUString m_sUsername; - com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment > m_xCmdEnv; - std::vector< rtl::OUString > m_aRepoIds; - rtl::OUString m_sRepoId; - - public: - CmisDetailsContainer( ); - ~CmisDetailsContainer( ) { }; - - virtual INetURLObject getUrl( ); - virtual bool setUrl( const INetURLObject& rUrl ); - virtual void setUsername( const rtl::OUString& rUsername ); - virtual void addControl( sal_uInt16 nId, Control* pControl ); - - private: - void selectRepository( ); - DECL_LINK ( RefreshReposHdl, void * ); - DECL_LINK ( SelectRepoHdl, void * ); -}; - -#endif -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/office/iodlg.cxx b/fpicker/source/office/iodlg.cxx index 37e01a9da038..7b6ebe1cad24 100644 --- a/fpicker/source/office/iodlg.cxx +++ b/fpicker/source/office/iodlg.cxx @@ -19,7 +19,7 @@ #include #include "iodlg.hxx" -#include "PlaceEditDialog.hxx" +#include #include "PlacesListBox.hxx" #include "fpsofficeResMgr.hxx" #include @@ -553,9 +553,9 @@ void SvtFileDialog::Init_Impl } } - Edit anOtherDummy( this, SvtResId( ED_EXPLORERFILE_CURRENTPATH ) ); - _pImp->_pEdCurrentPath = new SvtURLBox( this, SvtResId(ED_EXPLORERFILE_CURRENTPATH) ); - _pImp->_pEdCurrentPath->SetUrlFilter( &m_aURLFilter ); + Edit anOtherDummy( this, SvtResId( ED_EXPLORERFILE_CURRENTPATH ) ); + _pImp->_pEdCurrentPath = new SvtURLBox( this, SvtResId(ED_EXPLORERFILE_CURRENTPATH) ); + _pImp->_pEdCurrentPath->SetUrlFilter( &m_aURLFilter ); _pImp->_pEdCurrentPath->SetPosSizePixel( anOtherDummy.GetPosPixel(), anOtherDummy.GetSizePixel() ); _pImp->_pEdCurrentPath->Show(); @@ -1396,35 +1396,35 @@ IMPL_STATIC_LINK( SvtFileDialog, FileNameModifiedHdl_Impl, void*, EMPTYARG ) IMPL_STATIC_LINK ( SvtFileDialog, URLBoxModifiedHdl_Impl, void*, EMPTYARG ) { - String _aPath = pThis->_pImp->_pEdCurrentPath->GetURL(); - pThis->OpenURL_Impl(_aPath); - return 0; + String _aPath = pThis->_pImp->_pEdCurrentPath->GetURL(); + pThis->OpenURL_Impl(_aPath); + return 0; } //***************************************************************************** IMPL_STATIC_LINK ( SvtFileDialog, ConnectToServerPressed_Hdl, void*, EMPTYARG ) { - pThis->_pFileView->EndInplaceEditing( false ); + pThis->_pFileView->EndInplaceEditing( false ); - PlaceEditDialog aDlg( pThis ); - short aRetCode = aDlg.Execute(); + PlaceEditDialog aDlg( pThis ); + short aRetCode = aDlg.Execute(); - switch (aRetCode) { - case RET_OK : - { - PlacePtr newPlace = aDlg.GetPlace(); - pThis->_pImp->_pPlaces->AppendPlace(newPlace); + switch (aRetCode) { + case RET_OK : + { + PlacePtr newPlace = aDlg.GetPlace(); + pThis->_pImp->_pPlaces->AppendPlace(newPlace); break; - } - case RET_CANCEL : - default : - // Do Nothing - break; - }; - - return 0; + } + case RET_CANCEL : + default : + // Do Nothing + break; + }; + + return 0; } //***************************************************************************** -- cgit v1.2.3