summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorRafael Dominguez <venccsralph@gmail.com>2012-08-03 18:12:51 -0430
committerRafael Dominguez <venccsralph@gmail.com>2012-08-03 18:31:33 -0430
commit51802df73230d08fe13bba58936da810100cc4d1 (patch)
tree523e4cd2afa990588968e548eefb4653446780c3 /svtools
parente433ab143c378299d18fc6579bc2df131f714e69 (diff)
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
Diffstat (limited to 'svtools')
-rw-r--r--svtools/AllLangResTarget_svt.mk11
-rw-r--r--svtools/Library_svt.mk2
-rw-r--r--svtools/Package_inc.mk3
-rw-r--r--svtools/inc/svtools/PlaceEditDialog.hxx118
-rw-r--r--svtools/inc/svtools/ServerDetailsControls.hxx150
-rw-r--r--svtools/inc/svtools/place.hxx42
-rw-r--r--svtools/source/dialogs/PlaceEditDialog.cxx333
-rw-r--r--svtools/source/dialogs/PlaceEditDialog.hrc66
-rw-r--r--svtools/source/dialogs/PlaceEditDialog.src223
-rw-r--r--svtools/source/dialogs/ServerDetailsControls.cxx428
10 files changed, 1371 insertions, 5 deletions
diff --git a/svtools/AllLangResTarget_svt.mk b/svtools/AllLangResTarget_svt.mk
index 4a4421a9ac67..17747834e4d1 100644
--- a/svtools/AllLangResTarget_svt.mk
+++ b/svtools/AllLangResTarget_svt.mk
@@ -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 \
diff --git a/svtools/Library_svt.mk b/svtools/Library_svt.mk
index c5f3e835be2d..3a0e7d0105ef 100644
--- a/svtools/Library_svt.mk
+++ b/svtools/Library_svt.mk
@@ -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 \
diff --git a/svtools/Package_inc.mk b/svtools/Package_inc.mk
index a7ce3a1a60c5..b0525ea255ec 100644
--- a/svtools/Package_inc.mk
+++ b/svtools/Package_inc.mk
@@ -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))
diff --git a/svtools/inc/svtools/PlaceEditDialog.hxx b/svtools/inc/svtools/PlaceEditDialog.hxx
new file mode 100644
index 000000000000..997707ea0ed4
--- /dev/null
+++ b/svtools/inc/svtools/PlaceEditDialog.hxx
@@ -0,0 +1,118 @@
+/* -*- 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 <jlevesy@gmail.com> (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 "ServerDetailsControls.hxx"
+
+#include <vcl/button.hxx>
+#include <vcl/dialog.hxx>
+#include <vcl/edit.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/lstbox.hxx>
+
+#include <svtools/inettbc.hxx>
+#include <svtools/place.hxx>
+
+#include <boost/shared_ptr.hpp>
+#include <vector>
+
+class SVT_DLLPUBLIC 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 boost::shared_ptr<Place> &pPlace );
+ ~PlaceEditDialog();
+
+ // Returns a place instance with given informations
+ boost::shared_ptr<Place> GetPlace();
+
+ rtl::OUString GetServerName() { return m_aEDServerName.GetText(); }
+ rtl::OUString GetServerUrl();
+
+ ResId GetResId( sal_uInt16 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/svtools/inc/svtools/ServerDetailsControls.hxx b/svtools/inc/svtools/ServerDetailsControls.hxx
new file mode 100644
index 000000000000..7d0c9ad3f005
--- /dev/null
+++ b/svtools/inc/svtools/ServerDetailsControls.hxx
@@ -0,0 +1,150 @@
+/* -*- 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 <cbosdonnat@suse.com> (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 <map>
+
+#include <com/sun/star/ucb/XCommandEnvironment.hpp>
+
+#include <tools/urlobj.hxx>
+#include <vcl/button.hxx>
+#include <vcl/edit.hxx>
+#include <vcl/field.hxx>
+#include <vcl/fixed.hxx>
+
+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/svtools/inc/svtools/place.hxx b/svtools/inc/svtools/place.hxx
new file mode 100644
index 000000000000..138186da6a98
--- /dev/null
+++ b/svtools/inc/svtools/place.hxx
@@ -0,0 +1,42 @@
+/* -*- 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: */
diff --git a/svtools/source/dialogs/PlaceEditDialog.cxx b/svtools/source/dialogs/PlaceEditDialog.cxx
new file mode 100644
index 000000000000..6d3d12bdcd54
--- /dev/null
+++ b/svtools/source/dialogs/PlaceEditDialog.cxx
@@ -0,0 +1,333 @@
+/* -*- 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 <jlevesy@gmail.com> (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 "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 ) ),
+ 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 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_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;
+}
+
+ResId PlaceEditDialog::GetResId(sal_uInt16 nId)
+{
+ return SvtResId( nId );
+}
+
+boost::shared_ptr<Place> PlaceEditDialog::GetPlace()
+{
+ boost::shared_ptr<Place> 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/svtools/source/dialogs/PlaceEditDialog.hrc b/svtools/source/dialogs/PlaceEditDialog.hrc
new file mode 100644
index 000000000000..94728ff3dfca
--- /dev/null
+++ b/svtools/source/dialogs/PlaceEditDialog.hrc
@@ -0,0 +1,66 @@
+/* -*- 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 <cbosdonnat@suse.com> (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 <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
+#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/svtools/source/dialogs/PlaceEditDialog.src b/svtools/source/dialogs/PlaceEditDialog.src
new file mode 100644
index 000000000000..cf3bf9a592b6
--- /dev/null
+++ b/svtools/source/dialogs/PlaceEditDialog.src
@@ -0,0 +1,223 @@
+
+/* -*- 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 <cbosdonnat@suse.com> (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"
+
+// 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/svtools/source/dialogs/ServerDetailsControls.cxx b/svtools/source/dialogs/ServerDetailsControls.cxx
new file mode 100644
index 000000000000..567bb1e9fae1
--- /dev/null
+++ b/svtools/source/dialogs/ServerDetailsControls.cxx
@@ -0,0 +1,428 @@
+/* -*- 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 <cbosdonnat@suse.com> (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 <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/task/XInteractionHandler.hpp>
+#include <com/sun/star/ucb/XCommandEnvironment.hpp>
+#include <com/sun/star/ucb/XContentAccess.hpp>
+#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 "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: */