Kaydet (Commit) 51802df7 authored tarafından Rafael Dominguez's avatar Rafael Dominguez

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
üst e433ab14
......@@ -44,7 +44,6 @@ $(eval $(call gb_SrsTarget_use_packages,fps_office/res,\
$(eval $(call gb_SrsTarget_add_files,fps_office/res,\
fpicker/source/office/OfficeFilePicker.src \
fpicker/source/office/iodlg.src \
fpicker/source/office/PlaceEditDialog.src \
))
# vim: set noet sw=4 ts=4:
......@@ -62,9 +62,7 @@ $(eval $(call gb_Library_add_exception_objects,fps_office,\
fpicker/source/office/OfficeControlAccess \
fpicker/source/office/OfficeFilePicker \
fpicker/source/office/OfficeFolderPicker \
fpicker/source/office/PlaceEditDialog \
fpicker/source/office/PlacesListBox \
fpicker/source/office/ServerDetailsControls \
))
# vim: set noet sw=4 ts=4:
......@@ -28,7 +28,7 @@
#include <iodlg.hrc>
#include <PlacesListBox.hxx>
#include "PlaceEditDialog.hxx"
#include <svtools/PlaceEditDialog.hxx>
#include <vcl/msgbox.hxx>
#include <svtools/headbar.hxx>
......@@ -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 )
......
......@@ -31,45 +31,11 @@
#include <iodlg.hxx>
#include <boost/shared_ptr.hpp>
#include <svtools/place.hxx>
#include <svtools/svtabbx.hxx>
#include <tools/urlobj.hxx>
#include <vector>
/** 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;
......
......@@ -19,7 +19,7 @@
#include <sal/macros.h>
#include "iodlg.hxx"
#include "PlaceEditDialog.hxx"
#include <svtools/PlaceEditDialog.hxx>
#include "PlacesListBox.hxx"
#include "fpsofficeResMgr.hxx"
#include <tools/stream.hxx>
......@@ -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;
}
//*****************************************************************************
......
......@@ -2,7 +2,7 @@
#*************************************************************************
#
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
#
# Copyright 2000, 2011 Oracle and/or its affiliates.
#
# OpenOffice.org - a multi-platform office productivity suite
......@@ -37,10 +37,10 @@ $(eval $(call gb_AllLangResTarget_add_srs,svt,\
$(eval $(call gb_SrsTarget_SrsTarget,svt/res))
$(eval $(call gb_SrsTarget_use_packages,svt/res,\
i18npool_inc \
svl_inc \
svtools_inc \
tools_inc \
i18npool_inc \
svl_inc \
svtools_inc \
tools_inc \
))
$(eval $(call gb_SrsTarget_set_include,svt/res,\
......@@ -61,6 +61,7 @@ $(eval $(call gb_SrsTarget_add_files,svt/res,\
svtools/source/dialogs/addresstemplate.src \
svtools/source/dialogs/filedlg2.src \
svtools/source/dialogs/formats.src \
svtools/source/dialogs/PlaceEditDialog.src \
svtools/source/dialogs/prnsetup.src \
svtools/source/dialogs/so3res.src \
svtools/source/dialogs/wizardmachine.src \
......
......@@ -138,8 +138,10 @@ $(eval $(call gb_Library_add_exception_objects,svt,\
svtools/source/dialogs/filedlg2 \
svtools/source/dialogs/insdlg \
svtools/source/dialogs/mcvmath \
svtools/source/dialogs/PlaceEditDialog \
svtools/source/dialogs/prnsetup \
svtools/source/dialogs/roadmapwizard \
svtools/source/dialogs/ServerDetailsControls \
svtools/source/dialogs/wizardmachine \
svtools/source/dialogs/wizdlg \
svtools/source/edit/editsyntaxhighlighter \
......
......@@ -111,6 +111,8 @@ $(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/slidesorterbaropt.hxx,
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/optionsdrawinglayer.hxx,svtools/optionsdrawinglayer.hxx))
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/parhtml.hxx,svtools/parhtml.hxx))
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/parrtf.hxx,svtools/parrtf.hxx))
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/place.hxx,svtools/place.hxx))
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/PlaceEditDialog.hxx,svtools/PlaceEditDialog.hxx))
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/popupmenucontrollerbase.hxx,svtools/popupmenucontrollerbase.hxx))
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/popupwindowcontroller.hxx,svtools/popupwindowcontroller.hxx))
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/prgsbar.hxx,svtools/prgsbar.hxx))
......@@ -125,6 +127,7 @@ $(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/ruler.hxx,svtools/rule
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/sampletext.hxx,svtools/sampletext.hxx))
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/scriptedtext.hxx,svtools/scriptedtext.hxx))
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/scrwin.hxx,svtools/scrwin.hxx))
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/ServerDetailsControls.hxx,svtools/ServerDetailsControls.hxx))
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/sfxecode.hxx,svtools/sfxecode.hxx))
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/soerr.hxx,svtools/soerr.hxx))
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/sores.hxx,svtools/sores.hxx))
......
......@@ -28,8 +28,6 @@
#ifndef _PLACEEDITDIALOG_HXX
#define _PLACEEDITDIALOG_HXX
#include "fpsofficeResMgr.hxx"
#include "PlacesListBox.hxx"
#include "ServerDetailsControls.hxx"
#include <vcl/button.hxx>
......@@ -39,11 +37,12 @@
#include <vcl/lstbox.hxx>
#include <svtools/inettbc.hxx>
#include <svtools/place.hxx>
#include <boost/shared_ptr.hpp>
#include <vector>
class PlaceEditDialog : public ModalDialog
class SVT_DLLPUBLIC PlaceEditDialog : public ModalDialog
{
private :
......@@ -92,16 +91,16 @@ private :
public :
PlaceEditDialog( Window* pParent);
PlaceEditDialog( Window* pParent, const PlacePtr& pPlace );
PlaceEditDialog(Window* pParent, const boost::shared_ptr<Place> &pPlace );
~PlaceEditDialog();
// Returns a place instance with given informations
PlacePtr GetPlace();
boost::shared_ptr<Place> GetPlace();
rtl::OUString GetServerName() { return m_aEDServerName.GetText(); }
rtl::OUString GetServerUrl();
ResId GetResId( sal_uInt16 nId ) { return SvtResId( nId ); };
ResId GetResId( sal_uInt16 nId );
private:
......
......@@ -28,10 +28,12 @@
#ifndef _SERVERDETAILSCONTROLS_HXX
#define _SERVERDETAILSCONTROLS_HXX
#include <map>
#include <com/sun/star/ucb/XCommandEnvironment.hpp>
#include <tools/urlobj.hxx>
#include <vcl/ctrl.hxx>
#include <vcl/button.hxx>
#include <vcl/edit.hxx>
#include <vcl/field.hxx>
#include <vcl/fixed.hxx>
......
/* -*- 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 __SVTOOLS_PLACE_HXX__
#define __SVTOOLS_PLACE_HXX__
#include <tools/urlobj.hxx>
class Place
{
private:
OUString msName;
INetURLObject maUrl;
bool mbEditable;
public:
Place( OUString sName, rtl::OUString sUrl, bool bEditable = false ) :
msName( sName ),
maUrl( sUrl ),
mbEditable( bEditable ) {};
void SetName(const OUString& aName ) { msName = aName; }
void SetUrl(const OUString& aUrl ) { maUrl.SetURL( aUrl ); }
OUString& GetName( ) { return msName; }
OUString GetUrl( ) { return maUrl.GetMainURL( INetURLObject::NO_DECODE ); }
INetURLObject& GetUrlObject( ) { return maUrl; }
bool IsLocal( ) { return maUrl.GetProtocol() == INET_PROT_FILE; }
bool IsEditable( ) { return mbEditable; }
};
#endif // __SVTOOLS_PLACE_HXX__
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -26,24 +26,22 @@
* instead of those above.
*/
#include "OfficeFilePicker.hrc"
#include "PlaceEditDialog.hrc"
#include "fpsofficeResMgr.hxx"
#include "PlacesListBox.hxx"
#include "PlaceEditDialog.hxx"
#include "ServerDetailsControls.hxx"
#include <officecfg/Office/Common.hxx>
#include <svtools/svtresid.hxx>
#include <vcl/msgbox.hxx>
using namespace boost;
PlaceEditDialog::PlaceEditDialog( Window* pParent ) :
ModalDialog( pParent, SvtResId( DLG_FPICKER_PLACE_EDIT ) ),
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_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 ) ),
......@@ -68,14 +66,14 @@ PlaceEditDialog::PlaceEditDialog( Window* pParent ) :
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_aBTOk.SetClickHdl( LINK( this, PlaceEditDialog, OKHdl) );
m_aBTOk.Enable( sal_False );
m_aEDServerName.SetModifyHdl( LINK( this, PlaceEditDialog, EditHdl) );
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();
// 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 ) );
......@@ -83,12 +81,12 @@ PlaceEditDialog::PlaceEditDialog( Window* pParent ) :
InitDetails( );
}
PlaceEditDialog::PlaceEditDialog( Window* pParent, const PlacePtr& pPlace ) :
ModalDialog( pParent, SvtResId( DLG_FPICKER_PLACE_EDIT ) ),
PlaceEditDialog::PlaceEditDialog( Window* pParent, const boost::shared_ptr<Place>& 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_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 ) ),
......@@ -161,10 +159,15 @@ rtl::OUString PlaceEditDialog::GetServerUrl()
return sUrl;
}
PlacePtr PlaceEditDialog::GetPlace()
ResId PlaceEditDialog::GetResId(sal_uInt16 nId)
{
return SvtResId( nId );
}
boost::shared_ptr<Place> PlaceEditDialog::GetPlace()
{
PlacePtr newPlace( new Place( m_aEDServerName.GetText(), GetServerUrl(), true ) );
return newPlace;
boost::shared_ptr<Place> newPlace( new Place( m_aEDServerName.GetText(), GetServerUrl(), true ) );
return newPlace;
}
void PlaceEditDialog::InitDetails( )
......@@ -236,15 +239,15 @@ void PlaceEditDialog::InitDetails( )
IMPL_LINK ( PlaceEditDialog, OKHdl, Button *, EMPTYARG )
{
EndDialog( RET_OK );
return 1;
EndDialog( RET_OK );
return 1;
}
IMPL_LINK ( PlaceEditDialog, DelHdl, Button *, EMPTYARG )
{
// ReUsing existing symbols...
EndDialog( RET_NO );
return 1;
// ReUsing existing symbols...
EndDialog( RET_NO );
return 1;
}
IMPL_LINK ( PlaceEditDialog, EditHdl, void *, EMPTYARG )
......@@ -252,7 +255,7 @@ 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;
return 1;
}
IMPL_LINK ( PlaceEditDialog, EditUsernameHdl, void *, EMPTYARG )
......
......@@ -30,6 +30,9 @@
#define _FPICKER_PLACEEDITDLG_HRC
#include <svl/solar.hrc>
#include <vcl/fpicker.hrc>
#define DLG_FPICKER_PLACE_EDIT (RID_FPICKER_START+16)
// DLG_FPICKER_PLACE_EDIT ------------------------------
#define FT_ADDPLACE_SERVERNAME 10
......
......@@ -28,7 +28,6 @@
*/
#include "PlaceEditDialog.hrc"
#include "OfficeFilePicker.hrc"
// Place Edit Dialog --------------------------------------------------------------
......
......@@ -33,13 +33,13 @@
#include <com/sun/star/sdbc/XResultSet.hpp>
#include <com/sun/star/sdbc/XRow.hpp>
#include <comphelper/processfactory.hxx>
#include <rtl/uri.hxx>
#include <ucbhelper/content.hxx>
#include <ucbhelper/commandenvironment.hxx>
#include "PlaceEditDialog.hrc"
#include "fpsofficeResMgr.hxx"
#include "PlaceEditDialog.hxx"
#include "ServerDetailsControls.hxx"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment