Ejemplo n.º 1
0
        void SelectionConvert_Click(Microsoft.Office.Core.CommandBarButton Ctrl, ref bool CancelDefault)
        {
            if (!HookDocumentClose(Application.ActiveDocument))
            {
                return;
            }

            try
            {
                WordSelectionDocument doc = new WordSelectionDocument(Application.ActiveDocument, OfficeTextDocument.ProcessingType.eWordByWord);
#if !QueryAllFonts
                // first get the fonts the user wants to process
                OfficeDocumentProcessor aSelectionProcessor = null;
                FontConvertersPicker    aFCsPicker          = new FontConvertersPicker(doc);
                if ((aFCsPicker.ShowDialog() == DialogResult.OK) && (aFCsPicker.SelectedFontConverters.Count > 0))
                {
                    FontConverters aFCs = aFCsPicker.SelectedFontConverters;
                    aSelectionProcessor = new OfficeDocumentProcessor(aFCs, new SILConverterProcessorForm());
                }
#else
                OfficeDocumentProcessor aSelectionProcessor = new OfficeDocumentProcessor((FontConverters)null, new SILConverterProcessorForm());
#endif
                if (aSelectionProcessor != null)
                {
                    doc.ProcessWordByWord(aSelectionProcessor);
                }
            }
            catch (Exception ex)
            {
                DisplayException(ex);
            }
        }
Ejemplo n.º 2
0
        protected virtual FontConverter QueryForFontConvert(string strFontName)
        {
            FontConverter        aFC = null;
            FontConvertersPicker aFontConverterPicker = new FontConvertersPicker(strFontName);

            if (aFontConverterPicker.ShowDialog() == DialogResult.OK)
            {
                aFC = aFontConverterPicker.SelectedFontConverters[strFontName];
            }
            return(aFC);
        }
Ejemplo n.º 3
0
        void ThisStoryConvert()
        {
            if (!HookDocumentClose(Application.ActiveDocument))
            {
                return;
            }

            try
            {
#if DEBUG
                string strPubPIOVer = Application.Version;
                MessageBox.Show(String.Format("MSPub PIA version: {0}", strPubPIOVer));
#endif
                PubStoryDocument doc = new PubStoryDocument(Application.ActiveDocument, OfficeTextDocument.ProcessingType.eWordByWord);

                // we want to process the file word by word and show differences between
                //  the Input and (once) Converted string
                if ((m_aThisStoryWordByWordFontProcessor == null) || (m_strLastStoryName != doc.StoryName))
                {
                    m_aThisStoryWordByWordFontProcessor = null; // just in case we came thru the latter OR case

                    // first get the fonts the user wants to process
                    FontConvertersPicker aFCsPicker = new FontConvertersPicker(doc);
                    if ((aFCsPicker.ShowDialog() == DialogResult.OK) && (aFCsPicker.SelectedFontConverters.Count > 0))
                    {
                        FontConverters aFCs = aFCsPicker.SelectedFontConverters;
                        m_aThisStoryWordByWordFontProcessor = GetDocumentProcessor(aFCs, new SILConverterProcessorForm());
                    }
                }

                if (m_aThisStoryWordByWordFontProcessor != null)
                {
                    if (doc.ProcessWordByWord(m_aThisStoryWordByWordFontProcessor))
                    {
                        m_aThisStoryWordByWordFontProcessor = null;
                        m_strLastStoryName = null;
                    }
                    else
                    {
                        m_strLastStoryName = doc.StoryName;
                    }
                }
            }
            catch (Exception ex)
            {
                DisplayException(ex);
                if ((m_aThisStoryWordByWordFontProcessor != null) && !m_aThisStoryWordByWordFontProcessor.AreLeftOvers)
                {
                    m_aThisStoryWordByWordFontProcessor = null;
                }
            }
        }
Ejemplo n.º 4
0
        void SpellFixerWordByWordFont_Click(Microsoft.Office.Core.CommandBarButton Ctrl, ref bool CancelDefault)
        {
            if (!HookDocumentClose(Application.ActiveDocument))
            {
                return;
            }

            Application.System.Cursor = Word.WdCursorType.wdCursorWait;
            try
            {
                WordDocument doc = new WordDocument(Application.ActiveDocument, OfficeTextDocument.ProcessingType.eWordByWord);

                // we want to process the file word by word and show differences between
                //  the Input and (once) Converted string
                if (m_aWordByWordFontSpellFixerProcessor == null)
                {
                    SpellFixerProcessorForm form = new SpellFixerProcessorForm(GetSpellFixer);

                    // next get the fonts the user wants to process
                    FontConvertersPicker aFCsPicker = new FontConvertersPicker(doc, GetSpellFixer.SpellFixerEncConverter);

                    if ((aFCsPicker.ShowDialog() == DialogResult.OK) && (aFCsPicker.SelectedFontConverters.Count > 0))
                    {
                        m_aWordByWordFontSpellFixerProcessor = new OfficeDocumentProcessor(aFCsPicker.SelectedFontConverters, form);
                    }
                    else
                    {
                        return;
                    }
                }

                if (m_aWordByWordFontSpellFixerProcessor != null)
                {
                    if (doc.ProcessWordByWord(m_aWordByWordFontSpellFixerProcessor))
                    {
                        m_aWordByWordFontSpellFixerProcessor = null;
                    }
                }
            }
            catch (Exception ex)
            {
                DisplayException(ex);
            }
            Application.System.Cursor = Word.WdCursorType.wdCursorNormal;
        }
Ejemplo n.º 5
0
        protected void WholeDocumentConvert()
        {
            if (!HookDocumentClose(Application.ActiveDocument))
            {
                return;
            }

            try
            {
                PubDocument doc = new PubDocument(Application.ActiveDocument, OfficeTextDocument.ProcessingType.eWordByWord);

                // we want to process the file word by word and show differences between
                //  the Input and (once) Converted string
                if (m_aWordByWordFontProcessor == null)
                {
                    // first get the fonts the user wants to process
                    FontConvertersPicker aFCsPicker = new FontConvertersPicker(doc);
                    if ((aFCsPicker.ShowDialog() == DialogResult.OK) && (aFCsPicker.SelectedFontConverters.Count > 0))
                    {
                        FontConverters aFCs = aFCsPicker.SelectedFontConverters;
                        m_aWordByWordFontProcessor = GetDocumentProcessor(aFCs, new SILConverterProcessorForm());
                    }
                }

                if (m_aWordByWordFontProcessor != null)
                {
                    if (doc.ProcessWordByWord(m_aWordByWordFontProcessor))
                    {
                        m_aWordByWordFontProcessor = null;
                    }
                }
            }
            catch (Exception ex)
            {
                DisplayException(ex);
                if ((m_aWordByWordFontProcessor != null) && !m_aWordByWordFontProcessor.AreLeftOvers)
                {
                    m_aWordByWordFontProcessor = null;
                }
            }
        }
Ejemplo n.º 6
0
        void RoundTripCheckFont_Click(Microsoft.Office.Core.CommandBarButton Ctrl, ref bool CancelDefault)
        {
            if (!HookDocumentClose(Application.ActiveDocument))
            {
                return;
            }

            Application.System.Cursor = Word.WdCursorType.wdCursorWait;
            try
            {
                WordDocument doc = new WordDocument(Application.ActiveDocument, OfficeTextDocument.ProcessingType.eWordByWord);

                if (m_aRoundTripCheckFontWordProcessor == null)
                {
                    // first get the fonts the user wants to process
                    FontConvertersPicker aFCsPicker = new FontConvertersPicker(doc);
                    if (aFCsPicker.ShowDialog() == DialogResult.OK)
                    {
                        FontConverters aFCs = aFCsPicker.SelectedFontConverters;
                        m_aRoundTripCheckFontWordProcessor = new RoundTripCheckWordProcessor(aFCs);
                    }
                }

                if (m_aRoundTripCheckFontWordProcessor != null)
                {
                    if (doc.ProcessWordByWord(m_aRoundTripCheckFontWordProcessor))
                    {
                        m_aRoundTripCheckFontWordProcessor = null;
                    }
                }
            }
            catch (Exception ex)
            {
                DisplayException(ex);
            }

            Application.System.Cursor = Word.WdCursorType.wdCursorNormal;
        }
Ejemplo n.º 7
0
		void WholeDocumentConvert_Click(Microsoft.Office.Core.CommandBarButton Ctrl, ref bool CancelDefault)
		{
			if (!HookDocumentClose(Application.ActiveDocument))
				return;

			try
			{
				PubDocument doc = new PubDocument(Application.ActiveDocument, OfficeTextDocument.ProcessingType.eWordByWord);

				// we want to process the file word by word and show differences between
				//  the Input and (once) Converted string
				if (m_aWordByWordFontProcessor == null)
				{
					// first get the fonts the user wants to process
					FontConvertersPicker aFCsPicker = new FontConvertersPicker(doc);
					if ((aFCsPicker.ShowDialog() == DialogResult.OK) && (aFCsPicker.SelectedFontConverters.Count > 0))
					{
						FontConverters aFCs = aFCsPicker.SelectedFontConverters;
						m_aWordByWordFontProcessor = GetDocumentProcessor(aFCs, new SILConverterProcessorForm());
					}
				}

				if (m_aWordByWordFontProcessor != null)
					if (doc.ProcessWordByWord(m_aWordByWordFontProcessor))
						m_aWordByWordFontProcessor = null;
			}
			catch (Exception ex)
			{
				DisplayException(ex);
				if ((m_aWordByWordFontProcessor != null) && !m_aWordByWordFontProcessor.AreLeftOvers)
					m_aWordByWordFontProcessor = null;
			}
		}
Ejemplo n.º 8
0
		void ThisStoryConvert_Click(Microsoft.Office.Core.CommandBarButton Ctrl, ref bool CancelDefault)
		{
			if (!HookDocumentClose(Application.ActiveDocument))
				return;

			try
			{
#if DEBUG
				string strPubPIOVer = Application.Version;
				MessageBox.Show(String.Format("MSPub PIA version: {0}", strPubPIOVer));
#endif
				PubStoryDocument doc = new PubStoryDocument(Application.ActiveDocument, OfficeTextDocument.ProcessingType.eWordByWord);

				// we want to process the file word by word and show differences between
				//  the Input and (once) Converted string
				if ((m_aThisStoryWordByWordFontProcessor == null) || (m_strLastStoryName != doc.StoryName))
				{
					m_aThisStoryWordByWordFontProcessor = null; // just in case we came thru the latter OR case

					// first get the fonts the user wants to process
					FontConvertersPicker aFCsPicker = new FontConvertersPicker(doc);
					if ((aFCsPicker.ShowDialog() == DialogResult.OK) && (aFCsPicker.SelectedFontConverters.Count > 0))
					{
						FontConverters aFCs = aFCsPicker.SelectedFontConverters;
						m_aThisStoryWordByWordFontProcessor = GetDocumentProcessor(aFCs, new SILConverterProcessorForm());
					}
				}

				if (m_aThisStoryWordByWordFontProcessor != null)
				{
					if (doc.ProcessWordByWord(m_aThisStoryWordByWordFontProcessor))
					{
						m_aThisStoryWordByWordFontProcessor = null;
						m_strLastStoryName = null;
					}
					else
					{
						m_strLastStoryName = doc.StoryName;
					}
				}
			}
			catch (Exception ex)
			{
				DisplayException(ex);
				if ((m_aThisStoryWordByWordFontProcessor != null) && !m_aThisStoryWordByWordFontProcessor.AreLeftOvers)
					m_aThisStoryWordByWordFontProcessor = null;
			}
		}
Ejemplo n.º 9
0
		protected virtual FontConverter QueryForFontConvert(string strFontName)
		{
			FontConverter aFC = null;
			FontConvertersPicker aFontConverterPicker = new FontConvertersPicker(strFontName);
			if (aFontConverterPicker.ShowDialog() == DialogResult.OK)
				aFC = aFontConverterPicker.SelectedFontConverters[strFontName];
			return aFC;
		}