Example #1
0
 public void Init(IElementBehaviorSite pBehaviorSite)
 {
     // then you can extract some information from the element
     //m_Element = pBehaviorSite.GetElement();
     //IHTMLStyle2 style = (IHTMLStyle2)m_Element.style;
     ////style.position = "absolute";
     //IHTMLStyle style3 = (IHTMLStyle)m_Element.style;
     ////style3.zIndex = "10000";
 }
Example #2
0
 IElementBehavior IElementBehaviorFactory.FindBehavior(string bstrBehavior, string bstrBehaviorUrl,
                                                       IElementBehaviorSite pSite)
 {
     // Find behavior will be called several times during the object initialization, but
     // we have to create new proxy-object Canvas only in case when bstrBehavior is null
     if (bstrBehavior == null)
     {
         Guid scopeForCanvas = GetScope(pSite.GetElement().document);
         //return new Canvas(scopeForCanvas);
         return new mshtml.CanvasProxy();
     }
     return null;
 }
        /// <summary>
        /// Return the behavior we were passed in our constructor. Note that this method
        /// insures that it is called only once via an assertion.
        /// </summary>
        /// <param name="bstrBehavior"></param>
        /// <param name="bstrBehaviorUrl"></param>
        /// <param name="pSite"></param>
        /// <param name="ppBehavior"></param>
        public void FindBehavior(string bstrBehavior, string bstrBehaviorUrl, IElementBehaviorSite pSite, ref IElementBehaviorRaw ppBehavior)
        {
            // Fix bug 519990: Setting ppBehavior to null, even in the failure case,
            // causes Writer to crash when an embedded Google Map is pasted into the
            // editor. If there is no behavior, DON'T TOUCH ppBehavior!

            // remind users of this class not to allow this to be called more than once
            Debug.Assert(findBehaviorCalled == false);

            // update call state
            findBehaviorCalled = true;

            // return rendering behavior
            ppBehavior = renderingBehavior;
        }
Example #4
0
        /// <summary>
        /// Return the behavior we were passed in our constructor. Note that this method
        /// insures that it is called only once via an assertion.
        /// </summary>
        /// <param name="bstrBehavior"></param>
        /// <param name="bstrBehaviorUrl"></param>
        /// <param name="pSite"></param>
        /// <param name="ppBehavior"></param>
        public void FindBehavior(string bstrBehavior, string bstrBehaviorUrl, IElementBehaviorSite pSite, ref IElementBehaviorRaw ppBehavior)
        {
            // Fix bug 519990: Setting ppBehavior to null, even in the failure case,
            // causes Writer to crash when an embedded Google Map is pasted into the
            // editor. If there is no behavior, DON'T TOUCH ppBehavior!

            // remind users of this class not to allow this to be called more than once
            Debug.Assert(findBehaviorCalled == false);

            // update call state
            findBehaviorCalled = true;

            // return rendering behavior
            ppBehavior = renderingBehavior;
        }
Example #5
0
        //void IECanvasHost.global::Interop.IObjectSafety.GetInterfaceSafetyOptions(ref Guid riid, out uint pdwSupportedOptions, out uint pdwEnabledOptions)
        //{
        //    throw new NotImplementedException();
        //}

        //void IECanvasHost.global::SharpCanvas.Interop.IObjectSafety.SetInterfaceSafetyOptions(ref Guid riid, uint dwOptionSetMask, uint dwEnabledOptions)
        //{
        //    throw new NotImplementedException();
        //}

        #region IElementBehavior Members

        void IElementBehavior.Init(IElementBehaviorSite pBehaviorSite)
        {
            throw new NotImplementedException();
        }
Example #6
0
 /// <summary>
 /// IElementBehavior.Init -- Notifies the Dynamic HTML (DHTML) behavior that it has been instantiated
 /// </summary>
 /// <param name="pBehaviorSite">Pointer to the IElementBehaviorSite interface through
 /// which the DHTML behavior communicates with MSHTML </param>
 void IElementBehaviorRaw.Init(IElementBehaviorSite pBehaviorSite)
 {
     // retain references to key interfaces
     _elementBehaviorSite = pBehaviorSite;
     _htmlPaintSite       = (IHTMLPaintSiteRaw)_elementBehaviorSite;
 }
Example #7
0
 public IElementBehavior FindBehavior(string bstrBehavior, string bstrBehaviorUrl, IElementBehaviorSite pSite)
 {
     return(this);
 }
 protected virtual void OnFindBehavior(string bstrBehavior, string bstrBehaviorUrl, IElementBehaviorSite pSite, out IElementBehaviorRaw ppBehavior)
 {
     // default to no behavior
     ppBehavior = null;
 }
        // allow subclasses to implement the behavior factory by overriding
        void IElementBehaviorFactoryRaw.FindBehavior(string bstrBehavior, string bstrBehaviorUrl, IElementBehaviorSite pSite, ref IElementBehaviorRaw ppBehavior)
        {
            // Fix bug 519990: Setting ppBehavior to null, even in the failure case,
            // causes Writer to crash when an embedded Google Map is pasted into the
            // editor. If there is no behavior, DON'T TOUCH ppBehavior!

            IElementBehaviorRaw behavior;
            OnFindBehavior(bstrBehavior, bstrBehaviorUrl, pSite, out behavior);
            if (behavior != null)
                ppBehavior = behavior;
            else
                throw new NotImplementedException();
        }
Example #10
0
 public void Init(IElementBehaviorSite pBehaviorSite)
 {
     // then you can extract some information from the element
     //m_Element = pBehaviorSite.GetElement();
     //IHTMLStyle2 style = (IHTMLStyle2)m_Element.style;
     ////style.position = "absolute";
     //IHTMLStyle style3 = (IHTMLStyle)m_Element.style;
     ////style3.zIndex = "10000";
 }
Example #11
0
 public IElementBehavior FindBehavior(string bstrBehavior, string bstrBehaviorUrl, IElementBehaviorSite pSite)
 {
     return this;
 }
 protected override void OnFindBehavior(string bstrBehavior, string bstrBehaviorUrl, IElementBehaviorSite pSite, out IElementBehaviorRaw ppBehavior)
 {
     ppBehavior = BehaviorManager.CreateBehavior(bstrBehavior);
 }
Example #13
0
 void IElementBehavior.Detach()
 {
     OnBehaviorDetach();
     _behaviorSite = null;
 }
Example #14
0
 void IElementBehavior.Init(IElementBehaviorSite pBehaviorSite)
 {
     _behaviorSite = pBehaviorSite;
     OnBehaviorInit();
 }
 /// <summary>
 /// IElementBehavior.Init -- Notifies the Dynamic HTML (DHTML) behavior that it has been instantiated
 /// </summary>
 /// <param name="pBehaviorSite">Pointer to the IElementBehaviorSite interface through
 /// which the DHTML behavior communicates with MSHTML </param>
 void IElementBehaviorRaw.Init(IElementBehaviorSite pBehaviorSite)
 {
     // retain references to key interfaces
     _elementBehaviorSite = pBehaviorSite;
     _htmlPaintSite = (IHTMLPaintSiteRaw)_elementBehaviorSite;
 }
Example #16
0
        public IElementBehavior FindBehavior(string bstrBehavior, string bstrBehaviorUrl, IElementBehaviorSite pSite)
        {
            string s = pSite.GetElement().ToString();

            if (pSite.GetElement() is IHTMLImgElement)
            {
                imgb = new ImageBehavior();
                return(imgb);
            }
            else if (pSite.GetElement() is IHTMLEmbedElement)
            {
                embedb = new EmbedBehavior();
                return(embedb);
            }
            else if (pSite.GetElement() is IHTMLObjectElement)
            {
                flashb = new FlashBehavior();
                return(flashb);
            }
            else if (pSite.GetElement() is mshtml.IHTMLTable)
            {
                tableb = new TableBehavior();
                return(tableb);
            }
            else if ((pSite.GetElement() is mshtml.IHTMLTableCell))
            {
                tablecellb = new TableCellBehavior();
                return(tablecellb);
            }
            else if (pSite.GetElement() is mshtml.IHTMLHRElement)
            {
                lineb = new LineBehavior();
                return(lineb);
            }
            else if (pSite.GetElement() is mshtml.IHTMLAnchorElement)
            {
                linkb = new LINKBehavior();
                return(linkb);
            }
            else if (pSite.GetElement() is mshtml.IHTMLPhraseElement)
            {
                phraseb = new PhraseBehavior();
                return(phraseb);
            }
            else if (pSite.GetElement() is mshtml.IHTMLHeaderElement)
            {
                headerb = new HeaderBehavior();
                return(headerb);
            }
            else if (pSite.GetElement() is mshtml.IHTMLParaElement)
            {
                pb = new PBehavior();
                return(pb);
            }
            else if (pSite.GetElement() is mshtml.IHTMLFontElement)
            {
                fontb = new FontBehavior();
                return(fontb);
            }
            else
            {
                return(null);
            }
        }