This is a class that retrieves assembled styles, either by matching an existing one, or by the path used to create it. We keep track of the path using two dictionaries, one for object properties and one for integer ones. The object one could serve for everything, but a lot of integers would get boxed, and we'd have to do all kinds of trickery to avoid the nuisance that two independent boxes of the same integer are not equal. We could achieve the same functionality without the Triple-keyed dictionaries at all, but much less efficiently: we'd have to create the derived AS every time before finding out that it already exists.
Esempio n. 1
0
		/// <summary>
		/// Intended for use only by AssembledStylesCache to make derived styles.
		/// If inheritedOnly is true, only those properties are copied which should be inherited by
		/// nested boxes.
		/// </summary>
		internal AssembledStyles(AssembledStyles basedOn, bool inheritedOnly)
		{
			m_styleCache = basedOn.m_styleCache; // all derived styles share it
			m_chrp = basedOn.m_chrp;
			m_lineHeight = basedOn.m_lineHeight;
			m_firstLineIndent = basedOn.m_firstLineIndent;
			m_styleName = basedOn.m_styleName;
			RightToLeft = basedOn.RightToLeft;
			if (inheritedOnly)
			{
				SetNonInheritedDefaults();
			}
			else
			{
				// copy everything else, too.
				m_paraAlignment = basedOn.m_paraAlignment;
				m_borderColor = basedOn.m_borderColor;
				m_borders = basedOn.m_borders;
				m_margins = basedOn.m_margins;
				m_pads = basedOn.m_pads;
				m_weight = basedOn.m_weight;
			}
		}
Esempio n. 2
0
		/// <summary>
		/// Default constructor sets initial state
		/// </summary>
		public AssembledStyles(IStylesheet stylesheet)
		{
			m_styleCache = new AssembledStylesCache(stylesheet);
			FontWeight = (int)VwFontWeight.kvfwNormal;
			m_chrp.dympHeight = 10000; // default 10 pt
			SetFaceName(DefaultFontName);
			m_chrp.clrFore = ColorUtil.ConvertColorToBGR(Color.Black);
			m_chrp.clrUnder = m_chrp.clrFore;
			m_borderColor = Color.Black;
			m_chrp.clrBack = ColorUtil.ConvertColorToBGR(Color.Transparent);
			SetNonInheritedDefaults();
			m_styleCache.m_canonicalStyles[this] = this; // AFTER setting all props!!
		}