From 35dd3f13f40c28951e66c0736b2a302323a1ac18 Mon Sep 17 00:00:00 2001 From: "Alexander.Trofimov" Date: Tue, 25 Aug 2015 09:24:49 +0000 Subject: [PATCH] delete ASCOfficeEWSEditor git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@64277 954022d7-b5bf-4e40-9824-e11837661b57 --- .gitattributes | 1 - ASCOfficeEWSEditor/ASCOfficeEWSEditor.sln | 20 - .../ASCOfficeEWSEditor.csproj | 599 ------- .../ASCOfficeEWSEditor/Editor/AutoFilter.cs | 626 ------- .../Editor/Calculation/CellItem.cs | 202 --- .../Formulas/BinOpCalc/AddCalculator.cs | 206 --- .../Formulas/BinOpCalc/Arithmetic.cs | 22 - .../Formulas/BinOpCalc/ConcatCalculator.cs | 228 --- .../Formulas/BinOpCalc/DivCalculator.cs | 230 --- .../Formulas/BinOpCalc/EqCalculator.cs | 206 --- .../Formulas/BinOpCalc/GtCalculator.cs | 206 --- .../BinOpCalc/IFullBinaryOpDispatcher.cs | 58 - .../Formulas/BinOpCalc/IsectCalculator.cs | 16 - .../Formulas/BinOpCalc/LtCalculator.cs | 206 --- .../Formulas/BinOpCalc/MulCalculator.cs | 206 --- .../Formulas/BinOpCalc/PowerCalculator.cs | 220 --- .../Formulas/BinOpCalc/RangeCalculator.cs | 16 - .../BinOpCalc/ReferenceOperatorsCalculator.cs | 223 --- .../Formulas/BinOpCalc/SubCalculator.cs | 206 --- .../Formulas/BinOpCalc/UnionCalculator.cs | 16 - .../Calculation/Formulas/CellParsedFormula.cs | 51 - .../Formulas/DataObjects/IDataObject.cs | 22 - .../Formulas/DataObjects/ObjectBoolean.cs | 108 -- .../Formulas/DataObjects/ObjectEmpty.cs | 98 -- .../Formulas/DataObjects/ObjectError.cs | 91 - .../Formulas/DataObjects/ObjectNumber.cs | 101 -- .../Formulas/DataObjects/ObjectReference.cs | 370 ---- .../Formulas/DataObjects/ObjectString.cs | 110 -- .../Editor/Calculation/Formulas/ErrorValue.cs | 155 -- .../Formulas/FormulaFormatException.cs | 50 - .../Calculation/Formulas/NameParsedFormula.cs | 38 - .../Calculation/Formulas/ParsedFormula.cs | 655 ------- .../Editor/Calculation/Formulas/Precision.cs | 60 - .../Ptgs/Functions/FunctionsStorage.cs | 474 ----- .../Formulas/Ptgs/Functions/PtgFuncAbs.cs | 16 - .../Formulas/Ptgs/Functions/PtgFuncAnd.cs | 82 - .../Formulas/Ptgs/Functions/PtgFuncAverage.cs | 40 - .../Formulas/Ptgs/Functions/PtgFuncCeiling.cs | 29 - .../Ptgs/Functions/PtgFuncConcatenate.cs | 23 - .../Formulas/Ptgs/Functions/PtgFuncCos.cs | 16 - .../Formulas/Ptgs/Functions/PtgFuncCount.cs | 40 - .../Ptgs/Functions/PtgFuncErrorType.cs | 32 - .../Formulas/Ptgs/Functions/PtgFuncEven.cs | 16 - .../Formulas/Ptgs/Functions/PtgFuncExact.cs | 56 - .../Formulas/Ptgs/Functions/PtgFuncFalse.cs | 20 - .../Formulas/Ptgs/Functions/PtgFuncFloor.cs | 36 - .../Formulas/Ptgs/Functions/PtgFuncIf.cs | 61 - .../Formulas/Ptgs/Functions/PtgFuncIfError.cs | 45 - .../Formulas/Ptgs/Functions/PtgFuncInt.cs | 16 - .../Formulas/Ptgs/Functions/PtgFuncIs.cs | 108 -- .../Formulas/Ptgs/Functions/PtgFuncIsEven.cs | 39 - .../Formulas/Ptgs/Functions/PtgFuncIsOdd.cs | 39 - .../Formulas/Ptgs/Functions/PtgFuncLower.cs | 41 - .../Formulas/Ptgs/Functions/PtgFuncMRound.cs | 32 - .../Formulas/Ptgs/Functions/PtgFuncMath.cs | 91 - .../Formulas/Ptgs/Functions/PtgFuncMax.cs | 64 - .../Formulas/Ptgs/Functions/PtgFuncMin.cs | 64 - .../Formulas/Ptgs/Functions/PtgFuncMod.cs | 34 - .../Formulas/Ptgs/Functions/PtgFuncN.cs | 34 - .../Formulas/Ptgs/Functions/PtgFuncNa.cs | 20 - .../Formulas/Ptgs/Functions/PtgFuncNot.cs | 40 - .../Formulas/Ptgs/Functions/PtgFuncOdd.cs | 16 - .../Formulas/Ptgs/Functions/PtgFuncOr.cs | 82 - .../Formulas/Ptgs/Functions/PtgFuncPi.cs | 20 - .../Formulas/Ptgs/Functions/PtgFuncPower.cs | 40 - .../Formulas/Ptgs/Functions/PtgFuncRept.cs | 68 - .../Formulas/Ptgs/Functions/PtgFuncRound.cs | 42 - .../Ptgs/Functions/PtgFuncRoundDown.cs | 40 - .../Formulas/Ptgs/Functions/PtgFuncRoundUp.cs | 40 - .../Formulas/Ptgs/Functions/PtgFuncSign.cs | 16 - .../Formulas/Ptgs/Functions/PtgFuncSin.cs | 16 - .../Formulas/Ptgs/Functions/PtgFuncSqrt.cs | 20 - .../Formulas/Ptgs/Functions/PtgFuncSum.cs | 37 - .../Formulas/Ptgs/Functions/PtgFuncT.cs | 29 - .../Formulas/Ptgs/Functions/PtgFuncTan.cs | 16 - .../Formulas/Ptgs/Functions/PtgFuncTrue.cs | 20 - .../Formulas/Ptgs/Functions/PtgFuncType.cs | 49 - .../Ptgs/Functions/PtgFuncUnsupported.cs | 24 - .../Formulas/Ptgs/Functions/PtgFuncUpper.cs | 41 - .../Calculation/Formulas/Ptgs/OperandPtg.cs | 24 - .../Calculation/Formulas/Ptgs/OperandPtg3D.cs | 123 -- .../Calculation/Formulas/Ptgs/OperatorPtg.cs | 58 - .../Editor/Calculation/Formulas/Ptgs/Ptg.cs | 18 - .../Calculation/Formulas/Ptgs/PtgAdd.cs | 36 - .../Calculation/Formulas/Ptgs/PtgArea.cs | 211 --- .../Calculation/Formulas/Ptgs/PtgArea3D.cs | 212 --- .../Calculation/Formulas/Ptgs/PtgBool.cs | 45 - .../Calculation/Formulas/Ptgs/PtgConcat.cs | 33 - .../Calculation/Formulas/Ptgs/PtgDiv.cs | 33 - .../Editor/Calculation/Formulas/Ptgs/PtgEq.cs | 33 - .../Calculation/Formulas/Ptgs/PtgErr.cs | 45 - .../Calculation/Formulas/Ptgs/PtgFunc.cs | 122 -- .../Editor/Calculation/Formulas/Ptgs/PtgGe.cs | 45 - .../Editor/Calculation/Formulas/Ptgs/PtgGt.cs | 33 - .../Calculation/Formulas/Ptgs/PtgIsect.cs | 40 - .../Editor/Calculation/Formulas/Ptgs/PtgLe.cs | 45 - .../Editor/Calculation/Formulas/Ptgs/PtgLt.cs | 33 - .../Calculation/Formulas/Ptgs/PtgMissedArg.cs | 46 - .../Calculation/Formulas/Ptgs/PtgMul.cs | 33 - .../Calculation/Formulas/Ptgs/PtgName.cs | 100 -- .../Editor/Calculation/Formulas/Ptgs/PtgNe.cs | 45 - .../Calculation/Formulas/Ptgs/PtgNum.cs | 41 - .../Calculation/Formulas/Ptgs/PtgParen.cs | 77 - .../Calculation/Formulas/Ptgs/PtgPercent.cs | 54 - .../Calculation/Formulas/Ptgs/PtgPower.cs | 33 - .../Calculation/Formulas/Ptgs/PtgRange.cs | 72 - .../Calculation/Formulas/Ptgs/PtgRef.cs | 155 -- .../Calculation/Formulas/Ptgs/PtgRef3D.cs | 173 -- .../Calculation/Formulas/Ptgs/PtgRefErr3D.cs | 47 - .../Calculation/Formulas/Ptgs/PtgStr.cs | 48 - .../Calculation/Formulas/Ptgs/PtgSub.cs | 36 - .../Calculation/Formulas/Ptgs/PtgUminus.cs | 59 - .../Calculation/Formulas/Ptgs/PtgUnion.cs | 21 - .../Calculation/Formulas/Ptgs/PtgUplus.cs | 58 - .../Editor/Calculation/HyperlinkItem.cs | 69 - .../Editor/Calculation/IObserver.cs | 20 - .../Editor/Calculation/ISubject.cs | 10 - .../Editor/Calculation/NameItem.cs | 121 -- .../Editor/Calculation/RangeSubject.cs | 50 - .../Editor/Calculation/SubjectsStorage.cs | 71 - .../Editor/Calculation/ValuesUpdateManager.cs | 297 ---- .../Editor/Calculation/WorksheetSubject.cs | 32 - .../Editor/CalculationTables/Power.cs | 80 - .../ASCOfficeEWSEditor/Editor/Cells/Cell.cs | 95 - .../Editor/Cells/CellRange.cs | 376 ---- .../Editor/Cells/CellRange3D.cs | 104 -- .../Editor/Cells/CellRangeRel.cs | 118 -- .../ASCOfficeEWSEditor/Editor/Cells/Offset.cs | 24 - .../Editor/Charts/Anchor.cs | 597 ------- .../Editor/Charts/BasicChar.cs | 126 -- .../ASCOfficeEWSEditor/Editor/Charts/Chart.cs | 254 --- .../Editor/Charts/Layout.cs | 167 -- .../Editor/Charts/Legend.cs | 87 - .../ASCOfficeEWSEditor/Editor/Charts/Misc.cs | 28 - .../Editor/Charts/PlotArea.cs | 257 --- .../Editor/Charts/Series.cs | 546 ------ .../ASCOfficeEWSEditor/Editor/Chartsheet.cs | 110 -- .../Editor/DefinedNames/DefinedName.cs | 28 - .../Editor/DefinedNames/DefinedNames.cs | 209 --- .../ASCOfficeEWSEditor/Editor/EWSEditor.cs | 353 ---- .../Editor/Events/CellsUpdatedEventArg.cs | 34 - .../Editor/Events/ErrorDescription.cs | 31 - .../Editor/Events/FileNotFoundError.cs | 24 - .../Editor/Events/FormulaFormatError.cs | 61 - .../Editor/Events/InternalError.cs | 24 - .../Editor/Events/OperandExpectedError.cs | 17 - .../Editor/Events/OperatorExpectedError.cs | 17 - .../Editor/Events/ReportableException.cs | 20 - .../Editor/Events/SystemIOError.cs | 24 - .../Editor/Events/UnknownFunctionError.cs | 17 - .../Editor/Events/UnknownOperandError.cs | 17 - .../Editor/Events/UnknownOperatorError.cs | 17 - .../Events/UnsupportedFileFormatError.cs | 24 - .../Events/WrongParenthesisSequenceError.cs | 17 - .../Events/WrongReferenceFormatError.cs | 27 - .../Editor/FileFormats/CsvLoader.cs | 231 --- .../Editor/FileFormats/CsvSaver.cs | 81 - .../Editor/FileFormats/Serializer.cs | 241 --- .../Editor/FileFormats/XlsxLoader.cs | 170 -- .../Editor/FileFormats/XlsxSaver.cs | 184 -- .../Editor/Format/Alignment/Alignment.cs | 224 --- .../Format/Alignment/AlignmentEntity.cs | 55 - .../Format/Alignment/HorizontalProperty.cs | 111 -- .../Editor/Format/Alignment/IndentProperty.cs | 51 - .../Alignment/JustifyLastLineProperty.cs | 25 - .../Format/Alignment/ReadingOrderProperty.cs | 81 - .../Alignment/RelativeIndentProperty.cs | 51 - .../Format/Alignment/ShrinkToFitProperty.cs | 24 - .../Format/Alignment/TextRotationProperty.cs | 51 - .../Format/Alignment/VerticalProperty.cs | 92 - .../Format/Alignment/WrapTextProperty.cs | 23 - .../Editor/Format/Borders/Border.cs | 152 -- .../Editor/Format/Borders/BorderEntity.cs | 83 - .../Editor/Format/Borders/BorderProperty.cs | 63 - .../Editor/Format/Borders/Borders.cs | 90 - .../Format/Borders/DiagonalTypeProperty.cs | 79 - .../Editor/Format/Borders/OutlineProperty.cs | 21 - .../Editor/Format/Borders/StyleProperty.cs | 153 -- .../Editor/Format/Colors/Color.cs | 149 -- .../Editor/Format/Colors/ColorProperty.cs | 97 - .../Editor/Format/Colors/ColorValue.cs | 488 ------ .../Editor/Format/Colors/Palette.cs | 224 --- .../Editor/Format/Fills/BottomProperty.cs | 19 - .../Editor/Format/Fills/DegreeProperty.cs | 19 - .../Editor/Format/Fills/FillEntity.cs | 104 -- .../Editor/Format/Fills/Fills.cs | 45 - .../Editor/Format/Fills/GradientFill.cs | 192 -- .../Format/Fills/GradientFillProperty.cs | 26 - .../Format/Fills/GradientTypeProperty.cs | 68 - .../Editor/Format/Fills/LeftProperty.cs | 19 - .../Editor/Format/Fills/PatternFill.cs | 107 -- .../Format/Fills/PatternFillProperty.cs | 17 - .../Editor/Format/Fills/PatternProperty.cs | 170 -- .../Editor/Format/Fills/RightProperty.cs | 19 - .../Editor/Format/Fills/StopProperty.cs | 41 - .../Editor/Format/Fills/TopProperty.cs | 19 - .../Editor/Format/Font/BoldProperty.cs | 21 - .../Editor/Format/Font/CharsetProperty.cs | 48 - .../Editor/Format/Font/CondenseProperty.cs | 22 - .../Editor/Format/Font/ExtendProperty.cs | 22 - .../Editor/Format/Font/FamilyProperty.cs | 47 - .../Editor/Format/Font/Font.cs | 374 ---- .../Editor/Format/Font/FontEntity.cs | 94 - .../Editor/Format/Font/FontNameProperty.cs | 48 - .../Editor/Format/Font/FontSizeProperty.cs | 48 - .../Editor/Format/Font/ItalicProperty.cs | 22 - .../Editor/Format/Font/OutlineProperty.cs | 22 - .../Editor/Format/Font/SchemeProperty.cs | 88 - .../Editor/Format/Font/ShadowProperty.cs | 22 - .../Format/Font/StrikethroughProperty.cs | 23 - .../Editor/Format/Font/SubscriptProperty.cs | 65 - .../Editor/Format/Font/SuperscriptProperty.cs | 64 - .../Editor/Format/Font/UnderlineProperty.cs | 23 - .../Editor/Format/Format.cs | 368 ---- .../Editor/Format/IProperty.cs | 437 ----- .../Editor/Format/IStyleEntity.cs | 17 - .../Editor/Format/IdEntity.cs | 46 - .../Editor/Format/InlineEntity.cs | 55 - .../Format/NumberFormat/NumberFormatEntity.cs | 22 - .../Format/Protection/HiddenProperty.cs | 23 - .../Format/Protection/LockedProperty.cs | 23 - .../Editor/Format/Protection/Protection.cs | 66 - .../Format/Protection/ProtectionEntity.cs | 33 - .../Editor/Format/SeparateEntity.cs | 96 - .../Editor/Hyperlinks/Hyperlink.cs | 83 - .../Editor/Hyperlinks/Hyperlinks.cs | 285 --- .../ASCOfficeEWSEditor/Editor/Images/Image.cs | 557 ------ .../ASCOfficeEWSEditor/Editor/MergeCells.cs | 247 --- .../Editor/NumberFormat/NumberFormatParser.cs | 566 ------ .../NumberFormat/NumberFormatsStorage.cs | 67 - .../Editor/OOX/ChartsheetFile.cs | 62 - .../Editor/OOX/ContentTypes.cs | 91 - .../Editor/OOX/IOrderedSections.cs | 12 - .../Editor/OOX/Relationships.cs | 174 -- .../Editor/OOX/SharedStringsFile.cs | 45 - .../Editor/OOX/StyleSheetFile.cs | 58 - .../Editor/OOX/TableFile.cs | 57 - .../Editor/OOX/ThemeFile.cs | 57 - .../Editor/OOX/WorkbookFile.cs | 59 - .../Editor/OOX/WorksheetFile.cs | 78 - .../ASCOfficeEWSEditor/Editor/OOX/XmlFile.cs | 113 -- .../ASCOfficeEWSEditor/Editor/Range.cs | 922 ---------- .../Editor/SharedStrings.cs | 114 -- .../ASCOfficeEWSEditor/Editor/Sheet.cs | 203 --- .../ASCOfficeEWSEditor/Editor/Sheets.cs | 275 --- .../Editor/Sorting/SortParameters.cs | 78 - .../ASCOfficeEWSEditor/Editor/StyleSheet.cs | 237 --- .../ASCOfficeEWSEditor/Editor/Table.cs | 445 ----- .../ASCOfficeEWSEditor/Editor/Theme.cs | 80 - .../Editor/Walkers/CellDeleter.cs | 74 - .../Editor/Walkers/CellRowNumberCorrector.cs | 33 - .../Editor/Walkers/CellSimpleGetter.cs | 175 -- .../Editor/Walkers/CellWalker.cs | 170 -- .../Editor/Walkers/CellsCopySetter.cs | 91 - .../Editor/Walkers/CellsNodesCollector.cs | 36 - .../Editor/Walkers/CellsSubstitutionSetter.cs | 103 -- .../Editor/Walkers/CellsUnregistrer.cs | 49 - .../Editor/Walkers/ColsWalker.cs | 133 -- .../Editor/Walkers/ExistentCellsCollector.cs | 98 -- .../FirstNonEmptyFormulaValueCollector.cs | 54 - .../Editor/Walkers/FormulaGetter.cs | 65 - .../Editor/Walkers/FormulaRecheck.cs | 45 - .../Editor/Walkers/FormulaSetter.cs | 145 -- .../Walkers/FormulaTextAndValueUpdater.cs | 52 - .../Editor/Walkers/FormulasParser.cs | 102 -- .../Editor/Walkers/HyperlinkGetter.cs | 59 - .../Editor/Walkers/HyperlinkSetter.cs | 82 - .../Editor/Walkers/ICellSetter.cs | 13 - .../Editor/Walkers/IColsSetter.cs | 13 - .../Editor/Walkers/IRowsCollector.cs | 12 - .../Editor/Walkers/IRowsSetter.cs | 13 - .../Editor/Walkers/IStatCollector.cs | 27 - .../Editor/Walkers/NonEmptyCellsCollector.cs | 102 -- .../Editor/Walkers/RangeWalker.cs | 275 --- .../Editor/Walkers/RemovedStringsCollector.cs | 48 - .../Editor/Walkers/RowsCellCollector.cs | 77 - .../Editor/Walkers/RowsCellDeleter.cs | 71 - .../Editor/Walkers/RowsCellMover.cs | 99 -- .../Editor/Walkers/RowsCellSetter.cs | 94 - .../Editor/Walkers/RowsHeightSetter.cs | 32 - .../Editor/Walkers/RowsRowNumberCorrector.cs | 66 - .../Editor/Walkers/RowsWalker.cs | 125 -- .../Editor/Walkers/SortValuesCollector.cs | 56 - .../Editor/Walkers/StyleCollector.cs | 857 --------- .../Editor/Walkers/StyleSetter.cs | 193 -- .../Editor/Walkers/ValueGetter.cs | 130 -- .../Editor/Walkers/ValueSetter.cs | 222 --- .../Editor/Walkers/WidthSetter.cs | 34 - .../ASCOfficeEWSEditor/Editor/Workbook.cs | 391 ----- .../ASCOfficeEWSEditor/Editor/Worksheet.cs | 1557 ----------------- .../ASCOfficeEWSEditor/Editor/Worksheets.cs | 168 -- .../ExcelDefaultFiles/TableStyleDark1.xml | 1 - .../ExcelDefaultFiles/TableStyleDark10.xml | 1 - .../ExcelDefaultFiles/TableStyleDark11.xml | 1 - .../ExcelDefaultFiles/TableStyleDark2.xml | 1 - .../ExcelDefaultFiles/TableStyleDark3.xml | 1 - .../ExcelDefaultFiles/TableStyleDark4.xml | 1 - .../ExcelDefaultFiles/TableStyleDark5.xml | 1 - .../ExcelDefaultFiles/TableStyleDark6.xml | 1 - .../ExcelDefaultFiles/TableStyleDark7.xml | 1 - .../ExcelDefaultFiles/TableStyleDark8.xml | 1 - .../ExcelDefaultFiles/TableStyleDark9.xml | 1 - .../ExcelDefaultFiles/TableStyleLight1.xml | 1 - .../ExcelDefaultFiles/TableStyleLight10.xml | 1 - .../ExcelDefaultFiles/TableStyleLight11.xml | 1 - .../ExcelDefaultFiles/TableStyleLight12.xml | 1 - .../ExcelDefaultFiles/TableStyleLight13.xml | 1 - .../ExcelDefaultFiles/TableStyleLight14.xml | 1 - .../ExcelDefaultFiles/TableStyleLight15.xml | 1 - .../ExcelDefaultFiles/TableStyleLight16.xml | 1 - .../ExcelDefaultFiles/TableStyleLight17.xml | 1 - .../ExcelDefaultFiles/TableStyleLight18.xml | 1 - .../ExcelDefaultFiles/TableStyleLight19.xml | 1 - .../ExcelDefaultFiles/TableStyleLight2.xml | 1 - .../ExcelDefaultFiles/TableStyleLight20.xml | 1 - .../ExcelDefaultFiles/TableStyleLight21.xml | 1 - .../ExcelDefaultFiles/TableStyleLight3.xml | 1 - .../ExcelDefaultFiles/TableStyleLight4.xml | 1 - .../ExcelDefaultFiles/TableStyleLight5.xml | 1 - .../ExcelDefaultFiles/TableStyleLight6.xml | 1 - .../ExcelDefaultFiles/TableStyleLight7.xml | 1 - .../ExcelDefaultFiles/TableStyleLight8.xml | 1 - .../ExcelDefaultFiles/TableStyleLight9.xml | 1 - .../ExcelDefaultFiles/TableStyleMedium1.xml | 1 - .../ExcelDefaultFiles/TableStyleMedium10.xml | 1 - .../ExcelDefaultFiles/TableStyleMedium11.xml | 1 - .../ExcelDefaultFiles/TableStyleMedium12.xml | 1 - .../ExcelDefaultFiles/TableStyleMedium13.xml | 1 - .../ExcelDefaultFiles/TableStyleMedium14.xml | 1 - .../ExcelDefaultFiles/TableStyleMedium15.xml | 1 - .../ExcelDefaultFiles/TableStyleMedium16.xml | 1 - .../ExcelDefaultFiles/TableStyleMedium17.xml | 1 - .../ExcelDefaultFiles/TableStyleMedium18.xml | 1 - .../ExcelDefaultFiles/TableStyleMedium19.xml | 1 - .../ExcelDefaultFiles/TableStyleMedium2.xml | 1 - .../ExcelDefaultFiles/TableStyleMedium20.xml | 1 - .../ExcelDefaultFiles/TableStyleMedium21.xml | 1 - .../ExcelDefaultFiles/TableStyleMedium22.xml | 1 - .../ExcelDefaultFiles/TableStyleMedium23.xml | 1 - .../ExcelDefaultFiles/TableStyleMedium24.xml | 1 - .../ExcelDefaultFiles/TableStyleMedium25.xml | 1 - .../ExcelDefaultFiles/TableStyleMedium26.xml | 1 - .../ExcelDefaultFiles/TableStyleMedium27.xml | 1 - .../ExcelDefaultFiles/TableStyleMedium28.xml | 1 - .../ExcelDefaultFiles/TableStyleMedium3.xml | 1 - .../ExcelDefaultFiles/TableStyleMedium4.xml | 1 - .../ExcelDefaultFiles/TableStyleMedium5.xml | 1 - .../ExcelDefaultFiles/TableStyleMedium6.xml | 1 - .../ExcelDefaultFiles/TableStyleMedium7.xml | 1 - .../ExcelDefaultFiles/TableStyleMedium8.xml | 1 - .../ExcelDefaultFiles/TableStyleMedium9.xml | 1 - .../ASCOfficeEWSEditor/Helpers/Iterator.cs | 30 - .../ASCOfficeEWSEditor/Helpers/OOXNavigate.cs | 249 --- .../Helpers/ReferencesFormat.cs | 220 --- .../ASCOfficeEWSEditor/Helpers/XmlUtils.cs | 43 - .../Properties/AssemblyInfo.cs | 36 - .../ASCOfficeEWSEditor/Resource1.Designer.cs | 392 ----- .../ASCOfficeEWSEditor/Resource1.resx | 172 -- .../ResourceExcelDefaultStyles.Designer.cs | 603 ------- .../ResourceExcelDefaultStyles.resx | 301 ---- .../XMLDataSpecific/Attrib.cs | 114 -- .../XMLTemplates/Empty_full.xml | 424 ----- .../XMLTemplates/default_border.xml | 2 - .../XMLTemplates/default_fill.xml | 1 - .../XMLTemplates/default_font.xml | 1 - .../XMLTemplates/empty_areaChart.xml | 204 --- .../XMLTemplates/empty_barChart.xml | 198 --- .../XMLTemplates/empty_book.xml | 91 - .../XMLTemplates/empty_bubbleChart.xml | 207 --- .../XMLTemplates/empty_chartDrawing.xml | 34 - .../XMLTemplates/empty_chartSeriesItem.xml | 6 - .../XMLTemplates/empty_doughnutChart.xml | 82 - .../XMLTemplates/empty_imageDrawing.xml | 39 - .../XMLTemplates/empty_lineChart.xml | 201 --- .../XMLTemplates/empty_pieChart.xml | 78 - .../XMLTemplates/empty_radarChart.xml | 206 --- .../XMLTemplates/empty_scatterChart.xml | 180 -- .../XMLTemplates/empty_sheet.xml | 9 - .../XMLTemplates/empty_stockChart.xml | 170 -- .../ASCOfficeEWSEditor/app.config | 3 - 380 files changed, 36693 deletions(-) delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor.sln delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/ASCOfficeEWSEditor.csproj delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/AutoFilter.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/CellItem.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/BinOpCalc/AddCalculator.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/BinOpCalc/Arithmetic.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/BinOpCalc/ConcatCalculator.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/BinOpCalc/DivCalculator.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/BinOpCalc/EqCalculator.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/BinOpCalc/GtCalculator.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/BinOpCalc/IFullBinaryOpDispatcher.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/BinOpCalc/IsectCalculator.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/BinOpCalc/LtCalculator.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/BinOpCalc/MulCalculator.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/BinOpCalc/PowerCalculator.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/BinOpCalc/RangeCalculator.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/BinOpCalc/ReferenceOperatorsCalculator.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/BinOpCalc/SubCalculator.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/BinOpCalc/UnionCalculator.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/CellParsedFormula.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/DataObjects/IDataObject.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/DataObjects/ObjectBoolean.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/DataObjects/ObjectEmpty.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/DataObjects/ObjectError.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/DataObjects/ObjectNumber.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/DataObjects/ObjectReference.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/DataObjects/ObjectString.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/ErrorValue.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/FormulaFormatException.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/NameParsedFormula.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/ParsedFormula.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Precision.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/FunctionsStorage.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncAbs.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncAnd.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncAverage.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncCeiling.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncConcatenate.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncCos.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncCount.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncErrorType.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncEven.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncExact.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncFalse.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncFloor.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncIf.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncIfError.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncInt.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncIs.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncIsEven.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncIsOdd.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncLower.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncMRound.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncMath.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncMax.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncMin.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncMod.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncN.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncNa.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncNot.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncOdd.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncOr.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncPi.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncPower.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncRept.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncRound.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncRoundDown.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncRoundUp.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncSign.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncSin.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncSqrt.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncSum.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncT.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncTan.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncTrue.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncType.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncUnsupported.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncUpper.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/OperandPtg.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/OperandPtg3D.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/OperatorPtg.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Ptg.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgAdd.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgArea.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgArea3D.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgBool.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgConcat.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgDiv.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgEq.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgErr.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgFunc.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgGe.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgGt.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgIsect.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgLe.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgLt.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgMissedArg.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgMul.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgName.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgNe.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgNum.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgParen.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgPercent.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgPower.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgRange.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgRef.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgRef3D.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgRefErr3D.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgStr.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgSub.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgUminus.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgUnion.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgUplus.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/HyperlinkItem.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/IObserver.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/ISubject.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/NameItem.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/RangeSubject.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/SubjectsStorage.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/ValuesUpdateManager.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/WorksheetSubject.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/CalculationTables/Power.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Cells/Cell.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Cells/CellRange.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Cells/CellRange3D.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Cells/CellRangeRel.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Cells/Offset.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Charts/Anchor.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Charts/BasicChar.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Charts/Chart.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Charts/Layout.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Charts/Legend.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Charts/Misc.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Charts/PlotArea.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Charts/Series.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Chartsheet.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/DefinedNames/DefinedName.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/DefinedNames/DefinedNames.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/EWSEditor.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Events/CellsUpdatedEventArg.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Events/ErrorDescription.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Events/FileNotFoundError.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Events/FormulaFormatError.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Events/InternalError.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Events/OperandExpectedError.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Events/OperatorExpectedError.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Events/ReportableException.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Events/SystemIOError.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Events/UnknownFunctionError.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Events/UnknownOperandError.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Events/UnknownOperatorError.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Events/UnsupportedFileFormatError.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Events/WrongParenthesisSequenceError.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Events/WrongReferenceFormatError.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/FileFormats/CsvLoader.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/FileFormats/CsvSaver.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/FileFormats/Serializer.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/FileFormats/XlsxLoader.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/FileFormats/XlsxSaver.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Alignment/Alignment.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Alignment/AlignmentEntity.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Alignment/HorizontalProperty.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Alignment/IndentProperty.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Alignment/JustifyLastLineProperty.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Alignment/ReadingOrderProperty.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Alignment/RelativeIndentProperty.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Alignment/ShrinkToFitProperty.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Alignment/TextRotationProperty.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Alignment/VerticalProperty.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Alignment/WrapTextProperty.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Borders/Border.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Borders/BorderEntity.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Borders/BorderProperty.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Borders/Borders.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Borders/DiagonalTypeProperty.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Borders/OutlineProperty.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Borders/StyleProperty.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Colors/Color.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Colors/ColorProperty.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Colors/ColorValue.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Colors/Palette.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Fills/BottomProperty.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Fills/DegreeProperty.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Fills/FillEntity.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Fills/Fills.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Fills/GradientFill.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Fills/GradientFillProperty.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Fills/GradientTypeProperty.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Fills/LeftProperty.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Fills/PatternFill.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Fills/PatternFillProperty.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Fills/PatternProperty.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Fills/RightProperty.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Fills/StopProperty.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Fills/TopProperty.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Font/BoldProperty.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Font/CharsetProperty.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Font/CondenseProperty.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Font/ExtendProperty.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Font/FamilyProperty.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Font/Font.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Font/FontEntity.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Font/FontNameProperty.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Font/FontSizeProperty.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Font/ItalicProperty.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Font/OutlineProperty.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Font/SchemeProperty.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Font/ShadowProperty.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Font/StrikethroughProperty.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Font/SubscriptProperty.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Font/SuperscriptProperty.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Font/UnderlineProperty.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Format.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/IProperty.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/IStyleEntity.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/IdEntity.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/InlineEntity.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/NumberFormat/NumberFormatEntity.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Protection/HiddenProperty.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Protection/LockedProperty.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Protection/Protection.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Protection/ProtectionEntity.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/SeparateEntity.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Hyperlinks/Hyperlink.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Hyperlinks/Hyperlinks.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Images/Image.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/MergeCells.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/NumberFormat/NumberFormatParser.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/NumberFormat/NumberFormatsStorage.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/OOX/ChartsheetFile.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/OOX/ContentTypes.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/OOX/IOrderedSections.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/OOX/Relationships.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/OOX/SharedStringsFile.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/OOX/StyleSheetFile.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/OOX/TableFile.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/OOX/ThemeFile.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/OOX/WorkbookFile.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/OOX/WorksheetFile.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/OOX/XmlFile.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Range.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/SharedStrings.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Sheet.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Sheets.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Sorting/SortParameters.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/StyleSheet.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Table.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Theme.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/CellDeleter.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/CellRowNumberCorrector.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/CellSimpleGetter.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/CellWalker.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/CellsCopySetter.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/CellsNodesCollector.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/CellsSubstitutionSetter.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/CellsUnregistrer.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/ColsWalker.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/ExistentCellsCollector.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/FirstNonEmptyFormulaValueCollector.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/FormulaGetter.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/FormulaRecheck.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/FormulaSetter.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/FormulaTextAndValueUpdater.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/FormulasParser.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/HyperlinkGetter.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/HyperlinkSetter.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/ICellSetter.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/IColsSetter.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/IRowsCollector.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/IRowsSetter.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/IStatCollector.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/NonEmptyCellsCollector.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/RangeWalker.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/RemovedStringsCollector.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/RowsCellCollector.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/RowsCellDeleter.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/RowsCellMover.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/RowsCellSetter.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/RowsHeightSetter.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/RowsRowNumberCorrector.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/RowsWalker.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/SortValuesCollector.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/StyleCollector.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/StyleSetter.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/ValueGetter.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/ValueSetter.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/WidthSetter.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Workbook.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Worksheet.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Worksheets.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleDark1.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleDark10.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleDark11.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleDark2.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleDark3.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleDark4.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleDark5.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleDark6.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleDark7.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleDark8.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleDark9.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight1.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight10.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight11.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight12.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight13.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight14.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight15.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight16.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight17.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight18.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight19.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight2.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight20.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight21.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight3.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight4.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight5.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight6.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight7.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight8.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight9.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium1.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium10.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium11.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium12.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium13.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium14.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium15.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium16.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium17.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium18.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium19.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium2.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium20.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium21.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium22.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium23.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium24.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium25.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium26.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium27.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium28.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium3.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium4.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium5.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium6.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium7.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium8.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium9.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Helpers/Iterator.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Helpers/OOXNavigate.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Helpers/ReferencesFormat.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Helpers/XmlUtils.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Properties/AssemblyInfo.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Resource1.Designer.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/Resource1.resx delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/ResourceExcelDefaultStyles.Designer.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/ResourceExcelDefaultStyles.resx delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/XMLDataSpecific/Attrib.cs delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/XMLTemplates/Empty_full.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/XMLTemplates/default_border.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/XMLTemplates/default_fill.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/XMLTemplates/default_font.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/XMLTemplates/empty_areaChart.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/XMLTemplates/empty_barChart.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/XMLTemplates/empty_book.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/XMLTemplates/empty_bubbleChart.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/XMLTemplates/empty_chartDrawing.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/XMLTemplates/empty_chartSeriesItem.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/XMLTemplates/empty_doughnutChart.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/XMLTemplates/empty_imageDrawing.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/XMLTemplates/empty_lineChart.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/XMLTemplates/empty_pieChart.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/XMLTemplates/empty_radarChart.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/XMLTemplates/empty_scatterChart.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/XMLTemplates/empty_sheet.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/XMLTemplates/empty_stockChart.xml delete mode 100644 ASCOfficeEWSEditor/ASCOfficeEWSEditor/app.config diff --git a/.gitattributes b/.gitattributes index 88fd28d11b..8335041649 100644 --- a/.gitattributes +++ b/.gitattributes @@ -37,7 +37,6 @@ ASCOfficeDocxFile2/Mac/ASCOfficeDocxFile2Lib.xcodeproj/project.xcworkspace/xcuse ASCOfficeDocxFile2/Mac/ASCOfficeDocxFile2Lib.xcodeproj/xcuserdata svnc_tsvn_003alogminsize=5 ASCOfficeDocxFile2/Mac/ASCOfficeDocxFile2Lib.xcodeproj/xcuserdata/alexey.musinov.xcuserdatad svnc_tsvn_003alogminsize=5 ASCOfficeDocxFile2/Mac/ASCOfficeDocxFile2Lib.xcodeproj/xcuserdata/alexey.musinov.xcuserdatad/xcschemes svnc_tsvn_003alogminsize=5 -ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Charts svnc_bugtraq_003anumber=true ASCOfficeFB2File/ASCOfficeFB2File/Resource/DocxTemplate.docx svn_mime_002dtype=application%2Foctet-stream ASCOfficeFB2File/ASCOfficeFB2FileTest/ASCOfficeFB2FileTest/bin/Release/AVSOfficeFB2FileTest.exe svn_mime_002dtype=application%2Foctet-stream ASCOfficeFB2File/ASCOfficeFB2FileTest/ASCOfficeFB2FileTest/bin/Release/AVSOfficeFB2FileTest.pdb svn_mime_002dtype=application%2Foctet-stream diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor.sln b/ASCOfficeEWSEditor/ASCOfficeEWSEditor.sln deleted file mode 100644 index b525c385ea..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor.sln +++ /dev/null @@ -1,20 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ASCOfficeEWSEditor", "ASCOfficeEWSEditor\ASCOfficeEWSEditor.csproj", "{D4C6EAD0-5A97-439C-AC74-E1B89E07CCBE}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {D4C6EAD0-5A97-439C-AC74-E1B89E07CCBE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D4C6EAD0-5A97-439C-AC74-E1B89E07CCBE}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D4C6EAD0-5A97-439C-AC74-E1B89E07CCBE}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D4C6EAD0-5A97-439C-AC74-E1B89E07CCBE}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ASCOfficeEWSEditor.csproj b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ASCOfficeEWSEditor.csproj deleted file mode 100644 index 9406edc410..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ASCOfficeEWSEditor.csproj +++ /dev/null @@ -1,599 +0,0 @@ - - - - Debug - AnyCPU - 9.0.21022 - 2.0 - {D4C6EAD0-5A97-439C-AC74-E1B89E07CCBE} - Library - Properties - ASCOfficeEWSEditor - ASCOfficeEWSEditor - v2.0 - 512 - - - OnOutputUpdated - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - false - true - bin\Debug\ASCOfficeEWSEditor.xml - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - bin\Release\ASCOfficeEWSEditor.xml - - - - False - ..\..\..\wwwroot\Bin\FileConverterUtils2.dll - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Code - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - True - True - ResourceExcelDefaultStyles.resx - - - - - True - True - Resource1.resx - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ResXFileCodeGenerator - Resource1.Designer.cs - Designer - - - ResXFileCodeGenerator - ResourceExcelDefaultStyles.Designer.cs - Designer - - - - - {E3305D24-A207-4431-BC43-2C09A53CB9B6} - 1 - 0 - 0 - tlbimp - False - - - {69DBBABC-8D59-40B8-9906-DAFD4F3EC346} - 1 - 0 - 0 - tlbimp - False - - - {F0A0AAE5-06FE-4ABC-A9F1-26BFFEE2A11F} - 1 - 0 - 0 - tlbimp - False - - - {74CBF220-BF08-11DE-8A39-0800200C9A66} - 1 - 0 - 0 - tlbimp - False - - - {EDB084E5-EC38-47EF-B421-D5E1A71F98A6} - 1 - 0 - 0 - tlbimp - False - - - {92F87FA9-D3C2-4820-82F6-DEAEC0A3539D} - 1 - 0 - 0 - tlbimp - False - - - {25B7D44B-94A1-4C94-9718-102CFA8F00D5} - 1 - 0 - 0 - tlbimp - False - - - {D9F21C35-D46C-42F3-996D-D4912435F7E7} - 1 - 0 - 0 - tlbimp - False - - - - - - copy $(ProjectDir)bin\$(ConfigurationName)\$(TargetFileName) $(ProjectDir)..\..\Redist\ -copy $(ProjectDir)bin\$(ConfigurationName)\$(TargetName).xml $(ProjectDir)..\..\Redist\ - - - - \ No newline at end of file diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/AutoFilter.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/AutoFilter.cs deleted file mode 100644 index 607a66a02b..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/AutoFilter.cs +++ /dev/null @@ -1,626 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; - -namespace ASCOfficeEWSEditor.Editor -{ - public struct AutoFilterElementSendData - { - /// - /// Видимые элементы (только для _type = 0) - /// - public List _arrVisibleElementsArray; - /// - /// Тип автофильтра - /// - public int _type; - /// - /// Первое условие сравнения (только для _type = 1) - /// - public int _condition1; - /// - /// Первое значение, с которым сравниваем (только для _type = 1) - /// - public string _value1; - /// - /// Второе условие сравнения (только для _type = 1) - /// - public int _condition2; - /// - /// Второе значение, с которым сравниваем (только для _type = 1) - /// - public string _value2; - /// - /// Оператор для двух сравнений (или/и) - /// 0 - Or - /// 1 - And - /// (только для _type = 1) - /// - public int _operator; - - /// - /// Индекс колонки, по которой автофильтр - /// - public int _colId; - }; - - public enum filterOperator - { - equal = 1, - notEqual = 2, - greaterThan = 3, - greaterThanOrEqual = 4, - lessThan = 5, - lessThanOrEqual = 6 - } - - /// - /// AutoFilter temporarily hides rows based on a filter criteria, - /// which is applied column by column to a table of data in the worksheet. - /// This collection expresses AutoFilter settings. - /// - public class AutoFilter - { - public AutoFilter(Worksheet worksheet, XmlNode xml_table_file, XmlNode xml_worksheet) - { - this.worksheet = worksheet; - this.xml_worksheet = xml_worksheet; - this.ns_manager = worksheet.Workbook.NamespaceManager; - this.m_oRefRange = Cells.CellRange.Empty; - - this.autofilter_xml = xml_table_file.SelectSingleNode("main:autoFilter", ns_manager); - if (null != this.autofilter_xml) - { - m_oRefRange = new ASCOfficeEWSEditor.Editor.Cells.CellRange(autofilter_xml.Attributes["ref"].Value, this.worksheet.Workbook); - - foreach (XmlNode oXmlNodeFilterColumn in autofilter_xml.ChildNodes) - { - if ("filterColumn" == oXmlNodeFilterColumn.Name) - { - FilterColumn oFilterColumn = new FilterColumn(oXmlNodeFilterColumn, ns_manager); - m_arrFilterColumns.Add(oFilterColumn); - } - } - } - } - - public AutoFilter(Worksheet worksheet, XmlNode xml_table_file, XmlNode xml_worksheet, AutoFilter oAutoFilter) - { - this.worksheet = worksheet; - this.xml_worksheet = xml_worksheet; - this.ns_manager = worksheet.Workbook.NamespaceManager; - - this.m_oRefRange = oAutoFilter.m_oRefRange; - this.autofilter_xml = xml_table_file.SelectSingleNode("main:autoFilter", ns_manager); - this.m_arrFilterColumns.AddRange(oAutoFilter.m_arrFilterColumns); - } - - private AutoFilter(Worksheet worksheet, XmlNode xml_table_file, XmlNode xml_worksheet, Cells.CellRange oFilterRange) - { - this.worksheet = worksheet; - this.xml_worksheet = xml_worksheet; - this.ns_manager = worksheet.Workbook.NamespaceManager; - this.m_oRefRange = oFilterRange; - - this.autofilter_xml = xml_table_file.SelectSingleNode("main:autoFilter", ns_manager); - } - - public XmlNode AutoFilterXml - { - get { return autofilter_xml; } - set { autofilter_xml = value.Clone(); } - } - - public static AutoFilter CreateNew(Worksheet worksheet, XmlNode xml_table_file, XmlNode xml_worksheet, Cells.CellRange oFilterRange) - { - return new AutoFilter(worksheet, xml_table_file, xml_worksheet, oFilterRange); - } - - public Dictionary ChangeAutoFilter(AutoFilterElementSendData oChangeObject) - { - Dictionary arrRows = new Dictionary(); - - XmlNodeList oXmlNodesRowList = xml_worksheet.SelectNodes("main:row[@r > " + m_oRefRange.RowFirst + " and @r <= " + m_oRefRange.RowLast + "]", ns_manager); - string strColumn = Helpers.ReferencesFormat.column2str(m_oRefRange.ColumnFirst + oChangeObject._colId, true); - - FilterColumn oFilterColumn = null; - int nIndex = 0; - for (; nIndex < m_arrFilterColumns.Count; ++nIndex) - { - if (m_arrFilterColumns[nIndex].colId == oChangeObject._colId) - { - oFilterColumn = m_arrFilterColumns[nIndex]; - break; - } - } - - if (null == oFilterColumn) - { - oFilterColumn = FilterColumn.CreateFilterColumn(oChangeObject._colId, autofilter_xml, ns_manager); - m_arrFilterColumns.Add(oFilterColumn); - } - - oFilterColumn.m_nFilterType = oChangeObject._type; - switch (oChangeObject._type) - { - case 0: - oFilterColumn.m_oFilter = new Filters(); - Filters oFilters = (Filters)oFilterColumn.m_oFilter; - if (null != oFilters) - { - oFilters.CreateFilters(autofilter_xml, ns_manager, oChangeObject._colId.ToString()); - oFilters.FilterValues = oChangeObject._arrVisibleElementsArray; - } - break; - case 1: - oFilterColumn.m_oFilter = new CustomFilters(); - CustomFilters oCustomFilter = (CustomFilters)oFilterColumn.m_oFilter; - if (null != oCustomFilter) - { - oCustomFilter.CreateFilters(autofilter_xml, ns_manager, oChangeObject._colId.ToString()); - oCustomFilter.ChangeFilter(oChangeObject); - } - break; - } - bool isAutoFilter = false; - foreach (XmlElement oRowElement in oXmlNodesRowList) - { - try - { - int row = System.Convert.ToInt32(oRowElement.GetAttribute("r")); - Range oRange = new Range(strColumn + row, worksheet); - - string strValue = oRange.DispValue.ToString(); - - if (oFilterColumn.m_oFilter.isVisible(strValue)) - { - oRowElement.RemoveAttribute("hidden"); - - arrRows.Add(row, false); - } - else - { - oRowElement.SetAttribute("hidden", "1"); - isAutoFilter = true; - - arrRows.Add(row, true); - } - } - catch { } - } - if (false == isAutoFilter && 0 == oFilterColumn.m_nFilterType) - { - oFilterColumn.RemoveFilterColumn(); - m_arrFilterColumns.RemoveAt(nIndex); - } - - return arrRows; - } - - private XmlNode autofilter_xml; - - /// - /// Reference to the cell range to which the AutoFilter is applied. - /// - public Cells.CellRange m_oRefRange { get; private set; } - /// - /// Filters Columns - /// - public List m_arrFilterColumns = new List(); - - private XmlNode xml_worksheet; - private Worksheet worksheet; - private XmlNamespaceManager ns_manager; - } - - /// - /// The filterColumn collection identifies a particular column in the AutoFilter - /// range and specifies filter information that has been applied to this column. - /// If a column in the AutoFilter range has no criteria specified, then there is - /// no corresponding filterColumn collection expressed for that column. - /// - public class FilterColumn - { - private FilterColumn(int nColId, XmlNode oXmlNodeAutoFilter, XmlNamespaceManager ns_manager) - { - colId = nColId; - - XmlElement oFilterColumn = oXmlNodeAutoFilter.OwnerDocument.CreateElement("filterColumn", ns_manager.LookupNamespace("main")); - oFilterColumn.SetAttribute("colId", nColId.ToString()); - m_oXmlNodeFilterColumn = oFilterColumn; - - oXmlNodeAutoFilter.AppendChild(m_oXmlNodeFilterColumn); - } - internal FilterColumn(XmlNode oXmlNodeFilterColumn, XmlNamespaceManager ns_manager) - { - m_oXmlNodeFilterColumn = oXmlNodeFilterColumn; - - colId = System.Convert.ToInt32(oXmlNodeFilterColumn.Attributes["colId"].Value); - foreach (XmlNode oXmlNodeFilter in oXmlNodeFilterColumn.ChildNodes) - { - switch (oXmlNodeFilter.Name) - { - case "filters": - m_oFilter = new Filters(oXmlNodeFilter, ns_manager); - m_nFilterType = 0; - break; - case "colorFilter": - m_oFilter = new ColorFilter(oXmlNodeFilter); - break; - case "customFilters": - m_oFilter = new CustomFilters(oXmlNodeFilter); - m_nFilterType = 1; - break; - } - } - } - - public static FilterColumn CreateFilterColumn(int nColId, XmlNode oXmlNodeAutoFilter, XmlNamespaceManager ns_manager) - { - FilterColumn oFilterColumn = new FilterColumn(nColId, oXmlNodeAutoFilter, ns_manager); - - return oFilterColumn; - } - - public void RemoveFilterColumn() - { - m_oXmlNodeFilterColumn.ParentNode.RemoveChild(m_oXmlNodeFilterColumn); - } - - public Filter m_oFilter = null; - public int colId = -1; - - public int m_nFilterType = -1; - - private XmlNode m_oXmlNodeFilterColumn; - } - - public abstract class Filter - { - public abstract bool isVisible(string strValue); - - protected XmlNode m_oXmlFilterNode; - } - /// - /// When multiple values are chosen to filter by, or when a group - /// of date values are chosen to filter by, this element groups those criteria together. - /// - public class Filters : Filter - { - internal Filters() - { - } - - internal Filters(XmlNode oXmlNodeFiltersColumn, XmlNamespaceManager ns_manager) - { - m_oXmlFilterNode = oXmlNodeFiltersColumn; - - foreach (XmlNode oFilterNode in oXmlNodeFiltersColumn.ChildNodes) - { - if (oFilterNode.Name == "filter") - m_arrFilterValues.Add(oFilterNode.Attributes["val"].Value); - } - } - - internal void CreateFilters(XmlNode autofilter_xml, XmlNamespaceManager ns_manager, string strColId) - { - this.ns_manager = ns_manager; - m_oXmlFilterNode = autofilter_xml.SelectSingleNode("main:filterColumn[@colId = '" + strColId + "']", ns_manager); - if (null == m_oXmlFilterNode) - { - m_oXmlFilterNode = autofilter_xml.OwnerDocument.CreateElement("filterColumn", ns_manager.LookupNamespace("main")); - XmlElement oElem = (XmlElement)m_oXmlFilterNode; - oElem.SetAttribute("colId", strColId); - autofilter_xml.AppendChild(m_oXmlFilterNode); - } - } - - public List FilterValues - { - get { return m_arrFilterValues; } - set - { - foreach (XmlNode oChildNode in m_oXmlFilterNode.ChildNodes) - { - m_oXmlFilterNode.RemoveChild(oChildNode); - } - - XmlNode oNode = m_oXmlFilterNode.OwnerDocument.CreateElement("filters", ns_manager.LookupNamespace("main")); - - if (null == value) - { - m_arrFilterValues = null; - return; - } - - value.Sort(); - - foreach (string strValue in value) - { - XmlElement oElementValue = m_oXmlFilterNode.OwnerDocument.CreateElement("filter", this.ns_manager.LookupNamespace("main")); - oElementValue.SetAttribute("val", strValue); - oNode.AppendChild(oElementValue); - - m_arrFilterValues.Add(strValue); - } - - m_oXmlFilterNode.AppendChild(oNode); - } - } - - public override bool isVisible(string strValue) - { - if (null == m_arrFilterValues) - return true; - return (-1 != m_arrFilterValues.IndexOf(strValue)); - } - - private List m_arrFilterValues = new List(); - private XmlNamespaceManager ns_manager; - } - /// - /// This element specifies the color to filter by and whether to use the cell's - /// fill or font color in the filter criteria. If the cell's font or fill color - /// does not match the color specified in the criteria, the rows corresponding - /// to those cells are hidden from view. - /// - public class ColorFilter : Filter - { - internal ColorFilter(XmlNode oXmlNodeColorFilterColumn) - { - m_oXmlFilterNode = oXmlNodeColorFilterColumn; - - if (null != oXmlNodeColorFilterColumn.Attributes["dxfId"]) - dxfId = System.Convert.ToInt32(oXmlNodeColorFilterColumn.Attributes["dxfId"].Value); - if (null != oXmlNodeColorFilterColumn.Attributes["cellColor"]) - cellColor = ("1" == oXmlNodeColorFilterColumn.Attributes["cellColor"].Value); - } - - public override bool isVisible(string strValue) - { - throw new NotImplementedException(); - } - - /// - /// Id of differential format record (dxf) in the Styles Part which expresses the color value to filter by. - /// - public int dxfId { get; private set; } - - /// - /// Flag indicating whether or not to filter by the cell's fill color. - /// '1' indicates to filter by cell fill. - /// '0' indicates to filter by the cell's font color. - /// For rich text in cells, if the color specified appears in the cell at all, - /// it shall be included in the filter. - /// - public bool cellColor { get; private set; } - } - - /// - /// When there is more than one custom filter criteria to apply (an 'and' or 'or' - /// joining two criteria), then this element groups the customFilter elements together. - /// - public class CustomFilters : Filter - { - internal CustomFilters() - { - } - internal CustomFilters(XmlNode oXmlNodeCustomFiltersColumn) - { - m_oXmlFilterNode = oXmlNodeCustomFiltersColumn; - - XmlAttribute oAnd = oXmlNodeCustomFiltersColumn.Attributes["and"]; - if (null == oAnd) - and = -1; - else - and = System.Convert.ToInt32(oAnd.Value); - - if (1 > oXmlNodeCustomFiltersColumn.ChildNodes.Count) - return; - - oCustomFilter1 = new CustomFilter(oXmlNodeCustomFiltersColumn.ChildNodes[0]); - - if (2 == oXmlNodeCustomFiltersColumn.ChildNodes.Count) - oCustomFilter2 = new CustomFilter(oXmlNodeCustomFiltersColumn.ChildNodes[1]); - } - - public override bool isVisible(string strValue) - { - switch (this.and) - { - case -1: - return oCustomFilter1.isCondition(strValue); - case 0: // Or - if (null != oCustomFilter2) - return oCustomFilter1.isCondition(strValue) || oCustomFilter2.isCondition(strValue); - else - return oCustomFilter1.isCondition(strValue); - case 1: // And - if (null != oCustomFilter2) - return oCustomFilter1.isCondition(strValue) && oCustomFilter2.isCondition(strValue); - else - return oCustomFilter1.isCondition(strValue); - } - - return false; - } - - internal void CreateFilters(XmlNode autofilter_xml, XmlNamespaceManager ns_manager, string strColId) - { - this.ns_manager = ns_manager; - m_oXmlFilterNode = autofilter_xml.SelectSingleNode("main:filterColumn[@colId = '" + strColId + "']", ns_manager); - if (null == m_oXmlFilterNode) - { - m_oXmlFilterNode = autofilter_xml.OwnerDocument.CreateElement("filterColumn", ns_manager.LookupNamespace("main")); - XmlElement oElem = (XmlElement)m_oXmlFilterNode; - oElem.SetAttribute("colId", strColId); - autofilter_xml.AppendChild(m_oXmlFilterNode); - } - } - - internal void ChangeFilter(AutoFilterElementSendData oChangeObject) - { - this.and = oChangeObject._operator; - - this.oCustomFilter1 = new CustomFilter(); - this.oCustomFilter1.operatorFilter = (filterOperator)oChangeObject._condition1; - this.oCustomFilter1.val = oChangeObject._value1; - - - if (-1 != this.and && 0 != oChangeObject._condition2) - { - this.oCustomFilter2 = new CustomFilter(); - this.oCustomFilter2.operatorFilter = (filterOperator)oChangeObject._condition2; - this.oCustomFilter2.val = oChangeObject._value2; - } - else - this.and = -1; - - foreach (XmlNode oChildNode in m_oXmlFilterNode.ChildNodes) - { - m_oXmlFilterNode.RemoveChild(oChildNode); - } - XmlElement oNode = m_oXmlFilterNode.OwnerDocument.CreateElement("customFilters", ns_manager.LookupNamespace("main")); - if (-1 != this.and) - oNode.SetAttribute("and", this.and.ToString()); - - if (null != oCustomFilter1) - { - XmlElement oElementValue1 = m_oXmlFilterNode.OwnerDocument.CreateElement("customFilter", this.ns_manager.LookupNamespace("main")); - oElementValue1.SetAttribute("operator", oCustomFilter1.operatorFilter.ToString()); - oElementValue1.SetAttribute("val", oCustomFilter1.val.ToString()); - oNode.AppendChild(oElementValue1); - } - if (null != oCustomFilter2) - { - XmlElement oElementValue2 = m_oXmlFilterNode.OwnerDocument.CreateElement("customFilter", this.ns_manager.LookupNamespace("main")); - oElementValue2.SetAttribute("operator", oCustomFilter2.operatorFilter.ToString()); - oElementValue2.SetAttribute("val", oCustomFilter2.val.ToString()); - oNode.AppendChild(oElementValue2); - } - - m_oXmlFilterNode.AppendChild(oNode); - } - - public int and { get; set; } - - public CustomFilter oCustomFilter1 = null; - public CustomFilter oCustomFilter2 = null; - - private XmlNamespaceManager ns_manager; - } - - /// - /// A custom AutoFilter specifies an operator and a value. - /// There can be at most two customFilters specified, and in - /// that case the parent element specifies whether the two conditions - /// are joined by 'and' or 'or'. For any cells whose values do not meet - /// the specified criteria, the corresponding rows shall be hidden from view when the fitler is applied. - /// - public class CustomFilter - { - internal CustomFilter() - { - } - - internal CustomFilter(XmlNode oXmlNodeCustomFilter) - { - m_oXmlNodeCustomFilter = oXmlNodeCustomFilter; - - string strValOperator = oXmlNodeCustomFilter.Attributes["operator"].Value; - - switch (strValOperator) - { - case "equal": - operatorFilter = filterOperator.equal; - break; - case "notEqual": - operatorFilter = filterOperator.notEqual; - break; - case "greaterThan": - operatorFilter = filterOperator.greaterThan; - break; - case "greaterThanOrEqual": - operatorFilter = filterOperator.greaterThanOrEqual; - break; - case "lessThan": - operatorFilter = filterOperator.lessThan; - break; - case "lessThanOrEqual": - operatorFilter = filterOperator.lessThanOrEqual; - break; - } - - val = oXmlNodeCustomFilter.Attributes["val"].Value; - } - - public bool isCondition(string strValue) - { - bool aIsDigit = false; - bool bIsDigit = false; - - int aDigit = 0; - int bDigit = 0; - - try - { - aDigit = System.Convert.ToInt32(strValue); - } - catch - { - aIsDigit = false; - } - try - { - bDigit = System.Convert.ToInt32(val); - } - catch - { - bIsDigit = false; - } - - if (true == bIsDigit) - { - if (false == aIsDigit && 1 <= (int)operatorFilter && (int)operatorFilter >= 6) - return false; - } - if (true == aIsDigit) - { - if (false == bIsDigit && 1 <= (int)operatorFilter && (int)operatorFilter >= 6) - return false; - } - - switch (operatorFilter) - { - case filterOperator.equal: - return strValue == val; - case filterOperator.notEqual: - return strValue != val; - case filterOperator.greaterThan: - return aDigit > bDigit; - case filterOperator.greaterThanOrEqual: - return aDigit >= bDigit; - case filterOperator.lessThan: - return aDigit < bDigit; - case filterOperator.lessThanOrEqual: - return aDigit <= bDigit; - } - - return false; - } - - /// - /// Operator used by the filter comparison. - /// equal, lessThan, lessThanOrEqual, notEqual, greaterThanOrEqual, greaterThan - /// - public filterOperator operatorFilter { get; set; } - - /// - /// Top or bottom value used in the filter criteria. - /// - public string val { get; set; } - - private XmlNode m_oXmlNodeCustomFilter; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/CellItem.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/CellItem.cs deleted file mode 100644 index 84d21cb904..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/CellItem.cs +++ /dev/null @@ -1,202 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using ASCOfficeEWSEditor.Editor.Calculation.Formulas; - -namespace ASCOfficeEWSEditor.Editor.Calculation -{ - internal class CellItem : IObserver, ISubject - { - /// - /// Create as an Observer - /// - public CellItem(Cells.Cell cell, Worksheet parent_sheet, ValuesUpdateManager manager, CellParsedFormula formula_item) - { - this.manager = manager; - this.formula_item = formula_item; // may be null - this.parent_sheet = parent_sheet; - this.cell = cell; - valid = true; - CellOrFormulaUpdated = false; - UpdateDelayed = false; - } - - /// - /// Construct non-observer, just subject - /// - public CellItem(Cells.Cell cell, Worksheet parent_sheet, ValuesUpdateManager manager) - : this(cell, parent_sheet, manager, null) - { - } - - #region IObserver Members - - // Do NOT call if not Observer - public void Update() - { - RecalcFormulaAndUpdateCell(); - } - - public bool RecalcFormulaAndUpdateCell() - { - Calculation.Formulas.DataObjects.IDataObject result = formula_item.Recalculate(); // May lead in Update of 'this' - CellOrFormulaUpdated = true; - valid = true; - if (result != null) - { - parent_sheet.CellSetValue(cell, result); - return true; - } - return false; - } - - public void CellSetErrorValue(Calculation.Formulas.DataObjects.IDataObject error) - { - parent_sheet.CellSetValue(cell, error); - } - - public void ChangeObserverOnRangeRemoved(Cells.CellRange removed_range, Worksheet removed_range_sheet) - { - if (formula_item.RemoveReferencesTo(removed_range, removed_range_sheet)) - { - CellOrFormulaUpdated = true; - } - else - { - UpdateDelayed = true; - } - } - - public void ChangeObserverOnWorksheetRemoved(Worksheet removed_sheet) - { - if (formula_item.RemoveReferencesTo(removed_sheet)) - { - RecalcFormulaAndUpdateCell(); - CellOrFormulaUpdated = true; - } - else // This case if the names of the sheets haven't been changed and the value shall be recalculated later (after actual sheet removing) - { - UpdateDelayed = true; - } - parent_sheet.FormulaSimpleSetValue(cell, formula_item.Assemble()); - } - - public void ChangeObserverOnWorksheetRenamed(Worksheet removed_sheet) - { - parent_sheet.FormulaSimpleSetValue(cell, formula_item.Assemble()); - CellOrFormulaUpdated = true; - } - - public void ChangeObserverOnRangeInserted(Cells.CellRange moved_range, Cells.Offset offset, Worksheet affected_sheet) - { - if (formula_item.ResizeInsertionAffected(moved_range, offset, affected_sheet)) - { - CellOrFormulaUpdated = true; - } - else - { - UpdateDelayed = true; - } - } - - public void ShiftReferencesTo(ISubject subject, Cells.Offset offset, Worksheet affected_sheet) - { - if (formula_item.ShiftReferencesTo(subject, offset, affected_sheet)) - { - CellOrFormulaUpdated = true; - } - else - { - UpdateDelayed = true; - } - } - - public bool Valid { get { return valid; } } - public void Invalidate() - { - valid = false; - manager.InvalidateUpdatedCell(this, cell, parent_sheet); - } - - #endregion - - #region ISubject Members - - public Formulas.DataObjects.IDataObject GetValue() - { - if (HasFormula() && !valid) - { - if (formula_item.RecalcInProgress) // Cycle found!!! - { - return new Formulas.DataObjects.ObjectError(ErrorValue.bad_reference); - } - Formulas.DataObjects.IDataObject result = formula_item.Recalculate(); // May lead in Update of 'this' - valid = true; - CellOrFormulaUpdated = true; - if (result != null) - { - parent_sheet.CellSetValue(cell, result); - } - return result; - } - else - { - return parent_sheet.CellGetValue(cell); - } - } - - #endregion - - public override string ToString() - { - return cell.ToString(); - } - - public void BecomeObserver(CellParsedFormula formula_item) - { - this.formula_item = formula_item; - } - - public void BecomeSubject() - { - this.formula_item = null; - } - - public bool HasFormula() - { - return formula_item != null; - } - - #region IComparable Members - - public int CompareTo(ISubject other) - { - CellItem other_subj = other as CellItem; - if (other_subj == null) - { - return this.GetType().GUID.CompareTo(other.GetType().GUID); - } - int sheets_cmp = parent_sheet.Index.CompareTo(other_subj.parent_sheet.Index); - if(sheets_cmp != 0) - { - return sheets_cmp; - } - return cell.CompareTo(other_subj.cell); - } - - #endregion - - internal bool CellOrFormulaUpdated { get; set; } // Set if the result value is changed due to a recalculation or linked subject changed - internal bool UpdateDelayed { get; set; } // Set if the formula can't be recalculated at a moment and must be recalculated later - internal Cells.Cell Cell { get { return cell; } } - - private Cells.Cell cell; - private Worksheet parent_sheet; - - private ValuesUpdateManager manager; - private CellParsedFormula formula_item; - private bool valid; - - } - -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/BinOpCalc/AddCalculator.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/BinOpCalc/AddCalculator.cs deleted file mode 100644 index 38c67f8daf..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/BinOpCalc/AddCalculator.cs +++ /dev/null @@ -1,206 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.BinOpCalc -{ - internal class AddCalculator : IFullBinaryOpDispatcher - { - #region IFullBinaryOpDispatcher Members - - #region DataObjects.ObjectNumber - public DataObjects.IDataObject Calc(DataObjects.ObjectNumber arg_num1, DataObjects.ObjectNumber arg_num2) - { - return new DataObjects.ObjectNumber(arg_num1.Value + arg_num2.Value); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectNumber arg_num, DataObjects.ObjectBoolean arg_bool) - { - return new DataObjects.ObjectNumber(arg_num.Value + (arg_bool.Value ? 1.0 : 0.0)); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectNumber arg_num, DataObjects.ObjectError arg_err) - { - return arg_err; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectNumber arg_num, DataObjects.ObjectString arg_str) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectNumber arg_num, DataObjects.ObjectReference arg_range) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectNumber arg_num, DataObjects.ObjectEmpty arg_empty) - { - return arg_num; - } - #endregion - - #region DataObjects.ObjectBoolean - public DataObjects.IDataObject Calc(DataObjects.ObjectBoolean arg_bool, DataObjects.ObjectNumber arg_num) // Call inversed - { - return Calc(arg_num, arg_bool); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectBoolean arg_bool1, DataObjects.ObjectBoolean arg_bool2) - { - return new DataObjects.ObjectNumber((arg_bool1.Value ? 1.0 : 0.0) + (arg_bool2.Value ? 1.0 : 0.0)); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectBoolean arg_bool, DataObjects.ObjectError arg_err) - { - return arg_err; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectBoolean arg_bool, DataObjects.ObjectString arg_str) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectBoolean arg_bool, DataObjects.ObjectReference arg_range) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectBoolean arg_bool, DataObjects.ObjectEmpty arg_empty) - { - return new DataObjects.ObjectNumber(arg_bool.Value ? 1.0 : 0.0); - } - #endregion - - #region DataObjects.ObjectError - public DataObjects.IDataObject Calc(DataObjects.ObjectError arg_err, DataObjects.ObjectNumber arg_num) - { - return arg_err; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectError arg_err, DataObjects.ObjectBoolean arg_bool) - { - return arg_err; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectError arg_err1, DataObjects.ObjectError arg_err2) - { - return arg_err1; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectError arg_err, DataObjects.ObjectString arg_str) - { - return arg_err; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectError arg_err, DataObjects.ObjectReference arg_range) - { - return arg_err; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectError arg_err, DataObjects.ObjectEmpty arg_empty) - { - return arg_err; - } - #endregion - - #region DataObjects.ObjectString - public DataObjects.IDataObject Calc(DataObjects.ObjectString arg_str, DataObjects.ObjectNumber arg_num) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectString arg_str, DataObjects.ObjectBoolean arg_bool) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectString arg_str, DataObjects.ObjectError arg_err) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); ; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectString arg_str1, DataObjects.ObjectString arg_str2) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectString arg_str, DataObjects.ObjectReference arg_range) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectString arg_str, DataObjects.ObjectEmpty arg_empty) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - #endregion - - #region ObjectReference - public DataObjects.IDataObject Calc(DataObjects.ObjectReference arg_range, DataObjects.ObjectNumber arg_num) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectReference arg_range, DataObjects.ObjectBoolean arg_bool) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectReference arg_range, DataObjects.ObjectError arg_err) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectReference arg_range, DataObjects.ObjectString arg_str) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectReference arg_range1, DataObjects.ObjectReference arg_range2) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectReference arg_range1, DataObjects.ObjectEmpty arg_empty) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - #endregion - - #region ObjectEmpty - public DataObjects.IDataObject Calc(DataObjects.ObjectEmpty arg_empty, DataObjects.ObjectNumber arg_num) // Call inversed - { - return Calc(arg_num, arg_empty); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectEmpty arg_empty, DataObjects.ObjectBoolean arg_bool) // Call inversed - { - return Calc(arg_bool, arg_empty); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectEmpty arg_empty, DataObjects.ObjectError arg_err) // Call inversed - { - return Calc(arg_err, arg_empty); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectEmpty arg_empty, DataObjects.ObjectString arg_str) // Call inversed - { - return Calc(arg_str, arg_empty); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectEmpty arg_empty, DataObjects.ObjectReference arg_range) // Call inversed - { - return Calc(arg_range, arg_empty); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectEmpty arg_empty1, DataObjects.ObjectEmpty arg_empty2) - { - return new DataObjects.ObjectNumber(0.0); - } - - #endregion - - #endregion - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/BinOpCalc/Arithmetic.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/BinOpCalc/Arithmetic.cs deleted file mode 100644 index ea6d2e7559..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/BinOpCalc/Arithmetic.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.BinOpCalc -{ - internal class Arithmetic - { - public static readonly AddCalculator AddCalculator = new AddCalculator(); - public static readonly SubCalculator SubCalculator = new SubCalculator(); - public static readonly MulCalculator MulCalculator = new MulCalculator(); - public static readonly DivCalculator DivCalculator = new DivCalculator(); - public static readonly PowerCalculator PowerCalculator = new PowerCalculator(); - public static readonly EqCalculator EqCalculator = new EqCalculator(); - public static readonly LtCalculator LtCalculator = new LtCalculator(); - public static readonly GtCalculator GtCalculator = new GtCalculator(); - public static readonly ConcatCalculator ConcatCalculator = new ConcatCalculator(); - public static readonly UnionCalculator UnionCalculator = new UnionCalculator(); - public static readonly IsectCalculator IsectCalculator = new IsectCalculator(); - public static readonly RangeCalculator RangeCalculator = new RangeCalculator(); - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/BinOpCalc/ConcatCalculator.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/BinOpCalc/ConcatCalculator.cs deleted file mode 100644 index d7d6e365b3..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/BinOpCalc/ConcatCalculator.cs +++ /dev/null @@ -1,228 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.BinOpCalc -{ - internal class ConcatCalculator : IFullBinaryOpDispatcher - { - private DataObjects.IDataObject Concat(DataObjects.IDataObject elem1, DataObjects.IDataObject elem2) - { - return new DataObjects.ObjectString(elem1.ToString() + elem2.ToString()); - } - private DataObjects.IDataObject Concat(DataObjects.ObjectString str, DataObjects.IDataObject elem2) - { - return new DataObjects.ObjectString(str.Value + elem2.ToString()); - } - private DataObjects.IDataObject Concat(DataObjects.IDataObject elem1, DataObjects.ObjectString str) - { - return new DataObjects.ObjectString(elem1.ToString() + str.Value); - } - private DataObjects.IDataObject Concat(DataObjects.ObjectEmpty empty, DataObjects.IDataObject elem2) - { - return new DataObjects.ObjectString(elem2.ToString()); - } - private DataObjects.IDataObject Concat(DataObjects.IDataObject elem1, DataObjects.ObjectEmpty empty) - { - return new DataObjects.ObjectString(elem1.ToString()); - } - - - #region IFullBinaryOpDispatcher Members - - #region DataObjects.ObjectNumber - public DataObjects.IDataObject Calc(DataObjects.ObjectNumber arg_num1, DataObjects.ObjectNumber arg_num2) - { - return Concat(arg_num1, arg_num2); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectNumber arg_num, DataObjects.ObjectBoolean arg_bool) - { - return Concat(arg_num, arg_bool); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectNumber arg_num, DataObjects.ObjectError arg_err) - { - return arg_err; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectNumber arg_num, DataObjects.ObjectString arg_str) - { - return Concat(arg_num, arg_str); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectNumber arg_num, DataObjects.ObjectReference arg_range) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectNumber arg_num, DataObjects.ObjectEmpty arg_empty) - { - return Concat(arg_num, arg_empty); - } - #endregion - - #region DataObjects.ObjectBoolean - public DataObjects.IDataObject Calc(DataObjects.ObjectBoolean arg_bool, DataObjects.ObjectNumber arg_num) - { - return Concat(arg_bool, arg_num); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectBoolean arg_bool1, DataObjects.ObjectBoolean arg_bool2) - { - return Concat(arg_bool1, arg_bool2); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectBoolean arg_bool, DataObjects.ObjectError arg_err) - { - return arg_err; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectBoolean arg_bool, DataObjects.ObjectString arg_str) - { - return Concat(arg_bool, arg_str); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectBoolean arg_bool, DataObjects.ObjectReference arg_range) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectBoolean arg_bool, DataObjects.ObjectEmpty arg_empty) - { - return Concat(arg_bool, arg_empty); - } - #endregion - - #region DataObjects.ObjectError - public DataObjects.IDataObject Calc(DataObjects.ObjectError arg_err, DataObjects.ObjectNumber arg_num) - { - return arg_err; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectError arg_err, DataObjects.ObjectBoolean arg_bool) - { - return arg_err; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectError arg_err1, DataObjects.ObjectError arg_err2) - { - return arg_err1; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectError arg_err, DataObjects.ObjectString arg_str) - { - return arg_err; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectError arg_err, DataObjects.ObjectReference arg_range) - { - return arg_err; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectError arg_err, DataObjects.ObjectEmpty arg_empty) - { - return arg_err; - } - #endregion - - #region DataObjects.ObjectString - public DataObjects.IDataObject Calc(DataObjects.ObjectString arg_str, DataObjects.ObjectNumber arg_num) - { - return Concat(arg_str, arg_num); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectString arg_str, DataObjects.ObjectBoolean arg_bool) - { - return Concat(arg_str, arg_bool); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectString arg_str, DataObjects.ObjectError arg_err) - { - return arg_err; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectString arg_str1, DataObjects.ObjectString arg_str2) - { - return new DataObjects.ObjectString(arg_str1.Value + arg_str2.Value); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectString arg_str, DataObjects.ObjectReference arg_range) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectString arg_str, DataObjects.ObjectEmpty arg_empty) - { - return arg_str; - } - #endregion - - #region ObjectReference - public DataObjects.IDataObject Calc(DataObjects.ObjectReference arg_range, DataObjects.ObjectNumber arg_num) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectReference arg_range, DataObjects.ObjectBoolean arg_bool) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectReference arg_range, DataObjects.ObjectError arg_err) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectReference arg_range, DataObjects.ObjectString arg_str) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectReference arg_range1, DataObjects.ObjectReference arg_range2) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectReference arg_range1, DataObjects.ObjectEmpty arg_empty) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - #endregion - - #region DataObjects.ObjectEmpty - public DataObjects.IDataObject Calc(DataObjects.ObjectEmpty arg_empty, DataObjects.ObjectNumber arg_num) - { - return Concat(arg_empty, arg_num); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectEmpty arg_empty, DataObjects.ObjectBoolean arg_bool) - { - return Concat(arg_empty, arg_bool); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectEmpty arg_empty, DataObjects.ObjectError arg_err) - { - return arg_err; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectEmpty arg_empty, DataObjects.ObjectString arg_str) - { - return arg_str; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectEmpty arg_empty, DataObjects.ObjectReference arg_range) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectEmpty arg_empty1, DataObjects.ObjectEmpty arg_empty2) - { - return new DataObjects.ObjectString(""); - } - - #endregion - - #endregion - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/BinOpCalc/DivCalculator.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/BinOpCalc/DivCalculator.cs deleted file mode 100644 index 4d077b257b..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/BinOpCalc/DivCalculator.cs +++ /dev/null @@ -1,230 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.BinOpCalc -{ - internal class DivCalculator : IFullBinaryOpDispatcher - { - #region IFullBinaryOpDispatcher Members - - #region DataObjects.ObjectNumber - public DataObjects.IDataObject Calc(DataObjects.ObjectNumber arg_num1, DataObjects.ObjectNumber arg_num2) - { - if (arg_num2.Value == 0.0) - { - return new DataObjects.ObjectError(ErrorValue.division_by_zero); - } - return new DataObjects.ObjectNumber(arg_num1.Value / arg_num2.Value); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectNumber arg_num, DataObjects.ObjectBoolean arg_bool) - { - if (!arg_bool.Value) - { - return new DataObjects.ObjectError(ErrorValue.division_by_zero); - } - return arg_num; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectNumber arg_num, DataObjects.ObjectError arg_err) - { - return arg_err; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectNumber arg_num, DataObjects.ObjectString arg_str) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectNumber arg_num, DataObjects.ObjectReference arg_range) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectNumber arg_num, DataObjects.ObjectEmpty arg_empty) - { - return new DataObjects.ObjectError(ErrorValue.division_by_zero); - } - #endregion - - #region DataObjects.ObjectBoolean - public DataObjects.IDataObject Calc(DataObjects.ObjectBoolean arg_bool, DataObjects.ObjectNumber arg_num) - { - if (arg_num.Value == 0.0) - { - return new DataObjects.ObjectError(ErrorValue.division_by_zero); - } - return new DataObjects.ObjectNumber((arg_bool.Value ? 1.0 : 0.0) / arg_num.Value); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectBoolean arg_bool1, DataObjects.ObjectBoolean arg_bool2) - { - if (!arg_bool2.Value) - { - return new DataObjects.ObjectError(ErrorValue.division_by_zero); - } - return new DataObjects.ObjectNumber((arg_bool1.Value ? 1.0 : 0.0)); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectBoolean arg_bool, DataObjects.ObjectError arg_err) - { - return arg_err; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectBoolean arg_bool, DataObjects.ObjectString arg_str) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectBoolean arg_bool, DataObjects.ObjectReference arg_range) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectBoolean arg_bool, DataObjects.ObjectEmpty arg_empty) - { - return new DataObjects.ObjectError(ErrorValue.division_by_zero); - } - #endregion - - #region DataObjects.ObjectError - public DataObjects.IDataObject Calc(DataObjects.ObjectError arg_err, DataObjects.ObjectNumber arg_num) - { - return arg_err; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectError arg_err, DataObjects.ObjectBoolean arg_bool) - { - return arg_err; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectError arg_err1, DataObjects.ObjectError arg_err2) - { - return arg_err1; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectError arg_err, DataObjects.ObjectString arg_str) - { - return arg_err; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectError arg_err, DataObjects.ObjectReference arg_range) - { - return arg_err; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectError arg_err, DataObjects.ObjectEmpty arg_empty) - { - return arg_err; - } - #endregion - - #region DataObjects.ObjectString - public DataObjects.IDataObject Calc(DataObjects.ObjectString arg_str, DataObjects.ObjectNumber arg_num) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectString arg_str, DataObjects.ObjectBoolean arg_bool) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectString arg_str, DataObjects.ObjectError arg_err) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); ; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectString arg_str1, DataObjects.ObjectString arg_str2) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectString arg_str, DataObjects.ObjectReference arg_range) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectString arg_str, DataObjects.ObjectEmpty arg_empty) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - #endregion - - #region DataObjects.ObjectReference - public DataObjects.IDataObject Calc(DataObjects.ObjectReference arg_range, DataObjects.ObjectNumber arg_num) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectReference arg_range, DataObjects.ObjectBoolean arg_bool) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectReference arg_range, DataObjects.ObjectError arg_err) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectReference arg_range, DataObjects.ObjectString arg_str) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectReference arg_range1, DataObjects.ObjectReference arg_range2) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectReference arg_range1, DataObjects.ObjectEmpty arg_empty) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - #endregion - - #region DataObjects.ObjectEmpty - public DataObjects.IDataObject Calc(DataObjects.ObjectEmpty arg_empty, DataObjects.ObjectNumber arg_num) - { - if (arg_num.Value == 0.0) - { - return new DataObjects.ObjectError(ErrorValue.division_by_zero); - } - return new DataObjects.ObjectNumber(0.0); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectEmpty arg_empty, DataObjects.ObjectBoolean arg_bool) - { - if (!arg_bool.Value) - { - return new DataObjects.ObjectError(ErrorValue.division_by_zero); - } - return new DataObjects.ObjectNumber(0.0); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectEmpty arg_empty, DataObjects.ObjectError arg_err) // Call inversed - { - return Calc(arg_err, arg_empty); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectEmpty arg_empty, DataObjects.ObjectString arg_str) // Call inversed - { - return Calc(arg_str, arg_empty); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectEmpty arg_empty, DataObjects.ObjectReference arg_range) // Call inversed - { - return Calc(arg_range, arg_empty); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectEmpty arg_empty1, DataObjects.ObjectEmpty arg_empty2) - { - return new DataObjects.ObjectError(ErrorValue.division_by_zero); - } - - #endregion - - #endregion - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/BinOpCalc/EqCalculator.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/BinOpCalc/EqCalculator.cs deleted file mode 100644 index 8a37a49f58..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/BinOpCalc/EqCalculator.cs +++ /dev/null @@ -1,206 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.BinOpCalc -{ - internal class EqCalculator : IFullBinaryOpDispatcher - { - #region IFullBinaryOpDispatcher Members - - #region DataObjects.ObjectNumber - public DataObjects.IDataObject Calc(DataObjects.ObjectNumber arg_num1, DataObjects.ObjectNumber arg_num2) - { - return new DataObjects.ObjectBoolean(arg_num1.Value == arg_num2.Value); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectNumber arg_num, DataObjects.ObjectBoolean arg_bool) - { - return new DataObjects.ObjectBoolean(false); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectNumber arg_num, DataObjects.ObjectError arg_err) - { - return arg_err; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectNumber arg_num, DataObjects.ObjectString arg_str) - { - return new DataObjects.ObjectBoolean(false); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectNumber arg_num, DataObjects.ObjectReference arg_range) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectNumber arg_num, DataObjects.ObjectEmpty arg_empty) - { - return new DataObjects.ObjectBoolean(arg_num.Value == 0); - } - #endregion - - #region DataObjects.ObjectBoolean - public DataObjects.IDataObject Calc(DataObjects.ObjectBoolean arg_bool, DataObjects.ObjectNumber arg_num) // Call inversed - { - return Calc(arg_num, arg_bool); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectBoolean arg_bool1, DataObjects.ObjectBoolean arg_bool2) - { - return new DataObjects.ObjectBoolean(arg_bool1.Value == arg_bool2.Value); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectBoolean arg_bool, DataObjects.ObjectError arg_err) - { - return arg_err; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectBoolean arg_bool, DataObjects.ObjectString arg_str) - { - return new DataObjects.ObjectBoolean(false); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectBoolean arg_bool, DataObjects.ObjectReference arg_range) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectBoolean arg_bool, DataObjects.ObjectEmpty arg_empty) - { - return new DataObjects.ObjectBoolean(arg_bool.Value == false); - } - #endregion - - #region DataObjects.ObjectError - public DataObjects.IDataObject Calc(DataObjects.ObjectError arg_err, DataObjects.ObjectNumber arg_num) - { - return arg_err; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectError arg_err, DataObjects.ObjectBoolean arg_bool) - { - return arg_err; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectError arg_err1, DataObjects.ObjectError arg_err2) - { - return arg_err1; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectError arg_err, DataObjects.ObjectString arg_str) - { - return arg_err; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectError arg_err, DataObjects.ObjectReference arg_range) - { - return arg_err; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectError arg_err, DataObjects.ObjectEmpty arg_empty) - { - return arg_err; - } - #endregion - - #region DataObjects.ObjectString - public DataObjects.IDataObject Calc(DataObjects.ObjectString arg_str, DataObjects.ObjectNumber arg_num) - { - return new DataObjects.ObjectBoolean(false); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectString arg_str, DataObjects.ObjectBoolean arg_bool) - { - return new DataObjects.ObjectBoolean(false); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectString arg_str, DataObjects.ObjectError arg_err) - { - return arg_err; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectString arg_str1, DataObjects.ObjectString arg_str2) - { - return new DataObjects.ObjectBoolean(string.Compare(arg_str1.Value, arg_str2.Value, true) == 0); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectString arg_str, DataObjects.ObjectReference arg_range) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectString arg_str, DataObjects.ObjectEmpty arg_empty) - { - return new DataObjects.ObjectBoolean(arg_str.Value.Length == 0); - } - #endregion - - #region ObjectReference - public DataObjects.IDataObject Calc(DataObjects.ObjectReference arg_range, DataObjects.ObjectNumber arg_num) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectReference arg_range, DataObjects.ObjectBoolean arg_bool) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectReference arg_range, DataObjects.ObjectError arg_err) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectReference arg_range, DataObjects.ObjectString arg_str) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectReference arg_range1, DataObjects.ObjectReference arg_range2) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectReference arg_range1, DataObjects.ObjectEmpty arg_empty) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - #endregion - - #region DataObjects.ObjectEmpty - public DataObjects.IDataObject Calc(DataObjects.ObjectEmpty arg_empty, DataObjects.ObjectNumber arg_num) // Call inversed - { - return Calc(arg_num, arg_empty); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectEmpty arg_empty, DataObjects.ObjectBoolean arg_bool) // Call inversed - { - return Calc(arg_bool, arg_empty); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectEmpty arg_empty, DataObjects.ObjectError arg_err) // Call inversed - { - return Calc(arg_err, arg_empty); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectEmpty arg_empty, DataObjects.ObjectString arg_str) // Call inversed - { - return Calc(arg_str, arg_empty); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectEmpty arg_empty, DataObjects.ObjectReference arg_range) // Call inversed - { - return Calc(arg_range, arg_empty); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectEmpty arg_empty1, DataObjects.ObjectEmpty arg_empty2) - { - return new DataObjects.ObjectBoolean(true); - } - - #endregion - - #endregion - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/BinOpCalc/GtCalculator.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/BinOpCalc/GtCalculator.cs deleted file mode 100644 index 5a34bed2bb..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/BinOpCalc/GtCalculator.cs +++ /dev/null @@ -1,206 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.BinOpCalc -{ - internal class GtCalculator : IFullBinaryOpDispatcher - { - #region IFullBinaryOpDispatcher Members - - #region DataObjects.ObjectNumber - public DataObjects.IDataObject Calc(DataObjects.ObjectNumber arg_num1, DataObjects.ObjectNumber arg_num2) - { - return new DataObjects.ObjectBoolean(arg_num1.Value > arg_num2.Value); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectNumber arg_num, DataObjects.ObjectBoolean arg_bool) - { - return new DataObjects.ObjectBoolean(false); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectNumber arg_num, DataObjects.ObjectError arg_err) - { - return arg_err; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectNumber arg_num, DataObjects.ObjectString arg_str) - { - return new DataObjects.ObjectBoolean(false); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectNumber arg_num, DataObjects.ObjectReference arg_range) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectNumber arg_num, DataObjects.ObjectEmpty arg_empty) - { - return new DataObjects.ObjectBoolean(arg_num.Value > 0); - } - #endregion - - #region DataObjects.ObjectBoolean - public DataObjects.IDataObject Calc(DataObjects.ObjectBoolean arg_bool, DataObjects.ObjectNumber arg_num) // Call inversed - { - return new DataObjects.ObjectBoolean(true); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectBoolean arg_bool1, DataObjects.ObjectBoolean arg_bool2) - { - return new DataObjects.ObjectBoolean(arg_bool1.Value && !arg_bool2.Value); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectBoolean arg_bool, DataObjects.ObjectError arg_err) - { - return arg_err; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectBoolean arg_bool, DataObjects.ObjectString arg_str) - { - return new DataObjects.ObjectBoolean(true); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectBoolean arg_bool, DataObjects.ObjectReference arg_range) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectBoolean arg_bool, DataObjects.ObjectEmpty arg_empty) - { - return arg_bool; - } - #endregion - - #region DataObjects.ObjectError - public DataObjects.IDataObject Calc(DataObjects.ObjectError arg_err, DataObjects.ObjectNumber arg_num) - { - return arg_err; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectError arg_err, DataObjects.ObjectBoolean arg_bool) - { - return arg_err; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectError arg_err1, DataObjects.ObjectError arg_err2) - { - return arg_err1; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectError arg_err, DataObjects.ObjectString arg_str) - { - return arg_err; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectError arg_err, DataObjects.ObjectReference arg_range) - { - return arg_err; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectError arg_err, DataObjects.ObjectEmpty arg_empty) - { - return arg_err; - } - #endregion - - #region DataObjects.ObjectString - public DataObjects.IDataObject Calc(DataObjects.ObjectString arg_str, DataObjects.ObjectNumber arg_num) - { - return new DataObjects.ObjectBoolean(true); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectString arg_str, DataObjects.ObjectBoolean arg_bool) - { - return new DataObjects.ObjectBoolean(false); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectString arg_str, DataObjects.ObjectError arg_err) - { - return arg_err; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectString arg_str1, DataObjects.ObjectString arg_str2) - { - return new DataObjects.ObjectBoolean(string.Compare(arg_str1.Value, arg_str2.Value, true) > 0); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectString arg_str, DataObjects.ObjectReference arg_range) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectString arg_str, DataObjects.ObjectEmpty arg_empty) - { - return new DataObjects.ObjectBoolean(arg_str.Value.Length != 0); - } - #endregion - - #region ObjectReference - public DataObjects.IDataObject Calc(DataObjects.ObjectReference arg_range, DataObjects.ObjectNumber arg_num) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectReference arg_range, DataObjects.ObjectBoolean arg_bool) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectReference arg_range, DataObjects.ObjectError arg_err) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectReference arg_range, DataObjects.ObjectString arg_str) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectReference arg_range1, DataObjects.ObjectReference arg_range2) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectReference arg_range1, DataObjects.ObjectEmpty arg_empty) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - #endregion - - #region DataObjects.ObjectEmpty - public DataObjects.IDataObject Calc(DataObjects.ObjectEmpty arg_empty, DataObjects.ObjectNumber arg_num) - { - return new DataObjects.ObjectBoolean(0 > arg_num.Value); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectEmpty arg_empty, DataObjects.ObjectBoolean arg_bool) - { - return new DataObjects.ObjectBoolean(false); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectEmpty arg_empty, DataObjects.ObjectError arg_err) - { - return arg_err; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectEmpty arg_empty, DataObjects.ObjectString arg_str) - { - return new DataObjects.ObjectBoolean(false); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectEmpty arg_empty, DataObjects.ObjectReference arg_range) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectEmpty arg_empty1, DataObjects.ObjectEmpty arg_empty2) - { - return new DataObjects.ObjectBoolean(false); - } - - #endregion - - #endregion - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/BinOpCalc/IFullBinaryOpDispatcher.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/BinOpCalc/IFullBinaryOpDispatcher.cs deleted file mode 100644 index 66c39dbcdb..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/BinOpCalc/IFullBinaryOpDispatcher.cs +++ /dev/null @@ -1,58 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.BinOpCalc -{ - internal interface IFullBinaryOpDispatcher - { - #region DataObjects.ObjectNumber - DataObjects.IDataObject Calc(DataObjects.ObjectNumber arg_num1, DataObjects.ObjectNumber arg_num2); - DataObjects.IDataObject Calc(DataObjects.ObjectNumber arg_num, DataObjects.ObjectBoolean arg_bool); - DataObjects.IDataObject Calc(DataObjects.ObjectNumber arg_num, DataObjects.ObjectError arg_err); - DataObjects.IDataObject Calc(DataObjects.ObjectNumber arg_num, DataObjects.ObjectString arg_str); - DataObjects.IDataObject Calc(DataObjects.ObjectNumber arg_num, DataObjects.ObjectReference arg_range); - DataObjects.IDataObject Calc(DataObjects.ObjectNumber arg_num, DataObjects.ObjectEmpty arg_empty); - #endregion - #region DataObjects.ObjectBoolean - DataObjects.IDataObject Calc(DataObjects.ObjectBoolean arg_bool, DataObjects.ObjectNumber arg_num); - DataObjects.IDataObject Calc(DataObjects.ObjectBoolean arg_bool1, DataObjects.ObjectBoolean arg_bool2); - DataObjects.IDataObject Calc(DataObjects.ObjectBoolean arg_bool, DataObjects.ObjectError arg_err); - DataObjects.IDataObject Calc(DataObjects.ObjectBoolean arg_bool, DataObjects.ObjectString arg_str); - DataObjects.IDataObject Calc(DataObjects.ObjectBoolean arg_bool, DataObjects.ObjectReference arg_range); - DataObjects.IDataObject Calc(DataObjects.ObjectBoolean arg_bool, DataObjects.ObjectEmpty arg_empty); - #endregion - #region DataObjects.ObjectError - DataObjects.IDataObject Calc(DataObjects.ObjectError arg_err, DataObjects.ObjectNumber arg_num); - DataObjects.IDataObject Calc(DataObjects.ObjectError arg_err, DataObjects.ObjectBoolean arg_bool); - DataObjects.IDataObject Calc(DataObjects.ObjectError arg_err1, DataObjects.ObjectError arg_err2); - DataObjects.IDataObject Calc(DataObjects.ObjectError arg_err, DataObjects.ObjectString arg_str); - DataObjects.IDataObject Calc(DataObjects.ObjectError arg_err, DataObjects.ObjectReference arg_range); - DataObjects.IDataObject Calc(DataObjects.ObjectError arg_err, DataObjects.ObjectEmpty arg_empty); - #endregion - #region DataObjects.ObjectString - DataObjects.IDataObject Calc(DataObjects.ObjectString arg_str, DataObjects.ObjectNumber arg_num); - DataObjects.IDataObject Calc(DataObjects.ObjectString arg_str, DataObjects.ObjectBoolean arg_bool); - DataObjects.IDataObject Calc(DataObjects.ObjectString arg_str, DataObjects.ObjectError arg_err); - DataObjects.IDataObject Calc(DataObjects.ObjectString arg_str1, DataObjects.ObjectString arg_str2); - DataObjects.IDataObject Calc(DataObjects.ObjectString arg_str, DataObjects.ObjectReference arg_range); - DataObjects.IDataObject Calc(DataObjects.ObjectString arg_str, DataObjects.ObjectEmpty arg_empty); - #endregion - #region ObjectReference - DataObjects.IDataObject Calc(DataObjects.ObjectReference arg_range, DataObjects.ObjectNumber arg_num); - DataObjects.IDataObject Calc(DataObjects.ObjectReference arg_range, DataObjects.ObjectBoolean arg_bool); - DataObjects.IDataObject Calc(DataObjects.ObjectReference arg_range, DataObjects.ObjectError arg_err); - DataObjects.IDataObject Calc(DataObjects.ObjectReference arg_range, DataObjects.ObjectString arg_str); - DataObjects.IDataObject Calc(DataObjects.ObjectReference arg_range1, DataObjects.ObjectReference arg_range2); - DataObjects.IDataObject Calc(DataObjects.ObjectReference arg_range1, DataObjects.ObjectEmpty arg_empty); - #endregion - #region ObjectEmpty - DataObjects.IDataObject Calc(DataObjects.ObjectEmpty arg_empty, DataObjects.ObjectNumber arg_num); - DataObjects.IDataObject Calc(DataObjects.ObjectEmpty arg_empty, DataObjects.ObjectBoolean arg_bool); - DataObjects.IDataObject Calc(DataObjects.ObjectEmpty arg_empty, DataObjects.ObjectError arg_err); - DataObjects.IDataObject Calc(DataObjects.ObjectEmpty arg_empty, DataObjects.ObjectString arg_str); - DataObjects.IDataObject Calc(DataObjects.ObjectEmpty arg_empty, DataObjects.ObjectReference arg_range); - DataObjects.IDataObject Calc(DataObjects.ObjectEmpty arg_empty1, DataObjects.ObjectEmpty arg_empty2); - #endregion - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/BinOpCalc/IsectCalculator.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/BinOpCalc/IsectCalculator.cs deleted file mode 100644 index 42a1599811..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/BinOpCalc/IsectCalculator.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.BinOpCalc -{ - internal class IsectCalculator : ReferenceOperatorsCalculator - { - public override DataObjects.IDataObject Calc(DataObjects.ObjectReference arg_range1, DataObjects.ObjectReference arg_range2) - { - return arg_range1.Intersect(arg_range2); - } - - public override string OperatorName { get { return "intersection"; } } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/BinOpCalc/LtCalculator.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/BinOpCalc/LtCalculator.cs deleted file mode 100644 index 07bf92e76e..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/BinOpCalc/LtCalculator.cs +++ /dev/null @@ -1,206 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.BinOpCalc -{ - internal class LtCalculator : IFullBinaryOpDispatcher - { - #region IFullBinaryOpDispatcher Members - - #region DataObjects.ObjectNumber - public DataObjects.IDataObject Calc(DataObjects.ObjectNumber arg_num1, DataObjects.ObjectNumber arg_num2) - { - return new DataObjects.ObjectBoolean(arg_num1.Value < arg_num2.Value); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectNumber arg_num, DataObjects.ObjectBoolean arg_bool) - { - return new DataObjects.ObjectBoolean(true); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectNumber arg_num, DataObjects.ObjectError arg_err) - { - return arg_err; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectNumber arg_num, DataObjects.ObjectString arg_str) - { - return new DataObjects.ObjectBoolean(true); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectNumber arg_num, DataObjects.ObjectReference arg_range) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectNumber arg_num, DataObjects.ObjectEmpty arg_empty) - { - return new DataObjects.ObjectBoolean(arg_num.Value < 0); - } - #endregion - - #region DataObjects.ObjectBoolean - public DataObjects.IDataObject Calc(DataObjects.ObjectBoolean arg_bool, DataObjects.ObjectNumber arg_num) - { - return new DataObjects.ObjectBoolean(false); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectBoolean arg_bool1, DataObjects.ObjectBoolean arg_bool2) - { - return new DataObjects.ObjectBoolean(!arg_bool1.Value && arg_bool2.Value); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectBoolean arg_bool, DataObjects.ObjectError arg_err) - { - return arg_err; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectBoolean arg_bool, DataObjects.ObjectString arg_str) - { - return new DataObjects.ObjectBoolean(false); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectBoolean arg_bool,DataObjects.ObjectReference arg_range) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectBoolean arg_bool, DataObjects.ObjectEmpty arg_empty) - { - return new DataObjects.ObjectBoolean(false); - } - #endregion - - #region DataObjects.ObjectError - public DataObjects.IDataObject Calc(DataObjects.ObjectError arg_err, DataObjects.ObjectNumber arg_num) - { - return arg_err; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectError arg_err, DataObjects.ObjectBoolean arg_bool) - { - return arg_err; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectError arg_err1, DataObjects.ObjectError arg_err2) - { - return arg_err1; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectError arg_err, DataObjects.ObjectString arg_str) - { - return arg_err; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectError arg_err, DataObjects.ObjectReference arg_range) - { - return arg_err; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectError arg_err, DataObjects.ObjectEmpty arg_empty) - { - return arg_err; - } - #endregion - - #region DataObjects.ObjectString - public DataObjects.IDataObject Calc(DataObjects.ObjectString arg_str, DataObjects.ObjectNumber arg_num) - { - return new DataObjects.ObjectBoolean(false); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectString arg_str, DataObjects.ObjectBoolean arg_bool) - { - return new DataObjects.ObjectBoolean(true); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectString arg_str, DataObjects.ObjectError arg_err) - { - return arg_err; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectString arg_str1, DataObjects.ObjectString arg_str2) - { - return new DataObjects.ObjectBoolean(string.Compare(arg_str1.Value, arg_str2.Value, true) < 0); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectString arg_str, DataObjects.ObjectReference arg_range) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectString arg_str, DataObjects.ObjectEmpty arg_empty) - { - return new DataObjects.ObjectBoolean(false); - } - #endregion - - #region ObjectReference - public DataObjects.IDataObject Calc(DataObjects.ObjectReference arg_range, DataObjects.ObjectNumber arg_num) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectReference arg_range, DataObjects.ObjectBoolean arg_bool) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectReference arg_range, DataObjects.ObjectError arg_err) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectReference arg_range, DataObjects.ObjectString arg_str) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectReference arg_range1, DataObjects.ObjectReference arg_range2) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectReference arg_range1, DataObjects.ObjectEmpty arg_empty) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - #endregion - - #region DataObjects.ObjectEmpty - public DataObjects.IDataObject Calc(DataObjects.ObjectEmpty arg_empty, DataObjects.ObjectNumber arg_num) - { - return new DataObjects.ObjectBoolean(0 < arg_num.Value); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectEmpty arg_empty, DataObjects.ObjectBoolean arg_bool) - { - return arg_bool; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectEmpty arg_empty, DataObjects.ObjectError arg_err) - { - return arg_err; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectEmpty arg_empty, DataObjects.ObjectString arg_str) - { - return new DataObjects.ObjectBoolean(arg_str.Value.Length != 0); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectEmpty arg_empty, DataObjects.ObjectReference arg_range) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectEmpty arg_empty1, DataObjects.ObjectEmpty arg_empty2) - { - return new DataObjects.ObjectBoolean(false); - } - - #endregion - - #endregion - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/BinOpCalc/MulCalculator.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/BinOpCalc/MulCalculator.cs deleted file mode 100644 index f4e3c285ec..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/BinOpCalc/MulCalculator.cs +++ /dev/null @@ -1,206 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.BinOpCalc -{ - internal class MulCalculator : IFullBinaryOpDispatcher - { - #region IFullBinaryOpDispatcher Members - - #region DataObjects.ObjectNumber - public DataObjects.IDataObject Calc(DataObjects.ObjectNumber arg_num1, DataObjects.ObjectNumber arg_num2) - { - return new DataObjects.ObjectNumber(arg_num1.Value * arg_num2.Value); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectNumber arg_num, DataObjects.ObjectBoolean arg_bool) - { - return new DataObjects.ObjectNumber(arg_num.Value * (arg_bool.Value ? 1.0 : 0.0)); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectNumber arg_num, DataObjects.ObjectError arg_err) - { - return arg_err; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectNumber arg_num, DataObjects.ObjectString arg_str) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectNumber arg_num, DataObjects.ObjectReference arg_range) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectNumber arg_num, DataObjects.ObjectEmpty arg_empty) - { - return new DataObjects.ObjectNumber(0.0); - } - #endregion - - #region DataObjects.ObjectBoolean - public DataObjects.IDataObject Calc(DataObjects.ObjectBoolean arg_bool, DataObjects.ObjectNumber arg_num) // Call inversed - { - return Calc(arg_num, arg_bool); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectBoolean arg_bool1, DataObjects.ObjectBoolean arg_bool2) - { - return new DataObjects.ObjectNumber((arg_bool1.Value ? 1.0 : 0.0) * (arg_bool2.Value ? 1.0 : 0.0)); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectBoolean arg_bool, DataObjects.ObjectError arg_err) - { - return arg_err; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectBoolean arg_bool, DataObjects.ObjectString arg_str) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectBoolean arg_bool, DataObjects.ObjectReference arg_range) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectBoolean arg_bool, DataObjects.ObjectEmpty arg_empty) - { - return new DataObjects.ObjectNumber(0.0); - } - #endregion - - #region DataObjects.ObjectError - public DataObjects.IDataObject Calc(DataObjects.ObjectError arg_err, DataObjects.ObjectNumber arg_num) - { - return arg_err; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectError arg_err, DataObjects.ObjectBoolean arg_bool) - { - return arg_err; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectError arg_err1, DataObjects.ObjectError arg_err2) - { - return arg_err1; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectError arg_err, DataObjects.ObjectString arg_str) - { - return arg_err; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectError arg_err, DataObjects.ObjectReference arg_range) - { - return arg_err; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectError arg_err, DataObjects.ObjectEmpty arg_empty) - { - return arg_err; - } - #endregion - - #region DataObjects.ObjectString - public DataObjects.IDataObject Calc(DataObjects.ObjectString arg_str, DataObjects.ObjectNumber arg_num) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectString arg_str, DataObjects.ObjectBoolean arg_bool) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectString arg_str, DataObjects.ObjectError arg_err) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); ; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectString arg_str1, DataObjects.ObjectString arg_str2) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectString arg_str, DataObjects.ObjectReference arg_range) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectString arg_str, DataObjects.ObjectEmpty arg_empty) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - #endregion - - #region ObjectReference - public DataObjects.IDataObject Calc(DataObjects.ObjectReference arg_range, DataObjects.ObjectNumber arg_num) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectReference arg_range, DataObjects.ObjectBoolean arg_bool) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectReference arg_range, DataObjects.ObjectError arg_err) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectReference arg_range, DataObjects.ObjectString arg_str) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectReference arg_range1, DataObjects.ObjectReference arg_range2) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectReference arg_range1, DataObjects.ObjectEmpty arg_empty) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - #endregion - - #region DataObjects.ObjectEmpty - public DataObjects.IDataObject Calc(DataObjects.ObjectEmpty arg_empty, DataObjects.ObjectNumber arg_num) // Call inversed - { - return Calc(arg_num, arg_empty); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectEmpty arg_empty, DataObjects.ObjectBoolean arg_bool) // Call inversed - { - return Calc(arg_bool, arg_empty); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectEmpty arg_empty, DataObjects.ObjectError arg_err) // Call inversed - { - return Calc(arg_err, arg_empty); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectEmpty arg_empty, DataObjects.ObjectString arg_str) // Call inversed - { - return Calc(arg_str, arg_empty); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectEmpty arg_empty, DataObjects.ObjectReference arg_range) // Call inversed - { - return Calc(arg_range, arg_empty); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectEmpty arg_empty1, DataObjects.ObjectEmpty arg_empty2) - { - return new DataObjects.ObjectNumber(0.0); - } - - #endregion - - #endregion - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/BinOpCalc/PowerCalculator.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/BinOpCalc/PowerCalculator.cs deleted file mode 100644 index 7ca1de4923..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/BinOpCalc/PowerCalculator.cs +++ /dev/null @@ -1,220 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.BinOpCalc -{ - internal class PowerCalculator : IFullBinaryOpDispatcher - { - #region IFullBinaryOpDispatcher Members - - #region DataObjects.ObjectNumber - public DataObjects.IDataObject Calc(DataObjects.ObjectNumber arg_num1, DataObjects.ObjectNumber arg_num2) - { - double x = arg_num1.Value; - double y = arg_num2.Value; - if(x == 0.0 && y == 0.0) - { - return new DataObjects.ObjectError(ErrorValue.not_numeric); - } - else if(x == 0.0 && y < 0.0) - { - return new DataObjects.ObjectError(ErrorValue.division_by_zero); - } - else if(x < 0 && Math.Truncate(y) != y) - { - return new DataObjects.ObjectError(ErrorValue.not_numeric); - } - return new DataObjects.ObjectNumber(Math.Pow(x, y)); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectNumber arg_num, DataObjects.ObjectBoolean arg_bool) - { - return Calc(arg_num, new DataObjects.ObjectNumber(arg_bool.Value ? 1.0 : 0.0)); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectNumber arg_num, DataObjects.ObjectError arg_err) - { - return arg_err; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectNumber arg_num, DataObjects.ObjectString arg_str) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectNumber arg_num, DataObjects.ObjectReference arg_range) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectNumber arg_num, DataObjects.ObjectEmpty arg_empty) - { - return Calc(arg_num, new DataObjects.ObjectNumber(0.0)); - } - #endregion - - #region DataObjects.ObjectBoolean - public DataObjects.IDataObject Calc(DataObjects.ObjectBoolean arg_bool, DataObjects.ObjectNumber arg_num) - { - return Calc(new DataObjects.ObjectNumber(arg_bool.Value ? 1.0 : 0.0), arg_num); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectBoolean arg_bool1, DataObjects.ObjectBoolean arg_bool2) - { - return Calc(new DataObjects.ObjectNumber(arg_bool1.Value ? 1.0 : 0.0), new DataObjects.ObjectNumber(arg_bool2.Value ? 1.0 : 0.0)); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectBoolean arg_bool, DataObjects.ObjectError arg_err) - { - return arg_err; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectBoolean arg_bool, DataObjects.ObjectString arg_str) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectBoolean arg_bool, DataObjects.ObjectReference arg_range) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectBoolean arg_bool, DataObjects.ObjectEmpty arg_empty) - { - return Calc(new DataObjects.ObjectNumber(arg_bool.Value ? 1.0 : 0.0), new DataObjects.ObjectNumber(0.0)); - } - #endregion - - #region DataObjects.ObjectError - public DataObjects.IDataObject Calc(DataObjects.ObjectError arg_err, DataObjects.ObjectNumber arg_num) - { - return arg_err; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectError arg_err, DataObjects.ObjectBoolean arg_bool) - { - return arg_err; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectError arg_err1, DataObjects.ObjectError arg_err2) - { - return arg_err1; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectError arg_err, DataObjects.ObjectString arg_str) - { - return arg_err; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectError arg_err, DataObjects.ObjectReference arg_range) - { - return arg_err; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectError arg_err, DataObjects.ObjectEmpty arg_empty) - { - return arg_err; - } - #endregion - - #region DataObjects.ObjectString - public DataObjects.IDataObject Calc(DataObjects.ObjectString arg_str, DataObjects.ObjectNumber arg_num) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectString arg_str, DataObjects.ObjectBoolean arg_bool) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectString arg_str, DataObjects.ObjectError arg_err) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); ; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectString arg_str1, DataObjects.ObjectString arg_str2) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectString arg_str, DataObjects.ObjectReference arg_range) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectString arg_str, DataObjects.ObjectEmpty arg_empty) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - #endregion - - #region ObjectReference - public DataObjects.IDataObject Calc(DataObjects.ObjectReference arg_range, DataObjects.ObjectNumber arg_num) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectReference arg_range, DataObjects.ObjectBoolean arg_bool) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectReference arg_range, DataObjects.ObjectError arg_err) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectReference arg_range, DataObjects.ObjectString arg_str) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectReference arg_range1, DataObjects.ObjectReference arg_range2) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectReference arg_range1, DataObjects.ObjectEmpty arg_empty) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - #endregion - - #region DataObjects.ObjectEmpty - public DataObjects.IDataObject Calc(DataObjects.ObjectEmpty arg_empty, DataObjects.ObjectNumber arg_num) - { - return Calc(new DataObjects.ObjectNumber(0.0), arg_num); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectEmpty arg_empty, DataObjects.ObjectBoolean arg_bool) - { - return Calc(new DataObjects.ObjectNumber(0.0), new DataObjects.ObjectNumber(arg_bool.Value ? 1.0 : 0.0)); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectEmpty arg_empty, DataObjects.ObjectError arg_err) // Call inversed - { - return Calc(arg_err, arg_empty); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectEmpty arg_empty, DataObjects.ObjectString arg_str) // Call inversed - { - return Calc(arg_str, arg_empty); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectEmpty arg_empty, DataObjects.ObjectReference arg_range) // Call inversed - { - return Calc(arg_range, arg_empty); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectEmpty arg_empty1, DataObjects.ObjectEmpty arg_empty2) - { - return new DataObjects.ObjectError(ErrorValue.not_numeric); - } - - #endregion - - #endregion - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/BinOpCalc/RangeCalculator.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/BinOpCalc/RangeCalculator.cs deleted file mode 100644 index 896aaf27b3..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/BinOpCalc/RangeCalculator.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.BinOpCalc -{ - internal class RangeCalculator : ReferenceOperatorsCalculator - { - public override DataObjects.IDataObject Calc(DataObjects.ObjectReference arg_range1, DataObjects.ObjectReference arg_range2) - { - return arg_range1.Range(arg_range2); - } - - public override string OperatorName { get { return "range"; } } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/BinOpCalc/ReferenceOperatorsCalculator.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/BinOpCalc/ReferenceOperatorsCalculator.cs deleted file mode 100644 index f98d4d1211..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/BinOpCalc/ReferenceOperatorsCalculator.cs +++ /dev/null @@ -1,223 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.BinOpCalc -{ - internal abstract class ReferenceOperatorsCalculator : IFullBinaryOpDispatcher - { - #region IFullBinaryOpDispatcher Members - - #region DataObjects.ObjectNumber - public DataObjects.IDataObject Calc(DataObjects.ObjectNumber arg_num1, DataObjects.ObjectNumber arg_num2) - { - return ThrowWrongArgumentsType(); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectNumber arg_num, DataObjects.ObjectBoolean arg_bool) - { - return ThrowWrongArgumentsType(); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectNumber arg_num, DataObjects.ObjectError arg_err) - { - return ThrowWrongArgumentsType(); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectNumber arg_num, DataObjects.ObjectString arg_str) - { - return ThrowWrongArgumentsType(); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectNumber arg_num, DataObjects.ObjectReference arg_range) - { - return ThrowWrongArgumentsType(); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectNumber arg_num, DataObjects.ObjectEmpty arg_empty) - { - return ThrowWrongArgumentsType(); - } - #endregion - - #region DataObjects.ObjectBoolean - public DataObjects.IDataObject Calc(DataObjects.ObjectBoolean arg_bool, DataObjects.ObjectNumber arg_num) - { - return ThrowWrongArgumentsType(); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectBoolean arg_bool1, DataObjects.ObjectBoolean arg_bool2) - { - return ThrowWrongArgumentsType(); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectBoolean arg_bool, DataObjects.ObjectError arg_err) - { - return ThrowWrongArgumentsType(); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectBoolean arg_bool, DataObjects.ObjectString arg_str) - { - return ThrowWrongArgumentsType(); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectBoolean arg_bool, DataObjects.ObjectReference arg_range) - { - return ThrowWrongArgumentsType(); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectBoolean arg_bool, DataObjects.ObjectEmpty arg_empty) - { - return ThrowWrongArgumentsType(); - } - #endregion - - #region DataObjects.ObjectError - public DataObjects.IDataObject Calc(DataObjects.ObjectError arg_err, DataObjects.ObjectNumber arg_num) - { - return ThrowWrongArgumentsType(); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectError arg_err, DataObjects.ObjectBoolean arg_bool) - { - return ThrowWrongArgumentsType(); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectError arg_err1, DataObjects.ObjectError arg_err2) - { - if(arg_err1.Value == ErrorValue.bad_reference && arg_err2.Value == ErrorValue.bad_reference) - { - return arg_err1; - } - return ThrowWrongArgumentsType(); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectError arg_err, DataObjects.ObjectString arg_str) - { - return ThrowWrongArgumentsType(); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectError arg_err, DataObjects.ObjectReference arg_range) - { - if (arg_err.Value == ErrorValue.bad_reference) - { - return arg_err; - } - return ThrowWrongArgumentsType(); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectError arg_err, DataObjects.ObjectEmpty arg_empty) - { - return ThrowWrongArgumentsType(); - } - #endregion - - #region DataObjects.ObjectString - public DataObjects.IDataObject Calc(DataObjects.ObjectString arg_str, DataObjects.ObjectNumber arg_num) - { - return ThrowWrongArgumentsType(); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectString arg_str, DataObjects.ObjectBoolean arg_bool) - { - return ThrowWrongArgumentsType(); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectString arg_str, DataObjects.ObjectError arg_err) - { - return ThrowWrongArgumentsType(); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectString arg_str1, DataObjects.ObjectString arg_str2) - { - return ThrowWrongArgumentsType(); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectString arg_str, DataObjects.ObjectReference arg_range) - { - return ThrowWrongArgumentsType(); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectString arg_str, DataObjects.ObjectEmpty arg_empty) - { - return ThrowWrongArgumentsType(); - } - #endregion - - #region DataObjects.ObjectReference - public DataObjects.IDataObject Calc(DataObjects.ObjectReference arg_range, DataObjects.ObjectNumber arg_num) - { - return ThrowWrongArgumentsType(); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectReference arg_range, DataObjects.ObjectBoolean arg_bool) - { - return ThrowWrongArgumentsType(); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectReference arg_range, DataObjects.ObjectError arg_err) - { - if (arg_err.Value == ErrorValue.bad_reference) - { - return arg_err; - } - return ThrowWrongArgumentsType(); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectReference arg_range, DataObjects.ObjectString arg_str) - { - return ThrowWrongArgumentsType(); - } - - // The main dispatcher. Shall be overridden in successors - public abstract DataObjects.IDataObject Calc(DataObjects.ObjectReference arg_range1, DataObjects.ObjectReference arg_range2); - - public DataObjects.IDataObject Calc(DataObjects.ObjectReference arg_range1, DataObjects.ObjectEmpty arg_empty) - { - return ThrowWrongArgumentsType(); - } - #endregion - - #region DataObjects.ObjectEmpty - public DataObjects.IDataObject Calc(DataObjects.ObjectEmpty arg_empty, DataObjects.ObjectNumber arg_num) - { - return ThrowWrongArgumentsType(); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectEmpty arg_empty, DataObjects.ObjectBoolean arg_bool) - { - return ThrowWrongArgumentsType(); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectEmpty arg_empty, DataObjects.ObjectError arg_err) // Call inversed - { - return ThrowWrongArgumentsType(); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectEmpty arg_empty, DataObjects.ObjectString arg_str) // Call inversed - { - return ThrowWrongArgumentsType(); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectEmpty arg_empty, DataObjects.ObjectReference arg_range) // Call inversed - { - return ThrowWrongArgumentsType(); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectEmpty arg_empty1, DataObjects.ObjectEmpty arg_empty2) - { - return ThrowWrongArgumentsType(); - } - - #endregion - - #endregion - - private DataObjects.IDataObject ThrowWrongArgumentsType() - { - throw new Events.ReportableException(new Events.FormulaFormatError("Wrong argument types of " + OperatorName + " operator")); - } - - public abstract string OperatorName { get; } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/BinOpCalc/SubCalculator.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/BinOpCalc/SubCalculator.cs deleted file mode 100644 index b02bc45175..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/BinOpCalc/SubCalculator.cs +++ /dev/null @@ -1,206 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.BinOpCalc -{ - internal class SubCalculator : IFullBinaryOpDispatcher - { - #region IFullBinaryOpDispatcher Members - - #region DataObjects.ObjectNumber - public DataObjects.IDataObject Calc(DataObjects.ObjectNumber arg_num1, DataObjects.ObjectNumber arg_num2) - { - return new DataObjects.ObjectNumber(arg_num1.Value - arg_num2.Value); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectNumber arg_num, DataObjects.ObjectBoolean arg_bool) - { - return new DataObjects.ObjectNumber(arg_num.Value - (arg_bool.Value ? 1.0 : 0.0)); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectNumber arg_num, DataObjects.ObjectError arg_err) - { - return arg_err; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectNumber arg_num, DataObjects.ObjectString arg_str) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectNumber arg_num, DataObjects.ObjectReference arg_range) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectNumber arg_num, DataObjects.ObjectEmpty arg_empty) - { - return arg_num; - } - #endregion - - #region DataObjects.ObjectBoolean - public DataObjects.IDataObject Calc(DataObjects.ObjectBoolean arg_bool, DataObjects.ObjectNumber arg_num) - { - return new DataObjects.ObjectNumber((arg_bool.Value ? 1.0 : 0.0) - arg_num.Value); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectBoolean arg_bool1, DataObjects.ObjectBoolean arg_bool2) - { - return new DataObjects.ObjectNumber((arg_bool1.Value ? 1.0 : 0.0) - (arg_bool2.Value ? 1.0 : 0.0)); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectBoolean arg_bool, DataObjects.ObjectError arg_err) - { - return arg_err; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectBoolean arg_bool, DataObjects.ObjectString arg_str) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectBoolean arg_bool, DataObjects.ObjectReference arg_range) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectBoolean arg_bool, DataObjects.ObjectEmpty arg_empty) - { - return new DataObjects.ObjectNumber(arg_bool.Value ? 1.0 : 0.0); - } - #endregion - - #region DataObjects.ObjectError - public DataObjects.IDataObject Calc(DataObjects.ObjectError arg_err, DataObjects.ObjectNumber arg_num) - { - return arg_err; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectError arg_err, DataObjects.ObjectBoolean arg_bool) - { - return arg_err; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectError arg_err1, DataObjects.ObjectError arg_err2) - { - return arg_err1; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectError arg_err, DataObjects.ObjectString arg_str) - { - return arg_err; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectError arg_err, DataObjects.ObjectReference arg_range) - { - return arg_err; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectError arg_err, DataObjects.ObjectEmpty arg_empty) - { - return arg_err; - } - #endregion - - #region DataObjects.ObjectString - public DataObjects.IDataObject Calc(DataObjects.ObjectString arg_str, DataObjects.ObjectNumber arg_num) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectString arg_str, DataObjects.ObjectBoolean arg_bool) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectString arg_str, DataObjects.ObjectError arg_err) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); ; - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectString arg_str1, DataObjects.ObjectString arg_str2) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectString arg_str, DataObjects.ObjectReference arg_range) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectString arg_str, DataObjects.ObjectEmpty arg_empty) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - #endregion - - #region DataObjects.ObjectReference - public DataObjects.IDataObject Calc(DataObjects.ObjectReference arg_range, DataObjects.ObjectNumber arg_num) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectReference arg_range, DataObjects.ObjectBoolean arg_bool) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectReference arg_range, DataObjects.ObjectError arg_err) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectReference arg_range, DataObjects.ObjectString arg_str) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectReference arg_range1, DataObjects.ObjectReference arg_range2) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectReference arg_range1, DataObjects.ObjectEmpty arg_empty) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - #endregion - - #region DataObjects.ObjectEmpty - public DataObjects.IDataObject Calc(DataObjects.ObjectEmpty arg_empty, DataObjects.ObjectNumber arg_num) - { - return new DataObjects.ObjectNumber(-arg_num.Value); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectEmpty arg_empty, DataObjects.ObjectBoolean arg_bool) - { - return new DataObjects.ObjectNumber(-(arg_bool.Value ? 1.0 : 0.0)); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectEmpty arg_empty, DataObjects.ObjectError arg_err) // Call inversed - { - return Calc(arg_err, arg_empty); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectEmpty arg_empty, DataObjects.ObjectString arg_str) // Call inversed - { - return Calc(arg_str, arg_empty); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectEmpty arg_empty, DataObjects.ObjectReference arg_range) // Call inversed - { - return Calc(arg_range, arg_empty); - } - - public DataObjects.IDataObject Calc(DataObjects.ObjectEmpty arg_empty1, DataObjects.ObjectEmpty arg_empty2) - { - return new DataObjects.ObjectNumber(0.0); - } - - #endregion - - #endregion - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/BinOpCalc/UnionCalculator.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/BinOpCalc/UnionCalculator.cs deleted file mode 100644 index 3dc6d7d355..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/BinOpCalc/UnionCalculator.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.BinOpCalc -{ - internal class UnionCalculator : ReferenceOperatorsCalculator - { - public override DataObjects.IDataObject Calc(DataObjects.ObjectReference arg_range1, DataObjects.ObjectReference arg_range2) - { - return arg_range1.Union(arg_range2); - } - - public override string OperatorName { get { return "union"; } } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/CellParsedFormula.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/CellParsedFormula.cs deleted file mode 100644 index e7f2e2aa87..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/CellParsedFormula.cs +++ /dev/null @@ -1,51 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.RegularExpressions; -using ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas -{ - internal class CellParsedFormula : ParsedFormula - { - internal CellParsedFormula(Cells.Cell cell, Worksheet parent_sheet) - : base(parent_sheet.Workbook) - { - this.parent_sheet = parent_sheet; - this.cell = cell; - cell_observer = null; - } - - public override void UnregisterDependencies() - { - if (cell_observer != null) - { - cell_observer.BecomeSubject(); - cell_observer = null; - } - base.UnregisterDependencies(); - } - - public void RegisterDependencies() - { - // Create or update an Observer - cell_observer = parent_sheet.SubjectsStorage.GetCellItemOrCreate(cell); - cell_observer.BecomeObserver(this); - base.RegisterDependencies(cell_observer); - } - - public void MoveToAnotherCell(Cells.Cell another_cell) - { - UnregisterDependencies(); - cell = another_cell; - RegisterDependencies(); - } - - internal override Worksheet ParentSheet { get { return parent_sheet; } } - public Cells.Cell Cell { get { return cell; } } // For GetUpdatedCells() - - private Cells.Cell cell; - private Worksheet parent_sheet; - CellItem cell_observer; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/DataObjects/IDataObject.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/DataObjects/IDataObject.cs deleted file mode 100644 index ba2e05af89..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/DataObjects/IDataObject.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.DataObjects -{ - internal interface IDataObject : IComparable - { - IDataObject PerformBinaryOperation(IDataObject element, BinOpCalc.IFullBinaryOpDispatcher visitor); - IDataObject PerformBinaryOperation(ObjectNumber element, BinOpCalc.IFullBinaryOpDispatcher visitor); - IDataObject PerformBinaryOperation(ObjectBoolean element, BinOpCalc.IFullBinaryOpDispatcher visitor); - IDataObject PerformBinaryOperation(ObjectError element, BinOpCalc.IFullBinaryOpDispatcher visitor); - IDataObject PerformBinaryOperation(ObjectString element, BinOpCalc.IFullBinaryOpDispatcher visitor); - IDataObject PerformBinaryOperation(ObjectReference element, BinOpCalc.IFullBinaryOpDispatcher visitor); - IDataObject PerformBinaryOperation(ObjectEmpty element, BinOpCalc.IFullBinaryOpDispatcher visitor); - - IDataObject ConvertIfPossible(PreferredResultType result_type); - - object UserValue { get; } - string Type { get; } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/DataObjects/ObjectBoolean.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/DataObjects/ObjectBoolean.cs deleted file mode 100644 index 958d65ce23..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/DataObjects/ObjectBoolean.cs +++ /dev/null @@ -1,108 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.RegularExpressions; -using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.DataObjects -{ - internal class ObjectBoolean : IDataObject - { - public ObjectBoolean(bool value) - { - Value = value; - } - - public ObjectBoolean(string value) - { - Value = XMLBoolean.ParseOrDefault(value, false); - } - - - #region IDataObject Members - - public IDataObject PerformBinaryOperation(IDataObject element, BinOpCalc.IFullBinaryOpDispatcher dispatcher) - { - return element.PerformBinaryOperation(this, dispatcher); - } - - public IDataObject PerformBinaryOperation(ObjectNumber element, BinOpCalc.IFullBinaryOpDispatcher dispatcher) - { - return dispatcher.Calc(element, this); - } - - public IDataObject PerformBinaryOperation(ObjectBoolean element, BinOpCalc.IFullBinaryOpDispatcher dispatcher) - { - return dispatcher.Calc(element, this); - } - - public IDataObject PerformBinaryOperation(ObjectError element, BinOpCalc.IFullBinaryOpDispatcher dispatcher) - { - return dispatcher.Calc(element, this); - } - - public IDataObject PerformBinaryOperation(ObjectString element, BinOpCalc.IFullBinaryOpDispatcher dispatcher) - { - return dispatcher.Calc(element, this); - } - - public IDataObject PerformBinaryOperation(ObjectReference element, BinOpCalc.IFullBinaryOpDispatcher dispatcher) - { - return dispatcher.Calc(element, this); - } - - public IDataObject PerformBinaryOperation(ObjectEmpty element, BinOpCalc.IFullBinaryOpDispatcher dispatcher) - { - return dispatcher.Calc(element, this); - } - - #endregion - - #region ConvertIfPossible - - public IDataObject ConvertIfPossible(PreferredResultType result_type) - { - switch (result_type) - { - case PreferredResultType.numeric_type: - return new ObjectNumber(Value ? 1.0 : 0.0); - - case PreferredResultType.string_type: - return new ObjectString(ToString()); - - default: - return this; - } - } - - #endregion - - #region IComparable Members - - public int CompareTo(IDataObject other) - { - ObjectBoolean other_bool = other as ObjectBoolean; - if (other_bool != null) - { - return Value.CompareTo(other_bool.Value); - } - if (other is ObjectNumber || other is ObjectString) - { - return 1; - } - return -1; // Less than all other types - } - - #endregion - - public override string ToString() - { - return Value ? "TRUE" : "FALSE"; - } - - public bool Value { get; private set; } - public object UserValue { get { return Value; } } - public string Type { get { return "b"; } } - - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/DataObjects/ObjectEmpty.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/DataObjects/ObjectEmpty.cs deleted file mode 100644 index 7fe7e12c74..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/DataObjects/ObjectEmpty.cs +++ /dev/null @@ -1,98 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.RegularExpressions; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.DataObjects -{ - internal class ObjectEmpty : IDataObject - { - public ObjectEmpty() - { - } - - #region IDataObject Members - - public IDataObject PerformBinaryOperation(IDataObject element, BinOpCalc.IFullBinaryOpDispatcher dispatcher) - { - return element.PerformBinaryOperation(this, dispatcher); - } - - public IDataObject PerformBinaryOperation(ObjectNumber element, BinOpCalc.IFullBinaryOpDispatcher dispatcher) - { - return dispatcher.Calc(element, this); - } - - public IDataObject PerformBinaryOperation(ObjectBoolean element, BinOpCalc.IFullBinaryOpDispatcher dispatcher) - { - return dispatcher.Calc(element, this); - } - - public IDataObject PerformBinaryOperation(ObjectError element, BinOpCalc.IFullBinaryOpDispatcher dispatcher) - { - return dispatcher.Calc(element, this); - } - - public IDataObject PerformBinaryOperation(ObjectString element, BinOpCalc.IFullBinaryOpDispatcher dispatcher) - { - return dispatcher.Calc(element, this); - } - - public IDataObject PerformBinaryOperation(ObjectReference element, BinOpCalc.IFullBinaryOpDispatcher dispatcher) - { - return dispatcher.Calc(element, this); - } - - public IDataObject PerformBinaryOperation(ObjectEmpty element, BinOpCalc.IFullBinaryOpDispatcher dispatcher) - { - return dispatcher.Calc(element, this); - } - - #endregion - - #region ConvertIfPossible - - public IDataObject ConvertIfPossible(PreferredResultType result_type) - { - switch (result_type) - { - case PreferredResultType.boolean_type: - return new ObjectBoolean(false); - - case PreferredResultType.numeric_type: - return new ObjectNumber(0.0); - - case PreferredResultType.string_type: - return new ObjectString(""); - - case PreferredResultType.value_type: - case PreferredResultType.as_is: - return this; - } - return this; - } - - #endregion - - #region IComparable Members - - public int CompareTo(IDataObject other) - { - if (other is ObjectEmpty) - { - return 0; - } - return 1; - } - - #endregion - - public override string ToString() - { - return "empty cell"; - } - - public object UserValue { get{ return "";} } - public string Type { get { return null; } } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/DataObjects/ObjectError.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/DataObjects/ObjectError.cs deleted file mode 100644 index 9bb6417f03..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/DataObjects/ObjectError.cs +++ /dev/null @@ -1,91 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.RegularExpressions; -using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.DataObjects -{ - internal class ObjectError : IDataObject - { - public ObjectError(ErrorValue value) - { - Value = value; - } - - #region IDataObject Members - - public IDataObject PerformBinaryOperation(IDataObject element, BinOpCalc.IFullBinaryOpDispatcher dispatcher) - { - return element.PerformBinaryOperation(this, dispatcher); - } - - public IDataObject PerformBinaryOperation(ObjectNumber element, BinOpCalc.IFullBinaryOpDispatcher dispatcher) - { - return dispatcher.Calc(element, this); - } - - public IDataObject PerformBinaryOperation(ObjectBoolean element, BinOpCalc.IFullBinaryOpDispatcher dispatcher) - { - return dispatcher.Calc(element, this); - } - - public IDataObject PerformBinaryOperation(ObjectError element, BinOpCalc.IFullBinaryOpDispatcher dispatcher) - { - return dispatcher.Calc(element, this); - } - - public IDataObject PerformBinaryOperation(ObjectString element, BinOpCalc.IFullBinaryOpDispatcher dispatcher) - { - return dispatcher.Calc(element, this); - } - - public IDataObject PerformBinaryOperation(ObjectReference element, BinOpCalc.IFullBinaryOpDispatcher dispatcher) - { - return dispatcher.Calc(element, this); - } - - public IDataObject PerformBinaryOperation(ObjectEmpty element, BinOpCalc.IFullBinaryOpDispatcher dispatcher) - { - return dispatcher.Calc(element, this); - } - - #endregion - - #region ConvertIfPossible - - public IDataObject ConvertIfPossible(PreferredResultType result_type) - { - return this; - } - - #endregion - - #region IComparable Members - - public int CompareTo(IDataObject other) - { - ObjectError other_err = other as ObjectError; - if (other_err != null) - { - return Value.CompareTo(other_err.Value); - } - if(other is DataObjects.ObjectEmpty) - { - return -1; - } - return 1; // More than all other types - } - - #endregion - - public override string ToString() - { - return Value.ToString(); - } - - public ErrorValue Value { get; private set; } - public object UserValue { get { return Value; } } - public string Type { get { return Value != ErrorValue.unsupported_function ? "e" : "str"; } } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/DataObjects/ObjectNumber.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/DataObjects/ObjectNumber.cs deleted file mode 100644 index b8ef59df5d..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/DataObjects/ObjectNumber.cs +++ /dev/null @@ -1,101 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.RegularExpressions; -using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.DataObjects -{ - internal class ObjectNumber : IDataObject - { - public ObjectNumber(double value) - { - Value = value; - } - - public ObjectNumber(string value) - { - Value = XMLDouble.ParseOrDefault(value, 0); - } - - - #region IDataObject Members - - public IDataObject PerformBinaryOperation(IDataObject element, BinOpCalc.IFullBinaryOpDispatcher dispatcher) - { - return element.PerformBinaryOperation(this, dispatcher); - } - - public IDataObject PerformBinaryOperation(ObjectNumber element, BinOpCalc.IFullBinaryOpDispatcher dispatcher) - { - return dispatcher.Calc(element, this); - } - - public IDataObject PerformBinaryOperation(ObjectBoolean element, BinOpCalc.IFullBinaryOpDispatcher dispatcher) - { - return dispatcher.Calc(element, this); - } - - public IDataObject PerformBinaryOperation(ObjectError element, BinOpCalc.IFullBinaryOpDispatcher dispatcher) - { - return dispatcher.Calc(element, this); - } - - public IDataObject PerformBinaryOperation(ObjectString element, BinOpCalc.IFullBinaryOpDispatcher dispatcher) - { - return dispatcher.Calc(element, this); - } - - public IDataObject PerformBinaryOperation(ObjectReference element, BinOpCalc.IFullBinaryOpDispatcher dispatcher) - { - return dispatcher.Calc(element, this); - } - - public IDataObject PerformBinaryOperation(ObjectEmpty element, BinOpCalc.IFullBinaryOpDispatcher dispatcher) - { - return dispatcher.Calc(element, this); - } - - #endregion - #region ConvertIfPossible - - public IDataObject ConvertIfPossible(PreferredResultType result_type) - { - switch (result_type) - { - case PreferredResultType.boolean_type: - return new ObjectBoolean(Value != 0.0); - - case PreferredResultType.string_type: - return new ObjectString(Value.ToString()); - } - return this; - } - - #endregion - - #region IComparable Members - - public int CompareTo(IDataObject other) - { - ObjectNumber other_num = other as ObjectNumber; - if (other_num != null) - { - return Value.CompareTo(other_num.Value); - } - return -1; // Less than all other types - } - - #endregion - - public override string ToString() - { - return XMLDouble.ToString(Value); - } - - public double Value { get; private set; } - public object UserValue { get { return Value; } } - public string Type { get { return ""; } } - - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/DataObjects/ObjectReference.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/DataObjects/ObjectReference.cs deleted file mode 100644 index e63122bd8d..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/DataObjects/ObjectReference.cs +++ /dev/null @@ -1,370 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.RegularExpressions; -using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.DataObjects -{ - internal class ObjectReference : IDataObject, IEnumerable - { - public ObjectReference(Cells.CellRange value, Worksheet parent_sheet, IObserver observer) - : this(new Cells.CellRange3D(value, parent_sheet), observer) - { - } - - public ObjectReference(Cells.CellRange3D value, IObserver observer) - { - this.observer = observer; - ranges = new LinkedList(); - ranges.AddLast(value); - } - - private ObjectReference(LinkedList ranges, IObserver observer) - { - this.observer = observer; - this.ranges = ranges; - } - - - #region IDataObject Members - - public IDataObject PerformBinaryOperation(IDataObject element, BinOpCalc.IFullBinaryOpDispatcher dispatcher) - { - return element.PerformBinaryOperation(this, dispatcher); - } - - public IDataObject PerformBinaryOperation(ObjectNumber element, BinOpCalc.IFullBinaryOpDispatcher dispatcher) - { - return dispatcher.Calc(element, this); - } - - public IDataObject PerformBinaryOperation(ObjectBoolean element, BinOpCalc.IFullBinaryOpDispatcher dispatcher) - { - return dispatcher.Calc(element, this); - } - - public IDataObject PerformBinaryOperation(ObjectError element, BinOpCalc.IFullBinaryOpDispatcher dispatcher) - { - return dispatcher.Calc(element, this); - } - - public IDataObject PerformBinaryOperation(ObjectString element, BinOpCalc.IFullBinaryOpDispatcher dispatcher) - { - return dispatcher.Calc(element, this); - } - - public IDataObject PerformBinaryOperation(ObjectReference element, BinOpCalc.IFullBinaryOpDispatcher dispatcher) - { - return dispatcher.Calc(element, this); - } - - public IDataObject PerformBinaryOperation(ObjectEmpty element, BinOpCalc.IFullBinaryOpDispatcher dispatcher) - { - return dispatcher.Calc(element, this); - } - - #endregion - - #region ConvertIfPossible - - public IDataObject ConvertIfPossible(PreferredResultType result_type) - { - if (result_type != PreferredResultType.reference_type && result_type != PreferredResultType.as_is) - { - if (IsSingleCell) - { - DataObjects.IDataObject result; - CellItem cell_subject; - Cells.Cell single_cell = ranges.First.Value.CellRange.TopLeft; - Worksheet parent_sheet = ranges.First.Value.WorksheetFrom; - if (parent_sheet.SubjectsStorage.CellSubjects.TryGetValue(single_cell, out cell_subject)) - { - result = cell_subject.GetValue(); - } - else - { - result = parent_sheet.CellGetValue(single_cell); - } - return result.ConvertIfPossible(result_type); - } - else - { - return new ObjectError(ErrorValue.wrong_value_type); - } - } - else - { - return this; - } - } - - #endregion - - #region IComparable Members - - public int CompareTo(IDataObject other) // Shouldn't be called ever - { - if (other is ObjectReference) - { - return 0; - } - return -1; - } - - #endregion - - #region IEnumerable Members - - public IEnumerator GetEnumerator() - { - return new Enumerator(this); - } - - #endregion - - #region IEnumerable Members - - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() - { - return new Enumerator(this); - } - - #endregion - - internal class Enumerator : IEnumerator - { - public Enumerator(ObjectReference reference) - { - this.reference = reference; - - existent_cells = new List(); - foreach (Cells.CellRange3D range in reference.ranges) - { - Workbook wb = range.WorksheetFrom.Workbook; - foreach (Worksheet ws in wb.WorksheetsN(range.WorksheetFrom.Index, range.WorksheetTo.Index)) - { - Walkers.ExistentCellsCollector collector = new Walkers.ExistentCellsCollector(ws); - new Walkers.RangeWalker(range.CellRange, ws).CollectStatistics(collector); - existent_cells.AddRange(collector.GetFoundCells()); - } - } - - cells_enum = existent_cells.GetEnumerator(); - } - - #region IEnumerator Members - - public IDataObject Current - { - get { return cells_enum.Current.WorksheetFrom.SubjectsStorage.GetCellItemOrCreate(cells_enum.Current.CellRange.TopLeft).GetValue(); } - } - - #endregion - - #region IDisposable Members - - public void Dispose() - { - } - - #endregion - - #region IEnumerator Members - - object System.Collections.IEnumerator.Current - { - get { return cells_enum.Current.WorksheetFrom.SubjectsStorage.GetCellItemOrCreate(cells_enum.Current.CellRange.TopLeft).GetValue(); } - } - - public bool MoveNext() - { - return cells_enum.MoveNext(); - } - - public void Reset() - { - throw new NotSupportedException(); - } - - #endregion - - private ObjectReference reference; - private List.Enumerator cells_enum; - private List existent_cells; - } - - public IDataObject Union(ObjectReference other_reference) - { - CheckPlanarAndCollinear(this, other_reference); - LinkedList ranges_result = ranges; - foreach (Cells.CellRange3D range in other_reference.ranges) - { - ranges_result.AddLast(range); - } - return new ObjectReference(ranges_result, observer); - } - - public IDataObject Intersect(ObjectReference other_reference) - { - CheckPlanarAndCollinear(this, other_reference); - LinkedList ranges_result = new LinkedList(); - foreach (Cells.CellRange3D range in ranges) - { - foreach (Cells.CellRange3D other_range in other_reference.ranges) - { - Cells.CellRange3D intersected_range = range.Intersect(other_range); - if (intersected_range != Cells.CellRange3D.Empty) - { - ranges_result.AddLast(intersected_range); - } - } - } - ObjectReference intersected_object = new ObjectReference(ranges_result, observer); - //Unregister(); - //other_reference.Unregister(); - //intersected_object.Register(); - return intersected_object; - } - - public IDataObject Range(ObjectReference other_reference) - { - CheckPlanarAndCollinear(this, other_reference); - Cells.CellRange3D bounding_box = Cells.CellRange3D.Empty; - foreach (Cells.CellRange3D range in ranges) - { - if (bounding_box == Cells.CellRange3D.Empty) - { - bounding_box = range; - } - else - { - bounding_box = bounding_box.BoundingBox(range); - } - } - foreach (Cells.CellRange3D range in other_reference.ranges) - { - if (bounding_box == Cells.CellRange3D.Empty) - { - bounding_box = range; - } - else - { - bounding_box = bounding_box.BoundingBox(range); - } - } - - ObjectReference bounded_object = new ObjectReference(bounding_box, observer); - //Unregister(); - //other_reference.Unregister(); -// bounded_object.Register(); - return bounded_object; - } - - - private static void CheckPlanarAndCollinear(ObjectReference ref1, ObjectReference ref2) - { - if (ref1.ranges.Count == 0 || ref2.ranges.Count == 0) - { - throw new Events.ReportableException(new Events.FormulaFormatError("Wrong argument types of a reference operator")); - } - Worksheet the_same_ws = ref1.ranges.First.Value.WorksheetFrom; - foreach (Cells.CellRange3D range in ref1.ranges) - { - if (range.WorksheetFrom != the_same_ws || range.WorksheetTo != the_same_ws) - { - throw new Events.ReportableException(new Events.FormulaFormatError("Wrong argument types of a reference operator")); - } - } - - foreach (Cells.CellRange3D range in ref2.ranges) - { - if (range.WorksheetFrom != the_same_ws || range.WorksheetTo != the_same_ws) - { - throw new Events.ReportableException(new Events.FormulaFormatError("Wrong argument types of a reference operator")); - } - } - } - - internal IObserver Unregister() - { - if(observer != null) - { - foreach (Cells.CellRange3D range in ranges) - { - Cells.CellRange cell_range = range.CellRange; - if (cell_range.IsSingleCell) - { - Calculation.CellItem cell_item = range.WorksheetFrom.SubjectsStorage.GetCellItem(cell_range.TopLeft); - if (cell_item != null) - { - range.WorksheetFrom.Workbook.ValuesUpdateManager.Unregister(cell_item, observer); - } - } - else - { - Calculation.RangeSubject range_item = range.WorksheetFrom.SubjectsStorage.GetRangeSubject(cell_range); - if (range_item != null) - { - range.WorksheetFrom.Workbook.ValuesUpdateManager.Unregister(range_item, observer); - } - } - } - return observer; - } - return null; - } - - internal void Register() - { - if (observer != null) - { - foreach (Cells.CellRange3D range in ranges) - { - Cells.CellRange cell_range = range.CellRange; - if (cell_range.IsSingleCell) - { - Calculation.CellItem cell_item = range.WorksheetFrom.SubjectsStorage.GetCellItemOrCreate(cell_range.TopLeft); - if (cell_item != null) - { - range.WorksheetFrom.Workbook.ValuesUpdateManager.Register(cell_item, observer); - } - } - else - { - Calculation.RangeSubject range_item = range.WorksheetFrom.SubjectsStorage.GetRangeSubjectOrCreate(cell_range); - if (range_item != null) - { - range.WorksheetFrom.Workbook.ValuesUpdateManager.Register(range_item, observer); - } - } - } - } - } - - - public override string ToString() - { - string result = ""; - foreach (Cells.CellRange3D range in ranges) - { - if (result.Length == 0) - { - result = range.ToString(); - } - else - { - result += "," + range.ToString(); - } - } - return result; - } - - private LinkedList ranges; - private IObserver observer; // Used in reference operators to register/unregister new/former subject - public bool IsSingleCell { get { return ranges.Count == 1 && ranges.First.Value.IsSingleCell; } } - - public object UserValue { get { return null; } } - public string Type { get { return null; } } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/DataObjects/ObjectString.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/DataObjects/ObjectString.cs deleted file mode 100644 index d645d39efd..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/DataObjects/ObjectString.cs +++ /dev/null @@ -1,110 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.RegularExpressions; -using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.DataObjects -{ - internal class ObjectString : IDataObject - { - public ObjectString(string value) - { - Value = value; - } - - #region IDataObject Members - - public IDataObject PerformBinaryOperation(IDataObject element, BinOpCalc.IFullBinaryOpDispatcher dispatcher) - { - return element.PerformBinaryOperation(this, dispatcher); - } - - public IDataObject PerformBinaryOperation(ObjectNumber element, BinOpCalc.IFullBinaryOpDispatcher dispatcher) - { - return dispatcher.Calc(element, this); - } - - public IDataObject PerformBinaryOperation(ObjectBoolean element, BinOpCalc.IFullBinaryOpDispatcher dispatcher) - { - return dispatcher.Calc(element, this); - } - - public IDataObject PerformBinaryOperation(ObjectError element, BinOpCalc.IFullBinaryOpDispatcher dispatcher) - { - return dispatcher.Calc(element, this); - } - - public IDataObject PerformBinaryOperation(ObjectString element, BinOpCalc.IFullBinaryOpDispatcher dispatcher) - { - return dispatcher.Calc(element, this); - } - - public IDataObject PerformBinaryOperation(ObjectReference element, BinOpCalc.IFullBinaryOpDispatcher dispatcher) - { - return dispatcher.Calc(element, this); - } - - public IDataObject PerformBinaryOperation(ObjectEmpty element, BinOpCalc.IFullBinaryOpDispatcher dispatcher) - { - return dispatcher.Calc(element, this); - } - - #endregion - - #region ConvertIfPossible - - public IDataObject ConvertIfPossible(PreferredResultType result_type) - { - string extracted_str_value; - int start_pos = 0; - if (result_type == PreferredResultType.boolean_type && Ptgs.PtgBool.Extract(Value, ref start_pos, out extracted_str_value)) - { - if(start_pos == Value.Length) - { - return new ObjectBoolean(extracted_str_value); - } - } - else if (result_type == PreferredResultType.numeric_type && Ptgs.PtgNum.Extract(Value, ref start_pos, out extracted_str_value)) - { - if (start_pos == Value.Length) - { - return new ObjectNumber(extracted_str_value); - } - } - return this; - } - - #endregion - - #region IComparable Members - - public int CompareTo(IDataObject other) - { - ObjectString other_str = other as ObjectString; - if (other_str != null) - { - return Value.CompareTo(other_str.Value); - } - if (other is ObjectNumber) - { - return 1; - } - return -1; // Less than all other types - } - - #endregion - - public override string ToString() - { - return Value; - } - - public string Value { get; private set; } - public object UserValue { get { return Value; } } - public string Type { get { return "str"; } } - - } - - -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/ErrorValue.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/ErrorValue.cs deleted file mode 100644 index df465d86ba..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/ErrorValue.cs +++ /dev/null @@ -1,155 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas -{ - /// - /// Represents an error value of calculations - /// - public class ErrorValue : IComparable - { - private ErrorValue(Values value) - { - this.value = value; - } - - /// - /// "#DIV/0!" Indicates when any number (including zero) or any error code is divided by zero. - /// - public static readonly ErrorValue division_by_zero = new ErrorValue(Values.division_by_zero); - /// - /// "#N/A" Indicates when a designated value is not available. - /// - public static readonly ErrorValue not_available = new ErrorValue(Values.not_available); - /// - /// "#NAME?" Indicates when what looks like a name is used, but no such name has been defined. - /// - public static readonly ErrorValue wrong_name = new ErrorValue(Values.wrong_name); - /// - /// "#NULL!" Indicates when two areas are required to intersect, but do not. - /// - public static readonly ErrorValue null_value = new ErrorValue(Values.null_value); - /// - /// "#NUM!" Indicates when an argument to a function has a compatible type, but has a value that is outside the domain over which that function is defined. - /// - public static readonly ErrorValue not_numeric = new ErrorValue(Values.not_numeric); - /// - /// "#REF!" Indicates when a cell reference cannot be evaluated - /// - public static readonly ErrorValue bad_reference = new ErrorValue(Values.bad_reference); - /// - /// "#VALUE!" Indicates when an incompatible type argument is passed to a function, or an incompatible type operand is used with an operator. - /// - public static readonly ErrorValue wrong_value_type = new ErrorValue(Values.wrong_value_type); - /// - /// "#UNSUPPORTED_FUNCTION!" Indicates when an unsupported function is used in a formula. - /// - internal static readonly ErrorValue unsupported_function = new ErrorValue(Values.unsupported_function); - - /// - /// Error value string representation - /// - /// string equivalent of the value - public override string ToString() - { - switch (value) - { - case Values.division_by_zero: return "#DIV/0!"; - case Values.not_available: return "#N/A"; - case Values.wrong_name: return "#NAME?"; - case Values.null_value: return "#NULL!"; - case Values.not_numeric: return "#NUM!"; - case Values.bad_reference: return "#REF!"; - case Values.wrong_value_type: return "#VALUE!"; - case Values.unsupported_function: return "#UNSUPPORTED_FUNCTION!"; - } - return base.ToString(); - } - - /// - /// Converts the string representation of an error value to its ErrorValue equivalent. - /// - /// A string containing an error value to convert. - /// An ErrorValue equivalent to the error value contained in str_value or null if str_value is in wrong format - public static ErrorValue Parse(string str_value) - { - switch (str_value.ToUpper()) - { - case "#DIV/0!": return division_by_zero; - case "#N/A": return not_available; - case "#NAME?": return wrong_name; - case "#NULL!": return null_value; - case "#NUM!": return not_numeric; - case "#REF!": return bad_reference; - case "#VALUE!": return wrong_value_type; - default: return not_available; - } - } - - /// - /// Converts the string representation of an error value to its ErrorValue equivalent. - /// - /// A string containing an error value to convert - /// Default value - /// An ErrorValue equivalent to the error value contained in str_value or the passed default value if str_value is in wrong format - public static ErrorValue ParseOrDefault(string str_value, ErrorValue def_val) - { - return Parse(str_value) ?? def_val; - } - - #region IComparable Members - - /// - /// Compares the current object with another object of the same type. - /// - /// - /// - public int CompareTo(ErrorValue other) - { - return value.CompareTo(other.value); - } - - #endregion - - internal int Code - { - get - { - switch(value) - { - case Values.null_value: - return 1; - case Values.division_by_zero: - return 2; - case Values.wrong_value_type: - return 3; - case Values.bad_reference: - return 4; - case Values.wrong_name: - return 5; - case Values.not_numeric: - return 6; - case Values.not_available: - return 7; - } - return 0; - } - } - - private enum Values - { - division_by_zero, - not_available, - wrong_name, - null_value, - not_numeric, - bad_reference, - wrong_value_type, - unsupported_function - } - - private Values value; - - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/FormulaFormatException.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/FormulaFormatException.cs deleted file mode 100644 index f675a05922..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/FormulaFormatException.cs +++ /dev/null @@ -1,50 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas -{ - /// - /// Formula format exception - /// - public abstract class FormulaFormatException : System.ArgumentException - { - internal FormulaFormatException(string message, string formula, int start_pos) - : base(message + " in formula \"" + formula + "\" at position " + start_pos) - { - } - } - - /// - /// Thrown when an unknown operator found or operator/operand sequence is broken - /// - public class UnknownOperatorException : FormulaFormatException - { - internal UnknownOperatorException(string formula, int start_pos) - : base("Unknown operator format", formula, start_pos) - { - } - } - - /// - /// Thrown when an unknown operand found or operator/operand sequence is broken - /// - public class UnknownOperandException : FormulaFormatException - { - internal UnknownOperandException(string formula, int start_pos) - : base("Unknown operand format", formula, start_pos) - { - } - } - - /// - /// Thrown when parenthesis sequence is wrong - /// - public class WrongParenthesisSequence : FormulaFormatException - { - internal WrongParenthesisSequence(string formula, int start_pos) - : base("Wrong parenthesis sequence", formula, start_pos) - { - } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/NameParsedFormula.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/NameParsedFormula.cs deleted file mode 100644 index 41e2a9accf..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/NameParsedFormula.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.RegularExpressions; -using ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas -{ - internal class NameParsedFormula : ParsedFormula - { - internal NameParsedFormula(string name, Workbook workbook) - : base(workbook) - { -// this.workbook = workbook; -// this.name = name; -// name_observer = null; - } - -/* - public override void UnregisterDependencies() - { - if (name_observer != null) - { - name_observer.BecomeSubject(); - name_observer = null; - } - base.UnregisterDependencies(); - } -*/ - - internal override Worksheet ParentSheet { get { return null; } } - -// private Workbook workbook; -// private string name; -// private NameItem name_observer; - - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/ParsedFormula.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/ParsedFormula.cs deleted file mode 100644 index ab8d2f4447..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/ParsedFormula.cs +++ /dev/null @@ -1,655 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.RegularExpressions; -using ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas -{ - internal abstract class ParsedFormula - { - internal ParsedFormula(Workbook workbook) - { - this.workbook = workbook; - ptgs_list = new LinkedList(); - RecalcInProgress = false; - formula_last_set = null; - } - - public bool Parse(string formula, Cells.Offset offset) - { - m_oLastError = null; - - formula_last_set = formula; - bool operand_expected = true; // This would help distinguish unary and binary and determine if an argument to a function is missed. - Stack ptg_stack = new Stack(); - Worksheet ws_from; - Worksheet ws_to; - - for (int start_pos = 0, strlen = formula.Length; start_pos != strlen; ) - { - #region Operators - if (is_operators(formula, start_pos) || PtgIsect.IsNextPtg(formula, start_pos)) - { - OperatorPtg found_operator = null; - if (PtgAdd.Extract(formula, ref start_pos, operand_expected)) - { - found_operator = new PtgAdd(); - operand_expected = true; - } - else if (PtgUplus.Extract(formula, ref start_pos, operand_expected)) - { - found_operator = new PtgUplus(); - operand_expected = true; - } - else if (PtgSub.Extract(formula, ref start_pos, operand_expected)) - { - found_operator = new PtgSub(); - operand_expected = true; - } - else if (PtgUminus.Extract(formula, ref start_pos, operand_expected)) - { - found_operator = new PtgUminus(); - operand_expected = true; - } - else if (PtgPercent.Extract(formula, ref start_pos, operand_expected)) - { - found_operator = new PtgPercent(); - operand_expected = false; - } - else - { - if (operand_expected) - { - m_oLastError = new Events.OperandExpectedError(formula, start_pos); - workbook.ReportError(m_oLastError); - ptgs_list.Clear(); - return false; - } - if (PtgMul.Extract(formula, ref start_pos)) - { - found_operator = new PtgMul(); - operand_expected = true; - } - else if (PtgDiv.Extract(formula, ref start_pos)) - { - found_operator = new PtgDiv(); - operand_expected = true; - } - else if (PtgPower.Extract(formula, ref start_pos)) - { - found_operator = new PtgPower(); - operand_expected = true; - } - else if (PtgEq.Extract(formula, ref start_pos)) // Sequence is important - { - found_operator = new PtgEq(); - operand_expected = true; - } - else if (PtgNe.Extract(formula, ref start_pos)) // Sequence is important - { - found_operator = new PtgNe(); - operand_expected = true; - } - else if (PtgLe.Extract(formula, ref start_pos)) // Sequence is important - { - found_operator = new PtgLe(); - operand_expected = true; - } - else if (PtgLt.Extract(formula, ref start_pos)) // Sequence is important - { - found_operator = new PtgLt(); - operand_expected = true; - } - else if (PtgGe.Extract(formula, ref start_pos)) // Sequence is important - { - found_operator = new PtgGe(); - operand_expected = true; - } - else if (PtgGt.Extract(formula, ref start_pos)) // Sequence is important - { - found_operator = new PtgGt(); - operand_expected = true; - } - else if (PtgConcat.Extract(formula, ref start_pos)) - { - found_operator = new PtgConcat(); - operand_expected = true; - } -/* - else if (PtgUnion.Extract(formula, ref start_pos)) - { - found_operator = new PtgConcat(); - operand_expected = true; - } -*/ - else if (PtgRange.Extract(formula, ref start_pos)) - { - found_operator = new PtgRange(); - operand_expected = true; - } - else if (PtgIsect.Extract(formula, ref start_pos)) // Must be the last of operators - { - found_operator = new PtgIsect(); - operand_expected = true; - } - else - { - m_oLastError = new Events.UnknownOperatorError(formula, start_pos); - start_pos += 1; - operand_expected = true; - } - } - - OperatorPtg operator_top; - while (ptg_stack.Count != 0 && (operator_top = (ptg_stack.Peek() as OperatorPtg)) != null && - (found_operator.isRightAssociative() ? (operator_top.Priority < found_operator.Priority) : - (operator_top.Priority <= found_operator.Priority))) - { - ptgs_list.AddFirst(ptg_stack.Pop()); - } - ptg_stack.Push(found_operator); - } - #endregion - #region Parenthesis - else if (PtgParen.Extract_Left(formula, ref start_pos)) - { - PtgFunc func = ptg_stack.Count != 0 ? ptg_stack.Peek() as PtgFunc : null; - operand_expected = true; - ptg_stack.Push(new PtgParen()); - } - else if (PtgParen.Extract_Right(formula, ref start_pos)) - { - PtgParen left_p = null; - if (ptg_stack.Count != 0 && ((left_p = ptg_stack.Peek() as PtgParen) != null) && operand_expected) - { - if (left_p.ParametersNum > 1) // This means there is at least one comma inside the parenthesis - { - ptgs_list.AddFirst(new PtgMissedArg()); - } - else - { - left_p.DecrementParametersNum(); - } - } - else - { - while (ptg_stack.Count != 0 && (left_p = ptg_stack.Peek() as PtgParen) == null) - { - ptgs_list.AddFirst(ptg_stack.Pop()); - } - } - if (ptg_stack.Count == 0 || left_p == null) - { - m_oLastError = new Events.WrongParenthesisSequenceError(formula, start_pos); - workbook.ReportError(m_oLastError); - ptgs_list.Clear(); - return false; - } - ptg_stack.Pop(); // pop PtgParen that is now stored in left_p - Ptg last_ptg = left_p; - PtgFunc func; - if (ptg_stack.Count != 0 && (func = ptg_stack.Peek() as PtgFunc) != null) - { - last_ptg = ptg_stack.Pop(); // pop PtgFunc - int num_parameters = left_p.ParametersNum; - if (num_parameters > 255) - { - m_oLastError = new Events.FormulaFormatError("Too many parameters to a function", formula, start_pos); - workbook.ReportError(m_oLastError); - ptgs_list.Clear(); - return false; - } - if (!func.SetParametersNum(num_parameters)) - { - m_oLastError = new Events.FormulaFormatError("Wrong parameters number (" + func.ParametersNum + " expected)", formula, start_pos); - workbook.ReportError(m_oLastError); - ptgs_list.Clear(); - return false; - } - } - else // If there is no function name before the left parenthesis - { - for (int i = 0; i < left_p.ParametersNum - 1; ++i) - { - ptgs_list.AddFirst(new PtgUnion()); - } - } - ptgs_list.AddFirst(last_ptg); - operand_expected = false; - } - #endregion - #region Comma and PtgUnion - else if (extract_comma(formula, ref start_pos)) - { - PtgParen left_p = ptg_stack.Count != 0 ? ptg_stack.Peek() as PtgParen : null; - if(left_p != null && operand_expected) - { - ptgs_list.AddFirst(new PtgMissedArg()); - } - else - { - while(ptg_stack.Count != 0 && (left_p = ptg_stack.Peek() as PtgParen) == null) - { - ptgs_list.AddFirst(ptg_stack.Pop()); - } - } - if (ptg_stack.Count == 0 || left_p == null) - { - m_oLastError = new Events.WrongParenthesisSequenceError(formula, start_pos); - if (formula.Length - 1 < start_pos) - { - workbook.ReportError(m_oLastError); - ptgs_list.Clear(); - return false; - } - else - { - operand_expected = true; - continue; - } - } - left_p.IncrementParametersNum(); // The count of parameters will be transferred to PtgFuncVar - operand_expected = true; - } - #endregion - #region Operands - else - { - if (!operand_expected) - { - m_oLastError = new Events.OperatorExpectedError(formula, start_pos); - workbook.ReportError(m_oLastError); - ptgs_list.Clear(); - return false; - } - OperandPtg found_operand; - string operand_str; - if (PtgBool.Extract(formula, ref start_pos, out operand_str)) - { - found_operand = new PtgBool(operand_str); - } - else if (PtgStr.Extract(formula, ref start_pos, out operand_str)) - { - found_operand = new PtgStr(operand_str); - } - else if (PtgErr.Extract(formula, ref start_pos, out operand_str)) - { - found_operand = new PtgErr(operand_str); - } - else if (extract_3D_part(formula, ref start_pos, out ws_from, out ws_to, workbook)) // Shall be placed strongly before extract_PtgName - { - if (PtgArea.Extract(formula, ref start_pos, out operand_str)) // Sequence is important (in pair with PtgRef3D) - { - found_operand = PtgArea3D.Create(operand_str, offset, ws_from, ws_to); - } - else if (PtgRef.Extract(formula, ref start_pos, out operand_str)) // Sequence is important (in pair with PtgArea3D) - { - found_operand = PtgRef3D.Create(operand_str, offset, ws_from, ws_to); - } - else if (PtgRefErr3D.Extract(formula, ref start_pos, out operand_str)) // Sequence is important (in pair with PtgArea3D) - { - found_operand = new PtgRefErr3D(operand_str, ws_from, ws_to); - } - else - { - m_oLastError = new Events.UnknownOperandError(formula, start_pos); - workbook.ReportError(m_oLastError); - ptgs_list.Clear(); - return false; - } - } - else if (PtgName.Extract(formula, ref start_pos, out operand_str, workbook)) // Shall be placed strongly before PtgArea and PtgRef - { - found_operand = new PtgName(operand_str, workbook); - } - else if (PtgArea.Extract(formula, ref start_pos, out operand_str)) // Sequence is important (in pair with PtgRef) - { - found_operand = PtgArea.Create(operand_str, offset, ParentSheet); - } - else if (PtgRef.Extract(formula, ref start_pos, out operand_str)) // Sequence is important (in pair with PtgArea) - { - found_operand = PtgRef.Create(operand_str, offset, ParentSheet); - } - else if (PtgNum.Extract(formula, ref start_pos, out operand_str)) // Shall be placed after PtgArea but before UndefinedName - { - found_operand = new PtgNum(operand_str); - } - else if (PtgFunc.Extract(formula, ref start_pos, out operand_str)) - { - PtgFunc func = workbook.Editor.FunctionsStorage.CreateInstance(operand_str.ToUpper()); - if (func == null) - { - // TODO: process user-defined functions here - m_oLastError = new Events.UnknownFunctionError(operand_str, formula, start_pos - operand_str.Length); - operand_expected = false; - continue; - } - ptg_stack.Push(func); - operand_expected = false; - continue; // skip appending to the result queue - } - else - { - m_oLastError = new Events.UnknownOperandError(formula, start_pos); - workbook.ReportError(m_oLastError); - ptgs_list.Clear(); - return false; - } - - ptgs_list.AddFirst(found_operand); - operand_expected = false; - } - #endregion - } - if (operand_expected) - { - m_oLastError = new Events.OperandExpectedError(formula, formula.Length); - workbook.ReportError(m_oLastError); - ptgs_list.Clear(); - return false; - } - - while (ptg_stack.Count != 0) - { - OperatorPtg operator_ptg = ptg_stack.Peek() as OperatorPtg; - if (operator_ptg != null) - { - ptgs_list.AddFirst(ptg_stack.Pop()); - } - else - { - m_oLastError = new Events.WrongParenthesisSequenceError(formula, formula.Length); - workbook.ReportError(m_oLastError); - ptgs_list.Clear(); - return false; - } - } - - if (null != m_oLastError) - { - workbook.ReportError(m_oLastError); - ptgs_list.Clear(); - m_oLastError = new Events.UnknownOperandError("", 0); - return false; - } - return true; - } - - #region Ungrouped regex verifiers - private bool is_operators(string formula, int start_pos) - { - Match match = rx_operators.Match(formula, start_pos); - return match.Success; - } - - private bool extract_comma(string formula, ref int start_pos) - { - Match match = rx_num.Match(formula, start_pos); - if (match.Success) - { - start_pos += match.Length; - return true; - } - return false; - } - - internal static bool extract_3D_part(string formula, ref int start_pos, out Worksheet ws_from, out Worksheet ws_to, Workbook wb) - { - Match match; - if ((match = rx_non_quoted_ref.Match(formula, start_pos)).Success || (match = rx_quoted_ref.Match(formula, start_pos)).Success) - { - GroupCollection groups = match.Groups; - string name_from = groups["name_from"].Value.Replace("''", "'"); - string name_to = groups["name_to"].Value.Replace("''", "'"); - ws_from = wb.Sheets[name_from] as Worksheet; - if (ws_from == null) - { - ws_to = null; - return false; - } - if (name_to.Length == 0) - { - ws_to = ws_from; - } - else - { - ws_to = wb.Sheets[name_to] as Worksheet; - if (ws_to == null) - { - return false; - } - } - start_pos += match.Length; - return true; - } - ws_from = ws_to = null; - return false; - } - #endregion - - /// - /// - /// - /// - /// - /// Whether at least one reference changed - public bool RemoveReferencesTo(Cells.CellRange removed_range, Worksheet removed_range_sheet) - { - bool at_least_one_changed = false; - for (LinkedListNode current = ptgs_list.First; current != null; current = current.Next) - { - IRefOperandPtg ref_ptg = current.Value as IRefOperandPtg; - if (ref_ptg != null) - { - OperandPtg replacement_operand = ref_ptg.RemoveRange(removed_range, removed_range_sheet); - if (replacement_operand != null) - { - current.Value = replacement_operand; - at_least_one_changed = true; - } - } - } - return at_least_one_changed; - } - - /// - /// - /// - /// - /// Returns is it possible to recalculate at the moment (TRUE) or the recalculation shall be put off (FALSE) - public bool RemoveReferencesTo(Worksheet removed_sheet) - { - bool shall_be_delayed = false; - for (LinkedListNode current = ptgs_list.First; current != null; current = current.Next) - { - OperandPtgRef3D _3d_ptg = current.Value as OperandPtgRef3D; - if (_3d_ptg != null) - { - OperandPtg replacement_operand = _3d_ptg.RemoveWorksheet(removed_sheet); - if (replacement_operand != null) - { - current.Value = replacement_operand; - } - else - { - shall_be_delayed = true; - } - } - } - return !shall_be_delayed; - } - - /// - /// - /// - /// - /// - /// - /// Whether at least one reference changed - public bool ResizeInsertionAffected(Cells.CellRange moved_range, Cells.Offset offset, Worksheet affected_sheet) - { - bool at_least_one_changed = false; - for (LinkedListNode current = ptgs_list.First; current != null; current = current.Next) - { - IRefOperandPtg ref_ptg = current.Value as IRefOperandPtg; - if (ref_ptg != null) - { - OperandPtg replacement_operand = ref_ptg.ResizeInsertionAffected(moved_range, offset, affected_sheet); - if (replacement_operand != null) - { - current.Value = replacement_operand; - at_least_one_changed = true; - } - } - } - return at_least_one_changed; - } - - /// - /// - /// - /// - /// - /// - /// Whether at least one reference removed - public bool ShiftReferencesTo(ISubject subject, Cells.Offset offset, Worksheet affected_sheet) - { - bool at_least_one_shifted = false; - for (LinkedListNode current = ptgs_list.First; current != null; current = current.Next) - { - IRefOperandPtg ref_ptg = current.Value as IRefOperandPtg; - if (ref_ptg != null && ref_ptg.ReferencesCellOrRange(subject)) - { - OperandPtg replacement_operand = ref_ptg.Shift(offset, affected_sheet); - if (replacement_operand != null) - { - current.Value = replacement_operand; - at_least_one_shifted = true; - } - } - } - return at_least_one_shifted; - } - - /// - /// Recalculates the formula value - /// - /// Result of the recalculation - public virtual DataObjects.IDataObject Recalculate() - { - return Recalculate(PreferredResultType.value_type); - } - - public virtual DataObjects.IDataObject Recalculate(PreferredResultType result_type) - { - RecalcInProgress = true; - DataObjects.IDataObject result = null; - if (ptgs_list.Count != 0) - { - LinkedList.Enumerator enumerator = ptgs_list.GetEnumerator(); - enumerator.MoveNext(); - try - { - result = enumerator.Current.Calculate(ref enumerator, result_type); - } - catch (Events.ReportableException reportable_exception) - { - workbook.ReportError(reportable_exception.error_description); - } - } - RecalcInProgress = false; - return result; - } - - public virtual void UnregisterDependencies() - { - foreach (Ptg ptg in ptgs_list) - { - IHavingSubjectPtg ref_ptg = ptg as IHavingSubjectPtg; - if (ref_ptg != null) - { - ref_ptg.UnregisterDependency(); - } - } - } - - public void RegisterDependencies(IObserver observer) - { - foreach (Ptg ptg in ptgs_list) - { - IHavingSubjectPtg ref_ptg = ptg as IHavingSubjectPtg; - if (ref_ptg != null) - { - ref_ptg.RegisterDependency(observer); - } - } - } - - public string Assemble() - { - if (ptgs_list.Count != 0) - { - LinkedList.Enumerator enumerator = ptgs_list.GetEnumerator(); - enumerator.MoveNext(); - try - { - return formula_last_set = enumerator.Current.Assemble(ref enumerator); - } - catch (Events.ReportableException reportable_exception) - { - workbook.ReportError(reportable_exception.error_description); - } - } - return ""; - } - - public bool HasRelativeParts() - { - foreach (Ptg ptg in ptgs_list) - { - IRefOperandPtg ref_ptg = ptg as IRefOperandPtg; - if(ref_ptg != null) - { - if(ref_ptg.IsRelative) - { - return true; - } - } - } - return false; - } - - public override string ToString() - { - return formula_last_set ?? Assemble(); - } - - internal bool RecalcInProgress { get; private set; } - - internal Events.FormulaFormatError LastError { get { return m_oLastError; } } - - private Events.FormulaFormatError m_oLastError = null; - - private string formula_last_set; - private Workbook workbook; - private LinkedList ptgs_list; - internal abstract Worksheet ParentSheet { get; } - - private static Regex rx_operators = new Regex("\\G *[-+*/^&%<=>:]"); - private static Regex rx_num = new Regex("\\G *[,;] *"); - - private static Regex rx_non_quoted_ref = new Regex("\\G(?\\w[\\w\\d.]*)(:(?\\w[\\w\\d.]*))?!"); - private static Regex rx_quoted_ref = new Regex("\\G'(?(''|[^]['\\/*?:])*)(:(?(''|[^]['\\/*?:])*))?'!"); - } - - enum PreferredResultType - { - numeric_type, - boolean_type, - string_type, - reference_type, - value_type, // Means must be unreferenced or left the same if not a reference - as_is // Means must be left the same - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Precision.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Precision.cs deleted file mode 100644 index 9cc74ca420..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Precision.cs +++ /dev/null @@ -1,60 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas -{ - internal class Precision - { - public const int ExcelSignificantDigits = 15; - public const int ExcelMaxExponent = 308; - public const int ExcelMinExponent = -308; - public const double Epsilon = 2.2204460492503131E-16; // Taken from in C++. - - // Note: 'number' and 'significance' MUST have the same sign - public static double Ceiling(double number, double significance) - { - double quotient = number / significance; - if (quotient == 0) - { - return 0; - } - double quotientTr = Math.Truncate(quotient); - - double nolpiat = 5 * Math.Sign(quotient) * Math.Pow(10, Math.Floor(Math.Log10(Math.Abs(quotient))) - ExcelSignificantDigits); - - if (Math.Abs(quotient - quotientTr) > nolpiat) - { - ++quotientTr; - } - - return quotientTr * significance; - } - - public static double Floor(double number, double significance) - { - double quotient = number / significance; - if (quotient == 0) - { - return 0; - } - - double nolpiat = 5 * Math.Sign(quotient) * Math.Pow(10, Math.Floor(Math.Log10(Math.Abs(quotient))) - ExcelSignificantDigits); - - return Math.Truncate(quotient + nolpiat) * significance; - } - - public static double SignZeroPositive(double number) - { - return number < 0 ? -1 : 1; - } - - public static double CorrectPrecisionAfterMultiplyDivision(double number) - { - double multiplier = Math.Pow(10, Math.Floor(Math.Log10(Math.Abs(number))) - ExcelSignificantDigits + 1); - double nolpiat = 0.5 * Math.Sign(number) * multiplier; - - return Math.Truncate((number + nolpiat) / multiplier) * multiplier; - } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/FunctionsStorage.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/FunctionsStorage.cs deleted file mode 100644 index 6f4d68c56d..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/FunctionsStorage.cs +++ /dev/null @@ -1,474 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs.Functions -{ - /// - /// Functions information storage - /// - public class FunctionsStorage - { - internal FunctionsStorage() - { - descriptions = new Dictionary(); - FillIn(); - } - - private void FillIn() - { - #region Math and trigonometry - descriptions.Add("SUM", new FunctionCreator("Math and trigonometry", typeof(PtgFuncSum))); - descriptions.Add("SIN", new FunctionCreator("Math and trigonometry", typeof(PtgFuncSin))); - descriptions.Add("COS", new FunctionCreator("Math and trigonometry", typeof(PtgFuncCos))); - descriptions.Add("TAN", new FunctionCreator("Math and trigonometry", typeof(PtgFuncTan))); - descriptions.Add("PI", new FunctionCreator("Math and trigonometry", typeof(PtgFuncPi))); - descriptions.Add("SQRT", new FunctionCreator("Math and trigonometry", typeof(PtgFuncSqrt))); - descriptions.Add("POWER", new FunctionCreator("Math and trigonometry", typeof(PtgFuncPower))); - descriptions.Add("SIGN", new FunctionCreator("Math and trigonometry", typeof(PtgFuncSign))); - descriptions.Add("ABS", new FunctionCreator("Math and trigonometry", typeof(PtgFuncAbs))); - descriptions.Add("EVEN", new FunctionCreator("Math and trigonometry", typeof(PtgFuncEven))); - descriptions.Add("ODD", new FunctionCreator("Math and trigonometry", typeof(PtgFuncOdd))); - descriptions.Add("FLOOR", new FunctionCreator("Math and trigonometry", typeof(PtgFuncFloor))); - descriptions.Add("CEILING", new FunctionCreator("Math and trigonometry", typeof(PtgFuncCeiling))); - descriptions.Add("ROUNDDOWN", new FunctionCreator("Math and trigonometry", typeof(PtgFuncRoundDown))); - descriptions.Add("ROUNDUP", new FunctionCreator("Math and trigonometry", typeof(PtgFuncRoundUp))); - descriptions.Add("ROUND", new FunctionCreator("Math and trigonometry", typeof(PtgFuncRound))); - descriptions.Add("MROUND", new FunctionCreator("Math and trigonometry", typeof(PtgFuncMRound))); - descriptions.Add("MOD", new FunctionCreator("Math and trigonometry", typeof(PtgFuncMod))); - descriptions.Add("INT", new FunctionCreator("Math and trigonometry", typeof(PtgFuncInt))); - - descriptions.Add("ACOS", new FunctionCreator("Math and trigonometry", typeof(PtgFuncUnsupported))); - descriptions.Add("ACOSH", new FunctionCreator("Math and trigonometry", typeof(PtgFuncUnsupported))); - descriptions.Add("ASIN", new FunctionCreator("Math and trigonometry", typeof(PtgFuncUnsupported))); - descriptions.Add("ASINH", new FunctionCreator("Math and trigonometry", typeof(PtgFuncUnsupported))); - descriptions.Add("ATAN", new FunctionCreator("Math and trigonometry", typeof(PtgFuncUnsupported))); - descriptions.Add("ATANH", new FunctionCreator("Math and trigonometry", typeof(PtgFuncUnsupported))); - descriptions.Add("ATAN2", new FunctionCreator("Math and trigonometry", typeof(PtgFuncUnsupported))); - descriptions.Add("COMBIN", new FunctionCreator("Math and trigonometry", typeof(PtgFuncUnsupported))); - descriptions.Add("COSH", new FunctionCreator("Math and trigonometry", typeof(PtgFuncUnsupported))); - descriptions.Add("DEGREES", new FunctionCreator("Math and trigonometry", typeof(PtgFuncUnsupported))); - descriptions.Add("EXP", new FunctionCreator("Math and trigonometry", typeof(PtgFuncUnsupported))); - descriptions.Add("FACT", new FunctionCreator("Math and trigonometry", typeof(PtgFuncUnsupported))); - descriptions.Add("FACTDOUBLE", new FunctionCreator("Math and trigonometry", typeof(PtgFuncUnsupported))); - descriptions.Add("GCD", new FunctionCreator("Math and trigonometry", typeof(PtgFuncUnsupported))); - descriptions.Add("LCM", new FunctionCreator("Math and trigonometry", typeof(PtgFuncUnsupported))); - descriptions.Add("LN", new FunctionCreator("Math and trigonometry", typeof(PtgFuncUnsupported))); - descriptions.Add("LOG", new FunctionCreator("Math and trigonometry", typeof(PtgFuncUnsupported))); - descriptions.Add("LOG10", new FunctionCreator("Math and trigonometry", typeof(PtgFuncUnsupported))); - descriptions.Add("MDETERM", new FunctionCreator("Math and trigonometry", typeof(PtgFuncUnsupported))); - descriptions.Add("MINVERSE", new FunctionCreator("Math and trigonometry", typeof(PtgFuncUnsupported))); - descriptions.Add("MMULT", new FunctionCreator("Math and trigonometry", typeof(PtgFuncUnsupported))); - descriptions.Add("MULTINOMIAL", new FunctionCreator("Math and trigonometry", typeof(PtgFuncUnsupported))); - descriptions.Add("PRODUCT", new FunctionCreator("Math and trigonometry", typeof(PtgFuncUnsupported))); - descriptions.Add("QUOTIENT", new FunctionCreator("Math and trigonometry", typeof(PtgFuncUnsupported))); - descriptions.Add("RADIANS", new FunctionCreator("Math and trigonometry", typeof(PtgFuncUnsupported))); - descriptions.Add("RAND", new FunctionCreator("Math and trigonometry", typeof(PtgFuncUnsupported))); - descriptions.Add("RANDBETWEEN", new FunctionCreator("Math and trigonometry", typeof(PtgFuncUnsupported))); - descriptions.Add("ROMAN", new FunctionCreator("Math and trigonometry", typeof(PtgFuncUnsupported))); - descriptions.Add("SERIESSUM", new FunctionCreator("Math and trigonometry", typeof(PtgFuncUnsupported))); - descriptions.Add("SINH", new FunctionCreator("Math and trigonometry", typeof(PtgFuncUnsupported))); - descriptions.Add("SQRTPI", new FunctionCreator("Math and trigonometry", typeof(PtgFuncUnsupported))); - descriptions.Add("SUBTOTAL", new FunctionCreator("Math and trigonometry", typeof(PtgFuncUnsupported))); - descriptions.Add("SUMIF", new FunctionCreator("Math and trigonometry", typeof(PtgFuncUnsupported))); - descriptions.Add("SUMIFS", new FunctionCreator("Math and trigonometry", typeof(PtgFuncUnsupported))); - descriptions.Add("SUMPRODUCT", new FunctionCreator("Math and trigonometry", typeof(PtgFuncUnsupported))); - descriptions.Add("SUMSQ", new FunctionCreator("Math and trigonometry", typeof(PtgFuncUnsupported))); - descriptions.Add("SUMXMY2", new FunctionCreator("Math and trigonometry", typeof(PtgFuncUnsupported))); - descriptions.Add("SUMX2MY2", new FunctionCreator("Math and trigonometry", typeof(PtgFuncUnsupported))); - descriptions.Add("SUMX2PY2", new FunctionCreator("Math and trigonometry", typeof(PtgFuncUnsupported))); - descriptions.Add("TANH", new FunctionCreator("Math and trigonometry", typeof(PtgFuncUnsupported))); - descriptions.Add("TRUNC", new FunctionCreator("Math and trigonometry", typeof(PtgFuncUnsupported))); - #endregion - - #region Statistical - descriptions.Add("COUNT", new FunctionCreator("Statistical", typeof(PtgFuncCount))); - descriptions.Add("AVERAGE", new FunctionCreator("Statistical", typeof(PtgFuncAverage))); - descriptions.Add("MIN", new FunctionCreator("Statistical", typeof(PtgFuncMin))); - descriptions.Add("MAX", new FunctionCreator("Statistical", typeof(PtgFuncMax))); - descriptions.Add("AVEDEV", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - descriptions.Add("AVERAGEA", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - descriptions.Add("AVERAGEIF", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - descriptions.Add("AVERAGEIFS", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - descriptions.Add("BETADIST", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - descriptions.Add("BETAINV", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - descriptions.Add("BINOMDIST", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - descriptions.Add("CHIDIST", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - descriptions.Add("CHIINV", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - descriptions.Add("CHITEST", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - descriptions.Add("CONFIDENCE", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - descriptions.Add("CORREL", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - descriptions.Add("COUNTA", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - descriptions.Add("COUNTBLANK", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - descriptions.Add("COUNTIF", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - descriptions.Add("COUNTIFS", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - descriptions.Add("COVAR", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - descriptions.Add("CRITBINOM", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - descriptions.Add("DEVSQ", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - descriptions.Add("EXPONDIST", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - descriptions.Add("FDIST", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - descriptions.Add("FINV", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - descriptions.Add("FISHER", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - descriptions.Add("FISHERINV", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - descriptions.Add("FORECAST", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - descriptions.Add("FREQUENCY", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - descriptions.Add("FTEST", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - descriptions.Add("GAMMADIST", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - descriptions.Add("GAMMAINV", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - descriptions.Add("GAMMALN", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - descriptions.Add("GEOMEAN", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - descriptions.Add("GROWTH", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - descriptions.Add("HARMEAN", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - descriptions.Add("HYPGEOMDIST", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - descriptions.Add("INTERCEPT", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - descriptions.Add("KURT", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - descriptions.Add("LARGE", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - descriptions.Add("LINEST", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - descriptions.Add("LOGINV", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - descriptions.Add("LOGNORMDIST", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - descriptions.Add("MAXA", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - descriptions.Add("MEDIAN", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - descriptions.Add("MINA", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - descriptions.Add("MODE", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - descriptions.Add("NEGBINOMDIST", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - descriptions.Add("NORMDIST", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - descriptions.Add("NORMINV", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - descriptions.Add("NORMSDIST", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - descriptions.Add("NORMSINV", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - descriptions.Add("PEARSON", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - descriptions.Add("PERCENTILE", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - descriptions.Add("PERCENTRANK", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - descriptions.Add("PERMUT", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - descriptions.Add("POISSON", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - descriptions.Add("PROB", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - descriptions.Add("QUARTILE", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - descriptions.Add("RANK", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - descriptions.Add("RSQ", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - descriptions.Add("SKEW", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - descriptions.Add("SLOPE", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - descriptions.Add("SMALL", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - descriptions.Add("STANDARDIZE", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - descriptions.Add("STDEV", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - descriptions.Add("STDEVA", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - descriptions.Add("STDEVP", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - descriptions.Add("STDEVPA", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - descriptions.Add("STEYX", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - descriptions.Add("TDIST", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - descriptions.Add("TINV", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - descriptions.Add("TREND", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - descriptions.Add("TRIMMEAN", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - descriptions.Add("TTEST", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - descriptions.Add("VAR", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - descriptions.Add("VARA", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - descriptions.Add("VARP", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - descriptions.Add("VARPA", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - descriptions.Add("WEIBULL", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - descriptions.Add("ZTEST", new FunctionCreator("Statistical", typeof(PtgFuncUnsupported))); - #endregion - - #region Logical (Full) - descriptions.Add("NOT", new FunctionCreator("Logical", typeof(PtgFuncNot))); - descriptions.Add("AND", new FunctionCreator("Logical", typeof(PtgFuncAnd))); - descriptions.Add("OR", new FunctionCreator("Logical", typeof(PtgFuncOr))); - descriptions.Add("TRUE", new FunctionCreator("Logical", typeof(PtgFuncTrue))); - descriptions.Add("FALSE", new FunctionCreator("Logical", typeof(PtgFuncFalse))); - descriptions.Add("IF", new FunctionCreator("Logical", typeof(PtgFuncIf))); - descriptions.Add("IFERROR", new FunctionCreator("Logical", typeof(PtgFuncIfError))); - #endregion - - #region Text and data - descriptions.Add("CONCATENATE", new FunctionCreator("Text and data", typeof(PtgFuncConcatenate))); - descriptions.Add("UPPER", new FunctionCreator("Text and data", typeof(PtgFuncUpper))); - descriptions.Add("LOWER", new FunctionCreator("Text and data", typeof(PtgFuncLower))); - descriptions.Add("T", new FunctionCreator("Text and data", typeof(PtgFuncT))); - descriptions.Add("REPT", new FunctionCreator("Text and data", typeof(PtgFuncRept))); - descriptions.Add("EXACT", new FunctionCreator("Text and data", typeof(PtgFuncExact))); - descriptions.Add("ASC", new FunctionCreator("Text and data", typeof(PtgFuncUnsupported))); - descriptions.Add("BAHTTEXT", new FunctionCreator("Text and data", typeof(PtgFuncUnsupported))); - descriptions.Add("CHAR", new FunctionCreator("Text and data", typeof(PtgFuncUnsupported))); - descriptions.Add("CLEAN", new FunctionCreator("Text and data", typeof(PtgFuncUnsupported))); - descriptions.Add("CODE", new FunctionCreator("Text and data", typeof(PtgFuncUnsupported))); - descriptions.Add("DOLLAR", new FunctionCreator("Text and data", typeof(PtgFuncUnsupported))); - descriptions.Add("FIND", new FunctionCreator("Text and data", typeof(PtgFuncUnsupported))); - descriptions.Add("FINDB", new FunctionCreator("Text and data", typeof(PtgFuncUnsupported))); - descriptions.Add("FIXED", new FunctionCreator("Text and data", typeof(PtgFuncUnsupported))); - descriptions.Add("JIS", new FunctionCreator("Text and data", typeof(PtgFuncUnsupported))); - descriptions.Add("LEFT", new FunctionCreator("Text and data", typeof(PtgFuncUnsupported))); - descriptions.Add("LEFTB", new FunctionCreator("Text and data", typeof(PtgFuncUnsupported))); - descriptions.Add("LEN", new FunctionCreator("Text and data", typeof(PtgFuncUnsupported))); - descriptions.Add("LENB", new FunctionCreator("Text and data", typeof(PtgFuncUnsupported))); - descriptions.Add("MID", new FunctionCreator("Text and data", typeof(PtgFuncUnsupported))); - descriptions.Add("MIDB", new FunctionCreator("Text and data", typeof(PtgFuncUnsupported))); - descriptions.Add("PHONETIC", new FunctionCreator("Text and data", typeof(PtgFuncUnsupported))); - descriptions.Add("PROPER", new FunctionCreator("Text and data", typeof(PtgFuncUnsupported))); - descriptions.Add("REPLACE", new FunctionCreator("Text and data", typeof(PtgFuncUnsupported))); - descriptions.Add("REPLACEB", new FunctionCreator("Text and data", typeof(PtgFuncUnsupported))); - descriptions.Add("RIGHT", new FunctionCreator("Text and data", typeof(PtgFuncUnsupported))); - descriptions.Add("RIGHTB", new FunctionCreator("Text and data", typeof(PtgFuncUnsupported))); - descriptions.Add("SEARCH", new FunctionCreator("Text and data", typeof(PtgFuncUnsupported))); - descriptions.Add("SEARCHB", new FunctionCreator("Text and data", typeof(PtgFuncUnsupported))); - descriptions.Add("SUBSTITUTE", new FunctionCreator("Text and data", typeof(PtgFuncUnsupported))); - descriptions.Add("TEXT", new FunctionCreator("Text and data", typeof(PtgFuncUnsupported))); - descriptions.Add("TRIM", new FunctionCreator("Text and data", typeof(PtgFuncUnsupported))); - descriptions.Add("VALUE", new FunctionCreator("Text and data", typeof(PtgFuncUnsupported))); - #endregion - - #region Information - descriptions.Add("N", new FunctionCreator("Information", typeof(PtgFuncN))); - descriptions.Add("ISBLANK", new FunctionCreator("Information", typeof(PtgFuncIsBlank))); - descriptions.Add("ISERR", new FunctionCreator("Information", typeof(PtgFuncIsErr))); - descriptions.Add("ISERROR", new FunctionCreator("Information", typeof(PtgFuncIsError))); - descriptions.Add("ISLOGICAL", new FunctionCreator("Information", typeof(PtgFuncIsLogical))); - descriptions.Add("ISNA", new FunctionCreator("Information", typeof(PtgFuncIsNa))); - descriptions.Add("ISNONTEXT", new FunctionCreator("Information", typeof(PtgFuncIsNontext))); - descriptions.Add("ISNUMBER", new FunctionCreator("Information", typeof(PtgFuncIsNumber))); - descriptions.Add("ISREF", new FunctionCreator("Information", typeof(PtgFuncIsRef))); - descriptions.Add("ISTEXT", new FunctionCreator("Information", typeof(PtgFuncIsText))); - descriptions.Add("ISODD", new FunctionCreator("Information", typeof(PtgFuncIsOdd))); - descriptions.Add("ISEVEN", new FunctionCreator("Information", typeof(PtgFuncIsEven))); - descriptions.Add("NA", new FunctionCreator("Information", typeof(PtgFuncNa))); - descriptions.Add("TYPE", new FunctionCreator("Information", typeof(PtgFuncType))); - descriptions.Add("ERROR.TYPE", new FunctionCreator("Information", typeof(PtgFuncErrorType))); - descriptions.Add("INFO", new FunctionCreator("Information", typeof(PtgFuncUnsupported))); - descriptions.Add("CELL", new FunctionCreator("Information", typeof(PtgFuncUnsupported))); - #endregion - - #region Engineering - descriptions.Add("BESSELI", new FunctionCreator("Engineering", typeof(PtgFuncUnsupported))); - descriptions.Add("BESSELJ", new FunctionCreator("Engineering", typeof(PtgFuncUnsupported))); - descriptions.Add("BESSELK", new FunctionCreator("Engineering", typeof(PtgFuncUnsupported))); - descriptions.Add("BESSELY", new FunctionCreator("Engineering", typeof(PtgFuncUnsupported))); - descriptions.Add("BIN2DEC", new FunctionCreator("Engineering", typeof(PtgFuncUnsupported))); - descriptions.Add("BIN2HEX", new FunctionCreator("Engineering", typeof(PtgFuncUnsupported))); - descriptions.Add("BIN2OCT", new FunctionCreator("Engineering", typeof(PtgFuncUnsupported))); - descriptions.Add("COMPLEX", new FunctionCreator("Engineering", typeof(PtgFuncUnsupported))); - descriptions.Add("CONVERT", new FunctionCreator("Engineering", typeof(PtgFuncUnsupported))); - descriptions.Add("DEC2BIN", new FunctionCreator("Engineering", typeof(PtgFuncUnsupported))); - descriptions.Add("DEC2HEX", new FunctionCreator("Engineering", typeof(PtgFuncUnsupported))); - descriptions.Add("DEC2OCT", new FunctionCreator("Engineering", typeof(PtgFuncUnsupported))); - descriptions.Add("DELTA", new FunctionCreator("Engineering", typeof(PtgFuncUnsupported))); - descriptions.Add("ERF", new FunctionCreator("Engineering", typeof(PtgFuncUnsupported))); - descriptions.Add("ERFC", new FunctionCreator("Engineering", typeof(PtgFuncUnsupported))); - descriptions.Add("GESTEP", new FunctionCreator("Engineering", typeof(PtgFuncUnsupported))); - descriptions.Add("HEX2BIN", new FunctionCreator("Engineering", typeof(PtgFuncUnsupported))); - descriptions.Add("HEX2DEC", new FunctionCreator("Engineering", typeof(PtgFuncUnsupported))); - descriptions.Add("HEX2OCT", new FunctionCreator("Engineering", typeof(PtgFuncUnsupported))); - descriptions.Add("IMABS", new FunctionCreator("Engineering", typeof(PtgFuncUnsupported))); - descriptions.Add("IMAGINARY", new FunctionCreator("Engineering", typeof(PtgFuncUnsupported))); - descriptions.Add("IMARGUMENT", new FunctionCreator("Engineering", typeof(PtgFuncUnsupported))); - descriptions.Add("IMCONJUGATE", new FunctionCreator("Engineering", typeof(PtgFuncUnsupported))); - descriptions.Add("IMCOS", new FunctionCreator("Engineering", typeof(PtgFuncUnsupported))); - descriptions.Add("IMDIV", new FunctionCreator("Engineering", typeof(PtgFuncUnsupported))); - descriptions.Add("IMEXP", new FunctionCreator("Engineering", typeof(PtgFuncUnsupported))); - descriptions.Add("IMLN", new FunctionCreator("Engineering", typeof(PtgFuncUnsupported))); - descriptions.Add("IMLOG10", new FunctionCreator("Engineering", typeof(PtgFuncUnsupported))); - descriptions.Add("IMLOG2", new FunctionCreator("Engineering", typeof(PtgFuncUnsupported))); - descriptions.Add("IMPOWER", new FunctionCreator("Engineering", typeof(PtgFuncUnsupported))); - descriptions.Add("IMPRODUCT", new FunctionCreator("Engineering", typeof(PtgFuncUnsupported))); - descriptions.Add("IMREAL", new FunctionCreator("Engineering", typeof(PtgFuncUnsupported))); - descriptions.Add("IMSIN", new FunctionCreator("Engineering", typeof(PtgFuncUnsupported))); - descriptions.Add("IMSQRT", new FunctionCreator("Engineering", typeof(PtgFuncUnsupported))); - descriptions.Add("IMSUB", new FunctionCreator("Engineering", typeof(PtgFuncUnsupported))); - descriptions.Add("IMSUM", new FunctionCreator("Engineering", typeof(PtgFuncUnsupported))); - descriptions.Add("OCT2BIN", new FunctionCreator("Engineering", typeof(PtgFuncUnsupported))); - descriptions.Add("OCT2DEC", new FunctionCreator("Engineering", typeof(PtgFuncUnsupported))); - descriptions.Add("OCT2HEX", new FunctionCreator("Engineering", typeof(PtgFuncUnsupported))); - #endregion - - #region Lookup and reference - descriptions.Add("ADDRESS", new FunctionCreator("Lookup and reference", typeof(PtgFuncUnsupported))); - descriptions.Add("AREAS", new FunctionCreator("Lookup and reference", typeof(PtgFuncUnsupported))); - descriptions.Add("CHOOSE", new FunctionCreator("Lookup and reference", typeof(PtgFuncUnsupported))); - descriptions.Add("COLUMN", new FunctionCreator("Lookup and reference", typeof(PtgFuncUnsupported))); - descriptions.Add("COLUMNS", new FunctionCreator("Lookup and reference", typeof(PtgFuncUnsupported))); - descriptions.Add("HLOOKUP", new FunctionCreator("Lookup and reference", typeof(PtgFuncUnsupported))); - descriptions.Add("HYPERLINK", new FunctionCreator("Lookup and reference", typeof(PtgFuncUnsupported))); - descriptions.Add("INDEX", new FunctionCreator("Lookup and reference", typeof(PtgFuncUnsupported))); - descriptions.Add("INDIRECT", new FunctionCreator("Lookup and reference", typeof(PtgFuncUnsupported))); - descriptions.Add("LOOKUP", new FunctionCreator("Lookup and reference", typeof(PtgFuncUnsupported))); - descriptions.Add("MATCH", new FunctionCreator("Lookup and reference", typeof(PtgFuncUnsupported))); - descriptions.Add("OFFSET", new FunctionCreator("Lookup and reference", typeof(PtgFuncUnsupported))); - descriptions.Add("ROW", new FunctionCreator("Lookup and reference", typeof(PtgFuncUnsupported))); - descriptions.Add("ROWS", new FunctionCreator("Lookup and reference", typeof(PtgFuncUnsupported))); - descriptions.Add("RTD", new FunctionCreator("Lookup and reference", typeof(PtgFuncUnsupported))); - descriptions.Add("TRANSPOSE", new FunctionCreator("Lookup and reference", typeof(PtgFuncUnsupported))); - descriptions.Add("VLOOKUP", new FunctionCreator("Lookup and reference", typeof(PtgFuncUnsupported))); - #endregion - - #region Cube - descriptions.Add("CUBEKPIMEMBER", new FunctionCreator("Cube", typeof(PtgFuncUnsupported))); - descriptions.Add("CUBEMEMBER", new FunctionCreator("Cube", typeof(PtgFuncUnsupported))); - descriptions.Add("CUBEMEMBERPROPERTY", new FunctionCreator("Cube", typeof(PtgFuncUnsupported))); - descriptions.Add("CUBERANKEDMEMBER", new FunctionCreator("Cube", typeof(PtgFuncUnsupported))); - descriptions.Add("CUBESET", new FunctionCreator("Cube", typeof(PtgFuncUnsupported))); - descriptions.Add("CUBESETCOUNT", new FunctionCreator("Cube", typeof(PtgFuncUnsupported))); - descriptions.Add("CUBEVALUE", new FunctionCreator("Cube", typeof(PtgFuncUnsupported))); - #endregion - - #region Date and time - descriptions.Add("DATE", new FunctionCreator("Date and time", typeof(PtgFuncUnsupported))); - descriptions.Add("DATEVALUE", new FunctionCreator("Date and time", typeof(PtgFuncUnsupported))); - descriptions.Add("DAY", new FunctionCreator("Date and time", typeof(PtgFuncUnsupported))); - descriptions.Add("DAYS360", new FunctionCreator("Date and time", typeof(PtgFuncUnsupported))); - descriptions.Add("EDATE", new FunctionCreator("Date and time", typeof(PtgFuncUnsupported))); - descriptions.Add("EOMONTH", new FunctionCreator("Date and time", typeof(PtgFuncUnsupported))); - descriptions.Add("HOUR", new FunctionCreator("Date and time", typeof(PtgFuncUnsupported))); - descriptions.Add("MINUTE", new FunctionCreator("Date and time", typeof(PtgFuncUnsupported))); - descriptions.Add("MONTH", new FunctionCreator("Date and time", typeof(PtgFuncUnsupported))); - descriptions.Add("NETWORKDAYS", new FunctionCreator("Date and time", typeof(PtgFuncUnsupported))); - descriptions.Add("NOW", new FunctionCreator("Date and time", typeof(PtgFuncUnsupported))); - descriptions.Add("SECOND", new FunctionCreator("Date and time", typeof(PtgFuncUnsupported))); - descriptions.Add("TIME", new FunctionCreator("Date and time", typeof(PtgFuncUnsupported))); - descriptions.Add("TIMEVALUE", new FunctionCreator("Date and time", typeof(PtgFuncUnsupported))); - descriptions.Add("TODAY", new FunctionCreator("Date and time", typeof(PtgFuncUnsupported))); - descriptions.Add("WEEKDAY", new FunctionCreator("Date and time", typeof(PtgFuncUnsupported))); - descriptions.Add("WEEKNUM", new FunctionCreator("Date and time", typeof(PtgFuncUnsupported))); - descriptions.Add("WORKDAY", new FunctionCreator("Date and time", typeof(PtgFuncUnsupported))); - descriptions.Add("YEAR", new FunctionCreator("Date and time", typeof(PtgFuncUnsupported))); - descriptions.Add("YEARFRAC", new FunctionCreator("Date and time", typeof(PtgFuncUnsupported))); - #endregion - - #region Financial - descriptions.Add("ACCRINT", new FunctionCreator("Financial", typeof(PtgFuncUnsupported))); - descriptions.Add("ACCRINTM", new FunctionCreator("Financial", typeof(PtgFuncUnsupported))); - descriptions.Add("AMORDEGRC", new FunctionCreator("Financial", typeof(PtgFuncUnsupported))); - descriptions.Add("AMORLINC", new FunctionCreator("Financial", typeof(PtgFuncUnsupported))); - descriptions.Add("COUPDAYBS", new FunctionCreator("Financial", typeof(PtgFuncUnsupported))); - descriptions.Add("COUPDAYS", new FunctionCreator("Financial", typeof(PtgFuncUnsupported))); - descriptions.Add("COUPDAYSNC", new FunctionCreator("Financial", typeof(PtgFuncUnsupported))); - descriptions.Add("COUPNCD", new FunctionCreator("Financial", typeof(PtgFuncUnsupported))); - descriptions.Add("COUPNUM", new FunctionCreator("Financial", typeof(PtgFuncUnsupported))); - descriptions.Add("COUPPCD", new FunctionCreator("Financial", typeof(PtgFuncUnsupported))); - descriptions.Add("CUMIPMT", new FunctionCreator("Financial", typeof(PtgFuncUnsupported))); - descriptions.Add("CUMPRINC", new FunctionCreator("Financial", typeof(PtgFuncUnsupported))); - descriptions.Add("DB", new FunctionCreator("Financial", typeof(PtgFuncUnsupported))); - descriptions.Add("DDB", new FunctionCreator("Financial", typeof(PtgFuncUnsupported))); - descriptions.Add("DISC", new FunctionCreator("Financial", typeof(PtgFuncUnsupported))); - descriptions.Add("DOLLARDE", new FunctionCreator("Financial", typeof(PtgFuncUnsupported))); - descriptions.Add("DOLLARFR", new FunctionCreator("Financial", typeof(PtgFuncUnsupported))); - descriptions.Add("DURATION", new FunctionCreator("Financial", typeof(PtgFuncUnsupported))); - descriptions.Add("EFFECT", new FunctionCreator("Financial", typeof(PtgFuncUnsupported))); - descriptions.Add("FV", new FunctionCreator("Financial", typeof(PtgFuncUnsupported))); - descriptions.Add("FVSCHEDULE", new FunctionCreator("Financial", typeof(PtgFuncUnsupported))); - descriptions.Add("INTRATE", new FunctionCreator("Financial", typeof(PtgFuncUnsupported))); - descriptions.Add("IPMT", new FunctionCreator("Financial", typeof(PtgFuncUnsupported))); - descriptions.Add("IRR", new FunctionCreator("Financial", typeof(PtgFuncUnsupported))); - descriptions.Add("ISPMT", new FunctionCreator("Financial", typeof(PtgFuncUnsupported))); - descriptions.Add("LOGEST", new FunctionCreator("Financial", typeof(PtgFuncUnsupported))); - descriptions.Add("MDURATION", new FunctionCreator("Financial", typeof(PtgFuncUnsupported))); - descriptions.Add("MIRR", new FunctionCreator("Financial", typeof(PtgFuncUnsupported))); - descriptions.Add("NOMINAL", new FunctionCreator("Financial", typeof(PtgFuncUnsupported))); - descriptions.Add("NPER", new FunctionCreator("Financial", typeof(PtgFuncUnsupported))); - descriptions.Add("NPV", new FunctionCreator("Financial", typeof(PtgFuncUnsupported))); - descriptions.Add("ODDFPRICE", new FunctionCreator("Financial", typeof(PtgFuncUnsupported))); - descriptions.Add("ODDFYIELD", new FunctionCreator("Financial", typeof(PtgFuncUnsupported))); - descriptions.Add("ODDLPRICE", new FunctionCreator("Financial", typeof(PtgFuncUnsupported))); - descriptions.Add("ODDLYIELD", new FunctionCreator("Financial", typeof(PtgFuncUnsupported))); - descriptions.Add("PMT", new FunctionCreator("Financial", typeof(PtgFuncUnsupported))); - descriptions.Add("PPMT", new FunctionCreator("Financial", typeof(PtgFuncUnsupported))); - descriptions.Add("PRICE", new FunctionCreator("Financial", typeof(PtgFuncUnsupported))); - descriptions.Add("PRICEDISC", new FunctionCreator("Financial", typeof(PtgFuncUnsupported))); - descriptions.Add("PRICEMAT", new FunctionCreator("Financial", typeof(PtgFuncUnsupported))); - descriptions.Add("PV", new FunctionCreator("Financial", typeof(PtgFuncUnsupported))); - descriptions.Add("RATE", new FunctionCreator("Financial", typeof(PtgFuncUnsupported))); - descriptions.Add("RECEIVED", new FunctionCreator("Financial", typeof(PtgFuncUnsupported))); - descriptions.Add("SLN", new FunctionCreator("Financial", typeof(PtgFuncUnsupported))); - descriptions.Add("SYD", new FunctionCreator("Financial", typeof(PtgFuncUnsupported))); - descriptions.Add("TBILLEQ", new FunctionCreator("Financial", typeof(PtgFuncUnsupported))); - descriptions.Add("TBILLPRICE", new FunctionCreator("Financial", typeof(PtgFuncUnsupported))); - descriptions.Add("TBILLYIELD", new FunctionCreator("Financial", typeof(PtgFuncUnsupported))); - descriptions.Add("VDB", new FunctionCreator("Financial", typeof(PtgFuncUnsupported))); - descriptions.Add("XIRR", new FunctionCreator("Financial", typeof(PtgFuncUnsupported))); - descriptions.Add("XNPV", new FunctionCreator("Financial", typeof(PtgFuncUnsupported))); - descriptions.Add("YIELD", new FunctionCreator("Financial", typeof(PtgFuncUnsupported))); - descriptions.Add("YIELDDISC", new FunctionCreator("Financial", typeof(PtgFuncUnsupported))); - descriptions.Add("YIELDMAT", new FunctionCreator("Financial", typeof(PtgFuncUnsupported))); - #endregion - } - - /// - /// Obtains the list of supported by the current version of the editor functions - /// - /// List of function descriptors - public List GetFunctionsList() - { - List result_list = new List(); - - foreach (FunctionCreator creator in descriptions.Values) - { - if (creator.function_type.GetConstructor(new Type[0]) != null) - { - PtgFunc func = (PtgFunc)Activator.CreateInstance(creator.function_type); - result_list.Add(new FunctionDescription(func.ToString(), creator.group_name, func.ArgumentsTip)); - } - } - return result_list; - } - - internal PtgFunc CreateInstance(string func_name) - { - FunctionCreator desc; - if(!descriptions.TryGetValue(func_name, out desc)) - { - return null; - } - - if (desc.function_type.GetConstructor(new Type[0]) != null) - { - return (PtgFunc)Activator.CreateInstance(desc.function_type); - } - else - { - object[] func_name_params = new object[1]; - func_name_params[0] = func_name; - return (PtgFunc)Activator.CreateInstance(desc.function_type, func_name_params); - } - } - - private Dictionary descriptions; - } - - internal class FunctionCreator - { - internal FunctionCreator(string group_name, Type function_type) - { - this.group_name = group_name; - this.function_type = function_type; - } - - internal string group_name; - internal Type function_type; - } - -} - -namespace ASCOfficeEWSEditor.Editor -{ - /// - /// Function description - /// - public class FunctionDescription - { - internal FunctionDescription(string func_name, string group_name, string arguments_tip) - { - FuncName = func_name; - ArgumentsTip = arguments_tip; - GroupName = group_name; - } - - /// - /// International function name - /// - public string FuncName { get; private set; } - /// - /// Arguments tip - /// - public string ArgumentsTip { get; private set; } - /// - /// Group name - /// - public string GroupName { get; private set; } - } - - -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncAbs.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncAbs.cs deleted file mode 100644 index a6cf5d33b8..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncAbs.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs.Functions -{ - internal class PtgFuncAbs : PtgFuncMathOneArg - { - public override DataObjects.IDataObject DoMath(double num_value) - { - return new DataObjects.ObjectNumber(Math.Abs(num_value)); - } - - public override string ToString() { return "ABS"; } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncAnd.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncAnd.cs deleted file mode 100644 index 0ac688ad01..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncAnd.cs +++ /dev/null @@ -1,82 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs.Functions -{ - internal class PtgFuncAnd : PtgFuncVar - { - public override DataObjects.IDataObject Calculate(LinkedList argv, PreferredResultType result_type) - { - DataObjects.ObjectBoolean and_result = null; - foreach (DataObjects.IDataObject arg in argv) - { - DataObjects.ObjectReference range = arg as DataObjects.ObjectReference; - if(range != null) - { - foreach (DataObjects.IDataObject arg_referenced in range) - { - if(arg_referenced is DataObjects.ObjectError) - { - return arg_referenced; - } - else if(arg_referenced is DataObjects.ObjectString || arg_referenced is DataObjects.ObjectEmpty) - { - continue; - } - DataObjects.ObjectBoolean arg_referenced_bool = arg_referenced as DataObjects.ObjectBoolean; - if (arg_referenced_bool == null) - { - arg_referenced_bool = arg_referenced.ConvertIfPossible(PreferredResultType.boolean_type) as DataObjects.ObjectBoolean; - if (arg_referenced_bool == null) - { - continue; - } - } - - if(and_result == null) - { - and_result = arg_referenced_bool; - } - else - { - and_result = new DataObjects.ObjectBoolean(and_result.Value && arg_referenced_bool.Value); - } - } - } - else // If non-reference - { - DataObjects.IDataObject arg_converted = arg.ConvertIfPossible(PreferredResultType.boolean_type); - if(arg_converted is DataObjects.ObjectError) - { - return arg.ConvertIfPossible(result_type);; - } - else if(arg_converted is DataObjects.ObjectString) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - DataObjects.ObjectBoolean arg_boolean = arg_converted as DataObjects.ObjectBoolean; - if (arg_boolean != null) - { - if (and_result == null) - { - and_result = arg_boolean; - } - else - { - and_result = new DataObjects.ObjectBoolean(and_result.Value && arg_boolean.Value); - } - } - } - } - if (and_result == null) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - return and_result.ConvertIfPossible(result_type); - } - - public override string ToString() { return "AND"; } - public override string ArgumentsTip { get { return "AND(logical1; logical2; ...)"; } } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncAverage.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncAverage.cs deleted file mode 100644 index 73d30f0af9..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncAverage.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs.Functions -{ - internal class PtgFuncAverage : PtgFuncVar - { - public override DataObjects.IDataObject Calculate(LinkedList argv, PreferredResultType result_type) - { - DataObjects.IDataObject sum = new DataObjects.ObjectNumber(0); - int count = 0; - foreach (DataObjects.IDataObject arg in argv) - { - DataObjects.ObjectReference range = arg as DataObjects.ObjectReference; - if(range != null) - { - foreach (DataObjects.IDataObject arg_referenced in range) - { - if (arg_referenced is DataObjects.ObjectNumber || arg_referenced is DataObjects.ObjectError) - { - sum = sum.PerformBinaryOperation(arg_referenced, BinOpCalc.Arithmetic.AddCalculator); - ++count; - } - } - } - else // If non-reference - { - sum = sum.PerformBinaryOperation(arg.ConvertIfPossible(PreferredResultType.numeric_type), BinOpCalc.Arithmetic.AddCalculator); - ++count; - } - } - - return sum.PerformBinaryOperation((DataObjects.IDataObject)new DataObjects.ObjectNumber(count), BinOpCalc.Arithmetic.DivCalculator).ConvertIfPossible(result_type); - } - - public override string ToString() { return "AVERAGE"; } - public override string ArgumentsTip { get { return "AVERAGE(number1; number2; ...)"; } } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncCeiling.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncCeiling.cs deleted file mode 100644 index ffc57270d4..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncCeiling.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs.Functions -{ - internal class PtgFuncCeiling : PtgFuncMathTwoArgs - { - public override DataObjects.IDataObject DoMath(double number, double significance) - { - if (significance == 0) - { - return new DataObjects.ObjectNumber(0); - } - if (Math.Sign(number) != Math.Sign(significance) && number != 0) - { - return new DataObjects.ObjectError(ErrorValue.not_numeric); - } - if (Double.IsInfinity(number / significance)) - { - return new DataObjects.ObjectError(ErrorValue.not_numeric); - } - return new DataObjects.ObjectNumber(Precision.Ceiling(number, significance)); - } - - public override string ToString() { return "CEILING"; } - public override string ArgumentsTip { get { return "CEILING(number; significance)"; } } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncConcatenate.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncConcatenate.cs deleted file mode 100644 index 3ea8ce188e..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncConcatenate.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs.Functions -{ - internal class PtgFuncConcatenate : PtgFuncVar - { - public override DataObjects.IDataObject Calculate(LinkedList argv, PreferredResultType result_type) - { - DataObjects.IDataObject text_result = new DataObjects.ObjectString(""); - foreach (DataObjects.IDataObject arg in argv) - { - text_result = text_result.PerformBinaryOperation(arg.ConvertIfPossible(PreferredResultType.value_type), BinOpCalc.Arithmetic.ConcatCalculator); - } - - return text_result.ConvertIfPossible(result_type); - } - - public override string ToString() { return "CONCATENATE"; } - public override string ArgumentsTip { get { return "CONCATENATE(text1; text2; ...)"; } } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncCos.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncCos.cs deleted file mode 100644 index 93c651bede..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncCos.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs.Functions -{ - internal class PtgFuncCos : PtgFuncMathOneArg - { - public override DataObjects.IDataObject DoMath(double num_value) - { - return new DataObjects.ObjectNumber(Math.Cos(num_value)); - } - - public override string ToString() { return "COS"; } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncCount.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncCount.cs deleted file mode 100644 index 0e15f89e7e..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncCount.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs.Functions -{ - internal class PtgFuncCount : PtgFuncVar - { - public override DataObjects.IDataObject Calculate(LinkedList argv, PreferredResultType result_type) - { - int count = 0; - foreach (DataObjects.IDataObject arg in argv) - { - DataObjects.ObjectReference range = arg as DataObjects.ObjectReference; - if(range != null) - { - foreach (DataObjects.IDataObject arg_referenced in range) - { - if (arg_referenced is DataObjects.ObjectNumber) - { - ++count; - } - } - } - else // If single value - { - if(arg.ConvertIfPossible(PreferredResultType.numeric_type) is DataObjects.ObjectNumber) - { - ++count; - } - } - } - - return new DataObjects.ObjectNumber(count); - } - - public override string ToString() { return "COUNT"; } - public override string ArgumentsTip { get { return "COUNT(value1; value2; ...)"; } } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncErrorType.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncErrorType.cs deleted file mode 100644 index cb315d630c..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncErrorType.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs.Functions -{ - internal class PtgFuncErrorType : PtgFuncFixed - { - public override DataObjects.IDataObject Calculate(LinkedList argv, PreferredResultType result_type) - { - if (argv.Count != ParametersNum) - { - throw new Events.ReportableException(new Events.InternalError("Wrong parameters number to " + ToString() + " function (" + ParametersNum + " expected)")); - } - - DataObjects.ObjectError error_arg = argv.First.Value.ConvertIfPossible(PreferredResultType.value_type) as DataObjects.ObjectError; - - if (error_arg == null) - { - return new DataObjects.ObjectError(ErrorValue.not_available); - } - - return new DataObjects.ObjectNumber(error_arg.Value.Code); - } - - public override string ToString() { return "ERROR.TYPE"; } - public override int ParametersNum { get { return 1; } } - public override int ParametersNumMin { get { return 1; } } - public override int ParametersNumMax { get { return 1; } } - public override string ArgumentsTip { get { return "ERROR.TYPE(value)"; } } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncEven.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncEven.cs deleted file mode 100644 index 9e3e64f71b..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncEven.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs.Functions -{ - internal class PtgFuncEven : PtgFuncMathOneArg - { - public override DataObjects.IDataObject DoMath(double num_value) - { - return new DataObjects.ObjectNumber(Math.Ceiling(Math.Abs(num_value) / 2) * 2 * Math.Sign(num_value)); - } - - public override string ToString() { return "EVEN"; } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncExact.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncExact.cs deleted file mode 100644 index 9b39113466..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncExact.cs +++ /dev/null @@ -1,56 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs.Functions -{ - internal class PtgFuncExact : PtgFuncFixed - { - public override DataObjects.IDataObject Calculate(LinkedList argv, PreferredResultType result_type) - { - DataObjects.IDataObject text_1_arg = null; - DataObjects.IDataObject text_2_arg = null; - int argument_index = 0; - foreach (DataObjects.IDataObject arg in argv) - { - switch (++argument_index) - { - case 1: - text_1_arg = arg.ConvertIfPossible(PreferredResultType.string_type); - break; - case 2: - text_2_arg = arg.ConvertIfPossible(PreferredResultType.string_type); - break; - } - } - if (argument_index != ParametersNum) - { - throw new Events.ReportableException(new Events.InternalError("Wrong parameters number to " + ToString() + " function (" + ParametersNum + " expected)")); - } - - if (text_1_arg is DataObjects.ObjectError) - { - return text_1_arg; - } - if (text_2_arg is DataObjects.ObjectError) - { - return text_2_arg; - } - - DataObjects.ObjectString text1 = text_1_arg as DataObjects.ObjectString; - DataObjects.ObjectString text2 = text_2_arg as DataObjects.ObjectString; - if (text1 == null || text2 == null) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - return new DataObjects.ObjectBoolean(text1.Value == text2.Value).ConvertIfPossible(result_type); - } - - public override string ToString() { return "EXACT"; } - public override int ParametersNum { get { return 2; } } - public override int ParametersNumMin { get { return 2; } } - public override int ParametersNumMax { get { return 2; } } - public override string ArgumentsTip { get { return "EXACT(text1; text2)"; } } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncFalse.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncFalse.cs deleted file mode 100644 index d2bd32163a..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncFalse.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs.Functions -{ - internal class PtgFuncFalse : PtgFuncFixed - { - public override DataObjects.IDataObject Calculate(LinkedList argv, PreferredResultType result_type) - { - return new DataObjects.ObjectBoolean(false).ConvertIfPossible(result_type); - } - - public override string ToString() { return "FALSE"; } - public override int ParametersNum { get { return 0; } } - public override int ParametersNumMin { get { return 0; } } - public override int ParametersNumMax { get { return 0; } } - public override string ArgumentsTip { get { return "FALSE()"; } } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncFloor.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncFloor.cs deleted file mode 100644 index a03a5e2ff2..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncFloor.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs.Functions -{ - internal class PtgFuncFloor : PtgFuncMathTwoArgs - { - public override DataObjects.IDataObject DoMath(double number, double significance) - { - if (significance == 0) - { - if (number != 0) - { - return new DataObjects.ObjectError(ErrorValue.division_by_zero); - } - else - { - return new DataObjects.ObjectNumber(0); - } - } - if (Math.Sign(number) != Math.Sign(significance) && number != 0) - { - return new DataObjects.ObjectError(ErrorValue.not_numeric); - } - if (Double.IsInfinity(number / significance)) - { - return new DataObjects.ObjectError(ErrorValue.not_numeric); - } - return new DataObjects.ObjectNumber(Precision.Floor(number, significance)); - } - - public override string ToString() { return "FLOOR"; } - public override string ArgumentsTip { get{ return "FLOOR(number; significance)"; } } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncIf.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncIf.cs deleted file mode 100644 index 0912747df7..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncIf.cs +++ /dev/null @@ -1,61 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs.Functions -{ - internal class PtgFuncIf : PtgFuncFixed - { - public override DataObjects.IDataObject Calculate(LinkedList argv, PreferredResultType result_type) - { - DataObjects.IDataObject condition = null; - DataObjects.IDataObject if_true = new DataObjects.ObjectBoolean (true); - DataObjects.IDataObject if_false = new DataObjects.ObjectBoolean(false); - int argument_index = 0; - foreach (DataObjects.IDataObject arg in argv) - { - switch(++argument_index) - { - case 1: - condition = arg.ConvertIfPossible(PreferredResultType.boolean_type); - break; - case 2: - if_true = arg; - break; - case 3: - if_false = arg; - break; - } - } - if (argument_index != ParametersNum && (ParametersNumMin > argument_index || argument_index > ParametersNumMax)) - { - throw new Events.ReportableException(new Events.InternalError("Wrong parameters number to " + ToString() + " function (" + ParametersNum + " expected)")); - } - - DataObjects.ObjectBoolean sure_condition = condition as DataObjects.ObjectBoolean; - if (null == condition) - { - sure_condition = new DataObjects.ObjectBoolean(false); - } - if(sure_condition == null) - { - if (condition is DataObjects.ObjectError) - { - return condition.ConvertIfPossible(result_type); - } - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - DataObjects.IDataObject result = (sure_condition.Value ? if_true : if_false).ConvertIfPossible(result_type); - if (result.Type == new DataObjects.ObjectEmpty().Type) - result = new DataObjects.ObjectNumber(0); - return result; - } - - public override string ToString() { return "IF"; } - public override int ParametersNum { get { return 3; } } - public override int ParametersNumMin { get { return 0; } } - public override int ParametersNumMax { get { return 3; } } - public override string ArgumentsTip { get { return "IF(logical_test; value_if_true; value_if_false)"; } } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncIfError.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncIfError.cs deleted file mode 100644 index 00b9334d0c..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncIfError.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs.Functions -{ - internal class PtgFuncIfError : PtgFuncFixed - { - public override DataObjects.IDataObject Calculate(LinkedList argv, PreferredResultType result_type) - { - DataObjects.IDataObject value = null; - DataObjects.IDataObject value_if_error = null; - int argument_index = 0; - foreach (DataObjects.IDataObject arg in argv) - { - switch(++argument_index) - { - case 1: - value = arg.ConvertIfPossible(PreferredResultType.value_type); - break; - case 2: - value_if_error = arg; - break; - } - } - if (argument_index != ParametersNum && (ParametersNumMin > argument_index || argument_index > ParametersNumMax)) - { - throw new Events.ReportableException(new Events.InternalError("Wrong parameters number to " + ToString() + " function (" + ParametersNum + " expected)")); - } - - if (null == value || value.Type == new DataObjects.ObjectEmpty().Type) - value = new DataObjects.ObjectNumber(0); - if (null == value_if_error || value_if_error.Type == new DataObjects.ObjectEmpty().Type) - value_if_error = new DataObjects.ObjectNumber(0); - - return (value is DataObjects.ObjectError ? value_if_error : value).ConvertIfPossible(result_type); - } - - public override string ToString() { return "IFERROR"; } - public override int ParametersNum { get { return 2; } } - public override int ParametersNumMin { get { return 0; } } - public override int ParametersNumMax { get { return 2; } } - public override string ArgumentsTip { get { return "IFERROR(value; value_if_error)"; } } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncInt.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncInt.cs deleted file mode 100644 index 844e833057..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncInt.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs.Functions -{ - internal class PtgFuncInt : PtgFuncMathOneArg - { - public override DataObjects.IDataObject DoMath(double num_value) - { - return new DataObjects.ObjectNumber(Math.Floor(num_value)); - } - - public override string ToString() { return "INT"; } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncIs.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncIs.cs deleted file mode 100644 index 8be34124e9..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncIs.cs +++ /dev/null @@ -1,108 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs.Functions -{ - internal abstract class PtgFuncIs : PtgFuncFixed - { - public override DataObjects.IDataObject Calculate(LinkedList argv, PreferredResultType result_type) - { - if (argv.Count != ParametersNum) - { - throw new Events.ReportableException(new Events.InternalError("Wrong parameters number to " + ToString() + " function (" + ParametersNum + " expected)")); - } - return new DataObjects.ObjectBoolean(Is(argv.First.Value)); - } - - public abstract bool Is(DataObjects.IDataObject arg); - public override int ParametersNum { get { return 1; } } - public override int ParametersNumMin { get { return 1; } } - public override int ParametersNumMax { get { return 1; } } - public override string ArgumentsTip { get { return ToString() + "(value)"; } } - } - - internal class PtgFuncIsBlank : PtgFuncIs - { - public override bool Is(DataObjects.IDataObject arg) - { - return arg.ConvertIfPossible(PreferredResultType.value_type) is DataObjects.ObjectEmpty; - } - public override string ToString() { return "ISBLANK"; } - } - - internal class PtgFuncIsErr : PtgFuncIs - { - public override bool Is(DataObjects.IDataObject arg) - { - DataObjects.ObjectError error_arg = arg.ConvertIfPossible(PreferredResultType.value_type) as DataObjects.ObjectError; - return error_arg != null && error_arg.Value != ErrorValue.not_available; - } - public override string ToString() { return "ISERR"; } - } - - internal class PtgFuncIsError : PtgFuncIs - { - public override bool Is(DataObjects.IDataObject arg) - { - return arg.ConvertIfPossible(PreferredResultType.value_type) is DataObjects.ObjectError; - } - public override string ToString() { return "ISERROR"; } - } - - internal class PtgFuncIsLogical : PtgFuncIs - { - public override bool Is(DataObjects.IDataObject arg) - { - return arg.ConvertIfPossible(PreferredResultType.value_type) is DataObjects.ObjectBoolean; - } - public override string ToString() { return "ISLOGICAL"; } - } - - internal class PtgFuncIsNa : PtgFuncIs - { - public override bool Is(DataObjects.IDataObject arg) - { - DataObjects.ObjectError error_arg = arg.ConvertIfPossible(PreferredResultType.value_type) as DataObjects.ObjectError; - return error_arg != null && error_arg.Value == ErrorValue.not_available; - } - public override string ToString() { return "ISNA"; } - } - - internal class PtgFuncIsNontext : PtgFuncIs - { - public override bool Is(DataObjects.IDataObject arg) - { - return !(arg.ConvertIfPossible(PreferredResultType.value_type) is DataObjects.ObjectString); - } - public override string ToString() { return "ISNONTEXT"; } - } - - internal class PtgFuncIsNumber : PtgFuncIs - { - public override bool Is(DataObjects.IDataObject arg) - { - return arg.ConvertIfPossible(PreferredResultType.value_type) is DataObjects.ObjectNumber; - } - public override string ToString() { return "ISNUMBER"; } - } - - internal class PtgFuncIsRef : PtgFuncIs - { - public override bool Is(DataObjects.IDataObject arg) - { - return arg is DataObjects.ObjectReference; - } - public override string ToString() { return "ISREF"; } - } - - internal class PtgFuncIsText : PtgFuncIs - { - public override bool Is(DataObjects.IDataObject arg) - { - return arg.ConvertIfPossible(PreferredResultType.value_type) is DataObjects.ObjectString; - } - public override string ToString() { return "ISTEXT"; } - } - -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncIsEven.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncIsEven.cs deleted file mode 100644 index 3d29a3917f..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncIsEven.cs +++ /dev/null @@ -1,39 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs.Functions -{ - internal class PtgFuncIsEven : PtgFuncFixed - { - public override DataObjects.IDataObject Calculate(LinkedList argv, PreferredResultType result_type) - { - if (argv.Count != ParametersNum) - { - throw new Events.ReportableException(new Events.InternalError("Wrong parameters number to " + ToString() + " function (" + ParametersNum + " expected)")); - } - - DataObjects.IDataObject arg = argv.First.Value.ConvertIfPossible(PreferredResultType.value_type); - if(arg is DataObjects.ObjectError) - { - return arg; - } - if (arg is DataObjects.ObjectBoolean) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - DataObjects.ObjectNumber num_arg = argv.First.Value.ConvertIfPossible(PreferredResultType.numeric_type) as DataObjects.ObjectNumber; - if (num_arg == null) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - return new DataObjects.ObjectBoolean((((int)num_arg.Value) & 1) == 0); - } - - public override string ToString() { return "ISEVEN"; } - public override int ParametersNum { get { return 1; } } - public override int ParametersNumMin { get { return 1; } } - public override int ParametersNumMax { get { return 1; } } - public override string ArgumentsTip { get { return "ISEVEN(number)"; } } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncIsOdd.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncIsOdd.cs deleted file mode 100644 index 3e7bfcf922..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncIsOdd.cs +++ /dev/null @@ -1,39 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs.Functions -{ - internal class PtgFuncIsOdd : PtgFuncFixed - { - public override DataObjects.IDataObject Calculate(LinkedList argv, PreferredResultType result_type) - { - if (argv.Count != ParametersNum) - { - throw new Events.ReportableException(new Events.InternalError("Wrong parameters number to " + ToString() + " function (" + ParametersNum + " expected)")); - } - - DataObjects.IDataObject arg = argv.First.Value.ConvertIfPossible(PreferredResultType.value_type); - if(arg is DataObjects.ObjectError) - { - return arg; - } - if (arg is DataObjects.ObjectBoolean) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - DataObjects.ObjectNumber num_arg = argv.First.Value.ConvertIfPossible(PreferredResultType.numeric_type) as DataObjects.ObjectNumber; - if (num_arg == null) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - return new DataObjects.ObjectBoolean((((int)num_arg.Value) & 1) == 1); - } - - public override string ToString() { return "ISODD"; } - public override int ParametersNum { get { return 1; } } - public override int ParametersNumMin { get { return 1; } } - public override int ParametersNumMax { get { return 1; } } - public override string ArgumentsTip { get { return "ISODD(number)"; } } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncLower.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncLower.cs deleted file mode 100644 index c40497fee6..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncLower.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs.Functions -{ - internal class PtgFuncLower : PtgFuncFixed - { - public override DataObjects.IDataObject Calculate(LinkedList argv, PreferredResultType result_type) - { - foreach (DataObjects.IDataObject arg in argv) - { - DataObjects.IDataObject arg_converted = arg.ConvertIfPossible(PreferredResultType.string_type); - - DataObjects.ObjectString str = arg_converted as DataObjects.ObjectString; - if (str != null) // If string - { - return new DataObjects.ObjectString(str.Value.ToLower()).ConvertIfPossible(result_type); - } - else // If non-numeric - { - if(arg_converted is DataObjects.ObjectError) - { - return arg_converted.ConvertIfPossible(result_type); - } - else - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - } - } - throw new Events.ReportableException(new Events.InternalError("Wrong parameters number to " + ToString() + " function (" + ParametersNum + " expected)")); - } - - public override string ToString() { return "LOWER"; } - public override int ParametersNum { get { return 1; } } - public override int ParametersNumMin { get { return 1; } } - public override int ParametersNumMax { get { return 1; } } - public override string ArgumentsTip { get { return "LOWER(text)"; } } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncMRound.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncMRound.cs deleted file mode 100644 index 8ef585ed66..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncMRound.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs.Functions -{ - internal class PtgFuncMRound : PtgFuncMathTwoArgs - { - public override DataObjects.IDataObject DoMath(double number, double multiple) - { - if (multiple == 0) - { - return new DataObjects.ObjectNumber(0); - } - if (Math.Sign(number) != Math.Sign(multiple) && number != 0) - { - return new DataObjects.ObjectError(ErrorValue.not_numeric); - } - - number = Precision.CorrectPrecisionAfterMultiplyDivision(number + multiple / 2); - - if (Double.IsInfinity(number / multiple)) - { - return new DataObjects.ObjectError(ErrorValue.not_numeric); - } - return new DataObjects.ObjectNumber(Precision.Floor(number, multiple)); - } - - public override string ToString() { return "MROUND"; } - public override string ArgumentsTip { get { return "MROUND(number; multiple)"; } } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncMath.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncMath.cs deleted file mode 100644 index c5204f3f6c..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncMath.cs +++ /dev/null @@ -1,91 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs.Functions -{ - internal abstract class PtgFuncMathOneArg : PtgFuncFixed - { - public override DataObjects.IDataObject Calculate(LinkedList argv, PreferredResultType result_type) - { - foreach (DataObjects.IDataObject arg in argv) - { - DataObjects.IDataObject arg_converted = arg.ConvertIfPossible(PreferredResultType.numeric_type); - DataObjects.ObjectNumber num = arg_converted as DataObjects.ObjectNumber; - if (num != null) // If numeric - { - return DoMath(num.Value).ConvertIfPossible(result_type); - } - else // If non-numeric - { - if(arg_converted is DataObjects.ObjectError) - { - return arg_converted; - } - else - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - } - } - throw new Events.ReportableException(new Events.InternalError("Wrong parameters number to " + ToString() + " function (" + ParametersNum + " expected)")); - } - - public override int ParametersNum { get { return 1; } } - public override int ParametersNumMin { get { return 1; } } - public override int ParametersNumMax { get { return 1; } } - public override string ArgumentsTip { get { return ToString() + "(number)"; } } - - public abstract DataObjects.IDataObject DoMath(double num_value); - } - - internal abstract class PtgFuncMathTwoArgs : PtgFuncFixed - { - public override DataObjects.IDataObject Calculate(LinkedList argv, PreferredResultType result_type) - { - DataObjects.IDataObject arg1 = null; - DataObjects.IDataObject arg2 = null; - int argument_index = 0; - foreach (DataObjects.IDataObject arg in argv) - { - switch (++argument_index) - { - case 1: - arg1 = arg.ConvertIfPossible(PreferredResultType.numeric_type); - break; - case 2: - arg2 = arg.ConvertIfPossible(PreferredResultType.numeric_type); - break; - } - } - if (argument_index != ParametersNum) - { - throw new Events.ReportableException(new Events.InternalError("Wrong parameters number to " + ToString() + " function (" + ParametersNum + " expected)")); - } - DataObjects.ObjectNumber num_value1 = arg1 as DataObjects.ObjectNumber; - DataObjects.ObjectNumber num_value2 = arg2 as DataObjects.ObjectNumber; - if (num_value1 != null && num_value2!= null) // If both numeric - { - return DoMath(num_value1.Value, num_value2.Value).ConvertIfPossible(result_type); - } - else // If non-numeric - { - if (arg1 is DataObjects.ObjectError) - { - return arg1; - } - else if (num_value1 != null && arg2 is DataObjects.ObjectError) - { - return arg2; - } - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - } - - public override int ParametersNum { get { return 2; } } - public override int ParametersNumMin { get { return 2; } } - public override int ParametersNumMax { get { return 2; } } - - public abstract DataObjects.IDataObject DoMath(double num_value1, double num_value2); - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncMax.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncMax.cs deleted file mode 100644 index 7db2408cde..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncMax.cs +++ /dev/null @@ -1,64 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs.Functions -{ - internal class PtgFuncMax : PtgFuncVar - { - public override DataObjects.IDataObject Calculate(LinkedList argv, PreferredResultType result_type) - { - DataObjects.ObjectNumber max = new DataObjects.ObjectNumber(double.MinValue); - foreach (DataObjects.IDataObject arg in argv) - { - DataObjects.ObjectReference range = arg as DataObjects.ObjectReference; - if(range != null) - { - foreach (DataObjects.IDataObject arg_referenced in range) - { - DataObjects.ObjectNumber arg_referenced_num = arg_referenced as DataObjects.ObjectNumber; - if (arg_referenced_num != null) - { - if (arg_referenced_num.Value > max.Value) - { - max = arg_referenced_num; - } - } - else if(arg_referenced is DataObjects.ObjectError) - { - return arg_referenced.ConvertIfPossible(result_type);; - } - } - } - else // If non-reference - { - DataObjects.IDataObject arg_converted = arg.ConvertIfPossible(PreferredResultType.numeric_type); - if(arg_converted is DataObjects.ObjectError) - { - return arg.ConvertIfPossible(result_type);; - } - else if(arg_converted is DataObjects.ObjectString) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - DataObjects.ObjectNumber arg_numeric = arg_converted as DataObjects.ObjectNumber; - if(arg_numeric != null) - { - if (arg_numeric.Value > max.Value) - { - max = arg_numeric; - } - } - } - } - if (max.Value == double.MinValue) - { - max = new DataObjects.ObjectNumber(0); - } - return max.ConvertIfPossible(result_type); - } - - public override string ToString() { return "MAX"; } - public override string ArgumentsTip { get { return "MAX(number1; number2; ...)"; } } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncMin.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncMin.cs deleted file mode 100644 index 43248f7f21..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncMin.cs +++ /dev/null @@ -1,64 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs.Functions -{ - internal class PtgFuncMin : PtgFuncVar - { - public override DataObjects.IDataObject Calculate(LinkedList argv, PreferredResultType result_type) - { - DataObjects.ObjectNumber min = new DataObjects.ObjectNumber(double.MaxValue); - foreach (DataObjects.IDataObject arg in argv) - { - DataObjects.ObjectReference range = arg as DataObjects.ObjectReference; - if(range != null) - { - foreach (DataObjects.IDataObject arg_referenced in range) - { - DataObjects.ObjectNumber arg_referenced_num = arg_referenced as DataObjects.ObjectNumber; - if (arg_referenced_num != null) - { - if(arg_referenced_num.Value < min.Value) - { - min = arg_referenced_num; - } - } - else if(arg_referenced is DataObjects.ObjectError) - { - return arg_referenced.ConvertIfPossible(result_type);; - } - } - } - else // If non-reference - { - DataObjects.IDataObject arg_converted = arg.ConvertIfPossible(PreferredResultType.numeric_type); - if(arg_converted is DataObjects.ObjectError) - { - return arg.ConvertIfPossible(result_type);; - } - else if(arg_converted is DataObjects.ObjectString) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - DataObjects.ObjectNumber arg_numeric = arg_converted as DataObjects.ObjectNumber; - if(arg_numeric != null) - { - if (arg_numeric.Value < min.Value) - { - min = arg_numeric; - } - } - } - } - if (min.Value == double.MaxValue) - { - min = new DataObjects.ObjectNumber(0); - } - return min.ConvertIfPossible(result_type); - } - - public override string ToString() { return "MIN"; } - public override string ArgumentsTip { get { return "MIN(number1; number2; ...)"; } } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncMod.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncMod.cs deleted file mode 100644 index 3882dd0cd6..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncMod.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs.Functions -{ - internal class PtgFuncMod : PtgFuncMathTwoArgs - { - // MOD(n, d) = n - d*INT(n/d) - public override DataObjects.IDataObject DoMath(double number, double divisor) - { - if (divisor == 0) - { - return new DataObjects.ObjectError(ErrorValue.division_by_zero); - } - - double quotient = number / divisor; - - if (quotient < 0 && quotient >= -1e-16) - { - return new DataObjects.ObjectNumber(0); - } - if (Double.IsInfinity(quotient)) - { - return new DataObjects.ObjectNumber(number); - } - - return new DataObjects.ObjectNumber(number - divisor * Math.Floor(quotient)); - } - - public override string ToString() { return "MOD"; } - public override string ArgumentsTip { get { return "MOD(number; divisor)"; } } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncN.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncN.cs deleted file mode 100644 index a6c0d6f294..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncN.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs.Functions -{ - internal class PtgFuncN : PtgFuncFixed - { - public override DataObjects.IDataObject Calculate(LinkedList argv, PreferredResultType result_type) - { - foreach (DataObjects.IDataObject arg in argv) - { - DataObjects.IDataObject value_arg = arg.ConvertIfPossible(PreferredResultType.value_type); - DataObjects.ObjectBoolean arg_bool = value_arg as DataObjects.ObjectBoolean; - if(arg_bool != null) - { - return new DataObjects.ObjectNumber(arg_bool.Value ? 1 : 0); - } - else if (value_arg is DataObjects.ObjectNumber || value_arg is DataObjects.ObjectError) - { - return value_arg; - } - return new DataObjects.ObjectNumber(0); - } - throw new Events.ReportableException(new Events.InternalError("Wrong parameters number to " + ToString() + " function (" + ParametersNum + " expected)")); - } - - public override string ToString() { return "N"; } - public override int ParametersNum { get { return 1; } } - public override int ParametersNumMin { get { return 1; } } - public override int ParametersNumMax { get { return 1; } } - public override string ArgumentsTip { get { return "N(value)"; } } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncNa.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncNa.cs deleted file mode 100644 index f964209bd5..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncNa.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs.Functions -{ - internal class PtgFuncNa : PtgFuncFixed - { - public override DataObjects.IDataObject Calculate(LinkedList argv, PreferredResultType result_type) - { - return new DataObjects.ObjectError(ErrorValue.not_available); - } - - public override string ToString() { return "NA"; } - public override int ParametersNum { get { return 0; } } - public override int ParametersNumMin { get { return 0; } } - public override int ParametersNumMax { get { return 0; } } - public override string ArgumentsTip { get { return "NA()"; } } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncNot.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncNot.cs deleted file mode 100644 index 3b3ded7836..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncNot.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs.Functions -{ - internal class PtgFuncNot : PtgFuncFixed - { - public override DataObjects.IDataObject Calculate(LinkedList argv, PreferredResultType result_type) - { - foreach (DataObjects.IDataObject arg in argv) - { - DataObjects.IDataObject arg_converted = arg.ConvertIfPossible(PreferredResultType.boolean_type); - DataObjects.ObjectBoolean bool_arg = arg_converted as DataObjects.ObjectBoolean; - if (bool_arg != null) // If boolean - { - return new DataObjects.ObjectBoolean(!bool_arg.Value).ConvertIfPossible(result_type); - } - else // If non-numeric - { - if(arg_converted is DataObjects.ObjectError) - { - return arg_converted.ConvertIfPossible(result_type); - } - else - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - } - } - throw new Events.ReportableException(new Events.InternalError("Wrong parameters number to " + ToString() + " function (" + ParametersNum + " expected)")); - } - - public override string ToString() { return "NOT"; } - public override int ParametersNum { get { return 1; } } - public override int ParametersNumMin { get { return 1; } } - public override int ParametersNumMax { get { return 1; } } - public override string ArgumentsTip { get { return "NOT(logical)"; } } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncOdd.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncOdd.cs deleted file mode 100644 index 599da25429..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncOdd.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs.Functions -{ - internal class PtgFuncOdd : PtgFuncMathOneArg - { - public override DataObjects.IDataObject DoMath(double num_value) - { - return new DataObjects.ObjectNumber(num_value == 0 ? 1 : (Math.Ceiling((Math.Abs(num_value) - 1) / 2) * 2 + 1) * Math.Sign(num_value)); - } - - public override string ToString() { return "ODD"; } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncOr.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncOr.cs deleted file mode 100644 index b33a387fd2..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncOr.cs +++ /dev/null @@ -1,82 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs.Functions -{ - internal class PtgFuncOr : PtgFuncVar - { - public override DataObjects.IDataObject Calculate(LinkedList argv, PreferredResultType result_type) - { - DataObjects.ObjectBoolean and_result = null; - foreach (DataObjects.IDataObject arg in argv) - { - DataObjects.ObjectReference range = arg as DataObjects.ObjectReference; - if(range != null) - { - foreach (DataObjects.IDataObject arg_referenced in range) - { - if(arg_referenced is DataObjects.ObjectError) - { - return arg_referenced.ConvertIfPossible(result_type);; - } - else if(arg_referenced is DataObjects.ObjectString || arg_referenced is DataObjects.ObjectEmpty) - { - continue; - } - DataObjects.ObjectBoolean arg_referenced_bool = arg_referenced as DataObjects.ObjectBoolean; - if (arg_referenced_bool == null) - { - arg_referenced_bool = arg_referenced.ConvertIfPossible(PreferredResultType.boolean_type) as DataObjects.ObjectBoolean; - if (arg_referenced_bool == null) - { - continue; - } - } - - if(and_result == null) - { - and_result = arg_referenced_bool; - } - else - { - and_result = new DataObjects.ObjectBoolean(and_result.Value || arg_referenced_bool.Value); - } - } - } - else // If non-reference - { - DataObjects.IDataObject arg_converted = arg.ConvertIfPossible(PreferredResultType.boolean_type); - if(arg_converted is DataObjects.ObjectError) - { - return arg.ConvertIfPossible(result_type);; - } - else if(arg_converted is DataObjects.ObjectString) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - DataObjects.ObjectBoolean arg_boolean = arg_converted as DataObjects.ObjectBoolean; - if (arg_boolean != null) - { - if (and_result == null) - { - and_result = arg_boolean; - } - else - { - and_result = new DataObjects.ObjectBoolean(and_result.Value || arg_boolean.Value); - } - } - } - } - if (and_result == null) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - return and_result.ConvertIfPossible(result_type); - } - - public override string ToString() { return "OR"; } - public override string ArgumentsTip { get { return "OR(logical1; logical2; ...)"; } } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncPi.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncPi.cs deleted file mode 100644 index 9757b82c12..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncPi.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs.Functions -{ - internal class PtgFuncPi : PtgFuncFixed - { - public override DataObjects.IDataObject Calculate(LinkedList argv, PreferredResultType result_type) - { - return new DataObjects.ObjectNumber(3.14159265358979).ConvertIfPossible(result_type); - } - - public override string ToString() { return "PI"; } - public override int ParametersNum { get { return 0; } } - public override int ParametersNumMin { get { return 0; } } - public override int ParametersNumMax { get { return 0; } } - public override string ArgumentsTip { get { return "PI()"; } } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncPower.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncPower.cs deleted file mode 100644 index 73cdc3c821..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncPower.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs.Functions -{ - internal class PtgFuncPower : PtgFuncFixed - { - public override DataObjects.IDataObject Calculate(LinkedList argv, PreferredResultType result_type) - { - DataObjects.IDataObject number = null; - DataObjects.IDataObject power = null; - int argument_index = 0; - foreach (DataObjects.IDataObject arg in argv) - { - switch (++argument_index) - { - case 1: - number = arg.ConvertIfPossible(PreferredResultType.numeric_type); - break; - case 2: - power = arg.ConvertIfPossible(PreferredResultType.numeric_type); - break; - } - } - if (argument_index != ParametersNum) - { - throw new Events.ReportableException(new Events.InternalError("Wrong parameters number to " + ToString() + " function (" + ParametersNum + " expected)")); - } - - return number.PerformBinaryOperation(power, BinOpCalc.Arithmetic.PowerCalculator).ConvertIfPossible(result_type); - } - - public override string ToString() { return "POWER"; } - public override int ParametersNum { get { return 2; } } - public override int ParametersNumMin { get { return 2; } } - public override int ParametersNumMax { get { return 2; } } - public override string ArgumentsTip { get { return "POWER(number; power)"; } } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncRept.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncRept.cs deleted file mode 100644 index 764ab20851..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncRept.cs +++ /dev/null @@ -1,68 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs.Functions -{ - internal class PtgFuncRept : PtgFuncFixed - { - public override DataObjects.IDataObject Calculate(LinkedList argv, PreferredResultType result_type) - { - DataObjects.IDataObject text_arg = null; - DataObjects.IDataObject number_of_times_arg = null; - int argument_index = 0; - foreach (DataObjects.IDataObject arg in argv) - { - switch (++argument_index) - { - case 1: - text_arg = arg.ConvertIfPossible(PreferredResultType.string_type); - break; - case 2: - number_of_times_arg = arg.ConvertIfPossible(PreferredResultType.numeric_type); - break; - } - } - if (argument_index != ParametersNum) - { - throw new Events.ReportableException(new Events.InternalError("Wrong parameters number to " + ToString() + " function (" + ParametersNum + " expected)")); - } - - if (text_arg is DataObjects.ObjectError) - { - return text_arg; - } - if(number_of_times_arg is DataObjects.ObjectError) - { - return number_of_times_arg; - } - - DataObjects.ObjectString text = text_arg as DataObjects.ObjectString; - DataObjects.ObjectNumber number_of_times = number_of_times_arg as DataObjects.ObjectNumber; - if (text == null || number_of_times == null) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - int num = (int)number_of_times.Value; - - if (number_of_times.Value < 0 || text.Value.Length * num > 32767) - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - - string res_line = ""; - for(int i = 0; i < num; ++i) - { - res_line += text.Value; - } - - return new DataObjects.ObjectString(res_line).ConvertIfPossible(result_type); - } - - public override string ToString() { return "REPT"; } - public override int ParametersNum { get { return 2; } } - public override int ParametersNumMin { get { return 2; } } - public override int ParametersNumMax { get { return 2; } } - public override string ArgumentsTip { get { return "REPT(text; number_of_times)"; } } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncRound.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncRound.cs deleted file mode 100644 index 96d602220c..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncRound.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs.Functions -{ - internal class PtgFuncRound : PtgFuncMathTwoArgs - { - public override DataObjects.IDataObject DoMath(double number, double num_digits) - { - if(num_digits > Precision.ExcelMaxExponent) - { - if (Math.Abs(number) < 1 || num_digits < 1e10) // The values are obtained experimentally - { - return new DataObjects.ObjectNumber(number); - } - return new DataObjects.ObjectNumber(0); - } - else if (num_digits < Precision.ExcelMinExponent) - { - if (Math.Abs(number) < 0.01) // The values are obtained experimentally - { - return new DataObjects.ObjectNumber(number); - } - return new DataObjects.ObjectNumber(0); - } - - double significance = Precision.SignZeroPositive(number) * Math.Pow(10, -Math.Truncate(num_digits)); - - number += significance / 2; - - if (Double.IsInfinity(number / significance)) - { - return new DataObjects.ObjectNumber(number); - } - return new DataObjects.ObjectNumber(Precision.Floor(number, significance)); - } - - public override string ToString() { return "ROUND"; } - public override string ArgumentsTip { get{ return "ROUND(number; num_digits)"; } } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncRoundDown.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncRoundDown.cs deleted file mode 100644 index 4605832223..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncRoundDown.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs.Functions -{ - internal class PtgFuncRoundDown : PtgFuncMathTwoArgs - { - public override DataObjects.IDataObject DoMath(double number, double num_digits) - { - if(num_digits > Precision.ExcelMaxExponent) - { - if (Math.Abs(number) >= 1e-100 || num_digits <= 98303) // The values are obtained experimentally - { - return new DataObjects.ObjectNumber(number); - } - return new DataObjects.ObjectNumber(0); - } - else if (num_digits < Precision.ExcelMinExponent) - { - if (Math.Abs(number) >= 1e100) // The values are obtained experimentally - { - return new DataObjects.ObjectNumber(number); - } - return new DataObjects.ObjectNumber(0); - } - - double significance = Math.Pow(10, -Math.Truncate(num_digits)); - - if (Double.IsInfinity(number / significance)) - { - return new DataObjects.ObjectNumber(number); - } - return new DataObjects.ObjectNumber(Precision.Floor(number, significance)); - } - - public override string ToString() { return "ROUNDDOWN"; } - public override string ArgumentsTip { get{ return "ROUNDDOWN(number; num_digits)"; } } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncRoundUp.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncRoundUp.cs deleted file mode 100644 index f40e915157..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncRoundUp.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs.Functions -{ - internal class PtgFuncRoundUp : PtgFuncMathTwoArgs - { - public override DataObjects.IDataObject DoMath(double number, double num_digits) - { - if(num_digits > Precision.ExcelMaxExponent) - { - if (Math.Abs(number) >= 1e-100 || num_digits <= 98303) // The values are obtained experimentally - { - return new DataObjects.ObjectNumber(number); - } - return new DataObjects.ObjectNumber(0); - } - else if (num_digits < Precision.ExcelMinExponent) - { - if (Math.Abs(number) >= 1e100 || number == 0) // The values are obtained experimentally - { - return new DataObjects.ObjectNumber(number); - } - return new DataObjects.ObjectError(ErrorValue.not_numeric); - } - - double significance = Precision.SignZeroPositive(number) * Math.Pow(10, -Math.Truncate(num_digits)); - - if (Double.IsInfinity(number / significance)) - { - return new DataObjects.ObjectNumber(number); - } - return new DataObjects.ObjectNumber(Precision.Ceiling(number, significance)); - } - - public override string ToString() { return "ROUNDUP"; } - public override string ArgumentsTip { get{ return "ROUNDUP(number; num_digits)"; } } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncSign.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncSign.cs deleted file mode 100644 index e259fbd0ec..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncSign.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs.Functions -{ - internal class PtgFuncSign : PtgFuncMathOneArg - { - public override DataObjects.IDataObject DoMath(double num_value) - { - return new DataObjects.ObjectNumber(Math.Sign(num_value)); - } - - public override string ToString() { return "SIGN"; } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncSin.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncSin.cs deleted file mode 100644 index 000619fe39..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncSin.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs.Functions -{ - internal class PtgFuncSin : PtgFuncMathOneArg - { - public override DataObjects.IDataObject DoMath(double num_value) - { - return new DataObjects.ObjectNumber(Math.Sin(num_value)); - } - - public override string ToString() { return "SIN"; } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncSqrt.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncSqrt.cs deleted file mode 100644 index 0241accdc8..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncSqrt.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs.Functions -{ - internal class PtgFuncSqrt : PtgFuncMathOneArg - { - public override DataObjects.IDataObject DoMath(double num_value) - { - if (num_value < 0) - { - return new DataObjects.ObjectError(ErrorValue.not_numeric); - } - return new DataObjects.ObjectNumber(Math.Sqrt(num_value)); - } - - public override string ToString() { return "SQRT"; } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncSum.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncSum.cs deleted file mode 100644 index e17fea4259..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncSum.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs.Functions -{ - internal class PtgFuncSum : PtgFuncVar - { - public override DataObjects.IDataObject Calculate(LinkedList argv, PreferredResultType result_type) - { - DataObjects.IDataObject sum = new DataObjects.ObjectNumber(0); - foreach (DataObjects.IDataObject arg in argv) - { - DataObjects.ObjectReference range = arg as DataObjects.ObjectReference; - if(range != null) - { - foreach (DataObjects.IDataObject arg_referenced in range) - { - if (arg_referenced is DataObjects.ObjectNumber || arg_referenced is DataObjects.ObjectError) - { - sum = sum.PerformBinaryOperation(arg_referenced, BinOpCalc.Arithmetic.AddCalculator); - } - } - } - else // If non-reference - { - sum = sum.PerformBinaryOperation(arg.ConvertIfPossible(PreferredResultType.numeric_type), BinOpCalc.Arithmetic.AddCalculator); - } - } - - return sum.ConvertIfPossible(result_type); - } - - public override string ToString() { return "SUM"; } - public override string ArgumentsTip { get { return "SUM(number1; number2; ...)"; } } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncT.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncT.cs deleted file mode 100644 index f423b0ea30..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncT.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs.Functions -{ - internal class PtgFuncT : PtgFuncFixed - { - public override DataObjects.IDataObject Calculate(LinkedList argv, PreferredResultType result_type) - { - foreach (DataObjects.IDataObject arg in argv) - { - DataObjects.IDataObject value_arg = arg.ConvertIfPossible(PreferredResultType.value_type); - if (value_arg is DataObjects.ObjectString || value_arg is DataObjects.ObjectError) - { - return value_arg; - } - return new DataObjects.ObjectString(""); - } - throw new Events.ReportableException(new Events.InternalError("Wrong parameters number to " + ToString() + " function (" + ParametersNum + " expected)")); - } - - public override string ToString() { return "T"; } - public override int ParametersNum { get { return 1; } } - public override int ParametersNumMin { get { return 1; } } - public override int ParametersNumMax { get { return 1; } } - public override string ArgumentsTip { get { return "T(value)"; } } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncTan.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncTan.cs deleted file mode 100644 index 5572de8cf0..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncTan.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs.Functions -{ - internal class PtgFuncTan : PtgFuncMathOneArg - { - public override DataObjects.IDataObject DoMath(double num_value) - { - return new DataObjects.ObjectNumber(Math.Tan(num_value)); - } - - public override string ToString() { return "TAN"; } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncTrue.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncTrue.cs deleted file mode 100644 index 96c0a63449..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncTrue.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs.Functions -{ - internal class PtgFuncTrue : PtgFuncFixed - { - public override DataObjects.IDataObject Calculate(LinkedList argv, PreferredResultType result_type) - { - return new DataObjects.ObjectBoolean(true).ConvertIfPossible(result_type); - } - - public override string ToString() { return "TRUE"; } - public override int ParametersNum { get { return 0; } } - public override int ParametersNumMin { get { return 0; } } - public override int ParametersNumMax { get { return 0; } } - public override string ArgumentsTip { get { return "TRUE()"; } } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncType.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncType.cs deleted file mode 100644 index 03c7f1c12a..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncType.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs.Functions -{ - internal class PtgFuncType : PtgFuncFixed - { - public override DataObjects.IDataObject Calculate(LinkedList argv, PreferredResultType result_type) - { - if (argv.Count != ParametersNum) - { - throw new Events.ReportableException(new Events.InternalError("Wrong parameters number to " + ToString() + " function (" + ParametersNum + " expected)")); - } - - DataObjects.IDataObject arg = argv.First.Value.ConvertIfPossible(PreferredResultType.value_type); - - if (arg is DataObjects.ObjectNumber || arg is DataObjects.ObjectEmpty) - { - return new DataObjects.ObjectNumber(1); - } - if (arg is DataObjects.ObjectString) - { - return new DataObjects.ObjectNumber(2); - } - if (arg is DataObjects.ObjectBoolean) - { - return new DataObjects.ObjectNumber(4); - } - if (arg is DataObjects.ObjectError) - { - return new DataObjects.ObjectNumber(16); - } -/* TODO: unlock when PtgArray is implemented - if (arg is PtgArray) - { - return new DataObjects.ObjectNumber(64); - } -*/ - throw new Events.ReportableException(new Events.InternalError("Argument of unknown type passed as a parameter to TYPE(value)")); - } - - public override string ToString() { return "TYPE"; } - public override int ParametersNum { get { return 1; } } - public override int ParametersNumMin { get { return 1; } } - public override int ParametersNumMax { get { return 1; } } - public override string ArgumentsTip { get { return "TYPE(value)"; } } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncUnsupported.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncUnsupported.cs deleted file mode 100644 index 534c3a6f6f..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncUnsupported.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs.Functions -{ - internal class PtgFuncUnsupported : PtgFuncVar - { - public PtgFuncUnsupported(string func_name) - { - this.func_name = func_name; - } - - public override DataObjects.IDataObject Calculate(LinkedList argv, PreferredResultType result_type) - { - return new DataObjects.ObjectError(ErrorValue.unsupported_function); - } - - public override string ToString() { return func_name; } - public override string ArgumentsTip { get { return func_name + "(...)"; } } - - private string func_name; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncUpper.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncUpper.cs deleted file mode 100644 index 52721df13f..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Functions/PtgFuncUpper.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs.Functions -{ - internal class PtgFuncUpper : PtgFuncFixed - { - public override DataObjects.IDataObject Calculate(LinkedList argv, PreferredResultType result_type) - { - foreach (DataObjects.IDataObject arg in argv) - { - DataObjects.IDataObject arg_converted = arg.ConvertIfPossible(PreferredResultType.string_type); - - DataObjects.ObjectString str = arg_converted as DataObjects.ObjectString; - if (str != null) // If string - { - return new DataObjects.ObjectString(str.Value.ToUpper()).ConvertIfPossible(result_type); - } - else // If non-numeric - { - if(arg_converted is DataObjects.ObjectError) - { - return arg_converted.ConvertIfPossible(result_type); - } - else - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - } - } - throw new Events.ReportableException(new Events.InternalError("Wrong parameters number to " + ToString() + " function (" + ParametersNum + " expected)")); - } - - public override string ToString() { return "UPPER"; } - public override int ParametersNum { get { return 1; } } - public override int ParametersNumMin { get { return 1; } } - public override int ParametersNumMax { get { return 1; } } - public override string ArgumentsTip { get { return "UPPER(text)"; } } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/OperandPtg.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/OperandPtg.cs deleted file mode 100644 index 586fbb6cd5..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/OperandPtg.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs -{ - internal abstract class OperandPtg : Ptg - { - public override string Assemble(ref LinkedList.Enumerator ptgs_enum) - { - return ToString(); - } - } - - internal interface IRefOperandPtg - { - OperandPtg Shift(Cells.Offset offset, Worksheet affected_sheet); - Cells.CellRange GetReferredRange(); - bool ReferencesCellOrRange(ISubject subject); - OperandPtg RemoveRange(Cells.CellRange removed_range, Worksheet removed_range_sheet); - OperandPtg ResizeInsertionAffected(Cells.CellRange moved_rows_range, Cells.Offset offset, Worksheet affected_sheet); - bool IsRelative { get; } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/OperandPtg3D.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/OperandPtg3D.cs deleted file mode 100644 index 07d5c817b3..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/OperandPtg3D.cs +++ /dev/null @@ -1,123 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs -{ - internal abstract class OperandPtgRef3D : OperandPtg, IHavingSubjectPtg - { - public OperandPtgRef3D(Worksheet ws_from, Worksheet ws_to) - { - WorksheetFrom = ws_from; - WorksheetTo = ws_to; - parent_book = ws_from.Workbook; - this.manager = parent_book.ValuesUpdateManager; - alien_ws_subjects = new List(); - foreach (Worksheet ws_current in parent_book.WorksheetsN(ws_from.Index, ws_to.Index)) - { - alien_ws_subjects.Add(ws_current.Subject); - } - } - - public OperandPtg RemoveWorksheet(Worksheet removed_sheet) - { - int from_index = WorksheetFrom.Index; - int to_index = WorksheetTo.Index; - int removed_sheet_index = removed_sheet.Index; - if (from_index <= removed_sheet_index && removed_sheet_index <= to_index) - { - if(from_index == removed_sheet_index || to_index == removed_sheet_index) - { - IObserver former_observer = UnregisterDependency(); - - if (from_index == to_index) - { - return new PtgErr(ErrorValue.bad_reference); // Recalculation is necessary and possible right now - } - if (from_index == removed_sheet_index) - { - bool next_has_found = false; - foreach (Worksheet ws in parent_book.WorksheetsN(from_index + 1, to_index)) - { - WorksheetFrom = ws; - next_has_found = true; - break; - } - if (!next_has_found) - { - return new PtgErr(ErrorValue.bad_reference); // Recalculation is necessary and possible right now - } - } - else if (to_index == removed_sheet_index) - { - bool last_has_found = false; - foreach (Worksheet ws in parent_book.WorksheetsN(from_index, to_index - 1)) - { - WorksheetTo = ws; - last_has_found = true; - } - - if (!last_has_found) - { - return new PtgErr(ErrorValue.bad_reference); // Recalculation is necessary and possible right now - } - } - // Store Subject in CellSubject storage - alien_ws_subjects.Remove(removed_sheet.Subject); - - if (former_observer != null) - { - RegisterDependency(former_observer); - } - return this; // Recalculation is necessary and possible right now - } - return null; // Recalculation must be delayed (impossible right now) - } - return this; // Recalculation is no necessary - } - - #region IHavingSubjectPtg Members - - public virtual IObserver UnregisterDependency() - { - if (observer != null) - { - foreach (WorksheetSubject ws_subj in alien_ws_subjects) - { - manager.Unregister(ws_subj, observer); - } - IObserver former_observer = observer; - observer = null; - return former_observer; - } - return null; - } - - public virtual void RegisterDependency(IObserver observer) - { - this.observer = observer; - // Register in DAG manager - foreach (WorksheetSubject ws_subj in alien_ws_subjects) - { - manager.Register(ws_subj, observer); - } - } - - #endregion - - - public string ToString3DPart() - { - return Cells.CellRange3D.ToString3DPart(WorksheetFrom, WorksheetTo); - } - - private Workbook parent_book; - private IObserver observer; - private ValuesUpdateManager manager; - - private List alien_ws_subjects; - - public Worksheet WorksheetFrom { get; private set; } - public Worksheet WorksheetTo { get; private set; } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/OperatorPtg.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/OperatorPtg.cs deleted file mode 100644 index da0fd10456..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/OperatorPtg.cs +++ /dev/null @@ -1,58 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs -{ - internal abstract class OperatorPtg : Ptg - { - /// - /// Must be overridden for right associative operators - /// - /// Associativity of the operator - public virtual bool isRightAssociative() - { - return false; - } - - public abstract int Priority { get; } - } - - internal abstract class BinOperatorPtg : OperatorPtg - { - public override string Assemble(ref LinkedList.Enumerator ptgs_enum) - { - if (!ptgs_enum.MoveNext()) - { - throw new Events.ReportableException(new Events.FormulaFormatError("Second argument of operator \"" + ToString() + "\" was not found")); - } - string arg2 = ptgs_enum.Current.Assemble(ref ptgs_enum); - if (!ptgs_enum.MoveNext()) - { - throw new Events.ReportableException(new Events.FormulaFormatError("First argument of operator \"" + ToString() + "\" was not found")); - } - string arg1 = ptgs_enum.Current.Assemble(ref ptgs_enum); - - return arg1 + ToString() + arg2; - } - - public override DataObjects.IDataObject Calculate(ref LinkedList.Enumerator ptgs_enum, PreferredResultType result_type) - { - if (!ptgs_enum.MoveNext()) - { - throw new Events.ReportableException(new Events.FormulaFormatError("Second argument of operator \"" + ToString() + "\" was not found")); - } - DataObjects.IDataObject arg2 = ptgs_enum.Current.Calculate(ref ptgs_enum, OperandsPreferredType); - if (!ptgs_enum.MoveNext()) - { - throw new Events.ReportableException(new Events.FormulaFormatError("First argument of operator \"" + ToString() + "\" was not found")); - } - DataObjects.IDataObject arg1 = ptgs_enum.Current.Calculate(ref ptgs_enum, OperandsPreferredType); - - return arg1.PerformBinaryOperation(arg2, Calculator).ConvertIfPossible(result_type); - } - - public abstract BinOpCalc.IFullBinaryOpDispatcher Calculator { get; } - public abstract PreferredResultType OperandsPreferredType { get; } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Ptg.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Ptg.cs deleted file mode 100644 index 4bc56e9a31..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/Ptg.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs -{ - internal abstract class Ptg - { - public abstract DataObjects.IDataObject Calculate(ref LinkedList.Enumerator ptgs_enum, PreferredResultType result_type); - public abstract string Assemble(ref LinkedList.Enumerator ptgs_enum); - } - - internal interface IHavingSubjectPtg - { - IObserver UnregisterDependency(); - void RegisterDependency(IObserver observer); - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgAdd.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgAdd.cs deleted file mode 100644 index b182126b87..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgAdd.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.RegularExpressions; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs -{ - internal class PtgAdd : BinOperatorPtg - { - private static Regex rx_plus = new Regex("\\G *\\+ *"); - public static bool Extract(string formula, ref int start_pos, bool operand_expected) - { - if (!operand_expected) - { - Match match = rx_plus.Match(formula, start_pos); - if (match.Success) - { - start_pos += match.Length; - return true; - } - } - return false; - } - - public override BinOpCalc.IFullBinaryOpDispatcher Calculator { get { return BinOpCalc.Arithmetic.AddCalculator; } } - - public override PreferredResultType OperandsPreferredType { get { return PreferredResultType.numeric_type; } } - - public override string ToString() - { - return "+"; - } - - public override int Priority { get { return 25; } } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgArea.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgArea.cs deleted file mode 100644 index 7a1492dffd..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgArea.cs +++ /dev/null @@ -1,211 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.RegularExpressions; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs -{ - internal class PtgArea : OperandPtg, IRefOperandPtg, IHavingSubjectPtg - { - private PtgArea(Cells.CellRangeRel range_ref, Worksheet parent_sheet) - { - this.parent_sheet = parent_sheet; - this.manager = parent_sheet.Workbook.ValuesUpdateManager; - alien_range_ref = range_ref; - - // Store Subject in CellSubject storage - alien_range_subject = parent_sheet.SubjectsStorage.GetRangeSubjectOrCreate(alien_range_ref.ToCellRange()); - } - - public static OperandPtg Create(string ref_str, Cells.Offset offset, Worksheet parent_sheet) - { - if (parent_sheet == null) - { - throw new Events.ReportableException(new Events.FormulaFormatError("It is prohibited to use range references without any certain sheet specified in Defined Names")); - } - - Cells.CellRangeRel range_ref = new Cells.CellRangeRel(ref_str, parent_sheet.Workbook) + offset; - if (range_ref != Cells.CellRangeRel.Empty) - { - return new PtgArea(range_ref, parent_sheet); - } - else - { - return new PtgErr(ErrorValue.bad_reference); - } - } - - #region IHavingSubjectPtg Members - - /// - /// - /// - /// former observer if it is registered - public IObserver UnregisterDependency() - { - if (observer != null) - { - manager.Unregister(alien_range_subject, observer); - IObserver former_observer = observer; - observer = null; - return former_observer; - } - return null; - // we do not remove cell_subject from SubjectsStorage because another formula may reference the same cell - } - - public void RegisterDependency(IObserver observer) - { - this.observer = observer; - // Register in DAG manager - manager.Register(alien_range_subject, observer); - } - - #endregion - private static Regex rx_range = new Regex("\\G\\$?[A-Za-z]+\\$?\\d+:\\$?[A-Za-z]+\\$?\\d+"); - private static Regex rx_cols = new Regex("\\G\\$?[A-Za-z]+:\\$?[A-Za-z]+"); - private static Regex rx_rows = new Regex("\\G\\$?\\d+:\\$?\\d+"); - public static bool Extract(string formula, ref int start_pos, out string operand_str) - { - Match match = rx_range.Match(formula, start_pos); - if ((match = rx_range.Match(formula, start_pos)).Success || - (match = rx_cols.Match(formula, start_pos)).Success || - (match = rx_rows.Match(formula, start_pos)).Success) - { - start_pos += match.Length; - operand_str = match.Value; - return true; - } - operand_str = null; - return false; - } - - public override DataObjects.IDataObject Calculate(ref LinkedList.Enumerator ptgs_enum, PreferredResultType result_type) - { - Cells.CellRange range = alien_range_ref.ToCellRange(); - if (result_type != PreferredResultType.reference_type && result_type != PreferredResultType.as_is) - { - if(range.IsSingleCell) - { - Cells.Cell cell = range.TopLeft; - CellItem cell_subject = parent_sheet.SubjectsStorage.GetCellItemOrCreate(cell); - return cell_subject.GetValue().ConvertIfPossible(result_type); - } - else - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - } - else - { - return new DataObjects.ObjectReference(range, parent_sheet, observer); - } - } - - #region IRefOperandPtg Members - - public Cells.CellRange GetReferredRange() - { - return alien_range_ref.ToCellRange(); - } - - public bool ReferencesCellOrRange(ISubject subject) - { - return alien_range_subject.CompareTo(subject) == 0; - } - - public OperandPtg Shift(Cells.Offset offset, Worksheet affected_sheet) - { - if (parent_sheet == affected_sheet) - { - IObserver former_observer = UnregisterDependency(); // Need this because the subject changes its key and the DAG tree become wrong - - alien_range_ref = alien_range_ref.Shift(offset); - if (alien_range_ref == Cells.CellRangeRel.Empty) - { - return new PtgErr(ErrorValue.bad_reference); - } - - // Store Subject in CellSubject storage - alien_range_subject = parent_sheet.SubjectsStorage.GetRangeSubjectOrCreate(alien_range_ref.ToCellRange()); - - if (former_observer != null) - { - RegisterDependency(former_observer); - } - return this; - } - return null; - } - - public OperandPtg RemoveRange(Cells.CellRange removed_range, Worksheet removed_range_sheet) - { - if(parent_sheet == removed_range_sheet) - { - IObserver former_observer = UnregisterDependency(); // Need this because the subject changes its key and the DAG tree become wrong - - Cells.CellRangeRel new_range_rel = alien_range_ref.Cut(removed_range); - if (new_range_rel == Cells.CellRangeRel.Empty) - { - return new PtgErr(ErrorValue.bad_reference); - } - alien_range_ref = new_range_rel; - - // Store Subject in CellSubject storage - alien_range_subject = parent_sheet.SubjectsStorage.GetRangeSubjectOrCreate(alien_range_ref.ToCellRange()); - - if (former_observer != null) - { - RegisterDependency(former_observer); - } - return this; - } - return null; - } - - public OperandPtg ResizeInsertionAffected(Cells.CellRange moved_range, Cells.Offset offset, Worksheet affected_sheet) - { - if (parent_sheet == affected_sheet) - { - IObserver former_observer = UnregisterDependency(); // Need this because the subject changes its key and the DAG tree become wrong - - Cells.CellRange cell_range = alien_range_ref.ToCellRange(); - - if (cell_range.IsBoundaryIntersectedWith(moved_range)) - { - alien_range_ref = alien_range_ref.Resize(offset); - } - - // Store Subject in CellSubject storage - alien_range_subject = parent_sheet.SubjectsStorage.GetRangeSubjectOrCreate(alien_range_ref.ToCellRange()); - - if (former_observer != null) - { - RegisterDependency(former_observer); - } - return this; - } - return null; - } - - public bool IsRelative - { - get { return alien_range_ref.IsRelative; } - } - - #endregion - - public override string ToString() - { - return alien_range_ref.ToString(); - } - - private Cells.CellRangeRel alien_range_ref; // The referred cells - private RangeSubject alien_range_subject; - - private IObserver observer; - - private ValuesUpdateManager manager; - private Worksheet parent_sheet; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgArea3D.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgArea3D.cs deleted file mode 100644 index 370fbadb7c..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgArea3D.cs +++ /dev/null @@ -1,212 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.RegularExpressions; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs -{ - internal class PtgArea3D : OperandPtgRef3D, IRefOperandPtg - { - private PtgArea3D(Cells.CellRangeRel range_ref, Worksheet ws_from, Worksheet ws_to) - : base(ws_from, ws_to) - { - Workbook parent_book = ws_from.Workbook; - manager = parent_book.ValuesUpdateManager; - alien_range_ref = range_ref; - - // Store Subjects in CellSubject storages - Cells.CellRange alien_cell_range = alien_range_ref.ToCellRange(); - alien_range_subjects = new List(); - foreach (Worksheet ws_current in parent_book.WorksheetsN(ws_from.Index, ws_to.Index)) - { - alien_range_subjects.Add(ws_current.SubjectsStorage.GetRangeSubjectOrCreate(alien_cell_range)); - } - } - - public static OperandPtg Create(string ref_str, Cells.Offset offset, Worksheet ws_from, Worksheet ws_to) - { - Cells.CellRangeRel range_ref = new Cells.CellRangeRel(ref_str, ws_from.Workbook) + offset; - if (range_ref != Cells.CellRangeRel.Empty) - { - return new PtgArea3D(range_ref, ws_from, ws_to); - } - else - { - return new PtgRefErr3D(ErrorValue.bad_reference, ws_from, ws_to); - } - - } - - #region IHavingSubjectPtg Members - - /// - /// - /// - /// former observer if it is registered - public override IObserver UnregisterDependency() - { - if (observer != null) - { - foreach (RangeSubject range_subj in alien_range_subjects) - { - manager.Unregister(range_subj, observer); - } - base.UnregisterDependency(); - IObserver former_observer = observer; - observer = null; - return former_observer; - } - return null; - // we do not remove cell_subject from SubjectsStorage because another formula may reference the same cell - } - - public override void RegisterDependency(IObserver observer) - { - this.observer = observer; - // Register in DAG manager - foreach (RangeSubject range_subj in alien_range_subjects) - { - manager.Register(range_subj, observer); - } - base.RegisterDependency(observer); - } - - #endregion - - public override DataObjects.IDataObject Calculate(ref LinkedList.Enumerator ptgs_enum, PreferredResultType result_type) - { - Cells.CellRange3D range3D = new Cells.CellRange3D(alien_range_ref.ToCellRange(), WorksheetFrom, WorksheetTo); - if (result_type != PreferredResultType.reference_type && result_type != PreferredResultType.as_is) - { - if (range3D.IsSingleCell) - { - Cells.Cell cell = range3D.CellRange.TopLeft; - CellItem cell_subject = WorksheetFrom.SubjectsStorage.GetCellItemOrCreate(cell); - return cell_subject.GetValue().ConvertIfPossible(result_type); - } - else - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - } - else - { - return new DataObjects.ObjectReference(range3D, observer); - } - } - - #region IRefOperandPtg Members - - public Cells.CellRange GetReferredRange() - { - return alien_range_ref.ToCellRange(); - } - - public bool ReferencesCellOrRange(ISubject subject) - { - foreach (RangeSubject range_subj in alien_range_subjects) - { - if (range_subj.CompareTo(subject) == 0) - { - return true; - } - } - return false; - } - - public OperandPtg Shift(Cells.Offset offset, Worksheet affected_sheet) - { - if (WorksheetFrom == WorksheetTo && WorksheetFrom == affected_sheet) - { - IObserver former_observer = UnregisterDependency(); // Need this because the subject changes its key and the DAG tree become wrong - - alien_range_ref = alien_range_ref.Shift(offset); - if (alien_range_ref == Cells.CellRangeRel.Empty) - { - return new PtgRefErr3D(ErrorValue.bad_reference, WorksheetFrom, WorksheetTo); - } - - // Store Subject in CellSubject storage - alien_range_subjects.Clear(); - alien_range_subjects.Add(affected_sheet.SubjectsStorage.GetRangeSubjectOrCreate(alien_range_ref.ToCellRange())); - - if (former_observer != null) - { - RegisterDependency(former_observer); - } - return this; - } - return null; - } - - public OperandPtg RemoveRange(Cells.CellRange removed_range, Worksheet removed_range_sheet) - { - if (WorksheetFrom == WorksheetTo && WorksheetFrom == removed_range_sheet) - { - IObserver former_observer = UnregisterDependency(); // Need this because the subject changes its key and the DAG tree become wrong - - Cells.CellRangeRel new_range_rel = alien_range_ref.Cut(removed_range); - if (new_range_rel == Cells.CellRangeRel.Empty) - { - return new PtgRefErr3D(ErrorValue.bad_reference, WorksheetFrom, WorksheetTo); - } - alien_range_ref = new_range_rel; - - // Store Subject in CellSubject storage - alien_range_subjects.Clear(); - alien_range_subjects.Add(removed_range_sheet.SubjectsStorage.GetRangeSubjectOrCreate(alien_range_ref.ToCellRange())); - - if (former_observer != null) - { - RegisterDependency(former_observer); - } - return this; - } - return null; - } - - public OperandPtg ResizeInsertionAffected(Cells.CellRange moved_range, Cells.Offset offset, Worksheet affected_sheet) - { - if (WorksheetFrom == WorksheetTo && WorksheetFrom == affected_sheet) - { - IObserver former_observer = UnregisterDependency(); // Need this because the subject changes its key and the DAG tree become wrong - - Cells.CellRange cell_range = alien_range_ref.ToCellRange(); - - if (cell_range.IsBoundaryIntersectedWith(moved_range)) - { - alien_range_ref = alien_range_ref.Resize(offset); - } - - // Store Subject in CellSubject storage - alien_range_subjects.Clear(); - alien_range_subjects.Add(affected_sheet.SubjectsStorage.GetRangeSubjectOrCreate(alien_range_ref.ToCellRange())); - - if (former_observer != null) - { - RegisterDependency(former_observer); - } - return this; - } - return null; - } - - public bool IsRelative - { - get { return alien_range_ref.IsRelative; } - } - - #endregion - - public override string ToString() - { - return ToString3DPart() + alien_range_ref.ToString(); - } - - private Cells.CellRangeRel alien_range_ref; // The referred cells - private List alien_range_subjects; - - private IObserver observer; - private ValuesUpdateManager manager; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgBool.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgBool.cs deleted file mode 100644 index cc2030f043..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgBool.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.RegularExpressions; -using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs -{ - internal class PtgBool : OperandPtg - { - public PtgBool(string value) - { - this.value = new DataObjects.ObjectBoolean(value); - } - private static Regex rx_num = new Regex("\\G(TRUE|FALSE)([-+*/^&%<=>: ;),]|$)", RegexOptions.IgnoreCase); // searched case insensitive - public static bool Extract(string formula, ref int start_pos, out string operand_str) - { - Match match = rx_num.Match(formula, start_pos); - if (match.Success) - { - GroupCollection groups = match.Groups; - if (groups.Count >= 2) - { - start_pos += groups[1].Length; - operand_str = groups[1].Value; - return true; - } - } - operand_str = null; - return false; - } - - public override DataObjects.IDataObject Calculate(ref LinkedList.Enumerator ptgs_enum, PreferredResultType result_type) - { - return value.ConvertIfPossible(result_type); - } - - public override string ToString() - { - return value.ToString(); - } - - private DataObjects.ObjectBoolean value; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgConcat.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgConcat.cs deleted file mode 100644 index a72adbb9f0..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgConcat.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.RegularExpressions; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs -{ - internal class PtgConcat : BinOperatorPtg - { - private static Regex rx_mul = new Regex("\\G *& *"); - public static bool Extract(string formula, ref int start_pos) - { - Match match = rx_mul.Match(formula, start_pos); - if (match.Success) - { - start_pos += match.Length; - return true; - } - return false; - } - - public override BinOpCalc.IFullBinaryOpDispatcher Calculator { get { return BinOpCalc.Arithmetic.ConcatCalculator; } } - - public override PreferredResultType OperandsPreferredType { get { return PreferredResultType.value_type; } } - - public override string ToString() - { - return "&"; - } - - public override int Priority { get { return 30; } } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgDiv.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgDiv.cs deleted file mode 100644 index 4b71e8083c..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgDiv.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.RegularExpressions; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs -{ - internal class PtgDiv : BinOperatorPtg - { - private static Regex rx_mul = new Regex("\\G */ *"); - public static bool Extract(string formula, ref int start_pos) - { - Match match = rx_mul.Match(formula, start_pos); - if (match.Success) - { - start_pos += match.Length; - return true; - } - return false; - } - - public override BinOpCalc.IFullBinaryOpDispatcher Calculator { get { return BinOpCalc.Arithmetic.DivCalculator; } } - - public override PreferredResultType OperandsPreferredType { get { return PreferredResultType.numeric_type; } } - - public override string ToString() - { - return "/"; - } - - public override int Priority { get { return 20; } } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgEq.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgEq.cs deleted file mode 100644 index 9e1a76287f..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgEq.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.RegularExpressions; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs -{ - internal class PtgEq : BinOperatorPtg - { - private static Regex rx_eq = new Regex("\\G *= *"); - public static bool Extract(string formula, ref int start_pos) - { - Match match = rx_eq.Match(formula, start_pos); - if (match.Success) - { - start_pos += match.Length; - return true; - } - return false; - } - - public override BinOpCalc.IFullBinaryOpDispatcher Calculator { get { return BinOpCalc.Arithmetic.EqCalculator; } } - - public override PreferredResultType OperandsPreferredType { get { return PreferredResultType.value_type; } } - - public override string ToString() - { - return "="; - } - - public override int Priority { get { return 35; } } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgErr.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgErr.cs deleted file mode 100644 index 8f2f623437..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgErr.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.RegularExpressions; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs -{ - internal class PtgErr : OperandPtg - { - public PtgErr(string value) - { - this.value = new DataObjects.ObjectError(ErrorValue.Parse(value)); - } - - public PtgErr(ErrorValue value) - { - this.value = new DataObjects.ObjectError(value); - } - private static Regex rx_num = new Regex("\\G(#NULL!|#DIV/0!|#VALUE!|#REF!|#NAME\\?|#NUM!|#N/A)", RegexOptions.IgnoreCase); // searched case insensitive - public static bool Extract(string formula, ref int start_pos, out string operand_str) - { - Match match = rx_num.Match(formula, start_pos); - if (match.Success) - { - start_pos += match.Length; - operand_str = match.Value; - return true; - } - operand_str = null; - return false; - } - - public override DataObjects.IDataObject Calculate(ref LinkedList.Enumerator ptgs_enum, PreferredResultType result_type) - { - return value; - } - - public override string ToString() - { - return value.ToString(); - } - - private DataObjects.ObjectError value; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgFunc.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgFunc.cs deleted file mode 100644 index a902409714..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgFunc.cs +++ /dev/null @@ -1,122 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.RegularExpressions; -using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs -{ - internal abstract class PtgFunc : OperandPtg - { - private static Regex rx_num = new Regex("\\G([\\w\\d.]+)[-+*/^&%<=>:;\\(\\)]"); - public static bool Extract(string formula, ref int start_pos, out string operand_str) - { - Match match = rx_num.Match(formula, start_pos); - if (match.Success) - { - GroupCollection groups = match.Groups; - if (groups.Count == 2) - { - start_pos += groups[1].Length; - operand_str = groups[1].Value; - return true; - } - } - operand_str = null; - return false; - } - - public override DataObjects.IDataObject Calculate(ref LinkedList.Enumerator ptgs_enum, PreferredResultType result_type) - { - LinkedList argv = new LinkedList(); - for (int num = ParametersNum; num != 0; --num) - { - if (!ptgs_enum.MoveNext()) - { - if (ParametersNumMin <= ParametersNum - num) - return Calculate(argv, result_type); - - throw new Events.ReportableException(new Events.FormulaFormatError("Argument #" + num + " of function " + ToString() + " was not found")); - } - DataObjects.IDataObject arg = ptgs_enum.Current.Calculate(ref ptgs_enum, PreferredResultType.as_is); - argv.AddFirst(arg); - } - return Calculate(argv, result_type); - } - - public abstract DataObjects.IDataObject Calculate(LinkedList argv, PreferredResultType result_type); - - public override string Assemble(ref LinkedList.Enumerator ptgs_enum) - { - string arguments = ""; - for (int num = ParametersNum; num != 0; --num) - { - if (!ptgs_enum.MoveNext()) - { - if (ParametersNumMin <= ParametersNum - num && ToString() == new Functions.PtgFuncIf().ToString()) - { - if (0 == ParametersNum - num || 1 == ParametersNum - num) - { - arguments += ",TRUE,FALSE"; - } - else if (2 == ParametersNum - num) - { - arguments += ",FALSE"; - } - else - throw new Events.ReportableException(new Events.FormulaFormatError("Argument #" + num + " of function " + ToString() + " was not found")); - - return ToString() + "(" + arguments + ")"; - } - else if (ParametersNumMin <= ParametersNum - num && ToString() == new Functions.PtgFuncIfError().ToString()) - { - arguments += ","; - return ToString() + "(" + arguments + ")"; - } - - throw new Events.ReportableException(new Events.FormulaFormatError("Argument #" + num + " of function " + ToString() + " was not found")); - } - arguments = ptgs_enum.Current.Assemble(ref ptgs_enum) + (num != ParametersNum ? ("," + arguments) : ""); - } - return ToString() + "(" + arguments + ")"; - } - - public abstract int ParametersNum { get; } - public abstract int ParametersNumMin { get; } - public abstract int ParametersNumMax { get; } - public abstract string ArgumentsTip { get; } - public abstract bool SetParametersNum(int parameters_num); - public abstract new string ToString(); - } - - internal abstract class PtgFuncVar : PtgFunc - { - public override int ParametersNum - { - get { return parameters_num; } - } - public override int ParametersNumMin - { - get { return parameters_num; } - } - public override int ParametersNumMax - { - get { return parameters_num; } - } - - public override bool SetParametersNum(int parameters_num) - { - this.parameters_num = parameters_num; - return true; - } - private int parameters_num; - } - - internal abstract class PtgFuncFixed : PtgFunc - { - public override bool SetParametersNum(int parameters_num) - { - return (ParametersNum == parameters_num || (ParametersNumMin <= parameters_num && parameters_num <= ParametersNumMax)); - } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgGe.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgGe.cs deleted file mode 100644 index 4236ec7532..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgGe.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.RegularExpressions; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs -{ - internal class PtgGe : BinOperatorPtg - { - private static Regex rx_lt = new Regex("\\G *>= *"); - public static bool Extract(string formula, ref int start_pos) - { - Match match = rx_lt.Match(formula, start_pos); - if (match.Success) - { - start_pos += match.Length; - return true; - } - return false; - } - - public override DataObjects.IDataObject Calculate(ref LinkedList.Enumerator ptgs_enum, PreferredResultType result_type) - { - DataObjects.IDataObject res_lt = base.Calculate(ref ptgs_enum, PreferredResultType.boolean_type); - - DataObjects.ObjectBoolean res_bool = res_lt as DataObjects.ObjectBoolean; - if (res_bool != null) - { - return new DataObjects.ObjectBoolean(!res_bool.Value).ConvertIfPossible(result_type); - } - return res_lt.ConvertIfPossible(result_type); - } - - public override BinOpCalc.IFullBinaryOpDispatcher Calculator { get { return BinOpCalc.Arithmetic.LtCalculator; } } - - public override PreferredResultType OperandsPreferredType { get { return PreferredResultType.value_type; } } - - public override string ToString() - { - return ">="; - } - - public override int Priority { get { return 35; } } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgGt.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgGt.cs deleted file mode 100644 index 799820e5db..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgGt.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.RegularExpressions; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs -{ - internal class PtgGt : BinOperatorPtg - { - private static Regex rx_gt = new Regex("\\G *> *"); - public static bool Extract(string formula, ref int start_pos) - { - Match match = rx_gt.Match(formula, start_pos); - if (match.Success) - { - start_pos += match.Length; - return true; - } - return false; - } - - public override BinOpCalc.IFullBinaryOpDispatcher Calculator { get { return BinOpCalc.Arithmetic.GtCalculator; } } - - public override PreferredResultType OperandsPreferredType { get { return PreferredResultType.value_type; } } - - public override string ToString() - { - return ">"; - } - - public override int Priority { get { return 35; } } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgIsect.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgIsect.cs deleted file mode 100644 index f3a6caeea3..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgIsect.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.RegularExpressions; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs -{ - internal class PtgIsect : BinOperatorPtg - { - private static Regex rx_before_operators = new Regex("\\G *[,()]"); - private static Regex rx_space = new Regex("\\G "); - - public static bool IsNextPtg(string formula, int start_pos) - { - return !rx_before_operators.Match(formula, start_pos).Success && - rx_space.Match(formula, start_pos).Success; - } - - public static bool Extract(string formula, ref int start_pos) - { - if(IsNextPtg(formula, start_pos)) - { - ++start_pos; // Only one symbol can be recognized - return true; - } - return false; - } - - public override BinOpCalc.IFullBinaryOpDispatcher Calculator { get { return BinOpCalc.Arithmetic.IsectCalculator; } } - - public override PreferredResultType OperandsPreferredType { get { return PreferredResultType.reference_type; } } - - public override string ToString() - { - return " "; - } - - public override int Priority { get { return 6; } } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgLe.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgLe.cs deleted file mode 100644 index 4c71f7de2c..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgLe.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.RegularExpressions; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs -{ - internal class PtgLe : BinOperatorPtg - { - private static Regex rx_gt = new Regex("\\G *<= *"); - public static bool Extract(string formula, ref int start_pos) - { - Match match = rx_gt.Match(formula, start_pos); - if (match.Success) - { - start_pos += match.Length; - return true; - } - return false; - } - - public override DataObjects.IDataObject Calculate(ref LinkedList.Enumerator ptgs_enum, PreferredResultType result_type) - { - DataObjects.IDataObject res_gt = base.Calculate(ref ptgs_enum, PreferredResultType.boolean_type); - - DataObjects.ObjectBoolean res_bool = res_gt as DataObjects.ObjectBoolean; - if (res_bool != null) - { - return new DataObjects.ObjectBoolean(!res_bool.Value).ConvertIfPossible(result_type); - } - return res_gt.ConvertIfPossible(result_type); - } - - public override BinOpCalc.IFullBinaryOpDispatcher Calculator { get { return BinOpCalc.Arithmetic.GtCalculator; } } - - public override PreferredResultType OperandsPreferredType { get { return PreferredResultType.value_type; } } - - public override string ToString() - { - return "<="; - } - - public override int Priority { get { return 35; } } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgLt.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgLt.cs deleted file mode 100644 index 6189f78b0b..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgLt.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.RegularExpressions; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs -{ - internal class PtgLt : BinOperatorPtg - { - private static Regex rx_lt = new Regex("\\G *< *"); - public static bool Extract(string formula, ref int start_pos) - { - Match match = rx_lt.Match(formula, start_pos); - if (match.Success) - { - start_pos += match.Length; - return true; - } - return false; - } - - public override BinOpCalc.IFullBinaryOpDispatcher Calculator { get { return BinOpCalc.Arithmetic.LtCalculator; } } - - public override PreferredResultType OperandsPreferredType { get { return PreferredResultType.value_type; } } - - public override string ToString() - { - return "<"; - } - - public override int Priority { get { return 35; } } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgMissedArg.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgMissedArg.cs deleted file mode 100644 index 10214a9b02..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgMissedArg.cs +++ /dev/null @@ -1,46 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.RegularExpressions; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs -{ - internal class PtgMissedArg : OperandPtg - { - public PtgMissedArg() - { - } - - public override DataObjects.IDataObject Calculate(ref LinkedList.Enumerator ptgs_enum, PreferredResultType result_type) - { - return new DataObjects.ObjectEmpty().ConvertIfPossible(result_type); - } - - public override string Assemble(ref LinkedList.Enumerator ptgs_enum) - { - return ""; - } - - #region IComparable Members - - public int CompareTo(DataObjects.IDataObject other) - { - if (other is DataObjects.ObjectEmpty) - { - return 0; - } - return 1; - } - - #endregion - - public override string ToString() - { - return "missed argument"; - } - - public object UserValue { get { return null;} } - public string Type { get { return null; } } - - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgMul.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgMul.cs deleted file mode 100644 index f7d76c97ce..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgMul.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.RegularExpressions; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs -{ - internal class PtgMul : BinOperatorPtg - { - private static Regex rx_mul = new Regex("\\G *\\* *"); - public static bool Extract(string formula, ref int start_pos) - { - Match match = rx_mul.Match(formula, start_pos); - if (match.Success) - { - start_pos += match.Length; - return true; - } - return false; - } - - public override BinOpCalc.IFullBinaryOpDispatcher Calculator { get { return BinOpCalc.Arithmetic.MulCalculator; } } - - public override PreferredResultType OperandsPreferredType { get { return PreferredResultType.numeric_type; } } - - public override string ToString() - { - return "*"; - } - - public override int Priority { get { return 20; } } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgName.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgName.cs deleted file mode 100644 index 6a6a70b4d6..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgName.cs +++ /dev/null @@ -1,100 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.RegularExpressions; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs -{ - internal class PtgName : OperandPtg, IHavingSubjectPtg - { - /// - /// - /// - /// Must be contained in DefinedNames.NameItems. Otherwise - exception - /// - public PtgName(string name, Workbook workbook) - { - this.workbook = workbook; - this.manager = workbook.ValuesUpdateManager; - this.name = name; - } - - #region IHavingSubjectPtg Members - public IObserver UnregisterDependency() - { - if (observer != null) - { - NameItem name_item; - if (workbook.DefinedNames.NameItems.TryGetValue(name, out name_item)) - { - manager.Unregister(name_item, observer); - } - else - { - throw new Events.ReportableException(new Events.InternalError("Attempt to unregister a non-existent NameItem")); - } - IObserver former_observer = observer; - observer = null; - return former_observer; - } - return null; - } - - public void RegisterDependency(IObserver observer) - { - this.observer = observer; - NameItem name_item; - if (workbook.DefinedNames.NameItems.TryGetValue(name, out name_item)) - { - manager.Register(name_item, observer); - } - else - { - throw new Events.ReportableException(new Events.InternalError("Attempt to register a non-existent NameItem")); - } - } - #endregion - private static Regex rx_ref = new Regex("\\G(?\\w[\\w\\d.]*)([-+*/^&%<=>: ;),]|$)"); - public static bool Extract(string formula, ref int start_pos, out string operand_str, Workbook workbook) - { - Match match = rx_ref.Match(formula, start_pos); - if (match.Success) - { - GroupCollection groups = match.Groups; - string name = groups["name"].Value; - if (name.Length != 0 && null != workbook.DefinedNames && workbook.DefinedNames.IsNameExists(name)) - { - start_pos += name.Length; - operand_str = name; - return true; - } - } - operand_str = null; - return false; - } - - public override DataObjects.IDataObject Calculate(ref LinkedList.Enumerator ptgs_enum, PreferredResultType result_type) - { - NameItem name_item; - if (workbook.DefinedNames.NameItems.TryGetValue(name, out name_item)) - { - return name_item.Formula.Recalculate(PreferredResultType.as_is).ConvertIfPossible(result_type); - } - else - { - return new DataObjects.ObjectError(ErrorValue.wrong_name); - } - } - - public override string ToString() - { - return name; - } - - private string name; // The referred defined name - - private IObserver observer; - private ValuesUpdateManager manager; - private Workbook workbook; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgNe.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgNe.cs deleted file mode 100644 index 5547c90c32..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgNe.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.RegularExpressions; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs -{ - internal class PtgNe : BinOperatorPtg - { - private static Regex rx_eq = new Regex("\\G *<> *"); - public static bool Extract(string formula, ref int start_pos) - { - Match match = rx_eq.Match(formula, start_pos); - if (match.Success) - { - start_pos += match.Length; - return true; - } - return false; - } - - public override DataObjects.IDataObject Calculate(ref LinkedList.Enumerator ptgs_enum, PreferredResultType result_type) - { - DataObjects.IDataObject res_eq = base.Calculate(ref ptgs_enum, PreferredResultType.boolean_type); - - DataObjects.ObjectBoolean res_bool = res_eq as DataObjects.ObjectBoolean; - if(res_bool != null) - { - return new DataObjects.ObjectBoolean(!res_bool.Value).ConvertIfPossible(result_type); - } - return res_eq.ConvertIfPossible(result_type); - } - - public override BinOpCalc.IFullBinaryOpDispatcher Calculator { get { return BinOpCalc.Arithmetic.EqCalculator; } } - - public override PreferredResultType OperandsPreferredType { get { return PreferredResultType.value_type; } } - - public override string ToString() - { - return "<>"; - } - - public override int Priority { get { return 35; } } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgNum.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgNum.cs deleted file mode 100644 index 32d9683e5b..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgNum.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.RegularExpressions; -using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs -{ - internal class PtgNum : OperandPtg - { - public PtgNum(string value) - { - this.value = new DataObjects.ObjectNumber(value); - } - private static Regex rx_num = new Regex("\\G[+-]?\\d*(\\d|\\.)\\d*([eE][+-]?\\d+)?"); - public static bool Extract(string formula, ref int start_pos, out string operand_str) - { - Match match = rx_num.Match(formula, start_pos); - if (match.Success) - { - start_pos += match.Length; - operand_str = match.Value; - return true; - } - operand_str = null; - return false; - } - - public override DataObjects.IDataObject Calculate(ref LinkedList.Enumerator ptgs_enum, PreferredResultType result_type) - { - return value.ConvertIfPossible(result_type); - } - - public override string ToString() - { - return value.ToString(); - } - - private DataObjects.ObjectNumber value; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgParen.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgParen.cs deleted file mode 100644 index dbf88fa333..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgParen.cs +++ /dev/null @@ -1,77 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.RegularExpressions; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs -{ - internal class PtgParen : Ptg - { - public PtgParen() - { - ParametersNum = 1; // Assume there should be at least one parameter - } - private static Regex rx_l_paren = new Regex("\\G *\\( *"); - public static bool Extract_Left(string formula, ref int start_pos) - { - Match match = rx_l_paren.Match(formula, start_pos); - if (match.Success) - { - start_pos += match.Length; - return true; - } - return false; - } - private static Regex rx_r_paren = new Regex("\\G *\\)"); - public static bool Extract_Right(string formula, ref int start_pos) - { - Match match = rx_r_paren.Match(formula, start_pos); - if (match.Success) - { - start_pos += match.Length; - return true; - } - return false; - } - - public override DataObjects.IDataObject Calculate(ref LinkedList.Enumerator ptgs_enum, PreferredResultType result_type) - { - if (!ptgs_enum.MoveNext()) - { - throw new Events.ReportableException(new Events.FormulaFormatError("Empty parenthesis")); - } - return ptgs_enum.Current.Calculate(ref ptgs_enum, result_type); - } - - public override string Assemble(ref LinkedList.Enumerator ptgs_enum) - { - if (!ptgs_enum.MoveNext()) - { - throw new Events.ReportableException(new Events.FormulaFormatError("Empty parenthesis")); - } - string arg = ptgs_enum.Current.Assemble(ref ptgs_enum); - - return "(" + arg + ")"; - } - - public override string ToString() - { - return "("; - } - - public int ParametersNum { get; private set; } - - public int ParametersNumMin { get; private set; } - - public int ParametersNumMax { get; private set; } - - public void DecrementParametersNum() - { - --ParametersNum; - } - public void IncrementParametersNum() - { - ++ParametersNum; - } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgPercent.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgPercent.cs deleted file mode 100644 index a57987d668..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgPercent.cs +++ /dev/null @@ -1,54 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.RegularExpressions; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs -{ - internal class PtgPercent : OperatorPtg - { - private static Regex rx_percent = new Regex("\\G *% *"); - public static bool Extract(string formula, ref int start_pos, bool operand_expected) - { - if (!operand_expected) - { - Match match = rx_percent.Match(formula, start_pos); - if (match.Success) - { - start_pos += match.Length; - return true; - } - } - return false; - } - - public override DataObjects.IDataObject Calculate(ref LinkedList.Enumerator ptgs_enum, PreferredResultType result_type) - { - if (!ptgs_enum.MoveNext()) - { - throw new Events.ReportableException(new Events.FormulaFormatError("Argument of operator unary \"%\" was not found")); - } - DataObjects.IDataObject arg = ptgs_enum.Current.Calculate(ref ptgs_enum, PreferredResultType.numeric_type); - - return arg.PerformBinaryOperation((DataObjects.IDataObject)new DataObjects.ObjectNumber(100.0), BinOpCalc.Arithmetic.DivCalculator).ConvertIfPossible(result_type); - } - - public override string Assemble(ref LinkedList.Enumerator ptgs_enum) - { - if (!ptgs_enum.MoveNext()) - { - throw new Events.ReportableException(new Events.FormulaFormatError("Argument of operator unary \"%\" was not found")); - } - string arg = ptgs_enum.Current.Assemble(ref ptgs_enum); - - return arg + ToString(); - } - - public override string ToString() - { - return "%"; - } - - public override int Priority { get { return 11; } } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgPower.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgPower.cs deleted file mode 100644 index e5c4960f8c..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgPower.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.RegularExpressions; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs -{ - internal class PtgPower : BinOperatorPtg - { - private static Regex rx_pow = new Regex("\\G *\\^ *"); - public static bool Extract(string formula, ref int start_pos) - { - Match match = rx_pow.Match(formula, start_pos); - if (match.Success) - { - start_pos += match.Length; - return true; - } - return false; - } - - public override BinOpCalc.IFullBinaryOpDispatcher Calculator { get { return BinOpCalc.Arithmetic.PowerCalculator; } } - - public override PreferredResultType OperandsPreferredType { get { return PreferredResultType.numeric_type; } } - - public override string ToString() - { - return "^"; - } - - public override int Priority { get { return 15; } } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgRange.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgRange.cs deleted file mode 100644 index ca7602c198..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgRange.cs +++ /dev/null @@ -1,72 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.RegularExpressions; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs -{ - internal class PtgRange : BinOperatorPtg, IHavingSubjectPtg - { - private static Regex rx_gt = new Regex("\\G *: *"); - public static bool Extract(string formula, ref int start_pos) - { - Match match = rx_gt.Match(formula, start_pos); - if (match.Success) - { - start_pos += match.Length; - return true; - } - return false; - } - - public override DataObjects.IDataObject Calculate(ref LinkedList.Enumerator ptgs_enum, PreferredResultType result_type) - { - UnregisterDependency(); - DataObjects.IDataObject result = base.Calculate(ref ptgs_enum, result_type); - vir_ref = result as DataObjects.ObjectReference; - RegisterDependency(); - return result; - } - - public override BinOpCalc.IFullBinaryOpDispatcher Calculator { get { return BinOpCalc.Arithmetic.RangeCalculator; } } - - public override PreferredResultType OperandsPreferredType { get { return PreferredResultType.reference_type; } } - - public override string ToString() - { - return ":"; - } - - public override int Priority { get { return 4; } } - - #region IHavingSubjectPtg Members - - public IObserver UnregisterDependency() - { - IObserver ret_observer = null; - if (vir_ref != null) - { - ret_observer = vir_ref.Unregister(); - } - vir_ref = null; - return ret_observer; - } - - public void RegisterDependency(IObserver observer) - { - RegisterDependency(); - } - - #endregion - - private void RegisterDependency() - { - if (vir_ref != null) - { - vir_ref.Register(); - } - } - - private DataObjects.ObjectReference vir_ref; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgRef.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgRef.cs deleted file mode 100644 index 347da45da9..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgRef.cs +++ /dev/null @@ -1,155 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.RegularExpressions; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs -{ - internal class PtgRef : OperandPtg, IRefOperandPtg, IHavingSubjectPtg - { - private PtgRef(Cells.CellRangeRel cell_ref, Worksheet parent_sheet) - { - this.parent_sheet = parent_sheet; - this.manager = parent_sheet.Workbook.ValuesUpdateManager; - alien_cell_ref = cell_ref; - - // Store Subject in CellSubject storage - alien_cell_subject = parent_sheet.SubjectsStorage.GetCellItemOrCreate(alien_cell_ref.ToCell()); - } - - public static OperandPtg Create(string ref_str, Cells.Offset offset, Worksheet parent_sheet) - { - if (parent_sheet == null) - { - throw new Events.ReportableException(new Events.FormulaFormatError("It is prohibited to use range references without any certain sheet specified in Defined Names")); - } - - Cells.CellRangeRel cell_ref = new Cells.CellRangeRel(ref_str, parent_sheet.Workbook) + offset; - if(cell_ref != Cells.CellRangeRel.Empty) - { - return new PtgRef(cell_ref, parent_sheet); - } - else - { - return new PtgErr(ErrorValue.bad_reference); - } - } - - #region IHavingSubjectPtg Members - public IObserver UnregisterDependency() - { - if (observer != null) - { - manager.Unregister(alien_cell_subject, observer); - IObserver former_observer = observer; - observer = null; - return former_observer; - } - return null; - // we do not remove cell_subject from SubjectsStorage because another formula may reference the same cell - } - - public void RegisterDependency(IObserver observer) - { - this.observer = observer; - // Register in DAG manager - manager.Register(alien_cell_subject, observer); - } - #endregion - private static Regex rx_ref = new Regex("\\G(\\$?[A-Za-z]+\\$?(\\d+))([-+*/^&%<=>: ;),]|$)"); - public static bool Extract(string formula, ref int start_pos, out string operand_str) - { - Match match = rx_ref.Match(formula, start_pos); - if (match.Success) - { - GroupCollection groups = match.Groups; - if (groups.Count >= 2 && (groups[1].Length < 7 || groups[1].Value.CompareTo("1048576") < 0)) - { - start_pos += groups[1].Length; - operand_str = groups[1].Value; - return true; - } - } - operand_str = null; - return false; - } - - public override DataObjects.IDataObject Calculate(ref LinkedList.Enumerator ptgs_enum, PreferredResultType result_type) - { - return result_type == PreferredResultType.reference_type || result_type == PreferredResultType.as_is ? - new DataObjects.ObjectReference(alien_cell_ref.ToCellRange(), parent_sheet, observer) : - alien_cell_subject.GetValue().ConvertIfPossible(result_type); - } - - #region IRefOperandPtg members - - public Cells.CellRange GetReferredRange() - { - return alien_cell_ref.ToCellRange(); - } - - public bool ReferencesCellOrRange(ISubject subject) - { - return alien_cell_subject.CompareTo(subject) == 0; - } - - public OperandPtg Shift(Cells.Offset offset, Worksheet affected_sheet) - { - if (parent_sheet == affected_sheet) - { - IObserver former_observer = UnregisterDependency(); - - alien_cell_ref = alien_cell_ref.Shift(offset); - if (alien_cell_ref == Cells.CellRangeRel.Empty) - { - return new PtgErr(ErrorValue.bad_reference); - } - - // Store Subject in CellSubject storage - alien_cell_subject = parent_sheet.SubjectsStorage.GetCellItemOrCreate(alien_cell_ref.ToCell()); - - if (former_observer != null) - { - RegisterDependency(former_observer); - } - return this; - } - return null; - } - - public OperandPtg RemoveRange(Cells.CellRange removed_range, Worksheet removed_range_sheet) - { - if (parent_sheet == removed_range_sheet && removed_range.Contains(alien_cell_ref.ToCell())) - { - UnregisterDependency(); - return new PtgErr(ErrorValue.bad_reference); - } - return null; - } - - public OperandPtg ResizeInsertionAffected(Cells.CellRange moved_rows_range, Cells.Offset offset, Worksheet affected_sheet) - { - return null; - } - - public bool IsRelative - { - get { return alien_cell_ref.IsRelative; } - } - - #endregion - - public override string ToString() - { - return alien_cell_ref.ToString(); - } - - private Cells.CellRangeRel alien_cell_ref; // The referred cell - private CellItem alien_cell_subject; - - private IObserver observer; - - private ValuesUpdateManager manager; - private Worksheet parent_sheet; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgRef3D.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgRef3D.cs deleted file mode 100644 index e5551be5b3..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgRef3D.cs +++ /dev/null @@ -1,173 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.RegularExpressions; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs -{ - internal class PtgRef3D : OperandPtgRef3D, IRefOperandPtg - { - private PtgRef3D(Cells.CellRangeRel cell_ref, Worksheet ws_from, Worksheet ws_to) - : base(ws_from, ws_to) - { - Workbook parent_book = ws_from.Workbook; - this.manager = parent_book.ValuesUpdateManager; - alien_cell_ref = cell_ref; - - // Store Subject in CellSubject storage - Cells.Cell alien_cell = alien_cell_ref.ToCell(); - alien_cell_subjects = new List(); - foreach (Worksheet ws_current in parent_book.WorksheetsN(ws_from.Index, ws_to.Index)) - { - alien_cell_subjects.Add(ws_current.SubjectsStorage.GetCellItemOrCreate(alien_cell)); - } - } - - public static OperandPtg Create(string ref_str, Cells.Offset offset, Worksheet ws_from, Worksheet ws_to) - { - Cells.CellRangeRel cell_ref = new Cells.CellRangeRel(ref_str, ws_from.Workbook) + offset; - if (cell_ref != Cells.CellRangeRel.Empty) - { - return new PtgRef3D(cell_ref, ws_from, ws_to); - } - else - { - return new PtgRefErr3D(ErrorValue.bad_reference, ws_from, ws_to); - } - } - - #region IHavingSubjectPtg Members - - public override IObserver UnregisterDependency() - { - if (observer != null) - { - foreach (CellItem alien_cell in alien_cell_subjects) - { - manager.Unregister(alien_cell, observer); - } - base.UnregisterDependency(); - IObserver former_observer = observer; - observer = null; - return former_observer; - } - return null; - // we do not remove cell_subject from SubjectsStorage because another formula may reference the same cell - } - - public override void RegisterDependency(IObserver observer) - { - this.observer = observer; - // Register in DAG manager - foreach (CellItem alien_cell in alien_cell_subjects) - { - manager.Register(alien_cell, observer); - } - base.RegisterDependency(observer); - } - - #endregion - - public override DataObjects.IDataObject Calculate(ref LinkedList.Enumerator ptgs_enum, PreferredResultType result_type) - { - Cells.CellRange3D range3D = new Cells.CellRange3D(alien_cell_ref.ToCellRange(), WorksheetFrom, WorksheetTo); - if (result_type != PreferredResultType.reference_type && result_type != PreferredResultType.as_is) - { - if (range3D.IsSingleCell) - { - Cells.Cell cell = range3D.CellRange.TopLeft; - CellItem cell_subject = WorksheetFrom.SubjectsStorage.GetCellItemOrCreate(cell); - return cell_subject.GetValue().ConvertIfPossible(result_type); - } - else - { - return new DataObjects.ObjectError(ErrorValue.wrong_value_type); - } - } - else - { - return new DataObjects.ObjectReference(range3D, observer); - } - } - - #region IRefOperandPtg Members - - public Cells.CellRange GetReferredRange() - { - return alien_cell_ref.ToCellRange(); - } - - public bool ReferencesCellOrRange(ISubject subject) - { - foreach (CellItem alien_cell in alien_cell_subjects) - { - if (alien_cell.CompareTo(subject) == 0) - { - return true; - } - } - return false; - } - - public OperandPtg Shift(Cells.Offset offset, Worksheet affected_sheet) - { - if (WorksheetFrom == WorksheetTo && WorksheetFrom == affected_sheet) - { - IObserver former_observer = UnregisterDependency(); - - alien_cell_ref = alien_cell_ref.Shift(offset); - if (alien_cell_ref == Cells.CellRangeRel.Empty) - { - return new PtgRefErr3D(ErrorValue.bad_reference, WorksheetFrom, WorksheetTo); - } - - // Store Subject in CellSubject storage - alien_cell_subjects.Clear(); - alien_cell_subjects.Add(affected_sheet.SubjectsStorage.GetCellItemOrCreate(alien_cell_ref.ToCell())); - - if (former_observer != null) - { - RegisterDependency(former_observer); - } - return this; - } - return null; - } - - public OperandPtg RemoveRange(Cells.CellRange removed_range, Worksheet removed_range_sheet) - { - if (WorksheetFrom == WorksheetTo && WorksheetFrom == removed_range_sheet) - { - if (removed_range.Contains(alien_cell_ref.ToCell())) - { - UnregisterDependency(); - return new PtgRefErr3D(ErrorValue.bad_reference, WorksheetFrom, WorksheetTo); - } - } - return null; - } - - public OperandPtg ResizeInsertionAffected(Cells.CellRange moved_rows_range, Cells.Offset offset, Worksheet affected_sheet) - { - return null; - } - - public bool IsRelative - { - get { return alien_cell_ref.IsRelative; } - } - - #endregion - - public override string ToString() - { - return ToString3DPart() + alien_cell_ref.ToString(); - } - - private Cells.CellRangeRel alien_cell_ref; // The referred cell - private List alien_cell_subjects; - - private IObserver observer; - private ValuesUpdateManager manager; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgRefErr3D.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgRefErr3D.cs deleted file mode 100644 index 0f43ad9ff7..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgRefErr3D.cs +++ /dev/null @@ -1,47 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.RegularExpressions; -using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs -{ - internal class PtgRefErr3D : OperandPtgRef3D - { - public PtgRefErr3D(ErrorValue value, Worksheet ws_from, Worksheet ws_to) - : base(ws_from, ws_to) - { - this.value = new DataObjects.ObjectError(value); - } - - public PtgRefErr3D(string value, Worksheet ws_from, Worksheet ws_to) - : this(ErrorValue.Parse(value), ws_from, ws_to) - { - } - private static Regex rx_num = new Regex("\\G#REF!", RegexOptions.IgnoreCase); // searched case insensitive - public static bool Extract(string formula, ref int start_pos, out string operand_str) - { - Match match = rx_num.Match(formula, start_pos); - if (match.Success) - { - start_pos += match.Length; - operand_str = match.Value; - return true; - } - operand_str = null; - return false; - } - - public override DataObjects.IDataObject Calculate(ref LinkedList.Enumerator ptgs_enum, PreferredResultType result_type) - { - return value; - } - - public override string ToString() - { - return ToString3DPart() + value.ToString(); - } - - private DataObjects.ObjectError value; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgStr.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgStr.cs deleted file mode 100644 index 4da248be49..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgStr.cs +++ /dev/null @@ -1,48 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.RegularExpressions; -using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs -{ - internal class PtgStr : OperandPtg - { - public PtgStr(string value) - { - this.value = new DataObjects.ObjectString(value); - } - private static Regex rx_num = new Regex("\\G\"((\"\"|[^\"])*)\""); - public static bool Extract(string formula, ref int start_pos, out string operand_str) - { - Match match = rx_num.Match(formula, start_pos); - if (match.Success) - { - GroupCollection groups = match.Groups; - if (groups.Count >= 2) - { - start_pos += match.Length; - operand_str = groups[1].Value.Replace("\"\"", "\""); - return true; - } - } - operand_str = null; - return false; - } - - public override DataObjects.IDataObject Calculate(ref LinkedList.Enumerator ptgs_enum, PreferredResultType result_type) - { - return value.ConvertIfPossible(result_type); - } - - - public override string ToString() - { - return "\"" + value.ToString() + "\""; - } - - public DataObjects.ObjectString value; - } - - -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgSub.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgSub.cs deleted file mode 100644 index 10feb3abe9..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgSub.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.RegularExpressions; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs -{ - internal class PtgSub : BinOperatorPtg - { - private static Regex rx_minus = new Regex("\\G *- *"); - public static bool Extract(string formula, ref int start_pos, bool operand_expected) - { - if (!operand_expected) - { - Match match = rx_minus.Match(formula, start_pos); - if (match.Success) - { - start_pos += match.Length; - return true; - } - } - return false; - } - - public override BinOpCalc.IFullBinaryOpDispatcher Calculator { get { return BinOpCalc.Arithmetic.SubCalculator; } } - - public override PreferredResultType OperandsPreferredType { get { return PreferredResultType.numeric_type; } } - - public override string ToString() - { - return "-"; - } - - public override int Priority { get { return 25; } } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgUminus.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgUminus.cs deleted file mode 100644 index 5d01781dfe..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgUminus.cs +++ /dev/null @@ -1,59 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.RegularExpressions; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs -{ - internal class PtgUminus : OperatorPtg - { - private static Regex rx_minus = new Regex("\\G *- *"); - public static bool Extract(string formula, ref int start_pos, bool operand_expected) - { - if (operand_expected) - { - Match match = rx_minus.Match(formula, start_pos); - if (match.Success) - { - start_pos += match.Length; - return true; - } - } - return false; - } - - public override bool isRightAssociative() - { - return true; - } - - public override DataObjects.IDataObject Calculate(ref LinkedList.Enumerator ptgs_enum, PreferredResultType result_type) - { - if (!ptgs_enum.MoveNext()) - { - throw new Events.ReportableException(new Events.FormulaFormatError("Argument of operator unary \"-\" was not found")); - } - DataObjects.IDataObject arg = ptgs_enum.Current.Calculate(ref ptgs_enum, PreferredResultType.numeric_type); - - return new DataObjects.ObjectNumber(0.0).PerformBinaryOperation(arg, BinOpCalc.Arithmetic.SubCalculator).ConvertIfPossible(result_type); - } - - public override string Assemble(ref LinkedList.Enumerator ptgs_enum) - { - if (!ptgs_enum.MoveNext()) - { - throw new Events.ReportableException(new Events.FormulaFormatError("Argument of operator unary \"-\" was not found")); - } - string arg = ptgs_enum.Current.Assemble(ref ptgs_enum); - - return ToString() + arg; - } - - public override string ToString() - { - return "-"; - } - - public override int Priority { get { return 10; } } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgUnion.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgUnion.cs deleted file mode 100644 index 1c77ad38d8..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgUnion.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.RegularExpressions; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs -{ - internal class PtgUnion : BinOperatorPtg - { - public override BinOpCalc.IFullBinaryOpDispatcher Calculator { get { return BinOpCalc.Arithmetic.UnionCalculator; } } - - public override PreferredResultType OperandsPreferredType { get { return PreferredResultType.reference_type; } } - - public override string ToString() - { - return ","; - } - - public override int Priority { get { return 5; } } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgUplus.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgUplus.cs deleted file mode 100644 index 8bd28c7603..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/Formulas/Ptgs/PtgUplus.cs +++ /dev/null @@ -1,58 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.RegularExpressions; - -namespace ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs -{ - internal class PtgUplus : OperatorPtg - { - private static Regex rx_plus = new Regex("\\G *\\+ *"); - public static bool Extract(string formula, ref int start_pos, bool operand_expected) - { - if (operand_expected) - { - Match match = rx_plus.Match(formula, start_pos); - if (match.Success) - { - start_pos += match.Length; - return true; - } - } - return false; - } - - public override bool isRightAssociative() - { - return true; - } - - public override DataObjects.IDataObject Calculate(ref LinkedList.Enumerator ptgs_enum, PreferredResultType result_type) - { - if (!ptgs_enum.MoveNext()) - { - throw new Events.ReportableException(new Events.FormulaFormatError("Argument of operator unary \"+\" was not found")); - } - - return ptgs_enum.Current.Calculate(ref ptgs_enum, PreferredResultType.numeric_type).ConvertIfPossible(result_type); - } - - public override string Assemble(ref LinkedList.Enumerator ptgs_enum) - { - if (!ptgs_enum.MoveNext()) - { - throw new Events.ReportableException(new Events.FormulaFormatError("Argument of operator unary \"+\" was not found")); - } - string arg = ptgs_enum.Current.Assemble(ref ptgs_enum); - - return ToString() + arg; - } - - public override string ToString() - { - return "+"; - } - - public override int Priority { get { return 10; } } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/HyperlinkItem.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/HyperlinkItem.cs deleted file mode 100644 index f930f63509..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/HyperlinkItem.cs +++ /dev/null @@ -1,69 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using ASCOfficeEWSEditor.Editor.Calculation.Formulas; - -namespace ASCOfficeEWSEditor.Editor.Calculation -{ - internal class HyperlinkItem : IObserver - { - public HyperlinkItem(Cells.Cell anchor, Worksheet parent_sheet) - { - this.parent_sheet = parent_sheet; - this.anchor = anchor; - valid = true; - } - - #region IObserver Members - - public void Update() - { - valid = true; - } - - public void ChangeObserverOnRangeRemoved(Cells.CellRange removed_range, Worksheet removed_range_sheet) - { - if(removed_range.Contains(anchor)) - { - parent_sheet.Hyperlinks.RemoveHyperlink(anchor); - } - } - - public void ChangeObserverOnWorksheetRemoved(Worksheet removed_sheet) - { - // Nothing to do. All resources will be removed automatically - } - - public void ChangeObserverOnWorksheetRenamed(Worksheet removed_sheet) - { - // Nothing to do. - } - - public void ChangeObserverOnRangeInserted(Cells.CellRange moved_range, Cells.Offset offset, Worksheet affected_sheet) - { - // Nothing to do. It is not a range - } - - public void ShiftReferencesTo(ISubject subject, Cells.Offset offset, Worksheet affected_sheet) - { - if (subject.Equals(parent_sheet.SubjectsStorage.GetCellItemOrCreate(anchor))) - { - parent_sheet.Hyperlinks.MoveHyperlink(anchor, anchor + offset); - } - } - - public bool Valid { get { return valid; } } - public void Invalidate() - { - valid = false; - } - - #endregion - - private bool valid; - - internal Cells.Cell anchor;/* { get; private set; }*/ - private Worksheet parent_sheet; - } - -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/IObserver.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/IObserver.cs deleted file mode 100644 index 6092dbed56..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/IObserver.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Calculation -{ - internal interface IObserver - { - void Update(); - void ChangeObserverOnRangeRemoved(Cells.CellRange removed_range, Worksheet removed_range_sheet); - void ChangeObserverOnRangeInserted(Cells.CellRange moved_rows_range, Cells.Offset offset, Worksheet affected_sheet); - void ShiftReferencesTo(ISubject subject, Cells.Offset offset, Worksheet affected_sheet); - - void ChangeObserverOnWorksheetRemoved(Worksheet removed_sheet); - void ChangeObserverOnWorksheetRenamed(Worksheet removed_sheet); - - bool Valid { get; } - void Invalidate(); - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/ISubject.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/ISubject.cs deleted file mode 100644 index f49a50b1bc..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/ISubject.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Calculation -{ - internal interface ISubject : IComparable - { - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/NameItem.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/NameItem.cs deleted file mode 100644 index be0520443c..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/NameItem.cs +++ /dev/null @@ -1,121 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using ASCOfficeEWSEditor.Editor.Calculation.Formulas; - -namespace ASCOfficeEWSEditor.Editor.Calculation -{ - internal class NameItem : IObserver, ISubject - { - public NameItem(string name, Workbook workbook, ValuesUpdateManager manager, NameParsedFormula formula_item) - { - this.manager = manager; - this.workbook = workbook; - Formula = formula_item; - Name = name; - valid = true; - } - - #region IObserver Members - - public void Update() - { - valid = true; - } - - public void ChangeObserverOnRangeRemoved(Cells.CellRange removed_range, Worksheet removed_range_sheet) - { - Formula.RemoveReferencesTo(removed_range, removed_range_sheet); - workbook.DefinedNames.AddName(Name, Formula.Assemble()); - } - - public void ChangeObserverOnWorksheetRemoved(Worksheet removed_sheet) - { - Formula.RemoveReferencesTo(removed_sheet); - workbook.DefinedNames.AddName(Name, Formula.Assemble()); - } - - public void ChangeObserverOnWorksheetRenamed(Worksheet removed_sheet) - { - workbook.DefinedNames.AddName(Name, Formula.Assemble()); - } - - public void ChangeObserverOnRangeInserted(Cells.CellRange moved_range, Cells.Offset offset, Worksheet affected_sheet) - { - Formula.ResizeInsertionAffected(moved_range, offset, affected_sheet); - workbook.DefinedNames.AddName(Name, Formula.Assemble()); - } - - public void ShiftReferencesTo(ISubject subject, Cells.Offset offset, Worksheet affected_sheet) - { - Formula.ShiftReferencesTo(subject, offset, affected_sheet); - workbook.DefinedNames.AddName(Name, Formula.Assemble()); - } - - public bool Valid { get { return valid; } } - public void Invalidate() - { - valid = false; - manager.Invalidate(this); - } - - #endregion - - #region ISubject Members - -/* - public Formulas.DataObjects.IDataObject GetValue() - { - if (HasFormula() && !valid) - { - if (formula_item.RecalcInProgress) // Cycle found!!! - { - return new Formulas.DataObjects.ObjectError(ErrorValue.bad_reference); - } - Formulas.DataObjects.IDataObject result = formula_item.Recalculate(); // May lead in Update of 'this' - valid = true; - CellOrFormulaUpdated = true; - if (result != null) - { - parent_sheet.CellSetValue(cell, result); - } - return result; - } - else - { - return parent_sheet.CellGetValue(cell); - } - } -*/ - - #endregion - - public override string ToString() - { - return Name; - } - - #region IComparable Members - - public int CompareTo(ISubject other) - { - NameItem other_subj = other as NameItem; - if (other_subj == null) - { - return this.GetType().GUID.CompareTo(other.GetType().GUID); - } - return Name.CompareTo(other_subj.Name); - } - - #endregion - - internal string Name { get; private set; } - internal NameParsedFormula Formula { get; private set; } - - private bool valid; - - private Workbook workbook; - private ValuesUpdateManager manager; - } - -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/RangeSubject.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/RangeSubject.cs deleted file mode 100644 index 00a8368c61..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/RangeSubject.cs +++ /dev/null @@ -1,50 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Calculation -{ - internal class RangeSubject : ISubject - { - /// - /// Construct non-observer, just subject - /// - public RangeSubject(Cells.CellRange range, Worksheet parent_sheet, ValuesUpdateManager manager) - { - this.range = range; - this.parent_sheet = parent_sheet; - this.manager = manager; - } - - #region ISubject Members - - #endregion - - public override string ToString() - { - return range.ToString(); - } - - #region IComparable Members - - public int CompareTo(ISubject other) - { - if (!(other is RangeSubject)) - { - return this.GetType().GUID.CompareTo(other.GetType().GUID); - } - RangeSubject other_subj = (RangeSubject)other; - return range.CompareTo(other_subj.range); - } - - #endregion - - internal Cells.CellRange CellRange { get { return range; } } - - private Cells.CellRange range; - private Worksheet parent_sheet; - - private ValuesUpdateManager manager; - } - -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/SubjectsStorage.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/SubjectsStorage.cs deleted file mode 100644 index 63593da51e..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/SubjectsStorage.cs +++ /dev/null @@ -1,71 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Calculation -{ - internal class SubjectsStorage - { - public SubjectsStorage(Worksheet parent_sheet) - { - this.parent_sheet = parent_sheet; - CellSubjects = new Dictionary(); - RangeSubjects = new Dictionary(); - } - - internal Dictionary CellSubjects { get; private set; } - internal Dictionary RangeSubjects { get; private set; } - - internal CellItem GetCellItemOrCreate(Cells.Cell cell) - { - CellItem result = GetCellItem(cell); - if (result == null) - { - result = new CellItem(cell, parent_sheet, parent_sheet.Workbook.ValuesUpdateManager); // create as subject - parent_sheet.SubjectsStorage.CellSubjects[cell] = result; - } - return result; - } - - internal CellItem GetCellItem(Cells.Cell cell) - { - CellItem result; - if (CellSubjects.TryGetValue(cell, out result)) - { - return result; - } - return null; - } - - internal RangeSubject GetRangeSubjectOrCreate(Cells.CellRange range) - { - RangeSubject result = GetRangeSubject(range); - if (result == null) - { - result = new RangeSubject(range, parent_sheet, parent_sheet.Workbook.ValuesUpdateManager); - parent_sheet.SubjectsStorage.RangeSubjects[range] = result; - } - return result; - } - - internal RangeSubject GetRangeSubject(Cells.CellRange range) - { - RangeSubject result; - if (RangeSubjects.TryGetValue(range, out result)) - { - return result; - } - return null; - } - - internal void MarkRangeCellsUpdated(Cells.CellRange range) - { - foreach (Cells.Cell cell in range) - { - GetCellItemOrCreate(cell).CellOrFormulaUpdated = true; - } - } - - private Worksheet parent_sheet; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/ValuesUpdateManager.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/ValuesUpdateManager.cs deleted file mode 100644 index 827c43bf43..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/ValuesUpdateManager.cs +++ /dev/null @@ -1,297 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Calculation -{ - internal class ValuesUpdateManager - { - public ValuesUpdateManager() - { - map = new Dictionary>(); - update_candidates = new Queue(); - } - - public void Register(ISubject subj, IObserver observer) - { - List list; - if (!map.TryGetValue(subj, out list)) - { - list = new List(); - list.Add(observer); - map[subj] = list; - } - else - { - if(!list.Contains(observer)) - { - list.Add(observer); - } - } - } - - public void Unregister(ISubject subj, IObserver observer) - { - List list; - if(map.TryGetValue(subj, out list)) - { - list.Remove(observer); - } - } - - // Designated for named ranges subject - internal void NotifyUpdated(ISubject subj) - { - Invalidate(subj); // Exclude snowball update - UpdateMarkedObservers(); - } - - internal void NotifyUpdatedCell(Cells.Cell updated_cell, Worksheet parent_sheet) - { - Calculation.CellItem cell_subj = parent_sheet.SubjectsStorage.GetCellItemOrCreate(updated_cell); - cell_subj.CellOrFormulaUpdated = true; - // Notify recalculation engine - InvalidateUpdatedCell(cell_subj, updated_cell, parent_sheet); - - UpdateMarkedObservers(); - } - - internal void NotifyDeleted(Cells.CellRange removed_range, Worksheet removed_range_sheet) - { - List deleted_subjects = new List(); - // Search for single cells - foreach (KeyValuePair subj_item in removed_range_sheet.SubjectsStorage.CellSubjects) - { - if(removed_range.Contains(subj_item.Key)) - { - deleted_subjects.Add(subj_item.Value); - InvalidateUpdatedCell(subj_item.Value, subj_item.Key, removed_range_sheet); - } - } - // Search for ranges - foreach (KeyValuePair subj_item in removed_range_sheet.SubjectsStorage.RangeSubjects) - { - if (removed_range.IsIntersectedWith(subj_item.Key)) - { - deleted_subjects.Add(subj_item.Value); - Invalidate(subj_item.Value); - } - } - // Change only first level observers. The others will be updated in UpdateMarkedObservers() - foreach (ISubject subj in deleted_subjects) - { - List observers; - if (map.TryGetValue(subj, out observers)) - { - List delete_candidates = new List(); - foreach (IObserver observer in observers) - { - delete_candidates.Add(observer); - } - foreach (IObserver observer in delete_candidates) - { - observer.ChangeObserverOnRangeRemoved(removed_range, removed_range_sheet); - } - } - } - UpdateMarkedObservers(); - } - - internal void NotifyRemovedSheet(Sheet removed_sheet) - { - Worksheet removed_worksheet = removed_sheet as Worksheet; - if (removed_worksheet != null) - { - Invalidate(removed_worksheet.Subject); - List observers; - if (map.TryGetValue(removed_worksheet.Subject, out observers)) - { - List referenced_observers = new List(); - foreach (IObserver observer in observers) - { - referenced_observers.Add(observer); - } - foreach (IObserver observer in referenced_observers) - { - update_candidates.Enqueue(observer); - observer.ChangeObserverOnWorksheetRemoved(removed_worksheet); - observer.Invalidate(); - } - } - UpdateMarkedObservers(); - } - } - - internal void NotifyRenamedSheet(Sheet renamed_sheet) - { - List observers; - Worksheet renamed_worksheet = renamed_sheet as Worksheet; - if (renamed_worksheet != null) - { - if (map.TryGetValue(renamed_worksheet.Subject, out observers)) - { - foreach (IObserver observer in observers) - { - observer.ChangeObserverOnWorksheetRenamed(renamed_worksheet); - } - } - } - } - - internal void NotifyRangesOnInsertedRowsOrColumns(Cells.CellRange moved_range, Cells.Offset offset, Worksheet affected_range) - { - List resized_subjects = new List(); - // Search for ranges - foreach (KeyValuePair subj_item in affected_range.SubjectsStorage.RangeSubjects) - { - if (subj_item.Key.IsBoundaryIntersectedWith(moved_range)) - { - resized_subjects.Add(subj_item.Value); - Invalidate(subj_item.Value); - } - } - // Change only first level observers. The others will be updated in UpdateMarkedObservers() - foreach (ISubject subj in resized_subjects) - { - List observers; - if (map.TryGetValue(subj, out observers)) - { - List delete_candidates = new List(); - foreach (IObserver observer in observers) - { - delete_candidates.Add(observer); - } - foreach (IObserver observer in delete_candidates) - { - observer.ChangeObserverOnRangeInserted(moved_range, offset, affected_range); - } - } - } - UpdateMarkedObservers(); - } - - internal void NotifyCellOrRangeMoved(Cells.CellRange moved_range, Cells.Offset offset, Worksheet affected_range) - { - LinkedList moved_subjects = new LinkedList(); - // Search for single cells - foreach (KeyValuePair element in affected_range.SubjectsStorage.CellSubjects) - { - Cells.Cell cell = element.Key; - if (moved_range.Contains(cell)) - { - if (offset.RowOffset > 0 || offset.ColumnOffset > 0) - { - moved_subjects.AddFirst(element.Value); - } - else - { - moved_subjects.AddLast(element.Value); - } - InvalidateUpdatedCell(element.Value, element.Key, affected_range); - } - } - // Search for ranges - foreach (KeyValuePair element in affected_range.SubjectsStorage.RangeSubjects) - { - Cells.CellRange cell_range = element.Key; - if (cell_range.IsIntersectedWith(moved_range)) - { - if (offset.RowOffset > 0 || offset.ColumnOffset > 0) - { - moved_subjects.AddFirst(element.Value); - } - else - { - moved_subjects.AddLast(element.Value); - } - Invalidate(element.Value); - } - } - - // Change only first level observers. The others will be updated in UpdateMarkedObservers() - foreach (ISubject subj in moved_subjects) - { - List observers; - if (map.TryGetValue(subj, out observers)) - { - List move_candidates = new List(); - foreach (IObserver observer in observers) - { - move_candidates.Add(observer); - } - foreach (IObserver observer in move_candidates) - { - observer.ShiftReferencesTo(subj, offset, affected_range); - } - } - } - UpdateMarkedObservers(); - } - - internal void InvalidateUpdatedCell(ISubject subj, Cells.Cell updated_cell, Worksheet parent_sheet) - { - Invalidate(subj); - - // Invalidate range subjects that aren't explicitly linked with the subject - foreach (KeyValuePair subj_item in parent_sheet.SubjectsStorage.RangeSubjects) - { - if (subj_item.Key.Contains(updated_cell)) - { - Invalidate(subj_item.Value); - } - } - - } - - // Note: No ranges subjects are touched here - internal void Invalidate(ISubject subj) - { - List observers; - if (map.TryGetValue(subj, out observers)) - { - foreach (IObserver observer in observers) - { - if (observer.Valid) - { - update_candidates.Enqueue(observer); - observer.Invalidate(); - } - } - } - } - - private void InvalidateObserver(IObserver observer) - { - if (observer.Valid) - { - update_candidates.Enqueue(observer); - observer.Invalidate(); - } - } - - private void UpdateMarkedObservers() - { - while (update_candidates.Count != 0) - { - IObserver observer = update_candidates.Dequeue(); - if (!observer.Valid) - { - observer.Update(); - } - } - } - - internal bool HasObservers(ISubject subject) - { - List observers; - if (map.TryGetValue(subject, out observers)) - { - return observers.Count != 0; - } - return false; - } - - private Dictionary> map; - private Queue update_candidates; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/WorksheetSubject.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/WorksheetSubject.cs deleted file mode 100644 index 25c7692a27..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Calculation/WorksheetSubject.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Calculation -{ - internal class WorksheetSubject : Calculation.ISubject - { - public WorksheetSubject(Worksheet worksheet) - { - Worksheet = worksheet; - ws_index = worksheet.Index; - } - - #region IComparable Members - - public int CompareTo(ASCOfficeEWSEditor.Editor.Calculation.ISubject other) - { - WorksheetSubject other_subj = other as WorksheetSubject; - if (other_subj == null) - { - return this.GetType().GUID.CompareTo(other.GetType().GUID); - } - return ws_index.CompareTo(other_subj.ws_index); - } - - #endregion - - public Worksheet Worksheet { get; private set; } - private int ws_index; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/CalculationTables/Power.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/CalculationTables/Power.cs deleted file mode 100644 index 09c5fb4684..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/CalculationTables/Power.cs +++ /dev/null @@ -1,80 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.CalculationTables -{ - internal class Power - { - internal static double Pow10(int degree) - { - switch(degree) - { - case 0: - return 1.0; - case 1: - return 10.0; - case 2: - return 100.0; - case 3: - return 1000.0; - case 4: - return 10000.0; - case 5: - return 100000.0; - case 6: - return 1e6; - case 7: - return 1e7; - case 8: - return 1e8; - case 9: - return 1e9; - case 10: - return 1e10; - case 11: - return 1e11; - case 12: - return 1e12; - case 13: - return 1e13; - case 14: - return 1e14; - case 15: - return 1e15; - case -1: - return 0.1; - case -2: - return 0.01; - case -3: - return 0.001; - case -4: - return 0.0001; - case -5: - return 0.00001; - case -6: - return 1e-6; - case -7: - return 1e-7; - case -8: - return 1e-8; - case -9: - return 1e-9; - case -10: - return 1e-10; - case -11: - return 1e-11; - case -12: - return 1e-12; - case -13: - return 1e-13; - case -14: - return 1e-14; - case -15: - return 1e-15; - default: - return Math.Pow(10, degree); - } - } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Cells/Cell.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Cells/Cell.cs deleted file mode 100644 index e192ae0ad8..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Cells/Cell.cs +++ /dev/null @@ -1,95 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Cells -{ - public struct Cell : IComparable - { - public Cell(string cell_ref) - { - bool row_rel; - bool column_rel; - Helpers.ReferencesFormat.str2loc(cell_ref, out row, out row_rel, out column, out column_rel); - } - - /// - /// Cell creation by row/column numbers - /// - /// 1-based row number - /// 1-based column number - public Cell(int row, int column) - { - this.row = row; - this.column = column; - } - - public override int GetHashCode() - { - return ((row - 1) ^ ((column - 1) << 18)); // because (maxCol - 1) = 3fffh and (maxRow - 1)= fffffh - } - - public override bool Equals(object obj) - { - if(!(obj is Cell)) - { - return false; - } - Cell other_cell = (Cell)obj; - return row == other_cell.row && column == other_cell.column; - } - - #region IComparable Members - - public int CompareTo(Cell other) - { - int cmp_row = row.CompareTo(other.row); - if (cmp_row != 0) - { - return cmp_row; - } - else - { - return column.CompareTo(other.column); - } - } - - #endregion - - public static Offset operator-(Cell cell1, Cell cell2) - { - return new Offset(cell1.row - cell2.row, cell1.column - cell2.column); - } - - public static Cell operator -(Cell cell, Offset offset) - { - return new Cell(cell.row - offset.RowOffset, cell.column - offset.ColumnOffset); - } - - public static Cell operator+(Cell cell, Offset offset) - { - return new Cell(cell.row + offset.RowOffset, cell.column + offset.ColumnOffset); - } - - public static bool operator ==(Cell one, Cell other) - { - return one.CompareTo(other) == 0; - } - - public static bool operator !=(Cell one, Cell other) - { - return one.CompareTo(other) != 0; - } - - public override string ToString() - { - return Helpers.ReferencesFormat.ref2str(row, true, column, true); - } - - public int Row { get { return row; } } - public int Column { get { return column; } } - - private readonly int row; - private readonly int column; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Cells/CellRange.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Cells/CellRange.cs deleted file mode 100644 index 19b37bdb05..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Cells/CellRange.cs +++ /dev/null @@ -1,376 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Cells -{ - public struct CellRange : IEnumerable, IComparable - { - /// - /// Create cell range by reference - /// - /// reference - /// this is only necessary for errors reporting - public CellRange(string cell_range_ref, Workbook workbook) - { - bool row1_rel; - bool column1_rel; - bool row2_rel; - bool column2_rel; - if (!Helpers.ReferencesFormat.str2ref(cell_range_ref.ToUpper(), out rowFirst, out row1_rel, out columnFirst, out column1_rel, - out rowLast, out row2_rel, out columnLast, out column2_rel)) - { - workbook.ReportError(new Events.WrongReferenceFormatError(cell_range_ref)); - this = Empty; - } - } - - public CellRange(int rowFirst, int columnFirst, int rowLast, int columnLast) - { - this.rowFirst = rowFirst; - this.columnFirst = columnFirst; - this.rowLast = rowLast; - this.columnLast = columnLast; - } - - public CellRange(Cell cell) - : this(cell.Row, cell.Column, cell.Row, cell.Column) - { - } - - public static CellRange Empty = new CellRange(-1, -1, -1, -1); - - /// - /// Returns number of cells in the range. Read-only. - /// - public int NumCells - { - get { return (rowLast - rowFirst + 1) * (columnLast - columnFirst + 1); } - } - - public int CellIndex(Cell cell) - { - return (cell.Row - rowFirst + 1) * (cell.Column - columnFirst + 1) - 1; - } - - public bool IsSingleCell - { - get { return rowFirst == rowLast && columnFirst == columnLast; } - } - - public Walkers.RangeWalker GetWalker(Worksheet ws) - { - return new Walkers.RangeWalker(this, ws); - } - - public bool Contains(Cell cell) - { - return rowFirst <= cell.Row && rowLast >= cell.Row && - columnFirst <= cell.Column && columnLast >= cell.Column; - } - - /// - /// If the range fully covers the specified one - /// - /// - /// - public bool Covers(CellRange another_range) - { - return (another_range.rowFirst >= rowFirst && another_range.rowLast <= rowLast && - another_range.columnFirst >= columnFirst && another_range.columnLast <= columnLast); - } - - public bool IsIntersectedWith(CellRange another_range) - { - return !(another_range.rowLast < rowFirst && another_range.rowFirst < rowFirst || - another_range.rowLast > rowLast && another_range.rowFirst > rowLast || - another_range.columnFirst < columnFirst && another_range.columnLast < columnFirst || - another_range.columnFirst > columnLast && another_range.columnLast > columnLast); - } - - public bool IsBoundaryIntersectedWith(CellRange another_range) - { - bool top_left_inside = another_range.Contains(TopLeft); - bool top_right_inside = another_range.Contains(TopRight); - bool bottom_left_inside = another_range.Contains(BottomLeft); - bool bottom_right_inside = another_range.Contains(BottomRight); - - return (top_left_inside || top_right_inside || bottom_left_inside || bottom_right_inside) && - (!top_left_inside || !top_right_inside || !bottom_left_inside || !bottom_right_inside); - } - - public CellRange BoundingBox(CellRange another_range) - { - return new CellRange(Math.Min(rowFirst, another_range.rowFirst), Math.Min(columnFirst, another_range.columnFirst), - Math.Max(rowLast, another_range.rowLast), Math.Max(columnLast, another_range.columnLast)); - } - - public CellRange Intersect(CellRange another_range) - { - if (!IsIntersectedWith(another_range)) - { - return Empty; - } - - return new CellRange(Math.Max(rowFirst, another_range.rowFirst), Math.Max(columnFirst, another_range.columnFirst), - Math.Min(rowLast, another_range.rowLast), Math.Min(columnLast, another_range.columnLast)); - } - - - public static bool operator ==(CellRange one, CellRange other) - { - return one.CompareTo(other) == 0; - } - - public static bool operator !=(CellRange one, CellRange other) - { - return one.CompareTo(other) != 0; - } - - public override int GetHashCode() - { - int hash_top_left = TopLeft.GetHashCode(); - return ((hash_top_left << 16) | (hash_top_left >> 16)) ^ BottomRight.GetHashCode(); - } - - public override bool Equals(object obj) - { - if (!(obj is CellRange)) - { - return false; - } - CellRange other_cell = (CellRange)obj; - return rowFirst == other_cell.rowFirst && columnFirst == other_cell.columnFirst && - rowLast == other_cell.rowLast && columnLast == other_cell.columnLast; - } - - public override string ToString() - { - return Helpers.ReferencesFormat.range2str(rowFirst, true, columnFirst, true, rowLast, true, columnLast, true); - } - - public Cell TopLeft { get { return new Cell(rowFirst, columnFirst); } } - public Cell TopRight { get { return new Cell(rowFirst, columnLast); } } - public Cell BottomLeft { get { return new Cell(rowLast, columnFirst); } } - public Cell BottomRight { get { return new Cell(rowLast, columnLast); } } - - public static CellRange operator +(CellRange range, Offset offset) - { - CellRange result = new CellRange(range.rowFirst + offset.RowOffset, range.columnFirst + offset.ColumnOffset, range.rowLast + offset.RowOffset, range.columnLast + offset.ColumnOffset); - if (result.RowFirst < 1 || result.ColumnFirst < 1 || - result.RowLast > Helpers.ReferencesFormat.maxRow || result.ColumnLast > Helpers.ReferencesFormat.maxCol) - { - return Empty; - } - return result; - } - - public static CellRange operator -(CellRange range, Offset offset) - { - CellRange result = new CellRange(range.rowFirst - offset.RowOffset, range.columnFirst - offset.ColumnOffset, range.rowLast - offset.RowOffset, range.columnLast - offset.ColumnOffset); - if (result.RowFirst < 1 || result.ColumnFirst < 1 || - result.RowLast > Helpers.ReferencesFormat.maxRow || result.ColumnLast > Helpers.ReferencesFormat.maxCol) - { - return Empty; - } - return result; - } - - /// - /// Note: We assume here that the range_sub is always a set of columns or set of rows and never the general type range - /// - /// - /// - public CellRange Cut(CellRange range_sub) - { - // Rule #1 - if (range_sub.Covers(this)) - { - return Empty; - } - // Rule #2 - if (!IsIntersectedWith(range_sub)) - { - return this; - } - bool top_left_inside = range_sub.Contains(TopLeft); - bool top_right_inside = range_sub.Contains(TopRight); - bool bottom_left_inside = range_sub.Contains(BottomLeft); - bool bottom_right_inside = range_sub.Contains(BottomRight); - - // Rule #3 (When the range_sub is vertically inside or horizontally inside. Like a cross figure in geometry.) - if (!top_left_inside && !bottom_right_inside && !top_right_inside && !bottom_left_inside) // Based on rules #1 and #2 - { - Cells.Offset offset = new Cells.Offset(range_sub.IsSetOfColumns ? 0 : -range_sub.Height, range_sub.IsSetOfRows ? 0 : -range_sub.Width); - return Resize(offset); - } - - // Rule #4 (When the top shall be cut) - if (top_left_inside && top_right_inside) - { - return new CellRange(range_sub.RowLast + 1, ColumnFirst, RowLast, ColumnLast); - } - - // Rule #5 (When the bottom shall be cut) - if (bottom_left_inside && bottom_right_inside) - { - return new CellRange(RowFirst, ColumnFirst, range_sub.RowFirst - 1, ColumnLast); - } - - // Rule #6 (When the left shall be cut) - if (top_left_inside && bottom_left_inside) - { - return new CellRange(RowFirst, range_sub.ColumnLast + 1, RowLast, ColumnLast); - } - - // Rule #7 (When the right shall be cut) - if (top_right_inside && bottom_right_inside) - { - return new CellRange(RowFirst, ColumnFirst, RowLast, range_sub.ColumnFirst - 1); - } - - return this; - } - - public CellRange Resize(Offset offset) - { - // Vertically - if (offset.RowOffset != 0) // Assumed that resized shall be performed vertically - { - if (IsSetOfColumns) // If the range is a set of columns, leave it the same size - { - return this; - } - return new CellRange(RowFirst - offset.RowOffset, ColumnFirst, RowLast, ColumnLast); // Will be moved down later in ChangeObserverOnRangeRemoved - } - // Horizontally - if (offset.ColumnOffset != 0) // Assumed that resized shall be performed horizontally - { - if (IsSetOfRows) // If the range is a set of rows, leave it the same size - { - return this; - } - return new CellRange(RowFirst, ColumnFirst - offset.ColumnOffset, RowLast, ColumnLast); // Will be moved right later in ChangeObserverOnRangeRemoved - } - - return this; - } - - #region IEnumerable Members - - public IEnumerator GetEnumerator() - { - return new Enumerator(this); - } - - #endregion - - #region IEnumerable Members - - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() - { - return new Enumerator(this); - } - - #endregion - - internal class Enumerator : IEnumerator - { - public Enumerator(CellRange range) - { - this.range = range; - current_row = range.RowFirst - 1; - current_column = range.ColumnLast; - } - - #region IEnumerator Members - - public Cell Current - { - get { return new Cell(current_row, current_column); } - } - - #endregion - - #region IDisposable Members - - public void Dispose() - { - } - - #endregion - - #region IEnumerator Members - - object System.Collections.IEnumerator.Current - { - get { return new Cell(current_row, current_column); } - } - - public bool MoveNext() - { - if (range == CellRange.Empty) - { - return false; - } - if (current_column + 1 > range.ColumnLast) - { - if (current_row + 1 > range.RowLast) - { - return false; - } - ++current_row; - current_column = range.ColumnFirst; - } - else - { - ++current_column; - } - return true; - } - - public void Reset() - { - throw new NotSupportedException(); - } - - #endregion - - private Cells.CellRange range; - private int current_row; - private int current_column; - } - - #region IComparable Members - - public int CompareTo(CellRange other) - { - int cmp_cell_result = TopLeft.CompareTo(other.TopLeft); - if (cmp_cell_result != 0) - { - return cmp_cell_result; - } - else - { - return BottomRight.CompareTo(other.BottomRight); - } - } - - #endregion - - public bool IsSetOfRows { get { return ColumnFirst == 1 && ColumnLast == Helpers.ReferencesFormat.maxCol; } } - public bool IsSetOfColumns { get { return RowFirst == 1 && RowLast == Helpers.ReferencesFormat.maxRow; } } - public int Width { get { return ColumnLast - ColumnFirst + 1; } } - public int Height { get { return RowLast - RowFirst + 1; } } - - public int RowFirst { get { return rowFirst; } } - public int ColumnFirst { get { return columnFirst; } } - public int RowLast { get { return rowLast; } } - public int ColumnLast { get { return columnLast; } } - - private readonly int rowFirst; - private readonly int columnFirst; - private readonly int rowLast; - private readonly int columnLast; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Cells/CellRange3D.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Cells/CellRange3D.cs deleted file mode 100644 index 4f867ae006..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Cells/CellRange3D.cs +++ /dev/null @@ -1,104 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.RegularExpressions; - -namespace ASCOfficeEWSEditor.Editor.Cells -{ - internal class CellRange3D - { - - public CellRange3D(CellRange cell_range, Worksheet worksheet_from, Worksheet worksheet_to) - { - CellRange = cell_range; - if(worksheet_from == null || worksheet_to == null) - { - WorksheetFrom = WorksheetTo = null; - return; - } - if (worksheet_from.Index <= worksheet_to.Index) - { - WorksheetFrom = worksheet_from; - WorksheetTo = worksheet_to; - } - else - { - WorksheetFrom = worksheet_to; - WorksheetTo = worksheet_from; - } - } - - public CellRange3D(CellRange cell_range, Worksheet worksheet) - : this(cell_range, worksheet, worksheet) - { - } - - public CellRange3D(Cell cell, Worksheet worksheet) - : this(new CellRange(cell), worksheet, worksheet) - { - } - - public static CellRange3D Empty = new CellRange3D(CellRange.Empty, null, null); - - public bool IsSingleCell - { - get { return CellRange.IsSingleCell && WorksheetFrom == WorksheetTo; } - } - - public bool IsIntersectedWith(CellRange3D another_range) - { - return CellRange.IsIntersectedWith(another_range.CellRange) && - !(WorksheetFrom.Index > another_range.WorksheetTo.Index || WorksheetTo.Index < another_range.WorksheetFrom.Index); - } - - public CellRange3D BoundingBox(CellRange3D another_range) - { - Worksheet ws_min = WorksheetFrom.Index < another_range.WorksheetFrom.Index ? WorksheetFrom : another_range.WorksheetFrom; - Worksheet ws_max = WorksheetTo.Index > another_range.WorksheetTo.Index ? WorksheetTo : another_range.WorksheetTo; - return new CellRange3D(CellRange.BoundingBox(another_range.CellRange), ws_min, ws_max); - } - - public CellRange3D Intersect(CellRange3D another_range) - { - if (!IsIntersectedWith(another_range)) - { - return Empty; - } - - Worksheet ws_min = WorksheetFrom.Index > another_range.WorksheetFrom.Index ? WorksheetFrom : another_range.WorksheetFrom; - Worksheet ws_max = WorksheetTo.Index < another_range.WorksheetTo.Index ? WorksheetTo : another_range.WorksheetTo; - return new CellRange3D(CellRange.Intersect(another_range.CellRange), ws_min, ws_max); - } - - public override string ToString() - { - return ToString3DPart(WorksheetFrom, WorksheetTo) + CellRange.ToString(); - } - private static Regex rx_AllowedName = new Regex("^\\w[\\w\\d.]*$"); - internal static string ToString3DPart(Worksheet ws_from, Worksheet ws_to) - { - if (ws_from == ws_to) - { - string name = ws_from.Name.Replace("'", "''"); - if (!rx_AllowedName.Match(name).Success) - { - return "\'" + name + "\'!"; - } - return name + "!"; - - } - string name_from = ws_from.Name.Replace("'", "''"); - string name_to = ws_to.Name.Replace("'", "''"); - - if (!rx_AllowedName.Match(name_from).Success || !rx_AllowedName.Match(name_to).Success) - { - return "\'" + name_from + ":" + name_to + "\'!"; - } - return name_from + ":" + name_to + "!"; - } - - public CellRange CellRange { get; private set; } - public Worksheet WorksheetFrom { get; private set; } - public Worksheet WorksheetTo { get; private set; } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Cells/CellRangeRel.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Cells/CellRangeRel.cs deleted file mode 100644 index 1868aeca17..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Cells/CellRangeRel.cs +++ /dev/null @@ -1,118 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Cells -{ - internal class CellRangeRel - { - public CellRangeRel(string ref_str, Workbook parent_book) - { - if (!Helpers.ReferencesFormat.str2ref(ref_str.ToUpper(), out rowFirst, out rowFirstRelative, out columnFirst, out columnFirstRelative, - out rowLast, out rowLastRelative, out columnLast, out columnLastRelative)) - { - parent_book.ReportError(new Events.WrongReferenceFormatError(ref_str)); - } - } - - private CellRangeRel(int rowFirst, bool rowFirstRelative, int columnFirst, bool columnFirstRelative, - int rowLast, bool rowLastRelative, int columnLast, bool columnLastRelative) - { - this.rowFirst = rowFirst; - this.rowFirstRelative = rowFirstRelative; - this.columnFirst = columnFirst; - this.columnFirstRelative = columnFirstRelative; - this.rowLast = rowLast; - this.rowLastRelative = rowLastRelative; - this.columnLast = columnLast; - this.columnLastRelative = columnLastRelative; - } - - public static CellRangeRel Empty = new CellRangeRel(-1, true, -1, true, -1, true, -1, true); - - override public string ToString() - { - return Helpers.ReferencesFormat.range2str(rowFirst, rowFirstRelative, columnFirst, columnFirstRelative, - rowLast, rowLastRelative, columnLast, columnLastRelative); - } - - public Cell ToCell() - { - return new Cell(rowFirst, columnFirst); - } - - public CellRange ToCellRange() - { - return new CellRange(rowFirst, columnFirst, rowLast, columnLast); - } - - public static CellRangeRel operator+(CellRangeRel range, Offset offset) - { - CellRangeRel result = new CellRangeRel(range.rowFirstRelative ? range.rowFirst + offset.RowOffset : range.rowFirst, range.rowFirstRelative, - range.columnFirstRelative ? range.columnFirst + offset.ColumnOffset : range.columnFirst, range.columnFirstRelative, - range.rowLastRelative ? range.rowLast + offset.RowOffset : range.rowLast, range.rowLastRelative, - range.columnLastRelative ? range.columnLast + offset.ColumnOffset : range.columnLast, range.columnLastRelative); - if (result.rowFirst < 1 || result.columnFirst < 1 || - result.rowLast > Helpers.ReferencesFormat.maxRow || result.columnLast > Helpers.ReferencesFormat.maxCol) - { - return Empty; - } - return result; - - } - - /// - /// Shifts the range independent on relativity - /// - /// - public CellRangeRel Shift(Offset offset) - { - CellRange range = ToCellRange(); - if (offset.RowOffset != 0 && range.IsSetOfColumns || offset.ColumnOffset != 0 && range.IsSetOfRows) - { - return this; - } - range += offset; - if (range == CellRange.Empty) - { - return Empty; - } - return new CellRangeRel(range.RowFirst, rowFirstRelative, range.ColumnFirst, columnFirstRelative, - range.RowLast, rowLastRelative, range.ColumnLast, columnLastRelative); - } - - public CellRangeRel Cut(CellRange range_sub) - { - CellRange range = ToCellRange().Cut(range_sub); - if (range != CellRange.Empty) - { - return new CellRangeRel(range.RowFirst, rowFirstRelative, range.ColumnFirst, columnFirstRelative, - range.RowLast, rowLastRelative, range.ColumnLast, columnLastRelative); - } - return Empty; - } - - public CellRangeRel Resize(Offset offset) - { - CellRange range = ToCellRange().Resize(offset); - if (range != CellRange.Empty) - { - return new CellRangeRel(range.RowFirst, rowFirstRelative, range.ColumnFirst, columnFirstRelative, - range.RowLast, rowLastRelative, range.ColumnLast, columnLastRelative); - } - return Empty; - } - - public bool IsRelative { get { return rowFirstRelative || rowLastRelative || columnFirstRelative || columnLastRelative; } } - - // All numbers are 1-based - private readonly int rowFirst; - private readonly int rowLast; - private readonly int columnFirst; - private readonly int columnLast; - private readonly bool rowFirstRelative; - private readonly bool rowLastRelative; - private readonly bool columnFirstRelative; - private readonly bool columnLastRelative; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Cells/Offset.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Cells/Offset.cs deleted file mode 100644 index a201781fc1..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Cells/Offset.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Cells -{ - public struct Offset - { - public static Offset Null = new Offset(0, 0); - internal Offset(int row_offset, int column_offset) - { - RowOffset = row_offset; - ColumnOffset = column_offset; - } - - public override string ToString() - { - return "{" + RowOffset + ", " + ColumnOffset + "}"; - } - - public int RowOffset; - public int ColumnOffset; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Charts/Anchor.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Charts/Anchor.cs deleted file mode 100644 index dd01f32cd5..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Charts/Anchor.cs +++ /dev/null @@ -1,597 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; - -namespace ASCOfficeEWSEditor.Editor.Charts -{ - /// - /// Absolute anchor of a drawing displacement - /// - public class AbsoluteAnchor - { - private XmlNode anchor_xml; - private Sheet parent_sheet; - - internal AbsoluteAnchor(XmlNode anchor_xml, Sheet parent_sheet) - { - this.anchor_xml = anchor_xml; - this.parent_sheet = parent_sheet; - } - - /// - /// Width of the chart. Measured in points - /// - public double Width - { - get - { - XmlElement ext_xml = (XmlElement)anchor_xml.SelectSingleNode("xdr:ext", parent_sheet.Workbook.NamespaceManager); - if (ext_xml != null) - { - long cx; - if (long.TryParse(ext_xml.GetAttribute("cx"), out cx)) - { - return cx / 12700.0; - } - } - return 0; - } - } - - /// - /// Height of the chart. Measured in points - /// - public double Height - { - get - { - XmlElement ext_xml = (XmlElement)anchor_xml.SelectSingleNode("xdr:ext", parent_sheet.Workbook.NamespaceManager); - if (ext_xml != null) - { - long cy; - if (long.TryParse(ext_xml.GetAttribute("cy"), out cy)) - { - return cy / 12700.0; - } - } - return 0; - } - } - - /// - /// X position of the chart. Measured in points - /// - public double PosX - { - get - { - XmlElement ext_xml = (XmlElement)anchor_xml.SelectSingleNode("xdr:pos", parent_sheet.Workbook.NamespaceManager); - if (ext_xml != null) - { - long x; - if (long.TryParse(ext_xml.GetAttribute("x"), out x)) - { - return x / 12700.0; - } - } - return 0; - } - } - - /// - /// Y position of the chart. Measured in points - /// - public double PosY - { - get - { - XmlElement ext_xml = (XmlElement)anchor_xml.SelectSingleNode("xdr:pos", parent_sheet.Workbook.NamespaceManager); - if (ext_xml != null) - { - long y; - if (long.TryParse(ext_xml.GetAttribute("y"), out y)) - { - return y / 12700.0; - } - } - return 0; - } - } - } - - - /// - /// Two cells anchor of a drawing displacement - /// - public class TwoCellAnchor - { - private XmlNode anchor_xml; - private Sheet parent_sheet; - - internal TwoCellAnchor(XmlNode anchor_xml, Sheet parent_sheet) - { - this.anchor_xml = anchor_xml; - this.parent_sheet = parent_sheet; - - LeftColumn = GetIntFromNode("xdr:from/xdr:col", 0); - RightColumn = GetIntFromNode("xdr:to/xdr:col", 0); - TopRow = GetIntFromNode("xdr:from/xdr:row", 0); - BottomRow = GetIntFromNode("xdr:to/xdr:row", 0); - - // - xmlManager = parent_sheet.Workbook.NamespaceManager; - from = (XmlElement)anchor_xml.SelectSingleNode("xdr:from", xmlManager); - to = (XmlElement)anchor_xml.SelectSingleNode("xdr:to", xmlManager); - frame = (XmlElement)anchor_xml.SelectSingleNode("xdr:graphicFrame", xmlManager); - sheet_id = 0; - chart_guid = Guid.NewGuid().ToString(); - } - - // - public int sheet_id; - public string chart_guid; - public XmlElement from, to, frame; - XmlNamespaceManager xmlManager; - - #region xdr:from - public int from_col - { - get - { - int retVal = -1; - if (from != null) - { - XmlElement col = (XmlElement)from.SelectSingleNode("xdr:col", xmlManager); - if (col != null) - retVal = int.Parse(col.InnerText); - } - - return retVal; - } - set - { - if (from != null) - { - XmlElement col = (XmlElement)from.SelectSingleNode("xdr:col", xmlManager); - if (col != null) - col.InnerText = value.ToString(); - } - } - } - - public int from_colOff - { - get - { - int retVal = -1; - if (from != null) - { - XmlElement colOff = (XmlElement)from.SelectSingleNode("xdr:colOff", xmlManager); - if (colOff != null) - retVal = int.Parse(colOff.InnerText); - } - - return retVal; - } - set - { - if (from != null) - { - XmlElement colOff = (XmlElement)from.SelectSingleNode("xdr:colOff", xmlManager); - if (colOff != null) - colOff.InnerText = value.ToString(); - } - } - } - - public int from_row - { - get - { - int retVal = -1; - if (from != null) - { - XmlElement row = (XmlElement)from.SelectSingleNode("xdr:row", xmlManager); - if (row != null) - retVal = int.Parse(row.InnerText); - } - - return retVal; - } - set - { - if (from != null) - { - XmlElement row = (XmlElement)from.SelectSingleNode("xdr:row", xmlManager); - if (row != null) - row.InnerText = value.ToString(); - } - } - } - - public int from_rowOff - { - get - { - int retVal = -1; - if (from != null) - { - XmlElement rowOff = (XmlElement)from.SelectSingleNode("xdr:rowOff", xmlManager); - if (rowOff != null) - retVal = int.Parse(rowOff.InnerText); - } - - return retVal; - } - set - { - if (from != null) - { - XmlElement rowOff = (XmlElement)from.SelectSingleNode("xdr:rowOff", xmlManager); - if (rowOff != null) - rowOff.InnerText = value.ToString(); - } - } - } - #endregion - - #region xdr:to - public int to_col - { - get - { - int retVal = -1; - if (to != null) - { - XmlElement col = (XmlElement)to.SelectSingleNode("xdr:col", xmlManager); - if (col != null) - retVal = int.Parse(col.InnerText); - } - - return retVal; - } - set - { - if (to != null) - { - XmlElement col = (XmlElement)to.SelectSingleNode("xdr:col", xmlManager); - if (col != null) - col.InnerText = value.ToString(); - } - } - } - - public int to_colOff - { - get - { - int retVal = -1; - if (to != null) - { - XmlElement colOff = (XmlElement)to.SelectSingleNode("xdr:colOff", xmlManager); - if (colOff != null) - retVal = int.Parse(colOff.InnerText); - } - - return retVal; - } - set - { - if (to != null) - { - XmlElement colOff = (XmlElement)to.SelectSingleNode("xdr:colOff", xmlManager); - if (colOff != null) - colOff.InnerText = value.ToString(); - } - } - } - - public int to_row - { - get - { - int retVal = -1; - if (to != null) - { - XmlElement row = (XmlElement)to.SelectSingleNode("xdr:row", xmlManager); - if (row != null) - retVal = int.Parse(row.InnerText); - } - - return retVal; - } - set - { - if (to != null) - { - XmlElement row = (XmlElement)to.SelectSingleNode("xdr:row", xmlManager); - if (row != null) - row.InnerText = value.ToString(); - } - } - } - - public int to_rowOff - { - get - { - int retVal = -1; - if (to != null) - { - XmlElement rowOff = (XmlElement)to.SelectSingleNode("xdr:rowOff", xmlManager); - if (rowOff != null) - retVal = int.Parse(rowOff.InnerText); - } - - return retVal; - } - set - { - if (to != null) - { - XmlElement rowOff = (XmlElement)to.SelectSingleNode("xdr:rowOff", xmlManager); - if (rowOff != null) - rowOff.InnerText = value.ToString(); - } - } - } - #endregion - - #region xdr:graphicFrame - public int frame_id - { - get - { - int retVal = -1; - if (frame != null) - { - XmlElement id = (XmlElement)frame.SelectSingleNode("xdr:nvGraphicFramePr/xdr:cNvPr", xmlManager); - if (id != null) - retVal = int.Parse(id.GetAttribute("id")); - } - - return retVal; - } - set - { - if (frame != null) - { - XmlElement id = (XmlElement)frame.SelectSingleNode("xdr:nvGraphicFramePr/xdr:cNvPr", xmlManager); - if (id != null) - id.SetAttribute("id", value.ToString()); - } - } - } - - public string chart_rid - { - get - { - string retVal = ""; - if (frame != null) - { - XmlElement rid = (XmlElement)frame.SelectSingleNode("a:graphic/a:graphicData/c:chart", xmlManager); - if (rid != null) - retVal = rid.GetAttribute("id", xmlManager.LookupNamespace("mainr")); - } - - return retVal; - } - set - { - if (frame != null) - { - XmlElement rid = (XmlElement)frame.SelectSingleNode("a:graphic/a:graphicData/c:chart", xmlManager); - if (rid != null) - rid.SetAttribute("r:id", value.ToString()); - } - } - } - #endregion - - #region chart_xOff - public int chart_xOff - { - get - { - int retVal = -1; - if (frame != null) - { - XmlElement cw = (XmlElement)frame.SelectSingleNode("xdr:xfrm/a:off", xmlManager); - if (cw != null) - retVal = int.Parse(cw.GetAttribute("x")); - } - return retVal; - } - - set - { - if (frame != null) - { - XmlElement cw = (XmlElement)frame.SelectSingleNode("xdr:xfrm/a:off", xmlManager); - if (cw != null) - cw.SetAttribute("x", value.ToString()); - } - } - } - #endregion - - #region chart_yOff - public int chart_yOff - { - get - { - int retVal = -1; - if (frame != null) - { - XmlElement ch = (XmlElement)frame.SelectSingleNode("xdr:xfrm/a:off", xmlManager); - if (ch != null) - retVal = int.Parse(ch.GetAttribute("y")); - } - return retVal; - } - - set - { - if (frame != null) - { - XmlElement ch = (XmlElement)frame.SelectSingleNode("xdr:xfrm/a:off", xmlManager); - if (ch != null) - ch.SetAttribute("y", value.ToString()); - } - } - } - #endregion - - #region chart_width - public int chart_width - { - get - { - int retVal = -1; - if (frame != null) - { - XmlElement cw = (XmlElement)frame.SelectSingleNode("xdr:xfrm/a:ext", xmlManager); - if (cw != null) - retVal = int.Parse(cw.GetAttribute("cx")); - } - return retVal; - } - - set - { - if (frame != null) - { - XmlElement cw = (XmlElement)frame.SelectSingleNode("xdr:xfrm/a:ext", xmlManager); - if (cw != null) - cw.SetAttribute("cx", value.ToString()); - } - } - } - #endregion - - #region chart_height - public int chart_height - { - get - { - int retVal = -1; - if (frame != null) - { - XmlElement ch = (XmlElement)frame.SelectSingleNode("xdr:xfrm/a:ext", xmlManager); - if (ch != null) - retVal = int.Parse(ch.GetAttribute("cy")); - } - return retVal; - } - - set - { - if (frame != null) - { - XmlElement ch = (XmlElement)frame.SelectSingleNode("xdr:xfrm/a:ext", xmlManager); - if (ch != null) - ch.SetAttribute("cy", value.ToString()); - } - } - } - #endregion - - // - - private int GetIntFromNode(string path, int default_value) - { - int num = default_value; - XmlElement num_xml = (XmlElement)anchor_xml.SelectSingleNode(path, parent_sheet.Workbook.NamespaceManager); - if (num_xml != null) - { - int.TryParse(num_xml.InnerText, out num); - } - return num; - } - - /// - /// Left column (zero-based) - /// - internal int LeftColumn { get; private set; } - /// - /// Right column (zero-based) - /// - internal int RightColumn { get; private set; } - /// - /// Top row (zero-based) - /// - internal int TopRow { get; private set; } - /// - /// Bottom row (zero-based) - /// - internal int BottomRow { get; private set; } - - - - /// - /// Reference of the cell where the top left corner of the anchor is located. - /// - public string TopLeftRef - { - get - { - return new Cells.Cell(TopRow + 1, LeftColumn + 1).ToString(); - } - } - - /// - /// Reference of the cell where the bottom right corner of the anchor is located. - /// - public string BottomRightRef - { - get - { - return new Cells.Cell(BottomRow + 1, RightColumn + 1).ToString(); - } - } - - /// - /// Offset in points inside a cell where the top left corner is located - /// - public Chart.XY TopLeftOffset - { - get - { - return GetCornerOffset("xdr:from"); - } - } - - /// - /// Offset in points inside a cell where the bottom right corner is located - /// - public Chart.XY BottomRightOffset - { - get - { - return GetCornerOffset("xdr:to"); - } - } - - private Chart.XY GetCornerOffset(string to_from_tag_name) - { - int col_off = 0; - XmlElement col_xml = (XmlElement)anchor_xml.SelectSingleNode(to_from_tag_name + "/xdr:colOff", parent_sheet.Workbook.NamespaceManager); - if (col_xml != null) - { - int.TryParse(col_xml.InnerText, out col_off); - } - int row_off = 0; - XmlElement row_xml = (XmlElement)anchor_xml.SelectSingleNode(to_from_tag_name + "/xdr:rowOff", parent_sheet.Workbook.NamespaceManager); - if (row_xml != null) - { - int.TryParse(row_xml.InnerText, out row_off); - } - - return new Chart.XY(col_off / 12700.0, row_off / 12700.0); - } - - - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Charts/BasicChar.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Charts/BasicChar.cs deleted file mode 100644 index 303833632e..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Charts/BasicChar.cs +++ /dev/null @@ -1,126 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; - -namespace ASCOfficeEWSEditor.Editor.Charts -{ - public class BasicChar - { - XmlNamespaceManager xmlManager; - XmlNode barChart; - string chartName; - public Chart chart { get; private set; } - public List seriesList; - public Sheet parent_sheet { get; private set; } - - public BasicChar(XmlNode bar_chart_xml, string chartName, Chart chart, XmlNamespaceManager ns_manager) - { - this.parent_sheet = chart.parent_sheet; - this.xmlManager = ns_manager; - this.barChart = bar_chart_xml; - this.chartName = chartName; - this.chart = chart; - seriesList = new List(); - - InitSubAreas(bar_chart_xml); - } - - public bool AddSeries(int count) - { - bool bResult = true; - - XmlNodeList allSeries = barChart.SelectNodes("c:ser", xmlManager); - - for (int i = 0; i < count; i++) - { - XmlNode lastSeries = allSeries[allSeries.Count - 1].Clone(); - XmlElement idxNode = (XmlElement)lastSeries.SelectSingleNode("c:idx", xmlManager); - XmlElement orderNode = (XmlElement)lastSeries.SelectSingleNode("c:order", xmlManager); - - idxNode.SetAttribute("val", (allSeries.Count + i).ToString()); - orderNode.SetAttribute("val", (allSeries.Count + i).ToString()); - - barChart.AppendChild(lastSeries); - InitSubAreas(barChart); - } - - return bResult; - } - - private void InitSubAreas(XmlNode bar_chart) - { - // ищём серии и берём значения - XmlNodeList allSeries = bar_chart.SelectNodes("c:ser", xmlManager); - if (allSeries == null) - return; - - seriesList = new List(); - foreach (XmlNode series in allSeries) - { - seriesList.Add(new Series(series, this, xmlManager)); - } - } - - public string chartType - { - get - { - string retVal = ""; - if (barChart != null) - { - XmlElement barDir = (XmlElement)barChart.SelectSingleNode("c:barDir", xmlManager); - if (barDir != null) - retVal = barDir.GetAttribute("val"); - else if (chartName == "areaChart" || chartName == "pieChart" || chartName == "bubbleChart" || - chartName == "lineChart" || chartName == "scatterChart" || chartName == "radarChart" || - chartName == "doughnutChart" || chartName == "stockChart") - retVal = chartName; - } - - return retVal; - } - set - { - if (!string.IsNullOrEmpty(value)) - { - XmlElement barDir = (XmlElement)barChart.SelectSingleNode("c:barDir", xmlManager); - if (barDir != null) - barDir.SetAttribute("val", value); - } - } - } - - public string seriesType - { - get - { - string retVal = ""; - if (barChart != null) - { - XmlElement grouping = (XmlElement)barChart.SelectSingleNode("c:grouping", xmlManager); - if (grouping != null) - retVal = grouping.GetAttribute("val"); - } - - return retVal; - } - set - { - if (!string.IsNullOrEmpty(value)) - { - XmlElement grouping = (XmlElement)barChart.SelectSingleNode("c:grouping", xmlManager); - if (grouping != null) - grouping.SetAttribute("val", value); - - if ((value == "stacked") || (value == "percentStacked")) - { - XmlElement overlap = (XmlElement)barChart.SelectSingleNode("c:overlap", xmlManager); - if (overlap != null) - overlap.SetAttribute("val", "100"); - } - } - } - } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Charts/Chart.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Charts/Chart.cs deleted file mode 100644 index 785fcc94ff..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Charts/Chart.cs +++ /dev/null @@ -1,254 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; - -namespace ASCOfficeEWSEditor.Editor.Charts -{ - /// - /// Chart - /// - public class Chart - { - public XmlNode chart_file_xml; - public XmlNode anchor_xml; - public Sheet parent_sheet { get; private set; } - - internal Chart(XmlNode chart_file_xml, XmlNode anchor_xml, Sheet parent_sheet) - { - this.chart_file_xml = chart_file_xml; - this.anchor_xml = anchor_xml; - this.parent_sheet = parent_sheet; - - InitSubAreas(); - } - - private void InitSubAreas() - { - #region Common variables - XmlNamespaceManager ns_manager = parent_sheet.Workbook.NamespaceManager; - XmlNode chart_xml = chart_file_xml.SelectSingleNode("c:chartSpace/c:chart", ns_manager); - if (chart_xml == null) - { - throw new Events.ReportableException(new Events.InternalError("Wrong OOX format. Required 'chart' tag is absent inside \"" + ((XmlElement)chart_file_xml).GetAttribute("name") + "\".")); - } - #endregion - - #region Width / Height - - Height = GetHeight(); - Width = GetWidth(); - em = parent_sheet.Workbook.DefaultFontSize; - - #endregion - - #region Legend - XmlNode legend_xml = chart_xml.SelectSingleNode("c:legend", ns_manager); - Legend = legend_xml != null ? new Legend(legend_xml, this, ns_manager) : null; - #endregion - - #region Layout - XmlNode layout_xml = chart_xml.SelectSingleNode("c:layout/c:manualLayout", ns_manager); - ManualLayout = layout_xml != null ? new Layout(layout_xml, this, new XY(0, 0), ns_manager) : null; - #endregion - - #region Anchors - AbsoluteAnchor = GetAbsoluteAnchor(); - TwoCellAnchor = GetTwoCellAnchor(); - #endregion - - #region Plot area - - XmlNode plot_area_xml = chart_xml.SelectSingleNode("c:plotArea", ns_manager); - if (plot_area_xml == null) - { - throw new Events.ReportableException(new Events.InternalError("Wrong OOX format. Required 'plotArea' tag is absent inside chart.")); - } - PlotArea = new PlotArea(plot_area_xml, this, ns_manager); - - #endregion - } - - public void DeleteLegend() - { - XmlNamespaceManager ns_manager = parent_sheet.Workbook.NamespaceManager; - XmlNode chart_xml = chart_file_xml.SelectSingleNode("c:chartSpace/c:chart", ns_manager); - XmlNode legend_xml = chart_xml.SelectSingleNode("c:legend", ns_manager); - chart_xml.RemoveChild(legend_xml); - Legend = null; - } - - public string title - { - get - { - // имя может быть составным, например, на разных языках - string retVal = ""; - - XmlNodeList titleNodes = chart_file_xml.SelectNodes("c:chartSpace/c:chart/c:title/c:tx/c:rich/a:p/a:r/a:t", parent_sheet.Workbook.NamespaceManager); - for (int i = 0; i < titleNodes.Count; i++) - { - retVal += ((i > 0) ? " " : "") + titleNodes[i].InnerText; - } - - return retVal; - } - set - { - if (!string.IsNullOrEmpty(value)) - { - XmlNode titleNode = (XmlElement)chart_file_xml.SelectSingleNode("c:chartSpace/c:chart/c:title/c:tx/c:rich/a:p/a:r/a:t", parent_sheet.Workbook.NamespaceManager); - if (titleNode != null) - titleNode.InnerText = value; - } - } - } - - #region Extraction methods - - private AbsoluteAnchor GetAbsoluteAnchor() - { - if (anchor_xml.Name == "xdr:absoluteAnchor") - { - return new AbsoluteAnchor(anchor_xml, parent_sheet); - } - return null; - - } - - private TwoCellAnchor GetTwoCellAnchor() - { - if (anchor_xml.Name == "xdr:twoCellAnchor") - { - return new TwoCellAnchor(anchor_xml, parent_sheet); - } - return null; - } - - #endregion - - - #region public extraction methods - - /// - /// Width of the chart - /// - /// width in points - public double GetWidth() - { - if (AbsoluteAnchor != null) - { - return AbsoluteAnchor.Width; - } - else if (TwoCellAnchor != null) - { - int font0size = parent_sheet.Workbook.DefaultFontSize; - Worksheet ws = parent_sheet as Worksheet; - if (ws != null) - { - Cells.CellRange cell_range = new Cells.CellRange(TwoCellAnchor.TopRow, TwoCellAnchor.LeftColumn, TwoCellAnchor.BottomRow, TwoCellAnchor.RightColumn); - Range range = new Range(cell_range, ws); - double left_inset = TwoCellAnchor.TopLeftOffset.x; - double right_inset = ws.Cell(cell_range.BottomRight).Width * font0size - TwoCellAnchor.BottomRightOffset.x; - - return range.Width * font0size - left_inset - right_inset; - } - } - return 0; - } - - /// Height of the chart - /// - /// height in points - public double GetHeight() - { - if (AbsoluteAnchor != null) - { - return AbsoluteAnchor.Height; - } - else if (TwoCellAnchor != null) - { - int font0size = parent_sheet.Workbook.DefaultFontSize; - Worksheet ws = parent_sheet as Worksheet; - if (ws != null) - { - Cells.CellRange cell_range = new Cells.CellRange(TwoCellAnchor.TopRow, TwoCellAnchor.LeftColumn, TwoCellAnchor.BottomRow, TwoCellAnchor.RightColumn); - Range range = new Range(cell_range, ws); - double top_inset = TwoCellAnchor.TopLeftOffset.y; - double bottom_inset = ws.Cell(cell_range.BottomRight).Height * font0size - TwoCellAnchor.BottomRightOffset.y; - - return range.Height * font0size - top_inset - bottom_inset; - } - } - return 0; - } - - #endregion - - - #region Properties - /// - /// Absolute anchor (applicable for chartsheets' charts only. For embedded charts returns null) - /// - public AbsoluteAnchor AbsoluteAnchor { get; private set; } - - /// - /// Two cells anchor (applicable for embedded charts only. For chartsheets' charts charts returns null) - /// - public TwoCellAnchor TwoCellAnchor { get; private set; } - - /// - /// Legend - /// - public Legend Legend { get; private set; } - - /// - /// Manually set layout - /// - public Layout ManualLayout { get; private set; } - - /// - /// Width of the chart in points - /// - public double Width { get; private set; } - - /// - /// Height of the chart in points - /// - public double Height { get; private set; } - - /// - /// em size in points - /// - public double em { get; private set; } - - /// - /// Plot area - /// - public PlotArea PlotArea { get; private set; } - - #endregion - - - - /// - /// This struct is a simple readonly pair of doubles. Main purpose - coordinates encapsulation - /// - public struct XY - { - internal XY(double x, double y) - { - this.x = x; - this.y = y; - } - /// - /// Typically X coordinate in points but may be used differently - /// - public readonly double x; - /// - /// Typically Y coordinate in points but may be used differently - /// - public readonly double y; - } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Charts/Layout.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Charts/Layout.cs deleted file mode 100644 index 4cd871c397..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Charts/Layout.cs +++ /dev/null @@ -1,167 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; - -namespace ASCOfficeEWSEditor.Editor.Charts -{ - /// - /// Manual object layout - /// - public class Layout - { - private XmlNode layout_xml; - private XmlNamespaceManager ns_manager; - private Chart.XY default_element_position; - - internal Layout(XmlNode legend_xml, Chart chart, Chart.XY default_element_position, XmlNamespaceManager ns_manager) - { - this.layout_xml = legend_xml; - this.default_element_position = default_element_position; - this.ns_manager = ns_manager; - Target = GetTarget(); - TopLeft = GetTopLeft(chart.Width, chart.Height); - Width = GetWidth(chart.Width); - Height = GetHeight(chart.Height); - } - - private LayoutTarget GetTarget() - { - XmlElement target_xml = (XmlElement)layout_xml.SelectSingleNode("c:layoutTarget", ns_manager); - if (target_xml != null) - { - switch (target_xml.GetAttribute("val")) - { - case "inner": return LayoutTarget.Inner; - case "outer": return LayoutTarget.Outer; - } - } - return LayoutTarget.Outer; // default - } - - private Chart.XY GetTopLeft(double chart_width, double chart_height) - { - #region Calculate X - double x = 0; - XmlElement x_tag = (XmlElement)layout_xml.SelectSingleNode("c:x", ns_manager); - if (x_tag != null) - { - LayoutMode xmode = GetLayoutMode("c:xMode"); - - double.TryParse(x_tag.GetAttribute("val"), out x); - x *= chart_width; - if (xmode == LayoutMode.Factor) - { - x += default_element_position.x; - } - } - #endregion - #region Calculate Y - double y = 0; - XmlElement y_tag = (XmlElement)layout_xml.SelectSingleNode("c:y", ns_manager); - if (y_tag != null) - { - LayoutMode ymode = GetLayoutMode("c:yMode"); - - double.TryParse(y_tag.GetAttribute("val"), out y); - y *= chart_height; - if (ymode == LayoutMode.Factor) - { - y += default_element_position.y; - } - } - #endregion - return new Chart.XY(x, y); - } - - private LayoutMode GetLayoutMode(string element_name) - { - XmlElement mode_tag = (XmlElement)layout_xml.SelectSingleNode(element_name, ns_manager); - if (mode_tag != null && mode_tag.GetAttribute("val") == "edge") - { - return LayoutMode.Edge; - } - return LayoutMode.Factor; - } - - private double GetWidth(double chart_width) - { - double w = 0; - XmlElement w_tag = (XmlElement)layout_xml.SelectSingleNode("c:w", ns_manager); - if (w_tag != null) - { - LayoutMode wmode = GetLayoutMode("c:wMode"); - - double.TryParse(w_tag.GetAttribute("val"), out w); - w *= chart_width; - if (wmode == LayoutMode.Edge) - { - w -= TopLeft.x; - } - } - return w; - } - - private double GetHeight(double chart_height) - { - double h = 0; - XmlElement h_tag = (XmlElement)layout_xml.SelectSingleNode("c:h", ns_manager); - if (h_tag != null) - { - LayoutMode hmode = GetLayoutMode("c:hMode"); - - double.TryParse(h_tag.GetAttribute("val"), out h); - h *= chart_height; - if (hmode == LayoutMode.Edge) - { - h -= TopLeft.y; - } - } - return h; - } - - private enum LayoutMode - { - Edge, - Factor - } - - - /// - /// Layout target - /// - public LayoutTarget Target { get; private set; } - - /// - /// Top left corner position - /// - public Chart.XY TopLeft { get; private set; } - - /// - /// Width - /// - public double Width { get; private set; } - - /// - /// Height - /// - public double Height { get; private set; } - - - /// - /// Layout target - /// - public enum LayoutTarget - { - /// - /// Inner - /// - Inner, - /// - /// Outer (default) - /// - Outer - } - - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Charts/Legend.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Charts/Legend.cs deleted file mode 100644 index b8f138d72f..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Charts/Legend.cs +++ /dev/null @@ -1,87 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; - -namespace ASCOfficeEWSEditor.Editor.Charts -{ - /// - /// Legend - /// - public class Legend - { - private XmlNode legend_xml; - private XmlNamespaceManager ns_manager; - - internal Legend(XmlNode legend_xml, Chart chart, XmlNamespaceManager ns_manager) - { - this.legend_xml = legend_xml; - this.ns_manager = ns_manager; - #region Layout - XmlNode layout_xml = legend_xml.SelectSingleNode("c:layout/c:manualLayout", ns_manager); - ManualLayout = layout_xml != null ? new Layout(layout_xml, chart, new Chart.XY(chart.Width / 2, chart.em * 4), ns_manager) : null; - #endregion - } - - public bool show - { - get - { - return (string.IsNullOrEmpty(legend_xml.InnerXml)) ? false : true; - } - set - { - if (!value) - legend_xml.InnerXml = ""; - } - } - - /// - /// This element specifies that other chart elements shall be allowed to overlap this chart element. - /// - public bool overlay - { - get - { - XmlElement pos_xml = (XmlElement)legend_xml.SelectSingleNode("c:overlay", ns_manager); - if (pos_xml != null) - return Misc.StringToBool(pos_xml.GetAttribute("val")); - - return false; // default - } - set - { - XmlElement pos_xml = (XmlElement)legend_xml.SelectSingleNode("c:overlay", ns_manager); - if (pos_xml != null) - pos_xml.SetAttribute("val", value ? "1" : "0"); - } - } - - public string position - { - get - { - XmlElement pos_xml = (XmlElement)legend_xml.SelectSingleNode("c:legendPos", ns_manager); - if (pos_xml != null) - return pos_xml.GetAttribute("val"); - else - return "r"; // default - } - set - { - if (!string.IsNullOrEmpty(value)) - { - XmlElement pos_xml = (XmlElement)legend_xml.SelectSingleNode("c:legendPos", ns_manager); - if (pos_xml != null) - pos_xml.SetAttribute("val", value); - } - } - } - - /// - /// Manually set layout - /// - public Layout ManualLayout { get; private set; } - - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Charts/Misc.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Charts/Misc.cs deleted file mode 100644 index 57a8baaf4b..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Charts/Misc.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Charts -{ - public class Misc - { - public static bool StringToBool(string attrValue) - { - bool retVal = false; - - if (!string.IsNullOrEmpty(attrValue)) - { - if (bool.TryParse(attrValue, out retVal)) - return retVal; - else - { - int convertRes = 0; - if (int.TryParse(attrValue, out convertRes) && (convertRes != 0)) - retVal = true; - } - } - - return retVal; - } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Charts/PlotArea.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Charts/PlotArea.cs deleted file mode 100644 index f5f5b59735..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Charts/PlotArea.cs +++ /dev/null @@ -1,257 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.Editor.Charts; - -namespace ASCOfficeEWSEditor.Editor.Charts -{ - /// - /// Plotting area - /// - public class PlotArea - { - private XmlNode plot_area_xml; - private XmlNamespaceManager ns_manager; - public BasicChar basicChart; - - internal PlotArea(XmlNode plot_area_xml, Chart chart, XmlNamespaceManager ns_manager) - { - this.plot_area_xml = plot_area_xml; - this.ns_manager = ns_manager; - - InitSeries(plot_area_xml, chart, ns_manager); - } - - private void InitSeries(XmlNode plot_area_xml, Chart chart, XmlNamespaceManager ns_manager) - { - XmlNode bar_xml = plot_area_xml.SelectSingleNode(@"c:barChart | c:bar3DChart | c:lineChart | c:line3DChart | c:areaChart | c:pieChart | - c:bubbleChart | c:scatterChart | c:radarChart | c:doughnutChart | c:stockChart", - ns_manager); - if (bar_xml != null) - basicChart = new BasicChar(bar_xml, bar_xml.LocalName, chart, ns_manager); - } - - public string xTitle - { - get - { - string retVal = ""; - - XmlElement xAxisNode = FindAxisX(); - if (xAxisNode != null) - { - XmlNodeList titleNodes = xAxisNode.SelectNodes("c:title/c:tx/c:rich/a:p/a:r/a:t", ns_manager); - for (int i = 0; i < titleNodes.Count; i++) - { - retVal += ((i > 0) ? " " : "") + titleNodes[i].InnerText; - } - } - - return retVal; - } - set - { - if (!string.IsNullOrEmpty(value)) - { - XmlElement xAxisNode = FindAxisX(); - if (xAxisNode != null) - { - XmlNode title = xAxisNode.SelectSingleNode("c:title/c:tx/c:rich/a:p/a:r/a:t", ns_manager); - if (title != null) - title.InnerText = value.ToString(); - } - } - } - } - - public string yTitle - { - get - { - string retVal = ""; - - XmlElement yAxisNode = FindAxisY(); - if (yAxisNode != null) - { - XmlNodeList titleNodes = yAxisNode.SelectNodes("c:title/c:tx/c:rich/a:p/a:r/a:t", ns_manager); - for (int i = 0; i < titleNodes.Count; i++) - { - retVal += ((i > 0) ? " " : "") + titleNodes[i].InnerText; - } - } - - return retVal; - } - set - { - if (!string.IsNullOrEmpty(value)) - { - XmlElement yAxisNode = FindAxisY(); - if (yAxisNode != null) - { - XmlNode title = yAxisNode.SelectSingleNode("c:title/c:tx/c:rich/a:p/a:r/a:t", ns_manager); - if (title != null) - title.InnerText = value.ToString(); - } - } - } - } - - public bool xShow - { - get - { - XmlElement xAxisNode = FindAxisX(); - if (xAxisNode != null) - { - XmlElement show = (XmlElement)xAxisNode.SelectSingleNode("c:delete", ns_manager); - if (show != null) - return !Misc.StringToBool(show.GetAttribute("val")); - } - return true; // default - } - set - { - if (!value) - { - XmlElement xAxisNode = FindAxisX(); - if (xAxisNode != null) - { - XmlElement show = (XmlElement)xAxisNode.SelectSingleNode("c:delete", ns_manager); - if (show != null) - show.SetAttribute("val", "1"); - } - } - } - } - - public bool yShow - { - get - { - XmlElement yAxisNode = FindAxisY(); - if (yAxisNode != null) - { - XmlElement show = (XmlElement)yAxisNode.SelectSingleNode("c:delete", ns_manager); - if (show != null) - return !Misc.StringToBool(show.GetAttribute("val")); - } - return true; // default - } - set - { - if (!value) - { - XmlElement yAxisNode = FindAxisY(); - if (yAxisNode != null) - { - XmlElement show = (XmlElement)yAxisNode.SelectSingleNode("c:delete", ns_manager); - if (show != null) - show.SetAttribute("val", "1"); - } - } - } - } - - public bool xGrid - { - get - { - XmlElement xAxisNode = FindAxisX(); - if (xAxisNode != null) - { - XmlNode gridNode = (XmlElement)xAxisNode.SelectSingleNode("c:majorGridlines", ns_manager); - return (gridNode != null); - } - return false; // default - } - set - { - if (!value) - { - XmlElement xAxisNode = FindAxisX(); - if (xAxisNode != null) - { - XmlNode gridNode = (XmlElement)xAxisNode.SelectSingleNode("c:majorGridlines", ns_manager); - if (gridNode != null) - xAxisNode.RemoveChild(gridNode); - } - } - } - } - - public bool yGrid - { - get - { - XmlElement yAxisNode = FindAxisY(); - if (yAxisNode != null) - { - XmlNode gridNode = (XmlElement)yAxisNode.SelectSingleNode("c:majorGridlines", ns_manager); - return (gridNode != null); - } - return false; // default - } - set - { - if (!value) - { - XmlElement yAxisNode = FindAxisY(); - if (yAxisNode != null) - { - XmlNode gridNode = (XmlElement)yAxisNode.SelectSingleNode("c:majorGridlines", ns_manager); - if (gridNode != null) - yAxisNode.RemoveChild(gridNode); - } - } - } - } - - XmlElement FindAxisX() - { - XmlElement axisNode = (XmlElement)plot_area_xml.SelectSingleNode("c:catAx", ns_manager); - if (axisNode != null) - return axisNode; - else - { - XmlNodeList valAxisList = plot_area_xml.SelectNodes("c:valAx", ns_manager); - for (int i = 0; i < valAxisList.Count; i++) - { - // проверяем позицию оси - XmlNode posAxisNode = valAxisList[i].SelectSingleNode("c:axPos", ns_manager); - if (posAxisNode != null) - { - if (((XmlElement)posAxisNode).GetAttribute("val") == "b") - return (XmlElement)valAxisList[i]; - } - } - } - - return axisNode; - } - - XmlElement FindAxisY() - { - XmlElement axisNode = (XmlElement)plot_area_xml.SelectSingleNode("c:catAx", ns_manager); - if (axisNode != null) - return (XmlElement)plot_area_xml.SelectSingleNode("c:valAx", ns_manager); - else - { - XmlNodeList valAxisList = plot_area_xml.SelectNodes("c:valAx", ns_manager); - for (int i = 0; i < valAxisList.Count; i++) - { - // проверяем позицию оси - XmlNode posAxisNode = valAxisList[i].SelectSingleNode("c:axPos", ns_manager); - if (posAxisNode != null) - { - if (((XmlElement)posAxisNode).GetAttribute("val") == "l") - return (XmlElement)valAxisList[i]; - } - } - } - - return null; - } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Charts/Series.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Charts/Series.cs deleted file mode 100644 index f216282a21..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Charts/Series.cs +++ /dev/null @@ -1,546 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs; -using ASCOfficeEWSEditor.Editor.Cells; -using System.Text.RegularExpressions; -using System.Globalization; - -namespace ASCOfficeEWSEditor.Editor.Charts -{ - public class Series - { - XmlNamespaceManager xmlManager; - XmlNode ser_xml; - - private BasicChar basicChart; - private Worksheet m_oReferredSheet; - private string m_strReferredRange = ""; - - public Series(XmlNode ser_xml, BasicChar basicChart, XmlNamespaceManager ns_manager) - { - this.xmlManager = ns_manager; - this.ser_xml = ser_xml; - this.basicChart = basicChart; - } - - public List GetValues() - { - List list = new List(); - XmlNode valuesNode = ser_xml.SelectSingleNode("c:val | c:bubbleSize | c:yVal", xmlManager); - XmlNode cache = valuesNode.SelectSingleNode("c:numRef/c:numCache", xmlManager); - - if (cache != null) - { - XmlNodeList values = cache.SelectNodes("c:pt/c:v", xmlManager); - foreach (XmlNode value in values) - { - double val = 0; - bool bRes = double.TryParse(value.InnerText, out val); - if (!bRes) - bRes = double.TryParse(value.InnerText.Replace(".", ","), out val); - - list.Add(val); - } - } - // кешированных данных нет, читаем формулу - else - { - string[] intervalParts = interval.Split(new char[] { ';' }); // Sheet1!$D$5;Sheet1!$F$26;Sheet1!$L$5 - - for (int i = 0; i < intervalParts.Length; i++) - { - string[] currPart = intervalParts[i].Split(new char[] { '!' }); // Sheet1!$D$5 - - if (currPart.Length == 2) - { - string formula = currPart[1].Replace("$", ""); - Range range = new Range(formula, basicChart.parent_sheet.Workbook.ActiveWorksheet); - List chartCells = range.ExistentCells(); - - for (int j = 0; j < chartCells.Count; j++) - { - range = new Range(chartCells[j], basicChart.parent_sheet.Workbook.ActiveWorksheet); - double value = 0; - bool bRes = double.TryParse(range.DispValue.ToString(), out value); - if (!bRes) - bRes = double.TryParse(range.DispValue.ToString().Replace(".", ","), out value); - list.Add(value); - } - } - } - } - - return list; - } - - public List GetCategories() - { - List list = new List(); - XmlNode valuesNode = ser_xml.SelectSingleNode("c:cat", xmlManager); - - if (valuesNode != null) - { - XmlNode cache = valuesNode.SelectSingleNode("c:strRef/c:strCache", xmlManager); - - if (cache != null) - { - XmlNodeList values = cache.SelectNodes("c:pt/c:v", xmlManager); - foreach (XmlNode value in values) - { - list.Add(value.InnerText); - } - } - // кешированных данных нет, читаем формулу - else - { - string[] intervalParts = interval.Split(new char[] { ';' }); // Sheet1!$D$5;Sheet1!$F$26;Sheet1!$L$5 - - for (int i = 0; i < intervalParts.Length; i++) - { - string[] currPart = intervalParts[i].Split(new char[] { '!' }); // Sheet1!$D$5 - - if (currPart.Length == 2) - { - string formula = currPart[1].Replace("$", ""); - Range range = new Range(formula, basicChart.parent_sheet.Workbook.ActiveWorksheet); - List chartCells = range.ExistentCells(); - - for (int j = 0; j < chartCells.Count; j++) - { - range = new Range(chartCells[j], basicChart.parent_sheet.Workbook.ActiveWorksheet); - list.Add(range.DispValue.ToString()); - } - } - } - } - } - - return list; - } - - public void InsertValues(List values) - { - DeleteValues(); - XmlNode valuesNode = ser_xml.SelectSingleNode("c:val | c:bubbleSize | c:yVal", xmlManager); - XmlNode cache = valuesNode.SelectSingleNode("c:numRef/c:numCache", xmlManager); - XmlElement valCountNode = (XmlElement)cache.SelectSingleNode("c:ptCount", xmlManager); - valCountNode.SetAttribute("val", values.Count.ToString()); - - XmlElement nodeTemplate = ser_xml.OwnerDocument.CreateElement("node"); - nodeTemplate.InnerXml = Resource1.empty_chartSeriesItem; - - // значения для дефолтного элемента, потом добавляем остальные - XmlNode newValueNode = nodeTemplate.SelectSingleNode("c:seriesItem/c:pt", xmlManager); - - // остальные значения диаграммы - for (int i = 0; i < values.Count; i++) - { - XmlNode newItem = newValueNode.Clone(); - XmlElement tmp = (XmlElement)newItem; - tmp.SetAttribute("idx", i.ToString()); - XmlNode nextValue = newItem.SelectSingleNode("c:v", xmlManager); - nextValue.InnerText = values[i].ToString(); - cache.AppendChild(newItem); - } - - } - - public void DeleteValues() - { - XmlNode mainNode = ser_xml.SelectSingleNode("c:val | c:bubbleSize | c:yVal", xmlManager); - XmlNode cacheNode = mainNode.SelectSingleNode("c:numRef/c:numCache", xmlManager); - XmlElement valCountNode = (XmlElement)cacheNode.SelectSingleNode("c:ptCount", xmlManager); - valCountNode.SetAttribute("val", "0"); - XmlNodeList valuesNodeList = cacheNode.SelectNodes("c:pt", xmlManager); - for (int i = 0; i < valuesNodeList.Count; i++) - { - cacheNode.RemoveChild(valuesNodeList[i]); - } - } - - public string name - { - get - { - string retVal = ""; - if (ser_xml != null) - { - XmlElement name = (XmlElement)ser_xml.SelectSingleNode("c:tx/c:v", xmlManager); - if (name != null) - retVal = name.InnerText; - } - return retVal; - } - set - { - if (!string.IsNullOrEmpty(value) && (ser_xml != null)) - { - XmlElement name = (XmlElement)ser_xml.SelectSingleNode("c:tx/c:v", xmlManager); - if (name != null) - name.InnerText = value; - } - } - } - - public string markerType - { - get - { - string retVal = ""; - if (ser_xml != null) - { - XmlElement marker = (XmlElement)ser_xml.SelectSingleNode("c:marker/c:symbol", xmlManager); - if (marker != null) - retVal = marker.GetAttribute("val"); - } - return retVal; - } - set - { - if (!string.IsNullOrEmpty(value) && (ser_xml != null)) - { - XmlElement marker = (XmlElement)ser_xml.SelectSingleNode("c:marker/c:symbol", xmlManager); - if (marker != null) - marker.SetAttribute("val", value); - } - } - } - - public int markerSize - { - get - { - int retVal = 0; - if (ser_xml != null) - { - XmlElement marker = (XmlElement)ser_xml.SelectSingleNode("c:marker/c:size", xmlManager); - if (marker != null) - retVal = int.Parse(marker.GetAttribute("val")); - } - return retVal; - } - set - { - if (ser_xml != null) - { - XmlElement marker = (XmlElement)ser_xml.SelectSingleNode("c:marker/c:size", xmlManager); - if (marker != null) - marker.SetAttribute("val", value.ToString()); - } - } - } - - public string color - { - get - { - string retVal = ""; - if (ser_xml != null) - { - XmlElement color = (XmlElement)ser_xml.SelectSingleNode("c:spPr/a:solidFill/a:srgbClr", xmlManager); - if (color != null) - retVal = color.GetAttribute("val"); - } - return retVal; - } - set - { - if (!string.IsNullOrEmpty(value) && (ser_xml != null)) - { - XmlElement color = (XmlElement)ser_xml.SelectSingleNode("c:spPr/a:solidFill/a:srgbClr", xmlManager); - if (color != null) - color.SetAttribute("val", value); - } - } - } - - public bool showVal - { - get - { - XmlElement show = (XmlElement)ser_xml.SelectSingleNode("c:dLbls/c:showVal", xmlManager); - if (show != null) - return Misc.StringToBool(show.GetAttribute("val")); - - return false; // default - } - set - { - if (value) - { - XmlElement show = (XmlElement)ser_xml.SelectSingleNode("c:dLbls/c:showVal", xmlManager); - if (show != null) - show.SetAttribute("val", "1"); - } - } - } - - public string borderColor - { - get - { - string retVal = ""; - if (ser_xml != null) - { - XmlElement color = (XmlElement)ser_xml.SelectSingleNode("c:spPr/a:ln/a:solidFill/a:srgbClr", xmlManager); - if (color != null) - retVal = color.GetAttribute("val"); - } - return retVal; - } - set - { - if (!string.IsNullOrEmpty(value) && (ser_xml != null)) - { - XmlElement color = (XmlElement)ser_xml.SelectSingleNode("c:spPr/a:ln/a:solidFill/a:srgbClr", xmlManager); - if (color != null) - color.SetAttribute("val", value); - } - } - } - - public string interval - { - get - { - string retVal = ""; - if (ser_xml != null) - { - XmlNode valuesNode = ser_xml.SelectSingleNode("c:val | c:bubbleSize | c:yVal", xmlManager); - XmlNode intervalNode = valuesNode.SelectSingleNode("c:numRef/c:f", xmlManager); - - if (intervalNode != null) - retVal = intervalNode.InnerText; - } - return retVal; - } - set - { - if (!string.IsNullOrEmpty(value) && (ser_xml != null)) - { - XmlNode valuesNode = ser_xml.SelectSingleNode("c:val | c:bubbleSize | c:yVal", xmlManager); - XmlNode intervalNode = valuesNode.SelectSingleNode("c:numRef/c:f", xmlManager); - - if (intervalNode != null) - intervalNode.InnerText = value; - } - } - } - - public Worksheet ReferredSheet - { - get - { - parceLocation(); - return m_oReferredSheet; - } - set - { - m_oReferredSheet = value; - } - } - public Cells.CellRange ReferredRange - { - get - { - parceLocation(); - return new Cells.CellRange(m_strReferredRange, this.basicChart.chart.parent_sheet.Workbook); - } - set - { - } - } - - private void parceLocation() - { - XmlNode valuesNode = ser_xml.SelectSingleNode("c:val | c:bubbleSize | c:yVal", xmlManager); - XmlNode oIntervalNode = valuesNode.SelectSingleNode("c:numRef/c:f", xmlManager); - - string strLocation = ""; - if (oIntervalNode != null) - strLocation = oIntervalNode.InnerText; - int start_pos = 0; - Worksheet ws_from; - Worksheet ws_to; - - if (Calculation.Formulas.ParsedFormula.extract_3D_part(strLocation, ref start_pos, out ws_from, out ws_to, this.basicChart.chart.parent_sheet.Workbook)) - { - m_oReferredSheet = ws_from; - m_strReferredRange = strLocation.Substring(start_pos); - } - else - { - // разбиваем на отдельные ячейки - //string[] spl = strLocation.Split(new char[]{','}); - //strLocation = ""; - //for (int i = 0; i < spl.Length; i++) - //{ - // strLocation - //} - } - } - - public void ChangeValues(List cells, Workbook wb) - { - for (int i = 0; i < cells.Count; i++) - { - if (ReferredRange.Contains(new Cells.Cell(cells[i]))) - { - Range range = new Range(cells[i], wb.ActiveWorksheet); - XmlNode valuesNode = ser_xml.SelectSingleNode("c:val | c:bubbleSize | c:yVal", xmlManager); - - XmlNode numRef = valuesNode.SelectSingleNode("c:numRef", xmlManager); - XmlNode numCache = numRef.SelectSingleNode("c:numCache", xmlManager); - - if (numCache == null) // вставляем кеш - { - List listValues = GetValues(); // по интервалу - - numRef.InnerXml += "General0"; - numCache = numRef.SelectSingleNode("c:numCache", xmlManager); - - InsertValues(listValues); - } - - XmlNodeList values = numCache.SelectNodes("c:pt/c:v", xmlManager); - - int index = ReferredRange.CellIndex(new Cells.Cell(cells[i])); - double newValue = 0; - if (double.TryParse(range.DispValue.ToString(), out newValue)) - values[index].InnerText = newValue.ToString(); - else // пробуем работать с $, €, р, £, ¥ - { - string sOutVal = ""; - string sNumFormat = ""; - - int m_cnInfo = 0x409; - CultureInfo oCulture = new CultureInfo(m_cnInfo); - - //Scientific - Match oScientifictMatch = Regex.Match(range.DispValue.ToString(), @"^([+-]?)(\d+|\d+\.\d*|\d*\.\d+)[Ee]([+-]?)(\d+)$"); - if (true == oScientifictMatch.Success) - { - string sSing1 = oScientifictMatch.Groups[1].Value; - string sV1 = oScientifictMatch.Groups[2].Value; - string sSing2 = oScientifictMatch.Groups[3].Value; - string sV2 = oScientifictMatch.Groups[4].Value; - double dVal = double.Parse(sV1, System.Globalization.NumberStyles.Float, oCulture); - if ("-" == sSing1) - dVal = -dVal; - int nCount = int.Parse(sV2); - for (int k = 0; k < nCount; k++) - { - if ("-" == sSing2) - dVal /= 10; - else - dVal *= 10; - } - sOutVal = dVal.ToString(oCulture); - - if (double.TryParse(sOutVal, out newValue)) - values[index].InnerText = sOutVal; - else - values[index].InnerText = "0"; - return; - } - - //проценты - Match oPersentMatch = Regex.Match(range.DispValue.ToString(), @"^([+-]?)(\d+|\d+\.\d*|\d*\.\d+)%$"); - if (true == oPersentMatch.Success) - { - string sSing1 = oPersentMatch.Groups[1].Value; - string sV1 = oPersentMatch.Groups[2].Value; - double dVal = double.Parse(sV1, System.Globalization.NumberStyles.Float, oCulture); - if ("-" == sSing1) - dVal = -dVal; - dVal /= 100; - sOutVal = dVal.ToString(oCulture); - - if (double.TryParse(sOutVal, out newValue)) - values[index].InnerText = sOutVal; - else - values[index].InnerText = "0"; - return; - } - //денежный - Match oMoneyMatch = Regex.Match(range.DispValue.ToString(), @"^([+-]?)(\D?)([+-]?)(\d+|(\d{1,2}(,\d{3})*)+|(\d{1,2}(,\d{3})*)+\.\d*|(\d{1,2}(,\d{3})*)*\.\d+)(\D?)$"); - if (true == oMoneyMatch.Success) - { - string sSign1 = oMoneyMatch.Groups[1].Value; - string sSign = oMoneyMatch.Groups[2].Value; - string sSign2 = oMoneyMatch.Groups[3].Value; - string sValue = oMoneyMatch.Groups[4].Value.Replace(",", ""); - string sSign5 = oMoneyMatch.Groups[11].Value; - double dVal = double.Parse(sValue, System.Globalization.NumberStyles.Float, oCulture); - if ("-" == sSign1 || "-" == sSign2) - dVal = -dVal; - - if (sSign.Length == 0) - { - sOutVal = dVal.ToString(oCulture); - - if (double.TryParse(sOutVal, out newValue)) - values[index].InnerText = sOutVal; - else - values[index].InnerText = "0"; - return; - } - else - { - if (sSign5 == "") - { - if ('$' == sSign[0]) - sNumFormat = "$#,##0.00"; - else if (8364 == (int)sSign[0]) - sNumFormat = "€#,##0.00"; - else if (163 == (int)sSign[0]) - sNumFormat = "£#,##0.00"; - else if (165 == (int)sSign[0]) - sNumFormat = "¥#,##0.00"; - } - else - if (sSign == "" && sSign5.Equals("р")) - { - sNumFormat = "#,##0.00р."; - } - if ("" != sNumFormat) - { - sOutVal = dVal.ToString(oCulture); - - if (double.TryParse(sOutVal, out newValue)) - values[index].InnerText = sOutVal; - else - values[index].InnerText = "0"; - } - return; - } - } - values[index].InnerText = "0"; - } - } - } - } - - public void ClearAutoFilterValues(List cells, Workbook wb) - { - // получение значений интервала - Range range = new Range(ReferredRange, wb.ActiveWorksheet); - List chartCells = range.ExistentCells(); - List newValueList = new List(); - - for (int i = 0; i < chartCells.Count; i++) - { - if (!cells.Contains(chartCells[i])) - { - range = new Range(chartCells[i], wb.ActiveWorksheet); - double newValue = 0; - double.TryParse(range.DispValue.ToString(), out newValue); - newValueList.Add(newValue); - } - } - InsertValues(newValueList); - } - } -} \ No newline at end of file diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Chartsheet.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Chartsheet.cs deleted file mode 100644 index 514b7ed237..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Chartsheet.cs +++ /dev/null @@ -1,110 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.XMLDataSpecific; -using System.IO; -using ASCOfficeEWSEditor.Editor.Charts; -using ASCOfficeEWSEditor.Editor.Events; - -namespace ASCOfficeEWSEditor.Editor -{ - /// - /// Represents a chartsheet. - /// - public class Chartsheet : Sheet - { - #region XML references - private XmlNode xml_chartsheet; - #endregion - #region tree references - #endregion - - internal OOX.Relationships Relationships { get; private set; } - - private OOX.ChartsheetFile chartsheet_file; - - /// - /// Create from existent chartsheet - /// - internal Chartsheet(string sheet_path, XmlNode xml_workbook_sheet, Sheets container, Workbook workbook) - : base(container, workbook, xml_workbook_sheet) - { - chartsheet_file = new OOX.ChartsheetFile(sheet_path, workbook.ContentTypes, workbook.Relationships, workbook); - xml_chartsheet = chartsheet_file.GetRootTag(); - Relationships = new OOX.Relationships(xml_chartsheet.ParentNode); - - FindChart(); - } - - /// - /// Permanently removes the chartsheet from the workbook - /// - /// Whether the operation successful. Return false if the removed sheet is the only sheet in the workbook - public override bool Remove() - { - if (RemoveSheet()) - { - chartsheet_file.Remove(); - return true; - } - return false; - } - - private void FindChart() - { - #region Find drawing file - XmlElement drawing_node = (XmlElement)xml_chartsheet.SelectSingleNode("main:drawing", ns_manager); - if(drawing_node == null) - { - throw new Events.ReportableException(new Events.InternalError("Wrong OOX format. Required 'drawing' tag is absent inside chartsheet.")); - } - string drawing_rId = drawing_node.GetAttribute("id", ns_manager.LookupNamespace("mainr")); - string drawing_path = Relationships.GetTarget(drawing_rId); - - XmlNode drawing_file_xml = Helpers.OOXNavigate.getReferenceByPath(drawing_path, xml_chartsheet.ParentNode.ParentNode); - if (drawing_file_xml == null) - { - throw new Events.ReportableException(new Events.InternalError("Wrong OOX format. File '" + drawing_path + "' not found.")); - } - #endregion - - #region Find chart file - XmlNode anchor_xml = drawing_file_xml.SelectSingleNode("xdr:wsDr/xdr:absoluteAnchor", ns_manager); - if (anchor_xml == null) - { - throw new Events.ReportableException(new Events.InternalError("Wrong OOX format. Required 'absoluteAnchor' tag is absent inside .")); - } - XmlNode anchor_chart_xml = anchor_xml.SelectSingleNode("xdr:graphicFrame/a:graphic/a:graphicData/c:chart", ns_manager); - if (anchor_chart_xml == null) - { - throw new Events.ReportableException(new Events.InternalError("Wrong OOX format. Required 'chart' tag is absent beneath .")); - } - string chart_rId = drawing_node.GetAttribute("id", ns_manager.LookupNamespace("mainr")); - - OOX.Relationships drawing_relationships = new OOX.Relationships(drawing_file_xml); - - string chart_path = drawing_relationships.GetTarget(chart_rId); - XmlNode chart_file_xml = Helpers.OOXNavigate.getReferenceByPath(chart_path, drawing_file_xml.ParentNode); - if (chart_file_xml == null) - { - throw new Events.ReportableException(new Events.InternalError("Wrong OOX format. File '" + chart_path + "' not found.")); - } - #endregion - - Chart = new Chart(chart_file_xml, anchor_xml, this); - } - - /// - /// Chart - /// - public Chart Chart { get; private set; } - - - /// - /// Overridden method of determination whether the sheet has data - /// - public override bool HasSheetData { get { return false; } } - - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/DefinedNames/DefinedName.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/DefinedNames/DefinedName.cs deleted file mode 100644 index ab704b399c..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/DefinedNames/DefinedName.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; - -namespace ASCOfficeEWSEditor.Editor.DefinedNames -{ - /// - /// DefinedName object - /// - public class DefinedName - { - internal DefinedName(string name, string formula) - { - Name = name; - Formula = formula; - } - - /// - /// Formula of the defined name - /// - public string Formula {get; private set;} - /// - /// Name of the defined name - /// - public string Name { get; private set; } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/DefinedNames/DefinedNames.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/DefinedNames/DefinedNames.cs deleted file mode 100644 index 7fde0bad68..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/DefinedNames/DefinedNames.cs +++ /dev/null @@ -1,209 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; - -namespace ASCOfficeEWSEditor.Editor.DefinedNames -{ - /// - /// Collection of defined names contained in a workbook - /// - public class DefinedNames : IEnumerable - { - internal DefinedNames(Workbook workbook) - { - this.workbook = workbook; - ns_manager = workbook.NamespaceManager; - - NameItems = new Dictionary(); - - defnames_xml = workbook.GetRootTag().SelectSingleNode("main:definedNames", ns_manager); - - if (defnames_xml != null) - { - foreach (XmlElement defname_xml in defnames_xml.SelectNodes("main:definedName", ns_manager)) - { - string name = defname_xml.GetAttribute("name"); - string formula = defname_xml.InnerText; - CreateAndAppendNameItem(defname_xml, name, formula); - } - } - } - - private Calculation.NameItem CreateAndAppendNameItem(XmlElement defname_xml, string name, string formula) - { - Calculation.Formulas.NameParsedFormula name_parsed_formula = new Calculation.Formulas.NameParsedFormula(name, workbook); - if (name_parsed_formula.Parse(formula, Cells.Offset.Null)) - { - if(name_parsed_formula.HasRelativeParts()) - { - workbook.ReportError(new Events.FormulaFormatError("Using of relative references is prohibited in defined names. Wrong formula: \"" + formula + "\"")); - } - Calculation.NameItem name_item; - if(NameItems.TryGetValue(name, out name_item)) - { - name_item.Formula.UnregisterDependencies(); - NameItems.Remove(name); - } - name_item = new Calculation.NameItem(name, workbook, workbook.ValuesUpdateManager, name_parsed_formula); - NameItems.Add(name, name_item); - defname_xml.InnerText = name_parsed_formula.Assemble(); - return name_item; - } - // Else just continue with the left correct formulas - return null; - } - - internal bool IsNameExists(string name) - { - return NameItems.ContainsKey(name); - } - - internal void RegisterFormulas() - { - foreach (Calculation.NameItem name_item in NameItems.Values) - { - name_item.Formula.RegisterDependencies(name_item); - } - } - - - #region IEnumerable Members - - /// - /// Enumerator - /// - /// Enumerator - public IEnumerator GetEnumerator() - { - return new Enumerator(this); - } - - #endregion - - #region IEnumerable Members - - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() - { - return new Enumerator(this); - } - - #endregion - - /// - /// Count of defined names currently stored in a workbook - /// - public int Count { get { return NameItems.Count; } } - - /// - /// Enumerator through all stored defined names - /// - public class Enumerator : IEnumerator - { - internal Enumerator(DefinedNames defnames) - { - name_items_enum = defnames.NameItems.GetEnumerator(); - } - - #region IEnumerator Members - - /// - /// Current defined name - /// - public DefinedName Current - { - get - { - KeyValuePair name_items_current = name_items_enum.Current; - return new DefinedName(name_items_current.Key, name_items_current.Value.Formula.ToString()); - } - } - - #endregion - - #region IDisposable Members - /// - /// Dispose :) - /// - public void Dispose() - { - } - - #endregion - - #region IEnumerator Members - - object System.Collections.IEnumerator.Current - { - get { return Current; } - } - - /// - /// Switches to the next Current - /// - /// - public bool MoveNext() - { - return name_items_enum.MoveNext(); - } - - /// - /// Reset - /// - public void Reset() - { - throw new NotSupportedException(); - } - - #endregion - - private Dictionary.Enumerator name_items_enum; - } - - /// - /// Add a defined name. Rewrites the existing one. - /// - /// Formula of the defined name - /// Name of the defined name - /// Whether the passed formula was parsed correctly - public bool AddName(string name, string formula) - { - XmlElement defname_xml = workbook.GetXmlDocument().CreateElement("definedName", ns_manager.LookupNamespace("main")); - defname_xml.SetAttribute("name", name); - defname_xml.InnerText = formula; - - AppendDefinedNamesXml(defname_xml, name); - - Calculation.NameItem name_item = CreateAndAppendNameItem(defname_xml, name, formula); - if (name_item != null) - { - name_item.Formula.RegisterDependencies(name_item); - return true; - } - return false; - } - - private void AppendDefinedNamesXml(XmlNode defname_xml, string name) - { - if (defnames_xml == null) - { - defnames_xml = workbook.GetXmlDocument().CreateElement("definedNames", ns_manager.LookupNamespace("main")); - workbook.XMLSectionsController.AppendXmlSection(defnames_xml); - } - - XmlNode existent_defname = defnames_xml.SelectSingleNode("main:definedName[@name = '" + name + "']", ns_manager); - if (existent_defname != null) - { - defnames_xml.RemoveChild(existent_defname); - } - - defnames_xml.AppendChild(defname_xml); - } - - private XmlNode defnames_xml; - - private Workbook workbook; - private XmlNamespaceManager ns_manager; - internal Dictionary NameItems { get; private set; } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/EWSEditor.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/EWSEditor.cs deleted file mode 100644 index 2c8cbf8996..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/EWSEditor.cs +++ /dev/null @@ -1,353 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using System.IO; -using System.Diagnostics; - -/* - * My main idea in this project is to minimize amount of stored in classes information - * that duplicates the one stored in linked XML. - * Since the performance is not sufficient here, we can access all the info from the XML itself to - * keep the tree in consistency and avoid the majority of errors. - * If there is a necessity to duplicate - do it as little as possible. - */ - - -namespace ASCOfficeEWSEditor.Editor -{ - /// - /// Represents the entire application - /// - public class EWSEditor : IDisposable - { - /// - /// Constructs an EWSEditor instance - /// - public EWSEditor() - { - Workbooks = new Dictionary(); - ReadDefaultFontPropertiesFromXML(); - FunctionsStorage = new Calculation.Formulas.Ptgs.Functions.FunctionsStorage(); - NumberFormatsStorage = new NumberFormat.NumberFormatsStorage(); - //SetupLog("EWSEditor.log", TraceOptions.Callstack); - } - public EWSEditor(string siteDir) - { - site_dir = siteDir; - Workbooks = new Dictionary(); - ReadDefaultFontPropertiesFromXML(); - FunctionsStorage = new Calculation.Formulas.Ptgs.Functions.FunctionsStorage(); - NumberFormatsStorage = new NumberFormat.NumberFormatsStorage(); - //SetupLog("EWSEditor.log", TraceOptions.Callstack); - } - - private void ReadDefaultFontPropertiesFromXML() - { - XmlDocument xml_doc = new XmlDocument(); - xml_doc.LoadXml(Resource1.empty_book); - Workbook wb = new Workbook("temp_workbook", xml_doc, this); - string font_name0 = wb.StyleSheet.Get0StyleFontName(); - int? font_size0 = wb.StyleSheet.Get0StyleFontSize(); - - if (font_name0 != null) - { - DefaultFontNameOnBooksCreation = font_name0; - } - else - { - DefaultFontNameOnBooksCreation = "Arial"; - } - if (font_size0 != null) - { - DefaultFontSizeOnBooksCreation = font_size0.Value; - } - else - { - DefaultFontSizeOnBooksCreation = 11; - } - } - - /// - /// Creates an empty workbook and appends it to the EWSEditor internal list. The workbook becomes active - /// - /// Name of the created workbook - /// Just created workbook reference - public Workbook CreateWorkbook(string name) - { - return CreateWorkbook(name, 1); - } - - /// - /// Creates an empty workbook and appends it to the EWSEditor internal list. The workbook becomes active - /// - /// Name of the created workbook - /// Number of empty sheets in the created workbook - /// Just created workbook reference - public Workbook CreateWorkbook(string name, int num_sheets) - { - Trace.TraceInformation("Workbook creation issued. Name: \"{0}\" Number of sheets: {1}", new object[] {name, num_sheets}); - - XmlDocument xml_doc = new XmlDocument(); - xml_doc.LoadXml(Resource1.empty_book); - Workbook wb; - try - { - wb = new Workbook(name, xml_doc, this); - } - catch (Events.ReportableException reportable_exception) - { - ReportError(null, reportable_exception.error_description); - return null; - } - // TODO: set default font properties - Workbooks.Add(name, wb); - ActiveWorkbook = wb; - for (int i = 2; i <= num_sheets; ++i) - { - wb.Sheets.AddEmptySheet("Sheet" + i, null); - } - wb.Sheets[0].Activate(); - return wb; - } - - /// - /// Loads a workbook from the specified path and appends it to the EWSEditor internal list. The workbook becomes active - /// - /// File path to the workbook location. - /// Just loaded workbook reference. - public Workbook LoadWorkbook(string path) - { - Workbook wb; - try - { - wb = FileFormats.Serializer.Load(this, path); - } - catch (Events.ReportableException reportable_exception) - { - ReportError(null, reportable_exception.error_description); - return null; - } - catch (System.IO.IOException io_exception) - { - ReportError(null, new Events.SystemIOError(io_exception)); - return null; - } - return wb; - } - - /// - /// Loads a workbook from CSV file at the specified path and appends it to the EWSEditor internal list. - /// The workbook becomes active - /// - /// File path to the CSV file location. - /// Code page of CSV data. - /// Cells delimiter. - /// Just loaded workbook reference. - public Workbook LoadWorkbookFromCSV(string path, int code_page, char delimiter) - { - Workbook wb; - try - { - wb = FileFormats.Serializer.LoadFromCSV(this, path, code_page, delimiter); - } - catch (Events.ReportableException reportable_exception) - { - ReportError(null, reportable_exception.error_description); - return null; - } - catch (System.IO.IOException io_exception) - { - ReportError(null, new Events.SystemIOError(io_exception)); - return null; - } - return wb; - } - - /// - /// Loads a workbook from a CSV file at the specified path and appends it to the EWSEditor internal list. - /// The workbook becomes active. - /// Delimiter set to default (,) - /// - /// File path to the CSV file location. - /// Code page of CSV data. - /// Just loaded workbook reference. - public Workbook LoadWorkbookFromCSV(string path, int code_page) - { - return LoadWorkbookFromCSV(path, code_page, FileFormats.Serializer.CSV_default_delimiter); - } - - /// - /// Active workbook reference. Read-only - /// - public Workbook ActiveWorkbook { get; internal set; } - - /// - /// Active sheet in active workbook reference. Read-only - /// - public Sheet ActiveSheet { get { return ActiveWorkbook.ActiveSheet; } private set { } } - - /// - /// Active worksheet. Read-only - /// - public Worksheet ActiveWorksheet - { - get - { - return ActiveSheet as Worksheet; - } - } - - - /// - /// Setup and start logging - /// - /// Name of the log file - /// Output options - /// Trace level - public void SetupLog(string file_name, TraceOptions trace_options, SourceLevels trace_level) - { - StopLogging(); - try - { - log_file = File.Open(file_name, FileMode.Append, FileAccess.Write, FileShare.Read); - log_file_listener = new TextWriterTraceListener(log_file, "EWSEditorLog"); - Trace.Listeners.Add(log_file_listener); - Trace.AutoFlush = true; - log_file_listener.TraceOutputOptions = trace_options; - log_file_listener.Filter = new System.Diagnostics.EventTypeFilter(trace_level); - } - catch (System.SystemException e) - { - ReportError(null, new Events.SystemIOError(e)); - } - } - - /// - /// Setup and start logging - /// - /// Name of the log file - /// Output options - public void SetupLog(string file_name, TraceOptions trace_options) - { - SetupLog(file_name, trace_options, SourceLevels.All); - } - - /// - /// Setup and start logging - /// - /// Name of the log file - /// Trace level - public void SetupLog(string file_name, SourceLevels trace_level) - { - SetupLog(file_name, TraceOptions.None, trace_level); - } - - /// - /// Setup and start logging - /// - /// Name of the log file - public void SetupLog(string file_name) - { - SetupLog(file_name, TraceOptions.None, SourceLevels.All); - } - - /// - /// Stop logging - /// - public void StopLogging() - { - if (log_file_listener != null) - { - log_file_listener.Close(); - Trace.Listeners.Remove(log_file_listener); - log_file_listener = null; - - if (log_file != null) - { - log_file.Close(); - log_file = null; - } - } - } - /// - /// Collection of all Workbooks opened in the application. Read-only - /// Key in the tree is the file name without an extension. - /// - public Dictionary Workbooks { get; private set; } - - /// - /// Default font size that is applied to the newly created workbooks - /// - public int DefaultFontSizeOnBooksCreation { get; set; } - - /// - /// Default font name that is applied to the newly created workbooks - /// - public string DefaultFontNameOnBooksCreation { get; set; } - - /// - /// An event that can be used to be notified whenever an error in the workbook happened. - /// 'sender' of EventHandler is Workbook - /// - public event EventHandler ErrorHappenedEvent; - - /// - /// Functions information storage - /// - public Calculation.Formulas.Ptgs.Functions.FunctionsStorage FunctionsStorage { get; private set; } - - /// - /// Internal number formats storage - /// - public NumberFormat.NumberFormatsStorage NumberFormatsStorage { get; private set; } - - internal void ReportError(Workbook workbook, Events.ErrorDescription description) - { - if (ErrorHappenedEvent != null) - { - ErrorHappenedEvent(workbook, description); - } - - Trace.TraceError(description.Text); - } - - static TraceOptions EnableCallstackTrace() - { - TraceListener ls = Trace.Listeners["EWSEditorLog"]; - if (ls != null) - { - TraceOptions callback_cache = ls.TraceOutputOptions; - ls.TraceOutputOptions |= TraceOptions.Callstack; - return callback_cache; - } - return TraceOptions.None; - } - - static void RestoreTraceOptions(TraceOptions options) - { - TraceListener ls = Trace.Listeners["EWSEditorLog"]; - if (ls != null) - { - ls.TraceOutputOptions = options; - } - } - - #region IDisposable Members - - /// - /// Resources releasing - /// - public void Dispose() - { - StopLogging(); - } - - #endregion - - private FileStream log_file; - private TextWriterTraceListener log_file_listener; - - public string site_dir; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Events/CellsUpdatedEventArg.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Events/CellsUpdatedEventArg.cs deleted file mode 100644 index 9ec2762772..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Events/CellsUpdatedEventArg.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Events -{ - /// - /// Set of arguments for CellsUpdatedEvent event - /// - public class CellsUpdatedEventArg : EventArgs - { - internal CellsUpdatedEventArg() - { - cell_refs = new List(); - } - - internal void AddCellRef(string cell_ref) - { - cell_refs.Add(cell_ref); - } - - /// - /// Returns List of updated cells references - /// - public List UpdatedCells { get { return cell_refs; } } - - /// - /// Whether at least one cell changed its value - /// - public bool IsSomethingChanged { get { return cell_refs.Count != 0; } } - - private List cell_refs; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Events/ErrorDescription.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Events/ErrorDescription.cs deleted file mode 100644 index 4a96372452..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Events/ErrorDescription.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Events -{ - internal interface IErrorDescription - { - string Text { get; } - } - - /// - /// Arguments for ErrorHappenedEvent - /// - public abstract class ErrorDescription : EventArgs, IErrorDescription - { - /// - /// Description getter - /// - public abstract string Text { get; } - - /// - /// String representation of an ErrorDescription object - /// - /// - public override string ToString() - { - return Text; - } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Events/FileNotFoundError.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Events/FileNotFoundError.cs deleted file mode 100644 index 51b7973172..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Events/FileNotFoundError.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Events -{ - /// - /// This happens when a requested file is not found on the path specified - /// - public class FileNotFoundError : ErrorDescription - { - internal FileNotFoundError(string file_path) - { - this.message = "The requested file hasn't been not found at \"" + file_path + "\""; - } - - /// - /// Description getter - /// - public override string Text { get { return message; } } - - private string message; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Events/FormulaFormatError.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Events/FormulaFormatError.cs deleted file mode 100644 index 0223365969..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Events/FormulaFormatError.cs +++ /dev/null @@ -1,61 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Events -{ - /// - /// Issued when a user entered a wrong formula or a wrong formula is contained in the loading document - /// - public class FormulaFormatError : ErrorDescription - { - internal FormulaFormatError(string message, string formula, int error_position) - { - Formula = formula; - Position = error_position; - error_message = message; - } - - internal FormulaFormatError(string message, string formula) - : this(message, formula, -1) - { - } - - internal FormulaFormatError(string message) - : this(message, null, -1) - { - } - - /// - /// Description getter - /// - public override string Text - { - get - { - string text = error_message; - if (Formula != null && Formula.Length != 0) - { - text += " in formula \"" + Formula + "\""; - if (Position != -1) - { - text += " at position " + Position; - } - } - return text; - } - } - - /// - /// Formula entered by a user - /// - public string Formula { get; set; } - - /// - /// Position of the erroneous symbols in Formula - /// - public int Position { get; set; } - - private string error_message; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Events/InternalError.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Events/InternalError.cs deleted file mode 100644 index f082073d04..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Events/InternalError.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Events -{ - /// - /// This happens when a problem with unknown reason is detected - /// - public class InternalError : ErrorDescription - { - internal InternalError(string message) - { - this.message = message; - } - - /// - /// Description getter - /// - public override string Text { get { return message; } } - - private string message; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Events/OperandExpectedError.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Events/OperandExpectedError.cs deleted file mode 100644 index cd58e622a8..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Events/OperandExpectedError.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Events -{ - /// - /// This happens when an operator has been found where an operand is expected - /// - public class OperandExpectedError : FormulaFormatError - { - internal OperandExpectedError(string formula, int error_position) - : base("Operand expected, but an operator has been found", formula, error_position) - { - } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Events/OperatorExpectedError.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Events/OperatorExpectedError.cs deleted file mode 100644 index 8d308ef007..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Events/OperatorExpectedError.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Events -{ - /// - /// This happens when an operand has been found where an operator is expected - /// - public class OperatorExpectedError : FormulaFormatError - { - internal OperatorExpectedError(string formula, int error_position) - : base("Operator expected, but an operand has been found", formula, error_position) - { - } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Events/ReportableException.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Events/ReportableException.cs deleted file mode 100644 index 4addfd19a7..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Events/ReportableException.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Events -{ - internal class ReportableException : SystemException - { - public ReportableException(ErrorDescription error_description) - { - this.error_description = error_description; - } - - public override string ToString() - { - return error_description.ToString(); - } - public ErrorDescription error_description { get; private set; } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Events/SystemIOError.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Events/SystemIOError.cs deleted file mode 100644 index 607a48d516..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Events/SystemIOError.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Events -{ - /// - /// This happens when an unknown operand is found - /// - public class SystemIOError : ErrorDescription - { - internal SystemIOError(System.SystemException io_exception) - { - this.io_exception = io_exception; - } - - /// - /// Description getter - /// - public override string Text { get { return io_exception.Message; } } - - private System.SystemException io_exception; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Events/UnknownFunctionError.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Events/UnknownFunctionError.cs deleted file mode 100644 index 94fefd47b5..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Events/UnknownFunctionError.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Events -{ - /// - /// This happens when an unknown function is found - /// - public class UnknownFunctionError : FormulaFormatError - { - internal UnknownFunctionError(string func_name, string formula, int error_position) - : base("Unknown function \"" + func_name + "\" found", formula, error_position) - { - } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Events/UnknownOperandError.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Events/UnknownOperandError.cs deleted file mode 100644 index 383436abfd..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Events/UnknownOperandError.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Events -{ - /// - /// This happens when an unknown operand is found - /// - public class UnknownOperandError : FormulaFormatError - { - internal UnknownOperandError(string formula, int error_position) - : base("Unknown operand found", formula, error_position) - { - } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Events/UnknownOperatorError.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Events/UnknownOperatorError.cs deleted file mode 100644 index d845db3d72..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Events/UnknownOperatorError.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Events -{ - /// - /// This happens when an unknown operator is found - /// - public class UnknownOperatorError : FormulaFormatError - { - internal UnknownOperatorError(string formula, int error_position) - : base("Unknown operator found", formula, error_position) - { - } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Events/UnsupportedFileFormatError.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Events/UnsupportedFileFormatError.cs deleted file mode 100644 index 41ee652e66..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Events/UnsupportedFileFormatError.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Events -{ - /// - /// This happens when trying to save or load to or from an unsupported file format - /// - public class UnsupportedFileFormatError : ErrorDescription - { - internal UnsupportedFileFormatError(FileFormats.Format format) - { - this.message = "Unsupported file format " + format; - } - - /// - /// Description getter - /// - public override string Text { get { return message; } } - - private string message; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Events/WrongParenthesisSequenceError.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Events/WrongParenthesisSequenceError.cs deleted file mode 100644 index df55620258..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Events/WrongParenthesisSequenceError.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Events -{ - /// - /// This happens when parenthesis sequence in formula is broken - /// - public class WrongParenthesisSequenceError : FormulaFormatError - { - internal WrongParenthesisSequenceError(string formula, int error_position) - : base("Wrong parenthesis sequence", formula, error_position) - { - } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Events/WrongReferenceFormatError.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Events/WrongReferenceFormatError.cs deleted file mode 100644 index c4a9bb0397..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Events/WrongReferenceFormatError.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Events -{ - /// - /// This happens when a passed reference has wrong format - /// - public class WrongReferenceFormatError : ErrorDescription - { - internal WrongReferenceFormatError(string wrong_reference) - { - this.wrong_reference = wrong_reference; - } - - /// - /// Description getter - /// - public override string Text - { - get { return "Wrong reference format in \"" + wrong_reference + "\""; } - } - - private string wrong_reference; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/FileFormats/CsvLoader.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/FileFormats/CsvLoader.cs deleted file mode 100644 index c8f6f1c976..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/FileFormats/CsvLoader.cs +++ /dev/null @@ -1,231 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using System.IO; -using System.Text.RegularExpressions; -using System.Globalization; -using ASCOfficeEWSEditor.Editor.Cells; -using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor.FileFormats -{ - internal class CsvLoader - { - public struct WrapCells - { - public int m_nRow; - public int m_nCol; - }; - - static internal void Load(Workbook wb, string file_path, int code_page, char delimiter) - { - if(!File.Exists(file_path)) - { - throw new Events.ReportableException(new Events.InternalError("The specified path \"" + file_path + "\" is not found")); - } - - Worksheet active_sheet = wb.ActiveSheet as Worksheet; - - //DateTime beforeTime = DateTime.Now; - //Console.WriteLine(string.Format("Start: {0}", beforeTime.ToString())); - - // Массив для запоминания ячеек, у которых нужно сделать Wrap - List arrWrapCells = new List(); - - // fix - string strCommonXml = ""; - - if (active_sheet != null) - { - using (Microsoft.VisualBasic.FileIO.TextFieldParser oTextFieldParser = new Microsoft.VisualBasic.FileIO.TextFieldParser(file_path, System.Text.Encoding.GetEncoding(code_page))) - { - int nRow = 1; - - oTextFieldParser.Delimiters = new string[] { delimiter.ToString() }; - while (true) - { - string[] arrParts = null; - try - { - arrParts = oTextFieldParser.ReadFields(); - } - catch (Microsoft.VisualBasic.FileIO.MalformedLineException) - { - arrParts = new string[] { oTextFieldParser.ErrorLine }; - } - if (arrParts == null) - { - break; - } - // fix - string strRow = string.Format("", nRow); - int nColumn = 1; - foreach (string strValueTmp in arrParts) - { - string strValue = Unescape(strValueTmp); - if (strValue.Length != 0) - { - // fix - string strValType = RecognizeValueType(strValue); - Cell oCell = new Cell(nRow, nColumn); - CellRange oCellRange = new CellRange(oCell); - - strValue = stripNonValidXMLCharacters(strValue); - string strConvertValue = ConvertValue(strValue, strValType); - - if (strValType == "s") - strConvertValue = wb.RegisterSharedString(strValue.ToString(), oCellRange.NumCells).ToString(); - - string strItem = string.Format("{2}", oCell.ToString(), strValType, strConvertValue); - strRow += strItem; - - if (-1 != strValue.IndexOf("\n")) - { - // Нужно применить Wrap - WrapCells oWrapCells; - oWrapCells.m_nRow = nRow; - oWrapCells.m_nCol = nColumn; - arrWrapCells.Add(oWrapCells); - } - } - ++nColumn; - } - - ++nRow; - - // fix - strRow += ""; - strCommonXml += strRow; - } - } - } - - active_sheet.SheetData.InnerXml = strCommonXml; - - // Выставляем Wrap для нужных ячеек (у которых больше одной строки) - foreach (WrapCells oWrapCells in arrWrapCells) - { - active_sheet.Cell(oWrapCells.m_nRow, oWrapCells.m_nCol).Format.Alignment.WrapText = true; - } - - //Console.WriteLine(string.Format("Stop: {0}", DateTime.Now.ToString())); - //TimeSpan workTime = DateTime.Now - beforeTime; - //Console.WriteLine(workTime.ToString()); - } - //http://forums.asp.net/t/1483793.aspx - static internal String stripNonValidXMLCharacters(string textIn) - { - StringBuilder textOut = new StringBuilder(); // Used to hold the output. - char current; // Used to reference the current character. - - - if (textIn == null || textIn == string.Empty) return string.Empty; // vacancy test. - for (int i = 0; i < textIn.Length; i++) - { - current = textIn[i]; - - - if ((current == 0x9 || current == 0xA || current == 0xD) || - ((current >= 0x20) && (current <= 0xD7FF)) || - ((current >= 0xE000) && (current <= 0xFFFD)) || - ((current >= 0x10000) && (current <= 0x10FFFF))) - { - textOut.Append(current); - } - } - return textOut.ToString(); - } - static private string Unescape(string value_from_file) - { - if (value_from_file.StartsWith("\"") && value_from_file.EndsWith("\"")) - { - return value_from_file.Substring(1, value_from_file.Length - 2).Replace("\"\"", "\""); - } - return value_from_file; - } - - private static string RecognizeValueType(object value) - { - if (value is string) - { - double val_numeric; - string val_str = value.ToString().ToUpper(); - if (val_str == "TRUE" || val_str == "FALSE") - { - return "b"; - } - else if (val_str == "#NULL!" || val_str == "#DIV/0!" || val_str == "#VALUE!" || val_str == "#REF!" || - val_str == "#NAME?" || val_str == "#NUM!" || val_str == "#N/A") - { - return "e"; - } - else if (double.TryParse(val_str, NumberStyles.Float, new CultureInfo(0x409), out val_numeric)) - { - return ""; - } - else if (val_str.Length == 0) - { - return null; - } - else - { - return "s"; - } - } - else if (value is double || value is float || value is Int32 || value is Int16 || value is Int64) - { - return ""; - } - else if (value is bool) - { - return "b"; - } - else if (value is Calculation.Formulas.ErrorValue) - { - return "e"; - } - return null; - } - private static string ConvertValue(object value, string value_type) - { - string value_set = value.ToString(); - - if (value_type == "str") - { - value_set = value.ToString(); - } - else if (value_type == "b") - { - string bool_str; - if ((bool_str = value as string) != null) - { - value_set = bool_str.ToUpper() == "TRUE" ? "1" : "0"; - } - else - { - value_set = XMLVariant.ToString(value); - } - } - else if (value_type == null) - { - value_set = ""; - } - else - { - value_set = XMLVariant.ToString(value); - } - - return value_set; - } - private static string HtmlEncode(string value) - { - string val = value; - - if (!string.IsNullOrEmpty(value)) - val = System.Web.HttpUtility.HtmlEncode(value); - - return val; - } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/FileFormats/CsvSaver.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/FileFormats/CsvSaver.cs deleted file mode 100644 index e3b1f5f279..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/FileFormats/CsvSaver.cs +++ /dev/null @@ -1,81 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using System.IO; - -namespace ASCOfficeEWSEditor.Editor.FileFormats -{ - internal class CsvSaver - { - static internal void Save(Workbook wb, string file_path, int code_page, char delimiter) - { - Worksheet active_sheet = wb.ActiveSheet as Worksheet; - - if (active_sheet != null) - { - using (StreamWriter writer = new StreamWriter(file_path, false, System.Text.Encoding.GetEncoding(code_page))) - { - Cells.CellRange cells_boundary = active_sheet.GetNonEmptyCells0Range(); - if (cells_boundary == Cells.CellRange.Empty) - { - writer.WriteLine(); - return; - } - int nColumnCount = cells_boundary.ColumnLast; - int nRowCount = cells_boundary.RowLast; - if (0 >= nColumnCount && 0 >= nRowCount) - { - writer.WriteLine(); - return; - } - - - ASCOfficeEWSEditor.Editor.Walkers.StyleCollectorCache oCache = new ASCOfficeEWSEditor.Editor.Walkers.StyleCollectorCache(wb); - - Range oRange = active_sheet.Range("A1:" + Helpers.ReferencesFormat.column2str(nColumnCount, true) + nRowCount.ToString()); - - Dictionary arrRowsDefaultStyle; - List arrCollsDefaultStyle; - List arrCells = oRange.GetCellSimple(oCache, out arrRowsDefaultStyle, out arrCollsDefaultStyle); - - int nColumnCurrent = 1; - int nRowCurrent = 1; - - int nColumnTmp = 0; - int nRowTmp = 0; - bool bColumnTmp_rel = false; - bool bRowTmp_rel = false; - - foreach (CellSimple oCellSimple in arrCells) - { - Helpers.ReferencesFormat.str2loc(oCellSimple.ID, out nRowTmp, out bRowTmp_rel, out nColumnTmp, out bColumnTmp_rel); - for (; nRowCurrent < nRowTmp; ++nRowCurrent) - { - for (; nColumnCurrent <= nColumnCount; ++nColumnCurrent) - writer.Write(delimiter); - - writer.WriteLine(); - nColumnCurrent = 1; - } - - for (; nColumnCurrent < nColumnTmp; ++nColumnCurrent) - writer.Write(delimiter); - - string strCellText = Escape(oCellSimple.DispValue, delimiter); - writer.Write(strCellText); - } - } - } - } - - static private string Escape(string cell_value, char delimiter) - { - if (cell_value.IndexOf(delimiter) != -1 || cell_value.IndexOf('\"') != -1 || -1 != cell_value.IndexOf("\n")) - { - return "\"" + cell_value.Replace("\"", "\"\"") + "\""; - } - return cell_value; - } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/FileFormats/Serializer.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/FileFormats/Serializer.cs deleted file mode 100644 index 4c79b2c9cf..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/FileFormats/Serializer.cs +++ /dev/null @@ -1,241 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using System.IO; -using ASCOfficeEWSEditor.Editor; -using System.Diagnostics; - - -namespace ASCOfficeEWSEditor.Editor.FileFormats -{ - internal class Serializer - { - static public void Save(Workbook wb, string path) - { - Save(wb, path, Format.AUTO); - } - - static public Workbook Load(EWSEditor editor, string path) - { - return Load(editor, path, Format.AUTO); - } - - static public void Save(Workbook wb, string path, Format format) - { - string temp_dir_path = Path.GetDirectoryName(path) + '\\' + Path.GetFileNameWithoutExtension(path); - - if(format == Format.AUTO) - { - format = DetectFormatByExtension(path); - } - Trace.TraceInformation("Saving to file \"{0}\" started. Format: {1}", new object[] { path, format }); - switch (format) - { - case Format.XLSX: - { - XlsxSaver saver = new XlsxSaver(wb.GetXmlDocument(), wb.BinaryDataStorage); - ASCOfficeUtils.COfficeUtilsClass ooxArchiver = new ASCOfficeUtils.COfficeUtilsClass(); - if (!ooxArchiver.CompressFilesFromMemory(path, saver, -1)) - { - throw new Events.ReportableException(new Events.InternalError("Compression to \"" + path + "\" failed for unknown reason")); - } - break; - } - case Format.XLS: - { - XlsxSaver.Save(wb.GetXmlDocument(), temp_dir_path, wb.BinaryDataStorage); - - ASCOfficeXlsFile.CXlsFileClass converter = new ASCOfficeXlsFile.CXlsFileClass(); - converter.SaveToFile(path, temp_dir_path, ""); - break; - } - case Format.HTML: - { - XlsxSaver.Save(wb.GetXmlDocument(), temp_dir_path, wb.BinaryDataStorage); - - ASCOfficeWSHtmlFile.CWSHtmlFileClass converter = new ASCOfficeWSHtmlFile.CWSHtmlFileClass(); - converter.SaveToFile(path, temp_dir_path, ""); - break; - } - case Format.ODS: - { - XlsxSaver.Save(wb.GetXmlDocument(), temp_dir_path, wb.BinaryDataStorage); - - ASCOfficeOdfFileWLib.COfficeOdfFileWClass converter = new ASCOfficeOdfFileWLib.COfficeOdfFileWClass(); - converter.SaveToFile(path, temp_dir_path, ""); - break; - } - default: - throw new Events.ReportableException(new Events.UnsupportedFileFormatError(format)); - } - Trace.TraceInformation("Saving to file successfully finished"); - } - - static public void SaveToCSV(Workbook wb, string path, int code_page, char delimiter) - { - Trace.TraceInformation("Saving to CSV file \"{0}\" started. Code page: {1} Delimiter: \"{2}\"", - new object[] { path, code_page, delimiter }); - CsvSaver.Save(wb, path, code_page, delimiter); - Trace.TraceInformation("Saving to CSV file successfully finished"); - } - static public void SaveToPrint(Workbook wb, string path, int index ) - { - Trace.TraceInformation("Saving to Print file \"{0}\" started."); - string sIndex = index.ToString();//формируем трехзначную индексную строку - string temp_dir_path = Path.GetDirectoryName(path) + '/' + Path.GetFileNameWithoutExtension(path); - XlsxSaver.Save(wb.GetXmlDocument(), temp_dir_path, wb.BinaryDataStorage); - ASCOfficeWSHtmlFile.CWSHtmlFileClass converter = new ASCOfficeWSHtmlFile.CWSHtmlFileClass(); - converter.SaveToFile(path, temp_dir_path, ""); - Trace.TraceInformation("Saving to Print file successfully finished"); - } - - static public Workbook Load(EWSEditor editor, string path, Format format) - { - if (format == Format.AUTO) - { - ASCOfficeFile.CAVSOfficeFormatCheckerClass oFormatChecker = new ASCOfficeFile.CAVSOfficeFormatCheckerClass(); - int nCheckerFormat = oFormatChecker.GetFileFormat(path); - switch (nCheckerFormat) - { - case FileConverterUtils2.FileFormats.AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX: format = Format.XLSX; break; - case FileConverterUtils2.FileFormats.AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLS: format = Format.XLS; break; - case FileConverterUtils2.FileFormats.AVS_OFFICESTUDIO_FILE_SPREADSHEET_ODS: format = Format.ODS; break; - case FileConverterUtils2.FileFormats.AVS_OFFICESTUDIO_FILE_SPREADSHEET_CSV: format = Format.CSV; break; - default: format = DetectFormatByExtension(path); break; - } - } - Trace.TraceInformation("Loading from file \"{0}\" started. Format: {1}", new object[] { path, format }); - - if(!File.Exists(path)) - { - throw new Events.ReportableException(new Events.FileNotFoundError(Path.GetFullPath(path))); - } - - Workbook wb = null; - switch (format) - { - case Format.XLSX: - { - XmlDocument xml_doc = new XmlDocument(); - xml_doc.LoadXml(" "); - - ASCOfficeUtils.COfficeUtilsClass ooxArchiver = new ASCOfficeUtils.COfficeUtilsClass(); - List binary_data_storage = new List(); - XlsxLoader data_receiver = new XlsxLoader(xml_doc, binary_data_storage); - if (!ooxArchiver.ExtractFilesToMemory(path, data_receiver)) - { - throw new Events.ReportableException(new Events.InternalError("Extracting from \"" + path + "\" failed for unknown reason")); - } - - wb = new Workbook(Path.GetFileNameWithoutExtension(path), xml_doc, editor, binary_data_storage); - - editor.Workbooks.Add(wb.Name, wb); - break; - } - case Format.XLS: - { - string temp_dir_path = Path.GetDirectoryName(path) + '/' + Path.GetFileNameWithoutExtension(path); - - XmlDocument xml_doc = new XmlDocument(); - xml_doc.LoadXml(" "); - - ASCOfficeXlsFile.CXlsFileClass converter = new ASCOfficeXlsFile.CXlsFileClass(); - converter.LoadFromFile(path, temp_dir_path, ""); - List binary_data_storage = new List(); - XlsxLoader.LoadXML(xml_doc, temp_dir_path, binary_data_storage); - wb = new Workbook(Path.GetFileNameWithoutExtension(path), xml_doc, editor, binary_data_storage); - editor.Workbooks.Add(wb.Name, wb); - break; - } - default: - throw new Events.ReportableException(new Events.UnsupportedFileFormatError(format)); - - } - Trace.TraceInformation("Loading from file successfully finished"); - wb.Activate(); - return wb; - } - - static public Workbook LoadFromCSV(EWSEditor editor, string path, int code_page, char delimiter) - { - Trace.TraceInformation("Loading from CSV file \"{0}\" started. Code page: {1} Delimiter: \"{2}\"", - new object[] { path, code_page, delimiter }); - - if (!File.Exists(path)) - { - throw new Events.ReportableException(new Events.FileNotFoundError(Path.GetFullPath(path))); - } - - Workbook wb = editor.CreateWorkbook(Path.GetFileNameWithoutExtension(path), 1); - CsvLoader.Load(wb, path, code_page, delimiter); - Trace.TraceInformation("Loading from CSV file successfully finished"); - wb.Activate(); - return wb; - } - - static private Format DetectFormatByExtension(string path) - { - string ext = Path.GetExtension(path).ToLower(); - switch (ext) - { - case ".xls": - return Format.XLS; - case ".ods": - return Format.ODS; - case ".csv": - return Format.CSV; - case ".htm": - case ".html": - return Format.HTML; - case ".txt": - return Format.TXT; - case ".xlsx": - case "": - default: - return Format.XLSX; - } - } - - public const char CSV_default_delimiter = ','; - } - /// - /// Worksheet file format - /// - public enum Format - { - /// - /// *.xlsx Microsoft Excel 2007 - /// - XLSX, - /// - /// *.xls Microsoft Excel 97-2003 - /// - XLS, - /// - /// *.ods OpenOffice.org Calc - /// - ODS, - /// - /// *.csv Tab-delimited data - /// - HTML, - /// - /// *.html Html files - /// - CSV, - /// - /// *.txt Text format - /// - TXT, - /// - /// *.xml Internal AVS format - /// - AVS_INTERNAL, - /// - /// *.* Automatic format detection - /// - AUTO - }; - -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/FileFormats/XlsxLoader.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/FileFormats/XlsxLoader.cs deleted file mode 100644 index 4e39a2979d..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/FileFormats/XlsxLoader.cs +++ /dev/null @@ -1,170 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using System.IO; - -namespace ASCOfficeEWSEditor.Editor.FileFormats -{ - internal class XlsxLoader : ASCOfficeUtils.IExtractedFileEvent - { - internal XlsxLoader(XmlDocument xml_recv_document, List binary_data_storage) - { - this.xml_recv_document = xml_recv_document; - this.binary_data_storage = binary_data_storage; - } - - #region IExtractedFileEvent Members - - public void ExtractedFile(string file_name, ref Array binary_data) - { - if(file_name.EndsWith("/") && binary_data.Length == 0) // If directory - { - - } - else // If file - { - XmlNode dir_xml = Helpers.OOXNavigate.getFolderReferenceByPath(file_name, xml_recv_document.DocumentElement, true); - string ext = Path.GetExtension(file_name).ToLower(); - switch (ext) - { - case ".xml": - case ".rels": - { - XmlElement file_tag = xml_recv_document.CreateElement("file"); - file_tag.SetAttribute("name", Path.GetFileName(file_name)); - dir_xml.AppendChild(file_tag); - - //XmlDocument xml_from_file = new XmlDocument(); - //xml_from_file.Load(new StreamReader(new MemoryStream((byte[])binary_data))); - - //XmlNode imported_branch = xml_recv_document.ImportNode(xml_from_file.DocumentElement, true); - //file_tag.AppendChild(imported_branch); - - string sXml = System.Text.Encoding.UTF8.GetString((byte[])binary_data); - //удаляем символы переноса строк, иначе они будут считаться отдельными node - ReplaceSpecialChars(ref sXml); - int nHeadIndex = sXml.IndexOf("?>"); - if (-1 != nHeadIndex) - file_tag.InnerXml = sXml.Remove(0, nHeadIndex + 2); - else - file_tag.InnerXml = sXml; - - break; - } - default: // Binary and unsupported data - { - XmlElement file_tag = xml_recv_document.CreateElement("file"); - file_tag.SetAttribute("name", Path.GetFileName(file_name)); - dir_xml.AppendChild(file_tag); - file_tag.SetAttribute("format", "bin"); - binary_data_storage.Add((byte[])binary_data); - file_tag.SetAttribute("bin_data_id", (binary_data_storage.Count - 1).ToString()); - break; - } - } - - } - } - - #endregion - - static internal void LoadXML(XmlDocument xml_doc, string dir_path, List binary_data_storage) - { - if(!Directory.Exists(dir_path)) - { - throw new Events.ReportableException(new Events.InternalError("The specified path \"" + dir_path + "\" is not found")); - } - loadDir(xml_doc.DocumentElement, dir_path, binary_data_storage); - } - - static private void loadDir(XmlElement cur_dir, string path_of_dir, List binary_data_storage) - { - foreach (string entry in Directory.GetDirectories(path_of_dir)) - { - XmlElement dir_tag = cur_dir.OwnerDocument.CreateElement("dir"); - dir_tag.SetAttribute("name", Path.GetFileName(entry)); - cur_dir.AppendChild(dir_tag); - loadDir(dir_tag, entry, binary_data_storage); - } - - foreach (string file_name in Directory.GetFiles(path_of_dir)) - { - string ext = Path.GetExtension(file_name).ToLower(); - switch(ext) - { - case ".xml": - case ".rels": - { - XmlElement file_tag = cur_dir.OwnerDocument.CreateElement("file"); - file_tag.SetAttribute("name", Path.GetFileName(file_name)); - cur_dir.AppendChild(file_tag); - - XmlDocument xml_from_file = new XmlDocument(); - xml_from_file.Load(file_name); - XmlNode imported_branch = cur_dir.OwnerDocument.ImportNode(xml_from_file.DocumentElement, true); - file_tag.AppendChild(imported_branch); - break; - } - default: // Binary and unsupported data - { - XmlElement file_tag = cur_dir.OwnerDocument.CreateElement("file"); - file_tag.SetAttribute("name", Path.GetFileName(file_name)); - cur_dir.AppendChild(file_tag); - file_tag.SetAttribute("format", "bin"); - - using (FileStream bin_file = File.OpenRead(file_name)) - { - byte[] bin_file_buffer = new byte[bin_file.Length]; - bin_file.Read(bin_file_buffer, 0, (int)bin_file.Length); - binary_data_storage.Add(bin_file_buffer); - file_tag.SetAttribute("bin_data_id", (binary_data_storage.Count - 1).ToString()); - } - break; - } - } - } - } - - // Грамотно удаляем конструкции \r\n - // \r\n - // \r\n\r\n - // \r\n - // - // Нельзя удалять только случай 2 - private void ReplaceSpecialChars(ref string strXml) - { - strXml = strXml.Replace("\r", ""); - strXml = strXml.Replace("\t", ""); - - for (int nIndex = 2; nIndex < strXml.Length - 2; ++nIndex) - { - if ('\n' == strXml[nIndex]) - { - if ('>' != strXml[nIndex - 1] || '<' != strXml[nIndex + 1]) - continue; - if ('/' != strXml[nIndex + 2] || '/' == strXml[nIndex - 2]) - { - strXml = strXml.Remove(nIndex--, 1); - continue; - } - - for (int nIndex2 = nIndex - 1; nIndex2 >= 0; --nIndex2) - { - if ('<' == strXml[nIndex2]) - { - if ('/' == strXml[nIndex2 + 1]) - strXml = strXml.Remove(nIndex--, 1); - - break; - } - } - } - } - } - - private XmlDocument xml_recv_document; - private List binary_data_storage; - private const int initial_memory_stream_buffer = 4096; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/FileFormats/XlsxSaver.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/FileFormats/XlsxSaver.cs deleted file mode 100644 index 6b003e5349..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/FileFormats/XlsxSaver.cs +++ /dev/null @@ -1,184 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using System.IO; -using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor.FileFormats -{ - internal class XlsxSaver : ASCOfficeUtils.IRequestFileEvent - { - internal XlsxSaver(XmlDocument xml_source_document, List binary_data_storage) - { - this.xml_source_document = xml_source_document; - this.binary_data_storage = binary_data_storage; - xml_current_element = (XmlElement)xml_source_document.DocumentElement.FirstChild; - } - - #region IRequestFileEvent Members - - public bool RequestFile(out string file_name, out Array arr) - { - if (xml_current_element == null) - { - file_name = ""; - arr = new byte[0]; - return false; - } - - string node_type = xml_current_element.Name; - string node_name = xml_current_element.GetAttribute("name"); - if ("dir" == node_type) - { - file_name = DetermineFilePathInXml(xml_current_element) + '/'; - arr = new byte[0]; - - XmlNode first_child = xml_current_element.FirstChild; - if(first_child != null) - { - xml_current_element = (XmlElement)first_child; - } - else - { - xml_current_element = Following(xml_current_element); - } - return true; - } - else if ("file" == node_type) - { - file_name = DetermineFilePathInXml(xml_current_element); - - string file_format = xml_current_element.GetAttribute("format"); - if (file_format == "bin") - { - string bin_data_id_str = xml_current_element.GetAttribute("bin_data_id"); - int bin_data_id = XMLInt.ParseOrDefault(bin_data_id_str, -1); - if(bin_data_id >= 0 && bin_data_id < binary_data_storage.Count) - { - arr = binary_data_storage[bin_data_id]; - } - else // Wrong binary reference - { - xml_current_element = Following(xml_current_element); - return RequestFile(out file_name, out arr); - } - } - else - { - using (MemoryStream mem_stream = new MemoryStream(initial_memory_stream_buffer)) - { - using (XmlWriter writer = XmlWriter.Create(mem_stream)) - { - xml_current_element.WriteContentTo(writer); - } - arr = mem_stream.ToArray(); - } - } - xml_current_element = Following(xml_current_element); - return true; - } - else // Unknown type of storage - { - xml_current_element = Following(xml_current_element); - return RequestFile(out file_name, out arr); - } - } - - #endregion - - private string DetermineFilePathInXml(XmlElement file_or_dir_xml) - { - string path = file_or_dir_xml.GetAttribute("name"); - file_or_dir_xml = (XmlElement)file_or_dir_xml.ParentNode; - while(file_or_dir_xml.Name != "root") - { - string node_name = file_or_dir_xml.GetAttribute("name"); - path = node_name + '/' + path; - file_or_dir_xml = (XmlElement)file_or_dir_xml.ParentNode; - } - return path; - } - - private XmlElement Following(XmlNode file_or_dir_xml) - { - XmlNode cur_elem_xml = file_or_dir_xml; - while (cur_elem_xml != null) - { - XmlNode next_sibling_xml = cur_elem_xml.SelectSingleNode("following-sibling::*"); - if (next_sibling_xml != null) - { - return (XmlElement)next_sibling_xml; - } - cur_elem_xml = cur_elem_xml.ParentNode; - } - return null; - } - - static internal void Save(XmlDocument xml_doc, string dir_path, List binary_data_storage) - { - Directory.CreateDirectory(dir_path); - storeDir(xml_doc.DocumentElement, dir_path, binary_data_storage); - } - - static private void storeDir(XmlElement cur_dir, string path_for_dir, List binary_data_storage) - { - if(null == cur_dir) - { - return; - } - - string node_type = cur_dir.Name; - string node_name = cur_dir.GetAttribute("name"); - if("dir" == node_type) - { - string dir_name = path_for_dir + "/" + node_name; - if (!Directory.Exists(dir_name)) - { - Directory.CreateDirectory(dir_name); - } - XmlNodeList children = cur_dir.ChildNodes; - foreach(XmlNode item in children) - { - storeDir((XmlElement)item, dir_name, binary_data_storage); - } - } - else if("root" == node_type) - { - XmlNodeList children = cur_dir.ChildNodes; - foreach(XmlNode item in children) - { - storeDir((XmlElement)item, path_for_dir, binary_data_storage); - } - } - else if("file" == node_type) - { - string file_format = cur_dir.GetAttribute("format"); - if(file_format == "bin") - { - string bin_data_id_str = cur_dir.GetAttribute("bin_data_id"); - int bin_data_id = XMLInt.ParseOrDefault(bin_data_id_str, -1); - if (bin_data_id >= 0 && bin_data_id < binary_data_storage.Count) - { - using (FileStream bin_file = File.Create(path_for_dir + "/" + node_name)) - { - bin_file.Write(binary_data_storage[bin_data_id], 0, binary_data_storage[bin_data_id].Length); - } - } - } - else - { - using(XmlWriter writer = XmlWriter.Create(path_for_dir + "/" + node_name)) - { - cur_dir.WriteContentTo(writer); - } - } - } - } - - private XmlDocument xml_source_document; - private XmlElement xml_current_element; - private List binary_data_storage; - private const int initial_memory_stream_buffer = 4096; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Alignment/Alignment.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Alignment/Alignment.cs deleted file mode 100644 index 7926705c8f..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Alignment/Alignment.cs +++ /dev/null @@ -1,224 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using ASCOfficeEWSEditor.Editor.Walkers; - -namespace ASCOfficeEWSEditor.Editor.Format.Alignment -{ - /// - /// Represents a set of cells alignment properties. - /// Has permanent link to the range where it was created from - /// - public class Alignment - { - internal Alignment(RangeWalker range_walker, Workbook workbook) - { - this.range_walker = range_walker; - this.workbook = workbook; - } - - - /// - /// Get/set the horizontal alignment in cells. - /// - public HorizontalAlignmentType? Horizontal - { - get - { - HorizontalProperty property = new HorizontalProperty(workbook); - StyleCollector collector = new StyleCollector(new AlignmentEntity(workbook), property, workbook); - range_walker.CollectStatisticsIncludingEmpty(collector); - - return property.Value; - } - set - { - HorizontalProperty property = new HorizontalProperty(value.Value, workbook); - StyleSetter setter = new StyleSetter(new AlignmentEntity(workbook), property, workbook); - range_walker.SetStyles(setter); - } - } - - /// - /// Get/set the indentation for text in cells. - /// - public int? Indent - { - get - { - IndentProperty property = new IndentProperty(workbook); - StyleCollector collector = new StyleCollector(new AlignmentEntity(workbook), property, workbook); - range_walker.CollectStatisticsIncludingEmpty(collector); - - return property.Value; - } - set - { - IndentProperty property = new IndentProperty(value.Value, workbook); - StyleSetter setter = new StyleSetter(new AlignmentEntity(workbook), property, workbook); - range_walker.SetStyles(setter); - } - } - - /// - /// Get/set if the cells justified or distributed alignment should be used on the last line of text. - /// - public bool? JustifyLastLine - { - get - { - JustifyLastLineProperty property = new JustifyLastLineProperty(); - StyleCollector collector = new StyleCollector(new AlignmentEntity(workbook), property, workbook); - range_walker.CollectStatisticsIncludingEmpty(collector); - - return property.Value; - } - set - { - JustifyLastLineProperty property = new JustifyLastLineProperty(value.Value); - StyleSetter setter = new StyleSetter(new AlignmentEntity(workbook), property, workbook); - range_walker.SetStyles(setter); - } - } - - /// - /// Get/set the reading order of the cells. - /// - public ReadingOrderType? ReadingOrder - { - get - { - ReadingOrderProperty property = new ReadingOrderProperty(workbook); - StyleCollector collector = new StyleCollector(new AlignmentEntity(workbook), property, workbook); - range_walker.CollectStatisticsIncludingEmpty(collector); - - return property.Value; - } - set - { - ReadingOrderProperty property = new ReadingOrderProperty(value.Value, workbook); - StyleSetter setter = new StyleSetter(new AlignmentEntity(workbook), property, workbook); - range_walker.SetStyles(setter); - } - } - - /// - /// Get/set the rotation of text in cells. - /// - public int? TextRotation - { - get - { - TextRotationProperty property = new TextRotationProperty(workbook); - StyleCollector collector = new StyleCollector(new AlignmentEntity(workbook), property, workbook); - range_walker.CollectStatisticsIncludingEmpty(collector); - - return property.Value; - } - set - { - TextRotationProperty property = new TextRotationProperty(value.Value, workbook); - StyleSetter setter = new StyleSetter(new AlignmentEntity(workbook), property, workbook); - range_walker.SetStyles(setter); - } - } - - /// - /// Get/set the horizontal alignment in cells. - /// - public VerticalAlignmentType? Vertical - { - get - { - VerticalProperty property = new VerticalProperty(workbook); - StyleCollector collector = new StyleCollector(new AlignmentEntity(workbook), property, workbook); - range_walker.CollectStatisticsIncludingEmpty(collector); - - return property.Value; - } - set - { - VerticalProperty property = new VerticalProperty(value.Value, workbook); - StyleSetter setter = new StyleSetter(new AlignmentEntity(workbook), property, workbook); - range_walker.SetStyles(setter); - } - } - - /// - /// Get/set if the text in a cell should be line-wrapped within the cell. - /// - public bool? WrapText - { - get - { - WrapTextProperty property = new WrapTextProperty(); - StyleCollector collector = new StyleCollector(new AlignmentEntity(workbook), property, workbook); - range_walker.CollectStatisticsIncludingEmpty(collector); - - return property.Value; - } - set - { - WrapTextProperty property = new WrapTextProperty(value.Value); - StyleSetter setter = new StyleSetter(new AlignmentEntity(workbook), property, workbook); - range_walker.SetStyles(setter); - } - } - - private Workbook workbook; - private RangeWalker range_walker; - - } - - public class AlignmentSimple - { - //для нужд быстрой загрузки - internal AlignmentSimple() - { - } - public HorizontalAlignmentType? Horizontal = HorizontalAlignmentType.right; - public VerticalAlignmentType? Vertical = VerticalAlignmentType.center; - public bool? WrapText = false; - - public static string HorizontalAlignmentToString(ref HorizontalAlignmentType? oHorizontal) - { - switch (oHorizontal) - { - case HorizontalAlignmentType.center: - return "center"; - case HorizontalAlignmentType.centerContinuous: - return "centerContinuous"; - case HorizontalAlignmentType.distributed: - return "distributed"; - case HorizontalAlignmentType.fill: - return "fill"; - case HorizontalAlignmentType.general: - return "general"; - case HorizontalAlignmentType.justify: - return "justify"; - case HorizontalAlignmentType.left: - return "left"; - case HorizontalAlignmentType.right: - default: - return "right"; - } - } - public static string VerticalAlignmentToString(ref VerticalAlignmentType? oVertical) - { - switch (oVertical) - { - case VerticalAlignmentType.bottom: - return "bottom"; - case VerticalAlignmentType.distributed: - return "distributed"; - case VerticalAlignmentType.justify: - return "justify"; - case VerticalAlignmentType.top: - return "top"; - case VerticalAlignmentType.center: - default: - return "middle"; - } - } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Alignment/AlignmentEntity.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Alignment/AlignmentEntity.cs deleted file mode 100644 index 582db5dc27..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Alignment/AlignmentEntity.cs +++ /dev/null @@ -1,55 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; - -namespace ASCOfficeEWSEditor.Editor.Format.Alignment -{ - internal class AlignmentEntity : InlineEntity - { - public AlignmentEntity(Workbook workbook) - : base(workbook) - { - horiz_prop = new HorizontalProperty(workbook); - indent_prop = new IndentProperty(workbook); - just_last_prop = new JustifyLastLineProperty(); - reading_order_prop = new ReadingOrderProperty(workbook); - rel_indent_prop = new RelativeIndentProperty(workbook); - shrink_to_fit_prop = new ShrinkToFitProperty(); - rotation_prop = new TextRotationProperty(workbook); - vert_prop = new VerticalProperty(workbook); - wrap_prop = new WrapTextProperty(); - } - - public override bool CompareEntities(XmlElement ent1, XmlElement ent2) - { - return horiz_prop.CompareEntities(ent1, ent2) && - indent_prop.CompareEntities(ent1, ent2) && - just_last_prop.CompareEntities(ent1, ent2) && - reading_order_prop.CompareEntities(ent1, ent2) && - rel_indent_prop.CompareEntities(ent1, ent2) && - shrink_to_fit_prop.CompareEntities(ent1, ent2) && - rotation_prop.CompareEntities(ent1, ent2) && - vert_prop.CompareEntities(ent1, ent2) && - wrap_prop.CompareEntities(ent1, ent2); - } - - public override string GetEntityTagName() - { - return entity_tag_name; - } - - private const string entity_tag_name = "alignment"; - - private HorizontalProperty horiz_prop; - private IndentProperty indent_prop; - private JustifyLastLineProperty just_last_prop; - private ReadingOrderProperty reading_order_prop; - private RelativeIndentProperty rel_indent_prop; - private ShrinkToFitProperty shrink_to_fit_prop; - private TextRotationProperty rotation_prop; - private VerticalProperty vert_prop; - private WrapTextProperty wrap_prop; - - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Alignment/HorizontalProperty.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Alignment/HorizontalProperty.cs deleted file mode 100644 index 337666cb44..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Alignment/HorizontalProperty.cs +++ /dev/null @@ -1,111 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor.Format.Alignment -{ - internal class HorizontalProperty : Property - { - public HorizontalProperty(HorizontalAlignmentType init_value, Workbook workbook) - : base(init_value) - { - this.workbook = workbook; - } - - public HorizontalProperty(Workbook workbook) - { - this.workbook = workbook; - } - - public override HorizontalAlignmentType ExtractValueFromEntity(XmlElement alignment_tag) - { - if (alignment_tag == null) - { - return HorizontalAlignmentType.general; - } - string scheme_val = alignment_tag.GetAttribute("horizontal"); - switch (scheme_val) - { - case "center": - return HorizontalAlignmentType.center; - case "centerContinuous": - return HorizontalAlignmentType.centerContinuous; - case "distributed": - return HorizontalAlignmentType.distributed; - case "fill": - return HorizontalAlignmentType.fill; - case "justify": - return HorizontalAlignmentType.justify; - case "left": - return HorizontalAlignmentType.left; - case "right": - return HorizontalAlignmentType.right; - case "general": - default: - return HorizontalAlignmentType.general; - } - } - - public override void SetToEntity(XmlElement alignment_tag) - { - if (Value.HasValue) - { - if (Value.Value != HorizontalAlignmentType.general) - { - alignment_tag.SetAttribute("horizontal", Value.Value.ToString()); - } - else - { - alignment_tag.RemoveAttribute("horizontal"); - } - } - } - - - private Workbook workbook; - } - - /// - /// Horizontal Alignment Type - /// - public enum HorizontalAlignmentType - { - /// - /// Centered - /// - center, - /// - /// centered across multiple cells - /// - centerContinuous, - /// - /// Distributed across the width of the cell - /// - distributed, - /// - /// Filled across the entire width of the cell - /// - fill, - /// - /// General-aligned - /// - general, - /// - /// Justified - /// - justify, - /// - /// Left-aligned - /// - left, - /// - /// Right-aligned - /// - right - - } - - -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Alignment/IndentProperty.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Alignment/IndentProperty.cs deleted file mode 100644 index cbd4465f70..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Alignment/IndentProperty.cs +++ /dev/null @@ -1,51 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor.Format.Alignment -{ - internal class IndentProperty : Property - { - public IndentProperty(int init_value, Workbook workbook) - : base(init_value) - { - this.workbook = workbook; - } - - public IndentProperty(Workbook workbook) - { - this.workbook = workbook; - } - - public override int ExtractValueFromEntity(XmlElement alignment_tag) - { - if (alignment_tag == null) - { - return 0; - } - return XMLInt.ParseOrDefault(alignment_tag.GetAttribute("indent"), 0); - } - - public override void SetToEntity(XmlElement alignment_tag) - { - if (Value.HasValue) - { - if (Value.Value != 0) - { - alignment_tag.SetAttribute("indent", Value.Value.ToString()); - } - else - { - alignment_tag.RemoveAttribute("indent"); - } - } - } - - - private Workbook workbook; - } - - -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Alignment/JustifyLastLineProperty.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Alignment/JustifyLastLineProperty.cs deleted file mode 100644 index 3e15f6601c..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Alignment/JustifyLastLineProperty.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor.Format.Alignment -{ - internal class JustifyLastLineProperty : PropertyBooleanAttrib - { - public JustifyLastLineProperty(bool init_value) - : base(init_value, false) - { - } - - public JustifyLastLineProperty() - : base(false) - { - } - - internal override string AttribName { get { return "justifyLastLine"; } } - } - - -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Alignment/ReadingOrderProperty.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Alignment/ReadingOrderProperty.cs deleted file mode 100644 index df2dbb1e70..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Alignment/ReadingOrderProperty.cs +++ /dev/null @@ -1,81 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor.Format.Alignment -{ - internal class ReadingOrderProperty : Property - { - public ReadingOrderProperty(ReadingOrderType init_value, Workbook workbook) - : base(init_value) - { - this.workbook = workbook; - } - - public ReadingOrderProperty(Workbook workbook) - { - this.workbook = workbook; - } - - public override ReadingOrderType ExtractValueFromEntity(XmlElement alignment_tag) - { - if (alignment_tag == null) - { - return ReadingOrderType.ContextDependent; - } - string scheme_val = alignment_tag.GetAttribute("readingOrder"); - switch (scheme_val) - { - case "1": - return ReadingOrderType.LeftToRight; - case "2": - return ReadingOrderType.RightToLeft; - case "0": - default: - return ReadingOrderType.ContextDependent; - } - } - - public override void SetToEntity(XmlElement alignment_tag) - { - if (Value.HasValue) - { - if (Value.Value != ReadingOrderType.ContextDependent) - { - alignment_tag.SetAttribute("readingOrder", Value.Value == ReadingOrderType.LeftToRight ? "1" : "2"); - } - else - { - alignment_tag.RemoveAttribute("readingOrder"); - } - } - } - - - private Workbook workbook; - } - - /// - /// Reading Order Type - /// - public enum ReadingOrderType - { - /// - /// reading order is determined by scanning the text for the first non-whitespace character: - /// if it is a strong right-to-left character, the reading order is right-to-left; otherwise, the reading order left-to-right. - /// - ContextDependent, - /// - /// reading order is left-to-right in the cell, as in English. - /// - LeftToRight, - /// - /// reading order is right-to-left in the cell, as in Hebrew - /// - RightToLeft - } - - -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Alignment/RelativeIndentProperty.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Alignment/RelativeIndentProperty.cs deleted file mode 100644 index 40f6e261c1..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Alignment/RelativeIndentProperty.cs +++ /dev/null @@ -1,51 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor.Format.Alignment -{ - internal class RelativeIndentProperty : Property - { - public RelativeIndentProperty(int init_value, Workbook workbook) - : base(init_value) - { - this.workbook = workbook; - } - - public RelativeIndentProperty(Workbook workbook) - { - this.workbook = workbook; - } - - public override int ExtractValueFromEntity(XmlElement alignment_tag) - { - if (alignment_tag == null) - { - return 0; - } - return XMLInt.ParseOrDefault(alignment_tag.GetAttribute("relativeIndent"), 0); - } - - public override void SetToEntity(XmlElement alignment_tag) - { - if (Value.HasValue) - { - if (Value.Value != 0) - { - alignment_tag.SetAttribute("relativeIndent", Value.Value.ToString()); - } - else - { - alignment_tag.RemoveAttribute("relativeIndent"); - } - } - } - - - private Workbook workbook; - } - - -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Alignment/ShrinkToFitProperty.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Alignment/ShrinkToFitProperty.cs deleted file mode 100644 index d032725045..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Alignment/ShrinkToFitProperty.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor.Format.Alignment -{ - internal class ShrinkToFitProperty : PropertyBooleanAttrib - { - public ShrinkToFitProperty(bool init_value) - : base(init_value, false) - { - } - - public ShrinkToFitProperty() : base(false) - { - } - - internal override string AttribName { get { return "shrinkToFit"; } } - } - - -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Alignment/TextRotationProperty.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Alignment/TextRotationProperty.cs deleted file mode 100644 index da95f80749..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Alignment/TextRotationProperty.cs +++ /dev/null @@ -1,51 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor.Format.Alignment -{ - internal class TextRotationProperty : Property - { - public TextRotationProperty(int init_value, Workbook workbook) - : base(init_value) - { - this.workbook = workbook; - } - - public TextRotationProperty(Workbook workbook) - { - this.workbook = workbook; - } - - public override int ExtractValueFromEntity(XmlElement alignment_tag) - { - if (alignment_tag == null) - { - return 0; - } - return XMLInt.ParseOrDefault(alignment_tag.GetAttribute("textRotation"), 0); - } - - public override void SetToEntity(XmlElement alignment_tag) - { - if (Value.HasValue) - { - if (Value.Value != 0) - { - alignment_tag.SetAttribute("textRotation", Value.Value.ToString()); - } - else - { - alignment_tag.RemoveAttribute("textRotation"); - } - } - } - - - private Workbook workbook; - } - - -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Alignment/VerticalProperty.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Alignment/VerticalProperty.cs deleted file mode 100644 index 9d69e04159..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Alignment/VerticalProperty.cs +++ /dev/null @@ -1,92 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor.Format.Alignment -{ - internal class VerticalProperty : Property - { - public VerticalProperty(VerticalAlignmentType init_value, Workbook workbook) - : base(init_value) - { - this.workbook = workbook; - } - - public VerticalProperty(Workbook workbook) - { - this.workbook = workbook; - } - - public override VerticalAlignmentType ExtractValueFromEntity(XmlElement alignment_tag) - { - if (alignment_tag == null) - { - return VerticalAlignmentType.bottom; - } - string vert_val = alignment_tag.GetAttribute("vertical"); - switch (vert_val) - { - case "center": - return VerticalAlignmentType.center; - case "distributed": - return VerticalAlignmentType.distributed; - case "justify": - return VerticalAlignmentType.justify; - case "top": - return VerticalAlignmentType.top; - case "bottom": - default: - return VerticalAlignmentType.bottom; - } - } - - public override void SetToEntity(XmlElement alignment_tag) - { - if (Value.HasValue) - { - if (Value.Value != VerticalAlignmentType.bottom) - { - alignment_tag.SetAttribute("vertical", Value.Value.ToString()); - } - else - { - alignment_tag.RemoveAttribute("vertical"); - } - } - } - - - private Workbook workbook; - } - - /// - /// Horizontal Alignment Type - /// - public enum VerticalAlignmentType - { - /// - /// Top-aligned - /// - top, - /// - /// Centered - /// - center, - /// - /// Bottom-aligned - /// - bottom, - /// - /// Justified - /// - justify, - /// - /// Distributed - /// - distributed - } - - -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Alignment/WrapTextProperty.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Alignment/WrapTextProperty.cs deleted file mode 100644 index 1aeca3aec3..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Alignment/WrapTextProperty.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor.Format.Alignment -{ - internal class WrapTextProperty : PropertyBooleanAttrib - { - public WrapTextProperty(bool init_value) - : base(init_value, false) - { - } - - public WrapTextProperty() - : base(false) - { - } - - internal override string AttribName { get { return "wrapText"; } } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Borders/Border.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Borders/Border.cs deleted file mode 100644 index 2e7c12fea4..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Borders/Border.cs +++ /dev/null @@ -1,152 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using ASCOfficeEWSEditor.Editor.Walkers; - -namespace ASCOfficeEWSEditor.Editor.Format.Borders -{ - /// - /// Represents a set of cells border properties. - /// Has permanent link to the range where it was created from - /// Corresponds to , , etc. tag - /// - public class Border - { - internal Border(BorderPosition border_position, RangeWalker range_walker, Workbook workbook) - { - this.range_walker = range_walker; - this.workbook = workbook; - this.border_position = border_position; - } - - /// - /// Returns Color object that is responsible for getting and setting of border color of cells. - /// Read-only. - /// - public Colors.Color Color - { - get - { - Colors.ColorProperty color_property = new Colors.FgColorProperty("color", workbook); - BorderProperty property = new BorderProperty(border_position, color_property, workbook); // Intermediate level to process -like tags - StyleCollector collector = new StyleCollector(new BorderEntity(workbook), property, workbook); - range_walker.CollectStatisticsIncludingEmpty(collector); - - StyleSetter style_setter = new StyleSetter(new BorderEntity(workbook), property, workbook); - if (property.IsNull()) - { - color_property.Value = new Colors.FgColor(workbook); - return new Colors.Color(null, range_walker, style_setter, color_property, workbook); - } - return new Colors.Color(color_property.Value, range_walker, style_setter, color_property, workbook); - // Terrible code. I know. Don't have time to improve. - } - private set { } - } - - /// - /// Get/set the style of a border of the cells - /// - public BorderStyle? Style - { - get - { - StyleProperty style_property = new StyleProperty(workbook); - BorderProperty property = new BorderProperty(border_position, style_property, workbook); // Intermediate level to process -like tags - StyleCollector collector = new StyleCollector(new BorderEntity(workbook), property, workbook); - range_walker.CollectStatisticsIncludingEmpty(collector); - - return style_property.Value; - } - set - { - StyleProperty style_property = new StyleProperty(value.Value, workbook); - BorderProperty property = new BorderProperty(border_position, style_property, workbook); // Intermediate level to process -like tags - StyleSetter setter = new StyleSetter(new BorderEntity(workbook), property, workbook); - range_walker.SetStyles(setter); - } - } - - - - private Workbook workbook; - private RangeWalker range_walker; - private BorderPosition border_position; - } - - - /// - /// Represents a specific set of cells border properties for diagonal borders. - /// Has permanent link to the range where it was created from - /// Corresponds to tag only - /// - public class DiagonalBorder : Border - { - internal DiagonalBorder(BorderPosition border_position, RangeWalker range_walker, Workbook workbook) : base(border_position, range_walker, workbook) - { - this.range_walker = range_walker; - this.border_position = border_position; - this.workbook = workbook; - } - - - /// - /// Get/set the style of a border of the cells - /// - public DiagonalType? DiagonalType - { - get - { - DiagonalTypeProperty diag_type_property = new DiagonalTypeProperty(workbook); - StyleCollector collector = new StyleCollector(new BorderEntity(workbook), diag_type_property, workbook); - range_walker.CollectStatisticsIncludingEmpty(collector); - - return diag_type_property.Value; - } - set - { - DiagonalTypeProperty diag_type_property = new DiagonalTypeProperty(value.Value, workbook); - StyleSetter setter = new StyleSetter(new BorderEntity(workbook), diag_type_property, workbook); - range_walker.SetStyles(setter); - } - } - - - - private Workbook workbook; - private RangeWalker range_walker; - private BorderPosition border_position; - } - - /// - /// Type of a diagonal border - /// - public enum DiagonalType - { - /// - /// Top left corner to bottom right - /// - Down, - /// - /// Bottom left to top right - /// - Up, - /// - /// Both up and down diagonals - /// - Both, - /// - /// No diagonal line - /// - none - } - - public class BorderSimple - { - internal BorderSimple() - { - } - public Colors.Color Color; - public BorderStyle? Style; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Borders/BorderEntity.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Borders/BorderEntity.cs deleted file mode 100644 index f1c95f2852..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Borders/BorderEntity.cs +++ /dev/null @@ -1,83 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; - -namespace ASCOfficeEWSEditor.Editor.Format.Borders -{ - internal class BorderEntity : SeparateEntity - { - public BorderEntity(Workbook workbook) - : base(workbook) - { - color_left_prop = new BorderProperty(BorderPosition.left, new Colors.FgColorProperty("color", workbook), workbook); - color_right_prop = new BorderProperty(BorderPosition.right, new Colors.FgColorProperty("color", workbook), workbook); - color_top_prop = new BorderProperty(BorderPosition.top, new Colors.FgColorProperty("color", workbook), workbook); - color_bottom_prop = new BorderProperty(BorderPosition.bottom, new Colors.FgColorProperty("color", workbook), workbook); - color_diagonal_prop = new BorderProperty(BorderPosition.diagonal, new Colors.FgColorProperty("color", workbook), workbook); - style_left_prop = new BorderProperty(BorderPosition.left, new StyleProperty(workbook), workbook); - style_right_prop = new BorderProperty(BorderPosition.right, new StyleProperty(workbook), workbook); - style_top_prop = new BorderProperty(BorderPosition.top, new StyleProperty(workbook), workbook); - style_bottom_prop = new BorderProperty(BorderPosition.bottom, new StyleProperty(workbook), workbook); - style_diagonal_prop = new BorderProperty(BorderPosition.diagonal, new StyleProperty(workbook), workbook); - diag_type_prop = new DiagonalTypeProperty(workbook); - outline_prop = new OutlineProperty(); - } - - public override string GetEntityIdAttribName() - { - return entity_id_attrib_name; - } - - public override string GetEntitiesTagName() - { - return entities_tag_name; - } - - public override string GetEntityTagName() - { - return entity_tag_name; - } - - public override string GetEntityTemplate() - { - return Resource1.default_border; - } - - public override bool CompareEntities(XmlElement ent1, XmlElement ent2) - { - return color_left_prop.CompareEntities(ent1, ent2) && - color_right_prop.CompareEntities(ent1, ent2) && - color_top_prop.CompareEntities(ent1, ent2) && - color_bottom_prop.CompareEntities(ent1, ent2) && - color_diagonal_prop.CompareEntities(ent1, ent2) && - style_left_prop.CompareEntities(ent1, ent2) && - style_right_prop.CompareEntities(ent1, ent2) && - style_top_prop.CompareEntities(ent1, ent2) && - style_bottom_prop.CompareEntities(ent1, ent2) && - style_diagonal_prop.CompareEntities(ent1, ent2) && - diag_type_prop.CompareEntities(ent1, ent2) && - outline_prop.CompareEntities(ent1, ent2); - } - - private const string apply_entity_attrib_name = "applyBorder"; - private const string entity_id_attrib_name = "borderId"; - private const string entities_tag_name = "borders"; - private const string entity_tag_name = "border"; - - private BorderProperty color_left_prop; - private BorderProperty color_right_prop; - private BorderProperty color_top_prop; - private BorderProperty color_bottom_prop; - private BorderProperty color_diagonal_prop; - private BorderProperty style_left_prop; - private BorderProperty style_right_prop; - private BorderProperty style_top_prop; - private BorderProperty style_bottom_prop; - private BorderProperty style_diagonal_prop; - private DiagonalTypeProperty diag_type_prop; - private OutlineProperty outline_prop; - - - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Borders/BorderProperty.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Borders/BorderProperty.cs deleted file mode 100644 index b89052ca13..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Borders/BorderProperty.cs +++ /dev/null @@ -1,63 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor.Format.Borders -{ - internal class BorderProperty : PropertyBridgeTag - { - public BorderProperty(BorderPosition border_position, IProperty included_property, Workbook workbook) : base(included_property, workbook) - { - switch (border_position) - { - case BorderPosition.bottom: - tag_name = "bottom"; - break; - case BorderPosition.diagonal: - tag_name = "diagonal"; - break; - case BorderPosition.left: - tag_name = "left"; - break; - case BorderPosition.right: - tag_name = "right"; - break; - case BorderPosition.top: - tag_name = "top"; - break; - } - } - - internal override string TagName { get { return tag_name; } } - private string tag_name; - } - - /// - /// This type identifies the place where the border is locates regarding the cell - /// - internal enum BorderPosition - { - /// - /// Left border - /// - left, - /// - /// Right border - /// - right, - /// - /// Top border - /// - top, - /// - /// Bottom border - /// - bottom, - /// - /// Diagonal borders - /// - diagonal - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Borders/Borders.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Borders/Borders.cs deleted file mode 100644 index 09fbd5a312..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Borders/Borders.cs +++ /dev/null @@ -1,90 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using ASCOfficeEWSEditor.Editor.Walkers; - -namespace ASCOfficeEWSEditor.Editor.Format.Borders -{ - /// - /// Represents a set of cells border properties. - /// Has permanent link to the range where it was created from - /// Corresponds to tag - /// - public class Borders - { - internal Borders(RangeWalker range_walker, Workbook workbook) - { - this.range_walker = range_walker; - this.workbook = workbook; - Left = new Border(BorderPosition.left, range_walker, workbook); - Right = new Border(BorderPosition.right, range_walker, workbook); - Top = new Border(BorderPosition.top, range_walker, workbook); - Bottom = new Border(BorderPosition.bottom, range_walker, workbook); - Diagonal = new DiagonalBorder(BorderPosition.diagonal, range_walker, workbook); - } - - /// - /// Returns Border object that is responsible for getting and setting of properties of left borders of the cells. - /// Read-only. - /// - public Border Left { get; private set; } - - /// - /// Returns Border object that is responsible for getting and setting of properties of right borders of the cells. - /// Read-only. - /// - public Border Right { get; private set; } - - /// - /// Returns Border object that is responsible for getting and setting of properties of top borders of the cells. - /// Read-only. - /// - public Border Top { get; private set; } - - /// - /// Returns Border object that is responsible for getting and setting of properties of bottom borders of the cells. - /// Read-only. - /// - public Border Bottom { get; private set; } - - /// - /// Returns Border object that is responsible for getting and setting of properties of diagonal borders of the cells. - /// Read-only. - /// - public DiagonalBorder Diagonal { get; private set; } - - /// - /// Get/set if left, right, top, and bottom borders should be applied only to outside borders of a cell range. - /// - public bool? Outline - { - get - { - OutlineProperty diag_type_property = new OutlineProperty(); - StyleCollector collector = new StyleCollector(new BorderEntity(workbook), diag_type_property, workbook); - range_walker.CollectStatisticsIncludingEmpty(collector); - - return diag_type_property.Value; - } - set - { - OutlineProperty diag_type_property = new OutlineProperty(value.Value); - StyleSetter setter = new StyleSetter(new BorderEntity(workbook), diag_type_property, workbook); - range_walker.SetStyles(setter); - } - } - - private Workbook workbook; - private RangeWalker range_walker; - } - public class BordersSimple - { - internal BordersSimple() - { - } - public BorderSimple Left = new BorderSimple(); - public BorderSimple Right = new BorderSimple(); - public BorderSimple Top = new BorderSimple(); - public BorderSimple Bottom = new BorderSimple(); - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Borders/DiagonalTypeProperty.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Borders/DiagonalTypeProperty.cs deleted file mode 100644 index c7b3b21a85..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Borders/DiagonalTypeProperty.cs +++ /dev/null @@ -1,79 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor.Format.Borders -{ - internal class DiagonalTypeProperty : Property - { - public DiagonalTypeProperty(DiagonalType init_value, Workbook workbook) - : base(init_value) - { - this.workbook = workbook; - } - - public DiagonalTypeProperty(Workbook workbook) - { - this.workbook = workbook; - } - - public override DiagonalType ExtractValueFromEntity(XmlElement border_tag) - { - if (border_tag == null) - { - return DiagonalType.none; - } - bool up_val = XMLBoolean.ParseOrDefault(border_tag.GetAttribute("diagonalUp"), false); - bool down_val = XMLBoolean.ParseOrDefault(border_tag.GetAttribute("diagonalDown"), false); - if (up_val && down_val) - { - return DiagonalType.Both; - } - if(up_val) - { - return DiagonalType.Up; - } - if (down_val) - { - return DiagonalType.Down; - } - return DiagonalType.none; - } - - public override void SetToEntity(XmlElement alignment_tag) - { - if (Value.HasValue) - { - if (Value.Value != DiagonalType.none) - { - if (Value.Value == DiagonalType.Up) - { - alignment_tag.SetAttribute("diagonalUp", "true"); - alignment_tag.RemoveAttribute("diagonalDown"); - } - else if (Value.Value == DiagonalType.Down) - { - alignment_tag.SetAttribute("diagonalDown", "true"); - alignment_tag.RemoveAttribute("diagonalUp"); - } - else - { - alignment_tag.SetAttribute("diagonalUp", "true"); - alignment_tag.SetAttribute("diagonalDown", "true"); - } - } - else - { - alignment_tag.RemoveAttribute("diagonalUp"); - alignment_tag.RemoveAttribute("diagonalDown"); - } - } - } - - - private Workbook workbook; - } - -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Borders/OutlineProperty.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Borders/OutlineProperty.cs deleted file mode 100644 index 826ebade6c..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Borders/OutlineProperty.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor.Format.Borders -{ - internal class OutlineProperty : PropertyBooleanAttrib - { - public OutlineProperty(bool init_value) : base(init_value, false) - { - } - - public OutlineProperty() : base(false) - { - } - - internal override string AttribName { get { return "outline"; } } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Borders/StyleProperty.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Borders/StyleProperty.cs deleted file mode 100644 index 4cdacdc3fd..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Borders/StyleProperty.cs +++ /dev/null @@ -1,153 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor.Format.Borders -{ - internal class StyleProperty : Property - { - public StyleProperty(BorderStyle init_value, Workbook workbook) - : base(init_value) - { - this.workbook = workbook; - } - - public StyleProperty(Workbook workbook) - { - this.workbook = workbook; - } - - public override BorderStyle ExtractValueFromEntity(XmlElement border_part_tag) - { - if (border_part_tag == null) - { - return BorderStyle.none; - } - string style_val = border_part_tag.GetAttribute("style"); - switch (style_val) - { - case "dashDot": - return BorderStyle.dashDot; - case "dashDotDot": - return BorderStyle.dashDotDot; - case "dashed": - return BorderStyle.dashed; - case "dotted": - return BorderStyle.dotted; - case "double": - return BorderStyle.doubleLine; - case "hair": - return BorderStyle.hair; - case "medium": - return BorderStyle.medium; - case "mediumDashDot": - return BorderStyle.mediumDashDot; - case "mediumDashDotDot": - return BorderStyle.mediumDashDotDot; - case "mediumDashed": - return BorderStyle.mediumDashed; - case "slantDashDot": - return BorderStyle.slantDashDot; - case "thick": - return BorderStyle.thick; - case "thin": - return BorderStyle.thin; - case "none": - default: - return BorderStyle.none; - } - } - - public override void SetToEntity(XmlElement alignment_tag) - { - if (Value.HasValue) - { - if (Value.Value != BorderStyle.none) - { - if (Value.Value == BorderStyle.doubleLine) - { - alignment_tag.SetAttribute("style", "double"); - } - else - { - alignment_tag.SetAttribute("style", Value.Value.ToString()); - } - } - else - { - alignment_tag.RemoveAttribute("style"); - } - } - } - - - private Workbook workbook; - } - - /// - /// Border Style Type - /// - public enum BorderStyle - { - /// - /// Dash-dot - /// - dashDot, - /// - /// Dash-dot-dot - /// - dashDotDot, - /// - /// Dashed - /// - dashed, - /// - /// Dotted - /// - dotted, - /// - /// Double line - /// - doubleLine, - /// - /// Hairline - /// - hair, - /// - /// Medium - /// - medium, - /// - /// Medium dash-dot - /// - mediumDashDot, - /// - /// Medium dash-dot-dot - /// - mediumDashDotDot, - /// - /// Medium dashed - /// - mediumDashed, - /// - /// No border visible - /// - none, - /// - /// Slant-dash-dot - /// - slantDashDot, - /// - /// Thick - /// - thick, - /// - /// Thin - /// - thin - } - - -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Colors/Color.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Colors/Color.cs deleted file mode 100644 index b86b728934..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Colors/Color.cs +++ /dev/null @@ -1,149 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using ASCOfficeEWSEditor.Editor.Walkers; - -namespace ASCOfficeEWSEditor.Editor.Format.Colors -{ - /// - /// Object of this class encapsulates color properties - /// - public class Color - { - internal Color(ColorValue color_value, RangeWalker range_walker, StyleSetter style_setter, PropertyColor property, Workbook workbook) - { - this.range_walker = range_walker; - this.workbook = workbook; - this.color_value = color_value; - this.style_setter = style_setter; - this.property = property; - } - internal Color(ColorValue color_value) - { - this.color_value = color_value; - } - /// - /// Read: RGB value common for the range of cells or null if the value is automatic and can't be transformed to RGB. - /// Write: Sets the passed RGB value for every cell in the range. - /// - public RGB? Rgb - { - get - { - try - { - RGB out_val; - if (color_value.ToRGB(out out_val.R, out out_val.G, out out_val.B)) - { - return out_val; - } - } - catch { } - return null; - } - set - { - property.Value.SetRGB(value.Value.R, value.Value.G, value.Value.B); - range_walker.SetStyles(style_setter); // style setter shall have reference to property, so it works. Until you break this. - } - } - - - /// - /// Forms a text hexadecimal representation of the color in RGB form. - /// - /// Textual form of RGB or empty string if the color is automatic. - public override string ToString() - { - return color_value.ToString(); - } - - /// - /// Whether the color is automatic and represents the foreground value - /// - /// - public bool IsForeground() - { - return color_value.IsForeground(); - } - - /// - /// Whether the color is automatic and represents the background value - /// - /// - public bool IsBackground() - { - return color_value.IsBackground(); - } - - /// - /// Tries to determine the color index that exactly matches the RGB value that the Color object stores. - /// - /// Exact index or null if no exact index exists - public int? GetExactIndex() - { - return color_value.GetExactIndex(); - } - - /// - /// Determine the closest color index for the RGB value that the Color object stores. - /// - /// Closest index - public int GetClosestIndex() - { - return color_value.GetClosestIndex(); - } - - /// - /// Whether the affected range has different color values for different cells. - /// If "true" is returned, the Color object must not use any property for read. If you do this you'll get a null reference exception. - /// - /// - public bool HasDifferentValues() - { - return color_value == null; - } - - - - - - private Workbook workbook; - private RangeWalker range_walker; - private StyleSetter style_setter; - private PropertyColor property; - private ColorValue color_value; - } - - - /// - /// RGB value - /// - public struct RGB - { - /// - /// Constructs an RGB struct from red-green-blue components - /// - /// Red - /// Green - /// Blue - public RGB(int r, int g, int b) - { - R = r; - G = g; - B = b; - } - /// - /// Red - /// - public int R; - /// - /// Green - /// - public int G; - /// - /// Blue - /// - public int B; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Colors/ColorProperty.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Colors/ColorProperty.cs deleted file mode 100644 index c711407be5..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Colors/ColorProperty.cs +++ /dev/null @@ -1,97 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.XMLDataSpecific; -using ASCOfficeEWSEditor.Editor.Walkers; - -namespace ASCOfficeEWSEditor.Editor.Format.Colors -{ - internal class ColorProperty : PropertyColor - { - public ColorProperty(Colors.ColorValue init_val, bool fore_or_back, string color_tag_name, Workbook workbook) - : base(init_val) - { - this.workbook = workbook; - this.color_tag_name = color_tag_name; - this.fore_or_back = fore_or_back; - } - - public ColorProperty(string color_tag_name, bool fore_or_back, Workbook workbook) - { - this.workbook = workbook; - this.color_tag_name = color_tag_name; - this.fore_or_back = fore_or_back; - } - - public override Colors.ColorValue ExtractValueFromEntity(XmlElement font_tag) - { - XmlElement color_tag = (XmlElement)font_tag.SelectSingleNode("main:" + color_tag_name, workbook.NamespaceManager); - string val_str; - if (color_tag != null) - { - if ((val_str = color_tag.GetAttribute("rgb")) != "") - { - return new Colors.ColorValue(val_str, fore_or_back, workbook); - } - if ((val_str = color_tag.GetAttribute("theme")) != "") - { - double tint = XMLDouble.ParseOrDefault(color_tag.GetAttribute("tint"), 0); - return new Colors.ColorValue(XMLInt.ParseOrDefault(val_str, fore_or_back ? 1 : 0), tint, fore_or_back, workbook); - } - if ((val_str = color_tag.GetAttribute("indexed")) != "") - { - return new Colors.ColorValue(XMLInt.ParseOrDefault(val_str, fore_or_back ? 64 : 65), fore_or_back, workbook); - } - } - return new Colors.ColorValue(fore_or_back, workbook); - } - - public override void SetToEntity(XmlElement font_tag) - { - if (Value != null) - { - XmlElement color_tag = (XmlElement)font_tag.SelectSingleNode("main:" + color_tag_name, workbook.NamespaceManager); - if (color_tag == null) - { - color_tag = font_tag.OwnerDocument.CreateElement(color_tag_name, workbook.NamespaceManager.LookupNamespace("main")); - font_tag.AppendChild(color_tag); - } - color_tag.RemoveAllAttributes(); - Value.SetAttribute(color_tag); - } - } - - private Workbook workbook; - private string color_tag_name; - private bool fore_or_back; - } - - - internal class FgColorProperty : ColorProperty - { - public FgColorProperty(Colors.ColorValue init_val, bool fore_or_back, string color_tag_name, Workbook workbook) - : base(init_val, true, color_tag_name, workbook) - { - } - - public FgColorProperty(string color_tag_name, Workbook workbook) - : base(color_tag_name, true, workbook) - { - } - } - - internal class BgColorProperty : ColorProperty - { - public BgColorProperty(Colors.ColorValue init_val, bool fore_or_back, string color_tag_name, Workbook workbook) - : base(init_val, false, color_tag_name, workbook) - { - } - - public BgColorProperty(string color_tag_name, Workbook workbook) - : base(color_tag_name, false, workbook) - { - } - } - -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Colors/ColorValue.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Colors/ColorValue.cs deleted file mode 100644 index 4ec9e719be..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Colors/ColorValue.cs +++ /dev/null @@ -1,488 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Globalization; -using System.Xml; - -namespace ASCOfficeEWSEditor.Editor.Format.Colors -{ - /// - /// Object of this class stores color information - /// - internal class ColorValue // : IComparable - { - // RGB - internal ColorValue(string hex_argb_value, bool fore_or_back, Workbook workbook) - { - this.workbook = workbook; - this.source = SourceType.rgb; - this.fore_or_back = fore_or_back; - FromARGB(hex_argb_value); - } - - // Index - internal ColorValue(int index_init, bool fore_or_back, Workbook workbook) - { - this.workbook = workbook; - this.fore_or_back = fore_or_back; - - if (index_init >= 64) - { - this.source = SourceType.auto; - R = G = B = fore_or_back ? 0 : 255; - return; - } - this.source = SourceType.indexed; - - index = index_init; - FromIndex(index_init); - } - - // Theme - internal ColorValue(int theme_init, double tint_init, bool fore_or_back, Workbook workbook) - { - this.workbook = workbook; - this.source = SourceType.theme; - this.fore_or_back = fore_or_back; - - theme_num = theme_init; - tint = tint_init; - FromTheme(theme_init); - ApplyTint(tint_init); - } - - // Auto - internal ColorValue(bool fore_or_back, Workbook workbook) - { - this.workbook = workbook; - this.source = SourceType.auto; - this.fore_or_back = fore_or_back; - - R = G = B = fore_or_back ? 0 : 255; - } - - private void FromARGB(string argb) - { - int packed_rgb; - if(argb.Length != 8 || !int.TryParse(argb.Substring(2), NumberStyles.HexNumber, null, out packed_rgb)) - { - R = G = B = 0; - return; - } - FromPackedRGB(packed_rgb); - } - - private void FromPackedRGB(int packed_rgb) - { - R = ((packed_rgb & 0x00ff0000) >> 16); - G = ((packed_rgb & 0x0000ff00) >> 8); - B = (packed_rgb & 0x000000ff); - } - - private int ToPackedRGB() - { - return R << 16 | G << 8 | B; - } - - private void FromIndex(int index) - { - int packed_rgb = workbook.StyleSheet.Palette.IndexToPackedRGB(index); - FromPackedRGB(packed_rgb); - } - - private void FromTheme(int theme_num) - { - string color_str = workbook.Theme.GetRGBByColor(WrongThemeIndexToCorrectThemeIndex(theme_num)); - switch(color_str) - { - case "": - R = G = B = fore_or_back ? 0 : 255; - break; - case "window": - R = G = B = 255; - break; - case "windowText": - R = G = B = 0; - break; - default: - FromARGB("FF" + color_str); - break; - } - } - - private static int WrongThemeIndexToCorrectThemeIndex(int wrong_index) - { - switch(wrong_index) - { - case 0: - return 1; - case 1: - return 0; - case 2: - return 3; - case 3: - return 2; - default: - return wrong_index; - } - } - - private static int CorrectThemeIndexToWrongThemeIndex(int correct_index) - { - return WrongThemeIndexToCorrectThemeIndex(correct_index); - } - - private void ApplyTint(double tint) - { - if(tint == 0) - { - return; - } - double h; - double s; - double l; - - ToHSL(out h, out s, out l); - - if (tint < 0) - { - l = l * (1 + tint); - } - else if (tint > 0) - { - l = l * (1 - tint) + tint; - } - //else left not changed - - FromHSL(h, s, l); - } - - private void ToHSL(out double h, out double s, out double l) - { - int maxRGB = Math.Max(R, Math.Max(G, B)); - int minRGB = Math.Min(R, Math.Min(G, B)); - - // Hue ************ - if (maxRGB == minRGB) - { - h = 0; - } - else if (maxRGB == R && G >= B) - { - h = (double)(G - B) / (6 * (maxRGB - minRGB)); - } - else if ((maxRGB == R && G < B)) - { - h = (double)(G - B) / (6 * (maxRGB - minRGB)) + 1; - } - else if (maxRGB == G) - { - h = (double)(B - R) / (6 * (maxRGB - minRGB)) + (double)1 / 3; - } - else// if (maxRGB == B) - { - h = (double)(R - G) / (6 * (maxRGB - minRGB)) + (double)2 / 3; - } - - // Luminosity ************ - - l = (double)(maxRGB + minRGB) / 2 / 255; - - // Saturation ************ - - if (l == 0) - { - s = 0; - } - else if (l > 0 && l <= 0.5) - { - s = (double)(maxRGB - minRGB) / (maxRGB + minRGB); - } - else if (l > 0.5 && l < 1) - { - s = (double)(maxRGB - minRGB) / (2 * 255 - (maxRGB + minRGB)); - } - else// if (l == 1) - { - s = 0; - } - } - - private void FromHSL(double h, double s, double l) - { - double q = l < 0.5 ? l * (1 + s) : l + s - (l * s); - double p = 2 * l - q; - - double[] t3 = new double[] { h + 1.0 / 3.0, h, h - 1.0 / 3.0 }; - double[] clr = new double[] { 0, 0, 0 }; - - for (int i = 0; i < 3; ++i) - { - double t = t3[i]; - if (t < 0) - { - t = t + 1; - } - else if (t > 1) - { - t = t - 1; - } - - if (t < (double)1 / 6) - { - clr[i] = (int)((p + (q - p) * 6 * t) * 255); - } - else if (t >= (double)1 / 6 && t < (double)1 / 2) - { - clr[i] = (int)(q * 255); - } - else if (t >= (double)1 / 2 && t < (double)2 / 3) - { - clr[i] = (int)((p + (q - p) * 6 * ((double)2 / 3 - t)) * 255); - } - else - { - clr[i] = (int)(p * 255); - } - } - R = (int)Math.Round(clr[0]); - G = (int)Math.Round(clr[1]); - B = (int)Math.Round(clr[2]); - } - - /// - /// Obtain RGB value in decimal form - /// - /// Red - /// Green - /// Blue - /// Returns false if the color is automatic and can't be transformed to RGB - public bool ToRGB(out int r, out int g, out int b) - { - r = R; - g = G; - b = B; - if (source == SourceType.auto) - { - return false; - } - return true; - } - - /// - /// Set RGB value - /// - /// Red - /// Green - /// Blue - public void SetRGB(int r, int g, int b) - { - R = r; - G = g; - B = b; - source = SourceType.rgb; - } - - /// - /// Whether the color is automatic and represents the foreground value - /// - /// - public bool IsForeground() - { - return source == SourceType.auto && fore_or_back; - } - - /// - /// Whether the color is automatic and represents the background value - /// - /// - public bool IsBackground() - { - return source == SourceType.auto && !fore_or_back; - } - - - /// - /// Tries to determine the color index that exactly matches the RGB value that the Color object stores. - /// - /// Exact index or null if no exact index exists - public int? GetExactIndex() - { - if (source == SourceType.auto) - { - return fore_or_back ? 64 : 65; - } - if (source == SourceType.indexed && index != null) - { - return index; - } - return workbook.StyleSheet.Palette.PackedRGBToExactIndex(ToPackedRGB()); - } - - /// - /// Determine the closest color index for the RGB value that the Color object stores. - /// - /// Closest index - public int GetClosestIndex() - { - if (source == SourceType.auto) - { - return fore_or_back ? 64 : 65; - } - if (source == SourceType.indexed && index != null) - { - return index.Value; - } - - return workbook.StyleSheet.Palette.PackedRGBToClosestIndex(ToPackedRGB()); - } - - - - - /// - /// Set value as an index in saved or default palette - /// - /// New index - public void SetIndex(int index) - { - this.index = index; - source = SourceType.indexed; - } - - /// - /// Red [0, 255] - /// - public int R { get; private set; } - - /// - /// Green [0, 255] - /// - public int G { get; private set; } - - /// - /// Blue [0, 255] - /// - public int B { get; private set; } - - #region Value type equality implementation - /// - /// Whether two Color objects are equal - /// - /// Comparable object - /// - public override bool Equals(object obj) - { - ColorValue color = obj as ColorValue; - if ((System.Object)color == null) - { - return false; - } - - return Equals(color); - } - - /// - /// Whether two Color objects are equal - /// - /// Comparable object - /// - public bool Equals(ColorValue color) - { - // If parameter is null return false. - if (color == null) - { - return false; - } - - if (source != color.source || R != color.R || G != color.G || B != color.B) - { - return false; - } - return true; - } - - /// - /// Returns hash code - /// - /// Hash code - public override int GetHashCode() - { - return R << 16 | G << 8 | B | ((int)source) << 24; - } - #endregion - - // Do not implement operator==. It would cause IProperty.IsNull to crash - - /// - /// Forms a text hexadecimal representation of the color in RGB form. Recommended for debug purposes only. - /// - /// Textual form of RGB or empty string if the color is automatic - public override string ToString() - { - if(source == SourceType.auto) - { - return ""; - } - return ToPackedRGB().ToString("X06"); - } - - internal void SetAttribute(XmlElement color_tag) - { - switch (source) - { - case SourceType.auto: - color_tag.SetAttribute("auto", "true"); - break; - case SourceType.indexed: - color_tag.SetAttribute("indexed", index.Value.ToString()); - break; - case SourceType.rgb: - color_tag.SetAttribute("rgb", "FF" + ToString()); - break; - case SourceType.theme: - color_tag.SetAttribute("theme", theme_num.ToString()); - color_tag.SetAttribute("tint", tint.ToString()); - break; - } - } - - - internal enum SourceType - { - rgb, - theme, - indexed, - auto - } - - private SourceType source; - private int? index; - private int theme_num; - private double tint; - private readonly bool fore_or_back; - - private Workbook workbook; - } - - /// - /// Automatic foreground Color - /// - internal class FgColor : ColorValue - { - internal FgColor(Workbook workbook) - : base(true, workbook) - {} - } - - /// - /// Automatic background Color - /// - internal class BgColor : ColorValue - { - internal BgColor(Workbook workbook) - : base(false, workbook) - {} - } - -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Colors/Palette.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Colors/Palette.cs deleted file mode 100644 index 64e6291990..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Colors/Palette.cs +++ /dev/null @@ -1,224 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using System.Globalization; -using System.Diagnostics; - -namespace ASCOfficeEWSEditor.Editor.Format.Colors -{ - /// - /// This class is responsible for indexed colors table. - /// - public class Palette - { - internal Palette(XmlNode style_sheet_xml, Workbook workbook) - { - this.workbook = workbook; - this.style_sheet_xml = style_sheet_xml; - } - - /// - /// Returns actual RGB info for the given index - /// - /// Index. [0;63] - /// Packed RGB - public int IndexToPackedRGB(int index) - { - XmlNode indexed_colors_xml = Get_IndexedColors(); - if(indexed_colors_xml != null) - { - XmlElement rgbColor_tag = (XmlElement)indexed_colors_xml.SelectSingleNode("main:rgbColor[position() = " + (index + 1 ).ToString() + "]", workbook.NamespaceManager); - if (rgbColor_tag != null) - { - string argb = rgbColor_tag.GetAttribute("rgb"); - int packed_rgb; - if (argb.Length != 8 || !int.TryParse(argb.Substring(2), NumberStyles.HexNumber, null, out packed_rgb)) - { - Trace.TraceWarning("Wrong format of rgbColor/@rgb. Value \"{0}\" substituted with 0", new object[] { argb }); - return 0; - } - return packed_rgb; - } - } - return default_palette[index]; - } - - /// - /// Searches for exact match of the passed RGB value in the color table. Returns null if no match found - /// - /// Packed RGB - /// Index. [0;63] or null - public int? PackedRGBToExactIndex(int packed_rgb) - { - XmlNode indexed_colors_xml = Get_IndexedColors(); - if (indexed_colors_xml != null) - { - XmlElement rgbColor_tag = (XmlElement)indexed_colors_xml.SelectSingleNode("main:rgbColor[substring(@rgb, 2) = " + - packed_rgb.ToString("X06") + "]", workbook.NamespaceManager); - if (rgbColor_tag != null) - { - return rgbColor_tag.SelectNodes("preceding-sibling::main:rgbColor", workbook.NamespaceManager).Count; - } - return null; - } - foreach (KeyValuePair pair in default_palette) - { - if(pair.Value == packed_rgb) - { - return pair.Key; - } - } - return null; - } - - /// - /// Determine the closest color index for the passed RGB value in the color table. - /// - /// Packed RGB - /// Index. [0;63] - public int PackedRGBToClosestIndex(int packed_rgb) - { - Dictionary distance_map = new Dictionary(); - int index_counter = 0; - XmlNode indexed_colors_xml = Get_IndexedColors(); - if (indexed_colors_xml != null) - { - foreach(XmlNode rgb_val_tag in indexed_colors_xml.SelectNodes("main:rgbColor/@rgb", workbook.NamespaceManager)) - { - string rgb_val = rgb_val_tag.InnerText.Substring(2); - distance_map[CalculateDistance(int.Parse(rgb_val, NumberStyles.HexNumber), packed_rgb)] = index_counter; - ++index_counter; - } - } - else - { - foreach (KeyValuePair pair in default_palette) - { - distance_map[CalculateDistance(pair.Value, packed_rgb)] = index_counter; - ++index_counter; - } - } - Dictionary.Enumerator enumerator = distance_map.GetEnumerator(); - enumerator.MoveNext(); - return enumerator.Current.Value; - } - - private int CalculateDistance(int packed_rgb1, int packed_rgb2) - { - int R1 = ((packed_rgb1 & 0x00ff0000) >> 16); - int G1 = ((packed_rgb1 & 0x0000ff00) >> 8); - int B1 = (packed_rgb1 & 0x000000ff); - int R2 = ((packed_rgb2 & 0x00ff0000) >> 16); - int G2 = ((packed_rgb2 & 0x0000ff00) >> 8); - int B2 = (packed_rgb2 & 0x000000ff); - return 30 * (R1 - R2) * (R1 - R2) + 59 * (G1 - G2) * (G1 - G2) + 11 * (B1 - B2) * (B1 - B2); - } - - private XmlNode Get_IndexedColors() - { - return style_sheet_xml.SelectSingleNode("main:colors/main:indexedColors", workbook.NamespaceManager); - } - - - private Workbook workbook; - private XmlNode style_sheet_xml; - private static DefaultPalette default_palette = new DefaultPalette(); - } - - internal class DefaultPalette : IEnumerable> - { - public DefaultPalette() - { - values = new Dictionary(); - values[0] = 0x000000; - values[1] = 0xFFFFFF; - values[2] = 0xFF0000; - values[3] = 0x00FF00; - values[4] = 0x0000FF; - values[5] = 0xFFFF00; - values[6] = 0xFF00FF; - values[7] = 0x00FFFF; - values[8] = 0x000000; - values[9] = 0xFFFFFF; - values[10] = 0xFF0000; - values[11] = 0x00FF00; - values[12] = 0x0000FF; - values[13] = 0xFFFF00; - values[14] = 0xFF00FF; - values[15] = 0x00FFFF; - values[16] = 0x800000; - values[17] = 0x008000; - values[18] = 0x000080; - values[19] = 0x808000; - values[20] = 0x800080; - values[21] = 0x008080; - values[22] = 0xC0C0C0; - values[23] = 0x808080; - values[24] = 0x9999FF; - values[25] = 0x993366; - values[26] = 0xFFFFCC; - values[27] = 0xCCFFFF; - values[28] = 0x660066; - values[29] = 0xFF8080; - values[30] = 0x0066CC; - values[31] = 0xCCCCFF; - values[32] = 0x000080; - values[33] = 0xFF00FF; - values[34] = 0xFFFF00; - values[35] = 0x00FFFF; - values[36] = 0x800080; - values[37] = 0x800000; - values[38] = 0x008080; - values[39] = 0x0000FF; - values[40] = 0x00CCFF; - values[41] = 0xCCFFFF; - values[42] = 0xCCFFCC; - values[43] = 0xFFFF99; - values[44] = 0x99CCFF; - values[45] = 0xFF99CC; - values[46] = 0xCC99FF; - values[47] = 0xFFCC99; - values[48] = 0x3366FF; - values[49] = 0x33CCCC; - values[50] = 0x99CC00; - values[51] = 0xFFCC00; - values[52] = 0xFF9900; - values[53] = 0xFF6600; - values[54] = 0x666699; - values[55] = 0x969696; - values[56] = 0x003366; - values[57] = 0x339966; - values[58] = 0x003300; - values[59] = 0x333300; - values[60] = 0x993300; - values[61] = 0x993366; - values[62] = 0x333399; - values[63] = 0x333333; - } - - public int this[int index] - { - get - { - return values[index]; - } - } - - #region IEnumerable Members - - public IEnumerator> GetEnumerator() - { - return values.GetEnumerator(); - } - - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() - { - return values.GetEnumerator(); - } - - #endregion - - private Dictionary values; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Fills/BottomProperty.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Fills/BottomProperty.cs deleted file mode 100644 index 82416632ec..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Fills/BottomProperty.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Format.Fills -{ - internal class BottomProperty : PropertyDoubleAttrib - { - public BottomProperty(double init_value) - : base(init_value, 0) - {} - - public BottomProperty() - : base(0) - {} - - internal override string AttribName { get { return "bottom"; } } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Fills/DegreeProperty.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Fills/DegreeProperty.cs deleted file mode 100644 index f0c3449aae..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Fills/DegreeProperty.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Format.Fills -{ - internal class DegreeProperty : PropertyIntAttrib - { - public DegreeProperty(int init_value) - : base(init_value, 0) - {} - - public DegreeProperty() - : base(0) - {} - - internal override string AttribName { get { return "degree"; } } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Fills/FillEntity.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Fills/FillEntity.cs deleted file mode 100644 index 4c2a5ce900..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Fills/FillEntity.cs +++ /dev/null @@ -1,104 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor.Format.Fills -{ - internal class FillEntity : SeparateEntity - { - public FillEntity(Workbook workbook) - : base(workbook) - { - this.workbook = workbook; - pattern_prop = new PatternFillProperty(new PatternProperty(), workbook); - bgcolor_prop = new PatternFillProperty(new Colors.BgColorProperty("bgColor", workbook), workbook); - fgcolor_prop = new PatternFillProperty(new Colors.FgColorProperty("fgColor", workbook), workbook); - fg_color_prop = new Colors.FgColorProperty("color", workbook); - gradient_type_prop = new GradientFillProperty(new GradientTypeProperty(), workbook); - gradient_left_prop = new GradientFillProperty(new LeftProperty(), workbook); - gradient_right_prop = new GradientFillProperty(new RightProperty(), workbook); - gradient_top_prop = new GradientFillProperty(new TopProperty(), workbook); - gradient_bottom_prop = new GradientFillProperty(new BottomProperty(), workbook); - - } - - public override string GetEntityIdAttribName() - { - return entity_id_attrib_name; - } - - public override string GetEntitiesTagName() - { - return entities_tag_name; - } - - public override string GetEntityTagName() - { - return entity_tag_name; - } - - public override string GetEntityTemplate() - { - return Resource1.default_fill; - } - - public override bool CompareEntities(XmlElement ent1, XmlElement ent2) - { - if (!pattern_prop.CompareEntities(ent1, ent2) || - !bgcolor_prop.CompareEntities(ent1, ent2) || - !fgcolor_prop.CompareEntities(ent1, ent2) || - !gradient_type_prop.CompareEntities(ent1, ent2) || - !gradient_left_prop.CompareEntities(ent1, ent2) || - !gradient_right_prop.CompareEntities(ent1, ent2) || - !gradient_top_prop.CompareEntities(ent1, ent2) || - !gradient_bottom_prop.CompareEntities(ent1, ent2)) - { - return false; - } - int stops1 = gradient_type_prop.StopsCount(ent1); - if (stops1 != gradient_type_prop.StopsCount(ent2)) - { - return false; - } - if (gradient_type_prop.StopsCount(ent1) != 0) - { - foreach (XmlElement stop_tag in ent1.SelectNodes("main:gradientFill/main:stop", workbook.NamespaceManager)) - { - XmlElement stop2_tag = (XmlElement)ent2.SelectSingleNode("main:gradientFill/main:stop[@position = \"" + - stop_tag.GetAttribute("position") + "\"]", workbook.NamespaceManager); - if(stop2_tag == null) - { - return false; - } - if(!fg_color_prop.CompareEntities(stop_tag, stop2_tag)) - { - return false; - } - } - - } - - return true; - } - - private const string apply_entity_attrib_name = "applyFill"; - private const string entity_id_attrib_name = "fillId"; - private const string entities_tag_name = "fills"; - private const string entity_tag_name = "fill"; - - private PatternFillProperty pattern_prop; - private PatternFillProperty bgcolor_prop; - private PatternFillProperty fgcolor_prop; - private GradientFillProperty gradient_type_prop; - private GradientFillProperty gradient_left_prop; - private GradientFillProperty gradient_right_prop; - private GradientFillProperty gradient_top_prop; - private GradientFillProperty gradient_bottom_prop; - private Colors.FgColorProperty fg_color_prop; - - private Workbook workbook; - - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Fills/Fills.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Fills/Fills.cs deleted file mode 100644 index 7a21739633..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Fills/Fills.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using ASCOfficeEWSEditor.Editor.Walkers; - -namespace ASCOfficeEWSEditor.Editor.Format.Fills -{ - /// - /// Represents a set of cells fill properties. - /// Has permanent link to the range where it was created from - /// Corresponds to tag - /// - public class Fills - { - internal Fills(RangeWalker range_walker, Workbook workbook) - { - PatternFill = new PatternFill(range_walker, workbook); - GradientFill = new GradientFill(range_walker, workbook); - } - - /// - /// Returns Border object that is responsible for getting and setting of properties of left borders of the cells. - /// Read-only. - /// - public PatternFill PatternFill { get; private set; } - - /// - /// Returns Border object that is responsible for getting and setting of properties of right borders of the cells. - /// Read-only. - /// - public GradientFill GradientFill { get; private set; } - - } - public class FillsSimple - { - //для нужд быстрой загрузки - internal FillsSimple() - { - PatternFill = new PatternFillSimple(); - GradientFill = new GradientFillSimple(); - } - public PatternFillSimple PatternFill { get; set; } - public GradientFillSimple GradientFill { get; set; } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Fills/GradientFill.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Fills/GradientFill.cs deleted file mode 100644 index 6a818b6f6e..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Fills/GradientFill.cs +++ /dev/null @@ -1,192 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using ASCOfficeEWSEditor.Editor.Walkers; - -namespace ASCOfficeEWSEditor.Editor.Format.Fills -{ - /// - /// Represents a set of cells gradient fill properties. - /// Has permanent link to the range where it was created from - /// - public class GradientFill - { - internal GradientFill(RangeWalker range_walker, Workbook workbook) - { - this.range_walker = range_walker; - this.workbook = workbook; - } - - /// - /// Get/set the fill type of the cells - /// - public int? Degree - { - get - { - DegreeProperty degree_property = new DegreeProperty(); - GradientFillProperty property = new GradientFillProperty(degree_property, workbook); - StyleCollector collector = new StyleCollector(new FillEntity(workbook), property, workbook); - range_walker.CollectStatisticsIncludingEmpty(collector); - return degree_property.Value; - } - set - { - if(value.HasValue) - { - DegreeProperty degree_property = new DegreeProperty(value.Value); - GradientFillProperty property = new GradientFillProperty(degree_property, workbook); - StyleSetter setter = new StyleSetter(new FillEntity(workbook), property, workbook); - range_walker.SetStyles(setter); - } - } - } - - /// - /// Get/set the gradient type of the cells - /// - public GradientType? Type - { - get - { - GradientTypeProperty gradient_type_property = new GradientTypeProperty(); - GradientFillProperty property = new GradientFillProperty(gradient_type_property, workbook); - StyleCollector collector = new StyleCollector(new FillEntity(workbook), property, workbook); - range_walker.CollectStatisticsIncludingEmpty(collector); - - return gradient_type_property.Value; - } - set - { - GradientTypeProperty gradient_type_property = new GradientTypeProperty(value.Value); - GradientFillProperty property = new GradientFillProperty(gradient_type_property, workbook); - StyleSetter setter = new StyleSetter(new FillEntity(workbook), property, workbook); - range_walker.SetStyles(setter); - } - } - - /// - /// Get/set the position of the left edge of the inner rectangle (color 1). - /// - public double? Left - { - get - { - LeftProperty degree_property = new LeftProperty(); - GradientFillProperty property = new GradientFillProperty(degree_property, workbook); - StyleCollector collector = new StyleCollector(new FillEntity(workbook), property, workbook); - range_walker.CollectStatisticsIncludingEmpty(collector); - return degree_property.Value; - } - set - { - LeftProperty degree_property = new LeftProperty(value.Value); - GradientFillProperty property = new GradientFillProperty(degree_property, workbook); - StyleSetter setter = new StyleSetter(new FillEntity(workbook), property, workbook); - range_walker.SetStyles(setter); - } - } - - /// - /// Get/set the position of the right edge of the inner rectangle (color 1). - /// - public double? Right - { - get - { - RightProperty degree_property = new RightProperty(); - GradientFillProperty property = new GradientFillProperty(degree_property, workbook); - StyleCollector collector = new StyleCollector(new FillEntity(workbook), property, workbook); - range_walker.CollectStatisticsIncludingEmpty(collector); - return degree_property.Value; - } - set - { - RightProperty degree_property = new RightProperty(value.Value); - GradientFillProperty property = new GradientFillProperty(degree_property, workbook); - StyleSetter setter = new StyleSetter(new FillEntity(workbook), property, workbook); - range_walker.SetStyles(setter); - } - } - - /// - /// Get/set the position of the top edge of the inner rectangle (color 1). - /// - public double? Top - { - get - { - TopProperty degree_property = new TopProperty(); - GradientFillProperty property = new GradientFillProperty(degree_property, workbook); - StyleCollector collector = new StyleCollector(new FillEntity(workbook), property, workbook); - range_walker.CollectStatisticsIncludingEmpty(collector); - return degree_property.Value; - } - set - { - TopProperty degree_property = new TopProperty(value.Value); - GradientFillProperty property = new GradientFillProperty(degree_property, workbook); - StyleSetter setter = new StyleSetter(new FillEntity(workbook), property, workbook); - range_walker.SetStyles(setter); - } - } - - /// - /// Get/set the position of the bottom edge of the inner rectangle (color 1). - /// - public double? Bottom - { - get - { - BottomProperty degree_property = new BottomProperty(); - GradientFillProperty property = new GradientFillProperty(degree_property, workbook); - StyleCollector collector = new StyleCollector(new FillEntity(workbook), property, workbook); - range_walker.CollectStatisticsIncludingEmpty(collector); - return degree_property.Value; - } - set - { - BottomProperty degree_property = new BottomProperty(value.Value); - GradientFillProperty property = new GradientFillProperty(degree_property, workbook); - StyleSetter setter = new StyleSetter(new FillEntity(workbook), property, workbook); - range_walker.SetStyles(setter); - } - } - - /// - /// Returns Color object that is responsible for getting and setting of gradient stop color at the specified position. - /// The functionality is limited. The only setting new and getting of existent stops is possible. - /// No interface to get the whole set of stops was implemented. - /// - /// Position of the color (from 0 to 1 inclusively) - /// - public Colors.Color Color(double position) - { - Colors.ColorProperty color_property = new Colors.FgColorProperty("color", workbook); - StopProperty stop_property = new StopProperty(position, color_property, workbook); - GradientFillProperty property = new GradientFillProperty(stop_property, workbook); - StyleCollector collector = new StyleCollector(new FillEntity(workbook), property, workbook); - range_walker.CollectStatisticsIncludingEmpty(collector); - - StyleSetter style_setter = new StyleSetter(new FillEntity(workbook), property, workbook); - if (property.IsNull()) - { - color_property.Value = new Colors.FgColor(workbook); - return new Colors.Color(null, range_walker, style_setter, color_property, workbook); - } - return new Colors.Color(color_property.Value, range_walker, style_setter, color_property, workbook); - } - - private Workbook workbook; - private RangeWalker range_walker; - } - public class GradientFillSimple - { - internal GradientFillSimple() - { - } - public Colors.Color Color; - public GradientType? Type; - } - -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Fills/GradientFillProperty.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Fills/GradientFillProperty.cs deleted file mode 100644 index 8df1618b3a..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Fills/GradientFillProperty.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; - -namespace ASCOfficeEWSEditor.Editor.Format.Fills -{ - internal class GradientFillProperty : PropertyBridgeTag - { - public GradientFillProperty(IProperty included_property, Workbook workbook) - : base(included_property, workbook) - { - this.workbook = workbook; - } - - internal int StopsCount(XmlElement ent1) - { - return ent1.SelectNodes("main:gradientFill/main:stop", workbook.NamespaceManager).Count; - } - - internal override string TagName { get { return "gradientFill"; } } - - private Workbook workbook; - } - -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Fills/GradientTypeProperty.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Fills/GradientTypeProperty.cs deleted file mode 100644 index 7e88ad70e0..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Fills/GradientTypeProperty.cs +++ /dev/null @@ -1,68 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor.Format.Fills -{ - internal class GradientTypeProperty : Property - { - public GradientTypeProperty(GradientType init_value) - : base(init_value) - { - } - - public GradientTypeProperty() - { - } - - public override GradientType ExtractValueFromEntity(XmlElement gradient_fill_tag) - { - if (gradient_fill_tag == null) - { - return GradientType.linear; - } - string type_val = gradient_fill_tag.GetAttribute("type"); - switch (type_val) - { - case "path": - return GradientType.path; - case "linear": - default: - return GradientType.linear; - } - } - - public override void SetToEntity(XmlElement alignment_tag) - { - if (Value.HasValue) - { - if (Value.Value == GradientType.path) - { - alignment_tag.SetAttribute("type", "path"); - } - else - { - alignment_tag.RemoveAttribute("type"); - } - } - } - } - - /// - /// Gradient Type - /// - public enum GradientType - { - /// - /// Linear gradient type - /// - linear, - /// - /// Path gradient type - /// - path - } - -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Fills/LeftProperty.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Fills/LeftProperty.cs deleted file mode 100644 index 1895dd4053..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Fills/LeftProperty.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Format.Fills -{ - internal class LeftProperty : PropertyDoubleAttrib - { - public LeftProperty(double init_value) - : base(init_value, 0) - {} - - public LeftProperty() - : base(0) - {} - - internal override string AttribName { get { return "left"; } } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Fills/PatternFill.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Fills/PatternFill.cs deleted file mode 100644 index 0745ef155d..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Fills/PatternFill.cs +++ /dev/null @@ -1,107 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using ASCOfficeEWSEditor.Editor.Walkers; - -namespace ASCOfficeEWSEditor.Editor.Format.Fills -{ - /// - /// Represents a set of cells pattern fill properties. - /// Has permanent link to the range where it was created from - /// - public class PatternFill - { - internal PatternFill(RangeWalker range_walker, Workbook workbook) - { - this.range_walker = range_walker; - this.workbook = workbook; - } - - /// - /// Returns Color object that is responsible for getting and setting of background color of the fill. - /// Read-only. - /// - public Colors.Color BgColor - { - get - { - Colors.ColorProperty color_property = new Colors.BgColorProperty("bgColor", workbook); - PatternFillProperty property = new PatternFillProperty(color_property, workbook); - StyleCollector collector = new StyleCollector(new FillEntity(workbook), property, workbook); - range_walker.CollectStatisticsIncludingEmpty(collector); - - StyleSetter style_setter = new StyleSetter(new FillEntity(workbook), property, workbook); - if (property.IsNull()) - { - color_property.Value = new Colors.BgColor(workbook); - return new Colors.Color(null, range_walker, style_setter, color_property, workbook); - } - return new Colors.Color(color_property.Value, range_walker, style_setter, color_property, workbook); - // Terrible code. I know. Don't have time to improve. - } - private set { } - } - - /// - /// Returns Color object that is responsible for getting and setting of foreground color of the fill. - /// Read-only. - /// - public Colors.Color FgColor - { - get - { - Colors.ColorProperty color_property = new Colors.FgColorProperty("fgColor", workbook); - PatternFillProperty property = new PatternFillProperty(color_property, workbook); - StyleCollector collector = new StyleCollector(new FillEntity(workbook), property, workbook); - range_walker.CollectStatistics(collector); - - StyleSetter style_setter = new StyleSetter(new FillEntity(workbook), property, workbook); - if (property.IsNull()) - { - color_property.Value = new Colors.FgColor(workbook); - return new Colors.Color(null, range_walker, style_setter, color_property, workbook); - } - return new Colors.Color(color_property.Value, range_walker, style_setter, color_property, workbook); - // Terrible code. I know. Don't have time to improve. - } - private set { } - } - - /// - /// Get/set the fill type of the cells - /// - public PatternType? Pattern - { - get - { - PatternProperty pattern_property = new PatternProperty(); - PatternFillProperty property = new PatternFillProperty(pattern_property, workbook); - StyleCollector collector = new StyleCollector(new FillEntity(workbook), property, workbook); - range_walker.CollectStatisticsIncludingEmpty(collector); - - return pattern_property.Value; - } - set - { - PatternProperty pattern_property = new PatternProperty(value.Value); - PatternFillProperty property = new PatternFillProperty(pattern_property, workbook); - StyleSetter setter = new StyleSetter(new FillEntity(workbook), property, workbook); - range_walker.SetStyles(setter); - } - } - - - - private Workbook workbook; - private RangeWalker range_walker; - } - public class PatternFillSimple - { - internal PatternFillSimple() - { - } - public PatternType? Pattern; - public Colors.Color FgColor; - public Colors.Color BgColor; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Fills/PatternFillProperty.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Fills/PatternFillProperty.cs deleted file mode 100644 index b5129a1a6b..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Fills/PatternFillProperty.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Format.Fills -{ - internal class PatternFillProperty : PropertyBridgeTag - { - public PatternFillProperty(IProperty included_property, Workbook workbook) - : base(included_property, workbook) - { - } - - internal override string TagName { get { return "patternFill"; } } - } - -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Fills/PatternProperty.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Fills/PatternProperty.cs deleted file mode 100644 index d46f4287ef..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Fills/PatternProperty.cs +++ /dev/null @@ -1,170 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor.Format.Fills -{ - internal class PatternProperty : Property - { - public PatternProperty(PatternType init_value) - : base(init_value) - { - } - - public PatternProperty() - { - } - - public override PatternType ExtractValueFromEntity(XmlElement pattern_fill_tag) - { - if (pattern_fill_tag == null) - { - return PatternType.none; - } - string pattern_val = pattern_fill_tag.GetAttribute("patternType"); - switch (pattern_val) - { - case "darkDown": - return PatternType.darkDown; - case "darkGray": - return PatternType.darkGray; - case "darkGrid": - return PatternType.darkGrid; - case "darkHorizontal": - return PatternType.darkHorizontal; - case "darkTrellis": - return PatternType.darkTrellis; - case "darkUp": - return PatternType.darkUp; - case "darkVertical": - return PatternType.darkVertical; - case "gray0625": - return PatternType.gray0625; - case "gray125": - return PatternType.gray125; - case "lightDown": - return PatternType.lightDown; - case "lightGray": - return PatternType.lightGray; - case "lightGrid": - return PatternType.lightGrid; - case "lightHorizontal": - return PatternType.lightHorizontal; - case "lightTrellis": - return PatternType.lightTrellis; - case "lightUp": - return PatternType.lightUp; - case "lightVertical": - return PatternType.lightVertical; - case "mediumGray": - return PatternType.mediumGray; - case "solid": - return PatternType.solid; - case "none": - default: - return PatternType.none; - } - } - - public override void SetToEntity(XmlElement alignment_tag) - { - if (Value.HasValue) - { - if (Value.Value != PatternType.none) - { - alignment_tag.SetAttribute("patternType", Value.Value.ToString()); - } - else - { - alignment_tag.RemoveAttribute("patternType"); - } - } - } - } - - /// - /// Pattern Type - /// - public enum PatternType - { - /// - /// Dark down - /// - darkDown, - /// - /// Dark gray - /// - darkGray, - /// - /// Dark grid - /// - darkGrid, - /// - /// Dark horizontal - /// - darkHorizontal, - /// - /// Dark trellis - /// - darkTrellis, - /// - /// Dark up - /// - darkUp, - /// - /// Dark vertical - /// - darkVertical, - /// - /// Grayscale of 0.0625 (1/16) value - /// - gray0625, - /// - /// Grayscale of 0.125 (1/8) value - /// - gray125, - /// - /// Light down - /// - lightDown, - /// - /// Light gray - /// - lightGray, - /// - /// Light grid - /// - lightGrid, - /// - /// Light horizontal - /// - lightHorizontal, - /// - /// Light trellis - /// - lightTrellis, - /// - /// Light up - /// - lightUp, - /// - /// Light vertical - /// - lightVertical, - /// - /// Medium gray - /// - mediumGray, - /// - /// No fill - /// - none, - /// - /// Solid fill (only FgColor is rendered) - /// - solid - } - -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Fills/RightProperty.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Fills/RightProperty.cs deleted file mode 100644 index ac7985be28..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Fills/RightProperty.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Format.Fills -{ - internal class RightProperty : PropertyDoubleAttrib - { - public RightProperty(double init_value) - : base(init_value, 0) - {} - - public RightProperty() - : base(0) - {} - - internal override string AttribName { get { return "right"; } } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Fills/StopProperty.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Fills/StopProperty.cs deleted file mode 100644 index 7674e2b3e7..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Fills/StopProperty.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor.Format.Fills -{ - internal class StopProperty : PropertyBridgeTag - { - public StopProperty(double position, IProperty included_property, Workbook workbook) - : base(included_property, workbook) - { - this.included_property = included_property; - this.workbook = workbook; - this.position = position; - tagName_precalculated = "stop[@position = \"" + XMLDouble.ToString(position) + "\"]"; - } - public override void SetToEntity(XmlElement entity_tag) - { - XmlElement stop_tag = (XmlElement)entity_tag.SelectSingleNode("main:" + TagName, workbook.NamespaceManager); - if (stop_tag == null) - { - stop_tag = entity_tag.OwnerDocument.CreateElement("stop", workbook.NamespaceManager.LookupNamespace("main")); - stop_tag.SetAttribute("position", XMLDouble.ToString(position)); - entity_tag.AppendChild(stop_tag); - } - included_property.SetToEntity(stop_tag); - } - - internal override string TagName { get { return tagName_precalculated; } } - - private IProperty included_property; - private Workbook workbook; - private double position; - private string tagName_precalculated; - - - } - -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Fills/TopProperty.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Fills/TopProperty.cs deleted file mode 100644 index ad060849b3..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Fills/TopProperty.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Format.Fills -{ - internal class TopProperty : PropertyDoubleAttrib - { - public TopProperty(double init_value) - : base(init_value, 0) - {} - - public TopProperty() - : base(0) - {} - - internal override string AttribName { get { return "top"; } } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Font/BoldProperty.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Font/BoldProperty.cs deleted file mode 100644 index c0dea3fdc6..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Font/BoldProperty.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor.Format.Font -{ - internal class BoldProperty : PropertyBooleanTag - { - public BoldProperty(bool init_value, Workbook workbook) : base(init_value, workbook) - { - } - - public BoldProperty(Workbook workbook) : base(workbook) - { - } - - internal override string TagName { get { return "b"; } } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Font/CharsetProperty.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Font/CharsetProperty.cs deleted file mode 100644 index e1242ae4fd..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Font/CharsetProperty.cs +++ /dev/null @@ -1,48 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor.Format.Font -{ - internal class CharsetProperty : Property - { - public CharsetProperty(int init_value, Workbook workbook) : base(init_value) - { - this.workbook = workbook; - } - - public CharsetProperty(Workbook workbook) - { - this.workbook = workbook; - } - - public override int ExtractValueFromEntity(XmlElement font_tag) - { - XmlElement charset_tag = (XmlElement)font_tag.SelectSingleNode("main:charset", workbook.NamespaceManager); - if (charset_tag == null) - { - return 0; - } - return XMLInt.ParseOrDefault(charset_tag.GetAttribute("val"), 0); - } - - public override void SetToEntity(XmlElement font_tag) - { - if (Value.HasValue) - { - XmlElement charset_tag = (XmlElement)font_tag.SelectSingleNode("main:charset", workbook.NamespaceManager); - if (charset_tag == null) - { - charset_tag = font_tag.OwnerDocument.CreateElement("charset", workbook.NamespaceManager.LookupNamespace("main")); - font_tag.AppendChild(charset_tag); - } - charset_tag.SetAttribute("val", Value.Value.ToString()); - } - } - - private Workbook workbook; - - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Font/CondenseProperty.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Font/CondenseProperty.cs deleted file mode 100644 index 8801a23dcb..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Font/CondenseProperty.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor.Format.Font -{ - internal class CondenseProperty : PropertyBooleanTag - { - public CondenseProperty(bool init_value, Workbook workbook) : base(init_value, workbook) - { - } - - public CondenseProperty(Workbook workbook) - : base(workbook) - { - } - - internal override string TagName { get { return "condese"; } } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Font/ExtendProperty.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Font/ExtendProperty.cs deleted file mode 100644 index 173237ae35..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Font/ExtendProperty.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor.Format.Font -{ - internal class ExtendProperty : PropertyBooleanTag - { - public ExtendProperty(bool init_value, Workbook workbook) : base(init_value, workbook) - { - } - - public ExtendProperty(Workbook workbook) - : base(workbook) - { - } - - internal override string TagName { get { return "extend"; } } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Font/FamilyProperty.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Font/FamilyProperty.cs deleted file mode 100644 index f11edae8d4..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Font/FamilyProperty.cs +++ /dev/null @@ -1,47 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor.Format.Font -{ - internal class FamilyProperty : Property - { - public FamilyProperty(int init_value, Workbook workbook) : base(init_value) - { - this.workbook = workbook; - } - - public FamilyProperty(Workbook workbook) - { - this.workbook = workbook; - } - - public override int ExtractValueFromEntity(XmlElement font_tag) - { - XmlElement family_tag = (XmlElement)font_tag.SelectSingleNode("main:family", workbook.NamespaceManager); - if (family_tag == null) - { - return 0; - } - return XMLInt.ParseOrDefault(family_tag.GetAttribute("val"), 0); - } - - public override void SetToEntity(XmlElement font_tag) - { - if (Value.HasValue) - { - XmlElement family_tag = (XmlElement)font_tag.SelectSingleNode("main:family", workbook.NamespaceManager); - if (family_tag == null) - { - family_tag = font_tag.OwnerDocument.CreateElement("family", workbook.NamespaceManager.LookupNamespace("main")); - font_tag.AppendChild(family_tag); - } - family_tag.SetAttribute("val", Value.Value.ToString()); - } - } - - private Workbook workbook; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Font/Font.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Font/Font.cs deleted file mode 100644 index 5f88b9bb70..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Font/Font.cs +++ /dev/null @@ -1,374 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using ASCOfficeEWSEditor.Editor.Walkers; - -namespace ASCOfficeEWSEditor.Editor.Format.Font -{ - /// - /// Represents a set of cells font properties. - /// Has permanent link to the range where it was created from - /// - public class Font - { - internal Font(RangeWalker range_walker, Workbook workbook) - { - this.range_walker = range_walker; - this.workbook = workbook; - } - - /// - /// Get/set the weight property of the font. - /// - public bool? Bold - { - get - { - BoldProperty property = new BoldProperty(workbook); - StyleCollector collector = new StyleCollector(new FontEntity(workbook), property, workbook); - range_walker.CollectStatisticsIncludingEmpty(collector); - - return property.Value; - } - set - { - BoldProperty property = new BoldProperty(value.Value, workbook); - StyleSetter setter = new StyleSetter(new FontEntity(workbook), property, workbook); - range_walker.SetStyles(setter); - } - } - - /// - /// Get/set the charset property of the font. - /// - public int? Charset - { - get - { - CharsetProperty property = new CharsetProperty(workbook); - StyleCollector collector = new StyleCollector(new FontEntity(workbook), property, workbook); - range_walker.CollectStatisticsIncludingEmpty(collector); - - return property.Value; - } - set - { - CharsetProperty property = new CharsetProperty(value.Value, workbook); - StyleSetter setter = new StyleSetter(new FontEntity(workbook), property, workbook); - range_walker.SetStyles(setter); - } - } - - /// - /// Get/set the condese property of the font. - /// - public bool? Condese - { - get - { - CondenseProperty property = new CondenseProperty(workbook); - StyleCollector collector = new StyleCollector(new FontEntity(workbook), property, workbook); - range_walker.CollectStatisticsIncludingEmpty(collector); - - return property.Value; - } - set - { - CondenseProperty property = new CondenseProperty(value.Value, workbook); - StyleSetter setter = new StyleSetter(new FontEntity(workbook), property, workbook); - range_walker.SetStyles(setter); - } - } - - /// - /// Get/set the extend property of the font. - /// - public bool? Extend - { - get - { - ExtendProperty property = new ExtendProperty(workbook); - StyleCollector collector = new StyleCollector(new FontEntity(workbook), property, workbook); - range_walker.CollectStatisticsIncludingEmpty(collector); - - return property.Value; - } - set - { - ExtendProperty property = new ExtendProperty(value.Value, workbook); - StyleSetter setter = new StyleSetter(new FontEntity(workbook), property, workbook); - range_walker.SetStyles(setter); - } - } - - /// - /// Get/set the family property of the font. - /// - public int? Family - { - get - { - FamilyProperty property = new FamilyProperty(workbook); - StyleCollector collector = new StyleCollector(new FontEntity(workbook), property, workbook); - range_walker.CollectStatisticsIncludingEmpty(collector); - - return property.Value; - } - set - { - FamilyProperty property = new FamilyProperty(value.Value, workbook); - StyleSetter setter = new StyleSetter(new FontEntity(workbook), property, workbook); - range_walker.SetStyles(setter); - } - } - - /// - /// Get/set the outline property of the font (used on Mac only). - /// - public bool? Outline - { - get - { - OutlineProperty property = new OutlineProperty(workbook); - StyleCollector collector = new StyleCollector(new FontEntity(workbook), property, workbook); - range_walker.CollectStatisticsIncludingEmpty(collector); - - return property.Value; - } - set - { - OutlineProperty property = new OutlineProperty(value.Value, workbook); - StyleSetter setter = new StyleSetter(new FontEntity(workbook), property, workbook); - range_walker.SetStyles(setter); - } - } - - /// - /// Get/set the scheme property of the font. - /// - public SchemeStyle? Scheme - { - get - { - SchemeProperty property = new SchemeProperty(workbook); - StyleCollector collector = new StyleCollector(new FontEntity(workbook), property, workbook); - range_walker.CollectStatisticsIncludingEmpty(collector); - - return property.Value; - } - set - { - SchemeProperty property = new SchemeProperty(value.Value, workbook); - StyleSetter setter = new StyleSetter(new FontEntity(workbook), property, workbook); - range_walker.SetStyles(setter); - } - } - - /// - /// Get/set the italic property of the font. - /// - public bool? Italic - { - get - { - ItalicProperty property = new ItalicProperty(workbook); - StyleCollector collector = new StyleCollector(new FontEntity(workbook), property, workbook); - range_walker.CollectStatisticsIncludingEmpty(collector); - - return property.Value; - } - set - { - ItalicProperty property = new ItalicProperty(value.Value, workbook); - StyleSetter setter = new StyleSetter(new FontEntity(workbook), property, workbook); - range_walker.SetStyles(setter); - } - } - - /// - /// Get/set the underline property of the font. - /// - public bool? Underline - { - get - { - UnderlineProperty property = new UnderlineProperty(workbook); - StyleCollector collector = new StyleCollector(new FontEntity(workbook), property, workbook); - range_walker.CollectStatisticsIncludingEmpty(collector); - - return property.Value; - } - set - { - UnderlineProperty property = new UnderlineProperty(value.Value, workbook); - StyleSetter setter = new StyleSetter(new FontEntity(workbook), property, workbook); - range_walker.SetStyles(setter); - } - } - - /// - /// Get/set the Strikethrough property of the font. - /// - public bool? Strikethrough - { - get - { - StrikethroughProperty property = new StrikethroughProperty(workbook); - StyleCollector collector = new StyleCollector(new FontEntity(workbook), property, workbook); - range_walker.CollectStatisticsIncludingEmpty(collector); - - return property.Value; - } - set - { - StrikethroughProperty property = new StrikethroughProperty(value.Value, workbook); - StyleSetter setter = new StyleSetter(new FontEntity(workbook), property, workbook); - range_walker.SetStyles(setter); - } - } - - /// - /// Get/set the shadow property of the font. - /// - public bool? Shadow - { - get - { - ShadowProperty property = new ShadowProperty(workbook); - StyleCollector collector = new StyleCollector(new FontEntity(workbook), property, workbook); - range_walker.CollectStatisticsIncludingEmpty(collector); - - return property.Value; - } - set - { - ShadowProperty property = new ShadowProperty(value.Value, workbook); - StyleSetter setter = new StyleSetter(new FontEntity(workbook), property, workbook); - range_walker.SetStyles(setter); - } - } - - /// - /// Get/set the superscript property of the font. - /// - public bool? Superscript - { - get - { - SuperscriptProperty property = new SuperscriptProperty(workbook); - StyleCollector collector = new StyleCollector(new FontEntity(workbook), property, workbook); - range_walker.CollectStatisticsIncludingEmpty(collector); - - return property.Value; - } - set - { - SuperscriptProperty property = new SuperscriptProperty(value.Value, workbook); - StyleSetter setter = new StyleSetter(new FontEntity(workbook), property, workbook); - range_walker.SetStyles(setter); - } - } - - /// - /// Get/set the subscript property of the font. - /// - public bool? Subscript - { - get - { - SubscriptProperty property = new SubscriptProperty(workbook); - StyleCollector collector = new StyleCollector(new FontEntity(workbook), property, workbook); - range_walker.CollectStatisticsIncludingEmpty(collector); - - return property.Value; - } - set - { - SubscriptProperty property = new SubscriptProperty(value.Value, workbook); - StyleSetter setter = new StyleSetter(new FontEntity(workbook), property, workbook); - range_walker.SetStyles(setter); - } - } - - /// - /// Get/set the size of the font. - /// - public int? Size - { - get - { - FontSizeProperty property = new FontSizeProperty(workbook); - StyleCollector collector = new StyleCollector(new FontEntity(workbook), property, workbook); - range_walker.CollectStatisticsIncludingEmpty(collector); - - return property.Value; - } - set - { - FontSizeProperty property = new FontSizeProperty(value.Value, workbook); - StyleSetter setter = new StyleSetter(new FontEntity(workbook), property, workbook); - range_walker.SetStyles(setter); - } - } - - /// - /// Get/set the name of the font. - /// - public string Name - { - get - { - FontNameProperty property = new FontNameProperty(workbook); - StyleCollector collector = new StyleCollector(new FontEntity(workbook), property, workbook); - range_walker.CollectStatisticsIncludingEmpty(collector); - - return property.Value; - } - set - { - FontNameProperty property = new FontNameProperty(value, workbook); - StyleSetter setter = new StyleSetter(new FontEntity(workbook), property, workbook); - range_walker.SetStyles(setter); - } - } - - /// - /// Returns Color object that is responsible for getting and setting of font color of cells. - /// Read-only. - /// - public Colors.Color Color - { - get - { - Colors.ColorProperty property = new Colors.FgColorProperty("color", workbook); - StyleCollector collector = new StyleCollector(new FontEntity(workbook), property, workbook); - range_walker.CollectStatisticsIncludingEmpty(collector); - - StyleSetter style_setter = new StyleSetter(new FontEntity(workbook), property, workbook); - if (property.IsNull()) - { - property.Value = new Colors.FgColor(workbook); - return new Colors.Color(null, range_walker, style_setter, property, workbook); - } - return new Colors.Color(property.Value, range_walker, style_setter, property, workbook); - // Terrible code. I know. Don't have time to improve. - } - private set{} - } - - private Workbook workbook; - private RangeWalker range_walker; - } - public class FontSimple - { - internal FontSimple() - { - } - public bool? Bold; - public bool? Italic; - public bool? Underline; - public int? Size; - public string Name; - public Colors.Color Color; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Font/FontEntity.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Font/FontEntity.cs deleted file mode 100644 index ad48407bcf..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Font/FontEntity.cs +++ /dev/null @@ -1,94 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; - -namespace ASCOfficeEWSEditor.Editor.Format.Font -{ - internal class FontEntity : SeparateEntity - { - public FontEntity(Workbook workbook) : base(workbook) - { - b_prop = new BoldProperty(workbook); - charset_prop = new CharsetProperty(workbook); - color_prop = new Colors.FgColorProperty("color", workbook); - condese_prop = new CondenseProperty(workbook); - extend_prop = new ExtendProperty(workbook); - family_prop = new FamilyProperty(workbook); - i_prop = new ItalicProperty(workbook); - name_prop = new FontNameProperty(workbook); - outline_prop = new OutlineProperty(workbook); - scheme_prop = new SchemeProperty(workbook); - shadow_prop = new ShadowProperty(workbook); - strike_prop = new StrikethroughProperty(workbook); - sz_prop = new FontSizeProperty(workbook); - u_prop = new UnderlineProperty(workbook); - sub_prop = new SubscriptProperty(workbook); - sup_prop = new SuperscriptProperty(workbook); - } - - public override string GetEntityIdAttribName() - { - return entity_id_attrib_name; - } - - public override string GetEntitiesTagName() - { - return entities_tag_name; - } - - public override string GetEntityTagName() - { - return entity_tag_name; - } - - public override string GetEntityTemplate() - { - return Resource1.default_font; - } - - public override bool CompareEntities(XmlElement ent1, XmlElement ent2) - { - return b_prop.CompareEntities(ent1, ent2) && - charset_prop.CompareEntities(ent1, ent2) && - color_prop.CompareEntities(ent1, ent2) && - condese_prop.CompareEntities(ent1, ent2) && - extend_prop.CompareEntities(ent1, ent2) && - family_prop.CompareEntities(ent1, ent2) && - i_prop.CompareEntities(ent1, ent2) && - name_prop.CompareEntities(ent1, ent2) && - outline_prop.CompareEntities(ent1, ent2) && - scheme_prop.CompareEntities(ent1, ent2) && - shadow_prop.CompareEntities(ent1, ent2) && - strike_prop.CompareEntities(ent1, ent2) && - sz_prop.CompareEntities(ent1, ent2) && - u_prop.CompareEntities(ent1, ent2) && - sub_prop.CompareEntities(ent1, ent2) && - sup_prop.CompareEntities(ent1, ent2); - } - - private const string apply_entity_attrib_name = "applyFont"; - private const string entity_id_attrib_name = "fontId"; - private const string entities_tag_name = "fonts"; - private const string entity_tag_name = "font"; - - private BoldProperty b_prop; - private CharsetProperty charset_prop; - private Colors.ColorProperty color_prop; - private CondenseProperty condese_prop; - private ExtendProperty extend_prop; - private FamilyProperty family_prop; - private ItalicProperty i_prop; - private FontNameProperty name_prop; - private OutlineProperty outline_prop; - private SchemeProperty scheme_prop; - private ShadowProperty shadow_prop; - private StrikethroughProperty strike_prop; - private FontSizeProperty sz_prop; - private UnderlineProperty u_prop; - private SubscriptProperty sub_prop; - private SuperscriptProperty sup_prop; - - - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Font/FontNameProperty.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Font/FontNameProperty.cs deleted file mode 100644 index d6fe30b18f..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Font/FontNameProperty.cs +++ /dev/null @@ -1,48 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor.Format.Font -{ - internal class FontNameProperty : PropertyString - { - public FontNameProperty(string init_value, Workbook workbook) : base(init_value) - { - this.workbook = workbook; - } - - public FontNameProperty(Workbook workbook) - { - this.workbook = workbook; - } - - public override string ExtractValueFromEntity(XmlElement font_tag) - { - XmlElement name_tag = (XmlElement)font_tag.SelectSingleNode("main:name", workbook.NamespaceManager); - string name; - if (name_tag != null && (name = name_tag.GetAttribute("val")) != "") - { - return name; - } - return workbook.StyleSheet.GetZeroStyleOrDefaultFontName(); - } - - public override void SetToEntity(XmlElement font_tag) - { - if (Value != null) - { - XmlElement name_tag = (XmlElement)font_tag.SelectSingleNode("main:name", workbook.NamespaceManager); - if (name_tag == null) - { - name_tag = font_tag.OwnerDocument.CreateElement("name", workbook.NamespaceManager.LookupNamespace("main")); - font_tag.AppendChild(name_tag); - } - name_tag.SetAttribute("val", Value); - } - } - - private Workbook workbook; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Font/FontSizeProperty.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Font/FontSizeProperty.cs deleted file mode 100644 index fbbd1795b4..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Font/FontSizeProperty.cs +++ /dev/null @@ -1,48 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor.Format.Font -{ - internal class FontSizeProperty : Property - { - public FontSizeProperty(int init_value, Workbook workbook) : base(init_value) - { - this.workbook = workbook; - } - - public FontSizeProperty(Workbook workbook) - { - this.workbook = workbook; - } - - public override int ExtractValueFromEntity(XmlElement font_tag) - { - XmlElement sz_tag = (XmlElement)font_tag.SelectSingleNode("main:sz", workbook.NamespaceManager); - int sz; - if (sz_tag != null && (sz = XMLInt.ParseOrDefault(sz_tag.GetAttribute("val"), -1)) != -1) - { - return sz; - } - return workbook.StyleSheet.GetZeroStyleOrDefaultFontSize(); - } - - public override void SetToEntity(XmlElement font_tag) - { - if (Value.HasValue) - { - XmlElement sz_tag = (XmlElement)font_tag.SelectSingleNode("main:sz", workbook.NamespaceManager); - if (sz_tag == null) - { - sz_tag = font_tag.OwnerDocument.CreateElement("sz", workbook.NamespaceManager.LookupNamespace("main")); - font_tag.AppendChild(sz_tag); - } - sz_tag.SetAttribute("val", Value.Value.ToString()); - } - } - - private Workbook workbook; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Font/ItalicProperty.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Font/ItalicProperty.cs deleted file mode 100644 index 44cf7d9fb4..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Font/ItalicProperty.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor.Format.Font -{ - internal class ItalicProperty : PropertyBooleanTag - { - public ItalicProperty(bool init_value, Workbook workbook) : base(init_value, workbook) - { - } - - public ItalicProperty(Workbook workbook) - : base(workbook) - { - } - - internal override string TagName { get { return "i"; } } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Font/OutlineProperty.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Font/OutlineProperty.cs deleted file mode 100644 index 03035cb7a2..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Font/OutlineProperty.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor.Format.Font -{ - internal class OutlineProperty : PropertyBooleanTag - { - public OutlineProperty(bool init_value, Workbook workbook) : base(init_value, workbook) - { - } - - public OutlineProperty(Workbook workbook) - : base(workbook) - { - } - - internal override string TagName { get { return "outline"; } } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Font/SchemeProperty.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Font/SchemeProperty.cs deleted file mode 100644 index 964f0361b5..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Font/SchemeProperty.cs +++ /dev/null @@ -1,88 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor.Format.Font -{ - internal class SchemeProperty : Property - { - public SchemeProperty(SchemeStyle init_value, Workbook workbook) - : base(init_value) - { - this.workbook = workbook; - } - - public SchemeProperty(Workbook workbook) - { - this.workbook = workbook; - } - - public override SchemeStyle ExtractValueFromEntity(XmlElement font_tag) - { - XmlElement scheme_tag = (XmlElement)font_tag.SelectSingleNode("main:scheme", workbook.NamespaceManager); - if (scheme_tag == null) - { - return SchemeStyle.None; - } - string scheme_val = scheme_tag.GetAttribute("val"); - switch (scheme_val) - { - case "major": - return SchemeStyle.Major; - case "minor": - return SchemeStyle.Minor; - case "none": - default: - return SchemeStyle.None; - } - } - - public override void SetToEntity(XmlElement font_tag) - { - if (Value.HasValue) - { - XmlElement family_tag = (XmlElement)font_tag.SelectSingleNode("main:family", workbook.NamespaceManager); - if (Value.Value != SchemeStyle.None) - { - if (family_tag == null) - { - family_tag = font_tag.OwnerDocument.CreateElement("family", workbook.NamespaceManager.LookupNamespace("main")); - font_tag.AppendChild(family_tag); - } - family_tag.SetAttribute("val", Value.Value == SchemeStyle.Major ? "major" : "minor"); - } - else - { - if (family_tag != null) - { - font_tag.RemoveChild(family_tag); - } - } - } - } - - private Workbook workbook; - } - - - /// - /// Font scheme style - /// - public enum SchemeStyle - { - /// - /// Major font of the scheme - /// - Major, - /// - /// Minor font of the scheme - /// - Minor, - /// - /// The font is not a theme font - /// - None - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Font/ShadowProperty.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Font/ShadowProperty.cs deleted file mode 100644 index 32c427de78..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Font/ShadowProperty.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor.Format.Font -{ - internal class ShadowProperty : PropertyBooleanTag - { - public ShadowProperty(bool init_value, Workbook workbook) : base(init_value, workbook) - { - } - - public ShadowProperty(Workbook workbook) - : base(workbook) - { - } - - internal override string TagName { get { return "shadow"; } } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Font/StrikethroughProperty.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Font/StrikethroughProperty.cs deleted file mode 100644 index a0cf69f980..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Font/StrikethroughProperty.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor.Format.Font -{ - internal class StrikethroughProperty : PropertyBooleanTag - { - public StrikethroughProperty(bool init_value, Workbook workbook) - : base(init_value, workbook) - { - } - - public StrikethroughProperty(Workbook workbook) - : base(workbook) - { - } - - internal override string TagName { get { return "strike"; } } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Font/SubscriptProperty.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Font/SubscriptProperty.cs deleted file mode 100644 index ba412be29b..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Font/SubscriptProperty.cs +++ /dev/null @@ -1,65 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; - -namespace ASCOfficeEWSEditor.Editor.Format.Font -{ - internal class SubscriptProperty : Property - { - public SubscriptProperty(bool init_val, Workbook workbook) - : base(init_val) - { - this.workbook = workbook; - } - - public SubscriptProperty(Workbook workbook) - { - this.workbook = workbook; - } - - public override bool ExtractValueFromEntity(XmlElement font_tag) - { - XmlElement vert_tag = (XmlElement)font_tag.SelectSingleNode("main:vertAlign", workbook.NamespaceManager); - if (vert_tag == null) - { - return false; - } - string vert_val = vert_tag.GetAttribute("val"); - switch (vert_val) - { - case "subscript": - return true; - default: - return false; - } - } - - public override void SetToEntity(XmlElement font_tag) - { - if (Value.HasValue) - { - XmlElement vert_tag = (XmlElement)font_tag.SelectSingleNode("main:vertAlign", workbook.NamespaceManager); - - if (Value.Value) - { - if (vert_tag == null) - { - vert_tag = font_tag.OwnerDocument.CreateElement("vertAlign", workbook.NamespaceManager.LookupNamespace("main")); - font_tag.AppendChild(vert_tag); - } - vert_tag.SetAttribute("val", "subscript"); - } - else - { - if (vert_tag != null) - { - font_tag.RemoveChild(vert_tag); - } - } - } - } - - private Workbook workbook; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Font/SuperscriptProperty.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Font/SuperscriptProperty.cs deleted file mode 100644 index 093c6f1097..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Font/SuperscriptProperty.cs +++ /dev/null @@ -1,64 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; - -namespace ASCOfficeEWSEditor.Editor.Format.Font -{ - internal class SuperscriptProperty : Property - { - public SuperscriptProperty(bool init_value, Workbook workbook) - : base(init_value) - { - this.workbook = workbook; - } - - public SuperscriptProperty(Workbook workbook) - { - this.workbook = workbook; - } - - public override bool ExtractValueFromEntity(XmlElement font_tag) - { - XmlElement vert_tag = (XmlElement)font_tag.SelectSingleNode("main:vertAlign", workbook.NamespaceManager); - if (vert_tag == null) - { - return false; - } - string vert_val = vert_tag.GetAttribute("val"); - switch (vert_val) - { - case "superscript": - return true; - default: - return false; - } - } - - public override void SetToEntity(XmlElement font_tag) - { - if (Value.HasValue) - { - XmlElement vert_tag = (XmlElement)font_tag.SelectSingleNode("main:vertAlign", workbook.NamespaceManager); - - if (Value.Value) - { - if (vert_tag == null) - { - vert_tag = font_tag.OwnerDocument.CreateElement("vertAlign", workbook.NamespaceManager.LookupNamespace("main")); - font_tag.AppendChild(vert_tag); - } - vert_tag.SetAttribute("val", "superscript"); - } - else - { - if (vert_tag != null) - { - font_tag.RemoveChild(vert_tag); - } - } - } - } - private Workbook workbook; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Font/UnderlineProperty.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Font/UnderlineProperty.cs deleted file mode 100644 index 6d2b83c8e9..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Font/UnderlineProperty.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor.Format.Font -{ - internal class UnderlineProperty : PropertyBooleanTag - { - public UnderlineProperty(bool init_value, Workbook workbook) - : base(init_value, workbook) - { - } - - public UnderlineProperty(Workbook workbook) - : base(workbook) - { - } - - internal override string TagName { get { return "u"; } } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Format.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Format.cs deleted file mode 100644 index 03d5ec9500..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Format.cs +++ /dev/null @@ -1,368 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using ASCOfficeEWSEditor.Editor.Walkers; -using ASCOfficeEWSEditor.Editor.NumberFormat; - -namespace ASCOfficeEWSEditor.Editor.Format -{ - /// - /// Represents a set of cells formatting properties. - /// Has permanent link to the range where it was created from - /// - public class Format - { - internal Format(RangeWalker range_walker, Cells.CellRange range_coords, Worksheet parent_sheet) - { - this.range_walker = range_walker; - this.workbook = parent_sheet.Workbook; - this.parent_sheet = parent_sheet; - this.range_coords = range_coords; - Font = new Font.Font(range_walker, workbook); - Alignment = new Alignment.Alignment(range_walker, workbook); - Protection = new Protection.Protection(range_walker, workbook); - Borders = new Borders.Borders(range_walker, workbook); - Fills = new Fills.Fills(range_walker, workbook); - } - - /// - /// Returns Font object that is responsible for getting and setting of all font properties of the cells. - /// Read-only. - /// - public Font.Font Font - { - get; - private set; - } - - /// - /// Returns Alignment object that is responsible for getting and setting of all Alignment properties of the cells. - /// Read-only. - /// - public Alignment.Alignment Alignment - { - get; - private set; - } - - /// - /// Returns Protection object that is responsible for getting and setting of all Protection properties of the cells. - /// Read-only. - /// - public Protection.Protection Protection - { - get; - private set; - } - - /// - /// Returns Borders object that is responsible for getting and setting of all properties of all borders of the cells. - /// Read-only. - /// - public Borders.Borders Borders - { - get; - private set; - } - - /// - /// Returns Fills object that is responsible for getting and setting of all fill properties of the cells. - /// Read-only. - /// - public Fills.Fills Fills - { - get; - private set; - } - - /// - /// Get/set the number format ID - /// Note: CellsUpdatedEvent issued on set - /// - public int? NumberFormatId - { - get - { - PropertyId property = new PropertyId(); - StyleCollector collector = new StyleCollector(new NumberFormat.NumberFormatEntity(property), property, workbook); - range_walker.CollectStatisticsIncludingEmpty(collector); - - return property.Value; - } - set - { - if(value.HasValue && workbook.StyleSheet.IsNumberFormatIdValidForThisBook(value.Value)) - { - PropertyId property = new PropertyId(value.Value); - - StyleSetter setter = new StyleSetter(new NumberFormat.NumberFormatEntity(property), property, workbook); - range_walker.SetStyles(setter); - - parent_sheet.SubjectsStorage.MarkRangeCellsUpdated(range_coords); - parent_sheet.IssueCellsUpdatedEvent(); - } - } - } - - /// - /// Get/set the number format code string - /// Note: CellsUpdatedEvent issued on set - /// - public string NumberFormatCode - { - get - { - int? format_id = NumberFormatId; - if(!format_id.HasValue) - { - return null; - } - return workbook.StyleSheet.GetNumberFormatString(format_id.Value); - } - set - { - if(value != null) - { - int format_id = workbook.StyleSheet.SetNumberFormatString(value); - NumberFormatId = format_id; - } - } - } - - /// - /// Show more precise values by showing more decimal places - /// Note: CellsUpdatedEvent issued - /// - public void IncreaseDecimal() - { - Range TopLeftRange = parent_sheet.Cell(range_coords.TopLeft); - string num_fmt_code = TopLeftRange.Format.NumberFormatCode; - if (num_fmt_code != null) - { - if (num_fmt_code.ToLower() == "general") - { - NumberFormatCode = NumberFormatParser.IncreaseDecimalGeneral(TopLeftRange.InternalValue); - } - else - { - string positive_format; - string negative_format; - string zero_format; - string text_format; - if (NumberFormatParser.SplitFormatString(num_fmt_code, out positive_format, out negative_format, out zero_format, out text_format)) - { - - NumberFormatCode = NumberFormatParser.MergeFormatString(NumberFormatParser.IncreaseDecimal(positive_format), - NumberFormatParser.IncreaseDecimal(negative_format), - NumberFormatParser.IncreaseDecimal(zero_format), - NumberFormatParser.IncreaseDecimal(text_format)); - } - } - } - } - - /// - /// Show less precise values by showing fewer decimal places - /// Note: CellsUpdatedEvent issued - /// - public void DecreaseDecimal() - { - Range TopLeftRange = parent_sheet.Cell(range_coords.TopLeft); - string num_fmt_code = TopLeftRange.Format.NumberFormatCode; - if (num_fmt_code != null) - { - if (num_fmt_code.ToLower() == "general") - { - NumberFormatCode = NumberFormatParser.DecreaseDecimalGeneral(TopLeftRange.InternalValue); - } - else - { - string positive_format; - string negative_format; - string zero_format; - string text_format; - if (NumberFormatParser.SplitFormatString(num_fmt_code, out positive_format, out negative_format, out zero_format, out text_format)) - { - - NumberFormatCode = NumberFormatParser.MergeFormatString(NumberFormatParser.DecreaseDecimal(positive_format), - NumberFormatParser.DecreaseDecimal(negative_format), - NumberFormatParser.DecreaseDecimal(zero_format), - NumberFormatParser.DecreaseDecimal(text_format)); - } - } - } - } - - private RangeWalker range_walker; - private Workbook workbook; - private Cells.CellRange range_coords; - private Worksheet parent_sheet; - } - public class FormatSimple - { //здесь не все свойства, а только те которые использет сайт - public Font.FontSimple Font = new ASCOfficeEWSEditor.Editor.Format.Font.FontSimple(); - public Alignment.AlignmentSimple Alignment = new ASCOfficeEWSEditor.Editor.Format.Alignment.AlignmentSimple(); - public Fills.FillsSimple Fills = new ASCOfficeEWSEditor.Editor.Format.Fills.FillsSimple(); - public Borders.BordersSimple Brds = new ASCOfficeEWSEditor.Editor.Format.Borders.BordersSimple(); - public int? NumberFormatId = 0; - public FormatSimple(Workbook workbook, System.Xml.XmlElement oCurNode) - { - m_oWorkbook = workbook; - - Init(oCurNode); - } - public FormatSimple(Workbook workbook) - { - m_oWorkbook = workbook; - } - public FormatSimple() - { - } - public FormatSimple( int nIndex, Workbook workbook ) - { - m_oWorkbook = workbook; - if (-1 != nIndex) - { - System.Xml.XmlNode CellXfs_xml = workbook.StyleSheet.Get_CellXfs_OrCreate(); - - System.Xml.XmlElement cell_xf = (System.Xml.XmlElement)CellXfs_xml.SelectSingleNode("main:xf[position() = " + (nIndex + 1).ToString() + "]", workbook.NamespaceManager); - if (cell_xf != null) // If the style reference in a cell is wrong - Init(cell_xf); - } - } - private void Init(System.Xml.XmlElement oCurNode) - { - Font.BoldProperty oBold = new Font.BoldProperty(m_oWorkbook); - Font.ItalicProperty oItalic = new Font.ItalicProperty(m_oWorkbook); - Font.UnderlineProperty oUnderline = new Font.UnderlineProperty(m_oWorkbook); - Font.FontSizeProperty oSize = new Font.FontSizeProperty(m_oWorkbook); - Font.FontNameProperty oName = new Font.FontNameProperty(m_oWorkbook); - Colors.ColorProperty oColorProp = new Colors.FgColorProperty("color", m_oWorkbook); - //Alignment - Alignment.HorizontalProperty oHorProp = new Alignment.HorizontalProperty(m_oWorkbook); - Alignment.VerticalProperty oVerProp = new Alignment.VerticalProperty(m_oWorkbook); - Alignment.WrapTextProperty oWrapProp = new Alignment.WrapTextProperty(); - //Fill - Fills.PatternProperty oPatTypeProp = new Fills.PatternProperty(); - Fills.PatternFillProperty oPatTypePropProp = new Fills.PatternFillProperty(oPatTypeProp, m_oWorkbook); - Colors.ColorProperty oPatFgProp = new Colors.FgColorProperty("fgColor", m_oWorkbook); - Fills.PatternFillProperty oPatFgPropProp = new Fills.PatternFillProperty(oPatFgProp, m_oWorkbook); - Colors.ColorProperty oPatBgProp = new Colors.BgColorProperty("bgColor", m_oWorkbook); - Fills.PatternFillProperty oPatBgPropProp = new Fills.PatternFillProperty(oPatBgProp, m_oWorkbook); - Fills.GradientTypeProperty oGraTypeProp = new Fills.GradientTypeProperty(); - Fills.GradientFillProperty oGraTypePropProp = new Fills.GradientFillProperty(oGraTypeProp, m_oWorkbook); - Colors.ColorProperty oGraColProp = new Colors.FgColorProperty("color", m_oWorkbook); - Fills.StopProperty oGraColPropProp = new Fills.StopProperty(0, oGraColProp, m_oWorkbook); - Fills.GradientFillProperty oGraColPropPropProp = new Fills.GradientFillProperty(oGraColPropProp, m_oWorkbook); - //Border - Borders.StyleProperty oBrdrLeftTypeProp = new Borders.StyleProperty(m_oWorkbook); - Borders.BorderProperty oBrdrLeftTypePropProp = new Borders.BorderProperty(Borders.BorderPosition.left, oBrdrLeftTypeProp, m_oWorkbook); - Borders.StyleProperty oBrdrTopTypeProp = new Borders.StyleProperty(m_oWorkbook); - Borders.BorderProperty oBrdrTopTypePropProp = new Borders.BorderProperty(Borders.BorderPosition.top, oBrdrTopTypeProp, m_oWorkbook); - Borders.StyleProperty oBrdrRightTypeProp = new Borders.StyleProperty(m_oWorkbook); - Borders.BorderProperty oBrdrRightTypePropProp = new Borders.BorderProperty(Borders.BorderPosition.right, oBrdrRightTypeProp, m_oWorkbook); - Borders.StyleProperty oBrdrBottomTypeProp = new Borders.StyleProperty(m_oWorkbook); - Borders.BorderProperty oBrdrBottomTypePropProp = new Borders.BorderProperty(Borders.BorderPosition.bottom, oBrdrBottomTypeProp, m_oWorkbook); - Colors.ColorProperty oBrdrLeftColorProp = new Colors.FgColorProperty("color", m_oWorkbook); - Borders.BorderProperty oBrdrLeftColorPropProp = new Borders.BorderProperty(Borders.BorderPosition.left, oBrdrLeftColorProp, m_oWorkbook); - Colors.ColorProperty oBrdrTopColorProp = new Colors.FgColorProperty("color", m_oWorkbook); - Borders.BorderProperty oBrdrTopColorPropProp = new Borders.BorderProperty(Borders.BorderPosition.top, oBrdrTopColorProp, m_oWorkbook); - Colors.ColorProperty oBrdrRightColorProp = new Colors.FgColorProperty("color", m_oWorkbook); - Borders.BorderProperty oBrdrRightColorPropProp = new Borders.BorderProperty(Borders.BorderPosition.right, oBrdrRightColorProp, m_oWorkbook); - Colors.ColorProperty oBrdrBottomColorProp = new Colors.FgColorProperty("color", m_oWorkbook); - Borders.BorderProperty oBrdrBottomColorPropProp = new Borders.BorderProperty(Borders.BorderPosition.bottom, oBrdrBottomColorProp, m_oWorkbook); - //NumberFormat - PropertyId oNumFormatProp = new PropertyId(); - - Font.FontEntity oFontEntity = new Font.FontEntity(m_oWorkbook); - Alignment.AlignmentEntity oAlignmentEntity = new Alignment.AlignmentEntity(m_oWorkbook); - NumberFormat.NumberFormatEntity oNumberFormatEntity = new NumberFormat.NumberFormatEntity(oNumFormatProp); - Fills.FillEntity oFillEntity = new Fills.FillEntity(m_oWorkbook); - Borders.BorderEntity oBorderEntity = new Borders.BorderEntity(m_oWorkbook); - - oFontEntity.CollectPropertyFromXF(oCurNode, oBold); - oFontEntity.CollectPropertyFromXF(oCurNode, oItalic); - oFontEntity.CollectPropertyFromXF(oCurNode, oUnderline); - oFontEntity.CollectPropertyFromXF(oCurNode, oSize); - oFontEntity.CollectPropertyFromXF(oCurNode, oName); - oFontEntity.CollectPropertyFromXF(oCurNode, oColorProp); - oAlignmentEntity.CollectPropertyFromXF(oCurNode, oHorProp); - oAlignmentEntity.CollectPropertyFromXF(oCurNode, oVerProp); - oAlignmentEntity.CollectPropertyFromXF(oCurNode, oWrapProp); - oFillEntity.CollectPropertyFromXF(oCurNode, oPatTypePropProp); - oFillEntity.CollectPropertyFromXF(oCurNode, oPatFgPropProp); - oFillEntity.CollectPropertyFromXF(oCurNode, oPatBgPropProp); - oFillEntity.CollectPropertyFromXF(oCurNode, oGraTypePropProp); - oFillEntity.CollectPropertyFromXF(oCurNode, oGraColPropPropProp); - oNumberFormatEntity.CollectPropertyFromXF(oCurNode, oNumFormatProp); - oBorderEntity.CollectPropertyFromXF(oCurNode, oBrdrLeftTypePropProp); - oBorderEntity.CollectPropertyFromXF(oCurNode, oBrdrTopTypePropProp); - oBorderEntity.CollectPropertyFromXF(oCurNode, oBrdrRightTypePropProp); - oBorderEntity.CollectPropertyFromXF(oCurNode, oBrdrBottomTypePropProp); - oBorderEntity.CollectPropertyFromXF(oCurNode, oBrdrLeftColorPropProp); - oBorderEntity.CollectPropertyFromXF(oCurNode, oBrdrTopColorPropProp); - oBorderEntity.CollectPropertyFromXF(oCurNode, oBrdrRightColorPropProp); - oBorderEntity.CollectPropertyFromXF(oCurNode, oBrdrBottomColorPropProp); - - - Font.Bold = oBold.Value; - Font.Italic = oItalic.Value; - Font.Underline = oUnderline.Value; - Font.Size = oSize.Value; - Font.Name = oName.Value; - SetColor(ref Font.Color, oColorProp); - Alignment.Horizontal = oHorProp.Value; - Alignment.Vertical = oVerProp.Value; - Alignment.WrapText = oWrapProp.Value; - Fills.PatternFill.Pattern = oPatTypeProp.Value; - SetColor(ref Fills.PatternFill.FgColor, oPatFgProp); - SetColor(ref Fills.PatternFill.BgColor, oPatBgProp); - Fills.GradientFill.Type = oGraTypeProp.Value; - SetColor(ref Fills.GradientFill.Color, oGraColProp); - //Border - if (oBrdrLeftTypeProp.Value == null) - Brds.Left.Style = ASCOfficeEWSEditor.Editor.Format.Borders.BorderStyle.none; - else - Brds.Left.Style = oBrdrLeftTypeProp.Value; - - if (oBrdrTopTypeProp.Value == null) - Brds.Top.Style = ASCOfficeEWSEditor.Editor.Format.Borders.BorderStyle.none; - else - Brds.Top.Style = oBrdrTopTypeProp.Value; - - if(oBrdrRightTypeProp.Value == null) - Brds.Right.Style = ASCOfficeEWSEditor.Editor.Format.Borders.BorderStyle.none; - else - Brds.Right.Style = oBrdrRightTypeProp.Value; - - if(oBrdrBottomTypeProp.Value == null) - Brds.Bottom.Style = ASCOfficeEWSEditor.Editor.Format.Borders.BorderStyle.none; - else - Brds.Bottom.Style = oBrdrBottomTypeProp.Value; - SetColor(ref Brds.Left.Color, oBrdrLeftColorProp); - SetColor(ref Brds.Top.Color, oBrdrTopColorProp); - SetColor(ref Brds.Right.Color, oBrdrRightColorProp); - SetColor(ref Brds.Bottom.Color, oBrdrBottomColorProp); - //NumberFormat - NumberFormatId = oNumFormatProp.Value; - } - private void SetColor(ref Colors.Color oColor, Colors.ColorProperty oColorProp) - { - if (oColorProp.IsNull()) - { - oColorProp.Value = new Colors.FgColor(m_oWorkbook); - oColor = new Colors.Color(null, null, null, oColorProp, m_oWorkbook); - } - else oColor = new Colors.Color(oColorProp.Value, null, null, oColorProp, m_oWorkbook); - } - private Workbook m_oWorkbook; - - }; - - public struct CCollFormat - { - public int m_nMin; - public int m_nMax; - public FormatSimple m_oFormatSimple; - }; -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/IProperty.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/IProperty.cs deleted file mode 100644 index 8aff967f3c..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/IProperty.cs +++ /dev/null @@ -1,437 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor.Format -{ - public interface IProperty - { - bool IsNull(); - bool CollectFromEntity(XmlElement entity_tag); - void SetToEntity(XmlElement entity_tag); - bool CompareEntities(XmlElement ent1, XmlElement ent2); - } - - internal abstract class Property : IProperty - where T : struct - { - internal Property() {} - internal Property(T init_value) - { - Value = init_value; - } - - public bool CollectFromEntity(XmlElement entity_tag) - { - return CollectFromValue(ExtractValueFromEntity(entity_tag)); - } - - public bool CollectFromValue(T collected_value) - { - if (!Value.HasValue) - { - Value = collected_value; - return true; // continue - } - else if (Value.Value.Equals(collected_value)) - { - return true; // continue - } - else - { - Value = null; - return false; - } - } - - public abstract void SetToEntity(XmlElement entity_tag); - - public bool IsNull() - { - return Value == null; - } - - public bool CompareEntities(XmlElement ent1, XmlElement ent2) - { - return ExtractValueFromEntity(ent1).Equals(ExtractValueFromEntity(ent2)); - } - - public abstract T ExtractValueFromEntity(XmlElement entity_tag); - - public T? Value { get; private set; } - } - - internal abstract class PropertyString : IProperty - { - internal PropertyString() { } - internal PropertyString(string init_value) - { - Value = init_value; - } - - public bool CollectFromEntity(XmlElement entity_tag) - { - string value_extracted = ExtractValueFromEntity(entity_tag); - - if (Value == null) - { - Value = value_extracted; - return true; // continue - } - else if (Value == value_extracted) - { - return true; // continue - } - else - { - Value = null; - return false; - } - } - - - public void SetNull() - { - Value = null; - } - public bool IsNull() - { - return Value == null; - } - - public bool CompareEntities(XmlElement ent1, XmlElement ent2) - { - return ExtractValueFromEntity(ent1) == ExtractValueFromEntity(ent2); - } - - public abstract string ExtractValueFromEntity(XmlElement entity_tag); - public abstract void SetToEntity(XmlElement entity_tag); - - public string Value { get; private set; } - - - } - - internal abstract class PropertyBooleanTag : Property - { - public PropertyBooleanTag(bool init_value, Workbook workbook) : base(init_value) - { - this.workbook = workbook; - } - - public PropertyBooleanTag(Workbook workbook) - { - this.workbook = workbook; - } - - public override bool ExtractValueFromEntity(XmlElement font_tag) - { - XmlElement prop_tag = (XmlElement)font_tag.SelectSingleNode("main:" + TagName, workbook.NamespaceManager); - if (prop_tag == null) - { - return false; - } - return XMLBoolean.ParseOrDefault(prop_tag.GetAttribute("val"), true); - } - - public override void SetToEntity(XmlElement font_tag) - { - if (Value.HasValue) - { - XmlElement prop_tag = (XmlElement)font_tag.SelectSingleNode("main:" + TagName, workbook.NamespaceManager); - - if (Value.Value) - { - if (prop_tag != null) - { - prop_tag.RemoveAttribute("val"); - } - else - { - prop_tag = font_tag.OwnerDocument.CreateElement(TagName , workbook.NamespaceManager.LookupNamespace("main")); - font_tag.AppendChild(prop_tag); - } - } - else - { - if (prop_tag != null) - { - font_tag.RemoveChild(prop_tag); - } - } - } - } - - internal abstract string TagName { get; } - - private Workbook workbook; - - } - - internal abstract class PropertyBooleanAttrib : Property - { - public PropertyBooleanAttrib(bool init_value, bool default_value) - : base(init_value) - { - this.default_value = default_value; - } - - public PropertyBooleanAttrib(bool default_value) - { - this.default_value = default_value; - } - - public override bool ExtractValueFromEntity(XmlElement entity_tag) - { - if (entity_tag == null) - { - return default_value; - } - return XMLBoolean.ParseOrDefault(entity_tag.GetAttribute(AttribName), default_value); - } - - public override void SetToEntity(XmlElement entity_tag) - { - if (Value.HasValue) - { - if (Value.Value != default_value) - { - entity_tag.SetAttribute(AttribName, XMLBoolean.ToString(Value.Value)); - } - else - { - entity_tag.RemoveAttribute(AttribName); - } - } - } - - internal abstract string AttribName { get; } - - private bool default_value; - - } - - internal abstract class PropertyDoubleAttrib : Property - { - public PropertyDoubleAttrib(double init_value, double default_value) - : base(init_value) - { - this.default_value = default_value; - } - - public PropertyDoubleAttrib(double default_value) - { - this.default_value = default_value; - } - - public override double ExtractValueFromEntity(XmlElement entity_tag) - { - if (entity_tag == null) - { - return default_value; - } - return XMLDouble.ParseOrDefault(entity_tag.GetAttribute(AttribName), default_value); - } - - public override void SetToEntity(XmlElement entity_tag) - { - if (Value.HasValue) - { - if (Value.Value != default_value) - { - entity_tag.SetAttribute(AttribName, XMLDouble.ToString(Value.Value)); - } - else - { - entity_tag.RemoveAttribute(AttribName); - } - } - } - - internal abstract string AttribName { get; } - - private double default_value; - - } - - internal abstract class PropertyIntAttrib : Property - { - public PropertyIntAttrib(int init_value, int default_value) - : base(init_value) - { - this.default_value = default_value; - } - - public PropertyIntAttrib(int default_value) - { - this.default_value = default_value; - } - - public override int ExtractValueFromEntity(XmlElement entity_tag) - { - if (entity_tag == null) - { - return default_value; - } - return XMLInt.ParseOrDefault(entity_tag.GetAttribute(AttribName), default_value); - } - - public override void SetToEntity(XmlElement entity_tag) - { - if (Value.HasValue) - { - if (Value.Value != default_value) - { - entity_tag.SetAttribute(AttribName, Value.Value.ToString()); - } - else - { - entity_tag.RemoveAttribute(AttribName); - } - } - } - - internal abstract string AttribName { get; } - - private int default_value; - - } - - internal abstract class PropertyColor : IProperty - { - internal PropertyColor() { } - internal PropertyColor(Colors.ColorValue init_value) - { - Value = init_value; - } - - public bool CollectFromEntity(XmlElement entity_tag) - { - Colors.ColorValue value_extracted = ExtractValueFromEntity(entity_tag); - - if (Value == null) - { - Value = value_extracted; - return true; // continue - } - else if (Value.Equals(value_extracted)) - { - return true; // continue - } - else - { - Value = null; - return false; - } - } - - - public bool IsNull() - { - return Value == null; - } - - public bool CompareEntities(XmlElement ent1, XmlElement ent2) - { - return ExtractValueFromEntity(ent1).Equals(ExtractValueFromEntity(ent2)); - } - - public abstract Colors.ColorValue ExtractValueFromEntity(XmlElement entity_tag); - public abstract void SetToEntity(XmlElement entity_tag); - - public Colors.ColorValue Value { get; set; } - } - - internal abstract class PropertyBridgeTag : IProperty - { - public PropertyBridgeTag(IProperty included_property, Workbook workbook) - { - this.included_property = included_property; - this.workbook = workbook; - } - - public bool IsNull() - { - return included_property.IsNull() || tag_exists == null; - } - - public bool CollectFromEntity(XmlElement entity_tag) - { - XmlElement bridge_tag = (XmlElement)entity_tag.SelectSingleNode("main:" + TagName, workbook.NamespaceManager); - bool next_tag_exists = bridge_tag != null; - - if (!tag_exists.HasValue) - { - tag_exists = next_tag_exists; - } - else if (tag_exists.Value != next_tag_exists) - { - tag_exists = null; - return false; - } - - if (!next_tag_exists) - { - return true; // continue because all entities could have no bridge tag. - } - return included_property.CollectFromEntity(bridge_tag); - } - - public virtual void SetToEntity(XmlElement entity_tag) - { - XmlElement border_part_tag = (XmlElement)entity_tag.SelectSingleNode("main:" + TagName, workbook.NamespaceManager); - if(border_part_tag == null) - { - border_part_tag = entity_tag.OwnerDocument.CreateElement(TagName, workbook.NamespaceManager.LookupNamespace("main")); - entity_tag.AppendChild(border_part_tag); - } - included_property.SetToEntity(border_part_tag); - } - - public bool CompareEntities(XmlElement ent1, XmlElement ent2) - { - XmlElement bridge_tag1 = (XmlElement)ent1.SelectSingleNode("main:" + TagName, workbook.NamespaceManager); - XmlElement bridge_tag2 = (XmlElement)ent2.SelectSingleNode("main:" + TagName, workbook.NamespaceManager); - if (bridge_tag1 == null && bridge_tag1 == null) - { - return true; - } - if (bridge_tag1 == null || bridge_tag2 == null) - { - return false; - } - return included_property.CompareEntities(bridge_tag1, bridge_tag2); - } - - internal abstract string TagName { get; } - - private IProperty included_property; - private Workbook workbook; - private bool? tag_exists; - } - - internal class PropertyId : Property - { - public PropertyId(int init_value) - : base(init_value) - { - } - - public PropertyId() - { - } - - public override int ExtractValueFromEntity(XmlElement entity_tag) - { - throw new NotImplementedException(); - } - - public override void SetToEntity(XmlElement entity_tag) - { - throw new NotImplementedException(); - } - - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/IStyleEntity.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/IStyleEntity.cs deleted file mode 100644 index 2ee157de58..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/IStyleEntity.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor.Format -{ - public interface IStyleEntity - { - int GetEntityIdByXF(XmlElement xf_tag); - void SetEntityIdToXF(XmlElement xf_tag, int entity_id); - bool CompareEntities(XmlElement ent1, XmlElement ent2); - int ApplyProperty(XmlElement xf_record, IProperty property); - bool CollectPropertyFromXF(XmlElement xf_record, IProperty property); - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/IdEntity.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/IdEntity.cs deleted file mode 100644 index ee8cc4ada0..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/IdEntity.cs +++ /dev/null @@ -1,46 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor.Format -{ - internal abstract class IdStyleEntity : IStyleEntity - { - public IdStyleEntity(PropertyId property) - { - this.property = property; - } - - public int GetEntityIdByXF(XmlElement xf_tag) - { - return XMLInt.ParseOrDefault(xf_tag.GetAttribute(GetEntityIdAttribName()), 0); - } - - public abstract string GetEntityIdAttribName(); - - public bool CompareEntities(XmlElement ent1, XmlElement ent2) - { - throw new NotImplementedException(); - } - - public void SetEntityIdToXF(XmlElement xf_tag, int entity_id) - { - xf_tag.SetAttribute(GetEntityIdAttribName(), entity_id.ToString()); - } - - public int ApplyProperty(XmlElement xf_record, IProperty invalid_property) - { - return property.Value.HasValue ? property.Value.Value : 0; - } - - public bool CollectPropertyFromXF(XmlElement xf_record, IProperty invalid_property) - { - int entity_id = GetEntityIdByXF(xf_record); - return property.CollectFromValue(entity_id); - } - - private PropertyId property; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/InlineEntity.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/InlineEntity.cs deleted file mode 100644 index ba1da7d25d..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/InlineEntity.cs +++ /dev/null @@ -1,55 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor.Format -{ - internal abstract class InlineEntity : IStyleEntity - { - public InlineEntity(Workbook workbook) - { - this.workbook = workbook; - } - - - public int GetEntityIdByXF(XmlElement xf_tag) - { - return -1; - } - - abstract public string GetEntityTagName(); - abstract public bool CompareEntities(XmlElement ent1, XmlElement ent2); - - public XmlElement GetEntityTagByXF(XmlElement xf_tag) - { - return (XmlElement)xf_tag.SelectSingleNode("main:" + GetEntityTagName(), workbook.NamespaceManager); - } - - public int ApplyProperty(XmlElement xf_record, IProperty property) - { - XmlElement entity_tag = GetEntityTagByXF(xf_record); - if (entity_tag == null) - { - entity_tag = xf_record.OwnerDocument.CreateElement(GetEntityTagName(), workbook.NamespaceManager.LookupNamespace("main")); - xf_record.AppendChild(entity_tag); - } - - property.SetToEntity(entity_tag); - return -1; - } - - public bool CollectPropertyFromXF(XmlElement xf_record, IProperty property) - { - XmlElement entity_tag = GetEntityTagByXF(xf_record); - return property.CollectFromEntity(entity_tag); - } - - public void SetEntityIdToXF(XmlElement xf_tag, int entity_id) - { - } - - private Workbook workbook; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/NumberFormat/NumberFormatEntity.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/NumberFormat/NumberFormatEntity.cs deleted file mode 100644 index 5941aef41b..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/NumberFormat/NumberFormatEntity.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; - -namespace ASCOfficeEWSEditor.Editor.Format.NumberFormat -{ - internal class NumberFormatEntity : IdStyleEntity - { - public NumberFormatEntity(PropertyId property) - : base(property) - { - } - - public override string GetEntityIdAttribName() - { - return entity_id_attrib_name; - } - - private const string entity_id_attrib_name = "numFmtId"; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Protection/HiddenProperty.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Protection/HiddenProperty.cs deleted file mode 100644 index 52fef13b0a..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Protection/HiddenProperty.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor.Format.Protection -{ - internal class HiddenProperty : PropertyBooleanAttrib - { - public HiddenProperty(bool init_value) - : base(init_value, false) - { - } - - public HiddenProperty() - : base(false) - { - } - - internal override string AttribName { get { return "hidden"; } } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Protection/LockedProperty.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Protection/LockedProperty.cs deleted file mode 100644 index 1f8819259b..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Protection/LockedProperty.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor.Format.Protection -{ - internal class LockedProperty : PropertyBooleanAttrib - { - public LockedProperty(bool init_value) - : base(init_value, true) - { - } - - public LockedProperty() - : base(true) - { - } - - internal override string AttribName { get { return "locked"; } } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Protection/Protection.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Protection/Protection.cs deleted file mode 100644 index 9124a27c6a..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Protection/Protection.cs +++ /dev/null @@ -1,66 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using ASCOfficeEWSEditor.Editor.Walkers; - -namespace ASCOfficeEWSEditor.Editor.Format.Protection -{ - /// - /// Represents a set of cells protection properties. - /// Has permanent link to the range where it was created from - /// - public class Protection - { - internal Protection(RangeWalker range_walker, Workbook workbook) - { - this.range_walker = range_walker; - this.workbook = workbook; - } - - /// - /// Get/set if the cell is hidden. - /// - public bool? Hidden - { - get - { - HiddenProperty property = new HiddenProperty(); - StyleCollector collector = new StyleCollector(new ProtectionEntity(workbook), property, workbook); - range_walker.CollectStatisticsIncludingEmpty(collector); - - return property.Value; - } - set - { - HiddenProperty property = new HiddenProperty(value.Value); - StyleSetter setter = new StyleSetter(new ProtectionEntity(workbook), property, workbook); - range_walker.SetStyles(setter); - } - } - - /// - /// Get/set if the cell is locked. - /// - public bool? Locked - { - get - { - LockedProperty property = new LockedProperty(); - StyleCollector collector = new StyleCollector(new ProtectionEntity(workbook), property, workbook); - range_walker.CollectStatisticsIncludingEmpty(collector); - - return property.Value; - } - set - { - LockedProperty property = new LockedProperty(value.Value); - StyleSetter setter = new StyleSetter(new ProtectionEntity(workbook), property, workbook); - range_walker.SetStyles(setter); - } - } - - private Workbook workbook; - private RangeWalker range_walker; - - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Protection/ProtectionEntity.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Protection/ProtectionEntity.cs deleted file mode 100644 index 6415aee539..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/Protection/ProtectionEntity.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; - -namespace ASCOfficeEWSEditor.Editor.Format.Protection -{ - internal class ProtectionEntity : InlineEntity - { - public ProtectionEntity(Workbook workbook) - : base(workbook) - { - hidden_prop = new HiddenProperty(); - locked_prop = new LockedProperty(); - } - - public override bool CompareEntities(XmlElement ent1, XmlElement ent2) - { - return hidden_prop.CompareEntities(ent1, ent2) && locked_prop.CompareEntities(ent1, ent2); - } - - public override string GetEntityTagName() - { - return entity_tag_name; - } - - private const string entity_tag_name = "property"; - - private HiddenProperty hidden_prop; - private LockedProperty locked_prop; - - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/SeparateEntity.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/SeparateEntity.cs deleted file mode 100644 index a563a032ee..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Format/SeparateEntity.cs +++ /dev/null @@ -1,96 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor.Format -{ - internal abstract class SeparateEntity : IStyleEntity - { - public SeparateEntity(Workbook workbook) - { - this.workbook = workbook; - } - - public int GetEntityIdByXF(XmlElement xf_tag) - { - return XMLInt.ParseOrDefault(xf_tag.GetAttribute(GetEntityIdAttribName()), 0); - } - - public void SetEntityIdToXF(XmlElement xf_tag, int entity_id) - { - xf_tag.SetAttribute(GetEntityIdAttribName(), entity_id.ToString()); - } - - public abstract string GetEntityIdAttribName(); - public abstract string GetEntitiesTagName(); - public abstract string GetEntityTagName(); - public abstract string GetEntityTemplate(); - public abstract bool CompareEntities(XmlElement ent1, XmlElement ent2); - - private XmlElement GetEntityTagByXF(XmlElement xf_tag) - { - XmlNode style_sheet_tag = workbook.StyleSheet.GetStyleSheetOrCreate(); - string entities_tag_name = GetEntitiesTagName(); // Ex: "fonts" - XmlNode entities_tag = style_sheet_tag.SelectSingleNode("main:" + entities_tag_name, workbook.NamespaceManager); // Ex: - if (entities_tag == null) - { - entities_tag = workbook.GetXmlDocument().CreateElement(entities_tag_name, workbook.NamespaceManager.LookupNamespace("main")); // Ex: - style_sheet_tag.AppendChild(entities_tag); - } - string entity_tag_name = GetEntityTagName(); // Ex: "font" - int entity_id = GetEntityIdByXF(xf_tag); // Ex: @fontId = 18 - XmlNode entity_tag = entities_tag.SelectSingleNode("main:" + entity_tag_name + - "[position() = " + (entity_id + 1).ToString() + "]", workbook.NamespaceManager); // Ex: [18 + 1] - if (entity_tag == null) // if the entity_id is wrong - { - entity_tag = entities_tag.SelectSingleNode("main:" + entity_tag_name, workbook.NamespaceManager); // Ex: [1] - if (entity_tag == null) // if the entities container is empty - { - entities_tag.InnerXml = GetEntityTemplate(); // Ex: Create [1] - ((XmlElement)entities_tag).SetAttribute("count", "1"); - entity_tag = entities_tag.FirstChild; - } - } - return (XmlElement)entity_tag; // Ex: - } - - private int GetEqualOrAppliedEntityId(XmlElement entity_with_value_set, XmlNode entities_tag) - { - XmlNodeList entities = entities_tag.SelectNodes("main:" + GetEntityTagName(), workbook.NamespaceManager); - int entity_position = 0; - foreach (XmlElement entity in entities) - { - if (CompareEntities(entity_with_value_set, entity)) - { - break; - } - ++entity_position; - } - if (entity_position == entities.Count) - { - entities_tag.AppendChild(entity_with_value_set); - ((XmlElement)entities_tag).RemoveAttribute("count"); - } - return entity_position; - } - - public int ApplyProperty(XmlElement xf_record, IProperty property) - { - XmlNode entity_tag = GetEntityTagByXF(xf_record); - XmlElement entity_clonned = (XmlElement)entity_tag.Clone(); - property.SetToEntity(entity_clonned); - return GetEqualOrAppliedEntityId(entity_clonned, entity_tag.ParentNode); - } - - public bool CollectPropertyFromXF(XmlElement xf_record, IProperty property) - { - XmlElement entity_tag = GetEntityTagByXF(xf_record); - return property.CollectFromEntity(entity_tag); - } - - - private Workbook workbook; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Hyperlinks/Hyperlink.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Hyperlinks/Hyperlink.cs deleted file mode 100644 index 88959f1069..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Hyperlinks/Hyperlink.cs +++ /dev/null @@ -1,83 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; - -namespace ASCOfficeEWSEditor.Editor.Hyperlinks -{ - /// - /// Hyperlink object - /// - public class Hyperlink - { - internal Hyperlink( Worksheet parent_sheet) - { - this.parent_sheet = parent_sheet; - } - internal Hyperlink(XmlElement hyperlink_xml, Worksheet parent_sheet) - { - this.parent_sheet = parent_sheet; - InitFromXml(hyperlink_xml, parent_sheet); - } - - private void InitFromXml(XmlElement hyperlink_xml, Worksheet parent_sheet) - { - ns_manager = parent_sheet.Workbook.NamespaceManager; - Anchor = hyperlink_xml.GetAttribute("ref"); - string rId = hyperlink_xml.GetAttribute("id", ns_manager.LookupNamespace("mainr")); - if(rId.Length != 0) - { - Target = parent_sheet.Relationships.GetTarget(rId); - ReferredSheet = null; - ReferredRange = ""; - } - else - { - Target = ""; - string location = hyperlink_xml.GetAttribute("location"); - int start_pos = 0; - Worksheet ws_from; - Worksheet ws_to; - if(Calculation.Formulas.ParsedFormula.extract_3D_part(location, ref start_pos, out ws_from, out ws_to, parent_sheet.Workbook)) - { - ReferredSheet = ws_from; - ReferredRange = location.Substring(start_pos); - } - } - } - - /// - /// Whether the hyperlink is of Location (true) or Address (false) type - /// - public bool IsLocationOrAddressType { get { return ReferredSheet != null; } } - - /// - /// Reference target like file path or Internet address - /// - public string Target { get; set; } - /// - /// Location target. Referred worksheet. - /// - public Worksheet ReferredSheet { get; set; } - /// - /// Location target. Referred range of cells. - /// - public string ReferredRange { get; set; } - - /// - /// Location (reference) of the hyperlink. - /// - public string Anchor { get; set; } - - internal Cells.Cell CellAnchor - { - get - { - return new Cells.CellRange(Anchor, parent_sheet.Workbook).TopLeft; - } - } - - private Worksheet parent_sheet; - private XmlNamespaceManager ns_manager; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Hyperlinks/Hyperlinks.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Hyperlinks/Hyperlinks.cs deleted file mode 100644 index 84cf913dec..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Hyperlinks/Hyperlinks.cs +++ /dev/null @@ -1,285 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; - -namespace ASCOfficeEWSEditor.Editor.Hyperlinks -{ - /// - /// Collection of hyperlinks contained in a worksheet - /// - public class Hyperlinks : IEnumerable - { - internal Hyperlinks(Worksheet parent_sheet) - { - this.parent_sheet = parent_sheet; - ns_manager = parent_sheet.Workbook.NamespaceManager; - - hyperlinks_xml = parent_sheet.SheetData.ParentNode.SelectSingleNode("main:hyperlinks", ns_manager); - hyperlink_items = new Dictionary(); - if (hyperlinks_xml != null) - { - foreach (XmlElement hyperlink_xml in hyperlinks_xml.SelectNodes("main:hyperlink", ns_manager)) - { - RegisterHyperlinkItem(new Cells.CellRange(hyperlink_xml.GetAttribute("ref"), parent_sheet.Workbook).TopLeft); - } - } - } - - #region IEnumerable Members - - /// - /// Enumerator - /// - /// Enumerator - public IEnumerator GetEnumerator() - { - return new Enumerator(this); - } - - #endregion - - #region IEnumerable Members - - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() - { - return new Enumerator(this); - } - - #endregion - - /// - /// Count of hyperlinks currently stored in a worksheet - /// - public int Count { get { return hyperlinks_xml != null ? hyperlinks_xml.SelectNodes("main:hyperlink", ns_manager).Count : 0; } } - - /// - /// Access certain cell Hyperlink object. - /// - /// - /// Hyperlink object or null if the cell doesn't have a hyperlink - public Hyperlink this[string cell_reference] - { - get - { - XmlNode hyp_xml = hyperlinks_xml != null ? hyperlinks_xml.SelectSingleNode("main:hyperlink[@ref = '" + cell_reference + "']", ns_manager) : null; - return hyp_xml != null ? new Hyperlink((XmlElement)hyp_xml, parent_sheet) : null; - } - set - { - if(value != null) - { - if (value.IsLocationOrAddressType) - { - AddLocationHyperlink(cell_reference, value.ReferredSheet, value.ReferredRange); - } - else - { - AddAddressHyperlink(cell_reference, value.Target); - } - } - } - } - - internal class Enumerator : IEnumerator - { - public Enumerator(Hyperlinks hyps) - { - this.hyps = hyps; - position = 0; - hyps_num = hyps.Count; - } - - #region IEnumerator Members - - public Hyperlink Current - { - get - { - XmlNode hyp_xml = hyps.hyperlinks_xml != null ? hyps.hyperlinks_xml.SelectSingleNode("main:hyperlink[position() = " + position + "]", hyps.ns_manager) : null; - return hyp_xml != null ? new Hyperlink((XmlElement)hyp_xml, hyps.parent_sheet) : null; - } - } - - #endregion - - #region IDisposable Members - - public void Dispose() - { - } - - #endregion - - #region IEnumerator Members - - object System.Collections.IEnumerator.Current - { - get { return Current; } - } - - public bool MoveNext() - { - if (position + 1 > hyps_num) - { - return false; - } - ++position; - return true; - } - - public void Reset() - { - throw new NotSupportedException(); - } - - #endregion - - private Hyperlinks hyps; - private int position; - private int hyps_num; - } - - /// - /// Add a hyperlink referencing a remote target like file path or Internet Address. - /// Note: Redefine a previously set hyperlink - /// - /// Hyperlink location (anchor) - /// Target address - public void AddAddressHyperlink(string cell_reference, string target_address) - { - XmlElement hyperlink_xml = parent_sheet.SheetData.OwnerDocument.CreateElement("hyperlink", ns_manager.LookupNamespace("main")); - hyperlink_xml.SetAttribute("ref", cell_reference); - string rId = parent_sheet.Relationships.AddTarget(target_address, OOX.Relationships.FileType.hyperlink, true); - hyperlink_xml.SetAttribute("id", ns_manager.LookupNamespace("mainr"), rId); - AppendHyperlinkXml(hyperlink_xml, cell_reference); - SetValueToTheCellIfAbsent(cell_reference, target_address); - SetHyperlinkStyle(cell_reference); - RegisterHyperlinkItem(new Cells.CellRange(cell_reference, parent_sheet.Workbook).TopLeft); - } - - /// - /// Add a hyperlink referencing a local place like certain worksheet and certain cells range. - /// Note: Redefine a previously set hyperlink - /// - /// Hyperlink location (anchor) - /// Referred worksheet - /// Referred cells range - public void AddLocationHyperlink(string cell_reference,Worksheet location_sheet, string location_range_reference) - { - Cells.CellRange3D location = new Cells.CellRange3D(new Cells.CellRange(location_range_reference, parent_sheet.Workbook), location_sheet); - XmlElement hyperlink_xml = parent_sheet.SheetData.OwnerDocument.CreateElement("hyperlink", ns_manager.LookupNamespace("main")); - hyperlink_xml.SetAttribute("ref", cell_reference); - hyperlink_xml.SetAttribute("location", location.ToString()); - AppendHyperlinkXml(hyperlink_xml, cell_reference); - SetValueToTheCellIfAbsent(cell_reference, location.ToString()); - SetHyperlinkStyle(cell_reference); - RegisterHyperlinkItem(new Cells.CellRange(cell_reference, parent_sheet.Workbook).TopLeft); - } - - internal void RemoveHyperlink(Cells.Cell anchor) - { - Calculation.HyperlinkItem h_item; - if(hyperlink_items.TryGetValue(anchor, out h_item)) - { - parent_sheet.Workbook.ValuesUpdateManager.Unregister(parent_sheet.SubjectsStorage.GetCellItemOrCreate(anchor), h_item); - hyperlink_items.Remove(anchor); - } - if(hyperlinks_xml != null) - { - XmlNode existent_hyperlink = hyperlinks_xml.SelectSingleNode("main:hyperlink[@ref = '" + anchor.ToString() + "']", ns_manager); - if (existent_hyperlink != null) - { - hyperlinks_xml.RemoveChild(existent_hyperlink); - } - } - RemoveHyperlinkStyle(anchor.ToString()); - } - - private void AppendHyperlinkXml(XmlNode hyperlink_xml, string cell_reference) - { - if(hyperlinks_xml == null) - { - hyperlinks_xml = parent_sheet.SheetData.OwnerDocument.CreateElement("hyperlinks", ns_manager.LookupNamespace("main")); - parent_sheet.XMLSectionsController.AppendXmlSection(hyperlinks_xml); - } - - XmlNode existent_hyperlink = hyperlinks_xml.SelectSingleNode("main:hyperlink[@ref = '" + cell_reference + "']", ns_manager); - if(existent_hyperlink != null) - { - hyperlinks_xml.RemoveChild(existent_hyperlink); - } - hyperlinks_xml.AppendChild(hyperlink_xml); - } - - private void SetHyperlinkStyle(string cell_reference) - { - Range range = parent_sheet.Range(cell_reference); - range.Format.Font.Underline = true; - range.Format.Font.Color.Rgb = new Format.Colors.RGB(0, 0, 255); - } - private void RemoveHyperlinkStyle(string cell_reference) - { - Range range = parent_sheet.Range(cell_reference); - range.Format.Font.Underline = false; - range.Format.Font.Color.Rgb = new Format.Colors.RGB(0, 0, 0); - } - private void SetValueToTheCellIfAbsent(string cell_reference, string value) - { - Range range = parent_sheet.Range(cell_reference); - if(range.Value.ToString().Length == 0) - { - range.Value = value; - } - } - - public XmlNode HyperlinksXml - { - get { return hyperlinks_xml; } - set { hyperlinks_xml = value.Clone(); } - } - - private void RegisterHyperlinkItem(Cells.Cell anchor) - { - if(!hyperlink_items.ContainsKey(anchor)) - { - Calculation.HyperlinkItem h_item = new Calculation.HyperlinkItem(anchor, parent_sheet); - Calculation.CellItem anchor_item = parent_sheet.SubjectsStorage.GetCellItemOrCreate(anchor); - hyperlink_items.Add(anchor, h_item); - parent_sheet.Workbook.ValuesUpdateManager.Register(anchor_item, h_item); - } - } - - internal void MoveHyperlink(Cells.Cell anchor, Cells.Cell new_anchor) - { - Calculation.HyperlinkItem h_item; - if (hyperlink_items.TryGetValue(anchor, out h_item)) - { - // Re-register - hyperlink_items.Remove(anchor); - parent_sheet.Workbook.ValuesUpdateManager.Unregister(parent_sheet.SubjectsStorage.GetCellItemOrCreate(anchor), h_item); - - Calculation.HyperlinkItem h_new_item = new Calculation.HyperlinkItem(new_anchor, parent_sheet); - hyperlink_items.Add(new_anchor, h_new_item); - parent_sheet.Workbook.ValuesUpdateManager.Register(parent_sheet.SubjectsStorage.GetCellItemOrCreate(new_anchor), h_new_item); - - // Reflect changes in XML - if (hyperlinks_xml != null) - { - XmlElement existent_hyperlink = (XmlElement)hyperlinks_xml.SelectSingleNode("main:hyperlink[@ref = '" + anchor.ToString() + "']", ns_manager); - if (existent_hyperlink != null) - { - existent_hyperlink.SetAttribute("ref", new_anchor.ToString()); - } - } - } - } - - private XmlNode hyperlinks_xml; - - private Worksheet parent_sheet; - private XmlNamespaceManager ns_manager; - - private Dictionary hyperlink_items; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Images/Image.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Images/Image.cs deleted file mode 100644 index eb10786f9f..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Images/Image.cs +++ /dev/null @@ -1,557 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; - -namespace ASCOfficeEWSEditor.Editor.Images -{ - public class Image - { - public Image(XmlNode anchorXml, XmlNamespaceManager manager) - { - if (anchorXml != null) - { - anchor = (XmlElement)anchorXml; - from = (XmlElement)anchorXml.SelectSingleNode("xdr:from", manager); - to = (XmlElement)anchorXml.SelectSingleNode("xdr:to", manager); - pic = (XmlElement)anchorXml.SelectSingleNode("xdr:pic", manager); - clientData = (XmlElement)anchorXml.SelectSingleNode("xdr:clientData", manager); - - } - image_doc_path = null; - image_url = null; - image_guid = Guid.NewGuid().ToString(); - sheet_id = 0; - - xmlManager = manager; - } - - private XmlNamespaceManager xmlManager; - private XmlDocument doc; - public XmlElement anchor, from, to, pic, clientData; - public string image_doc_path; - public string image_url; - public string image_guid; - public int sheet_id; - - #region xdr:from - public int from_col - { - get - { - int retVal = -1; - if (from != null) - { - XmlElement col = (XmlElement)from.SelectSingleNode("xdr:col", xmlManager); - if (col != null) - { - retVal = int.Parse(col.InnerText); - } - } - - return retVal; - } - set - { - if (from != null) - { - XmlElement col = (XmlElement)from.SelectSingleNode("xdr:col", xmlManager); - if (col != null) - { - col.InnerText = value.ToString(); - } - } - } - } - - public int from_colOff - { - get - { - int retVal = -1; - if (from != null) - { - XmlElement colOff = (XmlElement)from.SelectSingleNode("xdr:colOff", xmlManager); - if (colOff != null) - { - retVal = int.Parse(colOff.InnerText); - } - } - - return retVal; - } - set - { - if (from != null) - { - XmlElement colOff = (XmlElement)from.SelectSingleNode("xdr:colOff", xmlManager); - if (colOff != null) - { - colOff.InnerText = value.ToString(); - } - } - } - } - - public int from_row - { - get - { - int retVal = -1; - if (from != null) - { - XmlElement row = (XmlElement)from.SelectSingleNode("xdr:row", xmlManager); - if (row != null) - { - retVal = int.Parse(row.InnerText); - } - } - - return retVal; - } - set - { - if (from != null) - { - XmlElement row = (XmlElement)from.SelectSingleNode("xdr:row", xmlManager); - if (row != null) - { - row.InnerText = value.ToString(); - } - } - } - } - - public int from_rowOff - { - get - { - int retVal = -1; - if (from != null) - { - XmlElement rowOff = (XmlElement)from.SelectSingleNode("xdr:rowOff", xmlManager); - if (rowOff != null) - { - retVal = int.Parse(rowOff.InnerText); - } - } - - return retVal; - } - set - { - if (from != null) - { - XmlElement rowOff = (XmlElement)from.SelectSingleNode("xdr:rowOff", xmlManager); - if (rowOff != null) - { - rowOff.InnerText = value.ToString(); - } - } - } - } - #endregion - - #region xdr:to - public int to_col - { - get - { - int retVal = -1; - if (to != null) - { - XmlElement col = (XmlElement)to.SelectSingleNode("xdr:col", xmlManager); - if (col != null) - { - retVal = int.Parse(col.InnerText); - } - } - - return retVal; - } - set - { - if (to != null) - { - XmlElement col = (XmlElement)to.SelectSingleNode("xdr:col", xmlManager); - if (col != null) - { - col.InnerText = value.ToString(); - } - } - } - } - - public int to_colOff - { - get - { - int retVal = -1; - if (to != null) - { - XmlElement colOff = (XmlElement)to.SelectSingleNode("xdr:colOff", xmlManager); - if (colOff != null) - { - retVal = int.Parse(colOff.InnerText); - } - } - - return retVal; - } - set - { - if (to != null) - { - XmlElement colOff = (XmlElement)to.SelectSingleNode("xdr:colOff", xmlManager); - if (colOff != null) - { - colOff.InnerText = value.ToString(); - } - } - } - } - - public int to_row - { - get - { - int retVal = -1; - if (to != null) - { - XmlElement row = (XmlElement)to.SelectSingleNode("xdr:row", xmlManager); - if (row != null) - { - retVal = int.Parse(row.InnerText); - } - } - - return retVal; - } - set - { - if (to != null) - { - XmlElement row = (XmlElement)to.SelectSingleNode("xdr:row", xmlManager); - if (row != null) - { - row.InnerText = value.ToString(); - } - } - } - } - - public int to_rowOff - { - get - { - int retVal = -1; - if (to != null) - { - XmlElement rowOff = (XmlElement)to.SelectSingleNode("xdr:rowOff", xmlManager); - if (rowOff != null) - { - retVal = int.Parse(rowOff.InnerText); - } - } - - return retVal; - } - set - { - if (to != null) - { - XmlElement rowOff = (XmlElement)to.SelectSingleNode("xdr:rowOff", xmlManager); - if (rowOff != null) - { - rowOff.InnerText = value.ToString(); - } - } - } - } - #endregion - - #region xdr:pic - public int pic_id - { - get - { - int retVal = -1; - if (pic != null) - { - XmlElement id = (XmlElement)pic.SelectSingleNode("xdr:nvPicPr/xdr:cNvPr", xmlManager); - if (id != null) - retVal = int.Parse(id.GetAttribute("id")); - } - - return retVal; - } - set - { - if (pic != null) - { - XmlElement id = (XmlElement)pic.SelectSingleNode("xdr:nvPicPr/xdr:cNvPr", xmlManager); - if (id != null) - id.SetAttribute("id", value.ToString()); - } - } - } - - public string pic_name - { - get - { - string retVal = ""; - if (pic != null) - { - XmlElement name = (XmlElement)pic.SelectSingleNode("xdr:nvPicPr/xdr:cNvPr", xmlManager); - if (name != null) - retVal = name.GetAttribute("name"); - } - - return retVal; - } - set - { - if (pic != null) - { - XmlElement name = (XmlElement)pic.SelectSingleNode("xdr:nvPicPr/xdr:cNvPr", xmlManager); - if (name != null) - name.SetAttribute("name", value.ToString()); - } - } - } - - public string pic_rid - { - get - { - string retVal = ""; - if (pic != null) - { - XmlElement rid = (XmlElement)pic.SelectSingleNode("xdr:blipFill/a:blip", xmlManager); - if (rid != null) - retVal = rid.GetAttribute("embed", xmlManager.LookupNamespace("mainr")); - } - - return retVal; - } - set - { - if (pic != null) - { - XmlElement rid = (XmlElement)pic.SelectSingleNode("xdr:blipFill/a:blip", xmlManager); - if (rid != null) - rid.SetAttribute("r:embed", value); - } - } - } - #endregion - - #region image_xOff - public int image_xOff - { - get - { - int retVal = -1; - if (pic != null) - { - XmlElement cw = (XmlElement)pic.SelectSingleNode("xdr:spPr/a:xfrm/a:off", xmlManager); - if (cw != null) - { - retVal = int.Parse(cw.GetAttribute("x")); - } - } - return retVal; - } - - set - { - if (pic != null) - { - XmlElement cw = (XmlElement)pic.SelectSingleNode("xdr:spPr/a:xfrm/a:off", xmlManager); - if (cw != null) - { - cw.SetAttribute("x", value.ToString()); - } - } - } - } - #endregion - - #region image_yOff - public int image_yOff - { - get - { - int retVal = -1; - if (pic != null) - { - XmlElement ch = (XmlElement)pic.SelectSingleNode("xdr:spPr/a:xfrm/a:off", xmlManager); - if (ch != null) - { - retVal = int.Parse(ch.GetAttribute("y")); - } - } - return retVal; - } - - set - { - if (pic != null) - { - XmlElement ch = (XmlElement)pic.SelectSingleNode("xdr:spPr/a:xfrm/a:off", xmlManager); - if (ch != null) - { - ch.SetAttribute("y", value.ToString()); - } - } - } - } - #endregion - - #region image_width - public int image_width - { - get - { - int retVal = -1; - if (pic != null) - { - XmlElement cw = (XmlElement)pic.SelectSingleNode("xdr:spPr/a:xfrm/a:ext", xmlManager); - if (cw != null) - { - retVal = int.Parse(cw.GetAttribute("cx")); - } - } - return retVal; - } - - set - { - if (pic != null) - { - XmlElement cw = (XmlElement)pic.SelectSingleNode("xdr:spPr/a:xfrm/a:ext", xmlManager); - if (cw != null) - { - cw.SetAttribute("cx", value.ToString()); - } - } - } - } - #endregion - - #region image_height - public int image_height - { - get - { - int retVal = -1; - if (pic != null) - { - XmlElement ch = (XmlElement)pic.SelectSingleNode("xdr:spPr/a:xfrm/a:ext", xmlManager); - if (ch != null) - { - retVal = int.Parse(ch.GetAttribute("cy")); - } - } - return retVal; - } - - set - { - if (pic != null) - { - XmlElement ch = (XmlElement)pic.SelectSingleNode("xdr:spPr/a:xfrm/a:ext", xmlManager); - if (ch != null) - { - ch.SetAttribute("cy", value.ToString()); - } - } - } - } - #endregion - } - - public class DrawingTransFromJson - { - public DrawingTransFromJson() - { - chart = new ChartTransFromJson(); - } - - public int object_id; - public string image_url; - public string object_guid; - public int sheet_id; - - public int object_xOff; - public int object_yOff; - - public int object_width; - public int object_height; - - public int from_col; - public int from_colOff; - public int from_row; - public int from_rowOff; - - public int to_col; - public int to_colOff; - public int to_row; - public int to_rowOff; - - public ChartTransFromJson chart { get; set; } - } - - public class ChartAxisFromJson - { - public bool show; - public bool grid; - public string title; - } - - public class ChartX : ChartAxisFromJson { } - public class ChartY : ChartAxisFromJson { } - - public class ChartLegendFromJson - { - public bool show; - public string legendPos; - public bool overlay; - } - - public class ChartTransFromJson - { - public ChartTransFromJson() - { - seriesList = new List(); - } - - public string chartType; - public string seriesType; - public string title; - public ChartX xAxis; - public ChartY yAxis; - public ChartLegendFromJson legend; - public List seriesList; - } - - public class ChartSeriesTransFromJson - { - public ChartSeriesTransFromJson() - { - valuesList = new List(); - catList = new List(); - } - - public bool showVal; - public string referredrange; - public string name; - public string markerType; - public int markerSize; - public string color; - public string borderColor; - public List valuesList; - public List catList; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/MergeCells.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/MergeCells.cs deleted file mode 100644 index 01a81301de..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/MergeCells.cs +++ /dev/null @@ -1,247 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; - -namespace ASCOfficeEWSEditor.Editor -{ - internal class MergeCells - { - internal MergeCells(Worksheet worksheet, XmlNode xml_worksheet) - { - this.worksheet = worksheet; - this.xml_worksheet = xml_worksheet; - ns_manager = worksheet.Workbook.NamespaceManager; - - mergeCells_xml = xml_worksheet.SelectSingleNode("main:mergeCells", ns_manager); - } - - internal void CalculateMerge() - { - if (m_bIsCalculateMerge) - return; - if (null == mergeCells_xml) - { - m_bIsCalculateMerge = true; - return; - } - - foreach (XmlNode oXmlNodeChild in mergeCells_xml.ChildNodes) - { - try - { - Cells.CellRange oCellRange = new Cells.CellRange(oXmlNodeChild.Attributes["ref"].Value, worksheet.Workbook); - m_arrMergedCells.Add(oCellRange); - } - catch { } - } - - m_bIsCalculateMerge = true; - } - - internal List GetMergedAreas() - { - List list = new List(); - - CalculateMerge(); - - foreach (Cells.CellRange oRange in m_arrMergedCells) - { - list.Add(oRange.ToString()); - } - return list; - } - - internal List GetMergedAreas2() - { - CalculateMerge(); - - return new List(m_arrMergedCells); - } - - internal Cells.CellRange MergedArea(Cells.Cell cell) - { - CalculateMerge(); - - foreach (Cells.CellRange oRange in m_arrMergedCells) - { - if (oRange.Contains(cell)) - return oRange; - } - - return new Cells.CellRange(cell); - } - - public MergeInfo HasMergedCells(Cells.CellRange selected_range) - { - CalculateMerge(); - - foreach (Cells.CellRange oRange in m_arrMergedCells) - { - if (oRange.IsIntersectedWith(selected_range)) - { - if (1 == selected_range.NumCells && oRange.RowFirst == selected_range.RowFirst && - oRange.ColumnFirst == selected_range.ColumnFirst) - return MergeInfo.firstmerge; - - return MergeInfo.merge; - } - } - - return MergeInfo.none; - } - - public void RemoveRange(Cells.CellRange removed_range, Cells.CellRange moved_range, Cells.Offset offset) - { - for (int nIndexCell = 0; nIndexCell < m_arrMergedCells.Count; ++nIndexCell) - { - Cells.CellRange oRange = m_arrMergedCells[nIndexCell]; - bool bIsEdit = false; - if (oRange.IsIntersectedWith(removed_range)) - { - oRange = oRange.Cut(removed_range); - if (oRange == Cells.CellRange.Empty || oRange.IsSingleCell) - { - RemoveMergeCell(nIndexCell); - --nIndexCell; - continue; - } - else - bIsEdit = true; - } - if (moved_range.Contains(oRange.BottomRight)) - { - if (!(oRange.IsSetOfColumns && offset.RowOffset != 0 || oRange.IsSetOfRows && offset.ColumnOffset != 0)) - { - oRange += offset; - bIsEdit = true; - } - } - - if (bIsEdit) - { - m_arrMergedCells[nIndexCell] = oRange; - ((XmlElement)mergeCells_xml.ChildNodes[nIndexCell]).SetAttribute("ref", oRange.ToString()); - } - } - } - - public void InsertRange(Cells.CellRange moved_range, Cells.Offset offset) - { - for (int nIndexCell = 0; nIndexCell < m_arrMergedCells.Count; ++nIndexCell) - { - Cells.CellRange oRange = m_arrMergedCells[nIndexCell]; - if (oRange.IsBoundaryIntersectedWith(moved_range)) - { - oRange = oRange.Resize(offset); - } - if (moved_range.Contains(oRange.BottomRight)) - { - if (!(oRange.IsSetOfColumns && offset.RowOffset != 0 || oRange.IsSetOfRows && offset.ColumnOffset != 0)) - { - oRange += offset; - } - } - - m_arrMergedCells[nIndexCell] = oRange; - ((XmlElement)mergeCells_xml.ChildNodes[nIndexCell]).SetAttribute("ref", oRange.ToString()); - } - } - - public void UnMerge(Cells.CellRange selected_range) - { - CalculateMerge(); - - for (int nIndexCell = 0; nIndexCell < m_arrMergedCells.Count; ++nIndexCell) - { - Cells.CellRange oRange = m_arrMergedCells[nIndexCell]; - if (oRange.IsIntersectedWith(selected_range)) - { - RemoveMergeCell(nIndexCell); - --nIndexCell; - } - } - } - - /// - /// Merges the specified range - /// - /// - /// Resulting range that may differ from the original if the original intersects with another merged range - public Cells.CellRange Merge(Cells.CellRange selected_range) - { - CalculateMerge(); - - Cells.CellRange current_range = selected_range; - bool start_from_the_beginning = true; - while (start_from_the_beginning) - { - start_from_the_beginning = false; - int nIndexCell = 0; - foreach (Cells.CellRange oRange in m_arrMergedCells) - { - if (oRange.IsIntersectedWith(current_range)) - { - RemoveMergeCell(nIndexCell); - current_range = current_range.BoundingBox(oRange); - start_from_the_beginning = true; - break; - } - ++nIndexCell; - } - } - AddMergeCell(current_range); - return current_range; - } - - private void AddMergeCell(Cells.CellRange appended_range) - { - if (mergeCells_xml == null) - { - mergeCells_xml = xml_worksheet.OwnerDocument.CreateElement("mergeCells", ns_manager.LookupNamespace("main")); - worksheet.XMLSectionsController.AppendXmlSection(mergeCells_xml); - } - - XmlElement new_mergeCell_tag = mergeCells_xml.OwnerDocument.CreateElement("mergeCell", ns_manager.LookupNamespace("main")); - new_mergeCell_tag.SetAttribute("ref", appended_range.ToString()); - mergeCells_xml.AppendChild(new_mergeCell_tag); - ((XmlElement)mergeCells_xml).RemoveAttribute("count"); - - m_arrMergedCells.Add(appended_range); - } - - private void RemoveMergeCell(int nIndexCell) - { - m_arrMergedCells.RemoveAt(nIndexCell); - if (mergeCells_xml != null) - { - XmlNode mergeCell_tag = mergeCells_xml.ChildNodes[nIndexCell]; - mergeCell_tag.ParentNode.RemoveChild(mergeCell_tag); - if (0 == m_arrMergedCells.Count) - { - xml_worksheet.RemoveChild(mergeCells_xml); - mergeCells_xml = null; - } - else - { - ((XmlElement)mergeCells_xml).RemoveAttribute("count"); - } - } - } - - public XmlNode MergeCellsXml - { - get { return mergeCells_xml; } - set { mergeCells_xml = value.Clone(); } - } - - private XmlNode mergeCells_xml; - private XmlNode xml_worksheet; - - private Worksheet worksheet; - private XmlNamespaceManager ns_manager; - - private List m_arrMergedCells = new List(); - private bool m_bIsCalculateMerge = false; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/NumberFormat/NumberFormatParser.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/NumberFormat/NumberFormatParser.cs deleted file mode 100644 index bcc757575d..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/NumberFormat/NumberFormatParser.cs +++ /dev/null @@ -1,566 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.RegularExpressions; -using System.Globalization; - -namespace ASCOfficeEWSEditor.Editor.NumberFormat -{ - internal class NumberFormatParser - { - public static object MakeDisplayValue(Calculation.Formulas.DataObjects.IDataObject cell_data, string number_format_string) - { - string sNumFormatLower = number_format_string.ToLower(); - if (sNumFormatLower == "general" || sNumFormatLower == "@" || number_format_string.Length == 0) - { - Calculation.Formulas.DataObjects.ObjectNumber numeric_value = cell_data as Calculation.Formulas.DataObjects.ObjectNumber; - if (numeric_value == null) - { - return cell_data.ToString(); - } - number_format_string = DecodeGeneralFormat(numeric_value.Value); - } - - Calculation.Formulas.DataObjects.ObjectNumber cell_number_data = cell_data as Calculation.Formulas.DataObjects.ObjectNumber; - if (cell_number_data != null) - { - bool has_date_format = false; - string adapted_number_format = ""; - - string[] arrFormats = number_format_string.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); - int nLength = arrFormats.Length; - if (1 == nLength) - { - adapted_number_format = AdaptNumberFormatString(cell_number_data.Value.ToString(), arrFormats[0], out has_date_format); - } - else if (2 == nLength) - { - if (0 <= cell_number_data.Value) - adapted_number_format = AdaptNumberFormatString(cell_number_data.Value.ToString(), arrFormats[0], out has_date_format); - else - adapted_number_format = AdaptNumberFormatString(cell_number_data.Value.ToString(), arrFormats[1], out has_date_format); - } - else if (4 == nLength) - { - if (0 < cell_number_data.Value) - adapted_number_format = AdaptNumberFormatString(cell_number_data.Value.ToString(), arrFormats[0], out has_date_format); - else if (0 > cell_number_data.Value) - adapted_number_format = AdaptNumberFormatString(cell_number_data.Value.ToString(), arrFormats[1], out has_date_format); - else if (0 == cell_number_data.Value) - adapted_number_format = AdaptNumberFormatString(cell_number_data.Value.ToString(), arrFormats[2], out has_date_format); - else - adapted_number_format = AdaptNumberFormatString(cell_number_data.Value.ToString(), arrFormats[3], out has_date_format); - } - - if(has_date_format) - { - double ticks = cell_number_data.Value * 8.64e4; - ticks = Math.Round(ticks); - ticks = ticks * 1e7; - if(ticks >= DateTime.MinValue.Ticks && ticks <= DateTime.MaxValue.Ticks) - { - DateTime date = new DateTime((long)ticks); - try - { - date = date.AddDays(693593); - } - catch - { - return "#####"; - } - return date.ToString(adapted_number_format, new CultureInfo(0x409)); - } - else - { - return "#####"; - } - } - - return cell_number_data.Value.ToString(adapted_number_format, new CultureInfo(0x409)); - } - - Calculation.Formulas.DataObjects.ObjectString cell_text_data = cell_data as Calculation.Formulas.DataObjects.ObjectString; - if(cell_text_data != null) - { - string positive_format; - string negative_format; - string zero_format; - string text_format; - if (SplitFormatString(number_format_string, out positive_format, out negative_format, out zero_format, out text_format)) - { - if (text_format.Length != 0) - { - return ApplyTextFormat(cell_text_data, text_format); - } - } - } - - return cell_data.ToString(); - } - - private static string DecodeGeneralFormat(double number) - { - if(number == 0.0) - { - return "0"; - } - int mantisa_num_digits = (int)Math.Ceiling(Math.Log10(Math.Abs(number))); - string suffix = ""; - int number_of_significant_fixed = 10; - - if (mantisa_num_digits > 0) - { - if (mantisa_num_digits == 10 || mantisa_num_digits == 11) - { - return "0"; - } - else if (mantisa_num_digits > 11) - { - number *= CalculationTables.Power.Pow10(1 - mantisa_num_digits); - suffix = "E+00"; - if(mantisa_num_digits > 99) - { - number_of_significant_fixed = 5; - } - else - { - number_of_significant_fixed = 6; - } - mantisa_num_digits = 1; - } - } - else - { - if(mantisa_num_digits < -3) - { - number *= CalculationTables.Power.Pow10(1 - mantisa_num_digits); - suffix = "E+00"; - if (mantisa_num_digits < -97) - { - number_of_significant_fixed = 5; - } - else - { - number_of_significant_fixed = 6; - } - } - mantisa_num_digits = 1; - } - string number_format_string = "0"; - int nine_digits = (int)((number - Math.Truncate(number)) * CalculationTables.Power.Pow10(number_of_significant_fixed - mantisa_num_digits) + 0.5 * Math.Sign(number)); - for (int i = 0; i < number_of_significant_fixed - mantisa_num_digits; ++i) - { - if (number_format_string.Length != 1) - { - number_format_string += '0'; - } - else - { - int rem; - nine_digits = Math.DivRem(nine_digits, 10, out rem); - if (rem != 0) - { - number_format_string += ".0"; - } - } - } - return number_format_string + suffix; - } - - private static object ApplyTextFormat(Calculation.Formulas.DataObjects.ObjectString cell_text_data, string format_string) - { - string result = ""; - for (int format_pos = 0; format_pos < format_string.Length; ++format_pos) - { - char symb = format_string[format_pos]; - switch (symb) - { - #region "as is" symbols - case '$': - case '-': - case '+': - case '/': - case '(': - case ')': - case ':': - case ' ': - result += format_string[format_pos]; - break; - - case '\\': - if (format_pos + 1 < format_string.Length) - { - result += format_string[++format_pos]; - } - break; - case '\"': - if (format_pos + 1 < format_string.Length) - { - int next_quot_pos = format_string.IndexOf('\"', format_pos + 1); - if (next_quot_pos == -1) - { - return ""; - } - if (next_quot_pos - format_pos > 1) - { - result += format_string.Substring(format_pos + 1, next_quot_pos - format_pos - 1); - } - format_pos = next_quot_pos; - } - break; - - #endregion - #region alignment symbols - case '_': - case '*': - if (format_pos + 1 < format_string.Length) - { - ++format_pos; - } - else - { - result += symb; - } - break; - #endregion - - case '@': - result += cell_text_data.Value; - break; - } - } - return result; - } - private static Regex rx_seconds_fwd = new Regex("\\Gm*([^hmdys]|(\".*\")|\\\\.|_.|\\*.)*s"); - private static Regex rx_ampm_fwd = new Regex("(AM/PM)|(A/P)"); - private static string AdaptNumberFormatString(string strValue, string format_string, out bool has_date_format) - { - has_date_format = false; - string adapted_format_string = ""; - bool h_found = false; - for (int format_pos = 0; format_pos < format_string.Length; ++format_pos) - { - char symb = format_string[format_pos]; - switch (symb) - { - #region ? -> # - case '?': - adapted_format_string += '#'; - break; - #endregion - #region alignment symbols - case '_': - case '*': - if (format_pos + 1 < format_string.Length) - { - ++format_pos; - } - else - { - adapted_format_string += symb; - } - break; - #endregion - #region "as is" symbols - case '\\': - if (format_pos + 1 < format_string.Length) - { - adapted_format_string += "\"" + format_string[++format_pos] + "\""; - } - else - { - adapted_format_string += symb; - } - break; - - case '\"': - if (format_pos + 1 < format_string.Length) - { - int next_quot_pos = format_string.IndexOf('\"', format_pos + 1); - if (next_quot_pos == -1) - { - adapted_format_string += format_string.Substring(format_pos); - format_pos = format_string.Length; - break; - } - adapted_format_string += format_string.Substring(format_pos, next_quot_pos - format_pos + 1); - format_pos = next_quot_pos; - } - else - { - adapted_format_string += symb; - } - break; - #endregion - #region color and conditions - case '[': - if (format_pos + 1 < format_string.Length) - { - int next_quot_pos = format_string.IndexOf(']', format_pos + 1); - if (next_quot_pos == -1) - { - next_quot_pos = format_string.Length - 1; - } - format_pos = next_quot_pos; - } - else - { - adapted_format_string += symb; - } - break; - #endregion - #region Date and time - case 'A': - if(has_date_format) - { - if (format_pos + 4 < format_string.Length && format_string.Substring(format_pos, 5) == "AM/PM") - { - adapted_format_string += "tt"; - format_pos += 4; - } - if (format_pos + 2 < format_string.Length && format_string.Substring(format_pos, 3) == "A/P") - { - adapted_format_string += 't'; - format_pos += 2; - } - } - break; - case 'h': - if (format_pos + 1 < format_string.Length && rx_ampm_fwd.Match(format_string, format_pos + 1).Success) - { - adapted_format_string += 'h'; - } - else - { - adapted_format_string += 'H'; - } - h_found = true; - has_date_format = true; - break; - case 'M': - adapted_format_string += 'M'; - has_date_format = true; - break; - case 'm': - if (h_found || format_pos + 1 < format_string.Length && rx_seconds_fwd.Match(format_string, format_pos + 1).Success) - { - adapted_format_string += 'm'; - } - else - { - adapted_format_string += 'M'; - } - has_date_format = true; - break; - case 'D': - case 'd': - case 'Y': - case 'y': - has_date_format = true; - adapted_format_string += symb.ToString().ToLower(); - break; - case 's': - has_date_format = true; - adapted_format_string += symb; - break; - case '0': - if (has_date_format) - { - adapted_format_string += 'f'; - } - else - { - adapted_format_string += symb; - } - break; - #endregion - #region @ - case '@': - adapted_format_string += strValue; - break; - #endregion - default: - adapted_format_string += symb; - break; - } - } - - return adapted_format_string; - } - - private static bool HasDateFormat(string format_string) - { - bool has; - AdaptNumberFormatString("", format_string, out has); - return has; - } - - internal static string IncreaseDecimal(string format_string) - { - if (!HasDateFormat(format_string)) - { - int period_pos = FindLastSymbolPosition(format_string, "."); - if(period_pos != -1) - { - return format_string.Insert(period_pos + 1, "0"); - } - else - { - int zero_pos = FindLastSymbolPosition(format_string, "0#?"); - if (zero_pos != -1) - { - return format_string.Insert(zero_pos + 1, ".0"); - } - } - } - return format_string; - } - - internal static string DecreaseDecimal(string format_string) - { - if (!HasDateFormat(format_string)) - { - int period_pos = FindLastSymbolPosition(format_string, "."); - if (period_pos != -1 && period_pos + 1 != format_string.Length) - { - char symb_after_period = format_string[period_pos + 1]; - if (symb_after_period == '0' || symb_after_period == '#' || symb_after_period == '?') - { - if (period_pos + 2 == format_string.Length || FindLastSymbolPosition(format_string.Substring(period_pos + 2), "0#?") == -1) - { - return format_string.Remove(period_pos, 2); - } - else - { - return format_string.Remove(period_pos + 1, 1); - } - } - } - } - return format_string; - } - - internal static string IncreaseDecimalGeneral(Calculation.Formulas.DataObjects.IDataObject data_value) - { - Calculation.Formulas.DataObjects.ObjectNumber numeric_value = data_value as Calculation.Formulas.DataObjects.ObjectNumber; - if (numeric_value == null) - { - return "General"; - } - - return IncreaseDecimal(DecodeGeneralFormat(numeric_value.Value)); - } - - internal static string DecreaseDecimalGeneral(Calculation.Formulas.DataObjects.IDataObject data_value) - { - Calculation.Formulas.DataObjects.ObjectNumber numeric_value = data_value as Calculation.Formulas.DataObjects.ObjectNumber; - if (numeric_value == null) - { - return "General"; - } - - return DecreaseDecimal(DecodeGeneralFormat(numeric_value.Value)); - } - - private static int FindLastSymbolPosition(string format_string, string searched_symbols) - { - int last_found_position = -1; - for (int format_pos = 0; format_pos < format_string.Length; ++format_pos) - { - char symb = format_string[format_pos]; - switch (symb) - { - #region alignment symbols - case '_': - case '*': - if (format_pos + 1 < format_string.Length) - { - ++format_pos; - } - break; - #endregion - #region "as is" symbols - case '\\': - if (format_pos + 1 < format_string.Length) - { - ++format_pos; - } - break; - case '\"': - if (format_pos + 1 < format_string.Length) - { - int next_quot_pos = format_string.IndexOf('\"', format_pos + 1); - if (next_quot_pos == -1) - { - format_pos = format_string.Length; - break; - } - format_pos = next_quot_pos; - } - break; - #endregion - #region color and conditions - case '[': - if (format_pos + 1 < format_string.Length) - { - int next_quot_pos = format_string.IndexOf(']', format_pos + 1); - if (next_quot_pos == -1) - { - next_quot_pos = format_string.Length - 1; - } - format_pos = next_quot_pos; - } - break; - #endregion - // Stop searching on exponent found - case 'E': - case 'e': - return last_found_position; - default: - if (searched_symbols.LastIndexOf(symb) != -1) - { - last_found_position = format_pos; - } - break; - } - } - return last_found_position; - } - private static Regex sections_splitter = new Regex("^(?([^;]|\\\\;|(\".*\")|_;|\\*;)+)(;(?([^;]|\\\\;|(\".*\")|_;|\\*;)*)(;(?([^;]|\\\\;|(\".*\")|_;|\\*;)*)(;(?([^;]|\\\\;|(\".*\")|_;|\\*;)*))?)?)?$"); - internal static bool SplitFormatString(string format_string, out string positive, out string negative, out string zero, out string text) - { - Match match = sections_splitter.Match(format_string); - if (match.Success) - { - GroupCollection groups = match.Groups; - positive = groups["positive"].Value; - negative = groups["negative"].Value; - zero = groups["zero"].Value; - text = groups["text"].Value; - return true; - } - positive = negative = zero = text = ""; - return false; - } - - internal static string MergeFormatString(string positive, string negative, string zero, string text) - { - if(text.Length != 0) - { - return positive + ";" + negative + ";" + zero + ";" + text; - } - else if (zero.Length != 0) - { - return positive + ";" + negative + ";" + zero; - } - else if (negative.Length != 0) - { - return positive + ";" + negative; - } - else - { - return positive; - } - } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/NumberFormat/NumberFormatsStorage.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/NumberFormat/NumberFormatsStorage.cs deleted file mode 100644 index 790a23b61b..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/NumberFormat/NumberFormatsStorage.cs +++ /dev/null @@ -1,67 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.NumberFormat -{ - /// - /// Internal number formats storage - /// - public class NumberFormatsStorage - { - internal NumberFormatsStorage() - { - FormatStrings = new SortedList(); - FillIn(); - } - - private void FillIn() - { - FormatStrings.Add(0, "General"); - FormatStrings.Add(1, "0"); - FormatStrings.Add(2, "0.00"); - FormatStrings.Add(3, "#,##0"); - FormatStrings.Add(4, "#,##0.00"); - FormatStrings.Add(9, "0%"); - FormatStrings.Add(10, "0.00%"); - FormatStrings.Add(11, "0.00E+00"); - FormatStrings.Add(12, "# ?/?"); - FormatStrings.Add(13, "# ??/??"); - FormatStrings.Add(14, "mm-dd-yy"); - FormatStrings.Add(15, "d-mmm-yy"); - FormatStrings.Add(16, "d-mmm"); - FormatStrings.Add(17, "mmm-yy"); - FormatStrings.Add(18, "h:mm AM/PM"); - FormatStrings.Add(19, "h:mm:ss AM/PM"); - FormatStrings.Add(20, "h:mm"); - FormatStrings.Add(21, "h:mm:ss"); - FormatStrings.Add(22, "m/d/yy h:mm"); - FormatStrings.Add(37, "#,##0 ;(#,##0)"); - FormatStrings.Add(38, "#,##0 ;[Red](#,##0)"); - FormatStrings.Add(39, "#,##0.00;(#,##0.00)"); - FormatStrings.Add(40, "#,##0.00;[Red](#,##0.00)"); - FormatStrings.Add(45, "mm:ss"); - FormatStrings.Add(46, "[h]:mm:ss"); - FormatStrings.Add(47, "mmss.0"); - FormatStrings.Add(48, "##0.0E+0"); - FormatStrings.Add(49, "@"); - } - - internal int GetIdByCode(string number_format) - { - foreach (KeyValuePair format in FormatStrings) - { - if(format.Value == number_format) - { - return format.Key; - } - } - return -1; - } - - /// - /// List of all standard number format strings - /// - public SortedList FormatStrings { get; private set; } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/OOX/ChartsheetFile.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/OOX/ChartsheetFile.cs deleted file mode 100644 index 7de0595b10..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/OOX/ChartsheetFile.cs +++ /dev/null @@ -1,62 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.Helpers; - -namespace ASCOfficeEWSEditor.Editor.OOX -{ - internal class ChartsheetFile : XmlFile, IOrderedSections - { - public ChartsheetFile(OOX.ContentTypes content_types, Relationships relationships, Workbook workbook) - : base(content_types, relationships, workbook.GetRootTag().ParentNode.ParentNode, - OOXNavigate.CreateUniqueFilePath(cs_rel_path_template, workbook.GetRootTag().ParentNode.ParentNode), - Relationships.FileType.chartsheet, ContentTypes.FileType.chartsheet) - { - ns_manager = new XmlNamespaceManager(workbook.GetRootTag().OwnerDocument.NameTable); - ns_manager.AddNamespace("main", "http://schemas.openxmlformats.org/spreadsheetml/2006/main"); - InitOrderedSections(); - } - - // Called when the file already exists - public ChartsheetFile(string sheet_path, ContentTypes content_types, Relationships relationships, Workbook workbook) - : base(content_types, relationships, workbook.GetRootTag().ParentNode.ParentNode, sheet_path, - Relationships.FileType.chartsheet, ContentTypes.FileType.chartsheet) - { - ns_manager = new XmlNamespaceManager(workbook.GetRootTag().OwnerDocument.NameTable); - ns_manager.AddNamespace("main", "http://schemas.openxmlformats.org/spreadsheetml/2006/main"); - InitOrderedSections(); - } - - private void InitOrderedSections() - { - sections_names_backward = new List() - { "extLst", "webPublishItems", "picture", "drawingHF", "drawing", "headerFooter", - "pageSetup", "pageMargins", "customSheetViews", "sheetProtection", "sheetViews", "sheetPr", }; - } - - public XmlNode GetChartsheetTag() - { - XmlNode file_tag = GetRootTag(); - if (file_tag == null || file_tag.LocalName != "chartsheet") - { - return null; - } - return file_tag; - } - - #region IOrderedSections Members - - public void AppendXmlSection(XmlNode section_node) - { - GetChartsheetTag(); - AppendXmlSection(section_node, sections_names_backward, ns_manager); - } - - #endregion - - const string cs_rel_path_template = "chartsheets/sheet.xml"; - XmlNamespaceManager ns_manager; - private List sections_names_backward; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/OOX/ContentTypes.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/OOX/ContentTypes.cs deleted file mode 100644 index 35cea7b0a0..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/OOX/ContentTypes.cs +++ /dev/null @@ -1,91 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; - -namespace ASCOfficeEWSEditor.Editor.OOX -{ - internal class ContentTypes - { - public ContentTypes(XmlDocument xml_document) - { - ns_manager = new XmlNamespaceManager(xml_document.NameTable); - ns_manager.AddNamespace("types", "http://schemas.openxmlformats.org/package/2006/content-types"); - ns_manager.AddNamespace("main", "http://schemas.openxmlformats.org/spreadsheetml/2006/main"); - FillInTypes(); - content_types = xml_document.SelectSingleNode("/root/file[@name = '[Content_Types].xml']/types:Types", ns_manager); - } - - public void RegisterFile(XmlNode file_tag, FileType type) - { - string file_path_absolute = Helpers.OOXNavigate.DetermineAbsolutePath(file_tag); - RegisterFile(file_path_absolute, type); - } - - public void RegisterFile(string file_path_absolute, FileType type) - { - XmlElement type_tag = content_types.OwnerDocument.CreateElement("Override", ns_manager.LookupNamespace("types")); - content_types.AppendChild(type_tag); - type_tag.SetAttribute("PartName", file_path_absolute); - type_tag.SetAttribute("ContentType", types[type]); - } - - public void DeRegisterFile(XmlNode file_tag) - { - string file_path_absolute = Helpers.OOXNavigate.DetermineAbsolutePath(file_tag); - XmlNode type_tag = content_types.SelectSingleNode("types:Override[@PartName = '" + file_path_absolute + "']", ns_manager); - if (null != type_tag) - { - content_types.RemoveChild(type_tag); - } - } - - public void RegisterFileType(string extension, FileType type) - { - XmlElement type_tag = content_types.OwnerDocument.CreateElement("Default", ns_manager.LookupNamespace("types")); - content_types.AppendChild(type_tag); - type_tag.SetAttribute("Extension", extension); - type_tag.SetAttribute("ContentType", types[type]); - } - - private void FillInTypes() - { - types = new Dictionary(); - types[FileType.worksheet] = "application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"; - types[FileType.chartsheet] = "application/vnd.openxmlformats-officedocument.drawingml.chart+xml"; - types[FileType.workbook] = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"; - types[FileType.styles] = "application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml"; - types[FileType.sharedStrings] = "application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml"; - types[FileType.calcChain] = "application/vnd.openxmlformats-officedocument.spreadsheetml.calcChain+xml"; - types[FileType.comments] = "application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml"; - types[FileType.drawing] = "application/vnd.openxmlformats-officedocument.drawing+xml"; - types[FileType.theme] = "application/vnd.openxmlformats-officedocument.theme+xml"; - - types[FileType.xml] = "application/xml"; - types[FileType.rels] = "application/vnd.openxmlformats-package.relationships+xml"; - types[FileType.bin] = "application/vnd.openxmlformats-officedocument.spreadsheetml.printerSettings"; - types[FileType.png] = "image/png"; - types[FileType.bmp] = "image/bmp"; - types[FileType.jpeg] = "image/jpeg"; - types[FileType.gif] = "image/gif"; - types[FileType.tiff] = "image/tiff"; - types[FileType.emf] = "image/emf"; - types[FileType.wmf] = "image/wmf"; - types[FileType.tga] = "image/tga"; - types[FileType.vml] = "application/vnd.openxmlformats-officedocument.vmlDrawing"; - - types[FileType.table] = "application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml"; - } - - public enum FileType { worksheet, chartsheet, workbook, styles, sharedStrings, calcChain, comments, drawing, theme, - xml, rels, bin, png, bmp, jpeg, gif, tiff, emf, wmf, tga, vml, table}; -#region XML regions - private XmlNode content_types; - private XmlNamespaceManager ns_manager; -#endregion - - private Dictionary types; - - - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/OOX/IOrderedSections.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/OOX/IOrderedSections.cs deleted file mode 100644 index 4f1d97c71b..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/OOX/IOrderedSections.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; - -namespace ASCOfficeEWSEditor.Editor.OOX -{ - internal interface IOrderedSections - { - void AppendXmlSection(XmlNode section_node); - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/OOX/Relationships.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/OOX/Relationships.cs deleted file mode 100644 index 45311ce29d..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/OOX/Relationships.cs +++ /dev/null @@ -1,174 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor.OOX -{ - internal class Relationships - { - public Relationships(XmlNode file_tag) - { - ns_manager = new XmlNamespaceManager(file_tag.OwnerDocument.NameTable); - ns_manager.AddNamespace("r", "http://schemas.openxmlformats.org/package/2006/relationships"); - referenced_file_tag = file_tag; - rels_tag = GetRelationshipsTag(false); - FillInTypes(); - } - - public string GetTarget(string rId) - { - if (null == rels_tag) - { - return ""; - } - else - { - XmlNode target = rels_tag.SelectSingleNode("r:Relationship[@Id = '" + rId + "']/@Target", ns_manager); - return null == target ? "" : target.InnerText; - } - } - - public string GetId(string target) - { - if (null == rels_tag) - { - return ""; - } - else - { - XmlNode id = rels_tag.SelectSingleNode("r:Relationship[@Target = '" + target + "']/@Id", ns_manager); - return null == id ? "" : id.InnerText; - } - } - - public string GetTarget(FileType rel_type) - { - XmlNode target = rels_tag.SelectSingleNode("r:Relationship[@Type = '" + types[rel_type] + "']/@Target", ns_manager); - return null == target ? "" : target.InnerText; - } - - public string AddTarget(string target, FileType type, bool external_mode) - { - if (rels_tag == null) - { - rels_tag = GetRelationshipsTag(true); - } - XmlElement rel = rels_tag.OwnerDocument.CreateElement("Relationship", ns_manager.LookupNamespace("r")); - int max_id = 0; - foreach (XmlNode id_tag in rels_tag.SelectNodes("r:Relationship/@Id", ns_manager)) - { - int id = XMLInt.ParseOrDefault(id_tag.InnerText.Substring(3), 0); - if (id > max_id) - { - max_id = id; - } - } - string rId = "rId" + (max_id + 1).ToString(); - rel.SetAttribute("Id", rId); - rel.SetAttribute("Type", types[type]); - rel.SetAttribute("Target", target); - if(external_mode) - { - rel.SetAttribute("TargetMode", "External"); - } - rels_tag.AppendChild(rel); - - return rId; - } - - public int GetLastRid() - { - if (rels_tag == null) - { - rels_tag = GetRelationshipsTag(true); - } - - int max_id = 0; - foreach (XmlNode id_tag in rels_tag.SelectNodes("r:Relationship/@Id", ns_manager)) - { - int id = XMLInt.ParseOrDefault(id_tag.InnerText.Substring(3), 0); - if (id > max_id) - { - max_id = id; - } - } - return max_id; - } - - public void RemoveTarget(string rId) - { - XmlNode rel = rels_tag.SelectSingleNode("r:Relationship[@Id = '" + rId + "']", ns_manager); - if (null != rel) - { - rels_tag.RemoveChild(rel); - } - } - - public void RemoveTarget(FileType rel_type) - { - XmlNode rel = rels_tag.SelectSingleNode("r:Relationship[@Type = '" + types[rel_type] + "']", ns_manager); - if (null != rel) - { - rels_tag.RemoveChild(rel); - } - } - - private XmlNode GetRelationshipsTag(bool create_if_absent) - { - XmlNode file_name_tag = referenced_file_tag.SelectSingleNode("@name"); - if (null == file_name_tag) - { - return null; - } - string file_name = file_name_tag.InnerText; - if ("[Content_Types].xml" == file_name) - { - file_name = ""; - } - XmlNode ret_tag = referenced_file_tag.SelectSingleNode("../dir[@name = '_rels']/file[@name = '" + file_name + ".rels']/r:Relationships", ns_manager); - if (ret_tag == null && create_if_absent) - { - XmlNode file_tag = Helpers.OOXNavigate.AddFile("_rels/" + file_name + ".rels", referenced_file_tag.ParentNode, false); - ret_tag = file_tag.OwnerDocument.CreateElement("Relationships", ns_manager.LookupNamespace("r")); - file_tag.AppendChild(ret_tag); - } - return ret_tag; - } - private void FillInTypes() - { - types = new Dictionary(); - types[FileType.worksheet] = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet"; - types[FileType.workbook] = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"; - types[FileType.styles] = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles"; - types[FileType.sharedStrings] = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings"; - types[FileType.calcChain] = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/calcChain"; - types[FileType.comments] = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments"; - types[FileType.drawing] = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing"; - types[FileType.vmlDrawing] = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing"; - types[FileType.theme] = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme"; - types[FileType.printerSettings] = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/printerSettings"; - types[FileType.image] = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image"; - types[FileType.hyperlink] = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink"; - types[FileType.chartsheet] = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/chartsheet"; - types[FileType.chart] = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart"; - types[FileType.table] = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/table"; - } - - - public enum FileType - { - worksheet, workbook, styles, sharedStrings, calcChain, comments, drawing, vmlDrawing, theme, printerSettings, image, - hyperlink, chartsheet, chart, table - }; - -#region XML references - private XmlNode rels_tag; - private XmlNode referenced_file_tag; -#endregion - private Dictionary types; - - XmlNamespaceManager ns_manager; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/OOX/SharedStringsFile.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/OOX/SharedStringsFile.cs deleted file mode 100644 index 57e24ba9f1..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/OOX/SharedStringsFile.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; - -namespace ASCOfficeEWSEditor.Editor.OOX -{ - internal class SharedStringsFile : XmlFile - { - public SharedStringsFile(ContentTypes content_types, Relationships relationships, Workbook workbook) - : base(content_types, relationships, workbook.GetRootTag().ParentNode.ParentNode, sst_rel_path, - Relationships.FileType.sharedStrings, ContentTypes.FileType.sharedStrings) - { - ns_manager = workbook.NamespaceManager; - } - - public XmlElement GetSST() - { - XmlNode file_tag = GetRootTag(); - if (file_tag == null || file_tag.LocalName != "sst") - { - return null; - } - return (XmlElement)file_tag; - } - - public XmlElement GetSSTOrCreate() - { - return GetSST() ?? CreateSST(); - } - - private XmlElement CreateSST() - { - XmlNode file_tag = GetFileTagOrCreate(); - XmlElement sst_tag = file_tag.OwnerDocument.CreateElement("sst", ns_manager.LookupNamespace("main")); - sst_tag.SetAttribute("count", "0"); - sst_tag.SetAttribute("uniqueCount", "0"); - file_tag.AppendChild(sst_tag); - return sst_tag; - } - - const string sst_rel_path = "sharedStrings.xml"; - XmlNamespaceManager ns_manager; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/OOX/StyleSheetFile.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/OOX/StyleSheetFile.cs deleted file mode 100644 index da16b6e6d1..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/OOX/StyleSheetFile.cs +++ /dev/null @@ -1,58 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; - -namespace ASCOfficeEWSEditor.Editor.OOX -{ - internal class StyleSheetFile : XmlFile, IOrderedSections - { - public StyleSheetFile(ContentTypes content_types, Relationships relationships, Workbook workbook) - : base(content_types, relationships, workbook.GetRootTag().ParentNode.ParentNode, styles_rel_path, - Relationships.FileType.styles, ContentTypes.FileType.styles) - { - ns_manager = workbook.NamespaceManager; - sections_names_backward = new List() - { "extLst", "colors", "tableStyles", "dxfs", "cellStyles", "cellXfs", "cellStyleXfs", - "borders", "fills", "fonts", "numFmts"}; - - } - - public XmlNode GetStyleSheet() - { - XmlNode file_tag = GetRootTag(); - if (file_tag == null || file_tag.LocalName != "styleSheet") - { - return null; - } - return file_tag; - } - - public XmlNode GetStyleSheetOrCreate() - { - return GetStyleSheet() ?? CreateStyleSheet(); - } - - private XmlNode CreateStyleSheet() - { - XmlNode file_tag = GetFileTagOrCreate(); - XmlElement sst_tag = file_tag.OwnerDocument.CreateElement("styleSheet", ns_manager.LookupNamespace("main")); - file_tag.AppendChild(sst_tag); - return sst_tag; - } - - #region IOrderedSections Members - - public void AppendXmlSection(XmlNode section_node) - { - GetStyleSheetOrCreate(); - AppendXmlSection(section_node, sections_names_backward, ns_manager); - } - - #endregion - - private const string styles_rel_path = "styles.xml"; - private XmlNamespaceManager ns_manager; - private List sections_names_backward; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/OOX/TableFile.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/OOX/TableFile.cs deleted file mode 100644 index d07d123f89..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/OOX/TableFile.cs +++ /dev/null @@ -1,57 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.Helpers; - -namespace ASCOfficeEWSEditor.Editor.OOX -{ - internal class TableFile : XmlFile - { - public TableFile(OOX.ContentTypes content_types, Relationships relationships, Workbook workbook) - : base(content_types, relationships, workbook.GetRootTag().ParentNode, - OOXNavigate.CreateUniqueFilePath(table_rel_path_template, workbook.GetRootTag().ParentNode), - Relationships.FileType.table, ContentTypes.FileType.table) - { - ns_manager = new XmlNamespaceManager(workbook.GetRootTag().OwnerDocument.NameTable); - ns_manager.AddNamespace("main", "http://schemas.openxmlformats.org/spreadsheetml/2006/main"); - } - - // Called when the file already exists - public TableFile(string table_path, ContentTypes content_types, Relationships relationships, Workbook workbook) - : base(content_types, relationships, workbook.GetRootTag().ParentNode, table_path, - Relationships.FileType.table, ContentTypes.FileType.table) - { - ns_manager = new XmlNamespaceManager(workbook.GetRootTag().OwnerDocument.NameTable); - ns_manager.AddNamespace("main", "http://schemas.openxmlformats.org/spreadsheetml/2006/main"); - } - - public XmlElement GetTable() - { - XmlNode file_tag = GetRootTag(); - if (file_tag == null || file_tag.LocalName != "table") - { - return null; - } - return (XmlElement)file_tag; - } - - public XmlElement GetTableOrCreate() - { - return GetTable() ?? CreateTable(); - } - - private XmlElement CreateTable() - { - XmlNode file_tag = GetFileTagOrCreate(); - XmlElement sst_tag = file_tag.OwnerDocument.CreateElement("table", ns_manager.LookupNamespace("main")); - sst_tag.SetAttribute("id", "-1"); - sst_tag.SetAttribute("totalsRowShown", "0"); - file_tag.AppendChild(sst_tag); - return sst_tag; - } - - const string table_rel_path_template = "../tables/table.xml"; - XmlNamespaceManager ns_manager; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/OOX/ThemeFile.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/OOX/ThemeFile.cs deleted file mode 100644 index 54d6e913ca..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/OOX/ThemeFile.cs +++ /dev/null @@ -1,57 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; - -namespace ASCOfficeEWSEditor.Editor.OOX -{ - internal class ThemeFile : XmlFile, IOrderedSections - { - public ThemeFile(ContentTypes content_types, Relationships relationships, Workbook workbook) - : base(content_types, relationships, workbook.GetRootTag().ParentNode.ParentNode, theme_rel_path, - Relationships.FileType.theme, ContentTypes.FileType.theme) - { - ns_manager = new XmlNamespaceManager(workbook.GetXmlDocument().NameTable); ; - ns_manager.AddNamespace("a", "http://schemas.openxmlformats.org/drawingml/2006/main"); - sections_names_backward = new List() - { "extLst", "custClrLst", "extraClrSchemeLst", "objectDefaults", "themeElements"}; - } - - public XmlNode GetTheme() - { - XmlNode file_tag = GetRootTag(); - if (file_tag == null || file_tag.LocalName != "theme") - { - return null; - } - return file_tag; - } - - public XmlNode GetThemeOrCreate() - { - return GetTheme() ?? CreateTheme(); - } - - private XmlNode CreateTheme() - { - XmlNode file_tag = GetFileTagOrCreate(); - XmlElement theme_tag = file_tag.OwnerDocument.CreateElement("theme", ns_manager.LookupNamespace("a")); - file_tag.AppendChild(theme_tag); - return theme_tag; - } - - #region IOrderedSections Members - - public void AppendXmlSection(XmlNode section_node) - { - GetThemeOrCreate(); - AppendXmlSection(section_node, sections_names_backward, ns_manager); - } - - #endregion - - const string theme_rel_path = "theme/theme1.xml"; - XmlNamespaceManager ns_manager; - private List sections_names_backward; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/OOX/WorkbookFile.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/OOX/WorkbookFile.cs deleted file mode 100644 index a69715cf6e..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/OOX/WorkbookFile.cs +++ /dev/null @@ -1,59 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; - -namespace ASCOfficeEWSEditor.Editor.OOX -{ - internal class WorkbookFile : XmlFile, IOrderedSections - { - public WorkbookFile(ContentTypes content_types, Relationships relationships, Workbook workbook) - : base(content_types, relationships, workbook.GetRootTag().ParentNode.ParentNode, workbook_rel_path, - Relationships.FileType.styles, ContentTypes.FileType.styles) - { - ns_manager = workbook.NamespaceManager; - sections_names_backward = new List() - { "extLst", "webPublishObjects", "fileRecoveryPr", "webPublishing", "smartTagTypes", "smartTagPr", "pivotCaches", - "customWorkbookViews", "oleSize", "calcPr", "definedNames", "externalReferences", "functionGroups", "sheets", - "bookViews", "workbookProtection", "workbookPr", "fileSharing", "fileVersion"}; - - } - - public XmlNode GetWorkbook() - { - XmlNode file_tag = GetRootTag(); - if (file_tag == null || file_tag.LocalName != "styleSheet") - { - return null; - } - return file_tag; - } - - public XmlNode GetWorkbookOrCreate() - { - return GetWorkbook() ?? CreateWorkbook(); - } - - private XmlNode CreateWorkbook() - { - XmlNode file_tag = GetFileTagOrCreate(); - XmlElement sst_tag = file_tag.OwnerDocument.CreateElement("workbook", ns_manager.LookupNamespace("main")); - file_tag.AppendChild(sst_tag); - return sst_tag; - } - - #region IOrderedSections Members - - public void AppendXmlSection(XmlNode section_node) - { - GetWorkbookOrCreate(); - AppendXmlSection(section_node, sections_names_backward, ns_manager); - } - - #endregion - - private const string workbook_rel_path = "workbook.xml"; - private XmlNamespaceManager ns_manager; - private List sections_names_backward; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/OOX/WorksheetFile.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/OOX/WorksheetFile.cs deleted file mode 100644 index 57a4ace93a..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/OOX/WorksheetFile.cs +++ /dev/null @@ -1,78 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.Helpers; - -namespace ASCOfficeEWSEditor.Editor.OOX -{ - internal class WorksheetFile : XmlFile, IOrderedSections - { - public WorksheetFile(OOX.ContentTypes content_types, Relationships relationships, Workbook workbook) - : base(content_types, relationships, workbook.GetRootTag().ParentNode.ParentNode, - OOXNavigate.CreateUniqueFilePath(ws_rel_path_template, workbook.GetRootTag().ParentNode.ParentNode), - Relationships.FileType.worksheet, ContentTypes.FileType.worksheet) - { - ns_manager = new XmlNamespaceManager(workbook.GetRootTag().OwnerDocument.NameTable); - ns_manager.AddNamespace("main", "http://schemas.openxmlformats.org/spreadsheetml/2006/main"); - InitOrderedSections(); - } - - // Called when the file already exists - public WorksheetFile(string sheet_path, ContentTypes content_types, Relationships relationships, Workbook workbook) - : base(content_types, relationships, workbook.GetRootTag().ParentNode.ParentNode, sheet_path, - Relationships.FileType.worksheet, ContentTypes.FileType.worksheet) - { - ns_manager = new XmlNamespaceManager(workbook.GetRootTag().OwnerDocument.NameTable); - ns_manager.AddNamespace("main", "http://schemas.openxmlformats.org/spreadsheetml/2006/main"); - InitOrderedSections(); - } - - private void InitOrderedSections() - { - sections_names_backward = new List() - { "extLst", "tableParts", "webPublishItems", "controls", "oleObjects", "picture", "drawingHF", - "drawing", "smartTags", "ignoredErrors", "cellWatches", "customProperties", "colBreaks", "rowBreaks", - "headerFooter", "pageSetup", "pageMargins", "printOptions", "hyperlinks","dataValidations", - "conditionalFormatting", "phoneticPr", "mergeCells", "customSheetViews", "dataConsolidate", - "sortState", "autoFilter", "scenarios", "protectedRanges", "sheetProtection", "sheetCalcPr", - "sheetData", "cols", "sheetFormatPr", "sheetViews", "dimension", "sheetPr", }; - } - - public XmlNode GetWorksheetTag() - { - XmlNode file_tag = GetRootTag(); - if (file_tag == null || file_tag.LocalName != "worksheet") - { - return null; - } - return file_tag; - } - - public XmlNode GetWorksheetTagOrCreate() - { - return GetWorksheetTag() ?? CreateWorksheetTag(); - } - - private XmlNode CreateWorksheetTag() - { - XmlNode file_tag = GetFileTagOrCreate(); - file_tag.InnerXml = Resource1.empty_sheet; // Creates worksheet from template - return file_tag.FirstChild; - } - - #region IOrderedSections Members - - public void AppendXmlSection(XmlNode section_node) - { - GetWorksheetTagOrCreate(); - AppendXmlSection(section_node, sections_names_backward, ns_manager); - } - - #endregion - - const string ws_rel_path_template = "worksheets/sheet.xml"; - XmlNamespaceManager ns_manager; - private List sections_names_backward; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/OOX/XmlFile.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/OOX/XmlFile.cs deleted file mode 100644 index 7c4117ce12..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/OOX/XmlFile.cs +++ /dev/null @@ -1,113 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.Helpers; - -namespace ASCOfficeEWSEditor.Editor.OOX -{ - internal class XmlFile - { - public XmlFile(ContentTypes content_types, Relationships relationships, XmlNode start_dir, string file_path, - OOX.Relationships.FileType rel_type, OOX.ContentTypes.FileType content_type) - { - content_types_link = content_types; - relationships_link = relationships; - start_dir_tag = start_dir; - this.file_path = file_path; - this.rel_type = rel_type; - this.content_type = content_type; - file_tag = Helpers.OOXNavigate.getReferenceByPath(file_path, start_dir); - rId = relationships.GetId(file_path); - } - - public XmlNode GetFileTag() - { - return file_tag; - } - - public XmlNode GetContainerDirTag() - { - return file_tag == null ? null : file_tag.ParentNode; - } - - public XmlNode GetRootTag() - { - return file_tag == null ? null : file_tag.FirstChild; - } - - public XmlNode GetFileTagOrCreate() - { - return GetFileTag() ?? CreateFileTag(); - } - - public XmlNode CreateFileTag() - { - file_tag = Helpers.OOXNavigate.AddFile(file_path, start_dir_tag, false); - - #region File registration - rId = relationships_link == null ? "" : relationships_link.AddTarget(file_path, rel_type, false); - if (content_types_link != null) - { - content_types_link.RegisterFile(file_tag, content_type); // Register in [Content_Types] - } - #endregion - - return file_tag; - } - - public void Remove() - { - if (file_tag != null) - { - relationships_link.RemoveTarget(rId); - content_types_link.DeRegisterFile(file_tag); - file_tag.ParentNode.RemoveChild(file_tag); - file_tag = null; - } - } - - internal void AppendXmlSection(XmlNode section_node, List sections_names_backward, XmlNamespaceManager ns_manager) - { - XmlNode main_tag = GetRootTag(); - if(main_tag != null) - { - string inserted_section_name = section_node.Name; - string query = "main:" + inserted_section_name; - - bool append_every_following_node = false; - XmlNode where_to_insert_after = null; - foreach (string section_name in sections_names_backward) - { - if (append_every_following_node) - { - where_to_insert_after = main_tag.SelectSingleNode("main:" + section_name, ns_manager); - if (where_to_insert_after != null) - { - break; - } - } - if (section_name == inserted_section_name) - { - append_every_following_node = true; - } - } - main_tag.InsertAfter(section_node, where_to_insert_after); - } - } - - - public string rId { get; private set; } - - #region Info for creation/deletion - private ContentTypes content_types_link; - private Relationships relationships_link; - private XmlNode start_dir_tag; - private string file_path; - private OOX.Relationships.FileType rel_type; - private OOX.ContentTypes.FileType content_type; - #endregion - - private XmlNode file_tag; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Range.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Range.cs deleted file mode 100644 index a2f2599be6..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Range.cs +++ /dev/null @@ -1,922 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using System.Xml.XPath; -using System.Xml.Xsl; -using System.IO; -using ASCOfficeEWSEditor.XMLDataSpecific; -using ASCOfficeEWSEditor.Editor.Walkers; - -namespace ASCOfficeEWSEditor.Editor -{ - /// - /// Represents a range of cells - /// - public class Range - { - internal Range(string ref_str, Worksheet parent_sheet) - : this(new Cells.CellRange(ref_str, parent_sheet.Workbook), parent_sheet) - { - } - - internal Range(Cells.CellRange coords, Worksheet parent_sheet) - { - this.xml_sheetData = parent_sheet.SheetData; - this.parent_sheet = parent_sheet; - ns_manager = parent_sheet.Workbook.NamespaceManager; - this.coords = coords; - range_walker = new RangeWalker(coords, parent_sheet); - Format = new Format.Format(range_walker, coords, parent_sheet); - } - - - - /// - /// Returns or sets a 'System.Object' value that represents the value of the specified range. - /// Returns null if the value differs for different cells. - /// Sets the passed value to all cells of the range if the range references more than one cell. - /// Note: Recalculation is possible. - /// - public object Value - { - get - { - ValueGetter collector = new ValueGetter(parent_sheet.Workbook); - range_walker.CollectStatistics(collector); - return collector.Value; - } - set - { - ValueSetter setter = null; - if (string.IsNullOrEmpty(ValueType)) - setter = new ValueSetter(value, parent_sheet, coords.NumCells); - else - setter = new ValueSetter(value, ValueType, parent_sheet, coords.NumCells, updateHeaders); - range_walker.ChangeValues(setter); - parent_sheet.IssueCellsUpdatedEvent(); - } - } - - internal Calculation.Formulas.DataObjects.IDataObject InternalValue - { - get - { - ValueGetter collector = new ValueGetter(parent_sheet.Workbook); - range_walker.CollectStatistics(collector); - return collector.InternalValue; - } - set - { - ValueSetter setter = new ValueSetter(value, parent_sheet, coords.NumCells); - range_walker.ChangeValues(setter); - parent_sheet.IssueCellsUpdatedEvent(); - } - } - - /// - /// Returns a 'System.Object' value that represents the displayed value of the specified range using the number format set to this value or range. - /// Returns null if the value differs for different cells. - /// - public object DispValue - { - get - { - Calculation.Formulas.DataObjects.IDataObject value = InternalValue; - if (value is Calculation.Formulas.DataObjects.ObjectEmpty || value == null) - { - return ""; - } - - int? number_format_id = Format.NumberFormatId; - if (!number_format_id.HasValue) - { - return ""; - } - - string number_format_string = parent_sheet.Workbook.StyleSheet.GetNumberFormatString(number_format_id.Value); - - return NumberFormat.NumberFormatParser.MakeDisplayValue(value, number_format_string); - } - } - - /// - /// Returns or sets a String value that represents the formula of the specified range. - /// Returns null if the value differs for different cells. - /// Sets the passed formula to all cells of the range if the range references more than one cell. - /// Recalculates the value after set formula. - /// Note: Recalculation is possible. - /// - public string Formula - { - get - { - FormulaGetter collector = new FormulaGetter(parent_sheet.Workbook); - range_walker.CollectStatistics(collector); - return collector.Value; - } - set - { - m_oLastSetFormulaError = null; - if(value != null && value.Length != 0) - { - FormulaSetter setter = new FormulaSetter(value != null ? value.Trim() : null, coords.TopLeft, parent_sheet); - if (false == range_walker.ChangeValues(setter)) - m_oLastSetFormulaError = new Events.FormulaFormatError(""); - parent_sheet.IssueCellsUpdatedEvent(); - } - else - { - Value = null; - } - } - } - - /// - /// - public string Hyperlink - { - get - { - HyperlinkGetter collector = new HyperlinkGetter(parent_sheet); - range_walker.CollectStatistics(collector); - return collector.Value; - } - set - { - HyperlinkSetter setter = new HyperlinkSetter(parent_sheet, value); - range_walker.ChangeValues(setter); - } - } - - /// - /// Sets/gets the height of all the rows in the range specified, measured in points. - /// Note: if the obtained values of height of rows in the range differ from each other, - /// this property returns 'null'. If all rows have the same height, this height is returned - /// You'll have no problems setting a value for several rows - /// - public double? RowHeight - { - get - { - XmlNode manual_set_height_node = xml_sheetData.SelectSingleNode("main:row[@r = " + coords.RowFirst + "]/@ht", ns_manager); - double standard_height = parent_sheet.StandardHeight; - double first_row_height = null == manual_set_height_node ? standard_height : XMLDouble.ParseOrDefault(manual_set_height_node.InnerText, -1); - if(first_row_height == -1) - { - parent_sheet.Workbook.ReportError(new Events.InternalError("Wrong OOX format. row[@r = " + coords.RowFirst + "]/@ht is not double")); - return null; - } - - for (int another_row = coords.RowFirst + 1; another_row <= coords.RowLast; ++another_row) - { - XmlNode another_height_node = xml_sheetData.SelectSingleNode("main:row[@r = " + another_row + "]/@ht", ns_manager); - double another_row_height = null == another_height_node ? standard_height : XMLDouble.ParseOrDefault(another_height_node.InnerText, -1); - if (another_row_height == -1) - { - parent_sheet.Workbook.ReportError(new Events.InternalError("Wrong OOX format. row[@r = " + another_row + "]/@ht is not double")); - return null; - } - if (another_row_height != first_row_height) - { - return null; - } - } - return first_row_height; - } - set - { - RowsWalker walker = new RowsWalker(coords.RowFirst, coords.RowLast, parent_sheet); - RowsHeightSetter setter = new RowsHeightSetter(value.Value); - walker.SetRows(setter); - } - } - public double[] GetHeights() - { - if (coords.RowFirst <= coords.RowLast) - { - int nCount = coords.RowLast - coords.RowFirst + 1; - double[] aResult = new double[nCount]; - double dStandartHeight = parent_sheet.StandardHeight; - for (int i = 0; i < nCount; i++) - aResult[i] = dStandartHeight; - XmlNodeList oRowNodes = this.xml_sheetData.ChildNodes; - try - { - XmlNode oCurRowNode = oRowNodes[0]; - while (null != oCurRowNode) - { - XmlElement oCurRowElem = (XmlElement)oCurRowNode; - int row = XMLInt.ParseOrDefault(oCurRowElem.GetAttribute("r"), 0); - double height = XMLDouble.ParseOrDefault(oCurRowElem.GetAttribute("ht"), -1); - if (coords.RowFirst <= row && row <= coords.RowLast) - aResult[row - 1] = height; - - oCurRowNode = oCurRowNode.NextSibling; - } - } - catch { } - return aResult; - } - return null; - } - public double[] GetWidths() - { - if (coords.ColumnFirst <= coords.ColumnLast) - { - int nCount = coords.ColumnLast - coords.ColumnFirst + 1; - double[] aResult = new double[nCount]; - double dStandartWidth = parent_sheet.StandardWidth; - for (int i = 0; i < nCount; i++) - aResult[i] = dStandartWidth; - XmlNodeList manual_set_width_node = xml_sheetData.SelectNodes("../main:cols/main:col[@min <= " + coords.ColumnLast + - " and @max >= " + coords.ColumnFirst + "]", ns_manager); - List oCols = new List(); - - int nCountElements = manual_set_width_node.Count; - for (int nIndex = 0; nIndex < nCountElements; ++nIndex) - { - try - { - XmlNode oCurNode = manual_set_width_node.Item(nIndex); - ColWidth oCurWidth = new ColWidth(); - - oCurWidth.nMin = Convert.ToInt32(oCurNode.Attributes["min"].Value); - oCurWidth.nMax = Convert.ToInt32(oCurNode.Attributes["max"].Value); - oCurWidth.dWidth = XMLDouble.ParseOrDefault(oCurNode.Attributes["width"].Value, -1); - oCols.Add(oCurWidth); - } - catch { } - } - - if (oCols.Count > 0) - { - //сортируем по min - oCols.Sort(ColWidth.Compare); - int nCurColIndex = 0; - int nCurMin = oCols[nCurColIndex].nMin; - int nCurMax = oCols[nCurColIndex].nMax; - double nCurWidth = oCols[nCurColIndex].dWidth; - for (int i = 0; i < nCount; i++) - { - if (i + 1 > nCurMax) - { - nCurColIndex++; - if (nCurColIndex < oCols.Count) - { - nCurMin = oCols[nCurColIndex].nMin; - nCurMax = oCols[nCurColIndex].nMax; - nCurWidth = oCols[nCurColIndex].dWidth; - } - else - break; - } - if (nCurMin <= i + 1 && i + 1 <= nCurMax) - aResult[i] = nCurWidth; - } - } - return aResult; - } - return null; - } - /// - /// Returns the height, in points, of the range. Read-only. - /// - public double Height - { - get - { - double total_height = 0; - double standard_height = parent_sheet.StandardHeight; - for (int row = coords.RowFirst; row <= coords.RowLast; ++row) - { - XmlNode row_ht_node = xml_sheetData.SelectSingleNode("main:row[@r = " + row + "]/@ht", ns_manager); - double row_height = null == row_ht_node ? standard_height : XMLDouble.ParseOrDefault(row_ht_node.InnerText, -1); - if (row_height == -1) - { - parent_sheet.Workbook.ReportError(new Events.InternalError("Wrong OOX format. row[@r = " + row + "]/@ht is not double")); - row_height = standard_height; - } - total_height += row_height; - } - return total_height; - } - } - - /// - /// Sets/gets the width of all columns in the range specified. Read/write. - /// One unit of the value is equal to the width of '0' (zero) character in the Normal style. - /// Note: if the obtained values of widths of columns in the range differ from each other, - /// this property returns 'null'. If all columns have the same width, this width is returned - /// You'll have no problems setting a value for several columns - /// - public double? ColumnWidth - { - get - { - string columnFirst_num_str = coords.ColumnFirst.ToString(); - XmlNode manual_set_width_node = xml_sheetData.SelectSingleNode("../main:cols/main:col[@min <= " + columnFirst_num_str + - " and @max >= " + columnFirst_num_str + "]/@width", ns_manager); - double standard_width = parent_sheet.StandardWidth; - double first_col_width = null == manual_set_width_node ? standard_width : XMLDouble.ParseOrDefault(manual_set_width_node.InnerText, -1); - if (first_col_width == -1) - { - parent_sheet.Workbook.ReportError(new Events.InternalError("Wrong OOX format. col/@width is not double")); - return null; - } - - for (int another_col = coords.ColumnFirst; another_col <= coords.ColumnLast; ++another_col) - { - string another_col_str = another_col.ToString(); - XmlNode another_width_node = xml_sheetData.SelectSingleNode("../main:cols/main:col[@min <= " + another_col_str + - " and @max >= " + another_col_str + "]/@width", ns_manager); - double another_column_width = null == another_width_node ? standard_width : XMLDouble.ParseOrDefault(another_width_node.InnerText, -1); - if (another_column_width == -1) - { - parent_sheet.Workbook.ReportError(new Events.InternalError("Wrong OOX format. col/@width is not double")); - return null; - } - if (another_column_width != first_col_width) - { - return null; - } - } - return first_col_width; - } - set - { - if(value.HasValue) - { - ColsWalker cols_walker = new ColsWalker(coords.ColumnFirst, coords.ColumnLast, parent_sheet); - cols_walker.SetCols(new WidthSetter(value.Value)); - } - } - } - - /// - /// Returns the width of the range. Read-only. - /// One unit of the value is equal to the width of '0' (zero) character in the Normal style. - /// - public double Width - { - get - { - double total_width = 0; - double standard_width = parent_sheet.StandardWidth; - for (int col = coords.ColumnFirst; col <= coords.ColumnLast; ++col) - { - string col_str_num = col.ToString(); - XmlNode col_width_node = xml_sheetData.SelectSingleNode("../main:cols/main:col[" + - "@min <= " + col_str_num + " and @max >= " + col_str_num + "]/@width", ns_manager); - - double col_width = null == col_width_node ? standard_width : XMLDouble.ParseOrDefault(col_width_node.InnerText, -1); - if (col_width == -1) - { - parent_sheet.Workbook.ReportError(new Events.InternalError("Wrong OOX format. col/@width is not double")); - col_width = standard_width; - } - total_width += col_width; - } - return total_width; - } - } - - /// - /// Examine if the created Range object references the only single cell - /// - public bool IsSingleCell - { - get {return coords.IsSingleCell;} - } - - /// - /// Returns number of cells in the range. Read-only. - /// - public int NumCells - { - get { return coords.NumCells; } - } - - /// - /// Returns string representation of the Range - /// - /// Range reference in A1 form - override public string ToString() - { - return coords.ToString(); - } - - /// - /// Inserts a new row above the range - /// Note: Recalculation is possible. - /// Note: Merged cells may be changed - /// - public void InsertRow() - { - InsertRows(1); - } - - /// - /// Inserts a number of new rows above the range - /// Note: Recalculation is possible. - /// Note: Merged cells may be changed - /// - public void InsertRows(int num_rows) - { - Cells.CellRange need_to_move_range = new Cells.CellRange(coords.RowFirst, 1, Helpers.ReferencesFormat.maxRow, Helpers.ReferencesFormat.maxCol); - Cells.Offset offset = new Cells.Offset(num_rows, 0); - - InsertRange(need_to_move_range, offset); - } - - private void InsertRange(Cells.CellRange moved_range, Cells.Offset offset) - { - parent_sheet.Workbook.ValuesUpdateManager.NotifyRangesOnInsertedRowsOrColumns(moved_range, offset, parent_sheet); - - RowsWalker moved_walker = new RowsWalker(moved_range.RowFirst, moved_range.RowLast, parent_sheet); - RowsCellMover mover = new RowsCellMover(moved_range.ColumnFirst, moved_range.ColumnLast, offset, parent_sheet); - moved_walker.UpdateRows(mover); - - // The following notification is made outside of any setter because the notification procedure - // could change some dependencies and lead in incorrect further work - parent_sheet.Workbook.ValuesUpdateManager.NotifyCellOrRangeMoved(moved_range, offset, parent_sheet); - - foreach (Worksheet ws in parent_sheet.Workbook.Worksheets) - { - FormulaTextAndValueUpdater formula_updater = new FormulaTextAndValueUpdater(ws); - RangeWalker low_part_walker = new RangeWalker(Helpers.ReferencesFormat.maxRange(), ws); - low_part_walker.UpdateValues(formula_updater); - } - - parent_sheet.MergeCells.InsertRange(moved_range, offset); - - parent_sheet.IssueCellsUpdatedEvent(); - } - - /// - /// Deletes all rows that are pointed to by the range - /// Note: Recalculation is possible. - /// Note: Merged cells may be changed - /// - public void DeleteRows() - { - Cells.CellRange deleted_range = new Cells.CellRange(coords.RowFirst, 1, coords.RowLast, Helpers.ReferencesFormat.maxCol); - Cells.CellRange moved_range = new Cells.CellRange(coords.RowLast + 1, 1, Helpers.ReferencesFormat.maxRow, Helpers.ReferencesFormat.maxCol); - Cells.Offset offset = new Cells.Offset(-deleted_range.Height, 0); - - DeleteRange(deleted_range, moved_range, offset); - } - - /// - /// Inserts a new column on the left of the range - /// Note: Merged cells may be changed - /// - public void InsertColumn() - { - InsertColumns(1); - } - - /// - /// Inserts a number of new columns on the left of the range - /// Note: Merged cells may be changed - /// - public void InsertColumns(int num_columns) - { - Cells.CellRange need_to_move_range = new Cells.CellRange(1, coords.ColumnFirst, Helpers.ReferencesFormat.maxRow, Helpers.ReferencesFormat.maxCol); - Cells.Offset offset = new Cells.Offset(0, num_columns); - - InsertRange(need_to_move_range, offset); - - #region update cols - foreach (XmlNode col_item in xml_sheetData.SelectNodes("../main:cols/main:col[@max >= " + coords.ColumnFirst + "]", ns_manager)) - { - XmlElement col_tag = (XmlElement)col_item; - int min = XMLInt.ParseOrDefault(col_tag.GetAttribute("min"), 1); - if(min >= coords.ColumnFirst) - { - col_tag.SetAttribute("min", (min + num_columns).ToString()); - } - col_tag.SetAttribute("max", (XMLInt.ParseOrDefault(col_tag.GetAttribute("max"), Helpers.ReferencesFormat.maxCol) + num_columns).ToString()); - } - #endregion -} - - /// - /// Deletes all columns that are pointed to by the range - /// Note: Merged cells may be changed - /// - public void DeleteColumns() - { - Cells.CellRange deleted_range = new Cells.CellRange(1, coords.ColumnFirst, Helpers.ReferencesFormat.maxRow, coords.ColumnLast); - Cells.CellRange moved_range = new Cells.CellRange(1, coords.ColumnLast + 1, Helpers.ReferencesFormat.maxRow, Helpers.ReferencesFormat.maxCol); - Cells.Offset offset = new Cells.Offset(0, -deleted_range.Width); - - DeleteRange(deleted_range, moved_range, offset); - - #region update cols - int num_cols_to_delete = coords.Width; - XmlNode cols_tag = xml_sheetData.SelectSingleNode("../main:cols", ns_manager); - foreach (XmlNode col_item in xml_sheetData.SelectNodes("../main:cols/main:col[@max >= " + coords.ColumnFirst + "]", ns_manager)) - { - XmlElement col_tag = (XmlElement)col_item; - int min = XMLInt.ParseOrDefaultAndReport(col_tag.GetAttribute("min"), 1, parent_sheet.Workbook, "col/@min"); - int max = XMLInt.ParseOrDefault(col_tag.GetAttribute("max"), Helpers.ReferencesFormat.maxCol); - - if (min > coords.ColumnLast) // the whole range on the right of the deleted region - { - min -= num_cols_to_delete; - max -= num_cols_to_delete; - } - else if (max <= coords.ColumnLast) // max is inside of the deleted region - { - if(min < coords.ColumnFirst) // cut off the right part of the range - { - max = coords.ColumnFirst - 1; - } - else // the whole range is inside of the deleted region - { - cols_tag.RemoveChild(col_item); // Delete nah - } - } - else // max is on the right of the deleted region - { - if (min >= coords.ColumnFirst) // cut off the left part of the range - { - min = coords.ColumnFirst; - } - max -= num_cols_to_delete; - } - col_tag.SetAttribute("min", min.ToString()); - col_tag.SetAttribute("max", max.ToString()); - } - #endregion - } - - private void DeleteRange(Cells.CellRange deleted_range, Cells.CellRange moved_range, Cells.Offset offset) - { - RowsWalker deleted_walker = new RowsWalker(deleted_range.RowFirst, deleted_range.RowLast, parent_sheet); - RowsCellDeleter deleter = new RowsCellDeleter(deleted_range.ColumnFirst, deleted_range.ColumnLast, parent_sheet); - deleted_walker.UpdateRows(deleter); - - parent_sheet.Workbook.ValuesUpdateManager.NotifyDeleted(deleted_range, parent_sheet); - - RowsWalker moved_walker = new RowsWalker(moved_range.RowFirst, moved_range.RowLast, parent_sheet); - RowsCellMover mover = new RowsCellMover(moved_range.ColumnFirst, moved_range.ColumnLast, offset, parent_sheet); - moved_walker.UpdateRows(mover); - - // The following notification is made outside of any setter because the notification procedure - // could change some dependencies and lead in incorrect further work - parent_sheet.Workbook.ValuesUpdateManager.NotifyCellOrRangeMoved(moved_range, offset, parent_sheet); - - foreach (Worksheet ws in parent_sheet.Workbook.Worksheets) - { - FormulaTextAndValueUpdater formula_updater = new FormulaTextAndValueUpdater(ws); - RangeWalker low_part_walker = new RangeWalker(Helpers.ReferencesFormat.maxRange(), ws); - low_part_walker.UpdateValues(formula_updater); - } - - parent_sheet.MergeCells.RemoveRange(deleted_range, moved_range, offset); - - parent_sheet.IssueCellsUpdatedEvent(); - } - - /// - /// Obtains a list of all existent cells references in the range. - /// - /// List of string references - public List ExistentCells() - { - ExistentCellsCollector collector = new ExistentCellsCollector(parent_sheet); - range_walker.CollectStatistics(collector); - return collector.GetFoundReferences(); - } - public List ExistentCells(out int nMaxRow, out int nMaxCol) - { - //ExistentCellsCollector collector = new ExistentCellsCollector(parent_sheet); - //range_walker.CollectStatistics(collector); - //int nRMin; - //int nCMin; - //collector.GetFoundBounds(out nRMin, out nMaxRow, out nCMin, out nMaxCol); - ////collector. - //return collector.GetFoundReferences(); - - nMaxRow = 0; - nMaxCol = 0; - XmlNodeList oRowNodes = this.xml_sheetData.ChildNodes; - try - { - XmlNode oCurRowNode = oRowNodes[0]; - while (null != oCurRowNode) - { - XmlElement oCurRowElem = (XmlElement)oCurRowNode; - int row = XMLInt.ParseOrDefault(oCurRowElem.GetAttribute("r"), 0); - if (row > nMaxRow) - nMaxRow = row; - string sSpans = oCurRowElem.GetAttribute("spans"); - if (string.Empty != sSpans) - { - int nIndex = sSpans.IndexOf(':'); - if (-1 != nIndex) - { - int nLastCol = XMLInt.ParseOrDefault(sSpans.Substring(nIndex + 1), 0); - if (nLastCol > nMaxCol) - nMaxCol = nLastCol; - } - } - else - { - XmlNodeList oColNodes = oCurRowNode.ChildNodes; - try - { - XmlNode oCurColNode = oColNodes[0]; - while (null != oCurColNode) - { - string sCellId = ((XmlElement)oCurColNode).GetAttribute("r"); - Cells.Cell oCurCell = new ASCOfficeEWSEditor.Editor.Cells.Cell(sCellId); - if (oCurCell.Column > nMaxCol) - nMaxCol = oCurCell.Column; - - oCurColNode = oCurColNode.NextSibling; - } - } - catch { } - } - - oCurRowNode = oCurRowNode.NextSibling; - } - } - catch { } - //Cells.Cell oLastCell = new ASCOfficeEWSEditor.Editor.Cells.Cell(nMaxRow, nMaxCol); - //List aResult = new List(); - //aResult.Add("A1:" + oLastCell.ToString()); - //return aResult; - return new List(); - } - - /// - /// Obtains a list of all non-empty cells references in the range - /// - /// List of string references - public List NonEmptyCells() - { - NonEmptyCellsCollector collector = new NonEmptyCellsCollector(parent_sheet); - range_walker.CollectStatistics(collector); - return collector.GetFoundReferences(); - } - - /// - /// Returns Format object that is responsible for getting and setting of all format and style properties of the cells. - /// Read-only. - /// - public Format.Format Format { get; private set; } - - /// - /// Returns the merged range reference that the Cell is included to (Must be called for single-cell ranges only. Otherwise an empty string is returned). - /// If no merged range contains the cell, the same cell reference is returned. - /// - public string MergedArea - { - get - { - if(coords.IsSingleCell) - { - Cells.CellRange area = parent_sheet.MergeCells.MergedArea(coords.TopLeft); - return area.ToString(); - } - else - { - return ""; - } - } - } - - /// - /// Returns Last Formula Error - /// - public Events.ErrorDescription LastFormulaError - { - get { return m_oLastSetFormulaError; } - } - - /// - /// Determines whether one of cells of the range is included in a merged range - /// - /// - public MergeInfo HasMergedCells() - { - return parent_sheet.MergeCells.HasMergedCells(coords); - } - - /// - /// Unmerge all ranges that intersect the specified one - /// - public void UnMerge() - { - parent_sheet.MergeCells.UnMerge(coords); - } - - /// - /// Merge the range. - /// Note: Recalculation is possible. - /// - public void Merge() - { - Cells.CellRange result_range = parent_sheet.MergeCells.Merge(coords); - Cells.Cell top_left = result_range.TopLeft; - - RangeWalker range_walker_result = new RangeWalker(result_range, parent_sheet); - CellWalker cell_walker_top_left = new CellWalker(top_left, parent_sheet); - - // Determine top left cell value and formula - FirstNonEmptyFormulaValueCollector formula_value_collector = new FirstNonEmptyFormulaValueCollector(parent_sheet.Workbook); - range_walker_result.CollectStatistics(formula_value_collector); - - // Set removed cells to null (except the top left cell) - ExceptCellDeleter setter = new ExceptCellDeleter(top_left.Row, top_left.Column, parent_sheet); - range_walker_result.ChangeValues(setter); - - // Move the first non-empty value to the top left cell - if(formula_value_collector.Formula != null && formula_value_collector.Formula != "") - { - FormulaSetter setter_one_cell = new FormulaSetter(formula_value_collector.Formula, top_left /* Excel do the same */, parent_sheet); - cell_walker_top_left.ChangeValues(setter_one_cell); - } - else if (formula_value_collector.Value != null && !(formula_value_collector.Value is Calculation.Formulas.DataObjects.ObjectEmpty)) - { - ValueSetter setter_one_cell = new ValueSetter(formula_value_collector.Value, parent_sheet, 1); - cell_walker_top_left.ChangeValues(setter_one_cell); - } - - parent_sheet.IssueCellsUpdatedEvent(); - } - - /// - /// Sort cells of the range - /// Note: Recalculation is possible. - /// - /// Sort orientation - /// Key range. Specifies the column (for row orientation) or the row (column orientation) that the sort is performed by - /// Sort order - public void Sort(Sorting.SortOrientation orientation, Range key, Sorting.SortOrder order) - { - - ExistentCellsCollector collector = new ExistentCellsCollector(parent_sheet); - range_walker.CollectStatistics(collector); - Cells.CellRange min_coords = collector.GetRange(); - Cells.CellRange sort_coords = new Cells.CellRange(coords.RowFirst, coords.ColumnFirst, min_coords.RowLast, min_coords.ColumnLast); - RangeWalker sort_range_walker = new RangeWalker(sort_coords, parent_sheet); - - - Cells.Cell key_cell = key.coords.TopLeft; - Cells.CellRange key_range = orientation == Sorting.SortOrientation.by_rows ? new Cells.CellRange(sort_coords.RowFirst, key_cell.Column, sort_coords.RowLast, key_cell.Column) : - new Cells.CellRange(key_cell.Row, sort_coords.ColumnFirst, key_cell.Row, sort_coords.ColumnLast); - #region Sort key values - RangeWalker key_range_walker = new RangeWalker(key_range, parent_sheet); - SortValuesCollector key_values = new SortValuesCollector(parent_sheet.Workbook, orientation); - key_range_walker.CollectStatisticsIncludingEmpty(key_values); - if(order == Sorting.SortOrder.ascending) - { - key_values.Values.Sort(); - } - else - { - key_values.Values.Sort(new Sorting.DescendingComparer()); - } - #endregion - #region Collect references to existent nodes - CellsNodesCollector nodes_collection = new CellsNodesCollector(); - sort_range_walker.CollectStatisticsIncludingEmpty(nodes_collection); - #endregion - - // Replace all cells - CellsSubstitutionSetter substitutor = new CellsSubstitutionSetter(nodes_collection.FoundReferences, key_values.Values, - orientation, sort_coords.TopLeft, parent_sheet); - - // ToDo (переделать, работает достаточно долго) - Dictionary arrRowsDefaultStyle = null; - List arrCoolsDefaultStyle = null; - List oCellsOld = GetCellSimple(null, out arrRowsDefaultStyle, out arrCoolsDefaultStyle); - sort_range_walker.ChangeValues(substitutor); - for (int nIndex = 0; nIndex < oCellsOld.Count; ++nIndex) - { - CellSimple oCell = oCellsOld[nIndex]; - Range oNeighborCel = parent_sheet.Range(oCell.ID); - oNeighborCel.Format.Borders.Bottom.Style = oCell.Format.Brds.Bottom.Style; - oNeighborCel.Format.Borders.Left.Style = oCell.Format.Brds.Left.Style; - oNeighborCel.Format.Borders.Right.Style = oCell.Format.Brds.Right.Style; - oNeighborCel.Format.Borders.Top.Style = oCell.Format.Brds.Top.Style; - } - - #region Move Hyperlinks - { - List hyps = new List(); - foreach (Cells.Cell cell in sort_coords) - { - Hyperlinks.Hyperlink hyp = parent_sheet.Hyperlinks[cell.ToString()]; - if (hyp != null) - { - hyps.Add(hyp); - parent_sheet.Hyperlinks.RemoveHyperlink(cell); - } - } - Cells.Cell top_left = sort_coords.TopLeft; - foreach (Hyperlinks.Hyperlink hyp in hyps) - { - Cells.Cell other_cell = hyp.CellAnchor; - Cells.Cell cell = orientation == Sorting.SortOrientation.by_rows ? new Cells.Cell(key_values.Values.FindIndex(delegate(Sorting.ValueRowColumn vrc) { return vrc.row_column == other_cell.Row; }) + top_left.Row, other_cell.Column) : - new Cells.Cell(other_cell.Row, key_values.Values.FindIndex(delegate(Sorting.ValueRowColumn vrc) { return vrc.row_column == other_cell.Column; }) + top_left.Column); - // Move hyperlink if it exists in former cell - parent_sheet.Hyperlinks[cell.ToString()] = hyp; - } - } - #endregion - - parent_sheet.IssueCellsUpdatedEvent(); - } - - /// - /// Copies the content, formulas and styles of all of the cells in the range to the specified destination range. - /// Note: Recalculation is possible. - /// Note: Styles are not copied when copy is made between different workbooks. - /// - /// Destination range - public void CopyTo(Range destination_range) - { - if(coords.TopLeft == destination_range.coords.TopLeft && parent_sheet == destination_range.parent_sheet) - { - return; - } - // Collect references to source nodes - CellsNodesCollector nodes_collection = new CellsNodesCollector(); - range_walker.CollectStatisticsIncludingEmpty(nodes_collection); - - Cells.Offset offset = destination_range.coords.TopLeft - coords.TopLeft; - Cells.CellRange dest_coords = coords + offset; - RangeWalker destination_walker = new RangeWalker(dest_coords, destination_range.parent_sheet); - - // Replace all cells - CellsCopySetter copier = new CellsCopySetter(nodes_collection.FoundReferences, parent_sheet, - destination_range.parent_sheet, offset); - destination_walker.ChangeValues(copier); - - destination_range.parent_sheet.IssueCellsUpdatedEvent(); - } - - #region XML references - private XmlNode xml_sheetData; - #endregion - #region Tree references - private Worksheet parent_sheet; - #endregion - private Events.FormulaFormatError m_oLastSetFormulaError = null; - private XmlNamespaceManager ns_manager; - private Cells.CellRange coords; - private RangeWalker range_walker; - private struct ColWidth - { - public int nMin; - public int nMax; - public double dWidth; - public static int Compare(ColWidth x, ColWidth y) - { - return x.nMin - y.nMin; - } - }; - public List GetCellSimple(StyleCollectorCache oCache, out Dictionary arrRowsDefaultStyle, out List arrCollsDefaultStyle) - { - CellSimpleGetter collector = new CellSimpleGetter(parent_sheet.Workbook, oCache); - range_walker.CollectStatistics(collector); - - arrRowsDefaultStyle = collector.m_arrRowsDefaultStyle; - arrCollsDefaultStyle = collector.m_arrCollsDefaultStyle; - return collector.Value; - } - - public string ValueType { set; get; } - public bool updateHeaders { set; get; } - } - - public enum MergeInfo - { - none = 0, - merge = 1, - firstmerge = 2 - } - - public class CellSimple - { - internal CellSimple() - { - } - public string ID; - public string DispValue; - public string InternalValue; - public string InternalDate; - public string Formula; - public string Hyperlink; - public string ValueType; - public Format.FormatSimple Format; - public MergeInfo HasMergedCells; - }; - -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/SharedStrings.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/SharedStrings.cs deleted file mode 100644 index f643a08556..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/SharedStrings.cs +++ /dev/null @@ -1,114 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using System.Xml.XPath; -using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor -{ - internal class SharedStrings - { - public SharedStrings(OOX.ContentTypes content_types, OOX.Relationships relationships, Workbook workbook) - { - this.workbook = workbook; - sst_file = new OOX.SharedStringsFile(content_types, relationships, workbook); - ns_manager = workbook.NamespaceManager; - } - - public string GetString(int id) - { - XmlElement sst_tag = sst_file.GetSST(); - if(sst_tag == null) - { - return null; - } - - XmlNode ssi_text = sst_tag.SelectSingleNode("main:si[position() = " + (id + 1).ToString() + "]", ns_manager); - if (ssi_text == null) - { - return null; - } - return ssi_text.InnerText; - } - - /// - /// - /// - /// - /// Whether the passed string is going to be used only once or many times - /// - public int SetString(string ssi, int used_times) - { - XmlElement sst_tag = sst_file.GetSSTOrCreate(); - int exact_si_index = FindExactString(ssi); - if (exact_si_index == -1) - { - XmlElement si_tag = sst_tag.OwnerDocument.CreateElement("si", ns_manager.LookupNamespace("main")); - XmlElement t_tag = sst_tag.OwnerDocument.CreateElement("t", ns_manager.LookupNamespace("main")); - t_tag.InnerText = ssi; - si_tag.AppendChild(t_tag); - sst_tag.AppendChild(si_tag); - XPathNavigator navigator = sst_tag.CreateNavigator(); - - UpdateUsageCounter(used_times); - return UpdateTotalCounter() - 1; - } - else // the string with the same text already exists - { - if (!sst_tag.HasAttribute("uniqueCount")) - { - UpdateTotalCounter(); - } - UpdateUsageCounter(used_times); - return exact_si_index; - } - } - - private int FindExactString(string ssi) - { - XmlElement sst_tag = sst_file.GetSSTOrCreate(); - - int counter = 0; - foreach (XmlNode si_tag in sst_tag.SelectNodes("main:si", ns_manager)) - { - XmlNode t_tag = si_tag.SelectSingleNode("main:t", ns_manager); - if(t_tag != null && t_tag.InnerText == ssi) - { - return counter; - } - counter++; - } - - return -1; - } - - - private int UpdateTotalCounter() - { - XmlElement sst_tag = sst_file.GetSSTOrCreate(); - XPathNavigator navigator2 = sst_tag.CreateNavigator(); - int uniqueCount = (int)(double)navigator2.Evaluate("count(main:si)", ns_manager); - sst_tag.SetAttribute("uniqueCount", uniqueCount.ToString()); - return uniqueCount; - } - - public int UpdateUsageCounter(int correction_value) - { - XmlElement sst_tag = sst_file.GetSSTOrCreate(); - int count = correction_value; - if (sst_tag.HasAttribute("count")) - { - count += XMLInt.ParseOrDefaultAndReport(sst_tag.GetAttribute("count"), 0, workbook, "sst/@count"); - } - sst_tag.SetAttribute("count", count.ToString()); - return count; - } - - private OOX.SharedStringsFile sst_file; - #region Tree references - private Workbook workbook; - #endregion - XmlNamespaceManager ns_manager; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Sheet.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Sheet.cs deleted file mode 100644 index 8fa0d7e06a..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Sheet.cs +++ /dev/null @@ -1,203 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.XMLDataSpecific; -using System.IO; - -namespace ASCOfficeEWSEditor.Editor -{ - /// - /// Represents a sheet (worksheet, chartsheet, macrosheet, etc). - /// - public abstract class Sheet - { - private Sheet(Sheets container, Workbook workbook) - { - ns_manager = workbook.NamespaceManager; - this.container = container; - Workbook = workbook; - } - - protected Sheet(Sheets container, Workbook workbook, XmlNode xml_workbook_sheet) - : this(container, workbook) - { - this.xml_workbook_sheet = (XmlElement)xml_workbook_sheet; - } - - - /// - /// Create a new sheet - /// - protected Sheet(string name, string rId, Sheet before, XmlNode xml_workbook_sheets, Sheets container, Workbook workbook) - : this(container, workbook) - { - xml_workbook_sheet = CreateWorkbookSheet(name, rId, before, xml_workbook_sheets); - } - - - /// - /// Create from existent worksheet - /// - internal Sheet(string sheet_path, XmlNode xml_workbook_sheet, Sheets container, Workbook workbook) - : this(container, workbook) - { - this.xml_workbook_sheet = (XmlElement)xml_workbook_sheet; - } - - private XmlElement CreateWorkbookSheet(string name, string rId, Sheet before, XmlNode xml_workbook_sheets) - { - XmlElement sheet = xml_workbook_sheets.OwnerDocument.CreateElement("sheet", ns_manager.LookupNamespace("main")); - sheet.SetAttribute("name", name); - int max_id = 0; - foreach (XmlNode sheetId_node in xml_workbook_sheets.SelectNodes("main:sheet/@sheetId", ns_manager)) - { - int sheetId = XMLInt.ParseOrDefault(sheetId_node.InnerText, 0); - if (sheetId > max_id) - { - max_id = sheetId; - } - } - sheet.SetAttribute("sheetId", (max_id + 1).ToString()); - sheet.SetAttribute("id", ns_manager.LookupNamespace("mainr"), rId); - - XmlNode sheet_before = before == null ? null : xml_workbook_sheets.SelectSingleNode("main:sheet[@name = '" + before.Name + "']", ns_manager); - xml_workbook_sheets.InsertBefore(sheet, sheet_before); - - return sheet; - } - - /// - /// Sets the sheet active. - /// - public virtual void Activate() - { - Workbook.ActivateSheet(Index); - } - - /// - /// Remove sheet active - /// - public virtual void RemoveActive() - { - } - - /// - /// Name of the sheet. Read-only. (use SetName to change the name of the sheet) - /// - public string Name - { - get - { - return xml_workbook_sheet.GetAttribute("name"); - } - internal set - { - xml_workbook_sheet.SetAttribute("name", value); - } - } - - /// - /// Visible of the sheet. - /// - public bool Hidden - { - get - { - return ("hidden" == xml_workbook_sheet.GetAttribute("state")); - } - set - { - if (value) - xml_workbook_sheet.SetAttribute("state", "hidden"); - else - xml_workbook_sheet.RemoveAttribute("state"); - } - } - - /// - /// Has sheet data. Read-only. - /// - public abstract bool HasSheetData { get; } - - /// - /// Returns the name of the sheet - /// - /// - public override string ToString() - { - return Name; - } - - /// - /// Sets the new name for the sheet - /// - /// new name - /// Whether the assignment was successful - public bool SetName(string name) - { - if (name.Length == 0) - { - return false; - } - if(container.ChangeSheetName(Name, name)) - { - Workbook.ValuesUpdateManager.NotifyRenamedSheet(this); - return true; - } - return false; - } - - /// - /// Index of the sheet. Zero-based. Read-only. - /// - public int Index - { - get - { - return xml_workbook_sheet.SelectNodes("preceding-sibling::main:sheet", ns_manager).Count; - } - } - - /// - /// Permanently removes the sheet from the workbook ( - /// - /// Whether the operation successful. Return false if the removed sheet is the only sheet in the workbook - protected bool RemoveSheet() - { - if(container.Count == 1) - { - return false; - } - - Workbook.ValuesUpdateManager.NotifyRemovedSheet(this); - - container.DetachSheet(Name); - - xml_workbook_sheet.ParentNode.RemoveChild(xml_workbook_sheet); // Remove workbook/sheet - - return true; - } - - /// - /// Permanently removes the sheet from the workbook - /// - /// Whether the operation successful. Return false if the removed sheet is the only sheet in the workbook - public abstract bool Remove(); - - /// - /// Workbook that contains this sheet - /// - public Workbook Workbook { get; private set; } - - #region XML references - private XmlElement xml_workbook_sheet; - #endregion - - #region tree references - protected Sheets container; - #endregion - - protected XmlNamespaceManager ns_manager; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Sheets.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Sheets.cs deleted file mode 100644 index 98dc14fa89..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Sheets.cs +++ /dev/null @@ -1,275 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor -{ - /// - /// A collection of all the sheet objects in the specified or active workbook - /// - public class Sheets : IEnumerable - { - internal Sheets(Workbook workbook) - { - ns_manager = workbook.NamespaceManager; - this.workbook = workbook; - sheets = new Dictionary(); - sheets_tag = workbook.GetRootTag().SelectSingleNode("main:sheets", ns_manager); - FindSheets(workbook.GetRootTag()); - } - - /// - /// Obtains a sheet reference by its name - /// - /// Name of the required sheet. - public Sheet this[string name] - { - get - { - Sheet result; - if (sheets.TryGetValue(name, out result)) - { - return result; - } - return null; - } - private set{} - } - - /// - /// Obtains a sheet reference by its index - /// - /// Index of the required sheet. Zero-based. - public Sheet this[int index] - { - get - { - foreach (Sheet sheet in sheets.Values) - { - if (sheet.Index == index) - { - return sheet; - } - } - return null; - } - private set { } - } - - /// - /// Gets the number of sheets contained in the workbook - /// - public int Count { get{ return sheets.Count;}} - - /// - /// Creates a new worksheet and makes it active. - /// - /// Name of the new sheet - /// Existent sheet that the new sheet shall be inserted before. If 'null' the new sheet is appended at the end - /// Just created worksheet - public Worksheet AddEmptySheet(string name, Sheet before) - { - Worksheet ws = Worksheet.CreateNew(name, before, sheets_tag, this, workbook); - - sheets.Add(name, ws); - if (null != ws.Workbook.ActiveSheet) - ws.Workbook.ActiveSheet.RemoveActive(); - ws.Activate(); - return ws; - } - - - public bool ReplaceSheets(string name, int index) - { - if (index < 0 || index >= sheets_tag.ChildNodes.Count) - return false; - - XmlNode oNode = null; - foreach (XmlNode sheetId_node in sheets_tag.SelectNodes("main:sheet", ns_manager)) - { - if (name == sheetId_node.Attributes["name"].InnerText) - oNode = sheetId_node; - } - - sheets_tag.RemoveChild(oNode); - - if (0 == index) - sheets_tag.InsertBefore(oNode, sheets_tag.ChildNodes[index]); - else - sheets_tag.InsertAfter(oNode, sheets_tag.ChildNodes[index-1]); - sheets.Clear(); - FindSheets(workbook.GetRootTag()); - Sheet oCurWoorksheet; - if (true == sheets.TryGetValue(name, out oCurWoorksheet)) - { - workbook.ActiveSheet.RemoveActive(); - oCurWoorksheet.Activate(); - } - return true; - } - - - public bool AddCopy(string name, Worksheet before) - { - Worksheet sheet = AddEmptySheet(name, null); - sheet.CopyData(before); - - //sheets.Add(name, sheet); - if (null != sheet.Workbook.ActiveSheet) - sheet.Workbook.ActiveSheet.RemoveActive(); - sheet.Activate(); - return true; - } - /// - /// Creates a new worksheet, append it to the end and makes it active. - /// - /// Name of the new sheet - /// Just created worksheet - public Worksheet AddEmptySheet(string name) - { - return AddEmptySheet(name, null); - } - - internal void DetachSheet(string name) - { - sheets.Remove(name); - } - - private void FindSheets(XmlNode workbook_tag) - { - XmlNode containing_dir = (workbook_tag.ParentNode ?? workbook_tag).ParentNode; - XmlNodeList sheets_xml = sheets_tag.SelectNodes("main:sheet", ns_manager); - foreach (XmlElement sheet_xml in sheets_xml) - { - string rId = sheet_xml.GetAttribute("id", ns_manager.LookupNamespace("mainr")); - string sheet_path = workbook.Relationships.GetTarget(rId); - XmlNode file_tag = Helpers.OOXNavigate.getReferenceByPath(sheet_path, workbook.GetRootTag().ParentNode.ParentNode); - if (file_tag != null) - { - switch (file_tag.FirstChild.Name) - { - case "worksheet": - sheets.Add(sheet_xml.GetAttribute("name"), new Worksheet(sheet_path, sheet_xml, this, workbook)); - break; - - case "chartsheet": - sheets.Add(sheet_xml.GetAttribute("name"), new Chartsheet(sheet_path, sheet_xml, this, workbook)); - break; - - case "dialogsheet": -// sheets.Add(sheet_xml.GetAttribute("name"), new Dialogsheet(sheet_path, sheet_xml, this, workbook)); - break; - - } - } - } - } - - internal bool ChangeSheetName(string old_name, string new_name) - { - if (old_name == new_name) - { - return true; - } - if(sheets.ContainsKey(new_name)) - { - return false; - } - - Sheet sheet = sheets[old_name]; - sheets.Remove(old_name); - sheets.Add(new_name, sheet); - sheet.Name = new_name; - return true; - } - - #region IEnumerable Members - - /// - /// Enumerator - /// - /// Enumerator - public IEnumerator GetEnumerator() - { - return new Enumerator(sheets.Values.GetEnumerator()); - } - - #endregion - - #region IEnumerable Members - - IEnumerator IEnumerable.GetEnumerator() - { - return new Enumerator(sheets.Values.GetEnumerator()); - } - - #endregion - - /// - /// Enumerator - /// - public class Enumerator : IEnumerator - { - internal Enumerator(IEnumerator orig_enumerator) - { - this.orig_enumerator = orig_enumerator; - } - - /// - /// Current sheet - /// - public Sheet Current - { - get - { - return orig_enumerator.Current; - } - } - - #region IDisposable Members - /// - /// Dispose :) - /// - public void Dispose() - { - } - - #endregion - - /// - /// Switches to the next Current - /// - /// - public bool MoveNext() - { - return orig_enumerator.MoveNext(); - } - - /// - /// Reset - /// - public void Reset() - { - orig_enumerator.Reset(); - } - - object System.Collections.IEnumerator.Current - { - get { return Current; } - } - - - IEnumerator orig_enumerator; - } - - - private Dictionary sheets; - private XmlNode sheets_tag; - private XmlNamespaceManager ns_manager; - private Workbook workbook; - - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Sorting/SortParameters.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Sorting/SortParameters.cs deleted file mode 100644 index ace1a8e624..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Sorting/SortParameters.cs +++ /dev/null @@ -1,78 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Editor.Sorting -{ - /// - /// Sort orientation - /// - public enum SortOrientation - { - /// - /// Sort by rows - /// - by_rows, - /// - /// Sort by columns - /// - by_columns - } - - /// - /// Sort order - /// - public enum SortOrder - { - /// - /// Sort ascending - /// - ascending, - /// - /// Sort descending - /// - descending - } - - internal struct ValueRowColumn : IComparable - { - public ValueRowColumn(Calculation.Formulas.DataObjects.IDataObject element, int row_column) - { - this.element = element; - this.row_column = row_column; - } - public Calculation.Formulas.DataObjects.IDataObject element; - public int row_column; - - #region IComparable Members - - public int CompareTo(ValueRowColumn other) - { - return element.CompareTo(other.element); - } - - #endregion - - public override string ToString() - { - return element.ToString() + ", " + row_column; - } - } - - internal class DescendingComparer : IComparer - { - #region IComparer Members - - public int Compare(ValueRowColumn x, ValueRowColumn y) - { - if (x.element is Calculation.Formulas.DataObjects.ObjectEmpty || y.element is Calculation.Formulas.DataObjects.ObjectEmpty) - { - return x.CompareTo(y); // This places PtgEmty to the end in every case - } - return -x.CompareTo(y); - } - - #endregion - } - -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/StyleSheet.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/StyleSheet.cs deleted file mode 100644 index 5c060a522a..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/StyleSheet.cs +++ /dev/null @@ -1,237 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor -{ - internal class StyleSheet - { - public StyleSheet(OOX.ContentTypes content_types, OOX.Relationships relationships, Workbook workbook) - { - this.workbook = workbook; - style_sheet_file = new OOX.StyleSheetFile(content_types, relationships, workbook); - ns_manager = workbook.NamespaceManager; - default_font_name = null; - default_font_size = null; - Palette = new Format.Colors.Palette(style_sheet_file.GetRootTag(), workbook); - } - - public XmlNode Get_CellXfs_OrCreate() - { - XmlNode style_sheet = style_sheet_file.GetStyleSheetOrCreate(); - XmlNode cellXfs_xml = style_sheet.SelectSingleNode("main:cellXfs", ns_manager); - if (cellXfs_xml == null) - { - cellXfs_xml = workbook.GetXmlDocument().CreateElement("cellXfs", ns_manager.LookupNamespace("main")); - XMLSectionsController.AppendXmlSection(cellXfs_xml); - } - return cellXfs_xml; - } - - public XmlNode Get_CellStyles_OrCreate() - { - XmlNode style_sheet = style_sheet_file.GetStyleSheetOrCreate(); - XmlNode cellStyles_xml = style_sheet.SelectSingleNode("main:cellStyles", ns_manager); - if (cellStyles_xml == null) - { - cellStyles_xml = workbook.GetXmlDocument().CreateElement("cellStyles", ns_manager.LookupNamespace("main")); - XMLSectionsController.AppendXmlSection(cellStyles_xml); - } - return cellStyles_xml; - } - - public XmlNode Get_CellStyleXfs_OrCreate() - { - XmlNode style_sheet = style_sheet_file.GetStyleSheetOrCreate(); - XmlNode cellStyleXfs_xml = style_sheet.SelectSingleNode("main:cellStyleXfs", ns_manager); - if (cellStyleXfs_xml == null) - { - cellStyleXfs_xml = workbook.GetXmlDocument().CreateElement("cellStyleXfs", ns_manager.LookupNamespace("main")); - XMLSectionsController.AppendXmlSection(cellStyleXfs_xml); - } - return cellStyleXfs_xml; - } - - public XmlNode GetStyleSheetOrCreate() - { - return style_sheet_file.GetStyleSheetOrCreate(); - } - - public int GetZeroStyleOrDefaultFontSize() - { - if(default_font_size == null) - { - int? font_size0 = Get0StyleFontSize(); - if (font_size0 != null) - { - default_font_size = font_size0.Value; - } - else - { - default_font_size = workbook.Editor.DefaultFontSizeOnBooksCreation; - } - } - return default_font_size.Value; - } - - public string GetZeroStyleOrDefaultFontName() - { - if (default_font_name == null) - { - string font_name0 = Get0StyleFontName(); - if(font_name0 != null) - { - default_font_name = font_name0; - } - else - { - default_font_name = workbook.Editor.DefaultFontNameOnBooksCreation; - } - } - return default_font_name; - } - - internal string Get0StyleFontName() - { - XmlNode font_entity = Get0StyleFont(); - if (font_entity != null) - { - XmlElement name_tag = (XmlElement)font_entity.SelectSingleNode("main:name", workbook.NamespaceManager); - string name; - if (name_tag != null && (name = name_tag.GetAttribute("val")) != "") - { - return name; - } - } - return null; - } - - internal int? Get0StyleFontSize() - { - XmlNode font_entity = Get0StyleFont(); - if (font_entity != null) - { - XmlElement sz_tag = (XmlElement)font_entity.SelectSingleNode("main:sz", workbook.NamespaceManager); - int sz; - if (sz_tag != null && (sz = XMLInt.ParseOrDefault(sz_tag.GetAttribute("val"), -1)) != -1) - { - return sz; - } - } - return null; - } - - private XmlNode Get0StyleFont() - { - XmlNode cell_styles_tag = Get_CellStyles_OrCreate(); - XmlElement cell_0_style = (XmlElement)cell_styles_tag.SelectSingleNode("main:cellStyle[@builtinId = 0]", ns_manager); - if (cell_0_style != null) - { - int xf_id = XMLInt.ParseOrDefault(cell_0_style.GetAttribute("xfId"), -1); - if(xf_id != -1) - { - XmlNode cell_style_xfs_tag = Get_CellStyleXfs_OrCreate(); - XmlElement xf_tag = (XmlElement)cell_style_xfs_tag.SelectSingleNode("main:xf[position() = " + (xf_id + 1).ToString() + "]", ns_manager); - if(xf_tag != null) - { - int font_id = XMLInt.ParseOrDefault(xf_tag.GetAttribute("fontId"), -1); - if(font_id != -1) - { - return style_sheet_file.GetRootTag().SelectSingleNode("main:fonts/main:font[position() = " + (font_id + 1).ToString() + "]", ns_manager); - } - } - } - } - return null; - } - - internal bool IsNumberFormatIdValidForThisBook(int num_fmt_id) - { - if(workbook.Editor.NumberFormatsStorage.FormatStrings.ContainsKey(num_fmt_id)) - { - return true; - } - XmlNode style_sheet = style_sheet_file.GetStyleSheetOrCreate(); - XmlNode numFmt = style_sheet.SelectSingleNode("main:numFmts/main:numFmt[@numFmtId = " + num_fmt_id + "]", ns_manager); - return numFmt != null; - } - - internal string GetNumberFormatString(int num_fmt_id) - { - string format_string; - XmlNode style_sheet = style_sheet_file.GetStyleSheetOrCreate(); - XmlElement numFmt = (XmlElement)style_sheet.SelectSingleNode("main:numFmts/main:numFmt[@numFmtId = " + num_fmt_id + "]", ns_manager); - if(numFmt == null) - { - if (workbook.Editor.NumberFormatsStorage.FormatStrings.TryGetValue(num_fmt_id, out format_string)) - { - return format_string; - } - return ""; - } - return numFmt.GetAttribute("formatCode"); - } - - internal int SetNumberFormatString(string num_fmt_string) - { - int num_fmt_standard_id = workbook.Editor.NumberFormatsStorage.GetIdByCode(num_fmt_string); - if (num_fmt_standard_id != -1) - { - return num_fmt_standard_id; - } - - XmlNode style_sheet = style_sheet_file.GetStyleSheetOrCreate(); - XmlElement numFmt_exact = (XmlElement)style_sheet.SelectSingleNode("main:numFmts/main:numFmt[@formatCode = \"" + - num_fmt_string.Replace("\"", """) + "\"]", ns_manager); - if (numFmt_exact != null) - { - int num_fmt_already_stored_id = XMLInt.ParseOrDefault(numFmt_exact.GetAttribute("numFmtId"), -1); - if(num_fmt_already_stored_id != -1) - { - return num_fmt_already_stored_id; - } - } - - int max_id = 0; - foreach (XmlElement numFmt_tag in style_sheet.SelectNodes("main:numFmts/main:numFmt", ns_manager)) - { - int num_fmt_id = XMLInt.ParseOrDefault(numFmt_tag.GetAttribute("numFmtId"), -1); - if(num_fmt_id > max_id) - { - max_id = num_fmt_id; - } - } - - if(max_id < 163) - { - max_id = 163; - } - XmlNode numFmts = style_sheet.SelectSingleNode("main:numFmts", ns_manager); - if(numFmts == null) - { - numFmts = style_sheet.OwnerDocument.CreateElement("numFmts", ns_manager.LookupNamespace("main")); - XMLSectionsController.AppendXmlSection(numFmts); - } - XmlElement numFmt_insert_tag = numFmts.OwnerDocument.CreateElement("numFmt", ns_manager.LookupNamespace("main")); - numFmt_insert_tag.SetAttribute("numFmtId", (max_id + 1).ToString()); - numFmt_insert_tag.SetAttribute("formatCode", num_fmt_string); - numFmts.AppendChild(numFmt_insert_tag); - - return max_id + 1; - } - - public Format.Colors.Palette Palette { get; private set; } - internal OOX.IOrderedSections XMLSectionsController { get { return style_sheet_file; } } - - private OOX.StyleSheetFile style_sheet_file; - #region Tree references - private Workbook workbook; - #endregion - XmlNamespaceManager ns_manager; - - private int? default_font_size; - private string default_font_name; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Table.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Table.cs deleted file mode 100644 index 68f9df7d38..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Table.cs +++ /dev/null @@ -1,445 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; - -namespace ASCOfficeEWSEditor.Editor -{ - public struct TableColumn - { - public string m_strName; - public string m_strId; - } - - public class Table - { - internal Table(Worksheet worksheet, OOX.TableFile oTableFile, XmlNode xml_worksheet, XmlNode sheet_data, string rId) - { - this.worksheet = worksheet; - this.ns_manager = worksheet.Workbook.NamespaceManager; - - this.m_oTableFile = oTableFile; - this.xml_table_file = this.m_oTableFile.GetTableOrCreate(); - - this.table_node = xml_worksheet.SelectSingleNode("main:tableParts", this.ns_manager); - this.rId = rId; - - if (0 < xml_table_file.ChildNodes.Count && "table" == xml_table_file.Name) - { - foreach (XmlNode oXmlNode in xml_table_file.ChildNodes) - { - switch (oXmlNode.Name) - { - case "autoFilter": - TableAutoFilter = new AutoFilter(worksheet, xml_table_file, sheet_data); - break; - case "tableColumns": - table_columns_node = oXmlNode; - foreach (XmlNode oTableColumnNode in oXmlNode.ChildNodes) - { - TableColumn oTableColumn = new TableColumn(); - if (null == oTableColumnNode.Attributes["id"] || null == oTableColumnNode.Attributes["name"]) - continue; - oTableColumn.m_strId = oTableColumnNode.Attributes["id"].Value; - oTableColumn.m_strName = oTableColumnNode.Attributes["name"].Value; - - this.addTableColumnToMap(oTableColumn); - } - break; - case "tableStyleInfo": - XmlAttribute oTableStyle = oXmlNode.Attributes["name"]; - if (null != oTableStyle) - TableStyle = oTableStyle.Value; - break; - } - } - } - } - - internal Table(Worksheet worksheet, OOX.TableFile oTableFile, XmlNode xml_worksheet, Table oTable) - { - this.worksheet = worksheet; - this.ns_manager = worksheet.Workbook.NamespaceManager; - - this.m_oTableFile = oTableFile; - this.xml_table_file = this.m_oTableFile.GetTableOrCreate(); - - this.rId = m_oTableFile.rId; - - this.TableStyle = oTable.TableStyle; - - this.table_node = xml_worksheet.SelectSingleNode("main:tableParts", this.ns_manager); - int nCountTables = 0; - if (null == this.table_node) - { - this.table_node = xml_worksheet.OwnerDocument.CreateElement("tableParts", ns_manager.LookupNamespace("main")); - xml_worksheet.AppendChild(this.table_node); - } - else - nCountTables = System.Convert.ToInt32(this.table_node.Attributes["count"].Value); - - ++nCountTables; - - XmlElement oElem = (XmlElement)this.table_node; - oElem.SetAttribute("count", nCountTables.ToString()); - - XmlElement oElementTablePart = xml_worksheet.OwnerDocument.CreateElement("tablePart", ns_manager.LookupNamespace("main")); - oElementTablePart.SetAttribute("id", ns_manager.LookupNamespace("mainr"), this.rId); - this.table_node.AppendChild(oElementTablePart); - - // Write AutoFilter To Xml - XmlElement oElementTableFile = (XmlElement)this.xml_table_file; - oElementTableFile.SetAttribute("ref", oTable.TableAutoFilter.m_oRefRange.ToString()); - int nMaxIdFile = MaxIdFile(xml_worksheet) + 1; - oElementTableFile.SetAttribute("id", nMaxIdFile.ToString()); - oElementTableFile.SetAttribute("name", "Table" + nMaxIdFile.ToString()); - oElementTableFile.SetAttribute("displayName", "Table" + nMaxIdFile.ToString()); - foreach (XmlNode oXmlNodeCopy in oTable.xml_table_file.ChildNodes) - { - oElementTableFile.AppendChild(oXmlNodeCopy.Clone()); - } - - TableAutoFilter = new AutoFilter(worksheet, xml_table_file, xml_worksheet.SelectSingleNode("main:sheetData", ns_manager), oTable.TableAutoFilter); - } - - private Table(Worksheet worksheet, OOX.TableFile oTableFile, XmlNode xml_worksheet, Cells.CellRange oFilterRange) - { - this.worksheet = worksheet; - this.ns_manager = worksheet.Workbook.NamespaceManager; - - this.m_oTableFile = oTableFile; - this.xml_table_file = this.m_oTableFile.GetTableOrCreate(); - - this.rId = m_oTableFile.rId; - - // set default TableStyle - this.TableStyle = "TableStyleMedium2"; - - this.table_node = xml_worksheet.SelectSingleNode("main:tableParts", this.ns_manager); - - int nCountTables = 0; - if (null == this.table_node) - { - this.table_node = xml_worksheet.OwnerDocument.CreateElement("tableParts", ns_manager.LookupNamespace("main")); - xml_worksheet.AppendChild(this.table_node); - } - else - nCountTables = System.Convert.ToInt32(this.table_node.Attributes["count"].Value); - - ++nCountTables; - - XmlElement oElem = (XmlElement)this.table_node; - oElem.SetAttribute("count", nCountTables.ToString()); - - XmlElement oElementTablePart = xml_worksheet.OwnerDocument.CreateElement("tablePart", ns_manager.LookupNamespace("main")); - oElementTablePart.SetAttribute("id", ns_manager.LookupNamespace("mainr"), this.rId); - this.table_node.AppendChild(oElementTablePart); - - // Write AutoFilter To Xml - XmlElement oElementTableFile = (XmlElement)this.xml_table_file; - oElementTableFile.SetAttribute("ref", oFilterRange.ToString()); - - if (0 == oElementTableFile.ChildNodes.Count) - { - // Auto Filter - XmlElement oAutoFilterElem = xml_worksheet.OwnerDocument.CreateElement("autoFilter", ns_manager.LookupNamespace("main")); - oAutoFilterElem.SetAttribute("ref", oFilterRange.ToString()); - oElementTableFile.AppendChild(oAutoFilterElem); - - // Create Columns - table_columns_node = xml_worksheet.OwnerDocument.CreateElement("tableColumns", ns_manager.LookupNamespace("main")); - ((XmlElement)table_columns_node).SetAttribute("count", (oFilterRange.ColumnLast - oFilterRange.ColumnFirst + 1).ToString()); - for (int nIndex = oFilterRange.ColumnFirst, i = 1; nIndex <= oFilterRange.ColumnLast; ++nIndex, ++i) - { - Range oRange = new Range(Helpers.ReferencesFormat.column2str(nIndex, true) + oFilterRange.RowFirst, worksheet); - string strValue = oRange.DispValue.ToString(); - if (string.IsNullOrEmpty(strValue)) - strValue = "Столбец" + i.ToString(); - - TableColumn oTableColumn = new TableColumn(); - oTableColumn.m_strId = i.ToString(); - oTableColumn.m_strName = strValue; - strValue = this.addTableColumnToMap(oTableColumn); - - oRange.ValueType = "s"; - oRange.updateHeaders = false; - oRange.Value = strValue; - - XmlElement oTableColumnElement = xml_worksheet.OwnerDocument.CreateElement("tableColumn", ns_manager.LookupNamespace("main")); - oTableColumnElement.SetAttribute("id", i.ToString()); - oTableColumnElement.SetAttribute("name", strValue); - table_columns_node.AppendChild(oTableColumnElement); - } - oElementTableFile.AppendChild(table_columns_node); - - //Style Table - XmlElement oTableStyleInfo = xml_worksheet.OwnerDocument.CreateElement("tableStyleInfo", ns_manager.LookupNamespace("main")); - oTableStyleInfo.SetAttribute("name", this.TableStyle); - oTableStyleInfo.SetAttribute("showFirstColumn", "0"); - oTableStyleInfo.SetAttribute("showLastColumn", "0"); - oTableStyleInfo.SetAttribute("showRowStripes", "1"); - oTableStyleInfo.SetAttribute("showColumnStripes", "0"); - oElementTableFile.AppendChild(oTableStyleInfo); - } - - int nMaxIdFile = MaxIdFile(xml_worksheet) + 1; - oElementTableFile.SetAttribute("id", nMaxIdFile.ToString()); - oElementTableFile.SetAttribute("name", "Table" + nMaxIdFile.ToString()); - oElementTableFile.SetAttribute("displayName", "Table" + nMaxIdFile.ToString()); - - TableAutoFilter = AutoFilter.CreateNew(worksheet, xml_table_file, xml_worksheet.SelectSingleNode("main:sheetData", ns_manager), oFilterRange); - } - - internal static Table CreateNew(Worksheet worksheet, OOX.TableFile oTableFile, XmlNode xml_worksheet, Cells.CellRange oFilterRange) - { - return new Table(worksheet, oTableFile, xml_worksheet, oFilterRange); - } - - public void RemoveFromXml(int nCountTables) - { - if (null != this.table_node) - { - XmlNode existent_table = this.table_node.SelectSingleNode("main:tablePart[@mainr:id='" + rId + "']", this.ns_manager); - if (null != existent_table) - { - existent_table.ParentNode.RemoveChild(existent_table); - - this.table_node.Attributes["count"].Value = (nCountTables - 1).ToString(); - } - } - - this.m_oTableFile.Remove(); - } - - public Dictionary ChangeAutoFilter(AutoFilterElementSendData oChangeObject) - { - return this.TableAutoFilter.ChangeAutoFilter(oChangeObject); - } - - public bool isCellHeader(int row, int col) - { - if (null == TableAutoFilter || null == TableAutoFilter.m_oRefRange) - return false; - - if (row == TableAutoFilter.m_oRefRange.RowFirst && - TableAutoFilter.m_oRefRange.ColumnFirst <= col && col <= TableAutoFilter.m_oRefRange.ColumnLast) - return true; - - return false; - } - - public void changeCellHeader(int col) - { - if (null == TableAutoFilter || null == TableAutoFilter.m_oRefRange) - return; - - Range oRange = new Range(Helpers.ReferencesFormat.column2str(col, true) + TableAutoFilter.m_oRefRange.RowFirst, worksheet); - string strValue = oRange.DispValue.ToString(); - - int nColId = col - TableAutoFilter.m_oRefRange.ColumnFirst + 1; - string strColId = nColId.ToString(); - foreach (var pair in m_mapTableColumns) - { - if (pair.Value.m_strId == strColId) - { - TableColumn oTableColumn = pair.Value; - m_mapTableColumns.Remove(oTableColumn.m_strName); - - oTableColumn.m_strName = strValue; - strValue = addTableColumnToMap(oTableColumn); - - XmlElement oXmlTableColumnNode = (XmlElement)table_columns_node.SelectSingleNode("main:tableColumn[@id = '" + strColId + "']", ns_manager); - if (null != oXmlTableColumnNode) - oXmlTableColumnNode.SetAttribute("name", strValue); - - oRange.ValueType = "s"; - oRange.updateHeaders = false; - oRange.Value = strValue; - break; - } - } - } - - private int MaxIdFile(XmlNode xml_worksheet) - { - int nMaxIdFile = 0; - - string template_path = "../tables/table.xml"; - int last_slash_pos = template_path.LastIndexOf("/"); - string folder_path = template_path.Substring(0, last_slash_pos + 1); /* (last_slash_pos == -1) is taken into account here too */ - XmlNode target_folder = Helpers.OOXNavigate.getFolderReferenceByPath(folder_path, xml_worksheet.ParentNode.ParentNode, true); - foreach (XmlNode oNodeChild in target_folder.ChildNodes) - { - int nId = System.Convert.ToInt32(oNodeChild.ChildNodes[0].Attributes["id"].Value); - nMaxIdFile = Math.Max(nMaxIdFile, nId); - } - - return nMaxIdFile; - } - - private string addTableColumnToMap(TableColumn oTableColumn) - { - if (m_mapTableColumns.ContainsKey(oTableColumn.m_strName)) - { - int nIndex = 2; - while (m_mapTableColumns.ContainsKey(oTableColumn.m_strName + nIndex)) - ++nIndex; - oTableColumn.m_strName = oTableColumn.m_strName + nIndex; - } - - m_mapTableColumns.Add(oTableColumn.m_strName, oTableColumn); - return oTableColumn.m_strName; - } - - public string TableStyle { get; private set; } - public AutoFilter TableAutoFilter { get; private set; } - public string rId { get; set; } - - private XmlNode table_node; - private XmlNode table_columns_node; - private XmlNode xml_table_file; - private Worksheet worksheet; - private XmlNamespaceManager ns_manager; - private OOX.TableFile m_oTableFile; - - private Dictionary m_mapTableColumns = new Dictionary(); - } - - public class TableStyle - { - // Summary: - // Specifies the line style for the border. - public enum XlLineStyle - { - // Summary: - // No line. - xlLineStyleNone = -4142, - // - // Summary: - // Double line. - xlDouble = -4119, - // - // Summary: - // Dotted line. - xlDot = -4118, - // - // Summary: - // Dashed line. - xlDash = -4115, - // - // Summary: - // Continuous line. - xlContinuous = 1, - // - // Summary: - // Alternating dashes and dots. - xlDashDot = 4, - // - // Summary: - // Dash followed by two dots. - xlDashDotDot = 5, - // - // Summary: - // Slanted dashes. - xlSlantDashDot = 13, - }; - - public struct TableStyleElemBorder - { - public XlLineStyle LineStyle; - public string Color; - public int? Size; - }; - - public struct TableStyleElem - { - public bool? Bold; - public bool? Italic; - public bool? Underline; - public string Color; - public string BgColor; - - public TableStyleElemBorder EdgeLeft; - public TableStyleElemBorder EdgeTop; - public TableStyleElemBorder EdgeBottom; - public TableStyleElemBorder EdgeRight; - public TableStyleElemBorder InsideVertical; - public TableStyleElemBorder InsideHorizontal; - }; - - public static TableStyle GetDefaultTableStyle(string strName) - { - TableStyle oDefaultTableStyle = new TableStyle(); - - string strXml = ResourceExcelDefaultStyles.ResourceManager.GetString(strName); - if (string.IsNullOrEmpty(strXml)) - return null; - - XmlDocument oDoc = new XmlDocument(); - oDoc.LoadXml(strXml); - - oDefaultTableStyle.HeaderStyle = LoadStyleElem(oDoc, "headerRow"); - oDefaultTableStyle.FirstRowStyle = LoadStyleElem(oDoc, "firstRowStripe"); - oDefaultTableStyle.SecondRowStyle = LoadStyleElem(oDoc, "secondRowStripe"); - oDefaultTableStyle.WholeTableStyle = LoadStyleElem(oDoc, "wholeTable"); - - return oDefaultTableStyle; - } - - public static TableStyleElem LoadStyleElem(XmlDocument oDoc, string strName) - { - TableStyleElem oElem = new TableStyleElem(); - XmlNode oXmlNode = oDoc.SelectSingleNode("/TableStyle/TableStyleElement[@name='" + strName + "']"); - if (null != oXmlNode) - { - if (null != oXmlNode.Attributes["Bold"]) - oElem.Bold = "true" == oXmlNode.Attributes["Bold"].Value; - if (null != oXmlNode.Attributes["Italic"]) - oElem.Italic = "true" == oXmlNode.Attributes["Italic"].Value; - if (null != oXmlNode.Attributes["Underline"]) - oElem.Underline = "true" == oXmlNode.Attributes["Underline"].Value; - if (null != oXmlNode.Attributes["Color"]) - oElem.Color = oXmlNode.Attributes["Color"].Value; - if (null != oXmlNode.Attributes["BgColor"]) - oElem.BgColor = oXmlNode.Attributes["BgColor"].Value; - - oElem.EdgeTop = LoadStyleElemBorder(oXmlNode, "EdgeTop"); - oElem.EdgeLeft = LoadStyleElemBorder(oXmlNode, "EdgeLeft"); - oElem.EdgeBottom = LoadStyleElemBorder(oXmlNode, "EdgeBottom"); - oElem.EdgeRight = LoadStyleElemBorder(oXmlNode, "EdgeRight"); - oElem.InsideVertical = LoadStyleElemBorder(oXmlNode, "InsideVertical"); - oElem.InsideHorizontal = LoadStyleElemBorder(oXmlNode, "InsideHorizontal"); - } - - return oElem; - } - - public static TableStyleElemBorder LoadStyleElemBorder(XmlNode oXmlNode, string strBorderName) - { - TableStyleElemBorder oElemBorder = new TableStyleElemBorder(); - XmlNode oXmlNodeBorder = oXmlNode.SelectSingleNode(strBorderName); - if (null != oXmlNodeBorder) - { - if (null != oXmlNodeBorder.Attributes["LineStyle"]) - oElemBorder.LineStyle = (XlLineStyle)System.Convert.ToInt32(oXmlNodeBorder.Attributes["LineStyle"].Value); - if (null != oXmlNodeBorder.Attributes["Color"]) - oElemBorder.Color = oXmlNodeBorder.Attributes["Color"].Value; - if (null != oXmlNodeBorder.Attributes["Weight"]) - { - oElemBorder.Size = System.Convert.ToInt32(oXmlNodeBorder.Attributes["Weight"].Value); - if (-4138 == oElemBorder.Size) - oElemBorder.Size = 2; - else - oElemBorder.Size /= 2; - } - } - - return oElemBorder; - } - - public TableStyleElem HeaderStyle { get; private set; } - public TableStyleElem FirstRowStyle { get; private set; } - public TableStyleElem SecondRowStyle { get; private set; } - public TableStyleElem WholeTableStyle { get; private set; } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Theme.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Theme.cs deleted file mode 100644 index 8c51a875f8..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Theme.cs +++ /dev/null @@ -1,80 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor -{ - internal class Theme - { - public Theme(OOX.ContentTypes content_types, OOX.Relationships relationships, Workbook workbook) - { - this.workbook = workbook; - theme_file = new OOX.ThemeFile(content_types, relationships, workbook); - ns_manager = new XmlNamespaceManager(workbook.GetXmlDocument().NameTable); ; - ns_manager.AddNamespace("a", "http://schemas.openxmlformats.org/drawingml/2006/main"); - } - - private XmlNode Get_clrScheme_OrCreate() - { - XmlNode theme_tag = theme_file.GetThemeOrCreate(); - XmlElement themeElements_xml = (XmlElement)theme_tag.SelectSingleNode("a:themeElements", ns_manager); - if (themeElements_xml == null) - { - themeElements_xml = workbook.GetXmlDocument().CreateElement("themeElements", ns_manager.LookupNamespace("a")); - XMLSectionsController.AppendXmlSection(themeElements_xml); - } - XmlElement clrScheme_xml = (XmlElement)themeElements_xml.SelectSingleNode("a:clrScheme", ns_manager); - if (clrScheme_xml == null) - { - clrScheme_xml = workbook.GetXmlDocument().CreateElement("clrScheme", ns_manager.LookupNamespace("a")); - clrScheme_xml.SetAttribute("name", "Standard"); // TODO: duplicate names possible. - themeElements_xml.AppendChild(clrScheme_xml); - } - - return clrScheme_xml; - } - - /// - /// - /// - /// Real theme element (srgbClr or sysClr) index - /// Empty string means the color hasn't been found and shall be set automatic. - /// Textual string means the color has to be detected by its textual representation. - public string GetRGBByColor(int index) - { - XmlNode clrScheme_xml = Get_clrScheme_OrCreate(); - XmlNode color_item = clrScheme_xml.SelectSingleNode("*[position() = " + (index + 1).ToString() + "]", ns_manager); - if (color_item == null) - { - return ""; - } - XmlElement srgbClr_xml = (XmlElement)color_item.SelectSingleNode("a:srgbClr", ns_manager); - if (srgbClr_xml != null) - { - return srgbClr_xml.GetAttribute("val"); - } - XmlElement sysClr_xml = (XmlElement)color_item.SelectSingleNode("a:sysClr", ns_manager); - if (sysClr_xml != null) - { - string lastClr = sysClr_xml.GetAttribute("lastClr"); - if(lastClr.Length != 0) - { - return lastClr; - } - return sysClr_xml.GetAttribute("val"); // Textual value - } - return ""; - } - - internal OOX.IOrderedSections XMLSectionsController { get { return theme_file; } } - - private OOX.ThemeFile theme_file; - #region Tree references - private Workbook workbook; - #endregion - XmlNamespaceManager ns_manager; - - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/CellDeleter.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/CellDeleter.cs deleted file mode 100644 index 4774d13c7f..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/CellDeleter.cs +++ /dev/null @@ -1,74 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor.Walkers -{ - internal class CellDeleter : ICellSetter - { - public CellDeleter(Worksheet parent_sheet) - { - this.parent_sheet = parent_sheet; - ns_manager = parent_sheet.Workbook.NamespaceManager; - cells_unregistrer = new CellsUnregistrer(parent_sheet); - } - - #region ICellSetter Members - - public virtual bool Set(int row, int col, XmlElement cell_tag) - { - Cells.Cell cell = new Cells.Cell(row, col); - // Unregister formula and shared strings - cells_unregistrer.Set(row, col, cell_tag); - // Remove cell XML tag - cell_tag.ParentNode.RemoveChild(cell_tag); - - // Notify recalculation engine - parent_sheet.Workbook.ValuesUpdateManager.NotifyUpdatedCell(cell, parent_sheet); - - return true; - } - - public void PostProcessing() - { - cells_unregistrer.PostProcessing(); - } - - #endregion - - - private Worksheet parent_sheet; - private XmlNamespaceManager ns_manager; - private CellsUnregistrer cells_unregistrer; - } - - internal class ExceptCellDeleter : CellDeleter - { - public ExceptCellDeleter(int excluded_cell_row, int excluded_cell_column, Worksheet parent_sheet) - : base(parent_sheet) - { - this.excluded_cell_row = excluded_cell_row; - this.excluded_cell_column = excluded_cell_column; - } - - #region ICellSetter Members - - public override bool Set(int row, int col, XmlElement cell_tag) - { - if (row == excluded_cell_row && col == excluded_cell_column) - { - return true; - } - return base.Set(row, col, cell_tag); - } - - #endregion - - private int excluded_cell_row; - private int excluded_cell_column; - } - - -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/CellRowNumberCorrector.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/CellRowNumberCorrector.cs deleted file mode 100644 index 8075bcfb4f..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/CellRowNumberCorrector.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.XMLDataSpecific; -using System.Xml.XPath; - -namespace ASCOfficeEWSEditor.Editor.Walkers -{ - internal class CellRowNumberCorrector : ICellSetter - { - public CellRowNumberCorrector(Cells.Offset offset) - { - this.offset = offset; - } - - #region ICellSetter Members - - public bool Set(int row, int col, XmlElement cell_tag) - { - cell_tag.SetAttribute("r", (new Cells.Cell(row, col) + offset).ToString()); - return true; - } - - public void PostProcessing() - { - } - - #endregion - - private readonly Cells.Offset offset; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/CellSimpleGetter.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/CellSimpleGetter.cs deleted file mode 100644 index 9e0db12ebe..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/CellSimpleGetter.cs +++ /dev/null @@ -1,175 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor.Walkers -{ - internal class CellSimpleGetter : IStatCollector - { - public CellSimpleGetter(Workbook workbook, StyleCollectorCache oStyleCache) - { - ns_manager = workbook.NamespaceManager; - m_oWorkbook = workbook; - m_oWorksheet = workbook.ActiveSheet as Worksheet; - m_oStyleCache = oStyleCache; - } - - #region IStatCollector Members - - public bool Collect(int row, int col, XmlElement cell_tag) - { - CellSimple oNewCellSimple = new CellSimple(); - oNewCellSimple.ID = (new ASCOfficeEWSEditor.Editor.Cells.Cell(row, col)).ToString(); - - //Style - int xf_index = XMLInt.ParseOrDefault(cell_tag.GetAttribute("s"), -1); - if (xf_index == -1) - { - xf_index = XMLInt.ParseOrDefault(((XmlElement)cell_tag.ParentNode).GetAttribute("s"), -1); - if (xf_index == -1) - { - XmlElement col_tag = (XmlElement)cell_tag.ParentNode.ParentNode.ParentNode.SelectSingleNode( - "main:cols/main:col[@min <= " + col + " and @max >= " + col + "]", ns_manager); - xf_index = col_tag != null ? XMLInt.ParseOrDefault(col_tag.GetAttribute("style"), 0) : 0; - } - } - if (-1 != xf_index) - { - if (null != m_oStyleCache) - oNewCellSimple.Format = m_oStyleCache.GetStyle(xf_index); - else - oNewCellSimple.Format = new Format.FormatSimple(xf_index, m_oWorkbook); - } - else - oNewCellSimple.Format = new Format.FormatSimple(); - - //Formula - XmlNode formula_tag = cell_tag.SelectSingleNode("main:f", ns_manager); - oNewCellSimple.Formula = (formula_tag == null) ? "" : formula_tag.InnerText.Replace(',', ';'); - - //Display value - XmlNode value_tag = cell_tag.SelectSingleNode("main:v", ns_manager); - //если в ячейке есть формула, но нет значения - пересчитывать формулу, с целью получения значения. - if (!string.IsNullOrEmpty(oNewCellSimple.Formula) && (value_tag == null || string.IsNullOrEmpty(value_tag.InnerText))) - { - Cells.Cell current_cell = new Cells.Cell(row, col); - Calculation.CellItem cell_item = m_oWorksheet.SubjectsStorage.GetCellItemOrCreate(current_cell); - cell_item.RecalcFormulaAndUpdateCell(); - m_oWorksheet.Workbook.ValuesUpdateManager.NotifyUpdatedCell(cell_item.Cell, m_oWorksheet); - cell_item.UpdateDelayed = false; - //Повторно запрашиваем значение, потому что оно пересчиталось - value_tag = cell_tag.SelectSingleNode("main:v", ns_manager); - } - if (value_tag == null) - { - oNewCellSimple.DispValue = ""; - oNewCellSimple.InternalValue = ""; - } - else - { - Calculation.Formulas.DataObjects.IDataObject piDataObject = ValueGetter.RecognizeValue(value_tag.InnerText, cell_tag.GetAttribute("t"), m_oWorkbook); - if (piDataObject is Calculation.Formulas.DataObjects.ObjectEmpty || piDataObject == null) - { - oNewCellSimple.DispValue = ""; - oNewCellSimple.InternalValue = ""; - } - else - { - int? number_format_id = oNewCellSimple.Format.NumberFormatId; - if (!number_format_id.HasValue) - { - oNewCellSimple.DispValue = ""; - oNewCellSimple.InternalValue = ""; - } - else - { - string number_format_string = m_oWorkbook.StyleSheet.GetNumberFormatString(number_format_id.Value); - oNewCellSimple.DispValue = (string)NumberFormat.NumberFormatParser.MakeDisplayValue(piDataObject, number_format_string); - oNewCellSimple.ValueType = piDataObject.Type; - oNewCellSimple.InternalValue = piDataObject.ToString(); - //значения формата взяты из web интерфейса - string sLowerFormat = number_format_string.ToLower(); - if ((-1 != sLowerFormat.IndexOf('h') || -1 != sLowerFormat.IndexOf('s')) && - (-1 != sLowerFormat.IndexOf('d') || -1 != sLowerFormat.IndexOf('y'))) - { - number_format_string = "m/d/yy h:mm"; - oNewCellSimple.InternalDate = (string)NumberFormat.NumberFormatParser.MakeDisplayValue(piDataObject, number_format_string); - - } - else if (-1 != sLowerFormat.IndexOf('h') || -1 != sLowerFormat.IndexOf('s')) - { - number_format_string = "h:mm:ss"; - oNewCellSimple.InternalDate = (string)NumberFormat.NumberFormatParser.MakeDisplayValue(piDataObject, number_format_string); - - } - else if (-1 != sLowerFormat.IndexOf('d') || -1 != sLowerFormat.IndexOf('y')) - { - number_format_string = "mm-dd-yyyy"; - oNewCellSimple.InternalDate = (string)NumberFormat.NumberFormatParser.MakeDisplayValue(piDataObject, number_format_string); - } - else - { - number_format_string = "General"; - oNewCellSimple.InternalDate = (string)NumberFormat.NumberFormatParser.MakeDisplayValue(piDataObject, number_format_string); - } - } - } - } - - //Hyperlink - oNewCellSimple.Hyperlink = ""; - Cells.Cell oCell = new Cells.Cell(row, col); - Hyperlinks.Hyperlink oCurHyp = m_oWorksheet.Hyperlinks[oCell.ToString()]; - if (null != oCurHyp) - { - //для гиперссылки возвращаем строку "hyp|{URL}" - //для внутренней возвращаем строку "ran|{SheetName}|{Range}" - if (true == oCurHyp.IsLocationOrAddressType) - oNewCellSimple.Hyperlink = "ran" + HyperlinkGetter.g_cCharDelimiter + oCurHyp.ReferredSheet.Name + HyperlinkGetter.g_cCharDelimiter + oCurHyp.ReferredRange; - else - oNewCellSimple.Hyperlink = "hyp" + HyperlinkGetter.g_cCharDelimiter + oCurHyp.Target; - } - - //HasMergedCells - oNewCellSimple.HasMergedCells = m_oWorksheet.MergeCells.HasMergedCells(new Cells.CellRange(oCell.ToString(), m_oWorkbook)); - - m_oCells.Add(oNewCellSimple); - return true; - } - - public Format.FormatSimple GetFormat(int xf_index) - { - if (null != m_oStyleCache) - return m_oStyleCache.GetStyle(xf_index); - - return new Format.FormatSimple(xf_index, m_oWorkbook); - } - - public bool Collect(int row, int col, Worksheet parent_sheet) - { - return false; - } - - #endregion - - public List Value - { - get - { - return m_oCells; - } - } - - private XmlNamespaceManager ns_manager; - private string raw_value; - Workbook m_oWorkbook; - Worksheet m_oWorksheet; - StyleCollectorCache m_oStyleCache; - List m_oCells = new List(); - - public Dictionary m_arrRowsDefaultStyle = new Dictionary(); - public List m_arrCollsDefaultStyle = new List(); - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/CellWalker.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/CellWalker.cs deleted file mode 100644 index 6de9c7d0b4..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/CellWalker.cs +++ /dev/null @@ -1,170 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor.Walkers -{ - internal class CellWalker - { - public CellWalker(Cells.Cell cell_coords, Worksheet parent_sheet) - { - this.cell_coords = cell_coords; - this.parent_sheet = parent_sheet; - this.sheetData_tag = parent_sheet.SheetData; - - ns_manager = parent_sheet.Workbook.NamespaceManager; - } - - - /// - /// Collect statistics from all existent cells. - /// Note: Don't use if you want to collect after setting. Use ChangeCells with two parameters for that purpose - /// - /// - public void CollectStatistics(IStatCollector collector) - { - XmlElement cell_tag_found = null; //(XmlElement)sheetData_tag.SelectSingleNode("main:row[@r = " + cell_coords.Row + "]/main:c[@r = '" + cell_coords.ToString() + "']", ns_manager); - - string row_str = cell_coords.Row.ToString(); - string cell_str = cell_coords.ToString(); - XmlNodeList oXmlNodesRowList = sheetData_tag.SelectNodes("main:row", ns_manager); - try - { - XmlElement row_tag = (XmlElement)oXmlNodesRowList[0]; - while (null != row_tag) - { - if (row_tag.GetAttribute("r") == row_str) - { - XmlNodeList oXmlNodesC = row_tag.SelectNodes("main:c", ns_manager); - try - { - XmlElement cell_tag = (XmlElement)oXmlNodesC[0]; - while (null != cell_tag) - { - if (cell_tag.GetAttribute("r") == cell_str) - { - cell_tag_found = cell_tag; - break; - } - cell_tag = (XmlElement)cell_tag.NextSibling; - } - } - catch { } - if (null != cell_tag_found) - break; - } - row_tag = (XmlElement)row_tag.NextSibling; - } - } - catch { } - - if(cell_tag_found != null) - { - collector.Collect(cell_coords.Row, cell_coords.Column, cell_tag_found); - } - else - { - collector.Collect(cell_coords.Row, cell_coords.Column, parent_sheet); - } - } - - /// - /// Create the cell if absent and update cells according to the passed setter. - /// - /// Any setter - public void ChangeValues(ICellSetter setter) - { - XmlElement row_tag = (XmlElement)sheetData_tag.SelectSingleNode("main:row[@r = " + cell_coords.Row + "]", ns_manager); - if(row_tag == null) - { - row_tag = sheetData_tag.OwnerDocument.CreateElement("row", ns_manager.LookupNamespace("main")); - row_tag.SetAttribute("r", cell_coords.Row.ToString()); - sheetData_tag.InsertBefore(row_tag, sheetData_tag.SelectSingleNode("main:row[@r > " + cell_coords.Row + "]", ns_manager)); - } - XmlElement cell_tag = (XmlElement)row_tag.SelectSingleNode("main:c[@r = '" + cell_coords.ToString() + "']", ns_manager); - if (cell_tag == null) - { - cell_tag = sheetData_tag.OwnerDocument.CreateElement("c", ns_manager.LookupNamespace("main")); - cell_tag.SetAttribute("r", cell_coords.ToString()); - - try - { - XmlNodeList oXmlNodeListC = row_tag.SelectNodes("main:c", ns_manager); - XmlElement insertion_place = (XmlElement)oXmlNodeListC[0]; - while (null != insertion_place) - { - int col = Helpers.ReferencesFormat.str2column(cell_tag.GetAttribute("r")); - if (col > cell_coords.Column) - { - row_tag.InsertBefore(cell_tag, insertion_place); - break; - } - insertion_place = (XmlElement)insertion_place.NextSibling; - } - } - catch { } - - if(cell_tag.ParentNode == null) - { - row_tag.AppendChild(cell_tag); - } - } - setter.Set(cell_coords.Row, cell_coords.Column, cell_tag); - setter.PostProcessing(); - } - -/* - /// - /// Collect statistics from all existent cells and all non-existent cells. - /// Note: Don't use if you want to collect after setting. Use ChangeCells with two parameters for that purpose - /// - /// - public void CollectStatisticsIncludingEmpty(IStatCollector collector) - { - rows_walker.CollectStatisticsIncludingEmpty(new RowsCellCollector(range_coords, sheetData_tag, collector)); - } - - /// - /// Goes through the existent cells among specified ones and update all visited cells according to the passed setter. - /// This means that absent rows and cells are not created - /// - /// - /// Any collector. May be null if you don't want to collect - /// - public bool UpdateValues(ICellSetter setter, IStatCollector collector) - { - bool collector_issued = false; - - foreach (XmlElement row_tag in sheetData_tag.SelectNodes("main:row[@r >= " + range_coords.RowFirst + " and @r <= " + range_coords.RowLast + "]", ns_manager)) - { - int row = XMLInt.Parse(((XmlElement)row_tag).GetAttribute("r"), "@r"); - - foreach (XmlElement cell_tag in row_tag.SelectNodes("main:c", ns_manager)) - { - int col = Helpers.ReferencesFormat.str2column(cell_tag.GetAttribute("r")); - if (col >= range_coords.ColumnFirst && col <= range_coords.ColumnLast) - { - if(!setter.Set(row, col, cell_tag)) - { - return collector_issued; - } - if (collector != null) - { - collector.Collect(row, col, cell_tag); - } - } - } - } - setter.PostProcessing(); - return collector_issued; - } -*/ - - private Cells.Cell cell_coords; - private XmlNode sheetData_tag; - private XmlNamespaceManager ns_manager; - private Worksheet parent_sheet; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/CellsCopySetter.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/CellsCopySetter.cs deleted file mode 100644 index 145f72514e..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/CellsCopySetter.cs +++ /dev/null @@ -1,91 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; - -namespace ASCOfficeEWSEditor.Editor.Walkers -{ - internal class CellsCopySetter : ICellSetter - { - public CellsCopySetter(Dictionary source_references, Worksheet source_parent_sheet, Worksheet dest_parent_sheet, Cells.Offset offset) - { - this.source_parent_sheet = source_parent_sheet; - this.dest_parent_sheet = dest_parent_sheet; - source_ns_manager = source_parent_sheet.Workbook.NamespaceManager; - dest_ns_manager = dest_parent_sheet.Workbook.NamespaceManager; - this.offset = offset; - this.source_references = source_references; - cells_unregistrer = new CellsUnregistrer(dest_parent_sheet); - } - - #region ICellSetter Members - - public bool Set(int row, int col, XmlElement cell_tag) - { - Cells.Cell dest_cell = new Cells.Cell(row, col); - Cells.Cell source_cell = dest_cell - offset; - XmlElement source_cell_tag = source_references[source_cell]; - - // Create and place new cell tag - XmlElement created_cell_tag = cell_tag.OwnerDocument.CreateElement("c", dest_ns_manager.LookupNamespace("main")); - created_cell_tag.SetAttribute("r", cell_tag.GetAttribute("r")); - string style = source_cell_tag != null ? source_cell_tag.GetAttribute("s") : ""; - if (style.Length != 0 && dest_parent_sheet.Workbook == source_parent_sheet.Workbook) - { - created_cell_tag.SetAttribute("s", style); - } - cell_tag.ParentNode.InsertBefore(created_cell_tag, cell_tag); - // Remove former cell - cell_tag.ParentNode.RemoveChild(cell_tag); - - // Copy hyperlink if it exists in the source cell - dest_parent_sheet.Hyperlinks[dest_cell.ToString()] = source_parent_sheet.Hyperlinks[source_cell.ToString()]; - - if (source_cell_tag == null || !source_cell_tag.HasChildNodes) // If the copied cell is empty - { - // Unregister former cell - cells_unregistrer.Set(row, col, cell_tag); - // Notify recalculation engine - dest_parent_sheet.Workbook.ValuesUpdateManager.NotifyUpdatedCell(dest_cell, dest_parent_sheet); - return true; - } - - // Set Formula or Value to the created cell - XmlNode formula_tag = source_cell_tag.SelectSingleNode("main:f", source_ns_manager); - if(formula_tag != null) - { - FormulaSetter formula_setter = new FormulaSetter(formula_tag.InnerText, source_cell, dest_parent_sheet); - formula_setter.Set(row, col, created_cell_tag); - formula_setter.PostProcessing(); - } - else - { - XmlNode value_tag = source_cell_tag.SelectSingleNode("main:v", source_ns_manager); - Calculation.Formulas.DataObjects.IDataObject elem = ValueGetter.RecognizeValue(value_tag != null ? value_tag.InnerText : null, - source_cell_tag.GetAttribute("t"), source_parent_sheet.Workbook); - ValueSetter value_setter = new ValueSetter(elem, dest_parent_sheet, 1); - value_setter.Set(row, col, created_cell_tag); - value_setter.PostProcessing(); - } - return true; - } - - public void PostProcessing() - { - cells_unregistrer.PostProcessing(); - } - - #endregion - - private Worksheet source_parent_sheet; - private Worksheet dest_parent_sheet; - private XmlNamespaceManager source_ns_manager; - private XmlNamespaceManager dest_ns_manager; - private Cells.Offset offset; - private CellsUnregistrer cells_unregistrer; - - private Dictionary source_references; - } - - -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/CellsNodesCollector.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/CellsNodesCollector.cs deleted file mode 100644 index b4ca6fbe34..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/CellsNodesCollector.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; - -namespace ASCOfficeEWSEditor.Editor.Walkers -{ - internal class CellsNodesCollector : IStatCollector - { - public CellsNodesCollector() - { - found_references = new Dictionary(); - } - - #region IStatCollector Members - - public bool Collect(int row, int col, XmlElement cell_tag) - { - found_references.Add(new Cells.Cell(row, col), cell_tag); - return true; - } - - public bool Collect(int row, int col, Worksheet parent_sheet) - { - found_references.Add(new Cells.Cell(row, col), null); - return true; - } - - #endregion - - public Dictionary FoundReferences { get { return found_references; } } - - private Dictionary found_references; - - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/CellsSubstitutionSetter.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/CellsSubstitutionSetter.cs deleted file mode 100644 index c20a3f0353..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/CellsSubstitutionSetter.cs +++ /dev/null @@ -1,103 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -//using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor.Walkers -{ - internal class CellsSubstitutionSetter : ICellSetter - { - public CellsSubstitutionSetter(Dictionary found_references, List sorted_rows_columns, - Sorting.SortOrientation orientation, Cells.Cell top_left, Worksheet parent_sheet) - { - this.found_references = found_references; - this.orientation = orientation; - this.parent_sheet = parent_sheet; - ns_manager = parent_sheet.Workbook.NamespaceManager; - - this.sorted_rows_columns = sorted_rows_columns; - cells_unregistrer = new CellsUnregistrer(parent_sheet); - this.top_left = top_left; - - } - - #region ICellSetter Members - - public bool Set(int row, int col, XmlElement cell_tag) - { - if ((orientation == Sorting.SortOrientation.by_rows ? row - top_left.Row : col - top_left.Column) < sorted_rows_columns.Count) - { - Cells.Cell other_cell = orientation == Sorting.SortOrientation.by_rows ? new Cells.Cell(sorted_rows_columns[row - top_left.Row].row_column, col) : - new Cells.Cell(row, sorted_rows_columns[col - top_left.Column].row_column); - XmlElement other_cell_tag = found_references[other_cell]; - Cells.Cell cell = new Cells.Cell(row, col); - - // Create and place new cell tag - XmlElement created_cell_tag = cell_tag.OwnerDocument.CreateElement("c", ns_manager.LookupNamespace("main")); - created_cell_tag.SetAttribute("r", cell_tag.GetAttribute("r")); - string style = other_cell_tag != null ? other_cell_tag.GetAttribute("s") : ""; - if(style.Length != 0) - { - created_cell_tag.SetAttribute("s", style); - } - cell_tag.ParentNode.InsertBefore(created_cell_tag, cell_tag); - // Remove former cell - cell_tag.ParentNode.RemoveChild(cell_tag); - - if (other_cell_tag == null || !other_cell_tag.HasChildNodes) // If the copied cell is empty - { - // Unregister former cell - cells_unregistrer.Set(row, col, cell_tag); - // Notify recalculation engine - parent_sheet.Workbook.ValuesUpdateManager.NotifyUpdatedCell(cell, parent_sheet); - - return true; - } - - // Set Formula or Value to the created cell - XmlNode formula_tag = other_cell_tag.SelectSingleNode("main:f", ns_manager); - if(formula_tag != null) - { - FormulaSetter formula_setter = new FormulaSetter(formula_tag.InnerText, other_cell, parent_sheet); - formula_setter.Set(row, col, created_cell_tag); - formula_setter.PostProcessing(); - } - else - { - XmlNode value_tag = other_cell_tag.SelectSingleNode("main:v", ns_manager); - Calculation.Formulas.DataObjects.IDataObject elem = ValueGetter.RecognizeValue(value_tag != null ? value_tag.InnerText : null, - other_cell_tag.GetAttribute("t"), parent_sheet.Workbook); - ValueSetter value_setter = new ValueSetter(elem, parent_sheet, 1); - value_setter.Set(row, col, created_cell_tag); - value_setter.PostProcessing(); - } - } - else - { - ValueSetter value_setter = new ValueSetter(new Calculation.Formulas.DataObjects.ObjectEmpty(), parent_sheet, 1); - value_setter.Set(row, col, cell_tag); - value_setter.PostProcessing(); - } - return true; - } - - public void PostProcessing() - { - cells_unregistrer.PostProcessing(); - } - - #endregion - - private Worksheet parent_sheet; - private XmlNamespaceManager ns_manager; - - private Dictionary found_references; - private List sorted_rows_columns; - private Sorting.SortOrientation orientation; - private CellsUnregistrer cells_unregistrer; - private Cells.Cell top_left; - } - - -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/CellsUnregistrer.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/CellsUnregistrer.cs deleted file mode 100644 index a5ad3d031d..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/CellsUnregistrer.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor.Walkers -{ - internal class CellsUnregistrer : ICellSetter - { - public CellsUnregistrer(Worksheet parent_sheet) - { - this.parent_sheet = parent_sheet; - ns_manager = parent_sheet.Workbook.NamespaceManager; - removed_strings_collector = new RemovedStringsCollector(parent_sheet.Workbook); - } - - #region ICellSetter Members - - public virtual bool Set(int row, int col, XmlElement cell_tag) - { - removed_strings_collector.Collect(row, col, cell_tag); - Cells.Cell cell = new Cells.Cell(row, col); - - // Remove former Formula registration - Calculation.Formulas.CellParsedFormula existent_formula; - if (parent_sheet.Formulas.TryGetValue(cell, out existent_formula)) - { - existent_formula.UnregisterDependencies(); // dependencies are broken here (for example, look into PtgRef.Unregister()) - parent_sheet.Formulas.Remove(cell); - } - return true; - } - - public void PostProcessing() - { - removed_strings_collector.DecrementCounters(); - } - - #endregion - - - private Worksheet parent_sheet; - private XmlNamespaceManager ns_manager; - private RemovedStringsCollector removed_strings_collector; - } - - -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/ColsWalker.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/ColsWalker.cs deleted file mode 100644 index 4c511c4c51..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/ColsWalker.cs +++ /dev/null @@ -1,133 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor.Walkers -{ - internal class ColsWalker - { - public ColsWalker(int colFirst, int colLast, Worksheet parent_sheet) - { - this.colFirst = colFirst; - this.colLast = colLast; - this.parent_sheet = parent_sheet; - this.sheetData_tag = parent_sheet.SheetData; - - ns_manager = parent_sheet.Workbook.NamespaceManager; - } - - - /// - /// Create absent cols in the range and update all the cols according to the passed setter. - /// - /// - public void SetCols(IColsSetter setter) - { - string columnFirst_num_str = colFirst.ToString(); - string columnLast_num_str = colLast.ToString(); - XmlNode cols_node = (XmlElement)sheetData_tag.SelectSingleNode("../main:cols", ns_manager); - if (null == cols_node) - { - cols_node = sheetData_tag.OwnerDocument.CreateElement("cols", ns_manager.LookupNamespace("main")); - sheetData_tag.ParentNode.InsertBefore(cols_node, sheetData_tag); - } - foreach (XmlElement col_elem in sheetData_tag.SelectNodes("../main:cols/main:col", ns_manager)) - { - int min = XMLInt.ParseOrDefaultAndReport(col_elem.GetAttribute("min"), 1, parent_sheet.Workbook, "col/@min"); - int max = XMLInt.ParseOrDefaultAndReport(col_elem.GetAttribute("max"), Helpers.ReferencesFormat.maxCol, parent_sheet.Workbook, "col/@max"); - if (min > max) - { - continue; - } - if (max < colFirst) // 1 - { - continue; - } - else if (min < colFirst && max <= colLast) // obvious: max >= columnFirst // 2 - { - if(!setter.WouldLeftTheSame(col_elem)) - { - XmlElement right_part = (XmlElement)col_elem.CloneNode(false); - col_elem.SetAttribute("max", (colFirst - 1).ToString()); - right_part.SetAttribute("min", columnFirst_num_str); - cols_node.InsertAfter(right_part, col_elem); - } - } - else if (min < colFirst && max > colLast) // 5 - { - if (!setter.WouldLeftTheSame(col_elem)) - { - XmlElement right_part = (XmlElement)col_elem.CloneNode(false); - XmlElement middle_part = (XmlElement)col_elem.CloneNode(false); - col_elem.SetAttribute("max", (colFirst - 1).ToString()); - middle_part.SetAttribute("min", columnFirst_num_str); - middle_part.SetAttribute("max", columnLast_num_str); - right_part.SetAttribute("min", (colFirst + 1).ToString()); - cols_node.InsertAfter(middle_part, col_elem); - cols_node.InsertAfter(right_part, middle_part); - } - } - else if (min <= colLast && max > colLast) // 3 - { - if (!setter.WouldLeftTheSame(col_elem)) - { - XmlElement left_part = (XmlElement)col_elem.CloneNode(false); - col_elem.SetAttribute("min", (colLast + 1).ToString()); - left_part.SetAttribute("max", columnLast_num_str); - cols_node.InsertBefore(left_part, col_elem); - } - } - else if (min <= colLast && max <= colLast) // 4 - { - continue; - } - else // 6 - { - continue; - } - - } - string standard_width_str = XMLDouble.ToString(parent_sheet.StandardWidth); - int last_updated_column = colFirst - 1; - foreach (XmlElement col_elem in sheetData_tag.SelectNodes("../main:cols/main:col[" + - "@min >= " + columnFirst_num_str + " and @min <= " + columnLast_num_str + " and " + - "@max >= " + columnFirst_num_str + " and @max <= " + columnLast_num_str + "]", ns_manager)) - { - int min = XMLInt.ParseOrDefault(col_elem.GetAttribute("min"), 1); - int max = XMLInt.ParseOrDefault(col_elem.GetAttribute("max"), Helpers.ReferencesFormat.maxCol); - if (min > last_updated_column + 1) - { - XmlElement col_ins = (XmlElement)sheetData_tag.OwnerDocument.CreateElement("col", ns_manager.LookupNamespace("main")); - col_ins.SetAttribute("min", (last_updated_column + 1).ToString()); - col_ins.SetAttribute("max", (min - 1).ToString()); - col_ins.SetAttribute("width", standard_width_str); - - setter.Set(col_ins); - - cols_node.InsertBefore(col_ins, col_elem); - } - setter.Set(col_elem); - last_updated_column = max; - } - if (last_updated_column != colLast) - { - XmlElement col_ins = (XmlElement)sheetData_tag.OwnerDocument.CreateElement("col", ns_manager.LookupNamespace("main")); - col_ins.SetAttribute("min", (last_updated_column + 1).ToString()); - col_ins.SetAttribute("max", columnLast_num_str); - col_ins.SetAttribute("width", standard_width_str); - - setter.Set(col_ins); - - cols_node.InsertBefore(col_ins, cols_node.SelectSingleNode("main:col[@min > " + columnLast_num_str + "]", ns_manager)); - } - } - - private int colFirst; - private int colLast; - private XmlNamespaceManager ns_manager; - private XmlNode sheetData_tag; - private Worksheet parent_sheet; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/ExistentCellsCollector.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/ExistentCellsCollector.cs deleted file mode 100644 index a4254806ab..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/ExistentCellsCollector.cs +++ /dev/null @@ -1,98 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; - -namespace ASCOfficeEWSEditor.Editor.Walkers -{ - internal class ExistentCellsCollector : IStatCollector - { - public ExistentCellsCollector(Worksheet parent_sheet) - { - this.parent_sheet = parent_sheet; - found_cells = new List(); - found_references = new List(); - } - - #region IStatCollector Members - - public bool Collect(int row, int col, XmlElement cell_tag) - { - string cell_reference = cell_tag.GetAttribute("r"); - found_cells.Add(new Cells.CellRange3D(new Cells.CellRange(cell_reference, parent_sheet.Workbook), parent_sheet)); - found_references.Add(cell_reference); - CountRowCol(row, col); - return true; - } - private void CountRowCol(int row, int col) - { - if (!row_min.HasValue || row < row_min.Value) - { - row_min = row; - } - if (!row_max.HasValue || row > row_max.Value) - { - row_max = row; - } - if (!col_min.HasValue || col < col_min.Value) - { - col_min = col; - } - if (!col_max.HasValue || col > col_max.Value) - { - col_max = col; - } - } - - internal Cells.CellRange GetRange() - { - if (row_min.HasValue && col_min.HasValue && row_max.HasValue && col_max.HasValue) - { - return new Cells.CellRange(row_min.Value, col_min.Value, row_max.Value, col_max.Value); - } - return Cells.CellRange.Empty; - } - - public bool Collect(int row, int col, Worksheet parent_sheet) - { - return true; // skip - } - - #endregion - - public List GetFoundCells() - { - return found_cells; - } - - public List GetFoundReferences() - { - return found_references; - } - public List GetFoundBounds(out int r_min, out int r_max, out int c_min, out int c_max) - { - r_min = 0; - r_max = 0; - c_min = 0; - c_max = 0; - if (true == row_min.HasValue) - r_min = row_min.Value; - if (true == row_max.HasValue) - r_max = row_max.Value; - if (true == col_min.HasValue) - c_min = col_min.Value; - if (true == col_max.HasValue) - c_max = col_max.Value; - return found_references; - } - - private List found_cells; - private List found_references; - private Worksheet parent_sheet; - - int? row_min; - int? row_max; - int? col_min; - int? col_max; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/FirstNonEmptyFormulaValueCollector.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/FirstNonEmptyFormulaValueCollector.cs deleted file mode 100644 index 7f62a4ebb5..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/FirstNonEmptyFormulaValueCollector.cs +++ /dev/null @@ -1,54 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor.Walkers -{ - internal class FirstNonEmptyFormulaValueCollector : IStatCollector - { - public FirstNonEmptyFormulaValueCollector(Workbook workbook) - { - this.workbook = workbook; - ns_manager = workbook.NamespaceManager; - Value = null; - Formula = null; - } - - #region IStatCollector Members - - public bool Collect(int row, int col, XmlElement cell_tag) - { - ValueGetter value_getter = new ValueGetter(workbook); - value_getter.Collect(row, col, cell_tag); - Calculation.Formulas.DataObjects.IDataObject value = value_getter.InternalValue; - - FormulaGetter formula_getter = new FormulaGetter(workbook); - formula_getter.Collect(row, col, cell_tag); - string formula = formula_getter.Value; - if (!(value is Calculation.Formulas.DataObjects.ObjectEmpty || value == null) || formula != null && formula != "") - { - Value = value; - Formula = formula; - return false; // Stop searching - } - return true; // Not found, continue searching - } - - public bool Collect(int row, int col, Worksheet parent_sheet) - { - return true; - } - - #endregion - - - private Workbook workbook; - private XmlNamespaceManager ns_manager; - - internal Calculation.Formulas.DataObjects.IDataObject Value { get; private set; } - internal string Formula { get; private set; } - } - -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/FormulaGetter.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/FormulaGetter.cs deleted file mode 100644 index 59be9e26a5..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/FormulaGetter.cs +++ /dev/null @@ -1,65 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor.Walkers -{ - internal class FormulaGetter : IStatCollector - { - public FormulaGetter(Workbook workbook) - { - ns_manager = workbook.NamespaceManager; - raw_value = null; -// value_type = null; - } - - #region IStatCollector Members - - public bool Collect(int row, int col, XmlElement cell_tag) - { - XmlNode formula_tag = cell_tag.SelectSingleNode("main:f", ns_manager); - return CollectValue(formula_tag == null ? "" : formula_tag.InnerText/*, ((XmlElement)cell_tag).GetAttribute("t")*/); - } - - public bool Collect(int row, int col, Worksheet parent_sheet) - { - return CollectValue(""/*, ""*/); - } - - #endregion - - private bool CollectValue(string value_extracted/*, string type_extracted*/) - { - if (raw_value == null) - { - raw_value = value_extracted; -// value_type = type_extracted; - return true; // continue - } - else if (/*value_type == type_extracted && */raw_value == value_extracted) - { - return true; // continue - } - else - { - raw_value = null; -// value_type = null; - return false; - } - } - - public string Value - { - get - { - return raw_value; - } - } - - private XmlNamespaceManager ns_manager; - private string raw_value; -// private string value_type; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/FormulaRecheck.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/FormulaRecheck.cs deleted file mode 100644 index 0303cbea2a..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/FormulaRecheck.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor.Walkers -{ - /// - /// Designed to be called with RangeWalker.UpdateCells or CellWalker.UpdateCells - /// - internal class FormulaRecheck : ICellSetter - { - public FormulaRecheck(Worksheet parent_sheet) - { - this.parent_sheet = parent_sheet; - } - - #region ICellSetter Members - - public bool Set(int row, int col, XmlElement cell_tag) - { - Cells.Cell current_cell = new Cells.Cell(row, col); - Calculation.CellItem cell_item = parent_sheet.SubjectsStorage.GetCellItemOrCreate(current_cell); - Calculation.Formulas.CellParsedFormula current_formula; - if (cell_item.GetValue() != null && cell_item.GetValue().UserValue!=null && cell_item.GetValue().UserValue.Equals("") && parent_sheet.Formulas.TryGetValue(current_cell, out current_formula)) - { - cell_item.RecalcFormulaAndUpdateCell(); - parent_sheet.Workbook.ValuesUpdateManager.NotifyUpdatedCell(cell_item.Cell, parent_sheet); - cell_item.UpdateDelayed = false; - } - - return true; - } - - public void PostProcessing() - { - } - - #endregion - - private Worksheet parent_sheet; - } - -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/FormulaSetter.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/FormulaSetter.cs deleted file mode 100644 index 3cc42f7274..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/FormulaSetter.cs +++ /dev/null @@ -1,145 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor.Walkers -{ - internal class FormulaSetter : ICellSetter - { - /// - /// - /// - /// - /// Top left cell of the set range or other base cell if the formula is copied from somewhere - /// - public FormulaSetter(string formula, Cells.Cell base_cell, Worksheet parent_sheet) - { - this.parent_sheet = parent_sheet; - this.base_cell = base_cell; - this.formula_origin = formula; - } - - #region ICellSetter Members - - public bool Set(int row, int col, XmlElement cell_tag) - { - Cells.Cell cell = new Cells.Cell(row, col); - Calculation.Formulas.CellParsedFormula cell_parsed_formula = new Calculation.Formulas.CellParsedFormula(cell, parent_sheet); - if (!cell_parsed_formula.Parse(formula_origin, cell - base_cell)) - { - string formula_origin_error = formula_origin.Replace(";", ","); - - if (cell_parsed_formula.LastError.GetType() != new Events.UnknownOperandError("", 0).GetType() && - cell_parsed_formula.LastError.GetType() != new Events.UnknownOperatorError("", 0).GetType()) - return false; - - FormulaSimpleSetter simple_setter_error = new FormulaSimpleSetter(formula_origin_error, parent_sheet); - simple_setter_error.Set(row, col, cell_tag); - - // Remove former Formula registration - Calculation.Formulas.CellParsedFormula existent_formula_error; - if (parent_sheet.Formulas.TryGetValue(cell, out existent_formula_error)) - { - existent_formula_error.UnregisterDependencies(); // dependencies are broken here (for example, look into PtgRef.UnregisterDependency()) - // The former formula is not removed from parent_sheet.Formulas because the new one is set in the next line - } - - // New Formula registration - parent_sheet.Formulas[cell] = cell_parsed_formula; - cell_parsed_formula.RegisterDependencies(); // After this line we can be sure that the cell has an associated observer - - Calculation.CellItem observer_error = parent_sheet.SubjectsStorage.GetCellItemOrCreate(cell); - - observer_error.CellSetErrorValue(new Calculation.Formulas.DataObjects.ObjectError(Calculation.Formulas.ErrorValue.wrong_name)); - - // Notify recalculation engine - parent_sheet.Workbook.ValuesUpdateManager.NotifyUpdatedCell(cell, parent_sheet); - - return true; - } - FormulaSimpleSetter simple_setter = new FormulaSimpleSetter(cell_parsed_formula.Assemble(), parent_sheet); - simple_setter.Set(row, col, cell_tag); - - // Remove former Formula registration - Calculation.Formulas.CellParsedFormula existent_formula; - if (parent_sheet.Formulas.TryGetValue(cell, out existent_formula)) - { - existent_formula.UnregisterDependencies(); // dependencies are broken here (for example, look into PtgRef.UnregisterDependency()) - // The former formula is not removed from parent_sheet.Formulas because the new one is set in the next line - } - // New Formula registration - parent_sheet.Formulas[cell] = cell_parsed_formula; - cell_parsed_formula.RegisterDependencies(); // After this line we can be sure that the cell has an associated observer - - Calculation.CellItem observer = parent_sheet.SubjectsStorage.GetCellItemOrCreate(cell); - if (!observer.RecalcFormulaAndUpdateCell()) - { - cell_parsed_formula.UnregisterDependencies(); - parent_sheet.Formulas.Remove(cell); - } - - // Notify recalculation engine - parent_sheet.Workbook.ValuesUpdateManager.NotifyUpdatedCell(cell, parent_sheet); - - return true; - } - - public void PostProcessing() - { - } - - #endregion - - private string formula_origin; - private Cells.Cell base_cell; - private Worksheet parent_sheet; - } - - internal class FormulaSimpleSetter : ICellSetter - { - public FormulaSimpleSetter(string formula, Worksheet parent_sheet) - { - this.formula = formula; - ns_manager = parent_sheet.Workbook.NamespaceManager; - } - - #region ICellSetter Members - - public bool Set(int row, int col, XmlElement cell_tag) - { - XmlNode formula_tag = cell_tag.SelectSingleNode("main:f", ns_manager); - if (formula != null && formula.Length != 0) - { - if (formula_tag == null) - { - formula_tag = cell_tag.OwnerDocument.CreateElement("f", ns_manager.LookupNamespace("main")); - cell_tag.InsertBefore(formula_tag, cell_tag.SelectSingleNode("main:v", ns_manager)); - } - else - { - ((XmlElement)formula_tag).RemoveAllAttributes(); - } - formula_tag.InnerText = formula; - } - else - { - if (formula_tag != null) - { - cell_tag.RemoveChild(formula_tag); - } - } - return true; - } - - public void PostProcessing() - { - } - - #endregion - - private string formula; - private XmlNamespaceManager ns_manager; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/FormulaTextAndValueUpdater.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/FormulaTextAndValueUpdater.cs deleted file mode 100644 index de9e169018..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/FormulaTextAndValueUpdater.cs +++ /dev/null @@ -1,52 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor.Walkers -{ - /// - /// Designed to be called with RangeWalker.UpdateCells or CellWalker.UpdateCells - /// - internal class FormulaTextAndValueUpdater : ICellSetter - { - public FormulaTextAndValueUpdater(Worksheet parent_sheet) - { - this.parent_sheet = parent_sheet; - } - - #region ICellSetter Members - - public bool Set(int row, int col, XmlElement cell_tag) - { - Cells.Cell current_cell = new Cells.Cell(row, col); - Calculation.CellItem cell_item = parent_sheet.SubjectsStorage.GetCellItemOrCreate(current_cell); - //Update formula - Calculation.Formulas.CellParsedFormula current_formula; - if (cell_item.CellOrFormulaUpdated && parent_sheet.Formulas.TryGetValue(current_cell, out current_formula)) - { - FormulaSimpleSetter simple_setter = new FormulaSimpleSetter(current_formula.Assemble(), parent_sheet); - simple_setter.Set(current_cell.Row, current_cell.Column, cell_tag); - } - // Update Value - if (cell_item.HasFormula() && cell_item.UpdateDelayed) - { - cell_item.RecalcFormulaAndUpdateCell(); - parent_sheet.Workbook.ValuesUpdateManager.NotifyUpdatedCell(cell_item.Cell, parent_sheet); - cell_item.UpdateDelayed = false; - } - - return true; - } - - public void PostProcessing() - { - } - - #endregion - - private Worksheet parent_sheet; - } - -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/FormulasParser.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/FormulasParser.cs deleted file mode 100644 index 277614a36d..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/FormulasParser.cs +++ /dev/null @@ -1,102 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor.Walkers -{ - class CFormulaInfo - { - public string m_strFormulaText; - public string m_strFormulaR; - } - - internal class FormulasParser : IStatCollector - { - public FormulasParser(Worksheet parent_sheet) - { - this.parent_sheet = parent_sheet; - ns_manager = parent_sheet.Workbook.NamespaceManager; - } - - #region IStatCollector Members - - public bool Collect(int row, int col, XmlElement cell_tag) - { - XmlElement formula_tag = null;// (XmlElement)cell_tag.SelectSingleNode("main:f", ns_manager); - for (int i = 0; i < cell_tag.ChildNodes.Count; i++) - { - if ("f" == cell_tag.ChildNodes[i].Name) - { - formula_tag = (XmlElement)cell_tag.ChildNodes[i]; - break; - } - } - if (formula_tag != null) - { - Cells.Cell cell = new Cells.Cell(row, col); - Calculation.Formulas.CellParsedFormula cell_parsed_formula = new Calculation.Formulas.CellParsedFormula(cell, parent_sheet); - if (formula_tag.InnerText.Length == 0 && formula_tag.GetAttribute("t") == "shared") - { - string si = formula_tag.GetAttribute("si"); - CFormulaInfo oInfo = null; - if (false == m_mapFormulas.TryGetValue(si, out oInfo) || null == oInfo) - { - XmlNode shared_formula_tag = cell_tag.SelectSingleNode("../../main:row/main:c/main:f[@si = " + si + "]", ns_manager); - if (null == shared_formula_tag) - return true; //Just continue with the left correct formulas - - oInfo = new CFormulaInfo(); - oInfo.m_strFormulaText = shared_formula_tag.InnerText; - oInfo.m_strFormulaR = ((XmlElement)shared_formula_tag.ParentNode).GetAttribute("r"); - m_mapFormulas.Add(si, oInfo); - } - Cells.Cell shared_cell = new Cells.Cell(oInfo.m_strFormulaR); - if (!cell_parsed_formula.Parse(oInfo.m_strFormulaText, cell - shared_cell)) - { - return true; //Just continue with the left correct formulas - } - formula_tag.RemoveAttribute("si"); - formula_tag.RemoveAttribute("t"); - formula_tag.InnerText = cell_parsed_formula.Assemble(); - - } - else - { - string strSI = formula_tag.GetAttribute("si"); - if (formula_tag.InnerText.Length != 0 && formula_tag.GetAttribute("t") == "shared" && !string.IsNullOrEmpty(strSI)) - { - CFormulaInfo oFormulaInfo = new CFormulaInfo(); - oFormulaInfo.m_strFormulaText = formula_tag.InnerText; - oFormulaInfo.m_strFormulaR = ((XmlElement)formula_tag.ParentNode).GetAttribute("r"); - m_mapFormulas.Add(strSI, oFormulaInfo); - } - - if (!cell_parsed_formula.Parse(formula_tag.InnerText, Cells.Offset.Null)) - { - return true; //Just continue with the left correct formulas - } - } - parent_sheet.Formulas[cell] = cell_parsed_formula; - cell_parsed_formula.RegisterDependencies(); - } - return true; - } - - public bool Collect(int row, int col, Worksheet parent_sheet) - { - return true; - } - - #endregion - - #region Methods - private Dictionary m_mapFormulas = new Dictionary(); - #endregion - - private XmlNamespaceManager ns_manager; - private Worksheet parent_sheet; - - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/HyperlinkGetter.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/HyperlinkGetter.cs deleted file mode 100644 index f713b09f97..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/HyperlinkGetter.cs +++ /dev/null @@ -1,59 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor.Walkers -{ - internal class HyperlinkGetter : IStatCollector - { - public const char g_cCharDelimiter = (char)5; - public HyperlinkGetter(Worksheet worksheet) - { - this.m_oWorksheet = worksheet; - } - - #region IStatCollector Members - - public bool Collect(int row, int col, XmlElement cell_tag) - { - return CollectValue( row, col, m_oWorksheet); - } - - public bool Collect(int row, int col, Worksheet parent_sheet) - { - return CollectValue(row, col, parent_sheet); - } - - #endregion - - private bool CollectValue(int row, int col, Worksheet sheet) - { - m_sValue = ""; - Cells.Cell oCell = new Cells.Cell(row, col); - Hyperlinks.Hyperlink oCurHyp = sheet.Hyperlinks[oCell.ToString()]; - if (null != oCurHyp) - { - //для гиперссылки возвращаем строку "hyp|{URL}" - //для внутренней возвращаем строку "ran|{SheetName}|{Range}" - if (true == oCurHyp.IsLocationOrAddressType) - m_sValue = "ran" + g_cCharDelimiter + oCurHyp.ReferredSheet.Name + g_cCharDelimiter + oCurHyp.ReferredRange; - else - m_sValue = "hyp" + g_cCharDelimiter + oCurHyp.Target; - } - return true; - } - - public string Value - { - get{return m_sValue;} - } - - private XmlNamespaceManager ns_manager; - private string raw_value; - private string m_sValue; - private Worksheet m_oWorksheet; - - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/HyperlinkSetter.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/HyperlinkSetter.cs deleted file mode 100644 index 659c70f100..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/HyperlinkSetter.cs +++ /dev/null @@ -1,82 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.XMLDataSpecific; -using System.Globalization; - -namespace ASCOfficeEWSEditor.Editor.Walkers -{ - internal class HyperlinkSetter : ICellSetter - { - public HyperlinkSetter( Worksheet parent_sheet, string sValue ) - { - this.m_oWorksheet = parent_sheet; - this.m_sValue = sValue; - } - #region ICellSetter Members - - public bool Set(int row, int col, XmlElement cell_tag) - { - Cells.Cell cell = new Cells.Cell(row, col); - Hyperlinks.Hyperlink oCurHyp = m_oWorksheet.Hyperlinks[cell.ToString()]; - //удаляем ссылку если существует( т.к. иначе не менялся тип ссылки с url на внутреннюю ) - if (null != oCurHyp) - m_oWorksheet.Hyperlinks.RemoveHyperlink(cell); - - Hyperlinks.Hyperlink oNewHyp = new Hyperlinks.Hyperlink(m_oWorksheet); - oNewHyp.Anchor = cell.ToString(); - ParseValue(ref oNewHyp); - if (null != oNewHyp) - m_oWorksheet.Hyperlinks[cell.ToString()] = oNewHyp; - return true; - } - - public void PostProcessing() - { - } - - #endregion - - private void ParseValue( ref Hyperlinks.Hyperlink hyp) - { - //для гиперссылки формат "hyp|{URL}" - //для внутренней формат "ran|{SheetName}|{Range}" - string[] aParams = m_sValue.Split( HyperlinkGetter.g_cCharDelimiter ); - if (2 == aParams.Length && "hyp" == aParams[0]) - { - if ("" != aParams[1]) - { - hyp.Target = aParams[1]; - hyp.ReferredSheet = null; - hyp.ReferredRange = ""; - } - else - hyp = null; - } - else if (3 == aParams.Length && "ran" == aParams[0]) - { - if ("" == aParams[1] || "" == aParams[1]) - hyp = null; - else - { - string sLocation = aParams[1] + "!" + aParams[2]; - int start_pos = 0; - Worksheet ws_from; - Worksheet ws_to; - if (Calculation.Formulas.ParsedFormula.extract_3D_part(sLocation, ref start_pos, out ws_from, out ws_to, m_oWorksheet.Workbook)) - { - hyp.Target = ""; - hyp.ReferredSheet = ws_from; - hyp.ReferredRange = sLocation.Substring(start_pos); - } - } - } - else - hyp = null; - } - - private Worksheet m_oWorksheet; - private string m_sValue; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/ICellSetter.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/ICellSetter.cs deleted file mode 100644 index d91ba5f367..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/ICellSetter.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; - -namespace ASCOfficeEWSEditor.Editor.Walkers -{ - public interface ICellSetter - { - bool Set(int row, int col, XmlElement cell_tag); - void PostProcessing(); - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/IColsSetter.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/IColsSetter.cs deleted file mode 100644 index 13273564c5..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/IColsSetter.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; - -namespace ASCOfficeEWSEditor.Editor.Walkers -{ - internal interface IColsSetter - { - bool WouldLeftTheSame(XmlElement col_tag); - void Set(XmlElement col_tag); - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/IRowsCollector.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/IRowsCollector.cs deleted file mode 100644 index 60d94daa8d..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/IRowsCollector.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; - -namespace ASCOfficeEWSEditor.Editor.Walkers -{ - internal interface IRowsCollector - { - bool CollectIncludingEmpty(XmlElement row_tag, int row_num); - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/IRowsSetter.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/IRowsSetter.cs deleted file mode 100644 index 77c03f0c39..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/IRowsSetter.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; - -namespace ASCOfficeEWSEditor.Editor.Walkers -{ - internal interface IRowsSetter - { - bool Set(XmlElement row_tag, int row_num); - void PostProcessing(); - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/IStatCollector.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/IStatCollector.cs deleted file mode 100644 index 5ab6d29d6e..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/IStatCollector.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; - -namespace ASCOfficeEWSEditor.Editor.Walkers -{ - public interface IStatCollector - { - /// - /// Issued when the cell exists - /// - /// - /// - /// - /// - bool Collect(int row, int col, XmlElement cell_tag); - /// - /// Issued when the cell doesn't exist - /// - /// - /// - /// - /// - bool Collect(int row, int col, Worksheet parent_sheet); - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/NonEmptyCellsCollector.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/NonEmptyCellsCollector.cs deleted file mode 100644 index 6a77c043fd..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/NonEmptyCellsCollector.cs +++ /dev/null @@ -1,102 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; - -namespace ASCOfficeEWSEditor.Editor.Walkers -{ - internal class NonEmptyCellsCollector : IStatCollector - { - public NonEmptyCellsCollector(Worksheet parent_sheet) - { - this.parent_sheet = parent_sheet; - found_cells = new List(); - found_references = new List(); - ns_manager = parent_sheet.Workbook.NamespaceManager; - } - - #region IStatCollector Members - - public bool Collect(int row, int col, XmlElement cell_tag) - { - XmlNode v_tag = cell_tag.SelectSingleNode("main:v",ns_manager); - if(v_tag != null && v_tag.InnerText.Length != 0) - { - string cell_reference = cell_tag.GetAttribute("r"); - found_cells.Add(new Cells.CellRange3D(new Cells.CellRange(cell_reference, parent_sheet.Workbook), parent_sheet)); - found_references.Add(cell_reference); - CountRowCol(row, col); - } - return true; - } - - public bool Collect(int row, int col, Worksheet parent_sheet) - { - return true; // skip - } - - #endregion - - private void CountRowCol(int row, int col) - { - if (!row_min.HasValue || row < row_min.Value) - { - row_min = row; - } - if (!row_max.HasValue || row > row_max.Value) - { - row_max = row; - } - if (!col_min.HasValue || col < col_min.Value) - { - col_min = col; - } - if (!col_max.HasValue || col > col_max.Value) - { - col_max = col; - } - } - - public List GetFoundCells() - { - return found_cells; - } - - public List GetFoundReferences() - { - return found_references; - } - - internal Cells.CellRange GetRange() - { - if (row_min.HasValue && col_min.HasValue && row_max.HasValue && col_max.HasValue) - { - return new Cells.CellRange(row_min.Value, col_min.Value, row_max.Value, col_max.Value); - } - return Cells.CellRange.Empty; - } - - /// - /// The difference from GetRange is that Get0Range returns range started in A1 and ended in max used cell - /// - /// - internal Cells.CellRange Get0Range() - { - if (row_max.HasValue && col_max.HasValue) - { - return new Cells.CellRange(1, 1, row_max.Value, col_max.Value); - } - return Cells.CellRange.Empty; - } - - private List found_cells; - private List found_references; - private XmlNamespaceManager ns_manager; - private Worksheet parent_sheet; - - int? row_min; - int? row_max; - int? col_min; - int? col_max; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/RangeWalker.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/RangeWalker.cs deleted file mode 100644 index af4fd79109..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/RangeWalker.cs +++ /dev/null @@ -1,275 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.XMLDataSpecific; -using System.Diagnostics; - -namespace ASCOfficeEWSEditor.Editor.Walkers -{ - public class RangeWalker - { - public RangeWalker(Cells.CellRange range_coords, Worksheet parent_sheet) - { - this.range_coords = range_coords; - this.parent_sheet = parent_sheet; - this.sheetData_tag = parent_sheet.SheetData; - - ns_manager = parent_sheet.Workbook.NamespaceManager; - - rows_walker = new RowsWalker(range_coords.RowFirst, range_coords.RowLast, parent_sheet); - cols_walker = new ColsWalker(range_coords.ColumnFirst, range_coords.ColumnLast, parent_sheet); - } - - - /// - /// Collect statistics from all existent cells. - /// Note: Don't use if you want to collect after setting. Use ChangeCells with two parameters for that purpose - /// - /// - public void CollectStatistics(IStatCollector collector) - { - if (range_coords.IsSingleCell) - { - new CellWalker(range_coords.TopLeft, parent_sheet).CollectStatistics(collector); - return; - } - int last_updated_row = range_coords.RowFirst - 1; - List empty_row_cells = new List(); - int empty_row_cells_row_list = -1; - int empty_row_cells_row = -1; - //int collector_issued_times = 0; - - CellSimpleGetter oCellSimple = collector as CellSimpleGetter; - if (null != oCellSimple) - { - XmlNodeList oXmlCollsList = sheetData_tag.ParentNode.SelectNodes("main:cols", ns_manager); - if (null != oXmlCollsList && 0 < oXmlCollsList.Count) - { - XmlElement oCollTag = (XmlElement)oXmlCollsList[0].FirstChild; - while (null != oCollTag) - { - Format.CCollFormat oCollFormat; - - oCollFormat.m_nMin = XMLInt.ParseOrDefault(((XmlElement)oCollTag).GetAttribute("min"), 0); - oCollFormat.m_nMax = XMLInt.ParseOrDefault(((XmlElement)oCollTag).GetAttribute("max"), 0); - int nStyleColl = XMLInt.ParseOrDefault(((XmlElement)oCollTag).GetAttribute("style"), 0); - oCollFormat.m_oFormatSimple = oCellSimple.GetFormat(nStyleColl); - oCellSimple.m_arrCollsDefaultStyle.Add(oCollFormat); - - oCollTag = (XmlElement)oCollTag.NextSibling; - } - } - } - - XmlNodeList oXmlNodeList = sheetData_tag.SelectNodes("main:row", ns_manager); - try - { - XmlElement row_tag = (XmlElement)oXmlNodeList[0]; - while (null != row_tag) - { - int row = XMLInt.ParseOrDefault(((XmlElement)row_tag).GetAttribute("r"), 0); - if (row >= range_coords.RowFirst) - break; - row_tag = (XmlElement)row_tag.NextSibling; - } - - while (null != row_tag) - { - int row = XMLInt.ParseOrDefault(((XmlElement)row_tag).GetAttribute("r"), 0); - if (row > range_coords.RowLast) - break; - - if (last_updated_row + 1 < row && -1 == empty_row_cells_row) - empty_row_cells_row = last_updated_row + 1; - - int last_updated_column = range_coords.ColumnFirst - 1; - bool row_has_style = row_tag.GetAttribute("s").Length != 0; - - if (null != oCellSimple) - { - int nCustomFormat = XMLInt.ParseOrDefault(((XmlElement)row_tag).GetAttribute("customFormat"), -1); - if (-1 != nCustomFormat) - oCellSimple.m_arrRowsDefaultStyle.Add(row, oCellSimple.GetFormat(nCustomFormat)); - } - - bool bFirst = true; - try - { - XmlNodeList oXmlNodeListCells = row_tag.SelectNodes("main:c", ns_manager); - XmlElement cell_tag = (XmlElement)oXmlNodeListCells[0]; - while (null != cell_tag) - { - int col = Helpers.ReferencesFormat.str2column(cell_tag.GetAttribute("r")); - - if (col > range_coords.ColumnLast) - { - break; - } - - if (col >= range_coords.ColumnFirst) - { - if (col > last_updated_column + 1) - { - if (row_has_style) - { - collector.Collect(row, last_updated_column + 1, parent_sheet); - } - else if (-1 == empty_row_cells_row) - { - empty_row_cells_row_list = row; - if (true == bFirst) - { - bFirst = false; - empty_row_cells.Clear(); - } - int[] aPair = new int[2]; - aPair[0] = last_updated_column + 1; - aPair[1] = col - 1; - empty_row_cells.Add(aPair); - } - } - if (!collector.Collect(row, col, cell_tag)) - { - return; // Stop collecting if 'collector' wishes - } - last_updated_column = col; - } - - cell_tag = (XmlElement)cell_tag.NextSibling; - } - } - catch { } - - if (last_updated_column != range_coords.ColumnLast) - { - if (row_has_style) - { - collector.Collect(row, last_updated_column + 1, parent_sheet); - } - else if (-1 == empty_row_cells_row) - { - empty_row_cells_row_list = row; - if (true == bFirst) - { - bFirst = false; - empty_row_cells.Clear(); - } - int[] aPair = new int[2]; - aPair[0] = last_updated_column + 1; - aPair[1] = range_coords.ColumnLast; - empty_row_cells.Add(aPair); - } - } - last_updated_row = row; - - row_tag = (XmlElement)row_tag.NextSibling; - } - } - catch { } - - if (last_updated_row < range_coords.RowLast && -1 == empty_row_cells_row) - empty_row_cells_row = last_updated_row + 1; - - if (-1 != empty_row_cells_row) - { - for (int col = range_coords.ColumnFirst; col <= range_coords.ColumnLast; col++) - collector.Collect(empty_row_cells_row, col, parent_sheet); - } - else if (-1 != empty_row_cells_row_list) - { - for (int i = 0; i < empty_row_cells.Count; i++) - for (int col = empty_row_cells[i][0]; col <= empty_row_cells[i][1]; col++) - collector.Collect(empty_row_cells_row_list, col, parent_sheet); - } - } - - /// - /// Collect statistics from all existent cells and all non-existent cells. - /// Note: Don't use if you want to collect after setting. Use ChangeCells with two parameters for that purpose - /// - /// - public void CollectStatisticsIncludingEmpty(IStatCollector collector) - { - rows_walker.CollectStatisticsIncludingEmpty(new RowsCellCollector(range_coords, parent_sheet, collector)); - } - - /// - /// Create absent cells in the range and update all the cells according to the passed setter. - /// Note: Doesn't stop on setter or collector signals - /// - /// Any setter - public bool ChangeValues(ICellSetter setter) - { - return rows_walker.SetRows(new RowsCellSetter(range_coords, setter, parent_sheet)); - } - - /// - /// Goes through the existent cells among specified ones and update all visited cells according to the passed setter. - /// This means that absent rows and cells are not created - /// - /// - /// - public void UpdateValues(ICellSetter setter) - { - foreach (XmlElement row_tag in sheetData_tag.SelectNodes("main:row", ns_manager)) - { - int row = XMLInt.ParseOrDefault(((XmlElement)row_tag).GetAttribute("r"), 0); - - if (row >= range_coords.RowFirst && row <= range_coords.RowLast) - { - foreach (XmlElement cell_tag in row_tag.SelectNodes("main:c", ns_manager)) - { - int col = Helpers.ReferencesFormat.str2column(cell_tag.GetAttribute("r")); - if (col >= range_coords.ColumnFirst) - { - if(col <= range_coords.ColumnLast) - { - if (!setter.Set(row, col, cell_tag)) - { - return; - } - } - else - { - break; // doesn't walk through the cells that are not in the range for sure. (Optimizatsiya, blin) - } - } - } - } - } - setter.PostProcessing(); - } - - /// - /// Call the passed setter for every existent cell and set styles for rows and columns if necessary. - /// Note: Doesn't stop on setter or collector signals - /// - /// Only style setter is acceptable - public void SetStyles(StyleSetter setter) - { - Trace.TraceInformation("SetStyles issued for " + range_coords.ToString()); - if (range_coords.IsSetOfRows) - { - rows_walker.SetRows(setter); - UpdateValues(setter); - } - else if (range_coords.IsSetOfColumns) - { - cols_walker.SetCols(setter); - UpdateValues(setter); - } - else - { - ChangeValues(setter); - } - } - - private Cells.CellRange range_coords; - private XmlNode sheetData_tag; - private Worksheet parent_sheet; - private XmlNamespaceManager ns_manager; - RowsWalker rows_walker; - ColsWalker cols_walker; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/RemovedStringsCollector.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/RemovedStringsCollector.cs deleted file mode 100644 index 0a405253ad..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/RemovedStringsCollector.cs +++ /dev/null @@ -1,48 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; - -namespace ASCOfficeEWSEditor.Editor.Walkers -{ - internal class RemovedStringsCollector : IStatCollector - { - public RemovedStringsCollector(Workbook workbook) - { - this.workbook = workbook; - removed_strings = 0; - } - - - #region IStatCollector Members - - public bool Collect(int row, int col, XmlElement cell_tag) - { - if (cell_tag.GetAttribute("t") == "s") - { - --removed_strings; - } - return true; - } - - public bool Collect(int row, int col, Worksheet parent_sheet) - { - return true; // no cell - no string - } - - #endregion - - public void DecrementCounters() - { - if (removed_strings != 0) - { - workbook.SharedStrings.UpdateUsageCounter(removed_strings); - } - } - - - private int removed_strings; - private Workbook workbook; - - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/RowsCellCollector.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/RowsCellCollector.cs deleted file mode 100644 index 04a461337f..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/RowsCellCollector.cs +++ /dev/null @@ -1,77 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor.Walkers -{ - internal class RowsCellCollector : IRowsCollector - { - public RowsCellCollector(Cells.CellRange range_coords, Worksheet parent_sheet, IStatCollector collector) - { - this.range_coords = range_coords; - this.parent_sheet = parent_sheet; - this.collector = collector; - ns_manager = parent_sheet.Workbook.NamespaceManager; - } - #region IRowsCollector Members - - public bool CollectIncludingEmpty(XmlElement row_tag, int row_num) - { - if(row_tag == null) - { - for (int col = 0; col < range_coords.ColumnLast - range_coords.ColumnFirst + 1; ++col) - { - if (!collector.Collect(row_num, col + range_coords.ColumnFirst, parent_sheet)) - { - return false; - } - } - return true; - } - XmlNodeList cells = row_tag.SelectNodes("main:c", ns_manager); - int last_updated_column = range_coords.ColumnFirst - 1; - foreach (XmlElement cell_tag in cells) - { - int col = Helpers.ReferencesFormat.str2column(cell_tag.GetAttribute("r")); - - // If inside the range - if (col >= last_updated_column + 1 && col <= range_coords.ColumnLast) - { - for (int i = last_updated_column + 1; i < col; ++i) - { - if (!collector.Collect(row_num, i, parent_sheet)) - { - return false; - } - } - if (!collector.Collect(row_num, col, cell_tag)) - { - return false; - } - last_updated_column = col; - } - } - if (last_updated_column != range_coords.ColumnLast) - { - for (int i = last_updated_column + 1; i <= range_coords.ColumnLast; ++i) - { - if (!collector.Collect(row_num, i, parent_sheet)) - { - return false; - } - } - } - return true; - } - - #endregion - - private Cells.CellRange range_coords; - - private XmlNamespaceManager ns_manager; - private IStatCollector collector; - private Worksheet parent_sheet; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/RowsCellDeleter.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/RowsCellDeleter.cs deleted file mode 100644 index 3d5a1091be..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/RowsCellDeleter.cs +++ /dev/null @@ -1,71 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor.Walkers -{ - internal class RowsCellDeleter : IRowsSetter - { - public RowsCellDeleter(int columnFirst, int columnLast, Worksheet parent_sheet) - { - this.parent_sheet = parent_sheet; - ns_manager = parent_sheet.Workbook.NamespaceManager; - this.columnFirst = columnFirst; - this.columnLast = columnLast; - delete_whole_row = columnFirst == 1 && columnLast == Helpers.ReferencesFormat.maxCol; - cells_unregistrer = new CellsUnregistrer(parent_sheet); - } - - #region IRowsSetter Members - - public bool Set(XmlElement row_tag, int row_num) - { - bool at_least_one_nondeleted_cell = false; - foreach (XmlElement cell_tag in row_tag.SelectNodes("main:c", ns_manager)) - { - Cells.Cell cell = new Cells.Cell(cell_tag.GetAttribute("r")); - if (delete_whole_row || cell.Column >= columnFirst && cell.Column <= columnLast) - { - // Unregister formula and shared strings - cells_unregistrer.Set(cell.Row, cell.Column, cell_tag); - - // Mark Updated - Calculation.CellItem cell_subj = parent_sheet.SubjectsStorage.GetCellItemOrCreate(cell); - cell_subj.CellOrFormulaUpdated = true; - - if (!delete_whole_row) // If the whole row is deleted then it is not necessary to delete the contained cells one by one - { - row_tag.RemoveChild(cell_tag); - } - } - else - { - at_least_one_nondeleted_cell = true; - } - } - if (!at_least_one_nondeleted_cell) - { - row_tag.ParentNode.RemoveChild(row_tag); - } - return true; - } - - public void PostProcessing() - { - cells_unregistrer.PostProcessing(); - } - - #endregion - - - private CellsUnregistrer cells_unregistrer; - - private XmlNamespaceManager ns_manager; - private readonly int columnFirst; - private readonly int columnLast; - private readonly bool delete_whole_row; - private Worksheet parent_sheet; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/RowsCellMover.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/RowsCellMover.cs deleted file mode 100644 index 235f93e59e..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/RowsCellMover.cs +++ /dev/null @@ -1,99 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor.Walkers -{ - internal class RowsCellMover : IRowsSetter - { - public RowsCellMover(int columnFirst, int columnLast, Cells.Offset offset, Worksheet parent_sheet) - { - this.offset = offset; - this.parent_sheet = parent_sheet; - ns_manager = parent_sheet.Workbook.NamespaceManager; - - this.columnFirst = columnFirst; - this.columnLast = columnLast; - - RowCorrector = new RowsRowNumberCorrector(offset, parent_sheet); - CellCorrector = new CellRowNumberCorrector(offset); - - formulas_to_move = new LinkedList(); - } - - #region IRowsSetter Members - - public bool Set(XmlElement row_tag, int row_num) - { - RowCorrector.Set(row_tag, row_num); - if (row_num + offset.RowOffset <= Helpers.ReferencesFormat.maxRow) - { - foreach (XmlElement cell_tag in row_tag.SelectNodes("main:c", ns_manager)) - { - Cells.Cell cell = new Cells.Cell(cell_tag.GetAttribute("r")); - if (cell.Column >= columnFirst && cell.Column <= columnLast) - { - Cells.Cell corrected_cell = cell + offset; - // Change row or column number of the cell - CellCorrector.Set(cell.Row, cell.Column, cell_tag); - - // Move Formula - Calculation.Formulas.CellParsedFormula moved_formula; - if (parent_sheet.Formulas.TryGetValue(cell, out moved_formula)) - { - if (offset.RowOffset > 0 || offset.ColumnOffset > 0) - { - formulas_to_move.AddFirst(moved_formula); - } - else - { - formulas_to_move.AddLast(moved_formula); - } - } - - Calculation.CellItem former_cell_item = parent_sheet.SubjectsStorage.GetCellItemOrCreate(cell); - Calculation.CellItem corrected_cell_item = parent_sheet.SubjectsStorage.GetCellItemOrCreate(corrected_cell); - former_cell_item.CellOrFormulaUpdated = true; - corrected_cell_item.CellOrFormulaUpdated = true; - - bool update_delayed = former_cell_item.UpdateDelayed; - former_cell_item.UpdateDelayed = false; - corrected_cell_item.UpdateDelayed = update_delayed; - // The necessary notification is performed outside of the setter (Range.DeleteRows) - } - } - } - return true; - } - - public void PostProcessing() - { - RowCorrector.PostProcessing(); - CellCorrector.PostProcessing(); - foreach (Calculation.Formulas.CellParsedFormula moved_formula in formulas_to_move) - { - Cells.Cell cell = moved_formula.Cell; - Cells.Cell corrected_cell = cell + offset; - parent_sheet.Formulas.Remove(cell); - parent_sheet.Formulas.Add(corrected_cell, moved_formula); - moved_formula.MoveToAnotherCell(corrected_cell); - } - } - - #endregion - - private Cells.Offset offset; - - private RowsRowNumberCorrector RowCorrector; - private CellRowNumberCorrector CellCorrector; - private LinkedList formulas_to_move; - - private readonly int columnFirst; - private readonly int columnLast; - - private XmlNamespaceManager ns_manager; - private Worksheet parent_sheet; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/RowsCellSetter.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/RowsCellSetter.cs deleted file mode 100644 index 6650794e96..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/RowsCellSetter.cs +++ /dev/null @@ -1,94 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor.Walkers -{ - internal class RowsCellSetter : IRowsSetter - { - public RowsCellSetter(Cells.CellRange range_coords, ICellSetter setter, Worksheet parent_sheet) - { - this.range_coords = range_coords; - this.setter = setter; - ns_manager = parent_sheet.Workbook.NamespaceManager; - - } - #region IRowsSetter Members - - public bool Set(XmlElement row_tag, int row_num) - { - XmlNodeList cells = row_tag.SelectNodes("main:c", ns_manager); - int last_updated_column = range_coords.ColumnFirst - 1; - foreach (XmlElement cell_tag in cells) - { - int col = Helpers.ReferencesFormat.str2column(cell_tag.GetAttribute("r")); - - if (col >= last_updated_column + 1 && col <= range_coords.ColumnLast) - { - for (int i = last_updated_column + 1; i < col; ++i) - { - XmlElement cell_ins = row_tag.OwnerDocument.CreateElement("c", ns_manager.LookupNamespace("main")); - cell_ins.SetAttribute("r", Helpers.ReferencesFormat.ref2str(row_num, true, i, true)); - row_tag.InsertBefore(cell_ins, cell_tag); - - if(!setter.Set(row_num, i, cell_ins)) - { - return false; - } - } - if(!setter.Set(row_num, col, cell_tag)) - { - return false; - } - last_updated_column = col; - } - else if (col > range_coords.ColumnLast) - { - if (last_updated_column != range_coords.ColumnLast) - { - for (int i = last_updated_column + 1; i <= range_coords.ColumnLast; ++i) - { - XmlElement cell_ins = (XmlElement)row_tag.OwnerDocument.CreateElement("c", ns_manager.LookupNamespace("main")); - cell_ins.SetAttribute("r", Helpers.ReferencesFormat.ref2str(row_num, true, i, true)); - row_tag.InsertBefore(cell_ins, cell_tag); - - if(!setter.Set(row_num, i, cell_ins)) - { - return false; - } - } - last_updated_column = range_coords.ColumnLast; - } - break; - } - } - if (last_updated_column != range_coords.ColumnLast) - { - for (int i = last_updated_column + 1; i <= range_coords.ColumnLast; ++i) - { - XmlElement cell_ins = (XmlElement)row_tag.OwnerDocument.CreateElement("c", ns_manager.LookupNamespace("main")); - cell_ins.SetAttribute("r", Helpers.ReferencesFormat.ref2str(row_num, true, i, true)); - row_tag.InsertBefore(cell_ins, null); - if(!setter.Set(row_num, i, cell_ins)) - { - return false; - } - } - } - return true; - } - - public void PostProcessing() - { - setter.PostProcessing(); - } - - #endregion - - private Cells.CellRange range_coords; - private XmlNamespaceManager ns_manager; - private ICellSetter setter; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/RowsHeightSetter.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/RowsHeightSetter.cs deleted file mode 100644 index a24f231939..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/RowsHeightSetter.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor.Walkers -{ - internal class RowsHeightSetter : IRowsSetter - { - public RowsHeightSetter(double height) - { - height_str = XMLDouble.ToString(height); - } - #region IRowsSetter Members - - public bool Set(XmlElement row_tag, int row_num) - { - row_tag.SetAttribute("ht", height_str); - row_tag.SetAttribute("customHeight", "true"); - return true; - } - - public void PostProcessing() - { - } - - #endregion - - private string height_str; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/RowsRowNumberCorrector.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/RowsRowNumberCorrector.cs deleted file mode 100644 index 22aafb66e7..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/RowsRowNumberCorrector.cs +++ /dev/null @@ -1,66 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.XMLDataSpecific; -using System.Xml.XPath; - -namespace ASCOfficeEWSEditor.Editor.Walkers -{ - internal class RowsRowNumberCorrector : IRowsSetter - { - public RowsRowNumberCorrector(Cells.Offset offset, Worksheet parent_sheet) - { - this.parent_sheet = parent_sheet; - correction_value = offset.RowOffset; - nothing_to_do = offset.RowOffset == 0; - ns_manager = parent_sheet.Workbook.NamespaceManager; - cells_unregistrer = new CellsUnregistrer(parent_sheet); - } - - #region IRowsSetter Members - - public bool Set(XmlElement row_tag, int row_num) - { - if(nothing_to_do) - { - return true; - } - int row_corrected = row_num + correction_value; - if (row_corrected > Helpers.ReferencesFormat.maxRow) - { - foreach (XmlElement cell_tag in row_tag.SelectNodes("main:c", ns_manager)) - { - Cells.Cell cell = new Cells.Cell(cell_tag.GetAttribute("r")); - // Unregister formula and shared strings - cells_unregistrer.Set(cell.Row, cell.Column, cell_tag); - - // Mark Updated - Calculation.CellItem cell_subj = parent_sheet.SubjectsStorage.GetCellItemOrCreate(cell); - cell_subj.CellOrFormulaUpdated = true; - } - // Notify recalculation engine - parent_sheet.Workbook.ValuesUpdateManager.NotifyDeleted(new Cells.CellRange(row_num, 1, row_num, Helpers.ReferencesFormat.maxCol), parent_sheet); - row_tag.ParentNode.RemoveChild(row_tag); - } - else - { - row_tag.SetAttribute("r", row_corrected.ToString()); - } - return true; - } - - public void PostProcessing() - { - cells_unregistrer.PostProcessing(); - } - - #endregion - - private CellsUnregistrer cells_unregistrer; - private readonly int correction_value; - private readonly bool nothing_to_do; - private XmlNamespaceManager ns_manager; - private Worksheet parent_sheet; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/RowsWalker.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/RowsWalker.cs deleted file mode 100644 index 6a860a5d39..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/RowsWalker.cs +++ /dev/null @@ -1,125 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor.Walkers -{ - internal class RowsWalker - { - public RowsWalker(int rowFirst, int rowLast, Worksheet parent_sheet) - { - this.rowFirst = rowFirst; - this.rowLast = rowLast; - this.sheetData_tag = parent_sheet.SheetData; - - ns_manager = parent_sheet.Workbook.NamespaceManager; - } - - - /// - /// Collect statistics from all existent and non-existent rows. - /// - /// - public void CollectStatisticsIncludingEmpty(IRowsCollector collector) - { - int last_updated_row = rowFirst - 1; - foreach (XmlElement row_tag in sheetData_tag.SelectNodes("main:row[@r >= " + rowFirst + " and @r <= " + rowLast + "]", ns_manager)) - { - int row = XMLInt.ParseOrDefault(row_tag.GetAttribute("r"), 0); - // If inside the range - for (int i = last_updated_row + 1; i < row; ++i) - { - if (!collector.CollectIncludingEmpty(null, i)) - { - return; - } - } - if (!collector.CollectIncludingEmpty(row_tag, row)) - { - return; - } - last_updated_row = row; - } - - if (last_updated_row < rowLast) - { - XmlNode before = sheetData_tag.SelectSingleNode("main:row[@r > " + rowLast + "]", ns_manager); - for (int i = last_updated_row + 1; i <= rowLast; ++i) - { - if (!collector.CollectIncludingEmpty(null, i)) - { - return; - } - } - } - } - - /// - /// Goes through the existent rows among specified ones and update all visited rows according to the passed setter. - /// - /// - public void UpdateRows(IRowsSetter setter) - { - foreach (XmlElement row_tag in sheetData_tag.SelectNodes("main:row[@r >= " + rowFirst + " and @r <= " + rowLast + "]", ns_manager)) - { - setter.Set(row_tag, XMLInt.ParseOrDefault(row_tag.GetAttribute("r"), 0)); - } - setter.PostProcessing(); - } - - /// - /// Create absent rows in the range and update all the rows according to the passed setter. - /// - /// - public bool SetRows(IRowsSetter setter) - { - int last_updated_row = rowFirst - 1; - foreach (XmlElement row_tag in sheetData_tag.SelectNodes("main:row[@r >= " + rowFirst + " and @r <= " + rowLast + "]", ns_manager)) - { - int row = XMLInt.ParseOrDefault(row_tag.GetAttribute("r"), 0); - for (int i = last_updated_row + 1; i < row; ++i) - { - XmlElement row_ins = sheetData_tag.OwnerDocument.CreateElement("row", ns_manager.LookupNamespace("main")); - row_ins.SetAttribute("r", i.ToString()); - sheetData_tag.InsertBefore(row_ins, row_tag); - - if(!setter.Set(row_ins, i)) - { - return false; - } - } - if(!setter.Set(row_tag, row)) - { - return false; - } - last_updated_row = row; - } - - if(last_updated_row < rowLast) - { - XmlNode before = sheetData_tag.SelectSingleNode("main:row[@r > " + rowLast + "]", ns_manager); - for (int i = last_updated_row + 1; i <= rowLast; ++i) - { - XmlElement row_ins = sheetData_tag.OwnerDocument.CreateElement("row", ns_manager.LookupNamespace("main")); - row_ins.SetAttribute("r", i.ToString()); - sheetData_tag.InsertBefore(row_ins, before); - - if(!setter.Set(row_ins, i)) - { - return false; - } - } - } - - setter.PostProcessing(); - return true; - } - - private int rowFirst; - private int rowLast; - private XmlNamespaceManager ns_manager; - private XmlNode sheetData_tag; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/SortValuesCollector.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/SortValuesCollector.cs deleted file mode 100644 index ebf8d04bd8..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/SortValuesCollector.cs +++ /dev/null @@ -1,56 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.XMLDataSpecific; -using ASCOfficeEWSEditor.Editor.Calculation.Formulas.Ptgs; - -namespace ASCOfficeEWSEditor.Editor.Walkers -{ - internal class SortValuesCollector : IStatCollector - { - public SortValuesCollector(Workbook workbook, Sorting.SortOrientation orientation) - { - this.workbook = workbook; - this.orientation = orientation; - ns_manager = workbook.NamespaceManager; - - Values = new List(); - - } - - #region IStatCollector Members - - public bool Collect(int row, int col, XmlElement cell_tag) - { - XmlNode value_tag = cell_tag.SelectSingleNode("main:v", ns_manager); - if (value_tag != null) - { - string value_type = cell_tag.GetAttribute("t"); - Values.Add(new Sorting.ValueRowColumn(ValueGetter.RecognizeValue(value_tag.InnerText, value_type, workbook), orientation == Sorting.SortOrientation.by_rows ? row : col)); - } - else - { - Values.Add(new Sorting.ValueRowColumn(new Calculation.Formulas.DataObjects.ObjectEmpty(), orientation == Sorting.SortOrientation.by_rows ? row : col)); - } - return true; - } - - public bool Collect(int row, int col, Worksheet parent_sheet) - { - Values.Add(new Sorting.ValueRowColumn(new Calculation.Formulas.DataObjects.ObjectEmpty(), orientation == Sorting.SortOrientation.by_rows ? row : col)); - return true; - } - - #endregion - - private Sorting.SortOrientation orientation; - - public List Values { get; private set; } - - private XmlNamespaceManager ns_manager; - private Workbook workbook; - - } -} - diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/StyleCollector.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/StyleCollector.cs deleted file mode 100644 index 6cb3b57e8a..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/StyleCollector.cs +++ /dev/null @@ -1,857 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor.Walkers -{ - /// - /// Terms of use: - /// Entity or Style entity - one of the following tags: , , - /// Property - one of an entity properties. For example: , , - /// - internal class StyleCollector : IStatCollector - { - public StyleCollector(Format.IStyleEntity style_entity, Format.IProperty property, Workbook workbook) - { - CellXfs_xml = (XmlElement)workbook.StyleSheet.Get_CellXfs_OrCreate(); - CellStyleXfs_xml = (XmlElement)workbook.StyleSheet.Get_CellStyleXfs_OrCreate(); - ns_manager = workbook.NamespaceManager; - this.property = property; - this.style_entity = style_entity; - - cell_style_ids = new Dictionary(); - entity_ids = new Dictionary(); - } - - - #region IStatCollector Members - - public bool Collect(int row, int col, XmlElement cell_tag) - { - int xf_index = XMLInt.ParseOrDefault(cell_tag.GetAttribute("s"), -1); - if (xf_index == -1) - { - xf_index = XMLInt.ParseOrDefault(((XmlElement)cell_tag.ParentNode).GetAttribute("s"), -1); - if (xf_index == -1) - { - XmlElement col_tag = (XmlElement)cell_tag.ParentNode.ParentNode.ParentNode.SelectSingleNode( - "main:cols/main:col[@min <= " + col + " and @max >= " + col + "]", ns_manager); - xf_index = col_tag != null ? XMLInt.ParseOrDefault(col_tag.GetAttribute("style"), 0) : 0; - } - } - return CollectFromCellXFIndex(xf_index); - } - - public bool Collect(int row, int col, Worksheet parent_sheet) - { - XmlElement row_tag = (XmlElement)parent_sheet.SheetData.SelectSingleNode("main:row[@r = " + row + "]", ns_manager); - int xf_index = row_tag != null ? XMLInt.ParseOrDefault(((XmlElement)row_tag).GetAttribute("s"), -1) : -1; - if (xf_index == -1) - { - XmlElement col_tag = (XmlElement)parent_sheet.SheetData.ParentNode.SelectSingleNode( - "main:cols/main:col[@min <= " + col + " and @max >= " + col + "]", ns_manager); - xf_index = col_tag != null ? XMLInt.ParseOrDefault(col_tag.GetAttribute("style"), 0) : 0; - } - return CollectFromCellXFIndex(xf_index); - } - - #endregion - - private bool CollectFromCellXFIndex(int xf_index) - { - if(property.IsNull() && cell_style_ids.Count != 0) - { - return false; // this defends the collector from bad walkers that don't stop on returning 'false' - } - if (cell_style_ids.ContainsKey(xf_index)) - { - return true; // continue - } - cell_style_ids[xf_index] = 0; // Append a new xf_index to the set - - XmlElement xf_record = GetXFRecord(xf_index); - int entity_id = style_entity.GetEntityIdByXF(xf_record); - if (entity_id != -1) // if the entity is not inline - { - if (entity_ids.ContainsKey(entity_id)) - { - return true; // continue - } - entity_ids[entity_id] = 0; // Append a new entity_id to the set - } - return style_entity.CollectPropertyFromXF(xf_record, property); - } - - private XmlElement GetXFRecord(int xfId) - { - XmlElement cell_xf = (XmlElement)CellXfs_xml.SelectSingleNode("main:xf[position() = " + (xfId + 1).ToString() + "]", ns_manager); - if (cell_xf == null) // If the style reference in a cell is wrong - { - cell_xf = (XmlElement)CellXfs_xml.SelectSingleNode("main:xf", ns_manager); // select first 'xf' - if (cell_xf == null) // if no 'xf' records found in - { - CellXfs_xml.InnerXml = ""; - CellXfs_xml.SetAttribute("count", "1"); - cell_xf = (XmlElement)CellXfs_xml.SelectSingleNode("main:xf", ns_manager); // select first 'xf' - } - } - /* Uncomment if the style info shall be used - if (!XMLBoolean.ParseOrDefault(cell_xf.GetAttribute(style_entity.GetApplyEntityAttribName()), false)) - { - int cell_style_xfId = XMLInt.ParseOrDefault(cell_xf.GetAttribute("xfId"), 0); - cell_xf = (XmlElement)CellStyleXfs_xml.SelectSingleNode("main:xf[position() = " + (cell_style_xfId + 1).ToString() + "]", ns_manager); - if (cell_xf == null) // if no 'xf' records found in - { - CellStyleXfs_xml.InnerXml = ""; - CellStyleXfs_xml.SetAttribute("count", "1"); - cell_xf = (XmlElement)CellStyleXfs_xml.SelectSingleNode("main:xf", ns_manager); // select first 'xf' - } - - } - */ - return cell_xf; - } - - private XmlElement CellStyleXfs_xml; - private XmlElement CellXfs_xml; - private XmlNamespaceManager ns_manager; - private Format.IProperty property; - private Format.IStyleEntity style_entity; - #region optimization info - Dictionary cell_style_ids; - Dictionary entity_ids; - #endregion - - } - - class CFont - { - public bool m_bIsBold = false; - public bool m_bIsItalic = false; - public bool m_bIsUnderline = false; - public string m_strName = ""; - public int m_nSize = -1; - - public Format.Colors.ColorValue m_oColorValue = null; - } - - class CFill - { - public Format.Fills.PatternType? m_oPatternType = null; - public Format.Colors.ColorValue m_oColorBg = null; - public Format.Colors.ColorValue m_oColorFg = null; - - public Format.Fills.GradientType? m_oGradientType = null; - public Format.Colors.ColorValue m_oColorGradient = null; - } - - class CBorderElem - { - public Format.Borders.BorderStyle? m_oBorderStyle = null; - public Format.Colors.ColorValue m_oBorderColor = null; - } - class CBorder - { - public CBorderElem m_oBorderElemLeft = new CBorderElem(); - public CBorderElem m_oBorderElemRight = new CBorderElem(); - public CBorderElem m_oBorderElemTop = new CBorderElem(); - public CBorderElem m_oBorderElemBottom = new CBorderElem(); - public CBorderElem m_oBorderElemDiagonal = new CBorderElem(); - } - - public class StyleCollectorCache - { - - public StyleCollectorCache(Workbook workbook) - { - CellXfs_xml = (XmlElement)workbook.StyleSheet.Get_CellXfs_OrCreate(); - CellStyleXfs_xml = (XmlElement)workbook.StyleSheet.Get_CellStyleXfs_OrCreate(); - ns_manager = workbook.NamespaceManager; - m_oWorkbook = workbook; - Init(); - } - public Format.FormatSimple GetStyle(int nIndex) - { - Format.FormatSimple oResult = null; - if (true == m_mapStyles.TryGetValue(nIndex, out oResult)) - return oResult; - else - return null; - } - private void Init() - { - XmlNodeList cell_xf = CellXfs_xml.SelectNodes("main:xf", ns_manager); - if (cell_xf != null) // If the style reference in a cell is wrong - { - #region LoadFonts - XmlNode style_sheet_tag = m_oWorkbook.StyleSheet.GetStyleSheetOrCreate(); - string entities_tag_name = "fonts"; // Ex: "fonts" - XmlNode entities_tag_font = style_sheet_tag.SelectSingleNode("main:" + entities_tag_name, m_oWorkbook.NamespaceManager); // Ex: - if (entities_tag_font == null) - { - entities_tag_font = m_oWorkbook.GetXmlDocument().CreateElement(entities_tag_name, m_oWorkbook.NamespaceManager.LookupNamespace("main")); // Ex: - style_sheet_tag.AppendChild(entities_tag_font); - } - - List arrFonts = new List(); - - foreach (XmlNode oXmlNodeChild in entities_tag_font.ChildNodes) - { - CFont oFont = new CFont(); - foreach (XmlNode oXmlNodeFont in oXmlNodeChild.ChildNodes) - { - XmlAttribute oAttr = null; - switch (oXmlNodeFont.Name) - { - case "name": - oAttr = oXmlNodeFont.Attributes["val"]; - if (null != oAttr) - oFont.m_strName = oAttr.Value; - break; - case "sz": - oAttr = oXmlNodeFont.Attributes["val"]; - if (null != oAttr) - oFont.m_nSize = XMLInt.ParseOrDefault(oAttr.Value, -1); - break; - case "b": - oAttr = oXmlNodeFont.Attributes["val"]; - oFont.m_bIsBold = XMLBoolean.ParseOrDefault((null == oAttr) ? "" : oAttr.Value, true); - break; - case "i": - oAttr = oXmlNodeFont.Attributes["val"]; - oFont.m_bIsItalic = XMLBoolean.ParseOrDefault((null == oAttr) ? "" : oAttr.Value, true); - break; - case "u": - oAttr = oXmlNodeFont.Attributes["val"]; - oFont.m_bIsUnderline = XMLBoolean.ParseOrDefault((null == oAttr) ? "" : oAttr.Value, true); - break; - case "color": - string strValueColor = ""; - oAttr = oXmlNodeFont.Attributes["rgb"]; - if (null != oAttr && (strValueColor = oAttr.Value) != "") - { - oFont.m_oColorValue = new Format.Colors.ColorValue(strValueColor, true, m_oWorkbook); - break; - } - - oAttr = oXmlNodeFont.Attributes["theme"]; - if (null != oAttr && (strValueColor = oAttr.Value) != "") - { - oAttr = oXmlNodeFont.Attributes["tint"]; - string strValue = (null != oAttr) ? oAttr.Value : ""; - double tint = XMLDouble.ParseOrDefault(strValue, 0); - oFont.m_oColorValue = new Format.Colors.ColorValue(XMLInt.ParseOrDefault(strValueColor, true ? 1 : 0), tint, true, m_oWorkbook); - break; - } - - oAttr = oXmlNodeFont.Attributes["indexed"]; - if (null != oAttr && (strValueColor = oAttr.Value) != "") - { - oFont.m_oColorValue = new Format.Colors.ColorValue(XMLInt.ParseOrDefault(strValueColor, true ? 64 : 65), true, m_oWorkbook); - } - break; - } - } - - if (-1 == oFont.m_nSize) - oFont.m_nSize = m_oWorkbook.StyleSheet.GetZeroStyleOrDefaultFontSize(); - if ("" == oFont.m_strName) - oFont.m_strName = m_oWorkbook.StyleSheet.GetZeroStyleOrDefaultFontName(); - if (null == oFont.m_oColorValue) - oFont.m_oColorValue = new Format.Colors.ColorValue(true, m_oWorkbook); - - arrFonts.Add(oFont); - } - - if (0 < cell_xf.Count && 0 == arrFonts.Count) - { - entities_tag_font.InnerXml = Resource1.default_font; // Ex: Create [1] - ((XmlElement)entities_tag_font).SetAttribute("count", "1"); - - CFont oFont = new CFont(); - - oFont.m_nSize = 11; - oFont.m_strName = "Calibri"; - oFont.m_oColorValue = new Format.Colors.ColorValue(true, m_oWorkbook); - arrFonts.Add(oFont); - } - #endregion - - #region LoadFills - entities_tag_name = "fills"; // Ex: "fonts" - XmlNode entities_tag_fill = style_sheet_tag.SelectSingleNode("main:" + entities_tag_name, m_oWorkbook.NamespaceManager); // Ex: - if (entities_tag_fill == null) - { - entities_tag_fill = m_oWorkbook.GetXmlDocument().CreateElement(entities_tag_name, m_oWorkbook.NamespaceManager.LookupNamespace("main")); // Ex: - style_sheet_tag.AppendChild(entities_tag_fill); - } - - List arrFills = new List(); - - foreach (XmlNode oXmlNodeChild in entities_tag_fill.ChildNodes) - { - CFill oFill = new CFill(); - - XmlAttribute oAttr = null; - if (0 != oXmlNodeChild.ChildNodes.Count) - { - switch (oXmlNodeChild.ChildNodes[0].Name) - { - case "patternFill": - #region PatternFillType - { - oAttr = oXmlNodeChild.ChildNodes[0].Attributes["patternType"]; - if (null != oAttr) - { - switch (oAttr.Value) - { - case "darkDown": - oFill.m_oPatternType = Format.Fills.PatternType.darkDown; - break; - case "darkGray": - oFill.m_oPatternType = Format.Fills.PatternType.darkGray; - break; - case "darkGrid": - oFill.m_oPatternType = Format.Fills.PatternType.darkGrid; - break; - case "darkHorizontal": - oFill.m_oPatternType = Format.Fills.PatternType.darkHorizontal; - break; - case "darkTrellis": - oFill.m_oPatternType = Format.Fills.PatternType.darkTrellis; - break; - case "darkUp": - oFill.m_oPatternType = Format.Fills.PatternType.darkUp; - break; - case "darkVertical": - oFill.m_oPatternType = Format.Fills.PatternType.darkVertical; - break; - case "gray0625": - oFill.m_oPatternType = Format.Fills.PatternType.gray0625; - break; - case "gray125": - oFill.m_oPatternType = Format.Fills.PatternType.gray125; - break; - case "lightDown": - oFill.m_oPatternType = Format.Fills.PatternType.lightDown; - break; - case "lightGray": - oFill.m_oPatternType = Format.Fills.PatternType.lightGray; - break; - case "lightGrid": - oFill.m_oPatternType = Format.Fills.PatternType.lightGrid; - break; - case "lightHorizontal": - oFill.m_oPatternType = Format.Fills.PatternType.lightHorizontal; - break; - case "lightTrellis": - oFill.m_oPatternType = Format.Fills.PatternType.lightTrellis; - break; - case "lightUp": - oFill.m_oPatternType = Format.Fills.PatternType.lightUp; - break; - case "lightVertical": - oFill.m_oPatternType = Format.Fills.PatternType.lightVertical; - break; - case "mediumGray": - oFill.m_oPatternType = Format.Fills.PatternType.mediumGray; - break; - case "solid": - oFill.m_oPatternType = Format.Fills.PatternType.solid; - break; - case "none": - default: - oFill.m_oPatternType = Format.Fills.PatternType.none; - break; - } - } - } - #endregion - #region Colors - foreach (XmlNode oXmlNodeColor in oXmlNodeChild.ChildNodes[0].ChildNodes) - { - switch (oXmlNodeColor.Name) - { - case "fgColor": - #region fgColor - { - string strValueColor = ""; - oAttr = oXmlNodeColor.Attributes["rgb"]; - if (null != oAttr && (strValueColor = oAttr.Value) != "") - { - oFill.m_oColorFg = new Format.Colors.ColorValue(strValueColor, true, m_oWorkbook); - break; - } - oAttr = oXmlNodeColor.Attributes["theme"]; - if (null != oAttr && (strValueColor = oAttr.Value) != "") - { - oAttr = oXmlNodeColor.Attributes["tint"]; - string strValue = (null != oAttr) ? oAttr.Value : ""; - - double tint = XMLDouble.ParseOrDefault(strValue, 0); - oFill.m_oColorFg = new Format.Colors.ColorValue(XMLInt.ParseOrDefault(strValueColor, true ? 1 : 0), tint, true, m_oWorkbook); - break; - } - oAttr = oXmlNodeColor.Attributes["indexed"]; - if (null != oAttr && (strValueColor = oAttr.Value) != "") - { - oFill.m_oColorFg = new Format.Colors.ColorValue(XMLInt.ParseOrDefault(strValueColor, true ? 64 : 65), true, m_oWorkbook); - break; - } - - oFill.m_oColorFg = new Format.Colors.ColorValue(true, m_oWorkbook); - } - #endregion - break; - case "bgColor": - #region bgColor - { - string strValueColor = ""; - oAttr = oXmlNodeColor.Attributes["rgb"]; - if (null != oAttr && (strValueColor = oAttr.Value) != "") - { - oFill.m_oColorBg = new Format.Colors.ColorValue(strValueColor, false, m_oWorkbook); - break; - } - oAttr = oXmlNodeColor.Attributes["theme"]; - if (null != oAttr && (strValueColor = oAttr.Value) != "") - { - oAttr = oXmlNodeColor.Attributes["tint"]; - string strValue = (null != oAttr) ? oAttr.Value : ""; - - double tint = XMLDouble.ParseOrDefault(strValue, 0); - oFill.m_oColorBg = new Format.Colors.ColorValue(XMLInt.ParseOrDefault(strValueColor, false ? 1 : 0), tint, false, m_oWorkbook); - break; - } - oAttr = oXmlNodeColor.Attributes["indexed"]; - if (null != oAttr && (strValueColor = oAttr.Value) != "") - { - oFill.m_oColorBg = new Format.Colors.ColorValue(XMLInt.ParseOrDefault(strValueColor, false ? 64 : 65), false, m_oWorkbook); - break; - } - - oFill.m_oColorBg = new Format.Colors.ColorValue(false, m_oWorkbook); - } - #endregion - break; - } - } - #endregion - break; - case "gradientFill": - #region gradientFillType - { - oAttr = oXmlNodeChild.ChildNodes[0].Attributes["type"]; - if (null != oAttr) - { - switch (oAttr.Value) - { - case "path": - oFill.m_oGradientType = Format.Fills.GradientType.path; - break; - case "linear": - default: - oFill.m_oGradientType = Format.Fills.GradientType.linear; - break; - } - } - } - #endregion - #region Color - { - if (1 < oXmlNodeChild.ChildNodes[0].ChildNodes.Count && "stop" == oXmlNodeChild.ChildNodes[0].ChildNodes[0].Name && - 1 <= oXmlNodeChild.ChildNodes[0].ChildNodes[0].ChildNodes.Count) - { - XmlNode oXmlNodeColor = oXmlNodeChild.ChildNodes[0].ChildNodes[0].ChildNodes[0]; - string strValueColor = ""; - oAttr = oXmlNodeColor.Attributes["rgb"]; - if (null != oAttr && (strValueColor = oAttr.Value) != "") - { - oFill.m_oColorGradient = new Format.Colors.ColorValue(strValueColor, true, m_oWorkbook); - break; - } - oAttr = oXmlNodeColor.Attributes["theme"]; - if (null != oAttr && (strValueColor = oAttr.Value) != "") - { - oAttr = oXmlNodeColor.Attributes["tint"]; - string strValue = (null != oAttr) ? oAttr.Value : ""; - - double tint = XMLDouble.ParseOrDefault(strValue, 0); - oFill.m_oColorGradient = new Format.Colors.ColorValue(XMLInt.ParseOrDefault(strValueColor, true ? 1 : 0), tint, true, m_oWorkbook); - break; - } - oAttr = oXmlNodeColor.Attributes["indexed"]; - if (null != oAttr && (strValueColor = oAttr.Value) != "") - { - oFill.m_oColorGradient = new Format.Colors.ColorValue(XMLInt.ParseOrDefault(strValueColor, true ? 64 : 65), true, m_oWorkbook); - break; - } - - oFill.m_oColorGradient = new Format.Colors.ColorValue(true, m_oWorkbook); - } - } - #endregion - break; - } - } - - arrFills.Add(oFill); - } - - if (0 < cell_xf.Count && 0 == arrFills.Count) - { - entities_tag_fill.InnerXml = Resource1.default_fill; // Ex: Create [1] - ((XmlElement)entities_tag_fill).SetAttribute("count", "1"); - - CFill oFill = new CFill(); - arrFills.Add(oFill); - } - #endregion - - #region LoadBorders - entities_tag_name = "borders"; // Ex: "fonts" - XmlNode entities_tag_border = style_sheet_tag.SelectSingleNode("main:" + entities_tag_name, m_oWorkbook.NamespaceManager); // Ex: - if (entities_tag_border == null) - { - entities_tag_border = m_oWorkbook.GetXmlDocument().CreateElement(entities_tag_name, m_oWorkbook.NamespaceManager.LookupNamespace("main")); // Ex: - style_sheet_tag.AppendChild(entities_tag_border); - } - - List arrBorders = new List(); - - foreach (XmlNode oXmlNodeChild in entities_tag_border.ChildNodes) - { - CBorder oBorder = new CBorder(); - XmlAttribute oAttr = null; - foreach (XmlNode oXmlNodeBorder in oXmlNodeChild.ChildNodes) - { - oAttr = oXmlNodeBorder.Attributes["style"]; - XmlNode oColor = (0 == oXmlNodeBorder.ChildNodes.Count) ? null : oXmlNodeBorder.ChildNodes[0]; - string strStyle = (null != oAttr) ? oAttr.Value : ""; - switch (oXmlNodeBorder.Name) - { - case "left": - #region LeftBorder - { - SetBorderStyle(ref oBorder.m_oBorderElemLeft.m_oBorderStyle, strStyle); - if (null != oColor) - ReadColor(ref oColor, ref oBorder.m_oBorderElemLeft.m_oBorderColor); - else - oBorder.m_oBorderElemLeft.m_oBorderColor = new Format.Colors.ColorValue(true, m_oWorkbook); - } - #endregion - break; - case "right": - #region RightBorder - { - SetBorderStyle(ref oBorder.m_oBorderElemRight.m_oBorderStyle, strStyle); - if (null != oColor) - ReadColor(ref oColor, ref oBorder.m_oBorderElemRight.m_oBorderColor); - else - oBorder.m_oBorderElemRight.m_oBorderColor = new Format.Colors.ColorValue(true, m_oWorkbook); - } - #endregion - break; - case "top": - #region TopBorder - { - SetBorderStyle(ref oBorder.m_oBorderElemTop.m_oBorderStyle, strStyle); - if (null != oColor) - ReadColor(ref oColor, ref oBorder.m_oBorderElemTop.m_oBorderColor); - else - oBorder.m_oBorderElemTop.m_oBorderColor = new Format.Colors.ColorValue(true, m_oWorkbook); - } - #endregion - break; - case "bottom": - #region BottomBorder - { - SetBorderStyle(ref oBorder.m_oBorderElemBottom.m_oBorderStyle, strStyle); - if (null != oColor) - ReadColor(ref oColor, ref oBorder.m_oBorderElemBottom.m_oBorderColor); - else - oBorder.m_oBorderElemBottom.m_oBorderColor = new Format.Colors.ColorValue(true, m_oWorkbook); - } - #endregion - break; - case "diagonal": - #region DiagonalBorder - { - SetBorderStyle(ref oBorder.m_oBorderElemDiagonal.m_oBorderStyle, strStyle); - if (null != oColor) - ReadColor(ref oColor, ref oBorder.m_oBorderElemDiagonal.m_oBorderColor); - else - oBorder.m_oBorderElemDiagonal.m_oBorderColor = new Format.Colors.ColorValue(true, m_oWorkbook); - } - #endregion - break; - } - } - arrBorders.Add(oBorder); - } - - if (0 < cell_xf.Count && 0 == arrBorders.Count) - { - entities_tag_border.InnerXml = Resource1.default_border; // Ex: Create [1] - ((XmlElement)entities_tag_border).SetAttribute("count", "1"); - - CBorder oBorder = new CBorder(); - arrBorders.Add(oBorder); - } - #endregion - - for (int i = 0; i < cell_xf.Count; i++) - { - Format.FormatSimple oNewStyleItem = new Format.FormatSimple(m_oWorkbook); - - XmlNode oCurNode = cell_xf.Item(i); - XmlAttribute oAttributeTmp = oCurNode.Attributes["fontId"]; - string strFontId = (null != oAttributeTmp) ? oAttributeTmp.Value : ""; - int nFontId = XMLInt.ParseOrDefault(strFontId, 0); - - oAttributeTmp = oCurNode.Attributes["fillId"]; - string strFillId = (null != oAttributeTmp) ? oAttributeTmp.Value : ""; - int nFillId = XMLInt.ParseOrDefault(strFillId, 0); - - oAttributeTmp = oCurNode.Attributes["numFmtId"]; - string strFormatId = (null != oAttributeTmp) ? oAttributeTmp.Value : ""; - int nFormatId = XMLInt.ParseOrDefault(strFormatId, 0); - - oAttributeTmp = oCurNode.Attributes["borderId"]; - string strBorderId = (null != oAttributeTmp) ? oAttributeTmp.Value : ""; - int nBorderId = XMLInt.ParseOrDefault(strBorderId, 0); - - string strHorizontal = ""; - string strVertical = ""; - bool bWrapText = false; - foreach(XmlNode oXmlNodeChildXF in oCurNode.ChildNodes) - { - if ("alignment" == oXmlNodeChildXF.Name) - { - oAttributeTmp = oXmlNodeChildXF.Attributes["horizontal"]; - if (null != oAttributeTmp) - strHorizontal = oAttributeTmp.Value; - - oAttributeTmp = oXmlNodeChildXF.Attributes["vertical"]; - if (null != oAttributeTmp) - strVertical = oAttributeTmp.Value; - - oAttributeTmp = oXmlNodeChildXF.Attributes["wrapText"]; - if (null != oAttributeTmp) - bWrapText = XMLBoolean.ParseOrDefault(oAttributeTmp.Value, false); - break; - } - } - - if (arrFonts.Count <= nFontId) - nFontId = 0; - if (arrFills.Count <= nFillId) - nFillId = 0; - if (arrBorders.Count <= nBorderId) - nBorderId = 0; - CFont oFont = arrFonts[nFontId]; - CFill oFill = arrFills[nFillId]; - CBorder oBorder = arrBorders[nBorderId]; - - #region Font - oNewStyleItem.Font.Bold = oFont.m_bIsBold; - oNewStyleItem.Font.Italic = oFont.m_bIsItalic; - oNewStyleItem.Font.Underline = oFont.m_bIsUnderline; - oNewStyleItem.Font.Size = oFont.m_nSize; - oNewStyleItem.Font.Name = oFont.m_strName; - - Format.Colors.ColorProperty oColorProp = new Format.Colors.FgColorProperty(oFont.m_oColorValue, true, "color", m_oWorkbook); - SetColor(ref oNewStyleItem.Font.Color, oColorProp); - #endregion - #region Alignment - switch (strVertical) - { - case "center": - oNewStyleItem.Alignment.Vertical = Format.Alignment.VerticalAlignmentType.center; - break; - case "distributed": - oNewStyleItem.Alignment.Vertical = Format.Alignment.VerticalAlignmentType.distributed; - break; - case "justify": - oNewStyleItem.Alignment.Vertical = Format.Alignment.VerticalAlignmentType.justify; - break; - case "top": - oNewStyleItem.Alignment.Vertical = Format.Alignment.VerticalAlignmentType.top; - break; - case "bottom": - default: - oNewStyleItem.Alignment.Vertical = Format.Alignment.VerticalAlignmentType.bottom; - break; - } - switch (strHorizontal) - { - case "center": - oNewStyleItem.Alignment.Horizontal = Format.Alignment.HorizontalAlignmentType.center; - break; - case "centerContinuous": - oNewStyleItem.Alignment.Horizontal = Format.Alignment.HorizontalAlignmentType.centerContinuous; - break; - case "distributed": - oNewStyleItem.Alignment.Horizontal = Format.Alignment.HorizontalAlignmentType.distributed; - break; - case "fill": - oNewStyleItem.Alignment.Horizontal = Format.Alignment.HorizontalAlignmentType.fill; - break; - case "justify": - oNewStyleItem.Alignment.Horizontal = Format.Alignment.HorizontalAlignmentType.justify; - break; - case "left": - oNewStyleItem.Alignment.Horizontal = Format.Alignment.HorizontalAlignmentType.left; - break; - case "right": - oNewStyleItem.Alignment.Horizontal = Format.Alignment.HorizontalAlignmentType.right; - break; - case "general": - default: - oNewStyleItem.Alignment.Horizontal = Format.Alignment.HorizontalAlignmentType.general; - break; - } - oNewStyleItem.Alignment.WrapText = bWrapText; - #endregion - #region Fill - oNewStyleItem.Fills.PatternFill.Pattern = oFill.m_oPatternType; - Format.Colors.ColorProperty oColorFgProp = new Format.Colors.FgColorProperty(oFill.m_oColorFg, true, "fgColor", m_oWorkbook); - SetColor(ref oNewStyleItem.Fills.PatternFill.FgColor, oColorFgProp); - Format.Colors.ColorProperty oColorBgProp = new Format.Colors.FgColorProperty(oFill.m_oColorBg, false, "bgColor", m_oWorkbook); - SetColor(ref oNewStyleItem.Fills.PatternFill.BgColor, oColorBgProp); - - oNewStyleItem.Fills.GradientFill.Type = oFill.m_oGradientType; - Format.Colors.ColorProperty oColorGradientProp = new Format.Colors.FgColorProperty(oFill.m_oColorGradient, true, "color", m_oWorkbook); - SetColor(ref oNewStyleItem.Fills.GradientFill.Color, oColorGradientProp); - #endregion - #region NumberFormat - oNewStyleItem.NumberFormatId = nFormatId; - #endregion - #region Borders - oNewStyleItem.Brds.Left.Style = oBorder.m_oBorderElemLeft.m_oBorderStyle; - oNewStyleItem.Brds.Top.Style = oBorder.m_oBorderElemTop.m_oBorderStyle; - oNewStyleItem.Brds.Right.Style = oBorder.m_oBorderElemRight.m_oBorderStyle; - oNewStyleItem.Brds.Bottom.Style = oBorder.m_oBorderElemBottom.m_oBorderStyle; - Format.Colors.ColorProperty oBorderPropColorLeft = new Format.Colors.FgColorProperty(oBorder.m_oBorderElemLeft.m_oBorderColor, true, "color", m_oWorkbook); - SetColor(ref oNewStyleItem.Brds.Left.Color, oBorderPropColorLeft); - Format.Colors.ColorProperty oBorderPropColorTop = new Format.Colors.FgColorProperty(oBorder.m_oBorderElemTop.m_oBorderColor, true, "color", m_oWorkbook); - SetColor(ref oNewStyleItem.Brds.Top.Color, oBorderPropColorTop); - Format.Colors.ColorProperty oColorGradientRight = new Format.Colors.FgColorProperty(oBorder.m_oBorderElemRight.m_oBorderColor, true, "color", m_oWorkbook); - SetColor(ref oNewStyleItem.Brds.Right.Color, oColorGradientRight); - Format.Colors.ColorProperty oColorGradientBottom = new Format.Colors.FgColorProperty(oBorder.m_oBorderElemBottom.m_oBorderColor, true, "color", m_oWorkbook); - SetColor(ref oNewStyleItem.Brds.Bottom.Color, oColorGradientBottom); - #endregion - - m_mapStyles.Add(i, oNewStyleItem); - } - - /*for (int i = 0; i < cell_xf.Count; i++) - { - XmlElement oCurNode = (XmlElement)cell_xf.Item(i); - Format.FormatSimple oNewStyleItem = new Format.FormatSimple(m_oWorkbook, oCurNode); - m_mapStyles.Add( i, oNewStyleItem ); - }*/ - } - } - - private void SetColor(ref Format.Colors.Color oColor, Format.Colors.ColorProperty oColorProp) - { - if (oColorProp.IsNull()) - { - oColorProp.Value = new Format.Colors.FgColor(m_oWorkbook); - oColor = new Format.Colors.Color(null, null, null, oColorProp, m_oWorkbook); - } - else oColor = new Format.Colors.Color(oColorProp.Value, null, null, oColorProp, m_oWorkbook); - } - - private void SetBorderStyle(ref Format.Borders.BorderStyle? oBorderStyle, string strBorderStyle) - { - switch (strBorderStyle) - { - case "dashDot": - oBorderStyle = Format.Borders.BorderStyle.dashDot; - break; - case "dashDotDot": - oBorderStyle = Format.Borders.BorderStyle.dashDotDot; - break; - case "dashed": - oBorderStyle = Format.Borders.BorderStyle.dashed; - break; - case "dotted": - oBorderStyle = Format.Borders.BorderStyle.dotted; - break; - case "double": - oBorderStyle = Format.Borders.BorderStyle.doubleLine; - break; - case "hair": - oBorderStyle = Format.Borders.BorderStyle.hair; - break; - case "medium": - oBorderStyle = Format.Borders.BorderStyle.medium; - break; - case "mediumDashDot": - oBorderStyle = Format.Borders.BorderStyle.mediumDashDot; - break; - case "mediumDashDotDot": - oBorderStyle = Format.Borders.BorderStyle.mediumDashDotDot; - break; - case "mediumDashed": - oBorderStyle = Format.Borders.BorderStyle.mediumDashed; - break; - case "slantDashDot": - oBorderStyle = Format.Borders.BorderStyle.slantDashDot; - break; - case "thick": - oBorderStyle = Format.Borders.BorderStyle.thick; - break; - case "thin": - oBorderStyle = Format.Borders.BorderStyle.thin; - break; - case "none": - default: - oBorderStyle = Format.Borders.BorderStyle.none; - break; - } - } - - private void ReadColor(ref XmlNode oXmlNode, ref Format.Colors.ColorValue oColorValue) - { - string strValueColor = ""; - XmlAttribute oAttr = oXmlNode.Attributes["rgb"]; - if (null != oAttr && (strValueColor = oAttr.Value) != "") - { - oColorValue = new Format.Colors.ColorValue(strValueColor, true, m_oWorkbook); - return; - } - oAttr = oXmlNode.Attributes["theme"]; - if (null != oAttr && (strValueColor = oAttr.Value) != "") - { - oAttr = oXmlNode.Attributes["tint"]; - string strValue = (null != oAttr) ? oAttr.Value : ""; - - double tint = XMLDouble.ParseOrDefault(strValue, 0); - oColorValue = new Format.Colors.ColorValue(XMLInt.ParseOrDefault(strValueColor, true ? 1 : 0), tint, true, m_oWorkbook); - return; - } - oAttr = oXmlNode.Attributes["indexed"]; - if (null != oAttr && (strValueColor = oAttr.Value) != "") - { - oColorValue = new Format.Colors.ColorValue(XMLInt.ParseOrDefault(strValueColor, true ? 64 : 65), true, m_oWorkbook); - return; - } - - oColorValue = new Format.Colors.ColorValue(true, m_oWorkbook); - } - - private Dictionary m_mapStyles = new Dictionary(); - private XmlElement CellStyleXfs_xml; - private XmlElement CellXfs_xml; - private XmlNamespaceManager ns_manager; - private Workbook m_oWorkbook; - - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/StyleSetter.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/StyleSetter.cs deleted file mode 100644 index 7b2670c097..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/StyleSetter.cs +++ /dev/null @@ -1,193 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor.Walkers -{ - /// - /// Terms of use: - /// Entity or Style entity - one of the following tags: , , - /// Property - one of an entity properties. For example: , , - /// - public class StyleSetter : ICellSetter, IRowsSetter, IColsSetter - { - public StyleSetter(Format.IStyleEntity style_entity, Format.IProperty property, Workbook workbook) - { - this.workbook = workbook; - CellXfs_xml = (XmlElement)workbook.StyleSheet.Get_CellXfs_OrCreate(); - CellStyleXfs_xml = (XmlElement)workbook.StyleSheet.Get_CellStyleXfs_OrCreate(); - ns_manager = workbook.NamespaceManager; - this.property = property; - this.style_entity = style_entity; - - cell_style_ids = new Dictionary(); - entity_ids = new Dictionary(); - } - - - #region ICellSetter Members - - public bool Set(int row, int col, XmlElement cell_tag) - { - int xf_index = XMLInt.ParseOrDefault(cell_tag.GetAttribute("s"), 0); - int xf_new_index = GetSuitableXFIndex(xf_index); - cell_tag.SetAttribute("s", xf_new_index.ToString()); - return true; - } - - public void PostProcessing() - { - // do nothing - } - - #endregion - - #region IRowsSetter Members - - public bool Set(XmlElement row_tag, int row_num) - { - int xf_index = XMLInt.ParseOrDefault(row_tag.GetAttribute("s"), 0); - int xf_new_index = GetSuitableXFIndex(xf_index); - row_tag.SetAttribute("s", xf_new_index.ToString()); - return true; - } - - #endregion - - #region IColsSetter Members - - public bool WouldLeftTheSame(XmlElement col_tag) - { - int xf_index = XMLInt.ParseOrDefault(col_tag.GetAttribute("style"), 0); - int xf_new_index = GetSuitableXFIndex(xf_index); - return xf_index == xf_new_index; - } - - public void Set(XmlElement col_tag) - { - int xf_index = XMLInt.ParseOrDefault(col_tag.GetAttribute("style"), 0); - col_tag.SetAttribute("style", GetSuitableXFIndex(xf_index).ToString()); - } - - #endregion - - - private int GetSuitableXFIndex(int xf_index) - { - if (cell_style_ids.ContainsKey(xf_index)) - { - return cell_style_ids[xf_index]; // return already calculated - } - - XmlElement xf_record = GetXFRecord(xf_index); - XmlElement xf_record_clonned = (XmlElement)xf_record.Clone(); - int entity_id = style_entity.GetEntityIdByXF(xf_record); - int changed_entity_position; - if (entity_ids.ContainsKey(entity_id) && entity_id != -1) - { - changed_entity_position = entity_ids[entity_id]; // return already calculated - } - else - { - changed_entity_position = style_entity.ApplyProperty(xf_record_clonned, property); - } - - entity_ids[entity_id] = changed_entity_position; // Append a new entity_id to the set - if (changed_entity_position == entity_id && entity_id != -1) - { - cell_style_ids[xf_index] = xf_index; // Append a new xf_index to the set - return xf_index; - } - - style_entity.SetEntityIdToXF(xf_record_clonned, changed_entity_position); - - - XmlNode cellXfs_tag = workbook.StyleSheet.Get_CellXfs_OrCreate(); - XmlNodeList xfs = cellXfs_tag.SelectNodes("main:xf", workbook.NamespaceManager); - int xf_new_position = 0; - foreach (XmlElement xf in xfs) - { - if (CompareXFs(xf_record_clonned, xf)) - { - break; - } - ++xf_new_position; - } - if (xf_new_position == xfs.Count) - { - cellXfs_tag.AppendChild(xf_record_clonned); - ((XmlElement)cellXfs_tag).RemoveAttribute("count"); - - } - cell_style_ids[xf_index] = xf_new_position; // Append a new xf_index to the set - return xf_new_position; - - } - - private XmlElement GetXFRecord(int xfId) - { - XmlElement cell_xf = (XmlElement)CellXfs_xml.SelectSingleNode("main:xf[position() = " + (xfId + 1).ToString() + "]", ns_manager); - if (cell_xf == null) // If the style reference in a cell is wrong - { - cell_xf = (XmlElement)CellXfs_xml.SelectSingleNode("main:xf", ns_manager); // select first 'xf' - if (cell_xf == null) // if no 'xf' records found in - { - CellXfs_xml.InnerXml = ""; - CellXfs_xml.SetAttribute("count", "1"); - cell_xf = (XmlElement)CellXfs_xml.SelectSingleNode("main:xf", ns_manager); // select first 'xf' - } - } - return cell_xf; - } - - - private bool CompareXFs(XmlElement xf1, XmlElement xf2) - { - if (xf1.GetAttribute("fontId") != xf2.GetAttribute("fontId") || - xf1.GetAttribute("fillId") != xf2.GetAttribute("fillId") || - xf1.GetAttribute("borderId") != xf2.GetAttribute("borderId") || - xf1.GetAttribute("numFmtId") != xf2.GetAttribute("numFmtId") || - xf1.GetAttribute("xfId") != xf2.GetAttribute("xfId")) - { - return false; - } - if (XMLBoolean.ParseOrDefault(xf1.GetAttribute("applyAlignment"), false) != XMLBoolean.ParseOrDefault(xf2.GetAttribute("applyAlignment"), false) || - XMLBoolean.ParseOrDefault(xf1.GetAttribute("applyBorder"), false) != XMLBoolean.ParseOrDefault(xf2.GetAttribute("applyBorder"), false) || - XMLBoolean.ParseOrDefault(xf1.GetAttribute("applyFill"), false) != XMLBoolean.ParseOrDefault(xf2.GetAttribute("applyFill"), false) || - XMLBoolean.ParseOrDefault(xf1.GetAttribute("applyFont"), false) != XMLBoolean.ParseOrDefault(xf2.GetAttribute("applyFont"), false) || - XMLBoolean.ParseOrDefault(xf1.GetAttribute("applyNumberFormat"), false) != XMLBoolean.ParseOrDefault(xf2.GetAttribute("applyNumberFormat"), false) || - XMLBoolean.ParseOrDefault(xf1.GetAttribute("applyProtection"), false) != XMLBoolean.ParseOrDefault(xf2.GetAttribute("applyProtection"), false) || - XMLBoolean.ParseOrDefault(xf1.GetAttribute("pivotButton"), false) != XMLBoolean.ParseOrDefault(xf2.GetAttribute("pivotButton"), false) || - XMLBoolean.ParseOrDefault(xf1.GetAttribute("quotePrefix"), false) != XMLBoolean.ParseOrDefault(xf2.GetAttribute("quotePrefix"), false) - ) - { - return false; - } - Format.Alignment.AlignmentEntity alignment_comparer = new Format.Alignment.AlignmentEntity(workbook); - Format.Protection.ProtectionEntity protection_comparer = new Format.Protection.ProtectionEntity(workbook); - if (!alignment_comparer.CompareEntities((XmlElement)alignment_comparer.GetEntityTagByXF(xf1), (XmlElement)alignment_comparer.GetEntityTagByXF(xf2)) || - !protection_comparer.CompareEntities((XmlElement)protection_comparer.GetEntityTagByXF(xf1), (XmlElement)protection_comparer.GetEntityTagByXF(xf2))) - { - return false; - } - - return true; - } - - - private Workbook workbook; - private XmlElement CellStyleXfs_xml; - private XmlElement CellXfs_xml; - private XmlNamespaceManager ns_manager; - private Format.IProperty property; - private Format.IStyleEntity style_entity; - #region optimization info - Dictionary cell_style_ids; - Dictionary entity_ids; - #endregion - } - -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/ValueGetter.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/ValueGetter.cs deleted file mode 100644 index 273fe93d63..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/ValueGetter.cs +++ /dev/null @@ -1,130 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor.Walkers -{ - internal class ValueGetter : IStatCollector - { - public ValueGetter(Workbook workbook) - { - this.workbook = workbook; - ns_manager = workbook.NamespaceManager; - raw_value = null; - value_type = null; - } - - #region IStatCollector Members - - public bool Collect(int row, int col, XmlElement cell_tag) - { - XmlNode value_tag = cell_tag.SelectSingleNode("main:v", ns_manager); - return CollectValue(value_tag == null ? "" : value_tag.InnerText, cell_tag.GetAttribute("t")); - } - - public bool Collect(int row, int col, Worksheet parent_sheet) - { - return CollectValue("", ""); - } - - #endregion - - private bool CollectValue(string value_extracted, string type_extracted) - { - if (raw_value == null) - { - raw_value = value_extracted; - value_type = type_extracted; - return true; // continue - } - else if (value_type == type_extracted && raw_value == value_extracted) - { - return true; // continue - } - else - { - raw_value = null; - value_type = null; - return false; - } - } - - public object Value - { - get - { - Calculation.Formulas.DataObjects.IDataObject internal_value = InternalValue; - if (null == internal_value) - { - return null; - } - return internal_value.UserValue; - } - } - - internal Calculation.Formulas.DataObjects.IDataObject InternalValue - { - get - { - if (null == raw_value) - { - return null; - } - return RecognizeValue(raw_value, value_type, workbook); - } - } - - - internal static Calculation.Formulas.DataObjects.IDataObject RecognizeValue(string value, string value_type, Workbook workbook) - { - if (null == value) - { - return new Calculation.Formulas.DataObjects.ObjectEmpty(); - } - switch (value_type.ToLower()) - { - case "b": - return new Calculation.Formulas.DataObjects.ObjectBoolean(value.ToLower() == "true" || value == "1"); - case "n": - case "": - { - double val_numeric; - if (XMLDouble.TryParse(value, out val_numeric)) - { - return new Calculation.Formulas.DataObjects.ObjectNumber(val_numeric); - } - else - { - if(value.Length != 0) - { - return new Calculation.Formulas.DataObjects.ObjectString(value); - } - return new Calculation.Formulas.DataObjects.ObjectEmpty(); - } - } - case "s": - { - int string_id = XMLInt.ParseOrDefault(value, -1); - return new Calculation.Formulas.DataObjects.ObjectString(string_id != -1 ? workbook.SharedStrings.GetString(string_id) : ""); - } - case "e": - { - return new Calculation.Formulas.DataObjects.ObjectError(Calculation.Formulas.ErrorValue.Parse(value)); - } - case "d": - case "inlinestr": - case "str": - default: - return new Calculation.Formulas.DataObjects.ObjectString(value); - } - } - - private XmlNamespaceManager ns_manager; - private string raw_value; - private string value_type; - private Workbook workbook; - - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/ValueSetter.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/ValueSetter.cs deleted file mode 100644 index 055d05c70e..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/ValueSetter.cs +++ /dev/null @@ -1,222 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.XMLDataSpecific; -using System.Globalization; - -namespace ASCOfficeEWSEditor.Editor.Walkers -{ - internal class ValueSetter : ValueSimpleSetter - { - public ValueSetter(object value, Worksheet parent_sheet, int num_cells) - : base(value, RecognizeValueType(value), parent_sheet, num_cells) - { - this.parent_sheet = parent_sheet; - ns_manager = parent_sheet.Workbook.NamespaceManager; - - updateHeaders = true; - } - - public ValueSetter(object value, string strValueType, Worksheet parent_sheet, int num_cells, bool bUpdateHeaders) - : base(value, strValueType, parent_sheet, num_cells) - { - this.parent_sheet = parent_sheet; - ns_manager = parent_sheet.Workbook.NamespaceManager; - - updateHeaders = bUpdateHeaders; - } - - public ValueSetter(Calculation.Formulas.DataObjects.IDataObject value, Worksheet parent_sheet, int num_cells) - : base(value.UserValue, value.Type, parent_sheet, num_cells) - { - this.parent_sheet = parent_sheet; - ns_manager = parent_sheet.Workbook.NamespaceManager; - - updateHeaders = true; - } - - #region ICellSetter Members - - public override bool Set(int row, int col, XmlElement cell_tag) - { - Cells.Cell cell = new Cells.Cell(row, col); - // Remove formula XML tag - XmlNode f_tag = cell_tag.SelectSingleNode("main:f", ns_manager); - if(f_tag != null) - { - cell_tag.RemoveChild(f_tag); - } - // Remove former Formula registration - Calculation.Formulas.CellParsedFormula existent_formula; - if (parent_sheet.Formulas.TryGetValue(cell, out existent_formula)) - { - existent_formula.UnregisterDependencies(); // dependencies are broken here (for example, look into PtgRef.Unregister()) - parent_sheet.Formulas.Remove(cell); - } - - base.Set(row, col, cell_tag); - - if (updateHeaders) - { - // Проверяем, является ли ячейка заголовком таблицы - int nTableIndex = -1; - if (parent_sheet.isCellHeader(row, col, out nTableIndex)) - { - parent_sheet.changeCellHeader(nTableIndex, col); - } - } - - // Notify recalculation engine - parent_sheet.Workbook.ValuesUpdateManager.NotifyUpdatedCell(cell, parent_sheet); - - return true; - } - - public override void PostProcessing() - { - base.PostProcessing(); - } - - #endregion - - private static string RecognizeValueType(object value) - { - if (value is string) - { - double val_numeric; - string val_str = value.ToString().ToUpper(); - if (val_str == "TRUE" || val_str == "FALSE") - { - return "b"; - } - else if (val_str == "#NULL!" || val_str == "#DIV/0!" || val_str == "#VALUE!" || val_str == "#REF!" || - val_str == "#NAME?" || val_str == "#NUM!" || val_str == "#N/A") - { - return "e"; - } - else if (double.TryParse(val_str, NumberStyles.Float, new CultureInfo(0x409), out val_numeric)) - { - return ""; - } - else if (val_str.Length == 0) - { - return null; - } - else - { - return "s"; - } - } - else if (value is double || value is float || value is Int32 || value is Int16 || value is Int64) - { - return ""; - } - else if (value is bool) - { - return "b"; - } - else if (value is Calculation.Formulas.ErrorValue) - { - return "e"; - } - return null; - } - - private Worksheet parent_sheet; - private XmlNamespaceManager ns_manager; - - private bool updateHeaders; - } - - internal class ValueSimpleSetter : ICellSetter - { - public ValueSimpleSetter(Calculation.Formulas.DataObjects.IDataObject value, Worksheet parent_sheet, int num_cells) - : this(value.UserValue, value.Type, parent_sheet, num_cells) - { - } - public ValueSimpleSetter(object value, string value_type, Worksheet parent_sheet, int num_cells) - { - this.value_type = value_type; - ns_manager = parent_sheet.Workbook.NamespaceManager; - - if (value_type == "s") - { - value_set = parent_sheet.Workbook.RegisterSharedString(value.ToString(), num_cells).ToString(); - } - else if (value_type == "str") - { - value_set = value.ToString(); - } - else if (value_type == "b") - { - string bool_str; - if ((bool_str = value as string) != null) - { - value_set = bool_str.ToUpper() == "TRUE" ? "1" : "0"; - } - else - { - value_set = XMLVariant.ToString(value); - } - } - else if (value_type == null) - { - value_set = ""; - } - else - { - value_set = XMLVariant.ToString(value); - } - removed_strings_collector = new RemovedStringsCollector(parent_sheet.Workbook); - } - - #region ICellSetter Members - - public virtual bool Set(int row, int col, XmlElement cell_tag) - { - removed_strings_collector.Collect(row, col, cell_tag); - - XmlNode val_tag = cell_tag.SelectSingleNode("main:v", ns_manager); - if (value_type == null) - { - if (val_tag != null) - { - cell_tag.RemoveChild(val_tag); - } - } - else - { - if (val_tag == null) - { - val_tag = cell_tag.OwnerDocument.CreateElement("v", ns_manager.LookupNamespace("main")); - cell_tag.InsertAfter(val_tag, cell_tag.SelectSingleNode("main:f", ns_manager)); - } - val_tag.InnerText = value_set; - } - - if (value_type != "" && value_type != null) - { - cell_tag.SetAttribute("t", value_type); - } - else if (cell_tag.HasAttribute("t")) - { - cell_tag.RemoveAttribute("t"); - } - return true; - } - - public virtual void PostProcessing() - { - removed_strings_collector.DecrementCounters(); - } - - #endregion - - private XmlNamespaceManager ns_manager; - public string value_set { get; set; } - private string value_type; - private RemovedStringsCollector removed_strings_collector; - } - -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/WidthSetter.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/WidthSetter.cs deleted file mode 100644 index e217dce3dc..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Walkers/WidthSetter.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor.Walkers -{ - internal class WidthSetter : IColsSetter - { - public WidthSetter(double width) - { - this.width = width; - } - - #region IColsSetter Members - - public bool WouldLeftTheSame(XmlElement col_tag) - { - int old_width = XMLInt.ParseOrDefault(col_tag.GetAttribute("width"), 0); - return width == old_width; - } - - public void Set(XmlElement col_tag) - { - col_tag.SetAttribute("width", XMLDouble.ToString(width)); - } - - #endregion - - private double width; - } - -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Workbook.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Workbook.cs deleted file mode 100644 index c8f3f03715..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Workbook.cs +++ /dev/null @@ -1,391 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.XMLDataSpecific; -using ASCOfficeEWSEditor.Editor.Walkers; - -namespace ASCOfficeEWSEditor.Editor -{ - /// - /// Represents a workbook. - /// - public class Workbook : IDisposable - { - internal Workbook(string wb_name, XmlDocument document, EWSEditor editor, List binary_data_storage) - { - InitNamespaceManager(document); - xml_doc = document; - Editor = editor; - Name = wb_name; - BinaryDataStorage = binary_data_storage; - xml_workbook = Helpers.OOXNavigate.FindWorkbookTag(document); - ValuesUpdateManager = new Calculation.ValuesUpdateManager(); - if (null == xml_workbook) - { - throw new Events.ReportableException(new Events.InternalError("Wrong document format. Workbook tag hasn't been found.")); - } - Relationships = new OOX.Relationships(xml_workbook.ParentNode); - ContentTypes = new OOX.ContentTypes(document); - StyleSheet = new StyleSheet(ContentTypes, Relationships, this); - Theme = new Theme(ContentTypes, Relationships, this); - Sheets = new Sheets(this); - Worksheets = new Worksheets(Sheets); - SharedStrings = new SharedStrings(ContentTypes, Relationships, this); - - RemoveCalculationChain(); - DefinedNames = new DefinedNames.DefinedNames(this); - DefinedNames.RegisterFormulas(); - foreach (Worksheet ws in Worksheets) - { - ws.BuildFormulasDependancies(); - } - ////если в ячейке есть формула, но нет значения - пересчитывать формулу, с целью получения значения. - //foreach (Worksheet ws in Worksheets) - //{ - // FormulaRecheck formula_updater = new FormulaRecheck(ws); - // RangeWalker low_part_walker = new RangeWalker(Helpers.ReferencesFormat.maxRange(), ws); - // low_part_walker.UpdateValues(formula_updater); - //} - workbook_file = new OOX.WorkbookFile(ContentTypes, Relationships, this); - } - - internal Workbook(string wb_name, XmlDocument document, EWSEditor editor) - : this(wb_name, document, editor, new List()) - { - } - - private void InitNamespaceManager(XmlDocument document) - { - NamespaceManager = new XmlNamespaceManager(document.NameTable); - NamespaceManager.AddNamespace("main", "http://schemas.openxmlformats.org/spreadsheetml/2006/main"); - NamespaceManager.AddNamespace("r", "http://schemas.openxmlformats.org/package/2006/relationships"); - NamespaceManager.AddNamespace("mainr", "http://schemas.openxmlformats.org/officeDocument/2006/relationships"); - NamespaceManager.AddNamespace("xdr", "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing"); - NamespaceManager.AddNamespace("a", "http://schemas.openxmlformats.org/drawingml/2006/main"); - NamespaceManager.AddNamespace("c", "http://schemas.openxmlformats.org/drawingml/2006/chart"); - } - - private void RemoveCalculationChain() - { - OOX.XmlFile calc_chain_file = new OOX.XmlFile(ContentTypes, Relationships, GetRootTag().ParentNode.ParentNode, - Relationships.GetTarget(OOX.Relationships.FileType.calcChain), OOX.Relationships.FileType.calcChain, OOX.ContentTypes.FileType.calcChain); - calc_chain_file.Remove(); - } - - /// - /// Stores workbook to the file. Format is obtained from extension of filename - /// - /// Path for storing - /// OK/NOK - public bool Save(string path) - { - return Save(path, FileFormats.Format.AUTO); - } - - /// - /// Stores workbook to the file of specified format - /// - /// Path for storing - /// File format - /// OK/NOK - public bool Save(string path, FileFormats.Format format) - { - try - { - FileFormats.Serializer.Save(this, path, format); - return true; - } - catch (Events.ReportableException reportable_exception) - { - Editor.ReportError(null, reportable_exception.error_description); - return false; - } - catch (System.IO.IOException io_exception) - { - Editor.ReportError(null, new Events.SystemIOError(io_exception)); - return false; - } - } - - /// - /// Stores workbook to the specified CSV file - /// - /// Path for storing - /// Code page - /// Cells delimiter - /// OK/NOK - public bool SaveToCSV(string path, int code_page, char delimiter) - { - try - { - FileFormats.Serializer.SaveToCSV(this, path, code_page, delimiter); - return true; - } - catch (Events.ReportableException reportable_exception) - { - Editor.ReportError(null, reportable_exception.error_description); - return false; - } - catch (System.IO.IOException io_exception) - { - Editor.ReportError(null, new Events.SystemIOError(io_exception)); - return false; - } - } - - /// - /// Stores workbook to the specified CSV file with default cells delimiter (,) - /// - /// Path for storing - /// Code page - /// OK/NOK - public bool SaveToCSV(string path, int code_page) - { - return SaveToCSV(path, code_page, FileFormats.Serializer.CSV_default_delimiter); - } - - - public bool SaveToPrint(string path, int nIndex) - { - try - { - FileFormats.Serializer.SaveToPrint(this, path, nIndex); - return true; - } - catch (Events.ReportableException reportable_exception) - { - Editor.ReportError(null, reportable_exception.error_description); - return false; - } - catch (System.IO.IOException io_exception) - { - Editor.ReportError(null, new Events.SystemIOError(io_exception)); - return false; - } - } - /// - /// Sets the workbook active. - /// - public void Activate() - { - Editor.ActiveWorkbook = this; - } - - /// - /// Collection of all sheets in the workbook. Read-only - /// - public Sheets Sheets { get; private set; } - - /// - /// Returns collection of all worksheets in the workbook. - /// - public Worksheets Worksheets { get; private set; } - -// /// -// /// Returns collection of all worksheets in the workbook. -// /// -// public Worksheets Worksheets() -// { -// return new Worksheets(Sheets); -// } -// public IEnumerable Worksheets -// { -// get -// { -// foreach (Sheet sheet in Sheets) -// { -// Worksheet ws = sheet as Worksheet; -// if (ws != null) -// { -// yield return ws; -// } -// } -// } -// } - - /// - /// Returns collection of worksheets in the specified indices range (inclusive boundaries) - /// - public IEnumerable WorksheetsN(int from_index, int to_index) - { - foreach (Sheet sheet in Sheets) - { - int index = sheet.Index; - if (index >= from_index && index <= to_index) - { - Worksheet ws = sheet as Worksheet; - if (ws != null) - { - yield return ws; - } - } - } - } - - - /// - /// Active sheet. Read-only - /// - public Sheet ActiveSheet - { - get - { - XmlNode activeTab = xml_workbook.SelectSingleNode("main:bookViews/main:workbookView/@activeTab", NamespaceManager); - return Sheets[null != activeTab ? XMLInt.ParseOrDefaultAndReport(activeTab.InnerText, 0, this, "workbookView/@activeTab") : 0]; - } - private set{} - } - - - /// - /// Active worksheet. Read-only - /// - public Worksheet ActiveWorksheet - { - get - { - return ActiveSheet as Worksheet; - } - } - - /// - /// Name of the workbook. Read-only. (use SetName to change the name of the workbook) - /// - public string Name { get; internal set;} - - /// - /// Sets the new name for the workbook - /// - /// new name - /// Whether the assignment was successful - public bool SetName(string name) - { - if (name.Length == 0) - { - return false; - } - if(Name == name) - { - return true; - } - if (Editor.Workbooks.ContainsKey(name)) - { - return false; - } - Editor.Workbooks.Remove(Name); - Name = name; - Editor.Workbooks.Add(name, this); - return true; - } - - /// - /// Close the workbook - /// - public void Close() - { - Editor.Workbooks.Remove(Name); - } - - internal void ActivateSheet(int index) - { - XmlElement workbookView = (XmlElement)xml_workbook.SelectSingleNode("main:bookViews/main:workbookView", NamespaceManager); - if(null == workbookView) - { - //AddBookView(); // TODO: implement - workbookView = (XmlElement)xml_workbook.SelectSingleNode("main:bookViews/main:workbookView", NamespaceManager); - } - workbookView.SetAttribute("activeTab", index.ToString()); - } - - /// - /// Registers a new or already existent shared string in SharedStrings file. - /// - /// String to register - /// Number times the string value is to be additionally used in - /// Offset reference (0-based) - internal int RegisterSharedString(string ssi, int used_times) - { - return SharedStrings.SetString(ssi, used_times); - } - - /// - /// Obtain <workbook> tag - /// - /// - internal XmlNode GetRootTag() - { - return xml_workbook; - } - - internal XmlDocument GetXmlDocument() - { - return xml_doc; - } - - internal void ReportError(Events.ErrorDescription description) - { - Editor.ReportError(this, description); - } - - /// - /// Collection of defined names contained in the workbook - /// - public DefinedNames.DefinedNames DefinedNames { get; private set; } - - /// - /// Default font name of the workbook (set as style 0). - /// - public string DefaultFontName - { - get - { - return StyleSheet.GetZeroStyleOrDefaultFontName(); - } - } - - /// - /// Default font size of the workbook (set as style 0). - /// - public int DefaultFontSize - { - get - { - return StyleSheet.GetZeroStyleOrDefaultFontSize(); - } - } - - #region IDisposable Members - /// - /// Simply closes the workbook - /// - public void Dispose() - { - Close(); - } - - #endregion - - internal OOX.IOrderedSections XMLSectionsController { get { return workbook_file; } } - - internal OOX.Relationships Relationships { get; private set; } - internal OOX.ContentTypes ContentTypes { get; private set; } - internal SharedStrings SharedStrings { get; private set; } - internal StyleSheet StyleSheet { get; private set; } - internal Theme Theme { get; private set; } - internal Calculation.ValuesUpdateManager ValuesUpdateManager { get; private set; } - internal List BinaryDataStorage { get; private set; } - - - private OOX.WorkbookFile workbook_file; - #region XML references - private XmlDocument xml_doc; - private XmlNode xml_workbook; - #endregion - #region Tree references - internal EWSEditor Editor { get; private set; } - #endregion - - internal XmlNamespaceManager NamespaceManager { get; private set; } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Worksheet.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Worksheet.cs deleted file mode 100644 index 053aaad96b..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Worksheet.cs +++ /dev/null @@ -1,1557 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.XMLDataSpecific; -using System.IO; -using ASCOfficeEWSEditor.Editor.Charts; -using ASCOfficeEWSEditor.Editor.Images; -using FileConverterUtils2; -using ASCOfficeFile; -using ASCImageFile3; -using ASCMediaCore3; -using System.Net; -using System.Text.RegularExpressions; -using ASCOfficeEWSEditor.Editor.Cells; -using ASCOfficeEWSEditor.Editor.Walkers; -using ASCImageStudio3; - -namespace ASCOfficeEWSEditor.Editor -{ - /// - /// Represents a worksheet. - /// - public class Worksheet : Sheet - { - /// - /// Create a new worksheet - /// - internal static Worksheet CreateNew(string name, Sheet before, XmlNode xml_workbook_sheets, Sheets container, Workbook workbook) - { - OOX.WorksheetFile worksheet_file = new OOX.WorksheetFile(workbook.ContentTypes, workbook.Relationships, workbook); - worksheet_file.GetFileTagOrCreate(); - return new Worksheet(name, worksheet_file.rId, before, xml_workbook_sheets, container, workbook, worksheet_file); - } - - /// - /// Create a new worksheet - /// - private Worksheet(string name, string rId, Sheet before, XmlNode xml_workbook_sheets, Sheets container, Workbook workbook, OOX.WorksheetFile worksheet_file) - : base(name, rId, before, xml_workbook_sheets, container, workbook) - { - this.worksheet_file = worksheet_file; - xml_worksheet = worksheet_file.GetWorksheetTagOrCreate(); - CommonInitialization(); - } - - /// - /// Create from existent worksheet - /// - internal Worksheet(string sheet_path, XmlNode xml_workbook_sheet, Sheets container, Workbook workbook) - : base(container, workbook, xml_workbook_sheet) - { - worksheet_file = new OOX.WorksheetFile(sheet_path, workbook.ContentTypes, workbook.Relationships, workbook); - xml_worksheet = worksheet_file.GetRootTag(); - CommonInitialization(); - //BuildFormulasDependancies(); - - FindTables(); - FindImages(workbook); - FindCharts(); - } - - private void CommonInitialization() - { - Relationships = new OOX.Relationships(xml_worksheet.ParentNode); - SubjectsStorage = new Calculation.SubjectsStorage(this); - Formulas = new Dictionary(); - xml_sheetData = xml_worksheet.SelectSingleNode("main:sheetData", ns_manager); - if (null == xml_sheetData) - { - throw new Events.ReportableException(new Events.InternalError("Wrong OOX format. Required 'sheetData' tag is absent.")); - } - xml_sheetView = xml_worksheet.SelectSingleNode("main:sheetViews", ns_manager); - if (null == xml_sheetView || 0 == xml_sheetView.ChildNodes.Count) - throw new Events.ReportableException(new Events.InternalError("Wrong OOX format. Required 'sheetView' tag is absent.")); - else - xml_sheetView = xml_sheetView.SelectSingleNode("main:sheetView", ns_manager); - if (null == xml_sheetView) - throw new Events.ReportableException(new Events.InternalError("Wrong OOX format. Required 'sheetView' tag is absent.")); - - MergeCells = new MergeCells(this, xml_worksheet); - Subject = new Calculation.WorksheetSubject(this); - Hyperlinks = new Hyperlinks.Hyperlinks(this); // Must follow Relationships initialization - - Tables = new List(); - SimpleImages = new List(); - SimpleCharts = new List(); - - AutoFilter = new AutoFilter(this, xml_worksheet, SheetData); - } - - internal void BuildFormulasDependancies() - { - Walkers.RangeWalker range_walker = new Walkers.RangeWalker(Helpers.ReferencesFormat.maxRange(), this); - - Walkers.FormulasParser collector = new Walkers.FormulasParser(this); - range_walker.CollectStatistics(collector); - } - - - /// - /// Has sheet data. Read-only. - /// - public override bool HasSheetData { get { return true; } } - - - /// - /// References the specified range of cells - /// - /// Name of the range in A1 form - /// - public virtual Range Range(string range_ref) - { - return new Range(range_ref, this); - } - - /// - /// References the specified single cell - /// - /// Row of the cell (1-based) - /// Column of the cell (1-based) - /// - public virtual Range Cell(int row, int col) - { - return new Range(new Cells.CellRange(row, col, row, col), this); - } - - internal virtual Range Cell(Cells.Cell cell) - { - return new Range(new Cells.CellRange(cell), this); - } - - /// - /// Sets/Gets the standard (default) height of all the rows in the worksheet, in points. - /// Note: You should keep in mind that when you set this value this will only affect - /// the rows which height was not set manually - /// - public double StandardHeight - { - get - { - XmlNode height_node = xml_worksheet.SelectSingleNode("main:sheetFormatPr/@defaultRowHeight", ns_manager); - if (null == height_node) - { - return 15; // TODO: find a way how to calculate this value depending on font type - } - double standard_height = XMLDouble.ParseOrDefault(height_node.InnerText, -1); - if (standard_height == -1 || double.IsNaN(standard_height)) - { - Workbook.ReportError(new Events.InternalError("Wrong OOX format. sheetFormatPr/@defaultRowHeight is not double or NaN")); - return 15; // TODO: find a way how to calculate this value depending on font type - } - return standard_height; - } - set - { - XmlElement sheetFormatPr_node = (XmlElement)xml_worksheet.SelectSingleNode("main:sheetFormatPr", ns_manager); - if (null == sheetFormatPr_node) - { - sheetFormatPr_node = xml_worksheet.OwnerDocument.CreateElement("sheetFormatPr", ns_manager.LookupNamespace("main")); - xml_worksheet.InsertAfter(sheetFormatPr_node, null); - } - sheetFormatPr_node.SetAttribute("defaultRowHeight", XMLDouble.ToString(value)); - } - } - - /// - /// Sets/Gets the standard (default) width of all the columns in the worksheet. - /// One unit of the value is equal to the width of '0' (zero) character in the Normal style. - /// Note: You should keep in mind that when you set this value this will only affect - /// the columns which width was not set manually - /// - public double StandardWidth - { - get - { - XmlNode width_node = xml_worksheet.SelectSingleNode("main:sheetFormatPr/@defaultColWidth", ns_manager); - if (null == width_node) - { - return 8.43; // TODO: find a way how to calculate this value depending on font type - } - double standard_width = XMLDouble.ParseOrDefault(width_node.InnerText, -1); - if (standard_width == -1 || double.IsNaN(standard_width)) - { - Workbook.ReportError(new Events.InternalError("Wrong OOX format. sheetFormatPr/@defaultColWidth is not double or NaN")); - return 8.43; // TODO: find a way how to calculate this value depending on font type - } - return standard_width; - } - set - { - XmlElement sheetFormatPr_node = (XmlElement)xml_worksheet.SelectSingleNode("main:sheetFormatPr", ns_manager); - if (null == sheetFormatPr_node) - { - sheetFormatPr_node = xml_worksheet.OwnerDocument.CreateElement("sheetFormatPr", ns_manager.LookupNamespace("main")); - XMLSectionsController.AppendXmlSection(sheetFormatPr_node); - } - sheetFormatPr_node.SetAttribute("defaultColWidth", XMLDouble.ToString(value)); - } - } - - /// - /// Permanently removes the worksheet from the workbook - /// - /// Whether the operation successful. Return false if the removed sheet is the only sheet in the workbook - public override bool Remove() - { - if (RemoveSheet()) - { - worksheet_file.Remove(); - - foreach (Calculation.Formulas.CellParsedFormula cell_parsed_formula in Formulas.Values) - { - cell_parsed_formula.UnregisterDependencies(); - } - - foreach (Worksheet ws in Workbook.Worksheets) - { - foreach (Calculation.CellItem cell_item in ws.SubjectsStorage.CellSubjects.Values) - { - if (cell_item.HasFormula() && cell_item.UpdateDelayed) - { - cell_item.RecalcFormulaAndUpdateCell(); - Workbook.ValuesUpdateManager.NotifyUpdatedCell(cell_item.Cell, ws); - cell_item.UpdateDelayed = false; - } - } - } - return true; - } - return false; - } - - /// - /// Sets the sheet active. - /// - public override void Activate() - { - ((XmlElement)this.xml_sheetView).SetAttribute("tabSelected", "1"); - base.Activate(); - } - - /// - /// Remove sheet active - /// - public override void RemoveActive() - { - ((XmlElement)this.xml_sheetView).RemoveAttribute("tabSelected"); - base.Activate(); - } - - /// - /// Gets a Range object that references all the cells on the worksheet - /// - public virtual Range Cells { get { return new Range(Helpers.ReferencesFormat.maxRange(), this); } } - - /// - /// Returns references to the merged ranges on the sheet - /// - /// List of range references - public List GetMergedAreas() - { - return MergeCells.GetMergedAreas(); - } - - /// - /// Returns references to the merged ranges on the sheet - /// - /// List of range references - public List GetMergedAreas2() - { - return MergeCells.GetMergedAreas2(); - } - - /// - /// This just sets the recalculated cell value without any attendant actions - /// - /// - /// - internal void CellSetValue(Cells.Cell cell, Calculation.Formulas.DataObjects.IDataObject value) - { - Walkers.CellWalker cell_walker = new Walkers.CellWalker(cell, this); - Walkers.ValueSimpleSetter setter = new Walkers.ValueSimpleSetter(value, this, 1); - cell_walker.ChangeValues(setter); - - } - - /// - /// This just gets the recalculated cell value without any attendant actions - /// - /// - internal Calculation.Formulas.DataObjects.IDataObject CellGetValue(Cells.Cell cell) - { - XmlNode value_tag = xml_sheetData.SelectSingleNode("main:row[@r = " + cell.Row + "]/main:c[@r = '" + cell.ToString() + "']/main:v", ns_manager); - if (value_tag == null) - { - return new Calculation.Formulas.DataObjects.ObjectEmpty(); - } - string value_type = ((XmlElement)value_tag.ParentNode).GetAttribute("t"); - return Walkers.ValueGetter.RecognizeValue(value_tag.InnerText, value_type, Workbook); - } - - /// - /// This just sets the recalculated formula value without any attendant actions - /// - /// - /// - internal void FormulaSimpleSetValue(Cells.Cell cell, string formula) - { - Walkers.CellWalker cell_walker = new Walkers.CellWalker(cell, this); - Walkers.FormulaSimpleSetter setter = new Walkers.FormulaSimpleSetter(formula, this); - cell_walker.ChangeValues(setter); - - } - - public string AddNewTable(string strFilterRange) - { - OOX.TableFile oTableFile = new ASCOfficeEWSEditor.Editor.OOX.TableFile(Workbook.ContentTypes, Relationships, Workbook); - - Cells.CellRange oFilterRange = new ASCOfficeEWSEditor.Editor.Cells.CellRange(strFilterRange, Workbook); - Table oNewTable = Table.CreateNew(this, oTableFile, xml_worksheet, oFilterRange); - - Tables.Add(oNewTable); - return oNewTable.rId; - } - - public void RemoveTable(string table_rId) - { - for (int nIndex = 0; nIndex < Tables.Count; ++nIndex) - { - if (Tables[nIndex].rId == table_rId) - { - Tables[nIndex].RemoveFromXml(Tables.Count); - Tables.RemoveAt(nIndex); - break; - } - } - } - - public Dictionary ChangeAutoFilterTable(string table_rId, AutoFilterElementSendData oChangeObject) - { - for (int nIndex = 0; nIndex < Tables.Count; ++nIndex) - { - if (Tables[nIndex].rId == table_rId) - { - return Tables[nIndex].ChangeAutoFilter(oChangeObject); - } - } - - return null; - } - - public bool isCellHeader(int row, int col, out int nTableIndex) - { - for (nTableIndex = 0; nTableIndex < Tables.Count; ++nTableIndex) - { - if (Tables[nTableIndex].isCellHeader(row, col)) - return true; - } - - nTableIndex = -1; - return false; - } - - public void changeCellHeader(int nTableIndex, int col) - { - if (0 > nTableIndex || nTableIndex >= Tables.Count) - return; - - Tables[nTableIndex].changeCellHeader(col); - } - - /// - /// An event that can be used to be notified whenever the cells containing formulas are recalculated. - /// - public event EventHandler CellsUpdatedEvent; - - /// - /// Obtain the set of updated cells - /// - /// Set of updated cells - public Events.CellsUpdatedEventArg GetUpdatedCells() - { - Events.CellsUpdatedEventArg cell_refs = new Events.CellsUpdatedEventArg(); - foreach (KeyValuePair element in SubjectsStorage.CellSubjects) - { - if (element.Value.CellOrFormulaUpdated) - { - cell_refs.AddCellRef(element.Key.ToString()); - element.Value.CellOrFormulaUpdated = false; - } - } - - return cell_refs; - } - - public bool CopyData(Worksheet worksheet) - { - if (null == worksheet.xml_sheetData) - return false; - //TODO подумать как бы копировать xml целиком, при этом убирая или наоборот дублирую rid в некоторых нодах(например pageSetup). - //Хорошо бы еще посмотреть есть ли rid в тех нодах, что копируются сейчас. - XmlNode oNodeSheetData = worksheet.xml_sheetData.Clone(); - xml_worksheet.ReplaceChild(oNodeSheetData, xml_sheetData); - xml_sheetData = oNodeSheetData; - - XmlNode oCols = worksheet.xml_worksheet.SelectSingleNode("main:cols", worksheet.ns_manager); - if (null != oCols) - xml_worksheet.InsertBefore(oCols.Clone(), xml_sheetData); - - XmlNode oPageMargin = xml_worksheet.SelectSingleNode("main:pageMargins", ns_manager); - if (null != oPageMargin) - { - if (null != worksheet.MergeCells.MergeCellsXml) - { - XmlNode oNodeMergeCells = worksheet.MergeCells.MergeCellsXml.Clone(); - xml_worksheet.InsertBefore(oNodeMergeCells, oPageMargin); - MergeCells.MergeCellsXml = oNodeMergeCells; - } - if (null != worksheet.Hyperlinks.HyperlinksXml) - { - XmlNode oNodeHyperlinks = worksheet.Hyperlinks.HyperlinksXml.Clone(); - xml_worksheet.InsertBefore(oNodeHyperlinks, oPageMargin); - Hyperlinks.HyperlinksXml = oNodeHyperlinks; - } - } - else - { - if (null != worksheet.MergeCells.MergeCellsXml) - { - XmlNode oNodeMergeCells = worksheet.MergeCells.MergeCellsXml.Clone(); - xml_worksheet.AppendChild(oNodeMergeCells); - MergeCells.MergeCellsXml = oNodeMergeCells; - } - if (null != worksheet.Hyperlinks.HyperlinksXml) - { - XmlNode oNodeHyperlinks = worksheet.Hyperlinks.HyperlinksXml.Clone(); - xml_worksheet.AppendChild(oNodeHyperlinks); - Hyperlinks.HyperlinksXml = oNodeHyperlinks; - } - } - foreach (Table oTable in worksheet.Tables) - { - if (ASCOfficeEWSEditor.Editor.Cells.CellRange.Empty != oTable.TableAutoFilter.m_oRefRange) - { - OOX.TableFile oTableFile = new ASCOfficeEWSEditor.Editor.OOX.TableFile(Workbook.ContentTypes, Relationships, Workbook); - Table oNewTable = new Table(this, oTableFile, xml_worksheet, oTable); - Tables.Add(oNewTable); - } - } - return true; - } - - internal void IssueCellsUpdatedEvent() - { - if (CellsUpdatedEvent != null) - { - Events.CellsUpdatedEventArg cell_refs = GetUpdatedCells(); - - if (cell_refs.IsSomethingChanged) - { - CellsUpdatedEvent(this, cell_refs); - } - } - } - - internal Cells.CellRange GetNonEmptyCellsRange() - { - Walkers.RangeWalker range_walker = new Walkers.RangeWalker(Helpers.ReferencesFormat.maxRange(), this); - Walkers.NonEmptyCellsCollector collector = new Walkers.NonEmptyCellsCollector(this); - range_walker.CollectStatistics(collector); - return collector.GetRange(); - } - - /// - /// The difference from GetNonEmptyCellsRange is that GetNonEmptyCells0Range returns range started in A1 and ended in max used cell - /// - /// - internal Cells.CellRange GetNonEmptyCells0Range() - { - Walkers.RangeWalker range_walker = new Walkers.RangeWalker(Helpers.ReferencesFormat.maxRange(), this); - Walkers.NonEmptyCellsCollector collector = new Walkers.NonEmptyCellsCollector(this); - range_walker.CollectStatistics(collector); - return collector.Get0Range(); - } - - private void FindCharts() - { - XmlElement drawing_node = (XmlElement)xml_worksheet.SelectSingleNode("main:drawing", ns_manager); - if (drawing_node == null) - { - // There is no drawing in the worksheet - return; - } - string drawing_rId = drawing_node.GetAttribute("id", ns_manager.LookupNamespace("mainr")); - string drawing_path = Relationships.GetTarget(drawing_rId); - - XmlNode drawing_file_xml = Helpers.OOXNavigate.getReferenceByPath(drawing_path, xml_worksheet.ParentNode.ParentNode); - if (drawing_file_xml == null) - { - throw new Events.ReportableException(new Events.InternalError("Wrong OOX format. File '" + drawing_path + "' not found.")); - } - - XmlNodeList anchors = drawing_file_xml.SelectNodes("xdr:wsDr/xdr:twoCellAnchor", ns_manager); - foreach (XmlNode anchor_xml in anchors) - { - XmlElement anchor_chart_xml = (XmlElement)anchor_xml.SelectSingleNode("xdr:graphicFrame/a:graphic/a:graphicData/c:chart", ns_manager); - if (anchor_chart_xml == null) // image - continue; - - string chart_rId = anchor_chart_xml.GetAttribute("id", ns_manager.LookupNamespace("mainr")); - - OOX.Relationships drawing_relationships = new OOX.Relationships(drawing_file_xml); - - string chart_path = drawing_relationships.GetTarget(chart_rId); - - if (string.IsNullOrEmpty(chart_path)) // случай когда ошибочно построили drawing, но файла нет - continue; - - XmlNode chart_file_xml = Helpers.OOXNavigate.getReferenceByPath(chart_path, drawing_file_xml.ParentNode); - if (chart_file_xml == null) - { - //drawing_relationships.RemoveTarget(chart_rId); - continue; - throw new Events.ReportableException(new Events.InternalError("Wrong OOX format. File '" + chart_path + "' not found.")); - } - SimpleCharts.Add(new Chart(chart_file_xml, anchor_xml, this)); - } - } - - private void FindTables() - { - XmlElement table_node = (XmlElement)xml_worksheet.SelectSingleNode("main:tableParts", ns_manager); - if (table_node == null) - { - // There is no tables in the worksheet - return; - } - foreach (XmlElement oXmlNode in table_node.ChildNodes) - { - string table_rId = oXmlNode.GetAttribute("id", ns_manager.LookupNamespace("mainr")); - string table_path = Relationships.GetTarget(table_rId); - - OOX.TableFile oTableFile = new OOX.TableFile(table_path, Workbook.ContentTypes, Relationships, Workbook); - - Tables.Add(new Table(this, oTableFile, xml_worksheet, SheetData, table_rId)); - } - } - - private void FindImages(Workbook workbook) - { - if ((workbook.Editor == null) || string.IsNullOrEmpty(workbook.Editor.site_dir) || !Directory.Exists(workbook.Editor.site_dir)) - return; - - string mediaFolder = null; - SimpleImages = new List(); - XmlElement drawing_node = (XmlElement)xml_worksheet.SelectSingleNode("main:drawing", ns_manager); - if (drawing_node == null) - return; - else - { - mediaFolder = workbook.Editor.site_dir + "\\process\\media\\"; - if (!Directory.Exists(mediaFolder)) - Directory.CreateDirectory(mediaFolder); - } - - string drawing_rId = drawing_node.GetAttribute("id", ns_manager.LookupNamespace("mainr")); - string drawing_path = Relationships.GetTarget(drawing_rId); - - XmlNode drawing_file_xml = Helpers.OOXNavigate.getReferenceByPath(drawing_path, xml_worksheet.ParentNode.ParentNode); - if (drawing_file_xml == null) - return; - - // find anchors - XmlNodeList anchors = drawing_file_xml.SelectNodes("xdr:wsDr/xdr:twoCellAnchor", ns_manager); - foreach (XmlNode anchor_xml in anchors) - { - XmlElement imageId = (XmlElement)anchor_xml.SelectSingleNode("xdr:pic/xdr:blipFill/a:blip", ns_manager); - if (imageId == null) // chart - continue; - - Image img = new Image(anchor_xml, ns_manager); - - // find image path - OOX.Relationships drawing_relationships = new OOX.Relationships(drawing_file_xml); - string image_doc_path = drawing_relationships.GetTarget(img.pic_rid); - - if (string.IsNullOrEmpty(image_doc_path)) // случай когда ошибочно построили drawing, но файла нет - continue; - - img.image_doc_path = image_doc_path; - - // extract images - XmlNode image_file_xml = Helpers.OOXNavigate.getReferenceByPath(image_doc_path, drawing_file_xml.ParentNode); - if (image_file_xml == null) - continue; - - string imageFileName = workbook.Name + "_" + Path.GetFileName(image_doc_path); - int binId = int.Parse(image_file_xml.Attributes["bin_data_id"].Value); - - string imageUrl = mediaFolder + imageFileName; - imageUrl = imageUrl.ToLower(); - string imageExt = Path.GetExtension(imageUrl); - - FileStream stream = new FileStream(imageUrl, FileMode.Create); - stream.Write(workbook.BinaryDataStorage[binId], 0, workbook.BinaryDataStorage[binId].Length); - stream.Close(); - - switch (imageExt) - { - case ".tiff": - case ".emf": - case ".wmf": - { - string toFile = imageUrl.Replace(imageExt, ".jpg"); - - ASCOfficeFile.CAVSOfficeFileConverterClass converter = new ASCOfficeFile.CAVSOfficeFileConverterClass(); - ASCImageStudio3.ImageTransformsClass imageConverter = new ASCImageStudio3.ImageTransformsClass(); - - string strLoadXml = "" + - "" + - "" + - ""; - bool bResult = imageConverter.SetXml(strLoadXml); - bResult = imageConverter.Transform(); - int reff = System.Runtime.InteropServices.Marshal.ReleaseComObject(imageConverter); - - if (bResult) - { - File.Delete(imageUrl); - imageUrl = toFile; - } - } - break; - - default: - break; - } - - int start = imageUrl.IndexOf(@"process\"); - img.image_url = imageUrl.Remove(0, start); - img.image_url = img.image_url.Replace("\\", "/"); - - SimpleImages.Add(img); - } - } - - bool ConvertToPng() - { - bool bResult = false; - return bResult; - } - - void ToLog(Workbook workbook, string what, bool newFile) - { - if (!string.IsNullOrEmpty(what)) - { - FileStream log = new FileStream(@"d:\Work\AVSDocuments\ASCOfficeWeb\wwwroot\process\log.txt", newFile ? FileMode.Create : FileMode.Open); - log.Seek(log.Length, SeekOrigin.Begin); - System.Text.UTF8Encoding encoding = new System.Text.UTF8Encoding(); - string str = what + "\n"; - log.Write(encoding.GetBytes(str), 0, str.Length); - log.Close(); - } - } - - private string ConvertInterval(string interval) - { - string retVal = ""; - - string listName, cells; - string[] spl = interval.Split(new char[] { '!' }); - - if (spl.Length > 0) - { - listName = spl[0]; - cells = spl[1]; - - spl = cells.Split(new char[] { ':' }); - - if (spl.Length > 0) - { - retVal = listName + "!"; - for (int i = 0; i < spl.Length; i++) - { - string cellNum = Regex.Replace(spl[i], @"\D", "", RegexOptions.Compiled); - string cellWord = spl[i].Replace(cellNum, ""); - - retVal += "$" + cellWord + "$" + cellNum + ((i < spl.Length - 1) ? ":" : ""); - } - } - } - - return retVal; - } - - public void UpdateChartPos(Chart chart, DrawingTransFromJson jsonChart) - { - chart.TwoCellAnchor.from_col = jsonChart.from_col; - chart.TwoCellAnchor.from_colOff = jsonChart.from_colOff; - chart.TwoCellAnchor.from_row = jsonChart.from_row; - chart.TwoCellAnchor.from_rowOff = jsonChart.from_rowOff; - - chart.TwoCellAnchor.to_col = jsonChart.to_col; - chart.TwoCellAnchor.to_colOff = jsonChart.to_colOff; - chart.TwoCellAnchor.to_row = jsonChart.to_row; - chart.TwoCellAnchor.to_rowOff = jsonChart.to_rowOff; - - chart.TwoCellAnchor.chart_width = jsonChart.object_width; - chart.TwoCellAnchor.chart_height = jsonChart.object_height; - chart.TwoCellAnchor.chart_xOff = jsonChart.object_xOff; - chart.TwoCellAnchor.chart_yOff = jsonChart.object_yOff; - } - - public bool UpdateChartData(DrawingTransFromJson jsonChart, Workbook workbook) - { - for (int i = 0; i < SimpleCharts.Count; i++) - { - if (SimpleCharts[i].TwoCellAnchor.frame_id == jsonChart.object_id) - { - switch (jsonChart.chart.chartType) - { - case "col": - case "bar": - SimpleCharts[i].chart_file_xml.InnerXml = Resource1.empty_barChart; - break; - case "lineChart": - SimpleCharts[i].chart_file_xml.InnerXml = Resource1.empty_lineChart; - break; - case "scatterChart": - SimpleCharts[i].chart_file_xml.InnerXml = Resource1.empty_scatterChart; - break; - case "bubbleChart": - SimpleCharts[i].chart_file_xml.InnerXml = Resource1.empty_bubbleChart; - break; - case "areaChart": - SimpleCharts[i].chart_file_xml.InnerXml = Resource1.empty_areaChart; - break; - case "radarChart": - SimpleCharts[i].chart_file_xml.InnerXml = Resource1.empty_radarChart; - break; - case "doughnutChart": - SimpleCharts[i].chart_file_xml.InnerXml = Resource1.empty_doughnutChart; - break; - case "pieChart": - SimpleCharts[i].chart_file_xml.InnerXml = Resource1.empty_pieChart; - break; - case "stockChart": - SimpleCharts[i].chart_file_xml.InnerXml = Resource1.empty_stockChart; - break; - } - - SimpleCharts.Clear(); - FindCharts(); - - for (int j = 0; j < SimpleCharts.Count; j++) - { - if (SimpleCharts[j].TwoCellAnchor.frame_id == jsonChart.object_id) - { - InitChartFromJson(SimpleCharts[j], jsonChart, workbook); - break; - } - } - break; - } - } - return true; - } - - public void UpdateChartValues(List cells, Workbook wb) - { - for (int i = 0; i < SimpleCharts.Count; i++) - { - for (int j = 0; j < SimpleCharts[i].PlotArea.basicChart.seriesList.Count; j++) - { - SimpleCharts[i].PlotArea.basicChart.seriesList[j].ChangeValues(cells, wb); - } - } - } - - public void UpdateChartAutoFilterValues(Dictionary autoFilterRows, Workbook workbook) - { - int maxRow, maxCol; - workbook.ActiveWorksheet.Cells.ExistentCells(out maxRow, out maxCol); - List deleteList = new List(); - foreach (KeyValuePair pair in autoFilterRows) - { - CellRange cellRange = new CellRange(pair.Key, 1, pair.Key, maxCol); - Range range = new Range(cellRange, workbook.ActiveWorksheet); - List changeList = range.NonEmptyCells(); - if (pair.Value) - { - for (int i = 0; i < changeList.Count; i++) - { - deleteList.Add(changeList[i]); - } - } - } - - // проверяем в каждой диаграмме все серии - for (int i = 0; i < SimpleCharts.Count; i++) - { - for (int j = 0; j < SimpleCharts[i].PlotArea.basicChart.seriesList.Count; j++) - { - SimpleCharts[i].PlotArea.basicChart.seriesList[j].ClearAutoFilterValues(deleteList, workbook); - } - } - } - - private void InitChartFromJson(Chart chart, DrawingTransFromJson jsonChart, Workbook workbook) - { - UpdateChartPos(chart, jsonChart); - - chart.PlotArea.basicChart.chartType = jsonChart.chart.chartType; - chart.PlotArea.basicChart.seriesType = jsonChart.chart.seriesType; - - chart.PlotArea.xShow = jsonChart.chart.xAxis.show; - chart.PlotArea.xTitle = jsonChart.chart.xAxis.title; - chart.PlotArea.xGrid = jsonChart.chart.xAxis.grid; - - chart.PlotArea.yShow = jsonChart.chart.yAxis.show; - chart.PlotArea.yTitle = jsonChart.chart.yAxis.title; - chart.PlotArea.yGrid = jsonChart.chart.yAxis.grid; - - chart.title = jsonChart.chart.title; - if (!jsonChart.chart.legend.show) - chart.DeleteLegend(); - else - { - chart.Legend.overlay = jsonChart.chart.legend.overlay; - chart.Legend.position = jsonChart.chart.legend.legendPos; - } - - // устанавливаем кол-во серий - 1 - chart.PlotArea.basicChart.AddSeries(jsonChart.chart.seriesList.Count - 1); - for (int i = 0; i < jsonChart.chart.seriesList.Count; i++) - { - chart.PlotArea.basicChart.seriesList[i].InsertValues(jsonChart.chart.seriesList[i].valuesList); - Cells.CellRange3D location = new Cells.CellRange3D(new Cells.CellRange(jsonChart.chart.seriesList[i].referredrange, workbook), workbook.ActiveWorksheet); - string formatedInterval = ConvertInterval(location.ToString()); - chart.PlotArea.basicChart.seriesList[i].interval = formatedInterval; - chart.PlotArea.basicChart.seriesList[i].color = jsonChart.chart.seriesList[i].color; - chart.PlotArea.basicChart.seriesList[i].borderColor = jsonChart.chart.seriesList[i].borderColor; - chart.PlotArea.basicChart.seriesList[i].name = jsonChart.chart.seriesList[i].name; - chart.PlotArea.basicChart.seriesList[i].showVal = jsonChart.chart.seriesList[i].showVal; - } - - chart.TwoCellAnchor.chart_guid = jsonChart.object_guid; - } - - // считает все диаграммы по всем листам - private int GetWorkbookLastRid(Workbook workbook) - { - int lastRid = 0; - for (int i = 0; i < workbook.Worksheets.Count; i++) - { - XmlNode drawing = Helpers.OOXNavigate.getReferenceByPath("xl/drawings/drawing" + (i + 1).ToString() + ".xml", xml_worksheet.OwnerDocument.DocumentElement); - if (drawing == null) - continue; - - OOX.Relationships rels = new OOX.Relationships(drawing); - int currRid = rels.GetLastRid(); - if (currRid > 0) - lastRid += currRid; - } - return lastRid; - } - - public bool AddChart(Workbook workbook, DrawingTransFromJson newObject) - { - // вставка - XmlElement drawing_node = (XmlElement)xml_worksheet.SelectSingleNode("main:drawing", ns_manager); - if (drawing_node == null) - { - // создаём новый drawing в листе - XmlElement drawing_tag = xml_worksheet.OwnerDocument.CreateElement("drawing", ns_manager.LookupNamespace("main")); - - // поиск последнего индекса автофильтров - OOX.Relationships sheet_rel = new OOX.Relationships(Helpers.OOXNavigate.getReferenceByPath("xl/worksheets/sheet" + (workbook.ActiveSheet.Index + 1).ToString() + ".xml", - xml_worksheet.OwnerDocument.DocumentElement)); - - drawing_tag.SetAttribute("id", ns_manager.LookupNamespace("mainr"), "rId" + (sheet_rel.GetLastRid() + 1).ToString()); - - - XmlNode pageMargins = xml_worksheet.SelectSingleNode("main:pageMargins", ns_manager); - if (pageMargins != null) - xml_worksheet.InsertAfter((XmlNode)drawing_tag, pageMargins); - else - { - XmlNode pageSetup = xml_worksheet.SelectSingleNode("main:pageSetup", ns_manager); - if (pageSetup == null) - return false; - xml_worksheet.InsertAfter((XmlNode)drawing_tag, pageSetup); - } - - // папки - XmlNode chart_dir_xml = Helpers.OOXNavigate.AddDirectory("xl/charts", xml_worksheet.OwnerDocument.DocumentElement, false); - XmlNode draw_dir_xml = Helpers.OOXNavigate.AddDirectory("xl/drawings", xml_worksheet.OwnerDocument.DocumentElement, false); - XmlNode draw_rels_dir_xml = Helpers.OOXNavigate.AddDirectory("xl/drawings/_rels", xml_worksheet.OwnerDocument.DocumentElement, false); - XmlNode sheet_rels_dir_xml = Helpers.OOXNavigate.AddDirectory("xl/worksheets/_rels", xml_worksheet.OwnerDocument.DocumentElement, false); - - // rels для worksheets - string sheet_rels_file_name = "sheet" + (workbook.ActiveSheet.Index + 1).ToString() + ".xml.rels"; - workbook.ContentTypes.RegisterFile("/xl/worksheets/_rels/" + sheet_rels_file_name, ASCOfficeEWSEditor.Editor.OOX.ContentTypes.FileType.rels); - - string drawingName = "drawing" + (workbook.ActiveSheet.Index + 1).ToString() + ".xml"; - XmlNode draw_file_xml = Helpers.OOXNavigate.AddFile("xl/drawings/" + drawingName, xml_worksheet.OwnerDocument.DocumentElement, false); - - // register - workbook.ContentTypes.RegisterFile(draw_file_xml, ASCOfficeEWSEditor.Editor.OOX.ContentTypes.FileType.drawing); - - // targets - Relationships = new OOX.Relationships(xml_worksheet.ParentNode); - string chartName = "chart" + (GetWorkbookLastRid(workbook) + 1).ToString() + ".xml"; - - draw_file_xml.InnerXml = Resource1.empty_chartDrawing; - OOX.Relationships drawing_rel = new OOX.Relationships(draw_file_xml); - drawing_rel.AddTarget("../charts/" + chartName, ASCOfficeEWSEditor.Editor.OOX.Relationships.FileType.chart, false); - - sheet_rel.AddTarget("../drawings/" + drawingName, ASCOfficeEWSEditor.Editor.OOX.Relationships.FileType.drawing, false); - workbook.ContentTypes.RegisterFile("/xl/drawings/_rels/" + drawingName + ".rels", ASCOfficeEWSEditor.Editor.OOX.ContentTypes.FileType.rels); - - // заполняем объект - XmlNode drawing_chart_file_xml = Helpers.OOXNavigate.getReferenceByPath("../charts/" + chartName, xml_worksheet.ParentNode.ParentNode); - - XmlNode chart_file_xml = Helpers.OOXNavigate.AddFile("xl/charts/" + chartName, xml_worksheet.OwnerDocument.DocumentElement, false); - workbook.ContentTypes.RegisterFile(chart_file_xml, ASCOfficeEWSEditor.Editor.OOX.ContentTypes.FileType.chartsheet); - - switch (newObject.chart.chartType) - { - case "col": - case "bar": - chart_file_xml.InnerXml = Resource1.empty_barChart; - break; - case "lineChart": - chart_file_xml.InnerXml = Resource1.empty_lineChart; - break; - case "scatterChart": - chart_file_xml.InnerXml = Resource1.empty_scatterChart; - break; - case "bubbleChart": - chart_file_xml.InnerXml = Resource1.empty_bubbleChart; - break; - case "areaChart": - chart_file_xml.InnerXml = Resource1.empty_areaChart; - break; - case "radarChart": - chart_file_xml.InnerXml = Resource1.empty_radarChart; - break; - case "doughnutChart": - chart_file_xml.InnerXml = Resource1.empty_doughnutChart; - break; - case "pieChart": - chart_file_xml.InnerXml = Resource1.empty_pieChart; - break; - case "stockChart": - chart_file_xml.InnerXml = Resource1.empty_stockChart; - break; - } - - Relationships = new OOX.Relationships(xml_worksheet.ParentNode); - - // получаем объект и заполняем поля - FindCharts(); - if (SimpleCharts.Count > 0) - InitChartFromJson(SimpleCharts[0], newObject, workbook); - } - else // есть drawing - { - string drawing_rId = drawing_node.GetAttribute("id", ns_manager.LookupNamespace("mainr")); - Relationships = new OOX.Relationships(xml_worksheet.ParentNode); - string drawing_path = Relationships.GetTarget(drawing_rId); - - string[] spl = drawing_path.Split(new char[] { '/' }); - XmlNode drawing_file_xml = Helpers.OOXNavigate.getReferenceByPath("xl/drawings/" + spl[spl.Length - 1], xml_worksheet.OwnerDocument.DocumentElement); - - if (drawing_file_xml == null) - return false; - - XmlNodeList anchors = drawing_file_xml.SelectNodes("xdr:wsDr/xdr:twoCellAnchor", ns_manager); - - // делаем копию и задаём новые параметры - if (anchors.Count > 0) - { - OOX.Relationships drawing_relationships = new OOX.Relationships(drawing_file_xml); - //string chartName = "chart" + (drawing_relationships.GetLastRid() + 1).ToString() + ".xml"; - string chartName = "chart" + (GetWorkbookLastRid(workbook) + 1).ToString() + ".xml"; - - XmlNode chart_file_xml = Helpers.OOXNavigate.AddFile("xl/charts/" + chartName, xml_worksheet.OwnerDocument.DocumentElement, false); - drawing_relationships.AddTarget("../charts/" + chartName, ASCOfficeEWSEditor.Editor.OOX.Relationships.FileType.chart, false); - workbook.ContentTypes.RegisterFile(chart_file_xml, ASCOfficeEWSEditor.Editor.OOX.ContentTypes.FileType.chartsheet); - - // пишем в drawing - XmlElement resourceDrawing = xml_worksheet.OwnerDocument.CreateElement("tmp"); - resourceDrawing.InnerXml = Resource1.empty_chartDrawing; - XmlNode template = resourceDrawing.SelectSingleNode("xdr:wsDr/xdr:twoCellAnchor", ns_manager); - - XmlNode newAnchor = template.Clone(); - - // меняем индексы - XmlNode frameNode = (XmlElement)newAnchor.SelectSingleNode("xdr:graphicFrame", ns_manager); - XmlElement id = (XmlElement)frameNode.SelectSingleNode("xdr:nvGraphicFramePr/xdr:cNvPr", ns_manager); - if (id != null) - id.SetAttribute("id", (drawing_relationships.GetLastRid() - 1).ToString()); - - XmlElement rid = (XmlElement)frameNode.SelectSingleNode("a:graphic/a:graphicData/c:chart", ns_manager); - if (rid != null) - rid.SetAttribute("r:id", "rId" + drawing_relationships.GetLastRid().ToString()); - - XmlNode docRoot = drawing_file_xml.SelectSingleNode("xdr:wsDr", ns_manager); - docRoot.AppendChild(newAnchor); - - // пишем в chart - switch (newObject.chart.chartType) - { - case "col": - case "bar": - chart_file_xml.InnerXml = Resource1.empty_barChart; - break; - case "lineChart": - chart_file_xml.InnerXml = Resource1.empty_lineChart; - break; - case "scatterChart": - chart_file_xml.InnerXml = Resource1.empty_scatterChart; - break; - case "bubbleChart": - chart_file_xml.InnerXml = Resource1.empty_bubbleChart; - break; - case "areaChart": - chart_file_xml.InnerXml = Resource1.empty_areaChart; - break; - case "radarChart": - chart_file_xml.InnerXml = Resource1.empty_radarChart; - break; - case "doughnutChart": - chart_file_xml.InnerXml = Resource1.empty_doughnutChart; - break; - case "pieChart": - chart_file_xml.InnerXml = Resource1.empty_pieChart; - break; - case "stockChart": - chart_file_xml.InnerXml = Resource1.empty_stockChart; - break; - } - - Relationships = new OOX.Relationships(xml_worksheet.ParentNode); - - // получаем объект и заполняем поля - SimpleCharts.Clear(); - FindCharts(); - if (SimpleCharts.Count > 0) - InitChartFromJson(SimpleCharts[SimpleCharts.Count - 1], newObject, workbook); - } - } - return true; - } - - public bool DeleteChart(Workbook workbook, DrawingTransFromJson newObject) - { - // поиск всех зависимостей - XmlElement drawing_node = (XmlElement)xml_worksheet.SelectSingleNode("main:drawing", ns_manager); - if (drawing_node == null) - return false; - - string drawing_rId = drawing_node.GetAttribute("id", ns_manager.LookupNamespace("mainr")); - Relationships = new OOX.Relationships(xml_worksheet.ParentNode); - string drawing_path = Relationships.GetTarget(drawing_rId); - - string[] spl = drawing_path.Split(new char[] { '/' }); - XmlNode drawing_file_xml = Helpers.OOXNavigate.getReferenceByPath("xl/drawings/" + spl[spl.Length - 1], xml_worksheet.OwnerDocument.DocumentElement); - - if (drawing_file_xml == null) - return false; - - for (int i = 0; i < workbook.ActiveWorksheet.SimpleCharts.Count; i++) - { - if (workbook.ActiveWorksheet.SimpleCharts[i].TwoCellAnchor.frame_id == newObject.object_id) - { - workbook.ActiveWorksheet.SimpleCharts.RemoveAt(i); - break; - } - } - - XmlNodeList anchors = drawing_file_xml.SelectNodes("xdr:wsDr/xdr:twoCellAnchor", ns_manager); - foreach (XmlNode anchor_xml in anchors) - { - XmlElement anchor_chart_xml = (XmlElement)anchor_xml.SelectSingleNode("xdr:graphicFrame/a:graphic/a:graphicData/c:chart", ns_manager); - if (anchor_chart_xml == null) // image - continue; - - string chart_rId = anchor_chart_xml.GetAttribute("id", ns_manager.LookupNamespace("mainr")); - - OOX.Relationships drawing_relationships = new OOX.Relationships(drawing_file_xml); - - string chart_path = drawing_relationships.GetTarget(chart_rId); - XmlNode chart_file_xml = Helpers.OOXNavigate.getReferenceByPath(chart_path, drawing_file_xml.ParentNode); - - Chart chart = new Chart(chart_file_xml, anchor_xml, this); - - if (chart.TwoCellAnchor.frame_id == newObject.object_id) - { - anchor_xml.ParentNode.RemoveChild(anchor_xml); - - // find image path - drawing_relationships = new OOX.Relationships(drawing_file_xml); - string chart_file_path = drawing_relationships.GetTarget(chart.TwoCellAnchor.chart_rid); - XmlNode image_file_xml = Helpers.OOXNavigate.getReferenceByPath(chart_file_path, drawing_file_xml.ParentNode); - - workbook.ContentTypes.DeRegisterFile(Helpers.OOXNavigate.getReferenceByPath("xl/charts/" + Path.GetFileName(chart_file_path), xml_worksheet.OwnerDocument.DocumentElement)); - drawing_relationships.RemoveTarget(chart.TwoCellAnchor.chart_rid); - - XmlNode ret_xml = Helpers.OOXNavigate.DeleteBinFile("xl/charts/" + Path.GetFileName(chart_file_path), xml_worksheet.OwnerDocument.DocumentElement); - - // удаляем drawing в листе - if (drawing_relationships.GetLastRid() == 0) - { - string drawingName = "drawing" + (workbook.ActiveSheet.Index + 1).ToString() + ".xml"; - string sheetName = "sheet" + (workbook.ActiveSheet.Index + 1).ToString() + ".xml"; - XmlNode removeElement = Helpers.OOXNavigate.getReferenceByPath("xl/drawings/" + drawingName, xml_worksheet.OwnerDocument.DocumentElement); - workbook.ContentTypes.DeRegisterFile(removeElement); - - removeElement = Helpers.OOXNavigate.getReferenceByPath("xl/drawings/_rels/" + drawingName + ".rels", xml_worksheet.OwnerDocument.DocumentElement); - workbook.ContentTypes.DeRegisterFile(removeElement); - - removeElement = Helpers.OOXNavigate.getReferenceByPath("xl/worksheets/_rels/" + sheetName + ".rels", xml_worksheet.OwnerDocument.DocumentElement); - workbook.ContentTypes.DeRegisterFile(removeElement); - //removeElement.ParentNode.RemoveChild(removeElement); - - xml_worksheet.RemoveChild(drawing_node); - - XmlNode drawing_xml = Helpers.OOXNavigate.getReferenceByPath("xl/drawings/" + drawingName, xml_worksheet.OwnerDocument.DocumentElement); - drawing_xml.ParentNode.RemoveChild(drawing_xml); - - XmlNode drawing_rels_xml = Helpers.OOXNavigate.getReferenceByPath("xl/drawings/_rels/" + drawingName + ".rels", xml_worksheet.OwnerDocument.DocumentElement); - drawing_rels_xml.ParentNode.RemoveChild(drawing_rels_xml); - } - break; - } - } - - return true; - } - - public bool AddImage(Workbook workbook, DrawingTransFromJson newObject, string siteDir) - { - string mediaFolder = siteDir + "\\process\\media\\"; - if (!Directory.Exists(mediaFolder)) - Directory.CreateDirectory(mediaFolder); - - string fileName = mediaFolder + workbook.Name + "_" + newObject.object_guid; - - // файл уже загружен - if (newObject.image_url.IndexOf("process/", 0) == 0) - { - string downloadFilePath = siteDir + "//" + newObject.image_url.Replace("/", "\\"); - File.Copy(downloadFilePath, fileName, true); - //File.Delete(downloadFilePath); - } - else // url картинки - { - // base64 - if (newObject.image_url.IndexOf("data:image/", 0) == 0) - { - string base64Image = newObject.image_url.Remove(0, newObject.image_url.IndexOf(",") + 1); - byte[] base64Buff = Convert.FromBase64String(base64Image); - FileStream base64Stream = new FileStream(fileName, FileMode.Create); - base64Stream.Write(base64Buff, 0, base64Buff.Length); - base64Stream.Close(); - } - else - { - try - { - WebClient webClient = new WebClient(); - webClient.DownloadFile(newObject.image_url, fileName); - } - catch (Exception ex) - { - throw new Events.ReportableException(new Events.InternalError("Error downloading file.")); - } - } - } - - // init registration - ASCOfficeFile.CAVSOfficeFormatChecker imageChecker = new CAVSOfficeFormatChecker(); - ASCOfficeEWSEditor.Editor.OOX.ContentTypes.FileType contentType; - int type = imageChecker.GetFileFormat(fileName); - int reff = System.Runtime.InteropServices.Marshal.ReleaseComObject(imageChecker); - string ext = ""; - - switch (type) - { - case FileConverterUtils2.FileFormats.AVS_OFFICESTUDIO_FILE_IMAGE_JPG: - contentType = ASCOfficeEWSEditor.Editor.OOX.ContentTypes.FileType.jpeg; - ext = ".jpeg"; - break; - case FileConverterUtils2.FileFormats.AVS_OFFICESTUDIO_FILE_IMAGE_PNG: - contentType = ASCOfficeEWSEditor.Editor.OOX.ContentTypes.FileType.png; - ext = ".png"; - break; - case FileConverterUtils2.FileFormats.AVS_OFFICESTUDIO_FILE_IMAGE_GIF: - contentType = ASCOfficeEWSEditor.Editor.OOX.ContentTypes.FileType.gif; - ext = ".gif"; - break; - - // необходима конвертация - case FileConverterUtils2.FileFormats.AVS_OFFICESTUDIO_FILE_IMAGE_BMP: - case FileConverterUtils2.FileFormats.AVS_OFFICESTUDIO_FILE_IMAGE_TIFF: - case FileConverterUtils2.FileFormats.AVS_OFFICESTUDIO_FILE_IMAGE_EMF: - case FileConverterUtils2.FileFormats.AVS_OFFICESTUDIO_FILE_IMAGE_WMF: - case FileConverterUtils2.FileFormats.AVS_OFFICESTUDIO_FILE_IMAGE_TGA: - { - try - { - contentType = ASCOfficeEWSEditor.Editor.OOX.ContentTypes.FileType.jpeg; - ext = ".jpeg"; - string toFile = fileName + "_jpeg"; - - ASCOfficeFile.CAVSOfficeFileConverterClass converter = new ASCOfficeFile.CAVSOfficeFileConverterClass(); - ASCImageStudio3.ImageTransformsClass imageConverter = new ASCImageStudio3.ImageTransformsClass(); - - string strLoadXml = "" + - "" + - "" + - ""; - bool bResult = imageConverter.SetXml(strLoadXml); - bResult = imageConverter.Transform(); - reff = System.Runtime.InteropServices.Marshal.ReleaseComObject(imageConverter); - - if (bResult) - { - File.Delete(fileName); - fileName = toFile; - } - } - catch (Exception ex) - { - throw new Events.ReportableException(new Events.InternalError("Image converter error.")); - } - } - break; - - default: - throw new Events.ReportableException(new Events.InternalError("Unsupported file.")); - } - - try - { - ASCOfficeFile.CAVSOfficeFileConverterClass converter = new ASCOfficeFile.CAVSOfficeFileConverterClass(); - ASCImageFile3.ImageFile3Class imageFileObj = new ASCImageFile3.ImageFile3Class(); - - Object itf = new Object(); - bool bRes = imageFileObj.LoadImage2(fileName, out itf); - - if (itf != null) - { - ASCMediaCore3.IAVSUncompressedVideoFrame metrics = (ASCMediaCore3.IAVSUncompressedVideoFrame)itf; - newObject.object_width = metrics.Width; - newObject.object_height = metrics.Height; - - if (itf != null) - reff = System.Runtime.InteropServices.Marshal.ReleaseComObject(itf); - } - reff = System.Runtime.InteropServices.Marshal.ReleaseComObject(imageFileObj); - } - catch (Exception ex) - { - } - - string binName = "image" + (workbook.BinaryDataStorage.Count + 1).ToString() + ext; - File.Copy(fileName, mediaFolder + workbook.Name + "_" + binName, true); - File.Delete(fileName); - fileName = mediaFolder + workbook.Name + "_" + binName; - - int start = fileName.IndexOf(@"process\"); - newObject.image_url = fileName.Remove(0, start); - newObject.image_url = newObject.image_url.Replace("\\", "/"); - - // вставка - XmlElement drawing_node = (XmlElement)xml_worksheet.SelectSingleNode("main:drawing", ns_manager); - if (drawing_node == null) - { - // создаём новый drawing в листе - XmlElement drawing_tag = xml_worksheet.OwnerDocument.CreateElement("drawing", ns_manager.LookupNamespace("main")); - drawing_tag.SetAttribute("id", ns_manager.LookupNamespace("mainr"), "rId1"); - xml_worksheet.AppendChild((XmlNode)drawing_tag); - - // папки - XmlNode media_dir_xml = Helpers.OOXNavigate.AddDirectory("xl/media", xml_worksheet.OwnerDocument.DocumentElement, false); - XmlNode draw_dir_xml = Helpers.OOXNavigate.AddDirectory("xl/drawings", xml_worksheet.OwnerDocument.DocumentElement, false); - XmlNode draw_rels_dir_xml = Helpers.OOXNavigate.AddDirectory("xl/drawings/_rels", xml_worksheet.OwnerDocument.DocumentElement, false); - XmlNode sheet_rels_dir_xml = Helpers.OOXNavigate.AddDirectory("xl/worksheets/_rels", xml_worksheet.OwnerDocument.DocumentElement, false); - - // rels для worksheets - string sheet_rels_file_name = "sheet" + (workbook.ActiveSheet.Index + 1).ToString() + ".xml.rels"; - workbook.ContentTypes.RegisterFile("/xl/worksheets/_rels/" + sheet_rels_file_name, ASCOfficeEWSEditor.Editor.OOX.ContentTypes.FileType.rels); - - string drawingName = "drawing" + (workbook.ActiveSheet.Index + 1).ToString() + ".xml"; - XmlNode draw_file_xml = Helpers.OOXNavigate.AddFile("xl/drawings/" + drawingName, xml_worksheet.OwnerDocument.DocumentElement, false); - - // register - workbook.ContentTypes.RegisterFile(draw_file_xml, ASCOfficeEWSEditor.Editor.OOX.ContentTypes.FileType.drawing); - - // targets - draw_file_xml.InnerXml = Resource1.empty_imageDrawing; - OOX.Relationships drawing_rel = new OOX.Relationships(draw_file_xml); - drawing_rel.AddTarget("../media/" + binName, ASCOfficeEWSEditor.Editor.OOX.Relationships.FileType.image, false); - - OOX.Relationships sheet_rel = new OOX.Relationships(Helpers.OOXNavigate.getReferenceByPath("xl/worksheets/sheet" + (workbook.ActiveSheet.Index + 1).ToString() + ".xml", - xml_worksheet.OwnerDocument.DocumentElement)); - sheet_rel.AddTarget("../drawings/" + drawingName, ASCOfficeEWSEditor.Editor.OOX.Relationships.FileType.drawing, false); - workbook.ContentTypes.RegisterFile("/xl/drawings/_rels/" + drawingName + ".rels", ASCOfficeEWSEditor.Editor.OOX.ContentTypes.FileType.rels); - - // заполняем объект - FileStream stream = new FileStream(fileName, FileMode.Open); - byte[] buffer = new byte[stream.Length]; - stream.Read(buffer, 0, (int)(stream.Length)); - stream.Close(); - - workbook.BinaryDataStorage.Add(buffer); - - XmlNode drawing_bin_file_xml = Helpers.OOXNavigate.getReferenceByPath("../media/" + binName, xml_worksheet.ParentNode.ParentNode); - - XmlNode image_file_xml = Helpers.OOXNavigate.AddBinFile("xl/media/" + binName, xml_worksheet.OwnerDocument.DocumentElement, false, workbook.BinaryDataStorage.Count - 1); - workbook.ContentTypes.RegisterFile(image_file_xml, contentType); - - XmlNode anchor = draw_file_xml.SelectSingleNode("xdr:wsDr/xdr:twoCellAnchor", ns_manager); - Image img = new Image(anchor, ns_manager); - - img.image_url = newObject.image_url; - img.image_guid = newObject.object_guid; - - // from - img.from_col = newObject.from_col; - img.from_colOff = newObject.from_colOff; - img.from_row = newObject.from_row; - img.from_rowOff = newObject.from_rowOff; - - // to - img.to_col = newObject.to_col; - img.to_colOff = newObject.to_colOff; - img.to_row = newObject.to_row; - img.to_rowOff = newObject.to_rowOff; - - img.image_width = newObject.object_width; - img.image_height = newObject.object_height; - - img.image_xOff = newObject.object_xOff; - img.image_yOff = newObject.object_yOff; - - // id - img.pic_id = workbook.BinaryDataStorage.Count - 1; - - // name - img.pic_name = "Image " + workbook.BinaryDataStorage.Count.ToString(); - - // rId - img.pic_rid = "rId1"; - - SimpleImages.Add(img); - } - else // есть drawing - { - string drawing_rId = drawing_node.GetAttribute("id", ns_manager.LookupNamespace("mainr")); - Relationships = new OOX.Relationships(xml_worksheet.ParentNode); - string drawing_path = Relationships.GetTarget(drawing_rId); - - string[] spl = drawing_path.Split(new char[] { '/' }); - XmlNode drawing_file_xml = Helpers.OOXNavigate.getReferenceByPath("xl/drawings/" + spl[spl.Length - 1], xml_worksheet.OwnerDocument.DocumentElement); - - if (drawing_file_xml == null) - return false; - - XmlNodeList anchors = drawing_file_xml.SelectNodes("xdr:wsDr/xdr:twoCellAnchor", ns_manager); - - // делаем копию и задаём новые параметры - if (anchors.Count > 0) - { - FileStream stream = new FileStream(fileName, FileMode.Open); - byte[] buffer = new byte[stream.Length]; - stream.Read(buffer, 0, (int)(stream.Length)); - stream.Close(); - - workbook.BinaryDataStorage.Add(buffer); - - XmlNode image_file_xml = Helpers.OOXNavigate.AddBinFile("xl/media/" + binName, xml_worksheet.OwnerDocument.DocumentElement, false, workbook.BinaryDataStorage.Count - 1); - OOX.Relationships drawing_relationships = new OOX.Relationships(drawing_file_xml); - drawing_relationships.AddTarget("../media/" + binName, ASCOfficeEWSEditor.Editor.OOX.Relationships.FileType.image, false); - workbook.ContentTypes.RegisterFile(image_file_xml, contentType); - - XmlElement resourceDrawing = xml_worksheet.OwnerDocument.CreateElement("tmp"); - resourceDrawing.InnerXml = Resource1.empty_imageDrawing; - XmlNode template = resourceDrawing.SelectSingleNode("xdr:wsDr/xdr:twoCellAnchor", ns_manager); - - XmlNode newAnchor = template.Clone(); - Image img = new Image(newAnchor, ns_manager); - - img.image_url = newObject.image_url; - img.image_guid = newObject.object_guid; - - // from - img.from_col = newObject.from_col; - img.from_colOff = newObject.from_colOff; - img.from_row = newObject.from_row; - img.from_rowOff = newObject.from_rowOff; - - // to - img.to_col = newObject.to_col; - img.to_colOff = newObject.to_colOff; - img.to_row = newObject.to_row; - img.to_rowOff = newObject.to_rowOff; - - img.image_width = newObject.object_width; - img.image_height = newObject.object_height; - - img.image_xOff = newObject.object_xOff; - img.image_yOff = newObject.object_yOff; - - // id - img.pic_id = workbook.BinaryDataStorage.Count - 1; - - // name - img.pic_name = "Image " + workbook.BinaryDataStorage.Count.ToString(); - - // rId - img.pic_rid = "rId" + drawing_relationships.GetLastRid().ToString(); - - SimpleImages.Add(img); - - XmlNode docRoot = drawing_file_xml.SelectSingleNode("xdr:wsDr", ns_manager); - docRoot.AppendChild(newAnchor); - } - } - return true; - } - - public bool DeleteImage(Workbook workbook, DrawingTransFromJson newObject, string siteDir) - { - // поиск всех зависимостей - XmlElement drawing_node = (XmlElement)xml_worksheet.SelectSingleNode("main:drawing", ns_manager); - if (drawing_node == null) - return false; - - string drawing_rId = drawing_node.GetAttribute("id", ns_manager.LookupNamespace("mainr")); - Relationships = new OOX.Relationships(xml_worksheet.ParentNode); - string drawing_path = Relationships.GetTarget(drawing_rId); - - string[] spl = drawing_path.Split(new char[] { '/' }); - XmlNode drawing_file_xml = Helpers.OOXNavigate.getReferenceByPath("xl/drawings/" + spl[spl.Length - 1], xml_worksheet.OwnerDocument.DocumentElement); - - //XmlNode drawing_file_xml = Helpers.OOXNavigate.getReferenceByPath(drawing_path, xml_worksheet.ParentNode.ParentNode); - if (drawing_file_xml == null) - return false; - - for (int i = 0; i < workbook.ActiveWorksheet.SimpleImages.Count; i++) - { - if (workbook.ActiveWorksheet.SimpleImages[i].pic_id == newObject.object_id) - { - workbook.ActiveWorksheet.SimpleImages.RemoveAt(i); - break; - } - } - - XmlNodeList anchors = drawing_file_xml.SelectNodes("xdr:wsDr/xdr:twoCellAnchor", ns_manager); - foreach (XmlNode anchor_xml in anchors) - { - XmlElement imageId = (XmlElement)anchor_xml.SelectSingleNode("xdr:pic/xdr:blipFill/a:blip", ns_manager); - if (imageId == null) - continue; - - Image img = new Image(anchor_xml, ns_manager); - - if (img.pic_id == newObject.object_id) - { - anchor_xml.ParentNode.RemoveChild(anchor_xml); - - // find image path - OOX.Relationships drawing_relationships = new OOX.Relationships(drawing_file_xml); - string image_doc_path = drawing_relationships.GetTarget(img.pic_rid); - XmlNode image_file_xml = Helpers.OOXNavigate.getReferenceByPath(image_doc_path, drawing_file_xml.ParentNode); - - workbook.ContentTypes.DeRegisterFile(Helpers.OOXNavigate.getReferenceByPath("xl/media/" + Path.GetFileName(image_doc_path), xml_worksheet.OwnerDocument.DocumentElement)); - drawing_relationships.RemoveTarget(img.pic_rid); - - XmlNode ret_xml = Helpers.OOXNavigate.DeleteBinFile("xl/media/" + Path.GetFileName(image_doc_path), xml_worksheet.OwnerDocument.DocumentElement); - - // удаляем drawing в листе - if (drawing_relationships.GetLastRid() == 0) - { - string drawingName = "drawing" + (workbook.ActiveSheet.Index + 1).ToString() + ".xml"; - string sheetName = "sheet" + (workbook.ActiveSheet.Index + 1).ToString() + ".xml"; - XmlNode removeElement = Helpers.OOXNavigate.getReferenceByPath("xl/drawings/" + drawingName, xml_worksheet.OwnerDocument.DocumentElement); - workbook.ContentTypes.DeRegisterFile(removeElement); - - removeElement = Helpers.OOXNavigate.getReferenceByPath("xl/drawings/_rels/" + drawingName + ".rels", xml_worksheet.OwnerDocument.DocumentElement); - workbook.ContentTypes.DeRegisterFile(removeElement); - - removeElement = Helpers.OOXNavigate.getReferenceByPath("xl/worksheets/_rels/" + sheetName + ".rels", xml_worksheet.OwnerDocument.DocumentElement); - workbook.ContentTypes.DeRegisterFile(removeElement); - removeElement.ParentNode.RemoveChild(removeElement); - - xml_worksheet.RemoveChild(drawing_node); - - XmlNode drawing_xml = Helpers.OOXNavigate.getReferenceByPath("xl/drawings/" + drawingName, xml_worksheet.OwnerDocument.DocumentElement); - drawing_xml.ParentNode.RemoveChild(drawing_xml); - - XmlNode drawing_rels_xml = Helpers.OOXNavigate.getReferenceByPath("xl/drawings/_rels/" + drawingName + ".rels", xml_worksheet.OwnerDocument.DocumentElement); - drawing_rels_xml.ParentNode.RemoveChild(drawing_rels_xml); - } - break; - } - } - - return true; - } - - internal Calculation.SubjectsStorage SubjectsStorage { get; private set; } - internal Dictionary Formulas { get; private set; } - - internal Calculation.WorksheetSubject Subject { get; private set; } - - internal MergeCells MergeCells { get; private set; } - /// - /// Collection of hyperlinks contained in the worksheet - /// - public Hyperlinks.Hyperlinks Hyperlinks { get; private set; } - - /// - /// AutoFilterAllSheet - /// - public AutoFilter AutoFilter { get; private set; } - - /// - /// TableAutoFilters - /// - public List
Tables { get; private set; } - - internal XmlNode SheetData { get { return xml_sheetData; } } - - public List SimpleCharts { get; private set; } - - public List SimpleImages { get; private set; } - - internal OOX.Relationships Relationships { get; private set; } - internal OOX.IOrderedSections XMLSectionsController { get { return worksheet_file; } } - - private OOX.WorksheetFile worksheet_file; - - #region XML references - private XmlNode xml_worksheet; - private XmlNode xml_sheetData; - private XmlNode xml_sheetView; - #endregion - #region tree references - #endregion - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Worksheets.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Worksheets.cs deleted file mode 100644 index c2fd2817c5..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Editor/Worksheets.cs +++ /dev/null @@ -1,168 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using ASCOfficeEWSEditor.XMLDataSpecific; - -namespace ASCOfficeEWSEditor.Editor -{ - /// - /// A collection of all the Worksheet objects in the specified or active workbook - /// - public class Worksheets : IEnumerable - { - internal Worksheets(Sheets sheets) - { - this.sheets = sheets; - } - - /// - /// Obtains a worksheet reference by its name - /// - /// Name of the required sheet. - public Worksheet this[string name] - { - get - { - return sheets[name] as Worksheet; - } - } - - /// - /// Obtains a worksheet reference by its index among worksheets only - /// - /// Index of the required sheet. Zero-based. - public Worksheet this[int index] - { - get - { - return sheets[index] as Worksheet; - } - } - - /// - /// Gets the number of worksheets contained in the workbook - /// - public int Count - { - get - { - int count = 0; - foreach (Sheet sheet in sheets) - { - if (sheet is Worksheet) count++; - } - return count; - } - } - - - #region IEnumerable Members - - IEnumerator IEnumerable.GetEnumerator() - { - return new Enumerator(sheets.GetEnumerator()); - } - - #endregion - - #region IEnumerable Members - - IEnumerator IEnumerable.GetEnumerator() - { - return new Enumerator(sheets.GetEnumerator()); - } - - #endregion - - /// - /// Enumerator - /// - public class Enumerator : IEnumerator - { - internal Enumerator(IEnumerator parent_enumerator) - { - this.parent_enumerator = parent_enumerator; - current = null; - } - - /// - /// Current worksheet - /// - public Worksheet Current - { - get - { - if (current == null) - { - parent_enumerator.Reset(); - return parent_enumerator.Current as Worksheet; // Generates System.InvalidOperationException - } - return current; - } - } - - #region IDisposable Members - /// - /// Dispose :) - /// - public void Dispose() - { - } - - #endregion - - /// - /// Switches to the next Current - /// - /// - public bool MoveNext() - { - if (parent_enumerator.MoveNext()) - { - while (!(parent_enumerator.Current is Worksheet)) - { - if (!parent_enumerator.MoveNext()) - { - return false; - } - } - current = parent_enumerator.Current as Worksheet; - return true; - } - return false; - } - - /// - /// Reset - /// - public void Reset() - { - parent_enumerator.Reset(); - current = null; - } - - object System.Collections.IEnumerator.Current - { - get { return Current; } - } - - - private IEnumerator parent_enumerator; - private Worksheet current; - - - } - - - private Sheets sheets; - - - } - - - - - -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleDark1.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleDark1.xml deleted file mode 100644 index deae3e1dda..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleDark1.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleDark10.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleDark10.xml deleted file mode 100644 index cd222debc2..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleDark10.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleDark11.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleDark11.xml deleted file mode 100644 index e8f44045bb..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleDark11.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleDark2.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleDark2.xml deleted file mode 100644 index 059e5e3d01..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleDark2.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleDark3.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleDark3.xml deleted file mode 100644 index e2cc28005d..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleDark3.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleDark4.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleDark4.xml deleted file mode 100644 index 8e78cb72a2..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleDark4.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleDark5.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleDark5.xml deleted file mode 100644 index 40fede538c..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleDark5.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleDark6.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleDark6.xml deleted file mode 100644 index 72e6d2bb66..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleDark6.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleDark7.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleDark7.xml deleted file mode 100644 index 74d288710b..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleDark7.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleDark8.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleDark8.xml deleted file mode 100644 index 40da01e65a..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleDark8.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleDark9.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleDark9.xml deleted file mode 100644 index 98b053206f..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleDark9.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight1.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight1.xml deleted file mode 100644 index 2d13b4d97a..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight1.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight10.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight10.xml deleted file mode 100644 index 31ed8fecb7..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight10.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight11.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight11.xml deleted file mode 100644 index d69e675e00..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight11.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight12.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight12.xml deleted file mode 100644 index 6ecf931422..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight12.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight13.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight13.xml deleted file mode 100644 index 509daeb027..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight13.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight14.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight14.xml deleted file mode 100644 index 2c1dfa31ec..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight14.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight15.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight15.xml deleted file mode 100644 index f375dbd3b3..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight15.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight16.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight16.xml deleted file mode 100644 index 2d4f804c56..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight16.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight17.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight17.xml deleted file mode 100644 index 8d1db56941..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight17.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight18.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight18.xml deleted file mode 100644 index a797117d4f..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight18.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight19.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight19.xml deleted file mode 100644 index c83f9b4583..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight19.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight2.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight2.xml deleted file mode 100644 index 52ea444a81..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight2.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight20.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight20.xml deleted file mode 100644 index a5d1726b41..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight20.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight21.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight21.xml deleted file mode 100644 index 5bc8ec4a1c..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight21.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight3.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight3.xml deleted file mode 100644 index 2c4eaa60ca..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight3.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight4.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight4.xml deleted file mode 100644 index 5d8b5a7157..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight4.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight5.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight5.xml deleted file mode 100644 index 24307b3017..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight5.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight6.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight6.xml deleted file mode 100644 index 1859a89adf..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight6.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight7.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight7.xml deleted file mode 100644 index 208f31970c..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight7.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight8.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight8.xml deleted file mode 100644 index d7edcd6083..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight8.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight9.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight9.xml deleted file mode 100644 index fae1de7140..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleLight9.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium1.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium1.xml deleted file mode 100644 index a542c11a28..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium1.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium10.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium10.xml deleted file mode 100644 index 7d04eae9ac..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium10.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium11.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium11.xml deleted file mode 100644 index fe2a3090d5..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium11.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium12.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium12.xml deleted file mode 100644 index bab0c8b089..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium12.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium13.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium13.xml deleted file mode 100644 index 7092fe0588..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium13.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium14.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium14.xml deleted file mode 100644 index c3f9699126..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium14.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium15.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium15.xml deleted file mode 100644 index 6a3201ce03..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium15.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium16.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium16.xml deleted file mode 100644 index 306e7984af..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium16.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium17.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium17.xml deleted file mode 100644 index b398a8c8e3..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium17.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium18.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium18.xml deleted file mode 100644 index 09e74b9754..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium18.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium19.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium19.xml deleted file mode 100644 index 433300f11d..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium19.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium2.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium2.xml deleted file mode 100644 index b6ac9944c0..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium2.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium20.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium20.xml deleted file mode 100644 index b509bb84f7..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium20.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium21.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium21.xml deleted file mode 100644 index c8166f85fd..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium21.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium22.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium22.xml deleted file mode 100644 index 9cb2bbd7f8..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium22.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium23.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium23.xml deleted file mode 100644 index 33dc392851..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium23.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium24.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium24.xml deleted file mode 100644 index 58b57479da..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium24.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium25.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium25.xml deleted file mode 100644 index 4f6d3f343a..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium25.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium26.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium26.xml deleted file mode 100644 index dd454f70d1..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium26.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium27.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium27.xml deleted file mode 100644 index 84b4de119b..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium27.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium28.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium28.xml deleted file mode 100644 index 81fd9de7d4..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium28.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium3.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium3.xml deleted file mode 100644 index bf1c3f7186..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium3.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium4.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium4.xml deleted file mode 100644 index 304c2c8529..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium4.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium5.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium5.xml deleted file mode 100644 index e353722f47..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium5.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium6.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium6.xml deleted file mode 100644 index 7bba8c61ec..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium6.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium7.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium7.xml deleted file mode 100644 index e5d0478056..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium7.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium8.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium8.xml deleted file mode 100644 index 350802f223..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium8.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium9.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium9.xml deleted file mode 100644 index 10792a71ce..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ExcelDefaultFiles/TableStyleMedium9.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Helpers/Iterator.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Helpers/Iterator.cs deleted file mode 100644 index bb82fff42c..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Helpers/Iterator.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ASCOfficeEWSEditor.Helpers -{ - internal class Iterator - { - public Iterator(IEnumerator enumerator) - { - this.enumerator = enumerator; - MoveNext(); - } - - public void MoveNext () - { - End = !enumerator.MoveNext(); - } - - public T Current { get { return enumerator.Current; } } - public bool End { get; private set; } - - public override string ToString() - { - return enumerator.Current.ToString(); - } - - private IEnumerator enumerator; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Helpers/OOXNavigate.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Helpers/OOXNavigate.cs deleted file mode 100644 index d6aad952c7..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Helpers/OOXNavigate.cs +++ /dev/null @@ -1,249 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; - -namespace ASCOfficeEWSEditor.Helpers -{ - internal class OOXNavigate - { - static public XmlNode FindWorkbookTag(XmlDocument document) - { - XmlNamespaceManager ns_manager = new XmlNamespaceManager(document.NameTable); - ns_manager.AddNamespace("types", "http://schemas.openxmlformats.org/package/2006/content-types"); - ns_manager.AddNamespace("main", "http://schemas.openxmlformats.org/spreadsheetml/2006/main"); - XmlNode wbpath_attr = document.SelectSingleNode("/root/file[@name = '[Content_Types].xml']/types:Types/types:Override[@ContentType = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml']/@PartName", - ns_manager); - if (null == wbpath_attr) - { - return wbpath_attr; - } - XmlNode wb_file = getReferenceByPath(wbpath_attr.InnerText, document.DocumentElement); - return null == wb_file ? wb_file : wb_file.SelectSingleNode("main:workbook", ns_manager); - } - - static public XmlNode getReferenceByPath(string path, XmlNode current_dir) - { - XmlNode target_dir = getFolderReferenceByPath(path, current_dir, false); - - int last_slash_pos = path.LastIndexOf("/"); - string jump_file; - if(-1 != last_slash_pos) - { - jump_file = path.Substring(last_slash_pos + 1); - } - else - { - jump_file = path; - } - return target_dir.SelectSingleNode("file[@name = '" + jump_file + "']"); // null is possible - } - - static public XmlNode getFolderReferenceByPath(string path, XmlNode current_dir, bool create_absent_folders) - { - if (0 != path.Length && path.StartsWith("/")) - { - current_dir = current_dir.OwnerDocument.DocumentElement; // Starts from root - path = path.Substring(1); - } - int last_slash_pos = path.LastIndexOf("/"); - if (-1 != last_slash_pos) - { - string[] jump_dirs = path.Substring(0, last_slash_pos).Split(new Char[] {'/'}); - foreach (string jump_dir in jump_dirs) - { - if (".." == jump_dir) - { - current_dir = current_dir.ParentNode ?? current_dir; - } - else if ("." == jump_dir) - { - continue; - } - else if (0 != jump_dir.Length) - { - XmlElement new_current_dir = (XmlElement)current_dir.SelectSingleNode("dir[@name = '" + jump_dir + "']"); - if(new_current_dir != null) - { - current_dir = new_current_dir; - } - else if (create_absent_folders) - { - new_current_dir = current_dir.OwnerDocument.CreateElement("dir"); - new_current_dir.SetAttribute("name", jump_dir); - current_dir.AppendChild(new_current_dir); - current_dir = new_current_dir; - } - } - } - } - return current_dir; - } - - static public XmlNode AddDirectory(string rel_dir_path_template, XmlNode directory, bool make_unique) - { - string rel_dir_path = make_unique ? CreateUniqueFilePath(rel_dir_path_template, directory) : rel_dir_path_template; - int last_slash_pos = rel_dir_path.LastIndexOf("/"); - XmlNode target_folder = getFolderReferenceByPath(rel_dir_path.Substring(0, last_slash_pos + 1), - directory, true); - string dir_name = rel_dir_path.Substring(last_slash_pos + 1); - XmlElement file_tag = (XmlElement)target_folder.SelectSingleNode("file[@dir = '" + dir_name + "']"); - if (file_tag == null) - { - file_tag = directory.OwnerDocument.CreateElement("dir"); - file_tag.SetAttribute("name", dir_name); - target_folder.AppendChild(file_tag); - } - - return file_tag; - } - - /// - /// Adds a new file or finds existing file - /// - /// - /// - /// Whether create a unique name of the file (appending ordering number) or create as specified and not rewrite - /// - static public XmlNode AddFile(string rel_file_path_template, XmlNode directory, bool make_unique) - { - string rel_file_path = make_unique ? CreateUniqueFilePath(rel_file_path_template, directory) : rel_file_path_template; - int last_slash_pos = rel_file_path.LastIndexOf("/"); - XmlNode target_folder = getFolderReferenceByPath(rel_file_path.Substring(0, last_slash_pos + 1) /* (last_slash_pos == -1) is taken into account here too */, - directory, true); - string file_name = rel_file_path.Substring(last_slash_pos + 1);/* (last_slash_pos == -1) is taken into account here */ - XmlElement file_tag = (XmlElement)target_folder.SelectSingleNode("file[@name = '" + file_name + "']"); - if (file_tag == null) - { - file_tag = directory.OwnerDocument.CreateElement("file"); - file_tag.SetAttribute("name", file_name); - target_folder.AppendChild(file_tag); - } - - return file_tag; - } - - static public XmlNode AddBinFile(string rel_file_path_template, XmlNode directory, bool make_unique, int data_id) - { - string rel_file_path = make_unique ? CreateUniqueFilePath(rel_file_path_template, directory) : rel_file_path_template; - int last_slash_pos = rel_file_path.LastIndexOf("/"); - XmlNode target_folder = getFolderReferenceByPath(rel_file_path.Substring(0, last_slash_pos + 1), directory, true); - string file_name = rel_file_path.Substring(last_slash_pos + 1); - XmlElement file_tag = (XmlElement)target_folder.SelectSingleNode("file[@name = '" + file_name + "']"); - if (file_tag == null) - { - file_tag = directory.OwnerDocument.CreateElement("file"); - file_tag.SetAttribute("name", file_name); - file_tag.SetAttribute("format", "bin"); - file_tag.SetAttribute("bin_data_id", data_id.ToString()); - target_folder.AppendChild(file_tag); - } - - return file_tag; - } - - static public XmlNode DeleteBinFile(string rel_file_path_template, XmlNode directory) - { - string rel_file_path = rel_file_path_template; - int last_slash_pos = rel_file_path.LastIndexOf("/"); - XmlNode target_folder = getFolderReferenceByPath(rel_file_path.Substring(0, last_slash_pos + 1), directory, true); - string file_name = rel_file_path.Substring(last_slash_pos + 1); - XmlElement file_tag = (XmlElement)target_folder.SelectSingleNode("file[@name = '" + file_name + "']"); - if (file_tag != null) - { - target_folder.RemoveChild(file_tag); - } - - return file_tag; - } - - /// - /// - /// - /// May include any type of file path. Must end with filename - /// Must point to 'dir' node that is the base for the 'template_path' - /// - static public string CreateUniqueFilePath(string template_path, XmlNode base_path_folder) - { - int last_slash_pos = template_path.LastIndexOf("/"); - string folder_path = template_path.Substring(0, last_slash_pos + 1); /* (last_slash_pos == -1) is taken into account here too */ - XmlNode target_folder = getFolderReferenceByPath(folder_path, base_path_folder, true); - string template_file_name = template_path.Substring(last_slash_pos + 1);/* (last_slash_pos == -1) is taken into account here */ - - int last_dot_pos = template_file_name.LastIndexOf("."); - string prefix_name = last_dot_pos != -1 ? template_file_name.Substring(0, last_dot_pos) : template_file_name; - string suffix_name = last_dot_pos != -1 ? template_file_name.Substring(last_dot_pos) : ""; - - int max_id = 0; - foreach (XmlNode other_file_name in target_folder.SelectNodes("file[starts-with(@name, '" + prefix_name + "')]/@name")) - { - string other_name = other_file_name.InnerText; - int last_dot_pos_other = other_name.LastIndexOf("."); - string must_be_num = other_name.Substring(prefix_name.Length, (last_dot_pos_other == -1 ? other_name.Length : last_dot_pos_other) - prefix_name.Length); - int id; - if (int.TryParse(must_be_num, out id) && id > max_id) - { - max_id = id; - } - } - return folder_path + prefix_name + (max_id + 1).ToString() + suffix_name; - } - - - static public string DetermineAbsolutePath(XmlNode file_or_dir_tag) - { - XmlElement current_file_elem = (XmlElement)file_or_dir_tag; - string absolute_path = ""; - while(current_file_elem != null) - { - switch(current_file_elem.Name) - { - case "dir": - absolute_path = current_file_elem.GetAttribute("name") + '/' + absolute_path; - break; - case "file": - absolute_path = current_file_elem.GetAttribute("name") + absolute_path; - break; - case "root": - return "/" + absolute_path; - - } - current_file_elem = (XmlElement)current_file_elem.ParentNode; - } - return "/" + absolute_path; - } - - /// - /// Tries to determine relative path to base directory. If it is impossible it returns absolute path - /// - /// - /// - /// - static public string DetermineRelativePath(XmlNode file_or_dir_tag, XmlNode base_dir) - { - XmlElement current_file_elem = (XmlElement)file_or_dir_tag; - string rel_path = ""; - while (current_file_elem != null) - { - if(base_dir.Equals(current_file_elem)) - { - return rel_path; - } - switch (current_file_elem.Name) - { - case "dir": - rel_path = current_file_elem.GetAttribute("name") + '/' + rel_path; - break; - case "file": - rel_path = current_file_elem.GetAttribute("name") + rel_path; - break; - case "root": - return "/" + rel_path; - - } - current_file_elem = (XmlElement)current_file_elem.ParentNode; - } - return "/" + rel_path; - } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Helpers/ReferencesFormat.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Helpers/ReferencesFormat.cs deleted file mode 100644 index b647920032..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Helpers/ReferencesFormat.cs +++ /dev/null @@ -1,220 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -//using System.Text.RegularExpressions; - -namespace ASCOfficeEWSEditor.Helpers -{ - internal class ReferencesFormat - { - /// - /// Extracts 1-based column number from reference - /// - /// Cell reference - /// 1-based column number - static internal int str2column(string ref_str) - { - int column = -1; - - int nLength = ref_str.Length; - for (int nIndex = 0; nIndex < nLength; ++nIndex) - { - char symb = ref_str[nIndex]; - if (symb < 'A' || symb > 'Z') - break; - - column = (column + 1) * radixZA + (symb - 'A'); - } - - ++column; // makes it 1-based - if (column > maxCol) - { - column = maxCol; - } - - return column; - } - - static internal int str2loc(string str, out int row, out bool row_rel, out int column, out bool col_rel) - { - col_rel = true; - row_rel = true; - - column = -1; - row = 0; - - int nLength = str.Length; - int nIndex = 0; - - // Calculate column - if (0 < nLength && '$' == str[nIndex]) - { - ++nIndex; - col_rel = false; - } - for (; nIndex < nLength; ++nIndex) - { - char symb = str[nIndex]; - if (symb < 'A' || symb > 'Z') - break; - - column = (column + 1) * radixZA + (symb - 'A'); - } - ++column; // makes it 1-based - if (column > maxCol) - { - column = maxCol; - } - - // Calculate row - if (nIndex < nLength && '$' == str[nIndex]) - { - ++nIndex; - row_rel = false; - } - for (; nIndex < nLength; ++nIndex) - { - char symb = str[nIndex]; - if ('0' > symb || '9' < symb) - { - break; - } - row = row * 10 + (symb - '0'); - } - if (row > maxRow) - { - row = maxRow; - } - - return nIndex; - } - - static internal bool str2ref(string ref_str, out int rowFirst, out bool rowFirstRelative, out int columnFirst, out bool columnFirstRelative, - out int rowLast, out bool rowLastRelative, out int columnLast, out bool columnLastRelative) - { - int nLength = ref_str.Length; - int nIndex = str2loc(ref_str, out rowFirst, out rowFirstRelative, out columnFirst, out columnFirstRelative); - - if (nIndex >= nLength) // single cell - { - rowLast = rowFirst; - rowLastRelative = rowFirstRelative; - columnLast = columnFirst; - columnLastRelative = columnFirstRelative; - return true; - } - if (':' != ref_str[nIndex]) // Example: "A2-A3" - { - rowLast = 0; - rowLastRelative = true; - columnLast = 0; - columnLastRelative = true; - return false; - } - ++nIndex; // skip ':' - str2loc(ref_str.Substring(nIndex), out rowLast, out rowLastRelative, out columnLast, out columnLastRelative); - - if(rowFirst != 0 && rowLast != 0 && columnFirst != 0 && columnLast != 0) - { - return true; - } - else if (rowFirst == 0 && rowLast == 0 && columnFirst != 0 && columnLast != 0) // no row specified - means whole column or range of columns - { - rowFirst = 1; - rowLast = maxRow; - return true; - } - else if (columnFirst == 0 && columnLast == 0 && rowFirst != 0 && rowLast != 0) // no column specified - means whole row or range of rows - { - columnFirst = 1; - columnLast = maxCol; - return true; - } - return false; - } - - - /// - /// Convert 1-based column number to string form - /// - /// column is 1-based - /// - /// - static internal string column2str(int column, bool columnRelative) - { - string ret_val = ""; - while(0 != column) - { - char sym = (char)((column - 1) % radixZA + 'A'); - ret_val = sym + ret_val; - column = (column - 1) / radixZA; - } - if (!columnRelative) - { - ret_val = '$' + ret_val; - } - return ret_val; - } - - /// - /// Convert 1-based row number to string form - /// - /// row is 1-based - /// - /// - static internal string row2str(int row, bool rowRelative) - { - if (!rowRelative) - { - return '$' + row.ToString(); - } - return row.ToString(); - } - - /// - /// All input parameters are 1-based - /// - static internal string range2str(int rowFirst, bool rowFirstRelative, int columnFirst, bool columnFirstRelative, - int rowLast, bool rowLastRelative, int columnLast, bool columnLastRelative) - { - const bool useShortForm = true; - if (1 == rowFirst && maxRow == rowLast) // whole column or range of columns - { - if (useShortForm) // TODO: mind the relativity - { - return column2str(columnFirst, columnFirstRelative) + ':' + column2str(columnLast, columnFirstRelative); - } - } - if (1 == columnFirst && maxCol == columnLast) // whole row or range of rows - { - if (useShortForm) // TODO: mind the relativity - { - return row2str(rowFirst, rowFirstRelative) + ':' + row2str(rowLast, rowLastRelative); - } - } - if (columnLast == columnFirst && rowFirst == rowLast) // single cell - { - return column2str(columnFirst, columnFirstRelative) + row2str(rowFirst, rowFirstRelative); - } - return column2str(columnFirst, columnFirstRelative) + row2str(rowFirst, rowFirstRelative) + ':' + - column2str(columnLast, columnLastRelative) + row2str(rowLast, rowLastRelative); - } - - /// - /// All input parameters are 1-based - /// - static internal string ref2str(int row, bool rowRelative, int column, bool columnRelative) - { - return column2str(column, columnRelative) + row2str(row, rowRelative); - } - - static internal Editor.Cells.CellRange maxRange() - { - return new Editor.Cells.CellRange(1, 1, Helpers.ReferencesFormat.maxRow, Helpers.ReferencesFormat.maxCol); - } - - const int radixZA = 'Z' - 'A' + 1; - public const int maxRow = 1048576; - public const int maxCol = 16384; - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Helpers/XmlUtils.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Helpers/XmlUtils.cs deleted file mode 100644 index a792b70d54..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Helpers/XmlUtils.cs +++ /dev/null @@ -1,43 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; - -namespace ASCOfficeEWSEditor.Helpers -{ - internal static class XmlUtils - { - private static int GetIntValFromChild(XmlNode xml_parent, string node_name, XmlNamespaceManager ns_manager, int? default_value) - { - int num; - XmlElement num_xml = (XmlElement)xml_parent.SelectSingleNode(node_name, ns_manager); - if (num_xml != null) - { - if(int.TryParse(num_xml.GetAttribute("val"), out num)) - { - return num; - } - } - if(default_value.HasValue) - { - return default_value.Value; - } - else - { - throw new ASCOfficeEWSEditor.Editor.Events.ReportableException(new ASCOfficeEWSEditor.Editor.Events.InternalError("Wrong OOX format. Required '" + node_name + "' tag is absent inside '" + xml_parent.LocalName + "' or has incorrect format.")); - } - } - - internal static int GetIntValFromChild(XmlNode xml_parent, string node_name, XmlNamespaceManager ns_manager, int default_value) - { - return GetIntValFromChild(xml_parent, node_name, ns_manager, default_value); - } - - internal static int GetIntValFromChild(XmlNode xml_parent, string node_name, XmlNamespaceManager ns_manager) - { - return GetIntValFromChild(xml_parent, node_name, ns_manager, null); - } - - - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Properties/AssemblyInfo.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Properties/AssemblyInfo.cs deleted file mode 100644 index 6c301f07f3..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("ASCOfficeEWSEditor")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("NCT")] -[assembly: AssemblyProduct("ASCOfficeEWSEditor")] -[assembly: AssemblyCopyright("Copyright © NCT 2009")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("0a5aabb4-d727-471a-952f-e5ecf49dac43")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.113")] -[assembly: AssemblyFileVersion("1.0.0.113")] diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Resource1.Designer.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Resource1.Designer.cs deleted file mode 100644 index 40a10c3acb..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Resource1.Designer.cs +++ /dev/null @@ -1,392 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:2.0.50727.5456 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace ASCOfficeEWSEditor { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resource1 { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resource1() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ASCOfficeEWSEditor.Resource1", typeof(Resource1).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - - /// - /// Looks up a localized string similar to <border><left /><right /><top /><bottom /><diagonal /></border> - /// - ///. - /// - internal static string default_border { - get { - return ResourceManager.GetString("default_border", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <fill><patternFill patternType="none"/></fill>. - /// - internal static string default_fill { - get { - return ResourceManager.GetString("default_fill", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <font><sz val="11"/><color auto="1"/><name val="Calibri"/><family val="2"/><charset val="204"/></font>. - /// - internal static string default_font { - get { - return ResourceManager.GetString("default_font", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="UTF-8" standalone="yes"?> - ///<c:chartSpace xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:c="http://schemas.openxmlformats.org/drawingml/2006/chart" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"> - /// <c:lang val="en-US"/> - /// <c:chart> - /// <c:title> - /// <c:layout/> - /// <c:tx> - /// <c:rich> - /// <a:bodyPr/> - /// <a:lstStyle/> - /// <a:p> - /// <a:pPr> - /// <a:defRPr/> - /// </a:pPr> - /// [rest of string was truncated]";. - /// - internal static string empty_areaChart { - get { - return ResourceManager.GetString("empty_areaChart", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="UTF-8" standalone="yes"?> - ///<c:chartSpace xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:c="http://schemas.openxmlformats.org/drawingml/2006/chart" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"> - /// <c:lang val="en-US"/> - /// <c:chart> - /// <c:title> - /// <c:tx> - /// <c:rich> - /// <a:bodyPr /> - /// <a:lstStyle /> - /// <a:p> - /// <a:pPr> - /// <a:defRPr /> - /// </a:pPr> - /// <a:r> - /// [rest of string was truncated]";. - /// - internal static string empty_barChart { - get { - return ResourceManager.GetString("empty_barChart", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0"?> - ///<root> - /// <dir name="xl"> - /// <file name="styles.xml"> - /// <styleSheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"> - /// <fonts count="1"> - /// <font> - /// <sz val="11"/> - /// <color auto="1"/> - /// <name val="Arial"/> - /// </font> - /// </fonts> - /// <fills count="2"> - /// <fill> - /// <patternFill patternType="none"/> - /// </fill> - /// <fill> - /// <patternFill patternType="gray125"/> - /// </fill> - /// </fills> - /// <borders count="1"> - /// <border> [rest of string was truncated]";. - /// - internal static string empty_book { - get { - return ResourceManager.GetString("empty_book", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="UTF-8" standalone="yes"?> - ///<c:chartSpace xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:c="http://schemas.openxmlformats.org/drawingml/2006/chart" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"> - /// <c:lang val="en-US"/> - /// <c:chart> - /// <c:title> - /// <c:layout/> - /// <c:tx> - /// <c:rich> - /// <a:bodyPr/> - /// <a:lstStyle/> - /// <a:p> - /// <a:pPr> - /// <a:defRPr/> - /// </a:pPr> - /// [rest of string was truncated]";. - /// - internal static string empty_bubbleChart { - get { - return ResourceManager.GetString("empty_bubbleChart", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="UTF-8" standalone="yes"?> - ///<xdr:wsDr xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:xdr="http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing"> - /// <xdr:twoCellAnchor editAs="oneCell"> - /// <xdr:from> - /// <xdr:col>0</xdr:col> - /// <xdr:colOff>0</xdr:colOff> - /// <xdr:row>0</xdr:row> - /// <xdr:rowOff>0</xdr:rowOff> - /// </xdr:from> - /// <xdr:to> - /// <xdr:col>0</xd [rest of string was truncated]";. - /// - internal static string empty_chartDrawing { - get { - return ResourceManager.GetString("empty_chartDrawing", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="UTF-8" standalone="yes" ?> - ///<c:seriesItem xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:c="http://schemas.openxmlformats.org/drawingml/2006/chart" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"> - /// <c:pt idx="0"> - /// <c:v>0</c:v> - /// </c:pt> - ///</c:seriesItem> - ///. - /// - internal static string empty_chartSeriesItem { - get { - return ResourceManager.GetString("empty_chartSeriesItem", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="UTF-8" standalone="yes"?> - ///<c:chartSpace xmlns:c="http://schemas.openxmlformats.org/drawingml/2006/chart" xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"> - /// <c:date1904 val="0"/> - /// <c:lang val="en-US"/> - /// <c:roundedCorners val="0"/> - /// <mc:AlternateContent xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"> - /// <mc:Choice Requires="c14" xmlns:c14="http://schemas [rest of string was truncated]";. - /// - internal static string empty_doughnutChart { - get { - return ResourceManager.GetString("empty_doughnutChart", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="UTF-8" standalone="yes" ?> - /// <xdr:wsDr xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:xdr="http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing"> - /// <xdr:twoCellAnchor editAs="oneCell"> - /// <xdr:from> - /// <xdr:col>0</xdr:col> - /// <xdr:colOff>0</xdr:colOff> - /// <xdr:row>0</xdr:row> - /// <xdr:rowOff>0</xdr:rowOff> - /// </xdr:from> - /// <xdr:to> - /// [rest of string was truncated]";. - /// - internal static string empty_imageDrawing { - get { - return ResourceManager.GetString("empty_imageDrawing", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="UTF-8" standalone="yes"?> - ///<c:chartSpace xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:c="http://schemas.openxmlformats.org/drawingml/2006/chart" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"> - /// <c:lang val="en-US"/> - /// <c:chart> - /// <c:title> - /// <c:layout/> - /// <c:tx> - /// <c:rich> - /// <a:bodyPr/> - /// <a:lstStyle/> - /// <a:p> - /// <a:pPr> - /// <a:defRPr/> - /// </a:pPr> - /// [rest of string was truncated]";. - /// - internal static string empty_lineChart { - get { - return ResourceManager.GetString("empty_lineChart", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="UTF-8" standalone="yes"?> - ///<c:chartSpace xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:c="http://schemas.openxmlformats.org/drawingml/2006/chart" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"> - /// <c:lang val="en-US"/> - /// <c:chart> - /// <c:title> - /// <c:layout/> - /// <c:tx> - /// <c:rich> - /// <a:bodyPr/> - /// <a:lstStyle/> - /// <a:p> - /// <a:pPr> - /// <a:defRPr/> - /// </a:pPr> - /// [rest of string was truncated]";. - /// - internal static string empty_pieChart { - get { - return ResourceManager.GetString("empty_pieChart", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="UTF-8" standalone="yes"?> - ///<c:chartSpace xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:c="http://schemas.openxmlformats.org/drawingml/2006/chart" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"> - /// <c:lang val="en-US"/> - /// <c:chart> - /// <c:title> - /// <c:layout/> - /// <c:tx> - /// <c:rich> - /// <a:bodyPr/> - /// <a:lstStyle/> - /// <a:p> - /// <a:pPr> - /// <a:defRPr/> - /// </a:pPr> - /// [rest of string was truncated]";. - /// - internal static string empty_radarChart { - get { - return ResourceManager.GetString("empty_radarChart", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="UTF-8" standalone="yes"?> - ///<c:chartSpace xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:c="http://schemas.openxmlformats.org/drawingml/2006/chart" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"> - /// <c:lang val="en-US"/> - /// <c:chart> - /// <c:title> - /// <c:layout/> - /// <c:tx> - /// <c:rich> - /// <a:bodyPr/> - /// <a:lstStyle/> - /// <a:p> - /// <a:pPr> - /// <a:defRPr/> - /// </a:pPr> - /// [rest of string was truncated]";. - /// - internal static string empty_scatterChart { - get { - return ResourceManager.GetString("empty_scatterChart", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"> - /// <dimension ref="A1"/> - /// <sheetViews> - /// <sheetView workbookViewId="0"/> - /// </sheetViews> - /// <sheetFormatPr defaultRowHeight="15"/> - /// <sheetData/> - /// <pageMargins left="0.7" right="0.7" top="0.75" bottom="0.75" header="0.3" footer="0.3"/> - ///</worksheet> - ///. - /// - internal static string empty_sheet { - get { - return ResourceManager.GetString("empty_sheet", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="UTF-8" standalone="yes"?> - ///<c:chartSpace xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:c="http://schemas.openxmlformats.org/drawingml/2006/chart" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"> - /// <c:lang val="en-US"/> - /// <c:chart> - /// <c:title> - /// <c:layout/> - /// <c:tx> - /// <c:rich> - /// <a:bodyPr/> - /// <a:lstStyle/> - /// <a:p> - /// <a:pPr> - /// <a:defRPr/> - /// </a:pPr> - /// [rest of string was truncated]";. - /// - internal static string empty_stockChart { - get { - return ResourceManager.GetString("empty_stockChart", resourceCulture); - } - } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Resource1.resx b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Resource1.resx deleted file mode 100644 index acdd1d4f47..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/Resource1.resx +++ /dev/null @@ -1,172 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - - xmltemplates\default_border.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - xmltemplates\default_fill.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - xmltemplates\default_font.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - XMLTemplates\empty_book.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;windows-1251 - - - xmltemplates\empty_sheet.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;windows-1251 - - - xmltemplates\empty_imageDrawing.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - xmltemplates\empty_chartDrawing.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - xmltemplates\empty_barChart.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - xmltemplates\empty_lineChart.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - xmltemplates\empty_scatterChart.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - xmltemplates\empty_bubbleChart.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - xmltemplates\empty_radarChart.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - xmltemplates\empty_areaChart.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - xmltemplates\empty_doughnutChart.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - xmltemplates\empty_pieChart.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - xmltemplates\empty_stockChart.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - xmltemplates\empty_chartSeriesItem.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - \ No newline at end of file diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ResourceExcelDefaultStyles.Designer.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ResourceExcelDefaultStyles.Designer.cs deleted file mode 100644 index d30c13d480..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ResourceExcelDefaultStyles.Designer.cs +++ /dev/null @@ -1,603 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:2.0.50727.3615 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace ASCOfficeEWSEditor { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class ResourceExcelDefaultStyles { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal ResourceExcelDefaultStyles() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ASCOfficeEWSEditor.ResourceExcelDefaultStyles", typeof(ResourceExcelDefaultStyles).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8"?><TableStyle name="TableStyleDark1"><TableStyleElement name="blankRow" /><TableStyleElement name="firstColumn" Bold="true" Italic="false" Underline="false" Color="#FFFFFF" BgColor="#404040" StripeSize="1"><DiagonalDown LineStyle="-4142" /><DiagonalUp LineStyle="-4142" /><EdgeLeft LineStyle="-4142" /><EdgeTop LineStyle="-4142" /><EdgeBottom LineStyle="-4142" /><EdgeRight LineStyle="1" Color="#FFFFFF" /><InsideVertical LineStyle="-4142" /><InsideHorizontal LineStyle="-4142 [rest of string was truncated]";. - /// - internal static string TableStyleDark1 { - get { - return ResourceManager.GetString("TableStyleDark1", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8"?><TableStyle name="TableStyleDark10"><TableStyleElement name="blankRow" /><TableStyleElement name="firstColumn" Bold="true" Italic="false" Underline="false" Color="#000000" BgColor="#000000" StripeSize="1"><DiagonalDown LineStyle="-4142" /><DiagonalUp LineStyle="-4142" /><EdgeLeft LineStyle="-4142" /><EdgeTop LineStyle="-4142" /><EdgeBottom LineStyle="-4142" /><EdgeRight LineStyle="-4142" /><InsideVertical LineStyle="-4142" /><InsideHorizontal LineStyle="-4142" /></Table [rest of string was truncated]";. - /// - internal static string TableStyleDark10 { - get { - return ResourceManager.GetString("TableStyleDark10", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8"?><TableStyle name="TableStyleDark11"><TableStyleElement name="blankRow" /><TableStyleElement name="firstColumn" Bold="true" Italic="false" Underline="false" Color="#000000" BgColor="#000000" StripeSize="1"><DiagonalDown LineStyle="-4142" /><DiagonalUp LineStyle="-4142" /><EdgeLeft LineStyle="-4142" /><EdgeTop LineStyle="-4142" /><EdgeBottom LineStyle="-4142" /><EdgeRight LineStyle="-4142" /><InsideVertical LineStyle="-4142" /><InsideHorizontal LineStyle="-4142" /></Table [rest of string was truncated]";. - /// - internal static string TableStyleDark11 { - get { - return ResourceManager.GetString("TableStyleDark11", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8"?><TableStyle name="TableStyleDark2"><TableStyleElement name="blankRow" /><TableStyleElement name="firstColumn" Bold="true" Italic="false" Underline="false" Color="#FFFFFF" BgColor="#366092" StripeSize="1"><DiagonalDown LineStyle="-4142" /><DiagonalUp LineStyle="-4142" /><EdgeLeft LineStyle="-4142" /><EdgeTop LineStyle="-4142" /><EdgeBottom LineStyle="-4142" /><EdgeRight LineStyle="1" Color="#FFFFFF" /><InsideVertical LineStyle="-4142" /><InsideHorizontal LineStyle="-4142 [rest of string was truncated]";. - /// - internal static string TableStyleDark2 { - get { - return ResourceManager.GetString("TableStyleDark2", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8"?><TableStyle name="TableStyleDark3"><TableStyleElement name="blankRow" /><TableStyleElement name="firstColumn" Bold="true" Italic="false" Underline="false" Color="#FFFFFF" BgColor="#963634" StripeSize="1"><DiagonalDown LineStyle="-4142" /><DiagonalUp LineStyle="-4142" /><EdgeLeft LineStyle="-4142" /><EdgeTop LineStyle="-4142" /><EdgeBottom LineStyle="-4142" /><EdgeRight LineStyle="1" Color="#FFFFFF" /><InsideVertical LineStyle="-4142" /><InsideHorizontal LineStyle="-4142 [rest of string was truncated]";. - /// - internal static string TableStyleDark3 { - get { - return ResourceManager.GetString("TableStyleDark3", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8"?><TableStyle name="TableStyleDark4"><TableStyleElement name="blankRow" /><TableStyleElement name="firstColumn" Bold="true" Italic="false" Underline="false" Color="#FFFFFF" BgColor="#76933C" StripeSize="1"><DiagonalDown LineStyle="-4142" /><DiagonalUp LineStyle="-4142" /><EdgeLeft LineStyle="-4142" /><EdgeTop LineStyle="-4142" /><EdgeBottom LineStyle="-4142" /><EdgeRight LineStyle="1" Color="#FFFFFF" /><InsideVertical LineStyle="-4142" /><InsideHorizontal LineStyle="-4142 [rest of string was truncated]";. - /// - internal static string TableStyleDark4 { - get { - return ResourceManager.GetString("TableStyleDark4", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8"?><TableStyle name="TableStyleDark5"><TableStyleElement name="blankRow" /><TableStyleElement name="firstColumn" Bold="true" Italic="false" Underline="false" Color="#FFFFFF" BgColor="#60497A" StripeSize="1"><DiagonalDown LineStyle="-4142" /><DiagonalUp LineStyle="-4142" /><EdgeLeft LineStyle="-4142" /><EdgeTop LineStyle="-4142" /><EdgeBottom LineStyle="-4142" /><EdgeRight LineStyle="1" Color="#FFFFFF" /><InsideVertical LineStyle="-4142" /><InsideHorizontal LineStyle="-4142 [rest of string was truncated]";. - /// - internal static string TableStyleDark5 { - get { - return ResourceManager.GetString("TableStyleDark5", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8"?><TableStyle name="TableStyleDark6"><TableStyleElement name="blankRow" /><TableStyleElement name="firstColumn" Bold="true" Italic="false" Underline="false" Color="#FFFFFF" BgColor="#31869B" StripeSize="1"><DiagonalDown LineStyle="-4142" /><DiagonalUp LineStyle="-4142" /><EdgeLeft LineStyle="-4142" /><EdgeTop LineStyle="-4142" /><EdgeBottom LineStyle="-4142" /><EdgeRight LineStyle="1" Color="#FFFFFF" /><InsideVertical LineStyle="-4142" /><InsideHorizontal LineStyle="-4142 [rest of string was truncated]";. - /// - internal static string TableStyleDark6 { - get { - return ResourceManager.GetString("TableStyleDark6", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8"?><TableStyle name="TableStyleDark7"><TableStyleElement name="blankRow" /><TableStyleElement name="firstColumn" Bold="true" Italic="false" Underline="false" Color="#FFFFFF" BgColor="#E26B0A" StripeSize="1"><DiagonalDown LineStyle="-4142" /><DiagonalUp LineStyle="-4142" /><EdgeLeft LineStyle="-4142" /><EdgeTop LineStyle="-4142" /><EdgeBottom LineStyle="-4142" /><EdgeRight LineStyle="1" Color="#FFFFFF" /><InsideVertical LineStyle="-4142" /><InsideHorizontal LineStyle="-4142 [rest of string was truncated]";. - /// - internal static string TableStyleDark7 { - get { - return ResourceManager.GetString("TableStyleDark7", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8"?><TableStyle name="TableStyleDark8"><TableStyleElement name="blankRow" /><TableStyleElement name="firstColumn" Bold="true" Italic="false" Underline="false" Color="#000000" BgColor="#000000" StripeSize="1"><DiagonalDown LineStyle="-4142" /><DiagonalUp LineStyle="-4142" /><EdgeLeft LineStyle="-4142" /><EdgeTop LineStyle="-4142" /><EdgeBottom LineStyle="-4142" /><EdgeRight LineStyle="-4142" /><InsideVertical LineStyle="-4142" /><InsideHorizontal LineStyle="-4142" /></TableS [rest of string was truncated]";. - /// - internal static string TableStyleDark8 { - get { - return ResourceManager.GetString("TableStyleDark8", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8"?><TableStyle name="TableStyleDark9"><TableStyleElement name="blankRow" /><TableStyleElement name="firstColumn" Bold="true" Italic="false" Underline="false" Color="#000000" BgColor="#000000" StripeSize="1"><DiagonalDown LineStyle="-4142" /><DiagonalUp LineStyle="-4142" /><EdgeLeft LineStyle="-4142" /><EdgeTop LineStyle="-4142" /><EdgeBottom LineStyle="-4142" /><EdgeRight LineStyle="-4142" /><InsideVertical LineStyle="-4142" /><InsideHorizontal LineStyle="-4142" /></TableS [rest of string was truncated]";. - /// - internal static string TableStyleDark9 { - get { - return ResourceManager.GetString("TableStyleDark9", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8"?><TableStyle name="TableStyleLight1"><TableStyleElement name="blankRow" /><TableStyleElement name="firstColumn" Bold="true" Italic="false" Underline="false" Color="#000000" BgColor="#000000" StripeSize="1"><DiagonalDown LineStyle="-4142" /><DiagonalUp LineStyle="-4142" /><EdgeLeft LineStyle="-4142" /><EdgeTop LineStyle="-4142" /><EdgeBottom LineStyle="-4142" /><EdgeRight LineStyle="-4142" /><InsideVertical LineStyle="-4142" /><InsideHorizontal LineStyle="-4142" /></Table [rest of string was truncated]";. - /// - internal static string TableStyleLight1 { - get { - return ResourceManager.GetString("TableStyleLight1", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8"?><TableStyle name="TableStyleLight10"><TableStyleElement name="blankRow" /><TableStyleElement name="firstColumn" Bold="true" Italic="false" Underline="false" Color="#000000" BgColor="#000000" StripeSize="1"><DiagonalDown LineStyle="-4142" /><DiagonalUp LineStyle="-4142" /><EdgeLeft LineStyle="-4142" /><EdgeTop LineStyle="-4142" /><EdgeBottom LineStyle="-4142" /><EdgeRight LineStyle="-4142" /><InsideVertical LineStyle="-4142" /><InsideHorizontal LineStyle="-4142" /></Tabl [rest of string was truncated]";. - /// - internal static string TableStyleLight10 { - get { - return ResourceManager.GetString("TableStyleLight10", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8"?><TableStyle name="TableStyleLight11"><TableStyleElement name="blankRow" /><TableStyleElement name="firstColumn" Bold="true" Italic="false" Underline="false" Color="#000000" BgColor="#000000" StripeSize="1"><DiagonalDown LineStyle="-4142" /><DiagonalUp LineStyle="-4142" /><EdgeLeft LineStyle="-4142" /><EdgeTop LineStyle="-4142" /><EdgeBottom LineStyle="-4142" /><EdgeRight LineStyle="-4142" /><InsideVertical LineStyle="-4142" /><InsideHorizontal LineStyle="-4142" /></Tabl [rest of string was truncated]";. - /// - internal static string TableStyleLight11 { - get { - return ResourceManager.GetString("TableStyleLight11", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8"?><TableStyle name="TableStyleLight12"><TableStyleElement name="blankRow" /><TableStyleElement name="firstColumn" Bold="true" Italic="false" Underline="false" Color="#000000" BgColor="#000000" StripeSize="1"><DiagonalDown LineStyle="-4142" /><DiagonalUp LineStyle="-4142" /><EdgeLeft LineStyle="-4142" /><EdgeTop LineStyle="-4142" /><EdgeBottom LineStyle="-4142" /><EdgeRight LineStyle="-4142" /><InsideVertical LineStyle="-4142" /><InsideHorizontal LineStyle="-4142" /></Tabl [rest of string was truncated]";. - /// - internal static string TableStyleLight12 { - get { - return ResourceManager.GetString("TableStyleLight12", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8"?><TableStyle name="TableStyleLight13"><TableStyleElement name="blankRow" /><TableStyleElement name="firstColumn" Bold="true" Italic="false" Underline="false" Color="#000000" BgColor="#000000" StripeSize="1"><DiagonalDown LineStyle="-4142" /><DiagonalUp LineStyle="-4142" /><EdgeLeft LineStyle="-4142" /><EdgeTop LineStyle="-4142" /><EdgeBottom LineStyle="-4142" /><EdgeRight LineStyle="-4142" /><InsideVertical LineStyle="-4142" /><InsideHorizontal LineStyle="-4142" /></Tabl [rest of string was truncated]";. - /// - internal static string TableStyleLight13 { - get { - return ResourceManager.GetString("TableStyleLight13", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8"?><TableStyle name="TableStyleLight14"><TableStyleElement name="blankRow" /><TableStyleElement name="firstColumn" Bold="true" Italic="false" Underline="false" Color="#000000" BgColor="#000000" StripeSize="1"><DiagonalDown LineStyle="-4142" /><DiagonalUp LineStyle="-4142" /><EdgeLeft LineStyle="-4142" /><EdgeTop LineStyle="-4142" /><EdgeBottom LineStyle="-4142" /><EdgeRight LineStyle="-4142" /><InsideVertical LineStyle="-4142" /><InsideHorizontal LineStyle="-4142" /></Tabl [rest of string was truncated]";. - /// - internal static string TableStyleLight14 { - get { - return ResourceManager.GetString("TableStyleLight14", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8"?><TableStyle name="TableStyleLight15"><TableStyleElement name="blankRow" /><TableStyleElement name="firstColumn" Bold="true" Italic="false" Underline="false" Color="#000000" BgColor="#000000" StripeSize="1"><DiagonalDown LineStyle="-4142" /><DiagonalUp LineStyle="-4142" /><EdgeLeft LineStyle="-4142" /><EdgeTop LineStyle="-4142" /><EdgeBottom LineStyle="-4142" /><EdgeRight LineStyle="-4142" /><InsideVertical LineStyle="-4142" /><InsideHorizontal LineStyle="-4142" /></Tabl [rest of string was truncated]";. - /// - internal static string TableStyleLight15 { - get { - return ResourceManager.GetString("TableStyleLight15", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8"?><TableStyle name="TableStyleLight16"><TableStyleElement name="blankRow" /><TableStyleElement name="firstColumn" Bold="true" Italic="false" Underline="false" Color="#000000" BgColor="#000000" StripeSize="1"><DiagonalDown LineStyle="-4142" /><DiagonalUp LineStyle="-4142" /><EdgeLeft LineStyle="-4142" /><EdgeTop LineStyle="-4142" /><EdgeBottom LineStyle="-4142" /><EdgeRight LineStyle="-4142" /><InsideVertical LineStyle="-4142" /><InsideHorizontal LineStyle="-4142" /></Tabl [rest of string was truncated]";. - /// - internal static string TableStyleLight16 { - get { - return ResourceManager.GetString("TableStyleLight16", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8"?><TableStyle name="TableStyleLight17"><TableStyleElement name="blankRow" /><TableStyleElement name="firstColumn" Bold="true" Italic="false" Underline="false" Color="#000000" BgColor="#000000" StripeSize="1"><DiagonalDown LineStyle="-4142" /><DiagonalUp LineStyle="-4142" /><EdgeLeft LineStyle="-4142" /><EdgeTop LineStyle="-4142" /><EdgeBottom LineStyle="-4142" /><EdgeRight LineStyle="-4142" /><InsideVertical LineStyle="-4142" /><InsideHorizontal LineStyle="-4142" /></Tabl [rest of string was truncated]";. - /// - internal static string TableStyleLight17 { - get { - return ResourceManager.GetString("TableStyleLight17", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8"?><TableStyle name="TableStyleLight18"><TableStyleElement name="blankRow" /><TableStyleElement name="firstColumn" Bold="true" Italic="false" Underline="false" Color="#000000" BgColor="#000000" StripeSize="1"><DiagonalDown LineStyle="-4142" /><DiagonalUp LineStyle="-4142" /><EdgeLeft LineStyle="-4142" /><EdgeTop LineStyle="-4142" /><EdgeBottom LineStyle="-4142" /><EdgeRight LineStyle="-4142" /><InsideVertical LineStyle="-4142" /><InsideHorizontal LineStyle="-4142" /></Tabl [rest of string was truncated]";. - /// - internal static string TableStyleLight18 { - get { - return ResourceManager.GetString("TableStyleLight18", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8"?><TableStyle name="TableStyleLight19"><TableStyleElement name="blankRow" /><TableStyleElement name="firstColumn" Bold="true" Italic="false" Underline="false" Color="#000000" BgColor="#000000" StripeSize="1"><DiagonalDown LineStyle="-4142" /><DiagonalUp LineStyle="-4142" /><EdgeLeft LineStyle="-4142" /><EdgeTop LineStyle="-4142" /><EdgeBottom LineStyle="-4142" /><EdgeRight LineStyle="-4142" /><InsideVertical LineStyle="-4142" /><InsideHorizontal LineStyle="-4142" /></Tabl [rest of string was truncated]";. - /// - internal static string TableStyleLight19 { - get { - return ResourceManager.GetString("TableStyleLight19", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8"?><TableStyle name="TableStyleLight2"><TableStyleElement name="blankRow" /><TableStyleElement name="firstColumn" Bold="true" Italic="false" Underline="false" Color="#366092" BgColor="#000000" StripeSize="1"><DiagonalDown LineStyle="-4142" /><DiagonalUp LineStyle="-4142" /><EdgeLeft LineStyle="-4142" /><EdgeTop LineStyle="-4142" /><EdgeBottom LineStyle="-4142" /><EdgeRight LineStyle="-4142" /><InsideVertical LineStyle="-4142" /><InsideHorizontal LineStyle="-4142" /></Table [rest of string was truncated]";. - /// - internal static string TableStyleLight2 { - get { - return ResourceManager.GetString("TableStyleLight2", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8"?><TableStyle name="TableStyleLight20"><TableStyleElement name="blankRow" /><TableStyleElement name="firstColumn" Bold="true" Italic="false" Underline="false" Color="#000000" BgColor="#000000" StripeSize="1"><DiagonalDown LineStyle="-4142" /><DiagonalUp LineStyle="-4142" /><EdgeLeft LineStyle="-4142" /><EdgeTop LineStyle="-4142" /><EdgeBottom LineStyle="-4142" /><EdgeRight LineStyle="-4142" /><InsideVertical LineStyle="-4142" /><InsideHorizontal LineStyle="-4142" /></Tabl [rest of string was truncated]";. - /// - internal static string TableStyleLight20 { - get { - return ResourceManager.GetString("TableStyleLight20", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8"?><TableStyle name="TableStyleLight21"><TableStyleElement name="blankRow" /><TableStyleElement name="firstColumn" Bold="true" Italic="false" Underline="false" Color="#000000" BgColor="#000000" StripeSize="1"><DiagonalDown LineStyle="-4142" /><DiagonalUp LineStyle="-4142" /><EdgeLeft LineStyle="-4142" /><EdgeTop LineStyle="-4142" /><EdgeBottom LineStyle="-4142" /><EdgeRight LineStyle="-4142" /><InsideVertical LineStyle="-4142" /><InsideHorizontal LineStyle="-4142" /></Tabl [rest of string was truncated]";. - /// - internal static string TableStyleLight21 { - get { - return ResourceManager.GetString("TableStyleLight21", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8"?><TableStyle name="TableStyleLight3"><TableStyleElement name="blankRow" /><TableStyleElement name="firstColumn" Bold="true" Italic="false" Underline="false" Color="#963634" BgColor="#000000" StripeSize="1"><DiagonalDown LineStyle="-4142" /><DiagonalUp LineStyle="-4142" /><EdgeLeft LineStyle="-4142" /><EdgeTop LineStyle="-4142" /><EdgeBottom LineStyle="-4142" /><EdgeRight LineStyle="-4142" /><InsideVertical LineStyle="-4142" /><InsideHorizontal LineStyle="-4142" /></Table [rest of string was truncated]";. - /// - internal static string TableStyleLight3 { - get { - return ResourceManager.GetString("TableStyleLight3", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8"?><TableStyle name="TableStyleLight4"><TableStyleElement name="blankRow" /><TableStyleElement name="firstColumn" Bold="true" Italic="false" Underline="false" Color="#76933C" BgColor="#000000" StripeSize="1"><DiagonalDown LineStyle="-4142" /><DiagonalUp LineStyle="-4142" /><EdgeLeft LineStyle="-4142" /><EdgeTop LineStyle="-4142" /><EdgeBottom LineStyle="-4142" /><EdgeRight LineStyle="-4142" /><InsideVertical LineStyle="-4142" /><InsideHorizontal LineStyle="-4142" /></Table [rest of string was truncated]";. - /// - internal static string TableStyleLight4 { - get { - return ResourceManager.GetString("TableStyleLight4", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8"?><TableStyle name="TableStyleLight5"><TableStyleElement name="blankRow" /><TableStyleElement name="firstColumn" Bold="true" Italic="false" Underline="false" Color="#60497A" BgColor="#000000" StripeSize="1"><DiagonalDown LineStyle="-4142" /><DiagonalUp LineStyle="-4142" /><EdgeLeft LineStyle="-4142" /><EdgeTop LineStyle="-4142" /><EdgeBottom LineStyle="-4142" /><EdgeRight LineStyle="-4142" /><InsideVertical LineStyle="-4142" /><InsideHorizontal LineStyle="-4142" /></Table [rest of string was truncated]";. - /// - internal static string TableStyleLight5 { - get { - return ResourceManager.GetString("TableStyleLight5", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8"?><TableStyle name="TableStyleLight6"><TableStyleElement name="blankRow" /><TableStyleElement name="firstColumn" Bold="true" Italic="false" Underline="false" Color="#31869B" BgColor="#000000" StripeSize="1"><DiagonalDown LineStyle="-4142" /><DiagonalUp LineStyle="-4142" /><EdgeLeft LineStyle="-4142" /><EdgeTop LineStyle="-4142" /><EdgeBottom LineStyle="-4142" /><EdgeRight LineStyle="-4142" /><InsideVertical LineStyle="-4142" /><InsideHorizontal LineStyle="-4142" /></Table [rest of string was truncated]";. - /// - internal static string TableStyleLight6 { - get { - return ResourceManager.GetString("TableStyleLight6", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8"?><TableStyle name="TableStyleLight7"><TableStyleElement name="blankRow" /><TableStyleElement name="firstColumn" Bold="true" Italic="false" Underline="false" Color="#E26B0A" BgColor="#000000" StripeSize="1"><DiagonalDown LineStyle="-4142" /><DiagonalUp LineStyle="-4142" /><EdgeLeft LineStyle="-4142" /><EdgeTop LineStyle="-4142" /><EdgeBottom LineStyle="-4142" /><EdgeRight LineStyle="-4142" /><InsideVertical LineStyle="-4142" /><InsideHorizontal LineStyle="-4142" /></Table [rest of string was truncated]";. - /// - internal static string TableStyleLight7 { - get { - return ResourceManager.GetString("TableStyleLight7", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8"?><TableStyle name="TableStyleLight8"><TableStyleElement name="blankRow" /><TableStyleElement name="firstColumn" Bold="true" Italic="false" Underline="false" Color="#000000" BgColor="#000000" StripeSize="1"><DiagonalDown LineStyle="-4142" /><DiagonalUp LineStyle="-4142" /><EdgeLeft LineStyle="-4142" /><EdgeTop LineStyle="-4142" /><EdgeBottom LineStyle="-4142" /><EdgeRight LineStyle="-4142" /><InsideVertical LineStyle="-4142" /><InsideHorizontal LineStyle="-4142" /></Table [rest of string was truncated]";. - /// - internal static string TableStyleLight8 { - get { - return ResourceManager.GetString("TableStyleLight8", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8"?><TableStyle name="TableStyleLight9"><TableStyleElement name="blankRow" /><TableStyleElement name="firstColumn" Bold="true" Italic="false" Underline="false" Color="#000000" BgColor="#000000" StripeSize="1"><DiagonalDown LineStyle="-4142" /><DiagonalUp LineStyle="-4142" /><EdgeLeft LineStyle="-4142" /><EdgeTop LineStyle="-4142" /><EdgeBottom LineStyle="-4142" /><EdgeRight LineStyle="-4142" /><InsideVertical LineStyle="-4142" /><InsideHorizontal LineStyle="-4142" /></Table [rest of string was truncated]";. - /// - internal static string TableStyleLight9 { - get { - return ResourceManager.GetString("TableStyleLight9", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8"?><TableStyle name="TableStyleMedium1"><TableStyleElement name="blankRow" /><TableStyleElement name="firstColumn" Bold="true" Italic="false" Underline="false" Color="#000000" BgColor="#000000" StripeSize="1"><DiagonalDown LineStyle="-4142" /><DiagonalUp LineStyle="-4142" /><EdgeLeft LineStyle="-4142" /><EdgeTop LineStyle="-4142" /><EdgeBottom LineStyle="-4142" /><EdgeRight LineStyle="-4142" /><InsideVertical LineStyle="-4142" /><InsideHorizontal LineStyle="-4142" /></Tabl [rest of string was truncated]";. - /// - internal static string TableStyleMedium1 { - get { - return ResourceManager.GetString("TableStyleMedium1", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8"?><TableStyle name="TableStyleMedium10"><TableStyleElement name="blankRow" /><TableStyleElement name="firstColumn" Bold="true" Italic="false" Underline="false" Color="#FFFFFF" BgColor="#C0504D" StripeSize="1"><DiagonalDown LineStyle="-4142" /><DiagonalUp LineStyle="-4142" /><EdgeLeft LineStyle="-4142" /><EdgeTop LineStyle="-4142" /><EdgeBottom LineStyle="-4142" /><EdgeRight LineStyle="-4142" /><InsideVertical LineStyle="-4142" /><InsideHorizontal LineStyle="-4142" /></Tab [rest of string was truncated]";. - /// - internal static string TableStyleMedium10 { - get { - return ResourceManager.GetString("TableStyleMedium10", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8"?><TableStyle name="TableStyleMedium11"><TableStyleElement name="blankRow" /><TableStyleElement name="firstColumn" Bold="true" Italic="false" Underline="false" Color="#FFFFFF" BgColor="#9BBB59" StripeSize="1"><DiagonalDown LineStyle="-4142" /><DiagonalUp LineStyle="-4142" /><EdgeLeft LineStyle="-4142" /><EdgeTop LineStyle="-4142" /><EdgeBottom LineStyle="-4142" /><EdgeRight LineStyle="-4142" /><InsideVertical LineStyle="-4142" /><InsideHorizontal LineStyle="-4142" /></Tab [rest of string was truncated]";. - /// - internal static string TableStyleMedium11 { - get { - return ResourceManager.GetString("TableStyleMedium11", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8"?><TableStyle name="TableStyleMedium12"><TableStyleElement name="blankRow" /><TableStyleElement name="firstColumn" Bold="true" Italic="false" Underline="false" Color="#FFFFFF" BgColor="#8064A2" StripeSize="1"><DiagonalDown LineStyle="-4142" /><DiagonalUp LineStyle="-4142" /><EdgeLeft LineStyle="-4142" /><EdgeTop LineStyle="-4142" /><EdgeBottom LineStyle="-4142" /><EdgeRight LineStyle="-4142" /><InsideVertical LineStyle="-4142" /><InsideHorizontal LineStyle="-4142" /></Tab [rest of string was truncated]";. - /// - internal static string TableStyleMedium12 { - get { - return ResourceManager.GetString("TableStyleMedium12", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8"?><TableStyle name="TableStyleMedium13"><TableStyleElement name="blankRow" /><TableStyleElement name="firstColumn" Bold="true" Italic="false" Underline="false" Color="#FFFFFF" BgColor="#4BACC6" StripeSize="1"><DiagonalDown LineStyle="-4142" /><DiagonalUp LineStyle="-4142" /><EdgeLeft LineStyle="-4142" /><EdgeTop LineStyle="-4142" /><EdgeBottom LineStyle="-4142" /><EdgeRight LineStyle="-4142" /><InsideVertical LineStyle="-4142" /><InsideHorizontal LineStyle="-4142" /></Tab [rest of string was truncated]";. - /// - internal static string TableStyleMedium13 { - get { - return ResourceManager.GetString("TableStyleMedium13", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8"?><TableStyle name="TableStyleMedium14"><TableStyleElement name="blankRow" /><TableStyleElement name="firstColumn" Bold="true" Italic="false" Underline="false" Color="#FFFFFF" BgColor="#F79646" StripeSize="1"><DiagonalDown LineStyle="-4142" /><DiagonalUp LineStyle="-4142" /><EdgeLeft LineStyle="-4142" /><EdgeTop LineStyle="-4142" /><EdgeBottom LineStyle="-4142" /><EdgeRight LineStyle="-4142" /><InsideVertical LineStyle="-4142" /><InsideHorizontal LineStyle="-4142" /></Tab [rest of string was truncated]";. - /// - internal static string TableStyleMedium14 { - get { - return ResourceManager.GetString("TableStyleMedium14", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8"?><TableStyle name="TableStyleMedium15"><TableStyleElement name="blankRow" /><TableStyleElement name="firstColumn" Bold="true" Italic="false" Underline="false" Color="#FFFFFF" BgColor="#000000" StripeSize="1"><DiagonalDown LineStyle="-4142" /><DiagonalUp LineStyle="-4142" /><EdgeLeft LineStyle="-4142" /><EdgeTop LineStyle="-4142" /><EdgeBottom LineStyle="-4142" /><EdgeRight LineStyle="-4142" /><InsideVertical LineStyle="-4142" /><InsideHorizontal LineStyle="-4142" /></Tab [rest of string was truncated]";. - /// - internal static string TableStyleMedium15 { - get { - return ResourceManager.GetString("TableStyleMedium15", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8"?><TableStyle name="TableStyleMedium16"><TableStyleElement name="blankRow" /><TableStyleElement name="firstColumn" Bold="true" Italic="false" Underline="false" Color="#FFFFFF" BgColor="#4F81BD" StripeSize="1"><DiagonalDown LineStyle="-4142" /><DiagonalUp LineStyle="-4142" /><EdgeLeft LineStyle="-4142" /><EdgeTop LineStyle="-4142" /><EdgeBottom LineStyle="-4142" /><EdgeRight LineStyle="-4142" /><InsideVertical LineStyle="-4142" /><InsideHorizontal LineStyle="-4142" /></Tab [rest of string was truncated]";. - /// - internal static string TableStyleMedium16 { - get { - return ResourceManager.GetString("TableStyleMedium16", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8"?><TableStyle name="TableStyleMedium17"><TableStyleElement name="blankRow" /><TableStyleElement name="firstColumn" Bold="true" Italic="false" Underline="false" Color="#FFFFFF" BgColor="#C0504D" StripeSize="1"><DiagonalDown LineStyle="-4142" /><DiagonalUp LineStyle="-4142" /><EdgeLeft LineStyle="-4142" /><EdgeTop LineStyle="-4142" /><EdgeBottom LineStyle="-4142" /><EdgeRight LineStyle="-4142" /><InsideVertical LineStyle="-4142" /><InsideHorizontal LineStyle="-4142" /></Tab [rest of string was truncated]";. - /// - internal static string TableStyleMedium17 { - get { - return ResourceManager.GetString("TableStyleMedium17", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8"?><TableStyle name="TableStyleMedium18"><TableStyleElement name="blankRow" /><TableStyleElement name="firstColumn" Bold="true" Italic="false" Underline="false" Color="#FFFFFF" BgColor="#9BBB59" StripeSize="1"><DiagonalDown LineStyle="-4142" /><DiagonalUp LineStyle="-4142" /><EdgeLeft LineStyle="-4142" /><EdgeTop LineStyle="-4142" /><EdgeBottom LineStyle="-4142" /><EdgeRight LineStyle="-4142" /><InsideVertical LineStyle="-4142" /><InsideHorizontal LineStyle="-4142" /></Tab [rest of string was truncated]";. - /// - internal static string TableStyleMedium18 { - get { - return ResourceManager.GetString("TableStyleMedium18", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8"?><TableStyle name="TableStyleMedium19"><TableStyleElement name="blankRow" /><TableStyleElement name="firstColumn" Bold="true" Italic="false" Underline="false" Color="#FFFFFF" BgColor="#8064A2" StripeSize="1"><DiagonalDown LineStyle="-4142" /><DiagonalUp LineStyle="-4142" /><EdgeLeft LineStyle="-4142" /><EdgeTop LineStyle="-4142" /><EdgeBottom LineStyle="-4142" /><EdgeRight LineStyle="-4142" /><InsideVertical LineStyle="-4142" /><InsideHorizontal LineStyle="-4142" /></Tab [rest of string was truncated]";. - /// - internal static string TableStyleMedium19 { - get { - return ResourceManager.GetString("TableStyleMedium19", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8"?><TableStyle name="TableStyleMedium2"><TableStyleElement name="blankRow" /><TableStyleElement name="firstColumn" Bold="true" Italic="false" Underline="false" Color="#000000" BgColor="#000000" StripeSize="1"><DiagonalDown LineStyle="-4142" /><DiagonalUp LineStyle="-4142" /><EdgeLeft LineStyle="-4142" /><EdgeTop LineStyle="-4142" /><EdgeBottom LineStyle="-4142" /><EdgeRight LineStyle="-4142" /><InsideVertical LineStyle="-4142" /><InsideHorizontal LineStyle="-4142" /></Tabl [rest of string was truncated]";. - /// - internal static string TableStyleMedium2 { - get { - return ResourceManager.GetString("TableStyleMedium2", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8"?><TableStyle name="TableStyleMedium20"><TableStyleElement name="blankRow" /><TableStyleElement name="firstColumn" Bold="true" Italic="false" Underline="false" Color="#FFFFFF" BgColor="#4BACC6" StripeSize="1"><DiagonalDown LineStyle="-4142" /><DiagonalUp LineStyle="-4142" /><EdgeLeft LineStyle="-4142" /><EdgeTop LineStyle="-4142" /><EdgeBottom LineStyle="-4142" /><EdgeRight LineStyle="-4142" /><InsideVertical LineStyle="-4142" /><InsideHorizontal LineStyle="-4142" /></Tab [rest of string was truncated]";. - /// - internal static string TableStyleMedium20 { - get { - return ResourceManager.GetString("TableStyleMedium20", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8"?><TableStyle name="TableStyleMedium21"><TableStyleElement name="blankRow" /><TableStyleElement name="firstColumn" Bold="true" Italic="false" Underline="false" Color="#FFFFFF" BgColor="#F79646" StripeSize="1"><DiagonalDown LineStyle="-4142" /><DiagonalUp LineStyle="-4142" /><EdgeLeft LineStyle="-4142" /><EdgeTop LineStyle="-4142" /><EdgeBottom LineStyle="-4142" /><EdgeRight LineStyle="-4142" /><InsideVertical LineStyle="-4142" /><InsideHorizontal LineStyle="-4142" /></Tab [rest of string was truncated]";. - /// - internal static string TableStyleMedium21 { - get { - return ResourceManager.GetString("TableStyleMedium21", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8"?><TableStyle name="TableStyleMedium22"><TableStyleElement name="blankRow" /><TableStyleElement name="firstColumn" Bold="true" Italic="false" Underline="false" Color="#000000" BgColor="#000000" StripeSize="1"><DiagonalDown LineStyle="-4142" /><DiagonalUp LineStyle="-4142" /><EdgeLeft LineStyle="-4142" /><EdgeTop LineStyle="-4142" /><EdgeBottom LineStyle="-4142" /><EdgeRight LineStyle="-4142" /><InsideVertical LineStyle="-4142" /><InsideHorizontal LineStyle="-4142" /></Tab [rest of string was truncated]";. - /// - internal static string TableStyleMedium22 { - get { - return ResourceManager.GetString("TableStyleMedium22", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8"?><TableStyle name="TableStyleMedium23"><TableStyleElement name="blankRow" /><TableStyleElement name="firstColumn" Bold="true" Italic="false" Underline="false" Color="#000000" BgColor="#000000" StripeSize="1"><DiagonalDown LineStyle="-4142" /><DiagonalUp LineStyle="-4142" /><EdgeLeft LineStyle="-4142" /><EdgeTop LineStyle="-4142" /><EdgeBottom LineStyle="-4142" /><EdgeRight LineStyle="-4142" /><InsideVertical LineStyle="-4142" /><InsideHorizontal LineStyle="-4142" /></Tab [rest of string was truncated]";. - /// - internal static string TableStyleMedium23 { - get { - return ResourceManager.GetString("TableStyleMedium23", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8"?><TableStyle name="TableStyleMedium24"><TableStyleElement name="blankRow" /><TableStyleElement name="firstColumn" Bold="true" Italic="false" Underline="false" Color="#000000" BgColor="#000000" StripeSize="1"><DiagonalDown LineStyle="-4142" /><DiagonalUp LineStyle="-4142" /><EdgeLeft LineStyle="-4142" /><EdgeTop LineStyle="-4142" /><EdgeBottom LineStyle="-4142" /><EdgeRight LineStyle="-4142" /><InsideVertical LineStyle="-4142" /><InsideHorizontal LineStyle="-4142" /></Tab [rest of string was truncated]";. - /// - internal static string TableStyleMedium24 { - get { - return ResourceManager.GetString("TableStyleMedium24", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8"?><TableStyle name="TableStyleMedium25"><TableStyleElement name="blankRow" /><TableStyleElement name="firstColumn" Bold="true" Italic="false" Underline="false" Color="#000000" BgColor="#000000" StripeSize="1"><DiagonalDown LineStyle="-4142" /><DiagonalUp LineStyle="-4142" /><EdgeLeft LineStyle="-4142" /><EdgeTop LineStyle="-4142" /><EdgeBottom LineStyle="-4142" /><EdgeRight LineStyle="-4142" /><InsideVertical LineStyle="-4142" /><InsideHorizontal LineStyle="-4142" /></Tab [rest of string was truncated]";. - /// - internal static string TableStyleMedium25 { - get { - return ResourceManager.GetString("TableStyleMedium25", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8"?><TableStyle name="TableStyleMedium26"><TableStyleElement name="blankRow" /><TableStyleElement name="firstColumn" Bold="true" Italic="false" Underline="false" Color="#000000" BgColor="#000000" StripeSize="1"><DiagonalDown LineStyle="-4142" /><DiagonalUp LineStyle="-4142" /><EdgeLeft LineStyle="-4142" /><EdgeTop LineStyle="-4142" /><EdgeBottom LineStyle="-4142" /><EdgeRight LineStyle="-4142" /><InsideVertical LineStyle="-4142" /><InsideHorizontal LineStyle="-4142" /></Tab [rest of string was truncated]";. - /// - internal static string TableStyleMedium26 { - get { - return ResourceManager.GetString("TableStyleMedium26", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8"?><TableStyle name="TableStyleMedium27"><TableStyleElement name="blankRow" /><TableStyleElement name="firstColumn" Bold="true" Italic="false" Underline="false" Color="#000000" BgColor="#000000" StripeSize="1"><DiagonalDown LineStyle="-4142" /><DiagonalUp LineStyle="-4142" /><EdgeLeft LineStyle="-4142" /><EdgeTop LineStyle="-4142" /><EdgeBottom LineStyle="-4142" /><EdgeRight LineStyle="-4142" /><InsideVertical LineStyle="-4142" /><InsideHorizontal LineStyle="-4142" /></Tab [rest of string was truncated]";. - /// - internal static string TableStyleMedium27 { - get { - return ResourceManager.GetString("TableStyleMedium27", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8"?><TableStyle name="TableStyleMedium28"><TableStyleElement name="blankRow" /><TableStyleElement name="firstColumn" Bold="true" Italic="false" Underline="false" Color="#000000" BgColor="#000000" StripeSize="1"><DiagonalDown LineStyle="-4142" /><DiagonalUp LineStyle="-4142" /><EdgeLeft LineStyle="-4142" /><EdgeTop LineStyle="-4142" /><EdgeBottom LineStyle="-4142" /><EdgeRight LineStyle="-4142" /><InsideVertical LineStyle="-4142" /><InsideHorizontal LineStyle="-4142" /></Tab [rest of string was truncated]";. - /// - internal static string TableStyleMedium28 { - get { - return ResourceManager.GetString("TableStyleMedium28", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8"?><TableStyle name="TableStyleMedium3"><TableStyleElement name="blankRow" /><TableStyleElement name="firstColumn" Bold="true" Italic="false" Underline="false" Color="#000000" BgColor="#000000" StripeSize="1"><DiagonalDown LineStyle="-4142" /><DiagonalUp LineStyle="-4142" /><EdgeLeft LineStyle="-4142" /><EdgeTop LineStyle="-4142" /><EdgeBottom LineStyle="-4142" /><EdgeRight LineStyle="-4142" /><InsideVertical LineStyle="-4142" /><InsideHorizontal LineStyle="-4142" /></Tabl [rest of string was truncated]";. - /// - internal static string TableStyleMedium3 { - get { - return ResourceManager.GetString("TableStyleMedium3", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8"?><TableStyle name="TableStyleMedium4"><TableStyleElement name="blankRow" /><TableStyleElement name="firstColumn" Bold="true" Italic="false" Underline="false" Color="#000000" BgColor="#000000" StripeSize="1"><DiagonalDown LineStyle="-4142" /><DiagonalUp LineStyle="-4142" /><EdgeLeft LineStyle="-4142" /><EdgeTop LineStyle="-4142" /><EdgeBottom LineStyle="-4142" /><EdgeRight LineStyle="-4142" /><InsideVertical LineStyle="-4142" /><InsideHorizontal LineStyle="-4142" /></Tabl [rest of string was truncated]";. - /// - internal static string TableStyleMedium4 { - get { - return ResourceManager.GetString("TableStyleMedium4", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8"?><TableStyle name="TableStyleMedium5"><TableStyleElement name="blankRow" /><TableStyleElement name="firstColumn" Bold="true" Italic="false" Underline="false" Color="#000000" BgColor="#000000" StripeSize="1"><DiagonalDown LineStyle="-4142" /><DiagonalUp LineStyle="-4142" /><EdgeLeft LineStyle="-4142" /><EdgeTop LineStyle="-4142" /><EdgeBottom LineStyle="-4142" /><EdgeRight LineStyle="-4142" /><InsideVertical LineStyle="-4142" /><InsideHorizontal LineStyle="-4142" /></Tabl [rest of string was truncated]";. - /// - internal static string TableStyleMedium5 { - get { - return ResourceManager.GetString("TableStyleMedium5", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8"?><TableStyle name="TableStyleMedium6"><TableStyleElement name="blankRow" /><TableStyleElement name="firstColumn" Bold="true" Italic="false" Underline="false" Color="#000000" BgColor="#000000" StripeSize="1"><DiagonalDown LineStyle="-4142" /><DiagonalUp LineStyle="-4142" /><EdgeLeft LineStyle="-4142" /><EdgeTop LineStyle="-4142" /><EdgeBottom LineStyle="-4142" /><EdgeRight LineStyle="-4142" /><InsideVertical LineStyle="-4142" /><InsideHorizontal LineStyle="-4142" /></Tabl [rest of string was truncated]";. - /// - internal static string TableStyleMedium6 { - get { - return ResourceManager.GetString("TableStyleMedium6", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8"?><TableStyle name="TableStyleMedium7"><TableStyleElement name="blankRow" /><TableStyleElement name="firstColumn" Bold="true" Italic="false" Underline="false" Color="#000000" BgColor="#000000" StripeSize="1"><DiagonalDown LineStyle="-4142" /><DiagonalUp LineStyle="-4142" /><EdgeLeft LineStyle="-4142" /><EdgeTop LineStyle="-4142" /><EdgeBottom LineStyle="-4142" /><EdgeRight LineStyle="-4142" /><InsideVertical LineStyle="-4142" /><InsideHorizontal LineStyle="-4142" /></Tabl [rest of string was truncated]";. - /// - internal static string TableStyleMedium7 { - get { - return ResourceManager.GetString("TableStyleMedium7", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8"?><TableStyle name="TableStyleMedium8"><TableStyleElement name="blankRow" /><TableStyleElement name="firstColumn" Bold="true" Italic="false" Underline="false" Color="#FFFFFF" BgColor="#000000" StripeSize="1"><DiagonalDown LineStyle="-4142" /><DiagonalUp LineStyle="-4142" /><EdgeLeft LineStyle="-4142" /><EdgeTop LineStyle="-4142" /><EdgeBottom LineStyle="-4142" /><EdgeRight LineStyle="-4142" /><InsideVertical LineStyle="-4142" /><InsideHorizontal LineStyle="-4142" /></Tabl [rest of string was truncated]";. - /// - internal static string TableStyleMedium8 { - get { - return ResourceManager.GetString("TableStyleMedium8", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8"?><TableStyle name="TableStyleMedium9"><TableStyleElement name="blankRow" /><TableStyleElement name="firstColumn" Bold="true" Italic="false" Underline="false" Color="#FFFFFF" BgColor="#4F81BD" StripeSize="1"><DiagonalDown LineStyle="-4142" /><DiagonalUp LineStyle="-4142" /><EdgeLeft LineStyle="-4142" /><EdgeTop LineStyle="-4142" /><EdgeBottom LineStyle="-4142" /><EdgeRight LineStyle="-4142" /><InsideVertical LineStyle="-4142" /><InsideHorizontal LineStyle="-4142" /></Tabl [rest of string was truncated]";. - /// - internal static string TableStyleMedium9 { - get { - return ResourceManager.GetString("TableStyleMedium9", resourceCulture); - } - } - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ResourceExcelDefaultStyles.resx b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ResourceExcelDefaultStyles.resx deleted file mode 100644 index 9e3f6d6d96..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/ResourceExcelDefaultStyles.resx +++ /dev/null @@ -1,301 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - - ExcelDefaultFiles\TableStyleDark1.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - ExcelDefaultFiles\TableStyleDark10.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - ExcelDefaultFiles\TableStyleDark11.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - ExcelDefaultFiles\TableStyleDark2.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - ExcelDefaultFiles\TableStyleDark3.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - ExcelDefaultFiles\TableStyleDark4.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - ExcelDefaultFiles\TableStyleDark5.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - ExcelDefaultFiles\TableStyleDark6.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - ExcelDefaultFiles\TableStyleDark7.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - ExcelDefaultFiles\TableStyleDark8.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - ExcelDefaultFiles\TableStyleDark9.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - ExcelDefaultFiles\TableStyleLight1.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - ExcelDefaultFiles\TableStyleLight10.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - ExcelDefaultFiles\TableStyleLight11.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - ExcelDefaultFiles\TableStyleLight12.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - ExcelDefaultFiles\TableStyleLight13.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - ExcelDefaultFiles\TableStyleLight14.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - ExcelDefaultFiles\TableStyleLight15.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - ExcelDefaultFiles\TableStyleLight16.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - ExcelDefaultFiles\TableStyleLight17.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - ExcelDefaultFiles\TableStyleLight18.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - ExcelDefaultFiles\TableStyleLight19.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - ExcelDefaultFiles\TableStyleLight2.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - ExcelDefaultFiles\TableStyleLight20.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - ExcelDefaultFiles\TableStyleLight21.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - ExcelDefaultFiles\TableStyleLight3.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - ExcelDefaultFiles\TableStyleLight4.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - ExcelDefaultFiles\TableStyleLight5.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - ExcelDefaultFiles\TableStyleLight6.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - ExcelDefaultFiles\TableStyleLight7.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - ExcelDefaultFiles\TableStyleLight8.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - ExcelDefaultFiles\TableStyleLight9.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - ExcelDefaultFiles\TableStyleMedium1.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - ExcelDefaultFiles\TableStyleMedium10.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - ExcelDefaultFiles\TableStyleMedium11.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - ExcelDefaultFiles\TableStyleMedium12.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - ExcelDefaultFiles\TableStyleMedium13.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - ExcelDefaultFiles\TableStyleMedium14.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - ExcelDefaultFiles\TableStyleMedium15.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - ExcelDefaultFiles\TableStyleMedium16.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - ExcelDefaultFiles\TableStyleMedium17.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - ExcelDefaultFiles\TableStyleMedium18.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - ExcelDefaultFiles\TableStyleMedium19.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - ExcelDefaultFiles\TableStyleMedium2.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - ExcelDefaultFiles\TableStyleMedium20.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - ExcelDefaultFiles\TableStyleMedium21.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - ExcelDefaultFiles\TableStyleMedium22.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - ExcelDefaultFiles\TableStyleMedium23.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - ExcelDefaultFiles\TableStyleMedium24.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - ExcelDefaultFiles\TableStyleMedium25.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - ExcelDefaultFiles\TableStyleMedium26.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - ExcelDefaultFiles\TableStyleMedium27.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - ExcelDefaultFiles\TableStyleMedium28.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - ExcelDefaultFiles\TableStyleMedium3.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - ExcelDefaultFiles\TableStyleMedium4.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - ExcelDefaultFiles\TableStyleMedium5.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - ExcelDefaultFiles\TableStyleMedium6.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - ExcelDefaultFiles\TableStyleMedium7.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - ExcelDefaultFiles\TableStyleMedium8.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - ExcelDefaultFiles\TableStyleMedium9.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - \ No newline at end of file diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/XMLDataSpecific/Attrib.cs b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/XMLDataSpecific/Attrib.cs deleted file mode 100644 index 41222e6bd4..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/XMLDataSpecific/Attrib.cs +++ /dev/null @@ -1,114 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Globalization; - -namespace ASCOfficeEWSEditor.XMLDataSpecific -{ - internal class XMLInt - { - internal static int ParseOrDefault(string str_value, int default_val) - { - int ret_val; - if (!int.TryParse(str_value, out ret_val)) - { - return default_val; - } - return ret_val; - } - internal static int ParseOrDefaultAndReport(string str_value, int default_val, Editor.Workbook workbook, string param_name) - { - int ret_val; - if (!int.TryParse(str_value, out ret_val)) - { - workbook.ReportError(new Editor.Events.InternalError("Wrong OOX format. " + param_name + " is not int")); - return default_val; - } - return ret_val; - } - } - - internal class XMLDouble - { - internal static double ParseOrDefault(string str_value, double default_val) - { - double ret_val; - if (!TryParse(str_value, out ret_val)) - { - return default_val; - } - return ret_val; - } - - internal static bool TryParse(string str_value, out double ret_val) - { - return double.TryParse(str_value, NumberStyles.Float | NumberStyles.AllowThousands, new CultureInfo(0x409), out ret_val); - } - - internal static string ToString(double value) - { - return value.ToString(new CultureInfo(0x409)); - } - - } - internal class XMLVariant - { - internal static string ToString(object value) - { - if(value is Double) - { - return XMLDouble.ToString((double)value); - - } - else if(value is Boolean) - { - return value.ToString().ToLower(); - } - return value.ToString(); - } - - } - - internal class XMLBoolean - { - internal static bool ParseOrDefault(string str_value, bool default_val) - { - bool ret_val; - if (!TryParse(str_value, out ret_val)) - { - return default_val; - } - return ret_val; - } - - internal static bool TryParse(string str_value, out bool ret_val) - { - switch(str_value.ToLower()) - { - case "0": - case "false": - { - ret_val = false; - return true; - } - case "1": - case "true": - { - ret_val = true; - return true; - } - default: - { - ret_val = false; - return false; - } - } - } - - internal static string ToString(bool value) - { - return value ? "true" : "false"; - } - - } -} diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/XMLTemplates/Empty_full.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/XMLTemplates/Empty_full.xml deleted file mode 100644 index 5da070b1b0..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/XMLTemplates/Empty_full.xml +++ /dev/null @@ -1,424 +0,0 @@ - - - - - - Microsoft Excel - 0 - false - - - - Worksheets - - - 1 - - - - - - Sheet1 - - - B - false - false - false - 12.0000 - - - - - A - A - 2009-11-18T08:27:39Z - 2009-11-18T08:28:59Z - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/XMLTemplates/default_border.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/XMLTemplates/default_border.xml deleted file mode 100644 index 2a4f753acb..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/XMLTemplates/default_border.xml +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/XMLTemplates/default_fill.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/XMLTemplates/default_fill.xml deleted file mode 100644 index efd3e45ff8..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/XMLTemplates/default_fill.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/XMLTemplates/default_font.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/XMLTemplates/default_font.xml deleted file mode 100644 index 080ea5589d..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/XMLTemplates/default_font.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/XMLTemplates/empty_areaChart.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/XMLTemplates/empty_areaChart.xml deleted file mode 100644 index b81690b22a..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/XMLTemplates/empty_areaChart.xml +++ /dev/null @@ -1,204 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Лист1!$D$5:$D$9 - - General - - - 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/XMLTemplates/empty_barChart.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/XMLTemplates/empty_barChart.xml deleted file mode 100644 index f36246fa2e..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/XMLTemplates/empty_barChart.xml +++ /dev/null @@ -1,198 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Лист1!$E$3:$E$5 - - General - - - 103 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/XMLTemplates/empty_book.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/XMLTemplates/empty_book.xml deleted file mode 100644 index 17b95de848..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/XMLTemplates/empty_book.xml +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/XMLTemplates/empty_bubbleChart.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/XMLTemplates/empty_bubbleChart.xml deleted file mode 100644 index 0e44c28825..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/XMLTemplates/empty_bubbleChart.xml +++ /dev/null @@ -1,207 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Лист1!$D$5:$D$12 - - General - - - 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/XMLTemplates/empty_chartDrawing.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/XMLTemplates/empty_chartDrawing.xml deleted file mode 100644 index fda898808b..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/XMLTemplates/empty_chartDrawing.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - 0 - 0 - 0 - 0 - - - 0 - 0 - 0 - 0 - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/XMLTemplates/empty_chartSeriesItem.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/XMLTemplates/empty_chartSeriesItem.xml deleted file mode 100644 index 301f5c84c5..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/XMLTemplates/empty_chartSeriesItem.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - 0 - - diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/XMLTemplates/empty_doughnutChart.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/XMLTemplates/empty_doughnutChart.xml deleted file mode 100644 index a6883b769c..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/XMLTemplates/empty_doughnutChart.xml +++ /dev/null @@ -1,82 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Лист1!$D$5:$D$12 - - General - - - 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/XMLTemplates/empty_imageDrawing.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/XMLTemplates/empty_imageDrawing.xml deleted file mode 100644 index f27fd46f02..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/XMLTemplates/empty_imageDrawing.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - 0 - 0 - 0 - 0 - - - 0 - 0 - 0 - 0 - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/XMLTemplates/empty_lineChart.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/XMLTemplates/empty_lineChart.xml deleted file mode 100644 index dd7c44bcbc..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/XMLTemplates/empty_lineChart.xml +++ /dev/null @@ -1,201 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Лист1!$B$4:$B$8 - - General - - - 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/XMLTemplates/empty_pieChart.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/XMLTemplates/empty_pieChart.xml deleted file mode 100644 index 0505771bcc..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/XMLTemplates/empty_pieChart.xml +++ /dev/null @@ -1,78 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Лист1!$B$4:$B$8 - - General - - - 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/XMLTemplates/empty_radarChart.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/XMLTemplates/empty_radarChart.xml deleted file mode 100644 index a780a4114c..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/XMLTemplates/empty_radarChart.xml +++ /dev/null @@ -1,206 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Лист1!$D$5:$D$9 - - General - - - 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/XMLTemplates/empty_scatterChart.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/XMLTemplates/empty_scatterChart.xml deleted file mode 100644 index 9f240026e8..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/XMLTemplates/empty_scatterChart.xml +++ /dev/null @@ -1,180 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Лист1!$D$5:$D$7 - - General - - - 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/XMLTemplates/empty_sheet.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/XMLTemplates/empty_sheet.xml deleted file mode 100644 index f5b1e66c74..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/XMLTemplates/empty_sheet.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/XMLTemplates/empty_stockChart.xml b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/XMLTemplates/empty_stockChart.xml deleted file mode 100644 index ace061aa24..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/XMLTemplates/empty_stockChart.xml +++ /dev/null @@ -1,170 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Лист1!$E$6:$E$9 - - General - - - 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/app.config b/ASCOfficeEWSEditor/ASCOfficeEWSEditor/app.config deleted file mode 100644 index b7db28170c..0000000000 --- a/ASCOfficeEWSEditor/ASCOfficeEWSEditor/app.config +++ /dev/null @@ -1,3 +0,0 @@ - - -