diff options
-rw-r--r-- | padmin/source/adddlg.cxx | 14 | ||||
-rw-r--r-- | padmin/source/fontentry.cxx | 14 | ||||
-rw-r--r-- | padmin/source/helper.cxx | 50 | ||||
-rw-r--r-- | padmin/source/helper.hxx | 106 | ||||
-rw-r--r-- | padmin/source/makefile.mk | 11 | ||||
-rw-r--r-- | padmin/source/newppdlg.cxx | 14 | ||||
-rw-r--r-- | padmin/source/pamain.cxx | 30 |
7 files changed, 149 insertions, 90 deletions
diff --git a/padmin/source/adddlg.cxx b/padmin/source/adddlg.cxx index 93be1fe2a754..456723be150f 100644 --- a/padmin/source/adddlg.cxx +++ b/padmin/source/adddlg.cxx @@ -2,9 +2,9 @@ * * $RCSfile: adddlg.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: pl $ $Date: 2001-06-19 13:47:44 $ + * last change: $Author: pl $ $Date: 2001-09-04 16:24:50 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -79,9 +79,6 @@ #ifndef _PSPRINT_STRHELPER_HXX_ #include <psprint/strhelper.hxx> #endif -#ifndef _SVT_FILEDLG_HXX -#include <filedlg.hxx> -#endif #ifndef _OSL_THREAD_H_ #include <osl/thread.h> #endif @@ -450,10 +447,9 @@ IMPL_LINK( APCommandPage, ClickBtnHdl, PushButton*, pButton ) } else if( pButton == &m_aPdfDirBtn ) { - PathDialog aDialog( this ); - aDialog.SetPath( m_aPdfDirEdt.GetText() ); - if( aDialog.Execute() ) - m_aPdfDirEdt.SetText( aDialog.GetPath() ); + String aPath( m_aPdfDirEdt.GetText() ); + if( chooseDirectory( this, aPath ) ) + m_aPdfDirEdt.SetText( aPath ); } return 0; } diff --git a/padmin/source/fontentry.cxx b/padmin/source/fontentry.cxx index fb5196852e92..4b2770aa29ee 100644 --- a/padmin/source/fontentry.cxx +++ b/padmin/source/fontentry.cxx @@ -2,9 +2,9 @@ * * $RCSfile: fontentry.cxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: pl $ $Date: 2001-06-27 16:03:31 $ + * last change: $Author: pl $ $Date: 2001-09-04 16:24:50 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -77,9 +77,6 @@ #ifndef _PAD_FONTENTRY_HXX_ #include <fontentry.hxx> #endif -#ifndef _SVT_FILEDLG_HXX -#include <filedlg.hxx> -#endif #ifndef _PAD_HELPER_HXX_ #include <helper.hxx> #endif @@ -685,11 +682,10 @@ IMPL_LINK( FontImportDialog, ClickBtnHdl, Button*, pButton ) { if( pButton == &m_aFromBtn ) { - PathDialog aDlg( this ); - aDlg.SetPath( m_aFromDirEdt.GetText() ); - if( aDlg.Execute() ) + String aPath( m_aFromDirEdt.GetText() ); + if( chooseDirectory( this, aPath ) ) { - m_aFromDirEdt.SetText( aDlg.GetPath() ); + m_aFromDirEdt.SetText( aPath ); RefreshTimeoutHdl( NULL ); } } diff --git a/padmin/source/helper.cxx b/padmin/source/helper.cxx index 5859ba247270..801153b10dc7 100644 --- a/padmin/source/helper.cxx +++ b/padmin/source/helper.cxx @@ -2,9 +2,9 @@ * * $RCSfile: helper.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: pl $ $Date: 2001-07-04 14:06:14 $ + * last change: $Author: pl $ $Date: 2001-09-04 16:24:50 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -86,10 +86,30 @@ #ifndef _CONFIG_HXX #include <tools/config.hxx> #endif +#ifndef _COM_SUN_STAR_UI_DIALOGS_EXECUTABLEDIALOGRESULTS_HPP_ +#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp> +#endif +#ifndef _COM_SUN_STAR_UI_DIALOGS_XFOLDERPICKER_HPP_ +#include <com/sun/star/ui/dialogs/XFolderPicker.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_ +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#endif +#ifndef _COMPHELPER_PROCESSFACTORY_HXX_ +#include <comphelper/processfactory.hxx> +#endif +#ifndef _URLOBJ_HXX +#include <tools/urlobj.hxx> +#endif + + using namespace osl; using namespace rtl; using namespace padmin; +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace com::sun::star::ui::dialogs; #define MAX_PATH 1024 @@ -277,3 +297,29 @@ void padmin::freePadminRC() if( pRC ) delete pRC, pRC = NULL; } + +bool padmin::chooseDirectory( Window* pParent, String& rInOutPath ) +{ + bool bRet = false; + Reference< XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); + if( xFactory.is() ) + { + Reference< XFolderPicker > xFolderPicker( xFactory->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.FolderPicker" ) ) ), UNO_QUERY ); + if( xFolderPicker.is() ) + { + INetURLObject aObj( rInOutPath, INET_PROT_FILE, INetURLObject::ENCODE_ALL ); + xFolderPicker->setDisplayDirectory( aObj.GetMainURL() ); + if( xFolderPicker->execute() == ExecutableDialogResults::OK ) + { + aObj = INetURLObject( xFolderPicker->getDirectory() ); + rInOutPath = aObj.PathToFileName(); + bRet = true; + } + } +#ifdef DEBUG + else + fprintf( stderr, "could not get FolderPicker service\n" ); +#endif + } + return bRet; +} diff --git a/padmin/source/helper.hxx b/padmin/source/helper.hxx index 21b9121d2c73..89ef61f98d4f 100644 --- a/padmin/source/helper.hxx +++ b/padmin/source/helper.hxx @@ -2,9 +2,9 @@ * * $RCSfile: helper.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: pl $ $Date: 2001-06-26 19:27:24 $ + * last change: $Author: pl $ $Date: 2001-09-04 16:24:50 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -96,72 +96,74 @@ class Config; namespace padmin { - class DelMultiListBox : public MultiListBox - { - Link m_aDelPressedLink; - public: - DelMultiListBox( Window* pParent, const ResId& rResId ) : - MultiListBox( pParent, rResId ) {} - ~DelMultiListBox() {} +class DelMultiListBox : public MultiListBox +{ + Link m_aDelPressedLink; +public: + DelMultiListBox( Window* pParent, const ResId& rResId ) : + MultiListBox( pParent, rResId ) {} + ~DelMultiListBox() {} - virtual long Notify( NotifyEvent& rEvent ); + virtual long Notify( NotifyEvent& rEvent ); - Link setDelPressedLink( const Link& rLink ) - { - Link aOldLink( m_aDelPressedLink ); + Link setDelPressedLink( const Link& rLink ) + { + Link aOldLink( m_aDelPressedLink ); m_aDelPressedLink = rLink; return aOldLink; - } - const Link& getDelPressedLink() const { return m_aDelPressedLink; } - }; + } + const Link& getDelPressedLink() const { return m_aDelPressedLink; } +}; - class DelListBox : public ListBox - { - Link m_aDelPressedLink; - public: - DelListBox( Window* pParent, const ResId& rResId ) : +class DelListBox : public ListBox +{ + Link m_aDelPressedLink; +public: + DelListBox( Window* pParent, const ResId& rResId ) : ListBox( pParent, rResId ) {} - ~DelListBox() {} + ~DelListBox() {} - virtual long Notify( NotifyEvent& rEvent ); + virtual long Notify( NotifyEvent& rEvent ); - Link setDelPressedLink( const Link& rLink ) - { - Link aOldLink( m_aDelPressedLink ); - m_aDelPressedLink = rLink; - return aOldLink; - } - const Link& getDelPressedLink() const { return m_aDelPressedLink; } - }; - - class QueryString : public ModalDialog + Link setDelPressedLink( const Link& rLink ) { - private: - OKButton m_aOKButton; - CancelButton m_aCancelButton; - FixedText m_aFixedText; - Edit m_aEdit; - ComboBox m_aComboBox; + Link aOldLink( m_aDelPressedLink ); + m_aDelPressedLink = rLink; + return aOldLink; + } + const Link& getDelPressedLink() const { return m_aDelPressedLink; } +}; + +class QueryString : public ModalDialog +{ +private: + OKButton m_aOKButton; + CancelButton m_aCancelButton; + FixedText m_aFixedText; + Edit m_aEdit; + ComboBox m_aComboBox; + + String& m_rReturnValue; + bool m_bUseEdit; - String& m_rReturnValue; - bool m_bUseEdit; + DECL_LINK( ClickBtnHdl, Button* ); - DECL_LINK( ClickBtnHdl, Button* ); +public: + QueryString( Window*, String &, String &, const ::std::list< String >& rChoices = ::std::list<String>() ); + // parent window, Query text, initial value + ~QueryString(); +}; - public: - QueryString( Window*, String &, String &, const ::std::list< String >& rChoices = ::std::list<String>() ); - // parent window, Query text, initial value - ~QueryString(); - }; +BOOL AreYouSure( Window*, int nRid = -1 ); - BOOL AreYouSure( Window*, int nRid = -1 ); +ResId PaResId( ULONG nId ); - ResId PaResId( ULONG nId ); +void FindFiles( const String& rDirectory, ::std::list< String >& rResult, const String& rSuffixes ); - void FindFiles( const String& rDirectory, ::std::list< String >& rResult, const String& rSuffixes ); +Config& getPadminRC(); +void freePadminRC(); - Config& getPadminRC(); - void freePadminRC(); +bool chooseDirectory( Window* pParent, String& rInOutPath ); } // namespace padmin diff --git a/padmin/source/makefile.mk b/padmin/source/makefile.mk index 5f3e10be09ae..03f4651d809b 100644 --- a/padmin/source/makefile.mk +++ b/padmin/source/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.4 $ +# $Revision: 1.5 $ # -# last change: $Author: pl $ $Date: 2001-07-09 15:46:37 $ +# last change: $Author: pl $ $Date: 2001-09-04 16:24:50 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -71,15 +71,13 @@ LIBTARGET=NO # --- Files -------------------------------------------------------- -SRCFILES=padialog.src filedlg2.src rtsetup.src +SRCFILES=padialog.src rtsetup.src RESLIB1NAME=spa RESLIB1SRSFILES= $(SRS)$/padmin.srs RESLIB1DEPN=\ padialog.src \ padialog.hrc \ - filedlg2.hrc \ - filedlg2.src \ rtsetup.src \ rtsetup.hrc RESLIB1BMPS=\ @@ -94,8 +92,6 @@ SLOFILES=\ $(SLO)$/cmddlg.obj \ $(SLO)$/progress.obj \ $(SLO)$/newppdlg.obj \ - $(SLO)$/filedlg.obj \ - $(SLO)$/filedlg2.obj \ $(SLO)$/prtsetup.obj \ $(SLO)$/prgsbar.obj \ $(SLO)$/fontentry.obj \ @@ -130,6 +126,7 @@ APP1OBJS=\ APP1STDLIBS= \ -l$(SHL1TARGET) \ $(SHL1STDLIBS) \ + $(UCBHELPERLIB) \ -lXext -lX11 # --- Targets ------------------------------------------------------ diff --git a/padmin/source/newppdlg.cxx b/padmin/source/newppdlg.cxx index ff6c71e97034..f240af81b2f4 100644 --- a/padmin/source/newppdlg.cxx +++ b/padmin/source/newppdlg.cxx @@ -2,9 +2,9 @@ * * $RCSfile: newppdlg.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: rt $ $Date: 2001-05-22 14:59:21 $ + * last change: $Author: pl $ $Date: 2001-09-04 16:24:50 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -68,9 +68,6 @@ #ifndef _PSPRINT_HELPER_HXX_ #include <psprint/helper.hxx> #endif -#ifndef _SVT_FILEDLG_HXX -#include <filedlg.hxx> -#endif #ifndef _SV_SVAPP_HXX #include <vcl/svapp.hxx> #endif @@ -254,11 +251,10 @@ IMPL_LINK( PPDImportDialog, ClickBtnHdl, PushButton*, pButton ) } else if( pButton == &m_aSearchBtn ) { - PathDialog aDlg( this ); - aDlg.SetPath( m_aPathBox.GetText() ); - if( aDlg.Execute() ) + String aPath( m_aPathBox.GetText() ); + if( chooseDirectory( this, aPath ) ) { - m_aPathBox.SetText( aDlg.GetPath() ); + m_aPathBox.SetText( aPath ); Import(); } } diff --git a/padmin/source/pamain.cxx b/padmin/source/pamain.cxx index fab4b692d209..8a9456e400a1 100644 --- a/padmin/source/pamain.cxx +++ b/padmin/source/pamain.cxx @@ -2,9 +2,9 @@ * * $RCSfile: pamain.cxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: pl $ $Date: 2001-05-08 11:56:36 $ + * last change: $Author: pl $ $Date: 2001-09-04 16:24:50 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -86,6 +86,14 @@ #include <comphelper/processfactory.hxx> #endif +#ifndef _UCBHELPER_CONTENTBROKER_HXX +#include <ucbhelper/contentbroker.hxx> +#endif + +#ifndef _UCBHELPER_CONFIGURATIONKEYS_HXX_ +#include <ucbhelper/configurationkeys.hxx> +#endif + using namespace padmin; using namespace rtl; using namespace cppu; @@ -150,11 +158,29 @@ void MyApp::Main() fprintf( stderr, "could not create service factory\n" ); #endif + /* + * Create UCB. + */ + Sequence< Any > aArgs( 2 ); + aArgs[ 0 ] <<= OUString::createFromAscii( UCB_CONFIGURATION_KEY1_LOCAL ); + aArgs[ 1 ] <<= OUString::createFromAscii( UCB_CONFIGURATION_KEY2_OFFICE ); + sal_Bool bSuccess = ::ucb::ContentBroker::initialize( xFactory, aArgs ); + +#ifdef DEBUG + if ( !bSuccess ) + fprintf( stderr, "Error creating UCB\n" ); +#endif + pPADialog = PADialog::Create( NULL , FALSE ); Application::SetDisplayName( pPADialog->GetText() ); pPADialog->Execute(); delete pPADialog; + /* + * clean up UCB + */ + ::ucb::ContentBroker::deinitialize(); + OString aTmp( OUStringToOString( aWriteRdbName, RTL_TEXTENCODING_ISO_8859_1 ) ); unlink( aTmp.getStr() ); } |