diff options
author | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2015-03-25 11:26:06 +0100 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2015-03-26 16:07:00 +0100 |
commit | 9e3064c172082eb43640381452d907bdb2ca6ebf (patch) | |
tree | b44b8b0e4d6600f83b4d1247d1121335338fdc98 /sw | |
parent | dc8697e554417d31501a0d90d731403ede223370 (diff) |
refactor FormatTable away from SwClients a bit
Change-Id: I43cf4ca6f8cf66b045eedd99108941ea44d56086
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/unocore/unotbl.cxx | 34 |
1 files changed, 14 insertions, 20 deletions
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx index 7a1fff41337f..7b667a19a801 100644 --- a/sw/source/core/unocore/unotbl.cxx +++ b/sw/source/core/unocore/unotbl.cxx @@ -604,20 +604,23 @@ static void lcl_InspectLines(SwTableLines& rLines, std::vector<OUString*>& rAllN } } -static void lcl_FormatTable(SwFrmFmt* pTblFmt) +static bool lcl_FormatTable(SwFrmFmt* pTblFmt) { + bool bHasFrames = false; SwIterator<SwFrm,SwFmt> aIter( *pTblFmt ); - for( SwFrm* pFrm = aIter.First(); pFrm; pFrm = aIter.Next() ) + for(SwFrm* pFrm = aIter.First(); pFrm; pFrm = aIter.Next()) { // mba: no TYPEINFO for SwTabFrm - if( pFrm->IsTabFrm() ) - { - if(pFrm->IsValid()) - pFrm->InvalidatePos(); - static_cast<SwTabFrm*>(pFrm)->SetONECalcLowers(); - static_cast<SwTabFrm*>(pFrm)->Calc(); - } + if(!pFrm->IsTabFrm()) + continue; + SwTabFrm* pTabFrm = static_cast<SwTabFrm*>(pFrm); + if(pTabFrm->IsValid()) + pTabFrm->InvalidatePos(); + pTabFrm->SetONECalcLowers(); + pTabFrm->Calc(); + bHasFrames = true; } + return bHasFrames; } static void lcl_CrsrSelect(SwPaM& rCrsr, bool bExpand) @@ -3180,13 +3183,8 @@ void SwXTextTable::setPropertyValue(const OUString& rPropertyName, const uno::An break; // something else } SwDoc* pDoc = pFmt->GetDoc(); - SwFrm* pFrm = SwIterator<SwFrm,SwFmt>( *pFmt ).First(); - // tables without layout (invisible header/footer?) - if (!pFrm) - { + if(!lcl_FormatTable(pFmt)) break; - } - lcl_FormatTable(pFmt); SwTable* pTable = SwTable::FindTable( pFmt ); SwTableLines &rLines = pTable->GetTabLines(); @@ -3374,13 +3372,9 @@ uno::Any SwXTextTable::getPropertyValue(const OUString& rPropertyName) case FN_UNO_TABLE_BORDER2: { SwDoc* pDoc = pFmt->GetDoc(); - SwFrm* pFrm = SwIterator<SwFrm,SwFmt>( *pFmt ).First(); // tables without layout (invisible header/footer?) - if (!pFrm) - { + if(!lcl_FormatTable(pFmt)) break; - } - lcl_FormatTable(pFmt); SwTable* pTable = SwTable::FindTable( pFmt ); SwTableLines &rLines = pTable->GetTabLines(); |