Version 5.2.6.1, tag libreoffice-5.2.6.1
[LibreOffice.git] / android / source / src / java / org / libreoffice / canvas / CommonCanvasElement.java
blob101afe4b70ace6b619b7eb0bf5b19eea81e68381
1 package org.libreoffice.canvas;
3 import android.graphics.Canvas;
5 /**
6 * Common implementation to canvas elements.
7 */
8 public abstract class CommonCanvasElement implements CanvasElement, CanvasElementImplRequirement {
10 private boolean mVisible = false;
12 /**
13 * Is element visible?
15 @Override
16 public boolean isVisible() {
17 return mVisible;
20 /**
21 * Set element visibility.
23 @Override
24 public void setVisible(boolean visible) {
25 mVisible = visible;
28 /**
29 * Trigger drawing the element on the canvas.
31 @Override
32 public void draw(Canvas canvas) {
33 if (isVisible()) {
34 onDraw(canvas);
38 /**
39 * Hit test. Return true if the element was hit. Directly return false if
40 * the element is invisible.
42 @Override
43 public boolean contains(float x, float y) {
44 if (!isVisible()) {
45 return false;
47 return onHitTest(x, y);