Show highlight ranges when chart is selected

Change-Id: Ibb9a085699065869a7f122f37a36c5873b934271
Reviewed-on: https://gerrit.libreoffice.org/82138
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/82140
Tested-by: Jenkins
This commit is contained in:
Szymon Kłos
2019-06-17 20:13:36 +02:00
parent 72fad7a18d
commit e9131e7abd
5 changed files with 49 additions and 15 deletions

View File

@@ -425,9 +425,9 @@ handle_r1c1:
}
}
static ReferenceMark lcl_GetReferenceMark( const ScViewData& rViewData, ScDocShell* pDocSh,
long nX1, long nX2, long nY1, long nY2,
long nTab, const Color& rColor )
ReferenceMark ScInputHandler::GetReferenceMark( ScViewData& rViewData, ScDocShell* pDocSh,
long nX1, long nX2, long nY1, long nY2,
long nTab, const Color& rColor )
{
ScSplitPos eWhich = rViewData.GetActivePart();
@@ -486,7 +486,7 @@ void ScInputHandler::UpdateLokReferenceMarks()
PutInOrder(nX1, nX2);
PutInOrder(nY1, nY2);
aReferenceMarks[0] = lcl_GetReferenceMark( rViewData, pDocSh,
aReferenceMarks[0] = ScInputHandler::GetReferenceMark( rViewData, pDocSh,
nX1, nX2, nY1, nY2,
nTab, aRefColor );
}
@@ -510,8 +510,9 @@ void ScInputHandler::UpdateLokReferenceMarks()
long nY2 = aRef.aEnd.Row();
long nTab = aRef.aStart.Tab();
aReferenceMarks[i + nAdditionalMarks] = lcl_GetReferenceMark(
rViewData, pDocSh, nX1, nX2, nY1, nY2, nTab, rData.nColor );
aReferenceMarks[i + nAdditionalMarks] = ScInputHandler::GetReferenceMark( rViewData, pDocSh,
nX1, nX2, nY1, nY2,
nTab, rData.nColor );
ScInputHandler::SendReferenceMarks( pActiveViewSh, aReferenceMarks );
}

View File

@@ -30,6 +30,7 @@
#include <tools/link.hxx>
#include <vcl/vclptr.hxx>
#include <editeng/svxenum.hxx>
#include "viewdata.hxx"
#include <set>
#include <memory>
@@ -282,6 +283,10 @@ public:
void SetDocumentDisposing( bool b );
static void SetAutoComplete(bool bSet) { bAutoComplete = bSet; }
static ReferenceMark GetReferenceMark( ScViewData& rViewData, ScDocShell* pDocSh,
long nX1, long nX2, long nY1, long nY2,
long nTab, const Color& rColor );
};
// ScInputHdlState

View File

@@ -366,7 +366,7 @@ public:
void FindChanged();
void SetPagebreakMode( ScPageBreakData* pPageData );
/// Draws reference mark and returns its properties
ReferenceMark DrawRefMark( SCCOL nRefStartX, SCROW nRefStartY,
void DrawRefMark( SCCOL nRefStartX, SCROW nRefStartY,
SCCOL nRefEndX, SCROW nRefEndY,
const Color& rColor, bool bHandle );
ReferenceMark FillReferenceMark( SCCOL nRefStartX, SCROW nRefStartY,

View File

@@ -1970,12 +1970,10 @@ ReferenceMark ScOutputData::FillReferenceMark( SCCOL nRefStartX, SCROW nRefStart
return aResult;
}
ReferenceMark ScOutputData::DrawRefMark( SCCOL nRefStartX, SCROW nRefStartY,
void ScOutputData::DrawRefMark( SCCOL nRefStartX, SCROW nRefStartY,
SCCOL nRefEndX, SCROW nRefEndY,
const Color& rColor, bool bHandle )
{
ReferenceMark aResult;
PutInOrder( nRefStartX, nRefEndX );
PutInOrder( nRefStartY, nRefEndY );
@@ -2098,8 +2096,6 @@ ReferenceMark ScOutputData::DrawRefMark( SCCOL nRefStartX, SCROW nRefStartY,
}
}
}
return aResult;
}
void ScOutputData::DrawOneChange( SCCOL nRefStartX, SCROW nRefStartY,

View File

@@ -62,6 +62,7 @@
#include <formula/FormulaCompiler.hxx>
#include <comphelper/lok.hxx>
#include <LibreOfficeKit/LibreOfficeKitEnums.h>
#include <output.hxx>
#include <com/sun/star/chart2/data/HighlightedRange.hpp>
@@ -2531,6 +2532,9 @@ void ScTabView::DoChartSelection(
{
ClearHighlightRanges();
const sal_Unicode sep = ::formula::FormulaCompiler::GetNativeSymbolChar(ocSep);
size_t nSize = 0;
size_t nIndex = 0;
std::vector<ReferenceMark> aReferenceMarks( nSize );
for (chart2::data::HighlightedRange const & rHighlightedRange : rHilightRanges)
{
@@ -2541,16 +2545,44 @@ void ScTabView::DoChartSelection(
aRangeList, rHighlightedRange.RangeRepresentation, &rDoc, rDoc.GetAddressConvention(), sep ))
{
size_t nListSize = aRangeList.size();
nSize += nListSize;
aReferenceMarks.resize(nSize);
for ( size_t j = 0; j < nListSize; ++j )
{
ScRange const & r = aRangeList[j];
ScRange& p = aRangeList[j];
ScRange aTargetRange;
if( rHighlightedRange.Index == - 1 )
AddHighlightRange( r, aSelColor );
{
aTargetRange = p;
AddHighlightRange( aTargetRange, aSelColor );
}
else
AddHighlightRange( lcl_getSubRangeByIndex( r, rHighlightedRange.Index ), aSelColor );
{
aTargetRange = lcl_getSubRangeByIndex( p, rHighlightedRange.Index );
AddHighlightRange( aTargetRange, aSelColor );
}
if ( comphelper::LibreOfficeKit::isActive() && aViewData.GetViewShell() )
{
aTargetRange.PutInOrder();
long nX1 = aTargetRange.aStart.Col();
long nX2 = aTargetRange.aEnd.Col();
long nY1 = aTargetRange.aStart.Row();
long nY2 = aTargetRange.aEnd.Row();
long nTab = aTargetRange.aStart.Tab();
aReferenceMarks[nIndex++] = ScInputHandler::GetReferenceMark( aViewData, aViewData.GetDocShell(),
nX1, nX2, nY1, nY2,
nTab, aSelColor );
}
}
}
}
if ( comphelper::LibreOfficeKit::isActive() && aViewData.GetViewShell() )
ScInputHandler::SendReferenceMarks( aViewData.GetViewShell(), aReferenceMarks );
}
void ScTabView::DoDPFieldPopup(OUString const & rPivotTableName, sal_Int32 nDimensionIndex, Point aPoint, Size aSize)