diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2018-02-13 18:57:46 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2018-02-14 11:21:51 +0100 |
commit | e2372907c991833a8bbe13f84460783d8d8fdfdb (patch) | |
tree | af8e58ad8ffb73a4352de578496f006839763ad2 /editeng | |
parent | 532576461654eaf43120d2f693172c07a41275fa (diff) |
Make SwFormatFrameSize derive from SvxSizeItem
...as seen in UBSan builds when, on an image in Writer, selecting context menu's
"Properties..." to open the "Image" dialog, there'll be failure
> cui/source/tabpages/grfpage.cxx:206:21: runtime error: downcast of address 0x00001293f5c0 which does not point to an object of type 'const SvxSizeItem'
> 0x00001293f5c0: note: object is of type 'SwFormatFrameSize'
00 00 00 00 68 d5 ea aa 8f 7f 00 00 01 00 00 00 43 27 00 00 81 2e 00 00 00 00 00 00 c5 41 00 00
> ^~~~~~~~~~~~~~~~~~~~~~~
> vptr for 'SwFormatFrameSize'
> #0 0x7f8f1ec29a34 in SvxGrfCropPage::Reset(SfxItemSet const*) cui/source/tabpages/grfpage.cxx:206:21
> #1 0x7f9036000d98 in SfxTabDialog::ActivatePageHdl(TabControl*) sfx2/source/dialog/tabdlg.cxx:1115:19
Moved the {Get,Set}{Width,Height} convenience functions down from
SwFormatFrameSize to SvxSizeItem. And "reverted" the SvxSizeItem
{Has,Scale}Metrics overrides in SwFormatFrameSize, "just in case." Renamed
SvxSizeItem::aSize to m_aSize to avoid GCC -Werror=shadow in
SwFormatFrameSize::dumpAsXml (sw/source/core/layout/atrfrm.cxx), which has a
local variable named aSize.
Change-Id: I9a2e0b19f21c1468ecba87a5bdafa40c8c424ae4
Reviewed-on: https://gerrit.libreoffice.org/49678
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/source/items/frmitems.cxx | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx index 0ed13e1088af..f39dc856fb3d 100644 --- a/editeng/source/items/frmitems.cxx +++ b/editeng/source/items/frmitems.cxx @@ -201,7 +201,7 @@ SvxSizeItem::SvxSizeItem( const sal_uInt16 nId, const Size& rSize ) : SfxPoolItem( nId ), - aSize( rSize ) + m_aSize( rSize ) { } @@ -211,7 +211,7 @@ bool SvxSizeItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; - awt::Size aTmp(aSize.Width(), aSize.Height()); + awt::Size aTmp(m_aSize.Width(), m_aSize.Height()); if( bConvert ) { aTmp.Height = convertTwipToMm100(aTmp.Height); @@ -247,7 +247,7 @@ bool SvxSizeItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) aTmp.Height = convertMm100ToTwip(aTmp.Height); aTmp.Width = convertMm100ToTwip(aTmp.Width); } - aSize = Size( aTmp.Width, aTmp.Height ); + m_aSize = Size( aTmp.Width, aTmp.Height ); } else { @@ -261,7 +261,7 @@ bool SvxSizeItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) if(!(rVal >>= nVal )) return false; - aSize.setWidth( bConvert ? convertMm100ToTwip(nVal) : nVal ); + m_aSize.setWidth( bConvert ? convertMm100ToTwip(nVal) : nVal ); } break; case MID_SIZE_HEIGHT: @@ -270,7 +270,7 @@ bool SvxSizeItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) if(!(rVal >>= nVal)) return true; - aSize.setHeight( bConvert ? convertMm100ToTwip(nVal) : nVal ); + m_aSize.setHeight( bConvert ? convertMm100ToTwip(nVal) : nVal ); } break; default: OSL_FAIL("Wrong MemberId!"); @@ -291,7 +291,7 @@ bool SvxSizeItem::operator==( const SfxPoolItem& rAttr ) const { assert(SfxPoolItem::operator==(rAttr)); - return ( aSize == static_cast<const SvxSizeItem&>( rAttr ).GetSize() ); + return ( m_aSize == static_cast<const SvxSizeItem&>( rAttr ).GetSize() ); } @@ -313,18 +313,18 @@ bool SvxSizeItem::GetPresentation switch ( ePres ) { case SfxItemPresentation::Nameless: - rText = GetMetricText( aSize.Width(), eCoreUnit, ePresUnit, &rIntl ) + + rText = GetMetricText( m_aSize.Width(), eCoreUnit, ePresUnit, &rIntl ) + cpDelimTmp + - GetMetricText( aSize.Height(), eCoreUnit, ePresUnit, &rIntl ); + GetMetricText( m_aSize.Height(), eCoreUnit, ePresUnit, &rIntl ); return true; case SfxItemPresentation::Complete: rText = EditResId(RID_SVXITEMS_SIZE_WIDTH) + - GetMetricText( aSize.Width(), eCoreUnit, ePresUnit, &rIntl ) + + GetMetricText( m_aSize.Width(), eCoreUnit, ePresUnit, &rIntl ) + " " + EditResId(GetMetricId(ePresUnit)) + cpDelimTmp + EditResId(RID_SVXITEMS_SIZE_HEIGHT) + - GetMetricText( aSize.Height(), eCoreUnit, ePresUnit, &rIntl ) + + GetMetricText( m_aSize.Height(), eCoreUnit, ePresUnit, &rIntl ) + " " + EditResId(GetMetricId(ePresUnit)); return true; // no break necessary @@ -337,8 +337,8 @@ bool SvxSizeItem::GetPresentation void SvxSizeItem::ScaleMetrics( long nMult, long nDiv ) { - aSize.setWidth( Scale( aSize.Width(), nMult, nDiv ) ); - aSize.setHeight( Scale( aSize.Height(), nMult, nDiv ) ); + m_aSize.setWidth( Scale( m_aSize.Width(), nMult, nDiv ) ); + m_aSize.setHeight( Scale( m_aSize.Height(), nMult, nDiv ) ); } |