Пример #1
0
 /// <summary>
 /// Funcion that launch the conversion of a "parameters.inputFile" to daisy
 /// </summary>
 /// <param name="parameters"></param>
 /// <param name="translateParams"></param>
 /// <param name="outputFilePath"></param>
 /// <param name="outputPipeline"></param>
 /// <param name="singleConverter"></param>
 public void ConvertToDaisy(OoxToDaisyParameters parameters, Hashtable translateParams, string outputFilePath, string outputPipeline, SingleConverter singleConverter)
 {
     if (parameters.MasterSubFlag == "No" || parameters.MasterSubFlag == "NoMasterSub")
     {
         //outputFilePath = AddInHelper.buttonIsSingleWordToXMLConversion(parameters.ControlName) ?
         //        outputFilePath + parameters.GetInputFileNameWithoutExtension + ".xml" :
         //        Path.Combine(outputFilePath, "convertedDocument" + ".xml");
         outputFilePath = (outputFilePath + parameters.GetInputFileNameWithoutExtension + ".xml").Replace(',', '_');
         singleConverter.OoxToDaisy(
             parameters.InputFile,
             outputFilePath,
             parameters.ListMathMl,
             translateParams,
             parameters.ControlName,
             outputPipeline);
     }
     else if (parameters.MasterSubFlag == "Yes")
     {
         singleConverter.OoxToDaisyOwn(
             parameters.TempInputFile,
             parameters.TempInputA,
             parameters.InputFile,
             outputFilePath,
             translateParams,
             parameters.ControlName,
             parameters.ListMathMl,
             outputPipeline);
     }
 }
Пример #2
0
        /// <summary>
        /// Default form for converting a word file to DTbook XML
        /// </summary>
        /// <param name="parameters"></param>
        /// <param name="manager"></param>
        public DesignForm(OoxToDaisyParameters parameters, ResourceManager manager)
        {
            btnID              = parameters.ControlName;
            inputFileName      = parameters.InputFile;
            tempInput          = parameters.TempInputFile;
            this.resManager    = manager;
            this.officeVersion = parameters.Version;
            this.masterSubFlag = parameters.MasterSubFlag;

            InitializeComponent();
        }
Пример #3
0
        /// <summary>
        /// Star the conversion of a single word file to selected fornat (
        /// - Function which shows UI to take input from user
        /// </summary>
        public void StartSingleWordConversion(OoxToDaisyParameters parameters)
        {
            if (parameters.ScriptPath != null && parameters.ScriptPath.Length > 0)
            {
                myForm = new DesignForm(
                    parameters.ScriptPath,
                    parameters.InputFile,
                    parameters.Directory,
                    parameters.Version,
                    parameters.ControlName,
                    parameters.TempInputFile,
                    this.resourceManager,
                    parameters.MasterSubFlag);
            }
            else
            {
                myForm = new DesignForm(parameters, this.resourceManager);
            }

            int translateFlag = myForm.DoTranslate();

            if (translateFlag == 1)
            {
                SingleConverter singleConverter = new SingleConverterUI(
                    converter,
                    parameters.ScriptPath != null && parameters.ScriptPath.Length > 0 ?
                    myForm.getParser :
                    null);
                ConvertToDaisy(
                    parameters,
                    myForm.HTable,
                    parameters.ScriptPath.Length > 0 ?
                    AddInHelper.AppDataSaveAsDAISYDirectory :
                    myForm.OutputFilepath,
                    myForm.PipeOutput,
                    singleConverter);
            }
        }
Пример #4
0
        /// <summary>
        /// Form for converting a word to dtbook XML and apply a pipeline script afterward
        /// (post process or conversion to another format)
        /// </summary>
        /// <param name="parameters"></param>
        /// <param name="projectDirectory"></param>
        /// <param name="scriptPath"></param>
        /// <param name="manager"></param>
        public DesignForm(OoxToDaisyParameters parameters, string projectDirectory, string scriptPath, ResourceManager manager)
        {
            btnID              = parameters.ControlName;
            inputFileName      = parameters.InputFile;
            tempInput          = parameters.TempInputFile;
            this.resManager    = manager;
            this.officeVersion = parameters.Version;
            this.masterSubFlag = parameters.MasterSubFlag;

            mInputPath        = parameters.InputFile;
            mProjectDirectory = projectDirectory;
            if (scriptPath != null && scriptPath.Length > 0)
            {
                mParser    = new ScriptParser(scriptPath);
                useAScript = true;
                FileInfo f = new FileInfo(scriptPath);
                if (!AddInHelper.buttonIsSingleWordToXMLConversion(btnID))
                {
                    this.Text = f.Name.Replace(f.Extension, "");
                }
            }
            InitializeComponent();
        }
Пример #5
0
        public void OoxToDaisyWithoutUI(OoxToDaisyParameters parameters, TranslationParametersBuilder parametersBuilder, string outputFilePath, string outputPipeline)
        {
            Hashtable translationParams = parametersBuilder.BuildTranslationParameters();

            ConvertToDaisy(parameters, translationParams, outputFilePath, outputPipeline, new SingleConverter(converter));
        }