/// convert_options_provider.dart /// /// Copyright © 2014-2023 PDF Technologies, Inc. All Rights Reserved. /// /// THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW /// AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT. /// UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES. /// This notice may not be removed from this file. import 'package:flutter/material.dart'; import 'package:kmpdfkit_conversion_flutter/models/convert_type.dart'; import 'package:kmpdfkit_conversion_flutter/models/options/convert_csv_options.dart'; import 'package:kmpdfkit_conversion_flutter/models/options/convert_excel_options.dart'; import 'package:kmpdfkit_conversion_flutter/models/options/convert_html_options.dart'; import 'package:kmpdfkit_conversion_flutter/models/options/convert_image_options.dart'; import 'package:kmpdfkit_conversion_flutter/models/options/convert_ppt_options.dart'; import 'package:kmpdfkit_conversion_flutter/models/options/convert_rtf_options.dart'; import 'package:kmpdfkit_conversion_flutter/models/options/convert_txt_options.dart'; import 'package:kmpdfkit_conversion_flutter/models/options/convert_word_options.dart'; import 'package:kmpdfkit_conversion_flutter/models/options/options.dart'; ///record convert format options class ConvertOptionsProvider extends ChangeNotifier { ConvertType convertType = ConvertType.none; ConvertPPTOptions pptOptions = ConvertPPTOptions(containImages: true, containAnnotations: true); ConvertWordOptions wordOptions = ConvertWordOptions(containImages: true, containAnnotations: true); ConvertExcelOptions excelOptions = ConvertExcelOptions( containImages: true, containAnnotations: false, workSheetOptions: ExcelWorkSheetOptions.forEachPage, contentOptions: ExcelContentOptions.allContent); ConvertImageOptions imageOptions = ConvertImageOptions( containAnnotations: true, imageDpi: 300, imagePageOptions: ImagePageOptions.png); ConvertCSVOptions csvOptions = ConvertCSVOptions(mergeCSV: false); ConvertRTFOptions rtfOptions = ConvertRTFOptions(containImages: true, containAnnotations: true); ConvertHTMLOptions htmlOptions = ConvertHTMLOptions( containImages: true, containAnnotations: false, htmlPageOptions: HtmlPageOptions.singlePage); Options getOptions() { switch (convertType) { case ConvertType.ppt: return pptOptions; case ConvertType.word: return wordOptions; case ConvertType.excel: return excelOptions; case ConvertType.image: return imageOptions; case ConvertType.csv: return csvOptions; case ConvertType.rtf: return rtfOptions; case ConvertType.html: return htmlOptions; default: return ConvertTXTOptions(); } } void changeConvertType(ConvertType convertType) { this.convertType = convertType; notifyListeners(); } void changePPTOptions({bool? containImages, bool? containAnnotations}) { if (containImages != null) { pptOptions.containImages = containImages; } if (containAnnotations != null) { pptOptions.containAnnotations = containAnnotations; } notifyListeners(); } void changeWordOptions({bool? containImages, bool? containAnnotations}) { if (containImages != null) { wordOptions.containImages = containImages; } if (containAnnotations != null) { wordOptions.containAnnotations = containAnnotations; } notifyListeners(); } void changeExcelOptions( {bool? containImages, bool? containAnnotations, ExcelWorkSheetOptions? workSheetOptions, ExcelContentOptions? contentOptions}) { if (containImages != null) { excelOptions.containImages = containImages; } if (containAnnotations != null) { excelOptions.containAnnotations = containAnnotations; } if (workSheetOptions != null) { excelOptions.workSheetOptions = workSheetOptions; } if (contentOptions != null) { excelOptions.contentOptions = contentOptions; } notifyListeners(); } void changeImageOptions( {bool? containAnnotations, int? imageDpi, ImagePageOptions? imagePageOptions}) { if (containAnnotations != null) { imageOptions.containAnnotations = containAnnotations; } if (imageDpi != null) { imageOptions.imageDpi = imageDpi; } if (imagePageOptions != null) { imageOptions.imagePageOptions = imagePageOptions; } notifyListeners(); } void changeCSVOptions(bool mergeCSV) { csvOptions.mergeCSV = mergeCSV; notifyListeners(); } void changeRTFOptions({bool? containImages, bool? containAnnotations}) { if (containImages != null) { rtfOptions.containImages = containImages; } if (containAnnotations != null) { rtfOptions.containAnnotations = containAnnotations; } notifyListeners(); } void changeHtmlOptions( {bool? containImages, bool? containAnnotations, HtmlPageOptions? htmlPageOptions}) { if (containImages != null) { htmlOptions.containImages = containImages; } if (containAnnotations != null) { htmlOptions.containAnnotations = containAnnotations; } if (htmlPageOptions != null) { htmlOptions.htmlPageOptions = htmlPageOptions; } notifyListeners(); } }