Kaydet (Commit) 1ffe0d5c authored tarafından Björn Milcke's avatar Björn Milcke

#93509# series rearrangement: new attributes column-mapping / row-mapping for chart element

üst f5d2e3a1
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: SchXMLImport.hxx,v $ * $RCSfile: SchXMLImport.hxx,v $
* *
* $Revision: 1.15 $ * $Revision: 1.16 $
* *
* last change: $Author: bm $ $Date: 2001-09-14 11:19:34 $ * last change: $Author: bm $ $Date: 2001-10-23 09:58:39 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -137,7 +137,9 @@ enum SchXMLChartAttrMap ...@@ -137,7 +137,9 @@ enum SchXMLChartAttrMap
XML_TOK_CHART_WIDTH, XML_TOK_CHART_WIDTH,
XML_TOK_CHART_HEIGHT, XML_TOK_CHART_HEIGHT,
XML_TOK_CHART_STYLE_NAME, XML_TOK_CHART_STYLE_NAME,
XML_TOK_CHART_ADDIN_NAME XML_TOK_CHART_ADDIN_NAME,
XML_TOK_CHART_COL_MAPPING,
XML_TOK_CHART_ROW_MAPPING
}; };
enum SchXMLPlotAreaAttrTokenMap enum SchXMLPlotAreaAttrTokenMap
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: SchXMLChartContext.cxx,v $ * $RCSfile: SchXMLChartContext.cxx,v $
* *
* $Revision: 1.25 $ * $Revision: 1.26 $
* *
* last change: $Author: bm $ $Date: 2001-10-22 10:38:33 $ * last change: $Author: bm $ $Date: 2001-10-23 10:02:29 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -91,6 +91,8 @@ ...@@ -91,6 +91,8 @@
#include "prstylei.hxx" #include "prstylei.hxx"
#endif #endif
#include "vector"
#ifndef _COM_SUN_STAR_CHART_XCHARTDOCUMENT_HPP_ #ifndef _COM_SUN_STAR_CHART_XCHARTDOCUMENT_HPP_
#include <com/sun/star/chart/XChartDocument.hpp> #include <com/sun/star/chart/XChartDocument.hpp>
#endif #endif
...@@ -275,6 +277,13 @@ void SchXMLChartContext::StartElement( const uno::Reference< xml::sax::XAttribut ...@@ -275,6 +277,13 @@ void SchXMLChartContext::StartElement( const uno::Reference< xml::sax::XAttribut
case XML_TOK_CHART_ADDIN_NAME: case XML_TOK_CHART_ADDIN_NAME:
aServiceName = aValue; aServiceName = aValue;
break; break;
case XML_TOK_CHART_COL_MAPPING:
msColTrans = aValue;
break;
case XML_TOK_CHART_ROW_MAPPING:
msRowTrans = aValue;
break;
} }
} }
...@@ -471,6 +480,22 @@ void SchXMLChartContext::EndElement() ...@@ -471,6 +480,22 @@ void SchXMLChartContext::EndElement()
xProp->setPropertyValue( rtl::OUString::createFromAscii( "SeriesAddresses" ), aAny ); xProp->setPropertyValue( rtl::OUString::createFromAscii( "SeriesAddresses" ), aAny );
} }
} }
// row / col translations
bool bHasColTrans = (msColTrans.getLength() > 0);
bool bHasRowTrans = (msRowTrans.getLength() > 0);
if( bHasColTrans )
{
uno::Sequence< sal_Int32 > aSeq = GetNumberSequenceFromString( msColTrans );
aAny <<= aSeq;
xProp->setPropertyValue( ::rtl::OUString::createFromAscii( "TranslatedColumns" ), aAny );
}
else if( bHasRowTrans )
{
uno::Sequence< sal_Int32 > aSeq = GetNumberSequenceFromString( msRowTrans );
aAny <<= aSeq;
xProp->setPropertyValue( ::rtl::OUString::createFromAscii( "TranslatedRows" ), aAny );
}
} }
catch( beans::UnknownPropertyException ) catch( beans::UnknownPropertyException )
{ {
...@@ -744,6 +769,41 @@ void SchXMLChartContext::InitChart (awt::Size aChartSize, ...@@ -744,6 +769,41 @@ void SchXMLChartContext::InitChart (awt::Size aChartSize,
xModel->unlockControllers(); xModel->unlockControllers();
} }
uno::Sequence< sal_Int32 > SchXMLChartContext::GetNumberSequenceFromString( const ::rtl::OUString& rStr )
{
const sal_Unicode aSpace( ' ' );
// count number of entries
::std::vector< sal_Int32 > aVec;
sal_Int32 nLastPos = 0;
sal_Int32 nPos = 0;
const sal_Int32 nSize = rStr.getLength();
while( nPos != -1 )
{
nPos = rStr.indexOf( aSpace, nLastPos );
if( nPos > nLastPos )
{
aVec.push_back( rStr.copy( nLastPos, (nPos - nLastPos) ).toInt32() );
}
if( nPos != -1 )
nLastPos = nPos + 1;
}
// last entry
if( nLastPos != 0 &&
rStr.getLength() > nLastPos )
{
aVec.push_back( rStr.copy( nLastPos, (rStr.getLength() - nLastPos) ).toInt32() );
}
const sal_Int32 nVecSize = aVec.size();
uno::Sequence< sal_Int32 > aSeq( nVecSize );
sal_Int32* pSeqArr = aSeq.getArray();
for( nPos = 0; nPos < nVecSize; ++nPos )
{
pSeqArr[ nPos ] = aVec[ nPos ];
}
return aSeq;
}
// ---------------------------------------- // ----------------------------------------
...@@ -942,7 +1002,3 @@ void SchXMLLegendContext::StartElement( const uno::Reference< xml::sax::XAttribu ...@@ -942,7 +1002,3 @@ void SchXMLLegendContext::StartElement( const uno::Reference< xml::sax::XAttribu
SchXMLLegendContext::~SchXMLLegendContext() SchXMLLegendContext::~SchXMLLegendContext()
{ {
} }
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: SchXMLChartContext.hxx,v $ * $RCSfile: SchXMLChartContext.hxx,v $
* *
* $Revision: 1.10 $ * $Revision: 1.11 $
* *
* last change: $Author: bm $ $Date: 2001-09-28 14:56:18 $ * last change: $Author: bm $ $Date: 2001-10-23 10:02:41 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -112,6 +112,10 @@ private: ...@@ -112,6 +112,10 @@ private:
::rtl::OUString msTableNumberList; ::rtl::OUString msTableNumberList;
::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > mxDrawPage; ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > mxDrawPage;
::rtl::OUString msColTrans;
::rtl::OUString msRowTrans;
::com::sun::star::uno::Sequence< sal_Int32 > GetNumberSequenceFromString( const ::rtl::OUString& rStr );
public: public:
SchXMLChartContext( SchXMLImportHelper& rImpHelper, SchXMLChartContext( SchXMLImportHelper& rImpHelper,
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: SchXMLExport.cxx,v $ * $RCSfile: SchXMLExport.cxx,v $
* *
* $Revision: 1.58 $ * $Revision: 1.59 $
* *
* last change: $Author: bm $ $Date: 2001-09-28 14:56:18 $ * last change: $Author: bm $ $Date: 2001-10-23 10:00:39 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -445,6 +445,57 @@ void SchXMLExportHelper::parseDocument( uno::Reference< chart::XChartDocument >& ...@@ -445,6 +445,57 @@ void SchXMLExportHelper::parseDocument( uno::Reference< chart::XChartDocument >&
if( sAddInName.getLength()) if( sAddInName.getLength())
mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_ADD_IN_NAME, sAddInName ); mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_ADD_IN_NAME, sAddInName );
// translated rows/columns
if( xDocPropSet.is())
{
sal_Bool bTranslate = sal_False;
::rtl::OUString aTransPropName;
enum XMLTokenEnum eTransToken;
uno::Any aAny = xDocPropSet->getPropertyValue(
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "HasTranslatedColumns" )));
aAny >>= bTranslate;
if( bTranslate )
{
aTransPropName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TranslatedColumns" ));
eTransToken = ::xmloff::token::XML_COLUMN_MAPPING;
}
else
{
aAny = xDocPropSet->getPropertyValue(
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "HasTranslatedRows" )));
aAny >>= bTranslate;
if( bTranslate )
{
aTransPropName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TranslatedRows" ));
eTransToken = ::xmloff::token::XML_ROW_MAPPING;
}
}
if( bTranslate )
{
uno::Sequence< sal_Int32 > aSeq;
aAny = xDocPropSet->getPropertyValue( aTransPropName );
if( aAny >>= aSeq )
{
const sal_Int32* pArray = aSeq.getConstArray();
const sal_Int32 nSize = aSeq.getLength();
sal_Int32 i = 0;
::rtl::OUStringBuffer aBuf;
for( i = 0; i < nSize; ++i )
{
aBuf.append( pArray[ i ], 10 );
if( i != (nSize - 1))
aBuf.append( static_cast< sal_Unicode >( ' ' ));
}
mrExport.AddAttribute( XML_NAMESPACE_CHART,
::xmloff::token::GetXMLToken( eTransToken ),
aBuf.makeStringAndClear() );
}
}
}
} }
// write style name // write style name
AddAutoStyleAttribute( aPropertyStates ); AddAutoStyleAttribute( aPropertyStates );
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: SchXMLImport.cxx,v $ * $RCSfile: SchXMLImport.cxx,v $
* *
* $Revision: 1.23 $ * $Revision: 1.24 $
* *
* last change: $Author: bm $ $Date: 2001-09-14 11:21:05 $ * last change: $Author: bm $ $Date: 2001-10-23 09:58:54 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -175,6 +175,8 @@ static __FAR_DATA SvXMLTokenMapEntry aChartAttrTokenMap[] = ...@@ -175,6 +175,8 @@ static __FAR_DATA SvXMLTokenMapEntry aChartAttrTokenMap[] =
{ XML_NAMESPACE_SVG, XML_HEIGHT, XML_TOK_CHART_HEIGHT }, { XML_NAMESPACE_SVG, XML_HEIGHT, XML_TOK_CHART_HEIGHT },
{ XML_NAMESPACE_CHART, XML_STYLE_NAME, XML_TOK_CHART_STYLE_NAME }, { XML_NAMESPACE_CHART, XML_STYLE_NAME, XML_TOK_CHART_STYLE_NAME },
{ XML_NAMESPACE_CHART, XML_ADD_IN_NAME, XML_TOK_CHART_ADDIN_NAME }, { XML_NAMESPACE_CHART, XML_ADD_IN_NAME, XML_TOK_CHART_ADDIN_NAME },
{ XML_NAMESPACE_CHART, XML_COLUMN_MAPPING, XML_TOK_CHART_COL_MAPPING },
{ XML_NAMESPACE_CHART, XML_ROW_MAPPING, XML_TOK_CHART_ROW_MAPPING },
XML_TOKEN_MAP_END XML_TOKEN_MAP_END
}; };
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: xmltoken.cxx,v $ * $RCSfile: xmltoken.cxx,v $
* *
* $Revision: 1.22 $ * $Revision: 1.23 $
* *
* last change: $Author: dvo $ $Date: 2001-09-21 16:27:53 $ * last change: $Author: bm $ $Date: 2001-10-23 09:59:47 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -2074,6 +2074,9 @@ namespace xmloff { namespace token { ...@@ -2074,6 +2074,9 @@ namespace xmloff { namespace token {
TOKEN( "spline-resolution" ), // XML_SPLINE_RESOLUTION TOKEN( "spline-resolution" ), // XML_SPLINE_RESOLUTION
TOKEN( "paper-tray-name" ), // XML_PAPER_TRAY_NAME TOKEN( "paper-tray-name" ), // XML_PAPER_TRAY_NAME
TOKEN( "column-mapping" ), // XML_COLUMN_MAPPING
TOKEN( "row-mapping" ), // XML_ROW_MAPPING
{ 0, NULL, NULL } // XML_TOKEN_END { 0, NULL, NULL } // XML_TOKEN_END
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment