diff options
author | Kurt Zenker <kz@openoffice.org> | 2009-09-14 10:57:16 +0000 |
---|---|---|
committer | Kurt Zenker <kz@openoffice.org> | 2009-09-14 10:57:16 +0000 |
commit | f779271dc4c7f587213ab73512ed4a29853dee50 (patch) | |
tree | d26bc0e1c1c4c00a08d0ecc827e2920ca91f7c61 | |
parent | e9b6b5cec5547c05c859d3a2ddb816ef60b0f49e (diff) |
CWS-TOOLING: integrate CWS chart41
2009-09-07 11:17:59 +0200 iha r275880 : #i104854# ODF: Fallback to bar chart for surface charts as long as surface charts are not implemented
2009-09-03 10:07:24 +0200 iha r275745 : #i104020# Y axis scaling problem with stock chart
2009-09-02 17:11:42 +0200 iha r275723 : #i103984# XChartDataArray / setDataArray broken
2009-09-02 17:05:16 +0200 iha r275721 : #i103984# XChartDataArray / setDataArray broken
2009-08-31 18:18:21 +0200 iha r275629 : #i103076# ODF, chart from MS-Office2007sp2 doesn't load caused be different xlink:href syntax
2009-08-28 18:35:52 +0200 iha r275548 : #i103460# ODF charts without svg:width and svg:height are not imported correctly
2009-08-28 18:35:25 +0200 iha r275547 : #i103460# ODF charts without svg:width and svg:height are not imported correctly
2009-08-28 18:25:45 +0200 iha r275546 : #i103460# ODF charts without svg:width and svg:height are not imported correctly
2009-08-28 18:23:21 +0200 iha r275544 : #i103460# ODF charts without svg:width and svg:height are not imported correctly
2009-08-28 18:18:34 +0200 iha r275543 : #i103460# ODF charts without svg:width and svg:height are not imported correctly
2009-08-27 15:57:20 +0200 iha r275490 : #i104160# report designer broken
-rw-r--r-- | embeddedobj/source/commonembedding/embedobj.cxx | 6 | ||||
-rw-r--r-- | embeddedobj/source/commonembedding/miscobj.cxx | 10 | ||||
-rw-r--r-- | embeddedobj/source/commonembedding/persistence.cxx | 10 | ||||
-rw-r--r-- | embeddedobj/source/inc/commonembobj.hxx | 7 | ||||
-rw-r--r-- | svx/source/svdraw/svdoole2.cxx | 8 | ||||
-rw-r--r-- | svx/source/xml/xmleohlp.cxx | 28 | ||||
-rw-r--r-- | xmloff/inc/xmloff/xmltoken.hxx | 1 | ||||
-rw-r--r-- | xmloff/source/chart/SchXMLChartContext.cxx | 27 | ||||
-rw-r--r-- | xmloff/source/chart/SchXMLChartContext.hxx | 7 | ||||
-rw-r--r-- | xmloff/source/chart/SchXMLExport.cxx | 7 | ||||
-rw-r--r-- | xmloff/source/chart/SchXMLTools.cxx | 9 | ||||
-rw-r--r-- | xmloff/source/core/xmltoken.cxx | 3 |
12 files changed, 97 insertions, 26 deletions
diff --git a/embeddedobj/source/commonembedding/embedobj.cxx b/embeddedobj/source/commonembedding/embedobj.cxx index 868f77836f..799e8654e9 100644 --- a/embeddedobj/source/commonembedding/embedobj.cxx +++ b/embeddedobj/source/commonembedding/embedobj.cxx @@ -696,3 +696,9 @@ void SAL_CALL OCommonEmbeddedObject::setParent( const com::sun::star::uno::Refer } } +// XDefaultSizeTransmitter +void SAL_CALL OCommonEmbeddedObject::setDefaultSize( const ::com::sun::star::awt::Size& rSize_100TH_MM ) throw (::com::sun::star::uno::RuntimeException) +{ + //#i103460# charts do not necessaryly have an own size within ODF files, in this case they need to use the size settings from the surrounding frame, which is made available with this method + m_aDefaultSizeForChart_In_100TH_MM = rSize_100TH_MM; +} diff --git a/embeddedobj/source/commonembedding/miscobj.cxx b/embeddedobj/source/commonembedding/miscobj.cxx index 5a2bc87b6e..c99f47722d 100644 --- a/embeddedobj/source/commonembedding/miscobj.cxx +++ b/embeddedobj/source/commonembedding/miscobj.cxx @@ -361,9 +361,14 @@ uno::Any SAL_CALL OCommonEmbeddedObject::queryInterface( const uno::Type& rType { uno::Any aReturn; - aReturn <<= ::cppu::queryInterface( + if ( rType == ::getCppuType( (uno::Reference< embed::XEmbeddedObject > const *)0 )) + { + void * p = static_cast< embed::XEmbeddedObject * >( this ); + return uno::Any( &p, rType ); + } + else + aReturn <<= ::cppu::queryInterface( rType, - static_cast< embed::XEmbeddedObject* >( this ), static_cast< embed::XInplaceObject* >( this ), static_cast< embed::XVisualObject* >( this ), static_cast< embed::XCommonEmbedPersist* >( static_cast< embed::XEmbedPersist* >( this ) ), @@ -374,6 +379,7 @@ uno::Any SAL_CALL OCommonEmbeddedObject::queryInterface( const uno::Type& rType static_cast< embed::XComponentSupplier* >( this ), static_cast< util::XCloseable* >( this ), static_cast< container::XChild* >( this ), + static_cast< chart2::XDefaultSizeTransmitter* >( this ), static_cast< document::XEventBroadcaster* >( this ) ); if ( aReturn.hasValue() ) diff --git a/embeddedobj/source/commonembedding/persistence.cxx b/embeddedobj/source/commonembedding/persistence.cxx index 8310ebc3a1..bd2ffcf042 100644 --- a/embeddedobj/source/commonembedding/persistence.cxx +++ b/embeddedobj/source/commonembedding/persistence.cxx @@ -58,6 +58,7 @@ #include <com/sun/star/util/XCloseable.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/beans/IllegalTypeException.hpp> +#include <com/sun/star/chart2/XChartDocument.hpp> #include <comphelper/fileformat.h> #include <comphelper/storagehelper.hxx> @@ -463,6 +464,15 @@ uno::Reference< util::XCloseable > OCommonEmbeddedObject::LoadDocumentFromStorag uno::Reference< util::XCloseable > xDocument( CreateDocument( m_xFactory, GetDocumentServiceName(), m_bEmbeddedScriptSupport ) ); + //#i103460# ODF: take the size given from the parent frame as default + uno::Reference< chart2::XChartDocument > xChart( xDocument, uno::UNO_QUERY ); + if( xChart.is() ) + { + uno::Reference< embed::XVisualObject > xChartVisualObject( xChart, uno::UNO_QUERY ); + if( xChartVisualObject.is() ) + xChartVisualObject->setVisualAreaSize( embed::Aspects::MSOLE_CONTENT, m_aDefaultSizeForChart_In_100TH_MM ); + } + uno::Reference< frame::XLoadable > xLoadable( xDocument, uno::UNO_QUERY ); uno::Reference< document::XStorageBasedDocument > xDoc #ifdef USE_STORAGEBASED_DOCUMENT diff --git a/embeddedobj/source/inc/commonembobj.hxx b/embeddedobj/source/inc/commonembobj.hxx index 2f4c8dea7e..9139409c09 100644 --- a/embeddedobj/source/inc/commonembobj.hxx +++ b/embeddedobj/source/inc/commonembobj.hxx @@ -47,6 +47,7 @@ #include <com/sun/star/awt/Rectangle.hpp> #include <com/sun/star/document/XEventBroadcaster.hpp> #include <com/sun/star/util/XCloseable.hpp> +#include <com/sun/star/chart2/XDefaultSizeTransmitter.hpp> #include <cppuhelper/weak.hxx> namespace com { namespace sun { namespace star { @@ -85,6 +86,7 @@ class OCommonEmbeddedObject : public ::com::sun::star::embed::XEmbeddedObject , public ::com::sun::star::embed::XLinkageSupport , public ::com::sun::star::embed::XInplaceObject , public ::com::sun::star::container::XChild + , public ::com::sun::star::chart2::XDefaultSizeTransmitter , public ::cppu::OWeakObject { protected: @@ -159,6 +161,7 @@ protected: sal_Bool m_bHasClonedSize; // the object has cached size ::com::sun::star::awt::Size m_aClonedSize; sal_Int32 m_nClonedMapUnit; + ::com::sun::star::awt::Size m_aDefaultSizeForChart_In_100TH_MM;//#i103460# charts do not necessaryly have an own size within ODF files, in this case they need to use the size settings from the surrounding frame, which is made available with this member private: void CommonInit_Impl( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& aObjectProps ); @@ -492,6 +495,10 @@ public: // XChild virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getParent( ) throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL setParent( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& Parent ) throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException); + + // XDefaultSizeTransmitter + //#i103460# charts do not necessaryly have an own size within ODF files, in this case they need to use the size settings from the surrounding frame, which is made available with this method + virtual void SAL_CALL setDefaultSize( const ::com::sun::star::awt::Size& rSize_100TH_MM ) throw (::com::sun::star::uno::RuntimeException); }; #endif diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx index 37281e107b..1e89aab1b0 100644 --- a/svx/source/svdraw/svdoole2.cxx +++ b/svx/source/svdraw/svdoole2.cxx @@ -1867,6 +1867,14 @@ void SdrOle2Obj::NbcSetSnapRect(const Rectangle& rRect) SdrRectObj::NbcSetSnapRect(rRect); if( pModel && !pModel->isLocked() ) ImpSetVisAreaSize(); + + if ( xObjRef.is() && IsChart() ) + { + //#i103460# charts do not necessaryly have an own size within ODF files, + //for this case they need to use the size settings from the surrounding frame, + //which is made available with this method as there is no other way + xObjRef.SetDefaultSizeForChart( Size( rRect.GetWidth(), rRect.GetHeight() ) ); + } } // ----------------------------------------------------------------------------- diff --git a/svx/source/xml/xmleohlp.cxx b/svx/source/xml/xmleohlp.cxx index 47056a247f..8b94cf3085 100644 --- a/svx/source/xml/xmleohlp.cxx +++ b/svx/source/xml/xmleohlp.cxx @@ -326,11 +326,29 @@ sal_Bool SvXMLEmbeddedObjectHelper::ImplGetStorageNames( } else { - sal_Int32 nPathStart = 0; - if( 0 == aURLNoPar.compareToAscii( "./", 2 ) ) - nPathStart = 2; - if( _nPos >= nPathStart ) - rContainerStorageName = aURLNoPar.copy( nPathStart, _nPos-nPathStart); + //eliminate 'superfluous' slashes at start and end + //#i103076# load objects with all allowed xlink:href syntaxes + { + //eliminate './' at start + sal_Int32 nStart = 0; + sal_Int32 nCount = aURLNoPar.getLength(); + if( 0 == aURLNoPar.compareToAscii( "./", 2 ) ) + { + nStart = 2; + nCount -= 2; + } + + //eliminate '/' at end + sal_Int32 nEnd = aURLNoPar.lastIndexOf( '/' ); + if( nEnd == aURLNoPar.getLength()-1 && nEnd != (nStart-1) ) + nCount--; + + aURLNoPar = aURLNoPar.copy( nStart, nCount ); + } + + _nPos = aURLNoPar.lastIndexOf( '/' ); + if( _nPos >= 0 ) + rContainerStorageName = aURLNoPar.copy( 0, _nPos ); rObjectStorageName = aURLNoPar.copy( _nPos+1 ); } } diff --git a/xmloff/inc/xmloff/xmltoken.hxx b/xmloff/inc/xmloff/xmltoken.hxx index 0010b61069..20ccb24944 100644 --- a/xmloff/inc/xmloff/xmltoken.hxx +++ b/xmloff/inc/xmloff/xmltoken.hxx @@ -3075,6 +3075,7 @@ namespace xmloff { namespace token { XML_AT_AXIS, XML_AT_LABELS_AND_AXIS, XML_FILLED_RADAR, + XML_SURFACE, // MathML only XML_MATHVARIANT, diff --git a/xmloff/source/chart/SchXMLChartContext.cxx b/xmloff/source/chart/SchXMLChartContext.cxx index f44f23a939..5125a37610 100644 --- a/xmloff/source/chart/SchXMLChartContext.cxx +++ b/xmloff/source/chart/SchXMLChartContext.cxx @@ -318,7 +318,12 @@ void SchXMLChartContext::StartElement( const uno::Reference< xml::sax::XAttribut // parse attributes sal_Int16 nAttrCount = xAttrList.is()? xAttrList->getLength(): 0; const SvXMLTokenMap& rAttrTokenMap = mrImportHelper.GetChartAttrTokenMap(); - awt::Size aChartSize; + + uno::Reference< embed::XVisualObject > xVisualObject( mrImportHelper.GetChartDocument(), uno::UNO_QUERY); + DBG_ASSERT(xVisualObject.is(),"need xVisualObject for page size"); + if( xVisualObject.is() ) + maChartSize = xVisualObject->getVisualAreaSize( embed::Aspects::MSOLE_CONTENT ); //#i103460# take the size given from the parent frame as default + // this flag is necessarry for pie charts in the core sal_Bool bSetSwitchData = sal_False; @@ -377,11 +382,11 @@ void SchXMLChartContext::StartElement( const uno::Reference< xml::sax::XAttribut break; case XML_TOK_CHART_WIDTH: - GetImport().GetMM100UnitConverter().convertMeasure( aChartSize.Width, aValue ); + GetImport().GetMM100UnitConverter().convertMeasure( maChartSize.Width, aValue ); break; case XML_TOK_CHART_HEIGHT: - GetImport().GetMM100UnitConverter().convertMeasure( aChartSize.Height, aValue ); + GetImport().GetMM100UnitConverter().convertMeasure( maChartSize.Height, aValue ); break; case XML_TOK_CHART_STYLE_NAME: @@ -406,8 +411,12 @@ void SchXMLChartContext::StartElement( const uno::Reference< xml::sax::XAttribut maChartTypeServiceName = SchXMLTools::GetChartTypeByClassName( aChartClass_Bar, false /* bUseOldNames */ ); } - InitChart (aChartSize, aOldChartTypeName, bSetSwitchData); - + // Set the size of the draw page. + if( xVisualObject.is() ) + xVisualObject->setVisualAreaSize( embed::Aspects::MSOLE_CONTENT, maChartSize ); + + InitChart( aOldChartTypeName, bSetSwitchData); + if( bHasAddin ) { //correct charttype serveice name when having an addin @@ -1198,11 +1207,9 @@ SvXMLImportContext* SchXMLChartContext::CreateChildContext( 4. Set the chart type. */ void SchXMLChartContext::InitChart( - awt::Size aChartSize, const OUString & rChartTypeServiceName, // currently the old service name sal_Bool /* bSetSwitchData */ ) { - maChartSize = aChartSize; uno::Reference< chart::XChartDocument > xDoc = mrImportHelper.GetChartDocument(); DBG_ASSERT( xDoc.is(), "No valid document!" ); uno::Reference< frame::XModel > xModel (xDoc, uno::UNO_QUERY ); @@ -1217,12 +1224,6 @@ void SchXMLChartContext::InitChart( xTitled->setTitleObject( 0 ); } - // Set the size of the draw page. - uno::Reference< embed::XVisualObject > xVisualObject(xModel,uno::UNO_QUERY); - DBG_ASSERT(xVisualObject.is(),"need xVisualObject for page size"); - if( xVisualObject.is() ) - xVisualObject->setVisualAreaSize( embed::Aspects::MSOLE_CONTENT, aChartSize ); - // Set the chart type via setting the diagram. if( rChartTypeServiceName.getLength() && xDoc.is()) diff --git a/xmloff/source/chart/SchXMLChartContext.hxx b/xmloff/source/chart/SchXMLChartContext.hxx index bfb823fa94..076cde7340 100644 --- a/xmloff/source/chart/SchXMLChartContext.hxx +++ b/xmloff/source/chart/SchXMLChartContext.hxx @@ -138,15 +138,12 @@ private: ::com::sun::star::awt::Size maChartSize; /** @descr This method bundles some settings to the chart model and executes them with - a locked controller. This includes setting the draw page size and setting - the chart type. - @param aChartSize The size the draw page will be set to. + a locked controller. This includes setting the chart type. @param aServiceName The name of the service the diagram is initialized with. @param bSetWitchData Indicates wether the data set takes it's data series from rows or from columns. */ - void InitChart (com::sun::star::awt::Size aChartSize, - const ::rtl::OUString & rChartTypeServiceName, + void InitChart (const ::rtl::OUString & rChartTypeServiceName, sal_Bool bSetSwitchData); void MergeSeriesForStockChart(); diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx index 25bcf43171..56daa7b05c 100644 --- a/xmloff/source/chart/SchXMLExport.cxx +++ b/xmloff/source/chart/SchXMLExport.cxx @@ -93,6 +93,7 @@ #include <com/sun/star/chart2/data/XDataSink.hpp> #include <com/sun/star/chart2/data/XDataReceiver.hpp> #include <com/sun/star/chart2/data/XDataProvider.hpp> +#include <com/sun/star/chart2/data/XDatabaseDataProvider.hpp> #include <com/sun/star/chart2/data/XRangeXMLConversion.hpp> #include <com/sun/star/chart2/data/XTextualDataSequence.hpp> #include <com/sun/star/chart2/data/XNumericalDataSequence.hpp> @@ -1123,6 +1124,12 @@ void SchXMLExportHelper::parseDocument( Reference< chart::XChartDocument >& rCha OUString aDataProviderURL( RTL_CONSTASCII_USTRINGPARAM( ".." ) ); if( xNewDoc->hasInternalDataProvider() ) aDataProviderURL = OUString( RTL_CONSTASCII_USTRINGPARAM( "." ) ); + else //special handling for data base data provider necessary + { + Reference< chart2::data::XDatabaseDataProvider > xDBDataProvider( xNewDoc->getDataProvider(), uno::UNO_QUERY ); + if( xDBDataProvider.is() ) + aDataProviderURL = OUString( RTL_CONSTASCII_USTRINGPARAM( "." ) ); + } mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, aDataProviderURL ); } diff --git a/xmloff/source/chart/SchXMLTools.cxx b/xmloff/source/chart/SchXMLTools.cxx index 40828bf400..6a600a44e1 100644 --- a/xmloff/source/chart/SchXMLTools.cxx +++ b/xmloff/source/chart/SchXMLTools.cxx @@ -173,6 +173,7 @@ static __FAR_DATA SvXMLEnumMapEntry aXMLChartClassMap[] = { XML_BAR, XML_CHART_CLASS_BAR }, { XML_STOCK, XML_CHART_CLASS_STOCK }, { XML_BUBBLE, XML_CHART_CLASS_BUBBLE }, + { XML_SURFACE, XML_CHART_CLASS_BAR }, //@todo change this if a surface chart is available { XML_ADD_IN, XML_CHART_CLASS_ADDIN }, { XML_TOKEN_INVALID, XML_CHART_CLASS_UNKNOWN } }; @@ -293,6 +294,14 @@ OUString GetChartTypeByClassName( else aResultBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM("CandleStick")); } + else if( IsXMLToken( rClassName, XML_SURFACE )) + { + //@todo change this if a surface chart is available + if( bUseOldNames ) + aResultBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM("Bar")); + else + aResultBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM("Column")); + } else bInternalType = false; diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx index 70319b4864..0dde523b4e 100644 --- a/xmloff/source/core/xmltoken.cxx +++ b/xmloff/source/core/xmltoken.cxx @@ -3077,7 +3077,8 @@ namespace xmloff { namespace token { TOKEN( "at-axis", XML_AT_AXIS ), TOKEN( "at-labels-and-axis", XML_AT_LABELS_AND_AXIS ), TOKEN( "filled-radar", XML_FILLED_RADAR ), - + TOKEN( "surface", XML_SURFACE ), + TOKEN( "mathvariant", XML_MATHVARIANT ), TOKEN( "mathsize", XML_MATHSIZE ), TOKEN( "mathweight", XML_MATHWEIGHT ), |