summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2013-10-18 15:15:29 +0300
committerTor Lillqvist <tml@collabora.com>2013-10-18 15:45:20 +0300
commit24f8446c9e7d1a0ea01cc11ca87abf85ba43342d (patch)
treec307f5c3eb4730d6776b974dd0dff8f91d7149e9 /sw
parent359472b2b50165966c27c239eccd3ecfb03e2acc (diff)
Work in progress: Text selection handling for iOS
Change-Id: I31c6bcb9a4b26653d439601f78d71fd94d938eeb
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/viscrs.hxx4
-rw-r--r--sw/source/core/crsr/viscrs.cxx45
2 files changed, 47 insertions, 2 deletions
diff --git a/sw/inc/viscrs.hxx b/sw/inc/viscrs.hxx
index a38fc3e257bc..aef159dc2f3e 100644
--- a/sw/inc/viscrs.hxx
+++ b/sw/inc/viscrs.hxx
@@ -19,6 +19,8 @@
#ifndef _VISCRS_HXX
#define _VISCRS_HXX
+#include <config_features.h>
+
#include <vcl/cursor.hxx>
#include "swcrsr.hxx"
#include "swrect.hxx"
@@ -71,11 +73,13 @@ class SwSelPaintRects : public SwRects
virtual void Paint( const Rectangle& rRect );
virtual void FillRects() = 0;
+#if HAVE_FEATURE_DESKTOP
sdr::overlay::OverlayObject* mpCursorOverlay;
// access to mpCursorOverlay for swapContent
sdr::overlay::OverlayObject* getCursorOverlay() const { return mpCursorOverlay; }
void setCursorOverlay(sdr::overlay::OverlayObject* pNew) { mpCursorOverlay = pNew; }
+#endif
public:
SwSelPaintRects( const SwCrsrShell& rCSh );
diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx
index 8f73dc9cd68d..a369f65778b2 100644
--- a/sw/source/core/crsr/viscrs.cxx
+++ b/sw/source/core/crsr/viscrs.cxx
@@ -17,6 +17,8 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <config_features.h>
+
#include <vcl/dialog.hxx>
#include <vcl/msgbox.hxx>
#include <vcl/wrkwin.hxx>
@@ -42,6 +44,8 @@
#include <vcl/svapp.hxx>
#include <svx/sdr/overlay/overlayselection.hxx>
+#include <touch/touch.h>
+
extern void SwCalcPixStatics( OutputDevice *pOut );
// Here static members are defined. They will get changed on alteration of the
@@ -184,8 +188,10 @@ void SwVisCrsr::_SetPosAndShow()
SwSelPaintRects::SwSelPaintRects( const SwCrsrShell& rCSh )
: SwRects(),
- pCShell( &rCSh ),
- mpCursorOverlay(0)
+ pCShell( &rCSh )
+#if HAVE_FEATURE_DESKTOP
+ , mpCursorOverlay(0)
+#endif
{
}
@@ -198,19 +204,23 @@ void SwSelPaintRects::swapContent(SwSelPaintRects& rSwap)
{
SwRects::swap(rSwap);
+#if HAVE_FEATURE_DESKTOP
// #i75172# also swap mpCursorOverlay
sdr::overlay::OverlayObject* pTempOverlay = getCursorOverlay();
setCursorOverlay(rSwap.getCursorOverlay());
rSwap.setCursorOverlay(pTempOverlay);
+#endif
}
void SwSelPaintRects::Hide()
{
+#if HAVE_FEATURE_DESKTOP
if(mpCursorOverlay)
{
delete mpCursorOverlay;
mpCursorOverlay = 0;
}
+#endif
SwRects::clear();
}
@@ -225,6 +235,7 @@ void SwSelPaintRects::Show()
SwRects::clear();
FillRects();
+#if HAVE_FEATURE_DESKTOP
// get new rects
std::vector< basegfx::B2DRange > aNewRanges;
@@ -250,8 +261,27 @@ void SwSelPaintRects::Show()
mpCursorOverlay = 0;
}
}
+#else
+ if (false)
+ ;
+#endif
else if(!empty())
{
+#if !HAVE_FEATURE_DESKTOP && defined IOS
+ 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)
+ {
+ 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());
+ }
+ touch_ui_selection_start(MLOSelectionText, GetShell(), rects, size(), NULL);
+#else
SdrPaintWindow* pCandidate = pView->GetPaintWindow(0);
rtl::Reference< ::sdr::overlay::OverlayManager > xTargetOverlay = pCandidate->GetOverlayManager();
@@ -270,10 +300,21 @@ void SwSelPaintRects::Show()
xTargetOverlay->add(*mpCursorOverlay);
}
+#endif
}
}
}
+#if !HAVE_FEATURE_DESKTOP
+
+extern "C" void touch_lo_selection_attempt_resize(const void * /* documentHandle */,
+ MLORect * /* selectedRectangles */,
+ int /* numberOfRectangles */)
+{
+}
+
+#endif
+
void SwSelPaintRects::Invalidate( const SwRect& rRect )
{
sal_uInt16 nSz = size();