diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-10-08 22:01:21 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-10-10 08:51:14 +0100 |
commit | af6980b1c7ed24d9102e5a88c095aa8fb4008715 (patch) | |
tree | 213a9412629d2b600f67123c72922d6515c505e8 /xmloff | |
parent | b2aa7673de144df737374b9173b5539f36f6a533 (diff) |
make xmloff ByteString free
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/source/chart/SchXMLChartContext.cxx | 7 | ||||
-rw-r--r-- | xmloff/source/chart/SchXMLExport.cxx | 65 | ||||
-rw-r--r-- | xmloff/source/chart/SchXMLImport.cxx | 9 | ||||
-rw-r--r-- | xmloff/source/chart/SchXMLPlotAreaContext.cxx | 32 | ||||
-rw-r--r-- | xmloff/source/core/xmlerror.cxx | 6 | ||||
-rw-r--r-- | xmloff/source/core/xmlexp.cxx | 12 | ||||
-rw-r--r-- | xmloff/source/core/xmlimp.cxx | 4 |
7 files changed, 61 insertions, 74 deletions
diff --git a/xmloff/source/chart/SchXMLChartContext.cxx b/xmloff/source/chart/SchXMLChartContext.cxx index fd245ac20590..96d04db568a4 100644 --- a/xmloff/source/chart/SchXMLChartContext.cxx +++ b/xmloff/source/chart/SchXMLChartContext.cxx @@ -40,8 +40,6 @@ #include "SchXMLTools.hxx" #include <comphelper/mediadescriptor.hxx> #include <tools/debug.hxx> -// header for class ByteString -#include <tools/string.hxx> #include "xmloff/xmlnmspe.hxx" #include <xmloff/xmlement.hxx> #include <xmloff/xmltoken.hxx> @@ -175,9 +173,8 @@ void lcl_removeEmptyChartTypeGroups( const uno::Reference< chart2::XChartDocumen } catch(const uno::Exception& ex) { - String aStr( ex.Message ); - ByteString aBStr( aStr, RTL_TEXTENCODING_ASCII_US ); - OSL_TRACE( "Exception caught while removing empty chart types: %s", aBStr.GetBuffer()); + rtl::OString aBStr(rtl::OUStringToOString(ex.Message, RTL_TEXTENCODING_ASCII_US)); + OSL_TRACE( "Exception caught while removing empty chart types: %s", aBStr.getStr()); } } diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx index df497d08770c..f3c1534e31f3 100644 --- a/xmloff/source/chart/SchXMLExport.cxx +++ b/xmloff/source/chart/SchXMLExport.cxx @@ -299,8 +299,9 @@ Reference< uno::XComponentContext > lcl_getComponentContext() if( xFactProp.is()) xFactProp->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))) >>= xContext; } - catch( uno::Exception& ) - {} + catch( const uno::Exception& ) + { + } return xContext; } @@ -377,7 +378,7 @@ Reference< chart2::data::XLabeledDataSequence > lcl_getCategories( const Referen } } } - catch( uno::Exception & ex ) + catch( const uno::Exception & ex ) { (void)ex; // avoid warning for pro build OSL_FAIL( OUStringToOString( @@ -495,7 +496,7 @@ bool lcl_isSeriesAttachedToFirstAxis( xProp->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("AttachedAxisIndex") ) ) >>= nAxisIndex; bResult = (0==nAxisIndex); } - catch( uno::Exception & ex ) + catch( const uno::Exception & ex ) { (void)ex; // avoid warning for pro build OSL_FAIL( OUStringToOString( @@ -720,9 +721,8 @@ bool lcl_SequenceHasUnhiddenData( const uno::Reference< chart2::data::XDataSeque if( !aHiddenValues.getLength() ) return true; } - catch( uno::Exception& e ) + catch( const uno::Exception& ) { - (void)e; // avoid warning return true; } } @@ -942,7 +942,7 @@ lcl_TableData lcl_getDataForLocalTable( rTarget[i] = uno::makeAny( rSource[i] ); } } - catch( uno::Exception & rEx ) + catch( const uno::Exception & rEx ) { (void)rEx; // avoid warning for pro build OSL_TRACE( OUStringToOString( OUString( RTL_CONSTASCII_USTRINGPARAM( @@ -993,12 +993,11 @@ void lcl_exportNumberFormat( const OUString& rPropertyName, const Reference< bea } } } - catch( uno::Exception & rEx ) + catch( const uno::Exception & rEx ) { #ifdef DBG_UTIL - String aStr( rEx.Message ); - ByteString aBStr( aStr, RTL_TEXTENCODING_ASCII_US ); - OSL_TRACE( "chart:exporting error bar ranges: %s", aBStr.GetBuffer()); + rtl::OString aBStr(rtl::OUStringToOString(rEx.Message, RTL_TEXTENCODING_ASCII_US)); + OSL_TRACE( "chart:exporting error bar ranges: %s", aBStr.getStr()); #else (void)rEx; // avoid warning #endif @@ -1266,7 +1265,7 @@ void SchXMLExportHelper_Impl::parseDocument( Reference< chart::XChartDocument >& aAny >>= aNullDate; } } - catch( beans::UnknownPropertyException & ) + catch( const beans::UnknownPropertyException & ) { DBG_WARNING( "Required property not found in ChartDocument" ); } @@ -1478,7 +1477,7 @@ void SchXMLExportHelper_Impl::parseDocument( Reference< chart::XChartDocument >& if( SchXMLEnumConverter::getLegendPositionConverter().exportXML( msString, aAny, mrExport.GetMM100UnitConverter() ) ) mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_LEGEND_POSITION, msString ); } - catch( beans::UnknownPropertyException & ) + catch( const beans::UnknownPropertyException & ) { DBG_WARNING( "Property Align not found in ChartLegend" ); } @@ -1510,7 +1509,7 @@ void SchXMLExportHelper_Impl::parseDocument( Reference< chart::XChartDocument >& } } } - catch( beans::UnknownPropertyException & ) + catch( const beans::UnknownPropertyException & ) { DBG_WARNING( "Property Expansion not found in ChartLegend" ); } @@ -1572,7 +1571,7 @@ void SchXMLExportHelper_Impl::parseDocument( Reference< chart::XChartDocument >& Any aShapesAny = xDocPropSet->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM( "AdditionalShapes" ))); aShapesAny >>= mxAdditionalShapes; } - catch( uno::Exception & rEx ) + catch( const uno::Exception & rEx ) { (void)rEx; // avoid warning for pro build OSL_TRACE( @@ -1667,7 +1666,7 @@ void SchXMLExportHelper_Impl::exportTable() mrExport.AddAttribute( XML_NAMESPACE_TABLE, XML_PROTECTED, XML_TRUE ); } } - catch ( uno::Exception& ) + catch ( const uno::Exception& ) { } @@ -2003,7 +2002,7 @@ void SchXMLExportHelper_Impl::exportPlotArea( : ::xmloff::token::GetXMLToken( ::xmloff::token::XML_ROW ))); } } - catch( beans::UnknownPropertyException & ) + catch( const beans::UnknownPropertyException & ) { DBG_ERRORFILE( "Properties missing" ); } @@ -2030,12 +2029,11 @@ void SchXMLExportHelper_Impl::exportPlotArea( mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_TABLE_NUMBER_LIST, msTableNumberList ); } } - catch( uno::Exception & rEx ) + catch( const uno::Exception & rEx ) { #ifdef DBG_UTIL - String aStr( rEx.Message ); - ByteString aBStr( aStr, RTL_TEXTENCODING_ASCII_US ); - OSL_TRACE( "chart:TableNumberList property caught: %s", aBStr.GetBuffer()); + rtl::OString aBStr(rtl::OUStringToOString(rEx.Message, RTL_TEXTENCODING_ASCII_US)); + OSL_TRACE("chart:TableNumberList property caught: %s", aBStr.getStr()); #else (void)rEx; // avoid warning #endif @@ -2067,12 +2065,11 @@ void SchXMLExportHelper_Impl::exportPlotArea( rShapeExport->export3DSceneAttributes( xPropSet ); } } - catch( uno::Exception & rEx ) + catch( const uno::Exception & rEx ) { #ifdef DBG_UTIL - String aStr( rEx.Message ); - ByteString aBStr( aStr, RTL_TEXTENCODING_ASCII_US ); - OSL_TRACE( "chart:exportPlotAreaException caught: %s", aBStr.GetBuffer()); + rtl::OString aBStr(rtl::OUStringToOString(rEx.Message, RTL_TEXTENCODING_ASCII_US)); + OSL_TRACE( "chart:exportPlotAreaException caught: %s", aBStr.getStr()); #else (void)rEx; // avoid warning #endif @@ -2789,7 +2786,7 @@ void SchXMLExportHelper_Impl::exportSeries( xPropSet = SchXMLSeriesHelper::createOldAPISeriesPropertySet( aSeriesSeq[nSeriesIdx], mrExport.GetModel() ); } - catch( uno::Exception & rEx ) + catch( const uno::Exception & rEx ) { (void)rEx; // avoid warning for pro build OSL_TRACE( @@ -2825,7 +2822,7 @@ void SchXMLExportHelper_Impl::exportSeries( OUString( RTL_CONSTASCII_USTRINGPARAM( "ErrorBarStyle" ))); aAny >>= nErrorBarStyle; } - catch( beans::UnknownPropertyException & rEx ) + catch( const beans::UnknownPropertyException & rEx ) { (void)rEx; // avoid warning for pro build OSL_TRACE( @@ -2961,7 +2958,7 @@ void SchXMLExportHelper_Impl::exportSeries( OUString( RTL_CONSTASCII_USTRINGPARAM( "DataMeanValueProperties" )))); aPropAny >>= xStatProp; } - catch( uno::Exception & rEx ) + catch( const uno::Exception & rEx ) { (void)rEx; // avoid warning for pro build OSL_TRACE( "Exception caught during Export of series - optional DataMeanValueProperties not available: %s", @@ -3009,7 +3006,7 @@ void SchXMLExportHelper_Impl::exportSeries( OUString( RTL_CONSTASCII_USTRINGPARAM( "DataErrorProperties" )))); aPropAny >>= xStatProp; } - catch( uno::Exception & rEx ) + catch( const uno::Exception & rEx ) { (void)rEx; // avoid warning for pro build OSL_TRACE( "Exception caught during Export of series - optional DataErrorProperties not available: %s", @@ -3085,7 +3082,7 @@ void SchXMLExportHelper_Impl::exportRegressionCurve( OUString( RTL_CONSTASCII_USTRINGPARAM( "DataRegressionProperties" )))); aPropAny >>= xStatProp; } - catch( uno::Exception & rEx ) + catch( const uno::Exception & rEx ) { (void)rEx; // avoid warning for pro build OSL_TRACE( "Exception caught during Export of series - optional DataRegressionProperties not available: %s", @@ -3356,7 +3353,7 @@ void SchXMLExportHelper_Impl::exportDataPoints( xSeries, nElement, mrExport.GetModel() ); bExportNumFmt = true; } - catch( uno::Exception & rEx ) + catch( const uno::Exception & rEx ) { (void)rEx; // avoid warning for pro build OSL_TRACE( "Exception caught during Export of data point: %s", @@ -3432,7 +3429,7 @@ void SchXMLExportHelper_Impl::exportDataPoints( xPropSet = SchXMLSeriesHelper::createOldAPIDataPointPropertySet( xSeries, nCurrIndex, mrExport.GetModel() ); } - catch( uno::Exception & rEx ) + catch( const uno::Exception & rEx ) { (void)rEx; // avoid warning for pro build OSL_TRACE( "Exception caught during Export of data point: %s", @@ -3735,7 +3732,7 @@ void SchXMLExport::_ExportContent() // do not include own table if there are external addresses bIncludeTable = (sChartAddress.getLength() == 0); } - catch( beans::UnknownPropertyException & ) + catch( const beans::UnknownPropertyException & ) { OSL_FAIL( "Property ChartRangeAddress not supported by ChartDocument" ); } @@ -3812,7 +3809,7 @@ void SchXMLExportHelper_Impl::InitRangeSegmentationProperties( const Reference< } } } - catch( uno::Exception & ex ) + catch( const uno::Exception & ex ) { (void)ex; // avoid warning for pro build OSL_FAIL( OUStringToOString( diff --git a/xmloff/source/chart/SchXMLImport.cxx b/xmloff/source/chart/SchXMLImport.cxx index 387f3a453eda..6643b8a7ace6 100644 --- a/xmloff/source/chart/SchXMLImport.cxx +++ b/xmloff/source/chart/SchXMLImport.cxx @@ -37,8 +37,6 @@ #include <tools/debug.hxx> #include <rtl/ustrbuf.hxx> -// header for class ByteString -#include <tools/string.hxx> #include <comphelper/processfactory.hxx> #include "xmloff/xmlnmspe.hxx" #include <xmloff/xmltoken.hxx> @@ -775,12 +773,11 @@ void SAL_CALL SchXMLImport::setTargetDocument( const uno::Reference< lang::XComp xChartDoc->createInternalDataProvider( sal_False ); } } - catch( uno::Exception & rEx ) + catch( const uno::Exception & rEx ) { #ifdef DBG_UTIL - String aStr( rEx.Message ); - ByteString aBStr( aStr, RTL_TEXTENCODING_ASCII_US ); - OSL_TRACE( "SchXMLChartContext::StartElement(): Exception caught: %s", aBStr.GetBuffer()); + rtl::OString aBStr(rtl::OUStringToOString(rEx.Message, RTL_TEXTENCODING_ASCII_US)); + OSL_TRACE("SchXMLChartContext::StartElement(): Exception caught: %s", aBStr.getStr()); #else (void)rEx; // avoid warning for pro build #endif diff --git a/xmloff/source/chart/SchXMLPlotAreaContext.cxx b/xmloff/source/chart/SchXMLPlotAreaContext.cxx index 41288969af64..249b1d53ce21 100644 --- a/xmloff/source/chart/SchXMLPlotAreaContext.cxx +++ b/xmloff/source/chart/SchXMLPlotAreaContext.cxx @@ -127,12 +127,11 @@ void SchXML3DSceneAttributesHelper::getCameraDefaultFromDiagram( const uno::Refe maVUP.setZ( aCamGeo.vup.DirectionZ ); } } - catch( uno::Exception & rEx ) + catch( const uno::Exception & rEx ) { #ifdef DBG_UTIL - String aStr( rEx.Message ); - ByteString aBStr( aStr, RTL_TEXTENCODING_ASCII_US ); - OSL_TRACE( "Exception caught for property NumberOfLines: %s", aBStr.GetBuffer()); + rtl::OString aBStr(rtl::OUStringToOString(rEx.Message, RTL_TEXTENCODING_ASCII_US)); + OSL_TRACE( "Exception caught for property NumberOfLines: %s", aBStr.getStr()); #else (void)rEx; // avoid warning for pro build #endif @@ -240,7 +239,7 @@ SchXMLPlotAreaContext::SchXMLPlotAreaContext( aAny <<= eSource; xProp->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "DataRowSource" )), aAny ); } - catch( beans::UnknownPropertyException & ) + catch( const beans::UnknownPropertyException & ) { OSL_FAIL( "Property required by service not supported" ); } @@ -324,7 +323,7 @@ void SchXMLPlotAreaContext::StartElement( const uno::Reference< xml::sax::XAttri ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "DataSourceLabelsInFirstRow" )), aAny ); } - catch( beans::UnknownPropertyException & ) + catch( const beans::UnknownPropertyException & ) { DBG_ERRORFILE( "Properties missing" ); } @@ -432,12 +431,11 @@ void SchXMLPlotAreaContext::StartElement( const uno::Reference< xml::sax::XAttri xProp->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NumberOfLines"))) >>= mnNumOfLinesProp; xProp->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Volume"))) >>= mbStockHasVolume; } - catch( uno::Exception & rEx ) + catch( const uno::Exception & rEx ) { #ifdef DBG_UTIL - String aStr( rEx.Message ); - ByteString aBStr( aStr, RTL_TEXTENCODING_ASCII_US ); - OSL_TRACE( "PlotAreaContext:EndElement(): Exception caught: %s", aBStr.GetBuffer()); + rtl::OString aBStr(rtl::OUStringToOString(rEx.Message, RTL_TEXTENCODING_ASCII_US)); + OSL_TRACE("PlotAreaContext:EndElement(): Exception caught: %s", aBStr.getStr()); #else (void)rEx; // avoid warning for pro build #endif @@ -609,12 +607,11 @@ void SchXMLPlotAreaContext::EndElement() xDiaProp->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "NumberOfLines" )), uno::makeAny( mnNumOfLinesProp )); } - catch( uno::Exception & rEx ) + catch( const uno::Exception & rEx ) { #ifdef DBG_UTIL - String aStr( rEx.Message ); - ByteString aBStr( aStr, RTL_TEXTENCODING_ASCII_US ); - OSL_TRACE( "Exception caught for property NumberOfLines: %s", aBStr.GetBuffer()); + rtl::OString aBStr(rtl::OUStringToOString(rEx.Message, RTL_TEXTENCODING_ASCII_US)); + OSL_TRACE( "Exception caught for property NumberOfLines: %s", aBStr.getStr()); #else (void)rEx; // avoid warning for pro build #endif @@ -631,12 +628,11 @@ void SchXMLPlotAreaContext::EndElement() xDiaProp->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Volume" )), uno::makeAny( true )); } - catch( uno::Exception & rEx ) + catch( const uno::Exception & rEx ) { #ifdef DBG_UTIL - String aStr( rEx.Message ); - ByteString aBStr( aStr, RTL_TEXTENCODING_ASCII_US ); - OSL_TRACE( "Exception caught for property Volume: %s", aBStr.GetBuffer()); + rtl::OString aBStr(rtl::OUStringToOString(rEx.Message, RTL_TEXTENCODING_ASCII_US)); + OSL_TRACE("Exception caught for property Volume: %s", aBStr.getStr()); #else (void)rEx; // avoid warning for pro build #endif diff --git a/xmloff/source/core/xmlerror.cxx b/xmloff/source/core/xmlerror.cxx index 640720166428..2ddcb8ed8d93 100644 --- a/xmloff/source/core/xmlerror.cxx +++ b/xmloff/source/core/xmlerror.cxx @@ -193,9 +193,9 @@ void XMLErrors::AddRecord( } // convert to byte string and signal the error - ByteString aError( String( sMessage.makeStringAndClear() ), - RTL_TEXTENCODING_ASCII_US ); - OSL_FAIL( aError.GetBuffer() ); + rtl::OString aError(rtl::OUStringToOString(sMessage.makeStringAndClear(), + RTL_TEXTENCODING_ASCII_US)); + OSL_FAIL( aError.getStr() ); #endif } diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx index 54b02a41f365..f244a5c65991 100644 --- a/xmloff/source/core/xmlexp.cxx +++ b/xmloff/source/core/xmlexp.cxx @@ -898,15 +898,15 @@ sal_Bool SAL_CALL SvXMLExport::filter( const uno::Sequence< beans::PropertyValue if (GetModel().is()) { // print a trace message with the URL - ByteString aUrl( (String) GetModel()->getURL(), - RTL_TEXTENCODING_ASCII_US ); - RTL_LOGFILE_CONTEXT_TRACE1( aLogContext, "%s", aUrl.GetBuffer() ); + rtl::OString aUrl(rtl::OUStringToOString(GetModel()->getURL(), + RTL_TEXTENCODING_ASCII_US)); + RTL_LOGFILE_CONTEXT_TRACE1( aLogContext, "%s", aUrl.getStr() ); // we also want a trace message with the document class - ByteString aClass( (String)GetXMLToken(meClass), - RTL_TEXTENCODING_ASCII_US ); + rtl::OString aClass(rtl::OUStringToOString(GetXMLToken(meClass), + RTL_TEXTENCODING_ASCII_US)); RTL_LOGFILE_CONTEXT_TRACE1( aLogContext, "class=\"%s\"", - aClass.GetBuffer() ); + aClass.getStr() ); } #endif diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx index 9574bd7334a8..cb431db22eee 100644 --- a/xmloff/source/core/xmlimp.cxx +++ b/xmloff/source/core/xmlimp.cxx @@ -725,10 +725,10 @@ void SAL_CALL SvXMLImport::startElement( const OUString& rName, #ifdef TIMELOG // If we do profiling, we want a trace message for the first element // in order to identify the stream. - ByteString aString( (String)rName, RTL_TEXTENCODING_ASCII_US ); + rtl::OString aString(rtl::OUStringToOString(rName, RTL_TEXTENCODING_ASCII_US)); RTL_LOGFILE_TRACE_AUTHOR1( "xmloff", LOGFILE_AUTHOR, "SvXMLImport::StartElement( \"%s\", ... )", - aString.GetBuffer() ); + aString.getStr() ); #endif pContext = CreateContext( nPrefix, aLocalName, xAttrList ); |