sc tiled editing: Make the selections work with zoom too.
Change-Id: I22d95fb2328acb81b8ece45e140da4094fc10026
This commit is contained in:
committed by
Miklos Vajna
parent
7fa8f72a17
commit
0bc8e678a1
@@ -5745,38 +5745,44 @@ void ScGridWindow::UpdateCopySourceOverlay()
|
|||||||
SetMapMode( aOldMode );
|
SetMapMode( aOldMode );
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Turn the selection ranges rRanges into the LibreOfficeKit selection, and call the callback.
|
/// Turn the selection ranges rRectangles into the LibreOfficeKit selection, and call the callback.
|
||||||
static void updateLibreOfficeKitSelection(ScDrawLayer* pDrawLayer, const std::vector<basegfx::B2DRange>& rRanges)
|
static void updateLibreOfficeKitSelection(ScViewData* pViewData, ScDrawLayer* pDrawLayer, const std::vector<Rectangle>& rRectangles)
|
||||||
{
|
{
|
||||||
if (!pDrawLayer->isTiledRendering())
|
if (!pDrawLayer->isTiledRendering())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
basegfx::B2DRange aBoundingBox;
|
double nPPTX = pViewData->GetPPTX();
|
||||||
|
double nPPTY = pViewData->GetPPTY();
|
||||||
|
|
||||||
|
Rectangle aBoundingBox;
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
|
|
||||||
bool bIsFirst = true;
|
bool bIsFirst = true;
|
||||||
for (const auto& rRange : rRanges)
|
for (auto aRectangle : rRectangles)
|
||||||
{
|
{
|
||||||
aBoundingBox.expand(rRange);
|
aRectangle.Right() += 1;
|
||||||
|
aRectangle.Bottom() += 1;
|
||||||
|
|
||||||
|
aBoundingBox.Union(aRectangle);
|
||||||
|
|
||||||
if (bIsFirst)
|
if (bIsFirst)
|
||||||
bIsFirst = false;
|
bIsFirst = false;
|
||||||
else
|
else
|
||||||
ss << "; ";
|
ss << "; ";
|
||||||
|
|
||||||
Rectangle aRect(rRange.getMinX() / HMM_PER_TWIPS, rRange.getMinY() / HMM_PER_TWIPS,
|
Rectangle aRect(aRectangle.Left() / nPPTX, aRectangle.Top() / nPPTY,
|
||||||
rRange.getMaxX() / HMM_PER_TWIPS, rRange.getMaxY() / HMM_PER_TWIPS);
|
aRectangle.Right() / nPPTX, aRectangle.Bottom() / nPPTY);
|
||||||
ss << aRect.toString().getStr();
|
ss << aRect.toString().getStr();
|
||||||
}
|
}
|
||||||
|
|
||||||
// selection start handle
|
// selection start handle
|
||||||
Rectangle aStart(aBoundingBox.getMinX() / HMM_PER_TWIPS, aBoundingBox.getMinY() / HMM_PER_TWIPS,
|
Rectangle aStart(aBoundingBox.Left() / nPPTX, aBoundingBox.Top() / nPPTY,
|
||||||
aBoundingBox.getMinX() / HMM_PER_TWIPS, (aBoundingBox.getMinY() / HMM_PER_TWIPS) + 256);
|
aBoundingBox.Left() / nPPTX, (aBoundingBox.Top() / nPPTY) + 256);
|
||||||
pDrawLayer->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION_START, aStart.toString().getStr());
|
pDrawLayer->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION_START, aStart.toString().getStr());
|
||||||
|
|
||||||
// selection end handle
|
// selection end handle
|
||||||
Rectangle aEnd(aBoundingBox.getMaxX() / HMM_PER_TWIPS, (aBoundingBox.getMaxY() / HMM_PER_TWIPS) - 256,
|
Rectangle aEnd(aBoundingBox.Right() / nPPTX, (aBoundingBox.Bottom() / nPPTY) - 256,
|
||||||
aBoundingBox.getMaxX() / HMM_PER_TWIPS, aBoundingBox.getMaxY() / HMM_PER_TWIPS);
|
aBoundingBox.Right() / nPPTX, aBoundingBox.Bottom() / nPPTY);
|
||||||
pDrawLayer->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION_END, aEnd.toString().getStr());
|
pDrawLayer->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION_END, aEnd.toString().getStr());
|
||||||
|
|
||||||
// the selection itself
|
// the selection itself
|
||||||
@@ -5938,7 +5944,7 @@ void ScGridWindow::UpdateCursorOverlay()
|
|||||||
// (once for the cell only, and then for the selection)
|
// (once for the cell only, and then for the selection)
|
||||||
if (!pViewData->GetMarkData().IsMarked() && !pViewData->GetMarkData().IsMultiMarked())
|
if (!pViewData->GetMarkData().IsMarked() && !pViewData->GetMarkData().IsMultiMarked())
|
||||||
{
|
{
|
||||||
updateLibreOfficeKitSelection(pDoc->GetDrawLayer(), aRanges);
|
updateLibreOfficeKitSelection(pViewData, pDoc->GetDrawLayer(), aPixelRects);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -6008,7 +6014,7 @@ void ScGridWindow::UpdateSelectionOverlay()
|
|||||||
mpOOSelection->append(*pOverlay);
|
mpOOSelection->append(*pOverlay);
|
||||||
|
|
||||||
// notify the LibreOfficeKit too
|
// notify the LibreOfficeKit too
|
||||||
updateLibreOfficeKitSelection(pDoc->GetDrawLayer(), aRanges);
|
updateLibreOfficeKitSelection(pViewData, pDoc->GetDrawLayer(), aPixelRects);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user