[ooo-build-commit] .: 21 commits - desktop/source fpicker/prj fpicker/source framework/prj framework/source framework/util officecfg/registry sfx2/sdi sfx2/source svx/inc svx/prj svx/source ucb/prj ucb/source

Jan Holesovsky kendy at kemper.freedesktop.org
Thu Aug 26 07:25:20 PDT 2010


 desktop/source/app/app.cxx                                   |   10 
 desktop/source/app/cmdlineargs.cxx                           |   88 +
 desktop/source/app/cmdlineargs.hxx                           |    8 
 desktop/source/app/cmdlinehelp.cxx                           |   15 
 desktop/source/app/dispatchwatcher.cxx                       |  224 ++
 desktop/source/app/dispatchwatcher.hxx                       |    7 
 desktop/source/app/officeipcthread.cxx                       |   60 
 desktop/source/app/officeipcthread.hxx                       |    4 
 fpicker/prj/build.lst                                        |    5 
 fpicker/prj/d.lst                                            |    2 
 fpicker/source/generic/fpicker.cxx                           |   28 
 fpicker/source/generic/makefile.mk                           |    1 
 fpicker/source/odma/ODMAFilePicker.cxx                       |  532 ++++++
 fpicker/source/odma/ODMAFilePicker.hxx                       |  213 ++
 fpicker/source/odma/ODMAFolderPicker.cxx                     |  182 ++
 fpicker/source/odma/ODMAFolderPicker.hxx                     |  100 +
 fpicker/source/odma/exports.map                              |    8 
 fpicker/source/odma/fps_odma.cxx                             |   78 
 fpicker/source/odma/makefile.mk                              |   72 
 fpicker/source/unx/kde/kdecommandthread.cxx                  |  174 ++
 fpicker/source/unx/kde/kdecommandthread.hxx                  |   94 +
 fpicker/source/unx/kde/kdefilepicker.cxx                     |  729 ++++++++
 fpicker/source/unx/kde/kdefilepicker.hxx                     |  122 +
 fpicker/source/unx/kde/kdefpmain.cxx                         |   89 +
 fpicker/source/unx/kde/kdemodalityfilter.cxx                 |   64 
 fpicker/source/unx/kde/kdemodalityfilter.hxx                 |   45 
 fpicker/source/unx/kde/makefile.mk                           |   76 
 fpicker/source/unx/kde_unx/FPServiceInfo.hxx                 |   44 
 fpicker/source/unx/kde_unx/UnxCommandThread.cxx              |  311 +++
 fpicker/source/unx/kde_unx/UnxCommandThread.hxx              |  132 +
 fpicker/source/unx/kde_unx/UnxFPentry.cxx                    |  124 +
 fpicker/source/unx/kde_unx/UnxFilePicker.cxx                 |  928 +++++++++++
 fpicker/source/unx/kde_unx/UnxFilePicker.hxx                 |  174 ++
 fpicker/source/unx/kde_unx/UnxNotifyThread.cxx               |  112 +
 fpicker/source/unx/kde_unx/UnxNotifyThread.hxx               |   86 +
 fpicker/source/unx/kde_unx/fps-kde-ucd.txt                   |    6 
 fpicker/source/unx/kde_unx/fps_kde.xml                       |   51 
 fpicker/source/unx/kde_unx/makefile.mk                       |   77 
 framework/prj/build.lst                                      |    2 
 framework/source/uielement/recentfilesmenucontroller.cxx     |   40 
 framework/source/uielement/toolbarmanager.cxx                |   21 
 framework/source/uielement/toolbarsmenucontroller.cxx        |    4 
 framework/util/makefile.mk                                   |    1 
 officecfg/registry/data/org/openoffice/ucb/Configuration.xcu |   11 
 officecfg/registry/schema/org/openoffice/Office/Common.xcs   |   23 
 sfx2/sdi/appslots.sdi                                        |    1 
 sfx2/source/appl/appserv.cxx                                 |   13 
 sfx2/source/bastyp/fltfnc.cxx                                |   10 
 sfx2/source/dialog/filedlghelper.cxx                         |   12 
 svx/inc/svx/dialogs.hrc                                      |    3 
 svx/inc/svx/linkwarn.hxx                                     |   54 
 svx/prj/d.lst                                                |    5 
 svx/source/dialog/linkwarn.cxx                               |  147 +
 svx/source/dialog/linkwarn.hrc                               |   60 
 svx/source/dialog/linkwarn.src                               |   85 +
 svx/source/dialog/makefile.mk                                |    2 
 ucb/prj/build.lst                                            |    1 
 ucb/prj/d.lst                                                |    5 
 ucb/source/ucp/odma/makefile.mk                              |   11 
 ucb/source/ucp/odma/odma_content.cxx                         |  100 -
 ucb/source/ucp/odma/odma_content.hxx                         |    2 
 ucb/source/ucp/odma/odma_contentprops.hxx                    |    1 
 ucb/source/ucp/odma/odma_datasupplier.cxx                    |    3 
 ucb/source/ucp/odma/odma_lib.cxx                             |   25 
 ucb/source/ucp/odma/odma_lib.hxx                             |   76 
 ucb/source/ucp/odma/odma_provider.cxx                        |    8 
 ucb/source/ucp/odma/odma_provider.hxx                        |   15 
 ucb/source/ucp/odma/odma_services.cxx                        |   14 
 ucb/source/ucp/odma/ucpodma.xml                              |    2 
 69 files changed, 5640 insertions(+), 192 deletions(-)

New commits:
commit 09877bede0535bd8b6131e5276177f2c0e44078d
Author: Muthu Subramanian K <sumuthu at novell.com>
Date:   Wed Aug 25 23:38:54 2010 +0200

    desktop-infilter-option.diff: Force input filter during the batch conversion.

diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index 6e8d53e..b659de3 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -2567,6 +2567,7 @@ void Desktop::OpenClients()
         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 ||
diff --git a/desktop/source/app/cmdlineargs.cxx b/desktop/source/app/cmdlineargs.cxx
index 8934872..8c93f46 100644
--- a/desktop/source/app/cmdlineargs.cxx
+++ b/desktop/source/app/cmdlineargs.cxx
@@ -539,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 ) );
@@ -936,6 +941,13 @@ 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 );
diff --git a/desktop/source/app/cmdlineargs.hxx b/desktop/source/app/cmdlineargs.hxx
index f6c2845..f357dad 100644
--- a/desktop/source/app/cmdlineargs.hxx
+++ b/desktop/source/app/cmdlineargs.hxx
@@ -93,6 +93,7 @@ class CommandLineArgs
             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!
@@ -172,6 +173,7 @@ 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;
diff --git a/desktop/source/app/cmdlinehelp.cxx b/desktop/source/app/cmdlinehelp.cxx
index cb96e6f..0869565 100644
--- a/desktop/source/app/cmdlinehelp.cxx
+++ b/desktop/source/app/cmdlinehelp.cxx
@@ -116,6 +116,9 @@ 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"\
+        "-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"\
diff --git a/desktop/source/app/dispatchwatcher.cxx b/desktop/source/app/dispatchwatcher.cxx
index 9bcba45..e2a6429 100644
--- a/desktop/source/app/dispatchwatcher.cxx
+++ b/desktop/source/app/dispatchwatcher.cxx
@@ -182,6 +182,8 @@ 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++ )
     {
@@ -192,6 +194,15 @@ 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 ||
@@ -378,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 );
diff --git a/desktop/source/app/dispatchwatcher.hxx b/desktop/source/app/dispatchwatcher.hxx
index 62828a5..cbcb900 100644
--- a/desktop/source/app/dispatchwatcher.hxx
+++ b/desktop/source/app/dispatchwatcher.hxx
@@ -77,6 +77,7 @@ class DispatchWatcher : public ::cppu::WeakImplHelper1< ::com::sun::star::frame:
             REQUEST_FORCEOPEN,
             REQUEST_FORCENEW,
             REQUEST_CONVERSION,
+            REQUEST_INFILTER,
             REQUEST_BATCHPRINT
         };
 
diff --git a/desktop/source/app/officeipcthread.cxx b/desktop/source/app/officeipcthread.cxx
index 56d02e4..b86d945 100644
--- a/desktop/source/app/officeipcthread.cxx
+++ b/desktop/source/app/officeipcthread.cxx
@@ -1011,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 );
diff --git a/desktop/source/app/officeipcthread.hxx b/desktop/source/app/officeipcthread.hxx
index 4f442a9..fe61c93 100644
--- a/desktop/source/app/officeipcthread.hxx
+++ b/desktop/source/app/officeipcthread.hxx
@@ -69,6 +69,7 @@ struct ProcessDocumentsRequest
     ::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
 };
 
commit 5d7c99f0c7f5fcc147fe45f01efbc7b7607784e8
Author: Muthu Subramanian K <sumuthu at novell.com>
Date:   Wed Aug 25 23:37:30 2010 +0200

    desktop-cmd-bulk-conversion.diff: Batch conversion.
    
    Based on work by Florian Reuter <freuter at novell.com>.

diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index b5406fc..6e8d53e 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -2564,6 +2564,9 @@ 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 );
 
         if ( aRequest.aOpenList.getLength() > 0 ||
              aRequest.aViewList.getLength() > 0 ||
@@ -2571,7 +2574,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;
 
@@ -2921,7 +2925,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 06f6e33..8934872 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,6 +330,23 @@ 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 )
@@ -335,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 );
                     }
                 }
             }
@@ -891,6 +936,28 @@ sal_Bool CommandLineArgs::GetLanguage( ::rtl::OUString& rPara ) const
     return m_aStrSetParams[ CMD_STRINGPARAM_LANGUAGE ];
 }
 
+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 569dd5c..f6c2845 100644
--- a/desktop/source/app/cmdlineargs.hxx
+++ b/desktop/source/app/cmdlineargs.hxx
@@ -90,6 +90,9 @@ class CommandLineArgs
             CMD_STRINGPARAM_VERSION,
             CMD_STRINGPARAM_PRINTTOLIST,
             CMD_STRINGPARAM_PRINTERNAME,
+            CMD_STRINGPARAM_CONVERSIONLIST,
+            CMD_STRINGPARAM_CONVERSIONPARAMS,
+            CMD_STRINGPARAM_CONVERSIONOUT,
             CMD_STRINGPARAM_DISPLAY,
             CMD_STRINGPARAM_LANGUAGE,
             CMD_STRINGPARAM_COUNT			// must be last element!
@@ -169,6 +172,9 @@ 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                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 8af72e6..cb96e6f 100644
--- a/desktop/source/app/cmdlinehelp.cxx
+++ b/desktop/source/app/cmdlinehelp.cxx
@@ -116,7 +116,17 @@ 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";
+        "-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 e6383e3..9bcba45 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()
@@ -141,7 +185,6 @@ sal_Bool DispatchWatcher::executeDispatchRequests( const DispatchList& aDispatch
 
     for ( p = aDispatchRequestsList.begin(); p != aDispatchRequestsList.end(); p++ )
     {
-        String					aPrinterName;
         const DispatchRequest&	aDispatchRequest = *p;
 
         // create parameter array
@@ -151,7 +194,9 @@ sal_Bool DispatchWatcher::executeDispatchRequests( const DispatchList& aDispatch
 
         // 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 +206,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 +243,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 +263,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;
@@ -361,24 +409,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 );
-                        aPrinterArgs[0].Name = ::rtl::OUString::createFromAscii("Name");
-                        aPrinterArgs[0].Value <<= ::rtl::OUString( aDispatchRequest.aPrinterName );
-                        xDoc->setPrinter( aPrinterArgs );
+                        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("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 +599,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 +633,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 f7de7ae..62828a5 100644
--- a/desktop/source/app/dispatchwatcher.hxx
+++ b/desktop/source/app/dispatchwatcher.hxx
@@ -75,7 +75,9 @@ class DispatchWatcher : public ::cppu::WeakImplHelper1< ::com::sun::star::frame:
             REQUEST_PRINT,
             REQUEST_PRINTTO,
             REQUEST_FORCEOPEN,
-            REQUEST_FORCENEW
+            REQUEST_FORCENEW,
+            REQUEST_CONVERSION,
+            REQUEST_BATCHPRINT
         };
 
         struct DispatchRequest
@@ -86,7 +88,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 0bd9db4..56d02e4 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
@@ -961,7 +1018,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 92a35a5..4f442a9 100644
--- a/desktop/source/app/officeipcthread.hxx
+++ b/desktop/source/app/officeipcthread.hxx
@@ -66,6 +66,9 @@ 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;
     ::osl::Condition *pcProcessed;  // pointer condition to be set when the request has been processed
 };
 
diff --git a/sfx2/source/bastyp/fltfnc.cxx b/sfx2/source/bastyp/fltfnc.cxx
index c42e49d..6d8c9b8 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;
 }
commit 495e53b5cf4eca01ac3137aca702bf69d7f8eaff
Author: Michael Meeks <michael.meeks at novell.com>
Date:   Wed Aug 25 23:26:49 2010 +0200

    ui-desktop-integration.diff: Disable UI [toolbars, menus] customization.

diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx
index e4cb7fd..4a1f2fe 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 bb97a82..d9ae3cf 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/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index bad5fbc..7e02dce 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -5775,6 +5775,13 @@
                 </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>
diff --git a/sfx2/sdi/appslots.sdi b/sfx2/sdi/appslots.sdi
index a230036..b80d93e 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 2f4c757..837f5be 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);
commit ec8def06ff678872a89d06d420a5987b3eb94fa9
Author: Thorsten Behrens <thb at openoffice.org>
Date:   Wed Aug 25 23:17:27 2010 +0200

    linkwarn-svx-warning-dlg.diff: Link warning dialog.
    
    n#348149

diff --git a/svx/inc/svx/dialogs.hrc b/svx/inc/svx/dialogs.hrc
index 26cd56c..d9a7524 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 0000000..270ce36
--- /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 2403c04..d79e421 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 0000000..e361675
--- /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 0000000..d01dc88
--- /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 0000000..100b53c
--- /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 ac608fa..3805de9 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 \
commit 5c7a42b8d654ac3f97138eda47ee1478789460dd
Author: Thorsten Behrens <thb at openoffice.org>
Date:   Wed Aug 25 23:10:41 2010 +0200

    linkwarn-officecfg-disable-msgbox.diff: Do not link images if possible.
    
    n#348149

diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index 5f31f98..bad5fbc 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>
commit df2f93008fcaec8bcc12850ddd400fb218da9ee7
Author: Thorsten Behrens <thb at openoffice.org>
Date:   Wed Aug 25 22:56:42 2010 +0200

    linkwarn-sfx2-disable-cb-persistency.diff: Disable checkbox persistency.
    
    n#348149

diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx
index 0d76af8..3bab58f 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() )
commit e63de186d0e900fa24e4e34ccda5434b83de3d7a
Author: Tor Lillqvist <tlillqvist at novell.com>
Date:   Wed Aug 25 22:28:03 2010 +0200

    novell-win32-odma.diff: ODMA dialog implementation.
    
    i#6885, i#32741

diff --git a/desktop/source/app/cmdlineargs.cxx b/desktop/source/app/cmdlineargs.cxx
index c142c5f..06f6e33 100644
--- a/desktop/source/app/cmdlineargs.cxx
+++ b/desktop/source/app/cmdlineargs.cxx
@@ -306,6 +306,15 @@ void CommandLineArgs::ParseCommandLine_Impl( Supplier& supplier )
                     }
                     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 );
diff --git a/fpicker/prj/build.lst b/fpicker/prj/build.lst
index 47b7c7c..04872c5 100644
--- a/fpicker/prj/build.lst
+++ b/fpicker/prj/build.lst
@@ -2,6 +2,7 @@ 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
diff --git a/fpicker/source/generic/fpicker.cxx b/fpicker/source/generic/fpicker.cxx
index 980c045..2498066 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 bfbfb65..f426bd7 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 0000000..09eb01b
--- /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 0000000..42c644b
--- /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 0000000..d8304a2
--- /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>

... etc. - the rest is truncated


More information about the ooo-build-commit mailing list