summaryrefslogtreecommitdiff
path: root/xmloff
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
commitca36684a63bbf94fef251625fb1c1a7bc4feebff (patch)
treebae9cc4e60c2232026c310c8eed32e3348050e0e /xmloff
parentfd840af5d14bb673860a078e7d38f72ccb97138a (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')
-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 5c279274f3..d525c74636 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 7dde79f930..9a8779630c 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 8681ecea36..2e0aad2997 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 12e31ed11c..40828bf400 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 a116dc6889..8be5df2ddb 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 faef92dd6a..26a96378a1 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& )