diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-08-03 23:36:47 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-08-04 01:40:24 +0200 |
commit | 714d907d304fae5cc8613eced127060199639af6 (patch) | |
tree | 31e495ddd9e12b32220dacbceabfca56ea7cf99e /toolkit/source/controls/unocontrolmodel.cxx | |
parent | 8c4a24092bd9ccd1d577d10ae0559cef406e8fae (diff) |
loplugin:flatten in toolkit
Change-Id: I8f4b29620134566f256f05bbab677e83baf20ec7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100031
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'toolkit/source/controls/unocontrolmodel.cxx')
-rw-r--r-- | toolkit/source/controls/unocontrolmodel.cxx | 172 |
1 files changed, 86 insertions, 86 deletions
diff --git a/toolkit/source/controls/unocontrolmodel.cxx b/toolkit/source/controls/unocontrolmodel.cxx index a735178bdca1..695b6fcb00e5 100644 --- a/toolkit/source/controls/unocontrolmodel.cxx +++ b/toolkit/source/controls/unocontrolmodel.cxx @@ -709,60 +709,60 @@ void UnoControlModel::write( const css::uno::Reference< css::io::XObjectOutputSt xMark->deleteMark(nPropDataBeginMark); } - if ( aProps.find( BASEPROPERTY_FONTDESCRIPTOR ) != aProps.end() ) - { - const css::uno::Any* pProp = &maData[ BASEPROPERTY_FONTDESCRIPTOR ]; - // Until 5.0 export arrives, write old format... - css::awt::FontDescriptor aFD; - (*pProp) >>= aFD; + if ( aProps.find( BASEPROPERTY_FONTDESCRIPTOR ) == aProps.end() ) + return; - for ( sal_uInt16 n = BASEPROPERTY_FONT_TYPE; n <= BASEPROPERTY_FONT_ATTRIBS; n++ ) - { - sal_Int32 nPropDataBeginMark = xMark->createMark(); - OutStream->writeLong( 0 ); // DataLen - OutStream->writeShort( n ); // PropId - OutStream->writeBoolean( false ); // Void + const css::uno::Any* pProp = &maData[ BASEPROPERTY_FONTDESCRIPTOR ]; + // Until 5.0 export arrives, write old format... + css::awt::FontDescriptor aFD; + (*pProp) >>= aFD; - if ( n == BASEPROPERTY_FONT_TYPE ) - { - OutStream->writeUTF( aFD.Name ); - OutStream->writeUTF( aFD.StyleName ); - OutStream->writeShort( aFD.Family ); - OutStream->writeShort( aFD.CharSet ); - OutStream->writeShort( aFD.Pitch ); - } - else if ( n == BASEPROPERTY_FONT_SIZE ) - { - OutStream->writeLong( aFD.Width ); - OutStream->writeLong( aFD.Height ); - OutStream->writeShort( - sal::static_int_cast< sal_Int16 >( - vcl::unohelper::ConvertFontWidth(aFD.CharacterWidth)) ); - } - else if ( n == BASEPROPERTY_FONT_ATTRIBS ) - { - OutStream->writeShort( - sal::static_int_cast< sal_Int16 >( - vcl::unohelper::ConvertFontWeight(aFD.Weight)) ); - OutStream->writeShort( - sal::static_int_cast< sal_Int16 >(aFD.Slant) ); - OutStream->writeShort( aFD.Underline ); - OutStream->writeShort( aFD.Strikeout ); - OutStream->writeShort( static_cast<short>(aFD.Orientation * 10) ); - OutStream->writeBoolean( aFD.Kerning ); - OutStream->writeBoolean( aFD.WordLineMode ); - } - else - { - OSL_FAIL( "Property?!" ); - } + for ( sal_uInt16 n = BASEPROPERTY_FONT_TYPE; n <= BASEPROPERTY_FONT_ATTRIBS; n++ ) + { + sal_Int32 nPropDataBeginMark = xMark->createMark(); + OutStream->writeLong( 0 ); // DataLen + OutStream->writeShort( n ); // PropId + OutStream->writeBoolean( false ); // Void - sal_Int32 nPropDataLen = xMark->offsetToMark( nPropDataBeginMark ); - xMark->jumpToMark( nPropDataBeginMark ); - OutStream->writeLong( nPropDataLen ); - xMark->jumpToFurthest(); - xMark->deleteMark(nPropDataBeginMark); + if ( n == BASEPROPERTY_FONT_TYPE ) + { + OutStream->writeUTF( aFD.Name ); + OutStream->writeUTF( aFD.StyleName ); + OutStream->writeShort( aFD.Family ); + OutStream->writeShort( aFD.CharSet ); + OutStream->writeShort( aFD.Pitch ); + } + else if ( n == BASEPROPERTY_FONT_SIZE ) + { + OutStream->writeLong( aFD.Width ); + OutStream->writeLong( aFD.Height ); + OutStream->writeShort( + sal::static_int_cast< sal_Int16 >( + vcl::unohelper::ConvertFontWidth(aFD.CharacterWidth)) ); + } + else if ( n == BASEPROPERTY_FONT_ATTRIBS ) + { + OutStream->writeShort( + sal::static_int_cast< sal_Int16 >( + vcl::unohelper::ConvertFontWeight(aFD.Weight)) ); + OutStream->writeShort( + sal::static_int_cast< sal_Int16 >(aFD.Slant) ); + OutStream->writeShort( aFD.Underline ); + OutStream->writeShort( aFD.Strikeout ); + OutStream->writeShort( static_cast<short>(aFD.Orientation * 10) ); + OutStream->writeBoolean( aFD.Kerning ); + OutStream->writeBoolean( aFD.WordLineMode ); + } + else + { + OSL_FAIL( "Property?!" ); } + + sal_Int32 nPropDataLen = xMark->offsetToMark( nPropDataBeginMark ); + xMark->jumpToMark( nPropDataBeginMark ); + OutStream->writeLong( nPropDataLen ); + xMark->jumpToFurthest(); + xMark->deleteMark(nPropDataBeginMark); } } @@ -1308,49 +1308,49 @@ void UnoControlModel::setPropertyValues( const css::uno::Sequence< OUString >& r sal_Int32 nValidHandles = getInfoHelper().fillHandles( pHandles, rPropertyNames ); - if ( nValidHandles ) + if ( !nValidHandles ) + return; + + // if somebody sets properties which are single aspects of a font descriptor, + // remove them, and build a font descriptor instead + std::unique_ptr< awt::FontDescriptor > pFD; + for ( sal_Int32 n = 0; n < nProps; ++n ) { - // if somebody sets properties which are single aspects of a font descriptor, - // remove them, and build a font descriptor instead - std::unique_ptr< awt::FontDescriptor > pFD; - for ( sal_Int32 n = 0; n < nProps; ++n ) + if ( ( pHandles[n] >= BASEPROPERTY_FONTDESCRIPTORPART_START ) && ( pHandles[n] <= BASEPROPERTY_FONTDESCRIPTORPART_END ) ) { - if ( ( pHandles[n] >= BASEPROPERTY_FONTDESCRIPTORPART_START ) && ( pHandles[n] <= BASEPROPERTY_FONTDESCRIPTORPART_END ) ) + if (!pFD) { - if (!pFD) - { - css::uno::Any* pProp = &maData[ BASEPROPERTY_FONTDESCRIPTOR ]; - pFD.reset( new awt::FontDescriptor ); - (*pProp) >>= *pFD; - } - lcl_ImplMergeFontProperty( *pFD, static_cast<sal_uInt16>(pHandles[n]), pValues[n] ); - pHandles[n] = -1; - nValidHandles--; + css::uno::Any* pProp = &maData[ BASEPROPERTY_FONTDESCRIPTOR ]; + pFD.reset( new awt::FontDescriptor ); + (*pProp) >>= *pFD; } + lcl_ImplMergeFontProperty( *pFD, static_cast<sal_uInt16>(pHandles[n]), pValues[n] ); + pHandles[n] = -1; + nValidHandles--; } + } - if ( nValidHandles ) - { - ImplNormalizePropertySequence( nProps, pHandles, pValues, &nValidHandles ); - aGuard.clear(); - // clear our guard before calling into setFastPropertyValues - this method - // will implicitly call property listeners, and this should not happen with - // our mutex locked - // #i23451# - setFastPropertyValues( nProps, pHandles, pValues, nValidHandles ); - } - else - aGuard.clear(); - // same as a few lines above + if ( nValidHandles ) + { + ImplNormalizePropertySequence( nProps, pHandles, pValues, &nValidHandles ); + aGuard.clear(); + // clear our guard before calling into setFastPropertyValues - this method + // will implicitly call property listeners, and this should not happen with + // our mutex locked + // #i23451# + setFastPropertyValues( nProps, pHandles, pValues, nValidHandles ); + } + else + aGuard.clear(); + // same as a few lines above - // Don't merge FD property into array, as it is sorted - if (pFD) - { - css::uno::Any aValue; - aValue <<= *pFD; - sal_Int32 nHandle = BASEPROPERTY_FONTDESCRIPTOR; - setFastPropertyValues( 1, &nHandle, &aValue, 1 ); - } + // Don't merge FD property into array, as it is sorted + if (pFD) + { + css::uno::Any aValue; + aValue <<= *pFD; + sal_Int32 nHandle = BASEPROPERTY_FONTDESCRIPTOR; + setFastPropertyValues( 1, &nHandle, &aValue, 1 ); } } |