diff options
author | Michael Stahl <mstahl@redhat.com> | 2013-05-15 17:09:16 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2013-05-15 18:41:58 +0200 |
commit | 3905bd92b038374d22e4ff9f74480decb116d727 (patch) | |
tree | 61602d069a6549ee9fe8f16716079cd558098584 /xmloff | |
parent | OSL_TRACE -> SAL_INFO (diff) | |
download | core-3905bd92b038374d22e4ff9f74480decb116d727.tar.gz core-3905bd92b038374d22e4ff9f74480decb116d727.zip |
factor out SvXMLImport::IsOOoXML()
Change-Id: I9ccfe565bde1112f9f3cb8c666e901bf121862dc
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/source/core/xmlimp.cxx | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx index 1b0893356cd7..d76eefe95d0d 100644 --- a/xmloff/source/core/xmlimp.cxx +++ b/xmloff/source/core/xmlimp.cxx @@ -270,6 +270,8 @@ public: OUString aODFVersion; + bool mbIsOOoXML; + // Boolean, indicating that position attributes // of shapes are given in horizontal left-to-right layout. This is the case // for the OpenOffice.org file format. (#i28749#) @@ -289,7 +291,7 @@ public: , hMathFontConv( 0 ) , mbOwnGraphicResolver( false ) , mbOwnEmbeddedResolver( false ) - , mStreamName() + , mbIsOOoXML(false) // Convert drawing object positions from OOo file format to OASIS (#i28749#) , mbShapePositionInHoriL2R( sal_False ) , mbTextDocInOOoFileFormat( sal_False ) @@ -831,7 +833,25 @@ void SAL_CALL SvXMLImport::setTargetDocument( const uno::Reference< lang::XCompo mxModel = uno::Reference< frame::XModel >::query( xDoc ); if( !mxModel.is() ) throw lang::IllegalArgumentException(); - if (mxModel.is() && !mxEventListener.is()) + + try + { + uno::Reference<document::XStorageBasedDocument> const xSBDoc(mxModel, + uno::UNO_QUERY_THROW); + uno::Reference<embed::XStorage> const xStor( + xSBDoc->getDocumentStorage()); + if (xStor.is()) + { + mpImpl->mbIsOOoXML = + ::comphelper::OStorageHelper::GetXStorageFormat(xStor) + < SOFFICE_FILEFORMAT_8; + } + } + catch (uno::Exception const& e) + { + SAL_WARN("xmloff.core", "exception caught: " << e.Message); + } + if (!mxEventListener.is()) { mxEventListener.set(new SvXMLImportEventListener(this)); mxModel->addEventListener(mxEventListener); @@ -1577,9 +1597,7 @@ sal_Bool SvXMLImport::IsODFVersionConsistent( const OUString& aODFVersion ) uno::Reference< beans::XPropertySet > xStorProps( xStor, uno::UNO_QUERY_THROW ); // the check should be done only for OASIS format - OUString aMediaType; - xStorProps->getPropertyValue( "MediaType" ) >>= aMediaType; - if ( ::comphelper::OStorageHelper::GetXStorageFormat( xStor ) >= SOFFICE_FILEFORMAT_8 ) + if (!IsOOoXML()) { sal_Bool bRepairPackage = sal_False; try @@ -1846,6 +1864,11 @@ OUString SvXMLImport::GetODFVersion() const return mpImpl->aODFVersion; } +bool SvXMLImport::IsOOoXML() const +{ + return mpImpl->mbIsOOoXML; +} + // xml:id for RDF metadata void SvXMLImport::SetXmlId(uno::Reference<uno::XInterface> const & i_xIfc, OUString const & i_rXmlId) |