summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xmloff/inc/xmloff/xmlmetai.hxx5
-rw-r--r--xmloff/source/chart/SchXMLImport.cxx5
-rw-r--r--xmloff/source/chart/SchXMLTableContext.cxx11
-rw-r--r--xmloff/source/chart/SchXMLTools.cxx60
-rw-r--r--xmloff/source/chart/SchXMLTools.hxx4
-rw-r--r--xmloff/source/meta/xmlmetai.cxx15
6 files changed, 78 insertions, 22 deletions
diff --git a/xmloff/inc/xmloff/xmlmetai.hxx b/xmloff/inc/xmloff/xmlmetai.hxx
index 9423b7424b73..7cc1c6b054ec 100644
--- a/xmloff/inc/xmloff/xmlmetai.hxx
+++ b/xmloff/inc/xmloff/xmlmetai.hxx
@@ -35,6 +35,7 @@
#include "xmloff/dllapi.h"
#include <xmloff/xmlictxt.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/document/XDocumentProperties.hpp>
#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
@@ -76,6 +77,10 @@ protected:
void initDocumentProperties();
// set the BuildId property at the importer
void setBuildId(const ::rtl::OUString & i_rBuildId);
+
+public:
+ static void setBuildId(const ::rtl::OUString & rGenerator,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& xImportInfo );
};
#endif // _XMLOFF_XMLMETAI_HXX
diff --git a/xmloff/source/chart/SchXMLImport.cxx b/xmloff/source/chart/SchXMLImport.cxx
index 831c15fb624e..dd955e6d69d5 100644
--- a/xmloff/source/chart/SchXMLImport.cxx
+++ b/xmloff/source/chart/SchXMLImport.cxx
@@ -35,6 +35,8 @@
#include "SchXMLChartContext.hxx"
#include "contexts.hxx"
#include "XMLChartPropertySetMapper.hxx"
+#include "SchXMLTools.hxx"
+
#include <tools/debug.hxx>
#include <rtl/ustrbuf.hxx>
// header for class ByteString
@@ -872,6 +874,9 @@ SvXMLImportContext* SchXMLImport::CreateStylesContext(
const OUString& rLocalName,
const Reference<xml::sax::XAttributeList>& xAttrList )
{
+ //#i103287# make sure that the version information is set before importing all the properties (especially stroke-opacity!)
+ SchXMLTools::setBuildIDAtImportInfo( GetModel(), getImportInfo() );
+
SvXMLStylesContext* pStylesCtxt =
new SvXMLStylesContext( *(this), XML_NAMESPACE_OFFICE, rLocalName, xAttrList );
diff --git a/xmloff/source/chart/SchXMLTableContext.cxx b/xmloff/source/chart/SchXMLTableContext.cxx
index 4eb17d289d73..a1c021171a92 100644
--- a/xmloff/source/chart/SchXMLTableContext.cxx
+++ b/xmloff/source/chart/SchXMLTableContext.cxx
@@ -936,7 +936,15 @@ void SchXMLTableHelper::applyTableSimple(
sal_Int32 nColumnCount = 0;
sal_Int32 nCol = 0, nRow = 0;
if( nRowCount )
+ {
nColumnCount = rTable.aData[ 0 ].size();
+ ::std::vector< ::std::vector< SchXMLCell > >::const_iterator iRow = rTable.aData.begin();
+ while( iRow != rTable.aData.end() )
+ {
+ nColumnCount = ::std::max( nColumnCount, static_cast<sal_Int32>(iRow->size()) );
+ iRow++;
+ }
+ }
// #i27909# avoid illegal index access for empty tables
if( nColumnCount == 0 || nRowCount == 0 )
@@ -950,7 +958,8 @@ void SchXMLTableHelper::applyTableSimple(
// set labels
::std::vector< ::std::vector< SchXMLCell > >::const_iterator iRow = rTable.aData.begin();
- for( nCol = 1; nCol < nColumnCount; nCol++ )
+ sal_Int32 nColumnCountOnFirstRow = iRow->size();
+ for( nCol = 1; nCol < nColumnCountOnFirstRow; nCol++ )
{
aLabels[ nCol - 1 ] = (*iRow)[ nCol ].aString;
}
diff --git a/xmloff/source/chart/SchXMLTools.cxx b/xmloff/source/chart/SchXMLTools.cxx
index 08f2c043894c..a1700c65d316 100644
--- a/xmloff/source/chart/SchXMLTools.cxx
+++ b/xmloff/source/chart/SchXMLTools.cxx
@@ -53,6 +53,7 @@
#include <xmloff/xmlprmap.hxx>
#include <xmloff/xmlexp.hxx>
#include "xmlnmspe.hxx"
+#include <xmloff/xmlmetai.hxx>
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
@@ -103,9 +104,19 @@ rtl::OUString lcl_getGeneratorFromModel( const uno::Reference< frame::XModel >&
uno::Reference< document::XDocumentProperties > xChartDocumentProperties(
xChartDocumentPropertiesSupplier->getDocumentProperties());
if( xChartDocumentProperties.is() )
- {
aGenerator = xChartDocumentProperties->getGenerator();
- }
+ }
+ return aGenerator;
+}
+
+rtl::OUString lcl_getGeneratorFromModelOrItsParent( const uno::Reference< frame::XModel >& xChartModel )
+{
+ ::rtl::OUString aGenerator( lcl_getGeneratorFromModel(xChartModel) );
+ if( !aGenerator.getLength() ) //try to get the missing info from the parent document
+ {
+ uno::Reference< container::XChild > xChild( xChartModel, uno::UNO_QUERY );
+ if( xChild.is() )
+ aGenerator = lcl_getGeneratorFromModel( uno::Reference< frame::XModel >( xChild->getParent(), uno::UNO_QUERY) );
}
return aGenerator;
}
@@ -681,6 +692,13 @@ bool switchBackToDataProviderFromParent( const Reference< chart2::XChartDocument
return true;
}
+void setBuildIDAtImportInfo( uno::Reference< frame::XModel > xModel, Reference< beans::XPropertySet > xImportInfo )
+{
+ ::rtl::OUString aGenerator( lcl_getGeneratorFromModelOrItsParent(xModel) );
+ if( aGenerator.getLength() )
+ SvXMLMetaDocumentContext::setBuildId( aGenerator, xImportInfo );
+}
+
bool isDocumentGeneratedWithOpenOfficeOlderThan3_0( const uno::Reference< frame::XModel >& xChartModel )
{
bool bResult = isDocumentGeneratedWithOpenOfficeOlderThan2_3( xChartModel );
@@ -714,31 +732,41 @@ bool isDocumentGeneratedWithOpenOfficeOlderThan2_3( const uno::Reference< frame:
//if there is a meta stream at the chart object it was not written with an older OpenOffice version < 2.3
if( !aGenerator.getLength() )
{
- //if there is no meta stream at the chart object we need to check the version from the parent document
- //and we need to check whether the document was created with OpenOffice.org at all
+ //if there is no meta stream at the chart object we need to check whether the parent document is OpenOffice at all
uno::Reference< container::XChild > xChild( xChartModel, uno::UNO_QUERY );
if( xChild.is() )
{
- ::rtl::OUString aParentGenerator( lcl_getGeneratorFromModel( uno::Reference< frame::XModel >( xChild->getParent(), uno::UNO_QUERY) ) );
- if( aParentGenerator.indexOf( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("OpenOffice.org_project") ) ) != -1 )
+ aGenerator = lcl_getGeneratorFromModel( uno::Reference< frame::XModel >( xChild->getParent(), uno::UNO_QUERY) );
+ if( aGenerator.indexOf( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("OpenOffice.org_project") ) ) != -1 )
{
- sal_Int32 nBuilId = lcl_getBuildIDFromGenerator( aParentGenerator );
- if( nBuilId<=9161 ) //9161 is build id of OpenOffice.org 2.2.1
- bResult= true;
+ //the chart application has not created files without a meta stream since OOo 2.3 (OOo 2.3 has written a metastream already)
+ //only the report builder extension has created some files with OOo 3.1 that do not have a meta stream
+ if( aGenerator.indexOf( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("OpenOffice.org_project/31") ) ) != -1 )
+ bResult = false;//#i100102# probably generated with OOo 3.1 by the report designer
+ else
+ bResult= true; //in this case the OLE chart was created by an older version, as OLE objects are sometimes stream copied the version can differ from the parents version, so the parents version is not a reliable indicator
}
- else if(
- ( aParentGenerator.indexOf( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("OpenOffice.org 1") ) ) == 0 )
- || ( aParentGenerator.indexOf( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("StarOffice 6") ) ) == 0 )
- || ( aParentGenerator.indexOf( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("StarOffice 7") ) ) == 0 )
- || ( aParentGenerator.indexOf( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("StarSuite 6") ) ) == 0 )
- || ( aParentGenerator.indexOf( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("StarSuite 7") ) ) == 0 )
- )
+ else if( isDocumentGeneratedWithOpenOfficeOlderThan2_0(xChartModel) )
bResult= true;
}
}
return bResult;
}
+bool isDocumentGeneratedWithOpenOfficeOlderThan2_0( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel)
+{
+ bool bResult = false;
+ ::rtl::OUString aGenerator( lcl_getGeneratorFromModelOrItsParent(xChartModel) );
+ if( ( aGenerator.indexOf( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("OpenOffice.org 1") ) ) == 0 )
+ || ( aGenerator.indexOf( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("StarOffice 6") ) ) == 0 )
+ || ( aGenerator.indexOf( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("StarOffice 7") ) ) == 0 )
+ || ( aGenerator.indexOf( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("StarSuite 6") ) ) == 0 )
+ || ( aGenerator.indexOf( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("StarSuite 7") ) ) == 0 )
+ )
+ bResult= true;
+ return bResult;
+}
+
Reference< chart2::data::XDataProvider > getDataProviderFromParent( const Reference< chart2::XChartDocument >& xChartDoc )
{
Reference< chart2::data::XDataProvider > xRet;
diff --git a/xmloff/source/chart/SchXMLTools.hxx b/xmloff/source/chart/SchXMLTools.hxx
index 1ceaf6090707..89d17fc440d9 100644
--- a/xmloff/source/chart/SchXMLTools.hxx
+++ b/xmloff/source/chart/SchXMLTools.hxx
@@ -53,10 +53,14 @@ class SvXMLExport;
namespace SchXMLTools
{
+ bool isDocumentGeneratedWithOpenOfficeOlderThan2_0( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel);
bool isDocumentGeneratedWithOpenOfficeOlderThan2_3( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel);
bool isDocumentGeneratedWithOpenOfficeOlderThan2_4( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel);
bool isDocumentGeneratedWithOpenOfficeOlderThan3_0( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel);
+ void setBuildIDAtImportInfo( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > xModel
+ , ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xImportInfo );
+
enum SchXMLChartTypeEnum
{
XML_CHART_CLASS_LINE,
diff --git a/xmloff/source/meta/xmlmetai.cxx b/xmloff/source/meta/xmlmetai.cxx
index 4eda35e38a23..c903cf2dc1ba 100644
--- a/xmloff/source/meta/xmlmetai.cxx
+++ b/xmloff/source/meta/xmlmetai.cxx
@@ -209,7 +209,13 @@ void SvXMLMetaDocumentContext::initDocumentProperties()
}
}
-void SvXMLMetaDocumentContext::setBuildId(::rtl::OUString const& i_rBuildId)
+void SvXMLMetaDocumentContext::setBuildId(const ::rtl::OUString & i_rBuildId)
+{
+ SvXMLMetaDocumentContext::setBuildId( i_rBuildId, GetImport().getImportInfo() );
+}
+
+//static
+void SvXMLMetaDocumentContext::setBuildId(::rtl::OUString const& i_rBuildId, const uno::Reference<beans::XPropertySet>& xImportInfo )
{
OUString sBuildId;
// skip to second product
@@ -258,14 +264,13 @@ void SvXMLMetaDocumentContext::setBuildId(::rtl::OUString const& i_rBuildId)
if ( sBuildId.getLength() ) try
{
- uno::Reference<beans::XPropertySet> xSet(GetImport().getImportInfo());
- if( xSet.is() )
+ if( xImportInfo.is() )
{
const OUString aPropName(RTL_CONSTASCII_USTRINGPARAM("BuildId"));
uno::Reference< beans::XPropertySetInfo > xSetInfo(
- xSet->getPropertySetInfo());
+ xImportInfo->getPropertySetInfo());
if( xSetInfo.is() && xSetInfo->hasPropertyByName( aPropName ) )
- xSet->setPropertyValue( aPropName, uno::makeAny( sBuildId ) );
+ xImportInfo->setPropertyValue( aPropName, uno::makeAny( sBuildId ) );
}
}
catch( uno::Exception& )