summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Lillqvist <tlillqvist@novell.com>2010-08-25 22:28:03 +0200
committerJan Holesovsky <kendy@suse.cz>2010-08-26 13:08:23 +0200
commite63de186d0e900fa24e4e34ccda5434b83de3d7a (patch)
treec4449c8c8a7958236fd59848f6375fc64dfe5246
parent47c333a0f61a5d91c1379f4b6aac58e5505735d4 (diff)
novell-win32-odma.diff: ODMA dialog implementation.
i#6885, i#32741
-rw-r--r--desktop/source/app/cmdlineargs.cxx9
-rw-r--r--fpicker/prj/build.lst1
-rw-r--r--fpicker/source/generic/fpicker.cxx28
-rw-r--r--fpicker/source/generic/makefile.mk1
-rw-r--r--fpicker/source/odma/ODMAFilePicker.cxx532
-rw-r--r--fpicker/source/odma/ODMAFilePicker.hxx213
-rw-r--r--fpicker/source/odma/ODMAFolderPicker.cxx182
-rw-r--r--fpicker/source/odma/ODMAFolderPicker.hxx100
-rw-r--r--fpicker/source/odma/exports.map8
-rw-r--r--fpicker/source/odma/fps_odma.cxx78
-rw-r--r--fpicker/source/odma/makefile.mk72
-rw-r--r--framework/prj/build.lst2
-rw-r--r--framework/source/uielement/recentfilesmenucontroller.cxx40
-rw-r--r--framework/util/makefile.mk1
-rw-r--r--officecfg/registry/data/org/openoffice/ucb/Configuration.xcu11
-rw-r--r--officecfg/registry/schema/org/openoffice/Office/Common.xcs7
-rw-r--r--ucb/prj/build.lst1
-rw-r--r--ucb/prj/d.lst5
-rw-r--r--ucb/source/ucp/odma/makefile.mk11
-rw-r--r--ucb/source/ucp/odma/odma_content.cxx100
-rw-r--r--ucb/source/ucp/odma/odma_content.hxx2
-rw-r--r--ucb/source/ucp/odma/odma_contentprops.hxx1
-rw-r--r--ucb/source/ucp/odma/odma_datasupplier.cxx3
-rw-r--r--ucb/source/ucp/odma/odma_lib.cxx25
-rw-r--r--ucb/source/ucp/odma/odma_lib.hxx76
-rw-r--r--ucb/source/ucp/odma/odma_provider.cxx8
-rw-r--r--ucb/source/ucp/odma/odma_provider.hxx15
-rw-r--r--ucb/source/ucp/odma/odma_services.cxx14
-rw-r--r--ucb/source/ucp/odma/ucpodma.xml2
29 files changed, 1401 insertions, 147 deletions
diff --git a/desktop/source/app/cmdlineargs.cxx b/desktop/source/app/cmdlineargs.cxx
index c142c5f96a..06f6e33555 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 47b7c7c693..04872c5354 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 980c04513b..2498066c78 100644
--- a/fpicker/source/generic/fpicker.cxx
+++ b/fpicker/source/generic/fpicker.cxx
@@ -34,6 +34,13 @@
#include "cppuhelper/implementationentry.hxx"
#endif
#include "com/sun/star/lang/XMultiComponentFactory.hpp"
+
+#ifdef WNT
+#include <tools/prewin.h>
+#include <tools/postwin.h>
+#include <odma_lib.hxx>
+#endif
+
#include "svtools/miscopt.hxx"
#include "svl/pickerhistoryaccess.hxx"
@@ -52,6 +59,7 @@ using rtl::OUString;
*/
static OUString FilePicker_getSystemPickerServiceName()
{
+#ifdef UNX
OUString aDesktopEnvironment (Application::GetDesktopEnvironment());
if (aDesktopEnvironment.equalsIgnoreAsciiCaseAscii ("gnome"))
return OUString (RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.ui.dialogs.GtkFilePicker"));
@@ -61,8 +69,14 @@ static OUString FilePicker_getSystemPickerServiceName()
return OUString (RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.ui.dialogs.KDE4FilePicker"));
else if (aDesktopEnvironment.equalsIgnoreAsciiCaseAscii ("macosx"))
return OUString (RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.ui.dialogs.AquaFilePicker"));
- else
- return OUString (RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.ui.dialogs.SystemFilePicker"));
+#endif
+#ifdef WNT
+ if (SvtMiscOptions().TryODMADialog() && ::odma::DMSsAvailable()) {
+ return OUString (RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.ui.dialogs.ODMAFilePicker"));
+ }
+ return OUString (RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.ui.dialogs.Win32FilePicker"));
+#endif
+ return OUString (RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.ui.dialogs.SystemFilePicker"));
}
static Reference< css::uno::XInterface > FilePicker_createInstance (
@@ -123,14 +137,20 @@ static Sequence< OUString > FilePicker_getSupportedServiceNames()
static OUString FolderPicker_getSystemPickerServiceName()
{
OUString aDesktopEnvironment (Application::GetDesktopEnvironment());
+#ifdef UNX
if (aDesktopEnvironment.equalsIgnoreAsciiCaseAscii ("gnome"))
return OUString (RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.ui.dialogs.GtkFolderPicker"));
else if (aDesktopEnvironment.equalsIgnoreAsciiCaseAscii ("kde"))
return OUString (RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.ui.dialogs.KDEFolderPicker"));
else if (aDesktopEnvironment.equalsIgnoreAsciiCaseAscii ("macosx"))
return OUString (RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.ui.dialogs.AquaFolderPicker"));
- else
- return OUString (RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.ui.dialogs.SystemFolderPicker"));
+#endif
+#ifdef WNT
+ if (SvtMiscOptions().TryODMADialog() && ::odma::DMSsAvailable()) {
+ return OUString (RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.ui.dialogs.ODMAFolderPicker"));
+ }
+#endif
+ return OUString (RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.ui.dialogs.SystemFolderPicker"));
}
static Reference< css::uno::XInterface > FolderPicker_createInstance (
diff --git a/fpicker/source/generic/makefile.mk b/fpicker/source/generic/makefile.mk
index bfbfb65f3d..f426bd7ad7 100644
--- a/fpicker/source/generic/makefile.mk
+++ b/fpicker/source/generic/makefile.mk
@@ -46,6 +46,7 @@ SHL1TARGET= $(TARGET)
SHL1IMPLIB= i$(TARGET)
SHL1OBJS= $(SLOFILES)
SHL1STDLIBS=\
+ $(ODMA_LIB_LIB) \
$(VCLLIB) \
$(SVLLIB) \
$(SVTOOLLIB) \
diff --git a/fpicker/source/odma/ODMAFilePicker.cxx b/fpicker/source/odma/ODMAFilePicker.cxx
new file mode 100644
index 0000000000..09eb01b737
--- /dev/null
+++ b/fpicker/source/odma/ODMAFilePicker.cxx
@@ -0,0 +1,532 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ * Copyright 2010 Novell, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_fpicker.hxx"
+
+#include "ODMAFilePicker.hxx"
+
+#include <tools/debug.hxx>
+
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/beans/StringPair.hpp>
+#include <com/sun/star/ui/dialogs/FilePreviewImageFormats.hpp>
+#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
+#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
+#include <com/sun/star/ucb/XCommandEnvironment.hpp>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+
+#include <comphelper/sequence.hxx>
+#include <cppuhelper/typeprovider.hxx>
+#include <ucbhelper/content.hxx>
+#include <unotools/ucbhelper.hxx>
+
+#ifndef ODMA_LIB_HXX
+#include <tools/prewin.h>
+#include <tools/postwin.h>
+#include <odma_lib.hxx>
+#endif
+
+// using ----------------------------------------------------------------
+
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::ui::dialogs;
+using namespace ::com::sun::star::ucb;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::util;
+using namespace ::utl;
+
+//------------------------------------------------------------------------------------
+// class ODMAFilePicker
+//------------------------------------------------------------------------------------
+ODMAFilePicker::ODMAFilePicker( const Reference < XMultiServiceFactory >& xFactory ) :
+ cppu::WeakComponentImplHelper9<
+ XFilterManager,
+ XFilterGroupManager,
+ XFilePickerControlAccess,
+ XFilePickerNotifier,
+ XFilePreview,
+ XInitialization,
+ XCancellable,
+ XEventListener,
+ XServiceInfo>( m_rbHelperMtx ),
+ m_bMultiSelectionMode( sal_False ),
+ m_aDefaultName( ),
+ m_aFiles( ),
+ m_nDialogKind( OPEN )
+{
+ m_bUseDMS = ::odma::DMSsAvailable();
+ m_xSystemFilePicker = xFactory->createInstance(
+ ::rtl::OUString::createFromAscii( "com.sun.star.ui.dialogs.Win32FilePicker" ) );
+}
+
+// XExecutableDialog functions
+
+void SAL_CALL ODMAFilePicker::setTitle( const ::rtl::OUString& aTitle )
+ throw (RuntimeException)
+{
+ Reference< XExecutableDialog > xExecutableDialog( m_xSystemFilePicker, UNO_QUERY );
+ xExecutableDialog->setTitle( aTitle);
+}
+
+sal_Int16 SAL_CALL ODMAFilePicker::execute( )
+ throw (RuntimeException)
+{
+ ODMSTATUS status;
+ ODMHANDLE handle;
+ WORD count = 0;
+ DWORD flags;
+
+ status = NODMRegisterApp( &handle, ODM_API_VERSION, "sodma", (DWORD) GetActiveWindow( ), NULL );
+ if (status == ODM_SUCCESS)
+ {
+ if (m_nDialogKind == OPEN)
+ {
+ const int MAXDOCS = 10;
+ char docids[ODM_DOCID_MAX*MAXDOCS+1];
+ WORD docidslen = sizeof( docids );
+
+ flags = 0;
+ if (m_bMultiSelectionMode)
+ count = MAXDOCS;
+ else
+ count = 1;
+ status = NODMSelectDocEx( handle, docids, &docidslen, &count, &flags, NULL );
+ if (status == ODM_SUCCESS)
+ {
+ // GroupWise doesn't set docidslen or count, so
+ // calculate number of document IDs manually
+ char *p = docids;
+ count = 0;
+ while (*p) {
+ count++;
+ p += strlen( p ) + 1;
+ }
+ }
+ else if (status == ODM_E_NOSUPPORT)
+ {
+ status = NODMSelectDoc( handle, docids, &flags );
+ if (status == ODM_SUCCESS)
+ count = 1;
+ }
+ NODMUnRegisterApp( handle );
+ if (status == ODM_SUCCESS)
+ {
+ rtl::OUString *strings = new rtl::OUString[count];
+ int i;
+ char *p = docids;
+
+ for (i = 0; i < count; i++) {
+ // Insane API... the first element is a full URI, the rest
+ // are just the "basenames" in the same "directory".
+ if (i == 0)
+ strings[0] = rtl::OUString::createFromAscii( "vnd.sun.star.odma:/" ) + rtl::OUString::createFromAscii( p );
+ else
+ strings[i] = rtl::OUString::createFromAscii( p );
+ p += strlen( p );
+ }
+
+ m_aFiles = Sequence< rtl::OUString >( strings, count );
+ delete[] strings;
+ return ExecutableDialogResults::OK;
+ }
+ }
+ else /* m_nDialogKind == SAVE */
+ {
+ char newdocid[ODM_DOCID_MAX+1];
+
+ if (m_aDefaultName.getLength() == 0 ||
+ !m_aDefaultName.matchIgnoreAsciiCaseAsciiL( "::ODMA\\", 7, 0 ))
+ {
+ char tempdocid[ODM_DOCID_MAX+1];
+
+ status = NODMNewDoc( handle, tempdocid, ODM_SILENT, NULL, NULL );
+ if (status == ODM_SUCCESS)
+ status = NODMSaveAs( handle, tempdocid, newdocid, NULL, NULL, NULL );
+ }
+ else
+ {
+ rtl::OString sDefaultName = rtl::OUStringToOString( m_aDefaultName, RTL_TEXTENCODING_ASCII_US );
+ status = NODMSaveAs( handle,
+ const_cast<sal_Char*>( sDefaultName.getStr() ),
+ newdocid, NULL, NULL, NULL );
+ }
+
+ NODMUnRegisterApp( handle );
+ if (status == ODM_SUCCESS)
+ {
+ rtl::OUString s( rtl::OUString::createFromAscii( "vnd.sun.star.odma:/" ) +
+ rtl::OUString::createFromAscii( newdocid ) );
+ // Create a Content for the odma URL so that
+ // odma::ContentProvider will learn about the DOCID we
+ // just created.
+ ucbhelper::Content content( s, Reference< XCommandEnvironment >() );
+ m_aFiles = Sequence< rtl::OUString >( &s, 1 );
+ return ExecutableDialogResults::OK;
+ }
+ }
+ }
+ if (status == ODM_E_APPSELECT)
+ {
+ m_bUseDMS = sal_False;
+
+ Reference< XExecutableDialog > xExecutableDialog( m_xSystemFilePicker, UNO_QUERY );
+ return xExecutableDialog->execute();
+ }
+
+ // Fallback
+ return ExecutableDialogResults::CANCEL;
+}
+
+// XFilePicker functions
+
+void SAL_CALL ODMAFilePicker::setMultiSelectionMode( sal_Bool bMode )
+ throw( RuntimeException )
+{
+ m_bMultiSelectionMode = bMode;
+
+ Reference< XFilePicker > xFilePicker( m_xSystemFilePicker, UNO_QUERY );
+ xFilePicker->setMultiSelectionMode( bMode );
+}
+
+void SAL_CALL ODMAFilePicker::setDefaultName( const rtl::OUString& aName )
+ throw( RuntimeException )
+{
+ // When editing a document from DMS, and doing Save As, this is
+ // called twice, first with the complete DOCID, the second time
+ // with the "extension" removed. Of course, this is bogus, as
+ // DOCIDs should be treated as opaque strings, they don't have
+ // "extensions".
+
+ // In the GroupWise case a DOCID is like
+ // ::ODMA\GRPWISE\FOO1.BAR.FOO-Bla_bla:12345.12 where the final
+ // dot separates the version number, not an "extension".
+ //
+ // So ignore the second call.
+ //
+ // The second call without "extension" is done if the
+ // XFilePickerControlAccess is set to have auto-extension turned
+ // on. (See sfx2/source/dialog/filedlghelper.cxx:
+ // FileDialogHelper_Impl::implInitializeFileName().) Thus we could
+ // alternatively make sure that a getValue call to get
+ // ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION returns
+ // false. But that might be hard as we don't know in advance
+ // whether the user will click the "use application dialog"
+ // button. If so, we indeed do use auto-extensions.
+ //
+ // Yes, this is ugly, relying on knowing details on how this
+ // function will be called.
+
+ if ( m_aDefaultName.getLength() == 0 )
+ m_aDefaultName = aName;
+
+ Reference< XFilePicker > xFilePicker( m_xSystemFilePicker, UNO_QUERY );
+ xFilePicker->setDefaultName( aName );
+}
+
+void SAL_CALL ODMAFilePicker::setDisplayDirectory( const rtl::OUString& aDirectory )
+ throw( IllegalArgumentException, RuntimeException )
+{
+ m_aDisplayDirectory = aDirectory;
+
+ Reference< XFilePicker > xFilePicker( m_xSystemFilePicker, UNO_QUERY );
+ xFilePicker->setDisplayDirectory( aDirectory );
+}
+
+rtl::OUString SAL_CALL ODMAFilePicker::getDisplayDirectory( )
+ throw( RuntimeException )
+{
+ if (m_bUseDMS)
+ return m_aDisplayDirectory;
+
+ Reference< XFilePicker > xFilePicker( m_xSystemFilePicker, UNO_QUERY );
+ return xFilePicker->getDisplayDirectory();
+}
+
+Sequence< rtl::OUString > SAL_CALL ODMAFilePicker::getFiles( )
+ throw( RuntimeException )
+{
+ if (m_bUseDMS)
+ return m_aFiles;
+
+ Reference< XFilePicker > xFilePicker( m_xSystemFilePicker, UNO_QUERY );
+ return xFilePicker->getFiles();
+}
+
+// XFilePickerControlAccess functions
+
+void SAL_CALL ODMAFilePicker::setValue( sal_Int16 nElementID,
+ sal_Int16 nControlAction,
+ const Any& rValue )
+ throw( RuntimeException )
+{
+ Reference< XFilePickerControlAccess > xFilePickerControlAccess( m_xSystemFilePicker, UNO_QUERY );
+ xFilePickerControlAccess->setValue( nElementID, nControlAction, rValue );
+}
+
+Any SAL_CALL ODMAFilePicker::getValue( sal_Int16 nElementID, sal_Int16 nControlAction )
+ throw( RuntimeException )
+{
+ Reference< XFilePickerControlAccess > xFilePickerControlAccess( m_xSystemFilePicker, UNO_QUERY );
+ return xFilePickerControlAccess->getValue( nElementID, nControlAction );
+}
+
+void SAL_CALL ODMAFilePicker::setLabel( sal_Int16 nLabelID, const rtl::OUString& rValue )
+ throw ( RuntimeException )
+{
+ Reference< XFilePickerControlAccess > xFilePickerControlAccess( m_xSystemFilePicker, UNO_QUERY );
+ xFilePickerControlAccess->setLabel( nLabelID, rValue );
+}
+
+rtl::OUString SAL_CALL ODMAFilePicker::getLabel( sal_Int16 nLabelID )
+ throw ( RuntimeException )
+{
+ Reference< XFilePickerControlAccess > xFilePickerControlAccess( m_xSystemFilePicker, UNO_QUERY );
+ return xFilePickerControlAccess->getLabel( nLabelID );
+}
+
+void SAL_CALL ODMAFilePicker::enableControl( sal_Int16 nElementID, sal_Bool bEnable )
+ throw( RuntimeException )
+{
+ Reference< XFilePickerControlAccess > xFilePickerControlAccess( m_xSystemFilePicker, UNO_QUERY );
+ xFilePickerControlAccess->enableControl( nElementID, bEnable );
+}
+
+// XFilePickerNotifier functions
+
+void SAL_CALL ODMAFilePicker::addFilePickerListener( const Reference< XFilePickerListener >& xListener )
+ throw ( RuntimeException )
+{
+ Reference< XFilePickerNotifier > xFilePickerNotifier( m_xSystemFilePicker, UNO_QUERY );
+ xFilePickerNotifier->addFilePickerListener( xListener );
+}
+
+void SAL_CALL ODMAFilePicker::removeFilePickerListener( const Reference< XFilePickerListener >& xListener )
+ throw ( RuntimeException )
+{
+ Reference< XFilePickerNotifier > xFilePickerNotifier( m_xSystemFilePicker, UNO_QUERY );
+ xFilePickerNotifier->removeFilePickerListener( xListener );
+}
+
+// XFilePreview functions
+
+Sequence< sal_Int16 > SAL_CALL ODMAFilePicker::getSupportedImageFormats( )
+ throw ( RuntimeException )
+{
+ Reference< XFilePreview > xFilePreview( m_xSystemFilePicker, UNO_QUERY );
+ return xFilePreview->getSupportedImageFormats();
+}
+
+sal_Int32 SAL_CALL ODMAFilePicker::getTargetColorDepth( )
+ throw ( RuntimeException )
+{
+ Reference< XFilePreview > xFilePreview( m_xSystemFilePicker, UNO_QUERY );
+ return xFilePreview->getTargetColorDepth();
+}
+
+sal_Int32 SAL_CALL ODMAFilePicker::getAvailableWidth( )
+ throw ( RuntimeException )
+{
+ Reference< XFilePreview > xFilePreview( m_xSystemFilePicker, UNO_QUERY );
+ return xFilePreview->getAvailableWidth();
+}
+
+sal_Int32 SAL_CALL ODMAFilePicker::getAvailableHeight( )
+ throw ( RuntimeException )
+{
+ Reference< XFilePreview > xFilePreview( m_xSystemFilePicker, UNO_QUERY );
+ return xFilePreview->getAvailableHeight();
+}
+
+void SAL_CALL ODMAFilePicker::setImage( sal_Int16 aImageFormat, const Any& rImage )
+ throw ( IllegalArgumentException, RuntimeException )
+{
+ Reference< XFilePreview > xFilePreview( m_xSystemFilePicker, UNO_QUERY );
+ xFilePreview->setImage( aImageFormat, rImage);
+}
+
+sal_Bool SAL_CALL ODMAFilePicker::setShowState( sal_Bool bShowState )
+ throw ( RuntimeException )
+{
+ Reference< XFilePreview > xFilePreview( m_xSystemFilePicker, UNO_QUERY );
+ return xFilePreview->setShowState( bShowState);
+}
+
+sal_Bool SAL_CALL ODMAFilePicker::getShowState( )
+ throw ( RuntimeException )
+{
+ Reference< XFilePreview > xFilePreview( m_xSystemFilePicker, UNO_QUERY );
+ return xFilePreview->getShowState();
+}
+
+// XFilterGroupManager functions
+
+void SAL_CALL ODMAFilePicker::appendFilterGroup( const ::rtl::OUString& sGroupTitle,
+ const Sequence< StringPair >& aFilters )
+ throw ( IllegalArgumentException, RuntimeException )
+{
+ Reference< XFilterGroupManager > xFilterGroupManager( m_xSystemFilePicker, UNO_QUERY );
+ xFilterGroupManager->appendFilterGroup( sGroupTitle, aFilters );
+}
+
+// XFilterManager functions
+
+void SAL_CALL ODMAFilePicker::appendFilter( const rtl::OUString& aTitle,
+ const rtl::OUString& aFilter )
+ throw( IllegalArgumentException, RuntimeException )
+{
+ Reference< XFilterManager > xFilterManager( m_xSystemFilePicker, UNO_QUERY );
+ xFilterManager->appendFilter( aTitle, aFilter );
+}
+
+void SAL_CALL ODMAFilePicker::setCurrentFilter( const rtl::OUString& aTitle )
+ throw( IllegalArgumentException, RuntimeException )
+{
+ Reference< XFilterManager > xFilterManager( m_xSystemFilePicker, UNO_QUERY );
+ xFilterManager->setCurrentFilter( aTitle );
+}
+
+rtl::OUString SAL_CALL ODMAFilePicker::getCurrentFilter( )
+ throw( RuntimeException )
+{
+ Reference< XFilterManager > xFilterManager( m_xSystemFilePicker, UNO_QUERY );
+ return xFilterManager->getCurrentFilter();
+}
+
+// XInitialization functions
+
+void SAL_CALL ODMAFilePicker::initialize( const Sequence< Any >& aArguments )
+ throw ( Exception, RuntimeException )
+{
+ if (aArguments.getLength( ) > 0)
+ {
+ Any aAny = aArguments[0];
+
+ if ( (aAny.getValueType() == ::getCppuType((sal_Int16*)0)) ||
+ (aAny.getValueType() == ::getCppuType((sal_Int8*)0)) )
+ {
+ sal_Int16 nTemplateId = -1;
+ aAny >>= nTemplateId;
+
+ switch (nTemplateId) {
+ case TemplateDescription::FILEOPEN_SIMPLE:
+ case TemplateDescription::FILEOPEN_LINK_PREVIEW_IMAGE_TEMPLATE:
+ case TemplateDescription::FILEOPEN_PLAY:
+ case TemplateDescription::FILEOPEN_READONLY_VERSION:
+ case TemplateDescription::FILEOPEN_LINK_PREVIEW:
+ m_nDialogKind = OPEN;
+ break;
+ default:
+ m_nDialogKind = SAVE;
+ }
+ }
+ }
+
+ Reference< XInitialization > xInitialization( m_xSystemFilePicker, UNO_QUERY );
+ xInitialization->initialize( aArguments );
+}
+
+// XCancellable functions
+
+void SAL_CALL ODMAFilePicker::cancel( )
+ throw( ::com::sun::star::uno::RuntimeException )
+{
+ Reference< XCancellable > xCancellable( m_xSystemFilePicker, UNO_QUERY );
+ xCancellable->cancel();
+}
+
+// XEventListener functions
+
+void SAL_CALL ODMAFilePicker::disposing( const ::com::sun::star::lang::EventObject& aEvent )
+ throw( RuntimeException )
+{
+ Reference< XEventListener > xEventListener( m_xSystemFilePicker, UNO_QUERY );
+ xEventListener->disposing( aEvent );
+}
+
+// XServiceInfo functions
+
+rtl::OUString SAL_CALL ODMAFilePicker::getImplementationName( )
+ throw( RuntimeException )
+{
+ return impl_getStaticImplementationName();
+}
+
+sal_Bool SAL_CALL ODMAFilePicker::supportsService( const rtl::OUString& sServiceName )
+ throw( RuntimeException )
+{
+ Sequence< rtl::OUString > seqServiceNames = getSupportedServiceNames();
+ const rtl::OUString* pArray = seqServiceNames.getConstArray();
+ for ( sal_Int32 i = 0; i < seqServiceNames.getLength(); i++ )
+ {
+ if ( sServiceName == pArray[i] )
+ {
+ return sal_True ;
+ }
+ }
+ return sal_False ;
+}
+
+Sequence< rtl::OUString > SAL_CALL ODMAFilePicker::getSupportedServiceNames( )
+ throw( RuntimeException )
+{
+ return impl_getStaticSupportedServiceNames();
+}
+
+Sequence< rtl::OUString > ODMAFilePicker::impl_getStaticSupportedServiceNames( )
+{
+ Sequence< rtl::OUString > seqServiceNames( 2 );
+ rtl::OUString* pArray = seqServiceNames.getArray();
+ pArray[0] = rtl::OUString::createFromAscii( "com.sun.star.ui.dialogs.ODMAFilePicker" );
+
+ // Super-ugly, but check the function sal_Bool
+ // lcl_isSystemFilePicker( const Reference< XFilePicker >& ) in
+ // sfx2/source/dialog/filedlghelper.cxx
+
+ // Lovely undocumented coupling right across abstraction layers,
+ // isn't it? If we don't claim to implement this "service" (which
+ // is not defined in any IDL file, btw), we get hangs.
+
+ pArray[1] = rtl::OUString::createFromAscii( "com.sun.star.ui.dialogs.SystemFilePicker" );
+ return seqServiceNames ;
+}
+
+rtl::OUString ODMAFilePicker::impl_getStaticImplementationName( )
+{
+ return rtl::OUString::createFromAscii( "com.sun.star.svtools.ODMAFilePicker" );
+}
+
+Reference< XInterface > SAL_CALL ODMAFilePicker::impl_createInstance(
+ const Reference< XComponentContext >& rxContext)
+ throw( Exception )
+{
+ Reference< XMultiServiceFactory > xServiceManager (rxContext->getServiceManager(), UNO_QUERY_THROW);
+ return Reference< XInterface >( *new ODMAFilePicker( xServiceManager ) );
+}
diff --git a/fpicker/source/odma/ODMAFilePicker.hxx b/fpicker/source/odma/ODMAFilePicker.hxx
new file mode 100644
index 0000000000..42c644b0ae
--- /dev/null
+++ b/fpicker/source/odma/ODMAFilePicker.hxx
@@ -0,0 +1,213 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ * Copyright 2010 Novell, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_ODMA_FILEPICKER_HXX
+#define INCLUDED_ODMA_FILEPICKER_HXX
+
+#include <cppuhelper/compbase9.hxx>
+
+#include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
+#include <com/sun/star/ui/dialogs/XFilePickerNotifier.hpp>
+#include <com/sun/star/ui/dialogs/XFilePreview.hpp>
+#include <com/sun/star/ui/dialogs/XFilterManager.hpp>
+#include <com/sun/star/ui/dialogs/XFilterGroupManager.hpp>
+#include <com/sun/star/ui/dialogs/XFilePickerListener.hpp>
+#include <com/sun/star/util/XCancellable.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+
+// class ODMAFilePicker ---------------------------------------------------
+
+class ODMAFilePicker :
+ public cppu::WeakComponentImplHelper9<
+ ::com::sun::star::ui::dialogs::XFilterManager,
+ ::com::sun::star::ui::dialogs::XFilterGroupManager,
+ ::com::sun::star::ui::dialogs::XFilePickerControlAccess,
+ ::com::sun::star::ui::dialogs::XFilePickerNotifier,
+ ::com::sun::star::ui::dialogs::XFilePreview,
+ ::com::sun::star::lang::XInitialization,
+ ::com::sun::star::util::XCancellable,
+ ::com::sun::star::lang::XEventListener,
+ ::com::sun::star::lang::XServiceInfo >
+{
+private:
+ sal_Bool m_bUseDMS;
+ sal_Bool m_bMultiSelectionMode;
+ rtl::OUString m_aDefaultName;
+ rtl::OUString m_aDisplayDirectory;
+ ::com::sun::star::uno::Sequence< rtl::OUString > m_aFiles;
+ enum { OPEN, SAVE } m_nDialogKind;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xSystemFilePicker;
+
+protected:
+ ::osl::Mutex m_rbHelperMtx;
+
+public:
+
+ ODMAFilePicker( const ::com::sun::star::uno::Reference < ::com::sun::star::lang::XMultiServiceFactory >& xFactory );
+
+ // XFilterManager functions
+
+ virtual void SAL_CALL appendFilter( const ::rtl::OUString& aTitle,
+ const ::rtl::OUString& aFilter )
+ throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL setCurrentFilter( const ::rtl::OUString& aTitle )
+ throw( ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException );
+
+ virtual ::rtl::OUString SAL_CALL getCurrentFilter( )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ // XFilterGroupManager functions
+
+ virtual void SAL_CALL appendFilterGroup( const ::rtl::OUString& sGroupTitle,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::StringPair >& aFilters )
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException );
+
+ // XFilePickerControlAccess functions
+
+ virtual void SAL_CALL setValue( sal_Int16 nControlID,
+ sal_Int16 nControlAction,
+ const ::com::sun::star::uno::Any& aValue )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual ::com::sun::star::uno::Any SAL_CALL getValue( sal_Int16 nControlID,
+ sal_Int16 nControlAction )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL setLabel( sal_Int16 nControlID,
+ const ::rtl::OUString& aValue )
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ virtual ::rtl::OUString SAL_CALL getLabel( sal_Int16 nControlID )
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL enableControl( sal_Int16 nControlID,
+ sal_Bool bEnable )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ // XFilePicker functions
+
+ virtual void SAL_CALL setMultiSelectionMode( sal_Bool bMode )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL setDefaultName( const ::rtl::OUString& aName )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL setDisplayDirectory( const ::rtl::OUString& aDirectory )
+ throw( ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException );
+
+ virtual ::rtl::OUString SAL_CALL getDisplayDirectory( )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getFiles( )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ // XExecutableDialog functions
+
+ virtual void SAL_CALL setTitle( const ::rtl::OUString& aTitle )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual sal_Int16 SAL_CALL execute( )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XFilePickerNotifier functions
+
+ virtual void SAL_CALL addFilePickerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XFilePickerListener >& xListener )
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL removeFilePickerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XFilePickerListener >& xListener )
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ // XFilePreview functions
+
+ virtual ::com::sun::star::uno::Sequence< sal_Int16 > SAL_CALL getSupportedImageFormats( )
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ virtual sal_Int32 SAL_CALL getTargetColorDepth( )
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ virtual sal_Int32 SAL_CALL getAvailableWidth( )
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ virtual sal_Int32 SAL_CALL getAvailableHeight( )
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL setImage( sal_Int16 aImageFormat,
+ const ::com::sun::star::uno::Any& aImage )
+ throw ( ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException );
+
+ virtual sal_Bool SAL_CALL setShowState( sal_Bool bShowState )
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ virtual sal_Bool SAL_CALL getShowState( )
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ // XInitialization functions
+
+ virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments )
+ throw ( ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException );
+
+ // XCancellable functions
+
+ virtual void SAL_CALL cancel( )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ // XEventListener functions
+
+ using cppu::WeakComponentImplHelperBase::disposing;
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& aEvent )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ // XServiceInfo functions
+
+ virtual ::rtl::OUString SAL_CALL getImplementationName( )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& sServiceName )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ /* Helper for XServiceInfo */
+ static ::com::sun::star::uno::Sequence< ::rtl::OUString > impl_getStaticSupportedServiceNames( );
+ static ::rtl::OUString impl_getStaticImplementationName( );
+
+ /* Helper for registry */
+ static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL impl_createInstance ( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext )
+ throw( ::com::sun::star::uno::Exception );
+};
+
+#endif // INCLUDED_ODMA_FILEPICKER_HXX
diff --git a/fpicker/source/odma/ODMAFolderPicker.cxx b/fpicker/source/odma/ODMAFolderPicker.cxx
new file mode 100644
index 0000000000..d8304a27b6
--- /dev/null
+++ b/fpicker/source/odma/ODMAFolderPicker.cxx
@@ -0,0 +1,182 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ * Copyright 2010 Novell, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_fpicker.hxx"
+
+#include "ODMAFolderPicker.hxx"
+
+#define _SVSTDARR_STRINGSDTOR
+#include "svl/svstdarr.hxx"
+
+#include <com/sun/star/container/XContentEnumerationAccess.hpp>
+#include <com/sun/star/container/XSet.hpp>
+#include <com/sun/star/uno/Any.hxx>
+#include <cppuhelper/factory.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <unotools/pathoptions.hxx>
+
+#ifndef ODMA_LIB_HXX
+#include <tools/prewin.h>
+#include <odma_lib.hxx>
+#include <tools/postwin.h>
+#endif
+
+// using ----------------------------------------------------------------
+
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+
+//------------------------------------------------------------------------------------
+// class ODMAFolderPicker
+//------------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------------
+ODMAFolderPicker::ODMAFolderPicker( const Reference < XMultiServiceFactory >& xFactory ) :
+ cppu::WeakComponentImplHelper2<
+ XFolderPicker,
+ XServiceInfo>( m_rbHelperMtx ),
+ m_bUseDMS( sal_False )
+{
+ m_xInterface = xFactory->createInstance(
+ ::rtl::OUString::createFromAscii( "com.sun.star.ui.dialogs.SystemFolderPicker" ) );
+}
+
+// XExecutableDialog functions
+
+void SAL_CALL ODMAFolderPicker::setTitle( const ::rtl::OUString& _rTitle ) throw (RuntimeException)
+{
+ if (m_bUseDMS)
+ return;
+
+ Reference< XExecutableDialog > xExecutableDialog( m_xInterface, UNO_QUERY );
+ xExecutableDialog->setTitle( _rTitle);
+}
+
+sal_Int16 SAL_CALL ODMAFolderPicker::execute( )
+ throw (RuntimeException)
+{
+ if (m_bUseDMS)
+ throw new RuntimeException( );
+
+ Reference< XExecutableDialog > xExecutableDialog( m_xInterface, UNO_QUERY );
+ return xExecutableDialog->execute();
+}
+
+// XFolderPicker functions
+
+void SAL_CALL ODMAFolderPicker::setDisplayDirectory( const ::rtl::OUString& aDirectory )
+ throw( IllegalArgumentException, RuntimeException )
+{
+ if (m_bUseDMS)
+ return;
+
+ Reference< XFolderPicker > xFolderPicker( m_xInterface, UNO_QUERY );
+ xFolderPicker->setDisplayDirectory( aDirectory );
+}
+
+::rtl::OUString SAL_CALL ODMAFolderPicker::getDisplayDirectory( )
+ throw( RuntimeException )
+{
+ if (m_bUseDMS)
+ return rtl::OUString();
+
+ Reference< XFolderPicker > xFolderPicker( m_xInterface, UNO_QUERY );
+ return xFolderPicker->getDisplayDirectory();
+}
+
+::rtl::OUString SAL_CALL ODMAFolderPicker::getDirectory( )
+ throw( RuntimeException )
+{
+ if (m_bUseDMS)
+ return rtl::OUString();
+
+ Reference< XFolderPicker > xFolderPicker( m_xInterface, UNO_QUERY );
+ return xFolderPicker->getDirectory();
+}
+
+void SAL_CALL ODMAFolderPicker::setDescription( const ::rtl::OUString& aDescription )
+ throw( RuntimeException )
+{
+ if (m_bUseDMS)
+ return;
+
+ Reference< XFolderPicker > xFolderPicker( m_xInterface, UNO_QUERY );
+ xFolderPicker->setDescription( aDescription );
+}
+
+// XServiceInfo
+
+::rtl::OUString SAL_CALL ODMAFolderPicker::getImplementationName( )
+ throw( RuntimeException )
+{
+ return impl_getStaticImplementationName();
+}
+
+sal_Bool SAL_CALL ODMAFolderPicker::supportsService( const ::rtl::OUString& sServiceName )
+ throw( RuntimeException )
+{
+ Sequence< ::rtl::OUString > seqServiceNames = getSupportedServiceNames();
+ const ::rtl::OUString* pArray = seqServiceNames.getConstArray();
+ for ( sal_Int32 i = 0; i < seqServiceNames.getLength(); i++ )
+ {
+ if ( sServiceName == pArray[i] )
+ {
+ return sal_True ;
+ }
+ }
+ return sal_False ;
+}
+
+Sequence< ::rtl::OUString > SAL_CALL ODMAFolderPicker::getSupportedServiceNames()
+ throw( RuntimeException )
+{
+ return impl_getStaticSupportedServiceNames();
+}
+
+Sequence< ::rtl::OUString > ODMAFolderPicker::impl_getStaticSupportedServiceNames( )
+{
+ Sequence< ::rtl::OUString > seqServiceNames( 1 );
+ ::rtl::OUString* pArray = seqServiceNames.getArray();
+ pArray[0] = ::rtl::OUString::createFromAscii( "com.sun.star.ui.dialogs.ODMAFolderPicker" );
+ return seqServiceNames ;
+}
+
+::rtl::OUString ODMAFolderPicker::impl_getStaticImplementationName( )
+{
+ return ::rtl::OUString::createFromAscii( "com.sun.star.svtools.ODMAFolderPicker" );
+}
+
+Reference< XInterface > SAL_CALL ODMAFolderPicker::impl_createInstance( const Reference< XComponentContext >& rxContext )
+ throw( Exception )
+{
+ Reference< XMultiServiceFactory > xServiceManager (rxContext->getServiceManager(), UNO_QUERY_THROW);
+ return Reference< XInterface >( *new ODMAFolderPicker( xServiceManager ) );
+}
diff --git a/fpicker/source/odma/ODMAFolderPicker.hxx b/fpicker/source/odma/ODMAFolderPicker.hxx
new file mode 100644
index 0000000000..87db25ddb9
--- /dev/null
+++ b/fpicker/source/odma/ODMAFolderPicker.hxx
@@ -0,0 +1,100 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ * Copyright 2010 Novell, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_ODMA_FOLDERPICKER_HXX
+#define INCLUDED_ODMA_FOLDERPICKER_HXX
+
+#include <cppuhelper/compbase2.hxx>
+
+#include <com/sun/star/ui/dialogs/XFolderPicker.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+// class ODMAFolderPicker ---------------------------------------------------
+
+class ODMAFolderPicker :
+ public cppu::WeakComponentImplHelper2<
+ ::com::sun::star::ui::dialogs::XFolderPicker,
+ ::com::sun::star::lang::XServiceInfo >
+{
+private:
+ sal_Bool m_bUseDMS;
+
+protected:
+ ::osl::Mutex m_rbHelperMtx;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xInterface;
+
+public:
+ ODMAFolderPicker( const ::com::sun::star::uno::Reference < ::com::sun::star::lang::XMultiServiceFactory >& xFactory );
+
+ // XFolderPicker functions
+
+ virtual void SAL_CALL setDisplayDirectory( const ::rtl::OUString& aDirectory )
+ throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException );
+
+ virtual ::rtl::OUString SAL_CALL getDisplayDirectory( )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual ::rtl::OUString SAL_CALL getDirectory( )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL setDescription( const ::rtl::OUString& aDescription )
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ // XExecutableDialog functions
+
+ virtual void SAL_CALL setTitle( const ::rtl::OUString& _rTitle )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual sal_Int16 SAL_CALL execute( )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo functions
+
+ virtual ::rtl::OUString SAL_CALL getImplementationName( )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& sServiceName )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ /* Helper for XServiceInfo */
+ static com::sun::star::uno::Sequence< ::rtl::OUString > impl_getStaticSupportedServiceNames( );
+ static ::rtl::OUString impl_getStaticImplementationName( );
+
+ /* Helper for registry */
+ static ::com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL impl_createInstance ( const ::com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext )
+ throw( com::sun::star::uno::Exception );
+};
+
+#endif // INCLUDED_ODMA_FOLDERPICKER_HXX
diff --git a/fpicker/source/odma/exports.map b/fpicker/source/odma/exports.map
new file mode 100644
index 0000000000..f4ed78b9e9
--- /dev/null
+++ b/fpicker/source/odma/exports.map
@@ -0,0 +1,8 @@
+UDK_3_0_0 {
+ global:
+ component_getImplementationEnvironment;
+ component_writeInfo;
+ component_getFactory;
+ local:
+ *;
+};
diff --git a/fpicker/source/odma/fps_odma.cxx b/fpicker/source/odma/fps_odma.cxx
new file mode 100644
index 0000000000..fefdcf07d3
--- /dev/null
+++ b/fpicker/source/odma/fps_odma.cxx
@@ -0,0 +1,78 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ * Copyright 2010 Novell, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_fpicker.hxx"
+
+#include "sal/types.h"
+
+#include "cppuhelper/implementationentry.hxx"
+
+#include "ODMAFilePicker.hxx"
+#include "ODMAFolderPicker.hxx"
+
+static cppu::ImplementationEntry g_entries[] =
+{
+ {
+ ODMAFilePicker::impl_createInstance,
+ ODMAFilePicker::impl_getStaticImplementationName,
+ ODMAFilePicker::impl_getStaticSupportedServiceNames,
+ cppu::createSingleComponentFactory, 0, 0
+ },
+ {
+ ODMAFolderPicker::impl_createInstance,
+ ODMAFolderPicker::impl_getStaticImplementationName,
+ ODMAFolderPicker::impl_getStaticSupportedServiceNames,
+ cppu::createSingleComponentFactory, 0, 0
+ },
+ { 0, 0, 0, 0, 0, 0 }
+};
+
+extern "C"
+{
+SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment (
+ const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */)
+{
+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
+
+SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo (
+ void * pServiceManager, void * pRegistryKey)
+{
+ return cppu::component_writeInfoHelper (
+ pServiceManager, pRegistryKey, g_entries);
+}
+
+SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory (
+ const sal_Char * pImplementationName, void * pServiceManager, void * pRegistryKey)
+{
+ return cppu::component_getFactoryHelper (
+ pImplementationName, pServiceManager, pRegistryKey, g_entries);
+}
+
+} // extern "C"
diff --git a/fpicker/source/odma/makefile.mk b/fpicker/source/odma/makefile.mk
new file mode 100644
index 0000000000..3cc62d6f94
--- /dev/null
+++ b/fpicker/source/odma/makefile.mk
@@ -0,0 +1,72 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+# Copyright 2010 Novell, Inc.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=fpicker
+TARGET=fps_odma
+LIBTARGET=NO
+ENABLE_EXCEPTIONS=TRUE
+GEN_HID=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+DLLPRE=
+
+# --- Files --------------------------------------------------------
+
+SLOFILES=\
+ $(SLO)$/ODMAFilePicker.obj \
+ $(SLO)$/ODMAFolderPicker.obj \
+ $(SLO)$/fps_odma.obj
+
+SHL1TARGET= $(TARGET).uno
+SHL1IMPLIB= i$(TARGET)
+SHL1OBJS= $(SLOFILES)
+SHL1STDLIBS=\
+ $(ODMA_LIB_LIB) \
+ $(SVTOOLLIB) \
+ $(TKLIB) \
+ $(VCLLIB) \
+ $(SVLLIB) \
+ $(UNOTOOLSLIB) \
+ $(TOOLSLIB) \
+ $(UCBHELPERLIB) \
+ $(COMPHELPERLIB) \
+ $(CPPUHELPERLIB) \
+ $(CPPULIB) \
+ $(SALLIB)
+
+SHL1VERSIONMAP=exports.map
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+DEF1NAME= $(SHL1TARGET)
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/framework/prj/build.lst b/framework/prj/build.lst
index 5c745e0907..2eb363b0f3 100644
--- a/framework/prj/build.lst
+++ b/framework/prj/build.lst
@@ -1,4 +1,4 @@
-fr framework : l10n svtools NULL
+fr framework : l10n svtools ucb NULL
fr framework usr1 - all fr_mkout NULL
fr framework\inc nmake - all fr_inc NULL
fr framework\source\constant nmake - all fr_constant fr_inc NULL
diff --git a/framework/source/uielement/recentfilesmenucontroller.cxx b/framework/source/uielement/recentfilesmenucontroller.cxx
index 56a220be98..a61cbf8823 100644
--- a/framework/source/uielement/recentfilesmenucontroller.cxx
+++ b/framework/source/uielement/recentfilesmenucontroller.cxx
@@ -61,6 +61,11 @@
#include <unotools/historyoptions.hxx>
#include <cppuhelper/implbase1.hxx>
#include <osl/file.hxx>
+#ifdef WNT
+#include <tools/prewin.h>
+#include <tools/postwin.h>
+#include <odma_lib.hxx>
+#endif
//#include <tools/solar.hrc>
#include <dispatch/uieventloghelper.hxx>
#include <vos/mutex.hxx>
@@ -210,6 +215,41 @@ void RecentFilesMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu >
else
aMenuTitle = aSystemPath;
}
+#ifdef WNT
+ else if ( aURL.GetProtocol() == INET_PROT_VND_SUN_STAR_ODMA && ::odma::DMSsAvailable ())
+ {
+ String aShortTitle = m_aRecentFilesItems.at( i ).aTitle;
+
+ // This is against all rules for using
+ // proper abstraction layers and whatnot.
+ // But figuring out how to do it "right"
+ // would have taken the whole week.
+ // So just call the odma_lib functions...
+ // (odma_lib is a thin layer on
+ // top of the ODMA32 DLL)
+
+ static ODMHANDLE handle = NULL;
+ static sal_Bool beenhere = sal_False;
+ ODMSTATUS status;
+
+ if ( ! beenhere )
+ {
+ status = NODMRegisterApp( &handle, ODM_API_VERSION, "sodma", NULL, NULL );
+ beenhere = sal_True;
+ }
+
+ if ( handle != NULL )
+ {
+ rtl::OUString s = aURL.GetMainURL( INetURLObject::DECODE_WITH_CHARSET, RTL_TEXTENCODING_MS_1252 );
+ s = s.copy( strlen ( "vnd.sun.star.odma:/" ) );
+ char title[47];
+ status = NODMGetDocInfo( handle, rtl::OUStringToOString( s, RTL_TEXTENCODING_MS_1252 ).pData->buffer, ODM_NAME, title, sizeof ( title ) );
+ aShortTitle = String::CreateFromAscii( title );
+ }
+ aMenuTitle += aShortTitle;
+ aTipHelpText = aURLString;
+ }
+#endif
else
{
// Use INetURLObject to abbreviate all other URLs
diff --git a/framework/util/makefile.mk b/framework/util/makefile.mk
index 91532cda76..4aee64439e 100644
--- a/framework/util/makefile.mk
+++ b/framework/util/makefile.mk
@@ -339,6 +339,7 @@ SHL4OBJS= \
$(SLO)$/startmoduledispatcher.obj
SHL4STDLIBS= \
+ $(ODMA_LIB_LIB) \
$(FWILIB) \
$(FWELIB) \
$(SVTOOLLIB) \
diff --git a/officecfg/registry/data/org/openoffice/ucb/Configuration.xcu b/officecfg/registry/data/org/openoffice/ucb/Configuration.xcu
index cdd6c2c294..d230087724 100644
--- a/officecfg/registry/data/org/openoffice/ucb/Configuration.xcu
+++ b/officecfg/registry/data/org/openoffice/ucb/Configuration.xcu
@@ -186,6 +186,17 @@
<value/>
</prop>
</node>
+ <node oor:name="Provider42" oor:op="replace">
+ <prop oor:name="ServiceName">
+ <value>com.sun.star.ucb.ODMAContentProvider</value>
+ </prop>
+ <prop oor:name="URLTemplate">
+ <value>vnd.sun.star.odma</value>
+ </prop>
+ <prop oor:name="Arguments">
+ <value/>
+ </prop>
+ </node>
<!-- We want the Provider to be the final fallback provider -->
<node oor:name="Provider999" oor:op="replace" install:module="gio">
<prop oor:name="ServiceName">
diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index 8b00736a7b..5f31f98678 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -5759,6 +5759,13 @@
</info>
<value>false</value>
</prop>
+ <prop oor:name="TryODMADialog" oor:type="xs:boolean">
+ <info>
+ <author>tml</author>
+ <desc>Determines whether to show the document creation and selection of the machine's default ODMA (Open Document Management Architecture) DMS (Document Management System). If true, and the machine has a DMS available, the DMS's dialog will be displayed. That dialog then gives the opportunity to use the application's dialog instead, which means the normal system file and folder pickers will be displayed. Relevant only on Windows.</desc>
+ </info>
+ <value>false</value>
+ </prop>
<prop oor:name="SymbolSet" oor:type="xs:short">
<!-- UIHints: Tools Options General View -->
<info>
diff --git a/ucb/prj/build.lst b/ucb/prj/build.lst
index dad7921304..e58d23926b 100644
--- a/ucb/prj/build.lst
+++ b/ucb/prj/build.lst
@@ -16,3 +16,4 @@ uc ucb\source\ucp\tdoc nmake - all uc_tdoc uc_inc NULL
uc ucb\source\ucp\expand nmake - all uc_expand uc_inc NULL
uc ucb\source\ucp\ext nmake - all uc_ext uc_inc NULL
uc ucb\qa\unoapi nmake - all uc_qa_unoapi NULL
+uc ucb\source\ucp\odma nmake - w uc_odma uc_inc NULL
diff --git a/ucb/prj/d.lst b/ucb/prj/d.lst
index b02c8184a6..7b15e5b7fa 100644
--- a/ucb/prj/d.lst
+++ b/ucb/prj/d.lst
@@ -23,6 +23,11 @@
..\%__SRC%\lib\ucp*.uno.dylib %_DEST%\lib%_EXT%\ucp*.uno.dylib
..\%__SRC%\misc\ucp*.map %_DEST%\bin%_EXT%\ucp*.map
..\%__SRC%\misc\ucp*.sym %_DEST%\bin%_EXT%\ucp*.sym
+
+..\%__SRC%\slb\odma_lib.lib %_DEST%\lib%_EXT%\odma_lib.lib
+..\source\ucp\odma\odma.h %_DEST%\inc%_EXT%\odma.h
+..\source\ucp\odma\odma_lib.hxx %_DEST%\inc%_EXT%\odma_lib.hxx
+
..\source\ucp\file\ucpfile.xml %_DEST%\xml%_EXT%\ucpfile.xml
..\source\ucp\ftp\ucpftp.xml %_DEST%\xml%_EXT%\ucpftp.xml
..\source\ucp\hierarchy\ucphier.xml %_DEST%\xml%_EXT%\ucphier.xml
diff --git a/ucb/source/ucp/odma/makefile.mk b/ucb/source/ucp/odma/makefile.mk
index 14a7d3d45c..643b4fa278 100644
--- a/ucb/source/ucp/odma/makefile.mk
+++ b/ucb/source/ucp/odma/makefile.mk
@@ -47,7 +47,7 @@ LIBTARGET=NO
# --- General -----------------------------------------------------
-SLOFILES=\
+SLO1FILES=\
$(SLO)$/odma_lib.obj \
$(SLO)$/odma_services.obj \
$(SLO)$/odma_provider.obj \
@@ -58,7 +58,7 @@ SLOFILES=\
$(SLO)$/odma_contentcaps.obj
LIB1TARGET=$(SLB)$/_$(TARGET).lib
-LIB1OBJFILES=$(SLOFILES)
+LIB1OBJFILES=$(SLO1FILES)
# --- Shared-Library ---------------------------------------------------
@@ -91,6 +91,13 @@ APP2STDLIBS=$(SALLIB) \
DEF2DES=UCB ODMA URL converter
+# --- odma_lib library -----------------------------------------------
+
+SLO3FILES=$(SLO)$/odma_lib.obj
+
+LIB3TARGET=$(SLB)$/odma_lib.lib
+LIB3OBJFILES=$(SLO3FILES)
+
# --- Targets ----------------------------------------------------------
.INCLUDE: target.mk
diff --git a/ucb/source/ucp/odma/odma_content.cxx b/ucb/source/ucp/odma/odma_content.cxx
index 663436b2cb..5360f1f004 100644
--- a/ucb/source/ucp/odma/odma_content.cxx
+++ b/ucb/source/ucp/odma/odma_content.cxx
@@ -471,6 +471,12 @@ uno::Any SAL_CALL Content::execute(
}
else if( ! aCommand.Name.compareToAscii( "transfer" ) )
{
+ // So far I have determined that this command is called when
+ // doing "Save As" to copy an already written backup copy of
+ // the document in the file system into the DMS.
+
+ // Maybe also in other situations.
+
ucb::TransferInfo aTransferInfo;
if( ! ( aCommand.Argument >>= aTransferInfo ) )
{
@@ -486,84 +492,21 @@ uno::Any SAL_CALL Content::execute(
::rtl::Reference<ContentProperties> aProp = m_aProps;
if(aProp->m_bIsFolder)
{
- aProp = getContentProvider()->getContentPropertyWithTitle(aTransferInfo.NewTitle);
+ aProp = getContentProvider()->getContentPropertyWithDocumentId(aTransferInfo.NewTitle);
if(!aProp.is())
aProp = getContentProvider()->getContentPropertyWithSavedAsName(aTransferInfo.NewTitle);
sal_Bool bError = !aProp.is();
- if(bError)
- {
- sal_Char* pExtension = NULL;
- ::rtl::OString sExt;
- sal_Int32 nPos = aTransferInfo.NewTitle.lastIndexOf('.');
- if(nPos != -1)
- {
- sExt = ::rtl::OUStringToOString(aTransferInfo.NewTitle.copy(nPos+1),RTL_TEXTENCODING_ASCII_US);
- if(sExt.equalsIgnoreAsciiCase("txt"))
- pExtension = ODM_FORMAT_TEXT;
- else if(sExt.equalsIgnoreAsciiCase("rtf"))
- pExtension = ODM_FORMAT_RTF;
- else if(sExt.equalsIgnoreAsciiCase("ps"))
- pExtension = ODM_FORMAT_PS;
- else
- pExtension = const_cast<sal_Char*>(sExt.getStr());
- }
- else
- pExtension = ODM_FORMAT_TEXT;
-
- sal_Char* lpszNewDocId = new sal_Char[ODM_DOCID_MAX];
- void *pData = NULL;
- DWORD dwFlags = ODM_SILENT;
- ODMSTATUS odm = NODMSaveAsEx(ContentProvider::getHandle(),
- NULL, // means it is saved the first time
- lpszNewDocId,
- pExtension,
- NULL, // no callback function here
- pData,
- &dwFlags);
-
- // check if we have to call the DMS dialog
- if(odm == ODM_E_USERINT)
- {
- dwFlags = 0;
- odm = NODMSaveAsEx(ContentProvider::getHandle(),
- NULL, // means it is saved the first time
- lpszNewDocId,
- pExtension,
- NULL, // no callback function here
- pData,
- &dwFlags);
- }
- bError = odm != ODM_SUCCESS;
- if(!bError)
- {
- aProp = new ContentProperties();
- aProp->m_sDocumentId = ::rtl::OString(lpszNewDocId);
- aProp->m_sContentType = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(ODMA_CONTENT_TYPE));
- aProp->m_sSavedAsName = aTransferInfo.NewTitle;
- getContentProvider()->append(aProp);
-
- // now set the title
- WORD nDocInfo = ODM_NAME;
- ::rtl::OUString sFileName = aTransferInfo.NewTitle;
- sal_Int32 nIndex = aTransferInfo.NewTitle.lastIndexOf( sal_Unicode('.') );
- if(nIndex != -1)
- sFileName = aTransferInfo.NewTitle.copy(0,nIndex);
-
- ::rtl::OString sDocInfoValue = ::rtl::OUStringToOString(sFileName,RTL_TEXTENCODING_ASCII_US);
- odm = NODMSetDocInfo( ContentProvider::getHandle(),
- lpszNewDocId,
- nDocInfo,
- const_cast<sal_Char*>(sDocInfoValue.getStr())
- );
- }
- else if ( odm == ODM_E_CANCEL)
- NODMActivate(ContentProvider::getHandle(),
- ODM_DELETE,
- lpszNewDocId);
+ // There used to be code below that called ODMSaveAsEx,
+ // but that was very broken. We have already called
+ // ODMSaveAsEx in the ODMA file picker when selecting the
+ // name for a new document, or the document already exists
+ // in the DMS and we don't need any ODMSaveAsEx. The ODMA
+ // file picker tells odma::ContentProvider about the new
+ // document's DOCID, so the
+ // getContentPropertyWithDocumentId() call above should
+ // succeed.
- delete [] lpszNewDocId;
- }
if(bError)
ucbhelper::cancelCommandExecution(
uno::makeAny( lang::IllegalArgumentException(
@@ -575,12 +518,23 @@ uno::Any SAL_CALL Content::execute(
rtl::OUString sFileURL = ContentProvider::openDoc(aProp);
sal_Int32 nLastIndex = sFileURL.lastIndexOf( sal_Unicode('/') );
+ // Create a new Content object for the "shadow" file
+ // corresponding to the opened document from the DMS.
::ucbhelper::Content aContent(sFileURL.copy(0,nLastIndex),NULL);
// aTransferInfo.NameClash = ucb::NameClash::OVERWRITE;
aTransferInfo.NewTitle = sFileURL.copy( 1 + nLastIndex );
+ // Copy our saved backup copy to the "shadow" file.
aContent.executeCommand(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("transfer")),uno::makeAny(aTransferInfo));
+ // Tell the DMS that the "shadow" file is done and can be
+ // imported.
getContentProvider()->saveDocument(aProp->m_sDocumentId);
}
+ else if ( aCommand.Name.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM( "getCasePreservingURL" ) ) )
+ {
+ rtl::OUString CasePreservingURL = openDoc();
+ aRet <<= CasePreservingURL;
+ }
else
{
//////////////////////////////////////////////////////////////////
diff --git a/ucb/source/ucp/odma/odma_content.hxx b/ucb/source/ucp/odma/odma_content.hxx
index ab50e1aec7..ed9fc38e09 100644
--- a/ucb/source/ucp/odma/odma_content.hxx
+++ b/ucb/source/ucp/odma/odma_content.hxx
@@ -59,7 +59,7 @@ namespace odma
// UNO service name for the content.
#define ODMA_CONTENT_SERVICE_NAME \
- "com.sun.star.ucb.OdmaContent"
+ "com.sun.star.ucb.ODMAContent"
//=========================================================================
class ContentProvider;
diff --git a/ucb/source/ucp/odma/odma_contentprops.hxx b/ucb/source/ucp/odma/odma_contentprops.hxx
index 8ac9fae68f..614a15e080 100644
--- a/ucb/source/ucp/odma/odma_contentprops.hxx
+++ b/ucb/source/ucp/odma/odma_contentprops.hxx
@@ -64,6 +64,7 @@ namespace odma
{}
inline ::rtl::OUString getTitle() const { return m_sTitle; }
+ inline ::rtl::OUString getDocumentId() const { return ::rtl::OStringToOUString( m_sDocumentId, RTL_TEXTENCODING_ASCII_US ); }
inline ::rtl::OUString getSavedAsName() const { return m_sSavedAsName; }
};
typedef ::std::binary_function< ::rtl::Reference<ContentProperties>, ::rtl::OUString,bool> TContentPropertiesFunctorBase;
diff --git a/ucb/source/ucp/odma/odma_datasupplier.cxx b/ucb/source/ucp/odma/odma_datasupplier.cxx
index a9024d4e64..ad0814548a 100644
--- a/ucb/source/ucp/odma/odma_datasupplier.cxx
+++ b/ucb/source/ucp/odma/odma_datasupplier.cxx
@@ -41,7 +41,6 @@
#include "odma_content.hxx"
#include "odma_contentprops.hxx"
#include "odma_provider.hxx"
-#include "odma_lib.hxx"
using namespace com::sun::star::beans;
using namespace com::sun::star::lang;
@@ -284,7 +283,7 @@ sal_Bool DataSupplier::getResult( sal_uInt32 nIndex )
ODMSTATUS odm = NODMGetDMS(ODMA_ODMA_REGNAME, lpszDMSList);
lpszDMSList[strlen(lpszDMSList)+1] = '\0';
- ::rtl::OString sQuery("SELECT ODM_DOCID, ODM_NAME");
+ ::rtl::OString sQuery("SELECT ODM_DOCID_LATEST, ODM_NAME");
DWORD dwFlags = ODM_SPECIFIC;
odm = NODMQueryExecute(ContentProvider::getHandle(), sQuery,dwFlags, lpszDMSList, pQueryId );
diff --git a/ucb/source/ucp/odma/odma_lib.cxx b/ucb/source/ucp/odma/odma_lib.cxx
index b6a0d3ada1..3f27bbdee0 100644
--- a/ucb/source/ucp/odma/odma_lib.cxx
+++ b/ucb/source/ucp/odma/odma_lib.cxx
@@ -32,6 +32,8 @@
//#endif
#include <osl/module.h>
#include <rtl/ustring.hxx>
+#include <tools/prewin.h>
+#include <tools/postwin.h>
#include "odma_lib.hxx"
@@ -70,17 +72,18 @@ namespace odma
sal_Bool LoadFunctions(oslModule _pODMA);
- sal_Bool LoadLibrary()
+ sal_Bool DMSsAvailable()
{
static sal_Bool bLoaded = sal_False;
- static oslModule pODMA = NULL;
+ static sal_Bool bBeenHere = sal_False;
+ oslModule pODMA = NULL;
- if (bLoaded)
- return sal_True;
+ if (bBeenHere)
+ return bLoaded;
+
::rtl::OUString sPath;
#ifdef WIN
sPath = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMA.DLL"));
-
#endif
#ifdef WNT
sPath = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMA32.DLL"));
@@ -89,11 +92,21 @@ namespace odma
sPath = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("libodma.so"));
#endif
+ bBeenHere = sal_True;
+
pODMA = osl_loadModule( sPath.pData,SAL_LOADMODULE_NOW );
if( !pODMA)
return sal_False;
- return bLoaded = LoadFunctions(pODMA);
+ if (!LoadFunctions(pODMA))
+ return sal_False;
+
+ bLoaded = (NODMGetDMSCount() > 0);
+
+ if (getenv ("NO_ODMA"))
+ bLoaded = sal_False;
+
+ return bLoaded;
}
// -------------------------------------------------------------------------
diff --git a/ucb/source/ucp/odma/odma_lib.hxx b/ucb/source/ucp/odma/odma_lib.hxx
index 0c9180ee7d..6eaae884e0 100644
--- a/ucb/source/ucp/odma/odma_lib.hxx
+++ b/ucb/source/ucp/odma/odma_lib.hxx
@@ -27,19 +27,7 @@
#ifndef ODMA_LIB_HXX
#define ODMA_LIB_HXX
-typedef void *LPVOID;
-typedef char *LPSTR,
- *PSTR;
-typedef const char *LPCSTR;
-typedef unsigned long DWORD;
-typedef unsigned short WORD;
-typedef unsigned short *LPWORD;
-typedef DWORD *LPDWORD;
-
-#define WINAPI __stdcall
-#define FAR
-
-#include "odma.h"
+#include <odma.h>
namespace odma
{
@@ -205,37 +193,37 @@ namespace odma
// now we define some macros
- #define NODMRegisterApp(a,b,c,d,e) (*(pODMRegisterApp))(a,b,c,d,e)
- #define NODMUnRegisterApp(a) (*(pODMUnRegisterApp))(a)
- #define NODMSelectDoc(a,b,c) (*(pODMSelectDoc))(a,b,c)
- #define NODMOpenDoc(a,b,c,d) (*(pODMOpenDoc))(a,b,c,d)
- #define NODMSaveDoc(a,b,c) (*(pODMSaveDoc))(a,b,c)
- #define NODMCloseDoc(a,b,c,d,e,f) (*(pODMCloseDoc))(a,b,c,d,e,f)
- #define NODMNewDoc(a,b,c,d,e) (*(pODMNewDoc))(a,b,c,d,e)
- #define NODMSaveAs(a,b,c,d,e,f) (*(pODMSaveAs))(a,b,c,d,e,f)
- #define NODMActivate(a,b,c) (*(pODMActivate))(a,b,c)
- #define NODMGetDocInfo(a,b,c,d,e) (*(pODMGetDocInfo))(a,b,c,d,e)
- #define NODMSetDocInfo(a,b,c,d) (*(pODMSetDocInfo))(a,b,c,d)
- #define NODMGetDMSInfo(a,b,c,d) (*(pODMGetDMSInfo))(a,b,c,d)
- #define NODMGetDMSCount() (*(pODMGetDMSCount))()
- #define NODMGetDMSList(a,b) (*(pODMGetDMSList))(a,b)
- #define NODMGetDMS(a,b) (*(pODMGetDMS))(a,b)
- #define NODMSetDMS(a,b) (*(pODMSetDMS))(a,b)
- #define NODMQueryExecute(a,b,c,d,e) (*(pODMQueryExecute))(a,b,c,d,e)
- #define NODMQueryGetResults(a,b,c,d,e,f) (*(pODMQueryGetResults))(a,b,c,d,e,f)
- #define NODMQueryClose(a,b) (*(pODMQueryClose))(a,b)
- #define NODMCloseDocEx(a,b,c,d,e,f,g) (*(pODMCloseDocEx))(a,b,c,d,e,f,g)
- #define NODMSaveAsEx(a,b,c,d,e,f,g) (*(pODMSaveAsEx))(a,b,c,d,e,f,g)
- #define NODMSaveDocEx(a,b,c,d) (*(pODMSaveDocEx))(a,b,c,d)
- #define NODMSelectDocEx(a,b,c,d,e,f) (*(pODMSelectDocEx))(a,b,c,d,e,f)
- #define NODMQueryCapability(a,b,c,d,e) (*(pODMQueryCapability))(a,b,c,d,e)
- #define NODMSetDocEvent(a,b,c,d,e,f,g) (*(pODMSetDocEvent))(a,b,c,d,e,f,g)
- #define NODMGetAlternateContent(a,b,c,d,e) (*(pODMGetAlternateContent))(a,b,c,d,e)
- #define NODMSetAlternateContent(a,b,c,d,e) (*(pODMSetAlternateContent))(a,b,c,d,e)
- #define NODMGetDocRelation(a,b,c,d,e,f) (*(pODMGetDocRelation))(a,b,c,d,e,f)
- #define NODMSetDocRelation(a,b,c,d,e,f) (*(pODMSetDocRelation))(a,b,c,d,e,f)
-
- sal_Bool LoadLibrary();
+ #define NODMRegisterApp(a,b,c,d,e) (*(::odma::pODMRegisterApp))(a,b,c,d,e)
+ #define NODMUnRegisterApp(a) (*(::odma::pODMUnRegisterApp))(a)
+ #define NODMSelectDoc(a,b,c) (*(::odma::pODMSelectDoc))(a,b,c)
+ #define NODMOpenDoc(a,b,c,d) (*(::odma::pODMOpenDoc))(a,b,c,d)
+ #define NODMSaveDoc(a,b,c) (*(::odma::pODMSaveDoc))(a,b,c)
+ #define NODMCloseDoc(a,b,c,d,e,f) (*(::odma::pODMCloseDoc))(a,b,c,d,e,f)
+ #define NODMNewDoc(a,b,c,d,e) (*(::odma::pODMNewDoc))(a,b,c,d,e)
+ #define NODMSaveAs(a,b,c,d,e,f) (*(::odma::pODMSaveAs))(a,b,c,d,e,f)
+ #define NODMActivate(a,b,c) (*(::odma::pODMActivate))(a,b,c)
+ #define NODMGetDocInfo(a,b,c,d,e) (*(::odma::pODMGetDocInfo))(a,b,c,d,e)
+ #define NODMSetDocInfo(a,b,c,d) (*(::odma::pODMSetDocInfo))(a,b,c,d)
+ #define NODMGetDMSInfo(a,b,c,d) (*(::odma::pODMGetDMSInfo))(a,b,c,d)
+ #define NODMGetDMSCount() (*(::odma::pODMGetDMSCount))()
+ #define NODMGetDMSList(a,b) (*(::odma::pODMGetDMSList))(a,b)
+ #define NODMGetDMS(a,b) (*(::odma::pODMGetDMS))(a,b)
+ #define NODMSetDMS(a,b) (*(::odma::pODMSetDMS))(a,b)
+ #define NODMQueryExecute(a,b,c,d,e) (*(::odma::pODMQueryExecute))(a,b,c,d,e)
+ #define NODMQueryGetResults(a,b,c,d,e,f) (*(::odma::pODMQueryGetResults))(a,b,c,d,e,f)
+ #define NODMQueryClose(a,b) (*(::odma::pODMQueryClose))(a,b)
+ #define NODMCloseDocEx(a,b,c,d,e,f,g) (*(::odma::pODMCloseDocEx))(a,b,c,d,e,f,g)
+ #define NODMSaveAsEx(a,b,c,d,e,f,g) (*(::odma::pODMSaveAsEx))(a,b,c,d,e,f,g)
+ #define NODMSaveDocEx(a,b,c,d) (*(::odma::pODMSaveDocEx))(a,b,c,d)
+ #define NODMSelectDocEx(a,b,c,d,e,f) (*(::odma::pODMSelectDocEx))(a,b,c,d,e,f)
+ #define NODMQueryCapability(a,b,c,d,e) (*(::odma::pODMQueryCapability))(a,b,c,d,e)
+ #define NODMSetDocEvent(a,b,c,d,e,f,g) (*(::odma::pODMSetDocEvent))(a,b,c,d,e,f,g)
+ #define NODMGetAlternateContent(a,b,c,d,e) (*(::odma::pODMGetAlternateContent))(a,b,c,d,e)
+ #define NODMSetAlternateContent(a,b,c,d,e) (*(::odma::pODMSetAlternateContent))(a,b,c,d,e)
+ #define NODMGetDocRelation(a,b,c,d,e,f) (*(::odma::pODMGetDocRelation))(a,b,c,d,e,f)
+ #define NODMSetDocRelation(a,b,c,d,e,f) (*(::odma::pODMSetDocRelation))(a,b,c,d,e,f)
+
+ sal_Bool DMSsAvailable();
extern TODMRegisterApp pODMRegisterApp;
extern TODMUnRegisterApp pODMUnRegisterApp;
diff --git a/ucb/source/ucp/odma/odma_provider.cxx b/ucb/source/ucp/odma/odma_provider.cxx
index c6a30acc86..7ba5b7c2f5 100644
--- a/ucb/source/ucp/odma/odma_provider.cxx
+++ b/ucb/source/ucp/odma/odma_provider.cxx
@@ -434,7 +434,7 @@ void ContentProvider::append(const ::rtl::Reference<ContentProperties>& _rProp)
lpszDMSList[strlen(lpszDMSList)+1] = '\0';
::rtl::OString sTitleText(::rtl::OUStringToOString(_sDocumentName,RTL_TEXTENCODING_ASCII_US));
- ::rtl::OString sQuery("SELECT ODM_DOCID, ODM_NAME WHERE ODM_TITLETEXT = '");
+ ::rtl::OString sQuery("SELECT ODM_DOCID_LATEST, ODM_NAME WHERE ODM_TITLETEXT = '");
sQuery += sTitleText;
sQuery += "'";
@@ -522,6 +522,12 @@ void ContentProvider::append(const ::rtl::Reference<ContentProperties>& _rProp)
return getContentProperty(_sTitle,aFunc);
}
// -----------------------------------------------------------------------------
+::rtl::Reference<ContentProperties> ContentProvider::getContentPropertyWithDocumentId(const ::rtl::OUString& _sDocumentId) const
+{
+ ContentPropertiesMemberFunctor aFunc(::std::mem_fun(&ContentProperties::getDocumentId));
+ return getContentProperty(_sDocumentId,aFunc);
+}
+// -----------------------------------------------------------------------------
::rtl::OUString ContentProvider::openDoc(const ::rtl::Reference<ContentProperties>& _rProp) throw (uno::Exception)
{
OSL_ENSURE(_rProp.is(),"No valid content properties!");
diff --git a/ucb/source/ucp/odma/odma_provider.hxx b/ucb/source/ucp/odma/odma_provider.hxx
index cbd8e6b49f..272d5e7fbe 100644
--- a/ucb/source/ucp/odma/odma_provider.hxx
+++ b/ucb/source/ucp/odma/odma_provider.hxx
@@ -29,6 +29,8 @@
#define ODMA_PROVIDER_HXX
#include <ucbhelper/providerhelper.hxx>
+#include <tools/prewin.h>
+#include <tools/postwin.h>
#include "odma_lib.hxx"
#include "rtl/ref.hxx"
@@ -43,7 +45,7 @@ namespace odma {
// UNO service name for the provider. This name will be used by the UCB to
// create instances of the provider.
#define ODMA_CONTENT_PROVIDER_SERVICE_NAME \
- "com.sun.star.ucb.OdmaContentProvider"
+ "com.sun.star.ucb.ODMAContentProvider"
// #define ODMA_CONTENT_PROVIDER_SERVICE_NAME_LENGTH 34
// URL scheme. This is the scheme the provider will be able to create
@@ -133,14 +135,21 @@ public:
*/
::rtl::Reference<ContentProperties> queryContentProperty(const ::rtl::OUString& _sDocumentName);
- /** getContentProperty returns the ContentProperties for the first content with that title
+ /** getContentPropertyWithTitle returns the ContentProperties for the first content with that title
@param _sTitle the title of the document
@return the content properties
*/
::rtl::Reference<ContentProperties> getContentPropertyWithTitle(const ::rtl::OUString& _sTitle) const;
- /** getContentProperty returns the ContentProperties for the first content with that SavedAsName
+ /** getContentPropertyWithDocumentId returns the ContentProperties for the first content with that title
+ @param _sTitle the title of the document
+
+ @return the content properties
+ */
+ ::rtl::Reference<ContentProperties> getContentPropertyWithDocumentId(const ::rtl::OUString& _sDocumentId) const;
+
+ /** getContentPropertyWithSavedAsName returns the ContentProperties for the first content with that SavedAsName
@param _sSaveAsName the SavedAsName of the document
@return the content properties
diff --git a/ucb/source/ucp/odma/odma_services.cxx b/ucb/source/ucp/odma/odma_services.cxx
index 1140083942..9464b5791b 100644
--- a/ucb/source/ucp/odma/odma_services.cxx
+++ b/ucb/source/ucp/odma/odma_services.cxx
@@ -32,21 +32,19 @@
#include <com/sun/star/registry/XRegistryKey.hpp>
#include "odma_contentprops.hxx"
#include "odma_provider.hxx"
-#include "odma_lib.hxx"
-using namespace rtl;
using namespace com::sun::star::uno;
using namespace com::sun::star::lang;
using namespace com::sun::star::registry;
//=========================================================================
static sal_Bool writeInfo( void * pRegistryKey,
- const OUString & rImplementationName,
- Sequence< OUString > const & rServiceNames )
+ const rtl::OUString & rImplementationName,
+ Sequence< rtl::OUString > const & rServiceNames )
{
- OUString aKeyName( OUString::createFromAscii( "/" ) );
+ rtl::OUString aKeyName( rtl::OUString::createFromAscii( "/" ) );
aKeyName += rImplementationName;
- aKeyName += OUString::createFromAscii( "/UNO/SERVICES" );
+ aKeyName += rtl::OUString::createFromAscii( "/UNO/SERVICES" );
Reference< XRegistryKey > xKey;
try
@@ -119,10 +117,8 @@ extern "C" void * SAL_CALL component_getFactory(
if ( ::odma::ContentProvider::getImplementationName_Static().
compareToAscii( pImplName ) == 0 )
{
- if(::odma::LoadLibrary())
+ if(::odma::DMSsAvailable())
xFactory = ::odma::ContentProvider::createServiceFactory( xSMgr );
- else
- OSL_ASSERT(!"Could not load library!");
}
//////////////////////////////////////////////////////////////////////
diff --git a/ucb/source/ucp/odma/ucpodma.xml b/ucb/source/ucp/odma/ucpodma.xml
index c3804b6662..390245e41a 100644
--- a/ucb/source/ucp/odma/ucpodma.xml
+++ b/ucb/source/ucp/odma/ucpodma.xml
@@ -11,7 +11,7 @@
Ocke Janssen
</author>
<name>
- com.sun.star.comp.ucb.OdmaContentProvider
+ com.sun.star.comp.ucb.ODMAContentProvider
</name>
<description>
This component implements a Content Provider for the Universal