summaryrefslogtreecommitdiff
path: root/xmloff/source/chart/SchXMLTools.cxx
diff options
context:
space:
mode:
authorVladimir Glazounov <vg@openoffice.org>2009-08-26 12:47:18 +0000
committerVladimir Glazounov <vg@openoffice.org>2009-08-26 12:47:18 +0000
commit004098681b06be35ad163abf2ae7ef8c39212a5a (patch)
tree4bb1bf452ac0908ed1acb02116cafefc02565c8a /xmloff/source/chart/SchXMLTools.cxx
parentdf2226e0bdc0ab020d8a59f6f5fc83d5a769ee00 (diff)
CWS-TOOLING: integrate CWS chart40
2009-08-05 10:28:53 +0200 iha r274640 : CWS-TOOLING: rebase CWS chart40 to trunk@274622 (milestone: DEV300:m54) 2009-07-31 18:03:11 +0200 iha r274546 : #i91420# number of lines on chart type dialog is incorrect 2009-07-23 15:51:13 +0200 iha r274275 : correct detection of old chart files b6700820 2009-07-23 15:10:30 +0200 iha r274273 : #i103287# some lines vanish on import of some old files (opacity-problem) 2009-07-23 13:42:10 +0200 iha r274268 : #i103588# Chart in report cause crash 2009-07-23 10:57:14 +0200 iha r274264 : #i95503# Enter key does not work in source ranges dialog 2009-07-22 10:25:02 +0200 iha r274221 : #i103713# ambiguous && || 2009-07-20 12:59:02 +0200 iha r274120 : #i103468# remove warning
Diffstat (limited to 'xmloff/source/chart/SchXMLTools.cxx')
-rw-r--r--xmloff/source/chart/SchXMLTools.cxx60
1 files changed, 44 insertions, 16 deletions
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;