LibreOffice Module android (master) 1
CalcHeaderCell.java
Go to the documentation of this file.
1package org.libreoffice.canvas;
2
3import android.graphics.Canvas;
4import android.graphics.Color;
5import android.graphics.Paint;
6import android.graphics.Paint.Style;
7import android.graphics.RectF;
8import android.text.TextPaint;
9
10public class CalcHeaderCell extends CommonCanvasElement {
11 private TextPaint mTextPaint = new TextPaint();
12 private Paint mBgPaint = new Paint();
13 private RectF mBounds;
14 private String mText;
15
16 public CalcHeaderCell(float left, float top, float width, float height, String text, boolean selected) {
17 mBounds = new RectF(left, top, left + width, top + height);
18 if (selected) {
19 // if the cell is selected, display filled
20 mBgPaint.setStyle(Style.FILL_AND_STROKE);
21 } else {
22 // if not, display only the frame
23 mBgPaint.setStyle(Style.STROKE);
24 }
25 mBgPaint.setColor(Color.GRAY);
26 mBgPaint.setAlpha(100); // hard coded for now
27 mTextPaint.setColor(Color.GRAY);
28 mTextPaint.setTextSize(24f); // hard coded for now
29 mText = text;
30 }
31
38 @Override
39 public boolean onHitTest(float x, float y) {
40 return false;
41 }
42
49 @Override
50 public void onDraw(Canvas canvas) {
51 canvas.drawRect(mBounds, mBgPaint);
52 canvas.drawText(mText, mBounds.left, mBounds.bottom, mTextPaint);
53 }
54}
void onDraw(Canvas canvas)
Called inside draw if the element is visible.
boolean onHitTest(float x, float y)
Implement hit test here.
CalcHeaderCell(float left, float top, float width, float height, String text, boolean selected)
Common implementation to canvas elements.
OString top
def text(shape, orig_st)
sal_uInt64 left