Avoid unnecessary heap allocation

Change-Id: I7bc1a0960cc100c51b90c50838a5ef620f3c763f
This commit is contained in:
Stephan Bergmann
2014-02-07 15:32:07 +01:00
parent 115457292f
commit 2b04d0a17f
4 changed files with 8 additions and 22 deletions

View File

@@ -36,9 +36,6 @@
#include <vcl/menu.hxx>
#include <vcl/unohelp2.hxx>
#include <memory>
using namespace ::com::sun::star::accessibility;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
@@ -239,7 +236,6 @@ Sequence< PropertyValue > VCLXAccessibleMenuItem::getCharacterAttributes( sal_In
{
OExternalLockGuard aGuard( this );
Sequence< PropertyValue > aValues;
OUString sText( implGetText() );
if ( !implIsValidIndex( nIndex, sText.getLength() ) )
@@ -248,10 +244,8 @@ Sequence< PropertyValue > VCLXAccessibleMenuItem::getCharacterAttributes( sal_In
Font aFont = Application::GetSettings().GetStyleSettings().GetMenuFont();
sal_Int32 nBackColor = getBackground();
sal_Int32 nColor = getForeground();
::std::auto_ptr< CharacterAttributesHelper > pHelper( new CharacterAttributesHelper( aFont, nBackColor, nColor ) );
aValues = pHelper->GetCharacterAttributes( aRequestedAttributes );
return aValues;
return CharacterAttributesHelper( aFont, nBackColor, nColor )
.GetCharacterAttributes( aRequestedAttributes );
}
// -----------------------------------------------------------------------------

View File

@@ -35,9 +35,6 @@
#include <vcl/status.hxx>
#include <vcl/controllayout.hxx>
#include <memory>
using namespace ::com::sun::star::accessibility;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
@@ -516,8 +513,8 @@ Sequence< PropertyValue > VCLXAccessibleStatusBarItem::getCharacterAttributes( s
Font aFont = m_pStatusBar->GetFont();
sal_Int32 nBackColor = getBackground();
sal_Int32 nColor = getForeground();
::std::auto_ptr< CharacterAttributesHelper > pHelper( new CharacterAttributesHelper( aFont, nBackColor, nColor ) );
aValues = pHelper->GetCharacterAttributes( aRequestedAttributes );
aValues = CharacterAttributesHelper( aFont, nBackColor, nColor )
.GetCharacterAttributes( aRequestedAttributes );
}
return aValues;

View File

@@ -35,9 +35,6 @@
#include <vcl/tabctrl.hxx>
#include <vcl/tabpage.hxx>
#include <memory>
using namespace ::com::sun::star::accessibility;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
@@ -590,8 +587,8 @@ Sequence< PropertyValue > VCLXAccessibleTabPage::getCharacterAttributes( sal_Int
Font aFont = m_pTabControl->GetFont();
sal_Int32 nBackColor = getBackground();
sal_Int32 nColor = getForeground();
::std::auto_ptr< CharacterAttributesHelper > pHelper( new CharacterAttributesHelper( aFont, nBackColor, nColor ) );
aValues = pHelper->GetCharacterAttributes( aRequestedAttributes );
aValues = CharacterAttributesHelper( aFont, nBackColor, nColor )
.GetCharacterAttributes( aRequestedAttributes );
}
return aValues;

View File

@@ -32,7 +32,6 @@
#include <vcl/unohelp2.hxx>
#include <vcl/ctrl.hxx>
#include <memory>
#include <vector>
using namespace ::com::sun::star;
@@ -237,9 +236,8 @@ Sequence< PropertyValue > VCLXAccessibleTextComponent::getCharacterAttributes( s
}
*/
::std::auto_ptr< CharacterAttributesHelper > pHelper( new CharacterAttributesHelper( aFont, nBackColor, nColor ) );
aValues = pHelper->GetCharacterAttributes( aRequestedAttributes );
aValues = CharacterAttributesHelper( aFont, nBackColor, nColor )
.GetCharacterAttributes( aRequestedAttributes );
}
return aValues;