summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2013-10-22 01:06:56 +0300
committerTor Lillqvist <tml@collabora.com>2013-10-22 01:10:41 +0300
commit657a3a81828216240b6ff31377d62ca17e656368 (patch)
tree5729af9bbbd63c5d729ad183b14d52065d70fffa /sw
parent36fb29338bbe2f3013ccedd244043e510b9ba0c1 (diff)
Try to handle selection resizing in a more "correct" way
Faking mouse clicks is a stupid way to do it of course. Try to do it "right". For now just worked on moving the end handle, but once that works, similar code should be used for the start handle, too. Does not work yet. It is hard to extract out from SwEditWin::MouseButtonDown() exactly what all is relevant, and what isn't, for this use case. Change-Id: I76a226f787facbac645aaff8b4852d693bcf4ccb
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/crsr/viscrs.cxx22
-rw-r--r--sw/source/ui/docvw/edtwin.cxx32
2 files changed, 46 insertions, 8 deletions
diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx
index ab2e2f863b88..e08501961de7 100644
--- a/sw/source/core/crsr/viscrs.cxx
+++ b/sw/source/core/crsr/viscrs.cxx
@@ -37,6 +37,7 @@
#include <ndtxt.hxx>
#include <scriptinfo.hxx>
#include <mdiexp.hxx>
+#include <wrtsh.hxx>
#include <comcore.hrc>
#include <svx/sdr/overlay/overlaymanager.hxx>
@@ -272,16 +273,21 @@ void SwSelPaintRects::Show()
const OutputDevice* pOut = GetShell()->GetWin();
if ( ! pOut )
pOut = GetShell()->GetOut();
- // Buffer will be deallocated in the UI layer
- CGRect *rects = (CGRect *) malloc((sizeof(CGRect))*size());
- for (size_t i = 0; i < size(); ++i)
+ SwWrtShell *pWrtShell = dynamic_cast<SwWrtShell*>(const_cast<SwCrsrShell*>(GetShell()));
+ if ( pWrtShell )
{
- Point origin = pOut->LogicToPixel((*this)[i].Pos());
- Size size = pOut->LogicToPixel((*this)[i].SSize());
- rects[i] = CGRectMake(origin.X(), origin.Y(),
- size.Width(), size.Height());
+ // Buffer will be deallocated in the UI layer
+ CGRect *rects = (CGRect *) malloc((sizeof(CGRect))*size());
+ for (size_t i = 0; i < size(); ++i)
+ {
+ Point origin = pOut->LogicToPixel((*this)[i].Pos());
+ Size size = pOut->LogicToPixel((*this)[i].SSize());
+ rects[i] = CGRectMake(origin.X(), origin.Y(),
+ size.Width(), size.Height());
+ }
+ // GetShell returns a SwCrsrShell which actually is a SwWrtShell
+ touch_ui_selection_start(MLOSelectionText, pWrtShell, rects, size(), NULL);
}
- touch_ui_selection_start(MLOSelectionText, GetShell(), rects, size(), NULL);
#else
// Not yet implemented
#endif
diff --git a/sw/source/ui/docvw/edtwin.cxx b/sw/source/ui/docvw/edtwin.cxx
index 6bc42f15ebc6..9ced231648c3 100644
--- a/sw/source/ui/docvw/edtwin.cxx
+++ b/sw/source/ui/docvw/edtwin.cxx
@@ -17,6 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <config_features.h>
#include <swtypes.hxx>
#include <hintids.hxx>
@@ -66,6 +67,8 @@
#include <basegfx/color/bcolortools.hxx>
#include <basegfx/polygon/b2dpolygon.hxx>
+#include <touch/touch-impl.h>
+
#include <editeng/acorrcfg.hxx>
#include <SwSmartTagMgr.hxx>
#include <edtwin.hxx>
@@ -2683,6 +2686,35 @@ static bool lcl_urlOverBackground(SwWrtShell& rSh, const Point& rDocPos)
return rSh.GetContentAtPos(rDocPos, aSwContentAtPos) && pSelectableObj->GetLayer() == rSh.GetDoc()->GetHellId();
}
+#if !HAVE_FEATURE_DESKTOP
+
+void touch_lo_selection_end_move_impl(const void *documentHandle,
+ int x,
+ int y)
+{
+ SwWrtShell *pWrtShell = reinterpret_cast<SwWrtShell*>(const_cast<void*>(documentHandle));
+
+ if (!pWrtShell)
+ return;
+
+ const OutputDevice *pOut = pWrtShell->GetWin();
+ if (!pOut)
+ pOut = pWrtShell->GetOut();
+
+ const Point aDocPos( pOut->PixelToLogic( Point(x, y) ) );
+
+ // SAL _ DEBUG("touch_lo_selection_end_move_impl: " << Point(x, y) << " => " << aDocPos);
+
+ pWrtShell->ChgCurrPam( aDocPos );
+
+ {
+ SwMvContext aMvContext( pWrtShell );
+ pWrtShell->SetCursor( &aDocPos, sal_False );
+ }
+}
+
+#endif
+
void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt)
{
SwWrtShell &rSh = m_rView.GetWrtShell();