From 70675bfda9773a31be43502d18825b5025221aff Mon Sep 17 00:00:00 2001 From: Guust Ysebie Date: Thu, 20 Jun 2024 15:39:36 +0200 Subject: [PATCH 1/3] Ignore interal methods in manual files DEVSIX-8355 --- doxyfile | 2 +- itext/itext.barcodes/itext/barcodes/BarcodesExtensions.cs | 2 ++ .../itext/bouncycastle/BouncyCastleFactory.cs | 2 ++ .../itext/bouncycastle/BouncyCastleUtil.cs | 4 +++- .../BouncyCastleConnectorExtensions.cs | 2 ++ .../itext/bouncycastlefips/BouncyCastleFipsUtil.cs | 2 ++ .../itext/bouncycastlefips/cert/X509CrlEntryBCFips.cs | 2 ++ .../itext/bouncycastlefips/tsp/TimeStampTokenBCFips.cs | 2 ++ itext/itext.commons/itext/commons/CommonsExtension.cs | 2 ++ .../itext/commons/utils/Collections/EmptyDictionary.cs | 2 ++ .../itext/commons/utils/Collections/EmptyEnumerator.cs | 2 ++ .../itext/commons/utils/Collections/EmptyList.cs | 2 ++ .../itext/commons/utils/Collections/EmptySet.cs | 2 ++ .../commons/utils/Collections/EnumerableExtentions.cs | 2 ++ .../itext/commons/utils/Collections/SingletonList.cs | 2 ++ .../itext/commons/utils/Collections/SingletonSet.cs | 2 ++ .../commons/utils/Collections/UnmodifiableCollection.cs | 2 ++ .../commons/utils/Collections/UnmodifiableDictionary.cs | 2 ++ .../itext/commons/utils/Collections/UnmodifiableList.cs | 2 ++ .../itext/commons/utils/Collections/UnmodifiableSet.cs | 2 ++ itext/itext.commons/itext/commons/utils/SortUtil.cs | 2 ++ itext/itext.commons/itext/commons/utils/SystemUtil.cs | 3 ++- itext/itext.forms/itext/forms/FormsExtensions.cs | 2 ++ itext/itext.forms/itext/forms/xfa/Xml2Som.cs | 2 ++ itext/itext.forms/itext/forms/xfa/Xml2SomDatasets.cs | 2 ++ itext/itext.forms/itext/forms/xfdf/XfdfFileUtils.cs | 2 ++ itext/itext.io/itext/io/IOExtensions.cs | 2 ++ itext/itext.io/itext/io/image/DrawingImageFactory.cs | 2 ++ itext/itext.kernel/KernelExtensions.cs | 3 ++- .../itext/kernel/crypto/securityhandler/EncryptionUtils.cs | 2 ++ .../itext/kernel/pdf/MemoryLimitsAwareOutputStream.cs | 2 ++ .../itext/kernel/pdf/PdfArrayDirectIterator.cs | 2 ++ .../itext.kernel/itext/kernel/pdf/PdfDictionaryEntrySet.cs | 2 ++ itext/itext.kernel/itext/kernel/pdf/PdfDictionaryValues.cs | 2 ++ itext/itext.kernel/itext/kernel/pdf/PdfNameLoader.cs | 2 ++ itext/itext.kernel/itext/kernel/utils/IdleOutputStream.cs | 2 ++ .../itext.kernel/itext/kernel/utils/TaggedPdfReaderTool.cs | 2 ++ .../itext/kernel/xmp/impl/CountOutputStream.cs | 2 ++ .../itext.kernel/itext/kernel/xmp/impl/ISO8601Converter.cs | 2 ++ itext/itext.kernel/itext/kernel/xmp/impl/ParseRdf.cs | 2 ++ itext/itext.kernel/itext/kernel/xmp/impl/XMPMetaImpl.cs | 2 ++ itext/itext.kernel/itext/kernel/xmp/impl/XMPNodeUtils.cs | 2 ++ itext/itext.kernel/itext/kernel/xmp/impl/XMPNormalizer.cs | 4 +++- .../itext/kernel/xmp/impl/XMPSchemaRegistryImpl.cs | 3 ++- .../itext.kernel/itext/kernel/xmp/impl/XMPSerializerRdf.cs | 4 +++- .../itext.layout/Properties/TypographyVersionAttribute.cs | 2 ++ itext/itext.layout/itext/layout/LayoutExtensions.cs | 2 ++ .../itext.layout/itext/layout/hyphenation/PatternParser.cs | 7 +++++-- itext/itext.pdfa/itext/pdfa/PdfAExtensions.cs | 2 ++ itext/itext.pdftest/itext/test/WrappedSamplesRunner.cs | 3 ++- itext/itext.pdfua/PdfUaExtensions.cs | 3 ++- itext/itext.sign/itext/signatures/SignExtensions.cs | 3 ++- itext/itext.sign/itext/signatures/SignUtils.cs | 2 ++ .../validation/v1/SignatureValidationProperties.cs | 4 ++++ itext/itext.styledxmlparser/StyledXmlParserExtensions.cs | 3 ++- .../styledxmlparser/css/parse/CssSelectorParserMatch.cs | 2 ++ .../resolver/resource/LimitedInputStream.cs | 2 ++ .../styledxmlparser/resolver/resource/UriEncodeUtil.cs | 2 ++ itext/itext.svg/SvgExtensions.cs | 3 ++- 59 files changed, 125 insertions(+), 14 deletions(-) diff --git a/doxyfile b/doxyfile index 5322f00ee1..bd9aa5d894 100644 --- a/doxyfile +++ b/doxyfile @@ -485,7 +485,7 @@ EXTRACT_PRIV_VIRTUAL = NO # scope will be included in the documentation. # The default value is: NO. -EXTRACT_PACKAGE = NO +EXTRACT_PACKAGE = YES # If the EXTRACT_STATIC tag is set to YES, all static members of a file will be # included in the documentation. diff --git a/itext/itext.barcodes/itext/barcodes/BarcodesExtensions.cs b/itext/itext.barcodes/itext/barcodes/BarcodesExtensions.cs index 380ad6e0e7..473ca079d5 100644 --- a/itext/itext.barcodes/itext/barcodes/BarcodesExtensions.cs +++ b/itext/itext.barcodes/itext/barcodes/BarcodesExtensions.cs @@ -26,6 +26,7 @@ You should have received a copy of the GNU Affero General Public License using iText.Commons.Utils; namespace iText.Barcodes { + //\cond DO_NOT_DOCUMENT internal static class BarcodesExtensions { public static byte[] GetBytes(this String str, String encoding) { return EncodingUtil.GetEncoding(encoding).GetBytes(str); @@ -69,4 +70,5 @@ public static Assembly GetAssembly(this Type type) { #endif } } + //\endcond } diff --git a/itext/itext.bouncy-castle-adapter/itext/bouncycastle/BouncyCastleFactory.cs b/itext/itext.bouncy-castle-adapter/itext/bouncycastle/BouncyCastleFactory.cs index 5f95d03935..d764e0c83b 100644 --- a/itext/itext.bouncy-castle-adapter/itext/bouncycastle/BouncyCastleFactory.cs +++ b/itext/itext.bouncy-castle-adapter/itext/bouncycastle/BouncyCastleFactory.cs @@ -1170,6 +1170,7 @@ public string CreateEndDate(IX509Certificate certificate) { return certificate.GetEndDateTime(); } + //\cond DO_NOT_DOCUMENT internal class BouncyCastlePasswordFinder : IPasswordFinder { private readonly char[] password; @@ -1181,5 +1182,6 @@ public char[] GetPassword() { return password; } } + //\endcond } } diff --git a/itext/itext.bouncy-castle-adapter/itext/bouncycastle/BouncyCastleUtil.cs b/itext/itext.bouncy-castle-adapter/itext/bouncycastle/BouncyCastleUtil.cs index 758537151d..bcc31a2e59 100644 --- a/itext/itext.bouncy-castle-adapter/itext/bouncycastle/BouncyCastleUtil.cs +++ b/itext/itext.bouncy-castle-adapter/itext/bouncycastle/BouncyCastleUtil.cs @@ -20,7 +20,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the You should have received a copy of the GNU Affero General Public License along with this program. If not, see . */ -using System.Collections.Generic; +using System.Collections.Generic; using System.IO; using iText.Bouncycastle.X509; using iText.Commons.Bouncycastle; @@ -31,6 +31,7 @@ You should have received a copy of the GNU Affero General Public License using Org.BouncyCastle.X509; namespace iText.Bouncycastle { + //\cond DO_NOT_DOCUMENT internal class BouncyCastleUtil : IBouncyCastleUtil { internal BouncyCastleUtil() { @@ -56,4 +57,5 @@ public virtual List ReadPkcs7Certs(Stream data) { } } } + //\endcond } diff --git a/itext/itext.bouncy-castle-connector/itext/bouncycastleconnector/BouncyCastleConnectorExtensions.cs b/itext/itext.bouncy-castle-connector/itext/bouncycastleconnector/BouncyCastleConnectorExtensions.cs index 7ef2599973..b770d441b2 100644 --- a/itext/itext.bouncy-castle-connector/itext/bouncycastleconnector/BouncyCastleConnectorExtensions.cs +++ b/itext/itext.bouncy-castle-connector/itext/bouncycastleconnector/BouncyCastleConnectorExtensions.cs @@ -23,6 +23,7 @@ You should have received a copy of the GNU Affero General Public License using System.Collections.Generic; namespace iText.Bouncycastleconnector { + //\cond DO_NOT_DOCUMENT internal static class BouncyCastleConnectorExtensions { public static TValue Get(this IDictionary col, TKey key) { TValue value = default(TValue); @@ -39,4 +40,5 @@ public static TValue Put(this IDictionary col, TKey return oldVal; } } + //\endcond } diff --git a/itext/itext.bouncy-castle-fips-adapter/itext/bouncycastlefips/BouncyCastleFipsUtil.cs b/itext/itext.bouncy-castle-fips-adapter/itext/bouncycastlefips/BouncyCastleFipsUtil.cs index fbe149951f..5703c6784f 100644 --- a/itext/itext.bouncy-castle-fips-adapter/itext/bouncycastlefips/BouncyCastleFipsUtil.cs +++ b/itext/itext.bouncy-castle-fips-adapter/itext/bouncycastlefips/BouncyCastleFipsUtil.cs @@ -31,6 +31,7 @@ You should have received a copy of the GNU Affero General Public License using Org.BouncyCastle.OpenSsl; namespace iText.Bouncycastlefips { + //\cond DO_NOT_DOCUMENT internal class BouncyCastleFipsUtil : IBouncyCastleUtil { internal BouncyCastleFipsUtil() { @@ -56,4 +57,5 @@ public virtual List ReadPkcs7Certs(Stream data) { } } } + //\endcond } diff --git a/itext/itext.bouncy-castle-fips-adapter/itext/bouncycastlefips/cert/X509CrlEntryBCFips.cs b/itext/itext.bouncy-castle-fips-adapter/itext/bouncycastlefips/cert/X509CrlEntryBCFips.cs index a7418cc55d..5b2a89ce69 100644 --- a/itext/itext.bouncy-castle-fips-adapter/itext/bouncycastlefips/cert/X509CrlEntryBCFips.cs +++ b/itext/itext.bouncy-castle-fips-adapter/itext/bouncycastlefips/cert/X509CrlEntryBCFips.cs @@ -29,6 +29,7 @@ You should have received a copy of the GNU Affero General Public License namespace iText.Bouncycastlefips.Cert { + //\cond DO_NOT_DOCUMENT internal class X509CrlEntryBCFips : IX509CrlEntry { private X509CrlEntry entry; @@ -56,4 +57,5 @@ public IBigInteger GetSerialNumber() return new BigIntegerBCFips(entry.SerialNumber); } } + //\endcond } \ No newline at end of file diff --git a/itext/itext.bouncy-castle-fips-adapter/itext/bouncycastlefips/tsp/TimeStampTokenBCFips.cs b/itext/itext.bouncy-castle-fips-adapter/itext/bouncycastlefips/tsp/TimeStampTokenBCFips.cs index 8dfcb18740..a25a7fa403 100644 --- a/itext/itext.bouncy-castle-fips-adapter/itext/bouncycastlefips/tsp/TimeStampTokenBCFips.cs +++ b/itext/itext.bouncy-castle-fips-adapter/itext/bouncycastlefips/tsp/TimeStampTokenBCFips.cs @@ -256,6 +256,7 @@ private class CertID { private EssCertID certID; private EssCertIDv2 certIDv2; + //\cond DO_NOT_DOCUMENT internal CertID(EssCertID certID) { this.certID = certID; this.certIDv2 = null; @@ -265,6 +266,7 @@ internal CertID(EssCertIDv2 certID) { this.certIDv2 = certID; this.certID = null; } + //\endcond public string GetHashAlgorithmName() { if (certID != null) diff --git a/itext/itext.commons/itext/commons/CommonsExtension.cs b/itext/itext.commons/itext/commons/CommonsExtension.cs index a8e12f3173..9498332b92 100644 --- a/itext/itext.commons/itext/commons/CommonsExtension.cs +++ b/itext/itext.commons/itext/commons/CommonsExtension.cs @@ -30,6 +30,7 @@ You should have received a copy of the GNU Affero General Public License namespace iText.Commons { + //\cond DO_NOT_DOCUMENT internal static class EventsExtension { public static String JSubstring(this String str, int beginIndex, int endIndex) { @@ -241,4 +242,5 @@ public static Assembly GetAssembly(this Type type) { #endif } } + //\endcond } diff --git a/itext/itext.commons/itext/commons/utils/Collections/EmptyDictionary.cs b/itext/itext.commons/itext/commons/utils/Collections/EmptyDictionary.cs index 0a8dd003ab..0a74ecc036 100644 --- a/itext/itext.commons/itext/commons/utils/Collections/EmptyDictionary.cs +++ b/itext/itext.commons/itext/commons/utils/Collections/EmptyDictionary.cs @@ -25,6 +25,7 @@ You should have received a copy of the GNU Affero General Public License using System.Collections.Generic; namespace iText.Commons.Utils.Collections { + //\cond DO_NOT_DOCUMENT internal class EmptyDictionary : IDictionary { public IEnumerator> GetEnumerator() { yield break; @@ -90,4 +91,5 @@ public ICollection Values { get { return new EmptySet(); } } } + //\endcond } diff --git a/itext/itext.commons/itext/commons/utils/Collections/EmptyEnumerator.cs b/itext/itext.commons/itext/commons/utils/Collections/EmptyEnumerator.cs index 737167e440..13dab7178a 100644 --- a/itext/itext.commons/itext/commons/utils/Collections/EmptyEnumerator.cs +++ b/itext/itext.commons/itext/commons/utils/Collections/EmptyEnumerator.cs @@ -26,6 +26,7 @@ You should have received a copy of the GNU Affero General Public License namespace iText.Commons.Utils.Collections { + //\cond DO_NOT_DOCUMENT internal class EmptyEnumerator : IEnumerator { public void Dispose() { @@ -71,4 +72,5 @@ object IEnumerator.Current { get { return Current; } } } + //\endcond } diff --git a/itext/itext.commons/itext/commons/utils/Collections/EmptyList.cs b/itext/itext.commons/itext/commons/utils/Collections/EmptyList.cs index 68082caae9..62b008e574 100644 --- a/itext/itext.commons/itext/commons/utils/Collections/EmptyList.cs +++ b/itext/itext.commons/itext/commons/utils/Collections/EmptyList.cs @@ -26,6 +26,7 @@ You should have received a copy of the GNU Affero General Public License namespace iText.Commons.Utils.Collections { + //\cond DO_NOT_DOCUMENT internal class EmptyList : IList { public IEnumerator GetEnumerator() { yield break; @@ -78,4 +79,5 @@ public T this[int index] { set { throw new NotSupportedException("Collection is read-only."); } } } + //\endcond } diff --git a/itext/itext.commons/itext/commons/utils/Collections/EmptySet.cs b/itext/itext.commons/itext/commons/utils/Collections/EmptySet.cs index da5572b746..6b685c86b7 100644 --- a/itext/itext.commons/itext/commons/utils/Collections/EmptySet.cs +++ b/itext/itext.commons/itext/commons/utils/Collections/EmptySet.cs @@ -27,6 +27,7 @@ You should have received a copy of the GNU Affero General Public License namespace iText.Commons.Utils.Collections { + //\cond DO_NOT_DOCUMENT internal class EmptySet : ISet { public IEnumerator GetEnumerator() { yield break; @@ -109,4 +110,5 @@ public bool IsReadOnly { get { return true; } } } + //\endcond } diff --git a/itext/itext.commons/itext/commons/utils/Collections/EnumerableExtentions.cs b/itext/itext.commons/itext/commons/utils/Collections/EnumerableExtentions.cs index 77722f0b74..16965a7a0b 100644 --- a/itext/itext.commons/itext/commons/utils/Collections/EnumerableExtentions.cs +++ b/itext/itext.commons/itext/commons/utils/Collections/EnumerableExtentions.cs @@ -27,6 +27,7 @@ You should have received a copy of the GNU Affero General Public License namespace iText.Commons.Utils.Collections { + //\cond DO_NOT_DOCUMENT internal static class EnumerableExtentions { public static IEnumerable Sorted(this IEnumerable source, Comparison comp) @@ -39,4 +40,5 @@ public static IEnumerable Sorted(this IEnumerable source) return source.OrderBy(x => x); } } + //\endcond } diff --git a/itext/itext.commons/itext/commons/utils/Collections/SingletonList.cs b/itext/itext.commons/itext/commons/utils/Collections/SingletonList.cs index e6692cafe4..e04c9c15f6 100644 --- a/itext/itext.commons/itext/commons/utils/Collections/SingletonList.cs +++ b/itext/itext.commons/itext/commons/utils/Collections/SingletonList.cs @@ -26,6 +26,7 @@ You should have received a copy of the GNU Affero General Public License namespace iText.Commons.Utils.Collections { + //\cond DO_NOT_DOCUMENT internal class SingletonList : IList { private readonly T element; @@ -94,4 +95,5 @@ public T this[int index] { set { throw new NotSupportedException("Collection is read-only."); } } } + //\endcond } diff --git a/itext/itext.commons/itext/commons/utils/Collections/SingletonSet.cs b/itext/itext.commons/itext/commons/utils/Collections/SingletonSet.cs index 37213f34ef..d4613d1106 100644 --- a/itext/itext.commons/itext/commons/utils/Collections/SingletonSet.cs +++ b/itext/itext.commons/itext/commons/utils/Collections/SingletonSet.cs @@ -26,6 +26,7 @@ You should have received a copy of the GNU Affero General Public License using System.Linq; namespace iText.Commons.Utils.Collections { + //\cond DO_NOT_DOCUMENT internal class SingletonSet : ISet { private T element; @@ -139,4 +140,5 @@ private bool elementsEqual(T one, T another) { return one == null && another == null || one != null && one.Equals(another); } } + //\endcond } diff --git a/itext/itext.commons/itext/commons/utils/Collections/UnmodifiableCollection.cs b/itext/itext.commons/itext/commons/utils/Collections/UnmodifiableCollection.cs index a7f91bf085..c56d41a275 100644 --- a/itext/itext.commons/itext/commons/utils/Collections/UnmodifiableCollection.cs +++ b/itext/itext.commons/itext/commons/utils/Collections/UnmodifiableCollection.cs @@ -26,6 +26,7 @@ You should have received a copy of the GNU Affero General Public License namespace iText.Commons.Utils.Collections { + //\cond DO_NOT_DOCUMENT internal class UnmodifiableCollection : ICollection { private ICollection _collection; @@ -69,4 +70,5 @@ public bool IsReadOnly { get { return true; } } } + //\endcond } diff --git a/itext/itext.commons/itext/commons/utils/Collections/UnmodifiableDictionary.cs b/itext/itext.commons/itext/commons/utils/Collections/UnmodifiableDictionary.cs index 40e7caa9c3..f1a5344caf 100644 --- a/itext/itext.commons/itext/commons/utils/Collections/UnmodifiableDictionary.cs +++ b/itext/itext.commons/itext/commons/utils/Collections/UnmodifiableDictionary.cs @@ -26,6 +26,7 @@ You should have received a copy of the GNU Affero General Public License namespace iText.Commons.Utils.Collections { + //\cond DO_NOT_DOCUMENT internal class UnmodifiableDictionary : IDictionary { private IDictionary _dict; @@ -98,4 +99,5 @@ public ICollection Values { get { return _dict.Values; } } } + //\endcond } diff --git a/itext/itext.commons/itext/commons/utils/Collections/UnmodifiableList.cs b/itext/itext.commons/itext/commons/utils/Collections/UnmodifiableList.cs index 0ab805a6ef..140876d81c 100644 --- a/itext/itext.commons/itext/commons/utils/Collections/UnmodifiableList.cs +++ b/itext/itext.commons/itext/commons/utils/Collections/UnmodifiableList.cs @@ -26,6 +26,7 @@ You should have received a copy of the GNU Affero General Public License namespace iText.Commons.Utils.Collections { + //\cond DO_NOT_DOCUMENT internal class UnmodifiableList : IList { private IList _list; @@ -94,4 +95,5 @@ public IEnumerator GetEnumerator() { return _list.GetEnumerator(); } } + //\endcond } diff --git a/itext/itext.commons/itext/commons/utils/Collections/UnmodifiableSet.cs b/itext/itext.commons/itext/commons/utils/Collections/UnmodifiableSet.cs index e9ae1c0d13..35ea2942ca 100644 --- a/itext/itext.commons/itext/commons/utils/Collections/UnmodifiableSet.cs +++ b/itext/itext.commons/itext/commons/utils/Collections/UnmodifiableSet.cs @@ -26,6 +26,7 @@ You should have received a copy of the GNU Affero General Public License namespace iText.Commons.Utils.Collections { + //\cond DO_NOT_DOCUMENT internal class UnmodifiableSet : ISet { private ISet _set; @@ -113,4 +114,5 @@ public bool IsReadOnly { get { return true; } } } + //\endcond } diff --git a/itext/itext.commons/itext/commons/utils/SortUtil.cs b/itext/itext.commons/itext/commons/utils/SortUtil.cs index e9f3e881f6..6781120c10 100644 --- a/itext/itext.commons/itext/commons/utils/SortUtil.cs +++ b/itext/itext.commons/itext/commons/utils/SortUtil.cs @@ -128,10 +128,12 @@ private static void Merge(T[] array, int left, int mid, int right, IComparer< } } + //\cond DO_NOT_DOCUMENT internal class StringOrdinalComparator : IComparer { public int Compare(String x, String y) { return String.CompareOrdinal(x, y); } } + //\endcond } } diff --git a/itext/itext.commons/itext/commons/utils/SystemUtil.cs b/itext/itext.commons/itext/commons/utils/SystemUtil.cs index f7dfe50f25..c080a057cd 100644 --- a/itext/itext.commons/itext/commons/utils/SystemUtil.cs +++ b/itext/itext.commons/itext/commons/utils/SystemUtil.cs @@ -126,7 +126,7 @@ public static StringBuilder RunProcessAndCollectErrors(String exec, String @para return errorsBuilder; } - + //\cond DO_NOT_DOCUMENT internal static void SetProcessStartInfo(Process proc, String exec, String @params) { SetProcessStartInfo(proc, exec, @params, null); } @@ -209,5 +209,6 @@ internal static StringBuilder GetProcessErrorsOutput(Process p) { return bre; } + //\endcond } } diff --git a/itext/itext.forms/itext/forms/FormsExtensions.cs b/itext/itext.forms/itext/forms/FormsExtensions.cs index 3e29f4a1cc..5503044fcf 100644 --- a/itext/itext.forms/itext/forms/FormsExtensions.cs +++ b/itext/itext.forms/itext/forms/FormsExtensions.cs @@ -28,6 +28,7 @@ You should have received a copy of the GNU Affero General Public License using System.Text; namespace iText.Forms { + //\cond DO_NOT_DOCUMENT internal static class FormsExtensions { public static void AddAll(this ICollection t, IEnumerable newItems) { foreach (T item in newItems) { @@ -147,4 +148,5 @@ public static void Add(this IList list, int index, T elem) { list.Insert(index, elem); } } + //\endcond } diff --git a/itext/itext.forms/itext/forms/xfa/Xml2Som.cs b/itext/itext.forms/itext/forms/xfa/Xml2Som.cs index 23aa6a36db..ef68ad0923 100644 --- a/itext/itext.forms/itext/forms/xfa/Xml2Som.cs +++ b/itext/itext.forms/itext/forms/xfa/Xml2Som.cs @@ -28,6 +28,7 @@ You should have received a copy of the GNU Affero General Public License namespace iText.Forms.Xfa { + //\cond DO_NOT_DOCUMENT /// A class for some basic SOM processing. internal class Xml2Som { @@ -322,4 +323,5 @@ public virtual void SetInverseSearch(IDictionary inverseSe this.inverseSearch = inverseSearch; } } + //\endcond } diff --git a/itext/itext.forms/itext/forms/xfa/Xml2SomDatasets.cs b/itext/itext.forms/itext/forms/xfa/Xml2SomDatasets.cs index b189b5f771..97ac273491 100644 --- a/itext/itext.forms/itext/forms/xfa/Xml2SomDatasets.cs +++ b/itext/itext.forms/itext/forms/xfa/Xml2SomDatasets.cs @@ -27,6 +27,7 @@ You should have received a copy of the GNU Affero General Public License namespace iText.Forms.Xfa { + //\cond DO_NOT_DOCUMENT /// Processes the datasets section in the XFA form. internal class Xml2SomDatasets : Xml2Som { @@ -161,4 +162,5 @@ private void ProcessDatasetsInternal(XNode n) } } } + //\endcond } diff --git a/itext/itext.forms/itext/forms/xfdf/XfdfFileUtils.cs b/itext/itext.forms/itext/forms/xfdf/XfdfFileUtils.cs index 13cd6fc40d..04680856df 100644 --- a/itext/itext.forms/itext/forms/xfdf/XfdfFileUtils.cs +++ b/itext/itext.forms/itext/forms/xfdf/XfdfFileUtils.cs @@ -28,6 +28,7 @@ You should have received a copy of the GNU Affero General Public License namespace iText.Forms.Xfdf { + //\cond DO_NOT_DOCUMENT internal sealed class XfdfFileUtils { private XfdfFileUtils() @@ -66,4 +67,5 @@ internal static void SaveXfdfDocumentToFile(XmlDocument document, Stream outputS outputStream.Dispose(); } } + //\endcond } diff --git a/itext/itext.io/itext/io/IOExtensions.cs b/itext/itext.io/itext/io/IOExtensions.cs index a1fbfd5f4c..1163c631a9 100644 --- a/itext/itext.io/itext/io/IOExtensions.cs +++ b/itext/itext.io/itext/io/IOExtensions.cs @@ -28,6 +28,7 @@ You should have received a copy of the GNU Affero General Public License using iText.Commons.Utils.Collections; namespace iText.IO { + //\cond DO_NOT_DOCUMENT internal static class IOExtensions { public static String JSubstring(this String str, int beginIndex, int endIndex) { return str.Substring(beginIndex, endIndex - beginIndex); @@ -182,4 +183,5 @@ public static Assembly GetAssembly(this Type type) { #endif } } + //\endcond } diff --git a/itext/itext.io/itext/io/image/DrawingImageFactory.cs b/itext/itext.io/itext/io/image/DrawingImageFactory.cs index 869a127bcb..e926ce3554 100644 --- a/itext/itext.io/itext/io/image/DrawingImageFactory.cs +++ b/itext/itext.io/itext/io/image/DrawingImageFactory.cs @@ -28,6 +28,7 @@ You should have received a copy of the GNU Affero General Public License using System.IO; namespace iText.IO.Image { + //\cond DO_NOT_DOCUMENT internal class DrawingImageFactory { /// Gets an instance of an Image from /// the to convert @@ -224,5 +225,6 @@ public static ImageData GetImage(System.Drawing.Image image, System.Drawing.Imag return ImageDataFactory.Create(ms.ToArray()); } } + //\endcond } #endif diff --git a/itext/itext.kernel/KernelExtensions.cs b/itext/itext.kernel/KernelExtensions.cs index fca6151043..387aebc76c 100644 --- a/itext/itext.kernel/KernelExtensions.cs +++ b/itext/itext.kernel/KernelExtensions.cs @@ -31,7 +31,7 @@ You should have received a copy of the GNU Affero General Public License using System.Text.RegularExpressions; using iText.Commons.Utils; using iText.Commons.Utils.Collections; - +//\cond DO_NOT_DOCUMENT internal static class KernelExtensions { public static String JSubstring(this String str, int beginIndex, int endIndex) { return str.Substring(beginIndex, endIndex - beginIndex); @@ -423,3 +423,4 @@ public static byte[] GetBuffer(this MemoryStream memoryStream) { } #endif } +//\endcond \ No newline at end of file diff --git a/itext/itext.kernel/itext/kernel/crypto/securityhandler/EncryptionUtils.cs b/itext/itext.kernel/itext/kernel/crypto/securityhandler/EncryptionUtils.cs index 9f1804eb3c..a62552d277 100644 --- a/itext/itext.kernel/itext/kernel/crypto/securityhandler/EncryptionUtils.cs +++ b/itext/itext.kernel/itext/kernel/crypto/securityhandler/EncryptionUtils.cs @@ -37,6 +37,7 @@ You should have received a copy of the GNU Affero General Public License using iText.Kernel.Pdf; namespace iText.Kernel.Crypto.Securityhandler { + //\cond DO_NOT_DOCUMENT internal sealed class EncryptionUtils { // 256-bit AES-CBC, PKCS#5 padding // Not ideal, but the best that the PDF standard allows. @@ -142,4 +143,5 @@ internal class DERForRecipientParams { internal IAlgorithmIdentifier algorithmIdentifier; } } + //\endcond } diff --git a/itext/itext.kernel/itext/kernel/pdf/MemoryLimitsAwareOutputStream.cs b/itext/itext.kernel/itext/kernel/pdf/MemoryLimitsAwareOutputStream.cs index 6b3175da65..71dc351f91 100644 --- a/itext/itext.kernel/itext/kernel/pdf/MemoryLimitsAwareOutputStream.cs +++ b/itext/itext.kernel/itext/kernel/pdf/MemoryLimitsAwareOutputStream.cs @@ -27,6 +27,7 @@ You should have received a copy of the GNU Affero General Public License using iText.Kernel.Exceptions; namespace iText.Kernel.Pdf { + //\cond DO_NOT_DOCUMENT /// This class implements an output stream which can be used for memory limits aware decompression of pdf streams. /// internal class MemoryLimitsAwareOutputStream : MemoryStream { @@ -111,4 +112,5 @@ public override void Write(byte[] b, int off, int len) { base.Write(b, off, len); } } + //\endcond } diff --git a/itext/itext.kernel/itext/kernel/pdf/PdfArrayDirectIterator.cs b/itext/itext.kernel/itext/kernel/pdf/PdfArrayDirectIterator.cs index e0cbdf131d..48bf23b9d6 100644 --- a/itext/itext.kernel/itext/kernel/pdf/PdfArrayDirectIterator.cs +++ b/itext/itext.kernel/itext/kernel/pdf/PdfArrayDirectIterator.cs @@ -24,6 +24,7 @@ You should have received a copy of the GNU Affero General Public License using System.Collections.Generic; namespace iText.Kernel.Pdf { + //\cond DO_NOT_DOCUMENT internal class PdfArrayDirectIterator : IEnumerator { private IEnumerator parentEnumerator; @@ -65,4 +66,5 @@ object IEnumerator.Current get { return Current; } } } + //\endcond } diff --git a/itext/itext.kernel/itext/kernel/pdf/PdfDictionaryEntrySet.cs b/itext/itext.kernel/itext/kernel/pdf/PdfDictionaryEntrySet.cs index 09c2e0c1f4..96b7745895 100644 --- a/itext/itext.kernel/itext/kernel/pdf/PdfDictionaryEntrySet.cs +++ b/itext/itext.kernel/itext/kernel/pdf/PdfDictionaryEntrySet.cs @@ -25,6 +25,7 @@ You should have received a copy of the GNU Affero General Public License using System.Collections.Generic; namespace iText.Kernel.Pdf { + //\cond DO_NOT_DOCUMENT internal class PdfDictionaryEntrySet : ICollection> { private readonly ICollection> collection; @@ -155,4 +156,5 @@ object IEnumerator.Current } } } + //\endcond } diff --git a/itext/itext.kernel/itext/kernel/pdf/PdfDictionaryValues.cs b/itext/itext.kernel/itext/kernel/pdf/PdfDictionaryValues.cs index 4dd04c2567..e181e03018 100644 --- a/itext/itext.kernel/itext/kernel/pdf/PdfDictionaryValues.cs +++ b/itext/itext.kernel/itext/kernel/pdf/PdfDictionaryValues.cs @@ -26,6 +26,7 @@ You should have received a copy of the GNU Affero General Public License namespace iText.Kernel.Pdf { + //\cond DO_NOT_DOCUMENT internal class PdfDictionaryValues : ICollection { private readonly ICollection collection; @@ -150,4 +151,5 @@ object IEnumerator.Current } } } + //\endcond } diff --git a/itext/itext.kernel/itext/kernel/pdf/PdfNameLoader.cs b/itext/itext.kernel/itext/kernel/pdf/PdfNameLoader.cs index 2fb0cb181b..6121e48ebe 100644 --- a/itext/itext.kernel/itext/kernel/pdf/PdfNameLoader.cs +++ b/itext/itext.kernel/itext/kernel/pdf/PdfNameLoader.cs @@ -26,6 +26,7 @@ You should have received a copy of the GNU Affero General Public License namespace iText.Kernel.Pdf { + //\cond DO_NOT_DOCUMENT internal static class PdfNameLoader { internal static IDictionary LoadNames() @@ -46,4 +47,5 @@ internal static IDictionary LoadNames() return staticNames; } } + //\endcond } diff --git a/itext/itext.kernel/itext/kernel/utils/IdleOutputStream.cs b/itext/itext.kernel/itext/kernel/utils/IdleOutputStream.cs index 3f8e329c32..428e370481 100644 --- a/itext/itext.kernel/itext/kernel/utils/IdleOutputStream.cs +++ b/itext/itext.kernel/itext/kernel/utils/IdleOutputStream.cs @@ -24,6 +24,7 @@ You should have received a copy of the GNU Affero General Public License using System.IO; namespace iText.Kernel.Utils { + //\cond DO_NOT_DOCUMENT internal class IdleOutputStream : Stream { public override void Flush() @@ -73,4 +74,5 @@ public override long Length public override long Position { get; set; } } + //\endcond } diff --git a/itext/itext.kernel/itext/kernel/utils/TaggedPdfReaderTool.cs b/itext/itext.kernel/itext/kernel/utils/TaggedPdfReaderTool.cs index c65335e8e6..3e129b30cb 100644 --- a/itext/itext.kernel/itext/kernel/utils/TaggedPdfReaderTool.cs +++ b/itext/itext.kernel/itext/kernel/utils/TaggedPdfReaderTool.cs @@ -339,9 +339,11 @@ public virtual ICollection GetSupportedEvents() { return null; } + //\cond DO_NOT_DOCUMENT internal MarkedContentEventListener(TaggedPdfReaderTool _enclosing) { this._enclosing = _enclosing; } + //\endcond private readonly TaggedPdfReaderTool _enclosing; } diff --git a/itext/itext.kernel/itext/kernel/xmp/impl/CountOutputStream.cs b/itext/itext.kernel/itext/kernel/xmp/impl/CountOutputStream.cs index 46205a6ec9..c4b85db040 100644 --- a/itext/itext.kernel/itext/kernel/xmp/impl/CountOutputStream.cs +++ b/itext/itext.kernel/itext/kernel/xmp/impl/CountOutputStream.cs @@ -46,12 +46,14 @@ public sealed class CountOutputStream : Stream { /// the byte counter private int bytesWritten; + //\cond DO_NOT_DOCUMENT /// /// Constructor with providing the output stream to decorate. /// an OutputStream internal CountOutputStream(Stream output) { this.output = output; } + //\endcond /// the bytesWritten diff --git a/itext/itext.kernel/itext/kernel/xmp/impl/ISO8601Converter.cs b/itext/itext.kernel/itext/kernel/xmp/impl/ISO8601Converter.cs index 5874a97a03..75266cec59 100644 --- a/itext/itext.kernel/itext/kernel/xmp/impl/ISO8601Converter.cs +++ b/itext/itext.kernel/itext/kernel/xmp/impl/ISO8601Converter.cs @@ -268,6 +268,7 @@ public static String Render(XMPDateTime dateTime) { } } + //\cond DO_NOT_DOCUMENT /// 22.08.2006 internal class ParseState { @@ -359,4 +360,5 @@ public virtual int GatherInt(String errorMsg, int maxValue) } } } + //\endcond } diff --git a/itext/itext.kernel/itext/kernel/xmp/impl/ParseRdf.cs b/itext/itext.kernel/itext/kernel/xmp/impl/ParseRdf.cs index 9cc11d8491..920e9902fc 100644 --- a/itext/itext.kernel/itext/kernel/xmp/impl/ParseRdf.cs +++ b/itext/itext.kernel/itext/kernel/xmp/impl/ParseRdf.cs @@ -89,6 +89,7 @@ public class ParseRdf : XMPConst /// this prefix is used for default namespaces public const String DEFAULT_PREFIX = "_dflt"; + //\cond DO_NOT_DOCUMENT /// The main parsing method. /// /// The main parsing method. The XML tree is walked through from the root node and and XMP tree @@ -122,6 +123,7 @@ internal static void Rdf_RDF(XMPMetaImpl xmp, XmlNode rdfRdfNode) throw new XMPException("Invalid attributes of rdf:RDF element", XMPError.BADRDF); } } + //\endcond /// /// 7.2.10 nodeElementList
diff --git a/itext/itext.kernel/itext/kernel/xmp/impl/XMPMetaImpl.cs b/itext/itext.kernel/itext/kernel/xmp/impl/XMPMetaImpl.cs index 30cf970f46..d741fb0d68 100644 --- a/itext/itext.kernel/itext/kernel/xmp/impl/XMPMetaImpl.cs +++ b/itext/itext.kernel/itext/kernel/xmp/impl/XMPMetaImpl.cs @@ -1054,6 +1054,7 @@ private void DoSetArrayItem(XMPNode arrayNode, int itemIndex, String itemValue, } } + //\cond DO_NOT_DOCUMENT /// /// The internals for setProperty() and related calls, used after the node is /// found or created. @@ -1087,6 +1088,7 @@ internal virtual void SetNode(XMPNode node, Object value, PropertyOptions newOpt node.RemoveChildren(); } } + //\endcond /// /// Evaluates a raw node value to the given value type, apply special diff --git a/itext/itext.kernel/itext/kernel/xmp/impl/XMPNodeUtils.cs b/itext/itext.kernel/itext/kernel/xmp/impl/XMPNodeUtils.cs index 2885c8a410..ebb635ecde 100644 --- a/itext/itext.kernel/itext/kernel/xmp/impl/XMPNodeUtils.cs +++ b/itext/itext.kernel/itext/kernel/xmp/impl/XMPNodeUtils.cs @@ -39,6 +39,7 @@ namespace iText.Kernel.XMP.Impl /// Aug 28, 2006 public sealed class XMPNodeUtils : XMPConst { + //\cond DO_NOT_DOCUMENT internal const int CLT_NO_VALUES = 0; internal const int CLT_SPECIFIC_MATCH = 1; @@ -423,6 +424,7 @@ internal static String SerializeNodeValue(Object value) } return strValue != null ? Utils.RemoveControlChars(strValue) : null; } + //\endcond /// /// After processing by ExpandXPath, a step can be of certain forms described in documentation. diff --git a/itext/itext.kernel/itext/kernel/xmp/impl/XMPNormalizer.cs b/itext/itext.kernel/itext/kernel/xmp/impl/XMPNormalizer.cs index 455a44b48a..cce5f97c29 100644 --- a/itext/itext.kernel/itext/kernel/xmp/impl/XMPNormalizer.cs +++ b/itext/itext.kernel/itext/kernel/xmp/impl/XMPNormalizer.cs @@ -54,6 +54,7 @@ private XMPNormalizer() { } + //\cond DO_NOT_DOCUMENT // EMPTY /// Normalizes a raw parsed XMPMeta-Object /// the raw metadata object @@ -68,7 +69,8 @@ internal static XMPMeta Process(XMPMetaImpl xmp, ParseOptions options) DeleteEmptySchemas(tree); return xmp; } - + //\endcond + /// /// Tweak old XMP: Move an instance ID from rdf:about to the /// xmpMM:InstanceID property. diff --git a/itext/itext.kernel/itext/kernel/xmp/impl/XMPSchemaRegistryImpl.cs b/itext/itext.kernel/itext/kernel/xmp/impl/XMPSchemaRegistryImpl.cs index d3710e9a6e..2e351b3bad 100644 --- a/itext/itext.kernel/itext/kernel/xmp/impl/XMPSchemaRegistryImpl.cs +++ b/itext/itext.kernel/itext/kernel/xmp/impl/XMPSchemaRegistryImpl.cs @@ -307,7 +307,7 @@ public XMPAliasInfo[] FindAliases(String aliasNS) return result.ToArray(new XMPAliasInfo[result.Count]); } } - + //\cond DO_NOT_DOCUMENT /// Associates an alias name with an actual name. /// /// Associates an alias name with an actual name. @@ -398,6 +398,7 @@ internal void RegisterAlias(String aliasNS, String aliasProp, String actualNS, S aliasMap[key] = aliasInfo; } } + //\endcond private sealed class _XMPAliasInfo_409 : XMPAliasInfo { diff --git a/itext/itext.kernel/itext/kernel/xmp/impl/XMPSerializerRdf.cs b/itext/itext.kernel/itext/kernel/xmp/impl/XMPSerializerRdf.cs index 5842f0bee1..400e737120 100644 --- a/itext/itext.kernel/itext/kernel/xmp/impl/XMPSerializerRdf.cs +++ b/itext/itext.kernel/itext/kernel/xmp/impl/XMPSerializerRdf.cs @@ -75,11 +75,13 @@ public class XMPSerializerRdf private const String RDF_EMPTY_STRUCT = ""; + //\cond DO_NOT_DOCUMENT /// a set of all rdf attribute qualifier internal static readonly ICollection RDF_ATTR_QUALIFIER = new HashSet(JavaUtil.ArraysAsList(XMPConst.XML_LANG, "rdf:resource", "rdf:ID", "rdf:bagID", "rdf:nodeID")); - + //\endcond + /// the metadata object to be serialized. private XMPMetaImpl xmp; diff --git a/itext/itext.layout/Properties/TypographyVersionAttribute.cs b/itext/itext.layout/Properties/TypographyVersionAttribute.cs index 9616c65079..01ee8712a9 100644 --- a/itext/itext.layout/Properties/TypographyVersionAttribute.cs +++ b/itext/itext.layout/Properties/TypographyVersionAttribute.cs @@ -23,6 +23,7 @@ You should have received a copy of the GNU Affero General Public License using System; namespace Versions.Attributes { + //\cond DO_NOT_DOCUMENT [AttributeUsage(AttributeTargets.Assembly)] internal class TypographyVersionAttribute : Attribute { internal string TypographyVersion { get; private set; } @@ -31,4 +32,5 @@ internal TypographyVersionAttribute(string typographyVersion) { this.TypographyVersion = typographyVersion; } } + //\endcond } diff --git a/itext/itext.layout/itext/layout/LayoutExtensions.cs b/itext/itext.layout/itext/layout/LayoutExtensions.cs index 3382f6f873..a2ada3fbee 100644 --- a/itext/itext.layout/itext/layout/LayoutExtensions.cs +++ b/itext/itext.layout/itext/layout/LayoutExtensions.cs @@ -29,6 +29,7 @@ You should have received a copy of the GNU Affero General Public License using iText.Commons.Utils.Collections; namespace iText.Layout { + //\cond DO_NOT_DOCUMENT internal static class LayoutExtensions { public static String JSubstring(this String str, int beginIndex, int endIndex) { return str.Substring(beginIndex, endIndex - beginIndex); @@ -231,4 +232,5 @@ public static ConstructorInfo GetConstructor(this Type type, Type[] parameterTyp } #endif } + //\endcond } diff --git a/itext/itext.layout/itext/layout/hyphenation/PatternParser.cs b/itext/itext.layout/itext/layout/hyphenation/PatternParser.cs index 4188d237f4..acc8a335bc 100644 --- a/itext/itext.layout/itext/layout/hyphenation/PatternParser.cs +++ b/itext/itext.layout/itext/layout/hyphenation/PatternParser.cs @@ -43,6 +43,7 @@ public class PatternParser { private bool hasClasses; + //\cond DO_NOT_DOCUMENT internal const int ELEM_CLASSES = 1; internal const int ELEM_EXCEPTIONS = 2; @@ -50,7 +51,7 @@ public class PatternParser { internal const int ELEM_PATTERNS = 3; internal const int ELEM_HYPHEN = 4; - + //\endcond /// Construct a pattern parser. private PatternParser() { token = new StringBuilder(); @@ -226,10 +227,12 @@ private static String GetInterletterValues(String pat) { } return il.ToString(); } - + + //\cond DO_NOT_DOCUMENT protected internal virtual void GetExternalClasses() { Parse(ResourceUtil.GetResourceStream(HyphenationConstants.HYPHENATION_DEFAULT_RESOURCE + "External.classes.xml"), "classes.xml"); } + //\endcond // // ContentHandler methods diff --git a/itext/itext.pdfa/itext/pdfa/PdfAExtensions.cs b/itext/itext.pdfa/itext/pdfa/PdfAExtensions.cs index 9874c05fc9..14bac602dc 100644 --- a/itext/itext.pdfa/itext/pdfa/PdfAExtensions.cs +++ b/itext/itext.pdfa/itext/pdfa/PdfAExtensions.cs @@ -27,6 +27,7 @@ You should have received a copy of the GNU Affero General Public License using System.Text; namespace iText.Pdfa { + //\cond DO_NOT_DOCUMENT internal static class PdfAExtensions { public static void AddAll(this IList list, IEnumerable c) { ((List) list).AddRange(c); @@ -86,4 +87,5 @@ public static Assembly GetAssembly(this Type type) { #endif } } + //\endcond } diff --git a/itext/itext.pdftest/itext/test/WrappedSamplesRunner.cs b/itext/itext.pdftest/itext/test/WrappedSamplesRunner.cs index a09a61d037..b833001b64 100644 --- a/itext/itext.pdftest/itext/test/WrappedSamplesRunner.cs +++ b/itext/itext.pdftest/itext/test/WrappedSamplesRunner.cs @@ -212,10 +212,11 @@ private static bool IsInSearchPath(String fullName, RunnerSearchConfig searchCon } public class RunnerParams { + //\cond DO_NOT_DOCUMENT internal Type sampleType; internal String ignoreMessage; - + //\endcond public override String ToString() { return sampleType.FullName; } diff --git a/itext/itext.pdfua/PdfUaExtensions.cs b/itext/itext.pdfua/PdfUaExtensions.cs index 7ee07c1379..e1a7349039 100644 --- a/itext/itext.pdfua/PdfUaExtensions.cs +++ b/itext/itext.pdfua/PdfUaExtensions.cs @@ -31,7 +31,7 @@ You should have received a copy of the GNU Affero General Public License using System.Text.RegularExpressions; using iText.Commons.Utils; using iText.Commons.Utils.Collections; - + //\cond DO_NOT_DOCUMENT internal static class PdfUaExtensions { public static String JSubstring(this String str, int beginIndex, int endIndex) { return str.Substring(beginIndex, endIndex - beginIndex); @@ -412,3 +412,4 @@ public static byte[] GetBuffer(this MemoryStream memoryStream) { } #endif } +//\endcond \ No newline at end of file diff --git a/itext/itext.sign/itext/signatures/SignExtensions.cs b/itext/itext.sign/itext/signatures/SignExtensions.cs index f3b83ea073..ecded872e0 100644 --- a/itext/itext.sign/itext/signatures/SignExtensions.cs +++ b/itext/itext.sign/itext/signatures/SignExtensions.cs @@ -25,7 +25,7 @@ You should have received a copy of the GNU Affero General Public License using System.IO; using System.Linq; using System.Text; - +//\cond DO_NOT_DOCUMENT namespace iText.Signatures { internal static class SignExtensions { public static String JSubstring(this String str, int beginIndex, int endIndex) { @@ -158,3 +158,4 @@ public static IEnumerable Sorted(this IEnumerable source, Comparison } } } +//\endcond \ No newline at end of file diff --git a/itext/itext.sign/itext/signatures/SignUtils.cs b/itext/itext.sign/itext/signatures/SignUtils.cs index 90ff2ec818..ce24447399 100644 --- a/itext/itext.sign/itext/signatures/SignUtils.cs +++ b/itext/itext.sign/itext/signatures/SignUtils.cs @@ -43,6 +43,7 @@ You should have received a copy of the GNU Affero General Public License using iText.Signatures.Exceptions; namespace iText.Signatures { + //\cond DO_NOT_DOCUMENT internal sealed class SignUtils { private static readonly IBouncyCastleFactory FACTORY = BouncyCastleFactoryCreator.GetFactory(); @@ -286,4 +287,5 @@ public static IX509Certificate GenerateCertificate(Stream data) { return FACTORY.CreateX509Certificate(data); } } + //\endcond } diff --git a/itext/itext.sign/itext/signatures/validation/v1/SignatureValidationProperties.cs b/itext/itext.sign/itext/signatures/validation/v1/SignatureValidationProperties.cs index 2b566f8c51..8543264e51 100644 --- a/itext/itext.sign/itext/signatures/validation/v1/SignatureValidationProperties.cs +++ b/itext/itext.sign/itext/signatures/validation/v1/SignatureValidationProperties.cs @@ -194,6 +194,7 @@ public iText.Signatures.Validation.V1.SignatureValidationProperties SetRequiredE return this; } + //\cond DO_NOT_DOCUMENT /// This method executes the setter method for every combination of selected validators and certificateSources /// /// the validators to execute the setter on @@ -232,6 +233,7 @@ internal virtual T GetParametersValueFor(ValidatorContext validatorContext, C } return default; } + //\endcond /// Enum representing possible online fetching permissions. public enum OnlineFetching { @@ -243,6 +245,7 @@ public enum OnlineFetching { NEVER_FETCH } + //\cond DO_NOT_DOCUMENT internal class ContextProperties { private TimeSpan freshness; @@ -288,5 +291,6 @@ public virtual void SetRequiredExtensions(IList requiredEx this.requiredExtensions = requiredExtensions; } } + //\endcond } } diff --git a/itext/itext.styledxmlparser/StyledXmlParserExtensions.cs b/itext/itext.styledxmlparser/StyledXmlParserExtensions.cs index cd660c98ed..4d67e94202 100644 --- a/itext/itext.styledxmlparser/StyledXmlParserExtensions.cs +++ b/itext/itext.styledxmlparser/StyledXmlParserExtensions.cs @@ -29,7 +29,7 @@ You should have received a copy of the GNU Affero General Public License using iText.StyledXmlParser.Jsoup.Helper; using System.Reflection; using iText.Commons.Utils; - +//\cond DO_NOT_DOCUMENT internal static class StyledXmlParserExtensions { public static String Name(this Encoding e) { return e.WebName.ToUpperInvariant(); @@ -488,3 +488,4 @@ public static byte[] GetBuffer(this MemoryStream memoryStream) { } #endif } +//\endcond \ No newline at end of file diff --git a/itext/itext.styledxmlparser/itext/styledxmlparser/css/parse/CssSelectorParserMatch.cs b/itext/itext.styledxmlparser/itext/styledxmlparser/css/parse/CssSelectorParserMatch.cs index 7facd89557..02777263f7 100644 --- a/itext/itext.styledxmlparser/itext/styledxmlparser/css/parse/CssSelectorParserMatch.cs +++ b/itext/itext.styledxmlparser/itext/styledxmlparser/css/parse/CssSelectorParserMatch.cs @@ -26,6 +26,7 @@ You should have received a copy of the GNU Affero General Public License using iText.IO.Util; namespace iText.StyledXmlParser.Css.Parse { + //\cond DO_NOT_DOCUMENT /// Internal class not for public use. /// Internal class not for public use. Its API may change. internal class CssSelectorParserMatch { @@ -75,4 +76,5 @@ public virtual void Next(int startIndex) { success = matcher.Find(startIndex); } } + //\endcond } diff --git a/itext/itext.styledxmlparser/itext/styledxmlparser/resolver/resource/LimitedInputStream.cs b/itext/itext.styledxmlparser/itext/styledxmlparser/resolver/resource/LimitedInputStream.cs index ee180a92ed..9c245bcfc5 100644 --- a/itext/itext.styledxmlparser/itext/styledxmlparser/resolver/resource/LimitedInputStream.cs +++ b/itext/itext.styledxmlparser/itext/styledxmlparser/resolver/resource/LimitedInputStream.cs @@ -25,6 +25,7 @@ You should have received a copy of the GNU Affero General Public License using iText.StyledXmlParser.Exceptions; namespace iText.StyledXmlParser.Resolver.Resource { + //\cond DO_NOT_DOCUMENT /// /// Implementation of the /// @@ -145,4 +146,5 @@ public override long Position { } } } + //\endcond } diff --git a/itext/itext.styledxmlparser/itext/styledxmlparser/resolver/resource/UriEncodeUtil.cs b/itext/itext.styledxmlparser/itext/styledxmlparser/resolver/resource/UriEncodeUtil.cs index 1599dc0ca7..c8974d04bf 100644 --- a/itext/itext.styledxmlparser/itext/styledxmlparser/resolver/resource/UriEncodeUtil.cs +++ b/itext/itext.styledxmlparser/itext/styledxmlparser/resolver/resource/UriEncodeUtil.cs @@ -29,6 +29,7 @@ You should have received a copy of the GNU Affero General Public License namespace iText.StyledXmlParser.Resolver.Resource { + //\cond DO_NOT_DOCUMENT internal class UriEncodeUtil { @@ -270,4 +271,5 @@ private static char CharacterForDigit(int digit, int radix) return (char)('a' - 10 + digit); } } + //\endcond } diff --git a/itext/itext.svg/SvgExtensions.cs b/itext/itext.svg/SvgExtensions.cs index 8ac74270fb..97cd02f081 100644 --- a/itext/itext.svg/SvgExtensions.cs +++ b/itext/itext.svg/SvgExtensions.cs @@ -28,7 +28,7 @@ You should have received a copy of the GNU Affero General Public License using iText.IO.Util; using System.Reflection; using iText.Commons.Utils; - +//\cond DO_NOT_DOCUMENT internal static class SvgExtensions { public static String Name(this Encoding e) { return e.WebName.ToUpperInvariant(); @@ -440,3 +440,4 @@ public static byte[] GetBuffer(this MemoryStream memoryStream) { } #endif } +//\endcond \ No newline at end of file From 77dd3bc35381b67fee82da6306bf4b9e2b37449e Mon Sep 17 00:00:00 2001 From: Dmitry Radchuk Date: Fri, 21 Jun 2024 14:19:10 +0000 Subject: [PATCH 2/3] Add repeat, fit-content support DEVSIX-8383 Autoported commit. Original commit hash: [1f97711f8] --- .../itext/layout/element/GridContainerTest.cs | 284 ++++++++++----- .../gridcontainer/GridContainerLayoutTest.cs | 13 +- .../itext/layout/properties/GridValueTest.cs | 53 ++- .../itext/layout/renderer/GridUnitTest.cs | 232 +++++------- .../cmp_autoRepeatOnEmptyGridTest.pdf | Bin 0 -> 988 bytes .../cmp_autoRepeatTestWithRowGapTest.pdf | Bin 0 -> 1269 bytes .../cmp_autoRepeatWithShrinkTest.pdf | Bin 0 -> 1165 bytes .../cmp_fitContentColumnsTest.pdf | Bin 0 -> 1526 bytes .../itext/kernel/utils/TaggedPdfReaderTool.cs | 2 - .../LayoutExceptionMessageConstant.cs | 4 + .../itext/layout/properties/GridValue.cs | 222 ------------ .../layout/properties/grid/AutoRepeatValue.cs | 41 +++ .../itext/layout/properties/grid/AutoValue.cs | 12 + .../layout/properties/grid/BreadthValue.cs | 10 + .../layout/properties/grid/FitContentValue.cs | 65 ++++ .../properties/grid/FixedRepeatValue.cs | 35 ++ .../itext/layout/properties/grid/FlexValue.cs | 19 + .../layout/properties/grid/FunctionValue.cs | 10 + .../layout/properties/{ => grid}/GridFlow.cs | 4 +- .../itext/layout/properties/grid/GridValue.cs | 35 ++ .../layout/properties/grid/LengthValue.cs | 20 ++ .../layout/properties/grid/MaxContentValue.cs | 12 + .../layout/properties/grid/MinContentValue.cs | 12 + .../layout/properties/grid/MinMaxValue.cs | 37 ++ .../layout/properties/grid/PercentValue.cs | 10 + .../layout/properties/grid/PointValue.cs | 10 + .../layout/properties/grid/TemplateValue.cs | 43 +++ .../itext/layout/renderer/Grid.cs | 180 ++++++---- .../layout/renderer/GridContainerRenderer.cs | 74 ++-- .../itext/layout/renderer/GridSizer.cs | 79 +++- .../layout/renderer/GridTemplateResolver.cs | 296 +++++++++++++++ .../itext/layout/renderer/GridTrackSizer.cs | 339 +++++++++++------- .../itext/layout/renderer/GridView.cs | 2 +- port-hash | 2 +- 34 files changed, 1460 insertions(+), 697 deletions(-) create mode 100644 itext.tests/itext.layout.tests/resources/itext/layout/GridContainerTest/cmp_autoRepeatOnEmptyGridTest.pdf create mode 100644 itext.tests/itext.layout.tests/resources/itext/layout/GridContainerTest/cmp_autoRepeatTestWithRowGapTest.pdf create mode 100644 itext.tests/itext.layout.tests/resources/itext/layout/GridContainerTest/cmp_autoRepeatWithShrinkTest.pdf create mode 100644 itext.tests/itext.layout.tests/resources/itext/layout/GridContainerTest/cmp_fitContentColumnsTest.pdf delete mode 100644 itext/itext.layout/itext/layout/properties/GridValue.cs create mode 100644 itext/itext.layout/itext/layout/properties/grid/AutoRepeatValue.cs create mode 100644 itext/itext.layout/itext/layout/properties/grid/AutoValue.cs create mode 100644 itext/itext.layout/itext/layout/properties/grid/BreadthValue.cs create mode 100644 itext/itext.layout/itext/layout/properties/grid/FitContentValue.cs create mode 100644 itext/itext.layout/itext/layout/properties/grid/FixedRepeatValue.cs create mode 100644 itext/itext.layout/itext/layout/properties/grid/FlexValue.cs create mode 100644 itext/itext.layout/itext/layout/properties/grid/FunctionValue.cs rename itext/itext.layout/itext/layout/properties/{ => grid}/GridFlow.cs (95%) create mode 100644 itext/itext.layout/itext/layout/properties/grid/GridValue.cs create mode 100644 itext/itext.layout/itext/layout/properties/grid/LengthValue.cs create mode 100644 itext/itext.layout/itext/layout/properties/grid/MaxContentValue.cs create mode 100644 itext/itext.layout/itext/layout/properties/grid/MinContentValue.cs create mode 100644 itext/itext.layout/itext/layout/properties/grid/MinMaxValue.cs create mode 100644 itext/itext.layout/itext/layout/properties/grid/PercentValue.cs create mode 100644 itext/itext.layout/itext/layout/properties/grid/PointValue.cs create mode 100644 itext/itext.layout/itext/layout/properties/grid/TemplateValue.cs create mode 100644 itext/itext.layout/itext/layout/renderer/GridTemplateResolver.cs diff --git a/itext.tests/itext.layout.tests/itext/layout/element/GridContainerTest.cs b/itext.tests/itext.layout.tests/itext/layout/element/GridContainerTest.cs index 089a3e5f4a..7a82e11478 100644 --- a/itext.tests/itext.layout.tests/itext/layout/element/GridContainerTest.cs +++ b/itext.tests/itext.layout.tests/itext/layout/element/GridContainerTest.cs @@ -22,6 +22,7 @@ You should have received a copy of the GNU Affero General Public License */ using System; using System.Collections.Generic; +using iText.Commons.Utils; using iText.Kernel.Colors; using iText.Kernel.Pdf; using iText.Kernel.Utils; @@ -29,6 +30,7 @@ You should have received a copy of the GNU Affero General Public License using iText.Layout.Borders; using iText.Layout.Exceptions; using iText.Layout.Properties; +using iText.Layout.Properties.Grid; using iText.Test; namespace iText.Layout.Element { @@ -49,10 +51,10 @@ public static void BeforeClass() { public virtual void BasicThreeColumnsTest() { String filename = DESTINATION_FOLDER + "basicThreeColumnsTest.pdf"; String cmpName = SOURCE_FOLDER + "cmp_basicThreeColumnsTest.pdf"; - IList templateColumns = new List(); - templateColumns.Add(GridValue.CreatePointValue(150.0f)); - templateColumns.Add(GridValue.CreatePointValue(150.0f)); - templateColumns.Add(GridValue.CreatePointValue(150.0f)); + IList templateColumns = new List(); + templateColumns.Add((TemplateValue)new PointValue(150.0f)); + templateColumns.Add((TemplateValue)new PointValue(150.0f)); + templateColumns.Add((TemplateValue)new PointValue(150.0f)); SolidBorder border = new SolidBorder(ColorConstants.BLUE, 1); using (Document document = new Document(new PdfDocument(new PdfWriter(filename)))) { GridContainer grid = new GridContainer(); @@ -73,7 +75,7 @@ public virtual void BasicAutoColumnsTest() { SolidBorder border = new SolidBorder(ColorConstants.BLUE, 1); using (Document document = new Document(new PdfDocument(new PdfWriter(filename)))) { GridContainer grid = new GridContainer(); - grid.SetProperty(Property.GRID_AUTO_COLUMNS, GridValue.CreatePointValue(150.0f)); + grid.SetProperty(Property.GRID_AUTO_COLUMNS, new PointValue(150.0f)); for (int i = 0; i < 5; ++i) { grid.Add(new Paragraph("Test" + i).SetBorder(border)); } @@ -90,7 +92,7 @@ public virtual void BasicAutoRowsTest() { SolidBorder border = new SolidBorder(ColorConstants.BLUE, 1); using (Document document = new Document(new PdfDocument(new PdfWriter(filename)))) { GridContainer grid = new GridContainer(); - grid.SetProperty(Property.GRID_AUTO_ROWS, GridValue.CreatePointValue(70.0f)); + grid.SetProperty(Property.GRID_AUTO_ROWS, new PointValue(70.0f)); grid.Add(new Paragraph("Lorem ipsum dolor sit amet, consectetur adipiscing elit, " + "sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, " + "quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute " + "irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. " + "Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim " + @@ -106,10 +108,10 @@ public virtual void BasicAutoRowsTest() { public virtual void BasicThreeColumnsWithCustomColumnIndexesTest() { String filename = DESTINATION_FOLDER + "basicThreeColumnsWithCustomColumnIndexesTest.pdf"; String cmpName = SOURCE_FOLDER + "cmp_basicThreeColumnsWithCustomColumnIndexesTest.pdf"; - IList templateColumns = new List(); - templateColumns.Add(GridValue.CreatePointValue(100.0f)); - templateColumns.Add(GridValue.CreatePointValue(100.0f)); - templateColumns.Add(GridValue.CreatePointValue(100.0f)); + IList templateColumns = new List(); + templateColumns.Add(new PointValue(100.0f)); + templateColumns.Add(new PointValue(100.0f)); + templateColumns.Add(new PointValue(100.0f)); SolidBorder border = new SolidBorder(ColorConstants.BLUE, 1); using (Document document = new Document(new PdfDocument(new PdfWriter(filename)))) { GridContainer grid = new GridContainer(); @@ -134,11 +136,11 @@ public virtual void BasicThreeColumnsWithCustomColumnIndexesTest() { public virtual void ThreeColumnsWithAdjacentWideCellsTest() { String filename = DESTINATION_FOLDER + "threeColumnsWithAdjacentWideCellsTest.pdf"; String cmpName = SOURCE_FOLDER + "cmp_threeColumnsWithAdjacentWideCellsTest.pdf"; - IList templateColumns = new List(); - templateColumns.Add(GridValue.CreatePointValue(100.0f)); - templateColumns.Add(GridValue.CreatePointValue(100.0f)); - templateColumns.Add(GridValue.CreatePointValue(100.0f)); - templateColumns.Add(GridValue.CreatePointValue(100.0f)); + IList templateColumns = new List(); + templateColumns.Add((TemplateValue)new PointValue(100.0f)); + templateColumns.Add((TemplateValue)new PointValue(100.0f)); + templateColumns.Add((TemplateValue)new PointValue(100.0f)); + templateColumns.Add((TemplateValue)new PointValue(100.0f)); using (Document document = new Document(new PdfDocument(new PdfWriter(filename)))) { SolidBorder border = new SolidBorder(ColorConstants.BLUE, 1); GridContainer grid = new GridContainer(); @@ -170,10 +172,10 @@ public virtual void ThreeColumnsWithAdjacentWideCellsTest() { public virtual void BasicThreeColumnsWithCustomRowIndexesTest() { String filename = DESTINATION_FOLDER + "basicThreeColumnsWithCustomRowIndexesTest.pdf"; String cmpName = SOURCE_FOLDER + "cmp_basicThreeColumnsWithCustomRowIndexesTest.pdf"; - IList templateColumns = new List(); - templateColumns.Add(GridValue.CreatePointValue(100.0f)); - templateColumns.Add(GridValue.CreatePointValue(100.0f)); - templateColumns.Add(GridValue.CreatePointValue(100.0f)); + IList templateColumns = new List(); + templateColumns.Add((TemplateValue)new PointValue(100.0f)); + templateColumns.Add((TemplateValue)new PointValue(100.0f)); + templateColumns.Add((TemplateValue)new PointValue(100.0f)); SolidBorder border = new SolidBorder(ColorConstants.BLUE, 1); using (Document document = new Document(new PdfDocument(new PdfWriter(filename)))) { GridContainer grid = new GridContainer(); @@ -198,10 +200,10 @@ public virtual void BasicThreeColumnsWithCustomRowIndexesTest() { public virtual void BasicThreeColumnsWithCustomColumnAndRowIndexesTest() { String filename = DESTINATION_FOLDER + "basicThreeColumnsWithCustomColumnAndRowIndexesTest.pdf"; String cmpName = SOURCE_FOLDER + "cmp_basicThreeColumnsWithCustomColumnAndRowIndexesTest.pdf"; - IList templateColumns = new List(); - templateColumns.Add(GridValue.CreatePointValue(100.0f)); - templateColumns.Add(GridValue.CreatePointValue(100.0f)); - templateColumns.Add(GridValue.CreatePointValue(100.0f)); + IList templateColumns = new List(); + templateColumns.Add((TemplateValue)new PointValue(100.0f)); + templateColumns.Add((TemplateValue)new PointValue(100.0f)); + templateColumns.Add((TemplateValue)new PointValue(100.0f)); using (Document document = new Document(new PdfDocument(new PdfWriter(filename)))) { GridContainer grid = new GridContainer(); SolidBorder border = new SolidBorder(ColorConstants.BLUE, 1); @@ -227,10 +229,10 @@ public virtual void BasicThreeColumnsWithCustomColumnAndRowIndexesTest() { public virtual void BasicThreeColumnsWithReversedIndexesTest() { String filename = DESTINATION_FOLDER + "basicThreeColumnsWithReversedIndexesTest.pdf"; String cmpName = SOURCE_FOLDER + "cmp_basicThreeColumnsWithReversedIndexesTest.pdf"; - IList templateColumns = new List(); - templateColumns.Add(GridValue.CreatePointValue(100.0f)); - templateColumns.Add(GridValue.CreatePointValue(100.0f)); - templateColumns.Add(GridValue.CreatePointValue(100.0f)); + IList templateColumns = new List(); + templateColumns.Add((TemplateValue)new PointValue(100.0f)); + templateColumns.Add((TemplateValue)new PointValue(100.0f)); + templateColumns.Add((TemplateValue)new PointValue(100.0f)); using (Document document = new Document(new PdfDocument(new PdfWriter(filename)))) { GridContainer grid = new GridContainer(); SolidBorder border = new SolidBorder(ColorConstants.BLUE, 1); @@ -264,10 +266,10 @@ public virtual void BasicThreeColumnsWithReversedIndexesTest() { public virtual void BasicThreeColumnsWithoutColumnEndTest() { String filename = DESTINATION_FOLDER + "basicThreeColumnsWithoutColumnEndTest.pdf"; String cmpName = SOURCE_FOLDER + "cmp_basicThreeColumnsWithoutColumnEndTest.pdf"; - IList templateColumns = new List(); - templateColumns.Add(GridValue.CreatePointValue(100.0f)); - templateColumns.Add(GridValue.CreatePointValue(100.0f)); - templateColumns.Add(GridValue.CreatePointValue(100.0f)); + IList templateColumns = new List(); + templateColumns.Add((TemplateValue)new PointValue(100.0f)); + templateColumns.Add((TemplateValue)new PointValue(100.0f)); + templateColumns.Add((TemplateValue)new PointValue(100.0f)); using (Document document = new Document(new PdfDocument(new PdfWriter(filename)))) { GridContainer grid = new GridContainer(); SolidBorder border = new SolidBorder(ColorConstants.BLUE, 1); @@ -299,10 +301,10 @@ public virtual void BasicThreeColumnsWithoutColumnEndTest() { public virtual void FixedColumnRowGoesFirstTest() { String filename = DESTINATION_FOLDER + "fixedColumnRowGoesFirstTest.pdf"; String cmpName = SOURCE_FOLDER + "cmp_fixedColumnRowGoesFirstTest.pdf"; - IList templateColumns = new List(); - templateColumns.Add(GridValue.CreatePointValue(100.0f)); - templateColumns.Add(GridValue.CreatePointValue(100.0f)); - templateColumns.Add(GridValue.CreatePointValue(100.0f)); + IList templateColumns = new List(); + templateColumns.Add((TemplateValue)new PointValue(100.0f)); + templateColumns.Add((TemplateValue)new PointValue(100.0f)); + templateColumns.Add((TemplateValue)new PointValue(100.0f)); using (Document document = new Document(new PdfDocument(new PdfWriter(filename)))) { GridContainer grid = new GridContainer(); SolidBorder border = new SolidBorder(ColorConstants.BLUE, 1); @@ -344,10 +346,10 @@ public virtual void FixedColumnRowGoesFirstTest() { [NUnit.Framework.Test] public virtual void OverlapWithExistingColumnTest() { String filename = DESTINATION_FOLDER + "overlapWithExistingColumnTest.pdf"; - IList templateColumns = new List(); - templateColumns.Add(GridValue.CreatePointValue(100.0f)); - templateColumns.Add(GridValue.CreatePointValue(100.0f)); - templateColumns.Add(GridValue.CreatePointValue(100.0f)); + IList templateColumns = new List(); + templateColumns.Add((TemplateValue)new PointValue(100.0f)); + templateColumns.Add((TemplateValue)new PointValue(100.0f)); + templateColumns.Add((TemplateValue)new PointValue(100.0f)); using (Document document = new Document(new PdfDocument(new PdfWriter(filename)))) { GridContainer grid = new GridContainer(); SolidBorder border = new SolidBorder(ColorConstants.BLUE, 1); @@ -378,10 +380,10 @@ public virtual void OverlapWithExistingColumnTest() { public virtual void BasicThreeColumnsWithPtAndPercentTest() { String filename = DESTINATION_FOLDER + "basicThreeColumnsWithPtAndPercentTest.pdf"; String cmpName = SOURCE_FOLDER + "cmp_basicThreeColumnsWithPtAndPercentTest.pdf"; - IList templateColumns = new List(); - templateColumns.Add(GridValue.CreatePercentValue(15.0f)); - templateColumns.Add(GridValue.CreatePercentValue(50.0f)); - templateColumns.Add(GridValue.CreatePointValue(100.0f)); + IList templateColumns = new List(); + templateColumns.Add((TemplateValue)new PercentValue(15.0f)); + templateColumns.Add((TemplateValue)new PercentValue(50.0f)); + templateColumns.Add((TemplateValue)new PointValue(100.0f)); SolidBorder border = new SolidBorder(ColorConstants.BLUE, 1); using (Document document = new Document(new PdfDocument(new PdfWriter(filename)))) { GridContainer grid = new GridContainer(); @@ -399,10 +401,10 @@ public virtual void BasicThreeColumnsWithPtAndPercentTest() { public virtual void ThirdColumnNotLayoutedTest() { String filename = DESTINATION_FOLDER + "thirdColumnNotLayoutedTest.pdf"; String cmpName = SOURCE_FOLDER + "cmp_thirdColumnNotLayoutedTest.pdf"; - IList templateColumns = new List(); - templateColumns.Add(GridValue.CreatePointValue(200.0f)); - templateColumns.Add(GridValue.CreatePointValue(200.0f)); - templateColumns.Add(GridValue.CreatePointValue(200.0f)); + IList templateColumns = new List(); + templateColumns.Add((TemplateValue)new PointValue(200.0f)); + templateColumns.Add((TemplateValue)new PointValue(200.0f)); + templateColumns.Add((TemplateValue)new PointValue(200.0f)); SolidBorder border = new SolidBorder(ColorConstants.BLUE, 1); using (Document document = new Document(new PdfDocument(new PdfWriter(filename)))) { GridContainer grid = new GridContainer(); @@ -420,10 +422,10 @@ public virtual void ThirdColumnNotLayoutedTest() { public virtual void ThreeColumnsWithSquareAndVerticalCellsTest() { String filename = DESTINATION_FOLDER + "threeColumnsWithSquareAndVerticalCellsTest.pdf"; String cmpName = SOURCE_FOLDER + "cmp_threeColumnsWithSquareAndVerticalCellsTest.pdf"; - IList templateColumns = new List(); - templateColumns.Add(GridValue.CreatePointValue(100.0f)); - templateColumns.Add(GridValue.CreatePointValue(100.0f)); - templateColumns.Add(GridValue.CreatePointValue(100.0f)); + IList templateColumns = new List(); + templateColumns.Add((TemplateValue)new PointValue(100.0f)); + templateColumns.Add((TemplateValue)new PointValue(100.0f)); + templateColumns.Add((TemplateValue)new PointValue(100.0f)); using (Document document = new Document(new PdfDocument(new PdfWriter(filename)))) { GridContainer grid = new GridContainer(); SolidBorder border = new SolidBorder(ColorConstants.BLUE, 1); @@ -454,10 +456,10 @@ public virtual void ThreeColumnsWithSquareAndVerticalCellsTest() { public virtual void ThreeColumnsWithSquareCellAndCellWithExplicitHeightTest() { String filename = DESTINATION_FOLDER + "threeColumnsWithSquareCellAndCellWithExplicitHeightTest.pdf"; String cmpName = SOURCE_FOLDER + "cmp_threeColumnsWithSquareCellAndCellWithExplicitHeightTest.pdf"; - IList templateColumns = new List(); - templateColumns.Add(GridValue.CreatePointValue(100.0f)); - templateColumns.Add(GridValue.CreatePointValue(100.0f)); - templateColumns.Add(GridValue.CreatePointValue(100.0f)); + IList templateColumns = new List(); + templateColumns.Add((TemplateValue)new PointValue(100.0f)); + templateColumns.Add((TemplateValue)new PointValue(100.0f)); + templateColumns.Add((TemplateValue)new PointValue(100.0f)); using (Document document = new Document(new PdfDocument(new PdfWriter(filename)))) { GridContainer grid = new GridContainer(); grid.SetBackgroundColor(ColorConstants.GREEN); @@ -485,10 +487,10 @@ public virtual void ThreeColumnsWithSquareCellAndCellWithExplicitHeightTest() { public virtual void ThreeColumnsWithVerticalCellWithSeveralNeighboursToTheLeftTest() { String filename = DESTINATION_FOLDER + "threeColumnsWithVerticalCellWithSeveralNeighboursToTheLeftTest.pdf"; String cmpName = SOURCE_FOLDER + "cmp_threeColumnsWithVerticalCellWithSeveralNeighboursToTheLeftTest.pdf"; - IList templateColumns = new List(); - templateColumns.Add(GridValue.CreatePointValue(100.0f)); - templateColumns.Add(GridValue.CreatePointValue(100.0f)); - templateColumns.Add(GridValue.CreatePointValue(100.0f)); + IList templateColumns = new List(); + templateColumns.Add((TemplateValue)new PointValue(100.0f)); + templateColumns.Add((TemplateValue)new PointValue(100.0f)); + templateColumns.Add((TemplateValue)new PointValue(100.0f)); using (Document document = new Document(new PdfDocument(new PdfWriter(filename)))) { GridContainer grid = new GridContainer(); SolidBorder border = new SolidBorder(ColorConstants.BLUE, 1); @@ -519,8 +521,8 @@ public virtual void BigCellMinContentTest() { String filename = DESTINATION_FOLDER + "bigCellMinContentTest.pdf"; String cmpName = SOURCE_FOLDER + "cmp_bigCellMinContentTest.pdf"; SolidBorder border = new SolidBorder(ColorConstants.BLUE, 1); - IList templateColumns = new List(); - templateColumns.Add(GridValue.CreateMinContentValue()); + IList templateColumns = new List(); + templateColumns.Add((TemplateValue)MinContentValue.VALUE); using (Document document = new Document(new PdfDocument(new PdfWriter(filename)))) { GridContainer grid = new GridContainer(); grid.SetProperty(Property.GRID_TEMPLATE_COLUMNS, templateColumns); @@ -537,14 +539,14 @@ public virtual void BigCellMinContentTest() { public virtual void ColumnRowGapTest() { String filename = DESTINATION_FOLDER + "columnRowGapTest.pdf"; String cmpName = SOURCE_FOLDER + "cmp_columnRowGapTest.pdf"; - IList template = new List(); - template.Add(GridValue.CreatePointValue(50.0f)); - template.Add(GridValue.CreatePointValue(50.0f)); + IList template = new List(); + template.Add((TemplateValue)new PointValue(50.0f)); + template.Add((TemplateValue)new PointValue(50.0f)); using (Document document = new Document(new PdfDocument(new PdfWriter(filename)))) { GridContainer grid = new GridContainer(); grid.SetProperty(Property.GRID_TEMPLATE_COLUMNS, template); grid.SetProperty(Property.GRID_TEMPLATE_ROWS, template); - grid.SetProperty(Property.GRID_AUTO_ROWS, GridValue.CreatePointValue(70.0f)); + grid.SetProperty(Property.GRID_AUTO_ROWS, new PointValue(70.0f)); grid.SetProperty(Property.COLUMN_GAP, 20.0f); grid.SetProperty(Property.ROW_GAP, 20.0f); grid.Add(new Paragraph("One").SetBackgroundColor(ColorConstants.CYAN)); @@ -560,14 +562,93 @@ public virtual void ColumnRowGapTest() { )); } + [NUnit.Framework.Test] + public virtual void AutoRepeatTestWithRowGapTest() { + String filename = DESTINATION_FOLDER + "autoRepeatTestWithRowGapTest.pdf"; + String cmpName = SOURCE_FOLDER + "cmp_autoRepeatTestWithRowGapTest.pdf"; + IList columnsTemplate = new List(); + columnsTemplate.Add(new FixedRepeatValue(2, JavaUtil.ArraysAsList((GridValue)new PercentValue(20.0f), (GridValue + )new PointValue(50.0f), (GridValue)new MinMaxValue(new PointValue(50.0f), AutoValue.VALUE)))); + IList rowsTemplate = new List(); + rowsTemplate.Add(new AutoRepeatValue(true, JavaCollectionsUtil.SingletonList((GridValue)new PointValue(100.0f + )))); + using (Document document = new Document(new PdfDocument(new PdfWriter(filename)))) { + GridContainer grid = new GridContainer(); + grid.SetProperty(Property.GRID_TEMPLATE_COLUMNS, columnsTemplate); + grid.SetProperty(Property.GRID_TEMPLATE_ROWS, rowsTemplate); + grid.SetProperty(Property.GRID_AUTO_ROWS, new PointValue(70.0f)); + grid.SetProperty(Property.COLUMN_GAP, 20.0f); + grid.SetProperty(Property.ROW_GAP, 20.0f); + grid.Add(new Paragraph("One").SetBackgroundColor(ColorConstants.CYAN)); + grid.Add(new Paragraph("Two").SetBackgroundColor(ColorConstants.CYAN)); + grid.Add(new Paragraph("Tree").SetBackgroundColor(ColorConstants.CYAN)); + grid.Add(new Paragraph("Four").SetBackgroundColor(ColorConstants.CYAN)); + grid.Add(new Paragraph("Five").SetBackgroundColor(ColorConstants.CYAN)); + grid.Add(new Paragraph("Six").SetBackgroundColor(ColorConstants.CYAN)); + grid.Add(new Paragraph("Seven").SetBackgroundColor(ColorConstants.CYAN)); + grid.Add(new Paragraph("Eight").SetBackgroundColor(ColorConstants.CYAN)); + grid.Add(new Paragraph("Nine").SetBackgroundColor(ColorConstants.CYAN)); + document.Add(grid); + } + NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(filename, cmpName, DESTINATION_FOLDER, "diff_" + )); + } + + [NUnit.Framework.Test] + public virtual void AutoRepeatWithShrinkTest() { + String filename = DESTINATION_FOLDER + "autoRepeatWithShrinkTest.pdf"; + String cmpName = SOURCE_FOLDER + "cmp_autoRepeatWithShrinkTest.pdf"; + IList columnsTemplate = new List(); + columnsTemplate.Add(new AutoRepeatValue(true, JavaCollectionsUtil.SingletonList((GridValue)new PointValue( + 50.0f)))); + columnsTemplate.Add(new PointValue(100.0f)); + IList rowsTemplate = new List(); + rowsTemplate.Add(new AutoRepeatValue(true, JavaCollectionsUtil.SingletonList((GridValue)new PointValue(100.0f + )))); + rowsTemplate.Add(new PointValue(200.0f)); + using (Document document = new Document(new PdfDocument(new PdfWriter(filename)))) { + GridContainer grid = new GridContainer(); + grid.SetHeight(500.0f); + grid.SetBackgroundColor(ColorConstants.GREEN); + grid.SetProperty(Property.GRID_TEMPLATE_COLUMNS, columnsTemplate); + grid.SetProperty(Property.GRID_TEMPLATE_ROWS, rowsTemplate); + grid.Add(new Paragraph("One").SetBackgroundColor(ColorConstants.CYAN)); + document.Add(grid); + } + NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(filename, cmpName, DESTINATION_FOLDER, "diff_" + )); + } + + [NUnit.Framework.Test] + public virtual void AutoRepeatOnEmptyGridTest() { + String filename = DESTINATION_FOLDER + "autoRepeatOnEmptyGridTest.pdf"; + String cmpName = SOURCE_FOLDER + "cmp_autoRepeatOnEmptyGridTest.pdf"; + IList columnsTemplate = new List(); + columnsTemplate.Add(new AutoRepeatValue(true, JavaCollectionsUtil.SingletonList((GridValue)new PointValue( + 50.0f)))); + IList rowsTemplate = new List(); + rowsTemplate.Add(new AutoRepeatValue(true, JavaCollectionsUtil.SingletonList((GridValue)new PointValue(100.0f + )))); + using (Document document = new Document(new PdfDocument(new PdfWriter(filename)))) { + GridContainer grid = new GridContainer(); + grid.SetBackgroundColor(ColorConstants.GREEN); + grid.SetHeight(500.0f); + grid.SetProperty(Property.GRID_TEMPLATE_COLUMNS, columnsTemplate); + grid.SetProperty(Property.GRID_TEMPLATE_ROWS, rowsTemplate); + document.Add(grid); + } + NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(filename, cmpName, DESTINATION_FOLDER, "diff_" + )); + } + [NUnit.Framework.Test] public virtual void FewBigCellsWithGapTest() { String filename = DESTINATION_FOLDER + "fewBigCellsWithGapTest.pdf"; String cmpName = SOURCE_FOLDER + "cmp_fewBigCellsWithGapTest.pdf"; - IList template = new List(); - template.Add(GridValue.CreatePointValue(50.0f)); - template.Add(GridValue.CreatePointValue(50.0f)); - template.Add(GridValue.CreatePointValue(50.0f)); + IList template = new List(); + template.Add((TemplateValue)new PointValue(50.0f)); + template.Add((TemplateValue)new PointValue(50.0f)); + template.Add((TemplateValue)new PointValue(50.0f)); using (Document document = new Document(new PdfDocument(new PdfWriter(filename)))) { GridContainer grid = new GridContainer(); grid.SetProperty(Property.GRID_TEMPLATE_COLUMNS, template); @@ -603,10 +684,10 @@ public virtual void FewBigCellsWithGapTest() { public virtual void ColumnFlowWithBigCellsTest() { String filename = DESTINATION_FOLDER + "columnFlowWithBigCellsTest.pdf"; String cmpName = SOURCE_FOLDER + "cmp_columnFlowWithBigCellsTest.pdf"; - IList template = new List(); - template.Add(GridValue.CreatePointValue(50.0f)); - template.Add(GridValue.CreatePointValue(50.0f)); - template.Add(GridValue.CreatePointValue(50.0f)); + IList template = new List(); + template.Add((TemplateValue)new PointValue(50.0f)); + template.Add((TemplateValue)new PointValue(50.0f)); + template.Add((TemplateValue)new PointValue(50.0f)); using (Document document = new Document(new PdfDocument(new PdfWriter(filename)))) { GridContainer grid = new GridContainer(); grid.SetProperty(Property.GRID_FLOW, GridFlow.COLUMN); @@ -644,9 +725,9 @@ public virtual void ColumnFlowWithBigCellsTest() { public virtual void FrInRowsTest() { String filename = DESTINATION_FOLDER + "frInRowsTest.pdf"; String cmpName = SOURCE_FOLDER + "cmp_frInRowsTest.pdf"; - IList template = new List(); - template.Add(GridValue.CreateFlexValue(1f)); - template.Add(GridValue.CreateFlexValue(3f)); + IList template = new List(); + template.Add((TemplateValue)new FlexValue(1f)); + template.Add((TemplateValue)new FlexValue(3f)); using (Document document = new Document(new PdfDocument(new PdfWriter(filename)))) { GridContainer grid = new GridContainer(); grid.SetProperty(Property.GRID_TEMPLATE_ROWS, template); @@ -664,10 +745,10 @@ public virtual void FrInRowsTest() { public virtual void FrColumnsTest() { String filename = DESTINATION_FOLDER + "frColumnsTest.pdf"; String cmpName = SOURCE_FOLDER + "cmp_frColumnsTest.pdf"; - IList templateColumns = new List(); - templateColumns.Add(GridValue.CreateFlexValue(1f)); - templateColumns.Add(GridValue.CreateAutoValue()); - templateColumns.Add(GridValue.CreateFlexValue(3f)); + IList templateColumns = new List(); + templateColumns.Add((TemplateValue)new FlexValue(1f)); + templateColumns.Add((TemplateValue)AutoValue.VALUE); + templateColumns.Add((TemplateValue)new FlexValue(3f)); SolidBorder border = new SolidBorder(ColorConstants.BLUE, 1); using (Document document = new Document(new PdfDocument(new PdfWriter(filename)))) { GridContainer grid = new GridContainer(); @@ -687,14 +768,41 @@ public virtual void FrColumnsTest() { )); } + [NUnit.Framework.Test] + public virtual void FitContentColumnsTest() { + String filename = DESTINATION_FOLDER + "fitContentColumnsTest.pdf"; + String cmpName = SOURCE_FOLDER + "cmp_fitContentColumnsTest.pdf"; + IList templateColumns = new List(); + templateColumns.Add((TemplateValue)new FlexValue(1f)); + templateColumns.Add((TemplateValue)new FlexValue(3f)); + templateColumns.Add((TemplateValue)new FitContentValue(UnitValue.CreatePercentValue(5.0f))); + SolidBorder border = new SolidBorder(ColorConstants.BLUE, 1); + using (Document document = new Document(new PdfDocument(new PdfWriter(filename)))) { + GridContainer grid = new GridContainer(); + grid.SetProperty(Property.GRID_TEMPLATE_COLUMNS, templateColumns); + grid.Add(new Paragraph("Test1").SetBorder(border)); + grid.Add(new Paragraph("Test2").SetBorder(border)); + grid.Add(new Paragraph("Test3 Test3 Test3 Test3 Test3 Test3 Test3 Test3").SetBorder(border)); + Paragraph test4 = new Paragraph("Test4Test4Test4Test4Test4 Test4 Test4 Test4 Test4 Test4 Test4 Test4").SetBorder + (border); + test4.SetProperty(Property.GRID_COLUMN_START, 1); + test4.SetProperty(Property.GRID_COLUMN_END, 3); + grid.Add(test4); + grid.Add(new Paragraph("Test5").SetBorder(border)); + document.Add(grid); + } + NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(filename, cmpName, DESTINATION_FOLDER, "diff_" + )); + } + [NUnit.Framework.Test] public virtual void ColumnSpanTest() { String filename = DESTINATION_FOLDER + "columnSpanTest.pdf"; String cmpName = SOURCE_FOLDER + "cmp_columnSpanTest.pdf"; - IList templateColumns = new List(); - templateColumns.Add(GridValue.CreatePointValue(100.0f)); - templateColumns.Add(GridValue.CreatePointValue(100.0f)); - templateColumns.Add(GridValue.CreatePointValue(100.0f)); + IList templateColumns = new List(); + templateColumns.Add((TemplateValue)new PointValue(100.0f)); + templateColumns.Add((TemplateValue)new PointValue(100.0f)); + templateColumns.Add((TemplateValue)new PointValue(100.0f)); SolidBorder border = new SolidBorder(ColorConstants.BLUE, 1); using (Document document = new Document(new PdfDocument(new PdfWriter(filename)))) { GridContainer grid = new GridContainer(); @@ -716,10 +824,10 @@ public virtual void ColumnSpanTest() { public virtual void RowSpanTest() { String filename = DESTINATION_FOLDER + "rowSpanTest.pdf"; String cmpName = SOURCE_FOLDER + "cmp_rowSpanTest.pdf"; - IList template = new List(); - template.Add(GridValue.CreatePointValue(100.0f)); - template.Add(GridValue.CreatePointValue(100.0f)); - template.Add(GridValue.CreatePointValue(100.0f)); + IList template = new List(); + template.Add((TemplateValue)new PointValue(100.0f)); + template.Add((TemplateValue)new PointValue(100.0f)); + template.Add((TemplateValue)new PointValue(100.0f)); SolidBorder border = new SolidBorder(ColorConstants.BLUE, 1); using (Document document = new Document(new PdfDocument(new PdfWriter(filename)))) { GridContainer grid = new GridContainer(); diff --git a/itext.tests/itext.layout.tests/itext/layout/element/gridcontainer/GridContainerLayoutTest.cs b/itext.tests/itext.layout.tests/itext/layout/element/gridcontainer/GridContainerLayoutTest.cs index abda01601e..2d35c9ba7c 100644 --- a/itext.tests/itext.layout.tests/itext/layout/element/gridcontainer/GridContainerLayoutTest.cs +++ b/itext.tests/itext.layout.tests/itext/layout/element/gridcontainer/GridContainerLayoutTest.cs @@ -33,6 +33,7 @@ You should have received a copy of the GNU Affero General Public License using iText.Layout.Element; using iText.Layout.Logs; using iText.Layout.Properties; +using iText.Layout.Properties.Grid; using iText.Test; using iText.Test.Attributes; @@ -148,8 +149,8 @@ public virtual void EmptyGridContainerTest() { GridContainer gridcontainer0 = new GridContainer(); gridcontainer0.SetProperty(Property.COLUMN_GAP_BORDER, null); gridcontainer0.SetBackgroundColor(ColorConstants.RED); - gridcontainer0.SetProperty(Property.GRID_TEMPLATE_COLUMNS, JavaUtil.ArraysAsList(GridValue.CreatePointValue - (150.0f), GridValue.CreatePointValue(150.0f), GridValue.CreatePointValue(150.0f))); + gridcontainer0.SetProperty(Property.GRID_TEMPLATE_COLUMNS, JavaUtil.ArraysAsList((TemplateValue)new PointValue + (150.0f), (TemplateValue)new PointValue(150.0f), (TemplateValue)new PointValue(150.0f))); gridcontainer0.SetProperty(Property.COLUMN_GAP, 12.0f); document.Add(gridcontainer0); document.Close(); @@ -164,8 +165,8 @@ public virtual void OverflowGridContainerTest() { Document document = new Document(pdfDocument); GridContainer gridcontainer0 = CreateGridBoxWithText(); gridcontainer0.SetBackgroundColor(ColorConstants.MAGENTA); - gridcontainer0.SetProperty(Property.GRID_TEMPLATE_ROWS, JavaUtil.ArraysAsList(GridValue.CreatePointValue(500.0f - ), GridValue.CreatePointValue(500.0f), GridValue.CreatePointValue(500.0f))); + gridcontainer0.SetProperty(Property.GRID_TEMPLATE_ROWS, JavaUtil.ArraysAsList((TemplateValue)new PointValue + (500.0f), (TemplateValue)new PointValue(500.0f), (TemplateValue)new PointValue(500.0f))); gridcontainer0.Add(new iText.Layout.Element.Image(ImageDataFactory.Create(SOURCE_FOLDER + "rock_texture.jpg" )).SetHeight(150)); document.Add(gridcontainer0); @@ -192,8 +193,8 @@ public virtual void NothingResultTest() { private GridContainer CreateGridBoxWithText() { GridContainer gridcontainer0 = new GridContainer(); gridcontainer0.SetProperty(Property.COLUMN_GAP_BORDER, null); - gridcontainer0.SetProperty(Property.GRID_TEMPLATE_COLUMNS, JavaUtil.ArraysAsList(GridValue.CreatePointValue - (150.0f), GridValue.CreatePointValue(150.0f), GridValue.CreatePointValue(150.0f))); + gridcontainer0.SetProperty(Property.GRID_TEMPLATE_COLUMNS, JavaUtil.ArraysAsList((TemplateValue)new PointValue + (150.0f), (TemplateValue)new PointValue(150.0f), (TemplateValue)new PointValue(150.0f))); gridcontainer0.SetProperty(Property.COLUMN_GAP, 12.0f); Div div1 = new Div(); div1.SetBackgroundColor(ColorConstants.YELLOW); diff --git a/itext.tests/itext.layout.tests/itext/layout/properties/GridValueTest.cs b/itext.tests/itext.layout.tests/itext/layout/properties/GridValueTest.cs index 02ea55f377..430b65805a 100644 --- a/itext.tests/itext.layout.tests/itext/layout/properties/GridValueTest.cs +++ b/itext.tests/itext.layout.tests/itext/layout/properties/GridValueTest.cs @@ -20,6 +20,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the You should have received a copy of the GNU Affero General Public License along with this program. If not, see . */ +using iText.Layout.Properties.Grid; using iText.Test; namespace iText.Layout.Properties { @@ -27,36 +28,52 @@ namespace iText.Layout.Properties { public class GridValueTest : ExtendedITextTest { [NUnit.Framework.Test] public virtual void UnitValueTest() { - GridValue value = GridValue.CreatePointValue(3.2f); - NUnit.Framework.Assert.IsTrue(value.IsPointValue()); - NUnit.Framework.Assert.AreEqual(3.2f, value.GetValue(), 0.00001); - value = GridValue.CreatePercentValue(30f); - NUnit.Framework.Assert.IsTrue(value.IsPercentValue()); - NUnit.Framework.Assert.AreEqual(30, value.GetValue(), 0.00001); + LengthValue value = new PointValue(3.2f); + NUnit.Framework.Assert.AreEqual(value.GetType(), TemplateValue.ValueType.POINT); + NUnit.Framework.Assert.AreEqual(3.2f, (float)value.GetValue(), 0.00001); + value = new PercentValue(30f); + NUnit.Framework.Assert.AreEqual(value.GetType(), TemplateValue.ValueType.PERCENT); + NUnit.Framework.Assert.AreEqual(30, (float)value.GetValue(), 0.00001); } [NUnit.Framework.Test] public virtual void MinMaxContentTest() { - GridValue value = GridValue.CreateMinContentValue(); - NUnit.Framework.Assert.IsTrue(value.IsMinContentValue()); - NUnit.Framework.Assert.IsNull(value.GetValue()); - value = GridValue.CreateMaxContentValue(); - NUnit.Framework.Assert.IsTrue(value.IsMaxContentValue()); - NUnit.Framework.Assert.IsNull(value.GetValue()); + GridValue value = MinContentValue.VALUE; + NUnit.Framework.Assert.AreEqual(value.GetType(), TemplateValue.ValueType.MIN_CONTENT); + value = MaxContentValue.VALUE; + NUnit.Framework.Assert.AreEqual(value.GetType(), TemplateValue.ValueType.MAX_CONTENT); } [NUnit.Framework.Test] public virtual void AutoTest() { - GridValue value = GridValue.CreateAutoValue(); - NUnit.Framework.Assert.IsTrue(value.IsAutoValue()); - NUnit.Framework.Assert.IsNull(value.GetValue()); + GridValue value = AutoValue.VALUE; + NUnit.Framework.Assert.AreEqual(value.GetType(), TemplateValue.ValueType.AUTO); } [NUnit.Framework.Test] public virtual void FlexValueTest() { - GridValue value = GridValue.CreateFlexValue(1.5f); - NUnit.Framework.Assert.IsTrue(value.IsFlexibleValue()); - NUnit.Framework.Assert.AreEqual(1.5f, (float)value.GetValue(), 0.00001); + FlexValue value = new FlexValue(1.5f); + NUnit.Framework.Assert.AreEqual(value.GetType(), TemplateValue.ValueType.FLEX); + NUnit.Framework.Assert.AreEqual(1.5f, (float)value.GetFlex(), 0.00001); + } + + [NUnit.Framework.Test] + public virtual void FitContentTest() { + FitContentValue value = new FitContentValue(new PointValue(50.0f)); + NUnit.Framework.Assert.AreEqual(value.GetType(), TemplateValue.ValueType.FIT_CONTENT); + NUnit.Framework.Assert.AreEqual(new PointValue(50.0f).GetValue(), value.GetLength().GetValue(), 0.00001); + value = new FitContentValue(UnitValue.CreatePercentValue(20.0f)); + NUnit.Framework.Assert.AreEqual(new PercentValue(20.0f).GetValue(), value.GetLength().GetValue(), 0.00001); + } + + [NUnit.Framework.Test] + public virtual void MinMaxTest() { + MinMaxValue value = new MinMaxValue(new PointValue(50.0f), new FlexValue(2.0f)); + NUnit.Framework.Assert.AreEqual(value.GetType(), TemplateValue.ValueType.MINMAX); + NUnit.Framework.Assert.AreEqual(new PointValue(50.0f).GetValue(), ((PointValue)value.GetMin()).GetValue(), + 0.00001); + NUnit.Framework.Assert.AreEqual(new FlexValue(2.0f).GetFlex(), ((FlexValue)value.GetMax()).GetFlex(), 0.00001 + ); } } } diff --git a/itext.tests/itext.layout.tests/itext/layout/renderer/GridUnitTest.cs b/itext.tests/itext.layout.tests/itext/layout/renderer/GridUnitTest.cs index 6b6b87a319..63796c5cc5 100644 --- a/itext.tests/itext.layout.tests/itext/layout/renderer/GridUnitTest.cs +++ b/itext.tests/itext.layout.tests/itext/layout/renderer/GridUnitTest.cs @@ -21,8 +21,10 @@ You should have received a copy of the GNU Affero General Public License along with this program. If not, see . */ using System; +using iText.Commons.Utils; using iText.Layout.Element; using iText.Layout.Properties; +using iText.Layout.Properties.Grid; using iText.Test; namespace iText.Layout.Renderer { @@ -30,35 +32,30 @@ namespace iText.Layout.Renderer { public class GridUnitTest : ExtendedITextTest { [NUnit.Framework.Test] public virtual void GetUniqueCellsTest() { - Grid grid = new Grid(3, 3, GridFlow.ROW); - grid.AddCell(new GridCell(new TextRenderer(new Text("One")))); IRenderer twoRenderer = new TextRenderer(new Text("Two")); twoRenderer.SetProperty(Property.GRID_COLUMN_START, 2); twoRenderer.SetProperty(Property.GRID_COLUMN_END, 4); - GridCell cell = new GridCell(twoRenderer); - grid.AddCell(cell); - grid.AddCell(new GridCell(new TextRenderer(new Text("Three")))); - grid.AddCell(new GridCell(new TextRenderer(new Text("Four")))); + iText.Layout.Renderer.Grid grid = Grid.Builder.ForItems(JavaUtil.ArraysAsList(new TextRenderer(new Text("One" + )), twoRenderer, new TextRenderer(new Text("Three")), new TextRenderer(new Text("Four")))).Columns(3). + Rows(3).Flow(GridFlow.ROW).Build(); NUnit.Framework.Assert.AreEqual(4, grid.GetUniqueGridCells(Grid.GridOrder.ROW).Count); } [NUnit.Framework.Test] - public virtual void GetUniqueCellsInColumnTest() { - Grid grid = new Grid(3, 3, GridFlow.ROW); - grid.AddCell(new GridCell(new TextRenderer(new Text("One")))); + public virtual void GetUniqueCellsInColumnAndRowTest() { IRenderer twoRenderer = new TextRenderer(new Text("Two")); twoRenderer.SetProperty(Property.GRID_ROW_START, 2); twoRenderer.SetProperty(Property.GRID_ROW_END, 4); - GridCell cell = new GridCell(twoRenderer); - grid.AddCell(cell); - grid.AddCell(new GridCell(new TextRenderer(new Text("Three")))); - grid.AddCell(new GridCell(new TextRenderer(new Text("Four")))); + iText.Layout.Renderer.Grid grid = Grid.Builder.ForItems(JavaUtil.ArraysAsList(new TextRenderer(new Text("One" + )), twoRenderer, new TextRenderer(new Text("Three")), new TextRenderer(new Text("Four")))).Columns(3). + Rows(3).Flow(GridFlow.ROW).Build(); NUnit.Framework.Assert.AreEqual(1, grid.GetUniqueCellsInTrack(Grid.GridOrder.COLUMN, 1).Count); + NUnit.Framework.Assert.AreEqual(3, grid.GetUniqueCellsInTrack(Grid.GridOrder.ROW, 0).Count); } [NUnit.Framework.Test] public virtual void InvalidColumnForGetColCellsTest() { - Grid grid = new Grid(3, 3, GridFlow.ROW); + iText.Layout.Renderer.Grid grid = new iText.Layout.Renderer.Grid(3, 3); NUnit.Framework.Assert.Catch(typeof(IndexOutOfRangeException), () => grid.GetUniqueCellsInTrack(Grid.GridOrder .COLUMN, 4)); NUnit.Framework.Assert.Catch(typeof(IndexOutOfRangeException), () => grid.GetUniqueCellsInTrack(Grid.GridOrder @@ -66,23 +63,9 @@ public virtual void InvalidColumnForGetColCellsTest() { NUnit.Framework.Assert.DoesNotThrow(() => grid.GetUniqueCellsInTrack(Grid.GridOrder.COLUMN, 2)); } - [NUnit.Framework.Test] - public virtual void GetUniqueCellsInRowTest() { - Grid grid = new Grid(3, 3, GridFlow.ROW); - grid.AddCell(new GridCell(new TextRenderer(new Text("One")))); - IRenderer twoRenderer = new TextRenderer(new Text("Two")); - twoRenderer.SetProperty(Property.GRID_COLUMN_START, 2); - twoRenderer.SetProperty(Property.GRID_COLUMN_END, 4); - GridCell cell = new GridCell(twoRenderer); - grid.AddCell(cell); - grid.AddCell(new GridCell(new TextRenderer(new Text("Three")))); - grid.AddCell(new GridCell(new TextRenderer(new Text("Four")))); - NUnit.Framework.Assert.AreEqual(2, grid.GetUniqueCellsInTrack(Grid.GridOrder.ROW, 0).Count); - } - [NUnit.Framework.Test] public virtual void InvalidRowForGetRowCellsTest() { - Grid grid = new Grid(3, 3, GridFlow.ROW); + iText.Layout.Renderer.Grid grid = new iText.Layout.Renderer.Grid(3, 3); NUnit.Framework.Assert.Catch(typeof(IndexOutOfRangeException), () => grid.GetUniqueCellsInTrack(Grid.GridOrder .ROW, 4)); NUnit.Framework.Assert.Catch(typeof(IndexOutOfRangeException), () => grid.GetUniqueCellsInTrack(Grid.GridOrder @@ -92,131 +75,104 @@ public virtual void InvalidRowForGetRowCellsTest() { [NUnit.Framework.Test] public virtual void SparsePackingTest() { - Grid grid = new Grid(3, 3, GridFlow.ROW); - GridCell cell1 = new GridCell(new TextRenderer(new Text("One"))); - grid.AddCell(cell1); - IRenderer renderer = new TextRenderer(new Text("Two")); - renderer.SetProperty(Property.GRID_COLUMN_START, 1); - renderer.SetProperty(Property.GRID_COLUMN_END, 6); - GridCell wideCell = new GridCell(renderer); - grid.AddCell(wideCell); - GridCell cell3 = new GridCell(new TextRenderer(new Text("Three"))); - GridCell cell4 = new GridCell(new TextRenderer(new Text("Four"))); - GridCell cell5 = new GridCell(new TextRenderer(new Text("Five"))); - GridCell cell6 = new GridCell(new TextRenderer(new Text("Six"))); - grid.AddCell(cell3); - grid.AddCell(cell4); - grid.AddCell(cell5); - grid.AddCell(cell6); - NUnit.Framework.Assert.AreEqual(cell1, grid.GetRows()[0][0]); - NUnit.Framework.Assert.AreEqual(wideCell, grid.GetRows()[1][0]); - NUnit.Framework.Assert.AreEqual(cell3, grid.GetRows()[2][0]); - NUnit.Framework.Assert.AreEqual(cell4, grid.GetRows()[2][1]); - NUnit.Framework.Assert.AreEqual(cell5, grid.GetRows()[2][2]); - NUnit.Framework.Assert.AreEqual(cell6, grid.GetRows()[2][3]); + IRenderer cell1 = new TextRenderer(new Text("One")); + IRenderer wideCell = new TextRenderer(new Text("Two")); + wideCell.SetProperty(Property.GRID_COLUMN_START, 2); + wideCell.SetProperty(Property.GRID_COLUMN_END, 4); + IRenderer cell3 = new TextRenderer(new Text("Three")); + IRenderer cell4 = new TextRenderer(new Text("Four")); + IRenderer cell5 = new TextRenderer(new Text("Five")); + IRenderer cell6 = new TextRenderer(new Text("Six")); + iText.Layout.Renderer.Grid grid = Grid.Builder.ForItems(JavaUtil.ArraysAsList(cell1, wideCell, cell3, cell4 + , cell5, cell6)).Columns(3).Rows(3).Flow(GridFlow.ROW).Build(); + NUnit.Framework.Assert.AreEqual(cell1, grid.GetRows()[0][0].GetValue()); + NUnit.Framework.Assert.AreEqual(wideCell, grid.GetRows()[0][1].GetValue()); + NUnit.Framework.Assert.AreEqual(wideCell, grid.GetRows()[0][2].GetValue()); + NUnit.Framework.Assert.AreEqual(cell3, grid.GetRows()[1][0].GetValue()); + NUnit.Framework.Assert.AreEqual(cell4, grid.GetRows()[1][1].GetValue()); + NUnit.Framework.Assert.AreEqual(cell5, grid.GetRows()[1][2].GetValue()); + NUnit.Framework.Assert.AreEqual(cell6, grid.GetRows()[2][0].GetValue()); } [NUnit.Framework.Test] public virtual void DensePackingTest() { - Grid grid = new Grid(3, 3, GridFlow.ROW_DENSE); - GridCell cell1 = new GridCell(new TextRenderer(new Text("One"))); - grid.AddCell(cell1); - IRenderer renderer = new TextRenderer(new Text("Two")); - renderer.SetProperty(Property.GRID_COLUMN_START, 1); - renderer.SetProperty(Property.GRID_COLUMN_END, 6); - GridCell wideCell = new GridCell(renderer); - grid.AddCell(wideCell); - GridCell cell3 = new GridCell(new TextRenderer(new Text("Three"))); - GridCell cell4 = new GridCell(new TextRenderer(new Text("Four"))); - GridCell cell5 = new GridCell(new TextRenderer(new Text("Five"))); - GridCell cell6 = new GridCell(new TextRenderer(new Text("Six"))); - grid.AddCell(cell3); - grid.AddCell(cell4); - grid.AddCell(cell5); - grid.AddCell(cell6); - NUnit.Framework.Assert.AreEqual(cell1, grid.GetRows()[0][0]); - NUnit.Framework.Assert.AreEqual(cell3, grid.GetRows()[0][1]); - NUnit.Framework.Assert.AreEqual(cell4, grid.GetRows()[0][2]); - NUnit.Framework.Assert.AreEqual(cell5, grid.GetRows()[0][3]); - NUnit.Framework.Assert.AreEqual(cell6, grid.GetRows()[0][4]); - NUnit.Framework.Assert.AreEqual(wideCell, grid.GetRows()[1][0]); + IRenderer cell1 = new TextRenderer(new Text("One")); + IRenderer wideCell = new TextRenderer(new Text("Two")); + wideCell.SetProperty(Property.GRID_COLUMN_START, 2); + wideCell.SetProperty(Property.GRID_COLUMN_END, 4); + IRenderer cell3 = new TextRenderer(new Text("Three")); + IRenderer cell4 = new TextRenderer(new Text("Four")); + IRenderer cell5 = new TextRenderer(new Text("Five")); + IRenderer cell6 = new TextRenderer(new Text("Six")); + iText.Layout.Renderer.Grid grid = Grid.Builder.ForItems(JavaUtil.ArraysAsList(cell1, wideCell, cell3, cell4 + , cell5, cell6)).Columns(3).Rows(3).Flow(GridFlow.ROW_DENSE).Build(); + NUnit.Framework.Assert.AreEqual(cell1, grid.GetRows()[0][0].GetValue()); + NUnit.Framework.Assert.AreEqual(wideCell, grid.GetRows()[0][1].GetValue()); + NUnit.Framework.Assert.AreEqual(wideCell, grid.GetRows()[0][2].GetValue()); + NUnit.Framework.Assert.AreEqual(cell3, grid.GetRows()[1][0].GetValue()); + NUnit.Framework.Assert.AreEqual(cell4, grid.GetRows()[1][1].GetValue()); + NUnit.Framework.Assert.AreEqual(cell5, grid.GetRows()[1][2].GetValue()); + NUnit.Framework.Assert.AreEqual(cell6, grid.GetRows()[2][0].GetValue()); } [NUnit.Framework.Test] public virtual void ColumnPackingTest() { - Grid grid = new Grid(3, 3, GridFlow.COLUMN); - GridCell cell1 = new GridCell(new TextRenderer(new Text("One"))); - GridCell cell2 = new GridCell(new TextRenderer(new Text("Two"))); - GridCell cell3 = new GridCell(new TextRenderer(new Text("Three"))); - GridCell cell4 = new GridCell(new TextRenderer(new Text("Four"))); - GridCell cell5 = new GridCell(new TextRenderer(new Text("Five"))); - GridCell cell6 = new GridCell(new TextRenderer(new Text("Six"))); - grid.AddCell(cell1); - grid.AddCell(cell2); - grid.AddCell(cell3); - grid.AddCell(cell4); - grid.AddCell(cell5); - grid.AddCell(cell6); - NUnit.Framework.Assert.AreEqual(cell1, grid.GetRows()[0][0]); - NUnit.Framework.Assert.AreEqual(cell2, grid.GetRows()[1][0]); - NUnit.Framework.Assert.AreEqual(cell3, grid.GetRows()[2][0]); - NUnit.Framework.Assert.AreEqual(cell4, grid.GetRows()[0][1]); - NUnit.Framework.Assert.AreEqual(cell5, grid.GetRows()[1][1]); - NUnit.Framework.Assert.AreEqual(cell6, grid.GetRows()[2][1]); + IRenderer cell1 = new TextRenderer(new Text("One")); + IRenderer cell2 = new TextRenderer(new Text("Two")); + IRenderer cell3 = new TextRenderer(new Text("Three")); + IRenderer cell4 = new TextRenderer(new Text("Four")); + IRenderer cell5 = new TextRenderer(new Text("Five")); + IRenderer cell6 = new TextRenderer(new Text("Six")); + iText.Layout.Renderer.Grid grid = Grid.Builder.ForItems(JavaUtil.ArraysAsList(cell1, cell2, cell3, cell4, + cell5, cell6)).Columns(3).Rows(3).Flow(GridFlow.COLUMN).Build(); + NUnit.Framework.Assert.AreEqual(cell1, grid.GetRows()[0][0].GetValue()); + NUnit.Framework.Assert.AreEqual(cell2, grid.GetRows()[1][0].GetValue()); + NUnit.Framework.Assert.AreEqual(cell3, grid.GetRows()[2][0].GetValue()); + NUnit.Framework.Assert.AreEqual(cell4, grid.GetRows()[0][1].GetValue()); + NUnit.Framework.Assert.AreEqual(cell5, grid.GetRows()[1][1].GetValue()); + NUnit.Framework.Assert.AreEqual(cell6, grid.GetRows()[2][1].GetValue()); } [NUnit.Framework.Test] public virtual void ColumnWithFixedWideCellPackingTest() { - Grid grid = new Grid(3, 3, GridFlow.COLUMN); - GridCell cell1 = new GridCell(new TextRenderer(new Text("One"))); - IRenderer renderer = new TextRenderer(new Text("Two")); - renderer.SetProperty(Property.GRID_COLUMN_START, 1); - renderer.SetProperty(Property.GRID_COLUMN_END, 3); - GridCell wideCell = new GridCell(renderer); - GridCell cell3 = new GridCell(new TextRenderer(new Text("Three"))); - GridCell cell4 = new GridCell(new TextRenderer(new Text("Four"))); - GridCell cell5 = new GridCell(new TextRenderer(new Text("Five"))); - GridCell cell6 = new GridCell(new TextRenderer(new Text("Six"))); - grid.AddCell(cell1); - grid.AddCell(wideCell); - grid.AddCell(cell3); - grid.AddCell(cell4); - grid.AddCell(cell5); - grid.AddCell(cell6); - NUnit.Framework.Assert.AreEqual(cell1, grid.GetRows()[0][0]); - NUnit.Framework.Assert.AreEqual(wideCell, grid.GetRows()[1][0]); - NUnit.Framework.Assert.AreEqual(wideCell, grid.GetRows()[1][1]); - NUnit.Framework.Assert.AreEqual(cell3, grid.GetRows()[2][0]); - NUnit.Framework.Assert.AreEqual(cell4, grid.GetRows()[0][1]); - NUnit.Framework.Assert.AreEqual(cell5, grid.GetRows()[2][1]); - NUnit.Framework.Assert.AreEqual(cell6, grid.GetRows()[0][2]); + IRenderer cell1 = new TextRenderer(new Text("One")); + IRenderer wideCell = new TextRenderer(new Text("Two")); + wideCell.SetProperty(Property.GRID_COLUMN_START, 1); + wideCell.SetProperty(Property.GRID_COLUMN_END, 3); + IRenderer cell3 = new TextRenderer(new Text("Three")); + IRenderer cell4 = new TextRenderer(new Text("Four")); + IRenderer cell5 = new TextRenderer(new Text("Five")); + IRenderer cell6 = new TextRenderer(new Text("Six")); + iText.Layout.Renderer.Grid grid = Grid.Builder.ForItems(JavaUtil.ArraysAsList(cell1, wideCell, cell3, cell4 + , cell5, cell6)).Columns(3).Rows(3).Flow(GridFlow.COLUMN).Build(); + NUnit.Framework.Assert.AreEqual(wideCell, grid.GetRows()[0][0].GetValue()); + NUnit.Framework.Assert.AreEqual(cell1, grid.GetRows()[1][0].GetValue()); + NUnit.Framework.Assert.AreEqual(cell4, grid.GetRows()[1][1].GetValue()); + NUnit.Framework.Assert.AreEqual(cell3, grid.GetRows()[2][0].GetValue()); + NUnit.Framework.Assert.AreEqual(wideCell, grid.GetRows()[0][1].GetValue()); + NUnit.Framework.Assert.AreEqual(cell5, grid.GetRows()[2][1].GetValue()); + NUnit.Framework.Assert.AreEqual(cell6, grid.GetRows()[0][2].GetValue()); } [NUnit.Framework.Test] public virtual void ColumnWithFixedTallCellPackingTest() { - Grid grid = new Grid(3, 3, GridFlow.COLUMN); - GridCell cell1 = new GridCell(new TextRenderer(new Text("One"))); - IRenderer renderer = new TextRenderer(new Text("Two")); - renderer.SetProperty(Property.GRID_ROW_START, 2); - renderer.SetProperty(Property.GRID_ROW_END, 4); - GridCell tallCell = new GridCell(renderer); - GridCell cell3 = new GridCell(new TextRenderer(new Text("Three"))); - GridCell cell4 = new GridCell(new TextRenderer(new Text("Four"))); - GridCell cell5 = new GridCell(new TextRenderer(new Text("Five"))); - GridCell cell6 = new GridCell(new TextRenderer(new Text("Six"))); - grid.AddCell(cell1); - grid.AddCell(tallCell); - grid.AddCell(cell3); - grid.AddCell(cell4); - grid.AddCell(cell5); - grid.AddCell(cell6); - NUnit.Framework.Assert.AreEqual(cell1, grid.GetRows()[0][0]); - NUnit.Framework.Assert.AreEqual(tallCell, grid.GetRows()[1][0]); - NUnit.Framework.Assert.AreEqual(tallCell, grid.GetRows()[2][0]); - NUnit.Framework.Assert.AreEqual(cell3, grid.GetRows()[0][1]); - NUnit.Framework.Assert.AreEqual(cell4, grid.GetRows()[1][1]); - NUnit.Framework.Assert.AreEqual(cell5, grid.GetRows()[2][1]); - NUnit.Framework.Assert.AreEqual(cell6, grid.GetRows()[0][2]); + IRenderer cell1 = new TextRenderer(new Text("One")); + IRenderer tallCell = new TextRenderer(new Text("Two")); + tallCell.SetProperty(Property.GRID_ROW_START, 2); + tallCell.SetProperty(Property.GRID_ROW_END, 4); + IRenderer cell3 = new TextRenderer(new Text("Three")); + IRenderer cell4 = new TextRenderer(new Text("Four")); + IRenderer cell5 = new TextRenderer(new Text("Five")); + IRenderer cell6 = new TextRenderer(new Text("Six")); + iText.Layout.Renderer.Grid grid = Grid.Builder.ForItems(JavaUtil.ArraysAsList(cell1, tallCell, cell3, cell4 + , cell5, cell6)).Columns(3).Rows(3).Flow(GridFlow.COLUMN).Build(); + NUnit.Framework.Assert.AreEqual(cell1, grid.GetRows()[0][0].GetValue()); + NUnit.Framework.Assert.AreEqual(tallCell, grid.GetRows()[1][0].GetValue()); + NUnit.Framework.Assert.AreEqual(tallCell, grid.GetRows()[2][0].GetValue()); + NUnit.Framework.Assert.AreEqual(cell3, grid.GetRows()[0][1].GetValue()); + NUnit.Framework.Assert.AreEqual(cell4, grid.GetRows()[1][1].GetValue()); + NUnit.Framework.Assert.AreEqual(cell5, grid.GetRows()[2][1].GetValue()); + NUnit.Framework.Assert.AreEqual(cell6, grid.GetRows()[0][2].GetValue()); } } } diff --git a/itext.tests/itext.layout.tests/resources/itext/layout/GridContainerTest/cmp_autoRepeatOnEmptyGridTest.pdf b/itext.tests/itext.layout.tests/resources/itext/layout/GridContainerTest/cmp_autoRepeatOnEmptyGridTest.pdf new file mode 100644 index 0000000000000000000000000000000000000000..ff5abb4b25149feda490a397843e5a17e5423599 GIT binary patch literal 988 zcmc&y%Wl&^6fFx__$y`;HC2`Rdd4%3QDmtkq!jwFlBkj&l4lp+g{UaX#&hB&lkP^3q$r+x9+qld;%<#XxKZkxvc|HmNTWXTk5Lu!iCIp;J$cMYH>5K^mDX_xT~S6@nT5@< z>h+SupV;E^9)EIkg|6rVlcW)EB-tHF=e{mXIdILj2ahSx5JccUTu|5rwhgeo;~yLK zZ$fH~TI6Wk#RQl2XVNzoNp}zScxQaFpN^lMPRMzC{~$dguhCXc@O+1SqyW%qB+34j zy{V8KShKhyCuchwuffJ^(?qpyeAQK7)^ctxHsmIh_0;-i;Zh3x7lo>(O~#{{|2v9m zQ?j(EJs`q!Ue<>Q&KW0~++rbg$?6{|HyC#*Hs=mTnYf1q)OGL|4+1yfTdcOSn4@hr z?QlS*y(~~nMOtT=cQuGm2rXhBWO0ZnKx<$;3oxgM5sS2X!w{`H3Y$==JGJ{{U~zIWx$^1Bw91 z^0^PG0g>o{QI-a8bx9bNQ3_F-AWclo+zBG&BXWKUtD{}8k!#Tzv&v%?gJ?UX28nFN zJ|vn#m90MnIr?8wEps9cXCJ9Bad-|?nFbV#x*gp_US)KY7*$NCp^VB(iEMd@VrpTB z*jO2PX9LdnW86Pr?v&!c1FEqUEg#}+I05tNDKsi$K<*$Ov~%@crD}c4_yn5Hmd2_( z&>@Hub>Z{?`jTRdbNWhDnu`x7fW~6knnSzx4s?4Z-Ci|_q(em;)hJJSQ#QK6nu-pv z5uSkN$lLuUNR5GGqn4`OZ) zMKYz;tj+wL(eAFBG9N==V8jfCv9pk4+j$!W=z-666*|38^w7tMD!R&N;ld+6$`sgD zahRx4TIF--KjPAuhfRp}6Wm%xQ^Ov0gFN#+mllLah)ck87*I}WfH}w14sc*I;Rw&= zR=z+3iwogHfjBNJh`{#%FgOKY1P;amY-Rz$%(i$Sh^l~nmk?ht!i0@I7O2_sndMRH zs_Q(DLGl0ZV8+}U1rq5eQ8Q~&Ds9_lJv;)4DLpgokd>&RqHg`*hy@sXjJsax{dv++G-rOAvuXtg1UG(>C_={ zLF~e5M~wBZ{I(E zF))BYcn^)aIkOS<_C6JFuC*`_m$A zNMIXcYXjo3=WpcOM;GMe)5)vV$rsng_wOv#mZzSLzndsNp-0!J4i25e8_C7x+rEEr zc)57#*T>GM!<)sg6Gzptm#?qfH+UQjv#6aW<&4PHM4a+CO@JocGFN#Jv8otsLUqI? z3|zGE<})6pbs$5Oe!{_m6#ZSWwlOo}ibh;@5y?=B ztg0GISxlC`dMSH(T3(JTi78mx1J=0Rc5sjl%^9#x@2aIJP;Ig6s~&CpLmq z|Mfa$v!NQ1Gd4sOsWUc+&f~Ck3YSV2^|;heW2p`{=R)EW5`-ResmE=_&f>TPY2f++ z^q_~F!1o;NQAQcY(4}^upfErVE%_|89ORb*&I1Q|m=fZKu8#!jhbfWq7p>@#p#`psKApB7fO*LJ6Gd)Ao}ym;w1Uj)r#MJ>b4PsN=2b@z9- zFAlP^`B`d9QNzH)QK2QVaF>Qh2Z0#t%1>trnZIt&h2U{v-a${j$V4)<@|p1R{r=| z<#NjHhPg*_$R}d9a}#xKn)Rw9ek(uP($o#?Q$0*#_iJl5yfOK5h3jAq)MpEKFzPj8 zCH7^bSD%q*PG;^t{4ON3#+E735o3pbUK;jT_|RlwS9=NE)Hw2fP;cASP3^0DCN4TG zIcfa~<@>jHh4(ifn~K?Uy5aNb-gm}pBVL_w>}>6x^R}=R1KzmSBQB=HaXz)bm47ns z%GW<0pb~0NIpJt%`9;M& zCoPa^%uMpBfC$nQpN@RG225c%F$a=7!dj)S7#d5OrvXP1rC6?@8a{yVyEu`iRI4J= zObHp$<_`yqxo0y5mZy3uAIOkbUxkb`WyoeT;g}#uBVs{`X@=5tkK(f%N{qKZLqLLp z4CHVY=SVyel5r5mC14Ik`frC^RgtPiq{e&lP@R4hq$w%_ToO#8t*-3UT-W-XJWvv! zx-K^h)F4$e4lGFk9}*Bkt9c|yty1eX1lFlabrr}iNC;rX16a)>w1rmqt4b4e!K;)7 zoXu7&6t-5-kl7<_J@VEd-6INEy3e?29$y*uyvLX7(>!d(Rl(y$s`&(E+CgzL#ko0=Vg-_L%aU87AiwLj= gpRs;PTTMk<|E*|?rVFa>CmM$YZi$Ue&&ja-4I+I7X#fBK literal 0 HcmV?d00001 diff --git a/itext/itext.kernel/itext/kernel/utils/TaggedPdfReaderTool.cs b/itext/itext.kernel/itext/kernel/utils/TaggedPdfReaderTool.cs index 3e129b30cb..c65335e8e6 100644 --- a/itext/itext.kernel/itext/kernel/utils/TaggedPdfReaderTool.cs +++ b/itext/itext.kernel/itext/kernel/utils/TaggedPdfReaderTool.cs @@ -339,11 +339,9 @@ public virtual ICollection GetSupportedEvents() { return null; } - //\cond DO_NOT_DOCUMENT internal MarkedContentEventListener(TaggedPdfReaderTool _enclosing) { this._enclosing = _enclosing; } - //\endcond private readonly TaggedPdfReaderTool _enclosing; } diff --git a/itext/itext.layout/itext/layout/exceptions/LayoutExceptionMessageConstant.cs b/itext/itext.layout/itext/layout/exceptions/LayoutExceptionMessageConstant.cs index 30fa21dd35..1bce86f136 100644 --- a/itext/itext.layout/itext/layout/exceptions/LayoutExceptionMessageConstant.cs +++ b/itext/itext.layout/itext/layout/exceptions/LayoutExceptionMessageConstant.cs @@ -65,6 +65,10 @@ public sealed class LayoutExceptionMessageConstant { public const String TAGGING_HINTKEY_SHOULD_HAVE_ACCES = "TaggingHintKey should have accessibility properties"; + public const String GRID_AUTO_REPEAT_CAN_BE_USED_ONLY_ONCE = "Automatic repetitions in the grid template are allowed only once per template."; + + public const String GRID_AUTO_REPEAT_CANNOT_BE_COMBINED_WITH_INDEFINITE_SIZES = "Automatic repetitions in the grid template cannot be combined with intrinsic or flexible sizes."; + private LayoutExceptionMessageConstant() { } } diff --git a/itext/itext.layout/itext/layout/properties/GridValue.cs b/itext/itext.layout/itext/layout/properties/GridValue.cs deleted file mode 100644 index 6364518daf..0000000000 --- a/itext/itext.layout/itext/layout/properties/GridValue.cs +++ /dev/null @@ -1,222 +0,0 @@ -/* -This file is part of the iText (R) project. -Copyright (c) 1998-2024 Apryse Group NV -Authors: Apryse Software. - -This program is offered under a commercial and under the AGPL license. -For commercial licensing, contact us at https://itextpdf.com/sales. For AGPL licensing, see below. - -AGPL licensing: -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see . -*/ -namespace iText.Layout.Properties { - /// - /// A specialized class that holds a value for grid-template-columns/rows and - /// grid-auto-columns/rows properties and the type it is measured in. - /// - public class GridValue { - private static readonly iText.Layout.Properties.GridValue MIN_CONTENT_VALUE = new iText.Layout.Properties.GridValue - (GridValue.SizingValueType.MIN_CONTENT); - - private static readonly iText.Layout.Properties.GridValue MAX_CONTENT_VALUE = new iText.Layout.Properties.GridValue - (GridValue.SizingValueType.MAX_CONTENT); - - private static readonly iText.Layout.Properties.GridValue AUTO_VALUE = new iText.Layout.Properties.GridValue - (GridValue.SizingValueType.AUTO); - - private GridValue.SizingValueType type; - - private float? value; - - private GridValue() { - } - - // Do nothing - private GridValue(GridValue.SizingValueType type) { - this.type = type; - } - - /// - /// Creates an instance of - /// - /// with point value. - /// - /// the point value - /// the grid value instance - public static iText.Layout.Properties.GridValue CreatePointValue(float value) { - iText.Layout.Properties.GridValue result = new iText.Layout.Properties.GridValue(); - result.type = GridValue.SizingValueType.POINT; - result.value = value; - return result; - } - - /// - /// Creates an instance of - /// - /// with percent value. - /// - /// the percent value - /// the grid value instance - public static iText.Layout.Properties.GridValue CreatePercentValue(float value) { - iText.Layout.Properties.GridValue result = new iText.Layout.Properties.GridValue(); - result.type = GridValue.SizingValueType.PERCENT; - result.value = value; - return result; - } - - /// - /// Creates an instance of - /// - /// with min-content value. - /// - /// the grid value instance - public static iText.Layout.Properties.GridValue CreateMinContentValue() { - return MIN_CONTENT_VALUE; - } - - /// - /// Creates an instance of - /// - /// with max-content value. - /// - /// the grid value instance - public static iText.Layout.Properties.GridValue CreateMaxContentValue() { - return MAX_CONTENT_VALUE; - } - - /// - /// Creates an instance of - /// - /// with auto value. - /// - /// the grid value instance - public static iText.Layout.Properties.GridValue CreateAutoValue() { - return AUTO_VALUE; - } - - /// - /// Creates an instance of - /// - /// with flexible value. - /// - /// the flexible value - /// the grid value instance - public static iText.Layout.Properties.GridValue CreateFlexValue(float value) { - iText.Layout.Properties.GridValue result = new iText.Layout.Properties.GridValue(); - result.type = GridValue.SizingValueType.FLEX; - result.value = value; - return result; - } - - /// Checks whether the value is absolute. - /// - /// - /// - /// if absolute, - /// - /// otherwise - /// - public virtual bool IsPointValue() { - return type == GridValue.SizingValueType.POINT; - } - - /// Checks whether the value is percent. - /// - /// - /// - /// if percent, - /// - /// otherwise - /// - public virtual bool IsPercentValue() { - return type == GridValue.SizingValueType.PERCENT; - } - - /// Checks whether the value is auto. - /// - /// - /// - /// if auto, - /// - /// otherwise - /// - public virtual bool IsAutoValue() { - return type == GridValue.SizingValueType.AUTO; - } - - /// Checks whether the value is min-content. - /// - /// - /// - /// if min-content, - /// - /// otherwise - /// - public virtual bool IsMinContentValue() { - return type == GridValue.SizingValueType.MIN_CONTENT; - } - - /// Checks whether the value is max-content. - /// - /// - /// - /// if max-content, - /// - /// otherwise - /// - public virtual bool IsMaxContentValue() { - return type == GridValue.SizingValueType.MAX_CONTENT; - } - - /// Checks whether the value is flexible. - /// - /// - /// - /// if flexible, - /// - /// otherwise - /// - public virtual bool IsFlexibleValue() { - return type == GridValue.SizingValueType.FLEX; - } - - /// Gets value, if exists. - /// - /// the value, or - /// - /// if there is no value - /// - public virtual float? GetValue() { - return value; - } - - /// Enum of sizing value types. - private enum SizingValueType { - /// Type which presents absolute point value. - POINT, - /// Type which presents relative percent value. - PERCENT, - /// Type which presents relative auto value. - AUTO, - /// Type which presents relative min content value. - MIN_CONTENT, - /// Type which presents relative max content value. - MAX_CONTENT, - /// Type which presents relative fit content function value. - FIT_CONTENT, - /// Type which presents relative flexible value. - FLEX - } - } -} diff --git a/itext/itext.layout/itext/layout/properties/grid/AutoRepeatValue.cs b/itext/itext.layout/itext/layout/properties/grid/AutoRepeatValue.cs new file mode 100644 index 0000000000..1e638cdaa5 --- /dev/null +++ b/itext/itext.layout/itext/layout/properties/grid/AutoRepeatValue.cs @@ -0,0 +1,41 @@ +using System.Collections.Generic; + +namespace iText.Layout.Properties.Grid { + /// This class represents an auto-repeat template value. + /// + /// This class represents an auto-repeat template value. + /// This value is preprocessed before grid sizing algorithm so its only exists at template level. + /// + public class AutoRepeatValue : TemplateValue { + private readonly IList values; + + private readonly bool autoFit; + + /// Create a new auto-repeat value + /// determines whether to shrink flatten template values to match the grid size + /// template values to repeat + public AutoRepeatValue(bool autoFit, IList values) + : base(TemplateValue.ValueType.AUTO_REPEAT) { + this.values = values; + this.autoFit = autoFit; + } + + /// Get template values which should be repeated. + /// template values list + public virtual IList GetValues() { + return values; + } + + /// Determines whether to shrink flatten template values to match the grid size. + /// + /// + /// + /// if to shrink, + /// + /// otherwise + /// + public virtual bool IsAutoFit() { + return autoFit; + } + } +} diff --git a/itext/itext.layout/itext/layout/properties/grid/AutoValue.cs b/itext/itext.layout/itext/layout/properties/grid/AutoValue.cs new file mode 100644 index 0000000000..6f343d4ef4 --- /dev/null +++ b/itext/itext.layout/itext/layout/properties/grid/AutoValue.cs @@ -0,0 +1,12 @@ +namespace iText.Layout.Properties.Grid { + /// Represents an auto template value. + public sealed class AutoValue : BreadthValue { + /// auto value constant. + public static readonly iText.Layout.Properties.Grid.AutoValue VALUE = new iText.Layout.Properties.Grid.AutoValue + (); + + private AutoValue() + : base(TemplateValue.ValueType.AUTO) { + } + } +} diff --git a/itext/itext.layout/itext/layout/properties/grid/BreadthValue.cs b/itext/itext.layout/itext/layout/properties/grid/BreadthValue.cs new file mode 100644 index 0000000000..b5ec2cd9bb --- /dev/null +++ b/itext/itext.layout/itext/layout/properties/grid/BreadthValue.cs @@ -0,0 +1,10 @@ +namespace iText.Layout.Properties.Grid { + /// Represents a breadth value on a grid. + public abstract class BreadthValue : GridValue { + /// Init a breadth value with a given type + /// value type + protected internal BreadthValue(TemplateValue.ValueType type) + : base(type) { + } + } +} diff --git a/itext/itext.layout/itext/layout/properties/grid/FitContentValue.cs b/itext/itext.layout/itext/layout/properties/grid/FitContentValue.cs new file mode 100644 index 0000000000..1f9b3c9afe --- /dev/null +++ b/itext/itext.layout/itext/layout/properties/grid/FitContentValue.cs @@ -0,0 +1,65 @@ +using iText.Layout.Properties; + +namespace iText.Layout.Properties.Grid { + /// Represents fit content function template value. + public class FitContentValue : FunctionValue { + private LengthValue length; + + /// + /// Create fit content function value based on provided + /// + /// instance. + /// + /// max size value + public FitContentValue(LengthValue length) + : base(TemplateValue.ValueType.FIT_CONTENT) { + this.length = length; + } + + /// + /// Create fit content function value based on provided + /// + /// instance. + /// + /// max size value + public FitContentValue(UnitValue length) + : base(TemplateValue.ValueType.FIT_CONTENT) { + if (length != null) { + if (length.IsPointValue()) { + this.length = new PointValue(length.GetValue()); + } + else { + if (length.IsPercentValue()) { + this.length = new PercentValue(length.GetValue()); + } + } + } + } + + /// + /// Get underlying + /// + /// which represents max size on a grid for this value. + /// + /// + /// underlying + /// + /// value + /// + public virtual LengthValue GetLength() { + return length; + } + + /// Gets the maximum size which the value can take on passed space. + /// the space for which fit-content size will be calculated + /// the maximum size of the value on passed space + public virtual float GetMaxSizeForSpace(float space) { + if (length.GetType() == TemplateValue.ValueType.POINT) { + return length.GetValue(); + } + else { + return length.GetValue() / 100 * space; + } + } + } +} diff --git a/itext/itext.layout/itext/layout/properties/grid/FixedRepeatValue.cs b/itext/itext.layout/itext/layout/properties/grid/FixedRepeatValue.cs new file mode 100644 index 0000000000..b61b8a3f9b --- /dev/null +++ b/itext/itext.layout/itext/layout/properties/grid/FixedRepeatValue.cs @@ -0,0 +1,35 @@ +using System.Collections.Generic; + +namespace iText.Layout.Properties.Grid { + /// This class represents an fixed-repeat template value. + /// + /// This class represents an fixed-repeat template value. + /// This value is preprocessed before grid sizing algorithm so its only exists at template level. + /// + public class FixedRepeatValue : TemplateValue { + private readonly IList values; + + private readonly int repeatCount; + + /// Create a new fixed-repeat value + /// number of repetitions + /// template values to repeat + public FixedRepeatValue(int repeatCount, IList values) + : base(TemplateValue.ValueType.FIXED_REPEAT) { + this.values = values; + this.repeatCount = repeatCount; + } + + /// Gets template values which should be repeated. + /// template values list + public virtual IList GetValues() { + return values; + } + + /// Gets number of template values repetitions. + /// number of template values repetitions + public virtual int GetRepeatCount() { + return repeatCount; + } + } +} diff --git a/itext/itext.layout/itext/layout/properties/grid/FlexValue.cs b/itext/itext.layout/itext/layout/properties/grid/FlexValue.cs new file mode 100644 index 0000000000..f0fabb1e75 --- /dev/null +++ b/itext/itext.layout/itext/layout/properties/grid/FlexValue.cs @@ -0,0 +1,19 @@ +namespace iText.Layout.Properties.Grid { + /// Represents flexible template value. + public class FlexValue : BreadthValue { + protected internal float value; + + /// Create new flexible value instance. + /// fraction value + public FlexValue(float value) + : base(TemplateValue.ValueType.FLEX) { + this.value = value; + } + + /// Gets fraction value. + /// fraction value + public virtual float GetFlex() { + return value; + } + } +} diff --git a/itext/itext.layout/itext/layout/properties/grid/FunctionValue.cs b/itext/itext.layout/itext/layout/properties/grid/FunctionValue.cs new file mode 100644 index 0000000000..d391b6c114 --- /dev/null +++ b/itext/itext.layout/itext/layout/properties/grid/FunctionValue.cs @@ -0,0 +1,10 @@ +namespace iText.Layout.Properties.Grid { + /// Abstract class representing function value on a grid. + public abstract class FunctionValue : GridValue { + /// Init a function value with a given type. + /// value type + protected internal FunctionValue(TemplateValue.ValueType type) + : base(type) { + } + } +} diff --git a/itext/itext.layout/itext/layout/properties/GridFlow.cs b/itext/itext.layout/itext/layout/properties/grid/GridFlow.cs similarity index 95% rename from itext/itext.layout/itext/layout/properties/GridFlow.cs rename to itext/itext.layout/itext/layout/properties/grid/GridFlow.cs index 7f2d6e48a9..0b71d09cb2 100644 --- a/itext/itext.layout/itext/layout/properties/GridFlow.cs +++ b/itext/itext.layout/itext/layout/properties/grid/GridFlow.cs @@ -20,7 +20,9 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the You should have received a copy of the GNU Affero General Public License along with this program. If not, see . */ -namespace iText.Layout.Properties { +using iText.Layout.Properties; + +namespace iText.Layout.Properties.Grid { /// /// A specialized enum containing potential property values for /// . diff --git a/itext/itext.layout/itext/layout/properties/grid/GridValue.cs b/itext/itext.layout/itext/layout/properties/grid/GridValue.cs new file mode 100644 index 0000000000..eb195746f3 --- /dev/null +++ b/itext/itext.layout/itext/layout/properties/grid/GridValue.cs @@ -0,0 +1,35 @@ +/* +This file is part of the iText (R) project. +Copyright (c) 1998-2024 Apryse Group NV +Authors: Apryse Software. + +This program is offered under a commercial and under the AGPL license. +For commercial licensing, contact us at https://itextpdf.com/sales. For AGPL licensing, see below. + +AGPL licensing: +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see . +*/ +namespace iText.Layout.Properties.Grid { + /// + /// A specialized class that holds a value for grid-template-columns/rows and + /// grid-auto-columns/rows properties and the type it is measured in. + /// + public abstract class GridValue : TemplateValue { + /// Create grid value with a given type. + /// grid value type + protected internal GridValue(TemplateValue.ValueType type) + : base(type) { + } + } +} diff --git a/itext/itext.layout/itext/layout/properties/grid/LengthValue.cs b/itext/itext.layout/itext/layout/properties/grid/LengthValue.cs new file mode 100644 index 0000000000..970d1a0318 --- /dev/null +++ b/itext/itext.layout/itext/layout/properties/grid/LengthValue.cs @@ -0,0 +1,20 @@ +namespace iText.Layout.Properties.Grid { + /// Abstract class representing length value on a grid. + public abstract class LengthValue : BreadthValue { + protected internal float value; + + /// Gets length value. + /// length value + public virtual float GetValue() { + return value; + } + + /// Init a breadth value with a given type and value. + /// value type + /// length value + protected internal LengthValue(TemplateValue.ValueType type, float value) + : base(type) { + this.value = value; + } + } +} diff --git a/itext/itext.layout/itext/layout/properties/grid/MaxContentValue.cs b/itext/itext.layout/itext/layout/properties/grid/MaxContentValue.cs new file mode 100644 index 0000000000..6c443a8c10 --- /dev/null +++ b/itext/itext.layout/itext/layout/properties/grid/MaxContentValue.cs @@ -0,0 +1,12 @@ +namespace iText.Layout.Properties.Grid { + /// Represents max-content template value. + public sealed class MaxContentValue : BreadthValue { + /// max-content value. + public static readonly iText.Layout.Properties.Grid.MaxContentValue VALUE = new iText.Layout.Properties.Grid.MaxContentValue + (); + + private MaxContentValue() + : base(TemplateValue.ValueType.MAX_CONTENT) { + } + } +} diff --git a/itext/itext.layout/itext/layout/properties/grid/MinContentValue.cs b/itext/itext.layout/itext/layout/properties/grid/MinContentValue.cs new file mode 100644 index 0000000000..932859cfc8 --- /dev/null +++ b/itext/itext.layout/itext/layout/properties/grid/MinContentValue.cs @@ -0,0 +1,12 @@ +namespace iText.Layout.Properties.Grid { + /// Represents min-content template value. + public sealed class MinContentValue : BreadthValue { + /// min-content value. + public static readonly iText.Layout.Properties.Grid.MinContentValue VALUE = new iText.Layout.Properties.Grid.MinContentValue + (); + + private MinContentValue() + : base(TemplateValue.ValueType.MIN_CONTENT) { + } + } +} diff --git a/itext/itext.layout/itext/layout/properties/grid/MinMaxValue.cs b/itext/itext.layout/itext/layout/properties/grid/MinMaxValue.cs new file mode 100644 index 0000000000..33a7289c0e --- /dev/null +++ b/itext/itext.layout/itext/layout/properties/grid/MinMaxValue.cs @@ -0,0 +1,37 @@ +namespace iText.Layout.Properties.Grid { + /// Represents minmax function template value. + public class MinMaxValue : FunctionValue { + private readonly BreadthValue min; + + private readonly BreadthValue max; + + /// Create a minmax function with a given values. + /// min value of a track + /// max value of a track + public MinMaxValue(BreadthValue min, BreadthValue max) + : base(TemplateValue.ValueType.MINMAX) { + this.min = min; + this.max = max; + } + + /// Gets min template value + /// + /// + /// + /// instance + /// + public virtual BreadthValue GetMin() { + return min; + } + + /// Gets max template value + /// + /// + /// + /// instance + /// + public virtual BreadthValue GetMax() { + return max; + } + } +} diff --git a/itext/itext.layout/itext/layout/properties/grid/PercentValue.cs b/itext/itext.layout/itext/layout/properties/grid/PercentValue.cs new file mode 100644 index 0000000000..db19ed819e --- /dev/null +++ b/itext/itext.layout/itext/layout/properties/grid/PercentValue.cs @@ -0,0 +1,10 @@ +namespace iText.Layout.Properties.Grid { + /// Represents percent template value. + public class PercentValue : LengthValue { + /// Creates percent value. + /// percent value + public PercentValue(float value) + : base(TemplateValue.ValueType.PERCENT, value) { + } + } +} diff --git a/itext/itext.layout/itext/layout/properties/grid/PointValue.cs b/itext/itext.layout/itext/layout/properties/grid/PointValue.cs new file mode 100644 index 0000000000..859cc65460 --- /dev/null +++ b/itext/itext.layout/itext/layout/properties/grid/PointValue.cs @@ -0,0 +1,10 @@ +namespace iText.Layout.Properties.Grid { + /// Represents point template value. + public class PointValue : LengthValue { + /// Creates point value with a given length. + /// length value + public PointValue(float value) + : base(TemplateValue.ValueType.POINT, value) { + } + } +} diff --git a/itext/itext.layout/itext/layout/properties/grid/TemplateValue.cs b/itext/itext.layout/itext/layout/properties/grid/TemplateValue.cs new file mode 100644 index 0000000000..acc85e10b6 --- /dev/null +++ b/itext/itext.layout/itext/layout/properties/grid/TemplateValue.cs @@ -0,0 +1,43 @@ +namespace iText.Layout.Properties.Grid { + /// A class that indicates its descendant class can be used as a grid template value. + public abstract class TemplateValue { + /// Template value type. + protected internal readonly TemplateValue.ValueType type; + + /// Creates template value with a given type. + /// template value type + protected internal TemplateValue(TemplateValue.ValueType type) { + this.type = type; + } + + /// Gets template value type. + /// template value type + public virtual TemplateValue.ValueType GetType() { + return type; + } + + /// Enum of sizing value types. + public enum ValueType { + /// Type which represents absolute point value. + POINT, + /// Type which represents relative percent value. + PERCENT, + /// Type which represents relative auto value. + AUTO, + /// Type which represents relative min content value. + MIN_CONTENT, + /// Type which represents relative max content value. + MAX_CONTENT, + /// Type which presents fit content function value. + FIT_CONTENT, + /// Type which represents minmax function value. + MINMAX, + /// Type which represents relative flexible value. + FLEX, + /// Type which represents fixed repeat value. + FIXED_REPEAT, + /// Type which represents auto-repeat value. + AUTO_REPEAT + } + } +} diff --git a/itext/itext.layout/itext/layout/renderer/Grid.cs b/itext/itext.layout/itext/layout/renderer/Grid.cs index 07689c795f..4b39123fa9 100644 --- a/itext/itext.layout/itext/layout/renderer/Grid.cs +++ b/itext/itext.layout/itext/layout/renderer/Grid.cs @@ -25,7 +25,7 @@ You should have received a copy of the GNU Affero General Public License using System.Linq; using iText.Commons.Utils; using iText.Layout.Exceptions; -using iText.Layout.Properties; +using iText.Layout.Properties.Grid; namespace iText.Layout.Renderer { //\cond DO_NOT_DOCUMENT @@ -39,43 +39,25 @@ namespace iText.Layout.Renderer { internal class Grid { private GridCell[][] rows = new GridCell[][] { new GridCell[1] }; - private readonly Grid.CellPlacementHelper cellPlacementHelper; - - private float minHeight = 0.0f; + //Using array list instead of array for .NET portability + private readonly IList> uniqueCells = new List>(2); //\cond DO_NOT_DOCUMENT /// Creates a new grid instance. /// initial number of row for the grid /// initial number of columns for the grid - /// - internal Grid(int initialRowsCount, int initialColumnsCount, GridFlow flow) { - cellPlacementHelper = new Grid.CellPlacementHelper(this, flow); + internal Grid(int initialRowsCount, int initialColumnsCount) { EnsureGridSize(initialRowsCount, initialColumnsCount); - } -//\endcond - -//\cond DO_NOT_DOCUMENT - /// - /// Get resulting layout height of the grid, if it's less than explicit (minimal) height of the grid - /// return the explicit one. - /// - /// resulting layout height of a grid. - internal virtual float GetHeight() { - for (int i = GetNumberOfRows() - 1; i >= 0; --i) { - for (int j = 0; j < GetNumberOfColumns(); ++j) { - if (rows[i][j] != null) { - return Math.Max(rows[i][j].GetLayoutArea().GetTop(), minHeight); - } - } - } - return minHeight; + //Add GridOrder.ROW and GridOrder.COLUMN cache for unique cells, which is null initially + uniqueCells.Add(null); + uniqueCells.Add(null); } //\endcond //\cond DO_NOT_DOCUMENT /// Get internal matrix of cells. /// matrix of cells. - internal virtual GridCell[][] GetRows() { + internal GridCell[][] GetRows() { return rows; } //\endcond @@ -83,7 +65,7 @@ internal virtual GridCell[][] GetRows() { //\cond DO_NOT_DOCUMENT /// Gets the current number of rows of grid. /// the number of rows - internal virtual int GetNumberOfRows() { + internal int GetNumberOfRows() { return rows.Length; } //\endcond @@ -91,8 +73,8 @@ internal virtual int GetNumberOfRows() { //\cond DO_NOT_DOCUMENT /// Gets the current number of rows of grid. /// the number of columns - internal virtual int GetNumberOfColumns() { - return rows[0].Length; + internal int GetNumberOfColumns() { + return rows.Length > 0 ? rows[0].Length : 0; } //\endcond @@ -105,24 +87,27 @@ internal virtual int GetNumberOfColumns() { /// the track index from which cells will be extracted /// collection of unique cells in a row or column internal virtual ICollection GetUniqueCellsInTrack(Grid.GridOrder order, int trackIndex) { - ICollection result = new LinkedHashSet(); + IList result = new List(order == Grid.GridOrder.ROW ? GetNumberOfRows() : GetNumberOfColumns + ()); + GridCell previous = null; if (Grid.GridOrder.COLUMN == order) { foreach (GridCell[] row in rows) { - GridCell cell = row[trackIndex]; - if (cell != null) { - result.Add(cell); + GridCell current = row[trackIndex]; + if (current != null && current != previous) { + previous = current; + result.Add(current); } } - return result; } else { - foreach (GridCell cell in rows[trackIndex]) { - if (cell != null) { - result.Add(cell); + foreach (GridCell current in rows[trackIndex]) { + if (current != null && current != previous) { + previous = current; + result.Add(current); } } - return result; } + return result; } //\endcond @@ -133,6 +118,7 @@ internal virtual ICollection GetUniqueCellsInTrack(Grid.GridOrder orde /// Internally big cells (height * width > 1) are stored in multiple quantities /// For example, cell with height = 2 and width = 2 will have 4 instances on a grid (width * height) to simplify /// internal grid processing. This method counts such cells as one and returns a list of unique cells. + /// The result is cached since grid can't be changed after creation. /// /// /// if {GridOrder.ROW} the order of cells is from left to right, top to bottom @@ -141,6 +127,9 @@ internal virtual ICollection GetUniqueCellsInTrack(Grid.GridOrder orde /// collection of unique grid cells. internal virtual ICollection GetUniqueGridCells(Grid.GridOrder iterationOrder) { ICollection result = new LinkedHashSet(); + if (uniqueCells[(int)(iterationOrder)] != null) { + return uniqueCells[(int)(iterationOrder)]; + } if (Grid.GridOrder.COLUMN.Equals(iterationOrder)) { for (int j = 0; j < GetNumberOfColumns(); ++j) { for (int i = 0; i < GetNumberOfRows(); ++i) { @@ -149,8 +138,10 @@ internal virtual ICollection GetUniqueGridCells(Grid.GridOrder iterati } } } + uniqueCells[(int)(iterationOrder)] = result; return result; } + // GridOrder.ROW foreach (GridCell[] cellsRow in rows) { foreach (GridCell cell in cellsRow) { if (cell != null) { @@ -158,29 +149,11 @@ internal virtual ICollection GetUniqueGridCells(Grid.GridOrder iterati } } } + uniqueCells[(int)(iterationOrder)] = result; return result; } //\endcond -//\cond DO_NOT_DOCUMENT - /// Add cell in the grid, checking that it would fit and initializing it bottom left corner (x, y). - /// cell to and in the grid - internal virtual void AddCell(GridCell cell) { - cellPlacementHelper.Fit(cell); - for (int i = cell.GetRowStart(); i < cell.GetRowEnd(); ++i) { - for (int j = cell.GetColumnStart(); j < cell.GetColumnEnd(); ++j) { - rows[i][j] = cell; - } - } - } -//\endcond - -//\cond DO_NOT_DOCUMENT - internal virtual void SetMinHeight(float minHeight) { - this.minHeight = minHeight; - } -//\endcond - //\cond DO_NOT_DOCUMENT /// Resize grid if needed, so it would have given number of rows/columns. /// new grid height @@ -211,6 +184,89 @@ internal virtual void EnsureGridSize(int height, int width) { } //\endcond +//\cond DO_NOT_DOCUMENT + /// Deletes all null rows/columns depending on the given values. + /// + /// Deletes all null rows/columns depending on the given values. + /// If resulting grid size is less than provided minSize than some null lines will be preserved. + /// + /// + /// which null lines to remove - + /// + /// to remove rows + /// + /// to remove columns + /// + /// minimal size of the resulting grid + /// the number of left lines in given order + internal virtual int CollapseNullLines(Grid.GridOrder order, int minSize) { + int nullLinesStart = DetermineNullLinesStart(order); + if (nullLinesStart == -1) { + return Grid.GridOrder.ROW.Equals(order) ? GetNumberOfRows() : GetNumberOfColumns(); + } + else { + nullLinesStart = Math.Max(minSize, nullLinesStart); + } + int rowsNumber = Grid.GridOrder.ROW.Equals(order) ? nullLinesStart : GetNumberOfRows(); + int colsNumber = Grid.GridOrder.COLUMN.Equals(order) ? nullLinesStart : GetNumberOfColumns(); + GridCell[][] shrankGrid = new GridCell[rowsNumber][]; + for (int i = 0; i < shrankGrid.Length; ++i) { + shrankGrid[i] = new GridCell[colsNumber]; + } + for (int i = 0; i < shrankGrid.Length; ++i) { + Array.Copy(rows[i], 0, shrankGrid[i], 0, shrankGrid[0].Length); + } + rows = shrankGrid; + return Grid.GridOrder.ROW.Equals(order) ? GetNumberOfRows() : GetNumberOfColumns(); + } +//\endcond + + /// Add cell in the grid, checking that it would fit and initializing it bottom left corner (x, y). + /// cell to and in the grid + private void AddCell(GridCell cell) { + for (int i = cell.GetRowStart(); i < cell.GetRowEnd(); ++i) { + for (int j = cell.GetColumnStart(); j < cell.GetColumnEnd(); ++j) { + rows[i][j] = cell; + } + } + } + + private int DetermineNullLinesStart(Grid.GridOrder order) { + if (Grid.GridOrder.ROW.Equals(order)) { + for (int i = 0; i < GetNumberOfRows(); ++i) { + bool isNull = true; + for (int j = 0; j < GetNumberOfColumns(); ++j) { + if (GetRows()[i][j] != null) { + isNull = false; + break; + } + } + if (isNull) { + return i; + } + } + return -1; + } + else { + if (Grid.GridOrder.COLUMN.Equals(order)) { + for (int j = 0; j < GetNumberOfColumns(); ++j) { + bool isNull = true; + for (int i = 0; i < GetNumberOfRows(); ++i) { + if (GetRows()[i][j] != null) { + isNull = false; + break; + } + } + if (isNull) { + return j; + } + } + return -1; + } + } + return -1; + } + internal enum GridOrder { ROW, COLUMN @@ -278,9 +334,11 @@ public Grid.Builder Flow(GridFlow flow) { /// Grid /// instance. /// - public Grid Build() { - Grid grid = new Grid(rowCount, columnCount, flow); + public iText.Layout.Renderer.Grid Build() { + iText.Layout.Renderer.Grid grid = new iText.Layout.Renderer.Grid(rowCount, columnCount); + Grid.CellPlacementHelper cellPlacementHelper = new Grid.CellPlacementHelper(grid, flow); foreach (GridCell cell in cells) { + cellPlacementHelper.Fit(cell); grid.AddCell(cell); } return grid; @@ -379,10 +437,10 @@ public int Compare(GridCell lhs, GridCell rhs) { private class CellPlacementHelper { private readonly GridView view; - private readonly Grid grid; + private readonly iText.Layout.Renderer.Grid grid; //\cond DO_NOT_DOCUMENT - internal CellPlacementHelper(Grid grid, GridFlow flow) { + internal CellPlacementHelper(iText.Layout.Renderer.Grid grid, GridFlow flow) { this.view = new GridView(grid, flow); this.grid = grid; } diff --git a/itext/itext.layout/itext/layout/renderer/GridContainerRenderer.cs b/itext/itext.layout/itext/layout/renderer/GridContainerRenderer.cs index 9cac972df2..b4b8ab5c4c 100644 --- a/itext/itext.layout/itext/layout/renderer/GridContainerRenderer.cs +++ b/itext/itext.layout/itext/layout/renderer/GridContainerRenderer.cs @@ -27,12 +27,15 @@ You should have received a copy of the GNU Affero General Public License using iText.Layout.Element; using iText.Layout.Layout; using iText.Layout.Properties; +using iText.Layout.Properties.Grid; namespace iText.Layout.Renderer { /// Represents a renderer for a grid. public class GridContainerRenderer : BlockRenderer { private bool isFirstLayout = true; + private float containerHeight = 0.0f; + /// Creates a Grid renderer from its corresponding layout object. /// /// the @@ -52,9 +55,7 @@ public override IRenderer GetNextRenderer() { /// public override LayoutResult Layout(LayoutContext layoutContext) { - //TODO DEVSIX-8331 enable continuous container, right now its not working properly out of the box because - // we don't need to enable it for every element in a grid, probably only to those which get - // split by a page + //TODO DEVSIX-8331 enable continuous container //this.setProperty(Property.TREAT_AS_CONTINUOUS_CONTAINER, Boolean.TRUE); Rectangle actualBBox = layoutContext.GetArea().GetBBox().Clone(); float? blockWidth = RetrieveWidth(actualBBox.GetWidth()); @@ -65,7 +66,13 @@ public override LayoutResult Layout(LayoutContext layoutContext) { ApplyPaddings(actualBBox, false); ApplyBorderBox(actualBBox, false); ApplyMargins(actualBBox, false); - Grid grid = ConstructGrid(this, actualBBox); + float? blockHeight = RetrieveHeight(); + if (blockHeight != null && (float)blockHeight < actualBBox.GetHeight()) { + actualBBox.SetY(actualBBox.GetY() + actualBBox.GetHeight() - (float)blockHeight); + actualBBox.SetHeight((float)blockHeight); + } + Grid grid = ConstructGrid(this, new Rectangle(actualBBox.GetWidth(), blockHeight == null ? -1 : actualBBox + .GetHeight())); GridContainerRenderer.GridLayoutResult layoutResult = LayoutGrid(layoutContext, actualBBox, grid); if (layoutResult.GetOverflowRenderers().IsEmpty()) { this.occupiedArea = CalculateContainerOccupiedArea(layoutContext, grid, true); @@ -73,10 +80,7 @@ public override LayoutResult Layout(LayoutContext layoutContext) { } else { if (layoutResult.GetSplitRenderers().IsEmpty()) { - IRenderer cause = this; - if (!layoutResult.GetCauseOfNothing().IsEmpty()) { - cause = layoutResult.GetCauseOfNothing()[0]; - } + IRenderer cause = layoutResult.GetCauseOfNothing() == null ? this : layoutResult.GetCauseOfNothing(); return new LayoutResult(LayoutResult.NOTHING, null, null, this, cause); } else { @@ -160,7 +164,7 @@ private GridContainerRenderer.GridLayoutResult LayoutGrid(LayoutContext layoutCo float itemHeight = ((GridItemRenderer)cellToRender).CalculateHeight(cellBBox.GetHeight()); cellToRender.SetProperty(Property.HEIGHT, UnitValue.CreatePointValue(itemHeight)); // Adjust cell BBox to the remaining part of the layout bbox - // This way we can layout elements partially + // This way we can lay out elements partially cellBBox.SetHeight(cellBBox.GetTop() - actualBBox.GetBottom()).SetY(actualBBox.GetY()); cellToRender.SetProperty(Property.FILL_AVAILABLE_AREA, true); LayoutResult cellResult = cellToRender.Layout(cellContext); @@ -186,7 +190,7 @@ private static int ProcessLayoutResult(GridContainerRenderer.GridLayoutResult la cellToRenderer.SetProperty(Property.GRID_ROW_START, cell.GetRowStart() + 1); cellToRenderer.SetProperty(Property.GRID_ROW_END, cell.GetRowEnd() + 1); layoutResult.GetOverflowRenderers().Add(cellToRenderer); - layoutResult.GetCauseOfNothing().Add(cellResult.GetCauseOfNothing()); + layoutResult.SetCauseOfNothing(cellResult.GetCauseOfNothing()); return cell.GetRowStart(); } // PARTIAL + FULL result handling @@ -241,10 +245,10 @@ private static LayoutContext GetCellLayoutContext(LayoutContext layoutContext, R (), layoutContext.IsClippedHeight()); } - //calculate grid container occupied area based on its width/height properties and cell layout areas + // Calculate grid container occupied area based on its width/height properties and cell layout areas private LayoutArea CalculateContainerOccupiedArea(LayoutContext layoutContext, Grid grid, bool isFull) { LayoutArea area = layoutContext.GetArea().Clone(); - float totalHeight = UpdateOccupiedHeight(grid.GetHeight(), isFull); + float totalHeight = UpdateOccupiedHeight(containerHeight, isFull); if (totalHeight < area.GetBBox().GetHeight() || isFull) { area.GetBBox().SetHeight(totalHeight); Rectangle initialBBox = layoutContext.GetArea().GetBBox(); @@ -254,6 +258,7 @@ private LayoutArea CalculateContainerOccupiedArea(LayoutContext layoutContext, G return area; } + // Recalculate height/width after grid sizing and re-apply height/width properties private void RecalculateHeightAndWidthAfterLayout(Rectangle bBox, bool isFull) { float? height = RetrieveHeight(); if (height != null) { @@ -303,29 +308,46 @@ private float SafelyRetrieveFloatProperty(int property) { return 0F; } - //Grid layout algorithm is based on a https://drafts.csswg.org/css-grid/#layout-algorithm + // Grid layout algorithm is based on a https://drafts.csswg.org/css-grid/#layout-algorithm + // This method creates grid, positions items on it and sizes grid tracks private static Grid ConstructGrid(iText.Layout.Renderer.GridContainerRenderer renderer, Rectangle actualBBox ) { - IList templateColumns = renderer.GetProperty>(Property.GRID_TEMPLATE_COLUMNS); - IList templateRows = renderer.GetProperty>(Property.GRID_TEMPLATE_ROWS); + float? columnGapProp = renderer.GetProperty(Property.COLUMN_GAP); + float? rowGapProp = renderer.GetProperty(Property.ROW_GAP); + float columnGap = columnGapProp == null ? 0f : (float)columnGapProp; + float rowGap = rowGapProp == null ? 0f : (float)rowGapProp; + // Resolving repeats + GridTemplateResolver rowRepeatResolver = new GridTemplateResolver(actualBBox.GetHeight(), rowGap); + GridTemplateResolver columnRepeatResolver = new GridTemplateResolver(actualBBox.GetWidth(), columnGap); + IList templateRows = rowRepeatResolver.ResolveTemplate(renderer.GetProperty>(Property.GRID_TEMPLATE_ROWS)); + IList templateColumns = columnRepeatResolver.ResolveTemplate(renderer.GetProperty>(Property.GRID_TEMPLATE_COLUMNS)); GridFlow flow = renderer.GetProperty(Property.GRID_FLOW) == null ? GridFlow.ROW : (GridFlow)(renderer .GetProperty(Property.GRID_FLOW)); foreach (IRenderer child in renderer.GetChildRenderers()) { child.SetParent(renderer); } // 8. Placing Grid Items - Grid grid = Grid.Builder.ForItems(renderer.GetChildRenderers()).Columns(templateColumns == null ? 1 : templateColumns - .Count).Rows(templateRows == null ? 1 : templateRows.Count).Flow(flow).Build(); + iText.Layout.Renderer.Grid grid = Grid.Builder.ForItems(renderer.GetChildRenderers()).Columns(templateColumns + == null ? 1 : templateColumns.Count).Rows(templateRows == null ? 1 : templateRows.Count).Flow(flow).Build + (); + // Collapse any empty repeated tracks if auto-fit was used + if (rowRepeatResolver.IsCollapseNullLines()) { + templateRows = rowRepeatResolver.ShrinkTemplatesToFitSize(grid.CollapseNullLines(Grid.GridOrder.ROW, rowRepeatResolver + .GetFixedValuesCount())); + } + if (columnRepeatResolver.IsCollapseNullLines()) { + templateColumns = columnRepeatResolver.ShrinkTemplatesToFitSize(grid.CollapseNullLines(Grid.GridOrder.COLUMN + , columnRepeatResolver.GetFixedValuesCount())); + } + // 12. Grid Layout Algorithm GridValue columnAutoWidth = renderer.GetProperty(Property.GRID_AUTO_COLUMNS); GridValue rowAutoHeight = renderer.GetProperty(Property.GRID_AUTO_ROWS); - float? columnGapProp = renderer.GetProperty(Property.COLUMN_GAP); - float? rowGapProp = renderer.GetProperty(Property.ROW_GAP); - float columnGap = columnGapProp == null ? 0f : (float)columnGapProp; - float rowGap = rowGapProp == null ? 0f : (float)rowGapProp; - // 12. Grid Layout Algorithm GridSizer gridSizer = new GridSizer(grid, templateColumns, templateRows, columnAutoWidth, rowAutoHeight, columnGap , rowGap, actualBBox); gridSizer.SizeGrid(); + renderer.containerHeight = gridSizer.GetContainerHeight(); return grid; } @@ -334,7 +356,7 @@ private sealed class GridLayoutResult { private readonly IList overflowRenderers = new List(); - private readonly IList causeOfNothing = new List(); + private IRenderer causeOfNothing; public GridLayoutResult() { } @@ -348,7 +370,11 @@ public IList GetOverflowRenderers() { return overflowRenderers; } - public IList GetCauseOfNothing() { + public void SetCauseOfNothing(IRenderer causeOfNothing) { + this.causeOfNothing = causeOfNothing; + } + + public IRenderer GetCauseOfNothing() { return causeOfNothing; } } diff --git a/itext/itext.layout/itext/layout/renderer/GridSizer.cs b/itext/itext.layout/itext/layout/renderer/GridSizer.cs index 5d087e13ce..3fb8356322 100644 --- a/itext/itext.layout/itext/layout/renderer/GridSizer.cs +++ b/itext/itext.layout/itext/layout/renderer/GridSizer.cs @@ -20,13 +20,15 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the You should have received a copy of the GNU Affero General Public License along with this program. If not, see . */ +using System; using System.Collections.Generic; using iText.Kernel.Geom; -using iText.Layout.Properties; +using iText.Layout.Properties.Grid; namespace iText.Layout.Renderer { //\cond DO_NOT_DOCUMENT // 12.1. Grid Sizing Algorithm + /// Class representing grid sizing algorithm. internal class GridSizer { private readonly Grid grid; @@ -44,9 +46,21 @@ internal class GridSizer { private readonly Rectangle actualBBox; + private float containerHeight; + //\cond DO_NOT_DOCUMENT - internal GridSizer(Grid grid, IList templateColumns, IList templateRows, GridValue columnAutoWidth - , GridValue rowAutoHeight, float columnGap, float rowGap, Rectangle actualBBox) { + /// Creates new grid sizer instance. + /// grid to size + /// template values for columns + /// template values for rows + /// value which used to size columns out of template range + /// value which used to size rows out of template range + /// gap size between columns + /// gap size between rows + /// actual bbox which restricts sizing algorithm + internal GridSizer(iText.Layout.Renderer.Grid grid, IList templateColumns, IList templateRows + , GridValue columnAutoWidth, GridValue rowAutoHeight, float columnGap, float rowGap, Rectangle actualBBox + ) { this.grid = grid; this.templateColumns = templateColumns; this.templateRows = templateRows; @@ -58,6 +72,7 @@ internal GridSizer(Grid grid, IList templateColumns, IList } //\endcond + /// Resolves grid track sizes. public virtual void SizeGrid() { // 1. First, the track sizing algorithm is used to resolve the sizes of the grid columns. ResolveGridColumns(); @@ -65,6 +80,17 @@ public virtual void SizeGrid() { ResolveGridRows(); } + /// Gets grid container height. + /// + /// Gets grid container height. + /// Use this method only after calling + /// . + /// + /// grid container height covered by row template + public virtual float GetContainerHeight() { + return containerHeight; + } + private void ResolveGridRows() { IList rowsValues = new List(); for (int i = 0; i < grid.GetNumberOfRows(); i++) { @@ -76,13 +102,14 @@ private void ResolveGridRows() { rowsValues.Add(rowAutoHeight); } else { - rowsValues.Add(GridValue.CreateAutoValue()); + rowsValues.Add(AutoValue.VALUE); } } } - // TODO DEVSIX-8384 during grid sizing algorithm take into account grid container constraints - GridTrackSizer gridTrackSizer = new GridTrackSizer(grid, rowsValues, rowGap, -1, Grid.GridOrder.ROW); - IList rows = gridTrackSizer.SizeTracks(); + GridTrackSizer gridTrackSizer = new GridTrackSizer(grid, rowsValues, rowGap, actualBBox.GetHeight(), Grid.GridOrder + .ROW); + GridTrackSizer.TrackSizingResult result = gridTrackSizer.SizeTracks(); + IList rows = result.GetTrackSizesAndExpandPercents(rowsValues); foreach (GridCell cell in grid.GetUniqueGridCells(Grid.GridOrder.ROW)) { float y = 0.0f; for (int currentRow = 0; currentRow < cell.GetRowStart(); ++currentRow) { @@ -102,17 +129,41 @@ private void ResolveGridRows() { ++rowSizesIdx; cellHeight += (float)rows[i]; } - // Preserve row sizes for split + //Preserve row sizes for split cell.SetRowSizes(rowSizes); cellHeight += (cell.GetGridHeight() - 1) * rowGap; cell.GetLayoutArea().SetHeight(cellHeight); } - // calculating explicit height to ensure that even empty rows which covered by template would be considered + containerHeight = CalculateGridOccupiedHeight(result.GetTrackSizes()); + } + + /// Calculate grid container occupied area based on original (non-expanded percentages) track sizes. + /// original track sizes + /// grid container occupied area + private float CalculateGridOccupiedHeight(IList originalSizes) { + // Calculate explicit height to ensure that even empty rows which covered by template would be considered float minHeight = 0.0f; - foreach (float? row in rows) { - minHeight += (float)row; + for (int i = 0; i < (templateRows == null ? 0 : templateRows.Count); ++i) { + minHeight += (float)originalSizes[i]; + } + float maxHeight = Sum(originalSizes); + // Add gaps + minHeight += (grid.GetNumberOfRows() - 1) * rowGap; + maxHeight += (grid.GetNumberOfRows() - 1) * rowGap; + float occupiedHeight = 0.0f; + ICollection cells = grid.GetUniqueGridCells(Grid.GridOrder.ROW); + foreach (GridCell cell in cells) { + occupiedHeight = Math.Max(occupiedHeight, cell.GetLayoutArea().GetTop()); + } + return Math.Max(Math.Min(maxHeight, occupiedHeight), minHeight); + } + + private float Sum(IList trackSizes) { + float sum = 0.0f; + foreach (float? size in trackSizes) { + sum += (float)size; } - grid.SetMinHeight(minHeight); + return sum; } private void ResolveGridColumns() { @@ -126,13 +177,13 @@ private void ResolveGridColumns() { colsValues.Add(columnAutoWidth); } else { - colsValues.Add(GridValue.CreateFlexValue(1f)); + colsValues.Add(new FlexValue(1f)); } } } GridTrackSizer gridTrackSizer = new GridTrackSizer(grid, colsValues, columnGap, actualBBox.GetWidth(), Grid.GridOrder .COLUMN); - IList columns = gridTrackSizer.SizeTracks(); + IList columns = gridTrackSizer.SizeTracks().GetTrackSizesAndExpandPercents(colsValues); foreach (GridCell cell in grid.GetUniqueGridCells(Grid.GridOrder.COLUMN)) { float x = 0.0f; for (int currentColumn = 0; currentColumn < cell.GetColumnStart(); ++currentColumn) { diff --git a/itext/itext.layout/itext/layout/renderer/GridTemplateResolver.cs b/itext/itext.layout/itext/layout/renderer/GridTemplateResolver.cs new file mode 100644 index 0000000000..b975428051 --- /dev/null +++ b/itext/itext.layout/itext/layout/renderer/GridTemplateResolver.cs @@ -0,0 +1,296 @@ +using System; +using System.Collections.Generic; +using Microsoft.Extensions.Logging; +using iText.Commons; +using iText.Layout.Exceptions; +using iText.Layout.Properties.Grid; + +namespace iText.Layout.Renderer { +//\cond DO_NOT_DOCUMENT + internal class GridTemplateResolver { + private readonly float space; + + private readonly float gap; + + private bool containsIntrinsicOrFlexible = false; + + private GridTemplateResolver.AutoRepeatResolver autoRepeatResolver = null; + + private GridTemplateResolver.Result result = new GridTemplateResolver.Result(new List()); + +//\cond DO_NOT_DOCUMENT + internal GridTemplateResolver(float space, float gap) { + this.space = space; + this.gap = gap; + } +//\endcond + +//\cond DO_NOT_DOCUMENT + /// Determines if auto-fit repeat was encountered during processing. + /// true if auto-fit repeat was encountered, false otherwise + internal virtual bool IsCollapseNullLines() { + return autoRepeatResolver != null; + } +//\endcond + +//\cond DO_NOT_DOCUMENT + /// Determines how many fixed values (all template values except auto-fit/fill repeat) in the result. + /// + /// number of fixed values in template list + internal virtual int GetFixedValuesCount() { + if (autoRepeatResolver == null) { + return result.Size(); + } + return result.Size() - (autoRepeatResolver.end - autoRepeatResolver.start); + } +//\endcond + +//\cond DO_NOT_DOCUMENT + /// Shrinks template list to fit the given size by reducing number of auto-fit/fill repetitions. + /// size to fit template list + internal virtual IList ShrinkTemplatesToFitSize(int sizeToFit) { + if (autoRepeatResolver == null) { + return result.GetList(); + } + return autoRepeatResolver.ShrinkTemplatesToFitSize(sizeToFit); + } +//\endcond + +//\cond DO_NOT_DOCUMENT + /// Resolves template values to grid values by flatting repeats. + /// template values list + /// grid values list + internal virtual IList ResolveTemplate(IList template) { + if (template == null) { + return null; + } + try { + float leftSpace = this.space; + foreach (TemplateValue value in template) { + leftSpace -= ProcessValue(value); + leftSpace -= gap; + } + leftSpace += gap; + if (autoRepeatResolver != null) { + if (autoRepeatResolver.start == result.Size()) { + // This additional gap is needed when auto-repeat is located at the end of a template + // It's for simplifying the logic of auto-repeat, because it always adds gap after last element + leftSpace += gap; + } + autoRepeatResolver.Resolve(leftSpace); + } + return result.GetList(); + } + catch (InvalidOperationException exception) { + ITextLogManager.GetLogger(typeof(iText.Layout.Renderer.GridTemplateResolver)).LogWarning(exception.Message + ); + Reset(); + } + return null; + } +//\endcond + + private float ProcessValue(TemplateValue value) { + switch (value.GetType()) { + case TemplateValue.ValueType.MIN_CONTENT: + case TemplateValue.ValueType.MAX_CONTENT: + case TemplateValue.ValueType.AUTO: + case TemplateValue.ValueType.FLEX: + case TemplateValue.ValueType.FIT_CONTENT: { + result.AddValue((GridValue)value); + containsIntrinsicOrFlexible = true; + break; + } + + case TemplateValue.ValueType.POINT: { + result.AddValue((GridValue)value); + return ((PointValue)value).GetValue(); + } + + case TemplateValue.ValueType.PERCENT: { + result.AddValue((GridValue)value); + return space > 0.0f ? ((PercentValue)value).GetValue() / 100 * space : 0.0f; + } + + case TemplateValue.ValueType.MINMAX: { + result.AddValue((GridValue)value); + result.SetFreeze(true); + // Treating each track as its max track sizing function if that is definite + // or as its minimum track sizing function otherwise + // if encountered intrinsic or flexible before, then it doesn't matter what to process + bool currentValue = containsIntrinsicOrFlexible; + float length = ProcessValue(((MinMaxValue)value).GetMax()); + if (containsIntrinsicOrFlexible) { + length = ProcessValue(((MinMaxValue)value).GetMin()); + } + containsIntrinsicOrFlexible = currentValue; + result.SetFreeze(false); + return length; + } + + case TemplateValue.ValueType.FIXED_REPEAT: { + float usedSpace = 0.0f; + FixedRepeatValue repeat = (FixedRepeatValue)value; + for (int i = 0; i < repeat.GetRepeatCount(); ++i) { + foreach (GridValue element in repeat.GetValues()) { + usedSpace += ProcessValue(element); + } + usedSpace += (repeat.GetValues().Count - 1) * gap; + } + return usedSpace; + } + + case TemplateValue.ValueType.AUTO_REPEAT: { + if (autoRepeatResolver != null) { + throw new InvalidOperationException(LayoutExceptionMessageConstant.GRID_AUTO_REPEAT_CAN_BE_USED_ONLY_ONCE); + } + autoRepeatResolver = new GridTemplateResolver.AutoRepeatResolver(this, (AutoRepeatValue)value, result.Size + ()); + break; + } + } + return 0.0f; + } + + private void Reset() { + autoRepeatResolver = null; + result.GetList().Clear(); + result.SetInsertPoint(-1); + } + + private class AutoRepeatResolver { +//\cond DO_NOT_DOCUMENT + internal readonly AutoRepeatValue repeat; +//\endcond + +//\cond DO_NOT_DOCUMENT + internal readonly int start; +//\endcond + +//\cond DO_NOT_DOCUMENT + internal int end = -1; +//\endcond + +//\cond DO_NOT_DOCUMENT + internal AutoRepeatResolver(GridTemplateResolver _enclosing, AutoRepeatValue repeat, int pos) { + this._enclosing = _enclosing; + this.repeat = repeat; + this.start = pos; + } +//\endcond + + /// Resolves auto-fit/fill repeat if it was encountered. + /// + /// Resolves auto-fit/fill repeat if it was encountered. + /// If given space is less than 0, only one iteration will be performed. + /// + /// space to fit repeat values on + public virtual void Resolve(float leftSpace) { + float usedSpace = 0.0f; + float usedSpacePerIteration = -1.0f; + int fixedTemplatesCount = this._enclosing.result.Size(); + do { + this._enclosing.result.SetInsertPoint(this.start); + foreach (GridValue value in this.repeat.GetValues()) { + usedSpace += this._enclosing.ProcessValue(value); + usedSpace += this._enclosing.gap; + } + if (usedSpacePerIteration < 0.0f) { + usedSpacePerIteration = usedSpace; + } + if (this._enclosing.containsIntrinsicOrFlexible) { + throw new InvalidOperationException(LayoutExceptionMessageConstant.GRID_AUTO_REPEAT_CANNOT_BE_COMBINED_WITH_INDEFINITE_SIZES + ); + } + } + while (usedSpace + usedSpacePerIteration <= leftSpace); + this.end = this.start + this._enclosing.result.Size() - fixedTemplatesCount; + } + +//\cond DO_NOT_DOCUMENT + /// Shrinks template list to fit the given size by reducing number of auto-fit/fill repetitions. + /// size to fit template list + internal virtual IList ShrinkTemplatesToFitSize(int sizeToFit) { + // Getting max number of available repetitions + int allowedRepeatValuesCount = this.GetAllowedRepeatValuesCount(sizeToFit); + // It could be done with .subList(), but this is not portable on .NET + IList shrankResult = new List(this._enclosing.result.Size()); + IList previousResult = this._enclosing.result.GetList(); + for (int i = 0; i < this.start; ++i) { + shrankResult.Add(previousResult[i]); + } + for (int i = 0; i < allowedRepeatValuesCount; ++i) { + shrankResult.AddAll(this.repeat.GetValues()); + } + for (int i = this.end; i < previousResult.Count; ++i) { + shrankResult.Add(previousResult[i]); + } + this._enclosing.result = new GridTemplateResolver.Result(shrankResult); + return this._enclosing.result.GetList(); + } +//\endcond + + private int GetAllowedRepeatValuesCount(int sizeToFit) { + // int division with rounding down + int allowedRepeatValuesCount = (Math.Min(sizeToFit - this._enclosing.GetFixedValuesCount(), this.end - this + .start)) / this.repeat.GetValues().Count * this.repeat.GetValues().Count; + // if space was indefinite than repeat can be used only once + if (this._enclosing.space < 0.0f && allowedRepeatValuesCount > 0) { + allowedRepeatValuesCount = 1; + } + return allowedRepeatValuesCount; + } + + private readonly GridTemplateResolver _enclosing; + } + + private class Result { +//\cond DO_NOT_DOCUMENT + internal readonly IList result; +//\endcond + +//\cond DO_NOT_DOCUMENT + internal int insertPoint = -1; +//\endcond + +//\cond DO_NOT_DOCUMENT + internal bool freeze = false; +//\endcond + +//\cond DO_NOT_DOCUMENT + internal Result(IList result) { + this.result = result; + } +//\endcond + + public virtual void AddValue(GridValue value) { + if (freeze) { + return; + } + if (insertPoint < 0) { + result.Add(value); + } + else { + result.Add(insertPoint++, value); + } + } + + public virtual void SetInsertPoint(int insertPoint) { + this.insertPoint = insertPoint; + } + + public virtual int Size() { + return result.Count; + } + + public virtual IList GetList() { + return result; + } + + public virtual void SetFreeze(bool freeze) { + this.freeze = freeze; + } + } + } +//\endcond +} diff --git a/itext/itext.layout/itext/layout/renderer/GridTrackSizer.cs b/itext/itext.layout/itext/layout/renderer/GridTrackSizer.cs index 06cac68c70..a079f6b257 100644 --- a/itext/itext.layout/itext/layout/renderer/GridTrackSizer.cs +++ b/itext/itext.layout/itext/layout/renderer/GridTrackSizer.cs @@ -26,29 +26,37 @@ You should have received a copy of the GNU Affero General Public License using iText.Kernel.Geom; using iText.Layout.Layout; using iText.Layout.Properties; +using iText.Layout.Properties.Grid; namespace iText.Layout.Renderer { //\cond DO_NOT_DOCUMENT // 12.3. Track Sizing Algorithm + /// Class representing a track sizing algorithm. internal class GridTrackSizer { - private const float EPSILON = 0.001f; - private readonly Grid grid; private readonly IList tracks; + private readonly float gap; + private readonly float availableSpace; private readonly Grid.GridOrder order; - private readonly ICollection cachedUniqueGridCells; + private readonly ICollection percentValueIndexes = new HashSet(); //\cond DO_NOT_DOCUMENT + /// Create a track sizing algorithm for given template. + /// grid to process + /// template values + /// gap between tracks + /// space to fit tracks on + /// grid order internal GridTrackSizer(Grid grid, IList values, float gap, float availableSpace, Grid.GridOrder order) { this.grid = grid; - // Cache the result of the getUniqueGridCells to speed up calculations - this.cachedUniqueGridCells = grid.GetUniqueGridCells(order); + this.availableSpace = availableSpace; + this.gap = gap; tracks = new List(values.Count); foreach (GridValue value in values) { GridTrackSizer.Track track = new GridTrackSizer.Track(); @@ -56,23 +64,32 @@ internal GridTrackSizer(Grid grid, IList values, float gap, float ava tracks.Add(track); } if (availableSpace < 0) { - foreach (GridTrackSizer.Track track in tracks) { - if (track.value.IsPercentValue()) { + for (int i = 0; i < tracks.Count; ++i) { + GridTrackSizer.Track track = tracks[i]; + if (track.value.GetType() == TemplateValue.ValueType.PERCENT) { // 7.2.1. Track Sizes: If the size of the grid container depends on the // size of its tracks, then the must be treated as auto - track.value = GridValue.CreateAutoValue(); + percentValueIndexes.Add(i); + track.value = AutoValue.VALUE; + } + if (track.value.GetType() == TemplateValue.ValueType.FIT_CONTENT && ((FitContentValue)track.value).GetLength + ().GetType() == TemplateValue.ValueType.PERCENT) { + // "7.2.1. Track Sizes: If the size of the grid container depends on the + // size of its tracks, then the must be treated as auto" + // for fit content this means, that formula becomes max(auto-minimum, auto-maximum) = auto + track.value = AutoValue.VALUE; } } } - // Grid sizing algorithm says "Gutters are treated as empty fixed-size tracks for the purpose of the algorithm." - // But relative gaps haven't supported yet, it is why to make algorithm simpler, available space just reduced by gaps. - this.availableSpace = availableSpace - ((values.Count - 1) * gap); this.order = order; } //\endcond //\cond DO_NOT_DOCUMENT - internal virtual IList SizeTracks() { + /// Resolves template values and auto-values to point values. + /// list of points, representing track sizes with expanded percentages in case of inline calculation. + /// + internal virtual GridTrackSizer.TrackSizingResult SizeTracks() { // First step (12.4. Initialize Track Sizes) InitializeTrackSizes(); // Second step (12.5. Resolve Intrinsic Track Sizes) @@ -83,19 +100,15 @@ internal virtual IList SizeTracks() { ExpandFlexibleTracks(); // Fifth step (12.8. Stretch auto Tracks) // Skip for now - IList result = new List(tracks.Count); - foreach (GridTrackSizer.Track track in tracks) { - result.Add(track.baseSize); - } - return result; + return new GridTrackSizer.TrackSizingResult(tracks, gap, percentValueIndexes); } //\endcond private void MaximizeTracks() { - float? freeSpace = GetFreeSpace(); - if (freeSpace != null) { + float freeSpace = GetFreeSpace(); + if (availableSpace > 0) { float leftSpace = (float)freeSpace; - while (leftSpace > EPSILON) { + while (leftSpace > 0.0f) { int unfrozenTracks = 0; foreach (GridTrackSizer.Track track in tracks) { if (JavaUtil.FloatCompare(track.baseSize, track.growthLimit) < 0) { @@ -127,7 +140,7 @@ private void MaximizeTracks() { private void ExpandFlexibleTracks() { bool thereIsFlexibleTrack = false; foreach (GridTrackSizer.Track track in tracks) { - if (track.value.IsFlexibleValue()) { + if (track.value.GetType() == TemplateValue.ValueType.FLEX) { thereIsFlexibleTrack = true; break; } @@ -136,40 +149,41 @@ private void ExpandFlexibleTracks() { return; } float frSize = 0; - if (availableSpace >= 0) { + if (availableSpace > 0.0f) { // If the free space is zero or if sizing the grid container under a min-content constraint: float freeSpace = (float)GetFreeSpace(); - if (freeSpace < EPSILON) { + if (freeSpace < 0.0f) { return; } // Otherwise, if the free space is a definite length: - frSize = FindFrSize(tracks, availableSpace); + frSize = FindFrSize(tracks, GetAvailableSpaceForSizing()); } else { // Otherwise, if the free space is an indefinite length: foreach (GridTrackSizer.Track track in tracks) { - if (track.value.IsFlexibleValue()) { - frSize = Math.Max(frSize, (float)(track.baseSize / track.value.GetValue())); + if (track.value.GetType() == TemplateValue.ValueType.FLEX) { + frSize = Math.Max(frSize, track.baseSize / ((FlexValue)track.value).GetFlex()); } } - foreach (GridCell cell in cachedUniqueGridCells) { + foreach (GridCell cell in grid.GetUniqueGridCells(order)) { bool atLeastOneFlexTrack = false; IList affectedTracks = GetAffectedTracks(cell); foreach (GridTrackSizer.Track track in affectedTracks) { - if (track.value.IsFlexibleValue()) { + if (track.value.GetType() == TemplateValue.ValueType.FLEX) { atLeastOneFlexTrack = true; + break; } } if (!atLeastOneFlexTrack) { continue; } - float maxContribution = CalculateMaxContribution(cell, order); + float maxContribution = CalculateMinMaxContribution(cell, false); frSize = Math.Max(frSize, FindFrSize(affectedTracks, maxContribution)); } } foreach (GridTrackSizer.Track track in tracks) { - if (track.value.IsFlexibleValue()) { - float newBaseSize = frSize * (float)track.value.GetValue(); + if (track.value.GetType() == TemplateValue.ValueType.FLEX) { + float newBaseSize = frSize * ((FlexValue)track.value).GetFlex(); if (newBaseSize > track.baseSize) { track.baseSize = newBaseSize; } @@ -185,11 +199,14 @@ private void ExpandFlexibleTracks() { return affectedTracks; } - private float? GetFreeSpace() { - if (availableSpace < 0) { - return null; - } - float freeSpace = availableSpace; + private float GetAvailableSpaceForSizing() { + // Grid sizing algorithm says "Gutters are treated as empty fixed-size tracks for the purpose of the algorithm." + // But relative gaps haven't supported yet, it is why to make algorithm simpler, available space just reduced by gaps. + return availableSpace - ((tracks.Count - 1) * gap); + } + + private float GetFreeSpace() { + float freeSpace = GetAvailableSpaceForSizing(); foreach (GridTrackSizer.Track track in tracks) { freeSpace -= track.baseSize; } @@ -197,7 +214,7 @@ private void ExpandFlexibleTracks() { } private static float FindFrSize(IList affectedTracks, float spaceToFill) { - // 12.7.1. Find the Size of an fr + // 12.7.1. Find the Size of an 'fr' float frSize = 0; bool allFlexTracksSatisfied = false; bool[] ignoreTracks = new bool[affectedTracks.Count]; @@ -206,8 +223,8 @@ private static float FindFrSize(IList affectedTracks, floa float flexFactorSum = 0; for (int i = 0; i < affectedTracks.Count; i++) { GridTrackSizer.Track track = affectedTracks[i]; - if (track.value.IsFlexibleValue() && !ignoreTracks[i]) { - flexFactorSum += (float)track.value.GetValue(); + if (track.value.GetType() == TemplateValue.ValueType.FLEX && !ignoreTracks[i]) { + flexFactorSum += ((FlexValue)track.value).GetFlex(); } else { leftoverSpace -= track.baseSize; @@ -218,11 +235,10 @@ private static float FindFrSize(IList affectedTracks, floa allFlexTracksSatisfied = true; for (int i = 0; i < affectedTracks.Count; i++) { GridTrackSizer.Track track = affectedTracks[i]; - if (track.value.IsFlexibleValue() && !ignoreTracks[i]) { - if (hyphFrSize * track.value.GetValue() < track.baseSize) { - ignoreTracks[i] = true; - allFlexTracksSatisfied = false; - } + if (track.value.GetType() == TemplateValue.ValueType.FLEX && !ignoreTracks[i] && hyphFrSize * ((FlexValue) + track.value).GetFlex() < track.baseSize) { + ignoreTracks[i] = true; + allFlexTracksSatisfied = false; } } if (allFlexTracksSatisfied) { @@ -238,18 +254,20 @@ private void ResolveIntrinsicTrackSizes() { // 2. Size tracks to fit non-spanning items. for (int i = 0; i < tracks.Count; i++) { GridTrackSizer.Track track = tracks[i]; - // TODO DEVSIX-8384 percent value can be resolvable for height if height of grid container is specified - if (track.value.IsPointValue() || track.value.IsPercentValue()) { - continue; + GridValue minTrackSizingValue = track.value; + GridValue maxTrackSizingValue = track.value; + if (track.value.GetType() == TemplateValue.ValueType.MINMAX) { + minTrackSizingValue = ((MinMaxValue)track.value).GetMin(); + maxTrackSizingValue = ((MinMaxValue)track.value).GetMax(); } ICollection cells = grid.GetUniqueCellsInTrack(order, i); // -> For max-content minimums: - if (track.value.IsMaxContentValue()) { + if (minTrackSizingValue.GetType() == TemplateValue.ValueType.MAX_CONTENT) { float maxContribution = 0; foreach (GridCell cell in cells) { // non-spanning items only if (cell.GetGridSpan(order) == 1) { - float contribution = CalculateMaxContribution(cell, order); + float contribution = CalculateMinMaxContribution(cell, false); maxContribution = Math.Max(maxContribution, contribution); } } @@ -257,60 +275,68 @@ private void ResolveIntrinsicTrackSizes() { } // -> For min-content minimums: // -> For auto minimums: (also the case if track specified by fr value) - if (track.value.IsAutoValue() || track.value.IsFlexibleValue() || track.value.IsMinContentValue()) { + if (minTrackSizingValue.GetType() == TemplateValue.ValueType.AUTO || minTrackSizingValue.GetType() == TemplateValue.ValueType + .FLEX || minTrackSizingValue.GetType() == TemplateValue.ValueType.MIN_CONTENT || minTrackSizingValue.GetType + () == TemplateValue.ValueType.FIT_CONTENT) { float maxContribution = 0; foreach (GridCell cell in cells) { // non-spanning items only if (cell.GetGridSpan(order) == 1) { - float contribution = CalculateMinContribution(cell, order); + float contribution = CalculateMinMaxContribution(cell, true); maxContribution = Math.Max(maxContribution, contribution); } } track.baseSize = maxContribution; } // -> For min-content maximums: - if (track.value.IsMinContentValue() && track.baseSize > EPSILON) { + if (maxTrackSizingValue.GetType() == TemplateValue.ValueType.MIN_CONTENT && track.baseSize > 0.0f) { track.growthLimit = track.baseSize; } // -> For max-content maximums: // Treat auto as max-content for max track sizing function - if (track.value.IsAutoValue() || track.value.IsMaxContentValue()) { + if (maxTrackSizingValue.GetType() == TemplateValue.ValueType.AUTO || maxTrackSizingValue.GetType() == TemplateValue.ValueType + .MAX_CONTENT || maxTrackSizingValue.GetType() == TemplateValue.ValueType.FIT_CONTENT) { float maxContribution = 0; foreach (GridCell cell in cells) { // non-spanning items only if (cell.GetGridSpan(order) == 1) { - float contribution = CalculateMaxContribution(cell, order); + float contribution = CalculateMinMaxContribution(cell, false); maxContribution = Math.Max(maxContribution, contribution); } } - if (maxContribution > EPSILON) { + if (maxContribution > 0.0f) { track.growthLimit = maxContribution; + if (maxTrackSizingValue.GetType() == TemplateValue.ValueType.FIT_CONTENT) { + //For fit-content() maximums, furthermore clamp this growth limit by the fit-content() argument. + float maxSize = ((FitContentValue)maxTrackSizingValue).GetMaxSizeForSpace(availableSpace); + track.growthLimit = Math.Min(track.growthLimit, maxSize); + } } } // if a track’s growth limit is now less than its base size - if (track.growthLimit > 0 && track.baseSize > EPSILON && track.baseSize > track.growthLimit) { + if (track.growthLimit > 0.0f && track.baseSize > 0.0f && track.baseSize > track.growthLimit) { track.growthLimit = track.baseSize; } } // 3. Increase sizes to accommodate spanning items crossing content-sized tracks. int maxSpanCell = 0; - foreach (GridCell cell in cachedUniqueGridCells) { + foreach (GridCell cell in grid.GetUniqueGridCells(order)) { maxSpanCell = Math.Max(maxSpanCell, cell.GetGridSpan(order)); } for (int span = 2; span <= maxSpanCell; span++) { - foreach (GridCell cell in cachedUniqueGridCells) { + foreach (GridCell cell in grid.GetUniqueGridCells(order)) { if (cell.GetGridSpan(order) == span) { bool flexTracksExist = false; IList affectedTracks = GetAffectedTracks(cell); foreach (GridTrackSizer.Track track in affectedTracks) { - if (track.value.IsFlexibleValue()) { + if (track.value.GetType() == TemplateValue.ValueType.FLEX) { flexTracksExist = true; } } if (flexTracksExist) { continue; } - float contribution = CalculateMinContribution(cell, order); + float contribution = CalculateMinMaxContribution(cell, true); // 3.1 For intrinsic minimums: // 3.2 For content-based minimums: // 3.3 For max-content minimums: @@ -322,19 +348,17 @@ private void ResolveIntrinsicTrackSizes() { // 3.5 For intrinsic maximums: // 3.6 For max-content maximums: // 4. Increase sizes to accommodate spanning items crossing flexible tracks: - foreach (GridCell cell in cachedUniqueGridCells) { - bool atLeastOneFlexTrack = false; + foreach (GridCell cell in grid.GetUniqueGridCells(order)) { IList affectedTracks = new List(); for (int i = cell.GetStart(order); i < cell.GetEnd(order); i++) { - if (tracks[i].value.IsFlexibleValue()) { - atLeastOneFlexTrack = true; + if (tracks[i].value.GetType() == TemplateValue.ValueType.FLEX) { affectedTracks.Add(tracks[i]); } } - if (!atLeastOneFlexTrack) { + if (affectedTracks.IsEmpty()) { continue; } - float contribution = CalculateMinContribution(cell, order); + float contribution = CalculateMinMaxContribution(cell, true); DistributeExtraSpaceWithFlexTracks(affectedTracks, contribution); } // 5. If any track still has an infinite growth limit @@ -348,31 +372,21 @@ private void ResolveIntrinsicTrackSizes() { private void DistributeExtraSpaceWithFlexTracks(IList tracks, float sizeContribution ) { // 1. Find the space to distribute: - float trackSizes = 0; - float sumFraction = 0; + float trackSizes = 0.0f; + float sumFraction = 0.0f; foreach (GridTrackSizer.Track track in tracks) { trackSizes += track.baseSize; - if (track.value.IsFlexibleValue()) { - sumFraction += (float)track.value.GetValue(); - } + sumFraction += ((FlexValue)track.value).GetFlex(); } - float space = Math.Max(0, sizeContribution - trackSizes); + if (sumFraction < 1.0f) { + sumFraction = 1.0f; + } + float space = Math.Max(0.0f, sizeContribution - trackSizes); + float spacePerFraction = space / sumFraction; // 2. Distribute space up to limits: - while (space > EPSILON) { - float distributedSpace = space / sumFraction; - bool allFrozen = true; - foreach (GridTrackSizer.Track track in tracks) { - if (track.value.IsFlexibleValue()) { - float? added = DistributeSpaceToTrack(track, distributedSpace); - if (added != null) { - space -= (float)added; - allFrozen = false; - } - } - } - if (allFrozen) { - break; - } + // For flex values we know that they're can't be frozen so we can distribute all available space at once + foreach (GridTrackSizer.Track track in tracks) { + DistributeSpaceToTrack(track, spacePerFraction * ((FlexValue)track.value).GetFlex()); } } @@ -384,20 +398,30 @@ private void DistributeExtraSpace(IList tracks, bool affec float trackSizes = 0; int numberOfAffectedTracks = 0; foreach (GridTrackSizer.Track track in tracks) { + GridValue value = track.value; + if (track.value.GetType() == TemplateValue.ValueType.MINMAX) { + value = affectsBase ? ((MinMaxValue)track.value).GetMin() : ((MinMaxValue)track.value).GetMax(); + } trackSizes += affectsBase ? track.baseSize : track.growthLimit; - if (!track.value.IsPointValue() && !track.value.IsPercentValue()) { + if (value.GetType() != TemplateValue.ValueType.POINT && value.GetType() != TemplateValue.ValueType.PERCENT + ) { numberOfAffectedTracks++; } } float space = Math.Max(0, sizeContribution - trackSizes); // 2. Distribute space up to limits: - while (space > EPSILON) { + while (space > 0.0f) { float distributedSpace = space / numberOfAffectedTracks; bool allFrozen = true; foreach (GridTrackSizer.Track track in tracks) { - if (!track.value.IsPointValue() && !track.value.IsPercentValue()) { - float? added = DistributeSpaceToTrack(track, distributedSpace); - if (added != null) { + GridValue value = track.value; + if (track.value.GetType() == TemplateValue.ValueType.MINMAX) { + value = affectsBase ? ((MinMaxValue)track.value).GetMin() : ((MinMaxValue)track.value).GetMax(); + } + if (value.GetType() != TemplateValue.ValueType.POINT && value.GetType() != TemplateValue.ValueType.PERCENT + ) { + float added = DistributeSpaceToTrack(track, distributedSpace); + if (added > 0) { space -= (float)added; allFrozen = false; } @@ -413,25 +437,49 @@ private void DistributeExtraSpace(IList tracks, bool affec // 4. Distribute space beyond limits: skipped private void InitializeTrackSizes() { foreach (GridTrackSizer.Track track in tracks) { + GridValue minTrackSizingValue = track.value; + GridValue maxTrackSizingValue = track.value; + if (track.value.GetType() == TemplateValue.ValueType.MINMAX) { + minTrackSizingValue = ((MinMaxValue)track.value).GetMin(); + maxTrackSizingValue = ((MinMaxValue)track.value).GetMax(); + } // A fixed sizing function - // TODO DEVSIX-8384 percent value can be resolvable for height if height of grid container is specified - if (track.value.IsPointValue() || track.value.IsPercentValue()) { - if (track.value.IsPointValue()) { - track.baseSize = (float)track.value.GetValue(); + if (minTrackSizingValue.GetType() == TemplateValue.ValueType.POINT || minTrackSizingValue.GetType() == TemplateValue.ValueType + .PERCENT) { + if (minTrackSizingValue.GetType() == TemplateValue.ValueType.POINT) { + track.baseSize = ((LengthValue)minTrackSizingValue).GetValue(); } else { - track.baseSize = (float)track.value.GetValue() / 100 * availableSpace; + track.baseSize = ((LengthValue)minTrackSizingValue).GetValue() / 100 * availableSpace; } - track.growthLimit = track.baseSize; } else { track.baseSize = 0; + } + // A fixed sizing function + if (maxTrackSizingValue.GetType() == TemplateValue.ValueType.POINT || maxTrackSizingValue.GetType() == TemplateValue.ValueType + .PERCENT) { + if (maxTrackSizingValue.GetType() == TemplateValue.ValueType.POINT) { + track.growthLimit = ((LengthValue)maxTrackSizingValue).GetValue(); + } + else { + track.growthLimit = ((LengthValue)maxTrackSizingValue).GetValue() / 100 * availableSpace; + } + } + else { track.growthLimit = -1; } } } - private static float? DistributeSpaceToTrack(GridTrackSizer.Track track, float distributedSpace) { + /// + /// Distributes given space to track, if given space can't be fully distributed returns + /// as many space as was distributed. + /// + /// track to which distribute space + /// how much space to distribute + /// how much space was distributed + private static float DistributeSpaceToTrack(GridTrackSizer.Track track, float distributedSpace) { if (track.growthLimit < 0 || distributedSpace + track.baseSize <= track.growthLimit) { track.baseSize += distributedSpace; return distributedSpace; @@ -443,17 +491,25 @@ private void InitializeTrackSizes() { return addedToLimit; } } - return null; + return -1.0f; } - private static float CalculateMinContribution(GridCell cell, Grid.GridOrder order) { + /// Calculate min or max contribution of a cell. + /// cell to calculate contribution + /// type of contribution: min if true, max otherwise + /// contribution value + private float CalculateMinMaxContribution(GridCell cell, bool minTypeContribution) { if (Grid.GridOrder.COLUMN == order) { if (cell.GetValue() is AbstractRenderer) { AbstractRenderer abstractRenderer = (AbstractRenderer)cell.GetValue(); - return abstractRenderer.GetMinMaxWidth().GetMinWidth(); + return minTypeContribution ? abstractRenderer.GetMinMaxWidth().GetMinWidth() : abstractRenderer.GetMinMaxWidth + ().GetMaxWidth(); } } else { + // https://drafts.csswg.org/css-sizing-3/#auto-box-sizes: + // min-content block size - For block containers, tables, and + // inline boxes, this is equivalent to the max-content block size. cell.GetValue().SetProperty(Property.FILL_AVAILABLE_AREA, false); LayoutContext layoutContext = new LayoutContext(new LayoutArea(1, new Rectangle(cell.GetLayoutArea().GetWidth (), AbstractRenderer.INF))); @@ -467,31 +523,71 @@ private static float CalculateMinContribution(GridCell cell, Grid.GridOrder orde return 0; } - private static float CalculateMaxContribution(GridCell cell, Grid.GridOrder gridOrder) { - if (Grid.GridOrder.COLUMN == gridOrder) { - if (cell.GetValue() is AbstractRenderer) { - AbstractRenderer abstractRenderer = (AbstractRenderer)cell.GetValue(); - return abstractRenderer.GetMinMaxWidth().GetMaxWidth(); +//\cond DO_NOT_DOCUMENT + internal class TrackSizingResult { + private readonly IList tracks; + + private readonly ICollection percentValueIndexes; + + private readonly float gap; + +//\cond DO_NOT_DOCUMENT + internal TrackSizingResult(IList tracks, float gap, ICollection percentValueIndexes + ) { + this.tracks = tracks; + this.percentValueIndexes = percentValueIndexes; + this.gap = gap; + } +//\endcond + +//\cond DO_NOT_DOCUMENT + /// Get original track sizes which are were resolved during track sizing algorithm. + /// + /// Get original track sizes which are were resolved during track sizing algorithm. + /// If result contains inline percentages those are not expanded/reduced and have a size equivalent + /// of AUTO. + /// + /// original track sizes list + internal virtual IList GetTrackSizes() { + IList result = new List(tracks.Count); + foreach (GridTrackSizer.Track track in tracks) { + result.Add(track.baseSize); } + return result; } - else { - cell.GetValue().SetProperty(Property.FILL_AVAILABLE_AREA, false); - // https://drafts.csswg.org/css-sizing-3/#auto-box-sizes: - // min-content block size - For block containers, tables, and - // inline boxes, this is equivalent to the max-content block size. - LayoutContext layoutContext = new LayoutContext(new LayoutArea(1, new Rectangle(cell.GetLayoutArea().GetWidth - (), AbstractRenderer.INF))); - LayoutResult inifiniteHeighLayoutResult = cell.GetValue().Layout(layoutContext); - if (inifiniteHeighLayoutResult.GetStatus() == LayoutResult.NOTHING || inifiniteHeighLayoutResult.GetStatus - () == LayoutResult.PARTIAL) { - return 0; +//\endcond + +//\cond DO_NOT_DOCUMENT + /// Get expanded track sizes where inline percents are resolved against calculated grid area. + /// grid value template + /// expanded track sizes list + internal virtual IList GetTrackSizesAndExpandPercents(IList template) { + if (percentValueIndexes.IsEmpty()) { + return GetTrackSizes(); + } + // Resolve inline percentage values (7.2.1. Track Sizes) + float total = 0.0f; + foreach (GridTrackSizer.Track track in tracks) { + total += track.baseSize; } - return inifiniteHeighLayoutResult.GetOccupiedArea().GetBBox().GetHeight(); + total += ((tracks.Count - 1) * gap); + IList expandedTrackSizes = new List(tracks.Count); + for (int i = 0; i < tracks.Count; ++i) { + if (percentValueIndexes.Contains(i)) { + expandedTrackSizes.Add(((PercentValue)template[i]).GetValue() / 100 * total); + } + else { + expandedTrackSizes.Add(tracks[i].baseSize); + } + } + return expandedTrackSizes; } - return 0; +//\endcond } +//\endcond - private class Track { +//\cond DO_NOT_DOCUMENT + internal class Track { //\cond DO_NOT_DOCUMENT internal float baseSize; //\endcond @@ -505,6 +601,7 @@ private class Track { internal GridValue value; //\endcond } +//\endcond } //\endcond } diff --git a/itext/itext.layout/itext/layout/renderer/GridView.cs b/itext/itext.layout/itext/layout/renderer/GridView.cs index 016d7e19b6..d6a4d509e1 100644 --- a/itext/itext.layout/itext/layout/renderer/GridView.cs +++ b/itext/itext.layout/itext/layout/renderer/GridView.cs @@ -21,7 +21,7 @@ You should have received a copy of the GNU Affero General Public License along with this program. If not, see . */ using System; -using iText.Layout.Properties; +using iText.Layout.Properties.Grid; namespace iText.Layout.Renderer { //\cond DO_NOT_DOCUMENT diff --git a/port-hash b/port-hash index 6c31ceae08..717b17b1f5 100644 --- a/port-hash +++ b/port-hash @@ -1 +1 @@ -b6139dd529e7df47bdcdc5c8673f6e786e4e9844 +1f97711f89a1ed2ba0ef6728078bb72c56dd27cc From 8d784f7e0b2809700b3da77d086929b7f6a6bc83 Mon Sep 17 00:00:00 2001 From: iText Software Date: Fri, 21 Jun 2024 14:20:54 +0000 Subject: [PATCH 3/3] Add missing copyright headers Autoported commit. Original commit hash: [9efb1ea89] --- .../layout/properties/grid/AutoRepeatValue.cs | 22 +++++++++++++++++++ .../itext/layout/properties/grid/AutoValue.cs | 22 +++++++++++++++++++ .../layout/properties/grid/BreadthValue.cs | 22 +++++++++++++++++++ .../layout/properties/grid/FitContentValue.cs | 22 +++++++++++++++++++ .../properties/grid/FixedRepeatValue.cs | 22 +++++++++++++++++++ .../itext/layout/properties/grid/FlexValue.cs | 22 +++++++++++++++++++ .../layout/properties/grid/FunctionValue.cs | 22 +++++++++++++++++++ .../layout/properties/grid/LengthValue.cs | 22 +++++++++++++++++++ .../layout/properties/grid/MaxContentValue.cs | 22 +++++++++++++++++++ .../layout/properties/grid/MinContentValue.cs | 22 +++++++++++++++++++ .../layout/properties/grid/MinMaxValue.cs | 22 +++++++++++++++++++ .../layout/properties/grid/PercentValue.cs | 22 +++++++++++++++++++ .../layout/properties/grid/PointValue.cs | 22 +++++++++++++++++++ .../layout/properties/grid/TemplateValue.cs | 22 +++++++++++++++++++ .../layout/renderer/GridTemplateResolver.cs | 22 +++++++++++++++++++ port-hash | 2 +- 16 files changed, 331 insertions(+), 1 deletion(-) diff --git a/itext/itext.layout/itext/layout/properties/grid/AutoRepeatValue.cs b/itext/itext.layout/itext/layout/properties/grid/AutoRepeatValue.cs index 1e638cdaa5..ec6c7d6b5b 100644 --- a/itext/itext.layout/itext/layout/properties/grid/AutoRepeatValue.cs +++ b/itext/itext.layout/itext/layout/properties/grid/AutoRepeatValue.cs @@ -1,3 +1,25 @@ +/* +This file is part of the iText (R) project. +Copyright (c) 1998-2024 Apryse Group NV +Authors: Apryse Software. + +This program is offered under a commercial and under the AGPL license. +For commercial licensing, contact us at https://itextpdf.com/sales. For AGPL licensing, see below. + +AGPL licensing: +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see . +*/ using System.Collections.Generic; namespace iText.Layout.Properties.Grid { diff --git a/itext/itext.layout/itext/layout/properties/grid/AutoValue.cs b/itext/itext.layout/itext/layout/properties/grid/AutoValue.cs index 6f343d4ef4..42e99c8b8c 100644 --- a/itext/itext.layout/itext/layout/properties/grid/AutoValue.cs +++ b/itext/itext.layout/itext/layout/properties/grid/AutoValue.cs @@ -1,3 +1,25 @@ +/* +This file is part of the iText (R) project. +Copyright (c) 1998-2024 Apryse Group NV +Authors: Apryse Software. + +This program is offered under a commercial and under the AGPL license. +For commercial licensing, contact us at https://itextpdf.com/sales. For AGPL licensing, see below. + +AGPL licensing: +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see . +*/ namespace iText.Layout.Properties.Grid { /// Represents an auto template value. public sealed class AutoValue : BreadthValue { diff --git a/itext/itext.layout/itext/layout/properties/grid/BreadthValue.cs b/itext/itext.layout/itext/layout/properties/grid/BreadthValue.cs index b5ec2cd9bb..ecb6bfd08c 100644 --- a/itext/itext.layout/itext/layout/properties/grid/BreadthValue.cs +++ b/itext/itext.layout/itext/layout/properties/grid/BreadthValue.cs @@ -1,3 +1,25 @@ +/* +This file is part of the iText (R) project. +Copyright (c) 1998-2024 Apryse Group NV +Authors: Apryse Software. + +This program is offered under a commercial and under the AGPL license. +For commercial licensing, contact us at https://itextpdf.com/sales. For AGPL licensing, see below. + +AGPL licensing: +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see . +*/ namespace iText.Layout.Properties.Grid { /// Represents a breadth value on a grid. public abstract class BreadthValue : GridValue { diff --git a/itext/itext.layout/itext/layout/properties/grid/FitContentValue.cs b/itext/itext.layout/itext/layout/properties/grid/FitContentValue.cs index 1f9b3c9afe..54e384ee31 100644 --- a/itext/itext.layout/itext/layout/properties/grid/FitContentValue.cs +++ b/itext/itext.layout/itext/layout/properties/grid/FitContentValue.cs @@ -1,3 +1,25 @@ +/* +This file is part of the iText (R) project. +Copyright (c) 1998-2024 Apryse Group NV +Authors: Apryse Software. + +This program is offered under a commercial and under the AGPL license. +For commercial licensing, contact us at https://itextpdf.com/sales. For AGPL licensing, see below. + +AGPL licensing: +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see . +*/ using iText.Layout.Properties; namespace iText.Layout.Properties.Grid { diff --git a/itext/itext.layout/itext/layout/properties/grid/FixedRepeatValue.cs b/itext/itext.layout/itext/layout/properties/grid/FixedRepeatValue.cs index b61b8a3f9b..07c3ddbec7 100644 --- a/itext/itext.layout/itext/layout/properties/grid/FixedRepeatValue.cs +++ b/itext/itext.layout/itext/layout/properties/grid/FixedRepeatValue.cs @@ -1,3 +1,25 @@ +/* +This file is part of the iText (R) project. +Copyright (c) 1998-2024 Apryse Group NV +Authors: Apryse Software. + +This program is offered under a commercial and under the AGPL license. +For commercial licensing, contact us at https://itextpdf.com/sales. For AGPL licensing, see below. + +AGPL licensing: +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see . +*/ using System.Collections.Generic; namespace iText.Layout.Properties.Grid { diff --git a/itext/itext.layout/itext/layout/properties/grid/FlexValue.cs b/itext/itext.layout/itext/layout/properties/grid/FlexValue.cs index f0fabb1e75..c7ef4a6baa 100644 --- a/itext/itext.layout/itext/layout/properties/grid/FlexValue.cs +++ b/itext/itext.layout/itext/layout/properties/grid/FlexValue.cs @@ -1,3 +1,25 @@ +/* +This file is part of the iText (R) project. +Copyright (c) 1998-2024 Apryse Group NV +Authors: Apryse Software. + +This program is offered under a commercial and under the AGPL license. +For commercial licensing, contact us at https://itextpdf.com/sales. For AGPL licensing, see below. + +AGPL licensing: +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see . +*/ namespace iText.Layout.Properties.Grid { /// Represents flexible template value. public class FlexValue : BreadthValue { diff --git a/itext/itext.layout/itext/layout/properties/grid/FunctionValue.cs b/itext/itext.layout/itext/layout/properties/grid/FunctionValue.cs index d391b6c114..c842364597 100644 --- a/itext/itext.layout/itext/layout/properties/grid/FunctionValue.cs +++ b/itext/itext.layout/itext/layout/properties/grid/FunctionValue.cs @@ -1,3 +1,25 @@ +/* +This file is part of the iText (R) project. +Copyright (c) 1998-2024 Apryse Group NV +Authors: Apryse Software. + +This program is offered under a commercial and under the AGPL license. +For commercial licensing, contact us at https://itextpdf.com/sales. For AGPL licensing, see below. + +AGPL licensing: +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see . +*/ namespace iText.Layout.Properties.Grid { /// Abstract class representing function value on a grid. public abstract class FunctionValue : GridValue { diff --git a/itext/itext.layout/itext/layout/properties/grid/LengthValue.cs b/itext/itext.layout/itext/layout/properties/grid/LengthValue.cs index 970d1a0318..895f8d0539 100644 --- a/itext/itext.layout/itext/layout/properties/grid/LengthValue.cs +++ b/itext/itext.layout/itext/layout/properties/grid/LengthValue.cs @@ -1,3 +1,25 @@ +/* +This file is part of the iText (R) project. +Copyright (c) 1998-2024 Apryse Group NV +Authors: Apryse Software. + +This program is offered under a commercial and under the AGPL license. +For commercial licensing, contact us at https://itextpdf.com/sales. For AGPL licensing, see below. + +AGPL licensing: +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see . +*/ namespace iText.Layout.Properties.Grid { /// Abstract class representing length value on a grid. public abstract class LengthValue : BreadthValue { diff --git a/itext/itext.layout/itext/layout/properties/grid/MaxContentValue.cs b/itext/itext.layout/itext/layout/properties/grid/MaxContentValue.cs index 6c443a8c10..a7a9f4542c 100644 --- a/itext/itext.layout/itext/layout/properties/grid/MaxContentValue.cs +++ b/itext/itext.layout/itext/layout/properties/grid/MaxContentValue.cs @@ -1,3 +1,25 @@ +/* +This file is part of the iText (R) project. +Copyright (c) 1998-2024 Apryse Group NV +Authors: Apryse Software. + +This program is offered under a commercial and under the AGPL license. +For commercial licensing, contact us at https://itextpdf.com/sales. For AGPL licensing, see below. + +AGPL licensing: +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see . +*/ namespace iText.Layout.Properties.Grid { /// Represents max-content template value. public sealed class MaxContentValue : BreadthValue { diff --git a/itext/itext.layout/itext/layout/properties/grid/MinContentValue.cs b/itext/itext.layout/itext/layout/properties/grid/MinContentValue.cs index 932859cfc8..5ad25f3833 100644 --- a/itext/itext.layout/itext/layout/properties/grid/MinContentValue.cs +++ b/itext/itext.layout/itext/layout/properties/grid/MinContentValue.cs @@ -1,3 +1,25 @@ +/* +This file is part of the iText (R) project. +Copyright (c) 1998-2024 Apryse Group NV +Authors: Apryse Software. + +This program is offered under a commercial and under the AGPL license. +For commercial licensing, contact us at https://itextpdf.com/sales. For AGPL licensing, see below. + +AGPL licensing: +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see . +*/ namespace iText.Layout.Properties.Grid { /// Represents min-content template value. public sealed class MinContentValue : BreadthValue { diff --git a/itext/itext.layout/itext/layout/properties/grid/MinMaxValue.cs b/itext/itext.layout/itext/layout/properties/grid/MinMaxValue.cs index 33a7289c0e..22a353ce5f 100644 --- a/itext/itext.layout/itext/layout/properties/grid/MinMaxValue.cs +++ b/itext/itext.layout/itext/layout/properties/grid/MinMaxValue.cs @@ -1,3 +1,25 @@ +/* +This file is part of the iText (R) project. +Copyright (c) 1998-2024 Apryse Group NV +Authors: Apryse Software. + +This program is offered under a commercial and under the AGPL license. +For commercial licensing, contact us at https://itextpdf.com/sales. For AGPL licensing, see below. + +AGPL licensing: +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see . +*/ namespace iText.Layout.Properties.Grid { /// Represents minmax function template value. public class MinMaxValue : FunctionValue { diff --git a/itext/itext.layout/itext/layout/properties/grid/PercentValue.cs b/itext/itext.layout/itext/layout/properties/grid/PercentValue.cs index db19ed819e..7748ba7ffe 100644 --- a/itext/itext.layout/itext/layout/properties/grid/PercentValue.cs +++ b/itext/itext.layout/itext/layout/properties/grid/PercentValue.cs @@ -1,3 +1,25 @@ +/* +This file is part of the iText (R) project. +Copyright (c) 1998-2024 Apryse Group NV +Authors: Apryse Software. + +This program is offered under a commercial and under the AGPL license. +For commercial licensing, contact us at https://itextpdf.com/sales. For AGPL licensing, see below. + +AGPL licensing: +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see . +*/ namespace iText.Layout.Properties.Grid { /// Represents percent template value. public class PercentValue : LengthValue { diff --git a/itext/itext.layout/itext/layout/properties/grid/PointValue.cs b/itext/itext.layout/itext/layout/properties/grid/PointValue.cs index 859cc65460..8d393f237f 100644 --- a/itext/itext.layout/itext/layout/properties/grid/PointValue.cs +++ b/itext/itext.layout/itext/layout/properties/grid/PointValue.cs @@ -1,3 +1,25 @@ +/* +This file is part of the iText (R) project. +Copyright (c) 1998-2024 Apryse Group NV +Authors: Apryse Software. + +This program is offered under a commercial and under the AGPL license. +For commercial licensing, contact us at https://itextpdf.com/sales. For AGPL licensing, see below. + +AGPL licensing: +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see . +*/ namespace iText.Layout.Properties.Grid { /// Represents point template value. public class PointValue : LengthValue { diff --git a/itext/itext.layout/itext/layout/properties/grid/TemplateValue.cs b/itext/itext.layout/itext/layout/properties/grid/TemplateValue.cs index acc85e10b6..69a1adda55 100644 --- a/itext/itext.layout/itext/layout/properties/grid/TemplateValue.cs +++ b/itext/itext.layout/itext/layout/properties/grid/TemplateValue.cs @@ -1,3 +1,25 @@ +/* +This file is part of the iText (R) project. +Copyright (c) 1998-2024 Apryse Group NV +Authors: Apryse Software. + +This program is offered under a commercial and under the AGPL license. +For commercial licensing, contact us at https://itextpdf.com/sales. For AGPL licensing, see below. + +AGPL licensing: +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see . +*/ namespace iText.Layout.Properties.Grid { /// A class that indicates its descendant class can be used as a grid template value. public abstract class TemplateValue { diff --git a/itext/itext.layout/itext/layout/renderer/GridTemplateResolver.cs b/itext/itext.layout/itext/layout/renderer/GridTemplateResolver.cs index b975428051..703dc56076 100644 --- a/itext/itext.layout/itext/layout/renderer/GridTemplateResolver.cs +++ b/itext/itext.layout/itext/layout/renderer/GridTemplateResolver.cs @@ -1,3 +1,25 @@ +/* +This file is part of the iText (R) project. +Copyright (c) 1998-2024 Apryse Group NV +Authors: Apryse Software. + +This program is offered under a commercial and under the AGPL license. +For commercial licensing, contact us at https://itextpdf.com/sales. For AGPL licensing, see below. + +AGPL licensing: +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see . +*/ using System; using System.Collections.Generic; using Microsoft.Extensions.Logging; diff --git a/port-hash b/port-hash index 717b17b1f5..535623cd15 100644 --- a/port-hash +++ b/port-hash @@ -1 +1 @@ -1f97711f89a1ed2ba0ef6728078bb72c56dd27cc +9efb1ea892c9de623115126013ec4bdb361c4695