Back to index

lightning-sunbird  0.9+nobinonly
nsSVGTSpanFrame.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is the Mozilla SVG project.
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Crocodile Clips Ltd..
00019  * Portions created by the Initial Developer are Copyright (C) 2002
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *   Alex Fritze <alex.fritze@crocodile-clips.com> (original author)
00024  *
00025  * Alternatively, the contents of this file may be used under the terms of
00026  * either of the GNU General Public License Version 2 or later (the "GPL"),
00027  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00028  * in which case the provisions of the GPL or the LGPL are applicable instead
00029  * of those above. If you wish to allow use of your version of this file only
00030  * under the terms of either the GPL or the LGPL, and not to allow others to
00031  * use your version of this file under the terms of the MPL, indicate your
00032  * decision by deleting the provisions above and replace them with the notice
00033  * and other provisions required by the GPL or the LGPL. If you do not delete
00034  * the provisions above, a recipient may use your version of this file under
00035  * the terms of any one of the MPL, the GPL or the LGPL.
00036  *
00037  * ***** END LICENSE BLOCK ***** */
00038 
00039 #ifndef NSSVGTSPANFRAME_H
00040 #define NSSVGTSPANFRAME_H
00041 
00042 #include "nsContainerFrame.h"
00043 #include "nsIDOMSVGTSpanElement.h"
00044 #include "nsPresContext.h"
00045 #include "nsISVGTextContainerFrame.h"
00046 #include "nsISVGRendererCanvas.h"
00047 #include "nsWeakReference.h"
00048 #include "nsISVGValue.h"
00049 #include "nsISVGValueObserver.h"
00050 #include "nsIDOMSVGSVGElement.h"
00051 #include "nsIDOMSVGMatrix.h"
00052 #include "nsIDOMSVGLengthList.h"
00053 #include "nsIDOMSVGLength.h"
00054 #include "nsISVGValueUtils.h"
00055 #include "nsIDOMSVGAnimatedLengthList.h"
00056 #include "nsISVGContainerFrame.h"
00057 #include "nsISVGChildFrame.h"
00058 #include "nsISVGTextFrame.h"
00059 #include "nsISVGGlyphFragmentNode.h"
00060 #include "nsIDOMSVGRect.h"
00061 #include "nsISVGOuterSVGFrame.h"
00062 #include "nsSVGRect.h"
00063 #include "nsSVGMatrix.h"
00064 #include "nsINameSpaceManager.h"
00065 #include "nsSVGAtoms.h"
00066 #include "nsLayoutAtoms.h"
00067 
00068 typedef nsContainerFrame nsSVGTSpanFrameBase;
00069 
00070 class nsSVGTSpanFrame : public nsSVGTSpanFrameBase,
00071                         public nsISVGTextContainerFrame,
00072                         public nsISVGGlyphFragmentNode,
00073                         public nsISVGChildFrame,
00074                         public nsISVGContainerFrame,
00075                         public nsISVGValueObserver,
00076                         public nsSupportsWeakReference
00077 {
00078   friend nsresult
00079   NS_NewSVGTSpanFrame(nsIPresShell* aPresShell, nsIContent* aContent,
00080                       nsIFrame* parentFrame, nsIFrame** aNewFrame);
00081 protected:
00082   nsSVGTSpanFrame();
00083   virtual ~nsSVGTSpanFrame();
00084   virtual nsresult InitSVG();
00085 
00086    // nsISupports interface:
00087   NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
00088 private:
00089   NS_IMETHOD_(nsrefcnt) AddRef() { return NS_OK; }
00090   NS_IMETHOD_(nsrefcnt) Release() { return NS_OK; }
00091 public:
00092   // nsIFrame:
00093 
00094   NS_IMETHOD  AppendFrames(nsIAtom*        aListName,
00095                            nsIFrame*       aFrameList);
00096   NS_IMETHOD  InsertFrames(nsIAtom*        aListName,
00097                            nsIFrame*       aPrevFrame,
00098                            nsIFrame*       aFrameList);
00099   NS_IMETHOD  RemoveFrame(nsIAtom*        aListName,
00100                           nsIFrame*       aOldFrame);
00101   NS_IMETHOD  ReplaceFrame(nsIAtom*        aListName,
00102                            nsIFrame*       aOldFrame,
00103                            nsIFrame*       aNewFrame);
00104   NS_IMETHOD Init(nsPresContext*  aPresContext,
00105                   nsIContent*      aContent,
00106                   nsIFrame*        aParent,
00107                   nsStyleContext*  aContext,
00108                   nsIFrame*        aPrevInFlow);
00109 
00115   virtual nsIAtom* GetType() const;
00116   virtual PRBool IsFrameOfType(PRUint32 aFlags) const;
00117 
00118 #ifdef DEBUG
00119   NS_IMETHOD GetFrameName(nsAString& aResult) const
00120   {
00121     return MakeFrameName(NS_LITERAL_STRING("SVGTSpan"), aResult);
00122   }
00123 #endif
00124 
00125   // nsISVGValueObserver
00126   NS_IMETHOD WillModifySVGObservable(nsISVGValue* observable,
00127                                      nsISVGValue::modificationType aModType);
00128   NS_IMETHOD DidModifySVGObservable (nsISVGValue* observable,
00129                                      nsISVGValue::modificationType aModType);
00130 
00131   // nsISupportsWeakReference
00132   // implementation inherited from nsSupportsWeakReference
00133 
00134   // nsISVGChildFrame interface:
00135   NS_IMETHOD PaintSVG(nsISVGRendererCanvas* canvas, const nsRect& dirtyRectTwips);
00136   NS_IMETHOD GetFrameForPointSVG(float x, float y, nsIFrame** hit);
00137   NS_IMETHOD_(already_AddRefed<nsISVGRendererRegion>) GetCoveredRegion();
00138   NS_IMETHOD InitialUpdate();
00139   NS_IMETHOD NotifyCanvasTMChanged();
00140   NS_IMETHOD NotifyRedrawSuspended();
00141   NS_IMETHOD NotifyRedrawUnsuspended();
00142   NS_IMETHOD SetMatrixPropagation(PRBool aPropagate);
00143   NS_IMETHOD GetBBox(nsIDOMSVGRect **_retval);
00144 
00145   // nsISVGContainerFrame interface:
00146   nsISVGOuterSVGFrame *GetOuterSVGFrame();
00147   already_AddRefed<nsIDOMSVGMatrix> GetCanvasTM();
00148   already_AddRefed<nsSVGCoordCtxProvider> GetCoordContextProvider();
00149 
00150   // nsISVGTextContainerFrame interface:
00151   NS_IMETHOD_(nsISVGTextFrame *) GetTextFrame();
00152   NS_IMETHOD_(PRBool) GetAbsolutePositionAdjustmentX(float &x, PRUint32 charNum);
00153   NS_IMETHOD_(PRBool) GetAbsolutePositionAdjustmentY(float &y, PRUint32 charNum);
00154   NS_IMETHOD_(PRBool) GetRelativePositionAdjustmentX(float &dx, PRUint32 charNum);
00155   NS_IMETHOD_(PRBool) GetRelativePositionAdjustmentY(float &dy, PRUint32 charNum);
00156   NS_IMETHOD_(already_AddRefed<nsIDOMSVGLengthList>) GetX();
00157   NS_IMETHOD_(already_AddRefed<nsIDOMSVGLengthList>) GetY();
00158   NS_IMETHOD_(already_AddRefed<nsIDOMSVGLengthList>) GetDx();
00159   NS_IMETHOD_(already_AddRefed<nsIDOMSVGLengthList>) GetDy();
00160 
00161   // nsISVGGlyphFragmentNode interface:
00162   NS_IMETHOD_(nsISVGGlyphFragmentLeaf *) GetFirstGlyphFragment();
00163   NS_IMETHOD_(nsISVGGlyphFragmentLeaf *) GetNextGlyphFragment();
00164   NS_IMETHOD_(PRUint32) BuildGlyphFragmentTree(PRUint32 charNum, PRBool lastBranch);
00165   NS_IMETHOD_(void) NotifyMetricsSuspended();
00166   NS_IMETHOD_(void) NotifyMetricsUnsuspended();
00167   NS_IMETHOD_(void) NotifyGlyphFragmentTreeSuspended();
00168   NS_IMETHOD_(void) NotifyGlyphFragmentTreeUnsuspended();
00169 
00170 protected:
00171   nsISVGGlyphFragmentNode *GetFirstGlyphFragmentChildNode();
00172   nsISVGGlyphFragmentNode *GetNextGlyphFragmentChildNode(nsISVGGlyphFragmentNode*node);
00173 
00174 private:
00175   PRUint32 mCharOffset; // index of first character of this node relative to the enclosing <text>-element
00176   PRBool mFragmentTreeDirty;
00177   PRBool mPropagateTransform;
00178 };
00179 
00180 #endif