using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using LBWordLibrary;

namespace ImportWordContent
{
	public partial class frmImportWordContent : Form
	{
		public frmImportWordContent()
		{
			InitializeComponent();
		}
		private void ofd_FileOk(object sender, CancelEventArgs e)
		{
			tbWordFile.Text = ofd.FileName;
		}
		private void btnBrowse_Click(object sender, EventArgs e)
		{
			ofd.ShowDialog();
		}
		LBApplicationClass _WordApp;
		private void btnOpen_Click(object sender, EventArgs e)
		{
			_WordApp = new LBApplicationClass();
			_WordApp.Documents.Open(tbWordFile.Text);
			_WordApp.Visible = true;
		}

		private void btnNext_Click(object sender, EventArgs e)
		{
			_WordApp.Selection.MoveDown(LBWdUnits.wdScreen, 1, 0);
		}

		private void btnParagraph_Click(object sender, EventArgs e)
		{
			_WordApp.Selection.MoveDown(LBWdUnits.wdParagraph, 1, 0);
			_WordApp.Selection.MoveDown(LBWdUnits.wdParagraph, 1, 1);
			tbParagraph.Text = _WordApp.Selection.Text;
			tbStyle.Text = _WordApp.Selection.Style.NameLocal;
			tbLevel.Text = _WordApp.Selection.Style.ListLevelNumber.ToString();
		}

		private void btnPrevious_Click(object sender, EventArgs e)
		{
			_WordApp.Selection.MoveUp(LBWdUnits.wdParagraph, 1, 0);
			_WordApp.Selection.MoveUp(LBWdUnits.wdParagraph, 1, 1);
			tbParagraph.Text = _WordApp.Selection.Text;
			tbStyle.Text = _WordApp.Selection.Style.NameLocal;
			tbLevel.Text = _WordApp.Selection.Style.ListLevelNumber.ToString();
		}
	}
}
