diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2016-06-10 15:52:05 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2016-06-10 15:52:05 +0200 |
commit | 8132d7f9d71d9f6418855d2d6241dae804beeb8b (patch) | |
tree | 7394f094265efdfaaa4ce02ce287da39c1a43f1a /xmloff/source/text/txtparae.cxx | |
parent | 285744fef87f4ca0278834b97d7f618bdba5f4c0 (diff) |
o3tl::tryGet on a temporary is dangerous
...so rename to o3tl::tryAccess to make it more obvious that the returned
proxy points into the internals of the given Any, and forbid calling
o3tl::tryAccess on a temporary
Change-Id: Ia412c6b2b06693811b9b7f0076a08bbf97142df9
Diffstat (limited to 'xmloff/source/text/txtparae.cxx')
-rw-r--r-- | xmloff/source/text/txtparae.cxx | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx index dfea038f50ae..340c06de9ad8 100644 --- a/xmloff/source/text/txtparae.cxx +++ b/xmloff/source/text/txtparae.cxx @@ -516,13 +516,13 @@ void XMLTextParagraphExport::Add( sal_uInt16 nFamily, xNumPropSet->getPropertySetInfo() ->hasPropertyByName( "IsAutomatic" ) ) { - bAdd = *o3tl::doGet<bool>(xNumPropSet->getPropertyValue( "IsAutomatic" )); + bAdd = *o3tl::doAccess<bool>(xNumPropSet->getPropertyValue( "IsAutomatic" )); // Check on outline style (#i73361#) if ( bAdd && xNumPropSet->getPropertySetInfo() ->hasPropertyByName( "NumberingIsOutline" ) ) { - bAdd = !(*o3tl::doGet<bool>(xNumPropSet->getPropertyValue( "NumberingIsOutline" ))); + bAdd = !(*o3tl::doAccess<bool>(xNumPropSet->getPropertyValue( "NumberingIsOutline" ))); } } else @@ -622,13 +622,13 @@ void XMLTextParagraphExport::Add( sal_uInt16 nFamily, xNumPropSet->getPropertySetInfo() ->hasPropertyByName( "IsAutomatic" ) ) { - bAdd = *o3tl::doGet<bool>(xNumPropSet->getPropertyValue( "IsAutomatic" )); + bAdd = *o3tl::doAccess<bool>(xNumPropSet->getPropertyValue( "IsAutomatic" )); // Check on outline style (#i73361#) if ( bAdd && xNumPropSet->getPropertySetInfo() ->hasPropertyByName( "NumberingIsOutline" ) ) { - bAdd = !(*o3tl::doGet<bool>(xNumPropSet->getPropertyValue( "NumberingIsOutline" ))); + bAdd = !(*o3tl::doAccess<bool>(xNumPropSet->getPropertyValue( "NumberingIsOutline" ))); } } else @@ -1459,13 +1459,13 @@ bool XMLTextParagraphExport::collectTextAutoStylesOptimized( bool bIsProgress ) } Any aAny = xAutoStyleFamilies->getByName( sName ); - Reference< XAutoStyleFamily > xAutoStyles = *o3tl::doGet<Reference<XAutoStyleFamily>>(aAny); + Reference< XAutoStyleFamily > xAutoStyles = *o3tl::doAccess<Reference<XAutoStyleFamily>>(aAny); Reference < XEnumeration > xAutoStylesEnum( xAutoStyles->createEnumeration() ); while ( xAutoStylesEnum->hasMoreElements() ) { aAny = xAutoStylesEnum->nextElement(); - Reference< XAutoStyle > xAutoStyle = *o3tl::doGet<Reference<XAutoStyle>>(aAny); + Reference< XAutoStyle > xAutoStyle = *o3tl::doAccess<Reference<XAutoStyle>>(aAny); Reference < XPropertySet > xPSet( xAutoStyle, uno::UNO_QUERY ); Add( nFamily, xPSet, nullptr, true ); } @@ -1482,7 +1482,7 @@ bool XMLTextParagraphExport::collectTextAutoStylesOptimized( bool bIsProgress ) while ( xTextFieldsEnum->hasMoreElements() ) { Any aAny = xTextFieldsEnum->nextElement(); - Reference< XTextField > xTextField = *o3tl::doGet<Reference<XTextField>>(aAny); + Reference< XTextField > xTextField = *o3tl::doAccess<Reference<XTextField>>(aAny); exportTextField( xTextField, bAutoStyles, bIsProgress, !xAutoStylesSupp.is() ); try @@ -1560,7 +1560,7 @@ bool XMLTextParagraphExport::collectTextAutoStylesOptimized( bool bIsProgress ) for( sal_Int32 i = 0; i < nCount; ++i ) { Any aAny = xSections->getByIndex( i ); - Reference< XTextSection > xSection = *o3tl::doGet<Reference<XTextSection>>(aAny); + Reference< XTextSection > xSection = *o3tl::doAccess<Reference<XTextSection>>(aAny); Reference < XPropertySet > xPSet( xSection, uno::UNO_QUERY ); Add( XML_STYLE_FAMILY_TEXT_SECTION, xPSet ); } @@ -1578,7 +1578,7 @@ bool XMLTextParagraphExport::collectTextAutoStylesOptimized( bool bIsProgress ) for( sal_Int32 i = 0; i < nCount; ++i ) { Any aAny = xTables->getByIndex( i ); - Reference< XTextTable > xTable = *o3tl::doGet<Reference<XTextTable>>(aAny); + Reference< XTextTable > xTable = *o3tl::doAccess<Reference<XTextTable>>(aAny); exportTable( xTable, true, true ); } } @@ -1608,13 +1608,13 @@ bool XMLTextParagraphExport::collectTextAutoStylesOptimized( bool bIsProgress ) xNumPropSet->getPropertySetInfo() ->hasPropertyByName( "IsAutomatic" ) ) { - bAdd = *o3tl::doGet<bool>(xNumPropSet->getPropertyValue( "IsAutomatic" )); + bAdd = *o3tl::doAccess<bool>(xNumPropSet->getPropertyValue( "IsAutomatic" )); // Check on outline style (#i73361#) if ( bAdd && xNumPropSet->getPropertySetInfo() ->hasPropertyByName( "NumberingIsOutline" ) ) { - bAdd = !(*o3tl::doGet<bool>(xNumPropSet->getPropertyValue( "NumberingIsOutline" ))); + bAdd = !(*o3tl::doAccess<bool>(xNumPropSet->getPropertyValue( "NumberingIsOutline" ))); } } else @@ -2506,13 +2506,13 @@ void XMLTextParagraphExport::exportTextMark( // start, end, or point-reference? sal_Int8 nElement; - if( *o3tl::doGet<bool>(rPropSet->getPropertyValue(sIsCollapsed)) ) + if( *o3tl::doAccess<bool>(rPropSet->getPropertyValue(sIsCollapsed)) ) { nElement = 0; } else { - nElement = *o3tl::doGet<bool>(rPropSet->getPropertyValue(sIsStart)) ? 1 : 2; + nElement = *o3tl::doAccess<bool>(rPropSet->getPropertyValue(sIsStart)) ? 1 : 2; } // bookmark, bookmark-start: xml:id and RDFa for RDF metadata @@ -2672,7 +2672,7 @@ XMLShapeExportFlags XMLTextParagraphExport::addTextFrameAttributes( bool bSyncWidth = false; if( xPropSetInfo->hasPropertyByName( sIsSyncWidthToHeight ) ) { - bSyncWidth = *o3tl::doGet<bool>(rPropSet->getPropertyValue( sIsSyncWidthToHeight )); + bSyncWidth = *o3tl::doAccess<bool>(rPropSet->getPropertyValue( sIsSyncWidthToHeight )); if( bSyncWidth ) GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_REL_WIDTH, XML_SCALE ); @@ -2700,7 +2700,7 @@ XMLShapeExportFlags XMLTextParagraphExport::addTextFrameAttributes( bool bSyncHeight = false; if( xPropSetInfo->hasPropertyByName( sIsSyncHeightToWidth ) ) { - bSyncHeight = *o3tl::doGet<bool>(rPropSet->getPropertyValue( sIsSyncHeightToWidth )); + bSyncHeight = *o3tl::doAccess<bool>(rPropSet->getPropertyValue( sIsSyncHeightToWidth )); } sal_Int16 nRelHeight = 0; if( !bSyncHeight && xPropSetInfo->hasPropertyByName( sRelativeHeight ) ) @@ -2967,7 +2967,7 @@ void XMLTextParagraphExport::exportContour( if( rPropSetInfo->hasPropertyByName( sIsPixelContour ) ) { - bPixel = *o3tl::doGet<bool>(rPropSet->getPropertyValue( sIsPixelContour )); + bPixel = *o3tl::doAccess<bool>(rPropSet->getPropertyValue( sIsPixelContour )); } // svg: width @@ -3029,7 +3029,7 @@ void XMLTextParagraphExport::exportContour( if( rPropSetInfo->hasPropertyByName( sIsAutomaticContour ) ) { - bool bTmp = *o3tl::doGet<bool>(rPropSet->getPropertyValue( + bool bTmp = *o3tl::doAccess<bool>(rPropSet->getPropertyValue( sIsAutomaticContour )); GetExport().AddAttribute( XML_NAMESPACE_DRAW, XML_RECREATE_ON_EDIT, bTmp ? XML_TRUE : XML_FALSE ); @@ -3250,7 +3250,7 @@ bool XMLTextParagraphExport::addHyperlinkAttributes( && ( !rPropState.is() || PropertyState_DIRECT_VALUE == rPropState->getPropertyState( sServerMap ) ) ) { - bServerMap = *o3tl::doGet<bool>(rPropSet->getPropertyValue( sServerMap )); + bServerMap = *o3tl::doAccess<bool>(rPropSet->getPropertyValue( sServerMap )); if ( bServerMap ) bExport = true; } @@ -3627,11 +3627,11 @@ void XMLTextParagraphExport::exportRuby( bool bAutoStyles ) { // early out: a collapsed ruby makes no sense - if (*o3tl::doGet<bool>(rPropSet->getPropertyValue(sIsCollapsed))) + if (*o3tl::doAccess<bool>(rPropSet->getPropertyValue(sIsCollapsed))) return; // start value ? - bool bStart = *o3tl::doGet<bool>(rPropSet->getPropertyValue(sIsStart)); + bool bStart = *o3tl::doAccess<bool>(rPropSet->getPropertyValue(sIsStart)); if (bAutoStyles) { |