summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore11
-rw-r--r--desktop/source/app/app.cxx10
-rw-r--r--desktop/source/app/cmdlineargs.cxx88
-rw-r--r--desktop/source/app/cmdlineargs.hxx8
-rw-r--r--desktop/source/app/cmdlinehelp.cxx15
-rw-r--r--desktop/source/app/dispatchwatcher.cxx224
-rw-r--r--desktop/source/app/dispatchwatcher.hxx7
-rw-r--r--desktop/source/app/officeipcthread.cxx60
-rw-r--r--desktop/source/app/officeipcthread.hxx4
-rw-r--r--fpicker/prj/build.lst5
-rw-r--r--fpicker/prj/d.lst2
-rw-r--r--fpicker/source/generic/fpicker.cxx28
-rw-r--r--fpicker/source/generic/makefile.mk1
-rw-r--r--fpicker/source/odma/ODMAFilePicker.cxx532
-rw-r--r--fpicker/source/odma/ODMAFilePicker.hxx213
-rw-r--r--fpicker/source/odma/ODMAFolderPicker.cxx182
-rw-r--r--fpicker/source/odma/ODMAFolderPicker.hxx100
-rw-r--r--fpicker/source/odma/exports.map8
-rw-r--r--fpicker/source/odma/fps_odma.cxx78
-rw-r--r--fpicker/source/odma/makefile.mk72
-rw-r--r--fpicker/source/unx/kde/kdecommandthread.cxx174
-rw-r--r--fpicker/source/unx/kde/kdecommandthread.hxx94
-rw-r--r--fpicker/source/unx/kde/kdefilepicker.cxx729
-rw-r--r--fpicker/source/unx/kde/kdefilepicker.hxx122
-rw-r--r--fpicker/source/unx/kde/kdefpmain.cxx89
-rw-r--r--fpicker/source/unx/kde/kdemodalityfilter.cxx64
-rw-r--r--fpicker/source/unx/kde/kdemodalityfilter.hxx45
-rw-r--r--fpicker/source/unx/kde/makefile.mk76
-rw-r--r--fpicker/source/unx/kde_unx/FPServiceInfo.hxx44
-rw-r--r--fpicker/source/unx/kde_unx/UnxCommandThread.cxx311
-rw-r--r--fpicker/source/unx/kde_unx/UnxCommandThread.hxx132
-rw-r--r--fpicker/source/unx/kde_unx/UnxFPentry.cxx124
-rw-r--r--fpicker/source/unx/kde_unx/UnxFilePicker.cxx928
-rw-r--r--fpicker/source/unx/kde_unx/UnxFilePicker.hxx174
-rw-r--r--fpicker/source/unx/kde_unx/UnxNotifyThread.cxx112
-rw-r--r--fpicker/source/unx/kde_unx/UnxNotifyThread.hxx86
-rw-r--r--fpicker/source/unx/kde_unx/fps-kde-ucd.txt6
-rw-r--r--fpicker/source/unx/kde_unx/fps_kde.xml51
-rw-r--r--fpicker/source/unx/kde_unx/makefile.mk77
-rw-r--r--framework/prj/build.lst2
-rw-r--r--framework/source/uielement/recentfilesmenucontroller.cxx40
-rw-r--r--framework/source/uielement/toolbarmanager.cxx21
-rw-r--r--framework/source/uielement/toolbarsmenucontroller.cxx4
-rw-r--r--framework/util/makefile.mk1
-rw-r--r--officecfg/registry/data/org/openoffice/ucb/Configuration.xcu11
-rw-r--r--officecfg/registry/schema/org/openoffice/Office/Common.xcs27
-rw-r--r--sfx2/sdi/appslots.sdi1
-rw-r--r--sfx2/source/appl/appserv.cxx13
-rw-r--r--sfx2/source/bastyp/fltfnc.cxx10
-rw-r--r--sfx2/source/dialog/filedlghelper.cxx12
-rwxr-xr-xsvx/inc/svx/dialogs.hrc3
-rw-r--r--svx/inc/svx/linkwarn.hxx54
-rw-r--r--svx/prj/d.lst5
-rw-r--r--svx/source/dialog/linkwarn.cxx147
-rw-r--r--svx/source/dialog/linkwarn.hrc60
-rw-r--r--svx/source/dialog/linkwarn.src85
-rw-r--r--svx/source/dialog/makefile.mk2
-rw-r--r--ucb/prj/build.lst1
-rw-r--r--ucb/prj/d.lst5
-rw-r--r--ucb/source/ucp/odma/makefile.mk11
-rw-r--r--ucb/source/ucp/odma/odma_content.cxx100
-rw-r--r--ucb/source/ucp/odma/odma_content.hxx2
-rw-r--r--ucb/source/ucp/odma/odma_contentprops.hxx1
-rw-r--r--ucb/source/ucp/odma/odma_datasupplier.cxx3
-rw-r--r--ucb/source/ucp/odma/odma_lib.cxx25
-rw-r--r--ucb/source/ucp/odma/odma_lib.hxx76
-rw-r--r--ucb/source/ucp/odma/odma_provider.cxx8
-rw-r--r--ucb/source/ucp/odma/odma_provider.hxx15
-rw-r--r--ucb/source/ucp/odma/odma_services.cxx14
-rw-r--r--ucb/source/ucp/odma/ucpodma.xml2
70 files changed, 5653 insertions, 194 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000000..def767e592
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,11 @@
+# backup and temporary files
+*~
+.*.sw[op]
+
+# the build directories
+/*/unxlng??
+/*/unxlng??.pro
+
+# autoconf generated stuff
+/ChangeLog
+/configure
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index 045970ea97..b493d273c6 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -2849,6 +2849,10 @@ void Desktop::OpenClients()
pArgs->GetPrinterName( aRequest.aPrinterName );
pArgs->GetForceOpenList( aRequest.aForceOpenList );
pArgs->GetForceNewList( aRequest.aForceNewList );
+ pArgs->GetConversionList( aRequest.aConversionList );
+ pArgs->GetConversionParams( aRequest.aConversionParams );
+ pArgs->GetConversionOut( aRequest.aConversionOut );
+ pArgs->GetInFilter( aRequest.aInFilter );
if ( aRequest.aOpenList.getLength() > 0 ||
aRequest.aViewList.getLength() > 0 ||
@@ -2856,7 +2860,8 @@ void Desktop::OpenClients()
aRequest.aPrintList.getLength() > 0 ||
aRequest.aForceOpenList.getLength() > 0 ||
aRequest.aForceNewList.getLength() > 0 ||
- ( aRequest.aPrintToList.getLength() > 0 && aRequest.aPrinterName.getLength() > 0 ))
+ ( aRequest.aPrintToList.getLength() > 0 && aRequest.aPrinterName.getLength() > 0 ) ||
+ aRequest.aConversionList.getLength() > 0 )
{
bLoaded = sal_True;
@@ -3206,7 +3211,8 @@ void Desktop::OpenSplashScreen()
!pCmdLine->IsNoLogo() &&
!pCmdLine->IsTerminateAfterInit() &&
!pCmdLine->GetPrintList( aTmpString ) &&
- !pCmdLine->GetPrintToList( aTmpString ) )
+ !pCmdLine->GetPrintToList( aTmpString ) &&
+ !pCmdLine->GetConversionList( aTmpString ))
{
// Determine application name from command line parameters
OUString aAppName;
diff --git a/desktop/source/app/cmdlineargs.cxx b/desktop/source/app/cmdlineargs.cxx
index c142c5f96a..8c93f46dbc 100644
--- a/desktop/source/app/cmdlineargs.cxx
+++ b/desktop/source/app/cmdlineargs.cxx
@@ -151,6 +151,11 @@ void CommandLineArgs::ParseCommandLine_Impl( Supplier& supplier )
sal_Bool bForceOpenEvent = sal_False;
sal_Bool bForceNewEvent = sal_False;
sal_Bool bDisplaySpec = sal_False;
+ sal_Bool bConversionEvent= sal_False;
+ sal_Bool bConversionParamsEvent= sal_False;
+ sal_Bool bBatchPrintEvent= sal_False;
+ sal_Bool bBatchPrinterNameEvent= sal_False;
+ sal_Bool bConversionOutEvent = sal_False;
m_eArgumentCount = NONE;
@@ -295,6 +300,27 @@ void CommandLineArgs::ParseCommandLine_Impl( Supplier& supplier )
bDisplaySpec = sal_False;
}
#endif
+ else if ( aArgStr.EqualsIgnoreCaseAscii( "-convert-to" ) )
+ {
+ bOpenEvent = sal_False;
+ bConversionEvent = sal_True;
+ bConversionParamsEvent = sal_True;
+ }
+ else if ( aArgStr.EqualsIgnoreCaseAscii( "-print-to-file" ) )
+ {
+ bOpenEvent = sal_False;
+ bBatchPrintEvent = sal_True;
+ }
+ else if ( aArgStr.EqualsIgnoreCaseAscii( "-printer-name" ) &&
+ bBatchPrintEvent )
+ {
+ bBatchPrinterNameEvent = sal_True;
+ }
+ else if ( aArgStr.EqualsIgnoreCaseAscii( "-outdir" ) &&
+ (bConversionEvent || bBatchPrintEvent) )
+ {
+ bConversionOutEvent = sal_True;
+ }
}
else
{
@@ -304,8 +330,34 @@ void CommandLineArgs::ParseCommandLine_Impl( Supplier& supplier )
AddStringListParam_Impl( CMD_STRINGPARAM_PRINTERNAME, aArgStr );
bPrinterName = sal_False;
}
+ else if ( bConversionParamsEvent && bConversionEvent )
+ {
+ // first argument must be the the params
+ AddStringListParam_Impl( CMD_STRINGPARAM_CONVERSIONPARAMS, aArgStr );
+ bConversionParamsEvent = sal_False;
+ }
+ else if ( bBatchPrinterNameEvent && bBatchPrintEvent )
+ {
+ // first argument is the printer name
+ AddStringListParam_Impl( CMD_STRINGPARAM_PRINTERNAME, aArgStr );
+ bBatchPrinterNameEvent = sal_False;
+ }
+ else if ( (bConversionEvent || bBatchPrintEvent) && bConversionOutEvent )
+ {
+ AddStringListParam_Impl( CMD_STRINGPARAM_CONVERSIONOUT, aArgStr );
+ bConversionOutEvent = sal_False;
+ }
else
{
+ if( bOpenEvent || bViewEvent || bForceNewEvent || bForceOpenEvent )
+ {
+ if( ::rtl::OUString(aArgStr).matchIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("::ODMA")) )
+ {
+ ::rtl::OUString sArg = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("vnd.sun.star.odma:/"));
+ sArg += aArgStr;
+ aArgStr = sArg;
+ }
+ }
// handle this argument as a filename
if ( bOpenEvent )
AddStringListParam_Impl( CMD_STRINGPARAM_OPENLIST, aArgStr );
@@ -326,6 +378,8 @@ void CommandLineArgs::ParseCommandLine_Impl( Supplier& supplier )
bDisplaySpec = sal_False; // only one display, not a lsit
bOpenEvent = sal_True; // set back to standard
}
+ else if ( bConversionEvent || bBatchPrintEvent )
+ AddStringListParam_Impl( CMD_STRINGPARAM_CONVERSIONLIST, aArgStr );
}
}
}
@@ -485,6 +539,11 @@ sal_Bool CommandLineArgs::InterpretCommandLineParameter( const ::rtl::OUString&
return sal_True;
}
#endif
+ else if ( aArgStr.Copy(0, 10).EqualsIgnoreCaseAscii( "-infilter=" ))
+ {
+ AddStringListParam_Impl( CMD_STRINGPARAM_INFILTER, aArgStr.Copy( 10 ) );
+ return sal_True;
+ }
else if ( aArgStr.Copy(0, 8).EqualsIgnoreCaseAscii( "-accept=" ))
{
AddStringListParam_Impl( CMD_STRINGPARAM_ACCEPT, aArgStr.Copy( 8 ) );
@@ -882,6 +941,35 @@ sal_Bool CommandLineArgs::GetLanguage( ::rtl::OUString& rPara ) const
return m_aStrSetParams[ CMD_STRINGPARAM_LANGUAGE ];
}
+sal_Bool CommandLineArgs::GetInFilter( ::rtl::OUString& rPara ) const
+{
+ osl::MutexGuard aMutexGuard( m_aMutex );
+ rPara = m_aStrParams[ CMD_STRINGPARAM_INFILTER ];
+ return m_aStrSetParams[ CMD_STRINGPARAM_INFILTER ];
+}
+
+sal_Bool CommandLineArgs::GetConversionList( ::rtl::OUString& rPara ) const
+{
+ osl::MutexGuard aMutexGuard( m_aMutex );
+ rPara = m_aStrParams[ CMD_STRINGPARAM_CONVERSIONLIST ];
+ return m_aStrSetParams[ CMD_STRINGPARAM_CONVERSIONLIST ];
+}
+
+sal_Bool CommandLineArgs::GetConversionParams( ::rtl::OUString& rPara ) const
+{
+ osl::MutexGuard aMutexGuard( m_aMutex );
+ rPara = m_aStrParams[ CMD_STRINGPARAM_CONVERSIONPARAMS ];
+ return m_aStrSetParams[ CMD_STRINGPARAM_CONVERSIONPARAMS ];
+}
+sal_Bool CommandLineArgs::GetConversionOut( ::rtl::OUString& rPara ) const
+{
+ osl::MutexGuard aMutexGuard( m_aMutex );
+ rPara = m_aStrParams[ CMD_STRINGPARAM_CONVERSIONOUT ];
+ return m_aStrSetParams[ CMD_STRINGPARAM_CONVERSIONOUT ];
+}
+
+
+
sal_Bool CommandLineArgs::IsEmpty() const
{
osl::MutexGuard aMutexGuard( m_aMutex );
diff --git a/desktop/source/app/cmdlineargs.hxx b/desktop/source/app/cmdlineargs.hxx
index 569dd5ccbc..f357dad523 100644
--- a/desktop/source/app/cmdlineargs.hxx
+++ b/desktop/source/app/cmdlineargs.hxx
@@ -90,6 +90,10 @@ class CommandLineArgs
CMD_STRINGPARAM_VERSION,
CMD_STRINGPARAM_PRINTTOLIST,
CMD_STRINGPARAM_PRINTERNAME,
+ CMD_STRINGPARAM_CONVERSIONLIST,
+ CMD_STRINGPARAM_CONVERSIONPARAMS,
+ CMD_STRINGPARAM_CONVERSIONOUT,
+ CMD_STRINGPARAM_INFILTER,
CMD_STRINGPARAM_DISPLAY,
CMD_STRINGPARAM_LANGUAGE,
CMD_STRINGPARAM_COUNT // must be last element!
@@ -169,6 +173,10 @@ class CommandLineArgs
sal_Bool GetPrintToList( ::rtl::OUString& rPara ) const;
sal_Bool GetPrinterName( ::rtl::OUString& rPara ) const;
sal_Bool GetLanguage( ::rtl::OUString& rPara ) const;
+ sal_Bool GetInFilter( ::rtl::OUString& rPara ) const;
+ sal_Bool GetConversionList( ::rtl::OUString& rPara ) const;
+ sal_Bool GetConversionParams( ::rtl::OUString& rPara ) const;
+ sal_Bool GetConversionOut( ::rtl::OUString& rPara ) const;
// Special analyzed states (does not match directly to a command line parameter!)
sal_Bool IsPrinting() const;
diff --git a/desktop/source/app/cmdlinehelp.cxx b/desktop/source/app/cmdlinehelp.cxx
index 8af72e63ec..0869565ce7 100644
--- a/desktop/source/app/cmdlinehelp.cxx
+++ b/desktop/source/app/cmdlinehelp.cxx
@@ -116,7 +116,20 @@ namespace desktop
"-unaccept=<accept-string>\n"\
" Close an acceptor that was created with -accept=<accept-string>\n"\
" Use -unnaccept=all to close all open acceptors\n"\
- "Remaining arguments will be treated as filenames or URLs of documents to open.\n";
+ "-infilter=<filter>\n"\
+ " Force an input filter type if possible\n"\
+ " Eg. -infilter=\"Calc Office Open XML\"\n"\
+ "-convert-to output_file_extension[:output_filter_name] [-outdir ouput_dir] files\n"\
+ " Batch convert files.\n"\
+ " If -outdir is not specified then current working dir is used as output_dir.\n"\
+ " Eg. -convert-to pdf *.doc\n"\
+ " -convert-to pdf:writer_pdf_Export -outdir /home/user *.doc\n"\
+ "-print-to-file [-printer-name printer_name] [-outdir ouput_dir] files\n"\
+ " Batch print files to file.\n"\
+ " If -outdir is not specified then current working dir is used as output_dir.\n"\
+ " Eg. -print-to-file *.doc\n"\
+ " -print-to-file -printer-name nasty_lowres_printer -outdir /home/user *.doc\n"\
+ "\nRemaining arguments will be treated as filenames or URLs of documents to open.\n";
void ReplaceStringHookProc( UniString& rStr );
diff --git a/desktop/source/app/dispatchwatcher.cxx b/desktop/source/app/dispatchwatcher.cxx
index e6383e32bd..e2a6429a3b 100644
--- a/desktop/source/app/dispatchwatcher.cxx
+++ b/desktop/source/app/dispatchwatcher.cxx
@@ -28,6 +28,12 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_desktop.hxx"
+#include <sfx2/docfile.hxx>
+#include <sfx2/docfilt.hxx>
+#include <sfx2/fcontnr.hxx>
+#include "osl/file.hxx"
+#include <svl/fstathelper.hxx>
+
#include "dispatchwatcher.hxx"
#include <rtl/ustring.hxx>
#include <tools/string.hxx>
@@ -48,13 +54,15 @@
#include <com/sun/star/util/XURLTransformer.hpp>
#include <com/sun/star/document/MacroExecMode.hpp>
#include <com/sun/star/document/UpdateDocMode.hpp>
+#include <com/sun/star/frame/XStorable.hpp>
#include <tools/urlobj.hxx>
#include <comphelper/mediadescriptor.hxx>
#include <vector>
+#include <osl/thread.hxx>
-using namespace ::rtl;
+using ::rtl::OUString;
using namespace ::osl;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::util;
@@ -80,6 +88,42 @@ struct DispatchHolder
Reference< XDispatch > xDispatch;
};
+// Temporary code
+static void impl_sleep( sal_uInt32 nSec )
+{
+ TimeValue aTime;
+ aTime.Seconds = nSec;
+ aTime.Nanosec = 0;
+
+ osl::Thread::wait( aTime );
+}
+
+static String impl_GetFilterFromExt( OUString aUrl, SfxFilterFlags nFlags,
+ String aAppl )
+{
+ String aFilter;
+ SfxMedium* pMedium = new SfxMedium( aUrl,
+ STREAM_STD_READ, FALSE );
+ const SfxFilter *pSfxFilter = NULL;
+ SfxFilterMatcher aMatcher;
+ if( nFlags == SFX_FILTER_EXPORT )
+ aMatcher = SfxFilterMatcher( aAppl );
+ aMatcher.GuessFilterIgnoringContent( *pMedium, &pSfxFilter, nFlags, 0 );
+ if( pSfxFilter )
+ aFilter = ( nFlags == SFX_FILTER_EXPORT ) ? pSfxFilter->GetFilterName() :
+ pSfxFilter->GetServiceName();
+
+ delete pMedium;
+ return aFilter;
+}
+static OUString impl_GuessFilter( OUString aUrlIn, OUString aUrlOut )
+{
+ /* aAppl can also be set to Factory like scalc, swriter... */
+ String aAppl;
+ aAppl = impl_GetFilterFromExt( aUrlIn, SFX_FILTER_IMPORT, aAppl );
+ return impl_GetFilterFromExt( aUrlOut, SFX_FILTER_EXPORT, aAppl );
+}
+
Mutex* DispatchWatcher::pWatcherMutex = NULL;
Mutex& DispatchWatcher::GetMutex()
@@ -138,10 +182,11 @@ sal_Bool DispatchWatcher::executeDispatchRequests( const DispatchList& aDispatch
DispatchList::const_iterator p;
std::vector< DispatchHolder > aDispatches;
::rtl::OUString aAsTemplateArg( RTL_CONSTASCII_USTRINGPARAM( "AsTemplate"));
+ sal_Bool bSetInputFilter = sal_False;
+ ::rtl::OUString aForcedInputFilter;
for ( p = aDispatchRequestsList.begin(); p != aDispatchRequestsList.end(); p++ )
{
- String aPrinterName;
const DispatchRequest& aDispatchRequest = *p;
// create parameter array
@@ -149,9 +194,20 @@ sal_Bool DispatchWatcher::executeDispatchRequests( const DispatchList& aDispatch
if ( aDispatchRequest.aPreselectedFactory.getLength() )
nCount++;
+ // Set Input Filter
+ if ( aDispatchRequest.aRequestType == REQUEST_INFILTER )
+ {
+ bSetInputFilter = sal_True;
+ aForcedInputFilter = aDispatchRequest.aURL;
+ OfficeIPCThread::RequestsCompleted( 1 );
+ continue;
+ }
+
// we need more properties for a print/print to request
if ( aDispatchRequest.aRequestType == REQUEST_PRINT ||
- aDispatchRequest.aRequestType == REQUEST_PRINTTO )
+ aDispatchRequest.aRequestType == REQUEST_PRINTTO ||
+ aDispatchRequest.aRequestType == REQUEST_BATCHPRINT ||
+ aDispatchRequest.aRequestType == REQUEST_CONVERSION)
nCount++;
Sequence < PropertyValue > aArgs( nCount );
@@ -161,7 +217,9 @@ sal_Bool DispatchWatcher::executeDispatchRequests( const DispatchList& aDispatch
aArgs[0].Value <<= ::rtl::OUString::createFromAscii("private:OpenEvent");
if ( aDispatchRequest.aRequestType == REQUEST_PRINT ||
- aDispatchRequest.aRequestType == REQUEST_PRINTTO )
+ aDispatchRequest.aRequestType == REQUEST_PRINTTO ||
+ aDispatchRequest.aRequestType == REQUEST_BATCHPRINT ||
+ aDispatchRequest.aRequestType == REQUEST_CONVERSION)
{
aArgs[1].Name = ::rtl::OUString::createFromAscii("ReadOnly");
aArgs[2].Name = ::rtl::OUString::createFromAscii("OpenNewView");
@@ -196,7 +254,9 @@ sal_Bool DispatchWatcher::executeDispatchRequests( const DispatchList& aDispatch
::rtl::OUString aTarget( RTL_CONSTASCII_USTRINGPARAM("_default") );
if ( aDispatchRequest.aRequestType == REQUEST_PRINT ||
- aDispatchRequest.aRequestType == REQUEST_PRINTTO )
+ aDispatchRequest.aRequestType == REQUEST_PRINTTO ||
+ aDispatchRequest.aRequestType == REQUEST_BATCHPRINT ||
+ aDispatchRequest.aRequestType == REQUEST_CONVERSION)
{
// documents opened for printing are opened readonly because they must be opened as a new document and this
// document could be open already
@@ -214,7 +274,6 @@ sal_Bool DispatchWatcher::executeDispatchRequests( const DispatchList& aDispatch
// hidden documents should never be put into open tasks
aTarget = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("_blank") );
}
-
// load the document ... if they are loadable!
// Otherwise try to dispatch it ...
Reference < XPrintable > xDoc;
@@ -330,8 +389,16 @@ sal_Bool DispatchWatcher::executeDispatchRequests( const DispatchList& aDispatch
aArgs[nIndex].Value <<= sal_True;
}
- // This is a synchron loading of a component so we don't have to deal with our statusChanged listener mechanism.
+ // Force input filter, if possible
+ if( bSetInputFilter )
+ {
+ sal_Int32 nIndex = aArgs.getLength();
+ aArgs.realloc(nIndex+1);
+ aArgs[nIndex].Name=OUString::createFromAscii("FilterName");
+ aArgs[nIndex].Value <<= aForcedInputFilter;
+ }
+ // This is a synchron loading of a component so we don't have to deal with our statusChanged listener mechanism.
try
{
xDoc = Reference < XPrintable >( ::comphelper::SynchronousDispatch::dispatch( xDesktop, aName, aTarget, 0, aArgs ), UNO_QUERY );
@@ -361,24 +428,133 @@ sal_Bool DispatchWatcher::executeDispatchRequests( const DispatchList& aDispatch
OfficeIPCThread::RequestsCompleted( 1 );
}
else if ( aDispatchRequest.aRequestType == REQUEST_PRINT ||
- aDispatchRequest.aRequestType == REQUEST_PRINTTO )
+ aDispatchRequest.aRequestType == REQUEST_PRINTTO ||
+ aDispatchRequest.aRequestType == REQUEST_BATCHPRINT ||
+ aDispatchRequest.aRequestType == REQUEST_CONVERSION )
{
if ( xDoc.is() )
{
- if ( aDispatchRequest.aRequestType == REQUEST_PRINTTO )
- {
- // create the printer
+ if ( aDispatchRequest.aRequestType == REQUEST_CONVERSION ) {
+ Reference< XStorable > xStorable( xDoc, UNO_QUERY );
+ if ( xStorable.is() ) {
+ rtl::OUString aParam = aDispatchRequest.aPrinterName;
+ sal_Int32 nPathIndex = aParam.lastIndexOfAsciiL( ";", 1 );
+ sal_Int32 nFilterIndex = aParam.indexOfAsciiL( ":", 1 );
+ if( nPathIndex < nFilterIndex )
+ nFilterIndex = -1;
+ rtl::OUString aFilterOut=aParam.copy( nPathIndex+1 );
+ rtl::OUString aFilter;
+ rtl::OUString aFilterExt;
+ sal_Bool bGuess = sal_False;
+
+ if( nFilterIndex >= 0 )
+ {
+ aFilter = aParam.copy( nFilterIndex+1, nPathIndex-nFilterIndex-1 );
+ aFilterExt = aParam.copy( 0, nFilterIndex );
+ }
+ else
+ {
+ // Guess
+ bGuess = sal_True;
+ aFilterExt = aParam.copy( 0, nPathIndex );
+ }
+ INetURLObject aOutFilename( aObj );
+ aOutFilename.SetExtension( aFilterExt );
+ FileBase::getFileURLFromSystemPath( aFilterOut, aFilterOut );
+ rtl::OUString aOutFile = aFilterOut+
+ ::rtl::OUString::createFromAscii( "/" )+
+ aOutFilename.getName();
+ //FileBase::getFileURLFromSystemPath( aOutFile, aOutFile );
+
+ if ( bGuess )
+ {
+ aFilter = impl_GuessFilter( aName, aOutFile );
+ }
+
+ Sequence<PropertyValue> conversionProperties( 2 );
+ conversionProperties[0].Name = ::rtl::OUString::createFromAscii( "Overwrite" );
+ conversionProperties[0].Value <<= sal_True;
+
+ conversionProperties[1].Name = ::rtl::OUString::createFromAscii( "FilterName" );
+ conversionProperties[1].Value <<= aFilter;
+
+ rtl::OUString aTempName;
+ FileBase::getSystemPathFromFileURL( aName, aTempName );
+ rtl::OString aSource8 = ::rtl::OUStringToOString ( aTempName, RTL_TEXTENCODING_UTF8 );
+ FileBase::getSystemPathFromFileURL( aOutFile, aTempName );
+ rtl::OString aTargetURL8 = ::rtl::OUStringToOString(aTempName, RTL_TEXTENCODING_UTF8 );
+ printf("convert %s -> %s using %s\n", aSource8.getStr(), aTargetURL8.getStr(),
+ ::rtl::OUStringToOString( aFilter, RTL_TEXTENCODING_UTF8 ).getStr());
+ if( FStatHelper::IsDocument(aOutFile) )
+ printf("Overwriting: %s\n",::rtl::OUStringToOString( aTempName, RTL_TEXTENCODING_UTF8 ).getStr() );
+ try
+ {
+ xStorable->storeToURL( aOutFile, conversionProperties );
+ }
+ catch ( Exception& )
+ {
+ fprintf( stderr, "Error: Please reverify input parameters...\n" );
+ }
+ }
+ } else if ( aDispatchRequest.aRequestType == REQUEST_BATCHPRINT ) {
+ rtl::OUString aParam = aDispatchRequest.aPrinterName;
+ sal_Int32 nPathIndex = aParam.lastIndexOfAsciiL( ";", 1 );
+
+ rtl::OUString aFilterOut;
+ rtl::OUString aPrinterName;
+ if( nPathIndex != -1 )
+ aFilterOut=aParam.copy( nPathIndex+1 );
+ if( nPathIndex != 0 )
+ aPrinterName=aParam.copy( 0, nPathIndex );
+
+ INetURLObject aOutFilename( aObj );
+ aOutFilename.SetExtension( ::rtl::OUString::createFromAscii("ps") );
+ FileBase::getFileURLFromSystemPath( aFilterOut, aFilterOut );
+ rtl::OUString aOutFile = aFilterOut+
+ ::rtl::OUString::createFromAscii( "/" )+
+ aOutFilename.getName();
+
+ rtl::OUString aTempName;
+ FileBase::getSystemPathFromFileURL( aName, aTempName );
+ rtl::OString aSource8 = ::rtl::OUStringToOString ( aTempName, RTL_TEXTENCODING_UTF8 );
+ FileBase::getSystemPathFromFileURL( aOutFile, aTempName );
+ rtl::OString aTargetURL8 = ::rtl::OUStringToOString(aTempName, RTL_TEXTENCODING_UTF8 );
+ printf("print %s -> %s using %s\n", aSource8.getStr(), aTargetURL8.getStr(),
+ aPrinterName.getLength() ?
+ ::rtl::OUStringToOString( aPrinterName, RTL_TEXTENCODING_UTF8 ).getStr() : "<default_printer>");
+
+ // create the custom printer, if given
+ Sequence < PropertyValue > aPrinterArgs( 1 );
+ if( aPrinterName.getLength() )
+ {
+ aPrinterArgs[0].Name = ::rtl::OUString::createFromAscii("Name");
+ aPrinterArgs[0].Value <<= aPrinterName;
+ xDoc->setPrinter( aPrinterArgs );
+ }
+
+ // print ( also without user interaction )
+ aPrinterArgs.realloc(2);
+ aPrinterArgs[0].Name = ::rtl::OUString::createFromAscii("FileName");
+ aPrinterArgs[0].Value <<= aOutFile;
+ aPrinterArgs[1].Name = ::rtl::OUString::createFromAscii("Wait");
+ aPrinterArgs[1].Value <<= ( sal_Bool ) sal_True;
+ xDoc->print( aPrinterArgs );
+ } else {
+ if ( aDispatchRequest.aRequestType == REQUEST_PRINTTO )
+ {
+ // create the printer
+ Sequence < PropertyValue > aPrinterArgs( 1 );
+ aPrinterArgs[0].Name = ::rtl::OUString::createFromAscii("Name");
+ aPrinterArgs[0].Value <<= ::rtl::OUString( aDispatchRequest.aPrinterName );
+ xDoc->setPrinter( aPrinterArgs );
+ }
+
+ // print ( also without user interaction )
Sequence < PropertyValue > aPrinterArgs( 1 );
- aPrinterArgs[0].Name = ::rtl::OUString::createFromAscii("Name");
- aPrinterArgs[0].Value <<= ::rtl::OUString( aDispatchRequest.aPrinterName );
- xDoc->setPrinter( aPrinterArgs );
+ aPrinterArgs[0].Name = ::rtl::OUString::createFromAscii("Wait");
+ aPrinterArgs[0].Value <<= ( sal_Bool ) sal_True;
+ xDoc->print( aPrinterArgs );
}
-
- // print ( also without user interaction )
- Sequence < PropertyValue > aPrinterArgs( 1 );
- aPrinterArgs[0].Name = ::rtl::OUString::createFromAscii("Wait");
- aPrinterArgs[0].Value <<= ( sal_Bool ) sal_True;
- xDoc->print( aPrinterArgs );
}
else
{
@@ -442,10 +618,16 @@ sal_Bool DispatchWatcher::executeDispatchRequests( const DispatchList& aDispatch
// implementation via statusChanged!!
if ( bEmpty && !bNoTerminate /*m_aRequestContainer.empty()*/ )
{
+ // Delay give a chance for threads to complete work
+ impl_sleep(2);
+
// We have to check if we have an open task otherwise we have to shutdown the office.
Reference< XFramesSupplier > xTasksSupplier( xDesktop, UNO_QUERY );
aGuard.clear();
+ // Delay give a chance for threads to complete work
+ impl_sleep(1);
+
Reference< XElementAccess > xList( xTasksSupplier->getFrames(), UNO_QUERY );
if ( !xList->hasElements() )
@@ -470,7 +652,7 @@ throw(::com::sun::star::uno::RuntimeException)
void SAL_CALL DispatchWatcher::dispatchFinished( const DispatchResultEvent& ) throw( RuntimeException )
{
osl::ClearableMutexGuard aGuard( GetMutex() );
- sal_Int16 nCount = --m_nRequestCount;
+ sal_Int16 nCount = m_nRequestCount;
aGuard.clear();
OfficeIPCThread::RequestsCompleted( 1 );
/*
diff --git a/desktop/source/app/dispatchwatcher.hxx b/desktop/source/app/dispatchwatcher.hxx
index f7de7ae0df..cbcb90057c 100644
--- a/desktop/source/app/dispatchwatcher.hxx
+++ b/desktop/source/app/dispatchwatcher.hxx
@@ -75,7 +75,10 @@ class DispatchWatcher : public ::cppu::WeakImplHelper1< ::com::sun::star::frame:
REQUEST_PRINT,
REQUEST_PRINTTO,
REQUEST_FORCEOPEN,
- REQUEST_FORCENEW
+ REQUEST_FORCENEW,
+ REQUEST_CONVERSION,
+ REQUEST_INFILTER,
+ REQUEST_BATCHPRINT
};
struct DispatchRequest
@@ -86,7 +89,7 @@ class DispatchWatcher : public ::cppu::WeakImplHelper1< ::com::sun::star::frame:
RequestType aRequestType;
rtl::OUString aURL;
boost::optional< rtl::OUString > aCwdUrl;
- rtl::OUString aPrinterName;
+ rtl::OUString aPrinterName; // also conversion params
rtl::OUString aPreselectedFactory;
};
diff --git a/desktop/source/app/officeipcthread.cxx b/desktop/source/app/officeipcthread.cxx
index 0bd9db40de..b86d9452f2 100644
--- a/desktop/source/app/officeipcthread.cxx
+++ b/desktop/source/app/officeipcthread.cxx
@@ -51,6 +51,7 @@
#include "osl/file.hxx"
#include "rtl/process.h"
#include "tools/getprocessworkingdir.hxx"
+#include "osl/file.hxx"
using namespace vos;
using namespace rtl;
@@ -945,6 +946,62 @@ static void AddToDispatchList(
}
}
+static void AddConversionsToDispatchList(
+ DispatchWatcher::DispatchList& rDispatchList,
+ boost::optional< rtl::OUString > const & cwdUrl,
+ const OUString& rRequestList,
+ const OUString& rParam,
+ const OUString& rPrinterName,
+ const OUString& rFactory,
+ const OUString& rParamOut )
+{
+ DispatchWatcher::RequestType nType;
+ OUString aParam( rParam );
+
+ if( rParam.getLength() )
+ {
+ nType = DispatchWatcher::REQUEST_CONVERSION;
+ aParam = rParam;
+ }
+ else
+ {
+ nType = DispatchWatcher::REQUEST_BATCHPRINT;
+ aParam = rPrinterName;
+ }
+
+ OUString aOutDir( rParamOut.trim() );
+ ::rtl::OUString aPWD;
+ ::tools::getProcessWorkingDir( &aPWD );
+
+ if( !::osl::FileBase::getAbsoluteFileURL( aPWD, rParamOut, aOutDir ) )
+ ::osl::FileBase::getSystemPathFromFileURL( aOutDir, aOutDir );
+
+ if( rParamOut.trim().getLength() )
+ {
+ aParam += ::rtl::OUString::createFromAscii(";");
+ aParam += aOutDir;
+ }
+ else
+ {
+ ::osl::FileBase::getSystemPathFromFileURL( aPWD, aPWD );
+ aParam += ::rtl::OUString::createFromAscii( ";" ) + aPWD;
+ }
+
+ if ( rRequestList.getLength() > 0 )
+ {
+ sal_Int32 nIndex = 0;
+ do
+ {
+ OUString aToken = rRequestList.getToken( 0, APPEVENT_PARAM_DELIMITER, nIndex );
+ if ( aToken.getLength() > 0 )
+ rDispatchList.push_back(
+ DispatchWatcher::DispatchRequest( nType, aToken, cwdUrl, aParam, rFactory ));
+ }
+ while ( nIndex >= 0 );
+ }
+}
+
+
sal_Bool OfficeIPCThread::ExecuteCmdLineRequests( ProcessDocumentsRequest& aRequest )
{
// protect the dispatch list
@@ -954,6 +1011,7 @@ sal_Bool OfficeIPCThread::ExecuteCmdLineRequests( ProcessDocumentsRequest& aRequ
rtl::OUString aEmpty;
// Create dispatch list for dispatch watcher
+ AddToDispatchList( aDispatchList, aRequest.aCwdUrl, aRequest.aInFilter, DispatchWatcher::REQUEST_INFILTER, aEmpty, aRequest.aModule );
AddToDispatchList( aDispatchList, aRequest.aCwdUrl, aRequest.aOpenList, DispatchWatcher::REQUEST_OPEN, aEmpty, aRequest.aModule );
AddToDispatchList( aDispatchList, aRequest.aCwdUrl, aRequest.aViewList, DispatchWatcher::REQUEST_VIEW, aEmpty, aRequest.aModule );
AddToDispatchList( aDispatchList, aRequest.aCwdUrl, aRequest.aStartList, DispatchWatcher::REQUEST_START, aEmpty, aRequest.aModule );
@@ -961,7 +1019,7 @@ sal_Bool OfficeIPCThread::ExecuteCmdLineRequests( ProcessDocumentsRequest& aRequ
AddToDispatchList( aDispatchList, aRequest.aCwdUrl, aRequest.aPrintToList, DispatchWatcher::REQUEST_PRINTTO, aRequest.aPrinterName, aRequest.aModule );
AddToDispatchList( aDispatchList, aRequest.aCwdUrl, aRequest.aForceOpenList, DispatchWatcher::REQUEST_FORCEOPEN, aEmpty, aRequest.aModule );
AddToDispatchList( aDispatchList, aRequest.aCwdUrl, aRequest.aForceNewList, DispatchWatcher::REQUEST_FORCENEW, aEmpty, aRequest.aModule );
-
+ AddConversionsToDispatchList( aDispatchList, aRequest.aCwdUrl, aRequest.aConversionList, aRequest.aConversionParams, aRequest.aPrinterName, aRequest.aModule, aRequest.aConversionOut );
sal_Bool bShutdown( sal_False );
if ( pGlobalOfficeIPCThread )
diff --git a/desktop/source/app/officeipcthread.hxx b/desktop/source/app/officeipcthread.hxx
index 92a35a5ff7..fe61c935f9 100644
--- a/desktop/source/app/officeipcthread.hxx
+++ b/desktop/source/app/officeipcthread.hxx
@@ -66,6 +66,10 @@ struct ProcessDocumentsRequest
::rtl::OUString aForceNewList; // Documents that should be forced to create a new document
::rtl::OUString aPrinterName; // The printer name that should be used for printing
::rtl::OUString aPrintToList; // Documents that should be printed on the given printer
+ ::rtl::OUString aConversionList;
+ ::rtl::OUString aConversionParams;
+ ::rtl::OUString aConversionOut;
+ ::rtl::OUString aInFilter;
::osl::Condition *pcProcessed; // pointer condition to be set when the request has been processed
};
diff --git a/fpicker/prj/build.lst b/fpicker/prj/build.lst
index 434f22660f..04872c5354 100644
--- a/fpicker/prj/build.lst
+++ b/fpicker/prj/build.lst
@@ -2,10 +2,13 @@ fp fpicker : l10n 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 7c4e0bf602..33035f34c7 100644
--- a/fpicker/prj/d.lst
+++ b/fpicker/prj/d.lst
@@ -4,6 +4,7 @@ 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
@@ -12,3 +13,4 @@ mkdir: %COMMON_DEST%\bin%_EXT%\hid
..\source\unx\gnome\fps-gnome-ucd.txt %_DEST%\bin%_EXT%\fps-gnome-ucd.txt
..\source\unx\kde4\fps-kde4-ucd.txt %_DEST%\bin%_EXT%\fps-kde4-ucd.txt
..\source\aqua\fps-aqua-ucd.txt %_DEST%\bin%_EXT%\fps-aqua-ucd.txt
+..\source\unx\kde_unx\fps-kde-ucd.txt %_DEST%\bin%_EXT%\fps-kde-ucd.txt
diff --git a/fpicker/source/generic/fpicker.cxx b/fpicker/source/generic/fpicker.cxx
index 980c04513b..2498066c78 100644
--- a/fpicker/source/generic/fpicker.cxx
+++ b/fpicker/source/generic/fpicker.cxx
@@ -34,6 +34,13 @@
#include "cppuhelper/implementationentry.hxx"
#endif
#include "com/sun/star/lang/XMultiComponentFactory.hpp"
+
+#ifdef WNT
+#include <tools/prewin.h>
+#include <tools/postwin.h>
+#include <odma_lib.hxx>
+#endif
+
#include "svtools/miscopt.hxx"
#include "svl/pickerhistoryaccess.hxx"
@@ -52,6 +59,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 +69,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 +137,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 (
diff --git a/fpicker/source/generic/makefile.mk b/fpicker/source/generic/makefile.mk
index bfbfb65f3d..f426bd7ad7 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 0000000000..09eb01b737
--- /dev/null
+++ b/fpicker/source/odma/ODMAFilePicker.cxx
@@ -0,0 +1,532 @@
+/*************************************************************************
+ *
+ * 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 <tools/prewin.h>
+#include <tools/postwin.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::createFromAscii( "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);
+}
+
+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) GetActiveWindow( ), 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::createFromAscii( "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::createFromAscii( "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::createFromAscii( "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::createFromAscii( "com.sun.star.ui.dialogs.SystemFilePicker" );
+ return seqServiceNames ;
+}
+
+rtl::OUString ODMAFilePicker::impl_getStaticImplementationName( )
+{
+ return rtl::OUString::createFromAscii( "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 ) );
+}
diff --git a/fpicker/source/odma/ODMAFilePicker.hxx b/fpicker/source/odma/ODMAFilePicker.hxx
new file mode 100644
index 0000000000..42c644b0ae
--- /dev/null
+++ b/fpicker/source/odma/ODMAFilePicker.hxx
@@ -0,0 +1,213 @@
+/*************************************************************************
+ *
+ * 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
diff --git a/fpicker/source/odma/ODMAFolderPicker.cxx b/fpicker/source/odma/ODMAFolderPicker.cxx
new file mode 100644
index 0000000000..d8304a27b6
--- /dev/null
+++ b/fpicker/source/odma/ODMAFolderPicker.cxx
@@ -0,0 +1,182 @@
+/*************************************************************************
+ *
+ * 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 <tools/prewin.h>
+#include <odma_lib.hxx>
+#include <tools/postwin.h>
+#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::createFromAscii( "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::createFromAscii( "com.sun.star.ui.dialogs.ODMAFolderPicker" );
+ return seqServiceNames ;
+}
+
+::rtl::OUString ODMAFolderPicker::impl_getStaticImplementationName( )
+{
+ return ::rtl::OUString::createFromAscii( "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 ) );
+}
diff --git a/fpicker/source/odma/ODMAFolderPicker.hxx b/fpicker/source/odma/ODMAFolderPicker.hxx
new file mode 100644
index 0000000000..87db25ddb9
--- /dev/null
+++ b/fpicker/source/odma/ODMAFolderPicker.hxx
@@ -0,0 +1,100 @@
+/*************************************************************************
+ *
+ * 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
diff --git a/fpicker/source/odma/exports.map b/fpicker/source/odma/exports.map
new file mode 100644
index 0000000000..f4ed78b9e9
--- /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 0000000000..fefdcf07d3
--- /dev/null
+++ b/fpicker/source/odma/fps_odma.cxx
@@ -0,0 +1,78 @@
+/*************************************************************************
+ *
+ * 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"
diff --git a/fpicker/source/odma/makefile.mk b/fpicker/source/odma/makefile.mk
new file mode 100644
index 0000000000..3cc62d6f94
--- /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/unx/kde/kdecommandthread.cxx b/fpicker/source/unx/kde/kdecommandthread.cxx
new file mode 100644
index 0000000000..43e2a68ac8
--- /dev/null
+++ b/fpicker/source/unx/kde/kdecommandthread.cxx
@@ -0,0 +1,174 @@
+/*************************************************************************
+ *
+ * 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 <kdecommandthread.hxx>
+
+#include <qstringlist.h>
+
+#include <kapplication.h>
+
+#include <iostream>
+
+//////////////////////////////////////////////////////////////////////////
+// CommandEvent
+//////////////////////////////////////////////////////////////////////////
+
+CommandEvent::CommandEvent( 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
+//////////////////////////////////////////////////////////////////////////
+
+CommandThread::CommandThread( QWidget *pObject )
+ : m_pObject( pObject )
+{
+}
+
+CommandThread::~CommandThread()
+{
+}
+
+void CommandThread::run()
+{
+ QTextIStream qStream( stdin );
+ qStream.setEncoding( QTextStream::UnicodeUTF8 );
+
+ QString qLine;
+ bool bQuit = false;
+ while ( !bQuit && !qStream.atEnd() )
+ {
+ qLine = qStream.readLine();
+ handleCommand( qLine, bQuit );
+ }
+}
+
+void CommandThread::handleCommand( const QString &rString, bool &bQuit )
+{
+ QMutexLocker qMutexLocker( &m_aMutex );
+
+#if OSL_DEBUG_LEVEL > 0
+ ::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 CommandEvent( qCommand, pTokens ) );
+}
+
+QStringList* CommandThread::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;
+}
diff --git a/fpicker/source/unx/kde/kdecommandthread.hxx b/fpicker/source/unx/kde/kdecommandthread.hxx
new file mode 100644
index 0000000000..bfb0570ecd
--- /dev/null
+++ b/fpicker/source/unx/kde/kdecommandthread.hxx
@@ -0,0 +1,94 @@
+/*************************************************************************
+ *
+ * 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 CommandEvent : 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:
+ CommandEvent( const QString &qCommand, QStringList *pStringList );
+
+ CommandEventType command() const { return m_eCommand; }
+ QStringList* stringList() { return static_cast< QStringList* >( data() ); }
+};
+
+class CommandThread : public QThread
+{
+protected:
+ QObject *m_pObject;
+
+ QMutex m_aMutex;
+
+public:
+ CommandThread( QWidget *pObject );
+ virtual ~CommandThread();
+
+ virtual void run();
+
+protected:
+ void handleCommand( const QString &rString, bool &bQuit );
+ QStringList* tokenize( const QString &rString );
+};
+
+#endif // _KDECOMMANDTHREAD_HXX_
diff --git a/fpicker/source/unx/kde/kdefilepicker.cxx b/fpicker/source/unx/kde/kdefilepicker.cxx
new file mode 100644
index 0000000000..6af58dd8da
--- /dev/null
+++ b/fpicker/source/unx/kde/kdefilepicker.cxx
@@ -0,0 +1,729 @@
+/*************************************************************************
+ *
+ * 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 <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>
+
+//////////////////////////////////////////////////////////////////////////
+// FileDialog
+//////////////////////////////////////////////////////////////////////////
+
+FileDialog::FileDialog( 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();
+}
+
+FileDialog::~FileDialog()
+{
+}
+
+void FileDialog::resizeEvent( QResizeEvent *pEvent )
+{
+ KFileDialog::resizeEvent( pEvent );
+
+ updateCustomWidgetLayout();
+}
+
+void FileDialog::showEvent( QShowEvent *pEvent )
+{
+ KFileDialog::showEvent( pEvent );
+
+ updateCustomWidgetLayout();
+}
+
+void FileDialog::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 FileDialog::customEvent( QCustomEvent *pEvent )
+{
+ if ( pEvent && pEvent->type() == CommandEvent::TypeId )
+ {
+ CommandEvent *pCommandEvent = static_cast< CommandEvent* >( pEvent );
+ QStringList *pStringList = pCommandEvent->stringList();
+
+ int nListSize = -1;
+ if ( pStringList )
+ nListSize = pStringList->size();
+
+ switch ( pCommandEvent->command() )
+ {
+ case CommandEvent::AppendControl:
+ if ( nListSize >= 3 )
+ {
+ appendControl( (*pStringList)[0], (*pStringList)[1], (*pStringList)[2] );
+ }
+ break;
+ case CommandEvent::EnableControl:
+ if ( nListSize >= 2 )
+ {
+ enableControl( (*pStringList)[0], (*pStringList)[1] );
+ }
+ break;
+ case CommandEvent::GetValue:
+ if ( nListSize >= 2 )
+ {
+ getValue( (*pStringList)[0], (*pStringList)[1] );
+ }
+ break;
+ case CommandEvent::SetValue:
+ if ( nListSize >= 2 )
+ {
+ QStringList qStringList = (*pStringList);
+ qStringList.pop_front();
+ qStringList.pop_front();
+
+ setValue( (*pStringList)[0], (*pStringList)[1], qStringList );
+ }
+ break;
+ case CommandEvent::AppendFilter:
+ if ( nListSize >= 2 )
+ {
+ appendFilter( (*pStringList)[0], (*pStringList)[1] );
+
+ // update the filters widget
+ setFilter( filters() );
+ }
+ break;
+ case CommandEvent::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 CommandEvent::GetCurrentFilter:
+ {
+ QString qCurrentFilter = filterWidget->currentText();
+ sendCommand( "currentFilter " + escapeString( qCurrentFilter ) );
+ }
+ break;
+ case CommandEvent::SetCurrentFilter:
+ if ( nListSize >= 1 )
+ {
+ static_cast< FileFilterComboHack* >( filterWidget )->setCurrentFilter( pStringList->front() );
+ }
+ break;
+ case CommandEvent::GetDirectory:
+ {
+ QString qDirectory = baseURL().url();
+ if ( qDirectory.startsWith( "file:/" ) && qDirectory.mid( 6, 1 ) != "/" )
+ qDirectory.replace( "file:/", "file:///" );
+ sendCommand( "currentDirectory " + escapeString( qDirectory ) );
+ }
+ break;
+ case CommandEvent::SetDirectory:
+ if ( nListSize >= 1 )
+ {
+ setURL( pStringList->front() );
+ }
+ break;
+ case CommandEvent::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 CommandEvent::SetTitle:
+ if ( nListSize >= 1 )
+ {
+ setCaption( pStringList->front() );
+ }
+ break;
+ case CommandEvent::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 CommandEvent::SetDefaultName:
+ if ( nListSize >= 1 )
+ {
+ setKeepLocation( true );
+ setSelection( pStringList->front() );
+ }
+ break;
+ case CommandEvent::SetMultiSelection:
+ if ( nListSize >= 1 )
+ {
+ if ( pStringList->front() == "true" )
+ setMode( KFile::Files );
+ else
+ setMode( KFile::File );
+ }
+ break;
+ case CommandEvent::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 FileDialog::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* FileDialog::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 FileDialog::enableControl( const QString &rId, const QString &rValue )
+{
+ QWidget *pWidget = findControl( rId );
+
+ if ( pWidget )
+ pWidget->setEnabled( rValue.lower() == "true" );
+}
+
+void FileDialog::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 FileDialog::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 FileDialog::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 FileDialog::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 FileDialog::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 FileDialog::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 FileDialog::mostLocalURL( const KURL &rURL ) const
+{
+#if KDE_IS_VERSION(3,5,0)
+ KURL qMostLocalURL( KIO::NetAccess::mostLocalURL( rURL, const_cast<FileDialog*>( 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<FileDialog*>( this ) ) );
+ if ( qMostLocalPath.isLocalFile() )
+ {
+ qMostLocalPath.addPath( rURL.fileName() );
+ return qMostLocalPath;
+ }
+ }
+#endif
+
+ return rURL;
+}
+
+QString FileDialog::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 FileDialog::fileHighlightedCommand( const QString & )
+{
+ if ( canNotifySelection() )
+ {
+ sendCommand( "fileSelectionChanged" );
+ setCanNotifySelection( false );
+ }
+}
+
+void FileDialog::selectionChangedCommand()
+{
+ if ( canNotifySelection() )
+ {
+ sendCommand( "fileSelectionChanged" );
+ setCanNotifySelection( false );
+ }
+}
+
+void FileDialog::sendCommand( const QString &rCommand )
+{
+#if OSL_DEBUG_LEVEL > 0
+ ::std::cerr << "kdefilepicker sent: " << rCommand.latin1() << ::std::endl;
+#endif
+
+ //m_aOutputStream << rCommand << endl;
+ ::std::cout << rCommand.utf8() << ::std::endl;
+}
+
+void FileDialog::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 FileDialog::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 FileDialog::escapeString( const QString &rString )
+{
+ QString qString;
+ qString.reserve( 2*rString.length() + 2 ); // every char escaped + quotes
+
+ appendEscaped( qString, rString );
+
+ return qString;
+}
+
+
+void FileFilterComboHack::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();
+ }
+}
diff --git a/fpicker/source/unx/kde/kdefilepicker.hxx b/fpicker/source/unx/kde/kdefilepicker.hxx
new file mode 100644
index 0000000000..160fc1f6e5
--- /dev/null
+++ b/fpicker/source/unx/kde/kdefilepicker.hxx
@@ -0,0 +1,122 @@
+/*************************************************************************
+ *
+ * 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 <kfiledialog.h>
+#include <kfilefiltercombo.h>
+
+class QGrid;
+class QHBox;
+class QVBox;
+
+class FileDialog : 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:
+ FileDialog( const QString &startDir, const QString &filter,
+ QWidget *parent, const char *name );
+ virtual ~FileDialog();
+
+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 FileFilterComboHack : public KFileFilterCombo
+{
+public:
+ void setCurrentFilter( const QString& filter );
+};
+
+#endif // _KDEFILEPICKER_HXX_
diff --git a/fpicker/source/unx/kde/kdefpmain.cxx b/fpicker/source/unx/kde/kdefpmain.cxx
new file mode 100644
index 0000000000..201c389ddf
--- /dev/null
+++ b/fpicker/source/unx/kde/kdefpmain.cxx
@@ -0,0 +1,89 @@
+/*************************************************************************
+ *
+ * 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 <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();
+
+ ModalityFilter qModalityFilter( nWinId );
+
+ FileDialog aFileDialog( NULL, QString(), NULL, "kdefiledialog" );
+
+ CommandThread qCommandThread( &aFileDialog );
+ qCommandThread.start();
+
+ kApplication.exec();
+
+ qCommandThread.wait();
+
+ ::std::cout << "exited" << ::std::endl;
+
+ return 0;
+}
diff --git a/fpicker/source/unx/kde/kdemodalityfilter.cxx b/fpicker/source/unx/kde/kdemodalityfilter.cxx
new file mode 100644
index 0000000000..cf39da77eb
--- /dev/null
+++ b/fpicker/source/unx/kde/kdemodalityfilter.cxx
@@ -0,0 +1,64 @@
+/*************************************************************************
+ *
+ * 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 <kdemodalityfilter.hxx>
+
+#include <kapplication.h>
+#include <kdialogbase.h>
+
+#include <netwm.h>
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+
+//////////////////////////////////////////////////////////////////////////
+// Modality filter
+//////////////////////////////////////////////////////////////////////////
+
+ModalityFilter::ModalityFilter( WId nWinId )
+ : m_nWinId( nWinId )
+{
+ kapp->installEventFilter( this );
+}
+
+ModalityFilter::~ModalityFilter()
+{
+ kapp->removeEventFilter( this );
+}
+
+bool ModalityFilter::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;
+}
diff --git a/fpicker/source/unx/kde/kdemodalityfilter.hxx b/fpicker/source/unx/kde/kdemodalityfilter.hxx
new file mode 100644
index 0000000000..66b795364b
--- /dev/null
+++ b/fpicker/source/unx/kde/kdemodalityfilter.hxx
@@ -0,0 +1,45 @@
+/*************************************************************************
+ *
+ * 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 ModalityFilter : public QObject
+{
+private:
+ WId m_nWinId;
+
+public:
+ ModalityFilter( WId nWinId );
+ virtual ~ModalityFilter();
+
+ virtual bool eventFilter( QObject *pObject, QEvent *pEvent );
+};
+
+#endif // _KDEMODALITYFILTER_HXX_
diff --git a/fpicker/source/unx/kde/makefile.mk b/fpicker/source/unx/kde/makefile.mk
new file mode 100644
index 0000000000..03cfafbd3f
--- /dev/null
+++ b/fpicker/source/unx/kde/makefile.mk
@@ -0,0 +1,76 @@
+#*************************************************************************
+#
+# 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
+#COMP1TYPELIST=$(TARGET)
+#COMPRDB=$(SOLARBINDIR)$/types.rdb
+
+# --- 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
+APP1STDLIBS=\
+ $(SALLIB) \
+ $(KDE_LIBS) -lkio
+
+
+.ENDIF # "$(GUIBASE)" != "unx" || "$(ENABLE_KDE)" != "TRUE"
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
+$(MISC)$/kdefilepicker.moc.cxx : kdefilepicker.hxx
+ $(MOC) $< -o $@
diff --git a/fpicker/source/unx/kde_unx/FPServiceInfo.hxx b/fpicker/source/unx/kde_unx/FPServiceInfo.hxx
new file mode 100644
index 0000000000..e4ea5663e8
--- /dev/null
+++ b/fpicker/source/unx/kde_unx/FPServiceInfo.hxx
@@ -0,0 +1,44 @@
+/*************************************************************************
+ *
+ * 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
diff --git a/fpicker/source/unx/kde_unx/UnxCommandThread.cxx b/fpicker/source/unx/kde_unx/UnxCommandThread.cxx
new file mode 100644
index 0000000000..9f577d824a
--- /dev/null
+++ b/fpicker/source/unx/kde_unx/UnxCommandThread.cxx
@@ -0,0 +1,311 @@
+/*************************************************************************
+ *
+ * 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.equalsAscii( "accept" ) )
+ {
+ m_aResult = sal_True;
+ m_aExecCondition.set();
+ }
+ else if ( aCommandName.equalsAscii( "reject" ) )
+ {
+ m_aResult = sal_False;
+ m_aExecCondition.set();
+ }
+ else if ( aCommandName.equalsAscii( "fileSelectionChanged" ) )
+ {
+ if ( m_pNotifyThread )
+ m_pNotifyThread->fileSelectionChanged();
+ }
+ else if ( aCommandName.equalsAscii( "files" ) )
+ {
+ m_aGetFiles = aList;
+ m_aGetFilesCondition.set();
+ }
+ else if ( aCommandName.equalsAscii( "value" ) )
+ {
+ ::rtl::OUString aType;
+ if ( !aList.empty() )
+ {
+ aType = aList.front();
+ aList.pop_front();
+ }
+
+ if ( aType.equalsAscii( "bool" ) )
+ {
+ sal_Bool bValue = !aList.empty() && aList.front().equalsIgnoreAsciiCaseAscii( "true" );
+
+ m_aGetValue <<= bValue;
+ m_aGetValueCondition.set();
+ }
+ else if ( aType.equalsAscii( "int" ) )
+ {
+ sal_Int32 nValue = 0;
+ if ( !aList.empty() )
+ nValue = aList.front().toInt32();
+
+ m_aGetValue <<= nValue;
+ m_aGetValueCondition.set();
+ }
+ else if ( aType.equalsAscii( "string" ) )
+ {
+ ::rtl::OUString aValue;
+ if ( !aList.empty() )
+ aValue = aList.front();
+
+ m_aGetValue <<= aValue;
+ m_aGetValueCondition.set();
+ }
+ else if ( aType.equalsAscii( "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.equalsAscii( "currentFilter" ) )
+ {
+ m_aGetCurrentFilter = aList.empty()? ::rtl::OUString(): aList.front();
+ m_aGetCurrentFilterCondition.set();
+ }
+ else if ( aCommandName.equalsAscii( "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;
+}
diff --git a/fpicker/source/unx/kde_unx/UnxCommandThread.hxx b/fpicker/source/unx/kde_unx/UnxCommandThread.hxx
new file mode 100644
index 0000000000..db6b2c2af2
--- /dev/null
+++ b/fpicker/source/unx/kde_unx/UnxCommandThread.hxx
@@ -0,0 +1,132 @@
+/*************************************************************************
+ *
+ * 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_
diff --git a/fpicker/source/unx/kde_unx/UnxFPentry.cxx b/fpicker/source/unx/kde_unx/UnxFPentry.cxx
new file mode 100644
index 0000000000..24ecd5456d
--- /dev/null
+++ b/fpicker/source/unx/kde_unx/UnxFPentry.cxx
@@ -0,0 +1,124 @@
+/*************************************************************************
+ *
+ * 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::createFromAscii( FILE_PICKER_REGKEY_NAME ) );
+ }
+ catch( InvalidRegistryException& )
+ {
+ OSL_ENSURE( sal_False, "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::createFromAscii( 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"
diff --git a/fpicker/source/unx/kde_unx/UnxFilePicker.cxx b/fpicker/source/unx/kde_unx/UnxFilePicker.cxx
new file mode 100644
index 0000000000..d4028bf427
--- /dev/null
+++ b/fpicker/source/unx/kde_unx/UnxFilePicker.cxx
@@ -0,0 +1,928 @@
+/*************************************************************************
+ *
+ * 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 <rtl/ustring.hxx>
+#include <rtl/ustrbuf.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::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.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::createFromAscii( "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::createFromAscii( "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::createFromAscii( "setMultiSelection true" ):
+ ::rtl::OUString::createFromAscii( "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::createFromAscii( "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::createFromAscii( "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::createFromAscii( "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.equalsAscii( "checkbox" ) )
+ {
+ sal_Bool bControlValue;
+ if ( ( rValue >>= bControlValue ) && bControlValue )
+ aBuffer.appendAscii( " true" );
+ else
+ aBuffer.appendAscii( " false" );
+ }
+ else if ( aType.equalsAscii( "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::createFromAscii( "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::createFromAscii( "invalid argument type" ),
+ static_cast< XFilePicker* >( this ), 1 );
+
+ sal_Int16 templateId = -1;
+ aAny >>= templateId;
+
+ ::rtl::OUString aTypeOpen = ::rtl::OUString::createFromAscii( "setType \"open\"" );
+ ::rtl::OUString aTypeSaveAs = ::rtl::OUString::createFromAscii( "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::createFromAscii( "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::createFromAscii( 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
+ const char *pFname = "kdefilepicker";
+
+ // 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( pFname, pFname, "--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::createFromAscii( "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::createFromAscii( "\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() );
+ }
+}
diff --git a/fpicker/source/unx/kde_unx/UnxFilePicker.hxx b/fpicker/source/unx/kde_unx/UnxFilePicker.hxx
new file mode 100644
index 0000000000..107db3164f
--- /dev/null
+++ b/fpicker/source/unx/kde_unx/UnxFilePicker.hxx
@@ -0,0 +1,174 @@
+/*************************************************************************
+ *
+ * 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();
+
+ // 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_
diff --git a/fpicker/source/unx/kde_unx/UnxNotifyThread.cxx b/fpicker/source/unx/kde_unx/UnxNotifyThread.cxx
new file mode 100644
index 0000000000..6aedf3dc01
--- /dev/null
+++ b/fpicker/source/unx/kde_unx/UnxNotifyThread.cxx
@@ -0,0 +1,112 @@
+/*************************************************************************
+ *
+ * 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();
+}
diff --git a/fpicker/source/unx/kde_unx/UnxNotifyThread.hxx b/fpicker/source/unx/kde_unx/UnxNotifyThread.hxx
new file mode 100644
index 0000000000..206721b020
--- /dev/null
+++ b/fpicker/source/unx/kde_unx/UnxNotifyThread.hxx
@@ -0,0 +1,86 @@
+/*************************************************************************
+ *
+ * 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_
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 0000000000..28aa49d97b
--- /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 0000000000..99683bfeca
--- /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 0000000000..067399bf08
--- /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/framework/prj/build.lst b/framework/prj/build.lst
index 5c745e0907..2eb363b0f3 100644
--- a/framework/prj/build.lst
+++ b/framework/prj/build.lst
@@ -1,4 +1,4 @@
-fr framework : l10n svtools NULL
+fr framework : l10n svtools ucb NULL
fr framework usr1 - all fr_mkout NULL
fr framework\inc nmake - all fr_inc NULL
fr framework\source\constant nmake - all fr_constant fr_inc NULL
diff --git a/framework/source/uielement/recentfilesmenucontroller.cxx b/framework/source/uielement/recentfilesmenucontroller.cxx
index 56a220be98..a61cbf8823 100644
--- a/framework/source/uielement/recentfilesmenucontroller.cxx
+++ b/framework/source/uielement/recentfilesmenucontroller.cxx
@@ -61,6 +61,11 @@
#include <unotools/historyoptions.hxx>
#include <cppuhelper/implbase1.hxx>
#include <osl/file.hxx>
+#ifdef WNT
+#include <tools/prewin.h>
+#include <tools/postwin.h>
+#include <odma_lib.hxx>
+#endif
//#include <tools/solar.hrc>
#include <dispatch/uieventloghelper.hxx>
#include <vos/mutex.hxx>
@@ -210,6 +215,41 @@ void RecentFilesMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu >
else
aMenuTitle = aSystemPath;
}
+#ifdef WNT
+ else if ( aURL.GetProtocol() == INET_PROT_VND_SUN_STAR_ODMA && ::odma::DMSsAvailable ())
+ {
+ String aShortTitle = m_aRecentFilesItems.at( i ).aTitle;
+
+ // This is against all rules for using
+ // proper abstraction layers and whatnot.
+ // But figuring out how to do it "right"
+ // would have taken the whole week.
+ // So just call the odma_lib functions...
+ // (odma_lib is a thin layer on
+ // top of the ODMA32 DLL)
+
+ static ODMHANDLE handle = NULL;
+ static sal_Bool beenhere = sal_False;
+ ODMSTATUS status;
+
+ if ( ! beenhere )
+ {
+ status = NODMRegisterApp( &handle, ODM_API_VERSION, "sodma", NULL, NULL );
+ beenhere = sal_True;
+ }
+
+ if ( handle != NULL )
+ {
+ rtl::OUString s = aURL.GetMainURL( INetURLObject::DECODE_WITH_CHARSET, RTL_TEXTENCODING_MS_1252 );
+ s = s.copy( strlen ( "vnd.sun.star.odma:/" ) );
+ char title[47];
+ status = NODMGetDocInfo( handle, rtl::OUStringToOString( s, RTL_TEXTENCODING_MS_1252 ).pData->buffer, ODM_NAME, title, sizeof ( title ) );
+ aShortTitle = String::CreateFromAscii( title );
+ }
+ aMenuTitle += aShortTitle;
+ aTipHelpText = aURLString;
+ }
+#endif
else
{
// Use INetURLObject to abbreviate all other URLs
diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx
index e4cb7fd3ed..4a1f2fe984 100644
--- a/framework/source/uielement/toolbarmanager.cxx
+++ b/framework/source/uielement/toolbarmanager.cxx
@@ -256,7 +256,7 @@ ToolBarManager::ToolBarManager( const Reference< XMultiServiceFactory >& rServic
m_bUpdateControllers( sal_False ),
m_bImageOrientationRegistered( sal_False ),
m_bImageMirrored( sal_False ),
- m_bCanBeCustomized( sal_True ),
+ m_bCanBeCustomized( !SvtMiscOptions().DisableUICustomization() ),
m_lImageRotation( 0 ),
m_pToolBar( pToolBar ),
m_aResourceName( rResourceName ),
@@ -496,6 +496,24 @@ void ToolBarManager::UpdateControllers()
{
RTL_LOGFILE_CONTEXT( aLog, "framework (cd100003) ::ToolBarManager::UpdateControllers" );
+ if( !m_bCanBeCustomized )
+ {
+ Any a;
+ Reference< XLayoutManager > xLayoutManager;
+ Reference< XPropertySet > xFramePropSet( m_xFrame, UNO_QUERY );
+ if ( xFramePropSet.is() )
+ a = xFramePropSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" )));
+ a >>= xLayoutManager;
+ Reference< XDockableWindow > xDockable( VCLUnoHelper::GetInterface( m_pToolBar ), UNO_QUERY );
+ if ( xLayoutManager.is() && xDockable.is() )
+ {
+ ::com::sun::star::awt::Point aPoint;
+ aPoint.X = aPoint.Y = LONG_MAX;
+ xLayoutManager->dockWindow( m_aResourceName, DockingArea_DOCKINGAREA_DEFAULT, aPoint );
+ xLayoutManager->lockWindow( m_aResourceName );
+ }
+ }
+
if ( !m_bUpdateControllers )
{
m_bUpdateControllers = sal_True;
@@ -1805,6 +1823,7 @@ PopupMenu * ToolBarManager::GetToolBarCustomMeun(ToolBox* pToolBar)
// Non-configurable toolbars should disable configuration menu items
aPopupMenu.EnableItem( MENUITEM_TOOLBAR_VISIBLEBUTTON, sal_False );
aPopupMenu.EnableItem( MENUITEM_TOOLBAR_CUSTOMIZETOOLBAR, sal_False );
+ aPopupMenu.EnableItem( MENUITEM_TOOLBAR_LOCKTOOLBARPOSITION, sal_False );
}
// Disable menu item CLOSE if the toolbar has no closer
diff --git a/framework/source/uielement/toolbarsmenucontroller.cxx b/framework/source/uielement/toolbarsmenucontroller.cxx
index bb97a82ec8..d9ae3cfbe1 100644
--- a/framework/source/uielement/toolbarsmenucontroller.cxx
+++ b/framework/source/uielement/toolbarsmenucontroller.cxx
@@ -79,6 +79,7 @@
#include <unotools/cmdoptions.hxx>
#include <dispatch/uieventloghelper.hxx>
#include <rtl/logfile.hxx>
+#include <svtools/miscopt.hxx>
//_________________________________________________________________________________________________________________
// Defines
@@ -376,6 +377,9 @@ sal_Bool ToolbarsMenuController::isContextSensitiveToolbarNonVisible()
void ToolbarsMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu >& rPopupMenu )
{
+ if( SvtMiscOptions().DisableUICustomization() )
+ return;
+
vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
resetPopupMenu( rPopupMenu );
diff --git a/framework/util/makefile.mk b/framework/util/makefile.mk
index 91532cda76..4aee64439e 100644
--- a/framework/util/makefile.mk
+++ b/framework/util/makefile.mk
@@ -339,6 +339,7 @@ SHL4OBJS= \
$(SLO)$/startmoduledispatcher.obj
SHL4STDLIBS= \
+ $(ODMA_LIB_LIB) \
$(FWILIB) \
$(FWELIB) \
$(SVTOOLLIB) \
diff --git a/officecfg/registry/data/org/openoffice/ucb/Configuration.xcu b/officecfg/registry/data/org/openoffice/ucb/Configuration.xcu
index cdd6c2c294..d230087724 100644
--- a/officecfg/registry/data/org/openoffice/ucb/Configuration.xcu
+++ b/officecfg/registry/data/org/openoffice/ucb/Configuration.xcu
@@ -186,6 +186,17 @@
<value/>
</prop>
</node>
+ <node oor:name="Provider42" oor:op="replace">
+ <prop oor:name="ServiceName">
+ <value>com.sun.star.ucb.ODMAContentProvider</value>
+ </prop>
+ <prop oor:name="URLTemplate">
+ <value>vnd.sun.star.odma</value>
+ </prop>
+ <prop oor:name="Arguments">
+ <value/>
+ </prop>
+ </node>
<!-- We want the Provider to be the final fallback provider -->
<node oor:name="Provider999" oor:op="replace" install:module="gio">
<prop oor:name="ServiceName">
diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index 02e05a9329..7e02dcec79 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -5752,6 +5752,15 @@
</info>
<value>true</value>
</prop>
+ <prop oor:name="ShowLinkWarningDialog" oor:type="xs:boolean">
+ <info>
+ <author>THB</author>
+ <desc>Determines if a warning dialog should be
+ displayed when a user checks the link checkbox in
+ the insert graphics dialog.</desc>
+ </info>
+ <value>true</value>
+ </prop>
<prop oor:name="UseSystemPrintDialog" oor:type="xs:boolean">
<info>
<author>PL</author>
@@ -5759,6 +5768,20 @@
</info>
<value>false</value>
</prop>
+ <prop oor:name="TryODMADialog" oor:type="xs:boolean">
+ <info>
+ <author>tml</author>
+ <desc>Determines whether to show the document creation and selection of the machine's default ODMA (Open Document Management Architecture) DMS (Document Management System). If true, and the machine has a DMS available, the DMS's dialog will be displayed. That dialog then gives the opportunity to use the application's dialog instead, which means the normal system file and folder pickers will be displayed. Relevant only on Windows.</desc>
+ </info>
+ <value>false</value>
+ </prop>
+ <prop oor:name="DisableUICustomization" oor:type="xs:boolean">
+ <info>
+ <author>RSiddhartha</author>
+ <desc>Disables the customization of the UI elements.</desc>
+ </info>
+ <value>false</value>
+ </prop>
<prop oor:name="SymbolSet" oor:type="xs:short">
<!-- UIHints: Tools Options General View -->
<info>
@@ -5773,11 +5796,11 @@
</enumeration>
<enumeration oor:value="1">
<info>
- <desc>32x32 pixel icons</desc>
+ <desc>larger icons</desc>
</info>
</enumeration>
</constraints>
- <value>0</value>
+ <value>1</value>
</prop>
<prop oor:name="SymbolStyle" oor:type="xs:string">
<!-- UIHints: Tools Options General View -->
diff --git a/sfx2/sdi/appslots.sdi b/sfx2/sdi/appslots.sdi
index a230036695..b80d93e3d4 100644
--- a/sfx2/sdi/appslots.sdi
+++ b/sfx2/sdi/appslots.sdi
@@ -177,6 +177,7 @@ interface Application
SID_AVAILABLE_TOOLBARS
[
ExecMethod = MiscExec_Impl ;
+ StateMethod = MiscState_Impl ;
]
SID_HELP_TUTORIALS
[
diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx
index 2f4c757121..837f5be86c 100644
--- a/sfx2/source/appl/appserv.cxx
+++ b/sfx2/source/appl/appserv.cxx
@@ -79,6 +79,7 @@
#include <unotools/moduleoptions.hxx>
#include <unotools/regoptions.hxx>
#include <svtools/helpopt.hxx>
+#include <svtools/miscopt.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <tools/shl.hxx>
#include <unotools/bootstrap.hxx>
@@ -659,6 +660,18 @@ void SfxApplication::MiscState_Impl(SfxItemSet &rSet)
break;
}
+ case SID_CONFIG:
+ case SID_TOOLBOXOPTIONS:
+ case SID_CONFIGSTATUSBAR:
+ case SID_CONFIGMENU:
+ case SID_CONFIGACCEL:
+ case SID_CONFIGEVENT:
+ {
+ if( SvtMiscOptions().DisableUICustomization() )
+ rSet.DisableItem(nWhich);
+ break;
+ }
+
case SID_BASICSTOP:
if ( !StarBASIC::IsRunning() )
rSet.DisableItem(nWhich);
diff --git a/sfx2/source/bastyp/fltfnc.cxx b/sfx2/source/bastyp/fltfnc.cxx
index c42e49d49e..6d8c9b88cb 100644
--- a/sfx2/source/bastyp/fltfnc.cxx
+++ b/sfx2/source/bastyp/fltfnc.cxx
@@ -374,8 +374,8 @@ const SfxFilter* SfxFilterMatcher::GetAnyFilter( SfxFilterFlags nMust, SfxFilter
sal_uInt32 SfxFilterMatcher::GuessFilterIgnoringContent(
SfxMedium& rMedium,
const SfxFilter**ppFilter,
- SfxFilterFlags /*nMust*/,
- SfxFilterFlags /*nDont*/ ) const
+ SfxFilterFlags nMust,
+ SfxFilterFlags nDont ) const
{
Reference< XTypeDetection > xDetection( ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.document.TypeDetection")), UNO_QUERY );
::rtl::OUString sTypeName;
@@ -390,7 +390,11 @@ sal_uInt32 SfxFilterMatcher::GuessFilterIgnoringContent(
*ppFilter = NULL;
if ( sTypeName.getLength() )
- *ppFilter = GetFilter4EA( sTypeName );
+ {
+ // make sure filter list is initialized
+ pImpl->InitForIterating();
+ *ppFilter = GetFilter4EA( sTypeName, nMust, nDont );
+ }
return *ppFilter ? ERRCODE_NONE : ERRCODE_ABORT;
}
diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx
index 0d76af8d26..3bab58f96b 100644
--- a/sfx2/source/dialog/filedlghelper.cxx
+++ b/sfx2/source/dialog/filedlghelper.cxx
@@ -2023,11 +2023,7 @@ void FileDialogHelper_Impl::saveConfig()
try
{
- aValue = xDlg->getValue( ExtendedFilePickerElementIds::CHECKBOX_LINK, 0 );
sal_Bool bValue = sal_False;
- aValue >>= bValue;
- aUserData.SetToken( 0, ' ', String::CreateFromInt32( (sal_Int32) bValue ) );
-
aValue = xDlg->getValue( ExtendedFilePickerElementIds::CHECKBOX_PREVIEW, 0 );
bValue = sal_False;
aValue >>= bValue;
@@ -2167,14 +2163,6 @@ void FileDialogHelper_Impl::loadConfig()
{
try
{
- // respect the last "insert as link" state
- sal_Bool bLink = (sal_Bool) aUserData.GetToken( 0, ' ' ).ToInt32();
- if ( !xDlg->getValue( ExtendedFilePickerElementIds::CHECKBOX_LINK, 0 ).hasValue() )
- {
- aValue <<= bLink;
- xDlg->setValue( ExtendedFilePickerElementIds::CHECKBOX_LINK, 0, aValue );
- }
-
// respect the last "show preview" state
sal_Bool bShowPreview = (sal_Bool) aUserData.GetToken( 1, ' ' ).ToInt32();
if ( !xDlg->getValue( ExtendedFilePickerElementIds::CHECKBOX_PREVIEW, 0 ).hasValue() )
diff --git a/svx/inc/svx/dialogs.hrc b/svx/inc/svx/dialogs.hrc
index 26cd56c2ef..d9a75249ad 100755
--- a/svx/inc/svx/dialogs.hrc
+++ b/svx/inc/svx/dialogs.hrc
@@ -35,7 +35,7 @@
// Resource-Id's ------------------------------------------------------------
// Bitte FIRSTFREE pflegen!!! (gilt nicht f"ur Strings)
-#define RID_SVX_FIRSTFREE 305
+#define RID_SVX_FIRSTFREE 314
// some strings also used in CUI
#define RID_SVXERRCTX (RID_SVX_START + 351)
@@ -379,6 +379,7 @@
#define RID_SVXDLG_TEXTCONTROL_CHARATTR (RID_SVX_START + 286)
#define RID_SVXDLG_TEXTCONTROL_PARAATTR (RID_SVX_START + 287)
+#define RID_SVXDLG_LINK_WARNING (RID_SVX_START + 313)
// !!! please update RID_SVX_FIRSTFREE !!! see line 46
// Strings ------------------------------------------------------------------
diff --git a/svx/inc/svx/linkwarn.hxx b/svx/inc/svx/linkwarn.hxx
new file mode 100644
index 0000000000..270ce363e5
--- /dev/null
+++ b/svx/inc/svx/linkwarn.hxx
@@ -0,0 +1,54 @@
+/*************************************************************************
+ *
+ * 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 _SFX_LINKWARN_HXX
+#define _SFX_LINKWARN_HXX
+
+#include <vcl/button.hxx>
+#include <vcl/fixed.hxx>
+#include <sfx2/basedlgs.hxx>
+#include "svx/svxdllapi.h"
+
+class SVX_DLLPUBLIC SvxLinkWarningDialog : public SfxModalDialog
+{
+private:
+ FixedImage m_aQueryImage;
+ FixedText m_aInfoText;
+ OKButton m_aLinkGraphicBtn;
+ CancelButton m_aEmbedGraphicBtn;
+ FixedLine m_aOptionLine;
+ CheckBox m_aWarningOnBox;
+
+ void InitSize();
+
+public:
+ SvxLinkWarningDialog( Window* pParent, const String& _rFileName );
+ virtual ~SvxLinkWarningDialog();
+};
+
+#endif // #ifndef _SFX_LINKWARN_HXX
diff --git a/svx/prj/d.lst b/svx/prj/d.lst
index 2403c04c43..d79e42172b 100644
--- a/svx/prj/d.lst
+++ b/svx/prj/d.lst
@@ -146,6 +146,11 @@ mkdir: %_DEST%\inc%_EXT%\svx
..\inc\svx\simptabl.hxx %_DEST%\inc%_EXT%\svx\simptabl.hxx
..\inc\svx\ctredlin.hxx %_DEST%\inc%_EXT%\svx\ctredlin.hxx
..\inc\svx\bmpmask.hxx %_DEST%\inc%_EXT%\svx\bmpmask.hxx
+..\inc\svx\linkwarn.hxx %_DEST%\inc%_EXT%\svx\linkwarn.hxx
+..\inc\svx\borderline.hxx %_DEST%\inc%_EXT%\svx\borderline.hxx
+..\inc\svx\boxitem.hxx %_DEST%\inc%_EXT%\svx\boxitem.hxx
+..\inc\svx\brkitem.hxx %_DEST%\inc%_EXT%\svx\brkitem.hxx
+..\inc\svx\brshitem.hxx %_DEST%\inc%_EXT%\svx\brshitem.hxx
..\inc\svx\camera3d.hxx %_DEST%\inc%_EXT%\svx\camera3d.hxx
..\inc\svx\charmap.hxx %_DEST%\inc%_EXT%\svx\charmap.hxx
..\inc\svx\checklbx.hxx %_DEST%\inc%_EXT%\svx\checklbx.hxx
diff --git a/svx/source/dialog/linkwarn.cxx b/svx/source/dialog/linkwarn.cxx
new file mode 100644
index 0000000000..e36167566b
--- /dev/null
+++ b/svx/source/dialog/linkwarn.cxx
@@ -0,0 +1,147 @@
+/*************************************************************************
+ *
+ * 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_svx.hxx"
+
+#include "linkwarn.hrc"
+#include "svx/linkwarn.hxx"
+#include "svx/dialogs.hrc"
+#include "svx/dialmgr.hxx"
+#include <vcl/msgbox.hxx>
+#include <sfx2/basedlgs.hxx>
+#include <svtools/miscopt.hxx>
+
+SvxLinkWarningDialog::SvxLinkWarningDialog( Window* pParent, const String& _rFileName ) :
+ SfxModalDialog( pParent, SVX_RES( RID_SVXDLG_LINK_WARNING ) ),
+ m_aQueryImage ( this, SVX_RES( FI_QUERY ) ),
+ m_aInfoText ( this, SVX_RES( FT_INFOTEXT ) ),
+ m_aLinkGraphicBtn ( this, SVX_RES( PB_OK ) ),
+ m_aEmbedGraphicBtn ( this, SVX_RES( PB_NO ) ),
+ m_aOptionLine ( this, SVX_RES( FL_OPTION ) ),
+ m_aWarningOnBox ( this, SVX_RES( CB_WARNING_OFF ) )
+{
+ FreeResource();
+
+ // set questionmark image
+ m_aQueryImage.SetImage( QueryBox::GetStandardImage() );
+
+ // replace filename
+ String sInfoText = m_aInfoText.GetText();
+ sInfoText.SearchAndReplaceAll(
+ UniString::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM( "%FILENAME" ) ), _rFileName );
+ m_aInfoText.SetText( sInfoText );
+
+ // load state of "warning on" checkbox from misc options
+ SvtMiscOptions aMiscOpt;
+ m_aWarningOnBox.Check( aMiscOpt.ShowLinkWarningDialog() == sal_True );
+ if( aMiscOpt.IsShowLinkWarningDialogReadOnly() )
+ m_aWarningOnBox.Disable();
+
+ // set focus to Cancel button
+ m_aEmbedGraphicBtn.GrabFocus();
+
+ // calculate and set the size of the dialog and its controls
+ InitSize();
+}
+
+// -----------------------------------------------------------------------
+
+SvxLinkWarningDialog::~SvxLinkWarningDialog()
+{
+ // save value of "warning off" checkbox, if necessary
+ SvtMiscOptions aMiscOpt;
+ sal_Bool bChecked = m_aWarningOnBox.IsChecked();
+ if ( aMiscOpt.ShowLinkWarningDialog() != bChecked )
+ aMiscOpt.SetShowLinkWarningDialog( bChecked );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxLinkWarningDialog::InitSize()
+{
+ // text of checkbox to wide -> add new line
+ long nTxtW = m_aWarningOnBox.GetCtrlTextWidth( m_aWarningOnBox.GetText() ) + IMPL_EXTRA_BUTTON_WIDTH;
+ long nCtrlW = m_aWarningOnBox.GetSizePixel().Width();
+ if ( nTxtW >= nCtrlW )
+ {
+ long nTextHeight = m_aWarningOnBox.GetTextHeight();
+ Size aNewSize = m_aWarningOnBox.GetSizePixel();
+ aNewSize.Height() += nTextHeight;
+ m_aWarningOnBox.SetSizePixel( aNewSize );
+ aNewSize = GetSizePixel();
+ aNewSize.Height() += nTextHeight;
+ SetSizePixel( aNewSize );
+ }
+
+ // align the size of the information text control (FixedText) to its content
+ Size aMinSize = m_aInfoText.CalcMinimumSize( m_aInfoText.GetSizePixel().Width() );
+ long nTxtH = aMinSize.Height();
+ long nCtrlH = m_aInfoText.GetSizePixel().Height();
+ long nDelta = ( nCtrlH - nTxtH );
+ Size aNewSize = m_aInfoText.GetSizePixel();
+ aNewSize.Height() -= nDelta;
+ m_aInfoText.SetSizePixel( aNewSize );
+
+ // new position for the succeeding windows
+ Window* pWins[] =
+ {
+ &m_aLinkGraphicBtn, &m_aEmbedGraphicBtn, &m_aOptionLine, &m_aWarningOnBox
+ };
+ Window** pCurrent = pWins;
+ for ( sal_uInt32 i = 0; i < sizeof(pWins) / sizeof(*pWins); ++i, ++pCurrent )
+ {
+ Point aNewPos = (*pCurrent)->GetPosPixel();
+ aNewPos.Y() -= nDelta;
+ (*pCurrent)->SetPosPixel( aNewPos );
+ }
+
+ // new size of the dialog
+ aNewSize = GetSizePixel();
+ aNewSize.Height() -= nDelta;
+ SetSizePixel( aNewSize );
+
+ // recalculate the size and position of the buttons
+ nTxtW = m_aLinkGraphicBtn.GetCtrlTextWidth( m_aLinkGraphicBtn.GetText() );
+ long nTemp = m_aEmbedGraphicBtn.GetCtrlTextWidth( m_aEmbedGraphicBtn.GetText() );
+ if ( nTemp > nTxtW )
+ nTxtW = nTemp;
+ nTxtW += IMPL_EXTRA_BUTTON_WIDTH;
+ Size a3Size = LogicToPixel( Size( 3, 3 ), MAP_APPFONT );
+ Point aPos = m_aLinkGraphicBtn.GetPosPixel();
+ aPos.X() = ( aNewSize.Width() - (2*nTxtW) - a3Size.Width() ) / 2;
+ long nDefX = m_aWarningOnBox.GetPosPixel().X();
+ if ( nDefX < aPos.X() )
+ aPos.X() = nDefX;
+ aNewSize = m_aLinkGraphicBtn.GetSizePixel();
+ aNewSize.Width() = nTxtW;
+ m_aLinkGraphicBtn.SetPosSizePixel( aPos, aNewSize );
+ aPos.X() += nTxtW + a3Size.Width();
+ m_aEmbedGraphicBtn.SetPosSizePixel( aPos, aNewSize );
+}
diff --git a/svx/source/dialog/linkwarn.hrc b/svx/source/dialog/linkwarn.hrc
new file mode 100644
index 0000000000..d01dc88d8e
--- /dev/null
+++ b/svx/source/dialog/linkwarn.hrc
@@ -0,0 +1,60 @@
+/*************************************************************************
+ *
+ * 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 _SVX_LINKWARN_HRC
+#define _SVX_LINKWARN_HRC
+
+#include <svtools/controldims.hrc>
+
+// dialog ids
+#define FI_QUERY 10
+#define FT_INFOTEXT 11
+#define PB_OK 12
+#define PB_NO 13
+#define FL_OPTION 15
+#define CB_WARNING_OFF 16
+
+// --------- general metrics ---------
+
+#define SYMBOL_EDGE 20
+#define DIALOG_WIDTH 220
+#define INFO_TEXT_LINES 11
+
+#define AW_COL_1 (RSC_SP_DLG_INNERBORDER_LEFT)
+#define AW_COL_2 (AW_COL_1+SYMBOL_EDGE+RSC_SP_CTRL_DESC_X)
+#define AW_COL_3 (AW_COL_2+RSC_CD_PUSHBUTTON_WIDTH+RSC_SP_CTRL_DESC_X)
+#define AW_COL_4 (DIALOG_WIDTH-RSC_SP_DLG_INNERBORDER_RIGHT-RSC_CD_PUSHBUTTON_WIDTH)
+
+#define AW_ROW_1 (RSC_SP_DLG_INNERBORDER_TOP)
+#define AW_ROW_2 (AW_ROW_1+INFO_TEXT_LINES*RSC_CD_FIXEDTEXT_HEIGHT+RSC_SP_CTRL_Y)
+#define AW_ROW_3 (AW_ROW_2+RSC_CD_PUSHBUTTON_HEIGHT+RSC_SP_CTRL_DESC_Y)
+#define AW_ROW_4 (AW_ROW_3+RSC_CD_FIXEDLINE_HEIGHT+RSC_SP_CTRL_DESC_Y)
+
+#define DIALOG_HEIGHT (AW_ROW_4+RSC_CD_CHECKBOX_HEIGHT+RSC_SP_DLG_INNERBORDER_BOTTOM)
+
+#endif
diff --git a/svx/source/dialog/linkwarn.src b/svx/source/dialog/linkwarn.src
new file mode 100644
index 0000000000..100b53cb6e
--- /dev/null
+++ b/svx/source/dialog/linkwarn.src
@@ -0,0 +1,85 @@
+/*************************************************************************
+ *
+ * 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 "linkwarn.hrc"
+#include "svx/dialogs.hrc"
+#include "helpid.hrc"
+
+ModalDialog RID_SVXDLG_LINK_WARNING
+{
+ Size = MAP_APPFONT( DIALOG_WIDTH, DIALOG_HEIGHT );
+ OutputSize = TRUE;
+ Closeable = FALSE;
+ Moveable = TRUE;
+ SVLook = TRUE;
+
+ Text = "%PRODUCTNAME %PRODUCTVERSION %PRODUCTEXTENSION";
+
+ FixedImage FI_QUERY
+ {
+ Pos = MAP_APPFONT( AW_COL_1, AW_ROW_1 );
+ Size = MAP_APPFONT( SYMBOL_EDGE, SYMBOL_EDGE );
+ };
+ FixedText FT_INFOTEXT
+ {
+ Pos = MAP_APPFONT( AW_COL_2, AW_ROW_1 );
+ Size = MAP_APPFONT( DIALOG_WIDTH-AW_COL_2-RSC_SP_DLG_INNERBORDER_RIGHT, INFO_TEXT_LINES*RSC_CD_FIXEDTEXT_HEIGHT );
+ NoLabel = TRUE;
+ Wordbreak = TRUE;
+ Text [ en-US ] = "The file %FILENAME will not be stored along with your document, but only referenced as a link. This is dangerous if you move and/or rename the files. Do you want to embed the graphic instead?";
+ Text [ de-DE ] = "Die Datei %FILENAME wird nicht zusammen mit dem Dokument gespeichert, sondern nur als Verweis referenziert. Dies kann zu Problemen führen, wenn die Dateien verschoben und/oder umbenannt werden. Möchten Sie stattdessen die Grafik als eingebettetes Objekt einfügen?";
+ };
+ OKButton PB_OK
+ {
+ Pos = MAP_APPFONT( AW_COL_2, AW_ROW_2 );
+ Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
+ DefButton = TRUE ;
+ Text [ en-US ] = "~Keep Link";
+ Text [ de-DE ] = "~Als Verweis einfügen";
+ };
+ CancelButton PB_NO
+ {
+ Pos = MAP_APPFONT( AW_COL_3, AW_ROW_2 );
+ Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
+ Text [ en-US ] = "~Embed Graphic";
+ Text [ de-DE ] = "~Eingebettet einfügen";
+ };
+ FixedLine FL_OPTION
+ {
+ Pos = MAP_APPFONT( 0, AW_ROW_3 );
+ Size = MAP_APPFONT( DIALOG_WIDTH, RSC_CD_FIXEDLINE_HEIGHT );
+ };
+ CheckBox CB_WARNING_OFF
+ {
+ Pos = MAP_APPFONT( AW_COL_2, AW_ROW_4 );
+ Size = MAP_APPFONT( DIALOG_WIDTH-AW_COL_2-RSC_SP_DLG_INNERBORDER_RIGHT, RSC_CD_CHECKBOX_HEIGHT );
+ WordBreak = TRUE ;
+ Text [ en-US ] = "~Ask when linking a graphic";
+ Text [ de-DE ] = "~Nachfragen falls Grafik als Verweis eingefügt wird";
+ };
+};
diff --git a/svx/source/dialog/makefile.mk b/svx/source/dialog/makefile.mk
index ac608fae8e..3805de953c 100644
--- a/svx/source/dialog/makefile.mk
+++ b/svx/source/dialog/makefile.mk
@@ -56,6 +56,7 @@ SRC1FILES = \
imapdlg.src \
langbox.src \
language.src \
+ linkwarn.src \
passwd.src \
prtqry.src \
rubydialog.src\
@@ -108,6 +109,7 @@ LIB2OBJFILES= \
$(SLO)$/hyprlink.obj \
$(SLO)$/imapdlg.obj \
$(SLO)$/imapwnd.obj \
+ $(SLO)$/linkwarn.obj \
$(SLO)$/measctrl.obj \
$(SLO)$/orienthelper.obj \
$(SLO)$/pagectrl.obj \
diff --git a/ucb/prj/build.lst b/ucb/prj/build.lst
index dad7921304..e58d23926b 100644
--- a/ucb/prj/build.lst
+++ b/ucb/prj/build.lst
@@ -16,3 +16,4 @@ uc ucb\source\ucp\tdoc nmake - all uc_tdoc uc_inc NULL
uc ucb\source\ucp\expand nmake - all uc_expand uc_inc NULL
uc ucb\source\ucp\ext nmake - all uc_ext uc_inc NULL
uc ucb\qa\unoapi nmake - all uc_qa_unoapi NULL
+uc ucb\source\ucp\odma nmake - w uc_odma uc_inc NULL
diff --git a/ucb/prj/d.lst b/ucb/prj/d.lst
index b02c8184a6..7b15e5b7fa 100644
--- a/ucb/prj/d.lst
+++ b/ucb/prj/d.lst
@@ -23,6 +23,11 @@
..\%__SRC%\lib\ucp*.uno.dylib %_DEST%\lib%_EXT%\ucp*.uno.dylib
..\%__SRC%\misc\ucp*.map %_DEST%\bin%_EXT%\ucp*.map
..\%__SRC%\misc\ucp*.sym %_DEST%\bin%_EXT%\ucp*.sym
+
+..\%__SRC%\slb\odma_lib.lib %_DEST%\lib%_EXT%\odma_lib.lib
+..\source\ucp\odma\odma.h %_DEST%\inc%_EXT%\odma.h
+..\source\ucp\odma\odma_lib.hxx %_DEST%\inc%_EXT%\odma_lib.hxx
+
..\source\ucp\file\ucpfile.xml %_DEST%\xml%_EXT%\ucpfile.xml
..\source\ucp\ftp\ucpftp.xml %_DEST%\xml%_EXT%\ucpftp.xml
..\source\ucp\hierarchy\ucphier.xml %_DEST%\xml%_EXT%\ucphier.xml
diff --git a/ucb/source/ucp/odma/makefile.mk b/ucb/source/ucp/odma/makefile.mk
index 14a7d3d45c..643b4fa278 100644
--- a/ucb/source/ucp/odma/makefile.mk
+++ b/ucb/source/ucp/odma/makefile.mk
@@ -47,7 +47,7 @@ LIBTARGET=NO
# --- General -----------------------------------------------------
-SLOFILES=\
+SLO1FILES=\
$(SLO)$/odma_lib.obj \
$(SLO)$/odma_services.obj \
$(SLO)$/odma_provider.obj \
@@ -58,7 +58,7 @@ SLOFILES=\
$(SLO)$/odma_contentcaps.obj
LIB1TARGET=$(SLB)$/_$(TARGET).lib
-LIB1OBJFILES=$(SLOFILES)
+LIB1OBJFILES=$(SLO1FILES)
# --- Shared-Library ---------------------------------------------------
@@ -91,6 +91,13 @@ APP2STDLIBS=$(SALLIB) \
DEF2DES=UCB ODMA URL converter
+# --- odma_lib library -----------------------------------------------
+
+SLO3FILES=$(SLO)$/odma_lib.obj
+
+LIB3TARGET=$(SLB)$/odma_lib.lib
+LIB3OBJFILES=$(SLO3FILES)
+
# --- Targets ----------------------------------------------------------
.INCLUDE: target.mk
diff --git a/ucb/source/ucp/odma/odma_content.cxx b/ucb/source/ucp/odma/odma_content.cxx
index 663436b2cb..5360f1f004 100644
--- a/ucb/source/ucp/odma/odma_content.cxx
+++ b/ucb/source/ucp/odma/odma_content.cxx
@@ -471,6 +471,12 @@ uno::Any SAL_CALL Content::execute(
}
else if( ! aCommand.Name.compareToAscii( "transfer" ) )
{
+ // So far I have determined that this command is called when
+ // doing "Save As" to copy an already written backup copy of
+ // the document in the file system into the DMS.
+
+ // Maybe also in other situations.
+
ucb::TransferInfo aTransferInfo;
if( ! ( aCommand.Argument >>= aTransferInfo ) )
{
@@ -486,84 +492,21 @@ uno::Any SAL_CALL Content::execute(
::rtl::Reference<ContentProperties> aProp = m_aProps;
if(aProp->m_bIsFolder)
{
- aProp = getContentProvider()->getContentPropertyWithTitle(aTransferInfo.NewTitle);
+ aProp = getContentProvider()->getContentPropertyWithDocumentId(aTransferInfo.NewTitle);
if(!aProp.is())
aProp = getContentProvider()->getContentPropertyWithSavedAsName(aTransferInfo.NewTitle);
sal_Bool bError = !aProp.is();
- if(bError)
- {
- sal_Char* pExtension = NULL;
- ::rtl::OString sExt;
- sal_Int32 nPos = aTransferInfo.NewTitle.lastIndexOf('.');
- if(nPos != -1)
- {
- sExt = ::rtl::OUStringToOString(aTransferInfo.NewTitle.copy(nPos+1),RTL_TEXTENCODING_ASCII_US);
- if(sExt.equalsIgnoreAsciiCase("txt"))
- pExtension = ODM_FORMAT_TEXT;
- else if(sExt.equalsIgnoreAsciiCase("rtf"))
- pExtension = ODM_FORMAT_RTF;
- else if(sExt.equalsIgnoreAsciiCase("ps"))
- pExtension = ODM_FORMAT_PS;
- else
- pExtension = const_cast<sal_Char*>(sExt.getStr());
- }
- else
- pExtension = ODM_FORMAT_TEXT;
-
- sal_Char* lpszNewDocId = new sal_Char[ODM_DOCID_MAX];
- void *pData = NULL;
- DWORD dwFlags = ODM_SILENT;
- ODMSTATUS odm = NODMSaveAsEx(ContentProvider::getHandle(),
- NULL, // means it is saved the first time
- lpszNewDocId,
- pExtension,
- NULL, // no callback function here
- pData,
- &dwFlags);
-
- // check if we have to call the DMS dialog
- if(odm == ODM_E_USERINT)
- {
- dwFlags = 0;
- odm = NODMSaveAsEx(ContentProvider::getHandle(),
- NULL, // means it is saved the first time
- lpszNewDocId,
- pExtension,
- NULL, // no callback function here
- pData,
- &dwFlags);
- }
- bError = odm != ODM_SUCCESS;
- if(!bError)
- {
- aProp = new ContentProperties();
- aProp->m_sDocumentId = ::rtl::OString(lpszNewDocId);
- aProp->m_sContentType = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(ODMA_CONTENT_TYPE));
- aProp->m_sSavedAsName = aTransferInfo.NewTitle;
- getContentProvider()->append(aProp);
-
- // now set the title
- WORD nDocInfo = ODM_NAME;
- ::rtl::OUString sFileName = aTransferInfo.NewTitle;
- sal_Int32 nIndex = aTransferInfo.NewTitle.lastIndexOf( sal_Unicode('.') );
- if(nIndex != -1)
- sFileName = aTransferInfo.NewTitle.copy(0,nIndex);
-
- ::rtl::OString sDocInfoValue = ::rtl::OUStringToOString(sFileName,RTL_TEXTENCODING_ASCII_US);
- odm = NODMSetDocInfo( ContentProvider::getHandle(),
- lpszNewDocId,
- nDocInfo,
- const_cast<sal_Char*>(sDocInfoValue.getStr())
- );
- }
- else if ( odm == ODM_E_CANCEL)
- NODMActivate(ContentProvider::getHandle(),
- ODM_DELETE,
- lpszNewDocId);
+ // There used to be code below that called ODMSaveAsEx,
+ // but that was very broken. We have already called
+ // ODMSaveAsEx in the ODMA file picker when selecting the
+ // name for a new document, or the document already exists
+ // in the DMS and we don't need any ODMSaveAsEx. The ODMA
+ // file picker tells odma::ContentProvider about the new
+ // document's DOCID, so the
+ // getContentPropertyWithDocumentId() call above should
+ // succeed.
- delete [] lpszNewDocId;
- }
if(bError)
ucbhelper::cancelCommandExecution(
uno::makeAny( lang::IllegalArgumentException(
@@ -575,12 +518,23 @@ uno::Any SAL_CALL Content::execute(
rtl::OUString sFileURL = ContentProvider::openDoc(aProp);
sal_Int32 nLastIndex = sFileURL.lastIndexOf( sal_Unicode('/') );
+ // Create a new Content object for the "shadow" file
+ // corresponding to the opened document from the DMS.
::ucbhelper::Content aContent(sFileURL.copy(0,nLastIndex),NULL);
// aTransferInfo.NameClash = ucb::NameClash::OVERWRITE;
aTransferInfo.NewTitle = sFileURL.copy( 1 + nLastIndex );
+ // Copy our saved backup copy to the "shadow" file.
aContent.executeCommand(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("transfer")),uno::makeAny(aTransferInfo));
+ // Tell the DMS that the "shadow" file is done and can be
+ // imported.
getContentProvider()->saveDocument(aProp->m_sDocumentId);
}
+ else if ( aCommand.Name.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM( "getCasePreservingURL" ) ) )
+ {
+ rtl::OUString CasePreservingURL = openDoc();
+ aRet <<= CasePreservingURL;
+ }
else
{
//////////////////////////////////////////////////////////////////
diff --git a/ucb/source/ucp/odma/odma_content.hxx b/ucb/source/ucp/odma/odma_content.hxx
index ab50e1aec7..ed9fc38e09 100644
--- a/ucb/source/ucp/odma/odma_content.hxx
+++ b/ucb/source/ucp/odma/odma_content.hxx
@@ -59,7 +59,7 @@ namespace odma
// UNO service name for the content.
#define ODMA_CONTENT_SERVICE_NAME \
- "com.sun.star.ucb.OdmaContent"
+ "com.sun.star.ucb.ODMAContent"
//=========================================================================
class ContentProvider;
diff --git a/ucb/source/ucp/odma/odma_contentprops.hxx b/ucb/source/ucp/odma/odma_contentprops.hxx
index 8ac9fae68f..614a15e080 100644
--- a/ucb/source/ucp/odma/odma_contentprops.hxx
+++ b/ucb/source/ucp/odma/odma_contentprops.hxx
@@ -64,6 +64,7 @@ namespace odma
{}
inline ::rtl::OUString getTitle() const { return m_sTitle; }
+ inline ::rtl::OUString getDocumentId() const { return ::rtl::OStringToOUString( m_sDocumentId, RTL_TEXTENCODING_ASCII_US ); }
inline ::rtl::OUString getSavedAsName() const { return m_sSavedAsName; }
};
typedef ::std::binary_function< ::rtl::Reference<ContentProperties>, ::rtl::OUString,bool> TContentPropertiesFunctorBase;
diff --git a/ucb/source/ucp/odma/odma_datasupplier.cxx b/ucb/source/ucp/odma/odma_datasupplier.cxx
index a9024d4e64..ad0814548a 100644
--- a/ucb/source/ucp/odma/odma_datasupplier.cxx
+++ b/ucb/source/ucp/odma/odma_datasupplier.cxx
@@ -41,7 +41,6 @@
#include "odma_content.hxx"
#include "odma_contentprops.hxx"
#include "odma_provider.hxx"
-#include "odma_lib.hxx"
using namespace com::sun::star::beans;
using namespace com::sun::star::lang;
@@ -284,7 +283,7 @@ sal_Bool DataSupplier::getResult( sal_uInt32 nIndex )
ODMSTATUS odm = NODMGetDMS(ODMA_ODMA_REGNAME, lpszDMSList);
lpszDMSList[strlen(lpszDMSList)+1] = '\0';
- ::rtl::OString sQuery("SELECT ODM_DOCID, ODM_NAME");
+ ::rtl::OString sQuery("SELECT ODM_DOCID_LATEST, ODM_NAME");
DWORD dwFlags = ODM_SPECIFIC;
odm = NODMQueryExecute(ContentProvider::getHandle(), sQuery,dwFlags, lpszDMSList, pQueryId );
diff --git a/ucb/source/ucp/odma/odma_lib.cxx b/ucb/source/ucp/odma/odma_lib.cxx
index b6a0d3ada1..3f27bbdee0 100644
--- a/ucb/source/ucp/odma/odma_lib.cxx
+++ b/ucb/source/ucp/odma/odma_lib.cxx
@@ -32,6 +32,8 @@
//#endif
#include <osl/module.h>
#include <rtl/ustring.hxx>
+#include <tools/prewin.h>
+#include <tools/postwin.h>
#include "odma_lib.hxx"
@@ -70,17 +72,18 @@ namespace odma
sal_Bool LoadFunctions(oslModule _pODMA);
- sal_Bool LoadLibrary()
+ sal_Bool DMSsAvailable()
{
static sal_Bool bLoaded = sal_False;
- static oslModule pODMA = NULL;
+ static sal_Bool bBeenHere = sal_False;
+ oslModule pODMA = NULL;
- if (bLoaded)
- return sal_True;
+ if (bBeenHere)
+ return bLoaded;
+
::rtl::OUString sPath;
#ifdef WIN
sPath = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMA.DLL"));
-
#endif
#ifdef WNT
sPath = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMA32.DLL"));
@@ -89,11 +92,21 @@ namespace odma
sPath = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("libodma.so"));
#endif
+ bBeenHere = sal_True;
+
pODMA = osl_loadModule( sPath.pData,SAL_LOADMODULE_NOW );
if( !pODMA)
return sal_False;
- return bLoaded = LoadFunctions(pODMA);
+ if (!LoadFunctions(pODMA))
+ return sal_False;
+
+ bLoaded = (NODMGetDMSCount() > 0);
+
+ if (getenv ("NO_ODMA"))
+ bLoaded = sal_False;
+
+ return bLoaded;
}
// -------------------------------------------------------------------------
diff --git a/ucb/source/ucp/odma/odma_lib.hxx b/ucb/source/ucp/odma/odma_lib.hxx
index 0c9180ee7d..6eaae884e0 100644
--- a/ucb/source/ucp/odma/odma_lib.hxx
+++ b/ucb/source/ucp/odma/odma_lib.hxx
@@ -27,19 +27,7 @@
#ifndef ODMA_LIB_HXX
#define ODMA_LIB_HXX
-typedef void *LPVOID;
-typedef char *LPSTR,
- *PSTR;
-typedef const char *LPCSTR;
-typedef unsigned long DWORD;
-typedef unsigned short WORD;
-typedef unsigned short *LPWORD;
-typedef DWORD *LPDWORD;
-
-#define WINAPI __stdcall
-#define FAR
-
-#include "odma.h"
+#include <odma.h>
namespace odma
{
@@ -205,37 +193,37 @@ namespace odma
// now we define some macros
- #define NODMRegisterApp(a,b,c,d,e) (*(pODMRegisterApp))(a,b,c,d,e)
- #define NODMUnRegisterApp(a) (*(pODMUnRegisterApp))(a)
- #define NODMSelectDoc(a,b,c) (*(pODMSelectDoc))(a,b,c)
- #define NODMOpenDoc(a,b,c,d) (*(pODMOpenDoc))(a,b,c,d)
- #define NODMSaveDoc(a,b,c) (*(pODMSaveDoc))(a,b,c)
- #define NODMCloseDoc(a,b,c,d,e,f) (*(pODMCloseDoc))(a,b,c,d,e,f)
- #define NODMNewDoc(a,b,c,d,e) (*(pODMNewDoc))(a,b,c,d,e)
- #define NODMSaveAs(a,b,c,d,e,f) (*(pODMSaveAs))(a,b,c,d,e,f)
- #define NODMActivate(a,b,c) (*(pODMActivate))(a,b,c)
- #define NODMGetDocInfo(a,b,c,d,e) (*(pODMGetDocInfo))(a,b,c,d,e)
- #define NODMSetDocInfo(a,b,c,d) (*(pODMSetDocInfo))(a,b,c,d)
- #define NODMGetDMSInfo(a,b,c,d) (*(pODMGetDMSInfo))(a,b,c,d)
- #define NODMGetDMSCount() (*(pODMGetDMSCount))()
- #define NODMGetDMSList(a,b) (*(pODMGetDMSList))(a,b)
- #define NODMGetDMS(a,b) (*(pODMGetDMS))(a,b)
- #define NODMSetDMS(a,b) (*(pODMSetDMS))(a,b)
- #define NODMQueryExecute(a,b,c,d,e) (*(pODMQueryExecute))(a,b,c,d,e)
- #define NODMQueryGetResults(a,b,c,d,e,f) (*(pODMQueryGetResults))(a,b,c,d,e,f)
- #define NODMQueryClose(a,b) (*(pODMQueryClose))(a,b)
- #define NODMCloseDocEx(a,b,c,d,e,f,g) (*(pODMCloseDocEx))(a,b,c,d,e,f,g)
- #define NODMSaveAsEx(a,b,c,d,e,f,g) (*(pODMSaveAsEx))(a,b,c,d,e,f,g)
- #define NODMSaveDocEx(a,b,c,d) (*(pODMSaveDocEx))(a,b,c,d)
- #define NODMSelectDocEx(a,b,c,d,e,f) (*(pODMSelectDocEx))(a,b,c,d,e,f)
- #define NODMQueryCapability(a,b,c,d,e) (*(pODMQueryCapability))(a,b,c,d,e)
- #define NODMSetDocEvent(a,b,c,d,e,f,g) (*(pODMSetDocEvent))(a,b,c,d,e,f,g)
- #define NODMGetAlternateContent(a,b,c,d,e) (*(pODMGetAlternateContent))(a,b,c,d,e)
- #define NODMSetAlternateContent(a,b,c,d,e) (*(pODMSetAlternateContent))(a,b,c,d,e)
- #define NODMGetDocRelation(a,b,c,d,e,f) (*(pODMGetDocRelation))(a,b,c,d,e,f)
- #define NODMSetDocRelation(a,b,c,d,e,f) (*(pODMSetDocRelation))(a,b,c,d,e,f)
-
- sal_Bool LoadLibrary();
+ #define NODMRegisterApp(a,b,c,d,e) (*(::odma::pODMRegisterApp))(a,b,c,d,e)
+ #define NODMUnRegisterApp(a) (*(::odma::pODMUnRegisterApp))(a)
+ #define NODMSelectDoc(a,b,c) (*(::odma::pODMSelectDoc))(a,b,c)
+ #define NODMOpenDoc(a,b,c,d) (*(::odma::pODMOpenDoc))(a,b,c,d)
+ #define NODMSaveDoc(a,b,c) (*(::odma::pODMSaveDoc))(a,b,c)
+ #define NODMCloseDoc(a,b,c,d,e,f) (*(::odma::pODMCloseDoc))(a,b,c,d,e,f)
+ #define NODMNewDoc(a,b,c,d,e) (*(::odma::pODMNewDoc))(a,b,c,d,e)
+ #define NODMSaveAs(a,b,c,d,e,f) (*(::odma::pODMSaveAs))(a,b,c,d,e,f)
+ #define NODMActivate(a,b,c) (*(::odma::pODMActivate))(a,b,c)
+ #define NODMGetDocInfo(a,b,c,d,e) (*(::odma::pODMGetDocInfo))(a,b,c,d,e)
+ #define NODMSetDocInfo(a,b,c,d) (*(::odma::pODMSetDocInfo))(a,b,c,d)
+ #define NODMGetDMSInfo(a,b,c,d) (*(::odma::pODMGetDMSInfo))(a,b,c,d)
+ #define NODMGetDMSCount() (*(::odma::pODMGetDMSCount))()
+ #define NODMGetDMSList(a,b) (*(::odma::pODMGetDMSList))(a,b)
+ #define NODMGetDMS(a,b) (*(::odma::pODMGetDMS))(a,b)
+ #define NODMSetDMS(a,b) (*(::odma::pODMSetDMS))(a,b)
+ #define NODMQueryExecute(a,b,c,d,e) (*(::odma::pODMQueryExecute))(a,b,c,d,e)
+ #define NODMQueryGetResults(a,b,c,d,e,f) (*(::odma::pODMQueryGetResults))(a,b,c,d,e,f)
+ #define NODMQueryClose(a,b) (*(::odma::pODMQueryClose))(a,b)
+ #define NODMCloseDocEx(a,b,c,d,e,f,g) (*(::odma::pODMCloseDocEx))(a,b,c,d,e,f,g)
+ #define NODMSaveAsEx(a,b,c,d,e,f,g) (*(::odma::pODMSaveAsEx))(a,b,c,d,e,f,g)
+ #define NODMSaveDocEx(a,b,c,d) (*(::odma::pODMSaveDocEx))(a,b,c,d)
+ #define NODMSelectDocEx(a,b,c,d,e,f) (*(::odma::pODMSelectDocEx))(a,b,c,d,e,f)
+ #define NODMQueryCapability(a,b,c,d,e) (*(::odma::pODMQueryCapability))(a,b,c,d,e)
+ #define NODMSetDocEvent(a,b,c,d,e,f,g) (*(::odma::pODMSetDocEvent))(a,b,c,d,e,f,g)
+ #define NODMGetAlternateContent(a,b,c,d,e) (*(::odma::pODMGetAlternateContent))(a,b,c,d,e)
+ #define NODMSetAlternateContent(a,b,c,d,e) (*(::odma::pODMSetAlternateContent))(a,b,c,d,e)
+ #define NODMGetDocRelation(a,b,c,d,e,f) (*(::odma::pODMGetDocRelation))(a,b,c,d,e,f)
+ #define NODMSetDocRelation(a,b,c,d,e,f) (*(::odma::pODMSetDocRelation))(a,b,c,d,e,f)
+
+ sal_Bool DMSsAvailable();
extern TODMRegisterApp pODMRegisterApp;
extern TODMUnRegisterApp pODMUnRegisterApp;
diff --git a/ucb/source/ucp/odma/odma_provider.cxx b/ucb/source/ucp/odma/odma_provider.cxx
index c6a30acc86..7ba5b7c2f5 100644
--- a/ucb/source/ucp/odma/odma_provider.cxx
+++ b/ucb/source/ucp/odma/odma_provider.cxx
@@ -434,7 +434,7 @@ void ContentProvider::append(const ::rtl::Reference<ContentProperties>& _rProp)
lpszDMSList[strlen(lpszDMSList)+1] = '\0';
::rtl::OString sTitleText(::rtl::OUStringToOString(_sDocumentName,RTL_TEXTENCODING_ASCII_US));
- ::rtl::OString sQuery("SELECT ODM_DOCID, ODM_NAME WHERE ODM_TITLETEXT = '");
+ ::rtl::OString sQuery("SELECT ODM_DOCID_LATEST, ODM_NAME WHERE ODM_TITLETEXT = '");
sQuery += sTitleText;
sQuery += "'";
@@ -522,6 +522,12 @@ void ContentProvider::append(const ::rtl::Reference<ContentProperties>& _rProp)
return getContentProperty(_sTitle,aFunc);
}
// -----------------------------------------------------------------------------
+::rtl::Reference<ContentProperties> ContentProvider::getContentPropertyWithDocumentId(const ::rtl::OUString& _sDocumentId) const
+{
+ ContentPropertiesMemberFunctor aFunc(::std::mem_fun(&ContentProperties::getDocumentId));
+ return getContentProperty(_sDocumentId,aFunc);
+}
+// -----------------------------------------------------------------------------
::rtl::OUString ContentProvider::openDoc(const ::rtl::Reference<ContentProperties>& _rProp) throw (uno::Exception)
{
OSL_ENSURE(_rProp.is(),"No valid content properties!");
diff --git a/ucb/source/ucp/odma/odma_provider.hxx b/ucb/source/ucp/odma/odma_provider.hxx
index cbd8e6b49f..272d5e7fbe 100644
--- a/ucb/source/ucp/odma/odma_provider.hxx
+++ b/ucb/source/ucp/odma/odma_provider.hxx
@@ -29,6 +29,8 @@
#define ODMA_PROVIDER_HXX
#include <ucbhelper/providerhelper.hxx>
+#include <tools/prewin.h>
+#include <tools/postwin.h>
#include "odma_lib.hxx"
#include "rtl/ref.hxx"
@@ -43,7 +45,7 @@ namespace odma {
// UNO service name for the provider. This name will be used by the UCB to
// create instances of the provider.
#define ODMA_CONTENT_PROVIDER_SERVICE_NAME \
- "com.sun.star.ucb.OdmaContentProvider"
+ "com.sun.star.ucb.ODMAContentProvider"
// #define ODMA_CONTENT_PROVIDER_SERVICE_NAME_LENGTH 34
// URL scheme. This is the scheme the provider will be able to create
@@ -133,14 +135,21 @@ public:
*/
::rtl::Reference<ContentProperties> queryContentProperty(const ::rtl::OUString& _sDocumentName);
- /** getContentProperty returns the ContentProperties for the first content with that title
+ /** getContentPropertyWithTitle returns the ContentProperties for the first content with that title
@param _sTitle the title of the document
@return the content properties
*/
::rtl::Reference<ContentProperties> getContentPropertyWithTitle(const ::rtl::OUString& _sTitle) const;
- /** getContentProperty returns the ContentProperties for the first content with that SavedAsName
+ /** getContentPropertyWithDocumentId returns the ContentProperties for the first content with that title
+ @param _sTitle the title of the document
+
+ @return the content properties
+ */
+ ::rtl::Reference<ContentProperties> getContentPropertyWithDocumentId(const ::rtl::OUString& _sDocumentId) const;
+
+ /** getContentPropertyWithSavedAsName returns the ContentProperties for the first content with that SavedAsName
@param _sSaveAsName the SavedAsName of the document
@return the content properties
diff --git a/ucb/source/ucp/odma/odma_services.cxx b/ucb/source/ucp/odma/odma_services.cxx
index 1140083942..9464b5791b 100644
--- a/ucb/source/ucp/odma/odma_services.cxx
+++ b/ucb/source/ucp/odma/odma_services.cxx
@@ -32,21 +32,19 @@
#include <com/sun/star/registry/XRegistryKey.hpp>
#include "odma_contentprops.hxx"
#include "odma_provider.hxx"
-#include "odma_lib.hxx"
-using namespace rtl;
using namespace com::sun::star::uno;
using namespace com::sun::star::lang;
using namespace com::sun::star::registry;
//=========================================================================
static sal_Bool writeInfo( void * pRegistryKey,
- const OUString & rImplementationName,
- Sequence< OUString > const & rServiceNames )
+ const rtl::OUString & rImplementationName,
+ Sequence< rtl::OUString > const & rServiceNames )
{
- OUString aKeyName( OUString::createFromAscii( "/" ) );
+ rtl::OUString aKeyName( rtl::OUString::createFromAscii( "/" ) );
aKeyName += rImplementationName;
- aKeyName += OUString::createFromAscii( "/UNO/SERVICES" );
+ aKeyName += rtl::OUString::createFromAscii( "/UNO/SERVICES" );
Reference< XRegistryKey > xKey;
try
@@ -119,10 +117,8 @@ extern "C" void * SAL_CALL component_getFactory(
if ( ::odma::ContentProvider::getImplementationName_Static().
compareToAscii( pImplName ) == 0 )
{
- if(::odma::LoadLibrary())
+ if(::odma::DMSsAvailable())
xFactory = ::odma::ContentProvider::createServiceFactory( xSMgr );
- else
- OSL_ASSERT(!"Could not load library!");
}
//////////////////////////////////////////////////////////////////////
diff --git a/ucb/source/ucp/odma/ucpodma.xml b/ucb/source/ucp/odma/ucpodma.xml
index c3804b6662..390245e41a 100644
--- a/ucb/source/ucp/odma/ucpodma.xml
+++ b/ucb/source/ucp/odma/ucpodma.xml
@@ -11,7 +11,7 @@
Ocke Janssen
</author>
<name>
- com.sun.star.comp.ucb.OdmaContentProvider
+ com.sun.star.comp.ucb.ODMAContentProvider
</name>
<description>
This component implements a Content Provider for the Universal