Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Print / Reach / Serialization / manager / ReachIDocumentPaginatorSerializer.cs / 1 / ReachIDocumentPaginatorSerializer.cs
/*++ Copyright (C) 2004- 2005 Microsoft Corporation All rights reserved. Module Name: ReachIDocumentPaginatorSerializer.cs Abstract: Author: [....] ([....]) January 2005 Revision History: --*/ using System; using System.Collections; using System.Collections.Generic; using System.Collections.Specialized; using System.ComponentModel; using System.Diagnostics; using System.Reflection; using System.Xml; using System.IO; using System.Security; using System.Security.Permissions; using System.ComponentModel.Design.Serialization; using System.Windows.Xps.Packaging; using System.Windows.Documents; using System.Windows.Media; using System.Windows.Markup; namespace System.Windows.Xps.Serialization { ////// /// internal class DocumentPaginatorSerializer : ReachSerializer { ////// /// public DocumentPaginatorSerializer( PackageSerializationManager manager ) : base(manager) { } public override void SerializeObject( Object serializedObject ) { // // Create the ImageTable required by the Type Converters // The Image table at this time is shared / document // ((XpsSerializationManager)SerializationManager).ResourcePolicy.ImageCrcTable = new Dictionary(); ((XpsSerializationManager)SerializationManager).ResourcePolicy.ImageUriHashTable = new Dictionary (); // // Create the ColorContextTable required by the Type Converters // The ColorContext table at this time is shared / document // ((XpsSerializationManager)SerializationManager).ResourcePolicy.ColorContextTable = new Dictionary (); SerializableObjectContext serializableObjectContext = new SerializableObjectContext(serializedObject, null); PersistObjectData(serializableObjectContext); } /// /// /// internal override void PersistObjectData( SerializableObjectContext serializableObjectContext ) { String xmlnsForType = SerializationManager.GetXmlNSForType(typeof(FixedDocument)); String nameForType = XpsS0Markup.FixedDocument; if( SerializationManager is XpsSerializationManager) { (SerializationManager as XpsSerializationManager).RegisterDocumentStart(); } if (xmlnsForType == null) { XmlWriter.WriteStartElement(nameForType); } else { XmlWriter.WriteStartElement(nameForType, xmlnsForType); } { XpsSerializationPrintTicketRequiredEventArgs e = new XpsSerializationPrintTicketRequiredEventArgs(PrintTicketLevel.FixedDocumentPrintTicket, 0); ((XpsSerializationManager)SerializationManager).OnXPSSerializationPrintTicketRequired(e); // // Serialize the data for the PrintTicket // if(e.Modified) { if(e.PrintTicket != null) { PrintTicketSerializer serializer = new PrintTicketSerializer(SerializationManager); serializer.SerializeObject(e.PrintTicket); } } DocumentPaginator paginator = (DocumentPaginator)serializableObjectContext.TargetObject; XmlLanguage language = null; DependencyObject dependencyObject = paginator.Source as DependencyObject; if (dependencyObject != null) { language = (XmlLanguage)dependencyObject.GetValue(FrameworkContentElement.LanguageProperty); } if (language == null) { //If the language property is null, assign the language to the default language = XmlLanguage.GetLanguage(XpsS0Markup.XmlLangValue); } SerializationManager.Language = language; for (int i = 0; !paginator.IsPageCountValid || (i < paginator.PageCount); i++) { DocumentPage page = Toolbox.GetPage(paginator, i); ReachSerializer serializer = SerializationManager.GetSerializer(page); if (serializer != null) { serializer.SerializeObject(page); } } } XmlWriter.WriteEndElement(); XmlWriter = null; // // Clear off the table from the resource policy // ((XpsSerializationManager)SerializationManager).ResourcePolicy.ImageCrcTable = null; ((XpsSerializationManager)SerializationManager).ResourcePolicy.ImageUriHashTable = null; // // Clear off the table from the resource policy // ((XpsSerializationManager)SerializationManager).ResourcePolicy.ColorContextTable = null; // // Signal to any registered callers that the Document has been serialized // XpsSerializationProgressChangedEventArgs progressEvent = new XpsSerializationProgressChangedEventArgs(XpsWritingProgressChangeLevel.FixedDocumentWritingProgress, 0, 0, null); if( SerializationManager is XpsSerializationManager) { (SerializationManager as XpsSerializationManager).RegisterDocumentEnd(); } ((XpsSerializationManager)SerializationManager).OnXPSSerializationProgressChanged(progressEvent); } ////// /// public override XmlWriter XmlWriter { get { if (base.XmlWriter == null) { base.XmlWriter = SerializationManager.AcquireXmlWriter(typeof(FixedDocument)); } return base.XmlWriter; } set { base.XmlWriter = null; SerializationManager.ReleaseXmlWriter(typeof(FixedDocument)); } } }; } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- DataBindingHandlerAttribute.cs
- DataControlLinkButton.cs
- TargetInvocationException.cs
- IOThreadTimer.cs
- MatcherBuilder.cs
- StaticFileHandler.cs
- StylusButtonCollection.cs
- ResourceReferenceExpressionConverter.cs
- ProgressiveCrcCalculatingStream.cs
- TextParagraphProperties.cs
- ApplicationActivator.cs
- WindowsStatusBar.cs
- XamlParser.cs
- GcSettings.cs
- Column.cs
- ObjectQueryExecutionPlan.cs
- Group.cs
- ContextStack.cs
- SecuritySessionFilter.cs
- SafeNativeMethods.cs
- NativeMethodsOther.cs
- HttpCapabilitiesEvaluator.cs
- SystemIPInterfaceProperties.cs
- XPathAncestorQuery.cs
- TextRunTypographyProperties.cs
- DrawingAttributeSerializer.cs
- XmlHelper.cs
- DataKey.cs
- WindowsEditBoxRange.cs
- BuilderPropertyEntry.cs
- ObjectDataSourceStatusEventArgs.cs
- LineServices.cs
- TreeNodeStyle.cs
- XXXInfos.cs
- ListItem.cs
- Geometry.cs
- WebBrowser.cs
- CodeArgumentReferenceExpression.cs
- ScriptResourceHandler.cs
- Attributes.cs
- ObjectItemNoOpAssemblyLoader.cs
- WorkflowServiceNamespace.cs
- Renderer.cs
- PeerUnsafeNativeMethods.cs
- StateMachineSubscription.cs
- WindowsScrollBarBits.cs
- LinkedList.cs
- DbProviderManifest.cs
- AssemblyAttributesGoHere.cs
- NamespaceMapping.cs
- CellCreator.cs
- Translator.cs
- ExpressionBuilderCollection.cs
- TextServicesCompartmentContext.cs
- TextWriterTraceListener.cs
- CurrentChangedEventManager.cs
- FormsAuthenticationCredentials.cs
- COM2FontConverter.cs
- PerfCounters.cs
- DynamicActivityXamlReader.cs
- HandlerMappingMemo.cs
- EventPropertyMap.cs
- ModuleBuilder.cs
- TemplateContentLoader.cs
- AssemblyUtil.cs
- ConfigXmlWhitespace.cs
- Menu.cs
- DaylightTime.cs
- LogicalExpressionTypeConverter.cs
- SqlDataSourceFilteringEventArgs.cs
- ComponentResourceKeyConverter.cs
- Faults.cs
- DataFormats.cs
- InstanceKey.cs
- WebBrowserBase.cs
- AssemblyHelper.cs
- DataSetMappper.cs
- SqlInfoMessageEvent.cs
- ByteStreamMessageEncodingElement.cs
- _emptywebproxy.cs
- Int64Converter.cs
- FlowDocumentView.cs
- BinaryUtilClasses.cs
- LogReservationCollection.cs
- BaseCodePageEncoding.cs
- WebScriptMetadataMessageEncoderFactory.cs
- MessageAction.cs
- SerialReceived.cs
- SqlNode.cs
- XmlSchemaAttribute.cs
- Int32RectConverter.cs
- SelectionItemPattern.cs
- RecordsAffectedEventArgs.cs
- ListViewItemMouseHoverEvent.cs
- ToolStripLocationCancelEventArgs.cs
- EngineSiteSapi.cs
- MatrixKeyFrameCollection.cs
- CodeDelegateCreateExpression.cs
- SpellCheck.cs
- InvokeProviderWrapper.cs