diff options
-rw-r--r-- | sc/source/core/data/document.cxx | 24 | ||||
-rw-r--r-- | sc/source/ui/view/viewfunc.cxx | 11 |
2 files changed, 24 insertions, 11 deletions
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index 8cb6bdb233b6..9057fa9be505 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -4940,7 +4940,29 @@ void ScDocument::GetSelectionFrame( const ScMarkData& rMark, ScLineFlags aFlags; - if (rMark.IsMarked()) + if( rMark.IsMultiMarked() ) + { + ScRangeList aRangeList; + rMark.FillRangeListWithMarks( &aRangeList, false ); + size_t nRangeCount = aRangeList.size(); + bool bMultipleRows = false, bMultipleCols = false; + for( size_t nRangeIdx = 0; nRangeIdx < nRangeCount; ++nRangeIdx ) + { + const ScRange* pRange = aRangeList[ nRangeIdx ]; + bMultipleRows = ( bMultipleRows || ( pRange->aStart.Row() != pRange->aEnd.Row() ) ); + bMultipleCols = ( bMultipleCols || ( pRange->aStart.Col() != pRange->aEnd.Col() ) ); + SCTAB nMax = static_cast<SCTAB>(maTabs.size()); + ScMarkData::const_iterator itr = rMark.begin(), itrEnd = rMark.end(); + for (; itr != itrEnd && *itr < nMax; ++itr) + if (maTabs[*itr]) + maTabs[*itr]->MergeBlockFrame( &rLineOuter, &rLineInner, aFlags, + pRange->aStart.Col(), pRange->aStart.Row(), + pRange->aEnd.Col(), pRange->aEnd.Row() ); + } + rLineInner.EnableHor( bMultipleRows ); + rLineInner.EnableVer( bMultipleCols ); + } + else if( rMark.IsMarked() ) { ScRange aRange; rMark.GetMarkArea(aRange); diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx index cb140c8fca6c..57b9c3e89268 100644 --- a/sc/source/ui/view/viewfunc.cxx +++ b/sc/source/ui/view/viewfunc.cxx @@ -841,16 +841,7 @@ void ScViewFunc::GetSelectionFrame( SvxBoxItem& rLineOuter, const ScMarkData& rMark = GetViewData().GetMarkData(); if ( rMark.IsMarked() || rMark.IsMultiMarked() ) - { - if ( rMark.IsMultiMarked() ) - { - ScMarkData aNewMark( rMark ); // use local copy for MarkToSimple - aNewMark.MarkToSimple(); // simple block is needed for GetSelectionFrame - pDoc->GetSelectionFrame( aNewMark, rLineOuter, rLineInner ); - } - else - pDoc->GetSelectionFrame( rMark, rLineOuter, rLineInner ); - } + pDoc->GetSelectionFrame( rMark, rLineOuter, rLineInner ); else { const ScPatternAttr* pAttrs = |