summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorCédric Bosdonnat <cedric.bosdonnat@free.fr>2012-05-29 15:18:29 +0200
committerCédric Bosdonnat <cedric.bosdonnat@free.fr>2012-06-04 13:28:12 +0200
commit966d20e35d5a2be2fce6c204af5c156c3ead7063 (patch)
treee23f080a8831d398508d7b1731c315310021aed8 /sfx2
parent12d193df238adaf67608327b36fea91003138539 (diff)
CMIS ucp: write documents back to CMIS server
This change needs a git repo build of libcmis. Change-Id: I I740d18dbf3c36d9387b867e750fcbe8e114e5362
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/doc/docfile.cxx28
1 files changed, 26 insertions, 2 deletions
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index 27d4398da299..6271acd84493 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -33,6 +33,7 @@
#include <com/sun/star/task/XInteractionHandler.hpp>
#include <com/sun/star/uno/Reference.h>
#include <com/sun/star/ucb/XContent.hpp>
+#include <com/sun/star/container/XChild.hpp>
#include <com/sun/star/document/XDocumentRevisionListPersistence.hpp>
#include <com/sun/star/document/LockedDocumentRequest.hpp>
#include <com/sun/star/document/OwnLockOnDocumentRequest.hpp>
@@ -1918,6 +1919,7 @@ void SfxMedium::Transfer_Impl()
Reference< ::com::sun::star::ucb::XProgressHandler >() );
rtl::OUString aDestURL( aDest.GetMainURL( INetURLObject::NO_DECODE ) );
+
if ( ::utl::LocalFileHelper::IsLocalFile( aDestURL ) || !aDest.removeSegment() )
{
TransactedTransferForFS_Impl( aSource, aDest, xComEnv );
@@ -1939,8 +1941,30 @@ void SfxMedium::Transfer_Impl()
::ucbhelper::Content aSourceContent;
::ucbhelper::Content aTransferContent;
- String aFileName = GetLongName();
- if ( !aFileName.Len() )
+ // Get the parent URL from the XChild if possible: why would the URL necessarily have
+ // a hierarchical path? It's not the case for CMIS.
+ ::ucbhelper::Content aDestContent;
+ ::ucbhelper::Content::create( aDestURL, xComEnv, aDestContent );
+ Reference< ::com::sun::star::container::XChild> xChild( aDestContent.get(), uno::UNO_QUERY );
+ rtl::OUString sParentUrl;
+ if ( xChild.is( ) )
+ {
+ Reference< ::com::sun::star::ucb::XContent > xParent( xChild->getParent( ), uno::UNO_QUERY );
+ if ( xParent.is( ) )
+ {
+ sParentUrl = xParent->getIdentifier( )->getContentIdentifier();
+ }
+ }
+
+ if ( !sParentUrl.isEmpty() )
+ aDest = INetURLObject( sParentUrl );
+
+ // LongName wasn't defined anywhere, only used here... get the Title instead
+ // as it's less probably empty
+ rtl::OUString aFileName;
+ Any aAny = aDestContent.getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Title" )) );
+ aAny >>= aFileName;
+ if ( aFileName.isEmpty() )
aFileName = GetURLObject().getName( INetURLObject::LAST_SEGMENT, true, INetURLObject::DECODE_WITH_CHARSET );
try