diff options
author | Noel Grandin <noel@peralex.com> | 2013-05-02 10:36:43 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2013-05-22 10:44:29 +0000 |
commit | 6a043e9c0acff20e1618ca8ec15c21d5d0fd0d37 (patch) | |
tree | 2746468845d6f1159e3759ee2cf7a620fca15b6e /forms/source/component | |
parent | 697a007c61b9cabceb9767fad87cd5822b300452 (diff) |
Use the new type-checking Reference constructor to reduce code noise
Also create a Clang compiler plugin to detect such cases.
Change-Id: I61ad1a1d6b1c017eeb51f226d2dde0e9bb7f1752
Reviewed-on: https://gerrit.libreoffice.org/4001
Tested-by: LibreOffice gerrit bot <gerrit@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'forms/source/component')
-rw-r--r-- | forms/source/component/FormattedField.cxx | 10 | ||||
-rw-r--r-- | forms/source/component/navigationbar.cxx | 14 | ||||
-rw-r--r-- | forms/source/component/scrollbar.cxx | 4 | ||||
-rw-r--r-- | forms/source/component/spinbutton.cxx | 4 |
4 files changed, 14 insertions, 18 deletions
diff --git a/forms/source/component/FormattedField.cxx b/forms/source/component/FormattedField.cxx index ca3142566205..fc3fd0f5356f 100644 --- a/forms/source/component/FormattedField.cxx +++ b/forms/source/component/FormattedField.cxx @@ -867,8 +867,7 @@ void OFormattedModel::write(const Reference<XObjectOutputStream>& _rxOutStream) // and to be a little bit more compatible we make the following section skippable { - Reference< XDataOutputStream > xOut(_rxOutStream, UNO_QUERY); - OStreamSection aDownCompat(xOut); + OStreamSection aDownCompat(_rxOutStream); // a sub version within the skippable block _rxOutStream->writeShort(0x0000); @@ -881,7 +880,7 @@ void OFormattedModel::write(const Reference<XObjectOutputStream>& _rxOutStream) } { - OStreamSection aDownCompat2(xOut); + OStreamSection aDownCompat2(_rxOutStream); switch (aEffectiveValue.getValueType().getTypeClass()) { case TypeClass_STRING: @@ -943,8 +942,7 @@ void OFormattedModel::read(const Reference<XObjectInputStream>& _rxInStream) thr if (nVersion == 0x0003) { // since version 3 there is a "skippable" block at this position - Reference< XDataInputStream > xIn(_rxInStream, UNO_QUERY); - OStreamSection aDownCompat(xIn); + OStreamSection aDownCompat(_rxInStream); sal_Int16 nSubVersion = _rxInStream->readShort(); (void)nSubVersion; @@ -952,7 +950,7 @@ void OFormattedModel::read(const Reference<XObjectInputStream>& _rxInStream) thr // version 0 and higher : the "effective value" property Any aEffectiveValue; { - OStreamSection aDownCompat2(xIn); + OStreamSection aDownCompat2(_rxInStream); switch (_rxInStream->readShort()) { case 0: // String diff --git a/forms/source/component/navigationbar.cxx b/forms/source/component/navigationbar.cxx index 2138caf56b41..9d1ac5fc40dc 100644 --- a/forms/source/component/navigationbar.cxx +++ b/forms/source/component/navigationbar.cxx @@ -225,14 +225,13 @@ namespace frm { // open a section for compatibility - if we later on write additional members, // then older versions can skip them - Reference< XDataOutputStream > xDataOut( _rxOutStream, UNO_QUERY ); - OStreamSection aEnsureBlockCompat( xDataOut ); + OStreamSection aEnsureBlockCompat( _rxOutStream ); // base class OControlModel::write( _rxOutStream ); { - OStreamSection aEnsureCompat( xDataOut ); + OStreamSection aEnsureCompat( _rxOutStream ); // determine which properties are not void and need to be written sal_Int32 nNonVoids = 0; if ( m_aTabStop.hasValue() ) @@ -270,7 +269,7 @@ namespace frm } { - OStreamSection aEnsureCompat( xDataOut ); + OStreamSection aEnsureCompat( _rxOutStream ); ::comphelper::operator<<( _rxOutStream, getFont() ); } @@ -297,14 +296,13 @@ namespace frm //------------------------------------------------------------------ void SAL_CALL ONavigationBarModel::read( const Reference< XObjectInputStream >& _rxInStream ) throw ( IOException, RuntimeException ) { - Reference< XDataInputStream > xDataIn( _rxInStream, UNO_QUERY ); - OStreamSection aEnsureBlockCompat( xDataIn ); + OStreamSection aEnsureBlockCompat( _rxInStream ); // base class OControlModel::read( _rxInStream ); { - OStreamSection aEnsureCompat( xDataIn ); + OStreamSection aEnsureCompat( _rxInStream ); // determine which properties were non-void sal_Int32 nNonVoids = _rxInStream->readLong( ); @@ -331,7 +329,7 @@ namespace frm } { - OStreamSection aEnsureCompat( xDataIn ); + OStreamSection aEnsureCompat( _rxInStream ); FontDescriptor aFont; ::comphelper::operator>>( _rxInStream, aFont ); setFont( aFont ); diff --git a/forms/source/component/scrollbar.cxx b/forms/source/component/scrollbar.cxx index fbab6e7ad2e0..e0ecb47fd5a5 100644 --- a/forms/source/component/scrollbar.cxx +++ b/forms/source/component/scrollbar.cxx @@ -250,7 +250,7 @@ namespace frm OBoundControlModel::write( _rxOutStream ); ::osl::MutexGuard aGuard( m_aMutex ); - OStreamSection aSection( Reference< XDataOutputStream >( _rxOutStream, UNO_QUERY ) ); + OStreamSection aSection( _rxOutStream ); // version _rxOutStream->writeShort( 0x0001 ); @@ -268,7 +268,7 @@ namespace frm // version { - OStreamSection aSection( Reference< XDataInputStream >( _rxInStream, UNO_QUERY ) ); + OStreamSection aSection( _rxInStream ); sal_uInt16 nVersion = _rxInStream->readShort(); if ( nVersion == 0x0001 ) diff --git a/forms/source/component/spinbutton.cxx b/forms/source/component/spinbutton.cxx index 1faa874f7bab..70237f38b09d 100644 --- a/forms/source/component/spinbutton.cxx +++ b/forms/source/component/spinbutton.cxx @@ -206,7 +206,7 @@ namespace frm OBoundControlModel::write( _rxOutStream ); ::osl::MutexGuard aGuard( m_aMutex ); - OStreamSection aSection( Reference< XDataOutputStream >( _rxOutStream, UNO_QUERY ) ); + OStreamSection aSection( _rxOutStream ); // version _rxOutStream->writeShort( 0x0001 ); @@ -224,7 +224,7 @@ namespace frm // version { - OStreamSection aSection( Reference< XDataInputStream >( _rxInStream, UNO_QUERY ) ); + OStreamSection aSection( _rxInStream ); sal_uInt16 nVersion = _rxInStream->readShort(); if ( nVersion == 0x0001 ) |