summaryrefslogtreecommitdiff
path: root/svx/source/svdraw/svdmrkv.cxx
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2019-08-26 20:07:12 +0900
committerTomaž Vajngerl <quikee@gmail.com>2019-08-30 03:58:03 +0200
commit0285492a45e9cc19c26e14dcdf297bcc491da4d2 (patch)
tree99be93079240d29990b59b7f50c30777d67e4efa /svx/source/svdraw/svdmrkv.cxx
parent5735a2ce6941264e90f6b0593c54f661291d4987 (diff)
tdf#126959 impress table border resize handle support
This adds support to edit the resize handles for the impress. It includes: - sending the positions of handles when table object is selected or changed - a implementaton of SID_TABLE_CHANGE_CURRENT_BORDER_POSITION to perform the changing of the border positions of a table Change-Id: I6f60822c5cd9afc3be5c48ea7b775f1860bfa5a7 Reviewed-on: https://gerrit.libreoffice.org/78201 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'svx/source/svdraw/svdmrkv.cxx')
-rw-r--r--svx/source/svdraw/svdmrkv.cxx68
1 files changed, 41 insertions, 27 deletions
diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx
index e49a00817582..4acee37ada36 100644
--- a/svx/source/svdraw/svdmrkv.cxx
+++ b/svx/source/svdraw/svdmrkv.cxx
@@ -24,6 +24,7 @@
#include <svx/svdview.hxx>
#include <svx/svdpagv.hxx>
#include <svx/svdpage.hxx>
+#include <svx/svdotable.hxx>
#include "svddrgm1.hxx"
#ifdef DBG_UTIL
@@ -46,6 +47,7 @@
#include <svx/svdovirt.hxx>
#include <sdr/overlay/overlayrollingrectangle.hxx>
#include <svx/sdr/overlay/overlaymanager.hxx>
+#include <svx/sdr/table/tablecontroller.hxx>
#include <svx/sdr/contact/viewcontact.hxx>
#include <svx/sdrpaintwindow.hxx>
#include <svx/sdrpagewindow.hxx>
@@ -739,7 +741,7 @@ void SdrMarkView::SetMarkHandles(SfxViewShell* pOtherShell)
}
SfxViewShell* pViewShell = GetSfxViewShell();
-
+ bool bIsInTextEditMode = false;
// check if text edit or ole is active and handles need to be suppressed. This may be the case
// when a single object is selected
// Using a strict return statement is okay here; no handles means *no* handles.
@@ -755,18 +757,12 @@ void SdrMarkView::SetMarkHandles(SfxViewShell* pOtherShell)
{
const SdrTextObj* pSdrTextObj = dynamic_cast< const SdrTextObj* >(mpMarkedObj);
- if(pSdrTextObj && pSdrTextObj->IsInEditMode())
+ if (pSdrTextObj && pSdrTextObj->IsInEditMode())
{
if (bTiledRendering)
- {
- // Suppress handles -> empty graphic selection.
- if (pViewShell)
- {
- pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_GRAPHIC_SELECTION, "EMPTY");
- SfxLokHelper::notifyOtherViews(pViewShell, LOK_CALLBACK_GRAPHIC_VIEW_SELECTION, "selection", "EMPTY");
- }
- }
- return;
+ bIsInTextEditMode = true;
+ else
+ return;
}
}
@@ -777,21 +773,6 @@ void SdrMarkView::SetMarkHandles(SfxViewShell* pOtherShell)
{
return;
}
-
- if (bTiledRendering && mpMarkedObj->GetObjIdentifier() == OBJ_TABLE)
- {
- rtl::Reference<sdr::SelectionController> xController = static_cast<SdrView*>(this)->getSelectionController();
- if (xController.is() && xController->hasSelectedCells())
- {
- // The table shape has selected cells, which provide text selection already -> no graphic selection.
- if (pViewShell)
- {
- pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_GRAPHIC_SELECTION, "EMPTY");
- SfxLokHelper::notifyOtherViews(pViewShell, LOK_CALLBACK_GRAPHIC_VIEW_SELECTION, "selection", "EMPTY");
- }
- return;
- }
- }
}
tools::Rectangle aRect(GetMarkedObjRect());
@@ -839,7 +820,22 @@ void SdrMarkView::SetMarkHandles(SfxViewShell* pOtherShell)
{
OString sSelectionText;
+ boost::property_tree::ptree aTableJsonTree;
+ bool bTableSelection = false;
+ bool bCellsAreSelected = false;
+
+ if (mpMarkedObj && mpMarkedObj->GetObjIdentifier() == OBJ_TABLE)
+ {
+ auto* pTableObject = dynamic_cast<sdr::table::SdrTableObj*>(mpMarkedObj);
+ bTableSelection = pTableObject->createTableEdgesJson(aTableJsonTree);
+ rtl::Reference<sdr::SelectionController> xController = static_cast<SdrView*>(this)->getSelectionController();
+ if (xController.is() && xController->hasSelectedCells())
+ {
+ // The table shape has selected cells, which provide text selection already -> no graphic selection.
+ bCellsAreSelected = true;
+ }
+ }
if (GetMarkedObjectCount())
{
SdrMark* pM = GetSdrMarkByIndex(0);
@@ -996,9 +992,27 @@ void SdrMarkView::SetMarkHandles(SfxViewShell* pOtherShell)
}
}
- if (sSelectionText.isEmpty())
+ if (sSelectionText.isEmpty() || bCellsAreSelected || bIsInTextEditMode)
sSelectionText = "EMPTY";
+ if (bTableSelection)
+ {
+ boost::property_tree::ptree aTableRectangle;
+ aTableRectangle.put("x", aSelection.Left());
+ aTableRectangle.put("y", aSelection.Top());
+ aTableRectangle.put("width", aSelection.GetWidth());
+ aTableRectangle.put("height", aSelection.GetHeight());
+ aTableJsonTree.push_back(std::make_pair("rectangle", aTableRectangle));
+
+ std::stringstream aStream;
+ boost::property_tree::write_json(aStream, aTableJsonTree);
+ pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TABLE_SELECTED, aStream.str().c_str());
+ }
+ else
+ {
+ pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TABLE_SELECTED, "{}");
+ }
+
if (pOtherShell)
{
// Another shell wants to know about our existing