/// <summary>
        /// Initialize the factory with an ealready existing IElementBehavior
        /// </summary>
        /// <param name="behavior">behavior we should return</param>
        public ElementBehaviorFactoryForExistingBehavior(IElementBehaviorRaw behavior)
        {
            if (behavior == null)
                throw new ArgumentNullException("behavior", "behavior cannot be null");

            renderingBehavior = behavior;
        }
Example #2
0
        /// <summary>
        /// Initialize the factory with an ealready existing IElementBehavior
        /// </summary>
        /// <param name="behavior">behavior we should return</param>
        public ElementBehaviorFactoryForExistingBehavior(IElementBehaviorRaw behavior)
        {
            if (behavior == null)
            {
                throw new ArgumentNullException("behavior", "behavior cannot be null");
            }

            renderingBehavior = behavior;
        }
        /// <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;
        }
 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();
        }
 protected override void OnFindBehavior(string bstrBehavior, string bstrBehaviorUrl, IElementBehaviorSite pSite, out IElementBehaviorRaw ppBehavior)
 {
     ppBehavior = BehaviorManager.CreateBehavior(bstrBehavior);
 }