From d7032d560717473bf958cc4754ffba0f7d5a709a Mon Sep 17 00:00:00 2001 From: Lu Wang Date: Sun, 3 Feb 2013 03:35:56 +0800 Subject: [PATCH] working... --- src/HTMLRenderer/StateTracker.h | 50 +++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 src/HTMLRenderer/StateTracker.h diff --git a/src/HTMLRenderer/StateTracker.h b/src/HTMLRenderer/StateTracker.h new file mode 100644 index 0000000..b7ab404 --- /dev/null +++ b/src/HTMLRenderer/StateTracker.h @@ -0,0 +1,50 @@ +/* + * StateTracker.h + * + * track specific PDF state + * manage reusable CSS classes + * + * Copyright (C) 2013 Lu Wang + */ + +#ifndef STATE_TRACKER_H__ +#define STATE_TRACKER_H__ + +#include + + +namespace pdf2htmlEX { + +class StateTrackerBase +{ +public: + virtual ~StateTracker(void); + + // usually called at the beginning of a page + virtual void reset(void) = 0; + /* + * update() is called when PDF updates the state + * check_state() is called when we really need the new state + * + * There could be a number of calls to update() between 2 consecutive calls to check_state() + * So usually we just mark as changed in update, and actually retrive from the state in check_state() + */ + virtual void update(GfxState * state) = 0; + /* + * return if state has been updated + * + * if force is true, do check the state if there is no update() called before + * useful for updateAll + */ + virtual bool check_state(GfxState * state, bool force) = 0; + + long long get_id() const { return id; } + +protected: + long long id; // For CSS classe +}; + + +} // namespace pdf2htmlEX + +#endif //STATE_TRACKER_H__