From: ishmal Date: Thu, 20 Mar 2008 19:14:23 +0000 (+0000) Subject: Change from DOM Level 3 Views to Level 2 to sync with CSS X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=5a08d0e3bae5d6dcf0b2d76da6a707bc8e02826f;p=inkscape.git Change from DOM Level 3 Views to Level 2 to sync with CSS --- diff --git a/src/dom/css.h b/src/dom/css.h index ad61ddb0f..aaefeb9ba 100644 --- a/src/dom/css.h +++ b/src/dom/css.h @@ -1,17 +1,32 @@ -/* - * Copyright (c) 2000 World Wide Web Consortium, - * (Massachusetts Institute of Technology, Institut National de - * Recherche en Informatique et en Automatique, Keio University). All - * Rights Reserved. This program is distributed under the W3C's Software - * Intellectual Property License. This program is distributed 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 W3C License http://www.w3.org/Consortium/Legal/ for more details. +/** + * Phoebe DOM Implementation. + * + * This is a C++ approximation of the W3C DOM model, which follows + * fairly closely the specifications in the various .idl files, copies of + * which are provided for reference. Most important is this one: + * + * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html + * + * Authors: + * Bob Jamison + * + * Copyright (C) 2005 Bob Jamison + * + * This library 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 2.1 of the License, or (at your option) any later version. + * + * This library 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 library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -// File: http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113/css.idl - #ifndef __CSS_H__ #define __CSS_H__ @@ -3962,9 +3977,9 @@ protected: #########################################################################*/ /** - * again, a mismatch with views::View and views::AbstractView + * */ -class ViewCSS : virtual public views::View +class ViewCSS : virtual public views::AbstractView { public: @@ -3985,14 +4000,14 @@ public: /** * */ - ViewCSS() : views::View() + ViewCSS() : views::AbstractView() { } /** * */ - ViewCSS(const ViewCSS &other) : views::View(other) + ViewCSS(const ViewCSS &other) : views::AbstractView(other) { } diff --git a/src/dom/cssparser.cpp b/src/dom/cssparser.cpp index 83fd92909..422c02e49 100644 --- a/src/dom/cssparser.cpp +++ b/src/dom/cssparser.cpp @@ -131,7 +131,7 @@ XMLCh CssParser::get(int p) * Test if the given substring exists at the given position * in parsebuf. Use get() in case of out-of-bounds */ -bool CssParser::match(int pos, char *str) +bool CssParser::match(int pos, const char *str) { while (*str) { diff --git a/src/dom/cssparser.h b/src/dom/cssparser.h index 6c7db16f9..ca137cbaa 100644 --- a/src/dom/cssparser.h +++ b/src/dom/cssparser.h @@ -12,7 +12,7 @@ * Authors: * Bob Jamison * - * Copyright (C) 2005-2007 Bob Jamison + * Copyright (C) 2005-2008 Bob Jamison * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -98,7 +98,7 @@ private: * Test if the given substring exists at the given position * in parsebuf. Use get() in case of out-of-bounds */ - bool match(int pos, char *str); + bool match(int pos, const char *str); /** * Skip over whitespace diff --git a/src/dom/events.h b/src/dom/events.h index f57383987..c19c2bdc5 100644 --- a/src/dom/events.h +++ b/src/dom/events.h @@ -13,7 +13,7 @@ * Authors: * Bob Jamison * - * Copyright (C) 2005 Bob Jamison + * Copyright (C) 2005-2008 Bob Jamison * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -673,10 +673,9 @@ class UIEvent : virtual public Event public: /** - * Note that the return type as listed in level3 events.idl is - * AbstractView, while in level3 views.idl it is called View + * Note that the return type is level -2- views */ - virtual views::View getView() + virtual views::AbstractView getView() { return view; } /** @@ -691,7 +690,7 @@ public: virtual void initUIEvent(const DOMString &/*typeArg*/, bool /*canBubbleArg*/, bool /*cancelableArg*/, - const views::View */*viewArg*/, + const views::AbstractView */*viewArg*/, long /*detailArg*/) { } @@ -703,7 +702,7 @@ public: const DOMString &/*typeArg*/, bool /*canBubbleArg*/, bool /*cancelableArg*/, - const views::View */*viewArg*/, + const views::AbstractView */*viewArg*/, long /*detailArg*/) { } @@ -733,7 +732,7 @@ public: protected: - views::View view; + views::AbstractView view; long detail; }; @@ -763,7 +762,7 @@ public: virtual void initTextEvent(const DOMString &/*typeArg*/, bool /*canBubbleArg*/, bool /*cancelableArg*/, - const views::View */*viewArg*/, + const views::AbstractView */*viewArg*/, long /*detailArg*/) { } @@ -775,7 +774,7 @@ public: const DOMString &/*typeArg*/, bool /*canBubbleArg*/, bool /*cancelableArg*/, - const views::View */*viewArg*/, + const views::AbstractView */*viewArg*/, long /*detailArg*/) { } @@ -899,7 +898,7 @@ public: virtual void initMouseEvent(const DOMString &/*typeArg*/, bool /*canBubbleArg*/, bool /*cancelableArg*/, - const views::View */*viewArg*/, + const views::AbstractView */*viewArg*/, long /*detailArg*/, long /*screenXArg*/, long /*screenYArg*/, @@ -922,7 +921,7 @@ public: const DOMString &/*typeArg*/, bool /*canBubbleArg*/, bool /*cancelableArg*/, - const views::View */*viewArg*/, + const views::AbstractView */*viewArg*/, long /*detailArg*/, long /*screenXArg*/, long /*screenYArg*/, @@ -1053,7 +1052,7 @@ public: virtual void initKeyboardEvent(const DOMString &/*typeArg*/, bool /*canBubbleArg*/, bool /*cancelableArg*/, - const views::View */*viewArg*/, + const views::AbstractView */*viewArg*/, const DOMString &/*keyIdentifier*/, unsigned long /*keyLocation*/, const DOMString /*modifiersList*/) @@ -1069,7 +1068,7 @@ public: const DOMString &/*typeArg*/, bool /*canBubbleArg*/, bool /*cancelableArg*/, - const views::View */*viewArg*/, + const views::AbstractView */*viewArg*/, const DOMString &/*keyIdentifier*/, unsigned long /*keyLocation*/, const DOMString /*modifiersList*/) diff --git a/src/dom/smil.h b/src/dom/smil.h index cbabe2525..a226dc65b 100644 --- a/src/dom/smil.h +++ b/src/dom/smil.h @@ -12,7 +12,7 @@ * Authors: * Bob Jamison * - * Copyright (C) 2005 Bob Jamison + * Copyright (C) 2005-2008 Bob Jamison * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -1374,7 +1374,7 @@ public: /** * */ - virtual views::View getView() + virtual views::AbstractView getView() { return view; } /** @@ -1387,7 +1387,7 @@ public: * */ virtual void initTimeEvent(const DOMString &/*typeArg*/, - const views::View */*viewArg*/, + const views::AbstractView */*viewArg*/, long /*detailArg*/) { } @@ -1421,7 +1421,7 @@ public: protected: - views::View view; + views::AbstractView view; long detail; diff --git a/src/dom/smilimpl.cpp b/src/dom/smilimpl.cpp index 3bd3b62ea..d2f8278d6 100644 --- a/src/dom/smilimpl.cpp +++ b/src/dom/smilimpl.cpp @@ -10,7 +10,7 @@ * Authors: * Bob Jamison * - * Copyright (C) 2005 Bob Jamison + * Copyright (C) 2005-2008 Bob Jamison * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/dom/smilimpl.h b/src/dom/smilimpl.h index c2864cb9f..7c1a014dc 100644 --- a/src/dom/smilimpl.h +++ b/src/dom/smilimpl.h @@ -12,7 +12,7 @@ * Authors: * Bob Jamison * - * Copyright (C) 2005 Bob Jamison + * Copyright (C) 2005-2008 Bob Jamison * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/dom/svg.h b/src/dom/svg.h index c5f3309b5..05120a640 100644 --- a/src/dom/svg.h +++ b/src/dom/svg.h @@ -13,7 +13,7 @@ * Authors: * Bob Jamison * - * Copyright (C) 2005 Bob Jamison + * Copyright (C) 2005-2008 Bob Jamison * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/dom/views-level3.h b/src/dom/views-level3.h new file mode 100644 index 000000000..f62d18751 --- /dev/null +++ b/src/dom/views-level3.h @@ -0,0 +1,1965 @@ +#ifndef __VIEWS_LEVEL3_H__ +#define __VIEWS_LEVEL3_H__ + +/** + * Phoebe DOM Implementation. + * + * This is a C++ approximation of the W3C DOM model, which follows + * fairly closely the specifications in the various .idl files, copies of + * which are provided for reference. Most important is this one: + * + * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html + * + * Authors: + * Bob Jamison + * + * Copyright (C) 2005-2008 Bob Jamison + * + * This library 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 2.1 of the License, or (at your option) any later version. + * + * This library 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 library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * Currently CSS is not at level 3, so we will probably not use this + * Level 3 Views implementation. Rather, we'll regress back to Level 2. + * This should not affect using the rest of DOM Core 3 + */ + +#include "dom.h" + + + +namespace org +{ +namespace w3c +{ +namespace dom +{ +namespace views +{ + + +//local aliases +typedef dom::Node Node; +typedef dom::DOMString DOMString; + +//forward declarations +class Segment; +class VisualResource; +class VisualCharacter; +class VisualCharacterRun; +class VisualFrame; +class VisualImage; +class VisualFormButton; +class VisualFormField; + + + + +/*######################################################################### +## Match +#########################################################################*/ + +/** + * + */ +class Match +{ +public: + + typedef enum + { + IS_EQUAL = 0, + IS_NOT_EQUAL = 1, + INT_PRECEDES = 2, + INT_PRECEDES_OR_EQUALS = 3, + INT_FOLLOWS = 4, + INT_FOLLOWS_OR_EQUALS = 5, + STR_STARTS_WITH = 6, + STR_ENDS_WITH = 7, + STR_CONTAINS = 8, + SET_ANY = 9, + SET_ALL = 10, + SET_NOT_ANY = 11, + SET_NOT_ALL = 12 + } MatchTestGroup; + + /** + * + */ + virtual unsigned short test() + { return IS_NOT_EQUAL; } + + //################## + //# Non-API methods + //################## + + /** + * + */ + Match() {} + + /** + * + */ + Match(const Match &/*other*/) + { + } + + /** + * + */ + virtual ~Match() {} +}; + + + +/*######################################################################### +## MatchString +#########################################################################*/ + +/** + * + */ +class MatchString : virtual public Match +{ +public: + + /** + * + */ + virtual DOMString getName() + { return name; } + + /** + * + */ + virtual DOMString getValue() + { return value; } + + //################## + //# Non-API methods + //################## + + /** + * + */ + MatchString() {} + + /** + * + */ + MatchString(const MatchString &other) : Match(other) + { + name = other.name; + value = other.value; + } + + /** + * + */ + virtual ~MatchString() {} + +protected: + + DOMString name; + DOMString value; + + +}; + + + +/*######################################################################### +## MatchInteger +#########################################################################*/ + +/** + * + */ +class MatchInteger : virtual public Match +{ +public: + + /** + * + */ + virtual DOMString getName() + { return name; } + + /** + * + */ + virtual long getValue() + { return value; } + + //################## + //# Non-API methods + //################## + + /** + * + */ + MatchInteger() {} + + /** + * + */ + MatchInteger(const MatchInteger &other) : Match(other) + { + name = other.name; + value = other.value; + } + + /** + * + */ + virtual ~MatchInteger() {} + +protected: + + DOMString name; + long value; +}; + + + +/*######################################################################### +## MatchBoolean +#########################################################################*/ + +/** + * + */ +class MatchBoolean : virtual public Match +{ +public: + + /** + * + */ + virtual DOMString getName() + { return name; } + + /** + * + */ + virtual bool getValue() + { return value; } + + //################## + //# Non-API methods + //################## + + /** + * + */ + MatchBoolean() {} + + /** + * + */ + MatchBoolean(const MatchBoolean &other) : Match(other) + { + name = other.name; + value = other.value; + } + + /** + * + */ + virtual ~MatchBoolean() {} + +protected: + + DOMString name; + bool value; +}; + + + +/*######################################################################### +## MatchContent +#########################################################################*/ + +/** + * + */ +class MatchContent : virtual public Match +{ +public: + + /** + * + */ + virtual DOMString getName() + { return name; } + + /** + * + */ + virtual NodePtr getNodeArg() + { return nodeArg; } + + + /** + * + */ + virtual unsigned long getOffset() + { return offset; } + + //################## + //# Non-API methods + //################## + + /** + * + */ + MatchContent() + { + nodeArg = NULL; + offset = 0L; + } + + /** + * + */ + MatchContent(const MatchContent &other) : Match(other) + { + name = other.name; + nodeArg = other.nodeArg; + offset = other.offset; + } + + /** + * + */ + virtual ~MatchContent() {} + +protected: + + DOMString name; + NodePtr nodeArg; + unsigned long offset; + + + +}; + + + +/*######################################################################### +## MatchSet +#########################################################################*/ + +/** + * + */ +class MatchSet : virtual public Match +{ +public: + + /** + * + */ + virtual NodePtr getNodeArg() + { return nodeArg; } + + /** + * + */ + virtual void addMatch(const Match &match) + { matches.push_back(match); } + + /** + * + */ + virtual Match getMatch(unsigned long index) + { + if (index >= matches.size()) + { + Match match; + return match; + } + return matches[index]; + } + + //################## + //# Non-API methods + //################## + + /** + * + */ + MatchSet() + { + nodeArg = NULL; + } + + /** + * + */ + MatchSet(const MatchSet &other) : Match(other) + { + nodeArg = other.nodeArg; + matches = other.matches; + } + + /** + * + */ + virtual ~MatchSet() {} + +protected: + + NodePtr nodeArg; + + std::vector matches; + +}; + + + +/*######################################################################### +## Item +#########################################################################*/ + +/** + * + */ +class Item +{ +public: + + /** + * + */ + virtual bool getExists() + { return exists; } + + /** + * + */ + virtual DOMString getName() + { return name; } + + //################## + //# Non-API methods + //################## + + /** + * + */ + Item() {} + + /** + * + */ + Item(const Item &other) + { + exists = other.exists; + name = other.name; + } + + /** + * + */ + virtual ~Item() {} + +protected: + + bool exists; + + DOMString name; + + +}; + + + +/*######################################################################### +## StringItem +#########################################################################*/ + +/** + * + */ +class StringItem : virtual public Item +{ +public: + + /** + * + */ + virtual DOMString getValue() + { return value; } + + //################## + //# Non-API methods + //################## + + /** + * + */ + StringItem() {} + + /** + * + */ + StringItem(const StringItem &other) : Item(other) + { + value = other.value; + } + + /** + * + */ + virtual ~StringItem() {} + +protected: + + DOMString value; + + +}; + + + +/*######################################################################### +## IntegerItem +#########################################################################*/ + +/** + * + */ +class IntegerItem : virtual public Item +{ +public: + + + /** + * + */ + virtual long getValue() + { return value; } + + //################## + //# Non-API methods + //################## + + /** + * + */ + IntegerItem() {} + + /** + * + */ + IntegerItem(const IntegerItem &other) : Item(other) + { + value = other.value; + } + + /** + * + */ + virtual ~IntegerItem() {} + +protected: + + long value; + +}; + + +/*######################################################################### +## BooleanItem +#########################################################################*/ + +/** + * + */ +class BooleanItem : virtual public Item +{ +public: + + /** + * + */ + virtual bool getValue() + { return value; } + + //################## + //# Non-API methods + //################## + + /** + * + */ + BooleanItem() {} + + /** + * + */ + BooleanItem(const BooleanItem &other) : Item(other) + { + value = other.value; + } + + /** + * + */ + virtual ~BooleanItem() {} + +protected: + + bool value; + +}; + + +/*######################################################################### +## ContentItem +#########################################################################*/ + +/** + * + */ +class ContentItem : virtual public Item +{ +public: + + /** + * + */ + virtual NodePtr getNodeArg() + { return nodeArg; } + + /** + * + */ + virtual unsigned long getOffset() + { return offset; } + + //################## + //# Non-API methods + //################## + + /** + * + */ + ContentItem() + { + nodeArg = NULL; + } + + /** + * + */ + ContentItem(const ContentItem &other) : Item(other) + { + nodeArg = other.nodeArg; + offset = other.offset; + } + + /** + * + */ + virtual ~ContentItem() {} + +protected: + + NodePtr nodeArg; + long offset; + + +}; + + + + + + + +/*######################################################################### +## Segment +#########################################################################*/ + +/** + * + */ +class Segment : virtual public Match +{ +public: + + /** + * + */ + virtual Match getCriteria() + { return criteria; } + + /** + * + */ + virtual void setCriteria(const Match &val) + { criteria = val; } + + + /** + * + */ + virtual DOMString getOrder() + { return order; } + + /** + * + */ + virtual void setOrder(const DOMString &val) + { order = val; } + + /** + * + */ + virtual MatchString createMatchString(unsigned short /*test*/, + const DOMString &/*name*/, + const DOMString &/*value*/) + { + MatchString ret; + return ret; + } + + /** + * + */ + virtual MatchInteger createMatchInteger(unsigned short /*test*/, + const DOMString &/*name*/, + long /*value*/) + { + MatchInteger ret; + return ret; + } + + /** + * + */ + virtual MatchBoolean createMatchBoolean(unsigned short /*test*/, + const DOMString &/*name*/, + bool /*value*/) + { + MatchBoolean ret; + return ret; + } + + /** + * + */ + virtual MatchContent createMatchContent(unsigned short /*test*/, + const DOMString &/*name*/, + unsigned long /*offset*/, + const NodePtr /*nodeArg*/) + { + MatchContent ret; + return ret; + } + + /** + * + */ + virtual MatchSet createMatchSet(unsigned short /*test*/) + { + MatchSet ret; + return ret; + } + + /** + * + */ + virtual StringItem createStringItem(const DOMString &/*name*/) + { + StringItem ret; + return ret; + } + + /** + * + */ + virtual IntegerItem createIntegerItem(const DOMString &/*name*/) + { + IntegerItem ret; + return ret; + } + + /** + * + */ + virtual BooleanItem createBooleanItem(const DOMString &/*name*/) + { + BooleanItem ret; + return ret; + } + + /** + * + */ + virtual ContentItem createContentItem(const DOMString &/*name*/) + { + ContentItem ret; + return ret; + } + + /** + * + */ + virtual void addItem(const Item &item) + { + items.push_back(item); + } + + /** + * + */ + virtual Item getItem(unsigned long index) + { + if (index >= items.size()) + { + Item item; + return item; + } + return items[index]; + } + + /** + * + */ + virtual bool getNext() + { + return false; + } + + //################## + //# Non-API methods + //################## + + /** + * + */ + Segment() {} + + /** + * + */ + Segment(const Segment &other) : Match(other) + { + criteria = other.criteria; + order = other.order; + items = other.items; + } + + /** + * + */ + virtual ~Segment() {} + +protected: + + Match criteria; + + DOMString order; + + std::vector items; + +}; + + + + + + + + + + + + +/*######################################################################### +## View +#########################################################################*/ + +/** + * + */ +class View +{ +public: + + /** + * + */ + virtual void select(const NodePtr /*boundary*/, + unsigned long /*offset*/, + bool /*extend*/, + bool /*add*/) + { + } + + /** + * + */ + virtual Segment createSegment() + { + Segment ret; + return ret; + } + + /** + * + */ + virtual bool matchFirstSegment(Segment &/*todo*/) //inout parm, not const + throw(dom::DOMException) + { + return false; + } + + /** + * + */ + virtual long getIntegerProperty(const DOMString &/*name*/) + throw(dom::DOMException) + { + long val=0; + return val; + } + + /** + * + */ + virtual DOMString getStringProperty(const DOMString &/*name*/) + throw(dom::DOMException) + { + DOMString val; + return val; + } + + /** + * + */ + virtual bool getBooleanProperty(bool /*name*/) + throw(dom::DOMException) + { + bool val=false; + return val; + } + + /** + * + */ + virtual NodePtr getContentPropertyNode(const DOMString &/*name*/) + throw(dom::DOMException) + { + NodePtr val = NULL; + return val; + } + + /** + * + */ + virtual unsigned long getContentPropertyOffset(const DOMString &/*name*/) + throw(dom::DOMException) + { + long val=0; + return val; + } + + //################## + //# Non-API methods + //################## + + /** + * + */ + View() {} + + /** + * + */ + View(const View &/*other*/) + { + } + + /** + * + */ + virtual ~View() {} +}; + + +/*######################################################################### +## VisualResource +#########################################################################*/ + +/** + * + */ +class VisualResource +{ +public: + + + //################## + //# Non-API methods + //################## + + /** + * + */ + VisualResource() {} + + /** + * + */ + VisualResource(const VisualResource &/*other*/) + { + } + + /** + * + */ + virtual ~VisualResource() {} +}; + + +/*######################################################################### +## VisualFont +#########################################################################*/ + +/** + * + */ +class VisualFont : virtual public VisualResource +{ +public: + + /** + * + */ + virtual DOMString getMatchFontName() + { return matchFontName; } + + /** + * + */ + virtual void setMatchFontName(const DOMString &val) + { matchFontName = val; } + + /** + * + */ + virtual bool getExists() + { return true; } + + /** + * + */ + virtual DOMString getFontName() + { return fontName; } + + /** + * + */ + virtual bool getNext() + { return next; } + + //################## + //# Non-API methods + //################## + + /** + * + */ + VisualFont() {} + + /** + * + */ + VisualFont(const VisualFont &other) : VisualResource(other) + { + matchFontName = other.matchFontName; + fontName = other.fontName; + next = other.next; + } + + /** + * + */ + virtual ~VisualFont() {} + +protected: + + DOMString matchFontName; + DOMString fontName; + bool next; + + +}; + + +/*######################################################################### +## VisualSegment +#########################################################################*/ + +/** + * + */ +class VisualSegment : virtual public VisualResource +{ +public: + + + /** + * + */ + virtual bool getMatchPosition() + { return matchPosition; } + + /** + * + */ + virtual void setMatchPosition(bool val) + { matchPosition = val; } + + /** + * + */ + virtual bool getMatchInside() + { return matchInside; } + + /** + * + */ + virtual void setMatchInside(bool val) + { matchInside = val; } + + /** + * + */ + virtual bool getMatchContaining() + { return matchContaining; } + + /** + * + */ + virtual void setMatchContaining(bool val) + { matchContaining = val; } + + /** + * + */ + virtual long getMatchX() + { return matchX; } + + /** + * + */ + virtual void setMatchX(long val) + { matchX = val; } + + /** + * + */ + virtual long getMatchY() + { return matchY; } + + /** + * + */ + virtual void setMatchY(long val) + { matchY = val; } + + /** + * + */ + virtual long getMatchXR() + { return matchXR; } + + /** + * + */ + virtual void setMatchXR(long val) + { matchXR = val; } + + /** + * + */ + virtual long getMatchYR() + { return matchYR; } + + /** + * + */ + virtual void setMatchYR(long val) + { matchYR = val; } + + /** + * + */ + virtual bool getMatchContent() + { return matchContent; } + + /** + * + */ + virtual void setMatchContent(bool val) + { matchContent = val; } + + /** + * + */ + virtual bool getMatchRange() + { return matchRange; } + + /** + * + */ + virtual void setMatchRange(bool val) + { matchRange = val; } + + /** + * + */ + virtual NodePtr getMatchNode() + { return matchNode; } + + /** + * + */ + virtual void setMatchNode(const NodePtr val) + { matchNode = (NodePtr )val; } + + /** + * + */ + virtual unsigned long getMatchOffset() + { return matchOffset; } + + /** + * + */ + virtual void setMatchOffset(unsigned long val) + { matchOffset = val; } + + /** + * + */ + virtual NodePtr getMatchNodeR() + { return matchNodeR; } + + /** + * + */ + virtual void setMatchNodeR(const NodePtr val) + { matchNodeR = (NodePtr )val; } + + /** + * + */ + virtual unsigned long getMatchOffsetR() + { return matchOffsetR; } + + /** + * + */ + virtual void setMatchOffsetR(unsigned long val) + { matchOffsetR = val; } + + /** + * + */ + virtual bool getMatchContainsSelected() + { return matchContainsSelected; } + + /** + * + */ + virtual void setMatchContainsSelected(bool val) + { matchContainsSelected = val; } + + /** + * + */ + virtual bool getMatchContainsVisible() + { return matchContainsVisible; } + + /** + * + */ + virtual void setMatchContainsVisible(bool val) + { matchContainsVisible = val; } + + + /** + * + */ + virtual bool getExists() + { return exists; } + + /** + * + */ + virtual NodePtr getStartNode() + { return startNode; } + + /** + * + */ + virtual unsigned long getStartOffset() + { return startOffset; } + + /** + * + */ + virtual NodePtr getEndNode() + { return endNode; } + + /** + * + */ + virtual unsigned long getEndOffset() + { return endOffset; } + + /** + * + */ + virtual long getTopOffset() + { return topOffset; } + + /** + * + */ + virtual long getBottomOffset() + { return bottomOffset; } + + /** + * + */ + virtual long getLeftOffset() + { return leftOffset; } + + /** + * + */ + virtual long getRightOffset() + { return rightOffset; } + + /** + * + */ + virtual unsigned long getWidth() + { return width; } + + /** + * + */ + virtual unsigned long getHeight() + { return height; } + + /** + * + */ + virtual bool getSelected() + { return selected; } + + /** + * + */ + virtual bool getVisible() + { return visible; } + + /** + * + */ + virtual unsigned long getForegroundColor() + { return foregroundColor; } + + /** + * + */ + virtual unsigned long getBackgroundColor() + { return backgroundColor; } + + /** + * + */ + virtual DOMString getFontName() + { return fontName; } + + /** + * + */ + virtual DOMString getFontHeight() + { return fontHeight; } + + /** + * + */ + virtual bool getNext() + { return next; } + + //################## + //# Non-API methods + //################## + + /** + * + */ + VisualSegment() {} + + /** + * + */ + VisualSegment(const VisualSegment &other) : VisualResource(other) + { + matchPosition = other.matchPosition; + matchInside = other.matchInside; + matchContaining = other.matchContaining; + matchX = other.matchX; + matchY = other.matchY; + matchXR = other.matchXR; + matchYR = other.matchYR; + matchContent = other.matchContent; + matchRange = other.matchRange; + matchNode = other.matchNode; + matchOffset = other.matchOffset; + matchNodeR = other.matchNodeR; + matchOffsetR = other.matchOffsetR; + matchContainsSelected = other.matchContainsSelected; + matchContainsVisible = other.matchContainsVisible; + exists = other.exists; + startNode = other.startNode; + startOffset = other.startOffset; + endNode = other.endNode; + endOffset = other.endOffset; + topOffset = other.topOffset; + bottomOffset = other.bottomOffset; + leftOffset = other.leftOffset; + rightOffset = other.rightOffset; + width = other.width; + height = other.height; + selected = other.selected; + visible = other.visible; + foregroundColor = other.foregroundColor; + backgroundColor = other.backgroundColor; + fontName = other.fontName; + fontHeight = other.fontHeight; + next = other.next; + } + + /** + * + */ + virtual ~VisualSegment() {} + + +protected: + + bool matchPosition; + bool matchInside; + bool matchContaining; + long matchX; + long matchY; + long matchXR; + long matchYR; + bool matchContent; + bool matchRange; + NodePtr matchNode; + unsigned long matchOffset; + NodePtr matchNodeR; + unsigned long matchOffsetR; + bool matchContainsSelected; + bool matchContainsVisible; + bool exists; + NodePtr startNode; + unsigned long startOffset; + NodePtr endNode; + unsigned long endOffset; + long topOffset; + long bottomOffset; + long leftOffset; + long rightOffset; + unsigned long width; + unsigned long height; + bool selected; + bool visible; + unsigned long foregroundColor; + unsigned long backgroundColor; + DOMString fontName; + DOMString fontHeight; + bool next; + + +}; + + +/*######################################################################### +## VisualCharacter +#########################################################################*/ + +/** + * + */ +class VisualCharacter : virtual public VisualSegment +{ +public: + + //################## + //# Non-API methods + //################## + + /** + * + */ + VisualCharacter() + {} + + /** + * + */ + VisualCharacter(const VisualCharacter &other) : VisualResource(other), + VisualSegment(other) + { + } + + /** + * + */ + virtual ~VisualCharacter() {} +}; + + + +/*######################################################################### +## VisualCharacterRun +#########################################################################*/ + +/** + * + */ +class VisualCharacterRun : virtual public VisualSegment +{ +public: + + + //################## + //# Non-API methods + //################## + + /** + * + */ + VisualCharacterRun() {} + + /** + * + */ + VisualCharacterRun(const VisualCharacterRun &other) : VisualResource(other), + VisualSegment(other) + { + } + + /** + * + */ + virtual ~VisualCharacterRun() {} + +protected: + + +}; + + + +/*######################################################################### +## VisualFrame +#########################################################################*/ + +/** + * + */ +class VisualFrame : virtual public VisualSegment +{ +public: + + + /** + * + */ + virtual VisualSegment getEmbedded() + { return embedded; } + + //################## + //# Non-API methods + //################## + + /** + * + */ + VisualFrame() {} + + /** + * + */ + VisualFrame(const VisualFrame &other) : VisualResource(other), + VisualSegment(other) + { + embedded = other.embedded; + } + + /** + * + */ + virtual ~VisualFrame() {} + +protected: + + VisualSegment embedded; +}; + + + +/*######################################################################### +## VisualImage +#########################################################################*/ + +/** + * + */ +class VisualImage : virtual public VisualSegment +{ +public: + + /** + * + */ + virtual DOMString getImageURL() + { return imageURL; } + + /** + * + */ + virtual bool getIsLoaded() + { return isLoaded; } + + + //################## + //# Non-API methods + //################## + + /** + * + */ + VisualImage() {} + + /** + * + */ + VisualImage(const VisualImage &other) : VisualResource(other), + VisualSegment(other) + { + imageURL = other.imageURL; + isLoaded = other.isLoaded; + } + + /** + * + */ + virtual ~VisualImage() {} + +protected: + + DOMString imageURL; + bool isLoaded; + +}; + + + +/*######################################################################### +## VisualFormButton +#########################################################################*/ + +/** + * + */ +class VisualFormButton : virtual public VisualSegment +{ +public: + + /** + * + */ + virtual bool getIsPressed() + { return isPressed; } + + //################## + //# Non-API methods + //################## + + /** + * + */ + VisualFormButton() + { isPressed = false; } + + /** + * + */ + VisualFormButton(const VisualFormButton &other) : VisualResource(other), + VisualSegment(other) + { + isPressed = other.isPressed; + } + + /** + * + */ + virtual ~VisualFormButton() {} + +protected: + + bool isPressed; + +}; + + + +/*######################################################################### +## VisualFormField +#########################################################################*/ + +/** + * + */ +class VisualFormField : virtual public VisualSegment +{ +public: + + /** + * + */ + virtual DOMString getFormValue() + { return formValue; } + + //################## + //# Non-API methods + //################## + + /** + * + */ + VisualFormField() {} + + /** + * + */ + VisualFormField(const VisualFormField &other) : VisualResource(other), + VisualSegment(other) + { + formValue = other.formValue; + } + + /** + * + */ + virtual ~VisualFormField() {} + +protected: + + DOMString formValue; + +}; + + + +/*######################################################################### +## VisualView +#########################################################################*/ + +/** + * + */ +class VisualView +{ +public: + + /** + * + */ + virtual bool getValue() + { return value; } + + /** + * + */ + virtual DOMString getFontScheme() + { return fontScheme; } + + /** + * + */ + virtual unsigned long getWidth() + { return width; } + + /** + * + */ + virtual unsigned long getHeight() + { return height; } + + /** + * + */ + virtual unsigned long getHorizontalDPI() + { return horizontalDPI; } + + /** + * + */ + virtual unsigned long getVerticalDPI() + { return verticalDPI; } + + /** + * + */ + virtual VisualCharacter createVisualCharacter() + { + VisualCharacter ret; + return ret; + } + + /** + * + */ + virtual VisualCharacterRun createVisualCharacterRun() + { + VisualCharacterRun ret; + return ret; + } + /** + * + */ + virtual VisualFrame createVisualFrame() + { + VisualFrame ret; + return ret; + } + + + /** + * + */ + virtual VisualImage createVisualImage() + { + VisualImage ret; + return ret; + } + + /** + * + */ + virtual VisualFormButton createVisualFormButton() + { + VisualFormButton ret; + return ret; + } + + /** + * + */ + virtual VisualFormField createVisualFormField() + { + VisualFormField ret; + return ret; + } + + /** + * + */ + virtual void select(const NodePtr /*boundary*/, + unsigned long /*offset*/, + bool /*extend*/, + bool /*add*/) + { + } + + /** + * + */ + virtual void matchSegment(const VisualResource */*segment*/) + { + } + + + //################## + //# Non-API methods + //################## + + /** + * + */ + VisualView() {} + + /** + * + */ + VisualView(const VisualView &other) + { + value = other.value; + fontScheme = other.fontScheme; + width = other.width; + height = other.height; + horizontalDPI = other.horizontalDPI; + verticalDPI = other.verticalDPI; + } + + /** + * + */ + virtual ~VisualView() {} + +protected: + + bool value; + + DOMString fontScheme; + + unsigned long width; + unsigned long height; + unsigned long horizontalDPI; + unsigned long verticalDPI; + +}; + + + + +} //namespace views +} //namespace dom +} //namespace w3c +} //namespace org + + +#endif /* __VIEWS_LEVEL3_H__ */ +/*######################################################################### +## E N D O F F I L E +#########################################################################*/ + diff --git a/src/dom/views.h b/src/dom/views.h index 078061318..f7d26bcfa 100644 --- a/src/dom/views.h +++ b/src/dom/views.h @@ -13,7 +13,7 @@ * Authors: * Bob Jamison * - * Copyright (C) 2005 Bob Jamison + * Copyright (C) 2005-2008 Bob Jamison * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -51,98 +51,29 @@ typedef dom::Node Node; typedef dom::DOMString DOMString; //forward declarations -class Segment; -class VisualResource; -class VisualCharacter; -class VisualCharacterRun; -class VisualFrame; -class VisualImage; -class VisualFormButton; -class VisualFormField; - +class DocumentView; +class AbstractView; /*######################################################################### -## Match +## AbstractView #########################################################################*/ /** * */ -class Match +class AbstractView { public: - typedef enum - { - IS_EQUAL = 0, - IS_NOT_EQUAL = 1, - INT_PRECEDES = 2, - INT_PRECEDES_OR_EQUALS = 3, - INT_FOLLOWS = 4, - INT_FOLLOWS_OR_EQUALS = 5, - STR_STARTS_WITH = 6, - STR_ENDS_WITH = 7, - STR_CONTAINS = 8, - SET_ANY = 9, - SET_ALL = 10, - SET_NOT_ANY = 11, - SET_NOT_ALL = 12 - } MatchTestGroup; - - /** - * - */ - virtual unsigned short test() - { return IS_NOT_EQUAL; } - - //################## - //# Non-API methods - //################## - - /** - * - */ - Match() {} - /** * */ - Match(const Match &/*other*/) + virtual DocumentView *getDocument() { - } - - /** - * - */ - virtual ~Match() {} -}; - - - -/*######################################################################### -## MatchString -#########################################################################*/ - -/** - * - */ -class MatchString : virtual public Match -{ -public: - - /** - * - */ - virtual DOMString getName() - { return name; } - - /** - * - */ - virtual DOMString getValue() - { return value; } + return documentView; + } //################## //# Non-API methods @@ -151,245 +82,62 @@ public: /** * */ - MatchString() {} + AbstractView() + { documentView = NULL; } /** * */ - MatchString(const MatchString &other) : Match(other) + AbstractView(const AbstractView &other) { - name = other.name; - value = other.value; + assign(other); } /** * */ - virtual ~MatchString() {} - -protected: - - DOMString name; - DOMString value; - - -}; - - - -/*######################################################################### -## MatchInteger -#########################################################################*/ - -/** - * - */ -class MatchInteger : virtual public Match -{ -public: - - /** - * - */ - virtual DOMString getName() - { return name; } - - /** - * - */ - virtual long getValue() - { return value; } - - //################## - //# Non-API methods - //################## - - /** - * - */ - MatchInteger() {} - - /** - * - */ - MatchInteger(const MatchInteger &other) : Match(other) + AbstractView &operator=(const AbstractView &other) { - name = other.name; - value = other.value; + assign(other); + return *this; } /** * */ - virtual ~MatchInteger() {} - -protected: - - DOMString name; - long value; -}; - - - -/*######################################################################### -## MatchBoolean -#########################################################################*/ - -/** - * - */ -class MatchBoolean : virtual public Match -{ -public: - - /** - * - */ - virtual DOMString getName() - { return name; } - - /** - * - */ - virtual bool getValue() - { return value; } - - //################## - //# Non-API methods - //################## + virtual ~AbstractView() {} - /** - * - */ - MatchBoolean() {} +private: - /** - * - */ - MatchBoolean(const MatchBoolean &other) : Match(other) + void assign(const AbstractView &other) { - name = other.name; - value = other.value; - } - - /** - * - */ - virtual ~MatchBoolean() {} - -protected: + documentView = other.documentView; + } - DOMString name; - bool value; + DocumentView *documentView; + }; - /*######################################################################### -## MatchContent +## DocumentView #########################################################################*/ -/** - * - */ -class MatchContent : virtual public Match -{ -public: - - /** - * - */ - virtual DOMString getName() - { return name; } - - /** - * - */ - virtual NodePtr getNodeArg() - { return nodeArg; } - - - /** - * - */ - virtual unsigned long getOffset() - { return offset; } - - //################## - //# Non-API methods - //################## - - /** - * - */ - MatchContent() - { - nodeArg = NULL; - offset = 0L; - } - - /** - * - */ - MatchContent(const MatchContent &other) : Match(other) - { - name = other.name; - nodeArg = other.nodeArg; - offset = other.offset; - } - - /** - * - */ - virtual ~MatchContent() {} - -protected: - - DOMString name; - NodePtr nodeArg; - unsigned long offset; - - - -}; - - - -/*######################################################################### -## MatchSet -#########################################################################*/ /** * */ -class MatchSet : virtual public Match +class DocumentView { public: /** * */ - virtual NodePtr getNodeArg() - { return nodeArg; } - - /** - * - */ - virtual void addMatch(const Match &match) - { matches.push_back(match); } - - /** - * - */ - virtual Match getMatch(unsigned long index) + virtual AbstractView *getDefaultView() { - if (index >= matches.size()) - { - Match match; - return match; - } - return matches[index]; - } + return defaultView; + } //################## //# Non-API methods @@ -398,1553 +146,43 @@ public: /** * */ - MatchSet() - { - nodeArg = NULL; - } + DocumentView() {} /** * */ - MatchSet(const MatchSet &other) : Match(other) + DocumentView(const DocumentView &other) { - nodeArg = other.nodeArg; - matches = other.matches; + assign(other); } /** * */ - virtual ~MatchSet() {} - -protected: - - NodePtr nodeArg; - - std::vector matches; - -}; - - - -/*######################################################################### -## Item -#########################################################################*/ - -/** - * - */ -class Item -{ -public: - - /** - * - */ - virtual bool getExists() - { return exists; } - - /** - * - */ - virtual DOMString getName() - { return name; } - - //################## - //# Non-API methods - //################## - - /** - * - */ - Item() {} - - /** - * - */ - Item(const Item &other) + DocumentView &operator=(const DocumentView &other) { - exists = other.exists; - name = other.name; + assign(other); + return *this; } /** * */ - virtual ~Item() {} - -protected: - - bool exists; - - DOMString name; - - -}; - - - -/*######################################################################### -## StringItem -#########################################################################*/ - -/** - * - */ -class StringItem : virtual public Item -{ -public: - - /** - * - */ - virtual DOMString getValue() - { return value; } + virtual ~DocumentView() {} - //################## - //# Non-API methods - //################## - - /** - * - */ - StringItem() {} +private: - /** - * - */ - StringItem(const StringItem &other) : Item(other) + void assign(const DocumentView &other) { - value = other.value; - } - - /** - * - */ - virtual ~StringItem() {} - -protected: - - DOMString value; - + defaultView = other.defaultView; + } + AbstractView *defaultView; + }; -/*######################################################################### -## IntegerItem -#########################################################################*/ - -/** - * - */ -class IntegerItem : virtual public Item -{ -public: - - - /** - * - */ - virtual long getValue() - { return value; } - - //################## - //# Non-API methods - //################## - - /** - * - */ - IntegerItem() {} - - /** - * - */ - IntegerItem(const IntegerItem &other) : Item(other) - { - value = other.value; - } - - /** - * - */ - virtual ~IntegerItem() {} - -protected: - - long value; - -}; - - -/*######################################################################### -## BooleanItem -#########################################################################*/ - -/** - * - */ -class BooleanItem : virtual public Item -{ -public: - - /** - * - */ - virtual bool getValue() - { return value; } - - //################## - //# Non-API methods - //################## - - /** - * - */ - BooleanItem() {} - - /** - * - */ - BooleanItem(const BooleanItem &other) : Item(other) - { - value = other.value; - } - - /** - * - */ - virtual ~BooleanItem() {} - -protected: - - bool value; - -}; - - -/*######################################################################### -## ContentItem -#########################################################################*/ - -/** - * - */ -class ContentItem : virtual public Item -{ -public: - - /** - * - */ - virtual NodePtr getNodeArg() - { return nodeArg; } - - /** - * - */ - virtual unsigned long getOffset() - { return offset; } - - //################## - //# Non-API methods - //################## - - /** - * - */ - ContentItem() - { - nodeArg = NULL; - } - - /** - * - */ - ContentItem(const ContentItem &other) : Item(other) - { - nodeArg = other.nodeArg; - offset = other.offset; - } - - /** - * - */ - virtual ~ContentItem() {} - -protected: - - NodePtr nodeArg; - long offset; - - -}; - - - - - - - -/*######################################################################### -## Segment -#########################################################################*/ - -/** - * - */ -class Segment : virtual public Match -{ -public: - - /** - * - */ - virtual Match getCriteria() - { return criteria; } - - /** - * - */ - virtual void setCriteria(const Match &val) - { criteria = val; } - - - /** - * - */ - virtual DOMString getOrder() - { return order; } - - /** - * - */ - virtual void setOrder(const DOMString &val) - { order = val; } - - /** - * - */ - virtual MatchString createMatchString(unsigned short /*test*/, - const DOMString &/*name*/, - const DOMString &/*value*/) - { - MatchString ret; - return ret; - } - - /** - * - */ - virtual MatchInteger createMatchInteger(unsigned short /*test*/, - const DOMString &/*name*/, - long /*value*/) - { - MatchInteger ret; - return ret; - } - - /** - * - */ - virtual MatchBoolean createMatchBoolean(unsigned short /*test*/, - const DOMString &/*name*/, - bool /*value*/) - { - MatchBoolean ret; - return ret; - } - - /** - * - */ - virtual MatchContent createMatchContent(unsigned short /*test*/, - const DOMString &/*name*/, - unsigned long /*offset*/, - const NodePtr /*nodeArg*/) - { - MatchContent ret; - return ret; - } - - /** - * - */ - virtual MatchSet createMatchSet(unsigned short /*test*/) - { - MatchSet ret; - return ret; - } - - /** - * - */ - virtual StringItem createStringItem(const DOMString &/*name*/) - { - StringItem ret; - return ret; - } - - /** - * - */ - virtual IntegerItem createIntegerItem(const DOMString &/*name*/) - { - IntegerItem ret; - return ret; - } - - /** - * - */ - virtual BooleanItem createBooleanItem(const DOMString &/*name*/) - { - BooleanItem ret; - return ret; - } - - /** - * - */ - virtual ContentItem createContentItem(const DOMString &/*name*/) - { - ContentItem ret; - return ret; - } - - /** - * - */ - virtual void addItem(const Item &item) - { - items.push_back(item); - } - - /** - * - */ - virtual Item getItem(unsigned long index) - { - if (index >= items.size()) - { - Item item; - return item; - } - return items[index]; - } - - /** - * - */ - virtual bool getNext() - { - return false; - } - - //################## - //# Non-API methods - //################## - - /** - * - */ - Segment() {} - - /** - * - */ - Segment(const Segment &other) : Match(other) - { - criteria = other.criteria; - order = other.order; - items = other.items; - } - - /** - * - */ - virtual ~Segment() {} - -protected: - - Match criteria; - - DOMString order; - - std::vector items; - -}; - - - - - - - - - - - - -/*######################################################################### -## View -#########################################################################*/ - -/** - * - */ -class View -{ -public: - - /** - * - */ - virtual void select(const NodePtr /*boundary*/, - unsigned long /*offset*/, - bool /*extend*/, - bool /*add*/) - { - } - - /** - * - */ - virtual Segment createSegment() - { - Segment ret; - return ret; - } - - /** - * - */ - virtual bool matchFirstSegment(Segment &/*todo*/) //inout parm, not const - throw(dom::DOMException) - { - return false; - } - - /** - * - */ - virtual long getIntegerProperty(const DOMString &/*name*/) - throw(dom::DOMException) - { - long val=0; - return val; - } - - /** - * - */ - virtual DOMString getStringProperty(const DOMString &/*name*/) - throw(dom::DOMException) - { - DOMString val; - return val; - } - - /** - * - */ - virtual bool getBooleanProperty(bool /*name*/) - throw(dom::DOMException) - { - bool val=false; - return val; - } - - /** - * - */ - virtual NodePtr getContentPropertyNode(const DOMString &/*name*/) - throw(dom::DOMException) - { - NodePtr val = NULL; - return val; - } - - /** - * - */ - virtual unsigned long getContentPropertyOffset(const DOMString &/*name*/) - throw(dom::DOMException) - { - long val=0; - return val; - } - - //################## - //# Non-API methods - //################## - - /** - * - */ - View() {} - - /** - * - */ - View(const View &/*other*/) - { - } - - /** - * - */ - virtual ~View() {} -}; - - -/*######################################################################### -## VisualResource -#########################################################################*/ - -/** - * - */ -class VisualResource -{ -public: - - - //################## - //# Non-API methods - //################## - - /** - * - */ - VisualResource() {} - - /** - * - */ - VisualResource(const VisualResource &/*other*/) - { - } - - /** - * - */ - virtual ~VisualResource() {} -}; - - -/*######################################################################### -## VisualFont -#########################################################################*/ - -/** - * - */ -class VisualFont : virtual public VisualResource -{ -public: - - /** - * - */ - virtual DOMString getMatchFontName() - { return matchFontName; } - - /** - * - */ - virtual void setMatchFontName(const DOMString &val) - { matchFontName = val; } - - /** - * - */ - virtual bool getExists() - { return true; } - - /** - * - */ - virtual DOMString getFontName() - { return fontName; } - - /** - * - */ - virtual bool getNext() - { return next; } - - //################## - //# Non-API methods - //################## - - /** - * - */ - VisualFont() {} - - /** - * - */ - VisualFont(const VisualFont &other) : VisualResource(other) - { - matchFontName = other.matchFontName; - fontName = other.fontName; - next = other.next; - } - - /** - * - */ - virtual ~VisualFont() {} - -protected: - - DOMString matchFontName; - DOMString fontName; - bool next; - - -}; - - -/*######################################################################### -## VisualSegment -#########################################################################*/ - -/** - * - */ -class VisualSegment : virtual public VisualResource -{ -public: - - - /** - * - */ - virtual bool getMatchPosition() - { return matchPosition; } - - /** - * - */ - virtual void setMatchPosition(bool val) - { matchPosition = val; } - - /** - * - */ - virtual bool getMatchInside() - { return matchInside; } - - /** - * - */ - virtual void setMatchInside(bool val) - { matchInside = val; } - - /** - * - */ - virtual bool getMatchContaining() - { return matchContaining; } - - /** - * - */ - virtual void setMatchContaining(bool val) - { matchContaining = val; } - - /** - * - */ - virtual long getMatchX() - { return matchX; } - - /** - * - */ - virtual void setMatchX(long val) - { matchX = val; } - - /** - * - */ - virtual long getMatchY() - { return matchY; } - - /** - * - */ - virtual void setMatchY(long val) - { matchY = val; } - - /** - * - */ - virtual long getMatchXR() - { return matchXR; } - - /** - * - */ - virtual void setMatchXR(long val) - { matchXR = val; } - - /** - * - */ - virtual long getMatchYR() - { return matchYR; } - - /** - * - */ - virtual void setMatchYR(long val) - { matchYR = val; } - - /** - * - */ - virtual bool getMatchContent() - { return matchContent; } - - /** - * - */ - virtual void setMatchContent(bool val) - { matchContent = val; } - - /** - * - */ - virtual bool getMatchRange() - { return matchRange; } - - /** - * - */ - virtual void setMatchRange(bool val) - { matchRange = val; } - - /** - * - */ - virtual NodePtr getMatchNode() - { return matchNode; } - - /** - * - */ - virtual void setMatchNode(const NodePtr val) - { matchNode = (NodePtr )val; } - - /** - * - */ - virtual unsigned long getMatchOffset() - { return matchOffset; } - - /** - * - */ - virtual void setMatchOffset(unsigned long val) - { matchOffset = val; } - - /** - * - */ - virtual NodePtr getMatchNodeR() - { return matchNodeR; } - - /** - * - */ - virtual void setMatchNodeR(const NodePtr val) - { matchNodeR = (NodePtr )val; } - - /** - * - */ - virtual unsigned long getMatchOffsetR() - { return matchOffsetR; } - - /** - * - */ - virtual void setMatchOffsetR(unsigned long val) - { matchOffsetR = val; } - - /** - * - */ - virtual bool getMatchContainsSelected() - { return matchContainsSelected; } - - /** - * - */ - virtual void setMatchContainsSelected(bool val) - { matchContainsSelected = val; } - - /** - * - */ - virtual bool getMatchContainsVisible() - { return matchContainsVisible; } - - /** - * - */ - virtual void setMatchContainsVisible(bool val) - { matchContainsVisible = val; } - - - /** - * - */ - virtual bool getExists() - { return exists; } - - /** - * - */ - virtual NodePtr getStartNode() - { return startNode; } - - /** - * - */ - virtual unsigned long getStartOffset() - { return startOffset; } - - /** - * - */ - virtual NodePtr getEndNode() - { return endNode; } - - /** - * - */ - virtual unsigned long getEndOffset() - { return endOffset; } - - /** - * - */ - virtual long getTopOffset() - { return topOffset; } - - /** - * - */ - virtual long getBottomOffset() - { return bottomOffset; } - - /** - * - */ - virtual long getLeftOffset() - { return leftOffset; } - - /** - * - */ - virtual long getRightOffset() - { return rightOffset; } - - /** - * - */ - virtual unsigned long getWidth() - { return width; } - - /** - * - */ - virtual unsigned long getHeight() - { return height; } - - /** - * - */ - virtual bool getSelected() - { return selected; } - - /** - * - */ - virtual bool getVisible() - { return visible; } - - /** - * - */ - virtual unsigned long getForegroundColor() - { return foregroundColor; } - - /** - * - */ - virtual unsigned long getBackgroundColor() - { return backgroundColor; } - - /** - * - */ - virtual DOMString getFontName() - { return fontName; } - - /** - * - */ - virtual DOMString getFontHeight() - { return fontHeight; } - - /** - * - */ - virtual bool getNext() - { return next; } - - //################## - //# Non-API methods - //################## - - /** - * - */ - VisualSegment() {} - - /** - * - */ - VisualSegment(const VisualSegment &other) : VisualResource(other) - { - matchPosition = other.matchPosition; - matchInside = other.matchInside; - matchContaining = other.matchContaining; - matchX = other.matchX; - matchY = other.matchY; - matchXR = other.matchXR; - matchYR = other.matchYR; - matchContent = other.matchContent; - matchRange = other.matchRange; - matchNode = other.matchNode; - matchOffset = other.matchOffset; - matchNodeR = other.matchNodeR; - matchOffsetR = other.matchOffsetR; - matchContainsSelected = other.matchContainsSelected; - matchContainsVisible = other.matchContainsVisible; - exists = other.exists; - startNode = other.startNode; - startOffset = other.startOffset; - endNode = other.endNode; - endOffset = other.endOffset; - topOffset = other.topOffset; - bottomOffset = other.bottomOffset; - leftOffset = other.leftOffset; - rightOffset = other.rightOffset; - width = other.width; - height = other.height; - selected = other.selected; - visible = other.visible; - foregroundColor = other.foregroundColor; - backgroundColor = other.backgroundColor; - fontName = other.fontName; - fontHeight = other.fontHeight; - next = other.next; - } - - /** - * - */ - virtual ~VisualSegment() {} - - -protected: - - bool matchPosition; - bool matchInside; - bool matchContaining; - long matchX; - long matchY; - long matchXR; - long matchYR; - bool matchContent; - bool matchRange; - NodePtr matchNode; - unsigned long matchOffset; - NodePtr matchNodeR; - unsigned long matchOffsetR; - bool matchContainsSelected; - bool matchContainsVisible; - bool exists; - NodePtr startNode; - unsigned long startOffset; - NodePtr endNode; - unsigned long endOffset; - long topOffset; - long bottomOffset; - long leftOffset; - long rightOffset; - unsigned long width; - unsigned long height; - bool selected; - bool visible; - unsigned long foregroundColor; - unsigned long backgroundColor; - DOMString fontName; - DOMString fontHeight; - bool next; - - -}; - - -/*######################################################################### -## VisualCharacter -#########################################################################*/ - -/** - * - */ -class VisualCharacter : virtual public VisualSegment -{ -public: - - //################## - //# Non-API methods - //################## - - /** - * - */ - VisualCharacter() - {} - - /** - * - */ - VisualCharacter(const VisualCharacter &other) : VisualResource(other), - VisualSegment(other) - { - } - - /** - * - */ - virtual ~VisualCharacter() {} -}; - - - -/*######################################################################### -## VisualCharacterRun -#########################################################################*/ - -/** - * - */ -class VisualCharacterRun : virtual public VisualSegment -{ -public: - - - //################## - //# Non-API methods - //################## - - /** - * - */ - VisualCharacterRun() {} - - /** - * - */ - VisualCharacterRun(const VisualCharacterRun &other) : VisualResource(other), - VisualSegment(other) - { - } - - /** - * - */ - virtual ~VisualCharacterRun() {} - -protected: - - -}; - - - -/*######################################################################### -## VisualFrame -#########################################################################*/ - -/** - * - */ -class VisualFrame : virtual public VisualSegment -{ -public: - - - /** - * - */ - virtual VisualSegment getEmbedded() - { return embedded; } - - //################## - //# Non-API methods - //################## - - /** - * - */ - VisualFrame() {} - - /** - * - */ - VisualFrame(const VisualFrame &other) : VisualResource(other), - VisualSegment(other) - { - embedded = other.embedded; - } - - /** - * - */ - virtual ~VisualFrame() {} - -protected: - - VisualSegment embedded; -}; - - - -/*######################################################################### -## VisualImage -#########################################################################*/ - -/** - * - */ -class VisualImage : virtual public VisualSegment -{ -public: - - /** - * - */ - virtual DOMString getImageURL() - { return imageURL; } - - /** - * - */ - virtual bool getIsLoaded() - { return isLoaded; } - - - //################## - //# Non-API methods - //################## - - /** - * - */ - VisualImage() {} - - /** - * - */ - VisualImage(const VisualImage &other) : VisualResource(other), - VisualSegment(other) - { - imageURL = other.imageURL; - isLoaded = other.isLoaded; - } - - /** - * - */ - virtual ~VisualImage() {} - -protected: - - DOMString imageURL; - bool isLoaded; - -}; - - - -/*######################################################################### -## VisualFormButton -#########################################################################*/ - -/** - * - */ -class VisualFormButton : virtual public VisualSegment -{ -public: - - /** - * - */ - virtual bool getIsPressed() - { return isPressed; } - - //################## - //# Non-API methods - //################## - - /** - * - */ - VisualFormButton() - { isPressed = false; } - - /** - * - */ - VisualFormButton(const VisualFormButton &other) : VisualResource(other), - VisualSegment(other) - { - isPressed = other.isPressed; - } - - /** - * - */ - virtual ~VisualFormButton() {} - -protected: - - bool isPressed; - -}; - - - -/*######################################################################### -## VisualFormField -#########################################################################*/ - -/** - * - */ -class VisualFormField : virtual public VisualSegment -{ -public: - - /** - * - */ - virtual DOMString getFormValue() - { return formValue; } - - //################## - //# Non-API methods - //################## - - /** - * - */ - VisualFormField() {} - - /** - * - */ - VisualFormField(const VisualFormField &other) : VisualResource(other), - VisualSegment(other) - { - formValue = other.formValue; - } - - /** - * - */ - virtual ~VisualFormField() {} - -protected: - - DOMString formValue; - -}; - - - -/*######################################################################### -## VisualView -#########################################################################*/ - -/** - * - */ -class VisualView -{ -public: - - /** - * - */ - virtual bool getValue() - { return value; } - - /** - * - */ - virtual DOMString getFontScheme() - { return fontScheme; } - - /** - * - */ - virtual unsigned long getWidth() - { return width; } - - /** - * - */ - virtual unsigned long getHeight() - { return height; } - - /** - * - */ - virtual unsigned long getHorizontalDPI() - { return horizontalDPI; } - - /** - * - */ - virtual unsigned long getVerticalDPI() - { return verticalDPI; } - - /** - * - */ - virtual VisualCharacter createVisualCharacter() - { - VisualCharacter ret; - return ret; - } - - /** - * - */ - virtual VisualCharacterRun createVisualCharacterRun() - { - VisualCharacterRun ret; - return ret; - } - /** - * - */ - virtual VisualFrame createVisualFrame() - { - VisualFrame ret; - return ret; - } - - - /** - * - */ - virtual VisualImage createVisualImage() - { - VisualImage ret; - return ret; - } - - /** - * - */ - virtual VisualFormButton createVisualFormButton() - { - VisualFormButton ret; - return ret; - } - - /** - * - */ - virtual VisualFormField createVisualFormField() - { - VisualFormField ret; - return ret; - } - - /** - * - */ - virtual void select(const NodePtr /*boundary*/, - unsigned long /*offset*/, - bool /*extend*/, - bool /*add*/) - { - } - - /** - * - */ - virtual void matchSegment(const VisualResource */*segment*/) - { - } - - - //################## - //# Non-API methods - //################## - - /** - * - */ - VisualView() {} - - /** - * - */ - VisualView(const VisualView &other) - { - value = other.value; - fontScheme = other.fontScheme; - width = other.width; - height = other.height; - horizontalDPI = other.horizontalDPI; - verticalDPI = other.verticalDPI; - } - - /** - * - */ - virtual ~VisualView() {} - -protected: - - bool value; - - DOMString fontScheme; - - unsigned long width; - unsigned long height; - unsigned long horizontalDPI; - unsigned long verticalDPI; - -}; - diff --git a/src/dom/work/views.idl b/src/dom/work/views.idl index 3cc74512c..7ae0c50a7 100644 --- a/src/dom/work/views.idl +++ b/src/dom/work/views.idl @@ -1,16 +1,16 @@ /* - * Copyright (c) 2004 World Wide Web Consortium, - * - * (Massachusetts Institute of Technology, European Research Consortium for - * Informatics and Mathematics, Keio University). All Rights Reserved. This - * work is distributed under the W3C(r) Software License [1] 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. - * - * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 + * Copyright (c) 2000 World Wide Web Consortium, + * (Massachusetts Institute of Technology, Institut National de + * Recherche en Informatique et en Automatique, Keio University). All + * Rights Reserved. This program is distributed under the W3C's Software + * Intellectual Property License. This program 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 W3C License http://www.w3.org/Consortium/Legal/ for more details. */ -// File: http://www.w3.org/TR/2004/NOTE-DOM-Level-3-Views-20040226/views.idl +// File: http://www.w3.org/TR/2000/REC-DOM-Level-2-Views-20001113/views.idl #ifndef _VIEWS_IDL_ #define _VIEWS_IDL_ @@ -21,232 +21,16 @@ module views { - typedef dom::Node Node; - typedef dom::DOMString DOMString; + interface DocumentView; - interface Segment; - interface VisualResource; - interface VisualCharacter; - interface VisualCharacterRun; - interface VisualFrame; - interface VisualImage; - interface VisualFormButton; - interface VisualFormField; - - // Introduced in DOM Level 3: - interface View { - void select(in Node boundary, - in unsigned long offset, - in boolean extend, - in boolean add); - Segment createSegment(); - boolean matchFirstSegment(inout Segment todo) - raises(dom::DOMException); - long getIntegerProperty(in DOMString name) - raises(dom::DOMException); - DOMString getStringProperty(in DOMString name) - raises(dom::DOMException); - boolean getBooleanProperty(in boolean name) - raises(dom::DOMException); - Node getContentPropertyNode(in DOMString name) - raises(dom::DOMException); - unsigned long getContentPropertyOffset(in DOMString name) - raises(dom::DOMException); - }; - - // Introduced in DOM Level 3: - interface Match { - - // MatchTestGroup - const unsigned short IS_EQUAL = 0; - const unsigned short IS_NOT_EQUAL = 1; - const unsigned short INT_PRECEDES = 2; - const unsigned short INT_PRECEDES_OR_EQUALS = 3; - const unsigned short INT_FOLLOWS = 4; - const unsigned short INT_FOLLOWS_OR_EQUALS = 5; - const unsigned short STR_STARTS_WITH = 6; - const unsigned short STR_ENDS_WITH = 7; - const unsigned short STR_CONTAINS = 8; - const unsigned short SET_ANY = 9; - const unsigned short SET_ALL = 10; - const unsigned short SET_NOT_ANY = 11; - const unsigned short SET_NOT_ALL = 12; - - readonly attribute unsigned short test; - }; - - // Introduced in DOM level 3: - interface MatchString : Match { - readonly attribute DOMString name; - readonly attribute DOMString value; - }; - - // Introduced in DOM level 3: - interface MatchInteger : Match { - readonly attribute DOMString name; - readonly attribute long value; - }; - - // Introduced in DOM level 3: - interface MatchBoolean : Match { - readonly attribute DOMString name; - readonly attribute boolean value; - }; - - // Introduced in DOM level 3: - interface MatchContent : Match { - readonly attribute DOMString name; - readonly attribute Node nodeArg; - readonly attribute unsigned long offset; - }; - - // Introduced in DOM level 3: - interface MatchSet : Match { - readonly attribute Node nodeArg; - void addMatch(in Match add); - Match getMatch(in unsigned long index); - }; - - // Introduced in DOM Level 3: - interface Item { - readonly attribute boolean exists; - readonly attribute DOMString name; - }; - - // Introduced in DOM Level 3: - interface StringItem : Item { - readonly attribute DOMString value; - }; - - // Introduced in DOM Level 3: - interface IntegerItem : Item { - readonly attribute long value; - }; - - // Introduced in DOM Level 3: - interface BooleanItem : Item { - attribute boolean value; - }; - - // Introduced in DOM Level 3: - interface ContentItem : Item { - attribute Node nodeArg; - attribute unsigned long offset; - }; - - interface VisualView { - readonly attribute DOMString fontScheme; - readonly attribute unsigned long width; - readonly attribute unsigned long height; - readonly attribute unsigned long horizontalDPI; - readonly attribute unsigned long verticalDPI; - VisualCharacter createVisualCharacter(); - VisualCharacterRun createVisualCharacterRun(); - VisualFrame createVisualFrame(); - VisualImage createVisualImage(); - VisualFormButton createVisualFormButton(); - VisualFormField createVisualFormField(); - void select(in Node boundary, - in unsigned long offset, - in boolean extend, - in boolean add); - void matchSegment(in VisualResource segment); - }; - - interface VisualResource { - }; - - interface VisualFont : VisualResource { - attribute DOMString matchFontName; - readonly attribute boolean exists; - readonly attribute DOMString fontName; - boolean getNext(); - }; - - interface VisualSegment : VisualResource { - attribute boolean matchPosition; - attribute boolean matchInside; - attribute boolean matchContaining; - attribute long matchX; - attribute long matchY; - attribute long matchXR; - attribute long matchYR; - attribute boolean matchContent; - attribute boolean matchRange; - attribute Node matchNode; - attribute unsigned long matchOffset; - attribute Node matchNodeR; - attribute unsigned long matchOffsetR; - attribute boolean matchContainsSelected; - attribute boolean matchContainsVisible; - readonly attribute boolean exists; - readonly attribute Node startNode; - readonly attribute unsigned long startOffset; - readonly attribute Node endNode; - readonly attribute unsigned long endOffset; - readonly attribute long topOffset; - readonly attribute long bottomOffset; - readonly attribute long leftOffset; - readonly attribute long rightOffset; - readonly attribute unsigned long width; - readonly attribute unsigned long height; - readonly attribute boolean selected; - readonly attribute boolean visible; - readonly attribute unsigned long foregroundColor; - readonly attribute unsigned long backgroundColor; - readonly attribute DOMString fontName; - readonly attribute DOMString fontHeight; - boolean getNext(); - }; - - interface VisualCharacter : VisualSegment { - }; - - interface VisualCharacterRun : VisualSegment { - }; - - interface VisualFrame : VisualSegment { - readonly attribute VisualSegment embedded; - }; - - interface VisualImage : VisualSegment { - readonly attribute DOMString imageURL; - readonly attribute boolean isLoaded; - }; - - interface VisualFormButton : VisualSegment { - readonly attribute boolean isPressed; - }; - - interface VisualFormField : VisualSegment { - readonly attribute DOMString formValue; + // Introduced in DOM Level 2: + interface AbstractView { + readonly attribute DocumentView document; }; - // Introduced in DOM Level 3: - interface Segment : Match { - attribute Match criteria; - attribute DOMString order; - void addItem(in Item add); - MatchString createMatchString(in unsigned short test, - in DOMString name, - in DOMString value); - MatchInteger createMatchInteger(in unsigned short test, - in DOMString name, - in long value); - MatchBoolean createMatchBoolean(in unsigned short test, - in DOMString name, - in boolean value); - MatchContent createMatchContent(in unsigned short test, - in DOMString name, - in unsigned long offset, - in Node nodeArg); - MatchSet createMatchSet(in unsigned short test); - StringItem createStringItem(in DOMString name); - IntegerItem createIntegerItem(in DOMString name); - BooleanItem createBooleanItem(in DOMString name); - ContentItem createContentItem(in DOMString name); - void getItem(in unsigned long index); - boolean getNext(); + // Introduced in DOM Level 2: + interface DocumentView { + readonly attribute AbstractView defaultView; }; };