tdf#155368 Can't toggle Wrap Text on all cells if cell already has
The problem is not so much that we cannot toggle, it is that we cannot unset a toggle property. And the reason for that, is that the state of the toggle never goes off because the view state as computed by ScViewFunc::GetSelectionPattern is different from the state that is seen in ScViewFunc::ApplySelectionPattern where we apply the pattern. So make the same shrink-data-area adjustment in GetSelectionPattern. Change-Id: Ic56145ee98ead931278767851f74e0ce7422a150 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152074 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
committed by
Noel Grandin
parent
f4c24da1e7
commit
8cc51cf988
@@ -904,17 +904,25 @@ SvtScriptType ScViewFunc::GetSelectionScriptType()
|
||||
return nScript;
|
||||
}
|
||||
|
||||
static void ShrinkToDataArea(ScMarkData& rFuncMark, ScDocument& rDoc);
|
||||
|
||||
const ScPatternAttr* ScViewFunc::GetSelectionPattern()
|
||||
{
|
||||
// Don't use UnmarkFiltered in slot state functions, for performance reasons.
|
||||
// The displayed state is always that of the whole selection including filtered rows.
|
||||
|
||||
const ScMarkData& rMark = GetViewData().GetMarkData();
|
||||
ScMarkData aMark = GetViewData().GetMarkData();
|
||||
ScDocument& rDoc = GetViewData().GetDocument();
|
||||
if ( rMark.IsMarked() || rMark.IsMultiMarked() )
|
||||
|
||||
// tdf#155368 if the selection is the whole sheet, we need to shrink the mark area, otherwise
|
||||
// we will not return a consistent result
|
||||
// (consistent compared to what happens in ScViewFunc::ApplySelectionPattern)
|
||||
ShrinkToDataArea( aMark, rDoc );
|
||||
|
||||
if ( aMark.IsMarked() || aMark.IsMultiMarked() )
|
||||
{
|
||||
// MarkToMulti is no longer necessary for rDoc.GetSelectionPattern
|
||||
const ScPatternAttr* pAttr = rDoc.GetSelectionPattern( rMark );
|
||||
const ScPatternAttr* pAttr = rDoc.GetSelectionPattern( aMark );
|
||||
return pAttr;
|
||||
}
|
||||
else
|
||||
@@ -923,9 +931,9 @@ const ScPatternAttr* ScViewFunc::GetSelectionPattern()
|
||||
SCROW nRow = GetViewData().GetCurY();
|
||||
SCTAB nTab = GetViewData().GetTabNo();
|
||||
|
||||
ScMarkData aTempMark( rMark ); // copy sheet selection
|
||||
aTempMark.SetMarkArea( ScRange( nCol, nRow, nTab ) );
|
||||
const ScPatternAttr* pAttr = rDoc.GetSelectionPattern( aTempMark );
|
||||
// copy sheet selection
|
||||
aMark.SetMarkArea( ScRange( nCol, nRow, nTab ) );
|
||||
const ScPatternAttr* pAttr = rDoc.GetSelectionPattern( aMark );
|
||||
return pAttr;
|
||||
}
|
||||
}
|
||||
@@ -1181,11 +1189,14 @@ void ScViewFunc::ApplyPatternLines( const ScPatternAttr& rAttr, const SvxBoxItem
|
||||
StartFormatArea();
|
||||
}
|
||||
|
||||
// tdf#147842 if the marked area is the entire sheet, then shrink it to the data area.
|
||||
// Otherwise ctrl-A, perform-action, will take a very long time as it tries to modify
|
||||
// cells that we are not using.
|
||||
static void ShrinkToDataArea(ScMarkData& rFuncMark, ScDocument& rDoc)
|
||||
{
|
||||
// tdf#147842 if the marked area is the entire sheet, then shrink it to the data area.
|
||||
// Otherwise ctrl-A, perform-action, will take a very long time as it tries to modify
|
||||
// cells then we are not using.
|
||||
// do not make it marked if it is not already marked
|
||||
if (!rFuncMark.IsMarked())
|
||||
return;
|
||||
if (rFuncMark.IsMultiMarked())
|
||||
return;
|
||||
ScRange aMarkArea = rFuncMark.GetMarkArea();
|
||||
@@ -1217,8 +1228,7 @@ void ScViewFunc::ApplySelectionPattern( const ScPatternAttr& rAttr, bool bCursor
|
||||
ScDocShell* pDocSh = rViewData.GetDocShell();
|
||||
ScDocument& rDoc = pDocSh->GetDocument();
|
||||
ScMarkData aFuncMark( rViewData.GetMarkData() ); // local copy for UnmarkFiltered
|
||||
if (aFuncMark.IsMarked()) // do not make it marked if it is not already marked
|
||||
ShrinkToDataArea( aFuncMark, rDoc );
|
||||
ShrinkToDataArea( aFuncMark, rDoc );
|
||||
ScViewUtil::UnmarkFiltered( aFuncMark, rDoc );
|
||||
|
||||
bool bRecord = true;
|
||||
|
Reference in New Issue
Block a user