Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Framework / System / Windows / Documents / FixedSOMGroup.cs / 1 / FixedSOMGroup.cs
/*++ File: FixedSOMGroup.cs Copyright (C) 2005 Microsoft Corporation. All rights reserved. Description: A concrete container that can be used to put together to group different or same types of containers History: 06/17/2005: [....] - Created --*/ namespace System.Windows.Documents { using System.Collections.Generic; using System.Diagnostics; using System.Windows.Media; using System.Globalization; internal class FixedSOMGroup :FixedSOMPageElement, IComparable { //-------------------------------------------------------------------- // // Constructors // //--------------------------------------------------------------------- #region Constructors public FixedSOMGroup(FixedSOMPage page) : base(page) { } #endregion Constructors #region IComparable int IComparable.CompareTo(object comparedObj) { int result = Int32.MinValue; FixedSOMGroup compared = comparedObj as FixedSOMGroup; Debug.Assert(compared != null); if (compared == null) { throw new ArgumentException(SR.Get(SRID.UnexpectedParameterType, comparedObj.GetType(), typeof(FixedSOMGroup)), "comparedObj"); } bool RTL = this.IsRTL && compared.IsRTL; SpatialComparison compareHor = base._CompareHorizontal(compared, RTL); SpatialComparison compareVer = base._CompareVertical(compared); Debug.Assert(compareHor != SpatialComparison.None); Debug.Assert(compareVer != SpatialComparison.None); switch (compareVer) { case SpatialComparison.Before: result = -1; break; case SpatialComparison.After: result = 1; break; case SpatialComparison.OverlapBefore: if ((int)compareHor <= (int)SpatialComparison.Equal) { result = -1; } else { result = 1; } break; case SpatialComparison.OverlapAfter: if ((int)compareHor >= (int)SpatialComparison.Equal) { result = 1; } else { result = -1; } break; case SpatialComparison.Equal: switch (compareHor) { case SpatialComparison.After: case SpatialComparison.OverlapAfter: result = 1; break; case SpatialComparison.Before: case SpatialComparison.OverlapBefore: result = -1; break; case SpatialComparison.Equal: result = 0; break; default: Debug.Assert(false); break; } break; default: //Shouldn't happen Debug.Assert(false); break; } return result; } #endregion #region Public methods //------------------------------------------------------------------- // // Public methods // //--------------------------------------------------------------------- public void AddContainer(FixedSOMPageElement pageElement) { FixedSOMFixedBlock block = pageElement as FixedSOMFixedBlock; if (block == null || (!block.IsFloatingImage && !block.IsWhiteSpace)) { if (pageElement.IsRTL) { _RTLCount++; } else { _LTRCount++; } } _semanticBoxes.Add(pageElement); if (_boundingRect.IsEmpty) { _boundingRect = pageElement.BoundingRect; } else { _boundingRect.Union(pageElement.BoundingRect); } } #if DEBUG public override void Render(DrawingContext dc, string label, DrawDebugVisual debugVisual) { Pen pen = new Pen(Brushes.Maroon, 3); Rect rect = _boundingRect; rect.Inflate(5,5); dc.DrawRectangle(null, pen , rect); if (label != null) { if (this.IsRTL) { label += "R"; } base.RenderLabel(dc, label); } foreach (FixedSOMSemanticBox box in _semanticBoxes) { box.Render(dc, "", debugVisual); } } #endif #endregion Public methods #region Public Properties public override bool IsRTL { get { return _RTLCount > _LTRCount; } } #endregion Public Properties #region Private fields private int _RTLCount; private int _LTRCount; #endregion Private fields } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
![Network programming in C#, Network Programming in VB.NET, Network Programming in .NET](/images/book.jpg)
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- UrlPath.cs
- ExpressionVisitor.cs
- TextTreeRootTextBlock.cs
- BufferedWebEventProvider.cs
- RecordsAffectedEventArgs.cs
- StylusPointProperties.cs
- AccessDataSource.cs
- ConfigXmlDocument.cs
- StreamSecurityUpgradeInitiatorBase.cs
- DateTimePicker.cs
- storepermissionattribute.cs
- Input.cs
- GlyphsSerializer.cs
- ClientSession.cs
- GeneralTransform3DGroup.cs
- IsolatedStorageFileStream.cs
- AspCompat.cs
- StringArrayConverter.cs
- HTTPAPI_VERSION.cs
- DummyDataSource.cs
- StringExpressionSet.cs
- PersianCalendar.cs
- InstanceKeyCollisionException.cs
- HtmlControlPersistable.cs
- QilTernary.cs
- PerformanceCounterCategory.cs
- LocalizableResourceBuilder.cs
- ByteStream.cs
- EqualityComparer.cs
- RuntimeUtils.cs
- BaseProcessProtocolHandler.cs
- WbmpConverter.cs
- DataTemplateKey.cs
- RequestDescription.cs
- XmlQualifiedName.cs
- XmlName.cs
- PathFigureCollectionConverter.cs
- ping.cs
- XD.cs
- ObjectMemberMapping.cs
- dbenumerator.cs
- ControlOperationInvoker.cs
- InkPresenter.cs
- XmlDocumentFragment.cs
- CompositeCollectionView.cs
- CodeDirectoryCompiler.cs
- ISessionStateStore.cs
- NeutralResourcesLanguageAttribute.cs
- WriterOutput.cs
- TableCellCollection.cs
- HTMLTextWriter.cs
- InputMethodStateTypeInfo.cs
- CacheSection.cs
- ClientData.cs
- SerialErrors.cs
- Pair.cs
- SpotLight.cs
- TemplateInstanceAttribute.cs
- StyleXamlTreeBuilder.cs
- HitTestResult.cs
- MobileSysDescriptionAttribute.cs
- XmlTypeMapping.cs
- LocalsItemDescription.cs
- ipaddressinformationcollection.cs
- TextTreeText.cs
- XmlRootAttribute.cs
- DbParameterHelper.cs
- MarkupObject.cs
- ForceCopyBuildProvider.cs
- Subtree.cs
- ConfigurationElementCollection.cs
- TaskFormBase.cs
- ColumnHeaderConverter.cs
- PrintPageEvent.cs
- AxisAngleRotation3D.cs
- BreakRecordTable.cs
- QilNode.cs
- TypedTableHandler.cs
- JavascriptXmlWriterWrapper.cs
- ClientBuildManager.cs
- AlphabeticalEnumConverter.cs
- HtmlShim.cs
- HttpProfileGroupBase.cs
- DBCSCodePageEncoding.cs
- TransformerInfoCollection.cs
- WCFBuildProvider.cs
- dataprotectionpermissionattribute.cs
- Activity.cs
- TemplatePagerField.cs
- DesignBinding.cs
- SmiTypedGetterSetter.cs
- FamilyTypeface.cs
- MouseEvent.cs
- StretchValidation.cs
- InterleavedZipPartStream.cs
- ScalarConstant.cs
- DeleteStoreRequest.cs
- DescriptionCreator.cs
- SEHException.cs
- WindowsButton.cs