diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-06-13 11:12:50 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-06-19 14:46:56 -0400 |
commit | 1d38cb365543924f9c50014e6b2227e77de1d0c9 (patch) | |
tree | 1e77d0d2f82330f16c09cda60864824397d132c4 /embeddedobj | |
parent | 2538e30ccc2e98de92de5157ca523fdb347eb537 (diff) |
fdo#71076, fdo#71767: Preserve number formats when charts are copied.
Change-Id: If5ae8852152012483237e7602e56a0c46ea8748a
Diffstat (limited to 'embeddedobj')
-rw-r--r-- | embeddedobj/source/commonembedding/persistence.cxx | 52 | ||||
-rw-r--r-- | embeddedobj/source/inc/commonembobj.hxx | 12 |
2 files changed, 48 insertions, 16 deletions
diff --git a/embeddedobj/source/commonembedding/persistence.cxx b/embeddedobj/source/commonembedding/persistence.cxx index 4a057f85f085..cbba5324be88 100644 --- a/embeddedobj/source/commonembedding/persistence.cxx +++ b/embeddedobj/source/commonembedding/persistence.cxx @@ -723,12 +723,33 @@ void OCommonEmbeddedObject::SwitchDocToStorage_Impl( const uno::Reference< docum m_xRecoveryStorage.clear(); } +namespace { -void OCommonEmbeddedObject::StoreDocToStorage_Impl( const uno::Reference< embed::XStorage >& xStorage, - sal_Int32 nStorageFormat, - const OUString& aBaseURL, - const OUString& aHierarchName, - bool bAttachToTheStorage ) +OUString getStringPropertyValue( const uno::Sequence<beans::PropertyValue>& rProps, const OUString& rName ) +{ + OUString aStr; + + for (sal_Int32 i = 0; i < rProps.getLength(); ++i) + { + if (rProps[i].Name == rName) + { + rProps[i].Value >>= aStr; + break; + } + } + + return aStr; +} + +} + +void OCommonEmbeddedObject::StoreDocToStorage_Impl( + const uno::Reference<embed::XStorage>& xStorage, + const uno::Sequence<beans::PropertyValue>& rMediaArgs, + const uno::Sequence<beans::PropertyValue>& rObjArgs, + sal_Int32 nStorageFormat, + const OUString& aHierarchName, + bool bAttachToTheStorage ) { SAL_WARN_IF( !xStorage.is(), "embeddedobj.common", "No storage is provided for storing!" ); @@ -742,6 +763,8 @@ void OCommonEmbeddedObject::StoreDocToStorage_Impl( const uno::Reference< embed: xDoc = uno::Reference< document::XStorageBasedDocument >( m_pDocHolder->GetComponent(), uno::UNO_QUERY ); } + OUString aBaseURL = GetBaseURLFrom_Impl(rMediaArgs, rObjArgs); + if ( xDoc.is() ) { OUString aFilterName = GetFilterName( nStorageFormat ); @@ -750,13 +773,17 @@ void OCommonEmbeddedObject::StoreDocToStorage_Impl( const uno::Reference< embed: if ( aFilterName.isEmpty() ) throw io::IOException(); // TODO: - uno::Sequence< beans::PropertyValue > aArgs( 3 ); + uno::Sequence<beans::PropertyValue> aArgs(5); aArgs[0].Name = "FilterName"; aArgs[0].Value <<= aFilterName; - aArgs[2].Name = "DocumentBaseURL"; - aArgs[2].Value <<= aBaseURL; aArgs[1].Name = "HierarchicalDocumentName"; aArgs[1].Value <<= aHierarchName; + aArgs[2].Name = "DocumentBaseURL"; + aArgs[2].Value <<= aBaseURL; + aArgs[3].Name = "SourceShellID"; + aArgs[3].Value <<= getStringPropertyValue(rObjArgs, "SourceShellID"); + aArgs[4].Name = "DestinationShellID"; + aArgs[4].Value <<= getStringPropertyValue(rObjArgs, "DestinationShellID"); xDoc->storeToStorage( xStorage, aArgs ); if ( bAttachToTheStorage ) @@ -1237,7 +1264,8 @@ void SAL_CALL OCommonEmbeddedObject::storeToEntry( const uno::Reference< embed:: aGuard.clear(); // TODO/LATER: support hierarchical name for embedded objects in embedded objects - StoreDocToStorage_Impl( xSubStorage, nTargetStorageFormat, GetBaseURLFrom_Impl( lArguments, lObjArgs ), sEntName, false ); + StoreDocToStorage_Impl( + xSubStorage, lArguments, lObjArgs, nTargetStorageFormat, sEntName, false ); aGuard.reset(); if ( bSwitchBackToLoaded ) @@ -1374,7 +1402,8 @@ void SAL_CALL OCommonEmbeddedObject::storeAsEntry( const uno::Reference< embed:: { aGuard.clear(); // TODO/LATER: support hierarchical name for embedded objects in embedded objects - StoreDocToStorage_Impl( xSubStorage, nTargetStorageFormat, GetBaseURLFrom_Impl( lArguments, lObjArgs ), sEntName, false ); + StoreDocToStorage_Impl( + xSubStorage, lArguments, lObjArgs, nTargetStorageFormat, sEntName, false ); aGuard.reset(); if ( bSwitchBackToLoaded ) @@ -1599,7 +1628,8 @@ void SAL_CALL OCommonEmbeddedObject::storeOwn() } aGuard.clear(); - StoreDocToStorage_Impl( m_xObjectStorage, nStorageFormat, GetBaseURL_Impl(), m_aEntryName, true ); + uno::Sequence<beans::PropertyValue> aEmpty; + StoreDocToStorage_Impl( m_xObjectStorage, aEmpty, aEmpty, nStorageFormat, m_aEntryName, true ); aGuard.reset(); } diff --git a/embeddedobj/source/inc/commonembobj.hxx b/embeddedobj/source/inc/commonembobj.hxx index 98354f3eabf4..ceba61e43198 100644 --- a/embeddedobj/source/inc/commonembobj.hxx +++ b/embeddedobj/source/inc/commonembobj.hxx @@ -195,11 +195,13 @@ private: ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseable > InitNewDocument_Impl(); - void StoreDocToStorage_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage, - sal_Int32 nStorageVersion, - const OUString& aBaseURL, - const OUString& aHierarchName, - bool bAttachToStorage ); + void StoreDocToStorage_Impl( + const css::uno::Reference<css::embed::XStorage>& xStorage, + const css::uno::Sequence<css::beans::PropertyValue>& rMediaArgs, + const css::uno::Sequence<css::beans::PropertyValue>& rObjArgs, + sal_Int32 nStorageVersion, + const OUString& aHierarchName, + bool bAttachToStorage ); void SwitchDocToStorage_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::document::XStorageBasedDocument >& xDoc, |