[Libreoffice-commits] core.git: Branch 'feature/tiled-editing' - include/svx sd/source svx/source

2015-03-30 Thread Miklos Vajna
 include/svx/sdr/table/tablecontroller.hxx |2 +-
 include/svx/selectioncontroller.hxx   |2 +-
 sd/source/ui/view/viewshel.cxx|   17 +++--
 svx/source/svdraw/selectioncontroller.cxx |3 ++-
 svx/source/table/tablecontroller.cxx  |   24 +---
 5 files changed, 28 insertions(+), 20 deletions(-)

New commits:
commit 077d0fa17f002d08376d415c04651892a4704617
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Mon Mar 30 16:20:13 2015 +0200

sd tiled rendering: support turning an editeng selection into a table one

With this, it's possible to drag the selection handle of an editeng
selection in an Impress table and drag it outside the table cell to
create an Impress table selection. Some unexpected graphic selection
still appears, though.

Change-Id: Ia7b36036ce2bda5cca570e8b6075238d5167090f

diff --git a/include/svx/sdr/table/tablecontroller.hxx 
b/include/svx/sdr/table/tablecontroller.hxx
index 6145dc4..b366a58 100644
--- a/include/svx/sdr/table/tablecontroller.hxx
+++ b/include/svx/sdr/table/tablecontroller.hxx
@@ -94,7 +94,7 @@ public:
 
 SVX_DLLPRIVATE virtual bool hasSelectedCells() const SAL_OVERRIDE { return 
mbCellSelectionMode || mpView-IsTextEdit(); }
 /// @see sdr::SelectionController::setCursorLogicPosition().
-SVX_DLLPRIVATE virtual void setCursorLogicPosition(const Point rPosition, 
bool bPoint) SAL_OVERRIDE;
+SVX_DLLPRIVATE virtual bool setCursorLogicPosition(const Point rPosition, 
bool bPoint) SAL_OVERRIDE;
 
 void getSelectedCells( CellPos rFirstPos, CellPos rLastPos );
 void setSelectedCells( const CellPos rFirstPos, const CellPos rLastPos );
diff --git a/include/svx/selectioncontroller.hxx 
b/include/svx/selectioncontroller.hxx
index 214ccd9..52bb9aa 100644
--- a/include/svx/selectioncontroller.hxx
+++ b/include/svx/selectioncontroller.hxx
@@ -72,7 +72,7 @@ public:
 /// This is a table object, and one or more of its cells are selected.
 virtual bool hasSelectedCells() const;
 /// Allows adjusting the point or mark of the selection to a document 
coordinate.
-virtual void setCursorLogicPosition(const Point rPosition, bool bPoint);
+virtual bool setCursorLogicPosition(const Point rPosition, bool bPoint);
 };
 
 }
diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx
index 4845178..541963e 100644
--- a/sd/source/ui/view/viewshel.cxx
+++ b/sd/source/ui/view/viewshel.cxx
@@ -536,17 +536,14 @@ void ViewShell::SetCursorLogicPosition(const Point 
rPosition, bool bPoint, bool
 {
 if (SdrView* pSdrView = GetView())
 {
-if (pSdrView-GetTextEditObject())
+rtl::Referencesdr::SelectionController 
xSelectionController(GetView()-getSelectionController());
+if (!xSelectionController.is() || 
!xSelectionController-setCursorLogicPosition(rPosition, bPoint))
 {
-EditView rEditView = 
pSdrView-GetTextEditOutlinerView()-GetEditView();
-rEditView.SetCursorLogicPosition(rPosition, bPoint, bClearMark);
-}
-else
-{
-// No text edit object, then try to adjust table selection.
-rtl::Referencesdr::SelectionController 
xSelectionController(GetView()-getSelectionController());
-if (xSelectionController.is())
-xSelectionController-setCursorLogicPosition(rPosition, 
bPoint);
+if (pSdrView-GetTextEditObject())
+{
+EditView rEditView = 
pSdrView-GetTextEditOutlinerView()-GetEditView();
+rEditView.SetCursorLogicPosition(rPosition, bPoint, 
bClearMark);
+}
 }
 }
 }
diff --git a/svx/source/svdraw/selectioncontroller.cxx 
b/svx/source/svdraw/selectioncontroller.cxx
index 6d84934..d8f7fbf 100644
--- a/svx/source/svdraw/selectioncontroller.cxx
+++ b/svx/source/svdraw/selectioncontroller.cxx
@@ -105,8 +105,9 @@ bool SelectionController::hasSelectedCells() const
 return false;
 }
 
-void SelectionController::setCursorLogicPosition(const Point /*rPosition*/, 
bool /*bPoint*/)
+bool SelectionController::setCursorLogicPosition(const Point /*rPosition*/, 
bool /*bPoint*/)
 {
+return false;
 }
 
 }
diff --git a/svx/source/table/tablecontroller.cxx 
b/svx/source/table/tablecontroller.cxx
index e487b06..496da15 100644
--- a/svx/source/table/tablecontroller.cxx
+++ b/svx/source/table/tablecontroller.cxx
@@ -3149,21 +3149,31 @@ bool SvxTableController::isColumnHeader()
 return aSettings.mbUseFirstColumn;
 }
 
-void SvxTableController::setCursorLogicPosition(const Point rPosition, bool 
bPoint)
+bool SvxTableController::setCursorLogicPosition(const Point rPosition, bool 
bPoint)
 {
 if (mxTableObj-GetObjIdentifier() != OBJ_TABLE)
-return;
+return false;
 
 SdrTableObj* pTableObj = static_castSdrTableObj*(mxTableObj.get());
 CellPos aCellPos;
 if (pTableObj-CheckTableHit(rPosition, aCellPos.mnCol, aCellPos.mnRow, 0) 
!= 

[Libreoffice-commits] core.git: Branch 'feature/tiled-editing' - include/svx sd/source svx/source

2015-02-20 Thread Miklos Vajna
 include/svx/svdmodel.hxx |7 +++
 sd/source/ui/inc/ViewShell.hxx   |9 -
 sd/source/ui/unoidl/unomodel.cxx |2 +-
 sd/source/ui/view/sdwindow.cxx   |2 +-
 sd/source/ui/view/viewshel.cxx   |   14 --
 svx/source/svdraw/svdmodel.cxx   |   14 ++
 6 files changed, 23 insertions(+), 25 deletions(-)

New commits:
commit 2cf3cb5905cc3458bcba1fe2718a94053dd9b06c
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Fri Feb 20 14:51:06 2015 +0100

sd::ViewShell - SdrModel for LOK callback

One one hand, this fixes missing invalidations after typing characters
in editeng on Android. Previously it was assumed that there is only one
sd::ViewShell for one Impress document, but that's obviously not true.

On the other hand, this will be handy when later svx code wants to
invoke the LOK callback as well, when it was stored in sd, that wasn't
possible.

Change-Id: Id467be01ad008aecaaabdd85b2a6b29a14f1eb86

diff --git a/include/svx/svdmodel.hxx b/include/svx/svdmodel.hxx
index cdad8a1..e5f1ffb 100644
--- a/include/svx/svdmodel.hxx
+++ b/include/svx/svdmodel.hxx
@@ -37,6 +37,7 @@
 #include svx/xtable.hxx
 #include svx/pageitem.hxx
 #include vcl/field.hxx
+#include vcl/ITiledRenderable.hxx
 
 #include boost/shared_ptr.hpp
 
@@ -173,6 +174,8 @@ protected:
 OutputDevice*   pRefOutDev; // ReferenceDevice for the EditEngine
 /// Set if we are doing tiled rendering.
 bool mbTiledRendering;
+LibreOfficeKitCallback mpLibreOfficeKitCallback;
+void* mpLibreOfficeKitData;
 sal_uIntPtr   nProgressAkt;   // for the
 sal_uIntPtr   nProgressMax;   // ProgressBar-
 sal_uIntPtr   nProgressOfs;   // -Handler
@@ -340,6 +343,10 @@ public:
 void setTiledRendering(bool bTiledRendering);
 /// Are we doing tiled rendering?
 bool isTiledRendering() const;
+/// The actual implementation of the 
vcl::ITiledRenderable::registerCallback() API.
+void registerLibreOfficeKitCallback(LibreOfficeKitCallback pCallback, 
void* pLibreOfficeKitData);
+/// Invokes the registered callback, if there are any.
+void libreOfficeKitCallback(int nType, const char* pPayload) const;
 // If a new MapMode is set on the RefDevice (or similar)
 void RefDeviceChanged(); // not yet implemented
 // default font heigth in logical units
diff --git a/sd/source/ui/inc/ViewShell.hxx b/sd/source/ui/inc/ViewShell.hxx
index e5f082c..b4bd333 100644
--- a/sd/source/ui/inc/ViewShell.hxx
+++ b/sd/source/ui/inc/ViewShell.hxx
@@ -23,7 +23,6 @@
 #include rtl/ref.hxx
 
 #include vcl/field.hxx
-#include vcl/ITiledRenderable.hxx
 #include sfx2/viewsh.hxx
 #include vcl/prntypes.hxx
 #include svtools/transfer.hxx
@@ -444,11 +443,6 @@ public:
 SdPage* pPage,
 const sal_Int32 nInsertPosition = -1);
 
-/// The actual implementation of the 
vcl::ITiledRenderable::registerCallback() API for Impress.
-void registerLibreOfficeKitCallback(LibreOfficeKitCallback pCallback, 
void* pLibreOfficeKitData);
-/// Invokes the registered callback, if there are any.
-void libreOfficeKitCallback(int nType, const char* pPayload) const;
-
 class Implementation;
 
 protected:
@@ -582,9 +576,6 @@ private:
 /** Create the rulers.
 */
 void SetupRulers (void);
-
-LibreOfficeKitCallback mpLibreOfficeKitCallback;
-void* mpLibreOfficeKitData;
 };
 
 SdrView* ViewShell::GetDrawView (void) const
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index e939d3b..7193fbc 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -2358,7 +2358,7 @@ void SdXImpressDocument::initializeForTiledRendering()
 void SdXImpressDocument::registerCallback(LibreOfficeKitCallback pCallback, 
void* pData)
 {
 SolarMutexGuard aGuard;
-mpDocShell-GetViewShell()-registerLibreOfficeKitCallback(pCallback, 
pData);
+mpDoc-registerLibreOfficeKitCallback(pCallback, pData);
 }
 
 uno::Reference i18n::XForbiddenCharacters  
SdXImpressDocument::getForbiddenCharsTable()
diff --git a/sd/source/ui/view/sdwindow.cxx b/sd/source/ui/view/sdwindow.cxx
index 8222f38..076cba5 100644
--- a/sd/source/ui/view/sdwindow.cxx
+++ b/sd/source/ui/view/sdwindow.cxx
@@ -992,7 +992,7 @@ void Window::LogicInvalidate(const ::vcl::Region* pRegion)
 sRectangle = EMPTY;
 else
 sRectangle = pRegion-GetBoundRect().toString();
-mpViewShell-libreOfficeKitCallback(LOK_CALLBACK_INVALIDATE_TILES, 
sRectangle.getStr());
+
mpViewShell-GetDoc()-libreOfficeKitCallback(LOK_CALLBACK_INVALIDATE_TILES, 
sRectangle.getStr());
 }
 
 } // end of namespace sd
diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx
index f728131..83dc9ca 100644
--- a/sd/source/ui/view/viewshel.cxx
+++ b/sd/source/ui/view/viewshel.cxx
@@ -137,8 +137,6 @@ ViewShell::ViewShell( SfxViewFrame*, vcl::Window* 
pParentWindow, ViewShellBase