Kaydet (Commit) 814ca076 authored tarafından Ptyl Dragon's avatar Ptyl Dragon Kaydeden (comit) Jan Holesovsky

ready for integration with CATiledLayer

Change-Id: I50f519a37036ed3d17f73c80b33f4a9c4c19cb52
üst 6b6088fa
...@@ -90,19 +90,75 @@ typedef CGRect MLORect; ...@@ -90,19 +90,75 @@ typedef CGRect MLORect;
typedef basegfx::B2IBox MLORect; typedef basegfx::B2IBox MLORect;
#endif #endif
typedef long long MLOContentSizeDimension; // MLODip - Device Independent Pixels
struct MLOContentSize {
MLOContentSizeDimension width; typedef long long MLOPixel;
MLOContentSizeDimension height; static const MLOPixel LO_TWIPS_TO_MLO_PIXEL_RATIO = 10L;
struct MLOPixelSize {
MLOPixel width;
MLOPixel height;
};
typedef struct MLOPixelSize MLOPixelSize;
struct MLOPixelPoint {
MLOPixel x;
MLOPixel y;
}; };
typedef struct MLOContentSize MLOContentSize; typedef struct MLOPixelPoint MLOPixelPoint;
CG_INLINE CGFloat
MLOPixelToCGFloat(MLOPixel mloPixel)
{
return (CGFloat) (mloPixel / LO_TWIPS_TO_MLO_PIXEL_RATIO);
}
CG_INLINE MLOPixel
CGFloatToMLOPixel(CGFloat cgFloat)
{
return (MLOPixel) cgFloat * LO_TWIPS_TO_MLO_PIXEL_RATIO;
}
CG_INLINE MLOPixelSize
MLOPixelSizeMake(MLOPixel width, MLOPixel height)
{
MLOPixelSize size; size.width = width; size.height = height; return size;
}
CG_INLINE MLOPixelPoint
MLOPixelPointMake(MLOPixel x, MLOPixel y)
{
MLOPixelPoint point; point.x = x; point.y = y; return point;
}
CG_INLINE MLOPixelSize
CGSizeToMLOPixelSize(CGSize cgSize)
{
MLOPixelSize mloPixelSize;
mloPixelSize.width = MLOPixelToCGFloat(cgSize.width);
mloPixelSize.height = MLOPixelToCGFloat(cgSize.height);
return mloPixelSize;
}
CG_INLINE CGSize
MLOPixelsToCGSize(MLOPixel width, MLOPixel height)
{
CGFloat fWidth = CGFloatToMLOPixel(width);
CGFloat fHeight = CGFloatToMLOPixel(height);
return CGSizeMake(fWidth, fHeight);
}
CG_INLINE MLOContentSize CG_INLINE CGSize
MLOContentSizeMake(MLOContentSizeDimension width, MLOContentSizeDimension height) MLOPixelSizeToCGSize(MLOPixelSize mloPixelSize)
{ {
MLOContentSize size; size.width = width; size.height = height; return size; return MLOPixelsToCGSize(mloPixelSize.width, mloPixelSize.height);
} }
MLOPixelPoint CGPointToMLOPixelPoint(CGPoint cgPoint);
CGPoint MLOPixelPointToCGPoint(MLOPixelPoint mloPixelPoint);
// selection
void touch_ui_selection_start(MLOSelectionKind kind, void touch_ui_selection_start(MLOSelectionKind kind,
const void *documentHandle, const void *documentHandle,
MLORect *rectangles, MLORect *rectangles,
...@@ -145,7 +201,7 @@ context, contextHeight, contextWidth specify where to draw. ...@@ -145,7 +201,7 @@ context, contextHeight, contextWidth specify where to draw.
*/ */
void touch_lo_draw_tile(void *context, int contextWidth, int contextHeight, int tilePosX, int tilePosY, int tileWidth, int tileHeight); void touch_lo_draw_tile(void *context, int contextWidth, int contextHeight, int tilePosX, int tilePosY, int tileWidth, int tileHeight);
void touch_lo_copy_buffer(const void * source, size_t sourceWidth, size_t sourceHeight, size_t sourceBytesPerRow, void * target, size_t targetWidth, size_t targetHeight); void touch_lo_copy_buffer(const void * source, size_t sourceWidth, size_t sourceHeight, size_t sourceBytesPerRow, void * target, size_t targetWidth, size_t targetHeight);
MLOContentSize touch_lo_get_content_size(); CGSize touch_lo_get_content_size();
void touch_lo_mouse_drag(int x, int y, MLOMouseButtonState state); void touch_lo_mouse_drag(int x, int y, MLOMouseButtonState state);
// Move the start of the selection to (x,y) // Move the start of the selection to (x,y)
......
...@@ -473,4 +473,4 @@ void touch_ui_selection_start(MLOSelectionKind kind, ...@@ -473,4 +473,4 @@ void touch_ui_selection_start(MLOSelectionKind kind,
void touch_ui_selection_none(){ void touch_ui_selection_none(){
// STUB // STUB
} }
\ No newline at end of file
...@@ -1816,7 +1816,7 @@ void touch_lo_draw_tile(void * context, int contextWidth, int contextHeight, int ...@@ -1816,7 +1816,7 @@ void touch_lo_draw_tile(void * context, int contextWidth, int contextHeight, int
Application::ReleaseSolarMutex(); Application::ReleaseSolarMutex();
} }
extern "C" extern "C"
MLOContentSize touch_lo_get_content_size() CGSize touch_lo_get_content_size()
{ {
SwWrtShell *pViewShell = GetActiveWrtShell(); SwWrtShell *pViewShell = GetActiveWrtShell();
if (pViewShell) if (pViewShell)
...@@ -1824,14 +1824,30 @@ MLOContentSize touch_lo_get_content_size() ...@@ -1824,14 +1824,30 @@ MLOContentSize touch_lo_get_content_size()
static const long WIDTH_ADDITION = 6L * DOCUMENTBORDER; static const long WIDTH_ADDITION = 6L * DOCUMENTBORDER;
static const long HEIGHT_ADDITION = 2L * DOCUMENTBORDER; static const long HEIGHT_ADDITION = 2L * DOCUMENTBORDER;
Size documentSize =pViewShell->GetView().GetDocSz(); Size documentSize =pViewShell->GetView().GetDocSz();
return MLOContentSizeMake(documentSize.Width() + WIDTH_ADDITION, return MLOPixelsToCGSize(documentSize.Width() + WIDTH_ADDITION,
documentSize.Height() + HEIGHT_ADDITION); documentSize.Height() + HEIGHT_ADDITION);
} }
return MLOContentSizeMake(0,0); return CGSizeMake(0,0);
}
extern "C"
MLOPixelPoint CGPointToMLOPixelPoint(CGPoint cgPoint)
{
CGSize contentSize = touch_lo_get_content_size();
MLOPixel x = CGFloatToMLOPixel(cgPoint.x - (contentSize.width/2.0f));
MLOPixel y = CGFloatToMLOPixel(cgPoint.y);
return MLOPixelPointMake(x,y);
} }
#endif
extern "C" void touch_ui_selection_none() {} extern "C"
CGPoint MLOPixelPointToCGPoint(MLOPixelPoint mloPixelPoint)
{
CGSize contentSize = touch_lo_get_content_size();
CGFloat x = MLOPixelToCGFloat(mloPixelPoint.x) + (contentSize.width/2.0f);
CGFloat y = MLOPixelToCGFloat(mloPixelPoint.y);
return CGPointMake(x,y);
}
#endif
void SwViewShell::SetBrowseBorder( const Size& rNew ) void SwViewShell::SetBrowseBorder( const Size& rNew )
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment