[Libreoffice-commits] core.git: Branch 'feature/tiled-editing' - 5 commits - sd/source svx/source
Miklos Vajna
vmiklos at collabora.co.uk
Tue Mar 24 08:53:43 PDT 2015
sd/source/ui/func/fusel.cxx | 7 +++++++
sd/source/ui/inc/ViewShell.hxx | 2 ++
sd/source/ui/inc/fupoor.hxx | 2 ++
sd/source/ui/inc/unomodel.hxx | 2 ++
sd/source/ui/unoidl/unomodel.cxx | 23 +++++++++++++++++++++++
sd/source/ui/view/viewshel.cxx | 18 ++++++++++++++++++
svx/source/sdr/overlay/overlayobjectlist.cxx | 6 +++++-
svx/source/svdraw/svdmrkv.cxx | 13 +++++++------
svx/source/svdraw/svdobj.cxx | 1 +
9 files changed, 67 insertions(+), 7 deletions(-)
New commits:
commit e9ba0ac14d64a7570fcbb4804d97922157913c87
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Tue Mar 24 16:45:36 2015 +0100
SdXImpressDocument: implement setGraphicSelection()
With this, it's possible to resize an Impress shape.
Change-Id: I6d81aee71853092a02bfad414fb107b514556247
diff --git a/sd/source/ui/inc/ViewShell.hxx b/sd/source/ui/inc/ViewShell.hxx
index 767a113..89bd8e6 100644
--- a/sd/source/ui/inc/ViewShell.hxx
+++ b/sd/source/ui/inc/ViewShell.hxx
@@ -449,6 +449,8 @@ public:
void LogicMouseButtonUp(const MouseEvent& rMouseEvent);
/// Allows adjusting the point or mark of the selection to a document coordinate.
void SetCursorLogicPosition(const Point& rPosition, bool bPoint, bool bClearMark);
+ /// Allows starting or ending a graphic move or resize action.
+ void SetGraphicLogicPosition(bool bStart, const Point& rPosition);
class Implementation;
diff --git a/sd/source/ui/inc/unomodel.hxx b/sd/source/ui/inc/unomodel.hxx
index 7641e11..fe5679b 100644
--- a/sd/source/ui/inc/unomodel.hxx
+++ b/sd/source/ui/inc/unomodel.hxx
@@ -248,6 +248,8 @@ public:
virtual void postMouseEvent(int nType, int nX, int nY, int nCount) SAL_OVERRIDE;
/// @see vcl::ITiledRenderable::setTextSelection().
virtual void setTextSelection(int nType, int nX, int nY) SAL_OVERRIDE;
+ /// @see vcl::ITiledRenderable::setGraphicSelection().
+ virtual void setGraphicSelection(int nType, int nX, int nY) SAL_OVERRIDE;
// XComponent
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index 4d32ced..4305b9b 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -2428,6 +2428,29 @@ void SdXImpressDocument::setTextSelection(int nType, int nX, int nY)
}
}
+void SdXImpressDocument::setGraphicSelection(int nType, int nX, int nY)
+{
+ SolarMutexGuard aGuard;
+
+ DrawViewShell* pViewShell = GetViewShell();
+ if (!pViewShell)
+ return;
+
+ Point aPoint(convertTwipToMm100(nX), convertTwipToMm100(nY));
+ switch (nType)
+ {
+ case LOK_SETGRAPHICSELECTION_START:
+ pViewShell->SetGraphicLogicPosition(/*bStart=*/true, aPoint);
+ break;
+ case LOK_SETGRAPHICSELECTION_END:
+ pViewShell->SetGraphicLogicPosition(/*bStart=*/false, aPoint);
+ break;
+ default:
+ assert(false);
+ break;
+ }
+}
+
uno::Reference< i18n::XForbiddenCharacters > SdXImpressDocument::getForbiddenCharsTable()
{
uno::Reference< i18n::XForbiddenCharacters > xForb(mxForbidenCharacters);
diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx
index 9bbf61d..ed34e5f 100644
--- a/sd/source/ui/view/viewshel.cxx
+++ b/sd/source/ui/view/viewshel.cxx
@@ -544,6 +544,24 @@ void ViewShell::SetCursorLogicPosition(const Point& rPosition, bool bPoint, bool
}
}
+void ViewShell::SetGraphicLogicPosition(bool bStart, const Point& rPosition)
+{
+ if (bStart)
+ {
+ MouseEvent aClickEvent(rPosition, 1, MouseEventModifiers::SIMPLECLICK, MOUSE_LEFT);
+ MouseButtonDown(aClickEvent, 0);
+ MouseEvent aMoveEvent(Point(rPosition.getX() + FuPoor::DRGLOG + 1, rPosition.getY()), 0, MouseEventModifiers::SIMPLEMOVE, MOUSE_LEFT);
+ MouseMove(aMoveEvent, 0);
+ }
+ else
+ {
+ MouseEvent aMoveEvent(Point(rPosition.getX() - FuPoor::DRGLOG - 1, rPosition.getY()), 0, MouseEventModifiers::SIMPLEMOVE, MOUSE_LEFT);
+ MouseMove(aMoveEvent, 0);
+ MouseEvent aClickEvent(rPosition, 1, MouseEventModifiers::SIMPLECLICK, MOUSE_LEFT);
+ MouseButtonUp(aClickEvent, 0);
+ }
+}
+
void ViewShell::MouseMove(const MouseEvent& rMEvt, ::sd::Window* pWin)
{
if (rMEvt.IsLeaveWindow())
commit 7013b6f33ce9bfa9487a7aa01e4c9a4987f141e3
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Tue Mar 24 16:41:18 2015 +0100
sd tiled rendering: increase hit testing tolerance
Change-Id: Ibab0aeb6b9b605d1cc964e7858404b1e0919fc10
diff --git a/sd/source/ui/func/fusel.cxx b/sd/source/ui/func/fusel.cxx
index 0cb164d..e4c42a5 100644
--- a/sd/source/ui/func/fusel.cxx
+++ b/sd/source/ui/func/fusel.cxx
@@ -155,6 +155,13 @@ bool FuSelection::MouseButtonDown(const MouseEvent& rMEvt)
sal_uInt16 nDrgLog = sal_uInt16 ( mpWindow->PixelToLogic(Size(DRGPIX,0)).Width() );
sal_uInt16 nHitLog = sal_uInt16 ( mpWindow->PixelToLogic(Size(HITPIX,0)).Width() );
+ if (mpDoc->isTiledRendering())
+ {
+ // When tiled rendering, we always work in logic units, use the non-pixel constants.
+ nDrgLog = DRGLOG;
+ nHitLog = HITLOG;
+ }
+
// The following code is executed for right clicks as well as for left
// clicks in order to modify the selection for the right button as a
// preparation for the context menu. The functions BegMarkObject() and
diff --git a/sd/source/ui/inc/fupoor.hxx b/sd/source/ui/inc/fupoor.hxx
index 7e7a0c6..00817a7 100644
--- a/sd/source/ui/inc/fupoor.hxx
+++ b/sd/source/ui/inc/fupoor.hxx
@@ -48,7 +48,9 @@ class FuPoor : public SimpleReferenceComponent
{
public:
static const int HITPIX = 2; // Hit-Toleranz in Pixel
+ static const int HITLOG = 53; // Hit tolerance in mm100
static const int DRGPIX = 2; // Drag MinMove in Pixel
+ static const int DRGLOG = 53; // Minimal drag move in mm100
TYPEINFO();
commit 0358100e1ecda99e2836643cc9e63ff1674d3dfe
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Tue Mar 24 16:17:48 2015 +0100
svx tiled rendering: grow hittest size when map mode is in mm100
Change-Id: I908b7a5687e49f8cc9ec7e6ca333fe7cab84fcfd
diff --git a/svx/source/sdr/overlay/overlayobjectlist.cxx b/svx/source/sdr/overlay/overlayobjectlist.cxx
index 3a6805d..484f645 100644
--- a/svx/source/sdr/overlay/overlayobjectlist.cxx
+++ b/svx/source/sdr/overlay/overlayobjectlist.cxx
@@ -76,9 +76,13 @@ namespace sdr
Size aSizeLogic(pManager->getOutputDevice().PixelToLogic(
Size(DEFAULT_VALUE_FOR_HITTEST_PIXEL, DEFAULT_VALUE_FOR_HITTEST_PIXEL)));
- // When tiled rendering, we always work in twips, use the non-pixel default.
+ // When tiled rendering, we always work in logic units, use the non-pixel default.
if (pManager->getModel()->isTiledRendering())
+ {
aSizeLogic = Size(DEFAULT_VALUE_FOR_HITTEST_TWIP, DEFAULT_VALUE_FOR_HITTEST_TWIP);
+ if (pManager->getOutputDevice().GetMapMode().GetMapUnit() == MAP_100TH_MM)
+ aSizeLogic = OutputDevice::LogicToLogic(aSizeLogic, MAP_TWIP, MAP_100TH_MM);
+ }
fLogicTolerance = aSizeLogic.Width();
}
commit ce71f7756c5148002d4edbf5aef342f43a31ef65
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Tue Mar 24 16:04:55 2015 +0100
SdrMarkView::SetMarkHandles: perform the mm100 -> twip conversion on a copy
Otherwise the position of the mark handles will depend on if we do tiled
rendering or not, which is not wanted.
Change-Id: Id415aa75977bb0224866ad0defc3c256357c366f
diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx
index eda88b5..9376df5 100644
--- a/svx/source/svdraw/svdmrkv.cxx
+++ b/svx/source/svdraw/svdmrkv.cxx
@@ -706,9 +706,10 @@ void SdrMarkView::SetMarkHandles()
if (GetModel()->isTiledRendering())
{
- OString sRectangle;
- if (aRect.IsEmpty())
- sRectangle = "EMPTY";
+ Rectangle aSelection(aRect);
+ OString sSelection;
+ if (aSelection.IsEmpty())
+ sSelection = "EMPTY";
else
{
// In case the map mode is in 100th MM, then need to convert the coordinates over to twips for LOK.
@@ -717,13 +718,13 @@ void SdrMarkView::SetMarkHandles()
if (OutputDevice* pOutputDevice = pMarkedPV->GetView().GetFirstOutputDevice())
{
if (pOutputDevice->GetMapMode().GetMapUnit() == MAP_100TH_MM)
- aRect = OutputDevice::LogicToLogic(aRect, MAP_100TH_MM, MAP_TWIP);
+ aSelection = OutputDevice::LogicToLogic(aSelection, MAP_100TH_MM, MAP_TWIP);
}
}
- sRectangle = aRect.toString();
+ sSelection = aSelection.toString();
}
- GetModel()->libreOfficeKitCallback(LOK_CALLBACK_GRAPHIC_SELECTION, sRectangle.getStr());
+ GetModel()->libreOfficeKitCallback(LOK_CALLBACK_GRAPHIC_SELECTION, sSelection.getStr());
}
if (bFrmHdl)
commit 89cdc6cf52307ee0702b20832eacd87ce1f643b1
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Tue Mar 24 16:04:07 2015 +0100
SdrObject::dumpAsXml: show bounding rectangle
Change-Id: I15e7d9645ce97a1014e0e74c116aebeb2e3a9ab7
diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx
index 9897ad8..ffbec1e 100644
--- a/svx/source/svdraw/svdobj.cxx
+++ b/svx/source/svdraw/svdobj.cxx
@@ -1817,6 +1817,7 @@ void SdrObject::dumpAsXml(xmlTextWriterPtr pWriter) const
xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("title"), "%s", BAD_CAST(GetTitle().toUtf8().getStr()));
xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("description"), "%s", BAD_CAST(GetDescription().toUtf8().getStr()));
xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("nOrdNum"), "%" SAL_PRIuUINT32, GetOrdNumDirect());
+ xmlTextWriterWriteAttribute(pWriter, BAD_CAST("aOutRect"), BAD_CAST(aOutRect.toString().getStr()));
if (const OutlinerParaObject* pOutliner = GetOutlinerParaObject())
pOutliner->dumpAsXml(pWriter);
More information about the Libreoffice-commits
mailing list