summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2014-06-16 19:38:39 -0400
committerKohei Yoshida <kohei.yoshida@collabora.com>2014-06-19 11:11:49 -0400
commitb1103ed29f57cc8c8d54bb996119d9d01443e825 (patch)
tree3a23c5f6db2cd99e16346c367eae9996ff3a6569
parentb5bde367b2f79814c05f3491f1edf46992a1cc4e (diff)
Pass source and destination shell IDs through myriad of abstraction layers.
Change-Id: I92e4507857ca64ff6bff31947f2604a4b7c29119
-rw-r--r--chart2/source/model/filter/XMLFilter.cxx5
-rw-r--r--chart2/source/model/inc/XMLFilter.hxx3
-rw-r--r--embeddedobj/source/commonembedding/persistence.cxx52
-rw-r--r--embeddedobj/source/inc/commonembobj.hxx12
-rw-r--r--include/xmloff/SchXMLExportHelper.hxx3
-rw-r--r--include/xmloff/xmlexp.hxx3
-rw-r--r--svtools/source/misc/embedtransfer.cxx7
-rw-r--r--xmloff/source/chart/SchXMLExport.cxx54
-rw-r--r--xmloff/source/core/xmlexp.cxx36
9 files changed, 153 insertions, 22 deletions
diff --git a/chart2/source/model/filter/XMLFilter.cxx b/chart2/source/model/filter/XMLFilter.cxx
index bc5f4940a33c..a5984edea742 100644
--- a/chart2/source/model/filter/XMLFilter.cxx
+++ b/chart2/source/model/filter/XMLFilter.cxx
@@ -541,6 +541,7 @@ sal_Int32 XMLFilter::impl_Export(
const Reference< lang::XComponent > & xDocumentComp,
const Sequence< beans::PropertyValue > & rMediaDescriptor )
{
+ m_aMediaDescriptor = rMediaDescriptor;
//save
sal_Int32 nWarning = 0;
@@ -744,9 +745,7 @@ sal_Int32 XMLFilter::impl_ExportStream(
if ( !xFilter.is() )
return ERRCODE_SFX_GENERAL;
- uno::Sequence < beans::PropertyValue > aMediaDesc(0);
- //@todo? filter properties? ... url? ...
- xFilter->filter( aMediaDesc );
+ xFilter->filter(m_aMediaDescriptor);
}
catch (const uno::Exception& rEx)
{
diff --git a/chart2/source/model/inc/XMLFilter.hxx b/chart2/source/model/inc/XMLFilter.hxx
index ad316d0c92b6..4c2c8a1fcefd 100644
--- a/chart2/source/model/inc/XMLFilter.hxx
+++ b/chart2/source/model/inc/XMLFilter.hxx
@@ -151,6 +151,9 @@ private:
::com::sun::star::lang::XComponent > m_xTargetDoc;
::com::sun::star::uno::Reference<
::com::sun::star::lang::XComponent > m_xSourceDoc;
+
+ css::uno::Sequence<css::beans::PropertyValue> m_aMediaDescriptor;
+
OUString m_sDocumentHandler; // when set it will be set as doc handler
volatile bool m_bCancelOperation;
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,
diff --git a/include/xmloff/SchXMLExportHelper.hxx b/include/xmloff/SchXMLExportHelper.hxx
index d46663f10cee..af866be30304 100644
--- a/include/xmloff/SchXMLExportHelper.hxx
+++ b/include/xmloff/SchXMLExportHelper.hxx
@@ -52,6 +52,9 @@ public:
/// returns the string corresponding to the current FileFormat CLSID for Chart
const OUString& getChartCLSID();
+ void SetSourceShellID( const OUString& rShellID );
+ void SetDestinationShellID( const OUString& rShellID );
+
private:
SchXMLExportHelper(); // not defined
SchXMLExportHelper(SchXMLExportHelper &); // not defined
diff --git a/include/xmloff/xmlexp.hxx b/include/xmloff/xmlexp.hxx
index d0b02456e6f5..0e5060d72517 100644
--- a/include/xmloff/xmlexp.hxx
+++ b/include/xmloff/xmlexp.hxx
@@ -210,6 +210,9 @@ protected:
// This method must be overloaded to export the content of <office:body>.
virtual void _ExportContent() = 0;
+ OUString GetSourceShellID() const;
+ OUString GetDestinationShellID() const;
+
void SetExtended( bool bSet=true ) { mbExtended = bSet; }
// save linked sections? (may be false in global documents)
diff --git a/svtools/source/misc/embedtransfer.cxx b/svtools/source/misc/embedtransfer.cxx
index 4341c8557c07..7792f84032b0 100644
--- a/svtools/source/misc/embedtransfer.cxx
+++ b/svtools/source/misc/embedtransfer.cxx
@@ -113,7 +113,12 @@ bool SvEmbedTransferHelper::GetData( const css::datatransfer::DataFlavor& rFlavo
SvStream* pStream = NULL;
bool bDeleteStream = false;
uno::Sequence < beans::PropertyValue > aEmpty;
- xPers->storeToEntry( xStg, aName, aEmpty, aEmpty );
+ uno::Sequence<beans::PropertyValue> aObjArgs(2);
+ aObjArgs[0].Name = "SourceShellID";
+ aObjArgs[0].Value <<= maParentShellID;
+ aObjArgs[1].Name = "DestinationShellID";
+ aObjArgs[1].Value <<= rDestDoc;
+ xPers->storeToEntry(xStg, aName, aEmpty, aObjArgs);
if ( xStg->isStreamElement( aName ) )
{
uno::Reference < io::XStream > xStm = xStg->cloneStreamElement( aName );
diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx
index 5691a5b9ce75..d2cdfbd63429 100644
--- a/xmloff/source/chart/SchXMLExport.cxx
+++ b/xmloff/source/chart/SchXMLExport.cxx
@@ -269,6 +269,9 @@ public:
OUString msCLSID;
+ OUString maSrcShellID;
+ OUString maDestShellID;
+
::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > mxAdditionalShapes;
tDataSequenceCont m_aDataSequencesToExport;
@@ -1010,6 +1013,20 @@ const OUString& SchXMLExportHelper::getChartCLSID()
return m_pImpl->msCLSID;
}
+void SchXMLExportHelper::SetSourceShellID( const OUString& rShellID )
+{
+ m_pImpl->maSrcShellID = rShellID;
+}
+
+void SchXMLExportHelper::SetDestinationShellID( const OUString& rShellID )
+{
+ m_pImpl->maDestShellID = rShellID;
+}
+
+UniReference< XMLPropertySetMapper > SchXMLExportHelper_Impl::GetPropertySetMapper() const
+{
+ return mxPropertySetMapper;
+}
void SchXMLExportHelper_Impl::exportAutoStyles()
{
@@ -2280,8 +2297,42 @@ void SchXMLExportHelper_Impl::exportAxis(
// get property states for autostyles
if( xAxisProps.is() && mxExpPropMapper.is() )
{
+ bool bIgnoreLinkedNumFmt = maSrcShellID != maDestShellID;
lcl_exportNumberFormat( sNumFormat, xAxisProps, mrExport );
aPropertyStates = mxExpPropMapper->Filter( xAxisProps );
+
+ fprintf(stdout, "SchXMLExportHelper_Impl::exportAxis: src shell = '%s' dest shell = '%s'\n",
+ rtl::OUStringToOString(maSrcShellID, RTL_TEXTENCODING_UTF8).getStr(),
+ rtl::OUStringToOString(maDestShellID, RTL_TEXTENCODING_UTF8).getStr());
+
+ if (bIgnoreLinkedNumFmt && false)
+ {
+ bool bFound = false;
+ const UniReference<XMLPropertySetMapper>& rMapper = mxExpPropMapper->getPropertySetMapper();
+ for (size_t i = 0; i < aPropertyStates.size(); ++i)
+ {
+ XMLPropertyState& rState = aPropertyStates[i];
+ if (rState.mnIndex < 0 || rMapper->GetEntryCount() <= rState.mnIndex)
+ continue;
+
+ OUString aAPIName = rMapper->GetEntryAPIName(rState.mnIndex);
+ OUString aXMLName = rMapper->GetEntryXMLName(rState.mnIndex);
+
+ if (aAPIName != "LinkNumberFormatToSource")
+ continue;
+
+ rState.maValue <<= false;
+ bFound = true;
+ }
+
+ if (!bFound)
+ {
+ sal_Int32 nIndex = rMapper->GetEntryIndex(XML_NAMESPACE_CHART, "link-data-style-to-source", 0);
+ XMLPropertyState aState(nIndex);
+ aState.maValue <<= false;
+ aPropertyStates.push_back(aState);
+ }
+ }
}
bool bExportDateScale = false;
@@ -3558,6 +3609,9 @@ SchXMLExport::~SchXMLExport()
sal_uInt32 SchXMLExport::exportDoc( enum ::xmloff::token::XMLTokenEnum eClass )
{
+ maExportHelper.SetSourceShellID(GetSourceShellID());
+ maExportHelper.SetDestinationShellID(GetDestinationShellID());
+
Reference< chart2::XChartDocument > xChartDoc( GetModel(), uno::UNO_QUERY );
maExportHelper.m_pImpl->InitRangeSegmentationProperties( xChartDoc );
return SvXMLExport::exportDoc( eClass );
diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx
index 2086d2a7b5b2..f61ed6ceac2a 100644
--- a/xmloff/source/core/xmlexp.cxx
+++ b/xmloff/source/core/xmlexp.cxx
@@ -259,6 +259,9 @@ public:
/// name of stream in package, e.g., "content.xml"
OUString mStreamName;
+ OUString maSrcShellID;
+ OUString maDestShellID;
+
/// stack of backed up namespace maps
/// long: depth at which namespace map has been backed up into the stack
::std::stack< ::std::pair< SvXMLNamespaceMap *, long > > mNamespaceMaps;
@@ -797,14 +800,15 @@ sal_Bool SAL_CALL SvXMLExport::filter( const uno::Sequence< beans::PropertyValue
try
{
+ const sal_Int32 nPropCount = aDescriptor.getLength();
+ const beans::PropertyValue* pProps = aDescriptor.getConstArray();
+
const sal_uInt32 nTest =
EXPORT_META|EXPORT_STYLES|EXPORT_CONTENT|EXPORT_SETTINGS;
if( (mnExportFlags & nTest) == nTest && msOrigFileName.isEmpty() )
{
// evaluate descriptor only for flat files and if a base URI
// has not been provided already
- const sal_Int32 nPropCount = aDescriptor.getLength();
- const beans::PropertyValue* pProps = aDescriptor.getConstArray();
for( sal_Int32 nIndex = 0; nIndex < nPropCount; nIndex++, pProps++ )
{
@@ -824,6 +828,24 @@ sal_Bool SAL_CALL SvXMLExport::filter( const uno::Sequence< beans::PropertyValue
}
}
+ for (sal_Int32 nIndex = 0; nIndex < nPropCount; ++nIndex, ++pProps)
+ {
+ const OUString& rPropName = pProps->Name;
+ const Any& rValue = pProps->Value;
+
+ if (rPropName == "SourceShellID")
+ {
+ if (!(rValue >>= mpImpl->maSrcShellID))
+ return false;
+ }
+ else if (rPropName == "DestinationShellID")
+ {
+ if (!(rValue >>= mpImpl->maDestShellID))
+ return false;
+ }
+ }
+
+
exportDoc( meClass );
}
catch(const uno::Exception& e)
@@ -1510,6 +1532,16 @@ void SvXMLExport::ResetNamespaceMap()
delete mpNamespaceMap; mpNamespaceMap = new SvXMLNamespaceMap;
}
+OUString SvXMLExport::GetSourceShellID() const
+{
+ return mpImpl->maSrcShellID;
+}
+
+OUString SvXMLExport::GetDestinationShellID() const
+{
+ return mpImpl->maDestShellID;
+}
+
void SvXMLExport::_ExportMeta()
{
OUString generator( ::utl::DocInfoHelper::GetGeneratorString() );