Exemplo n.º 1
0
        private void FillStylesCombo(string sStyle)
        {
            m_cbStyle.Enabled = true;
            m_cbStyle.Items.Clear();
            m_cbStyle.Sorted = true;
            IStStyle stySel = null;

            for (int i = 0; i < m_stylesheet.CStyles; ++i)
            {
                int      hvo = m_stylesheet.get_NthStyle(i);
                IStStyle sty = m_cache.ServiceLocator.GetInstance <IStStyleRepository>().GetObject(hvo);
                if (sty.Type == StyleType.kstCharacter)
                {
                    m_cbStyle.Items.Add(sty);
                    if (sty.Name == sStyle)
                    {
                        stySel = sty;
                    }
                }
            }
            if (stySel == null)
            {
                // TODO: Should we create a style here to match the name???
            }
            else
            {
                m_cbStyle.SelectedItem = stySel;
            }
        }
Exemplo n.º 2
0
        public void TestAddAndRetrieveStyle()
        {
            IVwStylesheet stylesheet  = (IVwStylesheet) new TestFwStylesheet();
            int           hvoNewStyle = stylesheet.MakeNewStyle();

            stylesheet.PutStyle("FirstStyle", "bls", hvoNewStyle, 0, hvoNewStyle, 0, false,
                                false, null);
            Assert.AreEqual(hvoNewStyle, stylesheet.get_NthStyle(0));
        }
Exemplo n.º 3
0
 private void InitializeStylesCombo(string sStyle)
 {
     m_cbStyles.Items.Clear();
     m_cbStyles.Sorted = true;
     for (int i = 0; i < m_stylesheet.CStyles; ++i)
     {
         int      hvo = m_stylesheet.get_NthStyle(i);
         IStStyle sty = m_cache.ServiceLocator.GetInstance <IStStyleRepository>().GetObject(hvo);
         if (sty.Type == StyleType.kstParagraph)
         {
             m_cbStyles.Items.Add(sty);
         }
     }
     foreach (IStStyle sty in m_cbStyles.Items)
     {
         if (sty.Name == sStyle)
         {
             m_cbStyles.SelectedItem = sty;
             break;
         }
     }
 }
Exemplo n.º 4
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Fill in the list of style names.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		protected override void FillInStylesComboList(UIListDisplayProperties display, IVwStylesheet stylesheet)
		{
			display.List.Clear();
			string charImage = "CharStyle";
			string paraImage = "ParaStyle";
			int cStyles = stylesheet.CStyles;
			for (int i = 0; i < cStyles; ++i)
			{
				string name = stylesheet.get_NthStyleName(i);
				int hvo = stylesheet.get_NthStyle(i);
				int type = stylesheet.GetType(name);
				if (type == (int)StyleType.kstCharacter || IsSelectionInParagraph)
				{
					display.List.Add(name, name,
						type == (int)StyleType.kstCharacter ? charImage : paraImage,
						null);
				}
			}
			string nameDefault = StyleUtils.DefaultParaCharsStyleName;
			display.List.Add(nameDefault, nameDefault, charImage, null);
			display.List.Sort();
		}
Exemplo n.º 5
0
		private void ReadStyles(IVwStylesheet vss)
		{
			string normalStyleName = vss.GetDefaultBasedOnStyleName();
			m_styleTable = new StyleInfoTable(normalStyleName,
				m_cache.ServiceLocator.WritingSystemManager);
			int cStyles = vss.CStyles;
			for (int i = 0; i < cStyles; ++i)
			{
				int hvo = vss.get_NthStyle(i);
				var sty = m_cache.ServiceLocator.GetInstance<IStStyleRepository>().GetObject(hvo);
				// CSS does not implement the kind of inheritance our styles use. To get the style
				// definitions we want in the CSS, we must create these styles using the 'net effect' of
				// each style and all the ones it is based on. Happily the VwStyleSheet knows exactly
				// how to do this.
				var props = vss.GetStyleRgch(sty.Name.Length, sty.Name);
				var exportStyleInfo = new ExportStyleInfo(sty, props);
				m_styleTable.Add(GetValidCssClassName(sty.Name), exportStyleInfo);
			}
		}
Exemplo n.º 6
0
		private void ReadStyles(IVwStylesheet vss)
		{
			string normalStyleName = vss.GetDefaultBasedOnStyleName();
			m_styleTable = new StyleInfoTable(normalStyleName,
				m_cache.LanguageWritingSystemFactoryAccessor);
			int cStyles = vss.CStyles;
			for (int i = 0; i < cStyles; ++i)
			{
				int hvo = vss.get_NthStyle(i);
				IStStyle sty = StStyle.CreateFromDBObject(m_cache, hvo);
				m_styleTable.Add(sty.Name, new ExportStyleInfo(sty));
			}
		}