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 /xmloff/source/style/styleexp.cxx | |
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 'xmloff/source/style/styleexp.cxx')
-rw-r--r-- | xmloff/source/style/styleexp.cxx | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/xmloff/source/style/styleexp.cxx b/xmloff/source/style/styleexp.cxx index b9ca2ad2e67e..318cc0d1c6f4 100644 --- a/xmloff/source/style/styleexp.cxx +++ b/xmloff/source/style/styleexp.cxx @@ -396,14 +396,13 @@ void XMLStyleExport::exportStyleFamily( if( !xStyleCont.is() ) return; - Reference< XNameAccess > xStyles( xStyleCont, UNO_QUERY ); // If next styles are supported and used styles should be exported only, // the next style may be unused but has to be exported, too. In this case // the names of all exported styles are remembered. boost::scoped_ptr<std::set<OUString> > pExportedStyles(0); sal_Bool bFirstStyle = sal_True; - const uno::Sequence< OUString> aSeq = xStyles->getElementNames(); + const uno::Sequence< OUString> aSeq = xStyleCont->getElementNames(); const OUString* pIter = aSeq.getConstArray(); const OUString* pEnd = pIter + aSeq.getLength(); for(;pIter != pEnd;++pIter) @@ -411,7 +410,7 @@ void XMLStyleExport::exportStyleFamily( Reference< XStyle > xStyle; try { - xStyles->getByName( *pIter ) >>= xStyle; + xStyleCont->getByName( *pIter ) >>= xStyle; } catch(const lang::IndexOutOfBoundsException&) { @@ -428,7 +427,7 @@ void XMLStyleExport::exportStyleFamily( if( !bUsed || xStyle->isInUse() ) { sal_Bool bExported = exportStyle( xStyle, rXMLFamily, rPropMapper, - xStyles,pPrefix ); + xStyleCont,pPrefix ); if( bUsed && bFirstStyle && bExported ) { // If this is the first style, find out whether next styles @@ -464,7 +463,7 @@ void XMLStyleExport::exportStyleFamily( for(;pIter != pEnd;++pIter) { Reference< XStyle > xStyle; - xStyles->getByName( *pIter ) >>= xStyle; + xStyleCont->getByName( *pIter ) >>= xStyle; DBG_ASSERT( xStyle.is(), "Style not found for export!" ); if( xStyle.is() ) @@ -500,7 +499,7 @@ void XMLStyleExport::exportStyleFamily( xStyleCont->getByName( sNextName ) >>= xStyle; DBG_ASSERT( xStyle.is(), "Style not found for export!" ); - if( xStyle.is() && exportStyle( xStyle, rXMLFamily, rPropMapper, xStyles,pPrefix ) ) + if( xStyle.is() && exportStyle( xStyle, rXMLFamily, rPropMapper, xStyleCont, pPrefix ) ) pExportedStyles->insert( sTmp ); } } |