Esempio n. 1
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;
			}
		}
Esempio n. 2
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;
                }
            }
        }