diff options
author | Pedro Giffuni <pfg@apache.org> | 2011-10-12 00:30:28 +0000 |
---|---|---|
committer | Pedro Giffuni <pfg@apache.org> | 2011-10-12 00:30:28 +0000 |
commit | 18bfd9d5385765ed63818d776473b1505f0adaa8 (patch) | |
tree | cbe9d7b18b6942416152bccb8345c9ca53ce2858 /xmloff | |
parent | 7de53f9d42fd7347d41d5945dbb37473b83a22e4 (diff) |
118485 - Styles for OLEs are not saved. Submitted by Armin Le Grand.
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/inc/xmloff/xmlimp.hxx | 16 | ||||
-rw-r--r-- | xmloff/source/core/xmlimp.cxx | 111 | ||||
-rw-r--r-- | xmloff/source/draw/shapeexport.cxx | 4 | ||||
-rw-r--r-- | xmloff/source/draw/shapeexport2.cxx | 3 | ||||
-rw-r--r-- | xmloff/source/draw/ximpshap.cxx | 20 |
5 files changed, 126 insertions, 28 deletions
diff --git a/xmloff/inc/xmloff/xmlimp.hxx b/xmloff/inc/xmloff/xmlimp.hxx index 871703bf9ed7..594b8ed47eef 100644 --- a/xmloff/inc/xmloff/xmlimp.hxx +++ b/xmloff/inc/xmloff/xmlimp.hxx @@ -453,13 +453,25 @@ public: static const sal_uInt16 OOo_1x = 10; static const sal_uInt16 OOo_2x = 20; - static const sal_uInt16 OOo_Current = 30; + // --> ORW + static const sal_uInt16 OOo_30x = 30; + static const sal_uInt16 OOo_31x = 31; + static const sal_uInt16 OOo_32x = 32; + static const sal_uInt16 OOo_33x = 33; + static const sal_uInt16 OOo_34x = 34; + static const sal_uInt16 ProductVersionUnknown = SAL_MAX_UINT16; + // <-- /** this checks the build ID and returns * OOo_1x for files created with OpenOffice.org 1.x or StarOffice 7 (this also includes binary import over binfilter) * OOo_2x for files created with OpenOffice.org 2.x or StarOffice 8 - * OOo_Current for files created with OpenOffice.org 3.x and StarOffice9 or newer or for files not created with OpenOffice.org or StarOffice + * OOo_30x for files created with OpenOffice.org 3.0/3.0.1 or StarOffice 9/9 PU01 + * OOo_31x for files created with OpenOffice.org 3.1/3.1.1 or StarOffice 9 PU02/9 PU03 + * OOo_32x for files created with OpenOffice.org 3.2/3.2.1 or StarOffice 9 PU04 or Oracle Open Office 3.2.1 + * OOo_33x for files created with OpenOffice.org 3.3 (and minors) or Oracle Open Office 3.3 (and minors) + * OOo_34x for files created with OpenOffice.org 3.4 Beta or Oracle Open Office 3.4 Beta + * ProductVersionUnknown for files not created with OpenOffice.org, StarOffice or Oracle Open Office */ sal_uInt16 getGeneratorVersion() const; diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx index ff16d453cae9..eed39fe8d8f7 100644 --- a/xmloff/source/core/xmlimp.cxx +++ b/xmloff/source/core/xmlimp.cxx @@ -165,6 +165,62 @@ void SAL_CALL SvXMLImportEventListener::disposing( const lang::EventObject& ) } //============================================================================== +// --> ORW +namespace +{ + class DocumentInfo + { + private: + sal_uInt16 mnGeneratorVersion; + + public: + DocumentInfo( const SvXMLImport& rImport ) + : mnGeneratorVersion( SvXMLImport::ProductVersionUnknown ) + { + sal_Int32 nUPD, nBuild; + if ( rImport.getBuildIds( nUPD, nBuild ) ) + { + if ( nUPD >= 640 && nUPD <= 645 ) + { + mnGeneratorVersion = SvXMLImport::OOo_1x; + } + else if ( nUPD == 680 ) + { + mnGeneratorVersion = SvXMLImport::OOo_2x; + } + else if ( nUPD == 300 && nBuild <= 9379 ) + { + mnGeneratorVersion = SvXMLImport::OOo_30x; + } + else if ( nUPD == 310 ) + { + mnGeneratorVersion = SvXMLImport::OOo_31x; + } + else if ( nUPD == 320 ) + { + mnGeneratorVersion = SvXMLImport::OOo_32x; + } + else if ( nUPD == 330 ) + { + mnGeneratorVersion = SvXMLImport::OOo_33x; + } + else if ( nUPD == 340 ) + { + mnGeneratorVersion = SvXMLImport::OOo_34x; + } + } + } + + ~DocumentInfo() + {} + + const sal_uInt16 getGeneratorVersion() const + { + return mnGeneratorVersion; + } + }; +} +// <-- class SvXMLImport_Impl { @@ -195,19 +251,23 @@ public: std::auto_ptr< xmloff::RDFaImportHelper > mpRDFaHelper; - SvXMLImport_Impl() : - hBatsFontConv( 0 ), hMathFontConv( 0 ), - mbOwnGraphicResolver( false ), - mbOwnEmbeddedResolver( false ), - mStreamName(), - // --> OD 2004-08-11 #i28749# - mbShapePositionInHoriL2R( sal_False ), - // <-- - // --> OD 2007-12-19 #152540# - mbTextDocInOOoFileFormat( sal_False ), + // --> ORW + std::auto_ptr< DocumentInfo > mpDocumentInfo; + // <-- + + SvXMLImport_Impl() + : hBatsFontConv( 0 ) + , hMathFontConv( 0 ) + , mbOwnGraphicResolver( false ) + , mbOwnEmbeddedResolver( false ) + , mStreamName() + , mbShapePositionInHoriL2R( sal_False ) + , mbTextDocInOOoFileFormat( sal_False ) + , mxComponentContext( ::comphelper::getProcessComponentContext() ) + , mpRDFaHelper() // lazy + // --> ORW + , mpDocumentInfo() // lazy // <-- - mxComponentContext( ::comphelper::getProcessComponentContext() ), - mpRDFaHelper() // lazy { OSL_ENSURE(mxComponentContext.is(), "SvXMLImport: no ComponentContext"); if (!mxComponentContext.is()) throw uno::RuntimeException(); @@ -221,6 +281,18 @@ public: DestroyFontToSubsFontConverter( hMathFontConv ); } + // --> ORW + const sal_uInt16 getGeneratorVersion( const SvXMLImport& rImport ) + { + if ( !mpDocumentInfo.get() ) + { + mpDocumentInfo.reset( new DocumentInfo( rImport ) ); + } + + return mpDocumentInfo->getGeneratorVersion(); + } + // <-- + ::comphelper::UnoInterfaceToUniqueIdentifierMapper maInterfaceToIdentifierMapper; }; @@ -1940,18 +2012,9 @@ bool SvXMLImport::getBuildIds( sal_Int32& rUPD, sal_Int32& rBuild ) const sal_uInt16 SvXMLImport::getGeneratorVersion() const { - sal_Int32 nUPD, nBuild; - - if( getBuildIds( nUPD, nBuild ) ) - { - if( nUPD == 680 ) - return OOo_2x; - - if( nUPD >= 640 && nUPD <= 645 ) - return OOo_1x; - } - - return OOo_Current; + // --> ORW + return mpImpl->getGeneratorVersion( *this ); + // <-- } bool SvXMLImport::isGraphicLoadOnDemandSupported() const diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx index a8f09f2d99bd..7effd712c92d 100644 --- a/xmloff/source/draw/shapeexport.cxx +++ b/xmloff/source/draw/shapeexport.cxx @@ -230,11 +230,11 @@ void XMLShapeExport::collectShapeAutoStyles(const uno::Reference< drawing::XShap // ----------------------------- ImpCalcShapeType(xShape, aShapeInfo.meShapeType); + // #i118485# enabled XmlShapeTypeDrawChartShape and XmlShapeTypeDrawOLE2Shape + // to have text const bool bObjSupportsText = // aShapeInfo.meShapeType != XmlShapeTypeDrawControlShape && - aShapeInfo.meShapeType != XmlShapeTypeDrawChartShape && aShapeInfo.meShapeType != XmlShapeTypePresChartShape && - aShapeInfo.meShapeType != XmlShapeTypeDrawOLE2Shape && aShapeInfo.meShapeType != XmlShapeTypePresOLE2Shape && aShapeInfo.meShapeType != XmlShapeTypeDrawSheetShape && aShapeInfo.meShapeType != XmlShapeTypePresSheetShape && diff --git a/xmloff/source/draw/shapeexport2.cxx b/xmloff/source/draw/shapeexport2.cxx index 7c6268571a9c..421d25029afd 100644 --- a/xmloff/source/draw/shapeexport2.cxx +++ b/xmloff/source/draw/shapeexport2.cxx @@ -1691,6 +1691,9 @@ void XMLShapeExport::ImpExportOLE2Shape( enum XMLTokenEnum eElem = sClassId.getLength() ? XML_OBJECT_OLE : XML_OBJECT; SvXMLElementExport aElem( mrExport, XML_NAMESPACE_DRAW, eElem, sal_True, sal_True ); + // #i118485# Add text export, the draw OLE shape allows text now + ImpExportText( xShape ); + if(bExportEmbedded && !bIsEmptyPresObj) { // #100592# diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx index 552c731230af..c8c4394c2447 100644 --- a/xmloff/source/draw/ximpshap.cxx +++ b/xmloff/source/draw/ximpshap.cxx @@ -2683,6 +2683,26 @@ void SdXMLObjectShapeContext::StartElement( const ::com::sun::star::uno::Referen void SdXMLObjectShapeContext::EndElement() { + // #i67705# + const sal_uInt16 nGeneratorVersion(GetImport().getGeneratorVersion()); + + if(nGeneratorVersion < SvXMLImport::OOo_34x) + { + // #i118485# + // If it's an old file from us written before OOo3.4, we need to correct + // FillStyle and LineStyle for OLE2 objects. The error was that the old paint + // implementations just ignored added fill/linestyles completely, thus + // those objects need to be corrected to not show blue and hairline which + // always was the default, but would be shown now + uno::Reference< beans::XPropertySet > xProps(mxShape, uno::UNO_QUERY); + + if( xProps.is() ) + { + xProps->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FillStyle")), uno::makeAny(drawing::FillStyle_NONE)); + xProps->setPropertyValue(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LineStyle")), uno::makeAny(drawing::LineStyle_NONE)); + } + } + // #100592# if( mxBase64Stream.is() ) { |