[Libreoffice-commits] core.git: 5 commits - desktop/source sw/source
Caolán McNamara
caolanm at redhat.com
Wed Sep 21 13:36:32 UTC 2016
desktop/source/app/app.cxx | 2
sw/source/core/frmedt/fetab.cxx | 151 ++++++++++++++++++++++------------------
2 files changed, 85 insertions(+), 68 deletions(-)
New commits:
commit 22a53c2bb8c72610e96b50a71dd19c755ff17498
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Sep 21 12:43:56 2016 +0100
Related: tdf#102073 survive table in footnotes edgecases
Change-Id: I31339e4adf9bf147cbd788dc1be4088b24d59b74
diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx
index e01d864..cda915d 100644
--- a/sw/source/core/frmedt/fetab.cxx
+++ b/sw/source/core/frmedt/fetab.cxx
@@ -646,9 +646,10 @@ void SwFEShell::SetTabCols( const SwTabCols &rNew, bool bCurRowOnly )
SET_CURR_SHELL( this );
StartAllAction();
- do {
+ do
+ {
pBox = pBox->GetUpper();
- } while ( !pBox->IsCellFrame() );
+ } while (pBox && !pBox->IsCellFrame());
GetDoc()->SetTabCols( rNew, bCurRowOnly, static_cast<SwCellFrame*>(pBox) );
EndAllActionAndCall();
@@ -660,8 +661,13 @@ void SwFEShell::GetTabCols( SwTabCols &rToFill ) const
if( !pFrame || !pFrame->IsInTab() )
return;
do
- { pFrame = pFrame->GetUpper();
- } while ( !pFrame->IsCellFrame() );
+ {
+ pFrame = pFrame->GetUpper();
+ }
+ while (pFrame && !pFrame->IsCellFrame());
+
+ if (!pFrame)
+ return;
GetTabCols_( rToFill, pFrame );
}
@@ -672,8 +678,12 @@ void SwFEShell::GetTabRows( SwTabCols &rToFill ) const
if( !pFrame || !pFrame->IsInTab() )
return;
do
- { pFrame = pFrame->GetUpper();
- } while ( !pFrame->IsCellFrame() );
+ {
+ pFrame = pFrame->GetUpper();
+ } while (pFrame && !pFrame->IsCellFrame());
+
+ if (!pFrame)
+ return;
GetTabRows_( rToFill, pFrame );
}
@@ -687,9 +697,10 @@ void SwFEShell::SetTabRows( const SwTabCols &rNew, bool bCurColOnly )
SET_CURR_SHELL( this );
StartAllAction();
- do {
+ do
+ {
pBox = pBox->GetUpper();
- } while ( !pBox->IsCellFrame() );
+ } while (pBox && !pBox->IsCellFrame());
GetDoc()->SetTabRows( rNew, bCurColOnly, static_cast<SwCellFrame*>(pBox) );
EndAllActionAndCall();
@@ -1029,18 +1040,17 @@ static sal_uInt16 lcl_GetRowNumber( const SwPosition& rPos )
else
pFrame = nullptr;
- if (!pFrame || !pFrame->IsInTab())
- return USHRT_MAX;
-
- sal_uInt16 nRet = USHRT_MAX;
+ const SwFrame* pRow = (pFrame && pFrame->IsInTab()) ? pFrame->GetUpper() : nullptr;
- const SwFrame* pRow = pFrame->GetUpper();
- while ( !pRow->GetUpper()->IsTabFrame() )
+ while (pRow && (!pRow->GetUpper() || !pRow->GetUpper()->IsTabFrame()))
pRow = pRow->GetUpper();
+ if (!pRow)
+ return USHRT_MAX;
+
const SwTabFrame* pTabFrame = static_cast<const SwTabFrame*>(pRow->GetUpper());
const SwTableLine* pTabLine = static_cast<const SwRowFrame*>(pRow)->GetTabLine();
-
+ sal_uInt16 nRet = USHRT_MAX;
sal_uInt16 nI = 0;
while ( nI < pTabFrame->GetTable()->GetTabLines().size() )
{
@@ -1336,11 +1346,18 @@ size_t SwFEShell::GetCurTabColNum() const
if (!pFrame || !pFrame->IsInTab())
return 0;
- size_t nRet = 0;
- do { // JP 26.09.95: why compare with ContentFrame
- // and not with CellFrame ????
+ do
+ {
+ // JP 26.09.95: why compare with ContentFrame
+ // and not with CellFrame ????
pFrame = pFrame->GetUpper();
- } while ( !pFrame->IsCellFrame() );
+ } while (pFrame && !pFrame->IsCellFrame());
+
+ if (!pFrame)
+ return 0;
+
+ size_t nRet = 0;
+
SWRECTFN( pFrame )
const SwPageFrame* pPage = pFrame->FindPageFrame();
commit 82dcd668689bce4b16a38baba09922d46d5952e7
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Sep 21 12:23:55 2016 +0100
return early on non-main condition, no logic change
Change-Id: I056ef7100c908cde53794f028a3acef5dcb07779
diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx
index f5af05b..e01d864 100644
--- a/sw/source/core/frmedt/fetab.cxx
+++ b/sw/source/core/frmedt/fetab.cxx
@@ -1020,7 +1020,6 @@ void SwFEShell::SetRowsToRepeat( sal_uInt16 nSet )
// returns the number of rows consecutively selected from top
static sal_uInt16 lcl_GetRowNumber( const SwPosition& rPos )
{
- sal_uInt16 nRet = USHRT_MAX;
Point aTmpPt;
const SwContentNode *pNd;
const SwContentFrame *pFrame;
@@ -1030,25 +1029,27 @@ static sal_uInt16 lcl_GetRowNumber( const SwPosition& rPos )
else
pFrame = nullptr;
- if ( pFrame && pFrame->IsInTab() )
- {
- const SwFrame* pRow = pFrame->GetUpper();
- while ( !pRow->GetUpper()->IsTabFrame() )
- pRow = pRow->GetUpper();
+ if (!pFrame || !pFrame->IsInTab())
+ return USHRT_MAX;
+
+ sal_uInt16 nRet = USHRT_MAX;
+
+ const SwFrame* pRow = pFrame->GetUpper();
+ while ( !pRow->GetUpper()->IsTabFrame() )
+ pRow = pRow->GetUpper();
- const SwTabFrame* pTabFrame = static_cast<const SwTabFrame*>(pRow->GetUpper());
- const SwTableLine* pTabLine = static_cast<const SwRowFrame*>(pRow)->GetTabLine();
+ const SwTabFrame* pTabFrame = static_cast<const SwTabFrame*>(pRow->GetUpper());
+ const SwTableLine* pTabLine = static_cast<const SwRowFrame*>(pRow)->GetTabLine();
- sal_uInt16 nI = 0;
- while ( nI < pTabFrame->GetTable()->GetTabLines().size() )
+ sal_uInt16 nI = 0;
+ while ( nI < pTabFrame->GetTable()->GetTabLines().size() )
+ {
+ if ( pTabFrame->GetTable()->GetTabLines()[ nI ] == pTabLine )
{
- if ( pTabFrame->GetTable()->GetTabLines()[ nI ] == pTabLine )
- {
- nRet = nI;
- break;
- }
- ++nI;
+ nRet = nI;
+ break;
}
+ ++nI;
}
return nRet;
commit b2aa15ed6e989c50402e3914bffbc1a352e127de
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Sep 21 12:20:52 2016 +0100
implement IsTableRightToLeft the same as IsTableVertical
Change-Id: I56ab1e9766f53bf8445f8c0ecab4682fcd24b7ec
diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx
index d38147b..f5af05b 100644
--- a/sw/source/core/frmedt/fetab.cxx
+++ b/sw/source/core/frmedt/fetab.cxx
@@ -2373,10 +2373,10 @@ bool SwFEShell::GetAutoSum( OUString& rFormula ) const
bool SwFEShell::IsTableRightToLeft() const
{
SwFrame *pFrame = GetCurrFrame();
- if( !pFrame || !pFrame->IsInTab() )
+ SwTabFrame *pTab = (pFrame && pFrame->IsInTab()) ? pFrame->ImplFindTabFrame() : nullptr;
+ if (!pTab)
return false;
-
- return pFrame->ImplFindTabFrame()->IsRightToLeft();
+ return pTab->IsRightToLeft();
}
bool SwFEShell::IsMouseTableRightToLeft(const Point &rPt) const
commit 148ad4cd0981e8352023f574884340ce81730d7b
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Sep 21 12:12:01 2016 +0100
return early on non-main condition, no logic change
Change-Id: Ia804e4c6bfb57e0984f3d6e76cd8d27a299cafe3
diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx
index 4ac0b77..d38147b 100644
--- a/sw/source/core/frmedt/fetab.cxx
+++ b/sw/source/core/frmedt/fetab.cxx
@@ -1328,59 +1328,58 @@ bool SwFEShell::DeleteTableSel()
size_t SwFEShell::GetCurTabColNum() const
{
//!!!GetCurMouseTabColNum() mitpflegen!!!!
- size_t nRet = 0;
-
SwFrame *pFrame = GetCurrFrame();
OSL_ENSURE( pFrame, "Cursor parked?" );
// check if SPoint/Mark of current cursor are in a table
- if( pFrame && pFrame->IsInTab() )
- {
- do { // JP 26.09.95: why compare with ContentFrame
- // and not with CellFrame ????
- pFrame = pFrame->GetUpper();
- } while ( !pFrame->IsCellFrame() );
- SWRECTFN( pFrame )
+ if (!pFrame || !pFrame->IsInTab())
+ return 0;
- const SwPageFrame* pPage = pFrame->FindPageFrame();
+ size_t nRet = 0;
+ do { // JP 26.09.95: why compare with ContentFrame
+ // and not with CellFrame ????
+ pFrame = pFrame->GetUpper();
+ } while ( !pFrame->IsCellFrame() );
+ SWRECTFN( pFrame )
- // get TabCols, as only via these we get to the position
- SwTabCols aTabCols;
- GetTabCols( aTabCols );
+ const SwPageFrame* pPage = pFrame->FindPageFrame();
- if( pFrame->FindTabFrame()->IsRightToLeft() )
- {
- long nX = (pFrame->Frame().*fnRect->fnGetRight)() - (pPage->Frame().*fnRect->fnGetLeft)();
+ // get TabCols, as only via these we get to the position
+ SwTabCols aTabCols;
+ GetTabCols( aTabCols );
- const long nRight = aTabCols.GetLeftMin() + aTabCols.GetRight();
+ if( pFrame->FindTabFrame()->IsRightToLeft() )
+ {
+ long nX = (pFrame->Frame().*fnRect->fnGetRight)() - (pPage->Frame().*fnRect->fnGetLeft)();
- if ( !::IsSame( nX, nRight ) )
- {
- nX = nRight - nX + aTabCols.GetLeft();
- for ( size_t i = 0; i < aTabCols.Count(); ++i )
- if ( ::IsSame( nX, aTabCols[i] ) )
- {
- nRet = i + 1;
- break;
- }
- }
- }
- else
+ const long nRight = aTabCols.GetLeftMin() + aTabCols.GetRight();
+
+ if ( !::IsSame( nX, nRight ) )
{
- const long nX = (pFrame->Frame().*fnRect->fnGetLeft)() -
- (pPage->Frame().*fnRect->fnGetLeft)();
+ nX = nRight - nX + aTabCols.GetLeft();
+ for ( size_t i = 0; i < aTabCols.Count(); ++i )
+ if ( ::IsSame( nX, aTabCols[i] ) )
+ {
+ nRet = i + 1;
+ break;
+ }
+ }
+ }
+ else
+ {
+ const long nX = (pFrame->Frame().*fnRect->fnGetLeft)() -
+ (pPage->Frame().*fnRect->fnGetLeft)();
- const long nLeft = aTabCols.GetLeftMin();
+ const long nLeft = aTabCols.GetLeftMin();
- if ( !::IsSame( nX, nLeft + aTabCols.GetLeft() ) )
- {
- for ( size_t i = 0; i < aTabCols.Count(); ++i )
- if ( ::IsSame( nX, nLeft + aTabCols[i] ) )
- {
- nRet = i + 1;
- break;
- }
- }
+ if ( !::IsSame( nX, nLeft + aTabCols.GetLeft() ) )
+ {
+ for ( size_t i = 0; i < aTabCols.Count(); ++i )
+ if ( ::IsSame( nX, nLeft + aTabCols[i] ) )
+ {
+ nRet = i + 1;
+ break;
+ }
}
}
return nRet;
commit fa5337ce04a642cb54d802f102735d90728516b9
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Sep 21 10:22:21 2016 +0100
use #i format for these bug ids
Change-Id: I90b6e426718ff11b4dfae00f7ee6b5e1036390f9
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index 0f039a9..732507b 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -1931,7 +1931,7 @@ class ExitTimer : public Timer
IMPL_LINK_NOARG_TYPED(Desktop, OpenClients_Impl, void*, void)
{
try {
- // #114963#
+ // #i114963#
// Enable IPC thread before OpenClients
//
// This is because it is possible for another client to connect during the OpenClients() call.
More information about the Libreoffice-commits
mailing list