diff options
Diffstat (limited to 'fpicker')
173 files changed, 5800 insertions, 923 deletions
diff --git a/fpicker/inc/pch/precompiled_fpicker.cxx b/fpicker/inc/pch/precompiled_fpicker.cxx index 4ac04c6bddd8..b9e46626be11 100644 --- a/fpicker/inc/pch/precompiled_fpicker.cxx +++ b/fpicker/inc/pch/precompiled_fpicker.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -27,3 +28,4 @@ #include "precompiled_fpicker.hxx" +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/inc/pch/precompiled_fpicker.hxx b/fpicker/inc/pch/precompiled_fpicker.hxx index e98065b915b4..7ce2239423e0 100644 --- a/fpicker/inc/pch/precompiled_fpicker.hxx +++ b/fpicker/inc/pch/precompiled_fpicker.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -31,3 +32,4 @@ #include <tools/debug.hxx> #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/prj/build.lst b/fpicker/prj/build.lst index 1be09c5d8fd1..6b8fb2d9b21c 100644 --- a/fpicker/prj/build.lst +++ b/fpicker/prj/build.lst @@ -1,11 +1,14 @@ -fp fpicker : LIBXSLT:libxslt L10N:l10n rdbmaker svtools NULL +fp fpicker : LIBXSLT:libxslt TRANSLATIONS:translations rdbmaker svtools NULL fp fpicker\inc nmake - all fp_inc NULL fp fpicker\source\generic nmake - all fp_generic fp_inc NULL fp fpicker\source\office nmake - all fp_office fp_inc NULL +fp fpicker\source\odma nmake - w fp_odma NULL fp fpicker\source\unx\gnome nmake - u fp_gnome_filepicker fp_inc NULL fp fpicker\source\unx\kde4 nmake - u fp_kde4_filepicker fp_inc NULL +fp fpicker\source\unx\kde_unx nmake - u fp_unx_common fp_inc NULL +fp fpicker\source\unx\kde nmake - u fp_unx_kde_filepicker fp_inc NULL fp fpicker\source\aqua nmake - u fp_macosx_filepicker NULL fp fpicker\source\win32\filepicker nmake - w fp_win32_filepicker fp_inc NULL fp fpicker\source\win32\folderpicker nmake - w fp_win32_folderpicker fp_inc NULL fp fpicker\source\win32\misc nmake - w fp_win32_misc fp_win32_filepicker.w fp_win32_folderpicker.w fp_inc NULL -fp fpicker\util nmake - all fp_util fp_win32_filepicker.w fp_win32_misc.w fp_win32_folderpicker.w NULL +fp fpicker\util nmake - all fp_util fp_gnome_filepicker.u fp_unx_common.u fp_unx_kde_filepicker.u fp_win32_filepicker.w fp_win32_misc.w fp_win32_folderpicker.w NULL diff --git a/fpicker/prj/d.lst b/fpicker/prj/d.lst index 4fff0467fc87..ca6317eed4d7 100644 --- a/fpicker/prj/d.lst +++ b/fpicker/prj/d.lst @@ -4,15 +4,10 @@ mkdir: %COMMON_DEST%\bin%_EXT%\hid ..\%__SRC%\bin\f*.res %_DEST%\bin%_EXT%\ ..\%__SRC%\bin\f*.dll %_DEST%\bin%_EXT%\ +..\%__SRC%\bin\kdefilepicker %_DEST%\bin%_EXT%\kdefilepicker ..\%__SRC%\lib\f*.so %_DEST%\lib%_EXT%\ ..\%__SRC%\lib\*.dylib %_DEST%\lib%_EXT%\*.dylib ..\source\win32\filepicker\*.xml %_DEST%\xml%_EXT%\*.xml ..\source\win32\folderpicker\*.xml %_DEST%\xml%_EXT%\*.xml -..\%__SRC%\misc\fop.component %_DEST%\xml%_EXT%\fop.component -..\%__SRC%\misc\fpicker.component %_DEST%\xml%_EXT%\fpicker.component -..\%__SRC%\misc\fps.component %_DEST%\xml%_EXT%\fps.component -..\%__SRC%\misc\fps_aqua.component %_DEST%\xml%_EXT%\fps_aqua.component -..\%__SRC%\misc\fps_gnome.component %_DEST%\xml%_EXT%\fps_gnome.component -..\%__SRC%\misc\fps_kde4.component %_DEST%\xml%_EXT%\fps_kde4.component -..\%__SRC%\misc\fps_office.component %_DEST%\xml%_EXT%\fps_office.component +..\%__SRC%\misc\*.component %_DEST%\xml%_EXT%\*.component diff --git a/fpicker/source/aqua/AquaFilePickerDelegate.hxx b/fpicker/source/aqua/AquaFilePickerDelegate.hxx index e17defb2b712..21b7ede9a745 100644 --- a/fpicker/source/aqua/AquaFilePickerDelegate.hxx +++ b/fpicker/source/aqua/AquaFilePickerDelegate.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -55,3 +56,5 @@ class FilterHelper; @end #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/aqua/CFStringUtilities.cxx b/fpicker/source/aqua/CFStringUtilities.cxx index 14b87b0d8759..7d9293d7a1f1 100644 --- a/fpicker/source/aqua/CFStringUtilities.cxx +++ b/fpicker/source/aqua/CFStringUtilities.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -119,3 +120,5 @@ rtl::OUString CFURLRefToOUString(CFURLRef aUrlRef, InfoType info) return sResult; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/aqua/CFStringUtilities.hxx b/fpicker/source/aqua/CFStringUtilities.hxx index f742dde67081..578782b5567c 100644 --- a/fpicker/source/aqua/CFStringUtilities.hxx +++ b/fpicker/source/aqua/CFStringUtilities.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -159,3 +160,5 @@ inline void DBG_PRINT_EXIT(const char * classname, const char * methodname, cons } #endif //_CFSTRINGUTILITIES_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/aqua/ControlHelper.cxx b/fpicker/source/aqua/ControlHelper.cxx index 0df9c485f65b..a29abb7d24a2 100644 --- a/fpicker/source/aqua/ControlHelper.cxx +++ b/fpicker/source/aqua/ControlHelper.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -29,7 +30,7 @@ #include <com/sun/star/ui/dialogs/CommonFilePickerElementIds.hpp> #include <com/sun/star/ui/dialogs/ControlActions.hpp> #include <com/sun/star/ui/dialogs/TemplateDescription.hpp> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <vcl/svapp.hxx> #include "CFStringUtilities.hxx" #include "resourceprovider.hxx" @@ -85,7 +86,7 @@ ControlHelper::~ControlHelper() [m_pUserPane release]; } - for(std::list<NSControl *>::iterator control = m_aActiveControls.begin(); control != m_aActiveControls.end(); control++) { + for(std::list<NSControl *>::iterator control = m_aActiveControls.begin(); control != m_aActiveControls.end(); ++control) { NSControl* pControl = (*control); NSString* sLabelName = m_aMapListLabels[pControl]; if (sLabelName != nil) { @@ -168,7 +169,7 @@ void ControlHelper::enableControl( const sal_Int16 nControlId, const sal_Bool bE { DBG_PRINT_ENTRY(CLASS_NAME, __func__, "controlId", nControlId, "enable", bEnable); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if (nControlId == ExtendedFilePickerElementIds::CHECKBOX_PREVIEW) { OSL_TRACE(" preview checkbox cannot be changed"); @@ -196,7 +197,7 @@ OUString ControlHelper::getLabel( sal_Int16 nControlId ) { DBG_PRINT_ENTRY(CLASS_NAME, __func__, "controlId", nControlId); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; NSControl* pControl = getControl( nControlId ); @@ -225,7 +226,7 @@ void ControlHelper::setLabel( sal_Int16 nControlId, const NSString* aLabel ) { DBG_PRINT_ENTRY(CLASS_NAME, __func__, "controlId", nControlId, "label", aLabel); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; NSAutoreleasePool *pool = [NSAutoreleasePool new]; @@ -257,7 +258,7 @@ void ControlHelper::setValue( sal_Int16 nControlId, sal_Int16 nControlAction, co { DBG_PRINT_ENTRY(CLASS_NAME, __func__, "controlId", nControlId, "controlAction", nControlAction); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if (nControlId == ExtendedFilePickerElementIds::CHECKBOX_PREVIEW) { OSL_TRACE(" value for preview is unchangeable"); @@ -290,7 +291,7 @@ uno::Any ControlHelper::getValue( sal_Int16 nControlId, sal_Int16 nControlAction { DBG_PRINT_ENTRY(CLASS_NAME, __func__, "controlId", nControlId, "controlAction", nControlAction); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; uno::Any aRetval; NSControl* pControl = getControl( nControlId ); @@ -804,7 +805,7 @@ void ControlHelper::layoutControls() { DBG_PRINT_ENTRY(CLASS_NAME, __func__); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if (nil == m_pUserPane) { OSL_TRACE("no user pane to layout"); @@ -1017,3 +1018,5 @@ void ControlHelper::updateFilterUI() DBG_PRINT_EXIT(CLASS_NAME, __func__); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/aqua/ControlHelper.hxx b/fpicker/source/aqua/ControlHelper.hxx index c9a146c7532f..23dd79bc332f 100644 --- a/fpicker/source/aqua/ControlHelper.hxx +++ b/fpicker/source/aqua/ControlHelper.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -42,7 +43,8 @@ #include "AquaFilePickerDelegate.hxx" using namespace com::sun::star; -using namespace rtl; + +using ::rtl::OUString; class ControlHelper { @@ -193,3 +195,5 @@ private: }; #endif //_CONTROLHELPER_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/aqua/FPServiceInfo.hxx b/fpicker/source/aqua/FPServiceInfo.hxx index 66cff666db45..c3cb6b841b44 100644 --- a/fpicker/source/aqua/FPServiceInfo.hxx +++ b/fpicker/source/aqua/FPServiceInfo.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -48,3 +49,5 @@ #define FOLDER_PICKER_REGKEY_NAME "/com.sun.star.ui.dialogs.SalAquaFolderPicker/UNO/SERVICES/com.sun.star.ui.dialogs.AquaFolderPicker" #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/aqua/FPentry.cxx b/fpicker/source/aqua/FPentry.cxx index 5d5dc16c5d32..83e915bbb6ca 100644 --- a/fpicker/source/aqua/FPentry.cxx +++ b/fpicker/source/aqua/FPentry.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -25,27 +26,14 @@ * ************************************************************************/ -//---------------------------------------------- -// includes of other projects -//---------------------------------------------- - #include <cppuhelper/factory.hxx> #include <com/sun/star/container/XSet.hpp> -// #ifndef _OSL_DIAGNOSE_H_ -// #include <osl/diagnose.h> -// #endif #include "SalAquaFilePicker.hxx" #include "SalAquaFolderPicker.hxx" -// #ifndef _SV_SVAPP_HXX -// #include <vcl/svapp.hxx> -// #endif #include "FPServiceInfo.hxx" -//----------------------------------------------- -// namespace directives -//----------------------------------------------- using namespace ::rtl; using namespace ::com::sun::star::uno; @@ -56,9 +44,6 @@ using namespace ::cppu; using ::com::sun::star::ui::dialogs::XFilePicker; using ::com::sun::star::ui::dialogs::XFolderPicker; -//------------------------------------------------ -// -//------------------------------------------------ static Reference< XInterface > SAL_CALL createFileInstance( const Reference< XMultiServiceFactory >& rServiceManager ) @@ -111,7 +96,7 @@ void* SAL_CALL component_getFactory( { Sequence< OUString > aSNS( 1 ); aSNS.getArray( )[0] = - OUString::createFromAscii(FILE_PICKER_SERVICE_NAME); + OUString(RTL_CONSTASCII_USTRINGPARAM(FILE_PICKER_SERVICE_NAME)); xFactory = createSingleFactory( reinterpret_cast< XMultiServiceFactory* > ( pSrvManager ), @@ -123,7 +108,7 @@ void* SAL_CALL component_getFactory( { Sequence< OUString > aSNS( 1 ); aSNS.getArray( )[0] = - OUString::createFromAscii(FOLDER_PICKER_SERVICE_NAME); + OUString(RTL_CONSTASCII_USTRINGPARAM(FOLDER_PICKER_SERVICE_NAME)); xFactory = createSingleFactory( reinterpret_cast< XMultiServiceFactory* > ( pSrvManager ), @@ -143,3 +128,5 @@ void* SAL_CALL component_getFactory( } } // extern "C" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/aqua/FilterHelper.cxx b/fpicker/source/aqua/FilterHelper.cxx index 9c644326005e..c0a590977ca3 100644 --- a/fpicker/source/aqua/FilterHelper.cxx +++ b/fpicker/source/aqua/FilterHelper.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -27,12 +28,9 @@ #include <functional> #include <algorithm> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <vcl/svapp.hxx> -// #ifndef _OSL_DIAGNOSE_H_ -// #include <osl/diagnose.h> -// #endif #include "CFStringUtilities.hxx" #include "NSString_OOoAdditions.hxx" #include "NSURL_OOoAdditions.hxx" @@ -272,7 +270,7 @@ void FilterHelper::SetCurFilter( const rtl::OUString& rFilter ) { DBG_PRINT_ENTRY(CLASS_NAME, __func__, "filter", rFilter); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if(m_aCurrentFilter.equals(rFilter) == false) { @@ -319,7 +317,7 @@ void FilterHelper::appendFilter(const ::rtl::OUString& aTitle, const ::rtl::OUSt throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException ) { DBG_PRINT_ENTRY(CLASS_NAME, __func__, "title", aTitle, "filter", aFilterString); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if( FilterNameExists( aTitle ) ) { throw com::sun::star::lang::IllegalArgumentException(); @@ -361,7 +359,7 @@ throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno:: DBG_PRINT_ENTRY(CLASS_NAME, __func__, "title", OUStringToOString(sGroupTitle, RTL_TEXTENCODING_UTF8).getStr()); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; //add a separator if this is not the first group to be added sal_Bool bPrependSeparator = m_pFilterList != NULL; @@ -374,7 +372,7 @@ throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno:: // append the filter if (bPrependSeparator) { - rtl::OUString dash = rtl::OUString::createFromAscii("-"); + rtl::OUString dash(RTL_CONSTASCII_USTRINGPARAM("-")); OUStringList emptyList; m_pFilterList->push_back(FilterEntry(dash, emptyList)); } @@ -421,7 +419,7 @@ sal_Bool FilterHelper::filenameMatchesFilter(NSString* sFilename) { rtl::OUString aName = [sFilename OUString]; - rtl::OUString allMatcher = rtl::OUString::createFromAscii(".*"); + rtl::OUString allMatcher(RTL_CONSTASCII_USTRINGPARAM(".*")); for(OUStringList::iterator iter = suffixList.begin(); iter != suffixList.end(); iter++) { if (aName.matchIgnoreAsciiCase(*iter, aName.getLength() - (*iter).getLength()) || ((*iter).equals(allMatcher))) { return sal_True; @@ -543,3 +541,5 @@ OUStringList FilterHelper::getCurrentFilterSuffixList() { return retVal; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/aqua/FilterHelper.hxx b/fpicker/source/aqua/FilterHelper.hxx index 0c4e7562389d..8e8bcc4b6cf7 100644 --- a/fpicker/source/aqua/FilterHelper.hxx +++ b/fpicker/source/aqua/FilterHelper.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,36 +29,12 @@ #ifndef _FILTERHELPER_HXX_ #define _FILTERHELPER_HXX_ -// #ifndef _COM_SUN_STAR_UNO_TYPE_HXX_ -// #include <com/sun/star/uno/Type.hxx> -// #endif - -// #ifndef INCLUDED_CPPU_UNOTYPE_HXX -// #include <cppu/unotype.hxx> -// #endif - -// #ifndef _TYPELIB_TYPECLASS_H_ -// #include "typelib/typeclass.h" -// #endif - -// #ifndef _TYPELIB_TYPEDESCRIPTION_H_ -// #include "typelib/typedescription.h" -// #endif - #include <com/sun/star/beans/StringPair.hpp> #include <com/sun/star/uno/Sequence.hxx> -#ifndef _COM_SUN_STAR_LANG_ILLEGALARGUMENTEXCEPTION_HXX_ #include <com/sun/star/lang/IllegalArgumentException.hpp> -#endif -#ifndef _COM_SUN_STAR_UNO_RUNTIMEEXCEPTION_HXX_ #include <com/sun/star/uno/RuntimeException.hpp> -#endif - -// #ifndef _RTL_USTRING_H_ -// #include <rtl/ustring.hxx> -// #endif #include <list> #include <vector> @@ -158,3 +135,5 @@ private: }; #endif //_FILTERHELPER_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/aqua/NSString_OOoAdditions.hxx b/fpicker/source/aqua/NSString_OOoAdditions.hxx index 09c6029de126..65551d15f17e 100644 --- a/fpicker/source/aqua/NSString_OOoAdditions.hxx +++ b/fpicker/source/aqua/NSString_OOoAdditions.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -32,7 +33,6 @@ #import <Cocoa/Cocoa.h> #include <postmac.h> #include <rtl/ustring.hxx> -// #include <sal/types.h> //for Cocoa types @interface NSString (OOoAdditions) @@ -42,3 +42,5 @@ @end #endif // _NSSTRING_OOOADDITIONS_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/aqua/NSURL_OOoAdditions.hxx b/fpicker/source/aqua/NSURL_OOoAdditions.hxx index 31b55385e155..b5ef549ea51b 100644 --- a/fpicker/source/aqua/NSURL_OOoAdditions.hxx +++ b/fpicker/source/aqua/NSURL_OOoAdditions.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -46,3 +47,5 @@ NSString* resolveAlias( NSString* i_pSystemPath ); #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/aqua/SalAquaConstants.h b/fpicker/source/aqua/SalAquaConstants.h index 83d74c63fc09..7a1ecd353abe 100644 --- a/fpicker/source/aqua/SalAquaConstants.h +++ b/fpicker/source/aqua/SalAquaConstants.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ #ifndef _SALAQUACONSTANTS_H_ #define _SALAQUACONSTANTS_H_ -#define kAppFourCharCode 'OOo2' +#define kAppFourCharCode 'LibO' #define kControlPropertyTracking 'Trck' #define kControlPropertyLastPartCode 'LsPc' #define kControlPropertySubType 'SuTy' @@ -61,3 +62,4 @@ #endif //_SALAQUACONSTANTS_H_ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/aqua/SalAquaFilePicker.cxx b/fpicker/source/aqua/SalAquaFilePicker.cxx index 699997bd2dbe..12846f54caf3 100644 --- a/fpicker/source/aqua/SalAquaFilePicker.cxx +++ b/fpicker/source/aqua/SalAquaFilePicker.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -40,17 +41,13 @@ #include <com/sun/star/ui/dialogs/ControlActions.hpp> #include <com/sun/star/uno/Any.hxx> #include <FPServiceInfo.hxx> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <vcl/svapp.hxx> -#ifndef _TOOLS_URLOBJ_HXX #include <tools/urlobj.hxx> -#endif #include "resourceprovider.hxx" -#ifndef _SV_RC_H #include <tools/rc.hxx> -#endif #include <osl/file.hxx> #include "CFStringUtilities.hxx" #include "NSString_OOoAdditions.hxx" @@ -97,9 +94,9 @@ namespace uno::Sequence<rtl::OUString> SAL_CALL FilePicker_getSupportedServiceNames() { uno::Sequence<rtl::OUString> aRet(3); - aRet[0] = rtl::OUString::createFromAscii( "com.sun.star.ui.dialogs.FilePicker" ); - aRet[1] = rtl::OUString::createFromAscii( "com.sun.star.ui.dialogs.SystemFilePicker" ); - aRet[2] = rtl::OUString::createFromAscii( "com.sun.star.ui.dialogs.AquaFilePicker" ); + aRet[0] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.FilePicker" )); + aRet[1] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.SystemFilePicker" )); + aRet[2] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.AquaFilePicker" )); return aRet; } } @@ -146,7 +143,7 @@ void SAL_CALL SalAquaFilePicker::addFilePickerListener( const uno::Reference<XFi { DBG_PRINT_ENTRY(CLASS_NAME, __func__); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; m_xListener = xListener; DBG_PRINT_EXIT(CLASS_NAME, __func__); @@ -157,7 +154,7 @@ void SAL_CALL SalAquaFilePicker::removeFilePickerListener( const uno::Reference< { DBG_PRINT_ENTRY(CLASS_NAME, __func__); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; m_xListener.clear(); DBG_PRINT_EXIT(CLASS_NAME, __func__); @@ -171,7 +168,7 @@ void SAL_CALL SalAquaFilePicker::setTitle( const rtl::OUString& aTitle ) throw( { DBG_PRINT_ENTRY(CLASS_NAME, __func__, "title", aTitle); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; implsetTitle(aTitle); DBG_PRINT_EXIT(CLASS_NAME, __func__); @@ -181,7 +178,7 @@ sal_Int16 SAL_CALL SalAquaFilePicker::execute() throw( uno::RuntimeException ) { DBG_PRINT_ENTRY(CLASS_NAME, __func__); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; sal_Int16 retVal = 0; @@ -190,7 +187,6 @@ sal_Int16 SAL_CALL SalAquaFilePicker::execute() throw( uno::RuntimeException ) // if m_pDialog is nil after initialization, something must have gone wrong before // or there was no initialization (see issue http://www.openoffice.org/issues/show_bug.cgi?id=100214) if (m_pDialog == nil) { - //throw uno::RuntimeException(rtl::OUString::createFromAscii("The dialog was not properly initialized!"), static_cast< XFilePicker* >( this )); m_nDialogType = NAVIGATIONSERVICES_OPEN; } @@ -209,7 +205,7 @@ sal_Int16 SAL_CALL SalAquaFilePicker::execute() throw( uno::RuntimeException ) rtl::OUString ouName = [windowTitle OUString]; //a window title will typically be something like "Untitled1 - OpenOffice.org Writer" //but we only want the "Untitled1" part of it - sal_Int32 indexOfDash = ouName.indexOf(rtl::OUString::createFromAscii(" - ")); + sal_Int32 indexOfDash = ouName.indexOf(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" - "))); if (indexOfDash > -1) { m_sSaveFileName = ouName.copy(0,indexOfDash); if (m_sSaveFileName.getLength() > 0) { @@ -247,7 +243,7 @@ sal_Int16 SAL_CALL SalAquaFilePicker::execute() throw( uno::RuntimeException ) break; default: - throw uno::RuntimeException(rtl::OUString::createFromAscii("The dialog returned with an unknown result!"), static_cast< XFilePicker* >( this )); + throw uno::RuntimeException(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("The dialog returned with an unknown result!")), static_cast< XFilePicker* >( this )); break; } @@ -266,7 +262,7 @@ void SAL_CALL SalAquaFilePicker::setMultiSelectionMode( sal_Bool bMode ) throw( { DBG_PRINT_ENTRY(CLASS_NAME, __func__, "multiSelectable?", bMode); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if (m_nDialogType == NAVIGATIONSERVICES_OPEN) { [(NSOpenPanel*)m_pDialog setAllowsMultipleSelection:YES]; @@ -281,7 +277,7 @@ throw( uno::RuntimeException ) { DBG_PRINT_ENTRY(CLASS_NAME, __func__, "name", aName); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; m_sSaveFileName = aName; @@ -293,7 +289,7 @@ throw( lang::IllegalArgumentException, uno::RuntimeException ) { DBG_PRINT_ENTRY(CLASS_NAME, __func__, "directory", rDirectory); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; implsetDisplayDirectory(rDirectory); @@ -314,7 +310,7 @@ uno::Sequence<rtl::OUString> SAL_CALL SalAquaFilePicker::getFiles() throw( uno:: { DBG_PRINT_ENTRY(CLASS_NAME, __func__); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; // OSL_TRACE("starting work"); /* @@ -375,7 +371,7 @@ throw( lang::IllegalArgumentException, uno::RuntimeException ) { DBG_PRINT_ENTRY(CLASS_NAME, __func__); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; ensureFilterHelper(); m_pFilterHelper->appendFilter( aTitle, aFilter ); @@ -391,7 +387,7 @@ throw( lang::IllegalArgumentException, uno::RuntimeException ) OSL_TRACE( "Setting current filter to %s", OUStringToOString( aTitle, RTL_TEXTENCODING_UTF8 ).getStr() ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; ensureFilterHelper(); m_pFilterHelper->setCurrentFilter(aTitle); @@ -405,7 +401,7 @@ throw( lang::IllegalArgumentException, uno::RuntimeException ) rtl::OUString SAL_CALL SalAquaFilePicker::getCurrentFilter() throw( uno::RuntimeException ) { DBG_PRINT_ENTRY(CLASS_NAME, __func__); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; ensureFilterHelper(); @@ -422,7 +418,7 @@ void SAL_CALL SalAquaFilePicker::appendFilterGroup( const rtl::OUString& sGroupT throw( lang::IllegalArgumentException, uno::RuntimeException ) { DBG_PRINT_ENTRY(CLASS_NAME, __func__); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; ensureFilterHelper(); m_pFilterHelper->appendFilterGroup(sGroupTitle, aFilters); @@ -440,7 +436,7 @@ throw( uno::RuntimeException ) { DBG_PRINT_ENTRY(CLASS_NAME, __func__); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; m_pControlHelper->setValue(nControlId, nControlAction, rValue); @@ -477,7 +473,7 @@ throw( uno::RuntimeException ) { DBG_PRINT_ENTRY(CLASS_NAME, __func__); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; NSString* sLabel = [NSString stringWithOUString:aLabel]; m_pControlHelper->setLabel( nControlId, sLabel ) ; @@ -504,19 +500,19 @@ throw( uno::Exception, uno::RuntimeException ) { DBG_PRINT_ENTRY(CLASS_NAME, __func__, "arguments size", aArguments.getLength()); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; // parameter checking uno::Any aAny; if( 0 == aArguments.getLength() ) - throw lang::IllegalArgumentException(rtl::OUString::createFromAscii( "no arguments" ), + throw lang::IllegalArgumentException(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "no arguments" )), static_cast<XFilePicker*>( this ), 1 ); aAny = aArguments[0]; if( ( aAny.getValueType() != ::getCppuType( ( sal_Int16* )0 ) ) && (aAny.getValueType() != ::getCppuType( ( sal_Int8* )0 ) ) ) - throw lang::IllegalArgumentException(rtl::OUString::createFromAscii( "invalid argument type" ), + throw lang::IllegalArgumentException(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "invalid argument type" )), static_cast<XFilePicker*>( this ), 1 ); sal_Int16 templateId = -1; @@ -569,7 +565,7 @@ throw( uno::Exception, uno::RuntimeException ) OSL_TRACE( "Template: FILESAVE_AUTOEXTENSION" ); break; default: - throw lang::IllegalArgumentException(rtl::OUString::createFromAscii( "Unknown template" ), + throw lang::IllegalArgumentException(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Unknown template" )), static_cast< XFilePicker* >( this ), 1 ); } @@ -590,7 +586,7 @@ void SAL_CALL SalAquaFilePicker::cancel() throw( uno::RuntimeException ) { DBG_PRINT_ENTRY(CLASS_NAME, __func__); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if (m_pDialog != nil) { [m_pDialog cancel:nil]; @@ -608,7 +604,7 @@ void SAL_CALL SalAquaFilePicker::disposing( const lang::EventObject& aEvent ) th { DBG_PRINT_ENTRY(CLASS_NAME, __func__); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; uno::Reference<XFilePickerListener> xFilePickerListener( aEvent.Source, ::com::sun::star::uno::UNO_QUERY ); @@ -628,7 +624,7 @@ throw( uno::RuntimeException ) { DBG_PRINT_ENTRY(CLASS_NAME, __func__); - rtl::OUString retVal = rtl::OUString::createFromAscii( FILE_PICKER_IMPL_NAME ); + rtl::OUString retVal(RTL_CONSTASCII_USTRINGPARAM( FILE_PICKER_IMPL_NAME )); DBG_PRINT_EXIT(CLASS_NAME, __func__, retVal); @@ -726,7 +722,7 @@ case ExtendedFilePickerElementIds::LISTBOX_##elem##_LABEL: \ void SalAquaFilePicker::ensureFilterHelper() { DBG_PRINT_ENTRY(CLASS_NAME, __func__); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if (NULL == m_pFilterHelper) { m_pFilterHelper = new FilterHelper; @@ -765,7 +761,7 @@ void SalAquaFilePicker::updateSaveFileNameExtension() { // we need to set this here again because initial setting does //[m_pDialog setExtensionHidden:YES]; - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if (m_pControlHelper->isAutoExtensionEnabled() == false) { OSL_TRACE("allowing other file types"); @@ -797,7 +793,7 @@ void SalAquaFilePicker::filterControlChanged() { return; } - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; updateSaveFileNameExtension(); @@ -810,3 +806,4 @@ void SalAquaFilePicker::filterControlChanged() { DBG_PRINT_EXIT(CLASS_NAME, __func__); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/aqua/SalAquaFilePicker.hxx b/fpicker/source/aqua/SalAquaFilePicker.hxx index 60795d87dec9..54b85a651e6e 100644 --- a/fpicker/source/aqua/SalAquaFilePicker.hxx +++ b/fpicker/source/aqua/SalAquaFilePicker.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -42,16 +43,12 @@ #include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp> #include <com/sun/star/beans/StringPair.hpp> -#ifndef _SALAQUAPICKER_HXX_ #include "SalAquaPicker.hxx" -#endif #include <memory> #include <list> -#ifndef _RTL_USTRING_H_ #include <rtl/ustring.hxx> -#endif #include "FilterHelper.hxx" #include "AquaFilePickerDelegate.hxx" @@ -62,8 +59,7 @@ //---------------------------------------------------------- // forward declarations //---------------------------------------------------------- - -using namespace rtl; +using ::rtl::OUString; //---------------------------------------------------------- // class declaration @@ -250,3 +246,5 @@ public: }; #endif // _SALAQUAFILEPICKER_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/aqua/SalAquaFolderPicker.cxx b/fpicker/source/aqua/SalAquaFolderPicker.cxx index 60857e47c6c3..7f269ec2b3c4 100644 --- a/fpicker/source/aqua/SalAquaFolderPicker.cxx +++ b/fpicker/source/aqua/SalAquaFolderPicker.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -40,7 +41,7 @@ #include <com/sun/star/ui/dialogs/TemplateDescription.hpp> #include <com/sun/star/uno/Any.hxx> #include <FPServiceInfo.hxx> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <vcl/svapp.hxx> #include "SalAquaFolderPicker.hxx" @@ -49,9 +50,7 @@ #include "resourceprovider.hxx" -#ifndef _SV_RC_H #include <tools/rc.hxx> -#endif #include <osl/file.hxx> #include "CFStringUtilities.hxx" @@ -81,8 +80,8 @@ namespace uno::Sequence<rtl::OUString> SAL_CALL FolderPicker_getSupportedServiceNames() { uno::Sequence<rtl::OUString> aRet(2); - aRet[0] = rtl::OUString::createFromAscii( "com.sun.star.ui.dialogs.SystemFolderPicker" ); - aRet[1] = rtl::OUString::createFromAscii( "com.sun.star.ui.dialogs.AquaFolderPicker" ); + aRet[0] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.SystemFolderPicker" )); + aRet[1] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.AquaFolderPicker" )); return aRet; } } @@ -108,7 +107,7 @@ void SAL_CALL SalAquaFolderPicker::setTitle( const rtl::OUString& aTitle ) throw { DBG_PRINT_ENTRY(CLASS_NAME, __func__, "title", aTitle); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; implsetTitle(aTitle); @@ -119,7 +118,7 @@ sal_Int16 SAL_CALL SalAquaFolderPicker::execute() throw( uno::RuntimeException ) { DBG_PRINT_ENTRY(CLASS_NAME, __func__); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; sal_Int16 retVal = 0; @@ -138,7 +137,7 @@ sal_Int16 SAL_CALL SalAquaFolderPicker::execute() throw( uno::RuntimeException ) break; default: - throw uno::RuntimeException(rtl::OUString::createFromAscii("The dialog returned with an unknown result!"), static_cast< XFolderPicker* >( this )); + throw uno::RuntimeException(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("The dialog returned with an unknown result!")), static_cast< XFolderPicker* >( this )); break; } @@ -155,7 +154,7 @@ void SAL_CALL SalAquaFolderPicker::setDisplayDirectory( const rtl::OUString& aDi { DBG_PRINT_ENTRY(CLASS_NAME, __func__, "directory", aDirectory); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; implsetDisplayDirectory(aDirectory); @@ -166,7 +165,7 @@ rtl::OUString SAL_CALL SalAquaFolderPicker::getDisplayDirectory() throw( uno::Ru { DBG_PRINT_ENTRY(CLASS_NAME, __func__); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; OUString aDirectory = implgetDisplayDirectory(); @@ -179,7 +178,7 @@ rtl::OUString SAL_CALL SalAquaFolderPicker::getDirectory() throw( uno::RuntimeEx { DBG_PRINT_ENTRY(CLASS_NAME, __func__); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; NSArray *files = nil; if (m_nDialogType == NAVIGATIONSERVICES_DIRECTORY) { @@ -190,7 +189,7 @@ rtl::OUString SAL_CALL SalAquaFolderPicker::getDirectory() throw( uno::RuntimeEx OSL_TRACE("# of items: %d", nFiles); if (nFiles < 1) { - throw uno::RuntimeException(rtl::OUString::createFromAscii("no directory selected"), static_cast< XFolderPicker* >( this )); + throw uno::RuntimeException(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("no directory selected")), static_cast< XFolderPicker* >( this )); } rtl::OUString aDirectory; @@ -227,7 +226,7 @@ rtl::OUString SAL_CALL SalAquaFolderPicker::getImplementationName() { DBG_PRINT_ENTRY(CLASS_NAME, __func__); - rtl::OUString retVal = rtl::OUString::createFromAscii( FOLDER_PICKER_IMPL_NAME ); + rtl::OUString retVal(RTL_CONSTASCII_USTRINGPARAM( FOLDER_PICKER_IMPL_NAME )); DBG_PRINT_EXIT(CLASS_NAME, __func__, retVal); @@ -270,7 +269,7 @@ void SAL_CALL SalAquaFolderPicker::cancel() throw( uno::RuntimeException ) { DBG_PRINT_ENTRY(CLASS_NAME, __func__); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; [m_pDialog cancel:nil]; @@ -287,3 +286,5 @@ void SAL_CALL SalAquaFolderPicker::disposing( const lang::EventObject& ) DBG_PRINT_ENTRY(CLASS_NAME, __func__); DBG_PRINT_EXIT(CLASS_NAME, __func__); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/aqua/SalAquaFolderPicker.hxx b/fpicker/source/aqua/SalAquaFolderPicker.hxx index b7529a11e34f..8cd643e24029 100644 --- a/fpicker/source/aqua/SalAquaFolderPicker.hxx +++ b/fpicker/source/aqua/SalAquaFolderPicker.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -32,26 +33,18 @@ // includes of other projects //_______________________________________________________________________________________________________________________ -#ifndef _CPPUHELPER_COMPBASE4_HXX_ #include <cppuhelper/implbase4.hxx> -#endif #include <com/sun/star/util/XCancellable.hpp> #include <com/sun/star/lang/XEventListener.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> -#ifndef _COM_SUN_STAR_UI_XFOLDERPICKER_HPP_ #include <com/sun/star/ui/dialogs/XFolderPicker.hpp> -#endif -#ifndef _SALAQUAPICKER_HXX_ #include "SalAquaPicker.hxx" -#endif #include <memory> -#ifndef _RTL_USTRING_H_ #include <rtl/ustring.hxx> -#endif #include <list> @@ -136,3 +129,5 @@ private: }; #endif // _SALAQUAFOLDERPICKER_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/aqua/SalAquaPicker.cxx b/fpicker/source/aqua/SalAquaPicker.cxx index 1a4132f23ea5..43962a30d3d5 100644 --- a/fpicker/source/aqua/SalAquaPicker.cxx +++ b/fpicker/source/aqua/SalAquaPicker.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -35,19 +36,15 @@ #include <osl/diagnose.h> #include <com/sun/star/uno/Any.hxx> #include <FPServiceInfo.hxx> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <vcl/svapp.hxx> -#ifndef _SALAQUAPICKER_HXX_ #include "SalAquaPicker.hxx" -#endif #include <tools/urlobj.hxx> #include <osl/file.hxx> #include "CFStringUtilities.hxx" #include "NSString_OOoAdditions.hxx" -#ifndef _NSURL_OOOADDITIONS_HXX_ #include "NSURL_OOoAdditions.hxx" -#endif #include "SalAquaFilePicker.hxx" @@ -79,7 +76,7 @@ SalAquaPicker::~SalAquaPicker() { DBG_PRINT_ENTRY(CLASS_NAME, __func__); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; NSAutoreleasePool *pool = [NSAutoreleasePool new]; @@ -98,7 +95,7 @@ void SAL_CALL SalAquaPicker::implInitialize() { DBG_PRINT_ENTRY(CLASS_NAME, __func__); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if (m_pDialog != nil) { return; @@ -162,7 +159,7 @@ int SalAquaPicker::run() { DBG_PRINT_ENTRY(CLASS_NAME, __func__); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; NSAutoreleasePool *pool = [NSAutoreleasePool new]; @@ -222,7 +219,7 @@ int SalAquaPicker::runandwaitforresult() { DBG_PRINT_ENTRY(CLASS_NAME, __func__); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; int status = this->run(); @@ -235,7 +232,7 @@ void SAL_CALL SalAquaPicker::implsetDisplayDirectory( const rtl::OUString& aDire { DBG_PRINT_ENTRY(CLASS_NAME, __func__, "directory", aDirectory); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if (aDirectory != m_sDisplayDirectory) { m_sDisplayDirectory = aDirectory; @@ -256,7 +253,7 @@ void SAL_CALL SalAquaPicker::implsetTitle( const rtl::OUString& aTitle ) throw( { DBG_PRINT_ENTRY(CLASS_NAME, __func__, "title", aTitle); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if (m_pDialog != nil) { [m_pDialog setTitle:[NSString stringWithOUString:aTitle]]; @@ -265,3 +262,4 @@ void SAL_CALL SalAquaPicker::implsetTitle( const rtl::OUString& aTitle ) throw( DBG_PRINT_EXIT(CLASS_NAME, __func__); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/aqua/SalAquaPicker.hxx b/fpicker/source/aqua/SalAquaPicker.hxx index be22ffddf063..001dac2d7d92 100644 --- a/fpicker/source/aqua/SalAquaPicker.hxx +++ b/fpicker/source/aqua/SalAquaPicker.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -34,17 +35,11 @@ #include <osl/mutex.hxx> -#ifndef _RTL_USTRING_HXX #include <rtl/ustring.hxx> -#endif -#ifndef _COM_SUN_STAR_LANG_ILLEGALARGUMENTEXCEPTION_HXX_ #include <com/sun/star/lang/IllegalArgumentException.hpp> -#endif -#ifndef _COM_SUN_STAR_UNO_RUNTIMEEXCEPTION_HXX_ #include <com/sun/star/uno/RuntimeException.hpp> -#endif #include "ControlHelper.hxx" #include <premac.h> @@ -104,3 +99,5 @@ protected: }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/aqua/resourceprovider.cxx b/fpicker/source/aqua/resourceprovider.cxx index 51985208c7ed..bc821ec4730a 100644 --- a/fpicker/source/aqua/resourceprovider.cxx +++ b/fpicker/source/aqua/resourceprovider.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -31,19 +32,15 @@ #include <osl/diagnose.h> #include <rtl/ustrbuf.hxx> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <vcl/svapp.hxx> #include <tools/resmgr.hxx> #include <com/sun/star/ui/dialogs/CommonFilePickerElementIds.hpp> #include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp> -#ifndef _SVTOOLS_SVTOOLS_HRC_ #include <svtools/svtools.hrc> -#endif -#ifndef _SVTOOLS_FILEDLG2_HRC_ #include <svtools/filedlg2.hrc> -#endif #include "NSString_OOoAdditions.hxx" #include "resourceprovider.hxx" @@ -98,8 +95,8 @@ _Entry OtherCtrlIdToResIdTable[] = { }; -const sal_Int32 SIZE_TABLE = sizeof( CtrlIdToResIdTable ) / sizeof( _Entry ); -const sal_Int32 OTHER_SIZE_TABLE = sizeof( OtherCtrlIdToResIdTable ) / sizeof( _Entry ); +const sal_Int32 SIZE_TABLE = SAL_N_ELEMENTS( CtrlIdToResIdTable ); +const sal_Int32 OTHER_SIZE_TABLE = SAL_N_ELEMENTS( OtherCtrlIdToResIdTable ); //------------------------------------------------------------ // @@ -174,7 +171,7 @@ public: String aResString; OUString aResOUString; - const ::vos::OGuard aGuard( Application::GetSolarMutex() ); + const SolarMutexGuard aGuard; try { @@ -238,3 +235,5 @@ NSString* CResourceProvider::getResString( sal_Int32 aId ) return result; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/aqua/resourceprovider.hxx b/fpicker/source/aqua/resourceprovider.hxx index 66323e9a08e5..6300def58f07 100644 --- a/fpicker/source/aqua/resourceprovider.hxx +++ b/fpicker/source/aqua/resourceprovider.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -65,3 +66,5 @@ private: }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/generic/fpicker.cxx b/fpicker/source/generic/fpicker.cxx index 7d6417099ae0..f25fbdb062e1 100644 --- a/fpicker/source/generic/fpicker.cxx +++ b/fpicker/source/generic/fpicker.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,15 +31,19 @@ #include "sal/types.h" #include "rtl/ustring.hxx" -#ifndef _CPPUHELPER_IMPLEMENTATIONENTRY_HXX_ #include "cppuhelper/implementationentry.hxx" -#endif #include "com/sun/star/lang/XMultiComponentFactory.hpp" + #include "svtools/miscopt.hxx" #include "svl/pickerhistoryaccess.hxx" -#ifndef _SV_APP_HXX #include "vcl/svapp.hxx" + +#ifdef WNT +#define GradientStyle_RECT BLA_GradientStyle_RECT +#include <windows.h> +#undef GradientStyle_RECT +#include <odma_lib.hxx> #endif namespace css = com::sun::star; @@ -52,6 +57,7 @@ using rtl::OUString; */ static OUString FilePicker_getSystemPickerServiceName() { +#ifdef UNX OUString aDesktopEnvironment (Application::GetDesktopEnvironment()); if (aDesktopEnvironment.equalsIgnoreAsciiCaseAscii ("gnome")) return OUString (RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.ui.dialogs.GtkFilePicker")); @@ -61,8 +67,14 @@ static OUString FilePicker_getSystemPickerServiceName() return OUString (RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.ui.dialogs.KDE4FilePicker")); else if (aDesktopEnvironment.equalsIgnoreAsciiCaseAscii ("macosx")) return OUString (RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.ui.dialogs.AquaFilePicker")); - else - return OUString (RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.ui.dialogs.SystemFilePicker")); +#endif +#ifdef WNT + if (SvtMiscOptions().TryODMADialog() && ::odma::DMSsAvailable()) { + return OUString (RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.ui.dialogs.ODMAFilePicker")); + } + return OUString (RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.ui.dialogs.Win32FilePicker")); +#endif + return OUString (RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.ui.dialogs.SystemFilePicker")); } static Reference< css::uno::XInterface > FilePicker_createInstance ( @@ -123,14 +135,20 @@ static Sequence< OUString > FilePicker_getSupportedServiceNames() static OUString FolderPicker_getSystemPickerServiceName() { OUString aDesktopEnvironment (Application::GetDesktopEnvironment()); +#ifdef UNX if (aDesktopEnvironment.equalsIgnoreAsciiCaseAscii ("gnome")) return OUString (RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.ui.dialogs.GtkFolderPicker")); else if (aDesktopEnvironment.equalsIgnoreAsciiCaseAscii ("kde")) return OUString (RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.ui.dialogs.KDEFolderPicker")); else if (aDesktopEnvironment.equalsIgnoreAsciiCaseAscii ("macosx")) return OUString (RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.ui.dialogs.AquaFolderPicker")); - else - return OUString (RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.ui.dialogs.SystemFolderPicker")); +#endif +#ifdef WNT + if (SvtMiscOptions().TryODMADialog() && ::odma::DMSsAvailable()) { + return OUString (RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.ui.dialogs.ODMAFolderPicker")); + } +#endif + return OUString (RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.ui.dialogs.SystemFolderPicker")); } static Reference< css::uno::XInterface > FolderPicker_createInstance ( @@ -224,3 +242,5 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory ( } } // extern "C" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/generic/makefile.mk b/fpicker/source/generic/makefile.mk index 0b2ad77baac6..29f900ac41da 100644 --- a/fpicker/source/generic/makefile.mk +++ b/fpicker/source/generic/makefile.mk @@ -46,6 +46,7 @@ SHL1TARGET= $(TARGET) SHL1IMPLIB= i$(TARGET) SHL1OBJS= $(SLOFILES) SHL1STDLIBS=\ + $(ODMA_LIB_LIB) \ $(VCLLIB) \ $(SVLLIB) \ $(SVTOOLLIB) \ diff --git a/fpicker/source/odma/ODMAFilePicker.cxx b/fpicker/source/odma/ODMAFilePicker.cxx new file mode 100644 index 000000000000..0e611262b8c3 --- /dev/null +++ b/fpicker/source/odma/ODMAFilePicker.cxx @@ -0,0 +1,549 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * Copyright 2010 Novell, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_fpicker.hxx" + +#include "ODMAFilePicker.hxx" + +#include <tools/debug.hxx> + +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/beans/StringPair.hpp> +#include <com/sun/star/ui/dialogs/FilePreviewImageFormats.hpp> +#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp> +#include <com/sun/star/ui/dialogs/TemplateDescription.hpp> +#include <com/sun/star/ucb/XCommandEnvironment.hpp> +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Sequence.hxx> + +#include <comphelper/sequence.hxx> +#include <cppuhelper/typeprovider.hxx> +#include <ucbhelper/content.hxx> +#include <unotools/ucbhelper.hxx> + +#ifndef ODMA_LIB_HXX +#include <windows.h> +#include <odma_lib.hxx> +#endif + +// using ---------------------------------------------------------------- + +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::ui::dialogs; +using namespace ::com::sun::star::ucb; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::util; +using namespace ::utl; + +//------------------------------------------------------------------------------------ +// class ODMAFilePicker +//------------------------------------------------------------------------------------ +ODMAFilePicker::ODMAFilePicker( const Reference < XMultiServiceFactory >& xFactory ) : + cppu::WeakComponentImplHelper9< + XFilterManager, + XFilterGroupManager, + XFilePickerControlAccess, + XFilePickerNotifier, + XFilePreview, + XInitialization, + XCancellable, + XEventListener, + XServiceInfo>( m_rbHelperMtx ), + m_bMultiSelectionMode( sal_False ), + m_aDefaultName( ), + m_aFiles( ), + m_nDialogKind( OPEN ) +{ + m_bUseDMS = ::odma::DMSsAvailable(); + m_xSystemFilePicker = xFactory->createInstance( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.Win32FilePicker" ) )); +} + +// XExecutableDialog functions + +void SAL_CALL ODMAFilePicker::setTitle( const ::rtl::OUString& aTitle ) + throw (RuntimeException) +{ + Reference< XExecutableDialog > xExecutableDialog( m_xSystemFilePicker, UNO_QUERY ); + xExecutableDialog->setTitle( aTitle); +} + +inline bool is_current_process_window(HWND hwnd) +{ + DWORD pid; + GetWindowThreadProcessId(hwnd, &pid); + return (pid == GetCurrentProcessId()); +} + +HWND choose_parent_window() +{ + HWND hwnd_parent = GetForegroundWindow(); + if (!is_current_process_window(hwnd_parent)) + hwnd_parent = GetDesktopWindow(); + return hwnd_parent; +} + +sal_Int16 SAL_CALL ODMAFilePicker::execute( ) + throw (RuntimeException) +{ + ODMSTATUS status; + ODMHANDLE handle; + WORD count = 0; + DWORD flags; + + status = NODMRegisterApp( &handle, ODM_API_VERSION, "sodma", (DWORD) choose_parent_window( ), NULL ); + if (status == ODM_SUCCESS) + { + if (m_nDialogKind == OPEN) + { + const int MAXDOCS = 10; + char docids[ODM_DOCID_MAX*MAXDOCS+1]; + WORD docidslen = sizeof( docids ); + + flags = 0; + if (m_bMultiSelectionMode) + count = MAXDOCS; + else + count = 1; + status = NODMSelectDocEx( handle, docids, &docidslen, &count, &flags, NULL ); + if (status == ODM_SUCCESS) + { + // GroupWise doesn't set docidslen or count, so + // calculate number of document IDs manually + char *p = docids; + count = 0; + while (*p) { + count++; + p += strlen( p ) + 1; + } + } + else if (status == ODM_E_NOSUPPORT) + { + status = NODMSelectDoc( handle, docids, &flags ); + if (status == ODM_SUCCESS) + count = 1; + } + NODMUnRegisterApp( handle ); + if (status == ODM_SUCCESS) + { + rtl::OUString *strings = new rtl::OUString[count]; + int i; + char *p = docids; + + for (i = 0; i < count; i++) { + // Insane API... the first element is a full URI, the rest + // are just the "basenames" in the same "directory". + if (i == 0) + strings[0] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.odma:/" )) + rtl::OUString::createFromAscii( p ); + else + strings[i] = rtl::OUString::createFromAscii( p ); + p += strlen( p ); + } + + m_aFiles = Sequence< rtl::OUString >( strings, count ); + delete[] strings; + return ExecutableDialogResults::OK; + } + } + else /* m_nDialogKind == SAVE */ + { + char newdocid[ODM_DOCID_MAX+1]; + + if (m_aDefaultName.getLength() == 0 || + !m_aDefaultName.matchIgnoreAsciiCaseAsciiL( "::ODMA\\", 7, 0 )) + { + char tempdocid[ODM_DOCID_MAX+1]; + + status = NODMNewDoc( handle, tempdocid, ODM_SILENT, NULL, NULL ); + if (status == ODM_SUCCESS) + status = NODMSaveAs( handle, tempdocid, newdocid, NULL, NULL, NULL ); + } + else + { + rtl::OString sDefaultName = rtl::OUStringToOString( m_aDefaultName, RTL_TEXTENCODING_ASCII_US ); + status = NODMSaveAs( handle, + const_cast<sal_Char*>( sDefaultName.getStr() ), + newdocid, NULL, NULL, NULL ); + } + + NODMUnRegisterApp( handle ); + if (status == ODM_SUCCESS) + { + rtl::OUString s( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.odma:/" )) + + rtl::OUString::createFromAscii( newdocid ) ); + // Create a Content for the odma URL so that + // odma::ContentProvider will learn about the DOCID we + // just created. + ucbhelper::Content content( s, Reference< XCommandEnvironment >() ); + m_aFiles = Sequence< rtl::OUString >( &s, 1 ); + return ExecutableDialogResults::OK; + } + } + } + if (status == ODM_E_APPSELECT) + { + m_bUseDMS = sal_False; + + Reference< XExecutableDialog > xExecutableDialog( m_xSystemFilePicker, UNO_QUERY ); + return xExecutableDialog->execute(); + } + + // Fallback + return ExecutableDialogResults::CANCEL; +} + +// XFilePicker functions + +void SAL_CALL ODMAFilePicker::setMultiSelectionMode( sal_Bool bMode ) + throw( RuntimeException ) +{ + m_bMultiSelectionMode = bMode; + + Reference< XFilePicker > xFilePicker( m_xSystemFilePicker, UNO_QUERY ); + xFilePicker->setMultiSelectionMode( bMode ); +} + +void SAL_CALL ODMAFilePicker::setDefaultName( const rtl::OUString& aName ) + throw( RuntimeException ) +{ + // When editing a document from DMS, and doing Save As, this is + // called twice, first with the complete DOCID, the second time + // with the "extension" removed. Of course, this is bogus, as + // DOCIDs should be treated as opaque strings, they don't have + // "extensions". + + // In the GroupWise case a DOCID is like + // ::ODMA\GRPWISE\FOO1.BAR.FOO-Bla_bla:12345.12 where the final + // dot separates the version number, not an "extension". + // + // So ignore the second call. + // + // The second call without "extension" is done if the + // XFilePickerControlAccess is set to have auto-extension turned + // on. (See sfx2/source/dialog/filedlghelper.cxx: + // FileDialogHelper_Impl::implInitializeFileName().) Thus we could + // alternatively make sure that a getValue call to get + // ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION returns + // false. But that might be hard as we don't know in advance + // whether the user will click the "use application dialog" + // button. If so, we indeed do use auto-extensions. + // + // Yes, this is ugly, relying on knowing details on how this + // function will be called. + + if ( m_aDefaultName.getLength() == 0 ) + m_aDefaultName = aName; + + Reference< XFilePicker > xFilePicker( m_xSystemFilePicker, UNO_QUERY ); + xFilePicker->setDefaultName( aName ); +} + +void SAL_CALL ODMAFilePicker::setDisplayDirectory( const rtl::OUString& aDirectory ) + throw( IllegalArgumentException, RuntimeException ) +{ + m_aDisplayDirectory = aDirectory; + + Reference< XFilePicker > xFilePicker( m_xSystemFilePicker, UNO_QUERY ); + xFilePicker->setDisplayDirectory( aDirectory ); +} + +rtl::OUString SAL_CALL ODMAFilePicker::getDisplayDirectory( ) + throw( RuntimeException ) +{ + if (m_bUseDMS) + return m_aDisplayDirectory; + + Reference< XFilePicker > xFilePicker( m_xSystemFilePicker, UNO_QUERY ); + return xFilePicker->getDisplayDirectory(); +} + +Sequence< rtl::OUString > SAL_CALL ODMAFilePicker::getFiles( ) + throw( RuntimeException ) +{ + if (m_bUseDMS) + return m_aFiles; + + Reference< XFilePicker > xFilePicker( m_xSystemFilePicker, UNO_QUERY ); + return xFilePicker->getFiles(); +} + +// XFilePickerControlAccess functions + +void SAL_CALL ODMAFilePicker::setValue( sal_Int16 nElementID, + sal_Int16 nControlAction, + const Any& rValue ) + throw( RuntimeException ) +{ + Reference< XFilePickerControlAccess > xFilePickerControlAccess( m_xSystemFilePicker, UNO_QUERY ); + xFilePickerControlAccess->setValue( nElementID, nControlAction, rValue ); +} + +Any SAL_CALL ODMAFilePicker::getValue( sal_Int16 nElementID, sal_Int16 nControlAction ) + throw( RuntimeException ) +{ + Reference< XFilePickerControlAccess > xFilePickerControlAccess( m_xSystemFilePicker, UNO_QUERY ); + return xFilePickerControlAccess->getValue( nElementID, nControlAction ); +} + +void SAL_CALL ODMAFilePicker::setLabel( sal_Int16 nLabelID, const rtl::OUString& rValue ) + throw ( RuntimeException ) +{ + Reference< XFilePickerControlAccess > xFilePickerControlAccess( m_xSystemFilePicker, UNO_QUERY ); + xFilePickerControlAccess->setLabel( nLabelID, rValue ); +} + +rtl::OUString SAL_CALL ODMAFilePicker::getLabel( sal_Int16 nLabelID ) + throw ( RuntimeException ) +{ + Reference< XFilePickerControlAccess > xFilePickerControlAccess( m_xSystemFilePicker, UNO_QUERY ); + return xFilePickerControlAccess->getLabel( nLabelID ); +} + +void SAL_CALL ODMAFilePicker::enableControl( sal_Int16 nElementID, sal_Bool bEnable ) + throw( RuntimeException ) +{ + Reference< XFilePickerControlAccess > xFilePickerControlAccess( m_xSystemFilePicker, UNO_QUERY ); + xFilePickerControlAccess->enableControl( nElementID, bEnable ); +} + +// XFilePickerNotifier functions + +void SAL_CALL ODMAFilePicker::addFilePickerListener( const Reference< XFilePickerListener >& xListener ) + throw ( RuntimeException ) +{ + Reference< XFilePickerNotifier > xFilePickerNotifier( m_xSystemFilePicker, UNO_QUERY ); + xFilePickerNotifier->addFilePickerListener( xListener ); +} + +void SAL_CALL ODMAFilePicker::removeFilePickerListener( const Reference< XFilePickerListener >& xListener ) + throw ( RuntimeException ) +{ + Reference< XFilePickerNotifier > xFilePickerNotifier( m_xSystemFilePicker, UNO_QUERY ); + xFilePickerNotifier->removeFilePickerListener( xListener ); +} + +// XFilePreview functions + +Sequence< sal_Int16 > SAL_CALL ODMAFilePicker::getSupportedImageFormats( ) + throw ( RuntimeException ) +{ + Reference< XFilePreview > xFilePreview( m_xSystemFilePicker, UNO_QUERY ); + return xFilePreview->getSupportedImageFormats(); +} + +sal_Int32 SAL_CALL ODMAFilePicker::getTargetColorDepth( ) + throw ( RuntimeException ) +{ + Reference< XFilePreview > xFilePreview( m_xSystemFilePicker, UNO_QUERY ); + return xFilePreview->getTargetColorDepth(); +} + +sal_Int32 SAL_CALL ODMAFilePicker::getAvailableWidth( ) + throw ( RuntimeException ) +{ + Reference< XFilePreview > xFilePreview( m_xSystemFilePicker, UNO_QUERY ); + return xFilePreview->getAvailableWidth(); +} + +sal_Int32 SAL_CALL ODMAFilePicker::getAvailableHeight( ) + throw ( RuntimeException ) +{ + Reference< XFilePreview > xFilePreview( m_xSystemFilePicker, UNO_QUERY ); + return xFilePreview->getAvailableHeight(); +} + +void SAL_CALL ODMAFilePicker::setImage( sal_Int16 aImageFormat, const Any& rImage ) + throw ( IllegalArgumentException, RuntimeException ) +{ + Reference< XFilePreview > xFilePreview( m_xSystemFilePicker, UNO_QUERY ); + xFilePreview->setImage( aImageFormat, rImage); +} + +sal_Bool SAL_CALL ODMAFilePicker::setShowState( sal_Bool bShowState ) + throw ( RuntimeException ) +{ + Reference< XFilePreview > xFilePreview( m_xSystemFilePicker, UNO_QUERY ); + return xFilePreview->setShowState( bShowState); +} + +sal_Bool SAL_CALL ODMAFilePicker::getShowState( ) + throw ( RuntimeException ) +{ + Reference< XFilePreview > xFilePreview( m_xSystemFilePicker, UNO_QUERY ); + return xFilePreview->getShowState(); +} + +// XFilterGroupManager functions + +void SAL_CALL ODMAFilePicker::appendFilterGroup( const ::rtl::OUString& sGroupTitle, + const Sequence< StringPair >& aFilters ) + throw ( IllegalArgumentException, RuntimeException ) +{ + Reference< XFilterGroupManager > xFilterGroupManager( m_xSystemFilePicker, UNO_QUERY ); + xFilterGroupManager->appendFilterGroup( sGroupTitle, aFilters ); +} + +// XFilterManager functions + +void SAL_CALL ODMAFilePicker::appendFilter( const rtl::OUString& aTitle, + const rtl::OUString& aFilter ) + throw( IllegalArgumentException, RuntimeException ) +{ + Reference< XFilterManager > xFilterManager( m_xSystemFilePicker, UNO_QUERY ); + xFilterManager->appendFilter( aTitle, aFilter ); +} + +void SAL_CALL ODMAFilePicker::setCurrentFilter( const rtl::OUString& aTitle ) + throw( IllegalArgumentException, RuntimeException ) +{ + Reference< XFilterManager > xFilterManager( m_xSystemFilePicker, UNO_QUERY ); + xFilterManager->setCurrentFilter( aTitle ); +} + +rtl::OUString SAL_CALL ODMAFilePicker::getCurrentFilter( ) + throw( RuntimeException ) +{ + Reference< XFilterManager > xFilterManager( m_xSystemFilePicker, UNO_QUERY ); + return xFilterManager->getCurrentFilter(); +} + +// XInitialization functions + +void SAL_CALL ODMAFilePicker::initialize( const Sequence< Any >& aArguments ) + throw ( Exception, RuntimeException ) +{ + if (aArguments.getLength( ) > 0) + { + Any aAny = aArguments[0]; + + if ( (aAny.getValueType() == ::getCppuType((sal_Int16*)0)) || + (aAny.getValueType() == ::getCppuType((sal_Int8*)0)) ) + { + sal_Int16 nTemplateId = -1; + aAny >>= nTemplateId; + + switch (nTemplateId) { + case TemplateDescription::FILEOPEN_SIMPLE: + case TemplateDescription::FILEOPEN_LINK_PREVIEW_IMAGE_TEMPLATE: + case TemplateDescription::FILEOPEN_PLAY: + case TemplateDescription::FILEOPEN_READONLY_VERSION: + case TemplateDescription::FILEOPEN_LINK_PREVIEW: + m_nDialogKind = OPEN; + break; + default: + m_nDialogKind = SAVE; + } + } + } + + Reference< XInitialization > xInitialization( m_xSystemFilePicker, UNO_QUERY ); + xInitialization->initialize( aArguments ); +} + +// XCancellable functions + +void SAL_CALL ODMAFilePicker::cancel( ) + throw( ::com::sun::star::uno::RuntimeException ) +{ + Reference< XCancellable > xCancellable( m_xSystemFilePicker, UNO_QUERY ); + xCancellable->cancel(); +} + +// XEventListener functions + +void SAL_CALL ODMAFilePicker::disposing( const ::com::sun::star::lang::EventObject& aEvent ) + throw( RuntimeException ) +{ + Reference< XEventListener > xEventListener( m_xSystemFilePicker, UNO_QUERY ); + xEventListener->disposing( aEvent ); +} + +// XServiceInfo functions + +rtl::OUString SAL_CALL ODMAFilePicker::getImplementationName( ) + throw( RuntimeException ) +{ + return impl_getStaticImplementationName(); +} + +sal_Bool SAL_CALL ODMAFilePicker::supportsService( const rtl::OUString& sServiceName ) + throw( RuntimeException ) +{ + Sequence< rtl::OUString > seqServiceNames = getSupportedServiceNames(); + const rtl::OUString* pArray = seqServiceNames.getConstArray(); + for ( sal_Int32 i = 0; i < seqServiceNames.getLength(); i++ ) + { + if ( sServiceName == pArray[i] ) + { + return sal_True ; + } + } + return sal_False ; +} + +Sequence< rtl::OUString > SAL_CALL ODMAFilePicker::getSupportedServiceNames( ) + throw( RuntimeException ) +{ + return impl_getStaticSupportedServiceNames(); +} + +Sequence< rtl::OUString > ODMAFilePicker::impl_getStaticSupportedServiceNames( ) +{ + Sequence< rtl::OUString > seqServiceNames( 2 ); + rtl::OUString* pArray = seqServiceNames.getArray(); + pArray[0] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.ODMAFilePicker" )); + + // Super-ugly, but check the function sal_Bool + // lcl_isSystemFilePicker( const Reference< XFilePicker >& ) in + // sfx2/source/dialog/filedlghelper.cxx + + // Lovely undocumented coupling right across abstraction layers, + // isn't it? If we don't claim to implement this "service" (which + // is not defined in any IDL file, btw), we get hangs. + + pArray[1] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.SystemFilePicker" )); + return seqServiceNames ; +} + +rtl::OUString ODMAFilePicker::impl_getStaticImplementationName( ) +{ + return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.svtools.ODMAFilePicker" )); +} + +Reference< XInterface > SAL_CALL ODMAFilePicker::impl_createInstance( + const Reference< XComponentContext >& rxContext) + throw( Exception ) +{ + Reference< XMultiServiceFactory > xServiceManager (rxContext->getServiceManager(), UNO_QUERY_THROW); + return Reference< XInterface >( *new ODMAFilePicker( xServiceManager ) ); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/odma/ODMAFilePicker.hxx b/fpicker/source/odma/ODMAFilePicker.hxx new file mode 100644 index 000000000000..bb389d8cb8cb --- /dev/null +++ b/fpicker/source/odma/ODMAFilePicker.hxx @@ -0,0 +1,216 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * Copyright 2010 Novell, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef INCLUDED_ODMA_FILEPICKER_HXX +#define INCLUDED_ODMA_FILEPICKER_HXX + +#include <cppuhelper/compbase9.hxx> + +#include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp> +#include <com/sun/star/ui/dialogs/XFilePickerNotifier.hpp> +#include <com/sun/star/ui/dialogs/XFilePreview.hpp> +#include <com/sun/star/ui/dialogs/XFilterManager.hpp> +#include <com/sun/star/ui/dialogs/XFilterGroupManager.hpp> +#include <com/sun/star/ui/dialogs/XFilePickerListener.hpp> +#include <com/sun/star/util/XCancellable.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/lang/XInitialization.hpp> + +// class ODMAFilePicker --------------------------------------------------- + +class ODMAFilePicker : + public cppu::WeakComponentImplHelper9< + ::com::sun::star::ui::dialogs::XFilterManager, + ::com::sun::star::ui::dialogs::XFilterGroupManager, + ::com::sun::star::ui::dialogs::XFilePickerControlAccess, + ::com::sun::star::ui::dialogs::XFilePickerNotifier, + ::com::sun::star::ui::dialogs::XFilePreview, + ::com::sun::star::lang::XInitialization, + ::com::sun::star::util::XCancellable, + ::com::sun::star::lang::XEventListener, + ::com::sun::star::lang::XServiceInfo > +{ +private: + sal_Bool m_bUseDMS; + sal_Bool m_bMultiSelectionMode; + rtl::OUString m_aDefaultName; + rtl::OUString m_aDisplayDirectory; + ::com::sun::star::uno::Sequence< rtl::OUString > m_aFiles; + enum { OPEN, SAVE } m_nDialogKind; + + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xSystemFilePicker; + +protected: + ::osl::Mutex m_rbHelperMtx; + +public: + + ODMAFilePicker( const ::com::sun::star::uno::Reference < ::com::sun::star::lang::XMultiServiceFactory >& xFactory ); + + // XFilterManager functions + + virtual void SAL_CALL appendFilter( const ::rtl::OUString& aTitle, + const ::rtl::OUString& aFilter ) + throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL setCurrentFilter( const ::rtl::OUString& aTitle ) + throw( ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::uno::RuntimeException ); + + virtual ::rtl::OUString SAL_CALL getCurrentFilter( ) + throw( ::com::sun::star::uno::RuntimeException ); + + // XFilterGroupManager functions + + virtual void SAL_CALL appendFilterGroup( const ::rtl::OUString& sGroupTitle, + const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::StringPair >& aFilters ) + throw (::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::uno::RuntimeException ); + + // XFilePickerControlAccess functions + + virtual void SAL_CALL setValue( sal_Int16 nControlID, + sal_Int16 nControlAction, + const ::com::sun::star::uno::Any& aValue ) + throw( ::com::sun::star::uno::RuntimeException ); + + virtual ::com::sun::star::uno::Any SAL_CALL getValue( sal_Int16 nControlID, + sal_Int16 nControlAction ) + throw( ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL setLabel( sal_Int16 nControlID, + const ::rtl::OUString& aValue ) + throw ( ::com::sun::star::uno::RuntimeException ); + + virtual ::rtl::OUString SAL_CALL getLabel( sal_Int16 nControlID ) + throw ( ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL enableControl( sal_Int16 nControlID, + sal_Bool bEnable ) + throw( ::com::sun::star::uno::RuntimeException ); + + // XFilePicker functions + + virtual void SAL_CALL setMultiSelectionMode( sal_Bool bMode ) + throw( ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL setDefaultName( const ::rtl::OUString& aName ) + throw( ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL setDisplayDirectory( const ::rtl::OUString& aDirectory ) + throw( ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::uno::RuntimeException ); + + virtual ::rtl::OUString SAL_CALL getDisplayDirectory( ) + throw( ::com::sun::star::uno::RuntimeException ); + + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getFiles( ) + throw( ::com::sun::star::uno::RuntimeException ); + + // XExecutableDialog functions + + virtual void SAL_CALL setTitle( const ::rtl::OUString& aTitle ) + throw (::com::sun::star::uno::RuntimeException); + + virtual sal_Int16 SAL_CALL execute( ) + throw (::com::sun::star::uno::RuntimeException); + + // XFilePickerNotifier functions + + virtual void SAL_CALL addFilePickerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XFilePickerListener >& xListener ) + throw ( ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL removeFilePickerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XFilePickerListener >& xListener ) + throw ( ::com::sun::star::uno::RuntimeException ); + + // XFilePreview functions + + virtual ::com::sun::star::uno::Sequence< sal_Int16 > SAL_CALL getSupportedImageFormats( ) + throw ( ::com::sun::star::uno::RuntimeException ); + + virtual sal_Int32 SAL_CALL getTargetColorDepth( ) + throw ( ::com::sun::star::uno::RuntimeException ); + + virtual sal_Int32 SAL_CALL getAvailableWidth( ) + throw ( ::com::sun::star::uno::RuntimeException ); + + virtual sal_Int32 SAL_CALL getAvailableHeight( ) + throw ( ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL setImage( sal_Int16 aImageFormat, + const ::com::sun::star::uno::Any& aImage ) + throw ( ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::uno::RuntimeException ); + + virtual sal_Bool SAL_CALL setShowState( sal_Bool bShowState ) + throw ( ::com::sun::star::uno::RuntimeException ); + + virtual sal_Bool SAL_CALL getShowState( ) + throw ( ::com::sun::star::uno::RuntimeException ); + + // XInitialization functions + + virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) + throw ( ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException ); + + // XCancellable functions + + virtual void SAL_CALL cancel( ) + throw( ::com::sun::star::uno::RuntimeException ); + + // XEventListener functions + + using cppu::WeakComponentImplHelperBase::disposing; + virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& aEvent ) + throw( ::com::sun::star::uno::RuntimeException ); + + // XServiceInfo functions + + virtual ::rtl::OUString SAL_CALL getImplementationName( ) + throw( ::com::sun::star::uno::RuntimeException ); + + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& sServiceName ) + throw( ::com::sun::star::uno::RuntimeException ); + + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) + throw( ::com::sun::star::uno::RuntimeException ); + + /* Helper for XServiceInfo */ + static ::com::sun::star::uno::Sequence< ::rtl::OUString > impl_getStaticSupportedServiceNames( ); + static ::rtl::OUString impl_getStaticImplementationName( ); + + /* Helper for registry */ + static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL impl_createInstance ( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext ) + throw( ::com::sun::star::uno::Exception ); +}; + +#endif // INCLUDED_ODMA_FILEPICKER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/odma/ODMAFolderPicker.cxx b/fpicker/source/odma/ODMAFolderPicker.cxx new file mode 100644 index 000000000000..a8d1f15138e3 --- /dev/null +++ b/fpicker/source/odma/ODMAFolderPicker.cxx @@ -0,0 +1,184 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * Copyright 2010 Novell, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_fpicker.hxx" + +#include "ODMAFolderPicker.hxx" + +#define _SVSTDARR_STRINGSDTOR +#include "svl/svstdarr.hxx" + +#include <com/sun/star/container/XContentEnumerationAccess.hpp> +#include <com/sun/star/container/XSet.hpp> +#include <com/sun/star/uno/Any.hxx> +#include <cppuhelper/factory.hxx> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <unotools/pathoptions.hxx> + +#ifndef ODMA_LIB_HXX +#include <windows.h> +#include <odma_lib.hxx> +#endif + +// using ---------------------------------------------------------------- + +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::uno; + +//------------------------------------------------------------------------------------ +// class ODMAFolderPicker +//------------------------------------------------------------------------------------ + +//------------------------------------------------------------------------------------ +ODMAFolderPicker::ODMAFolderPicker( const Reference < XMultiServiceFactory >& xFactory ) : + cppu::WeakComponentImplHelper2< + XFolderPicker, + XServiceInfo>( m_rbHelperMtx ), + m_bUseDMS( sal_False ) +{ + m_xInterface = xFactory->createInstance( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.SystemFolderPicker" ) )); +} + +// XExecutableDialog functions + +void SAL_CALL ODMAFolderPicker::setTitle( const ::rtl::OUString& _rTitle ) throw (RuntimeException) +{ + if (m_bUseDMS) + return; + + Reference< XExecutableDialog > xExecutableDialog( m_xInterface, UNO_QUERY ); + xExecutableDialog->setTitle( _rTitle); +} + +sal_Int16 SAL_CALL ODMAFolderPicker::execute( ) + throw (RuntimeException) +{ + if (m_bUseDMS) + throw new RuntimeException( ); + + Reference< XExecutableDialog > xExecutableDialog( m_xInterface, UNO_QUERY ); + return xExecutableDialog->execute(); +} + +// XFolderPicker functions + +void SAL_CALL ODMAFolderPicker::setDisplayDirectory( const ::rtl::OUString& aDirectory ) + throw( IllegalArgumentException, RuntimeException ) +{ + if (m_bUseDMS) + return; + + Reference< XFolderPicker > xFolderPicker( m_xInterface, UNO_QUERY ); + xFolderPicker->setDisplayDirectory( aDirectory ); +} + +::rtl::OUString SAL_CALL ODMAFolderPicker::getDisplayDirectory( ) + throw( RuntimeException ) +{ + if (m_bUseDMS) + return rtl::OUString(); + + Reference< XFolderPicker > xFolderPicker( m_xInterface, UNO_QUERY ); + return xFolderPicker->getDisplayDirectory(); +} + +::rtl::OUString SAL_CALL ODMAFolderPicker::getDirectory( ) + throw( RuntimeException ) +{ + if (m_bUseDMS) + return rtl::OUString(); + + Reference< XFolderPicker > xFolderPicker( m_xInterface, UNO_QUERY ); + return xFolderPicker->getDirectory(); +} + +void SAL_CALL ODMAFolderPicker::setDescription( const ::rtl::OUString& aDescription ) + throw( RuntimeException ) +{ + if (m_bUseDMS) + return; + + Reference< XFolderPicker > xFolderPicker( m_xInterface, UNO_QUERY ); + xFolderPicker->setDescription( aDescription ); +} + +// XServiceInfo + +::rtl::OUString SAL_CALL ODMAFolderPicker::getImplementationName( ) + throw( RuntimeException ) +{ + return impl_getStaticImplementationName(); +} + +sal_Bool SAL_CALL ODMAFolderPicker::supportsService( const ::rtl::OUString& sServiceName ) + throw( RuntimeException ) +{ + Sequence< ::rtl::OUString > seqServiceNames = getSupportedServiceNames(); + const ::rtl::OUString* pArray = seqServiceNames.getConstArray(); + for ( sal_Int32 i = 0; i < seqServiceNames.getLength(); i++ ) + { + if ( sServiceName == pArray[i] ) + { + return sal_True ; + } + } + return sal_False ; +} + +Sequence< ::rtl::OUString > SAL_CALL ODMAFolderPicker::getSupportedServiceNames() + throw( RuntimeException ) +{ + return impl_getStaticSupportedServiceNames(); +} + +Sequence< ::rtl::OUString > ODMAFolderPicker::impl_getStaticSupportedServiceNames( ) +{ + Sequence< ::rtl::OUString > seqServiceNames( 1 ); + ::rtl::OUString* pArray = seqServiceNames.getArray(); + pArray[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.ODMAFolderPicker" )); + return seqServiceNames ; +} + +::rtl::OUString ODMAFolderPicker::impl_getStaticImplementationName( ) +{ + return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.svtools.ODMAFolderPicker" )); +} + +Reference< XInterface > SAL_CALL ODMAFolderPicker::impl_createInstance( const Reference< XComponentContext >& rxContext ) + throw( Exception ) +{ + Reference< XMultiServiceFactory > xServiceManager (rxContext->getServiceManager(), UNO_QUERY_THROW); + return Reference< XInterface >( *new ODMAFolderPicker( xServiceManager ) ); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/odma/ODMAFolderPicker.hxx b/fpicker/source/odma/ODMAFolderPicker.hxx new file mode 100644 index 000000000000..880d5a534500 --- /dev/null +++ b/fpicker/source/odma/ODMAFolderPicker.hxx @@ -0,0 +1,103 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * Copyright 2010 Novell, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef INCLUDED_ODMA_FOLDERPICKER_HXX +#define INCLUDED_ODMA_FOLDERPICKER_HXX + +#include <cppuhelper/compbase2.hxx> + +#include <com/sun/star/ui/dialogs/XFolderPicker.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XSingleServiceFactory.hpp> +#include <com/sun/star/lang/DisposedException.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> + +// class ODMAFolderPicker --------------------------------------------------- + +class ODMAFolderPicker : + public cppu::WeakComponentImplHelper2< + ::com::sun::star::ui::dialogs::XFolderPicker, + ::com::sun::star::lang::XServiceInfo > +{ +private: + sal_Bool m_bUseDMS; + +protected: + ::osl::Mutex m_rbHelperMtx; + + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xInterface; + +public: + ODMAFolderPicker( const ::com::sun::star::uno::Reference < ::com::sun::star::lang::XMultiServiceFactory >& xFactory ); + + // XFolderPicker functions + + virtual void SAL_CALL setDisplayDirectory( const ::rtl::OUString& aDirectory ) + throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException ); + + virtual ::rtl::OUString SAL_CALL getDisplayDirectory( ) + throw( ::com::sun::star::uno::RuntimeException ); + + virtual ::rtl::OUString SAL_CALL getDirectory( ) + throw( ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL setDescription( const ::rtl::OUString& aDescription ) + throw ( ::com::sun::star::uno::RuntimeException ); + + // XExecutableDialog functions + + virtual void SAL_CALL setTitle( const ::rtl::OUString& _rTitle ) + throw (::com::sun::star::uno::RuntimeException); + + virtual sal_Int16 SAL_CALL execute( ) + throw (::com::sun::star::uno::RuntimeException); + + // XServiceInfo functions + + virtual ::rtl::OUString SAL_CALL getImplementationName( ) + throw( ::com::sun::star::uno::RuntimeException ); + + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& sServiceName ) + throw( ::com::sun::star::uno::RuntimeException ); + + virtual com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) + throw( ::com::sun::star::uno::RuntimeException ); + + /* Helper for XServiceInfo */ + static com::sun::star::uno::Sequence< ::rtl::OUString > impl_getStaticSupportedServiceNames( ); + static ::rtl::OUString impl_getStaticImplementationName( ); + + /* Helper for registry */ + static ::com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL impl_createInstance ( const ::com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext ) + throw( com::sun::star::uno::Exception ); +}; + +#endif // INCLUDED_ODMA_FOLDERPICKER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/odma/exports.map b/fpicker/source/odma/exports.map new file mode 100644 index 000000000000..f4ed78b9e970 --- /dev/null +++ b/fpicker/source/odma/exports.map @@ -0,0 +1,8 @@ +UDK_3_0_0 { + global: + component_getImplementationEnvironment; + component_writeInfo; + component_getFactory; + local: + *; +}; diff --git a/fpicker/source/odma/fps_odma.cxx b/fpicker/source/odma/fps_odma.cxx new file mode 100644 index 000000000000..6d7642ca0674 --- /dev/null +++ b/fpicker/source/odma/fps_odma.cxx @@ -0,0 +1,81 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * Copyright 2010 Novell, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_fpicker.hxx" + +#include "sal/types.h" + +#include "cppuhelper/implementationentry.hxx" + +#include "ODMAFilePicker.hxx" +#include "ODMAFolderPicker.hxx" + +static cppu::ImplementationEntry g_entries[] = +{ + { + ODMAFilePicker::impl_createInstance, + ODMAFilePicker::impl_getStaticImplementationName, + ODMAFilePicker::impl_getStaticSupportedServiceNames, + cppu::createSingleComponentFactory, 0, 0 + }, + { + ODMAFolderPicker::impl_createInstance, + ODMAFolderPicker::impl_getStaticImplementationName, + ODMAFolderPicker::impl_getStaticSupportedServiceNames, + cppu::createSingleComponentFactory, 0, 0 + }, + { 0, 0, 0, 0, 0, 0 } +}; + +extern "C" +{ +SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment ( + const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */) +{ + *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; +} + +SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo ( + void * pServiceManager, void * pRegistryKey) +{ + return cppu::component_writeInfoHelper ( + pServiceManager, pRegistryKey, g_entries); +} + +SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory ( + const sal_Char * pImplementationName, void * pServiceManager, void * pRegistryKey) +{ + return cppu::component_getFactoryHelper ( + pImplementationName, pServiceManager, pRegistryKey, g_entries); +} + +} // extern "C" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/odma/makefile.mk b/fpicker/source/odma/makefile.mk new file mode 100644 index 000000000000..3cc62d6f94c4 --- /dev/null +++ b/fpicker/source/odma/makefile.mk @@ -0,0 +1,72 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# Copyright 2010 Novell, Inc. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/.. + +PRJNAME=fpicker +TARGET=fps_odma +LIBTARGET=NO +ENABLE_EXCEPTIONS=TRUE +GEN_HID=TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk +DLLPRE= + +# --- Files -------------------------------------------------------- + +SLOFILES=\ + $(SLO)$/ODMAFilePicker.obj \ + $(SLO)$/ODMAFolderPicker.obj \ + $(SLO)$/fps_odma.obj + +SHL1TARGET= $(TARGET).uno +SHL1IMPLIB= i$(TARGET) +SHL1OBJS= $(SLOFILES) +SHL1STDLIBS=\ + $(ODMA_LIB_LIB) \ + $(SVTOOLLIB) \ + $(TKLIB) \ + $(VCLLIB) \ + $(SVLLIB) \ + $(UNOTOOLSLIB) \ + $(TOOLSLIB) \ + $(UCBHELPERLIB) \ + $(COMPHELPERLIB) \ + $(CPPUHELPERLIB) \ + $(CPPULIB) \ + $(SALLIB) + +SHL1VERSIONMAP=exports.map +SHL1DEF= $(MISC)$/$(SHL1TARGET).def +DEF1NAME= $(SHL1TARGET) + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk diff --git a/fpicker/source/office/OfficeControlAccess.cxx b/fpicker/source/office/OfficeControlAccess.cxx index 6afe6e509acf..50632bf89d95 100644 --- a/fpicker/source/office/OfficeControlAccess.cxx +++ b/fpicker/source/office/OfficeControlAccess.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,6 +29,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_fpicker.hxx" +#include <sal/macros.h> #include "OfficeControlAccess.hxx" #include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp> #include <com/sun/star/ui/dialogs/CommonFilePickerElementIds.hpp> @@ -116,7 +118,7 @@ namespace svt }; // ................................................................ - static const sal_Int32 s_nControlCount = sizeof( aDescriptions ) / sizeof( aDescriptions[0] ); + static const sal_Int32 s_nControlCount = SAL_N_ELEMENTS( aDescriptions ); static ControlDescIterator s_pControls = aDescriptions; static ControlDescIterator s_pControlsEnd = aDescriptions + s_nControlCount; @@ -166,7 +168,7 @@ namespace svt }; // ................................................................ - static const int s_nPropertyCount = sizeof( aProperties ) / sizeof( aProperties[0] ); + static const int s_nPropertyCount = SAL_N_ELEMENTS( aProperties ); static ControlPropertyIterator s_pProperties = aProperties; static ControlPropertyIterator s_pPropertiesEnd = aProperties + s_nPropertyCount; @@ -702,7 +704,7 @@ namespace svt break; default: - DBG_ERROR( "OControlAccess::implSetControlProperty: invalid property id!" ); + OSL_FAIL( "OControlAccess::implSetControlProperty: invalid property id!" ); } } @@ -778,7 +780,7 @@ namespace svt break; default: - DBG_ERROR( "OControlAccess::implGetControlProperty: invalid property id!" ); + OSL_FAIL( "OControlAccess::implGetControlProperty: invalid property id!" ); } return aReturn; } @@ -787,3 +789,4 @@ namespace svt } // namespace svt //......................................................................... +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/office/OfficeControlAccess.hxx b/fpicker/source/office/OfficeControlAccess.hxx index 35196907f900..44bd416f60c1 100644 --- a/fpicker/source/office/OfficeControlAccess.hxx +++ b/fpicker/source/office/OfficeControlAccess.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -123,3 +124,4 @@ namespace svt #endif // SVTOOLS_CONTROLACCESS_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/office/OfficeFilePicker.cxx b/fpicker/source/office/OfficeFilePicker.cxx index c7ef19a4dbb8..a14fc476aca8 100644 --- a/fpicker/source/office/OfficeFilePicker.cxx +++ b/fpicker/source/office/OfficeFilePicker.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -58,10 +59,8 @@ #include <unotools/pathoptions.hxx> #include <comphelper/sequence.hxx> #include <cppuhelper/typeprovider.hxx> -#include "vos/mutex.hxx" -#ifndef _SV_APP_HXX +#include "osl/mutex.hxx" #include "vcl/svapp.hxx" -#endif // define ---------------------------------------------------------------- @@ -561,7 +560,7 @@ void SAL_CALL SvtFilePicker::setMultiSelectionMode( sal_Bool bMode ) throw( Runt { checkAlive(); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; m_bMultiSelection = bMode; } @@ -569,7 +568,7 @@ void SAL_CALL SvtFilePicker::setDefaultName( const rtl::OUString& aName ) throw( { checkAlive(); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; m_aDefaultName = aName; } @@ -578,7 +577,7 @@ void SAL_CALL SvtFilePicker::setDisplayDirectory( const rtl::OUString& aDirector { checkAlive(); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; m_aDisplayDirectory = aDirectory; } @@ -586,7 +585,7 @@ rtl::OUString SAL_CALL SvtFilePicker::getDisplayDirectory() throw( RuntimeExcept { checkAlive(); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if ( getDialog() ) { rtl::OUString aPath = getDialog()->GetPath(); @@ -614,7 +613,7 @@ Sequence< rtl::OUString > SAL_CALL SvtFilePicker::getFiles() throw( RuntimeExcep { checkAlive(); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if ( ! getDialog() ) { Sequence< rtl::OUString > aEmpty; @@ -660,7 +659,7 @@ void SAL_CALL SvtFilePicker::setValue( sal_Int16 nElementID, { checkAlive(); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if ( getDialog() ) { ::svt::OControlAccess aAccess( getDialog(), getDialog()->GetView() ); @@ -704,7 +703,7 @@ Any SAL_CALL SvtFilePicker::getValue( sal_Int16 nElementID, sal_Int16 nControlAc { checkAlive(); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; Any aAny; // execute() called? @@ -740,7 +739,7 @@ void SAL_CALL SvtFilePicker::setLabel( sal_Int16 nLabelID, const rtl::OUString& { checkAlive(); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if ( getDialog() ) { ::svt::OControlAccess aAccess( getDialog(), getDialog()->GetView() ); @@ -780,7 +779,7 @@ rtl::OUString SAL_CALL SvtFilePicker::getLabel( sal_Int16 nLabelID ) { checkAlive(); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; rtl::OUString aLabel; if ( getDialog() ) @@ -813,7 +812,7 @@ void SAL_CALL SvtFilePicker::enableControl( sal_Int16 nElementID, sal_Bool bEnab { checkAlive(); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if ( getDialog() ) { ::svt::OControlAccess aAccess( getDialog(), getDialog()->GetView() ); @@ -855,7 +854,7 @@ void SAL_CALL SvtFilePicker::addFilePickerListener( const Reference< XFilePicker { checkAlive(); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; m_xListener = xListener; } @@ -864,7 +863,7 @@ void SAL_CALL SvtFilePicker::removeFilePickerListener( const Reference< XFilePic { checkAlive(); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; m_xListener.clear(); } @@ -877,7 +876,7 @@ Sequence< sal_Int16 > SAL_CALL SvtFilePicker::getSupportedImageFormats() { checkAlive(); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; Sequence< sal_Int16 > aFormats( 1 ); aFormats[0] = FilePreviewImageFormats::BITMAP; @@ -890,7 +889,7 @@ sal_Int32 SAL_CALL SvtFilePicker::getTargetColorDepth() throw ( RuntimeException { checkAlive(); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; sal_Int32 nDepth = 0; if ( getDialog() ) @@ -904,7 +903,7 @@ sal_Int32 SAL_CALL SvtFilePicker::getAvailableWidth() throw ( RuntimeException ) { checkAlive(); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; sal_Int32 nWidth = 0; if ( getDialog() ) @@ -918,7 +917,7 @@ sal_Int32 SAL_CALL SvtFilePicker::getAvailableHeight() throw ( RuntimeException { checkAlive(); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; sal_Int32 nHeigth = 0; if ( getDialog() ) @@ -933,7 +932,7 @@ void SAL_CALL SvtFilePicker::setImage( sal_Int16 aImageFormat, const Any& rImage { checkAlive(); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if ( getDialog() ) getDialog()->setImage( aImageFormat, rImage ); } @@ -944,7 +943,7 @@ sal_Bool SAL_CALL SvtFilePicker::setShowState( sal_Bool bShowState ) { checkAlive(); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; sal_Bool bRet = sal_False; if ( getDialog() ) @@ -958,7 +957,7 @@ sal_Bool SAL_CALL SvtFilePicker::getShowState() throw ( RuntimeException ) { checkAlive(); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; sal_Bool bRet = sal_False; if ( getDialog() ) @@ -977,7 +976,7 @@ void SAL_CALL SvtFilePicker::appendFilterGroup( const ::rtl::OUString& sGroupTit { checkAlive(); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; // check the names if ( FilterNameExists( aFilters ) ) @@ -1005,7 +1004,7 @@ void SAL_CALL SvtFilePicker::appendFilter( const rtl::OUString& aTitle, { checkAlive(); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; // check the name if ( FilterNameExists( aTitle ) ) // TODO: a more precise exception message @@ -1024,7 +1023,7 @@ void SAL_CALL SvtFilePicker::setCurrentFilter( const rtl::OUString& aTitle ) { checkAlive(); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if ( ! FilterNameExists( aTitle ) ) throw IllegalArgumentException(); @@ -1040,7 +1039,7 @@ rtl::OUString SAL_CALL SvtFilePicker::getCurrentFilter() { checkAlive(); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; rtl::OUString aFilter = getDialog() ? rtl::OUString( getDialog()->GetCurFilter() ) : rtl::OUString( m_aCurrentFilter ); return aFilter; @@ -1108,19 +1107,19 @@ void SAL_CALL SvtFilePicker::initialize( const Sequence< Any >& _rArguments ) //------------------------------------------------------------------------- sal_Bool SvtFilePicker::implHandleInitializationArgument( const ::rtl::OUString& _rName, const Any& _rValue ) SAL_THROW( ( Exception, RuntimeException ) ) { - if ( _rName.equalsAscii( "TemplateDescription" ) ) + if ( _rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "TemplateDescription" ) ) ) { m_nServiceType = TemplateDescription::FILEOPEN_SIMPLE; OSL_VERIFY( _rValue >>= m_nServiceType ); return sal_True; } - if ( _rName.equalsAscii( "StandardDir" ) ) + if ( _rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "StandardDir" ) ) ) { OSL_VERIFY( _rValue >>= m_aStandardDir ); return sal_True; } - if ( _rName.equalsAscii( "BlackList" ) ) + if ( _rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "BlackList" ) ) ) { OSL_VERIFY( _rValue >>= m_aBlackList ); return sal_True; @@ -1167,14 +1166,14 @@ Sequence< rtl::OUString > SvtFilePicker::impl_getStaticSupportedServiceNames() { Sequence< rtl::OUString > seqServiceNames( 1 ); rtl::OUString* pArray = seqServiceNames.getArray(); - pArray[0] = rtl::OUString::createFromAscii( "com.sun.star.ui.dialogs.OfficeFilePicker" ); + pArray[0] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.OfficeFilePicker" )); return seqServiceNames ; } /* Helper for XServiceInfo */ rtl::OUString SvtFilePicker::impl_getStaticImplementationName() { - return rtl::OUString::createFromAscii( "com.sun.star.svtools.OfficeFilePicker" ); + return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.svtools.OfficeFilePicker" )); } /* Helper for registry */ @@ -1184,3 +1183,5 @@ Reference< XInterface > SAL_CALL SvtFilePicker::impl_createInstance( Reference< XMultiServiceFactory > xServiceManager (rxContext->getServiceManager(), UNO_QUERY_THROW); return Reference< XInterface >( *new SvtFilePicker( xServiceManager ) ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/office/OfficeFilePicker.hxx b/fpicker/source/office/OfficeFilePicker.hxx index c203924f6e51..d0218461f8f2 100644 --- a/fpicker/source/office/OfficeFilePicker.hxx +++ b/fpicker/source/office/OfficeFilePicker.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -37,9 +38,7 @@ #include <com/sun/star/ui/dialogs/XAsynchronousExecutableDialog.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XEventListener.hpp> -#ifndef _COM_SUN_STAR_UNO_XCOMPONENT_CONTEXT_HPP_ #include <com/sun/star/uno/XComponentContext.hpp> -#endif #include <tools/wintypes.hxx> @@ -228,3 +227,4 @@ private: #endif // INCLUDED_SVT_FILEPICKER_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/office/OfficeFolderPicker.cxx b/fpicker/source/office/OfficeFolderPicker.cxx index 076635ffa923..337f85c02581 100644 --- a/fpicker/source/office/OfficeFolderPicker.cxx +++ b/fpicker/source/office/OfficeFolderPicker.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -245,14 +246,14 @@ Sequence< ::rtl::OUString > SAL_CALL SvtFolderPicker::getSupportedServiceNames() Sequence< ::rtl::OUString > SvtFolderPicker::impl_getStaticSupportedServiceNames() { Sequence< ::rtl::OUString > seqServiceNames(1); - seqServiceNames[0] = ::rtl::OUString::createFromAscii( "com.sun.star.ui.dialogs.OfficeFolderPicker" ); + seqServiceNames[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.OfficeFolderPicker" )); return seqServiceNames ; } /* Helper for XServiceInfo */ ::rtl::OUString SvtFolderPicker::impl_getStaticImplementationName() { - return ::rtl::OUString::createFromAscii( "com.sun.star.svtools.OfficeFolderPicker" ); + return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.svtools.OfficeFolderPicker" )); } /* Helper for registry */ @@ -263,3 +264,4 @@ Reference< XInterface > SAL_CALL SvtFolderPicker::impl_createInstance( const Ref return Reference< XInterface >( *new SvtFolderPicker( xServiceManager ) ); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/office/OfficeFolderPicker.hxx b/fpicker/source/office/OfficeFolderPicker.hxx index 1cba8a122063..273f971edb5a 100644 --- a/fpicker/source/office/OfficeFolderPicker.hxx +++ b/fpicker/source/office/OfficeFolderPicker.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -120,3 +121,5 @@ protected: }; #endif // INCLUDED_SVT_FOLDERPICKER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/office/asyncfilepicker.cxx b/fpicker/source/office/asyncfilepicker.cxx index 4d08805999f4..9062a18d577e 100644 --- a/fpicker/source/office/asyncfilepicker.cxx +++ b/fpicker/source/office/asyncfilepicker.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -142,7 +143,7 @@ namespace svt break; default: - DBG_ERROR( "AsyncPickerAction::execute: unknown action!" ); + OSL_FAIL( "AsyncPickerAction::execute: unknown action!" ); break; } @@ -207,7 +208,7 @@ namespace svt break; default: - DBG_ERROR( "AsyncPickerAction::OnActionDone: unknown action!" ); + OSL_FAIL( "AsyncPickerAction::OnActionDone: unknown action!" ); break; } @@ -218,3 +219,4 @@ namespace svt } // namespace svt //........................................................................ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/office/asyncfilepicker.hxx b/fpicker/source/office/asyncfilepicker.hxx index d489a075b9ff..4ec9be11ec31 100644 --- a/fpicker/source/office/asyncfilepicker.hxx +++ b/fpicker/source/office/asyncfilepicker.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -116,3 +117,4 @@ namespace svt #endif // SVTOOLS_SOURCE_FILEPICKER_ASYNCFILEPICKER_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/office/commonpicker.cxx b/fpicker/source/office/commonpicker.cxx index 7fcab23e7657..f360770dea4b 100644 --- a/fpicker/source/office/commonpicker.cxx +++ b/fpicker/source/office/commonpicker.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -32,7 +33,7 @@ #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/beans/NamedValue.hpp> #include <vcl/svapp.hxx> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <toolkit/helper/vclunohelper.hxx> #include <comphelper/weakeventlistener.hxx> #include <comphelper/types.hxx> @@ -66,13 +67,13 @@ namespace svt { // the two properties we have registerProperty( - ::rtl::OUString::createFromAscii( "HelpURL" ), PROPERTY_ID_HELPURL, + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "HelpURL" )), PROPERTY_ID_HELPURL, PropertyAttribute::TRANSIENT, &m_sHelpURL, ::getCppuType( &m_sHelpURL ) ); registerProperty( - ::rtl::OUString::createFromAscii( "Window" ), PROPERTY_ID_WINDOW, + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Window" )), PROPERTY_ID_WINDOW, PropertyAttribute::TRANSIENT | PropertyAttribute::READONLY, &m_xWindow, ::getCppuType( &m_xWindow ) ); @@ -120,7 +121,7 @@ namespace svt //--------------------------------------------------------------------- void SAL_CALL OCommonPicker::disposing() { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; stopWindowListening(); @@ -151,7 +152,7 @@ namespace svt //--------------------------------------------------------------------- void SAL_CALL OCommonPicker::disposing( const EventObject& _rSource ) throw (RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; sal_Bool bDialogDying = _rSource.Source == m_xWindow; sal_Bool bParentDying = _rSource.Source == m_xDialogParent; @@ -168,7 +169,7 @@ namespace svt } else { - DBG_ERROR( "OCommonPicker::disposing: where did this come from?" ); + OSL_FAIL( "OCommonPicker::disposing: where did this come from?" ); } } @@ -209,7 +210,7 @@ namespace svt //--------------------------------------------------------------------- sal_Bool OCommonPicker::createPicker() { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if ( !m_pDlg ) { @@ -262,7 +263,7 @@ namespace svt { checkAlive(); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if ( createPicker() ) { ::svt::OControlAccess aAccess( m_pDlg, m_pDlg->GetView() ); @@ -275,7 +276,7 @@ namespace svt { checkAlive(); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if ( createPicker() ) { ::svt::OControlAccess aAccess( m_pDlg, m_pDlg->GetView() ); @@ -292,7 +293,7 @@ namespace svt { checkAlive(); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if ( createPicker() ) { ::svt::OControlAccess aAccess( m_pDlg, m_pDlg->GetView() ); @@ -307,7 +308,7 @@ namespace svt { checkAlive(); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if ( createPicker() ) { ::svt::OControlAccess aAccess( m_pDlg, m_pDlg->GetView() ); @@ -322,7 +323,7 @@ namespace svt { checkAlive(); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if ( createPicker() ) { ::svt::OControlAccess aAccess( m_pDlg, m_pDlg->GetView() ); @@ -337,7 +338,7 @@ namespace svt { checkAlive(); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if ( createPicker() ) { ::svt::OControlAccess aAccess( m_pDlg, m_pDlg->GetView() ); @@ -352,14 +353,14 @@ namespace svt //--------------------------------------------------------------------- void SAL_CALL OCommonPicker::setTitle( const rtl::OUString& _rTitle ) throw( RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; m_aTitle = _rTitle; } //--------------------------------------------------------------------- sal_Int16 OCommonPicker::execute() throw (RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; prepareDialog(); @@ -464,7 +465,7 @@ namespace svt } else { - DBG_ERROR( + OSL_FAIL( ( ::rtl::OString( "OCommonPicker::initialize: unknown argument type at position " ) += ::rtl::OString::valueOf( (sal_Int32)( pArguments - _rArguments.getConstArray() ) ) ).getStr() @@ -489,7 +490,7 @@ namespace svt sal_Bool OCommonPicker::implHandleInitializationArgument( const ::rtl::OUString& _rName, const Any& _rValue ) SAL_THROW( ( Exception, RuntimeException ) ) { sal_Bool bKnown = sal_True; - if ( _rName.equalsAscii( "ParentWindow" ) ) + if ( _rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ParentWindow" ) ) ) { m_xDialogParent.clear(); OSL_VERIFY( _rValue >>= m_xDialogParent ); @@ -504,3 +505,4 @@ namespace svt } // namespace svt //......................................................................... +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/office/commonpicker.hxx b/fpicker/source/office/commonpicker.hxx index 2531f5e7f4c5..6422019affa5 100644 --- a/fpicker/source/office/commonpicker.hxx +++ b/fpicker/source/office/commonpicker.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -207,3 +208,4 @@ namespace svt #endif // SVTOOLS_COMMONPICKER_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/office/fpinteraction.cxx b/fpicker/source/office/fpinteraction.cxx index 72529bad04d6..4f5d906737af 100644 --- a/fpicker/source/office/fpinteraction.cxx +++ b/fpicker/source/office/fpinteraction.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -167,3 +168,4 @@ namespace svt } // namespace svt //........................................................................ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/office/fpinteraction.hxx b/fpicker/source/office/fpinteraction.hxx index 9b1b4e2c27a4..88a2590384cf 100644 --- a/fpicker/source/office/fpinteraction.hxx +++ b/fpicker/source/office/fpinteraction.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -90,3 +91,4 @@ namespace svt #endif // SVTOOLS_FILEPICKER_INTERACTION_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/office/fps_office.cxx b/fpicker/source/office/fps_office.cxx index 3d06873338de..29eb084335fc 100644 --- a/fpicker/source/office/fps_office.cxx +++ b/fpicker/source/office/fps_office.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,9 +31,7 @@ #include "precompiled_fpicker.hxx" #include "sal/types.h" -#ifndef _CPPUHELPER_IMPLEMENTATIONENTRY_HXX_ #include "cppuhelper/implementationentry.hxx" -#endif #include "OfficeFilePicker.hxx" #include "OfficeFolderPicker.hxx" @@ -71,3 +70,5 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( } } // extern "C" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/office/fpsmartcontent.cxx b/fpicker/source/office/fpsmartcontent.cxx index a7842a5a2e58..b66cd8ac05a6 100644 --- a/fpicker/source/office/fpsmartcontent.cxx +++ b/fpicker/source/office/fpsmartcontent.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -164,7 +165,7 @@ namespace svt } catch( Exception& ) { - DBG_ERROR( "SmartContent::bindTo: unexpected exception caught!" ); + OSL_FAIL( "SmartContent::bindTo: unexpected exception caught!" ); } } else @@ -225,7 +226,7 @@ namespace svt try { ::rtl::OUString sTitle; - m_pContent->getPropertyValue( ::rtl::OUString::createFromAscii( "Title" ) ) >>= sTitle; + m_pContent->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Title" )) ) >>= sTitle; _rTitle = sTitle; // from here on, we definately know that the content is valid @@ -306,3 +307,4 @@ namespace svt } // namespace svt //........................................................................ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/office/fpsmartcontent.hxx b/fpicker/source/office/fpsmartcontent.hxx index d5474ae3fd5f..e16c288678b1 100644 --- a/fpicker/source/office/fpsmartcontent.hxx +++ b/fpicker/source/office/fpsmartcontent.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -210,3 +211,5 @@ namespace svt //........................................................................ #endif // SVTOOLS_SOURCE_FILEPICKER_FPSMARTCONTENT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/office/iodlg.cxx b/fpicker/source/office/iodlg.cxx index 13f427351411..bda16353eb34 100644 --- a/fpicker/source/office/iodlg.cxx +++ b/fpicker/source/office/iodlg.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -29,7 +30,7 @@ #include "precompiled_fpicker.hxx" // includes -------------------------------------------------------------- - +#include <sal/macros.h> #include "iodlg.hxx" #include <tools/stream.hxx> #include <tools/urlobj.hxx> @@ -56,24 +57,16 @@ #include <toolkit/helper/vclunohelper.hxx> #include <unotools/localfilehelper.hxx> -#ifndef _SVTOOLS_HRC #include "svtools/svtools.hrc" -#endif -#ifndef _SVT_HELPID_HRC #include "svtools/helpid.hrc" -#endif -#ifndef _SVTOOLS_IODLGIMPL_HRC #include "iodlg.hrc" -#endif #include "rtl/instance.hxx" #include "asyncfilepicker.hxx" #include "iodlgimp.hxx" #include "svtools/inettbc.hxx" #include "unotools/syslocale.hxx" #include "svtools/QueryFolderName.hxx" -#ifndef _RTL_USTRING_HXX #include <rtl/ustring.hxx> -#endif #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/ucb/XContentProviderManager.hpp> #include <com/sun/star/ui/dialogs/CommonFilePickerElementIds.hpp> @@ -89,13 +82,10 @@ #include <com/sun/star/uno/RuntimeException.hpp> #include <com/sun/star/beans/XPropertySet.hpp> -#ifndef _UNOTOOLS_PROCESSFACTORY_HXX #include <comphelper/processfactory.hxx> -#endif #include <osl/file.h> #include <vcl/waitobj.hxx> -// #97148# ------------------------------------ #include <com/sun/star/task/XInteractionHandler.hpp> #include "com/sun/star/ucb/InteractiveAugmentedIOException.hpp" #include "fpinteraction.hxx" @@ -132,8 +122,8 @@ using namespace InternalFilePickerElementIds; #define GET_DECODED_NAME(aObj) \ aObj.getName( INetURLObject::LAST_SEGMENT, true, INetURLObject::DECODE_WITH_CHARSET ) -// Zeit die beim Traveln in der Filterbox gewartet wird, -// bis in der Browsebox gefiltert wird ( in ms ). +// Time to wait while traveling in the filterbox until +// the browsebox gets filtered ( in ms). #define TRAVELFILTER_TIMEOUT 750 #define WIDTH_ADDITION 15 @@ -152,7 +142,6 @@ namespace if ( !pFilter ) pFilter = pImpl->GetCurFilter(); - // Filtern. if ( !pFilter ) return String(); @@ -246,7 +235,6 @@ namespace { // check if it is a real file extension, and not only the "post-dot" part in // a directory name - // 28.03.2002 - 98337 - fs@openoffice.org sal_Bool bRealExtensions = sal_True; if ( STRING_NOTFOUND != aExt.Search( '/' ) ) bRealExtensions = sal_False; @@ -267,7 +255,6 @@ namespace } if ( INET_PROT_FILE == aURL.GetProtocol() ) { - // #97148# & #102204# ----- try { bRealExtensions = !_pDialog->ContentIsFolder( aURL.GetMainURL( INetURLObject::NO_DECODE ) ); @@ -325,7 +312,7 @@ namespace } catch( const Exception& ) { - DBG_ERROR( "lcl_getHomeDirectory: caught an exception!" ); + OSL_FAIL( "lcl_getHomeDirectory: caught an exception!" ); } return 0 < _rHomeDir.Len(); } @@ -530,7 +517,7 @@ SvtFileDialog::~SvtFileDialog() SvtViewOptions aDlgOpt( E_DIALOG, _pImp->_aIniKey ); aDlgOpt.SetWindowState( String( GetWindowState(), osl_getThreadTextEncoding() ) ); String sUserData = _pFileView->GetConfigString(); - aDlgOpt.SetUserItem( ::rtl::OUString::createFromAscii( "UserData" ), + aDlgOpt.SetUserItem( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "UserData" )), makeAny( ::rtl::OUString( sUserData ) ) ); } @@ -557,8 +544,7 @@ void SvtFileDialog::Init_Impl WinBits nStyle ) { - sal_Bool bIsHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); - m_aImages = ImageList( SvtResId( bIsHighContrast ? RID_FILEPICKER_IMAGES_HC : RID_FILEPICKER_IMAGES ) ); + m_aImages = ImageList( SvtResId( RID_FILEPICKER_IMAGES ) ); _pImp->_nStyle = nStyle; _pImp->_a6Size = LogicToPixel( Size( 6, 6 ), MAP_APPFONT ); @@ -572,14 +558,13 @@ void SvtFileDialog::Init_Impl INetURLObject aStdDirObj( SvtPathOptions().GetWorkPath() ); SetStandardDir( aStdDirObj.GetMainURL( INetURLObject::NO_DECODE ) ); - // Reichweite bestimmen. + // determine range if ( !( nStyle & SFXWB_NOREMOTE ) ) { _pImp->_nState |= FILEDLG_STATE_REMOTE; } - // Kontrollelement erzeugen, wobei die Reihenfolge die Tab-Steuerung - // bestimmt. + // Create control element, the order defines the tab control. _pImp->_pFtFileName = new FixedText( this, SvtResId( FT_EXPLORERFILE_FILENAME ) ); SvtURLBox* pURLBox = new SvtURLBox( this ); @@ -652,7 +637,7 @@ void SvtFileDialog::Init_Impl _pFileView->SetHelpId( HID_FILEDLG_STANDARD ); _pFileView->SetStyle( _pFileView->GetStyle() | WB_TABSTOP ); - // Positionen und Groessen der Knoepfe bestimmen. + // determine the positions and size of the buttons Image aNewFolderImg( GetButtonImage( IMG_FILEDLG_CREATEFOLDER ) ); _pImp->_pBtnNewFolder->SetModeImage( aNewFolderImg ); @@ -722,15 +707,14 @@ void SvtFileDialog::Init_Impl AddControls_Impl( ); - // Zahl der Pixel bestimmen, um die die anderen Elemente in der Position - // Angepasst werden muessen. + // Determine the amount of pixel the other elements have to be adjusted in their position. aPos.Y() += aSize.Height(); aPos.Y() += LogicToPixel( Size( 0, 6 ), MAP_APPFONT ).Height(); long nYOffset = aPos.Y(); aPos = _pFileView->GetPosPixel(); nYOffset -= aPos.Y(); - // Positionen der uebrigen Elemente anpassen. + // Adjust the position of the other elements. aPos.Y() += nYOffset; _pFileView->SetPosPixel( aPos ); @@ -755,12 +739,12 @@ void SvtFileDialog::Init_Impl lcl_MoveControl( _pImp->_pBtnHelp, 0, nYOffset + 3 ); // a little more spacing between Cancel- and HelpButton - // Groesse des Dialoges anpassen. + // adjust size of the dialog aSize = GetSizePixel(); aSize.Height() += nYOffset; SetSizePixel( aSize ); - // Beschriftungen dem Modus anpassen. + // adjust the labels to the mode sal_uInt16 nResId = STR_EXPLORERFILE_OPEN; sal_uInt16 nButtonResId = 0; @@ -788,7 +772,7 @@ void SvtFileDialog::Init_Impl _pImp->GetFilterListControl()->Hide(); } - // Einstellungen der Steuerelemente vornehmen. + // Setting preferences of the control elements. _pImp->_pBtnNewFolder->SetClickHdl( STATIC_LINK( this, SvtFileDialog, NewFolderHdl_Impl ) ); _pImp->_pBtnFileOpen->SetClickHdl( STATIC_LINK( this, SvtFileDialog, OpenHdl_Impl ) ); _pImp->_pBtnCancel->SetClickHdl( LINK( this, SvtFileDialog, CancelHdl_Impl ) ); @@ -799,17 +783,15 @@ void SvtFileDialog::Init_Impl _pFileView->SetDoubleClickHdl( LINK( this, SvtFileDialog, DblClickHdl_Impl ) ); _pFileView->SetOpenDoneHdl( LINK( this, SvtFileDialog, OpenDoneHdl_Impl ) ); - // Resourcen freigeben. FreeResource(); - // Timer fuer Filterbox Travel setzen + // set timer for the filterbox travel _pImp->_aFilterTimer.SetTimeout( TRAVELFILTER_TIMEOUT ); _pImp->_aFilterTimer.SetTimeoutHdl( STATIC_LINK( this, SvtFileDialog, FilterSelectHdl_Impl ) ); if ( WB_SAVEAS & nStyle ) { // different help ids if in save-as mode - // 90744 - 09.08.2001 - frank.schoenheit@sun.com SetHelpId( HID_FILESAVE_DIALOG ); _pImp->_pEdFileName->SetHelpId( HID_FILESAVE_FILEURL ); @@ -825,7 +807,6 @@ void SvtFileDialog::Init_Impl // for the extra use cases, and separated _pLbFileVersion // I did not find out in which cases the help ID is really needed HID_FILESAVE_TEMPLATE - all // tests I made lead to a dialog where _no_ of the three list boxes was present. - // 96930 - 15.08.2002 - fs@openoffice.org if ( _pImp->_pLbFileVersion ) _pImp->_pLbFileVersion->SetHelpId( HID_FILESAVE_TEMPLATE ); if ( _pImp->_pLbTemplates ) @@ -881,7 +862,6 @@ IMPL_STATIC_LINK_NOINSTANCE( SvtFileDialog, ViewHdl_Impl, ImageButton*, EMPTYARG return 0; } -//***************************************************************************** //----------------------------------------------------------------------------- sal_Bool SvtFileDialog::createNewUserFilter( const String& _rNewFilter, sal_Bool _bAllowUserDefExt ) { @@ -897,7 +877,6 @@ sal_Bool SvtFileDialog::createNewUserFilter( const String& _rNewFilter, sal_Bool SetDefaultExt( _rNewFilter.Copy( 2 ) ); // TODO: this is nonsense. In the whole file there are a lotta places where we assume that a user filter // is always "*.<something>". But changing this would take some more time than I have now ... - // 05.12.2001 - 95486 - fs@openoffice.org // now, the default extension is set to the one of the user filter (or empty) // if the former is not allowed (_bAllowUserDefExt = <FALSE/>), we have to use the ext of the current filter @@ -1017,7 +996,7 @@ IMPL_STATIC_LINK( SvtFileDialog, OpenHdl_Impl, void*, pVoid ) { if ( pThis->_pImp->_bMultiSelection && pThis->_pFileView->GetSelectionCount() > 1 ) { - // bei Multiselektion spezielles Open + // special open in case of multiselection pThis->OpenMultiSelection_Impl(); return 0; } @@ -1033,7 +1012,6 @@ IMPL_STATIC_LINK( SvtFileDialog, OpenHdl_Impl, void*, pVoid ) // if an entry is selected in the view .... if ( pThis->_pFileView->GetSelectionCount() ) { // -> use this one. This will allow us to step down this folder - // #i8928# - 2002-12-20 - fs@openoffice.org aFileName = pThis->_pFileView->GetCurrentURL(); } } @@ -1058,7 +1036,7 @@ IMPL_STATIC_LINK( SvtFileDialog, OpenHdl_Impl, void*, pVoid ) return 0; } -#if defined( UNX ) || defined( FS_PRIV_DEBUG ) +#if defined( UNX ) if ( ( 1 == aText.Len() ) && ( '~' == aText.GetBuffer()[0] ) ) { // go to the home directory @@ -1126,7 +1104,7 @@ IMPL_STATIC_LINK( SvtFileDialog, OpenHdl_Impl, void*, pVoid ) } } - // Pr"ufen, ob es sich um einen Ordner handelt. + // check if it is a folder sal_Bool bIsFolder = sal_False; // first thing before doing anyhing with the content: Reset it. When the user presses "open" (or "save" or "export", @@ -1136,7 +1114,6 @@ IMPL_STATIC_LINK( SvtFileDialog, OpenHdl_Impl, void*, pVoid ) // error messages for the same content a second time .... pThis->m_aContent.bindTo( ::rtl::OUString( ) ); - // #97148# & #102204# --------- if ( aFileName.Len() ) { // Make sure we have own Interaction Handler in place. We do not need @@ -1185,8 +1162,8 @@ IMPL_STATIC_LINK( SvtFileDialog, OpenHdl_Impl, void*, pVoid ) && !( FILEDLG_MODE_SAVE == pThis->_pImp->_eMode // we're saving a file && pThis->_pFileView->GetSelectionCount() // there is a selected file in the file view -> it will later on ) // (in SvtFileDialog::GetPathList) be taken as file to save to - // (#114818# - 2004-03-17 - fs@openoffice.org) - && FILEDLG_MODE_OPEN != pThis->_pImp->_eMode // pb: #i83408# don't append extension on open + + && FILEDLG_MODE_OPEN != pThis->_pImp->_eMode // #i83408# don't append extension on open ) { // check extension and append the default extension if necessary @@ -1226,12 +1203,12 @@ IMPL_STATIC_LINK( SvtFileDialog, OpenHdl_Impl, void*, pVoid ) } else if ( !( nNewFilterFlags & FLT_NONEMPTY ) ) { - // Ggf. URL speichern. + // if applicable save URL pThis->_aPath = aFileName; } else { - // Ggf. neu filtern. + // if applicable filter again if ( nNewFilterFlags & FLT_CHANGED ) pThis->ExecuteFilter(); return 0; @@ -1257,7 +1234,12 @@ IMPL_STATIC_LINK( SvtFileDialog, OpenHdl_Impl, void*, pVoid ) { if ( ::utl::UCBContentHelper::Exists( aFileObj.GetMainURL( INetURLObject::NO_DECODE ) ) ) { - QueryBox aBox( pThis, WB_YES_NO, SvtResId( STR_SVT_ALREADYEXISTOVERWRITE ) ); + String aMsg = SvtResId( STR_SVT_ALREADYEXISTOVERWRITE ); + aMsg.SearchAndReplace( + String( RTL_CONSTASCII_USTRINGPARAM( "$filename$" ) ), + aFileObj.getName(INetURLObject::LAST_SEGMENT, true, INetURLObject::DECODE_WITH_CHARSET) + ); + QueryBox aBox( pThis, WB_YES_NO, aMsg ); if ( aBox.Execute() != RET_YES ) return 0; } @@ -1269,7 +1251,6 @@ IMPL_STATIC_LINK( SvtFileDialog, OpenHdl_Impl, void*, pVoid ) // if content does not exist: at least its path must exist INetURLObject aPathObj = aFileObj; aPathObj.removeSegment(); - // #97148# & #102204# ------------ sal_Bool bFolder = pThis->m_aContent.isFolder( aPathObj.GetMainURL( INetURLObject::NO_DECODE ) ); if ( !bFolder ) { @@ -1284,12 +1265,10 @@ IMPL_STATIC_LINK( SvtFileDialog, OpenHdl_Impl, void*, pVoid ) case FILEDLG_MODE_OPEN: { // do an existence check herein, again - // 16.11.2001 - 93107 - frank.schoenheit@sun.com if ( INET_PROT_FILE == aFileObj.GetProtocol( ) ) { sal_Bool bExists = sal_False; - // #102204# -------------- bExists = pThis->m_aContent.is( aFileObj.GetMainURL( INetURLObject::NO_DECODE ) ); @@ -1316,10 +1295,10 @@ IMPL_STATIC_LINK( SvtFileDialog, OpenHdl_Impl, void*, pVoid ) break; default: - DBG_ERROR("SvtFileDialog, OpenHdl_Impl: invalid mode!"); + OSL_FAIL("SvtFileDialog, OpenHdl_Impl: invalid mode!"); } - // Interessenten benachrichtigen. + // notify interested parties long nRet; if ( pThis->_aOKHdl.IsSet() ) @@ -1348,10 +1327,10 @@ IMPL_STATIC_LINK( SvtFileDialog, FilterSelectHdl_Impl, ListBox*, pBox ) { DBG_ASSERT( pBox, "SvtFileDialog:keine Instanz" ); - // wurde der Handler vom Travel-Timer gefeuert? + // was the handler executed by the travel timer? if ( pBox == (ListBox*)&pThis->_pImp->_aFilterTimer ) { - // Anzeige erneut filtern. + // filter the view again pThis->ExecuteFilter(); return 0; } @@ -1393,10 +1372,10 @@ IMPL_STATIC_LINK( SvtFileDialog, FilterSelectHdl_Impl, ListBox*, pBox ) String sLastFilterExt = pThis->_pImp->GetCurFilter()->GetExtension(); DELETEZ( pThis->_pImp->_pUserFilter ); - // Ggf. Filter des Benutzers entfernen. + // if applicable remove filter of the user pThis->_pImp->SetCurFilter( pSelectedFilter, sSelectedFilterDisplayName ); - // Ggf. Endung anzeigen. + // if applicable show extension pThis->SetDefaultExt( pSelectedFilter->GetExtension() ); sal_uInt16 nSepPos = pThis->GetDefaultExt().Search( FILEDIALOG_DEF_EXTSEP ); @@ -1406,20 +1385,20 @@ IMPL_STATIC_LINK( SvtFileDialog, FilterSelectHdl_Impl, ListBox*, pBox ) // update the extension of the current file if necessary lcl_autoUpdateFileExtension( pThis, sLastFilterExt ); - // wenn der Benutzer schnell durch die Filterbox - // travelt, nicht sofort Filtern + // if the user is traveling fast through the filterbox + // do not filter instantly if ( pThis->_pImp->IsFilterListTravelSelect() ) { - // FilterSelectHdl_Impl soll in - // TRAVELFILTER_TIMEOUT ms neu gefeuert werden + // FilterSelectHdl_Impl should be started again in + // TRAVELFILTER_TIMEOUT ms pThis->_pImp->_aFilterTimer.Start(); } else { - // evtl. vorher gestarteten Timer stoppen + // stop previously started timer pThis->_pImp->_aFilterTimer.Stop(); - // Anzeige erneut filtern. + // filter the view again pThis->ExecuteFilter(); } } @@ -1450,17 +1429,15 @@ IMPL_STATIC_LINK( SvtFileDialog, FileNameModifiedHdl_Impl, void*, EMPTYARG ) SvtFileDialogFilter_Impl* SvtFileDialog::FindFilter_Impl ( const String& _rFilter, - sal_Bool _bMultiExt,/* sal_True - auch Filter mit mehreren Endungen - beruecksichtigen - sal_False - keine ... + sal_Bool _bMultiExt,/* TRUE - regard filter with several extensions + FALSE - do not ... */ sal_Bool& _rFilterChanged ) -/* [Beschreibung] +/* [Description] - Die Methode sucht in den eingef"ugten Filtern nach der - spezifizierten Endung. + This method looks for the specified extension in the included filters. */ { @@ -1497,7 +1474,7 @@ SvtFileDialogFilter_Impl* SvtFileDialog::FindFilter_Impl if ( pFoundFilter ) { - // Filter aktivieren. + // activate filter _rFilterChanged = _pImp->_pUserFilter || ( _pImp->GetCurFilter() != pFilter ); createNewUserFilter( _rFilter, sal_False ); @@ -1520,9 +1497,9 @@ void SvtFileDialog::ExecuteFilter() void SvtFileDialog::OpenMultiSelection_Impl() -/* [Beschreibung] +/* [Description] - OpenHandler f"ur MultiSelektion + OpenHandler for MultiSelection */ { @@ -1533,7 +1510,7 @@ void SvtFileDialog::OpenMultiSelection_Impl() if ( nCount && pEntry ) _aPath = _pFileView->GetURL( pEntry ); - // Interessenten benachrichtigen. + // notify interested parties long nRet; if ( _aOKHdl.IsSet() ) @@ -1644,7 +1621,7 @@ IMPL_LINK( SvtFileDialog, SelectHdl_Impl, SvTabListBox*, pBox ) if ( _pImp->_bMultiSelection && _pFileView->GetSelectionCount() > 1 ) { - // bei Multiselektion den Datei-Edit leeren + // clear the file edit for multiselection _pImp->_pEdFileName->SetText( String() ); } @@ -1755,9 +1732,9 @@ IMPL_LINK( SvtFileDialog, PlayButtonHdl_Impl, PushButton*, EMPTYARG ) long SvtFileDialog::Notify( NotifyEvent& rNEvt ) -/* [Beschreibung] +/* [Description] - Die Methode wird gerufen, <BACKSPACE> abzufangen. + This method gets called to catch <BACKSPACE>. */ { @@ -1772,7 +1749,7 @@ long SvtFileDialog::Notify( NotifyEvent& rNEvt ) if ( !rKeyCode.GetModifier() && KEY_BACKSPACE == nCode && !_pImp->_pEdFileName->HasChildPathFocus() ) { - nRet = 0; //! (long)_pFileView->DoBeamerKeyInput( *rNEvt.GetKeyEvent() ); + nRet = 0; if ( !nRet && _pImp->_pBtnUp->IsEnabled() ) { @@ -1780,15 +1757,6 @@ long SvtFileDialog::Notify( NotifyEvent& rNEvt ) nRet = 1; } } -// else if ( rKeyCode.IsMod1() && ( KEY_C == nCode || KEY_V == nCode || KEY_X == nCode ) ) -// { -/* (mhu) - String aVerb = KEY_C == nCode ? UniString(RTL_CONSTASCII_USTRINGPARAM(SVT_MENUPART_VERB_COPY)) : - ( KEY_V == nCode ? UniString(RTL_CONSTASCII_USTRINGPARAM(SVT_MENUPART_VERB_PASTE)) : UniString(RTL_CONSTASCII_USTRINGPARAM(SVT_MENUPART_VERB_CUT)) ); -//(dv) if ( !CntPopupMenu::DoVerbCommand( aVerb, _pFileView->GetView() ) ) -//(dv) Sound::Beep(); -*/ -// } } return nRet ? nRet : ModalDialog::Notify( rNEvt ); } @@ -1884,7 +1852,6 @@ String SvtFileDialog::implGetInitialURL( const String& _rPath, const String& _rF if ( bIsInvalid && m_bHasFilename && !aURLParser.hasFinalSlash() ) { // check if the parent folder exists - // #108429# - 2003-03-26 - fs@openoffice.org INetURLObject aParent( aURLParser ); aParent.removeSegment( ); aParent.setFinalSlash( ); @@ -1926,27 +1893,24 @@ short SvtFileDialog::Execute() if ( !PrepareExecute() ) return 0; - // Start des Dialogs. + // start the dialog _bIsInExecute = sal_True; short nResult = ModalDialog::Execute(); _bIsInExecute = sal_False; DBG_ASSERT( !m_pCurrentAsyncAction.is(), "SvtFilePicker::Execute: still running an async action!" ); - // the dialog should not be cancellable while an async action is running - firs, the action + // the dialog should not be cancellable while an async action is running - first, the action // needs to be cancelled - // letztes Verzeichnis merken + // remember last directory if ( RET_OK == nResult ) { INetURLObject aURL( _aPath ); if ( aURL.GetProtocol() == INET_PROT_FILE ) { - // nur bei File-URL's und nicht bei virtuelle Folder - // das ausgew"ahlte Verzeichnis merken + // remember the selected directory only for file URLs not for virtual folders sal_Int32 nLevel = aURL.getSegmentCount(); - // #97148# & #102204# ------ sal_Bool bDir = m_aContent.isFolder( aURL.GetMainURL( INetURLObject::NO_DECODE ) ); - // sal_Bool bClassPath = ( ( _pImp->_nStyle & SFXWB_CLASSPATH ) == SFXWB_CLASSPATH ); if ( nLevel > 1 && ( FILEDLG_TYPE_FILEDLG == _pImp->_eDlgType || !bDir ) ) aURL.removeSegment(); } @@ -1960,8 +1924,7 @@ void SvtFileDialog::StartExecuteModal( const Link& rEndDialogHdl ) { PrepareExecute(); - // Start des Dialogs. -// _bIsInExecute = sal_True; + // start of the dialog ModalDialog::StartExecuteModal( rEndDialogHdl ); } @@ -2024,7 +1987,7 @@ void SvtFileDialog::displayIOException( const String& _rURL, IOErrorCode _eCode } catch( const Exception& ) { - DBG_ERROR( "iodlg::displayIOException: caught an exception!" ); + OSL_FAIL( "iodlg::displayIOException: caught an exception!" ); } } @@ -2072,7 +2035,7 @@ short SvtFileDialog::PrepareExecute() { rtl::OUString aEnvValue; if ( getEnvironmentValue( "WorkDirMustContainRemovableMedia", aEnvValue ) && - aEnvValue.equalsAscii( "1" ) ) + aEnvValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "1" ) ) ) { try { @@ -2081,8 +2044,8 @@ short SvtFileDialog::PrepareExecute() INetURLObject::NO_DECODE ) ), Reference< XCommandEnvironment >() ); Sequence< rtl::OUString > aProps(2); - aProps[0] = rtl::OUString::createFromAscii( "IsVolume" ); - aProps[1] = rtl::OUString::createFromAscii( "IsRemoveable" ); + aProps[0] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "IsVolume" )); + aProps[1] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "IsRemoveable" )); Reference< XResultSet > xResultSet = aCnt.createCursor( aProps, ::ucbhelper::INCLUDE_FOLDERS_ONLY ); @@ -2098,21 +2061,7 @@ short SvtFileDialog::PrepareExecute() } else { -// @@@ KSO 05/18/2006: support for removable media currently hardcoded/incomplete in OSL -// -// do -// { -// // check, whether child is a removable volume -// if ( xRow->getBoolean( 1 ) && !xRow->wasNull() ) -// { -// if ( xRow->getBoolean( 2 ) && !xRow->wasNull() ) -// { bEmpty = false; -// break; -// } -// } -// } -// while ( xResultSet->next() ); } if ( bEmpty ) @@ -2131,16 +2080,14 @@ short SvtFileDialog::PrepareExecute() } } - // #102204# --------------- if ( ( _pImp->_nStyle & WB_SAVEAS ) && m_bHasFilename ) // when doing a save-as, we do not want the handler to handle "this file does not exist" messages // - finally we're going to save that file, aren't we? - // #105812# - 2002-12-02 - fs@openoffice.org m_aContent.enableOwnInteractionHandler(::svt::OFilePickerInteractionHandler::E_DOESNOTEXIST); else m_aContent.enableDefaultInteractionHandler(); - // #53016# evtl. nur ein Filename ohne Pfad? + // possibly just a filename without a path String aFileNameOnly; if( _aPath.Len() && (_pImp->_eMode == FILEDLG_MODE_SAVE) && (_aPath.Search(':') == STRING_NOTFOUND) @@ -2151,13 +2098,13 @@ short SvtFileDialog::PrepareExecute() _aPath.Erase(); } - // kein Startpfad angegeben? + // no starting path specified? if ( !_aPath.Len() ) { - // dann das Standard-Dir verwenden + // then use the standard directory _aPath = lcl_ensureFinalSlash( _pImp->GetStandardDir() ); - // #53016# vorgegebener Dateiname an Pfad anh"angen + // attach given filename to path if ( aFileNameOnly.Len() ) _aPath += aFileNameOnly; } @@ -2175,17 +2122,17 @@ short SvtFileDialog::PrepareExecute() if ( !m_aURLFilter.isUrlAllowed( _aPath ) ) _aPath = m_aURLFilter.getFilter()[0]; - // Ggf. Filter anzeigen. + // if applicable show filter _pImp->InitFilterList(); - // Initialen Filter einstellen. + // set up initial filter sal_uInt16 nFilterCount = GetFilterCount(); String aAll( SvtResId( STR_FILTERNAME_ALL ) ); sal_Bool bHasAll = _pImp->HasFilterListEntry( aAll ); if ( _pImp->GetCurFilter() || nFilterCount == 1 || ( nFilterCount == 2 && bHasAll ) ) { - // Ggf. einzigen Filter als aktuellen Filter setzen oder den einzigen - // Filter, der nicht auf alle Dateien verweist. + // if applicable set the only filter or the only filter that + // does not refer to all files, as the current one if ( !_pImp->GetCurFilter() ) { sal_uInt16 nPos = 0; @@ -2203,7 +2150,7 @@ short SvtFileDialog::PrepareExecute() _pImp->SetCurFilter( pNewCurFilter, pNewCurFilter->GetName() ); } - // Anzeige anpassen. + // adjust view _pImp->SelectFilterListEntry( _pImp->GetCurFilter()->GetName() ); SetDefaultExt( _pImp->GetCurFilter()->GetExtension() ); sal_uInt16 nSepPos = GetDefaultExt().Search( FILEDIALOG_DEF_EXTSEP ); @@ -2212,7 +2159,7 @@ short SvtFileDialog::PrepareExecute() } else { - // Ggf. Filter fuer alle Dateien setzen bzw. erzeugen. + // if applicable set respectively create filter for all files if ( !bHasAll ) { SvtFileDialogFilter_Impl* pAllFilter = implAddFilter( aAll, UniString(RTL_CONSTASCII_USTRINGPARAM(FILEDIALOG_FILTER_ALL)) ); @@ -2224,8 +2171,7 @@ short SvtFileDialog::PrepareExecute() _pImp->_pDefaultFilter = _pImp->GetCurFilter(); - // HACK #50065# - // ggf. Filter isolieren. + // if applicable isolate filter String aFilter; if ( !IsolateFilterFromPath_Impl( _aPath, aFilter ) ) @@ -2236,9 +2182,8 @@ short SvtFileDialog::PrepareExecute() { _pImp->_pEdFileName->SetText( aFilter ); } - // HACK #50065# - // Instanz fuer den gesetzten Pfad erzeugen und anzeigen. + // create and show instance for set path INetURLObject aFolderURL( _aPath ); String aFileName( aFolderURL.getName( INetURLObject::LAST_SEGMENT, false ) ); xub_StrLen nFileNameLen = aFileName.Len(); @@ -2252,7 +2197,7 @@ short SvtFileDialog::PrepareExecute() INetURLObject aObj = aFolderURL; if ( aObj.GetProtocol() == INET_PROT_FILE ) { - // Ordner als aktuelles Verzeichnis setzen. + // set folder as current directory aObj.setFinalSlash(); } @@ -2261,16 +2206,13 @@ short SvtFileDialog::PrepareExecute() // Somebody might want to enable some controls acording to the current filter FilterSelect(); - // Zustand der Steuerelemente anpassen. -// EndListeningAll(); - ViewHdl_Impl( this, NULL ); OpenURL_Impl( aObj.GetMainURL( INetURLObject::NO_DECODE ) ); _pFileView->Show(); SvtDefModalDialogParent_Impl aDefParent( this ); - // ggf. Gr"osse aus Ini lesen und setzen + // if applicable read and set size from ini InitSize(); return 1; @@ -2344,9 +2286,9 @@ void SvtFileDialog::FilterSelect() void SvtFileDialog::SetStandardDir( const String& rStdDir ) -/* [Beschreibung] +/* [Description] - Die Methode setzt den Pfad f"ur den Standardknopf. + This method sets the path for the default button. */ { @@ -2371,9 +2313,9 @@ const ::com::sun::star::uno::Sequence< ::rtl::OUString >& SvtFileDialog::GetBlac const String& SvtFileDialog::GetStandardDir() const -/* [Beschreibung] +/* [Description] - Diese Methode gibt den eingestellten Standardpfad zur"uck. + This method returns the standard path. */ { @@ -2432,14 +2374,12 @@ void SvtFileDialog::AddFilterGroup( const String& _rFilter, const Sequence< Stri implAddFilter( pSubFilters->First, pSubFilters->Second ); } -//***************************************************************************** - //----------------------------------------------------------------------------- void SvtFileDialog::SetCurFilter( const String& rFilter ) { DBG_ASSERT( !IsInExecute(), "SvtFileDialog::SetCurFilter: currently executing!" ); - // Entsprechenden Filter suchen. + // look for corresponding filter sal_uInt16 nPos = _pImp->_pFilter->Count(); while ( nPos-- ) @@ -2498,8 +2438,7 @@ void SvtFileDialog::InitSize() if ( !_pImp->_nFixDeltaHeight ) { - // Fixgr"ossen errechnen und merken - Point aPnt = _pFileView->GetPosPixel(); + // calculate and save fixsize long nBoxH = _pFileView->GetSizePixel().Height(); long nH = GetSizePixel().Height(); _pImp->_nFixDeltaHeight = nH - nBoxH; @@ -2512,7 +2451,7 @@ void SvtFileDialog::InitSize() { SetWindowState( ByteString( String( aDlgOpt.GetWindowState() ), osl_getThreadTextEncoding() ) ); - Any aUserData = aDlgOpt.GetUserItem( ::rtl::OUString::createFromAscii( "UserData" ) ); + Any aUserData = aDlgOpt.GetUserItem( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "UserData" ) )); ::rtl::OUString sCfgStr; if ( aUserData >>= sCfgStr ) _pFileView->SetConfigString( String( sCfgStr ) ); @@ -2574,13 +2513,12 @@ void SvtFileDialog::implArrangeControls() // (including the FixedTexts is important - not for tabbing order (they're irrelevant there), // but for working keyboard shortcuts) - // 96861 - 23.01.2002 - fs@openoffice.org }; // loop through all these controls and adjust the z-order Window* pPreviousWin = NULL; Control** pCurrent = pControls; - for ( sal_Int32 i = 0; i < sal_Int32(sizeof( pControls ) / sizeof( pControls[ 0 ] )); ++i, ++pCurrent ) + for ( sal_Int32 i = 0; i < sal_Int32(SAL_N_ELEMENTS( pControls )); ++i, ++pCurrent ) { if ( !*pCurrent ) // this control is not available in the current operation mode -> skip @@ -2609,7 +2547,7 @@ sal_Bool SvtFileDialog::IsolateFilterFromPath_Impl( String& rPath, String& rFilt if ( nQuestionMarkPos != STRING_NOTFOUND ) { - // Fragezeichen als Wildcard nur bei Files + // use question mark as wildcard only for files INetProtocol eProt = INetURLObject::CompareProtocolScheme( rPath ); if ( INET_PROT_NOT_VALID != eProt && INET_PROT_FILE != eProt ) @@ -2647,7 +2585,7 @@ sal_Bool SvtFileDialog::IsolateFilterFromPath_Impl( String& rPath, String& rFilt #endif } - // Syntax pr"ufen. + // check syntax if ( nPathTokenPos != STRING_NOTFOUND ) { if ( nPathTokenPos < (rPath.Len() - nWildCardPos - 1) ) @@ -2656,12 +2594,12 @@ sal_Bool SvtFileDialog::IsolateFilterFromPath_Impl( String& rPath, String& rFilt return sal_False; } - // Filter abschneiden. + // cut off filter rFilter = aReversePath; rFilter.Erase( nPathTokenPos ); rFilter.Reverse(); - // Ordner bestimmen. + // determine folder rPath = aReversePath; rPath.Erase( 0, nPathTokenPos ); rPath.Reverse(); @@ -2676,16 +2614,10 @@ sal_Bool SvtFileDialog::IsolateFilterFromPath_Impl( String& rPath, String& rFilt return sal_True; } -//***************************************************************************** - //----------------------------------------------------------------------------- void SvtFileDialog::implUpdateImages( ) { - // determine high contrast mode - { - sal_Bool bIsHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); - m_aImages = ImageList( SvtResId( bIsHighContrast ? RID_FILEPICKER_IMAGES_HC : RID_FILEPICKER_IMAGES ) ); - } + m_aImages = ImageList( SvtResId( RID_FILEPICKER_IMAGES ) ); // set the appropriate images on the buttons if ( _pImp->_pBtnUp ) @@ -2744,7 +2676,7 @@ void SvtFileDialog::Resize() _pFileView->SetSizePixel( aNewSize ); if ( !nDeltaY && !nDeltaX ) - // Dieses Resize wurde nur zum Ein - oder Ausblenden des Indicators aufgerufen + // This resize was only called to show or hide the indicator. return; // ------------- @@ -2760,7 +2692,7 @@ void SvtFileDialog::Resize() _pPbPlay, _pImp->_pCbPassword, _pImp->_pCbAutoExtension, _pImp->_pCbOptions, _pCbSelection }; Control** ppMoveControls = aMoveControlsVert; - Control** ppMoveControlsEnd = ppMoveControls + sizeof( aMoveControlsVert ) / sizeof( aMoveControlsVert[0] ); + Control** ppMoveControlsEnd = ppMoveControls + SAL_N_ELEMENTS( aMoveControlsVert ); for ( ; ppMoveControls != ppMoveControlsEnd; ++ppMoveControls ) lcl_MoveControl( *ppMoveControls, 0, nDeltaY ); } @@ -2772,7 +2704,7 @@ void SvtFileDialog::Resize() _pImp->_pBtnFileOpen, _pImp->_pBtnCancel, _pImp->_pBtnHelp }; Control** ppMoveControls = aMoveControlsBoth; - Control** ppMoveControlsEnd = ppMoveControls + sizeof( aMoveControlsBoth ) / sizeof( aMoveControlsBoth[0] ); + Control** ppMoveControlsEnd = ppMoveControls + SAL_N_ELEMENTS( aMoveControlsBoth ); for ( ; ppMoveControls != ppMoveControlsEnd; ++ppMoveControls ) lcl_MoveControl( *ppMoveControls, nDeltaX, nDeltaY ); } @@ -2784,7 +2716,7 @@ void SvtFileDialog::Resize() _pImp->_pBtnUp, _pImp->_pBtnNewFolder, _pImp->_pBtnStandard }; Control** ppMoveControls = aMoveControlsHor; - Control** ppMoveControlsEnd = ppMoveControls + sizeof( aMoveControlsHor ) / sizeof( aMoveControlsHor[0] ); + Control** ppMoveControlsEnd = ppMoveControls + SAL_N_ELEMENTS( aMoveControlsHor ); for ( ; ppMoveControls != ppMoveControlsEnd; ++ppMoveControls ) lcl_MoveControl( *ppMoveControls, nDeltaX, 0 ); } @@ -2797,7 +2729,7 @@ void SvtFileDialog::Resize() _pImp->_pEdFileName, _pImp->_pLbFileVersion, _pImp->_pLbTemplates, _pImp->_pLbImageTemplates, _pImp->GetFilterListControl(), _pImp->_pFtCurrentPath, }; - sal_Int32 nSizeControls = sizeof( aSizeControls ) / sizeof( aSizeControls[0] ); + sal_Int32 nSizeControls = SAL_N_ELEMENTS( aSizeControls ); Control** ppSizeControls = aSizeControls; for ( sal_Int32 j=0; j<nSizeControls; ++j, ++ppSizeControls ) { @@ -2810,12 +2742,12 @@ void SvtFileDialog::Resize() } } - // zus"atzliche Controls ausrichten + // align additional controls if ( _pPrevWin && _pPrevWin->GetPosPixel().X() > _pFileView->GetPosPixel().X() ) { - // Controls vom Typ Window speziell ausrichten - // auch die Gr"osse anpassen + // special alignment for controls of the type window + // also adjust the size Point aNewPos = _pPrevWin->GetPosPixel(); aNewPos.X() += nDeltaX; _pPrevWin->SetPosPixel( aNewPos ); @@ -2834,8 +2766,6 @@ void SvtFileDialog::Resize() _pFileNotifier->notify( DIALOG_SIZE_CHANGED, 0 ); } -//***************************************************************************** - //----------------------------------------------------------------------------- Control* SvtFileDialog::getControl( sal_Int16 _nControlId, sal_Bool _bLabelControl ) const { @@ -2998,7 +2928,7 @@ void SvtFileDialog::AddControls_Impl( ) // we need to disable the auto width feature of the filter box _pImp->DisableFilterBoxAutoWidth(); - // "Vorschau" + // "preview" _pCbPreviewBox = new CheckBox( this ); _pCbPreviewBox->SetText( SvtResId( STR_SVT_FILEPICKER_SHOW_PREVIEW ) ); _pCbPreviewBox->SetHelpId( HID_FILEDLG_PREVIEW_CB ); @@ -3006,7 +2936,7 @@ void SvtFileDialog::AddControls_Impl( ) ReleaseOwnerShip( _pCbPreviewBox ); _pCbPreviewBox->SetClickHdl( LINK( this, SvtFileDialog, ClickHdl_Impl ) ); - // Preview-Fenster erst hier erzeugen + // generate preview window just here _pPrevWin = new Window( this, WinBits( WB_BORDER ) ); AddControl( _pPrevWin ); ReleaseOwnerShip( _pPrevWin ); @@ -3074,7 +3004,6 @@ void SvtFileDialog::AddControls_Impl( ) // This is strange. During the re-factoring during 96930, I discovered that this help id // is set in the "Templates mode". This was hidden in the previous implementation. // Shouldn't this be a more meaningfull help id. - // 96930 - 15.08.2002 - fs@openoffice.org } else if ( _nExtraBits & SFX_EXTRA_IMAGE_TEMPLATE ) { @@ -3152,15 +3081,6 @@ sal_Bool SvtFileDialog::setShowState( sal_Bool /*bShowState*/ ) // of the file dialog dynamically // support for set/getShowState is opionally // see com::sun::star::ui::dialogs::XFilePreview - /* - if ( _pPrevBmp ) - { - _pPrevBmp->Show( bShowState ); - return sal_True; - } - else - return sal_False; - */ return sal_False; } @@ -3204,9 +3124,9 @@ sal_Bool SvtFileDialog::getShowState() void SvtFileDialog::ReleaseOwnerShip( Window* pUserControl ) /* - [Beschreibung] - Die Methode sorgt dafuer das das spezifizierte Element nicht mehr im Besitz - der Instanz ist. + [Description] + This method ensures that the specified element is no longer in possession + of the instance. */ { @@ -3249,8 +3169,8 @@ sal_Bool SvtFileDialog::AddControl( Window* pControl, sal_Bool bNewLine ) long nTextWidth = pControl->GetTextWidth( pControl->GetText() ); aSize.Width() = nTextWidth + WIDTH_ADDITION; - // PushButton: Mindestbreite 50 logische Einheiten, - // H"ohe immer 14 logische Einheiten + // PushButton: Minimum width 50 logical units, + // height always 14 logical units. if ( aDefSiz.Width() > aSize.Width() ) aSize.Width() = aDefSiz.Width(); aSize.Height() = aDefSiz.Height(); @@ -3274,7 +3194,6 @@ sal_Bool SvtFileDialog::AddControl( Window* pControl, sal_Bool bNewLine ) Point aNewControlPos; Size* pNewDlgSize = NULL; sal_Bool bNewRow = bNewLine; - sal_Bool bFirstNewRow = sal_False; if ( nType == WINDOW_WINDOW ) { @@ -3307,7 +3226,6 @@ sal_Bool SvtFileDialog::AddControl( Window* pControl, sal_Bool bNewLine ) { // Create a new row if there was no usercontrol before. bNewRow = sal_True; - bFirstNewRow = sal_True; } // Check if a new row has to be created. @@ -3419,8 +3337,6 @@ void SvtFileDialog::appendDefaultExtension(String& _rFileName, } } -// ----------------------------------------------------------------------- - // QueryFolderNameDialog ------------------------------------------------------- namespace svtools { @@ -3481,3 +3397,5 @@ IMPL_LINK( QueryFolderNameDialog, NameHdl, Edit *, EMPTYARG ) } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/office/iodlg.hxx b/fpicker/source/office/iodlg.hxx index 746a6e1d207a..b33eeeede9b4 100644 --- a/fpicker/source/office/iodlg.hxx +++ b/fpicker/source/office/iodlg.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -27,12 +28,8 @@ #ifndef _IODLGIMPL_HXX #define _IODLGIMPL_HXX -#ifndef _VCL_DIALOG_HXX #include <vcl/dialog.hxx> -#endif -#ifndef _SV_BUTTON_HXX #include <vcl/button.hxx> -#endif #include <vcl/fixed.hxx> #include <vcl/edit.hxx> #include <vcl/combobox.hxx> @@ -69,10 +66,10 @@ class SvtFileDialogFilter_Impl; #define SFXWB_READONLY WB_READONLY #define SFXWB_PATHDIALOG WB_PATH #define SFXWB_CLASSPATH ( 0x08000000L | SFXWB_PATHDIALOG ) -#define SFXWB_SHOWALLFOLDER 0x10000000L // alle Ordner auch Mail/News/... -#define SFXWB_MULTISELECTION 0x20000000L // Multiselection an +#define SFXWB_SHOWALLFOLDER 0x10000000L // all directories including Mail/News/... +#define SFXWB_MULTISELECTION 0x20000000L // activate Multiselection #define SFXWB_NOREMOTE 0x40000000L -#define SFXWB_SHOWVERSIONS 0x80000000L // Versionsauswahl anzeigen +#define SFXWB_SHOWVERSIONS 0x80000000L // show version selection #define SFX_EXTRA_AUTOEXTENSION 0x00000001L #define SFX_EXTRA_FILTEROPTIONS 0x00000002L @@ -162,7 +159,7 @@ private: DECL_LINK( ClickHdl_Impl, CheckBox* ); DECL_LINK( PlayButtonHdl_Impl, PushButton* ); - // entfernt einen Filter mit Wildcards aus dem Path und gibt in zurueck + // removes a filter with wildcards from the path and returns it sal_Bool IsolateFilterFromPath_Impl( String& rPath, String& rFilter ); void implArrangeControls(); @@ -217,7 +214,7 @@ public: const ::com::sun::star::uno::Sequence< ::rtl::OUString >& GetBlackList() const; void SetStandardDir( const String& rStdDir ); const String& GetStandardDir() const; - SvStringsDtor* GetPathList() const; // bei MultiSelektion + SvStringsDtor* GetPathList() const; // for MultiSelection void AddFilter( const String& rFilter, const String& rType ); @@ -473,3 +470,5 @@ class SvtFilePicker; #endif // #ifndef _IODLG_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/office/iodlg.src b/fpicker/source/office/iodlg.src index 2a460797fe56..4a3c2f6736fb 100644 --- a/fpicker/source/office/iodlg.src +++ b/fpicker/source/office/iodlg.src @@ -53,13 +53,6 @@ ImageList RID_FILEPICKER_IMAGES FILEPICKER_IL_IDLIST }; -ImageList RID_FILEPICKER_IMAGES_HC -{ - Prefix = "fph"; - MASKCOLOR - FILEPICKER_IL_IDLIST -}; - // dialogs ******************************************************************* ModalDialog DLG_SVT_EXPLORERFILE @@ -99,21 +92,7 @@ ModalDialog DLG_SVT_EXPLORERFILE }; QuickHelpText [ en-US ] = "List"; }; - ImageButton BTN_EXPLORERFILE_DETAILSVIEW - { HelpID = "fpicker:ImageButton:DLG_SVT_EXPLORERFILE:BTN_EXPLORERFILE_DETAILSVIEW"; - TabStop = FALSE ; - Pos = MAP_APPFONT ( 109 , 6 ) ; - ButtonImage = Image - { - ImageBitmap = Bitmap - { - File = "sc06356.bmp" ; - }; - MASKCOLOR - }; - QuickHelpText [ en-US ] = "Details"; - }; MenuButton BTN_EXPLORERFILE_UP { HelpID = "fpicker:MenuButton:DLG_SVT_EXPLORERFILE:BTN_EXPLORERFILE_UP"; @@ -320,7 +299,7 @@ String STR_FILTERNAME_ALL String STR_SVT_ALREADYEXISTOVERWRITE { - Text [ en-US ] = "The file already exists. Overwrite?" ; + Text [ en-US ] = "A file named \"$filename$\" already exists.\n\nDo you want to replace it?" ; }; String STR_SVT_NEW_FOLDER @@ -333,5 +312,10 @@ String STR_SVT_NOREMOVABLEDEVICE Text [ en-US ] = "No removable storage device detected.\nMake sure it is plugged in properly and try again." ; }; +String STR_SVT_ALLFORMATS +{ + Text [ en-US ] = "All Formats" ; +}; + //******************************************************************** EOF diff --git a/fpicker/source/office/iodlgimp.cxx b/fpicker/source/office/iodlgimp.cxx index 41acd84be3e0..90b00c4bc803 100644 --- a/fpicker/source/office/iodlgimp.cxx +++ b/fpicker/source/office/iodlgimp.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -81,7 +82,7 @@ static inline String GetViewOptUserItem( const SvtViewOptions& rOpt ) } -// defines f"ur den Style der BrowseBox +// defines for the style of the BrowseBox #define STYLE_MULTI_SELECTION \ CNTVIEWSTYLE_NODE_BUTTONS | \ @@ -218,15 +219,14 @@ void SvtUpButton_Impl::FillURLMenu( PopupMenu* _pMenu ) delete _pURLs; _pURLs = new SvStringsDtor; - // "Ubergeordnete Ebenen bestimmen. + // determine parent levels INetURLObject aObject( pBox->GetViewURL() ); sal_Int32 nCount = aObject.getSegmentCount(); ::svtools::VolumeInfo aVolInfo( sal_True /* volume */, sal_False /* remote */, sal_False /* removable */, sal_False /* floppy */, sal_False /* compact disk */ ); - sal_Bool bIsHighContrast = pBox->GetSettings().GetStyleSettings().GetHighContrastMode(); - Image aVolumeImage( SvFileInformationManager::GetFolderImage( aVolInfo, bIsHighContrast ) ); + Image aVolumeImage( SvFileInformationManager::GetFolderImage( aVolInfo ) ); while ( nCount >= 1 ) { @@ -241,8 +241,7 @@ void SvtUpButton_Impl::FillURLMenu( PopupMenu* _pMenu ) aTitle = aObject.getName(); Image aImage = ( nCount > 1 ) // if nCount == 1 means workplace, which detects the wrong image - ? SvFileInformationManager::GetImage( aObject, bIsHighContrast ) - : aVolumeImage; + ? SvFileInformationManager::GetImage( aObject ) : aVolumeImage; _pMenu->InsertItem( nItemId++, aTitle, aImage ); _pURLs->Insert( pParentURL, _pURLs->Count() ); @@ -313,8 +312,6 @@ void SvtTravelButton_Impl::FillURLMenu( PopupMenu* _pMenu ) _pMenu->Clear(); - sal_Bool bIsHighContrast = GetDialogParent()->GetView()->GetSettings().GetStyleSettings().GetHighContrastMode(); - sal_uInt16 nItemId = 1; String sDisplayName; @@ -323,8 +320,7 @@ void SvtTravelButton_Impl::FillURLMenu( PopupMenu* _pMenu ) { if ( GetDialogParent()->isUrlAllowed( *aLoop ) ) { - Image aImage = SvFileInformationManager::GetImage( - INetURLObject(*aLoop), bIsHighContrast ); + Image aImage = SvFileInformationManager::GetImage( INetURLObject(*aLoop) ); if ( LocalFileHelper::ConvertURLToSystemPath(*aLoop, sDisplayName) ) _pMenu->InsertItem( nItemId, sDisplayName, aImage ); else @@ -505,3 +501,5 @@ void SvtExpFileDlg_Impl::CreateFilterListControl( Window* _pParent, const ResId& _pLbFilter->SetDropDownLineCount( 10 ); } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/office/iodlgimp.hxx b/fpicker/source/office/iodlgimp.hxx index 9826290858c2..2cc4f71edcc1 100644 --- a/fpicker/source/office/iodlgimp.hxx +++ b/fpicker/source/office/iodlgimp.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -57,9 +58,9 @@ class SvUShorts; // SvtFileDialogFilter_Impl //***************************************************************************** -/* [Beschreibung] +/* [Description] - Instanzen dieser Klasse repr"asentieren einen Filter + Instances of this class represent a filter. */ class SvtFileDialogFilter_Impl @@ -230,21 +231,21 @@ public: String _aStdDir; - // beim traveln der Filterbox erst Zeitversetzt filtern + // delay filter when traveling the filterbox Timer _aFilterTimer; - // Zeigt der OpenHdl_Imp(), ob das Open durch einen Doppelclick ausgel"ost wurde + // shows OpenHdl_Imp() if the open was triggered by a double click sal_Bool _bDoubleClick; sal_Bool m_bNeedDelayedFilterExecute; - // Liste mit den 5 zuletzt genutzten Filtern - // Defaultfilter fuer <Alle> oder <Alle ...> + // list of the 5 most recently used filters + // Defaultfilter for <All> oder <All ...> const SvtFileDialogFilter_Impl* _pDefaultFilter; - // Multiselektion? + // MultiSelection? sal_Bool _bMultiSelection; - // Fixgr"ossen f"ur Resize merken + // remember fixsizes for resize long _nFixDeltaHeight; Size _a6Size; Size _aDlgSize; @@ -337,3 +338,4 @@ inline void SvtExpFileDlg_Impl::SetCurFilter( SvtFileDialogFilter_Impl* pFilter #endif // #ifndef _IODLGIMP_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/office/pickercallbacks.hxx b/fpicker/source/office/pickercallbacks.hxx index 8942c90ce496..2140fe5c716d 100644 --- a/fpicker/source/office/pickercallbacks.hxx +++ b/fpicker/source/office/pickercallbacks.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -60,3 +61,4 @@ namespace svt #endif // SVTOOLS_PICKER_CALLBACKS_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/unx/gnome/FPServiceInfo.hxx b/fpicker/source/unx/gnome/FPServiceInfo.hxx index 1f8f8383619a..c0352af2b25d 100644 --- a/fpicker/source/unx/gnome/FPServiceInfo.hxx +++ b/fpicker/source/unx/gnome/FPServiceInfo.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -48,3 +49,5 @@ #define FOLDER_PICKER_REGKEY_NAME "/com.sun.star.ui.dialogs.SalGtkFolderPicker/UNO/SERVICES/com.sun.star.ui.dialogs.GtkFolderPicker" #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/unx/gnome/FPentry.cxx b/fpicker/source/unx/gnome/FPentry.cxx index ccca3dabf72c..d2463dc4c48a 100644 --- a/fpicker/source/unx/gnome/FPentry.cxx +++ b/fpicker/source/unx/gnome/FPentry.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,15 +29,19 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_fpicker.hxx" +#ifdef AIX +#define _LINUX_SOURCE_COMPAT +#include <sys/timer.h> +#undef _LINUX_SOURCE_COMPAT +#endif + //---------------------------------------------- // includes of other projects //---------------------------------------------- #include <cppuhelper/factory.hxx> -#include <com/sun/star/container/XSet.hpp> #include <osl/diagnose.h> #include "SalGtkFilePicker.hxx" #include "SalGtkFolderPicker.hxx" -#include <vcl/svapp.hxx> #include "FPServiceInfo.hxx" #include <glib-object.h> @@ -50,11 +55,9 @@ extern const guint gtk_minor_version; using namespace ::rtl; using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::container; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::registry; using namespace ::cppu; -using ::com::sun::star::ui::dialogs::XFilePicker; using ::com::sun::star::ui::dialogs::XFilePicker2; using ::com::sun::star::ui::dialogs::XFolderPicker; @@ -120,7 +123,7 @@ void* SAL_CALL component_getFactory( { Sequence< OUString > aSNS( 1 ); aSNS.getArray( )[0] = - OUString::createFromAscii(FILE_PICKER_SERVICE_NAME); + OUString(RTL_CONSTASCII_USTRINGPARAM(FILE_PICKER_SERVICE_NAME)); xFactory = createSingleFactory( reinterpret_cast< XMultiServiceFactory* > ( pSrvManager ), @@ -132,7 +135,7 @@ void* SAL_CALL component_getFactory( { Sequence< OUString > aSNS( 1 ); aSNS.getArray( )[0] = - OUString::createFromAscii(FOLDER_PICKER_SERVICE_NAME); + OUString(RTL_CONSTASCII_USTRINGPARAM(FOLDER_PICKER_SERVICE_NAME)); xFactory = createSingleFactory( reinterpret_cast< XMultiServiceFactory* > ( pSrvManager ), @@ -153,3 +156,4 @@ void* SAL_CALL component_getFactory( } // extern "C" +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/unx/gnome/SalGtkFilePicker.cxx b/fpicker/source/unx/gnome/SalGtkFilePicker.cxx index 3848ab081186..2034763528ec 100644 --- a/fpicker/source/unx/gnome/SalGtkFilePicker.cxx +++ b/fpicker/source/unx/gnome/SalGtkFilePicker.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,34 +29,35 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_fpicker.hxx" +#ifdef AIX +#define _LINUX_SOURCE_COMPAT +#include <sys/timer.h> +#undef _LINUX_SOURCE_COMPAT +#endif + //------------------------------------------------------------------------ // includes //------------------------------------------------------------------------ -#include <com/sun/star/lang/DisposedException.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp> -#include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp> #include <com/sun/star/ui/dialogs/CommonFilePickerElementIds.hpp> #include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp> -#include <cppuhelper/interfacecontainer.h> #include <osl/diagnose.h> #include <osl/process.h> #include <com/sun/star/ui/dialogs/TemplateDescription.hpp> #include <com/sun/star/ui/dialogs/ControlActions.hpp> #include <com/sun/star/uno/Any.hxx> #include <FPServiceInfo.hxx> -#include <vos/mutex.hxx> -#include <vcl/svapp.hxx> +#include <osl/mutex.hxx> #include <SalGtkFilePicker.hxx> +#include <tools/string.hxx> #include <tools/urlobj.hxx> -#include <iostream> #include <algorithm> +#include <set> +#include <string.h> #include "resourceprovider.hxx" -#ifndef _SV_RC_H -#include <tools/rc.hxx> -#endif //------------------------------------------------------------------------ // namespace directives @@ -83,9 +85,9 @@ namespace uno::Sequence<rtl::OUString> SAL_CALL FilePicker_getSupportedServiceNames() { uno::Sequence<rtl::OUString> aRet(3); - aRet[0] = rtl::OUString::createFromAscii( "com.sun.star.ui.dialogs.FilePicker" ); - aRet[1] = rtl::OUString::createFromAscii( "com.sun.star.ui.dialogs.SystemFilePicker" ); - aRet[2] = rtl::OUString::createFromAscii( "com.sun.star.ui.dialogs.GtkFilePicker" ); + aRet[0] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.FilePicker" )); + aRet[1] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.SystemFilePicker" )); + aRet[2] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.GtkFilePicker" )); return aRet; } } @@ -148,6 +150,7 @@ SalGtkFilePicker::SalGtkFilePicker( const uno::Reference<lang::XMultiServiceFact mbPreviewState( sal_False ), mHID_Preview( 0 ), m_pPreview( NULL ), + m_pPseudoFilter( NULL ), m_PreviewImageWidth( 256 ), m_PreviewImageHeight( 256 ) { @@ -399,52 +402,6 @@ void SAL_CALL SalGtkFilePicker::controlStateChanged( FilePickerEvent aEvent ) if (m_xListener.is()) m_xListener->controlStateChanged( aEvent ); } -//----------------------------------------------------------------------------------------- -// If there are more then one listener the return value of the last one wins -//----------------------------------------------------------------------------------------- - -rtl::OUString SAL_CALL SalGtkFilePicker::helpRequested( FilePickerEvent aEvent ) const -{ - rtl::OUString aHelpText; - - ::cppu::OInterfaceContainerHelper* pICHelper = - rBHelper.getContainer( getCppuType( ( uno::Reference<XFilePickerListener> * )0 ) ); - - if( pICHelper ) - { - ::cppu::OInterfaceIteratorHelper iter( *pICHelper ); - - while( iter.hasMoreElements() ) - { - try - { - /* - if there are multiple listeners responding - to this notification the next response - overwrittes the one before if it is not empty - */ - - rtl::OUString aTempString; - - uno::Reference<XFilePickerListener> xFPListener( iter.next(), uno::UNO_QUERY ); - if( xFPListener.is() ) - { - aTempString = xFPListener->helpRequested( aEvent ); - if( aTempString.getLength() ) - aHelpText = aTempString; - } - - } - catch( uno::RuntimeException& ) - { - OSL_ENSURE( false, "RuntimeException during event dispatching" ); - } - } - } - - return aHelpText; -} - //===================================================================== struct FilterEntry @@ -532,7 +489,7 @@ shrinkFilterName( const rtl::OUString &rFilterName, bool bAllowNoStar = false ) int i; int nBracketLen = -1; int nBracketEnd = -1; - const sal_Unicode *pStr = rFilterName; + const sal_Unicode *pStr = rFilterName.getStr(); OUString aRealName = rFilterName; for( i = aRealName.getLength() - 1; i > 0; i-- ) @@ -657,7 +614,7 @@ void SalGtkFilePicker::ensureFilterList( const ::rtl::OUString& _rInitialCurrent m_pFilterList = new FilterList; // set the first filter to the current filter - if( ( !m_aCurrentFilter ) || ( !m_aCurrentFilter.getLength() ) ) + if ( !m_aCurrentFilter.getLength() ) m_aCurrentFilter = _rInitialCurrentFilter; } } @@ -680,7 +637,6 @@ void SAL_CALL SalGtkFilePicker::appendFilter( const rtl::OUString& aTitle, const // append the filter m_pFilterList->insert( m_pFilterList->end(), FilterEntry( aTitle, aFilter ) ); - // implAddFilter( aTitle, aFilter ); } //----------------------------------------------------------------------------------------- @@ -747,7 +703,10 @@ void SalGtkFilePicker::UpdateFilterfromUI() } else if( GtkFileFilter *filter = gtk_file_chooser_get_filter(GTK_FILE_CHOOSER(m_pDialog))) { - updateCurrentFilterFromName(gtk_file_filter_get_name( filter )); + if (m_pPseudoFilter != filter) + updateCurrentFilterFromName(gtk_file_filter_get_name( filter )); + else + updateCurrentFilterFromName(OUStringToOString( m_aInitialFilter, RTL_TEXTENCODING_UTF8 ).getStr()); } } @@ -898,7 +857,7 @@ uno::Sequence<rtl::OUString> SAL_CALL SalGtkFilePicker::getSelectedFiles() throw if( sExtension.getLength() >= 3 ) // 3 = typical/minimum extension length { - static const OUString aStarDot = OUString::createFromAscii( "*." ); + static const OUString aStarDot(RTL_CONSTASCII_USTRINGPARAM( "*." )); ::rtl::OUString aNewFilter; ::rtl::OUString aOldFilter = getCurrentFilter(); @@ -908,7 +867,7 @@ uno::Sequence<rtl::OUString> SAL_CALL SalGtkFilePicker::getSelectedFiles() throw ++aListIter ) { - if( aListIter->getFilter().indexOf( aStarDot+sExtension ) >= 0 ) + if( aListIter->getFilter().equalsIgnoreAsciiCase( aStarDot+sExtension ) ) { if( !aNewFilter.getLength() ) aNewFilter = aListIter->getTitle(); @@ -919,14 +878,19 @@ uno::Sequence<rtl::OUString> SAL_CALL SalGtkFilePicker::getSelectedFiles() throw bExtensionTypedIn = true; } } - if( bChangeFilter ) + if( bChangeFilter && bExtensionTypedIn ) setCurrentFilter( aNewFilter ); } } - const gchar* filtername = - gtk_file_filter_get_name( gtk_file_chooser_get_filter( GTK_FILE_CHOOSER( m_pDialog ) ) ); - sFilterName = OUString( filtername, strlen( filtername ), RTL_TEXTENCODING_UTF8 ); + GtkFileFilter *filter = gtk_file_chooser_get_filter(GTK_FILE_CHOOSER(m_pDialog)); + if (m_pPseudoFilter != filter) + { + const gchar* filtername = gtk_file_filter_get_name( filter ); + sFilterName = OUString( filtername, strlen( filtername ), RTL_TEXTENCODING_UTF8 ); + } + else + sFilterName = m_aInitialFilter; } OSL_TRACE( "2: current filter is %s\n", @@ -960,10 +924,10 @@ uno::Sequence<rtl::OUString> SAL_CALL SalGtkFilePicker::getSelectedFiles() throw } while( nTokenIndex >= 0 ); - if( !bExtensionTypedIn && ( !sToken.equalsAscii( "*" ) ) ) + if( !bExtensionTypedIn && ( !sToken.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("*")) ) ) { //if the filename does not already have the auto extension, stick it on - OUString sExtension = OUString::createFromAscii( "." ) + sToken; + OUString sExtension = OUString(RTL_CONSTASCII_USTRINGPARAM( "." )) + sToken; OUString &rBase = aSelectedFiles[nIndex]; sal_Int32 nExtensionIdx = rBase.getLength() - sExtension.getLength(); OSL_TRACE( "idx are %d %d\n", rBase.lastIndexOf( sExtension ), nExtensionIdx ); @@ -1014,9 +978,12 @@ sal_Int16 SAL_CALL SalGtkFilePicker::execute() throw( uno::RuntimeException ) int btn = GTK_RESPONSE_NO; uno::Reference< awt::XExtendedToolkit > xToolkit( - m_xServiceMgr->createInstance( ::rtl::OUString::createFromAscii("com.sun.star.awt.Toolkit") ), uno::UNO_QUERY); + m_xServiceMgr->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.Toolkit")) ), uno::UNO_QUERY); - RunDialog* pRunDialog = new RunDialog(m_pDialog, xToolkit); + uno::Reference< frame::XDesktop > xDesktop( + m_xServiceMgr->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")) ), uno::UNO_QUERY); + + RunDialog* pRunDialog = new RunDialog(m_pDialog, xToolkit, xDesktop); uno::Reference < awt::XTopWindowListener > xLifeCycle(pRunDialog); while( GTK_RESPONSE_NO == btn ) { @@ -1037,19 +1004,46 @@ sal_Int16 SAL_CALL SalGtkFilePicker::execute() throw( uno::RuntimeException ) CResourceProvider aResProvider; GtkWidget *dlg; + + INetURLObject aFileObj( sFileName ); + + OString baseName( + OUStringToOString( + aFileObj.getName( + INetURLObject::LAST_SEGMENT, + true, + INetURLObject::DECODE_WITH_CHARSET + ), + RTL_TEXTENCODING_UTF8 + ) + ); + OString aMsg( + OUStringToOString( + aResProvider.getResString( FILE_PICKER_OVERWRITE ), + RTL_TEXTENCODING_UTF8 + ) + ); + OString toReplace( RTL_CONSTASCII_STRINGPARAM( "$filename$" )); + + aMsg = aMsg.replaceAt( + aMsg.indexOf( toReplace ), + toReplace.getLength(), + baseName + ); + dlg = gtk_message_dialog_new( NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO, - OUStringToOString( - aResProvider.getResString( FILE_PICKER_OVERWRITE ), - RTL_TEXTENCODING_UTF8 ).getStr() ); + "%s", + aMsg.getStr() + ); gtk_window_set_title( GTK_WINDOW( dlg ), OUStringToOString(aResProvider.getResString(FILE_PICKER_TITLE_SAVE ), RTL_TEXTENCODING_UTF8 ).getStr() ); - RunDialog* pAnotherDialog = new RunDialog(dlg, xToolkit); + RunDialog* pAnotherDialog = new RunDialog(dlg, xToolkit, xDesktop); uno::Reference < awt::XTopWindowListener > xAnotherLifeCycle(pAnotherDialog); btn = pAnotherDialog->run(); @@ -1491,7 +1485,7 @@ void SalGtkFilePicker::implChangeType( GtkTreeSelection *selection ) { gchar *title; gtk_tree_model_get (model, &iter, 2, &title, -1); - aLabel += rtl::OUString::createFromAscii( ": " ); + aLabel += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ": " )); aLabel += rtl::OUString( title, strlen(title), RTL_TEXTENCODING_UTF8 ); g_free (title); } @@ -1626,7 +1620,7 @@ void SAL_CALL SalGtkFilePicker::initialize( const uno::Sequence<uno::Any>& aArgu uno::Any aAny; if( 0 == aArguments.getLength() ) throw lang::IllegalArgumentException( - rtl::OUString::createFromAscii( "no arguments" ), + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "no arguments" )), static_cast<XFilePicker2*>( this ), 1 ); aAny = aArguments[0]; @@ -1634,7 +1628,7 @@ void SAL_CALL SalGtkFilePicker::initialize( const uno::Sequence<uno::Any>& aArgu if( ( aAny.getValueType() != ::getCppuType( ( sal_Int16* )0 ) ) && (aAny.getValueType() != ::getCppuType( ( sal_Int8* )0 ) ) ) throw lang::IllegalArgumentException( - rtl::OUString::createFromAscii( "invalid argument type" ), + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "invalid argument type" )), static_cast<XFilePicker2*>( this ), 1 ); sal_Int16 templateId = -1; @@ -1722,7 +1716,7 @@ void SAL_CALL SalGtkFilePicker::initialize( const uno::Sequence<uno::Any>& aArgu break; default: throw lang::IllegalArgumentException( - rtl::OUString::createFromAscii( "Unknown template" ), + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Unknown template" )), static_cast< XFilePicker2* >( this ), 1 ); } @@ -1801,7 +1795,7 @@ void SAL_CALL SalGtkFilePicker::cancel() throw( uno::RuntimeException ) rtl::OUString SAL_CALL SalGtkFilePicker::getImplementationName() throw( uno::RuntimeException ) { - return rtl::OUString::createFromAscii( FILE_PICKER_IMPL_NAME ); + return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( FILE_PICKER_IMPL_NAME )); } // ------------------------------------------------- @@ -1882,7 +1876,7 @@ case_insensitive_filter (const GtkFileFilterInfo *filter_info, gpointer data) if( !g_ascii_strcasecmp( pFilter, pExtn ) ) bRetval = sal_True; -#ifdef DEBUG +#if OSL_DEBUG_LEVEL > 1 fprintf( stderr, "'%s' match extn '%s' vs '%s' yeilds %d\n", filter_info->uri, pExtn, pFilter, bRetval ); #endif @@ -1891,7 +1885,7 @@ case_insensitive_filter (const GtkFileFilterInfo *filter_info, gpointer data) } } -int SalGtkFilePicker::implAddFilter( const OUString& rFilter, const OUString& rType ) +GtkFileFilter* SalGtkFilePicker::implAddFilter( const OUString& rFilter, const OUString& rType ) { GdkThreadLock aLock; @@ -1899,9 +1893,9 @@ int SalGtkFilePicker::implAddFilter( const OUString& rFilter, const OUString& rT OUString aShrunkName = shrinkFilterName( rFilter ); OString aFilterName = rtl::OUStringToOString( aShrunkName, RTL_TEXTENCODING_UTF8 ); - gtk_file_filter_set_name( filter, aFilterName ); + gtk_file_filter_set_name( filter, aFilterName.getStr() ); - static const OUString aStarDot = OUString::createFromAscii( "*." ); + static const OUString aStarDot(RTL_CONSTASCII_USTRINGPARAM( "*." )); OUString aTokens; bool bAllGlob = !rType.compareToAscii( "*.*" ) || !rType.compareToAscii( "*" ); @@ -1919,16 +1913,16 @@ int SalGtkFilePicker::implAddFilter( const OUString& rFilter, const OUString& rT if (aToken.getLength()) { if (aTokens.getLength()) - aTokens += OUString::createFromAscii(","); + aTokens += OUString(RTL_CONSTASCII_USTRINGPARAM(",")); aTokens = aTokens += aToken; gtk_file_filter_add_custom (filter, GTK_FILE_FILTER_URI, case_insensitive_filter, - g_strdup( rtl::OUStringToOString( aToken, RTL_TEXTENCODING_UTF8 ) ), + g_strdup( rtl::OUStringToOString(aToken, RTL_TEXTENCODING_UTF8).getStr() ), (GDestroyNotify) g_free ); OSL_TRACE( "fustering with %s\n", rtl::OUStringToOString( aToken, RTL_TEXTENCODING_UTF8 ).getStr()); } -#ifdef DEBUG +#if OSL_DEBUG_LEVEL > 0 else { g_warning( "Duff filter token '%s'\n", @@ -1942,7 +1936,6 @@ int SalGtkFilePicker::implAddFilter( const OUString& rFilter, const OUString& rT gtk_file_chooser_add_filter( GTK_FILE_CHOOSER( m_pDialog ), filter ); - int nAdded = 0; if (!bAllGlob) { GtkTreeIter iter; @@ -1953,30 +1946,67 @@ int SalGtkFilePicker::implAddFilter( const OUString& rFilter, const OUString& rT 2, aFilterName.getStr(), 3, OUStringToOString(rType, RTL_TEXTENCODING_UTF8).getStr(), -1); - nAdded = 1; } - return nAdded; + return filter; } -int SalGtkFilePicker::implAddFilterGroup( const OUString& /*_rFilter*/, const Sequence< StringPair >& _rFilters ) +void SalGtkFilePicker::implAddFilterGroup( const OUString& /*_rFilter*/, const Sequence< StringPair >& _rFilters ) { // Gtk+ has no filter group concept I think so ... // implAddFilter( _rFilter, String() ); - int nAdded = 0; const StringPair* pSubFilters = _rFilters.getConstArray(); const StringPair* pSubFiltersEnd = pSubFilters + _rFilters.getLength(); for( ; pSubFilters != pSubFiltersEnd; ++pSubFilters ) - nAdded += implAddFilter( pSubFilters->First, pSubFilters->Second ); - return nAdded; + implAddFilter( pSubFilters->First, pSubFilters->Second ); } void SalGtkFilePicker::SetFilters() { - OSL_TRACE( "start setting filters\n"); - GdkThreadLock aLock; - int nAdded = 0; + if (!m_aInitialFilter.getLength()) + m_aInitialFilter = m_aCurrentFilter; + + rtl::OUString sPseudoFilter; + if( GTK_FILE_CHOOSER_ACTION_SAVE == gtk_file_chooser_get_action( GTK_FILE_CHOOSER( m_pDialog ) ) ) + { + std::set<OUString> aAllFormats; + if( m_pFilterList && !m_pFilterList->empty() ) + { + for ( FilterList::iterator aListIter = m_pFilterList->begin(); + aListIter != m_pFilterList->end(); + ++aListIter + ) + { + if( aListIter->hasSubFilters() ) + { // it's a filter group + UnoFilterList aSubFilters; + aListIter->getSubFilters( aSubFilters ); + const StringPair* pSubFilters = aSubFilters.getConstArray(); + const StringPair* pSubFiltersEnd = pSubFilters + aSubFilters.getLength(); + for( ; pSubFilters != pSubFiltersEnd; ++pSubFilters ) + aAllFormats.insert(pSubFilters->Second); + } + else + aAllFormats.insert(aListIter->getFilter()); + } + } + if (aAllFormats.size() > 1) + { + rtl::OUString sAllFilter; + std::set<OUString>::const_iterator aEnd = aAllFormats.end(); + for (std::set<OUString>::const_iterator aIter = aAllFormats.begin(); aIter != aEnd; ++aIter) + { + if (sAllFilter.getLength()) + sAllFilter += OUString(sal_Unicode(';')); + sAllFilter += *aIter; + } + CResourceProvider aResProvider; + sPseudoFilter = aResProvider.getResString(FILE_PICKER_ALLFORMATS); + m_pPseudoFilter = implAddFilter( sPseudoFilter, sAllFilter ); + } + } + if( m_pFilterList && !m_pFilterList->empty() ) { for ( FilterList::iterator aListIter = m_pFilterList->begin(); @@ -1990,30 +2020,27 @@ void SalGtkFilePicker::SetFilters() UnoFilterList aSubFilters; aListIter->getSubFilters( aSubFilters ); - nAdded += implAddFilterGroup( aListIter->getTitle(), aSubFilters ); + implAddFilterGroup( aListIter->getTitle(), aSubFilters ); } else { // it's a single filter - nAdded += implAddFilter( aListIter->getTitle(), aListIter->getFilter() ); + implAddFilter( aListIter->getTitle(), aListIter->getFilter() ); } } } - if (nAdded) + if (gtk_tree_model_iter_n_children(GTK_TREE_MODEL(m_pFilterStore), NULL)) //If m_pFilterStore is not empty gtk_widget_show( m_pFilterExpander ); else gtk_widget_hide( m_pFilterExpander ); // set the default filter - if( m_aCurrentFilter && (m_aCurrentFilter.getLength() > 0) ) - { - OSL_TRACE( "Setting current filter to %s\n", - OUStringToOString( m_aCurrentFilter, RTL_TEXTENCODING_UTF8 ).getStr() ); - + if (sPseudoFilter.getLength()) + SetCurFilter( sPseudoFilter ); + else if(m_aCurrentFilter.getLength()) SetCurFilter( m_aCurrentFilter ); - } OSL_TRACE( "end setting filters\n"); } @@ -2037,4 +2064,4 @@ SalGtkFilePicker::~SalGtkFilePicker() gtk_widget_destroy( m_pVBox ); } -/* vi:set tabstop=4 shiftwidth=4 expandtab: */ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/unx/gnome/SalGtkFilePicker.hxx b/fpicker/source/unx/gnome/SalGtkFilePicker.hxx index 42f6a58b55f6..b846eb351d76 100644 --- a/fpicker/source/unx/gnome/SalGtkFilePicker.hxx +++ b/fpicker/source/unx/gnome/SalGtkFilePicker.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -41,15 +42,11 @@ #include <com/sun/star/ui/dialogs/XFilePreview.hpp> #include <com/sun/star/beans/StringPair.hpp> -#ifndef _SALGTKPICKER_HXX_ #include "SalGtkPicker.hxx" -#endif #include <memory> -#ifndef _RTL_USTRING_H_ #include <rtl/ustring.hxx> -#endif #include <list> @@ -61,8 +58,8 @@ // forward declarations //---------------------------------------------------------- -using namespace rtl; - +using ::rtl::OUString; +using ::rtl::OString; struct FilterEntry; struct ElementEntry_Impl; @@ -246,7 +243,6 @@ class SalGtkFilePicker : void SAL_CALL fileSelectionChanged( ::com::sun::star::ui::dialogs::FilePickerEvent aEvent ); void SAL_CALL directoryChanged( ::com::sun::star::ui::dialogs::FilePickerEvent aEvent ); - rtl::OUString SAL_CALL helpRequested( ::com::sun::star::ui::dialogs::FilePickerEvent aEvent ) const; void SAL_CALL controlStateChanged( ::com::sun::star::ui::dialogs::FilePickerEvent aEvent ); private: @@ -314,11 +310,13 @@ class SalGtkFilePicker : gulong mnHID_SelectionChange; ::rtl::OUString m_aCurrentFilter; + ::rtl::OUString m_aInitialFilter; bool bVersionWidthUnset; sal_Bool mbPreviewState; gulong mHID_Preview; GtkWidget* m_pPreview; + GtkFileFilter* m_pPseudoFilter; sal_Int32 m_PreviewImageWidth; sal_Int32 m_PreviewImageHeight; @@ -329,8 +327,8 @@ class SalGtkFilePicker : void UpdateFilterfromUI(); void implChangeType( GtkTreeSelection *selection ); - int implAddFilter( const OUString& rFilter, const OUString& rType); - int implAddFilterGroup( const OUString& rFilter, + GtkFileFilter * implAddFilter( const OUString& rFilter, const OUString& rType ); + void implAddFilterGroup( const OUString& rFilter, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::StringPair>& _rFilters ); void updateCurrentFilterFromName(const gchar* filtername); void unselect_type(); @@ -352,5 +350,6 @@ class SalGtkFilePicker : virtual ~SalGtkFilePicker(); }; -/* vi:set tabstop=4 shiftwidth=4 expandtab: */ #endif // _SALGTKFILEPICKER_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/unx/gnome/SalGtkFolderPicker.cxx b/fpicker/source/unx/gnome/SalGtkFolderPicker.cxx index e1c98004035b..3be63ded420f 100644 --- a/fpicker/source/unx/gnome/SalGtkFolderPicker.cxx +++ b/fpicker/source/unx/gnome/SalGtkFolderPicker.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,31 +29,28 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_fpicker.hxx" +#ifdef AIX +#define _LINUX_SOURCE_COMPAT +#include <sys/timer.h> +#undef _LINUX_SOURCE_COMPAT +#endif + //------------------------------------------------------------------------ // includes //------------------------------------------------------------------------ -#include <com/sun/star/lang/DisposedException.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp> -#include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp> #include <com/sun/star/ui/dialogs/CommonFilePickerElementIds.hpp> #include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp> -#include <cppuhelper/interfacecontainer.h> #include <osl/diagnose.h> #include <com/sun/star/ui/dialogs/TemplateDescription.hpp> #include <com/sun/star/uno/Any.hxx> #include <FPServiceInfo.hxx> -#include <vos/mutex.hxx> -#include <vcl/svapp.hxx> +#include <osl/mutex.hxx> #include "SalGtkFolderPicker.hxx" - -#include <tools/urlobj.hxx> - -#include <iostream> #include "resourceprovider.hxx" -#ifndef _SV_RC_H -#include <tools/rc.hxx> -#endif + +#include <string.h> //------------------------------------------------------------------------ // namespace directives @@ -74,8 +72,8 @@ namespace uno::Sequence<rtl::OUString> SAL_CALL FolderPicker_getSupportedServiceNames() { uno::Sequence<rtl::OUString> aRet(2); - aRet[0] = rtl::OUString::createFromAscii( "com.sun.star.ui.dialogs.SystemFolderPicker" ); - aRet[1] = rtl::OUString::createFromAscii( "com.sun.star.ui.dialogs.GtkFolderPicker" ); + aRet[0] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.SystemFolderPicker" )); + aRet[1] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.GtkFolderPicker" )); return aRet; } } @@ -177,9 +175,12 @@ sal_Int16 SAL_CALL SalGtkFolderPicker::execute() throw( uno::RuntimeException ) sal_Int16 retVal = 0; uno::Reference< awt::XExtendedToolkit > xToolkit( - m_xServiceMgr->createInstance( ::rtl::OUString::createFromAscii("com.sun.star.awt.Toolkit") ), uno::UNO_QUERY); + m_xServiceMgr->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.Toolkit")) ), uno::UNO_QUERY); - RunDialog* pRunDialog = new RunDialog(m_pDialog, xToolkit); + uno::Reference< frame::XDesktop > xDesktop( + m_xServiceMgr->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")) ), uno::UNO_QUERY); + + RunDialog* pRunDialog = new RunDialog(m_pDialog, xToolkit, xDesktop); uno::Reference < awt::XTopWindowListener > xLifeCycle(pRunDialog); gint nStatus = pRunDialog->run(); switch( nStatus ) @@ -216,7 +217,7 @@ void SAL_CALL SalGtkFolderPicker::cancel() throw( uno::RuntimeException ) rtl::OUString SAL_CALL SalGtkFolderPicker::getImplementationName() throw( uno::RuntimeException ) { - return rtl::OUString::createFromAscii( FOLDER_PICKER_IMPL_NAME ); + return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( FOLDER_PICKER_IMPL_NAME )); } // ------------------------------------------------- @@ -244,3 +245,5 @@ uno::Sequence<rtl::OUString> SAL_CALL SalGtkFolderPicker::getSupportedServiceNam { return FolderPicker_getSupportedServiceNames(); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/unx/gnome/SalGtkFolderPicker.hxx b/fpicker/source/unx/gnome/SalGtkFolderPicker.hxx index 07b25c256653..5110ea86a0f6 100644 --- a/fpicker/source/unx/gnome/SalGtkFolderPicker.hxx +++ b/fpicker/source/unx/gnome/SalGtkFolderPicker.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -32,19 +33,13 @@ // includes of other projects //_______________________________________________________________________________________________________________________ -#ifndef _CPPUHELPER_COMPBASE3_HXX_ #include <cppuhelper/implbase3.hxx> -#endif -#ifndef _SALGTKPICKER_HXX_ #include "SalGtkPicker.hxx" -#endif #include <memory> -#ifndef _RTL_USTRING_H_ #include <rtl/ustring.hxx> -#endif #include <list> @@ -125,11 +120,8 @@ class SalGtkFolderPicker : private: // to instanciate own services ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceMgr; - -#if 0 - public: - virtual ~SalGtkFolderPicker(); -#endif }; #endif // _SALGTKFOLDERPICKER_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/unx/gnome/SalGtkPicker.cxx b/fpicker/source/unx/gnome/SalGtkPicker.cxx index 6fd19b2f7f79..94671521a6fc 100644 --- a/fpicker/source/unx/gnome/SalGtkPicker.cxx +++ b/fpicker/source/unx/gnome/SalGtkPicker.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,6 +29,12 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_fpicker.hxx" +#ifdef AIX +#define _LINUX_SOURCE_COMPAT +#include <sys/timer.h> +#undef _LINUX_SOURCE_COMPAT +#endif + //------------------------------------------------------------------------ // includes //------------------------------------------------------------------------ @@ -45,7 +52,7 @@ #include <osl/diagnose.h> #include <com/sun/star/uno/Any.hxx> #include <FPServiceInfo.hxx> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <vcl/svapp.hxx> #include "SalGtkPicker.hxx" #include <tools/urlobj.hxx> @@ -123,9 +130,10 @@ extern "C" extern GdkDisplay* gdk_x11_lookup_xdisplay (void*xdisplay); } -RunDialog::RunDialog( GtkWidget *pDialog, uno::Reference< awt::XExtendedToolkit >& rToolkit ) : - cppu::WeakComponentImplHelper1< awt::XTopWindowListener >( maLock ), - mpDialog(pDialog), mpCreatedParent(NULL), mxToolkit(rToolkit) +RunDialog::RunDialog( GtkWidget *pDialog, uno::Reference< awt::XExtendedToolkit >& rToolkit, + uno::Reference< frame::XDesktop >& rDesktop ) : + cppu::WeakComponentImplHelper2< awt::XTopWindowListener, frame::XTerminateListener >( maLock ), + mpDialog(pDialog), mpCreatedParent(NULL), mxToolkit(rToolkit), mxDesktop(rDesktop) { awt::SystemDependentXWindow aWindowHandle; @@ -179,6 +187,18 @@ void SAL_CALL RunDialog::windowOpened( const ::com::sun::star::lang::EventObject g_timeout_add_full(G_PRIORITY_HIGH_IDLE, 0, (GSourceFunc)canceldialog, this, NULL); } +void SAL_CALL RunDialog::queryTermination( const ::com::sun::star::lang::EventObject& ) + throw(::com::sun::star::frame::TerminationVetoException, ::com::sun::star::uno::RuntimeException) +{ +} + +void SAL_CALL RunDialog::notifyTermination( const ::com::sun::star::lang::EventObject& ) + throw(::com::sun::star::uno::RuntimeException) +{ + GdkThreadLock aLock; + g_timeout_add_full(G_PRIORITY_HIGH_IDLE, 0, (GSourceFunc)canceldialog, this, NULL); +} + void RunDialog::cancel() { GdkThreadLock aLock; @@ -214,19 +234,19 @@ static void lcl_setGTKLanguage(const uno::Reference<lang::XMultiServiceFactory>& { uno::Reference<lang::XMultiServiceFactory> xConfigMgr = uno::Reference<lang::XMultiServiceFactory>(xServiceMgr->createInstance( - OUString::createFromAscii("com.sun.star.configuration.ConfigurationProvider")), + OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationProvider"))), UNO_QUERY_THROW ); Sequence< Any > theArgs(1); - theArgs[ 0 ] <<= OUString::createFromAscii("org.openoffice.Office.Linguistic/General"); + theArgs[ 0 ] <<= OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office.Linguistic/General")); uno::Reference< container::XNameAccess > xNameAccess = uno::Reference< container::XNameAccess >(xConfigMgr->createInstanceWithArguments( - OUString::createFromAscii("com.sun.star.configuration.ConfigurationAccess"), theArgs ), + OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationAccess")), theArgs ), UNO_QUERY_THROW ); if (xNameAccess.is()) - xNameAccess->getByName(OUString::createFromAscii("UILocale")) >>= sUILocale; + xNameAccess->getByName(OUString(RTL_CONSTASCII_USTRINGPARAM("UILocale"))) >>= sUILocale; } catch (...) {} if (sUILocale.getLength()) @@ -292,3 +312,5 @@ void SAL_CALL SalGtkPicker::implsetTitle( const rtl::OUString& aTitle ) throw( u GdkThreadLock aLock; gtk_window_set_title( GTK_WINDOW( m_pDialog ), aWindowTitle.getStr() ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/unx/gnome/SalGtkPicker.hxx b/fpicker/source/unx/gnome/SalGtkPicker.hxx index 94e7a11de99a..92b29e728a59 100644 --- a/fpicker/source/unx/gnome/SalGtkPicker.hxx +++ b/fpicker/source/unx/gnome/SalGtkPicker.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -33,7 +34,7 @@ //_____________________________________________________________________________ #include <osl/mutex.hxx> -#include <cppuhelper/compbase1.hxx> +#include <cppuhelper/compbase2.hxx> #include <com/sun/star/ui/dialogs/XFilePicker.hpp> #include <com/sun/star/ui/dialogs/XFilePicker2.hpp> #include <com/sun/star/ui/dialogs/XFolderPicker.hpp> @@ -42,6 +43,8 @@ #include <com/sun/star/awt/XTopWindowListener.hpp> #include <com/sun/star/awt/XExtendedToolkit.hpp> +#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/frame/XTerminateListener.hpp> #include <gtk/gtk.h> #include <gdk/gdkkeysyms.h> @@ -84,13 +87,16 @@ public: //to happen while we're opened waiting for user input, e.g. //https://bugzilla.redhat.com/show_bug.cgi?id=441108 class RunDialog : - public cppu::WeakComponentImplHelper1< ::com::sun::star::awt::XTopWindowListener > + public cppu::WeakComponentImplHelper2< + ::com::sun::star::awt::XTopWindowListener, + ::com::sun::star::frame::XTerminateListener > { private: osl::Mutex maLock; GtkWidget *mpDialog; GdkWindow *mpCreatedParent; ::com::sun::star::uno::Reference< ::com::sun::star::awt::XExtendedToolkit> mxToolkit; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDesktop > mxDesktop; public: // XTopWindowListener @@ -111,11 +117,22 @@ public: throw (::com::sun::star::uno::RuntimeException) {} virtual void SAL_CALL windowDeactivated( const ::com::sun::star::lang::EventObject& ) throw (::com::sun::star::uno::RuntimeException) {} + + // XTerminateListener + virtual void SAL_CALL queryTermination( const ::com::sun::star::lang::EventObject& aEvent ) + throw(::com::sun::star::frame::TerminationVetoException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL notifyTermination( const ::com::sun::star::lang::EventObject& aEvent ) + throw(::com::sun::star::uno::RuntimeException); public: - RunDialog(GtkWidget *pDialog, ::com::sun::star::uno::Reference< ::com::sun::star::awt::XExtendedToolkit > &rToolkit); + RunDialog(GtkWidget *pDialog, + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XExtendedToolkit > &rToolkit, + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDesktop > &rDesktop + ); gint run(); void cancel(); ~RunDialog(); }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/unx/gnome/eventnotification.hxx b/fpicker/source/unx/gnome/eventnotification.hxx index 6bd63f091441..3866ca59946f 100644 --- a/fpicker/source/unx/gnome/eventnotification.hxx +++ b/fpicker/source/unx/gnome/eventnotification.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,9 +29,7 @@ #ifndef _EVENTNOTIFICATION_HXX_ #define _EVENTNOTIFICATION_HXX_ -#ifndef _COM_SUN_STAR_UNO_XINTEFACE_HPP_ #include <com/sun/star/uno/XInterface.hpp> -#endif #include <com/sun/star/uno/Reference.hxx> //----------------------------------- @@ -51,3 +50,5 @@ public: }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/unx/gnome/resourceprovider.cxx b/fpicker/source/unx/gnome/resourceprovider.cxx index 8df810060ee5..4a4f49cc089d 100644 --- a/fpicker/source/unx/gnome/resourceprovider.cxx +++ b/fpicker/source/unx/gnome/resourceprovider.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -34,7 +35,7 @@ #include <osl/diagnose.h> #include <rtl/ustrbuf.hxx> #include "resourceprovider.hxx" -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <vcl/svapp.hxx> #include <tools/resmgr.hxx> #include <com/sun/star/ui/dialogs/CommonFilePickerElementIds.hpp> @@ -82,7 +83,8 @@ _Entry CtrlIdToResIdTable[] = { { CHECKBOX_SELECTION, STR_SVT_FILEPICKER_SELECTION }, { FOLDERPICKER_TITLE, STR_SVT_FOLDERPICKER_DEFAULT_TITLE }, { FOLDER_PICKER_DEF_DESCRIPTION, STR_SVT_FOLDERPICKER_DEFAULT_DESCRIPTION }, - { FILE_PICKER_OVERWRITE, STR_SVT_ALREADYEXISTOVERWRITE } + { FILE_PICKER_OVERWRITE, STR_SVT_ALREADYEXISTOVERWRITE }, + { FILE_PICKER_ALLFORMATS, STR_SVT_ALLFORMATS } }; _Entry OtherCtrlIdToResIdTable[] = { @@ -92,8 +94,8 @@ _Entry OtherCtrlIdToResIdTable[] = { }; -const sal_Int32 SIZE_TABLE = sizeof( CtrlIdToResIdTable ) / sizeof( _Entry ); -const sal_Int32 OTHER_SIZE_TABLE = sizeof( OtherCtrlIdToResIdTable ) / sizeof( _Entry ); +const sal_Int32 SIZE_TABLE = SAL_N_ELEMENTS( CtrlIdToResIdTable ); +const sal_Int32 OTHER_SIZE_TABLE = SAL_N_ELEMENTS( OtherCtrlIdToResIdTable ); //------------------------------------------------------------ // @@ -223,3 +225,5 @@ OUString CResourceProvider::getResString( sal_Int32 aId ) { return m_pImpl->getResString( aId ).replace('~', '_'); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/unx/gnome/resourceprovider.hxx b/fpicker/source/unx/gnome/resourceprovider.hxx index cb43dd12b3e2..5bbbbfd68e7e 100644 --- a/fpicker/source/unx/gnome/resourceprovider.hxx +++ b/fpicker/source/unx/gnome/resourceprovider.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -35,9 +36,7 @@ #include <sal/types.h> -#ifndef _RTL_USTRING_HXX_ -#include <rtl/ustring> -#endif +#include <rtl/ustring.hxx> #define FOLDERPICKER_TITLE 500 #define FOLDER_PICKER_DEF_DESCRIPTION 501 @@ -45,6 +44,7 @@ #define FILE_PICKER_TITLE_SAVE 503 #define FILE_PICKER_FILE_TYPE 504 #define FILE_PICKER_OVERWRITE 505 +#define FILE_PICKER_ALLFORMATS 506 //------------------------------------------------------------------------ // deklarations @@ -65,3 +65,5 @@ private: }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/unx/kde/kdecommandthread.cxx b/fpicker/source/unx/kde/kdecommandthread.cxx new file mode 100644 index 000000000000..b68ddb0030c4 --- /dev/null +++ b/fpicker/source/unx/kde/kdecommandthread.cxx @@ -0,0 +1,181 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2010 Novell, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <cstddef> + +#include <kdecommandthread.hxx> + +#include <qstringlist.h> + +#include <kapplication.h> + +#if OSL_DEBUG_LEVEL > 1 +#include <iostream> +#endif + +////////////////////////////////////////////////////////////////////////// +// CommandEvent +////////////////////////////////////////////////////////////////////////// + +KDECommandEvent::KDECommandEvent( const QString &qCommand, QStringList *pStringList ) + : QCustomEvent( TypeId, pStringList ), + m_eCommand( Unknown ) +{ + struct { + const char *pName; + CommandEventType eType; + } *pIdx, pMapping[] = + { + { "appendControl", AppendControl }, + { "enableControl", EnableControl }, + { "getValue", GetValue }, + { "setValue", SetValue }, + { "appendFilter", AppendFilter }, + { "appendFilterGroup", AppendFilterGroup }, + { "getCurrentFilter", GetCurrentFilter }, + { "setCurrentFilter", SetCurrentFilter }, + { "getDirectory", GetDirectory }, + { "setDirectory", SetDirectory }, + { "getFiles", GetFiles }, + { "setTitle", SetTitle }, + { "setType", SetType }, + { "setDefaultName", SetDefaultName }, + { "setMultiSelection", SetMultiSelection }, + { "exec", Exec }, + { 0, Unknown } + }; + + for ( pIdx = pMapping; pIdx->pName && qCommand != pIdx->pName; ++pIdx ) + ; + + m_eCommand = pIdx->eType; +} + +////////////////////////////////////////////////////////////////////////// +// CommandThread +////////////////////////////////////////////////////////////////////////// + +KDECommandThread::KDECommandThread( QWidget *pObject ) + : m_pObject( pObject ) +{ +} + +KDECommandThread::~KDECommandThread() +{ +} + +void KDECommandThread::run() +{ + QTextIStream qStream( stdin ); + qStream.setEncoding( QTextStream::UnicodeUTF8 ); + + QString qLine; + bool bQuit = false; + while ( !bQuit && !qStream.atEnd() ) + { + qLine = qStream.readLine(); + handleCommand( qLine, bQuit ); + } +} + +void KDECommandThread::handleCommand( const QString &rString, bool &bQuit ) +{ + QMutexLocker qMutexLocker( &m_aMutex ); + +#if OSL_DEBUG_LEVEL > 1 + ::std::cerr << "kdefilepicker received: " << rString.latin1() << ::std::endl; +#endif + + bQuit = false; + QStringList *pTokens = tokenize( rString ); + + if ( !pTokens ) + return; + if ( pTokens->empty() ) + { + delete pTokens, pTokens = NULL; + return; + } + + QString qCommand = pTokens->front(); + pTokens->pop_front(); + + if ( qCommand == "exit" ) + { + bQuit = true; + kapp->exit(); + kapp->wakeUpGuiThread(); + } + else + kapp->postEvent( m_pObject, new KDECommandEvent( qCommand, pTokens ) ); +} + +QStringList* KDECommandThread::tokenize( const QString &rString ) +{ + // Commands look like: + // command arg1 arg2 arg3 ... + // Args may be enclosed in '"', if they contain spaces. + + QStringList *pList = new QStringList(); + + QString qBuffer; + qBuffer.reserve( 1024 ); + + const QChar *pUnicode = rString.unicode(); + const QChar *pEnd = pUnicode + rString.length(); + bool bQuoted = false; + + for ( ; pUnicode != pEnd; ++pUnicode ) + { + if ( *pUnicode == '\\' ) + { + ++pUnicode; + if ( pUnicode != pEnd ) + { + if ( *pUnicode == 'n' ) + qBuffer.append( '\n' ); + else + qBuffer.append( *pUnicode ); + } + } + else if ( *pUnicode == '"' ) + bQuoted = !bQuoted; + else if ( *pUnicode == ' ' && !bQuoted ) + { + pList->push_back( qBuffer ); + qBuffer.setLength( 0 ); + } + else + qBuffer.append( *pUnicode ); + } + pList->push_back( qBuffer ); + + return pList; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/unx/kde/kdecommandthread.hxx b/fpicker/source/unx/kde/kdecommandthread.hxx new file mode 100644 index 000000000000..7486bf9192f6 --- /dev/null +++ b/fpicker/source/unx/kde/kdecommandthread.hxx @@ -0,0 +1,97 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2010 Novell, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _KDECOMMANDTHREAD_HXX_ +#define _KDECOMMANDTHREAD_HXX_ + +#include <qevent.h> +#include <qmutex.h> +#include <qthread.h> + +class KDECommandEvent : public QCustomEvent +{ +public: + enum CommandEventType { + Unknown = 0, + + AppendControl, + EnableControl, + GetValue, + SetValue, + + AppendFilter, + AppendFilterGroup, + UpdateFilters, + GetCurrentFilter, + SetCurrentFilter, + + GetDirectory, + SetDirectory, + + GetFiles, + + SetTitle, + SetType, + SetDefaultName, + SetMultiSelection, + + Exec + }; + static const QEvent::Type TypeId = (QEvent::Type) ( (int) QEvent::User + 42 /*random magic value*/ ); + +protected: + CommandEventType m_eCommand; + +public: + KDECommandEvent( const QString &qCommand, QStringList *pStringList ); + + CommandEventType command() const { return m_eCommand; } + QStringList* stringList() { return static_cast< QStringList* >( data() ); } +}; + +class KDECommandThread : public QThread +{ +protected: + QObject *m_pObject; + + QMutex m_aMutex; + +public: + KDECommandThread( QWidget *pObject ); + virtual ~KDECommandThread(); + + virtual void run(); + +protected: + void handleCommand( const QString &rString, bool &bQuit ); + QStringList* tokenize( const QString &rString ); +}; + +#endif // _KDECOMMANDTHREAD_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/unx/kde/kdefilepicker.cxx b/fpicker/source/unx/kde/kdefilepicker.cxx new file mode 100644 index 000000000000..779a34d894d0 --- /dev/null +++ b/fpicker/source/unx/kde/kdefilepicker.cxx @@ -0,0 +1,734 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2010 Novell, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <cstddef> + +#include <kdecommandthread.hxx> +#include <kdefilepicker.hxx> + +#include <qcheckbox.h> +#include <qcombobox.h> +#include <qgrid.h> +#include <qhbox.h> +#include <qlabel.h> +#include <qlayout.h> +#include <qobjectlist.h> +#include <qpushbutton.h> +#include <qregexp.h> +#include <qvbox.h> + +#ifdef QT_NO_EMIT +#define emit +#endif + +#include <kdeversion.h> +#include <kdiroperator.h> +#include <kfiledialog.h> +#include <kfilefiltercombo.h> +#include <kio/netaccess.h> +#include <klocale.h> +#include <kmessagebox.h> +#include <ktempfile.h> + +#include <algorithm> +#include <iostream> + +////////////////////////////////////////////////////////////////////////// +// KDEFileDialog +////////////////////////////////////////////////////////////////////////// + +KDEFileDialog::KDEFileDialog( const QString &startDir, const QString &filter, + QWidget *parent, const char *name ) + : KFileDialog( startDir, filter, parent, name, true, m_pCustomWidget = new QVBox() ), + m_pCombosAndButtons( new QHBox( m_pCustomWidget ) ), + m_pLabels( new QVBox( m_pCombosAndButtons ) ), + m_pComboBoxes( new QVBox( m_pCombosAndButtons ) ), + m_pPushButtons( new QVBox( m_pCombosAndButtons ) ), + m_pCheckBoxes( new QGrid( 2, m_pCustomWidget ) ), + m_bIsSave( false ), + m_bIsExecuting( false ), + m_bCanNotifySelection( true ) +{ + connect( this, SIGNAL( fileHighlighted( const QString & ) ), + this, SLOT( fileHighlightedCommand( const QString & ) ) ); + + connect( this, SIGNAL( selectionChanged() ), + this, SLOT( selectionChangedCommand() ) ); + + m_pCustomWidget->setSpacing( KDialog::spacingHint() ); + m_pCombosAndButtons->setSpacing( KDialog::spacingHint() ); + + updateCustomWidgetLayout(); +} + +KDEFileDialog::~KDEFileDialog() +{ +} + +void KDEFileDialog::resizeEvent( QResizeEvent *pEvent ) +{ + KFileDialog::resizeEvent( pEvent ); + + updateCustomWidgetLayout(); +} + +void KDEFileDialog::showEvent( QShowEvent *pEvent ) +{ + KFileDialog::showEvent( pEvent ); + + updateCustomWidgetLayout(); +} + +void KDEFileDialog::updateCustomWidgetLayout() +{ + QPoint qReferencePoint = filterWidget->mapTo( this, QPoint( 0, 0 ) ); + QPoint qCustomPoint = m_pCustomWidget->mapTo( this, QPoint( 0, 0 ) ); + + int nLeft = qReferencePoint.x() - qCustomPoint.x(); + int nRight = m_pCustomWidget->width() - filterWidget->width() - nLeft; + + nLeft -= KDialog::spacingHint(); + nRight -= KDialog::spacingHint(); + m_pLabels->setFixedWidth( ( nLeft > 0 )? nLeft: 80 ); + // FIXME The following call sets the width of m_pPushButtons all right, + // but it also increases the width of m_pComboBoxes rapidly. Can we do + // anything about it? + m_pPushButtons->setFixedWidth( ( nRight > 0 )? nRight: 100 ); +} + +void KDEFileDialog::customEvent( QCustomEvent *pEvent ) +{ + if ( pEvent && pEvent->type() == KDECommandEvent::TypeId ) + { + KDECommandEvent *pCommandEvent = static_cast< KDECommandEvent* >( pEvent ); + QStringList *pStringList = pCommandEvent->stringList(); + + int nListSize = -1; + if ( pStringList ) + nListSize = pStringList->size(); + + switch ( pCommandEvent->command() ) + { + case KDECommandEvent::AppendControl: + if ( nListSize >= 3 ) + { + appendControl( (*pStringList)[0], (*pStringList)[1], (*pStringList)[2] ); + } + break; + case KDECommandEvent::EnableControl: + if ( nListSize >= 2 ) + { + enableControl( (*pStringList)[0], (*pStringList)[1] ); + } + break; + case KDECommandEvent::GetValue: + if ( nListSize >= 2 ) + { + getValue( (*pStringList)[0], (*pStringList)[1] ); + } + break; + case KDECommandEvent::SetValue: + if ( nListSize >= 2 ) + { + QStringList qStringList = (*pStringList); + qStringList.pop_front(); + qStringList.pop_front(); + + setValue( (*pStringList)[0], (*pStringList)[1], qStringList ); + } + break; + case KDECommandEvent::AppendFilter: + if ( nListSize >= 2 ) + { + appendFilter( (*pStringList)[0], (*pStringList)[1] ); + + // update the filters widget + setFilter( filters() ); + } + break; + case KDECommandEvent::AppendFilterGroup: + if ( nListSize >= 1 ) + { + QStringList::const_iterator it = pStringList->begin(); + ++it; // We ignore the filter group name + + while ( it != pStringList->end() ) + { + QString qTitle = *it; + ++it; + if ( it != pStringList->end() ) + { + appendFilter( qTitle, (*it) ); + ++it; + } + } + + // update the filters widget + setFilter( filters() ); + } + break; + case KDECommandEvent::GetCurrentFilter: + { + QString qCurrentFilter = filterWidget->currentText(); + sendCommand( "currentFilter " + escapeString( qCurrentFilter ) ); + } + break; + case KDECommandEvent::SetCurrentFilter: + if ( nListSize >= 1 ) + { + static_cast< KDEFileFilterComboHack* >( filterWidget )->setCurrentFilter( pStringList->front() ); + } + break; + case KDECommandEvent::GetDirectory: + { + QString qDirectory = baseURL().url(); + if ( qDirectory.startsWith( "file:/" ) && qDirectory.mid( 6, 1 ) != "/" ) + qDirectory.replace( "file:/", "file:///" ); + sendCommand( "currentDirectory " + escapeString( qDirectory ) ); + } + break; + case KDECommandEvent::SetDirectory: + if ( nListSize >= 1 ) + { + setURL( pStringList->front() ); + } + break; + case KDECommandEvent::GetFiles: + { + QString qString; + qString.reserve( 1024 ); + + qString.append( "files" ); + + if ( result() == QDialog::Accepted ) + { + KURL::List qList( selectedURLs() ); + for ( KURL::List::const_iterator it = qList.begin(); it != qList.end(); ++it ) + appendURL( qString, (*it) ); + } + else + { + // we have to return the selected files anyway + const KFileItemList *pItems = ops->selectedItems(); + for ( KFileItemListIterator it( *pItems ); it.current(); ++it ) + appendURL( qString, (*it)->url() ); + } + + sendCommand( qString ); + setCanNotifySelection( true ); + } + break; + case KDECommandEvent::SetTitle: + if ( nListSize >= 1 ) + { + setCaption( pStringList->front() ); + } + break; + case KDECommandEvent::SetType: + if ( nListSize >= 1 ) + { + QString qType( pStringList->front() ); + if ( qType == "open" ) + { + setIsSave( false ); + setCaption( i18n( "Open" ) ); + } + else if ( qType == "save" ) + { + setIsSave( true ); + setCaption( i18n( "Save As" ) ); + } + } + break; + case KDECommandEvent::SetDefaultName: + if ( nListSize >= 1 ) + { + setKeepLocation( true ); + setSelection( pStringList->front() ); + } + break; + case KDECommandEvent::SetMultiSelection: + if ( nListSize >= 1 ) + { + if ( pStringList->front() == "true" ) + setMode( KFile::Files ); + else + setMode( KFile::File ); + } + break; + case KDECommandEvent::Exec: + { + filterWidget->setEditable( false ); + setIsExecuting( true ); + bool bCanExit = false; + do { + setCanNotifySelection( true ); + exec(); + + KURL qLocalSelectedURL = mostLocalURL( selectedURL() ); + QString qProtocol( qLocalSelectedURL.protocol() ); + + if ( isSave() && result() == QDialog::Accepted ) + { + if ( qProtocol == "file" ) + { + QString qFileName( addExtension( qLocalSelectedURL.path() ) ); + bCanExit = + !QFile::exists( qFileName ) || + ( KMessageBox::warningYesNo( 0, + i18n( "A file named \"%1\" already exists. " + "Are you sure you want to overwrite it?" ).arg( qFileName ), + i18n( "Overwrite File?" ), + i18n( "Overwrite" ), KStdGuiItem::cancel() ) == KMessageBox::Yes ); + } + else if ( !isSupportedProtocol( qProtocol ) ) + { + KMessageBox::sorry( 0, + i18n( "Saving using protocol \"%1\" is not supported." ).arg( qProtocol ) ); + bCanExit = false; + } + else + bCanExit = true; + } + else if ( !isSave() && result() == QDialog::Accepted && !isSupportedProtocol( qProtocol ) ) + { + KMessageBox::information( 0, + i18n( "Protocol \"%1\" is supported only partially. " + "Local copy of the file will be created." ).arg( qProtocol ) ); + bCanExit = true; + } + else + bCanExit = true; + } while ( !bCanExit ); + setIsExecuting( false ); + + if ( result() == QDialog::Accepted ) + sendCommand( "accept" ); + else + sendCommand( "reject" ); + } + break; + default: + break; + } + + // FIXME Some cleanup of pEvent? delete something, etc.? + } +} + +void KDEFileDialog::appendControl( const QString &rId, const QString &rType, const QString &rTitle ) +{ + QString qLabel( rTitle ); + qLabel.replace( '~', '&' ); + + if ( rType == "checkbox" ) + { + QCheckBox *pCheckBox = new QCheckBox( qLabel, m_pCheckBoxes, rId.utf8() ); + + pCheckBox->setEnabled( true ); + pCheckBox->setChecked( false ); + } + else if ( rType == "listbox" ) + { + QLabel *pComboLabel = new QLabel( qLabel, m_pLabels ); + QComboBox *pComboBox = new QComboBox( m_pComboBoxes, rId.utf8() ); + + pComboLabel->setBuddy( pComboBox ); + pComboBox->setEnabled( true ); + } + else if ( rType == "pushbutton" ) + { + QPushButton *pPushButton = new QPushButton( qLabel, m_pPushButtons, rId.utf8() ); + pPushButton->setEnabled( true ); + } +} + +QWidget* KDEFileDialog::findControl( const QString &rId ) const +{ + QObjectList *pList = m_pCustomWidget->queryList(); + QCString qName( rId.utf8() ); + QObjectList::const_iterator it = pList->begin(); + + for ( ; it != pList->end() && qName != (*it)->name(); ++it ) + ; + + QWidget *pWidget = NULL; + if ( it != pList->end() ) + pWidget = static_cast< QWidget* >( *it ); + + delete pList; + + return pWidget; +} + +void KDEFileDialog::enableControl( const QString &rId, const QString &rValue ) +{ + QWidget *pWidget = findControl( rId ); + + if ( pWidget ) + pWidget->setEnabled( rValue.lower() == "true" ); +} + +void KDEFileDialog::getValue( const QString &rId, const QString &rAction ) +{ + QWidget *pWidget = findControl( rId ); + QString qString; + qString.reserve( 1024 ); + qString.append( "value" ); + + if ( pWidget ) + { + QCString qClassName = pWidget->className(); + if ( qClassName == "QCheckBox" ) + { + QCheckBox *pCheckBox = static_cast< QCheckBox* >( pWidget ); + + if ( pCheckBox->isChecked() ) + qString.append( " bool true" ); + else + qString.append( " bool false" ); + } + else if ( qClassName == "QComboBox" ) + { + QComboBox *pComboBox = static_cast< QComboBox* >( pWidget ); + if ( rAction == "getItems" ) + { + qString.append( " stringList" ); + for ( int nIdx = 0; nIdx < pComboBox->count(); ++nIdx ) + { + qString.append( ' ' ); + appendEscaped( qString, pComboBox->text( nIdx ) ); + } + } + else if ( rAction == "getSelectedItem" ) + { + qString.append( " string " ); + appendEscaped( qString, pComboBox->currentText() ); + } + else if ( rAction == "getSelectedItemIndex" ) + { + qString.append( " int " ); + qString.append( QString().setNum( pComboBox->currentItem() ) ); + } + // TODO getHelpURL + } + // TODO push button + } + + sendCommand( qString ); +} + +void KDEFileDialog::setValue( const QString &rId, const QString &rAction, const QStringList &rValue ) +{ + QWidget *pWidget = findControl( rId ); + + if ( pWidget ) + { + QCString qClassName = pWidget->className(); + if ( qClassName == "QCheckBox" ) + { + QCheckBox *pCheckBox = static_cast< QCheckBox* >( pWidget ); + + bool bValue = ( !rValue.isEmpty() ) && ( rValue.front().lower() == "true" ); + pCheckBox->setChecked( bValue ); + } + else if ( qClassName == "QComboBox" ) + { + QComboBox *pComboBox = static_cast< QComboBox* >( pWidget ); + if ( rAction == "addItem" ) + { + if ( !rValue.isEmpty() ) + pComboBox->insertItem( rValue.front() ); + } + else if ( rAction == "addItems" ) + { + pComboBox->insertStringList( rValue ); + } + else if ( rAction == "deleteItem" ) + { + if ( !rValue.isEmpty() ) + pComboBox->removeItem( rValue.front().toInt() ); + } + else if ( rAction == "deleteItems" ) + { + pComboBox->clear(); + } + else if ( rAction == "setSelectedItem" ) + { + if ( !rValue.isEmpty() ) + pComboBox->setCurrentItem( rValue.front().toInt() ); + } + // FIXME setHelpURL is ignored + } + // TODO push button + } +} + +void KDEFileDialog::appendFilter( const QString &rTitle, const QString &rFilter ) +{ + // Filters are separated by ';' + QString qFilter( rFilter ); + qFilter.replace( QChar( ';' ), QChar( ' ' ) ).replace( "*.*", "*" ); + + // Workaround for too wide <All formats> (*.bmp;...) entry + QString qTitle( rTitle ); + qTitle.replace( QRegExp( "^<([^>]*)> \\(.*" ), "<\\1>" ); + + m_aFilters.push_back( qMakePair( qTitle, qFilter ) ); +} + +QString KDEFileDialog::filters() const +{ + QString qString, qTmp; + bool bFirstFilter = true; + + for ( FilterList::const_iterator it = m_aFilters.begin(); it != m_aFilters.end(); ++it ) + { + if ( bFirstFilter ) + bFirstFilter = false; + else + qString.append( '\n' ); + + qString.append( (*it).second ); + qString.append( '|' ); + + qTmp = (*it).first; + qString.append( qTmp.replace( '/', "\\/" ) ); + } + + return qString; +} + +QString KDEFileDialog::addExtension( const QString &rFileName ) const +{ + if ( !isSave() ) + return rFileName; + + QString qExtension; + + QWidget *pExtensionWidget = findControl( "100" ); // CHECKBOX_AUTOEXTENSION + QCheckBox *pExtensionCB = pExtensionWidget? static_cast< QCheckBox* >( pExtensionWidget->qt_cast( "QCheckBox" ) ): NULL; + if ( pExtensionCB && pExtensionCB->isChecked() ) + { + // FIXME: qFilter can be a MIME; we ignore it now... + QStringList qFilterList = QStringList::split( " ", currentFilter() ); + for ( QStringList::const_iterator it = qFilterList.begin(); + qExtension.isEmpty() && it != qFilterList.end(); + ++it ) + { + int nUnwanted = (*it).findRev( '*' ); + if ( nUnwanted < 0 ) + nUnwanted = (*it).findRev( '?' ); + else + nUnwanted = ::std::max( nUnwanted, (*it).find( '?', nUnwanted ) ); + + int nIdx = (*it).find( '.', ::std::max( nUnwanted, 0 ) ); + if ( nIdx >= 0 ) + qExtension = (*it).mid( nIdx ).lower(); + } + } + + if ( qExtension.isEmpty() || qExtension == "." || rFileName.endsWith( qExtension ) ) + return rFileName; + else + return rFileName + qExtension; +} + +bool KDEFileDialog::isSupportedProtocol( const QString &rProtocol ) const +{ + // TODO Get this information directly from OOo + const char * pOOoProtocols[] = { "", "smb", "ftp", "http", "file", "mailto", + "vnd.sun.star.webdav", "news", "private", "vnd.sun.star.help", + "https", "slot", "macro", "javascript", "imap", "pop3", "data", + "cid", "out", "vnd.sun.star.wfs", "vnd.sun.star.hier", "vim", + ".uno", ".component", "vnd.sun.star.pkg", "ldap", "db", + "vnd.sun.star.cmd", "vnd.sun.star.script", "vnd.sun.star.odma", + "telnet", + NULL }; + + for ( const char **pIndex = pOOoProtocols; *pIndex != NULL; ++pIndex ) + { + if ( rProtocol == *pIndex ) + return true; + } + + // TODO gnome-vfs bits here + + return false; +} + +KURL KDEFileDialog::mostLocalURL( const KURL &rURL ) const +{ +#if KDE_IS_VERSION(3,5,0) + KURL qMostLocalURL( KIO::NetAccess::mostLocalURL( rURL, const_cast<KDEFileDialog*>( this ) ) ); + if ( qMostLocalURL.isLocalFile() ) + return qMostLocalURL; + else + { + // Terrible hack to get even non-existing media:// files right + qMostLocalURL.cd( ".." ); + KURL qMostLocalPath( KIO::NetAccess::mostLocalURL( qMostLocalURL, const_cast<KDEFileDialog*>( this ) ) ); + if ( qMostLocalPath.isLocalFile() ) + { + qMostLocalPath.addPath( rURL.fileName() ); + return qMostLocalPath; + } + } +#endif + + return rURL; +} + +QString KDEFileDialog::localCopy( const QString &rFileName ) const +{ + // 106 == MIB enum for UTF-8 + KURL qLocalURL = mostLocalURL( KURL( rFileName, 106 ) ); + if ( qLocalURL.isLocalFile() ) + return qLocalURL.url(); + + int nExtensionPos = rFileName.findRev( '/' ); + if ( nExtensionPos >= 0 ) + nExtensionPos = rFileName.find( '.', nExtensionPos ); + else + nExtensionPos = rFileName.find( '.' ); + + KTempFile qTempFile( QString::null, ( nExtensionPos < 0 )? QString(): rFileName.mid( nExtensionPos ) ); + KURL qDestURL; + qDestURL.setPath( qTempFile.name() ); + + if ( !KIO::NetAccess::file_copy( rFileName, qDestURL, 0600, true, false, NULL ) ) + { + KMessageBox::error( 0, KIO::NetAccess::lastErrorString() ); + return QString::null; + } + + return qDestURL.url(); +} + +void KDEFileDialog::fileHighlightedCommand( const QString & ) +{ + if ( canNotifySelection() ) + { + sendCommand( "fileSelectionChanged" ); + setCanNotifySelection( false ); + } +} + +void KDEFileDialog::selectionChangedCommand() +{ + if ( canNotifySelection() ) + { + sendCommand( "fileSelectionChanged" ); + setCanNotifySelection( false ); + } +} + +void KDEFileDialog::sendCommand( const QString &rCommand ) +{ +#if OSL_DEBUG_LEVEL > 1 + ::std::cerr << "kdefilepicker sent: " << rCommand.latin1() << ::std::endl; +#endif + + //m_aOutputStream << rCommand << endl; + ::std::cout << rCommand.utf8() << ::std::endl; +} + +void KDEFileDialog::appendURL( QString &rBuffer, const KURL &rURL ) +{ + // From Martin Kretzschmar: + // file:///path/to/test%E0.odt is not a valid URL from OOo's point of + // view. (?Most modern parts of?) OOo assume(s) that the URL contains only + // ASCII characters (which test%E0.odt does) and is UTF-8 after unescaping + // (which file:///path/test%E0.odt is not). + // Cf. the comment in sal/inc/osl/file.h. + // 106 == MIB enum for UTF-8 + QString qUrlStr = addExtension( rURL.url( 0, 106 ) ); + + if ( !isExecuting() && !isSupportedProtocol( rURL.protocol() ) ) + qUrlStr = localCopy( qUrlStr ); + + if ( qUrlStr.startsWith( "file:/" ) && qUrlStr.mid( 6, 1 ) != "/" ) + qUrlStr.replace( "file:/", "file:///" ); + + rBuffer.append( " " ); + if ( !qUrlStr.isEmpty() ) + appendEscaped( rBuffer, qUrlStr ); +} + +void KDEFileDialog::appendEscaped( QString &rBuffer, const QString &rString ) +{ + const QChar *pUnicode = rString.unicode(); + const QChar *pEnd = pUnicode + rString.length(); + + rBuffer.append( '"' ); + for ( ; pUnicode != pEnd; ++pUnicode ) + { + if ( *pUnicode == '\\' ) + rBuffer.append( "\\\\" ); + else if ( *pUnicode == '"' ) + rBuffer.append( "\\\"" ); + else if ( *pUnicode == '\n' ) + rBuffer.append( "\\\n" ); + else + rBuffer.append( *pUnicode ); + } + rBuffer.append( '"' ); +} + +QString KDEFileDialog::escapeString( const QString &rString ) +{ + QString qString; + qString.reserve( 2*rString.length() + 2 ); // every char escaped + quotes + + appendEscaped( qString, rString ); + + return qString; +} + + +void KDEFileFilterComboHack::setCurrentFilter( const QString& filter ) +{ + setCurrentText( filter ); + filterChanged(); + + // Workaround for 'Filter name (*.blah)' vs. 'Filter name' + if ( currentText() != text( currentItem() ) ) + { + int nItem = 0; + for ( ; nItem < count() && !text( nItem ).startsWith( filter ); ++nItem ); + + if ( nItem < count() ) + setCurrentItem( nItem ); + else + setCurrentItem( 0 ); + + filterChanged(); + } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/unx/kde/kdefilepicker.hxx b/fpicker/source/unx/kde/kdefilepicker.hxx new file mode 100644 index 000000000000..4d545ebc76ca --- /dev/null +++ b/fpicker/source/unx/kde/kdefilepicker.hxx @@ -0,0 +1,127 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2010 Novell, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _KDEFILEPICKER_HXX_ +#define _KDEFILEPICKER_HXX_ + +#include <cstddef> + +#include <kfiledialog.h> +#include <kfilefiltercombo.h> + +class QGrid; +class QHBox; +class QVBox; + +class KDEFileDialog : public KFileDialog +{ + Q_OBJECT + +protected: + typedef QPair< QString, QString > FilterEntry; + typedef QValueList< FilterEntry > FilterList; + + QVBox *m_pCustomWidget; + QHBox *m_pCombosAndButtons; + + QVBox *m_pLabels; + QVBox *m_pComboBoxes; + QVBox *m_pPushButtons; + + QGrid *m_pCheckBoxes; + + FilterList m_aFilters; + + /** Are we a "Save As" dialog? + * + * We cannot use KFileDialog::setOperationMode() here, because then + * it automatically adds an "Automatically select filename extension" + * check box, and completely destroys the dialog's layout + * (custom list boxes are under this check box, which looks ugly). + */ + bool m_bIsSave; + bool m_bIsExecuting; + + bool m_bCanNotifySelection; + +public: + KDEFileDialog( const QString &startDir, const QString &filter, + QWidget *parent, const char *name ); + virtual ~KDEFileDialog(); + +protected: + virtual void resizeEvent( QResizeEvent *pEvent ); + virtual void showEvent( QShowEvent *pEvent ); + void updateCustomWidgetLayout(); + + virtual void customEvent( QCustomEvent *pEvent ); + +protected: + void appendControl( const QString &rId, const QString &rType, const QString &rTitle ); + QWidget* findControl( const QString &rId ) const; + void enableControl( const QString &rId, const QString &rValue ); + void getValue( const QString &rId, const QString &rAction ); + void setValue( const QString &rId, const QString &rAction, const QStringList &rValue ); + + void appendFilter( const QString &rTitle, const QString &rFilter ); + QString filters() const; + QString addExtension( const QString &rFileName ) const; + + void setIsSave( bool bIsSave ) { m_bIsSave = bIsSave; } + bool isSave( void ) const { return m_bIsSave; } + + void setIsExecuting( bool bIsExecuting ) { m_bIsExecuting = bIsExecuting; } + bool isExecuting( void ) const { return m_bIsExecuting; } + + bool isSupportedProtocol( const QString &rProtocol ) const; + KURL mostLocalURL( const KURL &rURL ) const; + QString localCopy( const QString &rFileName ) const; + + void setCanNotifySelection( bool bCanNotifySelection ) { m_bCanNotifySelection = bCanNotifySelection; } + bool canNotifySelection( void ) const { return m_bCanNotifySelection; } + +protected slots: + void fileHighlightedCommand( const QString & ); + void selectionChangedCommand(); + +protected: + void sendCommand( const QString &rCommand ); + void appendURL( QString &rBuffer, const KURL &rURL ); + void appendEscaped( QString &rBuffer, const QString &rString ); + QString escapeString( const QString &rString ); +}; + +class KDEFileFilterComboHack : public KFileFilterCombo +{ +public: + void setCurrentFilter( const QString& filter ); +}; + +#endif // _KDEFILEPICKER_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/unx/kde/kdefpmain.cxx b/fpicker/source/unx/kde/kdefpmain.cxx new file mode 100644 index 000000000000..2300fe61a2c4 --- /dev/null +++ b/fpicker/source/unx/kde/kdefpmain.cxx @@ -0,0 +1,94 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2010 Novell, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <cstddef> + +#include <kdemodalityfilter.hxx> +#include <kdefilepicker.hxx> +#include <kdecommandthread.hxx> + +#include <kaboutdata.h> +#include <kapplication.h> +#include <kcmdlineargs.h> + +#include <iostream> +#include <stdlib.h> + +////////////////////////////////////////////////////////////////////////// +// Main +////////////////////////////////////////////////////////////////////////// + +static KCmdLineOptions sOptions[] = +{ + { "winid <argument>", I18N_NOOP("Window ID to which is the fpicker modal"), "0" }, + KCmdLineLastOption +}; + +int main( int argc, char* argv[] ) +{ + // we fake the name of the application to have "OpenOffice.org" in the + // title + KAboutData qAboutData( "kdefilepicker", I18N_NOOP( "OpenOffice.org" ), + "0.1", I18N_NOOP( "kdefilepicker is an implementation of the KDE file dialog for OpenOffice.org." ), + KAboutData::License_LGPL, + "(c) 2004, Jan Holesovsky" ); + qAboutData.addAuthor( "Jan Holesovsky", I18N_NOOP("Original author and current maintainer"), "kendy@openoffice.org" ); + + // Let the user see that this does something... + ::std::cerr << "kdefilepicker, an implementation of KDE file dialog for OOo." << ::std::endl + << "Type 'exit' and press Enter to finish." << ::std::endl; + + KCmdLineArgs::addCmdLineOptions( sOptions ); + KCmdLineArgs::init( argc, argv, &qAboutData ); + + KLocale::setMainCatalogue( "kdialog" ); + + KApplication kApplication; + + // Setup the modality + KCmdLineArgs *pArgs = KCmdLineArgs::parsedArgs(); + long nWinId = atol( pArgs->getOption( "winid" ) ); + pArgs->clear(); + + KDEModalityFilter qModalityFilter( nWinId ); + + KDEFileDialog aFileDialog( NULL, QString(), NULL, "kdefiledialog" ); + + KDECommandThread qCommandThread( &aFileDialog ); + qCommandThread.start(); + + kApplication.exec(); + + qCommandThread.wait(); + + ::std::cout << "exited" << ::std::endl; + + return 0; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/unx/kde/kdemodalityfilter.cxx b/fpicker/source/unx/kde/kdemodalityfilter.cxx new file mode 100644 index 000000000000..5aeddb0a80a6 --- /dev/null +++ b/fpicker/source/unx/kde/kdemodalityfilter.cxx @@ -0,0 +1,69 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2010 Novell, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <cstddef> + +#include <kdemodalityfilter.hxx> + +#include <kapplication.h> +#include <kdialogbase.h> + +#include <netwm.h> +#include <X11/Xlib.h> +#include <X11/Xutil.h> + +////////////////////////////////////////////////////////////////////////// +// Modality filter +////////////////////////////////////////////////////////////////////////// + +KDEModalityFilter::KDEModalityFilter( WId nWinId ) + : m_nWinId( nWinId ) +{ + kapp->installEventFilter( this ); +} + +KDEModalityFilter::~KDEModalityFilter() +{ + kapp->removeEventFilter( this ); +} + +bool KDEModalityFilter::eventFilter( QObject *pObject, QEvent *pEvent ) +{ + if ( pObject->isWidgetType() && pEvent->type() == QEvent::Show ) + { + KDialogBase* pDlg = ::qt_cast< KDialogBase* >( pObject ); + if ( pDlg != NULL && m_nWinId != 0 ) + { + XSetTransientForHint( qt_xdisplay(), pDlg->winId(), m_nWinId ); + m_nWinId = 0; + } + } + return false; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/unx/kde/kdemodalityfilter.hxx b/fpicker/source/unx/kde/kdemodalityfilter.hxx new file mode 100644 index 000000000000..8635694a39e1 --- /dev/null +++ b/fpicker/source/unx/kde/kdemodalityfilter.hxx @@ -0,0 +1,48 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2010 Novell, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _KDEMODALITYFILTER_HXX_ +#define _KDEMODALITYFILTER_HXX_ + +#include <qobject.h> + +class KDEModalityFilter : public QObject +{ +private: + WId m_nWinId; + +public: + KDEModalityFilter( WId nWinId ); + virtual ~KDEModalityFilter(); + + virtual bool eventFilter( QObject *pObject, QEvent *pEvent ); +}; + +#endif // _KDEMODALITYFILTER_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/unx/kde/makefile.mk b/fpicker/source/unx/kde/makefile.mk new file mode 100644 index 000000000000..e1bc4db47d36 --- /dev/null +++ b/fpicker/source/unx/kde/makefile.mk @@ -0,0 +1,73 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2010 Novell, Inc. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/..$/.. + +PRJNAME=fpicker +TARGET=kdefilepicker +LIBTARGET=NO +ENABLE_EXCEPTIONS=TRUE +EXTERNAL_WARNINGS_NOT_ERRORS=TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk + +# ------------------------------------------------------------------ + +.IF "$(GUIBASE)" != "unx" || "$(ENABLE_KDE)" != "TRUE" + +dummy: + @echo "Nothing to build. GUIBASE == $(GUIBASE), ENABLE_KDE is not set" + +.ELSE # we build for KDE + +CFLAGS+= $(KDE_CFLAGS) + +# --- Files -------------------------------------------------------- + +SLOFILES =\ + $(SLO)$/kdecommandthread.obj \ + $(SLO)$/kdefilepicker.obj \ + $(SLO)$/kdefilepicker.moc.obj \ + $(SLO)$/kdefpmain.obj \ + $(SLO)$/kdemodalityfilter.obj + +APP1TARGET=$(TARGET) +APP1OBJS=$(SLOFILES) +APP1RPATH=BRAND +APP1LINKFLAGS=$(KDE_LIBS) -lkio -lX11 +APP1STDLIBS=$(SALLIB) + +.ENDIF # "$(GUIBASE)" != "unx" || "$(ENABLE_KDE)" != "TRUE" + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk + +$(MISC)$/kdefilepicker.moc.cxx : kdefilepicker.hxx + $(MOC) $< -o $@ diff --git a/fpicker/source/unx/kde4/FPServiceInfo.hxx b/fpicker/source/unx/kde4/FPServiceInfo.hxx index 8d99249acb14..6dfb50e5d1ef 100644 --- a/fpicker/source/unx/kde4/FPServiceInfo.hxx +++ b/fpicker/source/unx/kde4/FPServiceInfo.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -38,3 +39,5 @@ // Format: -> "/ImplName/UNO/SERVICES/ServiceName" // <Implementation-Name></UNO/SERVICES/><Service-Name> #define FILE_PICKER_REGKEY_NAME "/com.sun.star.ui.dialogs.KDE4FilePickerImpl/UNO/SERVICES/com.sun.star.ui.dialogs.KDE4FilePicker" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/unx/kde4/KDE4FPEntry.cxx b/fpicker/source/unx/kde4/KDE4FPEntry.cxx index 174b1fc440a6..0dd047c399f0 100644 --- a/fpicker/source/unx/kde4/KDE4FPEntry.cxx +++ b/fpicker/source/unx/kde4/KDE4FPEntry.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -62,7 +63,7 @@ extern "C" if ( pSrvManager && ( 0 == rtl_str_compare( pImplName, FILE_PICKER_IMPL_NAME ) ) ) { Sequence< OUString > aSNS( 1 ); - aSNS.getArray( )[0] = OUString::createFromAscii( FILE_PICKER_SERVICE_NAME ); + aSNS.getArray( )[0] = OUString(RTL_CONSTASCII_USTRINGPARAM( FILE_PICKER_SERVICE_NAME )); Reference< XSingleServiceFactory > xFactory ( createSingleFactory( reinterpret_cast< XMultiServiceFactory* > ( pSrvManager ), @@ -79,3 +80,5 @@ extern "C" return pRet; } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/unx/kde4/KDE4FilePicker.cxx b/fpicker/source/unx/kde4/KDE4FilePicker.cxx index 32b26ca02f15..562a2d254f3d 100644 --- a/fpicker/source/unx/kde4/KDE4FilePicker.cxx +++ b/fpicker/source/unx/kde4/KDE4FilePicker.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -40,7 +41,7 @@ #include <svtools/svtools.hrc> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <vcl/svapp.hxx> #include <vcl/sysdata.hxx> @@ -62,6 +63,7 @@ #include <kapplication.h> #include <kfilefiltercombo.h> +#include <qclipboard.h> #include <QWidget> #include <QCheckBox> #include <QGridLayout> @@ -97,9 +99,9 @@ namespace uno::Sequence<rtl::OUString> SAL_CALL FilePicker_getSupportedServiceNames() { uno::Sequence<rtl::OUString> aRet(3); - aRet[0] = rtl::OUString::createFromAscii("com.sun.star.ui.dialogs.FilePicker"); - aRet[1] = rtl::OUString::createFromAscii("com.sun.star.ui.dialogs.SystemFilePicker"); - aRet[2] = rtl::OUString::createFromAscii("com.sun.star.ui.dialogs.KDE4FilePicker"); + aRet[0] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ui.dialogs.FilePicker")); + aRet[1] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ui.dialogs.SystemFilePicker")); + aRet[2] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ui.dialogs.KDE4FilePicker")); return aRet; } } @@ -152,14 +154,14 @@ KDE4FilePicker::~KDE4FilePicker() void SAL_CALL KDE4FilePicker::addFilePickerListener( const uno::Reference<XFilePickerListener>& xListener ) throw( uno::RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; m_xListener = xListener; } void SAL_CALL KDE4FilePicker::removeFilePickerListener( const uno::Reference<XFilePickerListener>& ) throw( uno::RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; m_xListener.clear(); } @@ -187,8 +189,24 @@ sal_Int16 SAL_CALL KDE4FilePicker::execute() _dialog->setFilter(_filter); _dialog->filterWidget()->setEditable(false); + // At this point, SolarMutex is held. Opening the KDE file dialog here + // can lead to QClipboard asking for clipboard contents. If LO core + // is the owner of the clipboard content, this will block for 5 seconds + // and timeout, since the clipboard thread will not be able to acquire + // SolarMutex and thus won't be able to respond. If the event loops + // are properly integrated and QClipboard can use a nested event loop + // (see the KDE VCL plug), then this won't happen, but otherwise + // simply release the SolarMutex here. The KDE file dialog does not + // call back to the core, so this should be safe (and if it does, + // SolarMutex will need to be re-acquired). + long mutexrelease = 0; + if( !qApp->clipboard()->property( "useEventLoopWhenWaiting" ).toBool()) + mutexrelease = Application::ReleaseSolarMutex(); //block and wait for user input - if (_dialog->exec() == KFileDialog::Accepted) + int result = _dialog->exec(); + if( !qApp->clipboard()->property( "useEventLoopWhenWaiting" ).toBool()) + Application::AcquireSolarMutex( mutexrelease ); + if( result == KFileDialog::Accepted) return ExecutableDialogResults::OK; return ExecutableDialogResults::CANCEL; @@ -230,20 +248,6 @@ uno::Sequence< ::rtl::OUString > SAL_CALL KDE4FilePicker::getFiles() QStringList rawFiles = _dialog->selectedFiles(); QStringList files; - // check if we need to add an extension - QString extension = ""; - if ( _dialog->operationMode() == KFileDialog::Saving ) - { - QCheckBox *cb = dynamic_cast<QCheckBox*> ( - _customWidgets[ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION ]); - - if (cb && cb->isChecked()) - { - extension = _dialog->currentFilter(); // assuming filter value is like this *.ext - extension.replace("*",""); - } - } - // Workaround for the double click selection KDE4 bug // kde file picker returns the file and directories for selectedFiles() // when a file is double clicked @@ -270,12 +274,7 @@ uno::Sequence< ::rtl::OUString > SAL_CALL KDE4FilePicker::getFiles() if (singleFile) filename.prepend(dir + "/"); - - //prevent extension append if we already have one - if (filename.endsWith(extension)) - files.append(filename); - else - files.append(filename + extension); + files.append(filename); } } @@ -300,10 +299,7 @@ void SAL_CALL KDE4FilePicker::appendFilter( const ::rtl::OUString &title, const if (!_filter.isNull()) _filter.append("\n"); - //add to hash map for reverse lookup in getCurrentFilter - _filters.insert(f, t); - - // '/' meed to be escaped to else they are assumed to be mime types by kfiledialog + // '/' need to be escaped else they are assumed to be mime types by kfiledialog //see the docs t.replace("/", "\\/"); @@ -324,7 +320,11 @@ void SAL_CALL KDE4FilePicker::setCurrentFilter( const rtl::OUString &title ) rtl::OUString SAL_CALL KDE4FilePicker::getCurrentFilter() throw( uno::RuntimeException ) { - QString filter = _filters[_dialog->currentFilter()]; + // _dialog->currentFilter() wouldn't quite work, because it returns only e.g. "*.doc", + // without the description, and there may be several filters with the same pattern + QString filter = _dialog->filterWidget()->currentText(); + filter = filter.mid( filter.indexOf( '|' ) + 1 ); // convert from the pattern|description format if needed + filter.replace( "\\/", "/" ); //default if not found if (filter.isNull()) @@ -363,6 +363,9 @@ void SAL_CALL KDE4FilePicker::setValue( sal_Int16 controlId, sal_Int16, const un switch (controlId) { case ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION: + // we actually rely on KFileDialog and ignore CHECKBOX_AUTOEXTENSION completely, + // otherwise the checkbox would be duplicated + break; case ExtendedFilePickerElementIds::CHECKBOX_PASSWORD: case ExtendedFilePickerElementIds::CHECKBOX_FILTEROPTIONS: case ExtendedFilePickerElementIds::CHECKBOX_READONLY: @@ -399,6 +402,10 @@ uno::Any SAL_CALL KDE4FilePicker::getValue( sal_Int16 controlId, sal_Int16 ) switch (controlId) { case ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION: + // we ignore this one and rely on KFileDialog to provide the function, + // always return true, here meaning "it's been taken care of" + res = uno::Any( true ); + break; case ExtendedFilePickerElementIds::CHECKBOX_PASSWORD: case ExtendedFilePickerElementIds::CHECKBOX_FILTEROPTIONS: case ExtendedFilePickerElementIds::CHECKBOX_READONLY: @@ -445,7 +452,7 @@ void SAL_CALL KDE4FilePicker::setLabel( sal_Int16 controlId, const ::rtl::OUStri { switch (controlId) { - case ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION: + case ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION: // ignored case ExtendedFilePickerElementIds::CHECKBOX_PASSWORD: case ExtendedFilePickerElementIds::CHECKBOX_FILTEROPTIONS: case ExtendedFilePickerElementIds::CHECKBOX_READONLY: @@ -480,7 +487,7 @@ rtl::OUString SAL_CALL KDE4FilePicker::getLabel(sal_Int16 controlId) { switch (controlId) { - case ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION: + case ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION: // ignored case ExtendedFilePickerElementIds::CHECKBOX_PASSWORD: case ExtendedFilePickerElementIds::CHECKBOX_FILTEROPTIONS: case ExtendedFilePickerElementIds::CHECKBOX_READONLY: @@ -573,6 +580,10 @@ void KDE4FilePicker::addCustomControl(sal_Int16 controlId) } widget = new QCheckBox(label, _extraControls); + // the checkbox is created even for CHECKBOX_AUTOEXTENSION to simplify + // code, but the checkbox is hidden and ignored + if( controlId == ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION ) + widget->hide(); break; } @@ -598,14 +609,13 @@ void SAL_CALL KDE4FilePicker::initialize( const uno::Sequence<uno::Any> &args ) throw( uno::Exception, uno::RuntimeException ) { _filter.clear(); - _filters.clear(); // parameter checking uno::Any arg; if (args.getLength() == 0) { throw lang::IllegalArgumentException( - rtl::OUString::createFromAscii( "no arguments" ), + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "no arguments" )), static_cast< XFilePicker* >( this ), 1 ); } @@ -615,7 +625,7 @@ void SAL_CALL KDE4FilePicker::initialize( const uno::Sequence<uno::Any> &args ) ( arg.getValueType() != ::getCppuType((sal_Int8*)0))) { throw lang::IllegalArgumentException( - rtl::OUString::createFromAscii( "invalid argument type" ), + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "invalid argument type" )), static_cast< XFilePicker* >( this ), 1 ); } @@ -636,13 +646,12 @@ void SAL_CALL KDE4FilePicker::initialize( const uno::Sequence<uno::Any> &args ) case FILESAVE_AUTOEXTENSION: operationMode = KFileDialog::Saving; - //addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION ); + addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION ); break; case FILESAVE_AUTOEXTENSION_PASSWORD: { operationMode = KFileDialog::Saving; - //addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION ); addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_PASSWORD ); break; } @@ -662,6 +671,7 @@ void SAL_CALL KDE4FilePicker::initialize( const uno::Sequence<uno::Any> &args ) case FILESAVE_AUTOEXTENSION_TEMPLATE: operationMode = KFileDialog::Saving; + addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION ); addCustomControl( ExtendedFilePickerElementIds::LISTBOX_TEMPLATE ); break; @@ -687,7 +697,7 @@ void SAL_CALL KDE4FilePicker::initialize( const uno::Sequence<uno::Any> &args ) default: throw lang::IllegalArgumentException( - rtl::OUString::createFromAscii( "Unknown template" ), + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Unknown template" )), static_cast< XFilePicker* >( this ), 1 ); } @@ -716,7 +726,7 @@ void SAL_CALL KDE4FilePicker::disposing( const lang::EventObject &rEvent ) rtl::OUString SAL_CALL KDE4FilePicker::getImplementationName() throw( uno::RuntimeException ) { - return rtl::OUString::createFromAscii( FILE_PICKER_IMPL_NAME ); + return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( FILE_PICKER_IMPL_NAME )); } sal_Bool SAL_CALL KDE4FilePicker::supportsService( const rtl::OUString& ServiceName ) @@ -738,3 +748,5 @@ uno::Sequence< ::rtl::OUString > SAL_CALL KDE4FilePicker::getSupportedServiceNam { return FilePicker_getSupportedServiceNames(); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/unx/kde4/KDE4FilePicker.hxx b/fpicker/source/unx/kde4/KDE4FilePicker.hxx index a7983a72590f..edef224c003e 100644 --- a/fpicker/source/unx/kde4/KDE4FilePicker.hxx +++ b/fpicker/source/unx/kde4/KDE4FilePicker.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -35,7 +36,6 @@ #include <com/sun/star/ui/dialogs/XFilterManager.hpp> #include <com/sun/star/ui/dialogs/XFilterGroupManager.hpp> #include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp> -//#include <com/sun/star/ui/dialogs/XFilePreview.hpp> #include <com/sun/star/util/XCancellable.hpp> #include <osl/conditn.hxx> @@ -79,9 +79,6 @@ protected: //running filter string to add to dialog QString _filter; - //filter for reverse lookup of filter text - QHash<QString, QString> _filters; - //mapping of SAL control ID's to created custom controls QHash<sal_Int16, QWidget*> _customWidgets; @@ -169,3 +166,5 @@ private: void addCustomControl(sal_Int16 controlId); }; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/unx/kde_unx/FPServiceInfo.hxx b/fpicker/source/unx/kde_unx/FPServiceInfo.hxx new file mode 100644 index 000000000000..9e4cbf1ac44d --- /dev/null +++ b/fpicker/source/unx/kde_unx/FPServiceInfo.hxx @@ -0,0 +1,47 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * Copyright 2010 Novell, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _FPSERVICEINFO_HXX_ +#define _FPSERVICEINFO_HXX_ + +// the service names +#define FILE_PICKER_SERVICE_NAME "com.sun.star.ui.dialogs.KDEFilePicker" + +// the implementation names +#define FILE_PICKER_IMPL_NAME "com.sun.star.ui.dialogs.UnxFilePicker" + +// the registry key names +// a key under which this service will be registered, +// Format: -> "/ImplName/UNO/SERVICES/ServiceName" +// <Implementation-Name></UNO/SERVICES/><Service-Name> +#define FILE_PICKER_REGKEY_NAME "/com.sun.star.ui.dialogs.UnxFilePicker/UNO/SERVICES/com.sun.star.ui.dialogs.KDEFilePicker" + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/unx/kde_unx/UnxCommandThread.cxx b/fpicker/source/unx/kde_unx/UnxCommandThread.cxx new file mode 100644 index 000000000000..3b113346eb40 --- /dev/null +++ b/fpicker/source/unx/kde_unx/UnxCommandThread.cxx @@ -0,0 +1,314 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2010 Novell, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <UnxCommandThread.hxx> +#include <UnxNotifyThread.hxx> + +#include <rtl/ustring.hxx> +#include <rtl/ustrbuf.hxx> + +#include <unistd.h> +#include <string.h> +#include <iostream> + +using namespace ::com::sun::star; + +////////////////////////////////////////////////////////////////////////// +// UnxFilePickerCommandThread +////////////////////////////////////////////////////////////////////////// + +UnxFilePickerCommandThread::UnxFilePickerCommandThread( UnxFilePickerNotifyThread *pNotifyThread, int nReadFD ) + : m_pNotifyThread( pNotifyThread ), + m_nReadFD( nReadFD ) +{ +} + +UnxFilePickerCommandThread::~UnxFilePickerCommandThread() +{ +} + +sal_Bool SAL_CALL UnxFilePickerCommandThread::result() +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return m_aResult; +} + +::rtl::OUString SAL_CALL UnxFilePickerCommandThread::getCurrentFilter() +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return m_aGetCurrentFilter; +} + +::rtl::OUString SAL_CALL UnxFilePickerCommandThread::getDirectory() +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return m_aGetDirectory; +} + +uno::Sequence< ::rtl::OUString > SAL_CALL UnxFilePickerCommandThread::getFiles() +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + sal_Int32 nSize = m_aGetFiles.size(); + uno::Sequence< ::rtl::OUString > aFiles( ( nSize > 1 )? nSize + 1: nSize ); + + if ( nSize == 1 ) + aFiles[0] = m_aGetFiles.front(); + else if ( nSize > 1 ) + { + // First entry in the sequence must be the dirname, the others are the + // filenames, so we have to rearrange the list... + + ::rtl::OUString aFront = m_aGetFiles.front(); + sal_Int32 nLastSlash = aFront.lastIndexOf( '/' ); + + aFiles[0] = ( nLastSlash >= 0 )? aFront.copy( 0, nLastSlash ): ::rtl::OUString(); + ++nLastSlash; + + sal_Int32 nIdx = 1; + for ( ::std::list< ::rtl::OUString >::const_iterator it = m_aGetFiles.begin(); + it != m_aGetFiles.end(); ++it, ++nIdx ) + { + sal_Int32 nLength = (*it).getLength() - nLastSlash; + aFiles[nIdx] = ( nLength >= 0 )? (*it).copy( nLastSlash, nLength ): ::rtl::OUString(); + } + } + + return aFiles; +} + +uno::Any SAL_CALL UnxFilePickerCommandThread::getValue() +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return m_aGetValue; +} + +void SAL_CALL UnxFilePickerCommandThread::run() +{ + if ( m_nReadFD < 0 ) + return; + + sal_Int32 nBufferSize = 1024; // 1 is for testing, 1024 for real use + sal_Char *pBuffer = new sal_Char[nBufferSize]; + sal_Char *pBufferEnd = pBuffer + nBufferSize; + + sal_Char *pWhereToRead = pBuffer; + sal_Char *pEntryBegin = pBuffer; + sal_Int32 nBytesRead = 0; + sal_Bool bShouldExit = sal_False; + while ( !bShouldExit && ( nBytesRead = read( m_nReadFD, pWhereToRead, pBufferEnd - pWhereToRead ) ) > 0 ) + { + sal_Bool bFoundNL = sal_False; + sal_Char *pWhereToReadEnd = pWhereToRead + nBytesRead; + sal_Char *pEntryEnd = pWhereToRead; + do { + for ( ; pEntryEnd < pWhereToReadEnd && *pEntryEnd != '\n'; ++pEntryEnd ) + ; + + if ( pEntryEnd < pWhereToReadEnd ) + { + bFoundNL = sal_True; + *pEntryEnd = 0; + + if ( strcmp( pEntryBegin, "exited" ) == 0 ) + bShouldExit = sal_True; + else + handleCommand( ::rtl::OUString( pEntryBegin, pEntryEnd - pEntryBegin, RTL_TEXTENCODING_UTF8 )/*, bQuit*/ ); + + pEntryBegin = pEntryEnd + 1; + } + } while ( pEntryEnd < pWhereToReadEnd ); + + if ( bFoundNL ) + { + if ( pEntryBegin < pBufferEnd ) + memmove( pBuffer, pEntryBegin, pWhereToReadEnd - pEntryBegin ); + } + else + { + // enlarge the buffer size + nBufferSize *= 2; + sal_Char *pNewBuffer = new sal_Char[nBufferSize]; + if ( pEntryBegin < pBufferEnd ) + memmove( pNewBuffer, pEntryBegin, pWhereToReadEnd - pEntryBegin ); + + delete[] pBuffer; + pBuffer = pNewBuffer; + pBufferEnd = pBuffer + nBufferSize; + } + + pWhereToRead = pBuffer + ( pWhereToReadEnd - pEntryBegin ); + pEntryBegin = pBuffer; + } +} + +void SAL_CALL UnxFilePickerCommandThread::handleCommand( const ::rtl::OUString &rCommand ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + +#if OSL_DEBUG_LEVEL > 0 + ::std::cerr << "UnxFilePicker received: \"" << + OUStringToOString( rCommand, RTL_TEXTENCODING_ASCII_US ).getStr() << "\"" << ::std::endl; +#endif + + ::std::list< ::rtl::OUString > aList = tokenize( rCommand ); + + if ( aList.size() == 0 ) + return; + + ::rtl::OUString aCommandName = aList.front(); + aList.pop_front(); + + if ( aCommandName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "accept" ) ) ) + { + m_aResult = sal_True; + m_aExecCondition.set(); + } + else if ( aCommandName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "reject" ) ) ) + { + m_aResult = sal_False; + m_aExecCondition.set(); + } + else if ( aCommandName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "fileSelectionChanged" ) ) ) + { + if ( m_pNotifyThread ) + m_pNotifyThread->fileSelectionChanged(); + } + else if ( aCommandName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "files" ) ) ) + { + m_aGetFiles = aList; + m_aGetFilesCondition.set(); + } + else if ( aCommandName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "value" ) ) ) + { + ::rtl::OUString aType; + if ( !aList.empty() ) + { + aType = aList.front(); + aList.pop_front(); + } + + if ( aType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "bool" ) ) ) + { + sal_Bool bValue = !aList.empty() && aList.front().equalsIgnoreAsciiCaseAscii( "true" ); + + m_aGetValue <<= bValue; + m_aGetValueCondition.set(); + } + else if ( aType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "int" ) ) ) + { + sal_Int32 nValue = 0; + if ( !aList.empty() ) + nValue = aList.front().toInt32(); + + m_aGetValue <<= nValue; + m_aGetValueCondition.set(); + } + else if ( aType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "string" ) ) ) + { + ::rtl::OUString aValue; + if ( !aList.empty() ) + aValue = aList.front(); + + m_aGetValue <<= aValue; + m_aGetValueCondition.set(); + } + else if ( aType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "stringList" ) ) ) + { + uno::Sequence< ::rtl::OUString > aSequence( aList.size() ); + sal_Int32 nIdx = 0; + for ( ::std::list< ::rtl::OUString >::const_iterator it = aList.begin(); it != aList.end(); ++it, ++nIdx ) + aSequence[nIdx] = (*it); + + m_aGetValue <<= aSequence; + m_aGetValueCondition.set(); + } + else + { + m_aGetValue = uno::Any(); + m_aGetValueCondition.set(); + } + } + else if ( aCommandName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "currentFilter" ) ) ) + { + m_aGetCurrentFilter = aList.empty()? ::rtl::OUString(): aList.front(); + m_aGetCurrentFilterCondition.set(); + } + else if ( aCommandName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "currentDirectory" ) ) ) + { + m_aGetDirectory = aList.empty()? ::rtl::OUString(): aList.front(); + m_aGetDirectoryCondition.set(); + } + else + { +#if OSL_DEBUG_LEVEL > 0 + ::std::cerr << "Unrecognized command: " + << OUStringToOString( aCommandName, RTL_TEXTENCODING_ASCII_US ).getStr() << "\"" << ::std::endl; +#endif + } +} + +::std::list< ::rtl::OUString > SAL_CALL UnxFilePickerCommandThread::tokenize( const ::rtl::OUString &rCommand ) +{ + ::std::list< ::rtl::OUString > aList; + ::rtl::OUStringBuffer aBuffer( 1024 ); + + const sal_Unicode *pUnicode = rCommand.getStr(); + const sal_Unicode *pEnd = pUnicode + rCommand.getLength(); + sal_Bool bQuoted = sal_False; + + for ( ; pUnicode != pEnd; ++pUnicode ) + { + if ( *pUnicode == '\\' ) + { + ++pUnicode; + if ( pUnicode != pEnd ) + { + if ( *pUnicode == 'n' ) + aBuffer.appendAscii( "\n", 1 ); + else + aBuffer.append( *pUnicode ); + } + } + else if ( *pUnicode == '"' ) + bQuoted = !bQuoted; + else if ( *pUnicode == ' ' && !bQuoted ) + aList.push_back( aBuffer.makeStringAndClear() ); + else + aBuffer.append( *pUnicode ); + } + aList.push_back( aBuffer.makeStringAndClear() ); + + return aList; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/unx/kde_unx/UnxCommandThread.hxx b/fpicker/source/unx/kde_unx/UnxCommandThread.hxx new file mode 100644 index 000000000000..b8c6aaaaf97c --- /dev/null +++ b/fpicker/source/unx/kde_unx/UnxCommandThread.hxx @@ -0,0 +1,135 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2010 Novell, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _UNXCOMMANDTHREAD_HXX_ +#define _UNXCOMMANDTHREAD_HXX_ + +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Sequence.hxx> + +#include <osl/conditn.hxx> +#include <osl/mutex.hxx> +#include <osl/thread.hxx> +#include <rtl/ustring.hxx> + +#include <vcl/svapp.hxx> + +#include <list> + +class UnxFilePickerNotifyThread; + +/** Synchronization for the 'thread-less' version of the fpicker. + + Something like osl::Condition, but calls Application::Yield() while in + wait(). +*/ +class YieldingCondition +{ + ::osl::Mutex m_aMutex; + bool m_bValue; + + bool get() + { + ::osl::MutexGuard aGuard( m_aMutex ); + return m_bValue; + } + +public: + YieldingCondition() { reset(); } + + void reset() + { + ::osl::MutexGuard aGuard( m_aMutex ); + m_bValue = false; + } + + void set() + { + ::osl::MutexGuard aGuard( m_aMutex ); + m_bValue = true; + } + + void wait() + { + while ( !get() ) + Application::Yield(); + } +}; + +class UnxFilePickerCommandThread : public ::osl::Thread +{ +protected: + UnxFilePickerNotifyThread *m_pNotifyThread; + int m_nReadFD; + + ::osl::Mutex m_aMutex; + + YieldingCondition m_aExecCondition; + sal_Bool m_aResult; + + ::osl::Condition m_aGetCurrentFilterCondition; + ::rtl::OUString m_aGetCurrentFilter; + + ::osl::Condition m_aGetDirectoryCondition; + ::rtl::OUString m_aGetDirectory; + + ::osl::Condition m_aGetFilesCondition; + ::std::list< ::rtl::OUString > m_aGetFiles; + + ::osl::Condition m_aGetValueCondition; + ::com::sun::star::uno::Any m_aGetValue; + +public: + UnxFilePickerCommandThread( UnxFilePickerNotifyThread *pNotifyThread, int nReadFD ); + ~UnxFilePickerCommandThread(); + + YieldingCondition& SAL_CALL execCondition() { return m_aExecCondition; } + sal_Bool SAL_CALL result(); + + ::osl::Condition& SAL_CALL getCurrentFilterCondition() { return m_aGetCurrentFilterCondition; } + ::rtl::OUString SAL_CALL getCurrentFilter(); + + ::osl::Condition& SAL_CALL getDirectoryCondition() { return m_aGetDirectoryCondition; } + ::rtl::OUString SAL_CALL getDirectory(); + + ::osl::Condition& SAL_CALL getFilesCondition() { return m_aGetFilesCondition; } + ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getFiles(); + + ::osl::Condition& SAL_CALL getValueCondition() { return m_aGetValueCondition; } + ::com::sun::star::uno::Any SAL_CALL getValue(); + +protected: + virtual void SAL_CALL run(); + + virtual void SAL_CALL handleCommand( const ::rtl::OUString &rCommand/*, sal_Bool &rQuit*/ ); + ::std::list< ::rtl::OUString > SAL_CALL tokenize( const ::rtl::OUString &rCommand ); +}; + +#endif // _UNXCOMMANDTHREAD_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/unx/kde_unx/UnxFPentry.cxx b/fpicker/source/unx/kde_unx/UnxFPentry.cxx new file mode 100644 index 000000000000..9a874329281c --- /dev/null +++ b/fpicker/source/unx/kde_unx/UnxFPentry.cxx @@ -0,0 +1,127 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * Copyright 2010 Novell, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <com/sun/star/container/XSet.hpp> + +#include <cppuhelper/factory.hxx> +#include <osl/diagnose.h> + +#include "UnxFilePicker.hxx" +#include "FPServiceInfo.hxx" + +using namespace ::rtl; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::registry; +using namespace ::cppu; +using ::com::sun::star::ui::dialogs::XFilePicker; + +////////////////////////////////////////////////////////////////////////// +// +////////////////////////////////////////////////////////////////////////// + +static Reference< XInterface > SAL_CALL createInstance( const Reference< XMultiServiceFactory >& rServiceManager ) +{ + return Reference< XInterface >( + static_cast< XFilePicker* >( new UnxFilePicker( rServiceManager ) ) ); +} + +////////////////////////////////////////////////////////////////////////// +// the three uno functions that will be exported +////////////////////////////////////////////////////////////////////////// + +extern "C" +{ + +////////////////////////////////////////////////////////////////////////// +// component_getImplementationEnvironment +////////////////////////////////////////////////////////////////////////// + +void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ ) +{ + *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; +} + +////////////////////////////////////////////////////////////////////////// +// +////////////////////////////////////////////////////////////////////////// + +sal_Bool SAL_CALL component_writeInfo( void* /*pServiceManager*/, void* pRegistryKey ) +{ + sal_Bool bRetVal = sal_True; + + if ( pRegistryKey ) + { + try + { + Reference< XRegistryKey > pXNewKey( static_cast< XRegistryKey* >( pRegistryKey ) ); + pXNewKey->createKey( OUString(RTL_CONSTASCII_USTRINGPARAM( FILE_PICKER_REGKEY_NAME ) )); + } + catch( InvalidRegistryException& ) + { + OSL_FAIL( "InvalidRegistryException caught" ); + bRetVal = sal_False; + } + } + + return bRetVal; +} + +////////////////////////////////////////////////////////////////////////// +// +////////////////////////////////////////////////////////////////////////// + +void* SAL_CALL component_getFactory( const sal_Char* pImplName, uno_Interface* pSrvManager, uno_Interface* /*pRegistryKey*/ ) +{ + void* pRet = 0; + + if ( pSrvManager && ( 0 == rtl_str_compare( pImplName, FILE_PICKER_IMPL_NAME ) ) ) + { + Sequence< OUString > aSNS( 1 ); + aSNS.getArray( )[0] = OUString(RTL_CONSTASCII_USTRINGPARAM( FILE_PICKER_SERVICE_NAME )); + + Reference< XSingleServiceFactory > xFactory ( createSingleFactory( + reinterpret_cast< XMultiServiceFactory* > ( pSrvManager ), + OUString::createFromAscii( pImplName ), + createInstance, + aSNS ) ); + if ( xFactory.is() ) + { + xFactory->acquire(); + pRet = xFactory.get(); + } + } + + return pRet; +} + +} // extern "C" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/unx/kde_unx/UnxFilePicker.cxx b/fpicker/source/unx/kde_unx/UnxFilePicker.cxx new file mode 100644 index 000000000000..c2756ee716c4 --- /dev/null +++ b/fpicker/source/unx/kde_unx/UnxFilePicker.cxx @@ -0,0 +1,937 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * Copyright 2010 Novell, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <com/sun/star/lang/DisposedException.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/ui/dialogs/TemplateDescription.hpp> +#include <com/sun/star/ui/dialogs/CommonFilePickerElementIds.hpp> +#include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp> +#include <com/sun/star/ui/dialogs/ControlActions.hpp> + +#include <FPServiceInfo.hxx> + +#include <cppuhelper/interfacecontainer.h> +#include <osl/diagnose.h> +#include <osl/file.hxx> +#include <rtl/ustring.hxx> +#include <rtl/ustrbuf.hxx> +#include <rtl/bootstrap.hxx> +#include <tools/resmgr.hxx> + +#include <svtools/svtools.hrc> +#include <UnxFilePicker.hxx> +#include <UnxCommandThread.hxx> +#include <UnxNotifyThread.hxx> + +#include <vcl/svapp.hxx> +#include <vcl/sysdata.hxx> +#include <vcl/syswin.hxx> +#include <vcl/window.hxx> + +#include <sys/wait.h> +#include <unistd.h> +#include <fcntl.h> +#include <stdio.h> + +#include <iostream> + +using namespace ::com::sun::star; + +using namespace ::com::sun::star::ui::dialogs; +using namespace ::com::sun::star::ui::dialogs::TemplateDescription; + +////////////////////////////////////////////////////////////////////////// +// helper functions +////////////////////////////////////////////////////////////////////////// + +namespace +{ + // controling event notifications + const bool STARTUP_SUSPENDED = true; + const bool STARTUP_ALIVE = false; + + uno::Sequence<rtl::OUString> SAL_CALL FilePicker_getSupportedServiceNames() + { + uno::Sequence<rtl::OUString> aRet(3); + aRet[0] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ui.dialogs.FilePicker")); + aRet[1] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ui.dialogs.SystemFilePicker")); + aRet[2] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ui.dialogs.KDEFilePicker")); + return aRet; + } +} + +////////////////////////////////////////////////////////////////////////// +// UnxFilePicker +////////////////////////////////////////////////////////////////////////// + +UnxFilePicker::UnxFilePicker( const uno::Reference<lang::XMultiServiceFactory>& xServiceMgr ) + : cppu::WeakComponentImplHelper8< + XFilterManager, + XFilterGroupManager, + XFilePickerControlAccess, + XFilePickerNotifier, +// TODO XFilePreview, + lang::XInitialization, + util::XCancellable, + lang::XEventListener, + lang::XServiceInfo>( m_rbHelperMtx ), + m_xServiceMgr( xServiceMgr ), + m_nFilePickerPid( -1 ), + m_nFilePickerWrite( -1 ), + m_nFilePickerRead( -1 ), + m_pNotifyThread( NULL ), + m_pCommandThread( NULL ), + m_pResMgr( CREATEVERSIONRESMGR( fps_office ) ) +{ +} + +UnxFilePicker::~UnxFilePicker() +{ + if ( m_nFilePickerPid > 0 ) + { + sendCommand( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "exit" )) ); + waitpid( m_nFilePickerPid, NULL, 0 ); + } + + if ( m_pCommandThread ) + { + m_pCommandThread->join(); + + delete m_pCommandThread, m_pCommandThread = NULL; + } + + if ( m_pNotifyThread ) + { + m_pNotifyThread->exit(); + + m_pNotifyThread->join(); + + delete m_pNotifyThread, m_pNotifyThread = NULL; + } + + if ( m_nFilePickerWrite >= 0 ) + close( m_nFilePickerWrite ); + + if ( m_nFilePickerRead >= 0 ) + close( m_nFilePickerRead ); + + delete m_pResMgr, m_pResMgr = NULL; +} + +void SAL_CALL UnxFilePicker::addFilePickerListener( const uno::Reference<XFilePickerListener>& xListener ) + throw( uno::RuntimeException ) +{ + OSL_ASSERT( m_pNotifyThread ); + osl::MutexGuard aGuard( m_aMutex ); + + m_pNotifyThread->addFilePickerListener( xListener ); +} + +void SAL_CALL UnxFilePicker::removeFilePickerListener( const uno::Reference<XFilePickerListener>& xListener ) + throw( uno::RuntimeException ) +{ + OSL_ASSERT( m_pNotifyThread ); + osl::MutexGuard aGuard( m_aMutex ); + + m_pNotifyThread->removeFilePickerListener( xListener ); +} + +void SAL_CALL UnxFilePicker::setTitle( const rtl::OUString &rTitle ) + throw( uno::RuntimeException ) +{ + checkFilePicker(); + ::osl::MutexGuard aGuard( m_aMutex ); + + ::rtl::OUStringBuffer aBuffer( 1024 ); + + aBuffer.appendAscii( "setTitle " ); + appendEscaped( aBuffer, rTitle ); + + sendCommand( aBuffer.makeStringAndClear() ); +} + +sal_Int16 SAL_CALL UnxFilePicker::execute() + throw( uno::RuntimeException ) +{ + checkFilePicker(); + + // this is _not_ an osl::Condition, see i#93366 + m_pCommandThread->execCondition().reset(); + + sendCommand( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "exec" ) )); + + m_pCommandThread->execCondition().wait(); + + return m_pCommandThread->result(); +} + +void SAL_CALL UnxFilePicker::setMultiSelectionMode( sal_Bool bMode ) + throw( uno::RuntimeException ) +{ + checkFilePicker(); + ::osl::MutexGuard aGuard( m_aMutex ); + + ::rtl::OUString aString = bMode? + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "setMultiSelection true" )): + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "setMultiSelection false" )); + + sendCommand( aString ); +} + +void SAL_CALL UnxFilePicker::setDefaultName( const ::rtl::OUString &rName ) + throw( uno::RuntimeException ) +{ + checkFilePicker(); + ::osl::MutexGuard aGuard( m_aMutex ); + + ::rtl::OUStringBuffer aBuffer( 1024 ); + + aBuffer.appendAscii( "setDefaultName " ); + appendEscaped( aBuffer, rName ); + + sendCommand( aBuffer.makeStringAndClear() ); +} + +void SAL_CALL UnxFilePicker::setDisplayDirectory( const rtl::OUString &rDirectory ) + throw( uno::RuntimeException ) +{ + checkFilePicker(); + ::osl::MutexGuard aGuard( m_aMutex ); + + ::rtl::OUStringBuffer aBuffer( 1024 ); + + aBuffer.appendAscii( "setDirectory " ); + appendEscaped( aBuffer, rDirectory ); + + sendCommand( aBuffer.makeStringAndClear() ); +} + +rtl::OUString SAL_CALL UnxFilePicker::getDisplayDirectory() + throw( uno::RuntimeException ) +{ + checkFilePicker(); + ::osl::MutexGuard aGuard( m_aMutex ); + + sendCommand( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "getDirectory" )), + m_pCommandThread->getDirectoryCondition() ); + + return m_pCommandThread->getDirectory(); +} + +uno::Sequence< ::rtl::OUString > SAL_CALL UnxFilePicker::getFiles() + throw( uno::RuntimeException ) +{ + checkFilePicker(); + ::osl::MutexGuard aGuard( m_aMutex ); + + sendCommand( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "getFiles" )), + m_pCommandThread->getFilesCondition() ); + + return m_pCommandThread->getFiles(); +} + +void SAL_CALL UnxFilePicker::appendFilter( const ::rtl::OUString &rTitle, const ::rtl::OUString &rFilter ) + throw( lang::IllegalArgumentException, uno::RuntimeException ) +{ + checkFilePicker(); + ::osl::MutexGuard aGuard( m_aMutex ); + + ::rtl::OUStringBuffer aBuffer( 1024 ); + + aBuffer.appendAscii( "appendFilter " ); + appendEscaped( aBuffer, rTitle ); + aBuffer.appendAscii( " ", 1 ); + appendEscaped( aBuffer, rFilter ); + + sendCommand( aBuffer.makeStringAndClear() ); +} + +void SAL_CALL UnxFilePicker::setCurrentFilter( const rtl::OUString &rTitle ) + throw( lang::IllegalArgumentException, uno::RuntimeException ) +{ + checkFilePicker(); + ::osl::MutexGuard aGuard( m_aMutex ); + + ::rtl::OUStringBuffer aBuffer( 1024 ); + + aBuffer.appendAscii( "setCurrentFilter " ); + appendEscaped( aBuffer, rTitle ); + + sendCommand( aBuffer.makeStringAndClear() ); +} + +rtl::OUString SAL_CALL UnxFilePicker::getCurrentFilter() + throw( uno::RuntimeException ) +{ + checkFilePicker(); + ::osl::MutexGuard aGuard( m_aMutex ); + + sendCommand( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "getCurrentFilter" )), + m_pCommandThread->getCurrentFilterCondition() ); + + return m_pCommandThread->getCurrentFilter(); +} + +void SAL_CALL UnxFilePicker::appendFilterGroup( const rtl::OUString &rGroupTitle, const uno::Sequence<beans::StringPair> &rFilters ) + throw( lang::IllegalArgumentException, uno::RuntimeException ) +{ + checkFilePicker(); + ::osl::MutexGuard aGuard( m_aMutex ); + + ::rtl::OUStringBuffer aBuffer( 1024 ); + + aBuffer.appendAscii( "appendFilterGroup " ); + appendEscaped( aBuffer, rGroupTitle ); + + for ( sal_Int32 i = 0; i < rFilters.getLength(); ++i ) + { + beans::StringPair aPair = rFilters[i]; + + aBuffer.appendAscii( " ", 1 ); + appendEscaped( aBuffer, aPair.First ); + aBuffer.appendAscii( " ", 1 ); + appendEscaped( aBuffer, aPair.Second ); + } + + sendCommand( aBuffer.makeStringAndClear() ); +} + +void SAL_CALL UnxFilePicker::setValue( sal_Int16 nControlId, sal_Int16 nControlAction, const uno::Any &rValue ) + throw( uno::RuntimeException ) +{ + checkFilePicker(); + ::osl::MutexGuard aGuard( m_aMutex ); + + ::rtl::OUString aType; + ::rtl::OUString aAction; + sal_Int32 nTitleId; + + if ( controlIdInfo( nControlId, aType, nTitleId ) && controlActionInfo( nControlAction, aAction ) ) + { + ::rtl::OUStringBuffer aBuffer( 1024 ); + + aBuffer.appendAscii( "setValue " ); + aBuffer.append( static_cast< sal_Int32 >( nControlId ) ); + aBuffer.appendAscii( " ", 1 ); + aBuffer.append( aAction ); + + if ( aType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "checkbox" ) ) ) + { + sal_Bool bControlValue; + if ( ( rValue >>= bControlValue ) && bControlValue ) + aBuffer.appendAscii( " true" ); + else + aBuffer.appendAscii( " false" ); + } + else if ( aType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "listbox" ) ) ) + { + switch ( nControlAction ) + { + case ControlActions::ADD_ITEM: + case ControlActions::SET_HELP_URL: + { + ::rtl::OUString aString; + if ( rValue >>= aString ) + { + aBuffer.appendAscii( " ", 1 ); + appendEscaped( aBuffer, aString ); + } + } + break; + + case ControlActions::ADD_ITEMS: + { + uno::Sequence< ::rtl::OUString > aSequence; + if ( rValue >>= aSequence ) + { + for ( sal_Int32 nIdx = 0; nIdx < aSequence.getLength(); ++nIdx ) + { + aBuffer.appendAscii( " ", 1 ); + appendEscaped( aBuffer, aSequence[nIdx] ); + } + + } + } + break; + + case ControlActions::DELETE_ITEM: + case ControlActions::SET_SELECT_ITEM: + { + sal_Int32 nInt; + if ( rValue >>= nInt ) + { + aBuffer.appendAscii( " ", 1 ); + aBuffer.append( nInt ); + } + } + break; + + default: + // nothing + break; + } + } + // TODO else if push button... + + sendCommand( aBuffer.makeStringAndClear() ); + } +} + +uno::Any SAL_CALL UnxFilePicker::getValue( sal_Int16 nControlId, sal_Int16 nControlAction ) + throw( uno::RuntimeException ) +{ + checkFilePicker(); + ::osl::MutexGuard aGuard( m_aMutex ); + + ::rtl::OUString aAction; + + if ( controlActionInfo( nControlAction, aAction ) ) + { + ::rtl::OUStringBuffer aBuffer( 1024 ); + + aBuffer.appendAscii( "getValue " ); + aBuffer.append( static_cast< sal_Int32 >( nControlId ) ); + aBuffer.appendAscii( " ", 1 ); + aBuffer.append( aAction ); + + sendCommand( aBuffer.makeStringAndClear(), + m_pCommandThread->getValueCondition() ); + + return m_pCommandThread->getValue(); + } + + return uno::Any(); +} + +void SAL_CALL UnxFilePicker::enableControl( sal_Int16 nControlId, sal_Bool bEnable ) + throw( uno::RuntimeException ) +{ + checkFilePicker(); + ::osl::MutexGuard aGuard( m_aMutex ); + + ::rtl::OUStringBuffer aBuffer( 1024 ); + + aBuffer.appendAscii( "enableControl " ); + aBuffer.append( static_cast< sal_Int32 >( nControlId ) ); + aBuffer.appendAscii( bEnable? " true": " false" ); + + sendCommand( aBuffer.makeStringAndClear() ); +} + +void SAL_CALL UnxFilePicker::setLabel( sal_Int16 nControlId, const ::rtl::OUString &rLabel ) + throw( uno::RuntimeException ) +{ + checkFilePicker(); + ::osl::MutexGuard aGuard( m_aMutex ); + + ::rtl::OUStringBuffer aBuffer( 1024 ); + + aBuffer.appendAscii( "setLabel " ); + aBuffer.append( static_cast< sal_Int32 >( nControlId ) ); + aBuffer.appendAscii( " ", 1 ); + appendEscaped( aBuffer, rLabel ); + + sendCommand( aBuffer.makeStringAndClear() ); +} + +rtl::OUString SAL_CALL UnxFilePicker::getLabel(sal_Int16 /*nControlId*/) + throw ( uno::RuntimeException ) +{ + // FIXME getLabel() is not yet implemented + checkFilePicker(); + ::osl::MutexGuard aGuard( m_aMutex ); + + // TODO return m_pImpl->getLabel(nControlId); + return ::rtl::OUString(); +} + +/* TODO +uno::Sequence<sal_Int16> SAL_CALL UnxFilePicker::getSupportedImageFormats() + throw( uno::RuntimeException ) +{ + checkFilePicker(); + ::osl::MutexGuard aGuard( m_aMutex ); + + return m_pImpl->getSupportedImageFormats(); +} + +sal_Int32 SAL_CALL UnxFilePicker::getTargetColorDepth() + throw( uno::RuntimeException ) +{ + checkFilePicker(); + ::osl::MutexGuard aGuard( m_aMutex ); + + return m_pImpl->getTargetColorDepth(); +} + +sal_Int32 SAL_CALL UnxFilePicker::getAvailableWidth() + throw( uno::RuntimeException ) +{ + checkFilePicker(); + ::osl::MutexGuard aGuard( m_aMutex ); + + return m_pImpl->getAvailableWidth(); +} + +sal_Int32 SAL_CALL UnxFilePicker::getAvailableHeight() + throw( uno::RuntimeException ) +{ + checkFilePicker(); + ::osl::MutexGuard aGuard( m_aMutex ); + + return m_pImpl->getAvailableHeight(); +} + +void SAL_CALL UnxFilePicker::setImage( sal_Int16 aImageFormat, const uno::Any &rImage ) + throw( lang::IllegalArgumentException, uno::RuntimeException ) +{ + checkFilePicker(); + ::osl::MutexGuard aGuard( m_aMutex ); + + m_pImpl->setImage( aImageFormat, aImage ); +} + +sal_Bool SAL_CALL UnxFilePicker::setShowState( sal_Bool bShowState ) + throw( uno::RuntimeException ) +{ + checkFilePicker(); + ::osl::MutexGuard aGuard( m_aMutex ); + + return m_pImpl->setShowState( bShowState ); +} + +sal_Bool SAL_CALL UnxFilePicker::getShowState() + throw( uno::RuntimeException ) +{ + checkFilePicker(); + ::osl::MutexGuard aGuard( m_aMutex ); + + return m_pImpl->getShowState(); +} +*/ + +void SAL_CALL UnxFilePicker::initialize( const uno::Sequence<uno::Any> &rArguments ) + throw( uno::Exception, uno::RuntimeException ) +{ + initFilePicker(); + + // parameter checking + uno::Any aAny; + if ( 0 == rArguments.getLength( ) ) + throw lang::IllegalArgumentException( + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "no arguments" )), + static_cast< XFilePicker* >( this ), 1 ); + + aAny = rArguments[0]; + + if ( ( aAny.getValueType() != ::getCppuType( (sal_Int16*)0 ) ) && ( aAny.getValueType() != ::getCppuType( (sal_Int8*)0 ) ) ) + throw lang::IllegalArgumentException( + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "invalid argument type" )), + static_cast< XFilePicker* >( this ), 1 ); + + sal_Int16 templateId = -1; + aAny >>= templateId; + + ::rtl::OUString aTypeOpen(RTL_CONSTASCII_USTRINGPARAM( "setType \"open\"" )); + ::rtl::OUString aTypeSaveAs(RTL_CONSTASCII_USTRINGPARAM( "setType \"save\"" )); + + switch ( templateId ) + { + case FILEOPEN_SIMPLE: + sendCommand( aTypeOpen ); + break; + + case FILESAVE_SIMPLE: + sendCommand( aTypeSaveAs ); + break; + + case FILESAVE_AUTOEXTENSION_PASSWORD: + sendCommand( aTypeSaveAs ); + + sendAppendControlCommand( ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION ); + sendAppendControlCommand( ExtendedFilePickerElementIds::CHECKBOX_PASSWORD ); + break; + + case FILESAVE_AUTOEXTENSION_PASSWORD_FILTEROPTIONS: + sendCommand( aTypeSaveAs ); + + sendAppendControlCommand( ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION ); + sendAppendControlCommand( ExtendedFilePickerElementIds::CHECKBOX_PASSWORD ); + sendAppendControlCommand( ExtendedFilePickerElementIds::CHECKBOX_FILTEROPTIONS ); + break; + + case FILESAVE_AUTOEXTENSION_SELECTION: + sendCommand( aTypeSaveAs ); + + sendAppendControlCommand( ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION ); + sendAppendControlCommand( ExtendedFilePickerElementIds::CHECKBOX_SELECTION ); + break; + + case FILESAVE_AUTOEXTENSION_TEMPLATE: + sendCommand( aTypeSaveAs ); + + sendAppendControlCommand( ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION ); + sendAppendControlCommand( ExtendedFilePickerElementIds::LISTBOX_TEMPLATE ); + break; + + case FILEOPEN_LINK_PREVIEW_IMAGE_TEMPLATE: + sendCommand( aTypeOpen ); + + sendAppendControlCommand( ExtendedFilePickerElementIds::CHECKBOX_LINK ); + sendAppendControlCommand( ExtendedFilePickerElementIds::CHECKBOX_PREVIEW ); + sendAppendControlCommand( ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE ); + break; + + case FILEOPEN_PLAY: + sendCommand( aTypeOpen ); + + sendAppendControlCommand( ExtendedFilePickerElementIds::PUSHBUTTON_PLAY ); + break; + + case FILEOPEN_READONLY_VERSION: + sendCommand( aTypeOpen ); + + sendAppendControlCommand( ExtendedFilePickerElementIds::CHECKBOX_READONLY ); + sendAppendControlCommand( ExtendedFilePickerElementIds::LISTBOX_VERSION ); + break; + + case FILEOPEN_LINK_PREVIEW: + sendCommand( aTypeOpen ); + + sendAppendControlCommand( ExtendedFilePickerElementIds::CHECKBOX_LINK ); + sendAppendControlCommand( ExtendedFilePickerElementIds::CHECKBOX_PREVIEW ); + break; + + case FILESAVE_AUTOEXTENSION: + sendCommand( aTypeSaveAs ); + + sendAppendControlCommand( ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION ); + break; + + default: + throw lang::IllegalArgumentException( + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Unknown template" )), + static_cast< XFilePicker* >( this ), + 1 ); + } +} + +void SAL_CALL UnxFilePicker::cancel() + throw ( uno::RuntimeException ) +{ + // FIXME cancel() is not implemented + checkFilePicker(); + ::osl::MutexGuard aGuard( m_aMutex ); + + // TODO m_pImpl->cancel(); +} + +void SAL_CALL UnxFilePicker::disposing( const lang::EventObject &rEvent ) + throw( uno::RuntimeException ) +{ + uno::Reference<XFilePickerListener> xFilePickerListener( rEvent.Source, uno::UNO_QUERY ); + + if ( xFilePickerListener.is() ) + removeFilePickerListener( xFilePickerListener ); +} + +rtl::OUString SAL_CALL UnxFilePicker::getImplementationName() + throw( uno::RuntimeException ) +{ + return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( FILE_PICKER_IMPL_NAME )); +} + +sal_Bool SAL_CALL UnxFilePicker::supportsService( const rtl::OUString& ServiceName ) + throw( uno::RuntimeException ) +{ + uno::Sequence< ::rtl::OUString > SupportedServicesNames = FilePicker_getSupportedServiceNames(); + + for ( sal_Int32 n = SupportedServicesNames.getLength(); n--; ) + { + if ( SupportedServicesNames[n].compareTo( ServiceName ) == 0 ) + return sal_True; + } + + return sal_False; +} + +uno::Sequence< ::rtl::OUString > SAL_CALL UnxFilePicker::getSupportedServiceNames() + throw( uno::RuntimeException ) +{ + return FilePicker_getSupportedServiceNames(); +} + +void UnxFilePicker::initFilePicker() +{ + int aFiledesStdin[2], aFiledesStdout[2]; + if ( pipe( aFiledesStdin ) < 0 || pipe( aFiledesStdout ) < 0 ) + return; + + m_nFilePickerPid = fork(); + if ( m_nFilePickerPid < 0 ) + return; + + if ( m_nFilePickerPid == 0 ) + { + // Child... + close( aFiledesStdin[1] ); // write end of the pipe + dup2( aFiledesStdin[0], 0 ); + close( aFiledesStdin[0] ); + + close( aFiledesStdout[0] ); // read end of the pipe + dup2( aFiledesStdout[1], 1 ); + close( aFiledesStdout[1] ); + +#if OSL_DEBUG_LEVEL == 0 + int nRedirect = open( "/dev/null", O_WRONLY ); + if( nRedirect != -1 ) + { + dup2( nRedirect, 2 ); + } +#endif + + // The executable name + rtl::OUString helperurl( RTL_CONSTASCII_USTRINGPARAM("${ORIGIN}/kdefilepicker")); + rtl::Bootstrap::expandMacros( helperurl ); + rtl::OUString helperpath; + osl::FileBase::getSystemPathFromFileURL( helperurl, helperpath ); + rtl::OString helper( rtl::OUStringToOString( helperpath, osl_getThreadTextEncoding())); + + // ID of the main window + const int nIdLen = 20; + char pWinId[nIdLen] = "0"; + + // TODO pass here the real parent (not possible for system dialogs + // yet), and default to GetDefDialogParent() only when the real parent + // is NULL + Window *pParentWin = Application::GetDefDialogParent(); + if ( pParentWin ) + { + const SystemEnvData* pSysData = ((SystemWindow *)pParentWin)->GetSystemData(); + if ( pSysData ) + { + snprintf( pWinId, nIdLen, "%ld", pSysData->aWindow ); // unx only + pWinId[nIdLen-1] = 0; + } + } + + // Execute the fpicker implementation + execlp( helper.getStr(), helper.getStr(), "--winid", pWinId, NULL ); + + // Error, finish the child + exit( -1 ); + } + + // Parent continues + close( aFiledesStdin[0] ); + m_nFilePickerWrite = aFiledesStdin[1]; + + close( aFiledesStdout[1] ); + m_nFilePickerRead = aFiledesStdout[0]; + + // Create the notify thread + if ( !m_pNotifyThread ) + m_pNotifyThread = new UnxFilePickerNotifyThread( this ); + + // Create the command thread + if ( !m_pCommandThread ) + m_pCommandThread = new UnxFilePickerCommandThread( m_pNotifyThread, m_nFilePickerRead ); + + // Start the threads + m_pNotifyThread->create(); + m_pCommandThread->create(); + + return; +} + +void UnxFilePicker::checkFilePicker() throw( ::com::sun::star::uno::RuntimeException ) +{ + if ( m_nFilePickerPid > 0 ) + { + // TODO check if external file picker is runnning + } + else + { + throw uno::RuntimeException( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "the external file picker does not run" )), + *this ); + } +} + +void UnxFilePicker::sendCommand( const ::rtl::OUString &rCommand ) +{ + if ( m_nFilePickerWrite < 0 ) + return; + + ::rtl::OString aUtfString = OUStringToOString( rCommand + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "\n" )), RTL_TEXTENCODING_UTF8 ); + +#if OSL_DEBUG_LEVEL > 0 + ::std::cerr << "UnxFilePicker sent: \"" << aUtfString.getStr() << "\"" << ::std::endl; +#endif + + write( m_nFilePickerWrite, aUtfString.getStr(), aUtfString.getLength() ); +} + +void UnxFilePicker::sendCommand( const ::rtl::OUString &rCommand, ::osl::Condition &rCondition ) +{ + rCondition.reset(); + + sendCommand( rCommand ); + + rCondition.wait(); +} + +void UnxFilePicker::appendEscaped( ::rtl::OUStringBuffer &rBuffer, const ::rtl::OUString &rString ) +{ + const sal_Unicode *pUnicode = rString.getStr(); + const sal_Unicode *pEnd = pUnicode + rString.getLength(); + + rBuffer.appendAscii( "\"" , 1 ); + + for ( ; pUnicode != pEnd; ++pUnicode ) + { + if ( *pUnicode == '\\' ) + rBuffer.appendAscii( "\\\\", 2 ); + else if ( *pUnicode == '"' ) + rBuffer.appendAscii( "\\\"", 2 ); + else if ( *pUnicode == '\n' ) + rBuffer.appendAscii( "\\n", 2 ); + else + rBuffer.append( *pUnicode ); + } + + rBuffer.appendAscii( "\"", 1 ); +} + +sal_Bool UnxFilePicker::controlIdInfo( sal_Int16 nControlId, ::rtl::OUString &rType, sal_Int32 &rTitleId ) +{ + typedef struct { + sal_Int16 nId; + const ::rtl::OUString *pType; + sal_Int32 nTitle; + } ElementToName; + + const ::rtl::OUString aCheckBox( RTL_CONSTASCII_USTRINGPARAM( "checkbox" ) ); + const ::rtl::OUString aControl( RTL_CONSTASCII_USTRINGPARAM( "control" ) ); + const ::rtl::OUString aEdit( RTL_CONSTASCII_USTRINGPARAM( "edit" ) ); + const ::rtl::OUString aLabel( RTL_CONSTASCII_USTRINGPARAM( "label" ) ); + const ::rtl::OUString aListBox( RTL_CONSTASCII_USTRINGPARAM( "listbox" ) ); + const ::rtl::OUString aPushButton( RTL_CONSTASCII_USTRINGPARAM( "pushbutton" ) ); + + const ElementToName *pPtr; + const ElementToName pArray[] = + { + { CommonFilePickerElementIds::PUSHBUTTON_OK, &aPushButton, 0/*FIXME?*/ }, + { CommonFilePickerElementIds::PUSHBUTTON_CANCEL, &aPushButton, 0/*FIXME?*/ }, + { CommonFilePickerElementIds::LISTBOX_FILTER, &aListBox, 0/*FIXME?*/ }, + { CommonFilePickerElementIds::CONTROL_FILEVIEW, &aControl, 0/*FIXME?*/ }, + { CommonFilePickerElementIds::EDIT_FILEURL, &aEdit, 0/*FIXME?*/ }, + { CommonFilePickerElementIds::LISTBOX_FILTER_LABEL, &aLabel, 0/*FIXME?*/ }, + { CommonFilePickerElementIds::EDIT_FILEURL_LABEL, &aLabel, 0/*FIXME?*/ }, + + { ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION, &aCheckBox, STR_SVT_FILEPICKER_AUTO_EXTENSION }, + { ExtendedFilePickerElementIds::CHECKBOX_PASSWORD, &aCheckBox, STR_SVT_FILEPICKER_PASSWORD }, + { ExtendedFilePickerElementIds::CHECKBOX_FILTEROPTIONS, &aCheckBox, STR_SVT_FILEPICKER_FILTER_OPTIONS }, + { ExtendedFilePickerElementIds::CHECKBOX_READONLY, &aCheckBox, STR_SVT_FILEPICKER_READONLY }, + { ExtendedFilePickerElementIds::CHECKBOX_LINK, &aCheckBox, STR_SVT_FILEPICKER_INSERT_AS_LINK }, + { ExtendedFilePickerElementIds::CHECKBOX_PREVIEW, &aCheckBox, STR_SVT_FILEPICKER_SHOW_PREVIEW }, + { ExtendedFilePickerElementIds::PUSHBUTTON_PLAY, &aPushButton, STR_SVT_FILEPICKER_PLAY }, + { ExtendedFilePickerElementIds::LISTBOX_VERSION, &aListBox, STR_SVT_FILEPICKER_VERSION }, + { ExtendedFilePickerElementIds::LISTBOX_TEMPLATE, &aListBox, STR_SVT_FILEPICKER_TEMPLATES }, + { ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE, &aListBox, STR_SVT_FILEPICKER_IMAGE_TEMPLATE }, + { ExtendedFilePickerElementIds::CHECKBOX_SELECTION, &aCheckBox, STR_SVT_FILEPICKER_SELECTION }, + { 0, 0, 0 } + }; + + for ( pPtr = pArray; pPtr->nId && ( pPtr->nId != nControlId ); ++pPtr ) + ; + + if ( pPtr->nId == nControlId ) + { + rType = *(pPtr->pType); + rTitleId = pPtr->nTitle; + + return sal_True; + } + + return sal_False; +} + +sal_Bool UnxFilePicker::controlActionInfo( sal_Int16 nControlAction, ::rtl::OUString &rType ) +{ + typedef struct { + sal_Int16 nId; + const ::rtl::OUString pType; + } ElementToName; + + const ElementToName *pPtr; + const ElementToName pArray[] = + { + { ControlActions::ADD_ITEM, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "addItem" ) ) }, + { ControlActions::ADD_ITEMS, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "addItems" ) ) }, + { ControlActions::DELETE_ITEM, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "deleteItem" ) ) }, + { ControlActions::DELETE_ITEMS, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "deleteItems" ) ) }, + { ControlActions::SET_SELECT_ITEM, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "setSelectedItem" ) ) }, + { ControlActions::GET_ITEMS, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "getItems" ) ) }, + { ControlActions::GET_SELECTED_ITEM, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "getSelectedItem" ) ) }, + { ControlActions::GET_SELECTED_ITEM_INDEX, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "getSelectedItemIndex" ) ) }, + { ControlActions::SET_HELP_URL, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "setHelpURL" ) ) }, + { ControlActions::GET_HELP_URL, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "getHelpURL" ) ) }, + { 0, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "noAction" ) ) } + }; + + for ( pPtr = pArray; pPtr->nId && ( pPtr->nId != nControlAction ); ++pPtr ) + ; + + rType = pPtr->pType; + + return sal_True; +} + +void UnxFilePicker::sendAppendControlCommand( sal_Int16 nControlId ) +{ + ::rtl::OUString aType; + sal_Int32 nTitleId; + + if ( controlIdInfo( nControlId, aType, nTitleId ) ) + { + ::rtl::OUStringBuffer aBuffer( 1024 ); + + aBuffer.appendAscii( "appendControl " ); + aBuffer.append( static_cast< sal_Int32 >( nControlId ) ); + aBuffer.appendAscii( " ", 1 ); + appendEscaped( aBuffer, aType ); + aBuffer.appendAscii( " ", 1 ); + appendEscaped( aBuffer, m_pResMgr? String( ResId( nTitleId, *m_pResMgr ) ): String() ); + + sendCommand( aBuffer.makeStringAndClear() ); + } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/unx/kde_unx/UnxFilePicker.hxx b/fpicker/source/unx/kde_unx/UnxFilePicker.hxx new file mode 100644 index 000000000000..d2a065486d17 --- /dev/null +++ b/fpicker/source/unx/kde_unx/UnxFilePicker.hxx @@ -0,0 +1,181 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * Copyright 2010 Novell, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _UNXFILEPICKER_HXX_ +#define _UNXFILEPICKER_HXX_ + +#include <cppuhelper/compbase8.hxx> +#include <osl/conditn.hxx> +#include <osl/mutex.hxx> +#include <rtl/ustrbuf.hxx> + +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/ui/dialogs/XFilePickerNotifier.hpp> +#include <com/sun/star/ui/dialogs/XFilterManager.hpp> +#include <com/sun/star/ui/dialogs/XFilterGroupManager.hpp> +#include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp> +#include <com/sun/star/ui/dialogs/XFilePreview.hpp> +#include <com/sun/star/util/XCancellable.hpp> + +#include <list> + +class UnxFilePickerCommandThread; +class UnxFilePickerNotifyThread; +class ResMgr; + +class UnxFilePickerDummy +{ +protected: + osl::Mutex m_aMutex; + osl::Mutex m_rbHelperMtx; +}; + +class UnxFilePicker : + public UnxFilePickerDummy, + public cppu::WeakComponentImplHelper8< + ::com::sun::star::ui::dialogs::XFilterManager, + ::com::sun::star::ui::dialogs::XFilterGroupManager, + ::com::sun::star::ui::dialogs::XFilePickerControlAccess, + ::com::sun::star::ui::dialogs::XFilePickerNotifier, +// TODO ::com::sun::star::ui::dialogs::XFilePreview, + ::com::sun::star::lang::XInitialization, + ::com::sun::star::util::XCancellable, + ::com::sun::star::lang::XEventListener, + ::com::sun::star::lang::XServiceInfo > +{ +protected: + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceMgr; // to instanciate own services + + pid_t m_nFilePickerPid; + int m_nFilePickerWrite; // (kde|...)filepicker gets it as stdin + int m_nFilePickerRead; // (kde|...)filepicker gets it as stdout + + UnxFilePickerNotifyThread *m_pNotifyThread; + UnxFilePickerCommandThread *m_pCommandThread; + + ResMgr *m_pResMgr; + +public: + UnxFilePicker( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceMgr ); + virtual ~UnxFilePicker(); + + // XComponent + + using cppu::WeakComponentImplHelperBase::disposing; + + // XFilePickerNotifier + + virtual void SAL_CALL addFilePickerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XFilePickerListener >& xListener ) throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL removeFilePickerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XFilePickerListener >& xListener ) throw( ::com::sun::star::uno::RuntimeException ); + + // XExecutableDialog functions + + virtual void SAL_CALL setTitle( const ::rtl::OUString &rTitle ) throw( ::com::sun::star::uno::RuntimeException ); + virtual sal_Int16 SAL_CALL execute() throw( ::com::sun::star::uno::RuntimeException ); + + // XFilePicker functions + + virtual void SAL_CALL setMultiSelectionMode( sal_Bool bMode ) throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL setDefaultName( const ::rtl::OUString &rName ) throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL setDisplayDirectory( const ::rtl::OUString &rDirectory ) throw( ::com::sun::star::uno::RuntimeException ); + virtual ::rtl::OUString SAL_CALL getDisplayDirectory() throw( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getFiles() throw( ::com::sun::star::uno::RuntimeException ); + + // XFilterManager functions + + virtual void SAL_CALL appendFilter( const ::rtl::OUString &rTitle, const ::rtl::OUString &rFilter ) throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL setCurrentFilter( const ::rtl::OUString &rTitle ) throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException ); + virtual ::rtl::OUString SAL_CALL getCurrentFilter() throw( ::com::sun::star::uno::RuntimeException ); + + // XFilterGroupManager functions + + virtual void SAL_CALL appendFilterGroup( const ::rtl::OUString &rGroupTitle, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::StringPair > &rFilters ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + + // XFilePickerControlAccess functions + + virtual void SAL_CALL setValue( sal_Int16 nControlId, sal_Int16 nControlAction, const ::com::sun::star::uno::Any &rValue ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getValue( sal_Int16 nControlId, sal_Int16 nControlAction ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL enableControl( sal_Int16 nControlId, sal_Bool bEnable ) throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL setLabel( sal_Int16 nControlId, const ::rtl::OUString &rLabel ) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getLabel( sal_Int16 nControlId ) throw (::com::sun::star::uno::RuntimeException); + + /* TODO XFilePreview + + virtual ::com::sun::star::uno::Sequence< sal_Int16 > SAL_CALL getSupportedImageFormats( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getTargetColorDepth( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getAvailableWidth( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getAvailableHeight( ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setImage( sal_Int16 aImageFormat, const ::com::sun::star::uno::Any &rImage ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL setShowState( sal_Bool bShowState ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL getShowState( ) throw (::com::sun::star::uno::RuntimeException); + */ + + // XInitialization + + virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > &rArguments ) throw( ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException ); + + // XCancellable + + virtual void SAL_CALL cancel( ) throw( ::com::sun::star::uno::RuntimeException ); + + // XEventListener + + virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject &rEvent ) throw( ::com::sun::star::uno::RuntimeException ); + + // XServiceInfo + + virtual ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException ); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString &rServiceName ) throw( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException ); + +private: + // prevent copy and assignment + UnxFilePicker( const UnxFilePicker& ); + UnxFilePicker& operator=( const UnxFilePicker& ); + +protected: + void initFilePicker(); + void checkFilePicker() throw( ::com::sun::star::uno::RuntimeException ); + + // Async sendCommand + void sendCommand( const ::rtl::OUString &rCommand ); + // Synchronized sendCommand + void sendCommand( const ::rtl::OUString &rCommand, ::osl::Condition &rCondition ); + void appendEscaped( ::rtl::OUStringBuffer &rBuffer, const ::rtl::OUString &rString ); + +private: + sal_Bool controlIdInfo( sal_Int16 nControlId, ::rtl::OUString &rType, sal_Int32 &rTitleId ); + sal_Bool controlActionInfo( sal_Int16 nControlId, ::rtl::OUString &rType ); + void sendAppendControlCommand( sal_Int16 nControlId ); +}; + +#endif // _UNXFILEPICKER_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/unx/kde_unx/UnxNotifyThread.cxx b/fpicker/source/unx/kde_unx/UnxNotifyThread.cxx new file mode 100644 index 000000000000..a97fdfc24fae --- /dev/null +++ b/fpicker/source/unx/kde_unx/UnxNotifyThread.cxx @@ -0,0 +1,115 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * Copyright 2010 Novell, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <UnxNotifyThread.hxx> +#include <UnxFilePicker.hxx> + +using namespace ::com::sun::star; + +////////////////////////////////////////////////////////////////////////// +// UnxFilePickerNotifyThread +////////////////////////////////////////////////////////////////////////// + +UnxFilePickerNotifyThread::UnxFilePickerNotifyThread( UnxFilePicker *pUnxFilePicker ) + : m_pUnxFilePicker( pUnxFilePicker ), + m_bExit( sal_False ), + m_eNotifyType( Nothing ), + m_nControlId( 0 ) +{ +} + +void SAL_CALL UnxFilePickerNotifyThread::addFilePickerListener( const uno::Reference< ui::dialogs::XFilePickerListener >& xListener ) + throw( uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + m_xListener = xListener; +} + +void SAL_CALL UnxFilePickerNotifyThread::removeFilePickerListener( const uno::Reference< ui::dialogs::XFilePickerListener >& /*xListener*/ ) + throw( uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + m_xListener.clear(); +} + +void SAL_CALL UnxFilePickerNotifyThread::exit() +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + m_bExit = sal_True; + + m_aExitCondition.reset(); + m_aNotifyCondition.set(); + + m_aExitCondition.wait(); +} + +void SAL_CALL UnxFilePickerNotifyThread::fileSelectionChanged() +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + m_eNotifyType = FileSelectionChanged; + m_nControlId = 0; + + m_aNotifyCondition.set(); +} + +void SAL_CALL UnxFilePickerNotifyThread::run() +{ + do { + m_aNotifyCondition.reset(); + m_aNotifyCondition.wait(); + + if ( m_xListener.is() && m_pUnxFilePicker ) + { + ::osl::MutexGuard aGuard( m_aMutex ); + + ui::dialogs::FilePickerEvent aEvent( *m_pUnxFilePicker, m_nControlId ); + + switch ( m_eNotifyType ) + { + case FileSelectionChanged: + m_xListener->fileSelectionChanged( aEvent ); + break; + + // TODO More to come... + + default: + // nothing + break; + } + } + } while ( !m_bExit ); + + m_aExitCondition.set(); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/unx/kde_unx/UnxNotifyThread.hxx b/fpicker/source/unx/kde_unx/UnxNotifyThread.hxx new file mode 100644 index 000000000000..b60d7b475871 --- /dev/null +++ b/fpicker/source/unx/kde_unx/UnxNotifyThread.hxx @@ -0,0 +1,89 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * Copyright 2010 Novell, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _UNXNOTIFYTHREAD_HXX_ +#define _UNXNOTIFYTHREAD_HXX_ + +#include <com/sun/star/ui/dialogs/XFilePickerListener.hpp> +#include <com/sun/star/uno/Reference.hxx> + +#include <osl/conditn.hxx> +#include <osl/mutex.hxx> +#include <osl/thread.hxx> + +class UnxFilePicker; + +class UnxFilePickerNotifyThread : public ::osl::Thread +{ +protected: + enum NotifyType + { + Nothing = 0, + FileSelectionChanged + // TODO More to come... + }; + + UnxFilePicker *m_pUnxFilePicker; + + ::osl::Mutex m_aMutex; + + ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XFilePickerListener > m_xListener; + + sal_Bool m_bExit; + ::osl::Condition m_aExitCondition; + + NotifyType m_eNotifyType; + ::osl::Condition m_aNotifyCondition; + sal_Int16 m_nControlId; + +public: + UnxFilePickerNotifyThread( UnxFilePicker *pUnxFilePicker ); + + virtual void SAL_CALL addFilePickerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XFilePickerListener >& xListener ) + throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL removeFilePickerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XFilePickerListener >& xListener ) + throw( ::com::sun::star::uno::RuntimeException ); + + void SAL_CALL exit(); + + void SAL_CALL fileSelectionChanged(); + /* TODO + void SAL_CALL directoryChanged( ::com::sun::star::ui::dialogs::FilePickerEvent aEvent ); + rtl::OUString SAL_CALL helpRequested( ::com::sun::star::ui::dialogs::FilePickerEvent aEvent ) const; + void SAL_CALL controlStateChanged( ::com::sun::star::ui::dialogs::FilePickerEvent aEvent ); + void SAL_CALL dialogSizeChanged( ); + */ + +protected: + virtual void SAL_CALL run(); +}; + +#endif // _UNXNOTIFYTHREAD_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/unx/kde_unx/fps-kde-ucd.txt b/fpicker/source/unx/kde_unx/fps-kde-ucd.txt new file mode 100644 index 000000000000..28aa49d97bea --- /dev/null +++ b/fpicker/source/unx/kde_unx/fps-kde-ucd.txt @@ -0,0 +1,6 @@ +[ComponentDescriptor] +ImplementationName=com.sun.star.ui.dialogs.UnxFilePicker +ComponentName=fps_kde.uno.so +LoaderName=com.sun.star.loader.SharedLibrary +[SupportedServices] +com.sun.star.ui.dialogs.KDEFilePicker diff --git a/fpicker/source/unx/kde_unx/fps_kde.xml b/fpicker/source/unx/kde_unx/fps_kde.xml new file mode 100644 index 000000000000..99683bfecacf --- /dev/null +++ b/fpicker/source/unx/kde_unx/fps_kde.xml @@ -0,0 +1,51 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE module-description PUBLIC "-//StarOffice//DTD ComponentDescription 1.0//EN" "module-description.dtd"> +<module-description xmlns:xlink="http://www.w3.org/1999/xlink"> + <module-name>fps_kde</module-name> + <component-description> + <author> Jan Holesovsky </author> + <name> com.sun.star.comp.ui.dialogs.FilePicker </name> + <description> + The KDE implementation of the FilePicker service. + </description> + <loader-name>com.sun.star.loader.SharedLibrary</loader-name> + <language> c++ </language> + <status value="beta"/> + <supported-service> com.sun.star.ui.dialogs.FilePicker </supported-service> + <service-dependency>...</service-dependency> + <type> com.sun.star.ui.dialogs.XExecutableDialog </type> + <type> com.sun.star.ui.dialogs.XFilePicker </type> + <type> com.sun.star.ui.dialogs.XFilterManager </type> + <type> com.sun.star.ui.dialogs.XFilterGroupManager </type> + <type> com.sun.star.ui.dialogs.XFilePickerListener </type> + <type> com.sun.star.ui.dialogs.ExecutableDialogException </type> + <type> com.sun.star.ui.dialogs.XFilePickerNotifier </type> + <type> com.sun.star.ui.dialogs.XFilePickerControlAccess </type> + <type> com.sun.star.ui.dialogs.XFilePreview </type> + <type> com.sun.star.ui.dialogs.ExtendedFilePickerElementIds </type> + <type> com.sun.star.ui.dialogs.ExecutableDialogResults </type> + <type> com.sun.star.ui.dialogs.FilePickerEvent </type> + <type> com.sun.star.ui.dialogs.CommonFilePickerElementIds </type> + <type> com.sun.star.ui.dialogs.ListboxControlActions </type> + <type> com.sun.star.ui.dialogs.TemplateDescription </type> + <type> com.sun.star.ui.dialogs.FilePreviewImageFormats </type> + <type> com.sun.star.util.XCancellable </type> + <type> com.sun.star.lang.XComponent </type> + <type> com.sun.star.lang.XMultiServiceFactory </type> + <type> com.sun.star.lang.XSingleServiceFactory </type> + <type> com.sun.star.lang.XServiceInfo </type> + <type> com.sun.star.lang.XTypeProvider </type> + <type> com.sun.star.lang.IllegalArgumentException </type> + <type> com.sun.star.uno.TypeClass </type> + <type> com.sun.star.uno.XWeak </type> + <type> com.sun.star.uno.XAggregation </type> + <type> com.sun.star.registry.XRegistryKey </type> + <type> com.sun.star.container.XSet </type> + </component-description> + <project-build-dependency> cppuhelper </project-build-dependency> + <project-build-dependency> cppu </project-build-dependency> + <project-build-dependency> sal </project-build-dependency> + <runtime-module-dependency> cppuhelper </runtime-module-dependency> + <runtime-module-dependency> cppu2 </runtime-module-dependency> + <runtime-module-dependency> sal2 </runtime-module-dependency> +</module-description> diff --git a/fpicker/source/unx/kde_unx/makefile.mk b/fpicker/source/unx/kde_unx/makefile.mk new file mode 100644 index 000000000000..067399bf0837 --- /dev/null +++ b/fpicker/source/unx/kde_unx/makefile.mk @@ -0,0 +1,77 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# Copyright 2010 Novell, Inc. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/..$/.. + +PRJNAME=fpicker +TARGET=fps_kde.uno +LIBTARGET=NO +ENABLE_EXCEPTIONS=TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk +DLLPRE= + +# ------------------------------------------------------------------ + +# Currently just KDE is supported... +.IF "$(GUIBASE)" != "unx" || "$(ENABLE_KDE)" != "TRUE" + +dummy: + @echo "Nothing to build. GUIBASE == $(GUIBASE), ENABLE_KDE is not set" + +.ELSE # we build for KDE + +# --- Files -------------------------------------------------------- + +SLOFILES =\ + $(SLO)$/UnxCommandThread.obj \ + $(SLO)$/UnxFilePicker.obj \ + $(SLO)$/UnxNotifyThread.obj \ + $(SLO)$/UnxFPentry.obj + +SHL1NOCHECK=TRUE +SHL1TARGET=fps_kde.uno +SHL1STDLIBS=$(CPPULIB)\ + $(CPPUHELPERLIB)\ + $(SALLIB)\ + $(VCLLIB)\ + $(TOOLSLIB) + +SHL1OBJS=$(SLOFILES) +SHL1DEF=$(MISC)$/$(SHL1TARGET).def + +DEF1NAME=$(SHL1TARGET) +DEF1VERSIONMAP=$(SOLARENV)/src/component.map + +.ENDIF # "$(GUIBASE)" != "unx" || "$(ENABLE_KDE)" != "TRUE" + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk diff --git a/fpicker/source/win32/filepicker/FPServiceInfo.hxx b/fpicker/source/win32/filepicker/FPServiceInfo.hxx index 046d2298fe13..33a27f683494 100644 --- a/fpicker/source/win32/filepicker/FPServiceInfo.hxx +++ b/fpicker/source/win32/filepicker/FPServiceInfo.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -75,3 +76,5 @@ #define FILE_PICKER_REGKEY_NAME "/com.sun.star.ui.dialogs.Win32FilePicker/UNO/SERVICES/com.sun.star.ui.dialogs.SystemFilePicker" #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/filepicker/FPentry.cxx b/fpicker/source/win32/filepicker/FPentry.cxx index 79a2cf3b2865..beaa3088ff46 100644 --- a/fpicker/source/win32/filepicker/FPentry.cxx +++ b/fpicker/source/win32/filepicker/FPentry.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -112,7 +113,7 @@ void* SAL_CALL component_getFactory( if ( pSrvManager && ( 0 == rtl_str_compare( pImplName, FILE_PICKER_IMPL_NAME ) ) ) { Sequence< OUString > aSNS( 1 ); - aSNS.getArray( )[0] = OUString::createFromAscii( FILE_PICKER_SERVICE_NAME ); + aSNS.getArray( )[0] = OUString(RTL_CONSTASCII_USTRINGPARAM( FILE_PICKER_SERVICE_NAME )); Reference< XSingleServiceFactory > xFactory ( createSingleFactory( reinterpret_cast< XMultiServiceFactory* > ( pSrvManager ), @@ -130,3 +131,5 @@ void* SAL_CALL component_getFactory( } } // extern "C" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/filepicker/FileOpenDlg.cxx b/fpicker/source/win32/filepicker/FileOpenDlg.cxx index 73a757058e28..ab1f396ad34e 100644 --- a/fpicker/source/win32/filepicker/FileOpenDlg.cxx +++ b/fpicker/source/win32/filepicker/FileOpenDlg.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -25,6 +26,8 @@ * ************************************************************************/ +#define _WIN32_WINNT 0x0500 + // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_fpicker.hxx" @@ -557,8 +560,8 @@ void SAL_CALL CFileOpenDialog::handleInitDialog(HWND hwndDlg, HWND hwndChild) // //------------------------------------------------------------------------ -unsigned int CALLBACK CFileOpenDialog::ofnHookProc( - HWND hChildDlg, unsigned int uiMsg, WPARAM wParam, LPARAM lParam) +UINT_PTR CALLBACK CFileOpenDialog::ofnHookProc( + HWND hChildDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam) { HWND hwndDlg = GetParent(hChildDlg); CFileOpenDialog* pImpl = NULL; @@ -574,10 +577,10 @@ unsigned int CALLBACK CFileOpenDialog::ofnHookProc( // subclass the base dialog for WM_NCDESTROY processing pImpl->m_pfnBaseDlgProc = reinterpret_cast<WNDPROC>( - SetWindowLong( + SetWindowLongPtr( hwndDlg, - GWL_WNDPROC, - reinterpret_cast<LONG>(CFileOpenDialog::BaseDlgProc))); + GWLP_WNDPROC, + reinterpret_cast<LONG_PTR>(CFileOpenDialog::BaseDlgProc))); // connect the instance handle to the window SetProp(hwndDlg, CURRENT_INSTANCE, pImpl); pImpl->handleInitDialog(hwndDlg, hChildDlg); @@ -618,8 +621,8 @@ LRESULT CALLBACK CFileOpenDialog::BaseDlgProc( pImpl = reinterpret_cast<CFileOpenDialog*>( RemoveProp(hWnd,CURRENT_INSTANCE)); - SetWindowLong(hWnd, GWL_WNDPROC, - reinterpret_cast<LONG>(pImpl->m_pfnBaseDlgProc)); + SetWindowLongPtr(hWnd, GWLP_WNDPROC, + reinterpret_cast<LONG_PTR>(pImpl->m_pfnBaseDlgProc)); } else { @@ -693,3 +696,5 @@ void SAL_CALL CFileOpenDialog::centerPositionToParent() const NULL, x, y, 0, 0, SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOSIZE ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/filepicker/FileOpenDlg.hxx b/fpicker/source/win32/filepicker/FileOpenDlg.hxx index f1d8753dcf43..4f2a7250ac5f 100644 --- a/fpicker/source/win32/filepicker/FileOpenDlg.hxx +++ b/fpicker/source/win32/filepicker/FileOpenDlg.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -34,9 +35,7 @@ #include <sal/types.h> -#ifndef _RTL_USTRING_HXX_ -#include <rtl/ustring> -#endif +#include <rtl/ustring.hxx> #include <rtl/ustrbuf.hxx> #include "platform_xp.h" @@ -213,10 +212,10 @@ public: // the method returns: // 0 - when the dialog was canceled by the user // 1 - when the dialog was closed with ok - // -1 - when an error occured + // -1 - when an error occurred sal_Int16 SAL_CALL doModal(); - // returns the last dialog error that occured + // returns the last dialog error that occurred sal_uInt32 SAL_CALL getLastDialogError() const; // retrievs the currently selected file @@ -304,9 +303,9 @@ private: WNDPROC m_pfnBaseDlgProc; // callback function - static unsigned int CALLBACK ofnHookProc( + static UINT_PTR CALLBACK ofnHookProc( HWND hChildDlg, // handle to child dialog box - unsigned int uiMsg, // message identifier + UINT uiMsg, // message identifier WPARAM wParam, // message parameter LPARAM lParam // message parameter ); @@ -325,3 +324,5 @@ private: }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/filepicker/FilePicker.cxx b/fpicker/source/win32/filepicker/FilePicker.cxx index a3191ce77580..360061978bae 100644 --- a/fpicker/source/win32/filepicker/FilePicker.cxx +++ b/fpicker/source/win32/filepicker/FilePicker.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -37,9 +38,7 @@ #include <cppuhelper/interfacecontainer.h> #include <osl/diagnose.h> -#ifndef _FILEPICKER_HXX_ #include "filepicker.hxx" -#endif #include "WinFileOpenImpl.hxx" #include "FPServiceInfo.hxx" @@ -77,8 +76,8 @@ namespace uno::Sequence<rtl::OUString> SAL_CALL FilePicker_getSupportedServiceNames() { uno::Sequence<rtl::OUString> aRet(2); - aRet[0] = rtl::OUString::createFromAscii("com.sun.star.ui.dialogs.FilePicker"); - aRet[1] = rtl::OUString::createFromAscii("com.sun.star.ui.dialogs.SystemFilePicker"); + aRet[0] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ui.dialogs.FilePicker")); + aRet[1] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ui.dialogs.SystemFilePicker")); return aRet; } } @@ -124,7 +123,7 @@ void SAL_CALL CFilePicker::addFilePickerListener(const uno::Reference<XFilePicke { if ( rBHelper.bDisposed ) throw lang::DisposedException( - rtl::OUString::createFromAscii( "object is already disposed" ), + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "object is already disposed" )), static_cast< XFilePicker2* >( this ) ); if ( !rBHelper.bInDispose && !rBHelper.bDisposed ) @@ -140,7 +139,7 @@ void SAL_CALL CFilePicker::removeFilePickerListener(const uno::Reference<XFilePi { if ( rBHelper.bDisposed ) throw lang::DisposedException( - rtl::OUString::createFromAscii( "object is already disposed" ), + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "object is already disposed" )), static_cast< XFilePicker2* >( this ) ); rBHelper.aLC.removeInterface( getCppuType( &xListener ), xListener ); @@ -239,7 +238,7 @@ rtl::OUString SAL_CALL CFilePicker::helpRequested(FilePickerEvent aEvent) const } catch(uno::RuntimeException&) { - OSL_ENSURE( false, "RuntimeException during event dispatching" ); + OSL_FAIL( "RuntimeException during event dispatching" ); } } } @@ -460,10 +459,10 @@ sal_Int16 SAL_CALL CFilePicker::execute() throw(uno::RuntimeException) } else { - OSL_ENSURE(sal_False, "Could not start event notifier thread!"); + OSL_FAIL("Could not start event notifier thread!"); throw uno::RuntimeException( - rtl::OUString::createFromAscii("Error executing dialog"), + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Error executing dialog")), static_cast<XFilePicker2*>(this)); } @@ -631,7 +630,7 @@ void SAL_CALL CFilePicker::initialize(const uno::Sequence<uno::Any>& aArguments) uno::Any aAny; if ( 0 == aArguments.getLength( ) ) throw lang::IllegalArgumentException( - rtl::OUString::createFromAscii( "no arguments" ), + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "no arguments" )), static_cast<XFilePicker2*>(this), 1); aAny = aArguments[0]; @@ -639,7 +638,7 @@ void SAL_CALL CFilePicker::initialize(const uno::Sequence<uno::Any>& aArguments) if ( (aAny.getValueType() != ::getCppuType((sal_Int16*)0)) && (aAny.getValueType() != ::getCppuType((sal_Int8*)0)) ) throw lang::IllegalArgumentException( - rtl::OUString::createFromAscii("invalid argument type"), + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("invalid argument type")), static_cast<XFilePicker2*>(this), 1); sal_Int16 templateId = -1; @@ -729,7 +728,7 @@ void SAL_CALL CFilePicker::initialize(const uno::Sequence<uno::Any>& aArguments) default: throw lang::IllegalArgumentException( - rtl::OUString::createFromAscii( "Unknown template" ), + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Unknown template" )), static_cast< XFilePicker2* >( this ), 1 ); } @@ -769,7 +768,7 @@ void SAL_CALL CFilePicker::cancel() rtl::OUString SAL_CALL CFilePicker::getImplementationName() throw(uno::RuntimeException) { - return rtl::OUString::createFromAscii(FILE_PICKER_IMPL_NAME); + return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(FILE_PICKER_IMPL_NAME)); } // ------------------------------------------------- @@ -797,3 +796,5 @@ uno::Sequence<rtl::OUString> SAL_CALL CFilePicker::getSupportedServiceNames() { return FilePicker_getSupportedServiceNames(); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/filepicker/FilePicker.hxx b/fpicker/source/win32/filepicker/FilePicker.hxx index 39dcf5246802..cb9722198fb6 100644 --- a/fpicker/source/win32/filepicker/FilePicker.hxx +++ b/fpicker/source/win32/filepicker/FilePicker.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -253,3 +254,5 @@ private: }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/filepicker/FilterContainer.cxx b/fpicker/source/win32/filepicker/FilterContainer.cxx index a54f796e23ac..f61ad675548a 100644 --- a/fpicker/source/win32/filepicker/FilterContainer.cxx +++ b/fpicker/source/win32/filepicker/FilterContainer.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -144,7 +145,7 @@ sal_Bool SAL_CALL CFilterContainer::getFilter( const OUString& aName, OUString& } catch( std::out_of_range& ) { - OSL_ENSURE( sal_False, "Filter not in filter container" ); + OSL_FAIL( "Filter not in filter container" ); pos = -1; } @@ -165,7 +166,7 @@ sal_Bool SAL_CALL CFilterContainer::getFilter( sal_Int32 aIndex, OUString& theFi } catch( std::out_of_range& ) { - OSL_ENSURE( sal_False, "Filter index out of range" ); + OSL_FAIL( "Filter index out of range" ); bRet = sal_False; } @@ -335,3 +336,4 @@ rtl::OUString SAL_CALL makeWinFilterBuffer( CFilterContainer& aFilterContainer ) return winFilterBuff; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/filepicker/FilterContainer.hxx b/fpicker/source/win32/filepicker/FilterContainer.hxx index 79b354e6a96d..91ee54571418 100644 --- a/fpicker/source/win32/filepicker/FilterContainer.hxx +++ b/fpicker/source/win32/filepicker/FilterContainer.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -113,3 +114,5 @@ private: rtl::OUString SAL_CALL makeWinFilterBuffer( CFilterContainer& aFilterContainer ); #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/filepicker/IVistaFilePickerInternalNotify.hxx b/fpicker/source/win32/filepicker/IVistaFilePickerInternalNotify.hxx index d47c21c40cb2..2414a6ff1229 100644 --- a/fpicker/source/win32/filepicker/IVistaFilePickerInternalNotify.hxx +++ b/fpicker/source/win32/filepicker/IVistaFilePickerInternalNotify.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -75,3 +76,5 @@ class IVistaFilePickerInternalNotify #undef css #endif FPICKER_WIN32_VISTA_FILEPICKER_INTERNALNOTIFY_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/filepicker/PreviewCtrl.cxx b/fpicker/source/win32/filepicker/PreviewCtrl.cxx index e387d672fd41..93704c00d94c 100644 --- a/fpicker/source/win32/filepicker/PreviewCtrl.cxx +++ b/fpicker/source/win32/filepicker/PreviewCtrl.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -225,12 +226,12 @@ CFilePreview* CFilePreview::createInstance( catch( CPreviewException& ) { OSL_ASSERT( !s_FilePreviewInst ); - OSL_ENSURE( sal_False, "Creation of the preview window failed" ); + OSL_FAIL( "Creation of the preview window failed" ); } catch( CAutoOleInit::COleInitException& ) { OSL_ASSERT( !s_FilePreviewInst ); - OSL_ENSURE( sal_False, "OleInitalize failed" ); + OSL_FAIL( "OleInitalize failed" ); } } @@ -418,7 +419,7 @@ sal_Bool SAL_CALL CFilePreview::show( sal_Bool bShow ) // if the preview is shown and enabled // preview of the given file will be shown // returns true on success or false if an error -// occured (the file in not there or not accessible etc.) +// occurred (the file in not there or not accessible etc.) //--------------------------------------------------- sal_Bool SAL_CALL CFilePreview::update( const rtl::OUString& aFileName ) @@ -613,3 +614,4 @@ LRESULT CALLBACK CFilePreview::WndProc( +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/filepicker/PreviewCtrl.hxx b/fpicker/source/win32/filepicker/PreviewCtrl.hxx index 3e91acab4c56..ac11e39e35d9 100644 --- a/fpicker/source/win32/filepicker/PreviewCtrl.hxx +++ b/fpicker/source/win32/filepicker/PreviewCtrl.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -151,7 +152,7 @@ public: // if the preview is shown and enabled // preview of the given file will be shown // returns true on success or false if an error - // occured (the file in not there or not accessible etc.) + // occurred (the file in not there or not accessible etc.) virtual sal_Bool SAL_CALL update( const rtl::OUString& aFileName ); protected: @@ -197,3 +198,5 @@ private: #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/filepicker/SolarMutex.cxx b/fpicker/source/win32/filepicker/SolarMutex.cxx index 71c1bda7cea7..b11d35a16aaf 100644 --- a/fpicker/source/win32/filepicker/SolarMutex.cxx +++ b/fpicker/source/win32/filepicker/SolarMutex.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -29,18 +30,18 @@ #include "precompiled_fpicker.hxx" #include <vcl/svapp.hxx> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <osl/thread.hxx> int ReleaseSolarMutexOnMainThreadContext(unsigned nThreadId) { int nAcquireCount = 0; - vos::IMutex& rSolarMutex = Application::GetSolarMutex(); - vos::OThread::TThreadIdentifier nMainThreadId = Application::GetMainThreadIdentifier(); + osl::SolarMutex& rSolarMutex = Application::GetSolarMutex(); + oslThreadIdentifier nMainThreadId = Application::GetMainThreadIdentifier(); if ( nMainThreadId == nThreadId ) { - ::vos::IMutex& rMutex = Application::GetSolarMutex(); + ::osl::SolarMutex& rMutex = Application::GetSolarMutex(); if ( rMutex.tryToAcquire() ) nAcquireCount = Application::ReleaseSolarMutex() - 1; } @@ -53,3 +54,5 @@ void AcquireSolarMutex(int nAcquireCount) if ( nAcquireCount ) Application::AcquireSolarMutex( nAcquireCount ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/filepicker/SolarMutex.hxx b/fpicker/source/win32/filepicker/SolarMutex.hxx index b5897d8ea1bb..d9c73ba6fe02 100644 --- a/fpicker/source/win32/filepicker/SolarMutex.hxx +++ b/fpicker/source/win32/filepicker/SolarMutex.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,3 +29,5 @@ int ReleaseSolarMutexOnMainThreadContext(unsigned nThreadId); void AcquireSolarMutex(int nAcquireCount); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/filepicker/VistaFilePicker.cxx b/fpicker/source/win32/filepicker/VistaFilePicker.cxx index f150120e132f..edb40f2e099b 100644 --- a/fpicker/source/win32/filepicker/VistaFilePicker.cxx +++ b/fpicker/source/win32/filepicker/VistaFilePicker.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -91,8 +92,8 @@ namespace css::uno::Sequence< ::rtl::OUString > SAL_CALL VistaFilePicker_getSupportedServiceNames() { css::uno::Sequence< ::rtl::OUString > aRet(2); - aRet[0] = ::rtl::OUString::createFromAscii("com.sun.star.ui.dialogs.FilePicker"); - aRet[1] = ::rtl::OUString::createFromAscii("com.sun.star.ui.dialogs.SystemFilePicker"); + aRet[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ui.dialogs.FilePicker")); + aRet[1] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ui.dialogs.SystemFilePicker")); return aRet; } } @@ -549,17 +550,9 @@ void SAL_CALL VistaFilePicker::initialize(const css::uno::Sequence< css::uno::An throw(css::uno::Exception , css::uno::RuntimeException) { - /* - // called twice ? - if (m_pDlg) - throw css::uno::Exception( - ::rtl::OUString::createFromAscii( "XInitialization::initialize() called twice." ), - static_cast< css::ui::dialogs::XFilePicker* >( this )); - */ - if (lArguments.getLength() < 1) throw css::lang::IllegalArgumentException( - ::rtl::OUString::createFromAscii( "XInitialization::initialize() called without arguments." ), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "XInitialization::initialize() called without arguments." )), static_cast< css::ui::dialogs::XFilePicker2* >( this ), 1); @@ -689,7 +682,7 @@ void SAL_CALL VistaFilePicker::cancel() ::rtl::OUString SAL_CALL VistaFilePicker::getImplementationName() throw(css::uno::RuntimeException) { - return ::rtl::OUString::createFromAscii("com.sun.star.comp.fpicker.VistaFileDialog"); + return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.fpicker.VistaFileDialog")); } // ------------------------------------------------- @@ -721,3 +714,5 @@ css::uno::Sequence< ::rtl::OUString > SAL_CALL VistaFilePicker::getSupportedServ } // namespace vista } // namespace win32 } // namespace fpicker + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/filepicker/VistaFilePicker.hxx b/fpicker/source/win32/filepicker/VistaFilePicker.hxx index 2b690c220c18..1a46ca0e1504 100644 --- a/fpicker/source/win32/filepicker/VistaFilePicker.hxx +++ b/fpicker/source/win32/filepicker/VistaFilePicker.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -313,3 +314,5 @@ public: #undef css #endif // FPICKER_WIN32_VISTA_FILEPICKER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/filepicker/VistaFilePickerEventHandler.cxx b/fpicker/source/win32/filepicker/VistaFilePickerEventHandler.cxx index f399c55de694..a0aa8ad0b8cf 100644 --- a/fpicker/source/win32/filepicker/VistaFilePickerEventHandler.cxx +++ b/fpicker/source/win32/filepicker/VistaFilePickerEventHandler.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,10 +29,6 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_fpicker.hxx" -//------------------------------------------------------------------------ -// includes -//------------------------------------------------------------------------ - #include "VistaFilePickerEventHandler.hxx" #include "asyncrequests.hxx" @@ -44,8 +41,6 @@ #include <comphelper/processfactory.hxx> #include <comphelper/storagehelper.hxx> -//#include <tools/urlobj.hxx> -//#include <unotools/ucbhelper.hxx> #include <osl/file.hxx> @@ -169,7 +164,7 @@ STDMETHODIMP VistaFilePickerEventHandler::OnFolderChange(IFileDialog* /*pDialog* //----------------------------------------------------------------------------------------- void lcl_updateVersionListDirectly(IFileDialog* pDialog) { - static const ::rtl::OUString SERVICENAME_REVISIONPERSISTENCE = ::rtl::OUString::createFromAscii("com.sun.star.document.DocumentRevisionListPersistence"); + static const ::rtl::OUString SERVICENAME_REVISIONPERSISTENCE(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.DocumentRevisionListPersistence")); static const ::sal_Int16 CONTROL_VERSIONLIST = css::ui::dialogs::ExtendedFilePickerElementIds::LISTBOX_VERSION; TFileDialog iDialog (pDialog); @@ -370,8 +365,8 @@ void VistaFilePickerEventHandler::stopListening() } } -static const ::rtl::OUString PROP_CONTROL_ID = ::rtl::OUString::createFromAscii("control_id"); -static const ::rtl::OUString PROP_PICKER_LISTENER = ::rtl::OUString::createFromAscii("picker_listener"); +static const ::rtl::OUString PROP_CONTROL_ID(RTL_CONSTASCII_USTRINGPARAM("control_id")); +static const ::rtl::OUString PROP_PICKER_LISTENER(RTL_CONSTASCII_USTRINGPARAM("picker_listener")); //----------------------------------------------------------------------------------------- class AsyncPickerEvents : public RequestHandler @@ -465,3 +460,5 @@ void VistaFilePickerEventHandler::impl_sendEvent( EEventType eEventType, } // namespace vista } // namespace win32 } // namespace fpicker + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/filepicker/VistaFilePickerEventHandler.hxx b/fpicker/source/win32/filepicker/VistaFilePickerEventHandler.hxx index 4b9434d8c6c2..85eed3ca39e0 100644 --- a/fpicker/source/win32/filepicker/VistaFilePickerEventHandler.hxx +++ b/fpicker/source/win32/filepicker/VistaFilePickerEventHandler.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -223,3 +224,5 @@ class VistaFilePickerEventHandler : public ::cppu::BaseMutex #undef css #endif // FPICKER_WIN32_VISTA_FILEPICKER_EVENTHANDLER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx b/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx index 97afa038fcab..6cc0d522b920 100644 --- a/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx +++ b/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -1261,3 +1262,5 @@ bool VistaFilePickerImpl::onFileTypeChanged( UINT /*nTypeIndex*/ ) } // namespace vista } // namespace win32 } // namespace fpicker + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/filepicker/VistaFilePickerImpl.hxx b/fpicker/source/win32/filepicker/VistaFilePickerImpl.hxx index 201ed9f1764d..14bf9fd8bfe0 100644 --- a/fpicker/source/win32/filepicker/VistaFilePickerImpl.hxx +++ b/fpicker/source/win32/filepicker/VistaFilePickerImpl.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -92,26 +93,26 @@ static const ::sal_Int32 FEATURE_PLAY = 256; static const ::sal_Int32 FEATURE_READONLY = 512; static const ::sal_Int32 FEATURE_VERSION = 1024; -static const ::rtl::OUString PROP_PICKER_LISTENER = ::rtl::OUString::createFromAscii("picker_listener" ); // [XFilePickerListenert] -static const ::rtl::OUString PROP_DIALOG_SHOW_RESULT = ::rtl::OUString::createFromAscii("dialog_show_result" ); // [sal_Bool] true=OK, false=CANCEL -static const ::rtl::OUString PROP_SELECTED_FILES = ::rtl::OUString::createFromAscii("selected_files" ); // [seq< OUString >] contains all user selected files (can be empty!) -static const ::rtl::OUString PROP_MULTISELECTION_MODE = ::rtl::OUString::createFromAscii("multiselection_mode"); // [sal_Bool] true=ON, false=OFF -static const ::rtl::OUString PROP_TITLE = ::rtl::OUString::createFromAscii("title" ); // [OUString] -static const ::rtl::OUString PROP_FILENAME = ::rtl::OUString::createFromAscii("filename" ); // [OUString] -static const ::rtl::OUString PROP_DIRECTORY = ::rtl::OUString::createFromAscii("directory" ); // [OUString] -static const ::rtl::OUString PROP_FEATURES = ::rtl::OUString::createFromAscii("features" ); // [sal_Int32] -static const ::rtl::OUString PROP_TEMPLATE_DESCR = ::rtl::OUString::createFromAscii("templatedescription"); // [sal_Int32] -static const ::rtl::OUString PROP_FILTER_TITLE = ::rtl::OUString::createFromAscii("filter_title" ); // [OUString] -static const ::rtl::OUString PROP_FILTER_VALUE = ::rtl::OUString::createFromAscii("filter_value" ); // [OUString] -static const ::rtl::OUString PROP_FORCE = ::rtl::OUString::createFromAscii("force" ); // [sal_Bool] -static const ::rtl::OUString PROP_FILTER_GROUP = ::rtl::OUString::createFromAscii("filter_group" ); // [seq< css:beans::StringPair >] contains a group of filters - -static const ::rtl::OUString PROP_CONTROL_ID = ::rtl::OUString::createFromAscii("control_id" ); // [sal_Int16] -static const ::rtl::OUString PROP_CONTROL_ACTION = ::rtl::OUString::createFromAscii("control_action" ); // [sal_Int16] -static const ::rtl::OUString PROP_CONTROL_VALUE = ::rtl::OUString::createFromAscii("control_value" ); // [Any] -static const ::rtl::OUString PROP_CONTROL_LABEL = ::rtl::OUString::createFromAscii("control_label" ); // [OUString] -static const ::rtl::OUString PROP_CONTROL_ENABLE = ::rtl::OUString::createFromAscii("control_enable" ); // [sal_Bool] true=ON, false=OFF -static const ::rtl::OUString STRING_SEPARATOR = ::rtl::OUString::createFromAscii("------------------------------------------" ); +static const ::rtl::OUString PROP_PICKER_LISTENER(RTL_CONSTASCII_USTRINGPARAM("picker_listener" ) ); // [XFilePickerListenert] +static const ::rtl::OUString PROP_DIALOG_SHOW_RESULT(RTL_CONSTASCII_USTRINGPARAM("dialog_show_result" )); // [sal_Bool] true=OK, false=CANCEL +static const ::rtl::OUString PROP_SELECTED_FILES(RTL_CONSTASCII_USTRINGPARAM("selected_files" )); // [seq< OUString >] contains all user selected files (can be empty!) +static const ::rtl::OUString PROP_MULTISELECTION_MODE(RTL_CONSTASCII_USTRINGPARAM("multiselection_mode")); // [sal_Bool] true=ON, false=OFF +static const ::rtl::OUString PROP_TITLE(RTL_CONSTASCII_USTRINGPARAM("title" )); // [OUString] +static const ::rtl::OUString PROP_FILENAME(RTL_CONSTASCII_USTRINGPARAM("filename" ) ); // [OUString] +static const ::rtl::OUString PROP_DIRECTORY(RTL_CONSTASCII_USTRINGPARAM("directory" )); // [OUString] +static const ::rtl::OUString PROP_FEATURES(RTL_CONSTASCII_USTRINGPARAM("features" )); // [sal_Int32] +static const ::rtl::OUString PROP_TEMPLATE_DESCR(RTL_CONSTASCII_USTRINGPARAM("templatedescription")); // [sal_Int32] +static const ::rtl::OUString PROP_FILTER_TITLE(RTL_CONSTASCII_USTRINGPARAM("filter_title" )); // [OUString] +static const ::rtl::OUString PROP_FILTER_VALUE(RTL_CONSTASCII_USTRINGPARAM("filter_value" )); // [OUString] +static const ::rtl::OUString PROP_FORCE(RTL_CONSTASCII_USTRINGPARAM("force" )); // [sal_Bool] +static const ::rtl::OUString PROP_FILTER_GROUP(RTL_CONSTASCII_USTRINGPARAM("filter-group" )); // [seq< css:beans::StringPair >] contains a group of filters + +static const ::rtl::OUString PROP_CONTROL_ID(RTL_CONSTASCII_USTRINGPARAM("control_id" )); // [sal_Int16] +static const ::rtl::OUString PROP_CONTROL_ACTION(RTL_CONSTASCII_USTRINGPARAM("control_action" )); // [sal_Int16] +static const ::rtl::OUString PROP_CONTROL_VALUE(RTL_CONSTASCII_USTRINGPARAM("control_value" )); // [Any] +static const ::rtl::OUString PROP_CONTROL_LABEL(RTL_CONSTASCII_USTRINGPARAM("control_label" )); // [OUString] +static const ::rtl::OUString PROP_CONTROL_ENABLE(RTL_CONSTASCII_USTRINGPARAM("control_enable" )); // [sal_Bool] true=ON, false=OFF +static const ::rtl::OUString STRING_SEPARATOR(RTL_CONSTASCII_USTRINGPARAM("------------------------------------------" )); //----------------------------------------------------------------------------- /** native implementation of the file picker on Vista and upcoming windows versions. @@ -361,3 +362,5 @@ class VistaFilePickerImpl : private ::cppu::BaseMutex #undef css #endif // FPICKER_WIN32_VISTA_FILEPICKERIMPL_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/filepicker/WinFileOpenImpl.cxx b/fpicker/source/win32/filepicker/WinFileOpenImpl.cxx index f701efe1357b..6d8423910949 100644 --- a/fpicker/source/win32/filepicker/WinFileOpenImpl.cxx +++ b/fpicker/source/win32/filepicker/WinFileOpenImpl.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -44,9 +45,7 @@ #include <com/sun/star/ui/dialogs/ListBoxControlActions.hpp> #include "..\misc\WinImplHelper.hxx" -#ifndef _FILEPICKER_HXX_ #include "filepicker.hxx" -#endif #include "controlaccess.hxx" #include <rtl/ustrbuf.hxx> #include <rtl/string.hxx> @@ -135,7 +134,7 @@ void CWinFileOpenImpl::setDisplayDirectory(const rtl::OUString& aDirectory) if ( ::osl::FileBase::E_None != ::osl::FileBase::getSystemPathFromFileURL(aDirectory,aSysDirectory)) throw IllegalArgumentException( - rtl::OUString::createFromAscii("Invalid directory"), + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Invalid directory")), static_cast<XFilePicker2*>(m_FilePicker), 1); // we ensure that there is a trailing '/' at the end of @@ -206,7 +205,7 @@ sal_Int16 SAL_CALL CWinFileOpenImpl::execute( ) throw(uno::RuntimeException) rc = ::com::sun::star::ui::dialogs::ExecutableDialogResults::CANCEL; else throw uno::RuntimeException( - rtl::OUString::createFromAscii("Error executing dialog"), + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Error executing dialog")), static_cast<XFilePicker2*>(m_FilePicker)); return rc; @@ -225,7 +224,7 @@ void SAL_CALL CWinFileOpenImpl::appendFilter(const rtl::OUString& aTitle, const if (!bRet) throw IllegalArgumentException( - rtl::OUString::createFromAscii("filter already exists"), + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("filter already exists")), static_cast<XFilePicker2*>(m_FilePicker), 1); // #95345# see MSDN OPENFILENAME @@ -250,7 +249,7 @@ void SAL_CALL CWinFileOpenImpl::setCurrentFilter(const rtl::OUString& aTitle) if (filterPos < 0) throw IllegalArgumentException( - rtl::OUString::createFromAscii("filter doesn't exist"), + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("filter doesn't exist")), static_cast<XFilePicker2*>(m_FilePicker), 1); // filter index of the base class starts with 1 @@ -557,8 +556,8 @@ LRESULT CALLBACK CWinFileOpenImpl::SubClassFunc( case WM_NCDESTROY: // restore the old window proc - SetWindowLong(hWnd, GWL_WNDPROC, - reinterpret_cast<LONG>(pImpl->m_pfnOldDlgProc)); + SetWindowLongPtr(hWnd, GWLP_WNDPROC, + reinterpret_cast<LONG_PTR>(pImpl->m_pfnOldDlgProc)); lResult = CallWindowProc( reinterpret_cast<WNDPROC>(pImpl->m_pfnOldDlgProc), @@ -909,8 +908,8 @@ void SAL_CALL CWinFileOpenImpl::onInitDialog(HWND hwndDlg) // subclass the dialog window m_pfnOldDlgProc = reinterpret_cast<WNDPROC>( - SetWindowLong( hwndDlg, GWL_WNDPROC, - reinterpret_cast<LONG>(SubClassFunc))); + SetWindowLongPtr( hwndDlg, GWLP_WNDPROC, + reinterpret_cast<LONG_PTR>(SubClassFunc))); } //----------------------------------------------------------------------------------------- @@ -1017,3 +1016,5 @@ void SAL_CALL CWinFileOpenImpl::InitialSetDefaultName() m_bInitialSelChanged = sal_False; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/filepicker/WinFileOpenImpl.hxx b/fpicker/source/win32/filepicker/WinFileOpenImpl.hxx index 9429f83cf30c..0c58f88c0a74 100644 --- a/fpicker/source/win32/filepicker/WinFileOpenImpl.hxx +++ b/fpicker/source/win32/filepicker/WinFileOpenImpl.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -33,9 +34,7 @@ // includes //------------------------------------------------------------------------ -#ifndef _COM_SUN_STAR_UI_DIALOGS_XEXTENDEDFILEPICKER_HPP_ #include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp> -#endif #include <com/sun/star/ui/dialogs/FilePickerEvent.hpp> #include <com/sun/star/ui/dialogs/XFilterGroupManager.hpp> #include "FilterContainer.hxx" @@ -232,3 +231,5 @@ private: #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/filepicker/afxres.h b/fpicker/source/win32/filepicker/afxres.h index 0961c334dd41..61f5ab91ce4c 100644 --- a/fpicker/source/win32/filepicker/afxres.h +++ b/fpicker/source/win32/filepicker/afxres.h @@ -1,2 +1,5 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #include <windows.h> #include <dlgs.h> + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/filepicker/asynceventnotifier.cxx b/fpicker/source/win32/filepicker/asynceventnotifier.cxx index 592c9e0c0e47..fac8480da907 100644 --- a/fpicker/source/win32/filepicker/asynceventnotifier.cxx +++ b/fpicker/source/win32/filepicker/asynceventnotifier.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -93,12 +94,12 @@ void SAL_CALL CAsyncEventNotifier::addListener(const uno::Type& { if ( m_rBroadcastHelper.bDisposed ) throw lang::DisposedException( - ::rtl::OUString::createFromAscii( "FilePicker is already disposed" ), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "FilePicker is already disposed" )), uno::Reference< uno::XInterface >() ); if ( m_rBroadcastHelper.bInDispose ) throw lang::DisposedException( - ::rtl::OUString::createFromAscii( "FilePicker will be disposed now." ), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "FilePicker will be disposed now." )), uno::Reference< uno::XInterface >() ); m_rBroadcastHelper.aLC.addInterface( aType, xListener ); @@ -113,7 +114,7 @@ void SAL_CALL CAsyncEventNotifier::removeListener(const uno::Type& { if ( m_rBroadcastHelper.bDisposed ) throw lang::DisposedException( - ::rtl::OUString::createFromAscii( "FilePicker is already disposed." ), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "FilePicker is already disposed." )), uno::Reference< uno::XInterface >() ); m_rBroadcastHelper.aLC.removeInterface( aType, xListener ); @@ -179,7 +180,7 @@ void SAL_CALL CAsyncEventNotifier::shutdown() // we are waiting infinite, so error will // be better detected in form of deadlocks if (WaitForSingleObject(m_hThread, INFINITE) == WAIT_FAILED) { - OSL_ENSURE(false, "Waiting for thread termination failed!"); + OSL_FAIL("Waiting for thread termination failed!"); } // lock mutex again to reset m_hThread @@ -298,7 +299,7 @@ void SAL_CALL CAsyncEventNotifier::run() } catch(uno::RuntimeException&) { - OSL_ENSURE(sal_False,"RuntimeException during event dispatching"); + OSL_FAIL("RuntimeException during event dispatching"); } } } @@ -325,3 +326,5 @@ unsigned int WINAPI CAsyncEventNotifier::ThreadProc(LPVOID pParam) return 0; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/filepicker/asynceventnotifier.hxx b/fpicker/source/win32/filepicker/asynceventnotifier.hxx index 5b8854aae38c..d7fd8ea0cefb 100644 --- a/fpicker/source/win32/filepicker/asynceventnotifier.hxx +++ b/fpicker/source/win32/filepicker/asynceventnotifier.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -107,3 +108,5 @@ private: }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/filepicker/asyncrequests.cxx b/fpicker/source/win32/filepicker/asyncrequests.cxx index eb0c9c6b4105..b0124859fb12 100644 --- a/fpicker/source/win32/filepicker/asyncrequests.cxx +++ b/fpicker/source/win32/filepicker/asyncrequests.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -27,7 +28,7 @@ #include "asyncrequests.hxx" #include <vcl/svapp.hxx> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> //----------------------------------------------------------------------------- // namespace @@ -66,7 +67,7 @@ void Request::wait(::sal_Int32 nMilliSeconds) void Request::waitProcessMessages() { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; while (!m_aJoiner.check()) Application::Yield(); } @@ -226,3 +227,5 @@ void SAL_CALL AsyncRequests::run() } // namespace vista } // namespace win32 } // namespace fpicker + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/filepicker/asyncrequests.hxx b/fpicker/source/win32/filepicker/asyncrequests.hxx index 752d919c2199..ba9b07eae995 100644 --- a/fpicker/source/win32/filepicker/asyncrequests.hxx +++ b/fpicker/source/win32/filepicker/asyncrequests.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -225,3 +226,5 @@ class AsyncRequests : private ::cppu::BaseMutex #undef css #endif // FPICKER_WIN32_VISTA_ASYNCREQUESTS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/filepicker/comptr.hxx b/fpicker/source/win32/filepicker/comptr.hxx index dad2ab5518e6..2eb4796921c2 100644 --- a/fpicker/source/win32/filepicker/comptr.hxx +++ b/fpicker/source/win32/filepicker/comptr.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -220,3 +221,5 @@ class ComPtr }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/filepicker/controlaccess.cxx b/fpicker/source/win32/filepicker/controlaccess.cxx index c6cf3b3ae6c6..d41eacd60145 100644 --- a/fpicker/source/win32/filepicker/controlaccess.cxx +++ b/fpicker/source/win32/filepicker/controlaccess.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -33,6 +34,7 @@ //------------------------------------------------------------------------ #include <tchar.h> +#include <sal/macros.h> #include <osl/diagnose.h> #include "controlaccess.hxx" #include "..\misc\WinImplHelper.hxx" @@ -62,14 +64,14 @@ namespace // private CheckboxSetState }; const size_t SIZE_CHECKBOX_SETVALUE_FUNCTION_TABLE = - sizeof( CheckboxSetValueFunctionTable ) / sizeof( CTRL_SETVALUE_FUNCTION_T ); + SAL_N_ELEMENTS( CheckboxSetValueFunctionTable ); CTRL_GETVALUE_FUNCTION_T CheckboxGetValueFunctionTable[] = { CheckboxGetState }; const size_t SIZE_CHECKBOX_GETVALUE_FUNCTION_TABLE = - sizeof( CheckboxGetValueFunctionTable ) / sizeof( CTRL_GETVALUE_FUNCTION_T ); + SAL_N_ELEMENTS( CheckboxGetValueFunctionTable ); CTRL_SETVALUE_FUNCTION_T ListboxSetValueFunctionTable[] = { @@ -81,7 +83,7 @@ namespace // private ListboxSetSelectedItem }; const size_t SIZE_LISTBOX_SETVALUE_FUNCTION_TABLE = - sizeof( ListboxSetValueFunctionTable ) / sizeof( CTRL_SETVALUE_FUNCTION_T ); + SAL_N_ELEMENTS( ListboxSetValueFunctionTable ); CTRL_GETVALUE_FUNCTION_T ListboxGetValueFunctionTable[] = { @@ -96,7 +98,7 @@ namespace // private ListboxGetSelectedItemIndex }; const size_t SIZE_LISTBOX_GETVALUE_ACTION_TABLE = - sizeof( ListboxGetValueFunctionTable ) / sizeof( CTRL_GETVALUE_FUNCTION_T ); + SAL_N_ELEMENTS( ListboxGetValueFunctionTable ); struct _ENTRY { @@ -183,8 +185,7 @@ namespace // private stc2, // LISTBOX_FILTER_LABEL stc3 // LISTBOX_FILE_NAME_LABEL }; - const int SIZE_WINDOWS_FILEOPEN_CTRL_IDS = - sizeof(WindowsFileOpenCtrlIds)/sizeof(WindowsFileOpenCtrlIds[0]); + const int SIZE_WINDOWS_FILEOPEN_CTRL_IDS = SAL_N_ELEMENTS(WindowsFileOpenCtrlIds); }; // end namespace @@ -225,9 +226,10 @@ CTRL_GETVALUE_FUNCTION_T SAL_CALL GetCtrlGetValueFunction( CTRL_CLASS aCtrlClass CTRL_CLASS SAL_CALL GetCtrlClass( HWND hwndCtrl ) { CTRL_CLASS aCtrlClass = UNKNOWN; - TCHAR aClassName[256]; + const size_t nClassNameSize = 256; + TCHAR aClassName[nClassNameSize]; - int nRet = GetClassName(hwndCtrl,aClassName,(sizeof(aClassName)/sizeof(TCHAR))); + int nRet = GetClassName(hwndCtrl,aClassName,nClassNameSize); if (nRet) { if (0 == _tcsicmp(aClassName,TEXT("button"))) @@ -259,3 +261,5 @@ int SAL_CALL CommonFilePickerCtrlIdToWinFileOpenCtrlId( sal_Int16 aControlId ) return WindowsFileOpenCtrlIds[aControlId]; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/filepicker/controlaccess.hxx b/fpicker/source/win32/filepicker/controlaccess.hxx index 3a6b925c46d2..d62819286b52 100644 --- a/fpicker/source/win32/filepicker/controlaccess.hxx +++ b/fpicker/source/win32/filepicker/controlaccess.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -78,3 +79,5 @@ CTRL_GETVALUE_FUNCTION_T SAL_CALL GetCtrlGetValueFunction( CTRL_CLASS aCtrlClass int SAL_CALL CommonFilePickerCtrlIdToWinFileOpenCtrlId( sal_Int16 aControlId ); #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/filepicker/controlcommand.cxx b/fpicker/source/win32/filepicker/controlcommand.cxx index c66c76549f9d..464d7c72df3f 100644 --- a/fpicker/source/win32/filepicker/controlcommand.cxx +++ b/fpicker/source/win32/filepicker/controlcommand.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -280,3 +281,5 @@ void SAL_CALL CEnableControlCommand::exec( CFilePickerState* aFilePickerState ) aFilePickerState->enableControl( getControlId( ), m_bEnable ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/filepicker/controlcommand.hxx b/fpicker/source/win32/filepicker/controlcommand.hxx index c63888ceeeb1..f44050cf8842 100644 --- a/fpicker/source/win32/filepicker/controlcommand.hxx +++ b/fpicker/source/win32/filepicker/controlcommand.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -141,3 +142,5 @@ private: }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/filepicker/controlcommandrequest.hxx b/fpicker/source/win32/filepicker/controlcommandrequest.hxx index c9c6de78fb08..53c28c69ebfd 100644 --- a/fpicker/source/win32/filepicker/controlcommandrequest.hxx +++ b/fpicker/source/win32/filepicker/controlcommandrequest.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -84,3 +85,5 @@ private: }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/filepicker/controlcommandresult.hxx b/fpicker/source/win32/filepicker/controlcommandresult.hxx index b1eeb9d27521..99fc66d5bfe1 100644 --- a/fpicker/source/win32/filepicker/controlcommandresult.hxx +++ b/fpicker/source/win32/filepicker/controlcommandresult.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -106,3 +107,5 @@ private: }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/filepicker/customcontrol.cxx b/fpicker/source/win32/filepicker/customcontrol.cxx index 257a96a0f3e1..c7d78fa8b294 100644 --- a/fpicker/source/win32/filepicker/customcontrol.cxx +++ b/fpicker/source/win32/filepicker/customcontrol.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -65,3 +66,4 @@ void SAL_CALL CCustomControl::RemoveAllControls() } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/filepicker/customcontrol.hxx b/fpicker/source/win32/filepicker/customcontrol.hxx index 3cfd7e35ce83..ea74c7c4710d 100644 --- a/fpicker/source/win32/filepicker/customcontrol.hxx +++ b/fpicker/source/win32/filepicker/customcontrol.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -58,3 +59,5 @@ public: }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/filepicker/customcontrolcontainer.cxx b/fpicker/source/win32/filepicker/customcontrolcontainer.cxx index e1afa16868f2..24ea12111990 100644 --- a/fpicker/source/win32/filepicker/customcontrolcontainer.cxx +++ b/fpicker/source/win32/filepicker/customcontrolcontainer.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -141,3 +142,5 @@ void SAL_CALL CCustomControlContainer::RemoveAllControls() m_ControlContainer.clear(); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/filepicker/customcontrolcontainer.hxx b/fpicker/source/win32/filepicker/customcontrolcontainer.hxx index b3d09622b72a..dc63c8cb355f 100644 --- a/fpicker/source/win32/filepicker/customcontrolcontainer.hxx +++ b/fpicker/source/win32/filepicker/customcontrolcontainer.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -58,3 +59,5 @@ private: }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/filepicker/customcontrolfactory.cxx b/fpicker/source/win32/filepicker/customcontrolfactory.cxx index 1cef962dfa7a..c933821641d6 100644 --- a/fpicker/source/win32/filepicker/customcontrolfactory.cxx +++ b/fpicker/source/win32/filepicker/customcontrolfactory.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -49,7 +50,7 @@ CCustomControl* CCustomControlFactory::CreateCustomControl(HWND aControlHandle, TCHAR aClsName[256]; ZeroMemory(aClsName,sizeof(aClsName)); if (GetClassName(aControlHandle,aClsName,sizeof(aClsName)) == 0) { - OSL_ENSURE(false,"Invalid window handle"); + OSL_FAIL("Invalid window handle"); } if (0 == _tcsicmp(aClsName,TEXT("button"))) @@ -84,3 +85,5 @@ CCustomControl* CCustomControlFactory::CreateCustomControlContainer() { return new CCustomControlContainer(); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/filepicker/customcontrolfactory.hxx b/fpicker/source/win32/filepicker/customcontrolfactory.hxx index ed363245c245..8222531f72e7 100644 --- a/fpicker/source/win32/filepicker/customcontrolfactory.hxx +++ b/fpicker/source/win32/filepicker/customcontrolfactory.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -59,3 +60,5 @@ public: }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/filepicker/dialogcustomcontrols.cxx b/fpicker/source/win32/filepicker/dialogcustomcontrols.cxx index 13b1354902af..8f42aaaf6d94 100644 --- a/fpicker/source/win32/filepicker/dialogcustomcontrols.cxx +++ b/fpicker/source/win32/filepicker/dialogcustomcontrols.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -193,3 +194,5 @@ void SAL_CALL CCheckboxCustomControl::Align() { AlignToBuddy(GetDlgItem(m_ParentHandle,cmb1)); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/filepicker/dialogcustomcontrols.hxx b/fpicker/source/win32/filepicker/dialogcustomcontrols.hxx index 11c3d04a7043..b7f64dc13ef2 100644 --- a/fpicker/source/win32/filepicker/dialogcustomcontrols.hxx +++ b/fpicker/source/win32/filepicker/dialogcustomcontrols.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -121,3 +122,5 @@ public: }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/filepicker/dibpreview.cxx b/fpicker/source/win32/filepicker/dibpreview.cxx index aa3a5903002e..35d0622428d9 100644 --- a/fpicker/source/win32/filepicker/dibpreview.cxx +++ b/fpicker/source/win32/filepicker/dibpreview.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -36,13 +37,9 @@ #include "dibpreview.hxx" #include <osl/diagnose.h> -#ifndef _COM_SUN_STAR_UI_DIALOG_FILEPREVIEWIMAGEFORMATS_HPP_ #include <com/sun/star/ui/dialogs/FilePreviewImageFormats.hpp> -#endif -#ifndef _USTRING_HXX_ #include <rtl/ustring.hxx> -#endif #include <stdexcept> #include <string> @@ -470,3 +467,5 @@ void SAL_CALL CDIBPreview::UnregisterDibPreviewWindowClass() s_ClassAtom = 0; } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/filepicker/dibpreview.hxx b/fpicker/source/win32/filepicker/dibpreview.hxx index ab8a0793a490..2269fce065c7 100644 --- a/fpicker/source/win32/filepicker/dibpreview.hxx +++ b/fpicker/source/win32/filepicker/dibpreview.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -114,3 +115,5 @@ private: #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/filepicker/eventnotification.hxx b/fpicker/source/win32/filepicker/eventnotification.hxx index 6bd63f091441..3866ca59946f 100644 --- a/fpicker/source/win32/filepicker/eventnotification.hxx +++ b/fpicker/source/win32/filepicker/eventnotification.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,9 +29,7 @@ #ifndef _EVENTNOTIFICATION_HXX_ #define _EVENTNOTIFICATION_HXX_ -#ifndef _COM_SUN_STAR_UNO_XINTEFACE_HPP_ #include <com/sun/star/uno/XInterface.hpp> -#endif #include <com/sun/star/uno/Reference.hxx> //----------------------------------- @@ -51,3 +50,5 @@ public: }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/filepicker/filepickereventnotification.cxx b/fpicker/source/win32/filepicker/filepickereventnotification.cxx index 06f1b690c02b..13001fdcd81a 100644 --- a/fpicker/source/win32/filepicker/filepickereventnotification.cxx +++ b/fpicker/source/win32/filepicker/filepickereventnotification.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -82,3 +83,5 @@ void SAL_CALL CFilePickerParamEventNotification::notifyEventListener( Reference< if (xFilePickerListener.is()) (xFilePickerListener.get()->*m_EventListenerMethod)(m_FilePickerEvent); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/filepicker/filepickereventnotification.hxx b/fpicker/source/win32/filepicker/filepickereventnotification.hxx index a783427acae1..4a64c0ffcf80 100644 --- a/fpicker/source/win32/filepicker/filepickereventnotification.hxx +++ b/fpicker/source/win32/filepicker/filepickereventnotification.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -71,3 +72,5 @@ private: #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/filepicker/filepickerstate.cxx b/fpicker/source/win32/filepicker/filepickerstate.cxx index fdacebd0b9db..ce8d26ac655d 100644 --- a/fpicker/source/win32/filepicker/filepickerstate.cxx +++ b/fpicker/source/win32/filepicker/filepickerstate.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -394,14 +395,14 @@ void SAL_CALL CExecuteFilePickerState::setValue( sal_Int16 aControlId, sal_Int16 // method the caller should use XFilterManager if ( !hwndCtrl || (aControlId == LISTBOX_FILTER) ) { - OSL_ENSURE( sal_False, "invalid control id" ); + OSL_FAIL( "invalid control id" ); return; } CTRL_CLASS aCtrlClass = GetCtrlClass( hwndCtrl ); if ( UNKNOWN == aCtrlClass ) { - OSL_ENSURE( sal_False, "unsupported control class" ); + OSL_FAIL( "unsupported control class" ); return; } @@ -410,7 +411,7 @@ void SAL_CALL CExecuteFilePickerState::setValue( sal_Int16 aControlId, sal_Int16 if ( !lpfnSetValue ) { - OSL_ENSURE( sal_False, "unsupported control action" ); + OSL_FAIL( "unsupported control action" ); return; } @@ -436,14 +437,14 @@ Any SAL_CALL CExecuteFilePickerState::getValue( sal_Int16 aControlId, sal_Int16 // method the caller should use XFilterManager if ( !hwndCtrl || (aControlId == LISTBOX_FILTER) ) { - OSL_ENSURE( sal_False, "invalid control id" ); + OSL_FAIL( "invalid control id" ); return Any( ); } CTRL_CLASS aCtrlClass = GetCtrlClass( hwndCtrl ); if ( UNKNOWN == aCtrlClass ) { - OSL_ENSURE( sal_False, "unsupported control class" ); + OSL_FAIL( "unsupported control class" ); return Any( ); } @@ -452,7 +453,7 @@ Any SAL_CALL CExecuteFilePickerState::getValue( sal_Int16 aControlId, sal_Int16 if ( !lpfnGetValue ) { - OSL_ENSURE( sal_False, "unsupported control action" ); + OSL_FAIL( "unsupported control action" ); return Any( ); } @@ -715,3 +716,5 @@ HWND SAL_CALL CExecuteFilePickerState::GetHwndDlgItem( sal_Int16 aControlId, sal return hwndCtrl; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/filepicker/filepickerstate.hxx b/fpicker/source/win32/filepicker/filepickerstate.hxx index 7ea1322a6542..1255e9325619 100644 --- a/fpicker/source/win32/filepicker/filepickerstate.hxx +++ b/fpicker/source/win32/filepicker/filepickerstate.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -160,3 +161,5 @@ private: }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/filepicker/getfilenamewrapper.cxx b/fpicker/source/win32/filepicker/getfilenamewrapper.cxx index 8da6f4014f15..0f1a1a883582 100644 --- a/fpicker/source/win32/filepicker/getfilenamewrapper.cxx +++ b/fpicker/source/win32/filepicker/getfilenamewrapper.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -294,3 +295,4 @@ int CGetFileNameWrapper::commDlgExtendedError( ) return m_ExtendedDialogError; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/filepicker/getfilenamewrapper.hxx b/fpicker/source/win32/filepicker/getfilenamewrapper.hxx index 89914c7c7112..2e028b4df210 100644 --- a/fpicker/source/win32/filepicker/getfilenamewrapper.hxx +++ b/fpicker/source/win32/filepicker/getfilenamewrapper.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -64,3 +65,5 @@ private: }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/filepicker/helppopupwindow.cxx b/fpicker/source/win32/filepicker/helppopupwindow.cxx index 5019af71e23e..46021a49777b 100644 --- a/fpicker/source/win32/filepicker/helppopupwindow.cxx +++ b/fpicker/source/win32/filepicker/helppopupwindow.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -607,9 +608,11 @@ void SAL_CALL CHelpPopupWindow::UnregisterWindowClass( ) if ( !UnregisterClass( (LPCTSTR)MAKELONG( s_ClassAtom, 0 ), m_hInstance ) ) { - OSL_ENSURE( false, "unregister window class failed" ); + OSL_FAIL( "unregister window class failed" ); } s_ClassAtom = 0; } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/filepicker/helppopupwindow.hxx b/fpicker/source/win32/filepicker/helppopupwindow.hxx index c58f3d03407b..71f74ad5a055 100644 --- a/fpicker/source/win32/filepicker/helppopupwindow.hxx +++ b/fpicker/source/win32/filepicker/helppopupwindow.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -141,3 +142,5 @@ private: }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/filepicker/makefile.mk b/fpicker/source/win32/filepicker/makefile.mk index 17e4f2609069..bfe5bee1da01 100644 --- a/fpicker/source/win32/filepicker/makefile.mk +++ b/fpicker/source/win32/filepicker/makefile.mk @@ -29,7 +29,6 @@ PRJ=..$/..$/.. PRJNAME=fpicker TARGET=fps -#LIBTARGET=NO ENABLE_EXCEPTIONS=TRUE COMP1TYPELIST=$(TARGET) @@ -41,11 +40,8 @@ COMP1TYPELIST=$(TARGET) CDEFS+=-D_UNICODE CDEFS+=-DUNICODE -#CDEFS+=-DWIN32_LEAN_AND_MEAN -#CDEFS+=-DWIN32 CDEFS+=-U_WIN32_WINNT -D_WIN32_WINNT=0x0600 - # --- Resources ---------------------------------------------------- .IF "$(GUI)" == "WNT" diff --git a/fpicker/source/win32/filepicker/platform_vista.h b/fpicker/source/win32/filepicker/platform_vista.h index 553ff811ef5e..a17f817163cd 100644 --- a/fpicker/source/win32/filepicker/platform_vista.h +++ b/fpicker/source/win32/filepicker/platform_vista.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -58,3 +59,5 @@ #endif #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/filepicker/platform_xp.h b/fpicker/source/win32/filepicker/platform_xp.h index d9603ade0820..41b034070425 100644 --- a/fpicker/source/win32/filepicker/platform_xp.h +++ b/fpicker/source/win32/filepicker/platform_xp.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -53,3 +54,4 @@ #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/filepicker/previewadapter.cxx b/fpicker/source/win32/filepicker/previewadapter.cxx index aa784a2f7607..994a8ee6538e 100644 --- a/fpicker/source/win32/filepicker/previewadapter.cxx +++ b/fpicker/source/win32/filepicker/previewadapter.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -31,9 +32,7 @@ #include <tchar.h> #include "previewadapter.hxx" -#ifndef _COM_SUN_STAR_UI_DIALOG_FILEPREVIEWIMAGEFORMATS_HPP_ #include <com/sun/star/ui/dialogs/FilePreviewImageFormats.hpp> -#endif #include "dibpreview.hxx" #include "../misc/WinImplHelper.hxx" @@ -711,3 +710,5 @@ void SAL_CALL CPreviewAdapter::notifyParentWindowPosChanged() { m_pImpl->notifyParentWindowPosChanged(); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/filepicker/previewadapter.hxx b/fpicker/source/win32/filepicker/previewadapter.hxx index 82f3ac409f13..0efc2e60245a 100644 --- a/fpicker/source/win32/filepicker/previewadapter.hxx +++ b/fpicker/source/win32/filepicker/previewadapter.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -105,3 +106,5 @@ private: #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/filepicker/previewbase.cxx b/fpicker/source/win32/filepicker/previewbase.cxx index 4e778e4fc011..bca984e5ad0f 100644 --- a/fpicker/source/win32/filepicker/previewbase.cxx +++ b/fpicker/source/win32/filepicker/previewbase.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -29,13 +30,12 @@ #include "precompiled_fpicker.hxx" #include "previewbase.hxx" -#ifndef _COM_SUN_STAR_UI_DIALOG_FILEPREVIEWIMAGEFORMATS_HPP_ #include <com/sun/star/ui/dialogs/FilePreviewImageFormats.hpp> -#endif using namespace com::sun::star::uno; using namespace com::sun::star::lang; -using namespace rtl; + +using ::rtl::OUString; //------------------------------- // @@ -91,11 +91,11 @@ void SAL_CALL PreviewBase::setImage( sal_Int16 aImageFormat, const ::com::sun::s { if (aImageFormat != ::com::sun::star::ui::dialogs::FilePreviewImageFormats::BITMAP) throw IllegalArgumentException( - OUString::createFromAscii("unsupported image format"), 0, 1); + OUString(RTL_CONSTASCII_USTRINGPARAM("unsupported image format")), 0, 1); if (aImage.hasValue() && (aImage.getValueType() != getCppuType((Sequence<sal_Int8>*)0))) throw IllegalArgumentException( - OUString::createFromAscii("invalid image data"), 0, 2); + OUString(RTL_CONSTASCII_USTRINGPARAM("invalid image data")), 0, 2); // save the new image data and force a redraw m_ImageData = aImage; @@ -148,3 +148,5 @@ HWND SAL_CALL PreviewBase::getWindowHandle() const { return 0; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/filepicker/previewbase.hxx b/fpicker/source/win32/filepicker/previewbase.hxx index b9296b439db2..d4b36a618c7f 100644 --- a/fpicker/source/win32/filepicker/previewbase.hxx +++ b/fpicker/source/win32/filepicker/previewbase.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -86,3 +87,5 @@ protected: #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/filepicker/propmap.hxx b/fpicker/source/win32/filepicker/propmap.hxx index 1b4130b24716..0e8ffd78425a 100644 --- a/fpicker/source/win32/filepicker/propmap.hxx +++ b/fpicker/source/win32/filepicker/propmap.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,11 +29,11 @@ #ifndef _PROPMAP_HXX_ #define _PROPMAP_HXX_ -#include <hash_map> +#include <boost/unordered_map.hpp> #include <rtl/ustring.hxx> #include <sal/types.h> -typedef ::std::hash_map< ::rtl::OUString , +typedef ::boost::unordered_map< ::rtl::OUString , void* , ::rtl::OUStringHash , ::std::equal_to< ::rtl::OUString > > TPropMapBase; @@ -99,3 +100,5 @@ class TPropMap }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/filepicker/resource.h b/fpicker/source/win32/filepicker/resource.h index 200b095e60f7..f99ffe34cf5a 100644 --- a/fpicker/source/win32/filepicker/resource.h +++ b/fpicker/source/win32/filepicker/resource.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ //{{NO_DEPENDENCIES}} // Microsoft Developer Studio generated include file. // Used by Fps.rc @@ -19,3 +20,5 @@ #define _APS_NEXT_SYMED_VALUE 101 #endif #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/filepicker/shared.hxx b/fpicker/source/win32/filepicker/shared.hxx index 8be38aaeb7fc..38580770515a 100644 --- a/fpicker/source/win32/filepicker/shared.hxx +++ b/fpicker/source/win32/filepicker/shared.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,9 +31,10 @@ #include <rtl/ustring.hxx> -const ::rtl::OUString BACKSLASH = ::rtl::OUString::createFromAscii( "\\" ); -const ::rtl::OUString FILTER_SEPARATOR = ::rtl::OUString::createFromAscii( "------------------------------------------" ); -const ::rtl::OUString ALL_FILES_WILDCARD = ::rtl::OUString::createFromAscii( "*.*" ); +const ::rtl::OUString BACKSLASH(RTL_CONSTASCII_USTRINGPARAM( "\\" )); +const ::rtl::OUString FILTER_SEPARATOR(RTL_CONSTASCII_USTRINGPARAM( "------------------------------------------" )); +const ::rtl::OUString ALL_FILES_WILDCARD(RTL_CONSTASCII_USTRINGPARAM( "*.*" )); const ::sal_Bool ALLOW_DUPLICATES = sal_True; -#endif
\ No newline at end of file +#endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/filepicker/vistatypes.h b/fpicker/source/win32/filepicker/vistatypes.h index d4c9975ccb78..08b4613f6d25 100644 --- a/fpicker/source/win32/filepicker/vistatypes.h +++ b/fpicker/source/win32/filepicker/vistatypes.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -66,3 +67,5 @@ typedef ComPtr< IFileDialogCustomize, IID_IFileDialogCustomize #undef css #endif // FPICKER_WIN32_VISTA_TYPES_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/filepicker/workbench/Test_fps.cxx b/fpicker/source/win32/filepicker/workbench/Test_fps.cxx index 699edc9533a2..5171ec064c85 100644 --- a/fpicker/source/win32/filepicker/workbench/Test_fps.cxx +++ b/fpicker/source/win32/filepicker/workbench/Test_fps.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -42,16 +43,14 @@ #include <cppuhelper/servicefactory.hxx> #ifndef _RTL_USTRING_ -#include <rtl/ustring> +#include <rtl/ustring.hxx> #endif #include <sal/types.h> #include <osl/diagnose.h> #include <com/sun/star/ui/dialogs/XFilePicker.hpp> #include <com/sun/star/ui/dialogs/XFilterManager.hpp> -#ifndef _COM_SUN_STAR_UI_DIALOGS_FILEDIALOGRESULTS_HPP_ #include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp> -#endif #include <cppuhelper/implbase1.hxx> #include <com/sun/star/ui/dialogs/XFilePickerListener.hpp> #include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp> @@ -99,7 +98,7 @@ void TestFilterManager( Reference< XFilePicker > xFilePicker ); Reference< XMultiServiceFactory > g_xFactory; -const OUString BMP_EXTENSION = OUString::createFromAscii( "bmp" ); +const OUString BMP_EXTENSION(RTL_CONSTASCII_USTRINGPARAM( "bmp" )); //------------------------------------------------------------------------------------------------------------------------- // a test client @@ -197,9 +196,8 @@ void SAL_CALL FilePickerListener::fileSelectionChanged( const ::com::sun::star:: } } } - catch( IllegalArgumentException& ex ) + catch( IllegalArgumentException& ) { - ex = ex; } } @@ -271,10 +269,10 @@ int SAL_CALL main(int nArgc, char* Argv[], char* Env[] ) OUString rdbName = OUString( RTL_CONSTASCII_USTRINGPARAM( RDB_SYSPATH ) ); Reference< XMultiServiceFactory > g_xFactory( createRegistryServiceFactory( rdbName ) ); - // Print a message if an error occured. + // Print a message if an error occurred. if ( g_xFactory.is() == sal_False ) { - OSL_ENSURE(sal_False, "Can't create RegistryServiceFactory"); + OSL_FAIL("Can't create RegistryServiceFactory"); return(-1); } @@ -283,19 +281,11 @@ int SAL_CALL main(int nArgc, char* Argv[], char* Env[] ) //------------------------------------------------- Sequence< Any > arguments(1); - //arguments[0] = makeAny( FILEOPEN_SIMPLE ); - //arguments[0] = makeAny( FILESAVE_SIMPLE ); - //arguments[0] = makeAny( FILESAVE_AUTOEXTENSION_PASSWORD ); - //arguments[0] = makeAny( FILESAVE_AUTOEXTENSION_PASSWORD_FILTEROPTIONS ); - //arguments[0] = makeAny( FILESAVE_AUTOEXTENSION_SELECTION ); - //arguments[0] = makeAny( FILESAVE_AUTOEXTENSION_TEMPLATE ); - //arguments[0] = makeAny( FILEOPEN_LINK_PREVIEW_IMAGE_TEMPLATE ); - //arguments[0] = makeAny( FILEOPEN_PLAY ); arguments[0] = makeAny( FILEOPEN_READONLY_VERSION ); Reference< XFilePicker > xFilePicker = Reference< XFilePicker >( g_xFactory->createInstanceWithArguments( - OUString::createFromAscii( FILE_PICKER_SERVICE_NAME ), arguments ), UNO_QUERY ); + OUString(RTL_CONSTASCII_USTRINGPARAM( FILE_PICKER_SERVICE_NAME )), arguments ), UNO_QUERY ); // install a FilePicker notifier Reference< XFilePickerListener > xFPListener( @@ -305,9 +295,9 @@ int SAL_CALL main(int nArgc, char* Argv[], char* Env[] ) if ( xFPNotifier.is( ) ) xFPNotifier->addFilePickerListener( xFPListener ); - xFilePicker->setTitle( OUString::createFromAscii("FileOpen Simple...")); + xFilePicker->setTitle( OUString(RTL_CONSTASCII_USTRINGPARAM("FileOpen Simple..."))); xFilePicker->setMultiSelectionMode( sal_True ); - xFilePicker->setDefaultName( OUString::createFromAscii("d:\\test2.sxw")); + xFilePicker->setDefaultName( OUString(RTL_CONSTASCII_USTRINGPARAM("d:\\test2.sxw"))); OUString aDirURL; OUString aSysPath = OStringToOUString( "d:\\ueaeoe", osl_getThreadTextEncoding( ) ); @@ -370,10 +360,10 @@ int SAL_CALL main(int nArgc, char* Argv[], char* Env[] ) // Cast factory to XComponent Reference< XComponent > xComponent( g_xFactory, UNO_QUERY ); - // Print a message if an error occured. + // Print a message if an error occurred. if ( xComponent.is() == sal_False ) { - OSL_ENSURE(sal_False, "Error shuting down"); + OSL_FAIL("Error shuting down"); } // Dispose and clear factory @@ -385,3 +375,5 @@ int SAL_CALL main(int nArgc, char* Argv[], char* Env[] ) return 0; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/folderpicker/FOPServiceInfo.hxx b/fpicker/source/win32/folderpicker/FOPServiceInfo.hxx index 4dc86192a051..0f1dd0c0eeb4 100644 --- a/fpicker/source/win32/folderpicker/FOPServiceInfo.hxx +++ b/fpicker/source/win32/folderpicker/FOPServiceInfo.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -52,3 +53,5 @@ #define FOLDER_PICKER_REGKEY_NAME "/com.sun.star.ui.dialogs.Win32FolderPicker/UNO/SERVICES/com.sun.star.ui.dialogs.SystemFolderPicker" #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/folderpicker/FolderPicker.cxx b/fpicker/source/win32/folderpicker/FolderPicker.cxx index acfe310e1cc6..5483b7d78ee9 100644 --- a/fpicker/source/win32/folderpicker/FolderPicker.cxx +++ b/fpicker/source/win32/folderpicker/FolderPicker.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -33,9 +34,7 @@ //------------------------------------------------------------------------ #include <osl/diagnose.h> -#ifndef _FOLDERPICKER_HXX_ #include "folderpicker.hxx" -#endif #include <com/sun/star/lang/DisposedException.hpp> #include "WinFOPImpl.hxx" @@ -72,7 +71,7 @@ namespace Sequence< OUString > SAL_CALL FolderPicker_getSupportedServiceNames() { Sequence< OUString > aRet(1); - aRet[0] = OUString::createFromAscii("com.sun.star.ui.dialogs.SystemFolderPicker"); + aRet[0] = OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ui.dialogs.SystemFolderPicker")); return aRet; } } @@ -167,7 +166,7 @@ sal_Int16 SAL_CALL CFolderPicker::execute( ) OUString SAL_CALL CFolderPicker::getImplementationName( ) throw( RuntimeException ) { - return OUString::createFromAscii( FOLDERPICKER_IMPL_NAME ); + return OUString(RTL_CONSTASCII_USTRINGPARAM( FOLDERPICKER_IMPL_NAME )); } // ------------------------------------------------- @@ -217,3 +216,4 @@ void SAL_CALL CFolderPicker::disposing() { } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/folderpicker/FolderPicker.hxx b/fpicker/source/win32/folderpicker/FolderPicker.hxx index 0bb02c3b7682..0aed9df40630 100644 --- a/fpicker/source/win32/folderpicker/FolderPicker.hxx +++ b/fpicker/source/win32/folderpicker/FolderPicker.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -36,16 +37,12 @@ #include <osl/mutex.hxx> #include <com/sun/star/lang/XServiceInfo.hpp> -#ifndef _COM_SUN_STAR_UI_XFOLDERPICKER_HPP_ #include <com/sun/star/ui/dialogs/XFolderPicker.hpp> -#endif #include <com/sun/star/util/XCancellable.hpp> #include <memory> -#ifndef _FPIMPLBASE_HXX_ #include "WinFOPImpl.hxx" -#endif //---------------------------------------------------------- // class declaration @@ -127,3 +124,5 @@ private: }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/folderpicker/FopEvtDisp.hxx b/fpicker/source/win32/folderpicker/FopEvtDisp.hxx index dfaa5a9abf9b..3da34d8f6bf6 100644 --- a/fpicker/source/win32/folderpicker/FopEvtDisp.hxx +++ b/fpicker/source/win32/folderpicker/FopEvtDisp.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -43,3 +44,5 @@ public: }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/folderpicker/Fopentry.cxx b/fpicker/source/win32/folderpicker/Fopentry.cxx index 3c861cc67ce3..73a048c21ff7 100644 --- a/fpicker/source/win32/folderpicker/Fopentry.cxx +++ b/fpicker/source/win32/folderpicker/Fopentry.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -35,13 +36,9 @@ #include <com/sun/star/container/XSet.hpp> #include <osl/diagnose.h> -#ifndef _FILEPICKER_HXX_ #include "folderpicker.hxx" -#endif -#ifndef _FPSERVICEINFO_HXX_ #include "FOPServiceInfo.hxx" -#endif #include "WinFOPImpl.hxx" //----------------------------------------------------------------------- @@ -117,3 +114,5 @@ void* SAL_CALL component_getFactory( const sal_Char* pImplName, uno_Interface* p } } // extern "C" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/folderpicker/MtaFop.cxx b/fpicker/source/win32/folderpicker/MtaFop.cxx index 88523848d872..8204b51cd930 100644 --- a/fpicker/source/win32/folderpicker/MtaFop.cxx +++ b/fpicker/source/win32/folderpicker/MtaFop.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -251,7 +252,7 @@ sal_Bool CMtaFolderPicker::browseForFolder( ) if ( WaitForSingleObject( m_hEvtThrdReady, MAX_WAITTIME ) != WAIT_OBJECT_0 ) { - OSL_ENSURE( sal_False, "sta thread not ready" ); + OSL_FAIL( "sta thread not ready" ); return sal_False; } @@ -720,7 +721,7 @@ unsigned int CMtaFolderPicker::run( ) // we stop here and return if ( FAILED( hr ) ) { - OSL_ENSURE( sal_False, "CoInitialize failed" ); + OSL_FAIL( "CoInitialize failed" ); return sal::static_int_cast< unsigned int >(-1); } @@ -739,7 +740,7 @@ unsigned int CMtaFolderPicker::run( ) } else { - OSL_ENSURE( sal_False, "failed to create sta thread" ); + OSL_FAIL( "failed to create sta thread" ); nRet = sal::static_int_cast< unsigned int >(-1); } @@ -837,3 +838,5 @@ void SAL_CALL CMtaFolderPicker::UnregisterStaRequestWindowClass( ) s_ClassAtom = 0; } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/folderpicker/MtaFop.hxx b/fpicker/source/win32/folderpicker/MtaFop.hxx index 4735300c0ee0..36e4648b05bd 100644 --- a/fpicker/source/win32/folderpicker/MtaFop.hxx +++ b/fpicker/source/win32/folderpicker/MtaFop.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -189,3 +190,5 @@ private: }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/folderpicker/WinFOPImpl.cxx b/fpicker/source/win32/folderpicker/WinFOPImpl.cxx index 1aac4f5f8c53..fdf191f07318 100644 --- a/fpicker/source/win32/folderpicker/WinFOPImpl.cxx +++ b/fpicker/source/win32/folderpicker/WinFOPImpl.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -32,15 +33,11 @@ // includes //------------------------------------------------------------------------ -#ifndef _WINDIRBROWSEIMPL_HXX_ #include "WinFOPImpl.hxx" -#endif #include <osl/diagnose.h> #include <com/sun/star/lang/EventObject.hpp> -#ifndef _COM_SUN_STAR_UI_FILEDIALOGRESULTS_HPP_ #include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp> -#endif #include "FopEvtDisp.hxx" #include <osl/file.hxx> #include "FolderPicker.hxx" @@ -61,7 +58,7 @@ using osl::FileBase; // //------------------------------------------------------------------------ -const OUString BACKSLASH = OUString::createFromAscii( "\\" ); +const OUString BACKSLASH(RTL_CONSTASCII_USTRINGPARAM( "\\" )); //------------------------------------------------------------------------ // ctor @@ -97,7 +94,7 @@ void SAL_CALL CWinFolderPickerImpl::setDisplayDirectory( const OUString& aDirect if ( ::osl::FileBase::E_None != rc ) throw IllegalArgumentException( - OUString::createFromAscii( "directory is not a valid file url" ), + OUString(RTL_CONSTASCII_USTRINGPARAM( "directory is not a valid file url" )), static_cast< XFolderPicker* >( m_pFolderPicker ), 1 ); @@ -166,3 +163,5 @@ void CWinFolderPickerImpl::onSelChanged( const OUString& aNewPath ) { setStatusText( aNewPath ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/folderpicker/WinFOPImpl.hxx b/fpicker/source/win32/folderpicker/WinFOPImpl.hxx index eb7889f86167..d88531629d03 100644 --- a/fpicker/source/win32/folderpicker/WinFOPImpl.hxx +++ b/fpicker/source/win32/folderpicker/WinFOPImpl.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -81,3 +82,5 @@ private: }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/folderpicker/makefile.mk b/fpicker/source/win32/folderpicker/makefile.mk index 7f0556d7cecb..f42ff9685c3c 100644 --- a/fpicker/source/win32/folderpicker/makefile.mk +++ b/fpicker/source/win32/folderpicker/makefile.mk @@ -28,7 +28,6 @@ PRJ=..$/..$/.. PRJNAME=fpicker TARGET=fop -#LIBTARGET=NO ENABLE_EXCEPTIONS=TRUE COMP1TYPELIST=$(TARGET) diff --git a/fpicker/source/win32/folderpicker/workbench/Test_fops.cxx b/fpicker/source/win32/folderpicker/workbench/Test_fops.cxx index 472562194566..c253de2f3227 100644 --- a/fpicker/source/win32/folderpicker/workbench/Test_fops.cxx +++ b/fpicker/source/win32/folderpicker/workbench/Test_fops.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -47,20 +48,14 @@ #include <sal/types.h> #include <osl/diagnose.h> -#ifndef _COM_SUN_STAR_UI_XFOLDERPICKER_HPP_ #include <com/sun/star/ui/dialogs/XFolderPicker.hpp> -#endif -#ifndef _COM_SUN_STAR_UI_FILEDIALOGRESULTS_HPP_ #include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp> -#endif #include <cppuhelper/implbase1.hxx> #include <stdio.h> -#ifndef _FPSERVICEINFO_HXX_ #include "..\FOPServiceInfo.hxx" -#endif #include <osl/file.hxx> @@ -91,27 +86,6 @@ using namespace std ; Reference< XMultiServiceFactory > g_xFactory; -/* -void CreateDeepDirectory( ) -{ - // create a deep directory - - OUString aPathURL( L"file:///d|/Deep" ); - OUString normalizedPath; - - OSL_ASSERT( ::osl::FileBase::E_None == \ - ::osl::FileBase::getNormalizedPathFromFileURL( aPathURL, normalizedPath ) ); - - while( ::osl::FileBase::E_None == osl::Directory::create( normalizedPath ) ) - { - aPathURL += L"/Deep"; - OSL_ASSERT( ::osl::FileBase::E_None == \ - ::osl::FileBase::getNormalizedPathFromFileURL( aPathURL, normalizedPath ) ); - } - -} -*/ - //-------------------------------------------------------------- // main //-------------------------------------------------------------- @@ -133,10 +107,10 @@ int SAL_CALL main(int /*nArgc*/, char* /*Argv[]*/, char* /*Env[]*/ ) OUString rdbName = OUString( RTL_CONSTASCII_USTRINGPARAM( RDB_SYSPATH ) ); Reference< XMultiServiceFactory > g_xFactory( createRegistryServiceFactory( rdbName ) ); - // Print a message if an error occured. + // Print a message if an error occurred. if ( g_xFactory.is() == sal_False ) { - OSL_ENSURE(sal_False, "Can't create RegistryServiceFactory"); + OSL_FAIL("Can't create RegistryServiceFactory"); return(-1); } @@ -153,7 +127,7 @@ int SAL_CALL main(int /*nArgc*/, char* /*Argv[]*/, char* /*Env[]*/ ) if ( xFolderPicker.is() == sal_False ) { - OSL_ENSURE( sal_False, "Error creating FolderPicker Service" ); + OSL_FAIL( "Error creating FolderPicker Service" ); return(-1); } @@ -184,10 +158,10 @@ int SAL_CALL main(int /*nArgc*/, char* /*Argv[]*/, char* /*Env[]*/ ) // Cast factory to XComponent Reference< XComponent > xComponent( g_xFactory, UNO_QUERY ); - // Print a message if an error occured. + // Print a message if an error occurred. if ( xComponent.is() == sal_False ) { - OSL_ENSURE(sal_False, "Error shuting down"); + OSL_FAIL("Error shuting down"); } // Dispose and clear factory @@ -201,3 +175,5 @@ int SAL_CALL main(int /*nArgc*/, char* /*Argv[]*/, char* /*Env[]*/ ) return 0; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/folderpicker/workbench/makefile.mk b/fpicker/source/win32/folderpicker/workbench/makefile.mk index bfdf840989f8..666751f2779d 100644 --- a/fpicker/source/win32/folderpicker/workbench/makefile.mk +++ b/fpicker/source/win32/folderpicker/workbench/makefile.mk @@ -32,9 +32,7 @@ TARGET= testfops LIBTARGET= NO TARGETTYPE= CUI - # --- Settings ----------------------------------------------------- -#.INCLUDE : $(PRJ)$/util$/makefile.pmk .INCLUDE : settings.mk @@ -58,5 +56,6 @@ APP1STDLIBS+= $(CPPULIB) \ APP1DEF= $(MISC)$/$(APP1TARGET).def # --- Targets ------------------------------------------------------ + .INCLUDE : target.mk diff --git a/fpicker/source/win32/misc/AutoBuffer.cxx b/fpicker/source/win32/misc/AutoBuffer.cxx index 08d7e34d3851..00c0f91fbf42 100644 --- a/fpicker/source/win32/misc/AutoBuffer.cxx +++ b/fpicker/source/win32/misc/AutoBuffer.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -167,3 +168,5 @@ void SAL_CALL CAutoUnicodeBuffer::init( ) empty( ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/misc/AutoBuffer.hxx b/fpicker/source/win32/misc/AutoBuffer.hxx index ccf6c0759e11..6b287d2556b0 100644 --- a/fpicker/source/win32/misc/AutoBuffer.hxx +++ b/fpicker/source/win32/misc/AutoBuffer.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -80,3 +81,5 @@ private: }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/misc/WinImplHelper.cxx b/fpicker/source/win32/misc/WinImplHelper.cxx index 6e8e93c6587d..301a5bc9e6bc 100644 --- a/fpicker/source/win32/misc/WinImplHelper.cxx +++ b/fpicker/source/win32/misc/WinImplHelper.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -53,9 +54,9 @@ using ::com::sun::star::uno::Sequence; // //------------------------------------------------------------ -const rtl::OUString TILDE = OUString::createFromAscii( "~" ); +const rtl::OUString TILDE(RTL_CONSTASCII_USTRINGPARAM( "~" )); const sal_Unicode TILDE_SIGN = L'~'; -const rtl::OUString AMPERSAND = OUString::createFromAscii( "&" ); +const rtl::OUString AMPERSAND(RTL_CONSTASCII_USTRINGPARAM( "&" )); const sal_Unicode AMPERSAND_SIGN = L'&'; //------------------------------------------------------------ @@ -247,7 +248,7 @@ void SAL_CALL ListboxAddItem( HWND hwnd, const Any& aItem, const Reference< XInt if ( !aItem.hasValue( ) || aItem.getValueType( ) != getCppuType((OUString*)0) ) throw IllegalArgumentException( - OUString::createFromAscii( "invalid value type or any has no value" ), + OUString(RTL_CONSTASCII_USTRINGPARAM( "invalid value type or any has no value" )), rXInterface, aArgPos ); @@ -269,7 +270,7 @@ void SAL_CALL ListboxAddItems( HWND hwnd, const Any& aItemList, const Reference< if ( !aItemList.hasValue( ) || aItemList.getValueType( ) != getCppuType((Sequence<OUString>*)0) ) throw IllegalArgumentException( - OUString::createFromAscii( "invalid value type or any has no value" ), + OUString(RTL_CONSTASCII_USTRINGPARAM( "invalid value type or any has no value" )), rXInterface, aArgPos ); @@ -297,7 +298,7 @@ void SAL_CALL ListboxDeleteItem( HWND hwnd, const Any& aPosition, const Referenc (aPosition.getValueType( ) != getCppuType((sal_Int16*)0)) && (aPosition.getValueType( ) != getCppuType((sal_Int8*)0)) ) ) throw IllegalArgumentException( - OUString::createFromAscii( "invalid value type or any has no value" ), + OUString(RTL_CONSTASCII_USTRINGPARAM( "invalid value type or any has no value" )), rXInterface, aArgPos ); @@ -310,7 +311,7 @@ void SAL_CALL ListboxDeleteItem( HWND hwnd, const Any& aPosition, const Referenc // index was not correct if ( CB_ERR == lRet ) throw IllegalArgumentException( - OUString::createFromAscii( "inavlid item position" ), + OUString(RTL_CONSTASCII_USTRINGPARAM( "invalid item position" )), rXInterface, aArgPos ); } @@ -349,7 +350,7 @@ void SAL_CALL ListboxSetSelectedItem( HWND hwnd, const Any& aPosition, const Ref (aPosition.getValueType( ) != getCppuType((sal_Int16*)0)) && (aPosition.getValueType( ) != getCppuType((sal_Int8*)0)) ) ) throw IllegalArgumentException( - OUString::createFromAscii( "invalid value type or any has no value" ), + OUString(RTL_CONSTASCII_USTRINGPARAM( "invalid value type or any has no value" )), rXInterface, aArgPos ); @@ -358,7 +359,7 @@ void SAL_CALL ListboxSetSelectedItem( HWND hwnd, const Any& aPosition, const Ref if ( nPos < -1 ) throw IllegalArgumentException( - OUString::createFromAscii("invalid index"), + OUString(RTL_CONSTASCII_USTRINGPARAM("invalid index")), rXInterface, aArgPos ); @@ -366,7 +367,7 @@ void SAL_CALL ListboxSetSelectedItem( HWND hwnd, const Any& aPosition, const Ref if ( (CB_ERR == lRet) && (-1 != nPos) ) throw IllegalArgumentException( - OUString::createFromAscii("invalid index"), + OUString(RTL_CONSTASCII_USTRINGPARAM("invalid index")), rXInterface, aArgPos ); } @@ -459,7 +460,7 @@ void SAL_CALL CheckboxSetState( if ( !aState.hasValue( ) || aState.getValueType( ) != getCppuType((sal_Bool*)0) ) throw IllegalArgumentException( - OUString::createFromAscii( "invalid value type or any has no value" ), + OUString(RTL_CONSTASCII_USTRINGPARAM( "invalid value type or any has no value" )), rXInterface, aArgPos ); @@ -608,3 +609,4 @@ OUString WindowsToSOfficeLabel( const rtl::OUString& aWinLabel ) return aSOLabel; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/misc/WinImplHelper.hxx b/fpicker/source/win32/misc/WinImplHelper.hxx index 412536cb37d6..03cefe901124 100644 --- a/fpicker/source/win32/misc/WinImplHelper.hxx +++ b/fpicker/source/win32/misc/WinImplHelper.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -121,3 +122,5 @@ rtl::OUString SOfficeToWindowsLabel( const rtl::OUString& aSOLabel ); rtl::OUString WindowsToSOfficeLabel( const rtl::OUString& aWinLabel ); #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/misc/resourceprovider.cxx b/fpicker/source/win32/misc/resourceprovider.cxx index b5448a93008c..fedea82d3515 100644 --- a/fpicker/source/win32/misc/resourceprovider.cxx +++ b/fpicker/source/win32/misc/resourceprovider.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -34,12 +35,10 @@ #include <osl/diagnose.h> #include <rtl/ustrbuf.hxx> #include "resourceprovider.hxx" -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <vcl/svapp.hxx> -#ifndef _TOOLS_SIMPLERESMGR_HXX #include <tools/simplerm.hxx> -#endif #include <com/sun/star/ui/dialogs/CommonFilePickerElementIds.hpp> #include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp> @@ -86,7 +85,7 @@ _Entry CtrlIdToResIdTable[] = { { FOLDER_PICKER_DEF_DESCRIPTION, STR_SVT_FOLDERPICKER_DEFAULT_DESCRIPTION } }; -const sal_Int32 SIZE_TABLE = sizeof( CtrlIdToResIdTable ) / sizeof( _Entry ); +const sal_Int32 SIZE_TABLE = SAL_N_ELEMENTS( CtrlIdToResIdTable ); //------------------------------------------------------------ // @@ -122,7 +121,7 @@ public: CResourceProvider_Impl( ) { - const ::vos::OGuard aGuard( Application::GetSolarMutex() ); + const SolarMutexGuard aGuard; com::sun::star::lang::Locale aLoc( Application::GetSettings().GetUILocale() ); m_ResMgr = new SimpleResMgr( CREATEVERSIONRESMGR_NAME( fps_office ), aLoc ); @@ -192,3 +191,5 @@ OUString CResourceProvider::getResString( sal_Int16 aId ) { return m_pImpl->getResString( aId ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/misc/resourceprovider.hxx b/fpicker/source/win32/misc/resourceprovider.hxx index 97cd753053bf..3b887e602a48 100644 --- a/fpicker/source/win32/misc/resourceprovider.hxx +++ b/fpicker/source/win32/misc/resourceprovider.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -35,9 +36,7 @@ #include <sal/types.h> -#ifndef _RTL_USTRING_HXX_ -#include <rtl/ustring> -#endif +#include <rtl/ustring.hxx> //------------------------------------------------------------------------ // deklarations @@ -58,3 +57,5 @@ private: }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/test/makefile.mk b/fpicker/test/makefile.mk index 66d9c348f3a2..4157d339bd3a 100644 --- a/fpicker/test/makefile.mk +++ b/fpicker/test/makefile.mk @@ -30,8 +30,6 @@ PRJ=.. PRJNAME=SV TARGET=svdem LIBTARGET=NO -#TARGETTYPE=GUI - .IF "$(GUI)" == "OS2" TARGETTYPE=GUI @@ -50,15 +48,12 @@ APP1NOSAL= TRUE APP1TARGET= $(TARGET) APP1OBJS= $(OBJFILES) -# $(OBJ)$/salmain.obj - APP1STDLIBS= $(CPPULIB) \ $(CPPUHELPERLIB) \ $(COMPHELPERLIB) \ $(VCLLIB) \ $(TOOLSLIB) \ $(SALLIB) \ - $(VOSLIB) \ $(SOTLIB) \ $(SVLIB) -l$(LB)/fps_office.uno.lib diff --git a/fpicker/test/svdem.cxx b/fpicker/test/svdem.cxx index f9fdd8ba3b19..5fb56e148beb 100644 --- a/fpicker/test/svdem.cxx +++ b/fpicker/test/svdem.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -47,9 +48,7 @@ #include <com/sun/star/ui/dialogs/XFilePicker.hpp> #include <com/sun/star/ui/dialogs/XFilterManager.hpp> -#ifndef _COM_SUN_STAR_UI_DIALOGS_FILEDIALOGRESULTS_HPP_ #include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp> -#endif #include <cppuhelper/implbase1.hxx> #include <com/sun/star/ui/dialogs/XFilePickerListener.hpp> #include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp> @@ -215,3 +214,4 @@ printf("Test\n"); return 0; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/util/makefile.mk b/fpicker/util/makefile.mk index 60bd3333cb71..39fb31837731 100644 --- a/fpicker/util/makefile.mk +++ b/fpicker/util/makefile.mk @@ -58,7 +58,9 @@ SHL1STDLIBS= $(COMMON_LIBS) \ $(OLEAUT32LIB)\ $(COMDLG32LIB)\ $(KERNEL32LIB)\ - $(UUIDLIB) + $(UUIDLIB)\ + Delayimp.lib\ + /DELAYLOAD:shell32.dll SHL1DEPN= SHL1IMPLIB=i$(SHL1TARGET) |