[Libreoffice-commits] core.git: 2 commits - svx/source sw/source
Michael Stahl
mstahl at redhat.com
Tue Jan 28 11:58:36 PST 2014
svx/source/tbxctrls/tbcontrl.cxx | 7 +++++--
sw/source/core/fields/reffld.cxx | 30 +++++++++++++++++++-----------
2 files changed, 24 insertions(+), 13 deletions(-)
New commits:
commit d9896aeeedb0ca03bec65df23e2fd96f30239619
Author: Michael Stahl <mstahl at redhat.com>
Date: Tue Jan 28 20:45:20 2014 +0100
fix bad cast in SvxStyleBox_Impl::StateChanged()
This causes various JunitTest crashes on Windows, regression from
887bc4dd3e62fe6dd19dc9d1c3ba273a5b21b5ec.
Change-Id: Iab24e0d39375ac1e5ac63d32470dca1e54d518c5
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index 5284816..0a96bd0 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -596,7 +596,10 @@ void SvxStyleBox_Impl::UserDraw( const UserDrawEvent& rUDEvt )
Size aPixelSize( pDevice->LogicToPixel( aFontSize, pShell->GetMapUnit() ) );
// setup the font properties
- Font aFont( pFontItem->GetFamilyName(), pFontItem->GetStyleName(), aPixelSize );
+ SvxFont aFont;
+ aFont.SetName(pFontItem->GetFamilyName());
+ aFont.SetStyleName(pFontItem->GetStyleName());
+ aFont.SetSize(aPixelSize);
const SfxPoolItem *pItem = aItemSet.GetItem( SID_ATTR_CHAR_WEIGHT );
if ( pItem )
@@ -632,7 +635,7 @@ void SvxStyleBox_Impl::UserDraw( const UserDrawEvent& rUDEvt )
pItem = aItemSet.GetItem( SID_ATTR_CHAR_CASEMAP );
if ( pItem )
- ((SvxFont &)aFont).SetCaseMap( static_cast< const SvxCaseMapItem* >( pItem )->GetCaseMap() );
+ aFont.SetCaseMap(static_cast<const SvxCaseMapItem*>(pItem)->GetCaseMap());
pItem = aItemSet.GetItem( SID_ATTR_CHAR_EMPHASISMARK );
if ( pItem )
commit 8676c2157a0d294dabd967b9591f48ba2ec95ac1
Author: Michael Stahl <mstahl at redhat.com>
Date: Tue Jan 28 17:04:24 2014 +0100
sw: style cleanup in GetFieldIdsFromDoc
Change-Id: Ib7141b47d5c2a27b75e47756adb4c644aace721a
diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx
index 2974c7b..1288582 100644
--- a/sw/source/core/fields/reffld.cxx
+++ b/sw/source/core/fields/reffld.cxx
@@ -950,17 +950,23 @@ typedef boost::ptr_vector<_RefIdsMap> _RefIdsMaps;
/// @param[in,out] rIds The list of IDs found in the document.
void _RefIdsMap::GetFieldIdsFromDoc( SwDoc& rDoc, std::set<sal_uInt16> &rIds)
{
- const SwTxtNode* pNd;
- SwFieldType* pType;
+ SwFieldType *const pType = rDoc.GetFldType(RES_SETEXPFLD, aName, false);
- if( 0 != ( pType = rDoc.GetFldType( RES_SETEXPFLD, aName, false ) ))
+ if (!pType)
+ return;
+
+ SwIterator<SwFmtFld,SwFieldType> aIter( *pType );
+ for (SwFmtFld const* pF = aIter.First(); pF; pF = aIter.Next())
{
- SwIterator<SwFmtFld,SwFieldType> aIter( *pType );
- for( SwFmtFld* pF = aIter.First(); pF; pF = aIter.Next() )
- if( pF->GetTxtFld() &&
- 0 != ( pNd = pF->GetTxtFld()->GetpTxtNode() ) &&
- pNd->GetNodes().IsDocNodes() )
- rIds.insert( ((SwSetExpField*)pF->GetField())->GetSeqNumber() );
+ if (pF->GetTxtFld())
+ {
+ SwTxtNode const*const pNd = pF->GetTxtFld()->GetpTxtNode();
+ if (pNd && pNd->GetNodes().IsDocNodes())
+ {
+ rIds.insert(static_cast<SwSetExpField const*>(pF->GetField())
+ ->GetSeqNumber());
+ }
+ }
}
}
@@ -999,8 +1005,10 @@ void _RefIdsMap::Init( SwDoc& rDoc, SwDoc& rDestDoc, bool bField )
for( SwFmtFld* pF = aIter.First(); pF; pF = aIter.Next() )
if( pF->GetTxtFld() )
{
- sal_uInt16 n = ((SwSetExpField*)pF->GetField())->GetSeqNumber( );
- ((SwSetExpField*)pF->GetField())->SetSeqNumber( sequencedIds[ n ] );
+ SwSetExpField *const pSetExp(
+ static_cast<SwSetExpField *>(pF->GetField()));
+ sal_uInt16 const n = pSetExp->GetSeqNumber();
+ pSetExp->SetSeqNumber( sequencedIds[n] );
}
}
}
More information about the Libreoffice-commits
mailing list