Commit 94fbaa41 authored by lxnhan's avatar lxnhan

commit

parent 771f9f82
/*
* 文件名称: CriticalLock.java
*
* 编译器: android2.2
* 时间: 上午10:22:11
*/
package com.office.allreader.allofficefilereader.common;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
/**
* TODO: 文件注释
* <p>
* <p>
* Read版本: Read V1.0
* <p>
* 作者: jqin
* <p>
* 日期: 2011-12-12
* <p>
* 负责人: jqin
* <p>
* 负责小组:
* <p>
* <p>
*/
public class CriticalLock
{
private CriticalLock()
{
}
public static void lock()
{
reentrantLock.lock();
}
public static void unlock()
{
reentrantLock.unlock();
}
private static Lock reentrantLock = new ReentrantLock();
}
/*
* 文件名称: ICustomDialog.java
*
* 编译器: android2.2
* 时间: 下午12:47:14
*/
package com.office.allreader.allofficefilereader.common;
/**
* TODO: 文件注释
* <p>
* <p>
* Read版本: Read V1.0
* <p>
* 作者: ljj8494
* <p>
* 日期: 2012-12-21
* <p>
* 负责人: ljj8494
* <p>
* 负责小组:
* <p>
* <p>
*/
public interface ICustomDialog
{
//password dialog
public static final byte DIALOGTYPE_PASSWORD = 0;
//txt encode dialog
public static final byte DIALOGTYPE_ENCODE = 1;
//loading dialog
public static final byte DIALOGTYPE_LOADING = 2;
//error dialog
public static final byte DIALOGTYPE_ERROR = 3;
//
public static final byte DIALOGTYPE_FIND = 4;
/**
*
* @param type dialog type
*/
public void showDialog(byte type);
/**
*
* @param type
*/
public void dismissDialog(byte type);
}
/*
* 文件名称: OfficeToPicture.java
*
* 编译器: android2.2
* 时间: 下午2:15:37
*/
package com.office.allreader.allofficefilereader.common;
import android.graphics.Bitmap;
/**
* Office 文档转换成图片的接口
* <p>
* <p>
* Read版本: Read V1.0
* <p>
* 作者: ljj8494
* <p>
* 日期: 2012-5-14
* <p>
* 负责人: ljj8494
* <p>
* 负责小组:
* <p>
* <p>
*/
public interface IOfficeToPicture
{
// 实现IOfficeToPicture接口的类路径
public static final String INSTANCE_CLASS_PATH = "com.allreader.office.allofficefilereader.officereader.OfficeToPicture";
// 视图发生变化时生成picture,例如滚动、fling进行中
public static final byte VIEW_CHANGING = 0;
// 视图发生变化结束后,例如滚动、fling、横竖屏切换结束后
public static final byte VIEW_CHANGE_END = VIEW_CHANGING + 1;
/**
* set mode type
* @param modeType
*/
public void setModeType(byte modeType);
/**
* 生成picture模式
*
* @ return = 0,视图发生变化时生成picture,例如滚动、fling进行中,
* = 1,视图发生变化结束后,例如滚动、fling、横竖屏切换结束后。
*/
public byte getModeType();
/**
* 获得converter to picture的Bitmap,如果返回空,则不生成picture
*
* @param visibleWidth engine组件的可视图宽度
* @param visibleHeight engine组件的可视图高度
* @return Bitmap Bitmap实例
*/
public Bitmap getBitmap(int visibleWidth, int visibleHeight);
/**
* picture 绘制完成,回调方法
*
* @param bitmap 绘制好的图片
*/
public void callBack(Bitmap bitmap);
/**
* 是否以zoom方式生成picture,此zoom是指office engine的size 和 bitmap size 之间的zoom。
* 例如 engine的size 1280 * 768,而bitmap size要求是845 * 480,这样的情况是否需要zoom。
*
* @return true do zoom
* false don’t zoom
*/
public boolean isZoom();
public void dispose();
}
/*
* 文件名称: ISlideShow.java
*
* 编译器: android2.2
* 时间: 上午9:58:39
*/
package com.office.allreader.allofficefilereader.common;
/**
* TODO: 文件注释
* <p>
* <p>
* Read版本: Read V1.0
* <p>
* 作者: jqin
* <p>
* 日期: 2012-12-28
* <p>
* 负责人: jqin
* <p>
* 负责小组:
* <p>
* <p>
*/
public interface ISlideShow
{
//slideshow type
//begin slideshow
public static final byte SlideShow_Begin = 0; //0
//exit slideshow
public static final byte SlideShow_Exit = SlideShow_Begin + 1; //1
//previous step of animation
public static final byte SlideShow_PreviousStep = SlideShow_Exit + 1; //2
//next step of animation
public static final byte SlideShow_NextStep = SlideShow_PreviousStep + 1;//3
//previous slide
public static final byte SlideShow_PreviousSlide = SlideShow_NextStep + 1;//4
//next slide
public static final byte SlideShow_NextSlide = SlideShow_PreviousSlide + 1;//5
// /**
// *
// * @param actionType
// */
// public void slideshow(byte actionType);
/**
* exit slideshow
*/
public void exit();
}
/*
* 文件名称: PaintKit.java
*
* 编译器: android2.2
* 时间: 下午1:42:18
*/
package com.office.allreader.allofficefilereader.common;
import android.graphics.Paint;
import android.graphics.Typeface;
import com.office.allreader.allofficefilereader.constant.SSConstant;
/**
* TODO: 文件注释
* <p>
* <p>
* Read版本: Read V1.0
* <p>
* 作者: jqin
* <p>
* 日期: 2011-12-7
* <p>
* 负责人: jqin
* <p>
* 负责小组:
* <p>
* <p>
*/
public class PaintKit
{
private Paint paint = null;
private static PaintKit pk = new PaintKit();
private PaintKit()
{
paint = new Paint();
paint.setTextSize(SSConstant.HEADER_TEXT_FONTSZIE);
paint.setTypeface(Typeface.SERIF);
paint.setFlags(Paint.ANTI_ALIAS_FLAG);
paint.setStrokeCap(Paint.Cap.ROUND);
}
/**
*
* @return
*/
public static PaintKit instance()
{
return pk;
}
public Paint getPaint()
{
paint.reset();
paint.setAntiAlias(true);
return paint;
}
}
/*
* 文件名称: Scrollbar.java
*
* 编译器: android2.2
* 时间: 下午2:30:54
*/
package com.office.allreader.allofficefilereader.common;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.RectF;
import com.office.allreader.allofficefilereader.java.awt.Dimension;
/**
* TODO: 文件注释
* <p>
* <p>
* Read版本: Read V1.0
* <p>
* 作者: jqin
* <p>
* 日期: 2011-12-13
* <p>
* 负责人: jqin
* <p>
* 负责小组:
* <p>
* <p>
*/
public class Scrollbar
{
private final int SCROLLBAR_SIZE = 5;
private final int SCROLLBAR_OFFBORDER = 2;
private final int SCROLLBAR_COLOR_ALPHA = 125;
// scroll bar color
private final int SCROLLBAR_COLOR = 0x8f444444;/*0x8fcecfd6;*/
public void setPageSize(int width, int height)
{
this.pageSize.setSize(width, height);
}
/**
* call setPageSize to set page size before call draw function
* @param canvas
* @param zoom
*/
public void draw(Canvas canvas, int currentX, int currentY, Paint paint)
{
Rect clip = canvas.getClipBounds();
int oldColor = paint.getColor();
int alpha = paint.getAlpha();
paint.setColor(SCROLLBAR_COLOR);
paint.setAlpha(SCROLLBAR_COLOR_ALPHA);
if(pageSize.width > clip.right)
{
drawHorizontalScrollBar(canvas, currentX, paint);
}
if(pageSize.height > clip.bottom)
{
drawVerticalScrollBar(canvas, currentY, paint);
}
paint.setColor(oldColor);
paint.setAlpha(alpha);
}
/**
*
* @param canvas
* @param zoom
*/
private void drawHorizontalScrollBar(Canvas canvas, int currentX, Paint paint)
{
Rect clip = canvas.getClipBounds();
//horizontal scroll bar length
float length = clip.right * clip.right / pageSize.width;
float pixelSteps = pageSize.width / (float)clip.right;
//find the scroll bar rect
float left = (pageSize.width / 2 - currentX) / pixelSteps - length / 2;
rect.set(left, clip.bottom - SCROLLBAR_SIZE - SCROLLBAR_OFFBORDER, left + length, clip.bottom - SCROLLBAR_OFFBORDER);
canvas.drawRoundRect(rect, SCROLLBAR_SIZE / 2, SCROLLBAR_SIZE / 2, paint);
}
/**
*
* @param canvas
* @param zoom
*/
private void drawVerticalScrollBar(Canvas canvas, int currentY, Paint paint)
{
Rect clip = canvas.getClipBounds();
//vertical scroll bar length
float length = clip.bottom * clip.bottom / pageSize.height;
float pixelSteps = pageSize.height / (float)clip.bottom;
//find the scroll bar rect
float top = (pageSize.height / 2 - currentY) / pixelSteps - length / 2;
rect.set(clip.right - SCROLLBAR_SIZE - SCROLLBAR_OFFBORDER, top, clip.right - SCROLLBAR_OFFBORDER, top + length);
canvas.drawRoundRect(rect, SCROLLBAR_SIZE / 2, SCROLLBAR_SIZE / 2, paint);
}
//
private Dimension pageSize = new Dimension();
//
private RectF rect = new RectF();
}
package com.office.allreader.allofficefilereader.common.autoshape;
import android.graphics.Path;
import com.office.allreader.allofficefilereader.common.bg.BackgroundAndFill;
import com.office.allreader.allofficefilereader.common.borders.Line;
public class ExtendPath
{
public ExtendPath()
{
path = new Path();
fill = null;
}
public ExtendPath(ExtendPath extendPath)
{
path = new Path(extendPath.getPath());
fill = extendPath.getBackgroundAndFill();
hasLine = extendPath.hasLine();
line = extendPath.getLine();
isArrow = extendPath.isArrowPath();
}
public void setPath(Path path)
{
this.path = path;
}
public Path getPath()
{
return path;
}
public void setBackgroundAndFill(BackgroundAndFill fill)
{
this.fill = fill;
}
public BackgroundAndFill getBackgroundAndFill()
{
return fill;
}
public boolean hasLine()
{
return hasLine;
}
public void setLine(boolean hasLine)
{
this.hasLine = hasLine;
if(hasLine && line == null)
{
line = new Line();
}
}
public Line getLine()
{
return line;
}
public void setLine(Line line)
{
this.line = line;
if(line != null)
{
hasLine = true;
}
else
{
hasLine = false;
}
}
public void setArrowFlag(boolean isArrow)
{
this.isArrow = isArrow;
}
public boolean isArrowPath()
{
return isArrow;
}
public void dispose()
{
path = null;
if(fill != null)
{
fill.dispose();
}
}
private Path path;
private BackgroundAndFill fill;
private boolean hasLine;
private Line line;
private boolean isArrow;
}
package com.office.allreader.allofficefilereader.common.autoshape.pathbuilder;
import android.graphics.Path;
import android.graphics.PointF;
public class ArrowPathAndTail {
private Path path;
private PointF tail;
public void reset() {
this.path = null;
this.tail = null;
}
public Path getArrowPath() {
return this.path;
}
public void setArrowPath(Path path) {
this.path = path;
}
public PointF getArrowTailCenter() {
return this.tail;
}
public void setArrowTailCenter(float f, float f2) {
this.tail = new PointF(f, f2);
}
}
/*
* 文件名称: SimpleArrow.java
*
* 编译器: android2.2
* 时间: 下午3:07:55
*/
package com.office.allreader.allofficefilereader.common.autoshape.pathbuilder.arrow;
import android.graphics.Rect;
import com.office.allreader.allofficefilereader.common.shape.AutoShape;
public class ArrowPathBuilder
{
public static Object getArrowPath(AutoShape shape, Rect rect)
{
if(shape.isAutoShape07())
{
return LaterArrowPathBuilder.getArrowPath(shape, rect);
}
else
{
return EarlyArrowPathBuilder.getArrowPath(shape, rect);
}
}
}
package com.office.allreader.allofficefilereader.common.bg;
import android.graphics.Rect;
import android.graphics.Shader;
import com.office.allreader.allofficefilereader.system.IControl;
public abstract class AShader
{
public Shader getShader()
{
return shader;
}
public Shader createShader(IControl control, int viewIndex, Rect rect)
{
return shader;
}
public int getAlpha()
{
return alpha;
}
public void setAlpha(int alpha)
{
this.alpha = alpha;
}
public void dispose()
{
shader = null;
}
protected int alpha = 255;
protected Shader shader = null;
}
package com.office.allreader.allofficefilereader.common.bg;
public abstract class Gradient extends AShader
{
public static final int COORDINATE_LENGTH = 100;
public Gradient(int[] colors, float[] positions)
{
if(colors != null && colors.length >= 2)
{
this.colors = colors;
}
this.positions = positions;
}
public int getGradientType()
{
return type;
}
public void setGradientType(int type)
{
this.type = type;
}
public int getFocus()
{
return focus;
}
public void setFocus(int focus)
{
this.focus = focus;
}
private int type;
protected int[] colors = null;
protected float[] positions = null;
//percent
private int focus = 100;
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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