Skip to content

Commit efe9e55

Browse files
committed
Refactored stuff
1 parent 462d316 commit efe9e55

File tree

5 files changed

+158
-182
lines changed

5 files changed

+158
-182
lines changed

OpenXmlPowerTools.Tests/WmlContentAtomListTests.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
2-
3-
#define COPY_FILES_FOR_DEBUGGING
1+
#define COPY_FILES_FOR_DEBUGGING
42

53
using DocumentFormat.OpenXml.Packaging;
64
using OpenXmlPowerTools;

OpenXmlPowerTools/FieldRetriever.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
// Copyright (c) Microsoft. All rights reserved.
2-
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
3-
4-
using DocumentFormat.OpenXml.Packaging;
1+
using DocumentFormat.OpenXml.Packaging;
52
using System.Collections.Generic;
63
using System.Linq;
74
using System.Xml.Linq;

OpenXmlPowerTools/MetricsGetter.cs

Lines changed: 140 additions & 145 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
// Copyright (c) Microsoft. All rights reserved.
2-
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
3-
4-
using DocumentFormat.OpenXml.Packaging;
1+
using DocumentFormat.OpenXml.Packaging;
52
using DocumentFormat.OpenXml.Validation;
63
using System;
74
using System.Collections.Generic;
@@ -160,8 +157,7 @@ public static int GetTextWidth(FontFamily ff, FontStyle fs, decimal sz, string t
160157
}
161158
catch (ArgumentException)
162159
{
163-
// if both regular and bold fail, then get metrics for Times New Roman
164-
// use the original FontStyle (in fs)
160+
// if both regular and bold fail, then get metrics for Times New Roman the original FontStyle (in fs)
165161
var ff2 = new FontFamily("Times New Roman");
166162
return _getTextWidth(ff2, fs, sz, text);
167163
}
@@ -246,10 +242,9 @@ private static XElement RetrieveNamespaceList(OpenXmlPackage oxPkg)
246242
uniqueNamespaces.Add(item);
247243
}
248244
}
249-
// if catch exception, forget about it. Just trying to get a most complete survey possible of all namespaces in all documents.
250-
// if caught exception, chances are the document is bad anyway.
251245
catch (Exception)
252246
{
247+
// if catch exception, forget about it. Just trying to get a most complete survey possible of all namespaces in all documents. If caught exception, chances are the document is bad anyway.
253248
continue;
254249
}
255250
}
@@ -1148,142 +1143,142 @@ private static object GetContentControlsTransform(XNode node, MetricsGetterSetti
11481143

11491144
public static class H
11501145
{
1151-
public static XName ActiveX = "ActiveX";
1152-
public static XName Alias = "Alias";
1153-
public static XName AltChunk = "AltChunk";
1154-
public static XName Arguments = "Arguments";
1155-
public static XName AsciiCharCount = "AsciiCharCount";
1156-
public static XName AsciiRunCount = "AsciiRunCount";
1157-
public static XName AverageParagraphLength = "AverageParagraphLength";
1158-
public static XName BaselineReport = "BaselineReport";
1159-
public static XName Batch = "Batch";
1160-
public static XName BatchName = "BatchName";
1161-
public static XName BatchSelector = "BatchSelector";
1162-
public static XName CSCharCount = "CSCharCount";
1163-
public static XName CSRunCount = "CSRunCount";
1164-
public static XName Catalog = "Catalog";
1165-
public static XName CatalogList = "CatalogList";
1166-
public static XName CatalogListFile = "CatalogListFile";
1167-
public static XName CaughtException = "CaughtException";
1168-
public static XName Cell = "Cell";
1169-
public static XName Column = "Column";
1170-
public static XName Columns = "Columns";
1171-
public static XName ComplexField = "ComplexField";
1172-
public static XName Computer = "Computer";
1173-
public static XName Computers = "Computers";
1174-
public static XName ContentControl = "ContentControl";
1175-
public static XName ContentControls = "ContentControls";
1176-
public static XName ContentType = "ContentType";
1177-
public static XName ContentTypes = "ContentTypes";
1178-
public static XName CustomXmlMarkup = "CustomXmlMarkup";
1179-
public static XName DLL = "DLL";
1180-
public static XName DefaultDialogValuesFile = "DefaultDialogValuesFile";
1181-
public static XName DefaultValues = "DefaultValues";
1182-
public static XName Dependencies = "Dependencies";
1183-
public static XName DestinationDir = "DestinationDir";
1184-
public static XName Directory = "Directory";
1185-
public static XName DirectoryPattern = "DirectoryPattern";
1186-
public static XName DisplayName = "DisplayName";
1187-
public static XName DoJobQueueName = "DoJobQueueName";
1188-
public static XName Document = "Document";
1189-
public static XName DocumentProtection = "DocumentProtection";
1190-
public static XName DocumentSelector = "DocumentSelector";
1191-
public static XName DocumentType = "DocumentType";
1192-
public static XName Documents = "Documents";
1193-
public static XName EastAsiaCharCount = "EastAsiaCharCount";
1194-
public static XName EastAsiaRunCount = "EastAsiaRunCount";
1195-
public static XName ElementCount = "ElementCount";
1196-
public static XName EmbeddedXlsx = "EmbeddedXlsx";
1197-
public static XName Error = "Error";
1198-
public static XName Exception = "Exception";
1199-
public static XName Exe = "Exe";
1200-
public static XName ExeRoot = "ExeRoot";
1201-
public static XName Extension = "Extension";
1202-
public static XName File = "File";
1203-
public static XName FileLength = "FileLength";
1204-
public static XName FileName = "FileName";
1205-
public static XName FilePattern = "FilePattern";
1206-
public static XName FileType = "FileType";
1207-
public static XName Guid = "Guid";
1208-
public static XName HAnsiCharCount = "HAnsiCharCount";
1209-
public static XName HAnsiRunCount = "HAnsiRunCount";
1210-
public static XName RevisionTracking = "RevisionTracking";
1211-
public static XName Hyperlink = "Hyperlink";
1212-
public static XName IPAddress = "IPAddress";
1213-
public static XName Id = "Id";
1214-
public static XName Invalid = "Invalid";
1215-
public static XName InvalidHyperlink = "InvalidHyperlink";
1216-
public static XName InvalidHyperlinkException = "InvalidHyperlinkException";
1217-
public static XName InvalidSaveThroughXslt = "InvalidSaveThroughXslt";
1218-
public static XName JobComplete = "JobComplete";
1219-
public static XName JobExe = "JobExe";
1220-
public static XName JobName = "JobName";
1221-
public static XName JobSpec = "JobSpec";
1222-
public static XName Languages = "Languages";
1223-
public static XName LegacyFrame = "LegacyFrame";
1224-
public static XName LocalDoJobQueue = "LocalDoJobQueue";
1225-
public static XName MachineName = "MachineName";
1226-
public static XName MaxConcurrentJobs = "MaxConcurrentJobs";
1227-
public static XName MaxDocumentsInJob = "MaxDocumentsInJob";
1228-
public static XName MaxParagraphLength = "MaxParagraphLength";
1229-
public static XName Message = "Message";
1230-
public static XName Metrics = "Metrics";
1231-
public static XName MultiDirectory = "MultiDirectory";
1232-
public static XName MultiFontRun = "MultiFontRun";
1233-
public static XName MultiServerQueue = "MultiServerQueue";
1234-
public static XName Name = "Name";
1235-
public static XName Namespaces = "Namespaces";
1236-
public static XName Namespace = "Namespace";
1237-
public static XName NamespaceName = "NamespaceName";
1238-
public static XName NamespacePrefix = "NamespacePrefix";
1239-
public static XName Note = "Note";
1240-
public static XName NumberingFormatList = "NumberingFormatList";
1241-
public static XName ObjectDisposedException = "ObjectDisposedException";
1242-
public static XName ParagraphCount = "ParagraphCount";
1243-
public static XName Part = "Part";
1244-
public static XName Parts = "Parts";
1245-
public static XName PassedDocuments = "PassedDocuments";
1246-
public static XName Path = "Path";
1247-
public static XName ProduceCatalog = "ProduceCatalog";
1248-
public static XName ReferenceToNullImage = "ReferenceToNullImage";
1249-
public static XName Report = "Report";
1250-
public static XName Root = "Root";
1251-
public static XName RootDirectory = "RootDirectory";
1252-
public static XName Row = "Row";
1253-
public static XName RunCount = "RunCount";
1254-
public static XName RunWithoutRprCount = "RunWithoutRprCount";
1255-
public static XName SdkValidationError = "SdkValidationError";
1256-
public static XName SdkValidationError2007 = "SdkValidationError2007";
1257-
public static XName SdkValidationError2010 = "SdkValidationError2010";
1258-
public static XName SdkValidationError2013 = "SdkValidationError2013";
1259-
public static XName Sheet = "Sheet";
1260-
public static XName Sheets = "Sheets";
1261-
public static XName SimpleField = "SimpleField";
1262-
public static XName Skip = "Skip";
1263-
public static XName SmartTag = "SmartTag";
1264-
public static XName SourceRootDir = "SourceRootDir";
1265-
public static XName SpawnerJobExeLocation = "SpawnerJobExeLocation";
1266-
public static XName SpawnerReady = "SpawnerReady";
1267-
public static XName Style = "Style";
1268-
public static XName StyleHierarchy = "StyleHierarchy";
1269-
public static XName SubDocument = "SubDocument";
1270-
public static XName Table = "Table";
1271-
public static XName TableData = "TableData";
1272-
public static XName Tag = "Tag";
1273-
public static XName Take = "Take";
1274-
public static XName TextBox = "TextBox";
1275-
public static XName TrackRevisionsEnabled = "TrackRevisionsEnabled";
1276-
public static XName Type = "Type";
1277-
public static XName Uri = "Uri";
1278-
public static XName Val = "Val";
1279-
public static XName Valid = "Valid";
1280-
public static XName WindowStyle = "WindowStyle";
1281-
public static XName XPath = "XPath";
1282-
public static XName ZeroLengthText = "ZeroLengthText";
1283-
public static XName custDataLst = "custDataLst";
1284-
public static XName custShowLst = "custShowLst";
1285-
public static XName kinsoku = "kinsoku";
1286-
public static XName modifyVerifier = "modifyVerifier";
1287-
public static XName photoAlbum = "photoAlbum";
1146+
public static readonly XName ActiveX = "ActiveX";
1147+
public static readonly XName Alias = "Alias";
1148+
public static readonly XName AltChunk = "AltChunk";
1149+
public static readonly XName Arguments = "Arguments";
1150+
public static readonly XName AsciiCharCount = "AsciiCharCount";
1151+
public static readonly XName AsciiRunCount = "AsciiRunCount";
1152+
public static readonly XName AverageParagraphLength = "AverageParagraphLength";
1153+
public static readonly XName BaselineReport = "BaselineReport";
1154+
public static readonly XName Batch = "Batch";
1155+
public static readonly XName BatchName = "BatchName";
1156+
public static readonly XName BatchSelector = "BatchSelector";
1157+
public static readonly XName CSCharCount = "CSCharCount";
1158+
public static readonly XName CSRunCount = "CSRunCount";
1159+
public static readonly XName Catalog = "Catalog";
1160+
public static readonly XName CatalogList = "CatalogList";
1161+
public static readonly XName CatalogListFile = "CatalogListFile";
1162+
public static readonly XName CaughtException = "CaughtException";
1163+
public static readonly XName Cell = "Cell";
1164+
public static readonly XName Column = "Column";
1165+
public static readonly XName Columns = "Columns";
1166+
public static readonly XName ComplexField = "ComplexField";
1167+
public static readonly XName Computer = "Computer";
1168+
public static readonly XName Computers = "Computers";
1169+
public static readonly XName ContentControl = "ContentControl";
1170+
public static readonly XName ContentControls = "ContentControls";
1171+
public static readonly XName ContentType = "ContentType";
1172+
public static readonly XName ContentTypes = "ContentTypes";
1173+
public static readonly XName CustomXmlMarkup = "CustomXmlMarkup";
1174+
public static readonly XName DLL = "DLL";
1175+
public static readonly XName DefaultDialogValuesFile = "DefaultDialogValuesFile";
1176+
public static readonly XName DefaultValues = "DefaultValues";
1177+
public static readonly XName Dependencies = "Dependencies";
1178+
public static readonly XName DestinationDir = "DestinationDir";
1179+
public static readonly XName Directory = "Directory";
1180+
public static readonly XName DirectoryPattern = "DirectoryPattern";
1181+
public static readonly XName DisplayName = "DisplayName";
1182+
public static readonly XName DoJobQueueName = "DoJobQueueName";
1183+
public static readonly XName Document = "Document";
1184+
public static readonly XName DocumentProtection = "DocumentProtection";
1185+
public static readonly XName DocumentSelector = "DocumentSelector";
1186+
public static readonly XName DocumentType = "DocumentType";
1187+
public static readonly XName Documents = "Documents";
1188+
public static readonly XName EastAsiaCharCount = "EastAsiaCharCount";
1189+
public static readonly XName EastAsiaRunCount = "EastAsiaRunCount";
1190+
public static readonly XName ElementCount = "ElementCount";
1191+
public static readonly XName EmbeddedXlsx = "EmbeddedXlsx";
1192+
public static readonly XName Error = "Error";
1193+
public static readonly XName Exception = "Exception";
1194+
public static readonly XName Exe = "Exe";
1195+
public static readonly XName ExeRoot = "ExeRoot";
1196+
public static readonly XName Extension = "Extension";
1197+
public static readonly XName File = "File";
1198+
public static readonly XName FileLength = "FileLength";
1199+
public static readonly XName FileName = "FileName";
1200+
public static readonly XName FilePattern = "FilePattern";
1201+
public static readonly XName FileType = "FileType";
1202+
public static readonly XName Guid = "Guid";
1203+
public static readonly XName HAnsiCharCount = "HAnsiCharCount";
1204+
public static readonly XName HAnsiRunCount = "HAnsiRunCount";
1205+
public static readonly XName RevisionTracking = "RevisionTracking";
1206+
public static readonly XName Hyperlink = "Hyperlink";
1207+
public static readonly XName IPAddress = "IPAddress";
1208+
public static readonly XName Id = "Id";
1209+
public static readonly XName Invalid = "Invalid";
1210+
public static readonly XName InvalidHyperlink = "InvalidHyperlink";
1211+
public static readonly XName InvalidHyperlinkException = "InvalidHyperlinkException";
1212+
public static readonly XName InvalidSaveThroughXslt = "InvalidSaveThroughXslt";
1213+
public static readonly XName JobComplete = "JobComplete";
1214+
public static readonly XName JobExe = "JobExe";
1215+
public static readonly XName JobName = "JobName";
1216+
public static readonly XName JobSpec = "JobSpec";
1217+
public static readonly XName Languages = "Languages";
1218+
public static readonly XName LegacyFrame = "LegacyFrame";
1219+
public static readonly XName LocalDoJobQueue = "LocalDoJobQueue";
1220+
public static readonly XName MachineName = "MachineName";
1221+
public static readonly XName MaxConcurrentJobs = "MaxConcurrentJobs";
1222+
public static readonly XName MaxDocumentsInJob = "MaxDocumentsInJob";
1223+
public static readonly XName MaxParagraphLength = "MaxParagraphLength";
1224+
public static readonly XName Message = "Message";
1225+
public static readonly XName Metrics = "Metrics";
1226+
public static readonly XName MultiDirectory = "MultiDirectory";
1227+
public static readonly XName MultiFontRun = "MultiFontRun";
1228+
public static readonly XName MultiServerQueue = "MultiServerQueue";
1229+
public static readonly XName Name = "Name";
1230+
public static readonly XName Namespaces = "Namespaces";
1231+
public static readonly XName Namespace = "Namespace";
1232+
public static readonly XName NamespaceName = "NamespaceName";
1233+
public static readonly XName NamespacePrefix = "NamespacePrefix";
1234+
public static readonly XName Note = "Note";
1235+
public static readonly XName NumberingFormatList = "NumberingFormatList";
1236+
public static readonly XName ObjectDisposedException = "ObjectDisposedException";
1237+
public static readonly XName ParagraphCount = "ParagraphCount";
1238+
public static readonly XName Part = "Part";
1239+
public static readonly XName Parts = "Parts";
1240+
public static readonly XName PassedDocuments = "PassedDocuments";
1241+
public static readonly XName Path = "Path";
1242+
public static readonly XName ProduceCatalog = "ProduceCatalog";
1243+
public static readonly XName ReferenceToNullImage = "ReferenceToNullImage";
1244+
public static readonly XName Report = "Report";
1245+
public static readonly XName Root = "Root";
1246+
public static readonly XName RootDirectory = "RootDirectory";
1247+
public static readonly XName Row = "Row";
1248+
public static readonly XName RunCount = "RunCount";
1249+
public static readonly XName RunWithoutRprCount = "RunWithoutRprCount";
1250+
public static readonly XName SdkValidationError = "SdkValidationError";
1251+
public static readonly XName SdkValidationError2007 = "SdkValidationError2007";
1252+
public static readonly XName SdkValidationError2010 = "SdkValidationError2010";
1253+
public static readonly XName SdkValidationError2013 = "SdkValidationError2013";
1254+
public static readonly XName Sheet = "Sheet";
1255+
public static readonly XName Sheets = "Sheets";
1256+
public static readonly XName SimpleField = "SimpleField";
1257+
public static readonly XName Skip = "Skip";
1258+
public static readonly XName SmartTag = "SmartTag";
1259+
public static readonly XName SourceRootDir = "SourceRootDir";
1260+
public static readonly XName SpawnerJobExeLocation = "SpawnerJobExeLocation";
1261+
public static readonly XName SpawnerReady = "SpawnerReady";
1262+
public static readonly XName Style = "Style";
1263+
public static readonly XName StyleHierarchy = "StyleHierarchy";
1264+
public static readonly XName SubDocument = "SubDocument";
1265+
public static readonly XName Table = "Table";
1266+
public static readonly XName TableData = "TableData";
1267+
public static readonly XName Tag = "Tag";
1268+
public static readonly XName Take = "Take";
1269+
public static readonly XName TextBox = "TextBox";
1270+
public static readonly XName TrackRevisionsEnabled = "TrackRevisionsEnabled";
1271+
public static readonly XName Type = "Type";
1272+
public static readonly XName Uri = "Uri";
1273+
public static readonly XName Val = "Val";
1274+
public static readonly XName Valid = "Valid";
1275+
public static readonly XName WindowStyle = "WindowStyle";
1276+
public static readonly XName XPath = "XPath";
1277+
public static readonly XName ZeroLengthText = "ZeroLengthText";
1278+
public static readonly XName custDataLst = "custDataLst";
1279+
public static readonly XName custShowLst = "custShowLst";
1280+
public static readonly XName kinsoku = "kinsoku";
1281+
public static readonly XName modifyVerifier = "modifyVerifier";
1282+
public static readonly XName photoAlbum = "photoAlbum";
12881283
}
12891284
}

0 commit comments

Comments
 (0)