// Copyright (C) 2000-2007, Luca Padovani . // // This file is part of GtkMathView, a flexible, high-quality rendering // engine for MathML documents. // // GtkMathView is free software; you can redistribute it and/or modify it // under the terms of the GNU Lesser General Public License as published // by the Free Software Foundation; either version 3 of the License, or // (at your option) any later version. // // GtkMathView is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License // along with this program. If not, see . #ifndef __View_hh__ #define __View_hh__ #include "Object.hh" #include "String.hh" #include "SmartPtr.hh" #include "BoundingBox.hh" // Area.hh moved down here for Win32 build #include "Area.hh" #include "MathMLOperatorDictionary.hh" #include "Builder.hh" #include "Element.hh" class GMV_MathView_EXPORT View : public Object { protected: View(const SmartPtr&); virtual ~View(); public: virtual void unload(void) = 0; bool frozen(void) const { return freezeCounter > 0; } bool freeze(void); bool thaw(void); // configuration stuff static String getDefaultConfigurationPath(void); static String getDefaultOperatorDictionaryPath(void); SmartPtr getLogger(void) const; void setOperatorDictionary(const SmartPtr&); SmartPtr getOperatorDictionary(void) const; void setBuilder(const SmartPtr&); SmartPtr getBuilder(void) const; void setMathMLNamespaceContext(const SmartPtr&); SmartPtr getMathMLNamespaceContext(void) const; #if GMV_ENABLE_BOXML void setBoxMLNamespaceContext(const SmartPtr&); SmartPtr getBoxMLNamespaceContext(void) const; #endif // GMV_ENABLE_BOXML void setDirtyLayout(void) const; SmartPtr getRootElement(void) const; void resetRootElement(void); BoundingBox getBoundingBox(void) const; SmartPtr getElementAt(const scaled&, const scaled&, Point* = 0, BoundingBox* = 0) const; bool getElementExtents(const SmartPtr&, const SmartPtr&, Point* = 0, BoundingBox* = 0) const; bool getElementExtents(const SmartPtr&, Point* = 0, BoundingBox* = 0) const; bool getElementLength(const SmartPtr&, CharIndex&) const; bool getElementOrigin(const SmartPtr& elem, Point& p) const { return getElementExtents(elem, &p, 0); } bool getElementOrigin(const SmartPtr& refElem, const SmartPtr& elem, Point& p) const { return getElementExtents(refElem, elem, &p, 0); } bool getElementBoundingBox(const SmartPtr& elem, BoundingBox& b) const { return getElementExtents(elem, 0, &b); } SmartPtr getCharAt(const scaled&, const scaled&, CharIndex&, Point* = 0, BoundingBox* = 0) const; bool getCharExtents(const SmartPtr&, const SmartPtr&, CharIndex, Point* = 0, BoundingBox* = 0) const; bool getCharExtents(const SmartPtr&, CharIndex, Point* = 0, BoundingBox* = 0) const; bool getCharOrigin(const SmartPtr& elem, CharIndex index, Point& p) const { return getCharExtents(elem, index, &p, 0); } bool getCharBoundingBox(const SmartPtr& elem, CharIndex index, BoundingBox& b) const { return getCharExtents(elem, index, 0, &b); } void render(class RenderingContext&, const scaled&, const scaled&) const; unsigned getDefaultFontSize(void) const { return defaultFontSize; } void setDefaultFontSize(unsigned); scaled getAvailableWidth(void) const { return availableWidth; } void setAvailableWidth(const scaled&); protected: SmartPtr getRootArea(void) const; SmartPtr formatElement(const SmartPtr&) const; private: mutable SmartPtr rootElement; SmartPtr logger; SmartPtr dictionary; SmartPtr builder; SmartPtr mathmlContext; #if GMV_ENABLE_BOXML SmartPtr boxmlContext; #endif // GMV_ENABLE_BOXML unsigned defaultFontSize; unsigned freezeCounter; scaled availableWidth; }; #endif // __View_hh__