diff options
author | Luboš Luňák <l.lunak@suse.cz> | 2013-08-21 15:07:31 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@suse.cz> | 2013-08-21 15:10:35 +0200 |
commit | 64b993e046f23baaacaff1572b7d2a816588b5ef (patch) | |
tree | 237dce36a1d4787d168a0520839f6aab22500487 /xmlscript | |
parent | 75f41baab6ce75786a91fe461835ee16a23ec18e (diff) |
finish deprecation of O(U)String::valueOf()
Compiler plugin to replace with matching number(), boolean() or OUString ctor,
ran it, few manual tweaks, mark as really deprecated.
Change-Id: I4a79bdbcf4c460d21e73b635d2bd3725c22876b2
Diffstat (limited to 'xmlscript')
-rw-r--r-- | xmlscript/source/xmldlg_imexp/exp_share.hxx | 31 | ||||
-rw-r--r-- | xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx | 2 | ||||
-rw-r--r-- | xmlscript/source/xmldlg_imexp/xmldlg_export.cxx | 24 |
3 files changed, 40 insertions, 17 deletions
diff --git a/xmlscript/source/xmldlg_imexp/exp_share.hxx b/xmlscript/source/xmldlg_imexp/exp_share.hxx index eb94eff82b72..bd3aacc13f1f 100644 --- a/xmlscript/source/xmldlg_imexp/exp_share.hxx +++ b/xmlscript/source/xmldlg_imexp/exp_share.hxx @@ -124,8 +124,7 @@ public: OUString const & rPropName, OUString const & rAttrName ) { read<sal_Int32>( rPropName, rAttrName ); } inline void readBoolAttr( - OUString const & rPropName, OUString const & rAttrName ) - { read<sal_Bool>( rPropName, rAttrName ); } + OUString const & rPropName, OUString const & rAttrName ); void readAlignAttr( OUString const & rPropName, OUString const & rAttrName ); @@ -157,7 +156,7 @@ public: OUString const & rAttrName ); inline void addBoolAttr( OUString const & rAttrName, sal_Bool bValue ) - { addAttribute( rAttrName, OUString::valueOf(bValue) ); } + { addAttribute( rAttrName, OUString::boolean(bValue) ); } void addNumberFormatAttr( css::uno::Reference< css::beans::XPropertySet > const & xFormatProperties ); @@ -231,12 +230,36 @@ inline void ElementDescriptor::read( css::uno::Any a( _xProps->getPropertyValue( propName ) ); T v = T(); if (a >>= v) - addAttribute( attrName, OUString::valueOf(v) ); + addAttribute( attrName, OUString::number(v) ); else OSL_FAIL( "### unexpected property type!" ); } } +template<> +inline void ElementDescriptor::read<sal_Bool>( + OUString const & propName, OUString const & attrName, + bool forceAttribute ) +{ + if (forceAttribute || + css::beans::PropertyState_DEFAULT_VALUE != + _xPropState->getPropertyState( propName )) + { + css::uno::Any a( _xProps->getPropertyValue( propName ) ); + sal_Bool v = sal_Bool(); + if (a >>= v) + addAttribute( attrName, OUString::boolean(v) ); + else + OSL_FAIL( "### unexpected property type!" ); + } +} + +inline void ElementDescriptor::readBoolAttr( + OUString const & rPropName, OUString const & rAttrName ) +{ + read<sal_Bool>( rPropName, rAttrName ); +} + template<typename T> inline bool ElementDescriptor::readProp( T * ret, OUString const & rPropName ) diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx index fecf2a1b0d69..00d575ef8075 100644 --- a/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx +++ b/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx @@ -893,7 +893,7 @@ void ElementDescriptor::readFormattedFieldModel( StyleBag * all_styles ) switch (a.getValueTypeClass()) { case TypeClass_DOUBLE: - addAttribute( XMLNS_DIALOGS_PREFIX ":value-default", OUString::valueOf( *(double const *)a.getValue() ) ); + addAttribute( XMLNS_DIALOGS_PREFIX ":value-default", OUString::number( *(double const *)a.getValue() ) ); break; case TypeClass_STRING: addAttribute( XMLNS_DIALOGS_PREFIX ":value-default", *(OUString const *)a.getValue() ); diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx index 0f7c5b02b01e..5eef0f3465e3 100644 --- a/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx +++ b/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx @@ -158,12 +158,12 @@ Reference< xml::sax::XAttributeList > Style::createElement() // dialog:font-height %numeric; #IMPLIED if (def_descr.Height != _descr.Height) { - pStyle->addAttribute( XMLNS_DIALOGS_PREFIX ":font-height", OUString::valueOf( (sal_Int32)_descr.Height ) ); + pStyle->addAttribute( XMLNS_DIALOGS_PREFIX ":font-height", OUString::number( _descr.Height ) ); } // dialog:font-width %numeric; #IMPLIED if (def_descr.Width != _descr.Width) { - pStyle->addAttribute( XMLNS_DIALOGS_PREFIX ":font-width", OUString::valueOf( (sal_Int32)_descr.Width ) ); + pStyle->addAttribute( XMLNS_DIALOGS_PREFIX ":font-width", OUString::number( _descr.Width ) ); } // dialog:font-stylename CDATA #IMPLIED if (def_descr.StyleName != _descr.StyleName) @@ -257,12 +257,12 @@ Reference< xml::sax::XAttributeList > Style::createElement() // dialog:font-charwidth CDATA #IMPLIED if (def_descr.CharacterWidth != _descr.CharacterWidth) { - pStyle->addAttribute( XMLNS_DIALOGS_PREFIX ":font-charwidth", OUString::valueOf( (float)_descr.CharacterWidth ) ); + pStyle->addAttribute( XMLNS_DIALOGS_PREFIX ":font-charwidth", OUString::number( (float)_descr.CharacterWidth ) ); } // dialog:font-weight CDATA #IMPLIED if (def_descr.Weight != _descr.Weight) { - pStyle->addAttribute( XMLNS_DIALOGS_PREFIX ":font-weight", OUString::valueOf( (float)_descr.Weight ) ); + pStyle->addAttribute( XMLNS_DIALOGS_PREFIX ":font-weight", OUString::number( (float)_descr.Weight ) ); } // dialog:font-slant "(oblique|italic|reverse_oblique|reverse_italic)" #IMPLIED if (def_descr.Slant != _descr.Slant) @@ -375,7 +375,7 @@ Reference< xml::sax::XAttributeList > Style::createElement() // dialog:font-orientation CDATA #IMPLIED if (def_descr.Orientation != _descr.Orientation) { - pStyle->addAttribute( XMLNS_DIALOGS_PREFIX ":font-orientation", OUString::valueOf( (float)_descr.Orientation ) ); + pStyle->addAttribute( XMLNS_DIALOGS_PREFIX ":font-orientation", OUString::number( (float)_descr.Orientation ) ); } // dialog:font-kerning %boolean; #IMPLIED if ((def_descr.Kerning != sal_False) != (_descr.Kerning != sal_False)) @@ -587,7 +587,7 @@ void ElementDescriptor::readDateAttr( OUString const & rPropName, OUString const if (a >>= aUDate) { ::Date aTDate(aUDate); - addAttribute( rAttrName, OUString::valueOf( static_cast<sal_Int32>(aTDate.GetDate()) ) ); + addAttribute( rAttrName, OUString::number( aTDate.GetDate() ) ); } else OSL_FAIL( "### internal error" ); @@ -608,7 +608,7 @@ void ElementDescriptor::readTimeAttr( OUString const & rPropName, OUString const if (a >>= aUTime) { ::Time aTTime(aUTime); - addAttribute( rAttrName, OUString::valueOf( aTTime.GetTime() / ::Time::nanoPerCenti ) ); + addAttribute( rAttrName, OUString::number( aTTime.GetTime() / ::Time::nanoPerCenti ) ); } else OSL_FAIL( "### internal error" ); @@ -1071,22 +1071,22 @@ void ElementDescriptor::readDefaults( bool supportPrintable, bool supportVisible a = _xProps->getPropertyValue( "PositionX" ); if (a.getValueTypeClass() == TypeClass_LONG) { - addAttribute( XMLNS_DIALOGS_PREFIX ":left", OUString::valueOf( *(sal_Int32 const *)a.getValue() ) ); + addAttribute( XMLNS_DIALOGS_PREFIX ":left", OUString::number( *(sal_Int32 const *)a.getValue() ) ); } a = _xProps->getPropertyValue( "PositionY" ); if (a.getValueTypeClass() == TypeClass_LONG) { - addAttribute( XMLNS_DIALOGS_PREFIX ":top", OUString::valueOf( *(sal_Int32 const *)a.getValue() ) ); + addAttribute( XMLNS_DIALOGS_PREFIX ":top", OUString::number( *(sal_Int32 const *)a.getValue() ) ); } a = _xProps->getPropertyValue( "Width" ); if (a.getValueTypeClass() == TypeClass_LONG) { - addAttribute( XMLNS_DIALOGS_PREFIX ":width", OUString::valueOf( *(sal_Int32 const *)a.getValue() ) ); + addAttribute( XMLNS_DIALOGS_PREFIX ":width", OUString::number( *(sal_Int32 const *)a.getValue() ) ); } a = _xProps->getPropertyValue( "Height" ); if (a.getValueTypeClass() == TypeClass_LONG) { - addAttribute( XMLNS_DIALOGS_PREFIX ":height", OUString::valueOf( *(sal_Int32 const *)a.getValue() ) ); + addAttribute( XMLNS_DIALOGS_PREFIX ":height", OUString::number( *(sal_Int32 const *)a.getValue() ) ); } if (supportPrintable) @@ -1303,7 +1303,7 @@ OUString StyleBag::getStyleId( Style const & rStyle ) // no appr style found, append new Style * pStyle = new Style( rStyle ); - pStyle->_id = OUString::valueOf( (sal_Int32)_styles.size() ); + pStyle->_id = OUString::number( _styles.size() ); _styles.push_back( pStyle ); return pStyle->_id; } |