public IPairTagMatch searchCloserFor(IPairTagMatch opener, uint startAt)
        {
            BBCodeTagMatch tm = opener as BBCodeTagMatch;

            if (tm == null || string.IsNullOrEmpty(tm.tagName))
            {
                return(null);
            }

            IPairTagMatch successMatch = null;
            IPairTagMatch m;
            int           j = 0xFFFFFF;
            int           i = tm.tagCloserInfos.Count;

            while (i-- > 0)
            {
                m = searchCloserByName(tm.tagCloserInfos[i].tagName, tm.tagCloserInfos[i].isTagOpener, startAt);
                if (m != null && m.tagIndex < j)
                {
                    j            = m.tagIndex;
                    successMatch = m;
                }
            }
            return(successMatch);
        }
        public IPairTagMatch searchOpenerAs(IPairTagMatch opener, uint startAt)
        {
            BBCodeTagMatch tm = opener as BBCodeTagMatch;

            if (tm == null || string.IsNullOrEmpty(tm.tagName))
            {
                return(null);
            }

            return(searchOpenerByName(tm.tagName, startAt));
        }
        public IPairTagMatch searchOpenerAs(IPairTagMatch opener, uint startAt)
        {
            BBCodeTagMatch tm = opener as BBCodeTagMatch;

            if (tm == null || tm.tagName == null || tm.tagName.Length < 1)
            {
                return(null);
            }

            return(searchOpenerByName(tm.tagName, startAt));
        }
        protected Boolean _hadleTag_BgColor(BBCodeTagMatch tm)
        {
            BBCodeStyle.Color c = _extractTagColor(tm.tagParam);
            if (c == null)
            {
                return(false);
            }

            tm.bbCodeStyle.backColor = c;
            return(true);
        }
		public Boolean isHandleable(IPairTagMatch tagMatch)
		{
			_tm = tagMatch as BBCodeTagMatch;
			if (_tm == null || !_tm.isTagOpener)
				return false;

			_tmName = _tm.tagName;
			if (_tmName == null || _tmName.Length < 1)
				return false;

			_tmName = _tmName.ToUpper();
			if (!_handlers.ContainsKey(_tmName) || _handlers[_tmName] == null)
				return false;

			return true;
		}
        protected Boolean _hadleTag_Size(BBCodeTagMatch tm)
        {
            if (string.IsNullOrEmpty(tm.tagParam))
            {
                return(false);
            }

            tm.bbCodeStyle.isAbsFontSize = true;

            String p           = tm.tagParam;
            String firstSymbol = p.Substring(0, 1);

            if (firstSymbol == "+" || firstSymbol == "-")
            {
                //  p = p.Substring(1);
                tm.bbCodeStyle.isAbsFontSize = false;
            }

            tm.bbCodeStyle.fontSize = Convert.ToSingle(p);
            return(true);
        }
        public Boolean isHandleable(IPairTagMatch tagMatch)
        {
            _tm = tagMatch as BBCodeTagMatch;
            if (_tm == null || !_tm.isTagOpener)
            {
                return(false);
            }

            _tmName = _tm.tagName;
            if (string.IsNullOrEmpty(_tmName))
            {
                return(false);
            }

            _tmName = _tmName.ToUpper();
            if (!_handlers.ContainsKey(_tmName) || _handlers[_tmName] == null)
            {
                return(false);
            }

            return(true);
        }
        protected BBCodeTagMatch _toTagMatch(Boolean isOpener, Match m)
        {
            if (m == null)
            {
                return(null);
            }

            Group mi        = m.Groups["slashA"];
            int   numSlashA = (mi != null && mi.Success) ? mi.Length : 0;

            mi = m.Groups["slashB"];
            int numSlashB = (mi != null && mi.Success) ? mi.Length : 0;

            mi = m.Groups["tagVal"];
            String tagVal   = (mi != null && mi.Success) ? mi.Value : "";
            int    tagIndex = (mi != null && mi.Success) ? mi.Index : -1;

            mi = m.Groups["tagName"];
            String tagName = (mi != null && mi.Success) ? mi.Value : "";

            mi = m.Groups["tagParam"];
            String tagParam = (mi != null && mi.Success) ? mi.Value : "";

            BBCodeTagMatch tm = new BBCodeTagMatch(isOpener,
                                                   tagIndex,
                                                   tagVal,
                                                   tagName,
                                                   tagParam,
                                                   (uint)numSlashA,
                                                   (uint)numSlashB,
                                                   true);

            if (isOpener)
            {
                tm.bbCodeStyle = new BBCodeStyle();
            }

            return(tm);
        }
Example #9
0
        public static BBCodeStyle getNodeStyle(IndexTree tree)
        {
            if (tree == null)
            {
                return(null);
            }

            IPairTag pairTag = tree.data as IPairTag;

            if (pairTag == null)
            {
                return(null);
            }

            BBCodeTagMatch tm = pairTag.openerMatch as BBCodeTagMatch;

            if (tm == null)
            {
                return(null);
            }

            return(tm.bbCodeStyle);
        }
Example #10
0
        protected Boolean _hadleTag_Font(BBCodeTagMatch tm)
        {
            if (tm.tagParam == null || tm.tagParam.Length < 2)
            {
                return(false);
            }

            String fontName  = tm.tagParam;
            String tmpSymbol = fontName.Substring(0, 1);

            if (tmpSymbol == "\"" || tmpSymbol == "'")
            {
                fontName = fontName.Substring(1);
            }

            tmpSymbol = fontName.Substring(fontName.Length - 1, 1);
            if (tmpSymbol == "\"" || tmpSymbol == "'")
            {
                fontName = fontName.Substring(0, fontName.Length - 1);
            }

            tm.bbCodeStyle.fontName = fontName.Length == 0 ? null : fontName;
            return(true);
        }
Example #11
0
		protected Boolean _hadleTag_NotB(BBCodeTagMatch tm)
		{
			tm.bbCodeStyle.isBold = StateMode.OFF;
			return true;
		}
Example #12
0
		protected Boolean _hadleTag_S(BBCodeTagMatch tm)
		{
			tm.bbCodeStyle.isStriked = StateMode.ON;
			return true;
		}
Example #13
0
		protected Boolean _hadleTag_U(BBCodeTagMatch tm)
		{
			tm.bbCodeStyle.isUnderlined = StateMode.ON;
			return true;
		}
Example #14
0
 protected Boolean _hadleTag_I(BBCodeTagMatch tm)
 {
     tm.bbCodeStyle.isItalic = StateMode.ON;
     return(true);
 }
Example #15
0
		protected Boolean _hadleTag_I(BBCodeTagMatch tm)
		{
			tm.bbCodeStyle.isItalic = StateMode.ON;
			return true;
		}
Example #16
0
		protected Boolean _hadleTag_Size(BBCodeTagMatch tm)
		{
			if (tm.tagParam == null)
				return false;

			tm.bbCodeStyle.isAbsFontSize = true;

			String p = tm.tagParam;
			String firstSymbol = p.Substring(0, 1);
			if (firstSymbol == "+" || firstSymbol == "-")
			{
				//	p = p.Substring(1);
				tm.bbCodeStyle.isAbsFontSize = false;
			}

			tm.bbCodeStyle.fontSize = Convert.ToSingle(p);
			return true;
		}
Example #17
0
		protected Boolean _hadleTag_BgColor(BBCodeTagMatch tm)
		{
			BBCodeStyle.Color c = _extractTagColor(tm.tagParam);
			if (c == null)
				return false;

			tm.bbCodeStyle.backColor = c;
			return true;
		}
Example #18
0
		protected Boolean _hadleTag_Font(BBCodeTagMatch tm)
		{
			if (tm.tagParam == null || tm.tagParam.Length < 2)
				return false;

			String fontName = tm.tagParam;
			String tmpSymbol = fontName.Substring(0, 1);
			if (tmpSymbol == "\"" || tmpSymbol == "'")
				fontName = fontName.Substring(1);

			tmpSymbol = fontName.Substring(fontName.Length - 1, 1);
			if (tmpSymbol == "\"" || tmpSymbol == "'")
				fontName = fontName.Substring(0, fontName.Length - 1);

			tm.bbCodeStyle.fontName = (fontName.Length < 1) ? null : fontName;
			return true;
		}
Example #19
0
		protected BBCodeTagMatch _toTagMatch(Boolean isOpener, Match m)
		{
			if (m == null)
				return null;

			Group mi = m.Groups["slashA"];
			int numSlashA = (mi != null && mi.Success) ? mi.Length : 0;

			mi = m.Groups["slashB"];
			int numSlashB = (mi != null && mi.Success) ? mi.Length : 0;

			mi = m.Groups["tagVal"];
			String tagVal = (mi != null && mi.Success) ? mi.Value : "";
			int tagIndex = (mi != null && mi.Success) ? mi.Index : -1;

			mi = m.Groups["tagName"];
			String tagName = (mi != null && mi.Success) ? mi.Value : "";

			mi = m.Groups["tagParam"];
			String tagParam = (mi != null && mi.Success) ? mi.Value : "";

			BBCodeTagMatch tm = new BBCodeTagMatch(isOpener,
												   tagIndex,
												   tagVal,
												   tagName,
												   tagParam,
												   (uint)numSlashA,
												   (uint)numSlashB,
												   true);

			if (isOpener)
				tm.bbCodeStyle = new BBCodeStyle();

			return tm;
		}
Example #20
0
 protected Boolean _hadleTag_S(BBCodeTagMatch tm)
 {
     tm.bbCodeStyle.isStriked = StateMode.ON;
     return(true);
 }
Example #21
0
 protected Boolean _hadleTag_U(BBCodeTagMatch tm)
 {
     tm.bbCodeStyle.isUnderlined = StateMode.ON;
     return(true);
 }
Example #22
0
 protected Boolean _hadleTag_NotB(BBCodeTagMatch tm)
 {
     tm.bbCodeStyle.isBold = StateMode.OFF;
     return(true);
 }