SerializeDocumentReference(
            object documentReference
            )
        {
            IDocumentPaginatorSource idp = ((DocumentReference)documentReference).GetDocument(false);

            if (idp != null)
            {
                FixedDocument fixedDoc = idp as FixedDocument;

                if (fixedDoc != null)
                {
                    ReachSerializer serializer = NgcSerializationManager.GetSerializer(fixedDoc);
                    if (serializer != null)
                    {
                        serializer.SerializeObject(fixedDoc);
                    }
                }
                else
                {
                    ReachSerializer serializer = NgcSerializationManager.GetSerializer(idp.DocumentPaginator);
                    if (serializer != null)
                    {
                        serializer.SerializeObject(idp);
                    }
                }
            }
        }
Beispiel #2
0
        SerializeObject(
            Object serializedObject
            )
        {
            DocumentPage dp = serializedObject as DocumentPage;

            if (dp != null)
            {
                Toolbox.EmitEvent(EventTrace.Event.WClientDRXGetVisualStart);
                Visual pageRootVisual = dp.Visual;
                Toolbox.EmitEvent(EventTrace.Event.WClientDRXGetVisualEnd);

                NgcSerializationManager NgcManager = SerializationManager as NgcSerializationManager;

                bool bManualStartDoc = NgcManager.StartPage();

                ReachSerializer serializer = SerializationManager.GetSerializer(pageRootVisual);
                serializer.SerializeObject(pageRootVisual);

                NgcManager.EndPage();
                if (bManualStartDoc)
                {
                    NgcManager.EndDocument();
                }
            }
        }
        BeginSerializeObject(
            Object serializedObject
            )
        {
            FixedDocumentSequence fds = serializedObject as FixedDocumentSequence;

            if (!NgcSerializationManager.IsPrintTicketEventHandlerEnabled)
            {
                //NgcSerializationManager.FdsPrintTicket = fds.PrintTicket as PrintTicket;
            }
            else
            {
                XpsSerializationPrintTicketRequiredEventArgs e =
                    new XpsSerializationPrintTicketRequiredEventArgs(PrintTicketLevel.FixedDocumentSequencePrintTicket,
                                                                     0);
                NgcSerializationManager.OnNGCSerializationPrintTicketRequired(e);
            }

            NgcSerializationManager.StartDocument(fds, false);

            NGCSerializerContext context = new NGCSerializerContext(this,
                                                                    null,
                                                                    SerializerAction.endPersistObjectData);

            NgcSerializationManager.OperationStack.Push(context);


            ReachSerializer serializer = NgcSerializationManager.GetSerializer(fds.References);

            serializer.SerializeObject(fds.References);
        }
        BeginSerializeObject(
            Object serializedObject
            )
        {
            DocumentPage dp = serializedObject as DocumentPage;

            if (dp != null)
            {
                Visual pageRootVisual = dp.Visual;

                bool bManualStartDoc = NgcSerializationManager.StartPage();

                SerializableObjectContext serializableObjectContext =
                    SerializableObjectContext.CreateContext(SerializationManager,
                                                            serializedObject,
                                                            null,
                                                            null);
                NGCPageSerializerContext context = new NGCPageSerializerContext(this,
                                                                                serializableObjectContext,
                                                                                SerializerAction.endPersistObjectData,
                                                                                bManualStartDoc);

                NgcSerializationManager.OperationStack.Push(context);

                ReachSerializer serializer = SerializationManager.GetSerializer(pageRootVisual);

                serializer.SerializeObject(pageRootVisual);
            }
        }
        SerializePage(
            SerializableObjectContext serializableObjectContext
            )
        {
            FixedPage fixedPage = Toolbox.GetPageRoot(serializableObjectContext.TargetObject);

            if (fixedPage != null)
            {
                ReachSerializer serializer = SerializationManager.GetSerializer(fixedPage);

                if (serializer != null)
                {
                    NgcSerializationManagerAsync manager = SerializationManager as NgcSerializationManagerAsync;

                    XpsSerializationPrintTicketRequiredEventArgs e =
                        new XpsSerializationPrintTicketRequiredEventArgs(PrintTicketLevel.FixedPagePrintTicket,
                                                                         0);
                    manager.OnNGCSerializationPrintTicketRequired(e);

                    Toolbox.Layout(fixedPage, manager.GetActivePrintTicket());

                    serializer.SerializeObject(fixedPage);
                }
                else
                {
                    throw new XpsSerializationException(SR.Get(SRID.ReachSerialization_NoSerializer));
                }
            }
        }
        SerializeNextDocumentPage(
            ReachSerializerContext context
            )
        {
            DocumentPaginatorSerializerContext paginatorContext = context as DocumentPaginatorSerializerContext;

            if (paginatorContext != null)
            {
                DocumentPaginator paginator = paginatorContext.Paginator;
                int index = paginatorContext.Index;

                if (!paginator.IsPageCountValid ||
                    (index < paginator.PageCount))
                {
                    index++;

                    DocumentPaginatorSerializerContext
                        collectionContext = new DocumentPaginatorSerializerContext(this,
                                                                                   paginatorContext.ObjectContext,
                                                                                   paginator,
                                                                                   index,
                                                                                   SerializerAction.serializeNextDocumentPage);
                    _xpsOMSerializationManagerAsync.OperationStack.Push(collectionContext);

                    DocumentPage page = Toolbox.GetPage(paginator, index - 1);

                    ReachSerializer serializer = SerializationManager.GetSerializer(page);
                    if (serializer != null)
                    {
                        serializer.SerializeObject(page);
                    }
                }
            }
        }
        SerializeDocument(
            SerializableObjectContext serializableObjectContext
            )
        {
            //
            // Loads the document
            //
            FixedDocument document =
                ((DocumentReference)serializableObjectContext.TargetObject).GetDocument(false);

            if (document.IsInitialized == false)
            {
                // Give a parser item a kick
                document.Dispatcher.Invoke(DispatcherPriority.ApplicationIdle,
                                           new DispatcherOperationCallback(Idle), null);
            }

            if (document != null)
            {
                ReachSerializer serializer = SerializationManager.GetSerializer(document);

                if (serializer != null)
                {
                    serializer.SerializeObject(document);
                }
                else
                {
                    //
                    // This shouldn't ever happen.
                    //
                    throw new XpsSerializationException(SR.Get(SRID.ReachSerialization_NoSerializer));
                }
            }
        }
Beispiel #8
0
        SerializeProperty(
            SerializablePropertyContext serializablePropertyContext
            )
        {
            if (serializablePropertyContext == null)
            {
                throw new ArgumentNullException("serializablePropertyContext");
            }

            if (!serializablePropertyContext.IsComplex)
            {
                //
                // Non-Complex Properties are serialized as attributes
                //
                WriteSerializedAttribute(serializablePropertyContext);
            }
            else
            {
                //
                // Complex properties could be treated in different ways
                // based on their type. Examples of that are:
                //
                //
                //
                ReachSerializer serializer = SerializationManager.GetSerializer(serializablePropertyContext.Value);

                // If there is no serializer for this type, we won't serialize this property
                if (serializer != null)
                {
                    serializer.SerializeObject(serializablePropertyContext);
                }
            }
        }
        SerializePage(
            SerializableObjectContext serializableObjectContext
            )
        {
            FixedPage fixedPage = Toolbox.GetPageRoot(serializableObjectContext.TargetObject);

            if (fixedPage != null)
            {
                ReachSerializer serializer = SerializationManager.GetSerializer(fixedPage);

                if (serializer != null)
                {
                    XpsSerializationPrintTicketRequiredEventArgs e =
                        new XpsSerializationPrintTicketRequiredEventArgs(PrintTicketLevel.FixedPagePrintTicket,
                                                                         0);
                    ((IXpsSerializationManager)SerializationManager).OnXPSSerializationPrintTicketRequired(e);

                    PrintTicket printTicket = null;
                    if (e.Modified)
                    {
                        printTicket = e.PrintTicket;
                    }
                    Toolbox.Layout(fixedPage, printTicket);

                    ((IXpsSerializationManager)SerializationManager).FixedPagePrintTicket = printTicket;

                    serializer.SerializeObject(fixedPage);
                }
                else
                {
                    throw new XpsSerializationException(SR.Get(SRID.ReachSerialization_NoSerializer));
                }
            }
        }
        BeginSerializeObject(
            Object serializedObject
            )
        {
            FixedDocument fd = serializedObject as FixedDocument;

            if (!NgcSerializationManager.IsPrintTicketEventHandlerEnabled)
            {
                //NgcSerializationManager.FdPrintTicket = fd.PrintTicket as PrintTicket;
            }

            NgcSerializationManager.StartDocument(fd, true);

            //
            // Create the context for the current object
            //

            NGCSerializerContext context = new NGCSerializerContext(this,
                                                                    null,
                                                                    SerializerAction.endPersistObjectData);

            NgcSerializationManager.OperationStack.Push(context);

            ReachSerializer serializer = NgcSerializationManager.GetSerializer(fd.Pages);

            serializer.SerializeObject(fd.Pages);
        }
        private void SerializeChild(Visual child, SerializableObjectContext parentContext)
        {
            ReachSerializer serializer = SerializationManager.GetSerializer(child);

            if (serializer != null)
            {
                serializer.SerializeObject(child);
            }
        }
        SerializePageContent(
            object pageContent
            )
        {
            ReachSerializer serializer = SerializationManager.GetSerializer(pageContent);

            if (serializer != null)
            {
                serializer.SerializeObject(pageContent);
            }
            else
            {
                throw new XpsSerializationException(SR.Get(SRID.ReachSerialization_NoSerializer));
            }
        }
Beispiel #13
0
        SerializeDocumentReference(
            object documentReference
            )
        {
            ReachSerializer serializer = SerializationManager.GetSerializer(documentReference);

            if (serializer != null)
            {
                serializer.SerializeObject(documentReference);
            }
            else
            {
                // should we throw if this is not a DocumentReference or just not do anything?
                throw new XpsSerializationException(SR.Get(SRID.ReachSerialization_NoSerializer));
            }
        }
Beispiel #14
0
        SerializeObject(
            Object serializedObject
            )
        {
            if (serializedObject == null)
            {
                throw new ArgumentNullException("serializedObject");
            }
            FixedDocumentSequence fds = serializedObject as FixedDocumentSequence;

            if (fds == null)
            {
                throw new ArgumentException(SR.Get(SRID.ReachSerialization_ExpectedFixedDocumentSequence));
            }

            NgcSerializationManager ngcManager = SerializationManager as NgcSerializationManager;

            if (!ngcManager.IsPrintTicketEventHandlerEnabled)
            {
                //ngcManager.FdsPrintTicket = fds.PrintTicket as PrintTicket;
            }
            else
            {
                XpsSerializationPrintTicketRequiredEventArgs printTicketEvent =
                    new XpsSerializationPrintTicketRequiredEventArgs(PrintTicketLevel.FixedDocumentSequencePrintTicket,
                                                                     0);
                ngcManager.OnNGCSerializationPrintTicketRequired(printTicketEvent);
            }

            ngcManager.StartDocument(fds, false);

            ReachSerializer serializer = ngcManager.GetSerializer(fds.References);

            serializer.SerializeObject(fds.References);

            ngcManager.EndDocument();

            XpsSerializationProgressChangedEventArgs e =
                new XpsSerializationProgressChangedEventArgs(XpsWritingProgressChangeLevel.FixedDocumentSequenceWritingProgress,
                                                             0,
                                                             0,
                                                             null);

            ngcManager.OnNGCSerializationProgressChagned(e);
        }
        PersistObjectData(
            SerializableObjectContext serializableObjectContext
            )
        {
            if (serializableObjectContext.IsComplexValue)
            {
                //SerializeObjectCore(serializableObjectContext);

                FixedPage fixedPage = Toolbox.GetPageRoot(serializableObjectContext.TargetObject);

                if (fixedPage != null)
                {
                    ReachSerializer serializer = SerializationManager.GetSerializer(fixedPage);

                    if (serializer != null)
                    {
                        //Get FixedPage Print Ticket and cache it inside of the SerializationManager
                        //so we can get it inside of
                        XpsSerializationPrintTicketRequiredEventArgs e =
                            new XpsSerializationPrintTicketRequiredEventArgs(PrintTicketLevel.FixedPagePrintTicket,
                                                                             0);
                        ((IXpsSerializationManager)SerializationManager).OnXPSSerializationPrintTicketRequired(e);

                        PrintTicket printTicket = null;
                        if (e.Modified)
                        {
                            printTicket = e.PrintTicket;
                        }
                        Toolbox.Layout(fixedPage, printTicket);

                        ((IXpsSerializationManager)SerializationManager).FixedPagePrintTicket = printTicket;

                        serializer.SerializeObject(fixedPage);
                    }
                    else
                    {
                        throw new XpsSerializationException(SR.Get(SRID.ReachSerialization_NoSerializer));
                    }
                }
            }
            else
            {
                throw new XpsSerializationException(SR.Get(SRID.ReachSerialization_WrongPropertyTypeForPageContent));
            }
        }
Beispiel #16
0
        SerializePageContent(
            object pageContent
            )
        {
            Toolbox.EmitEvent(EventTrace.Event.WClientDRXSavePageBegin);

            ReachSerializer serializer = SerializationManager.GetSerializer(pageContent);

            if (serializer != null)
            {
                serializer.SerializeObject(pageContent);
            }
            else
            {
                throw new XpsSerializationException(SR.Get(SRID.ReachSerialization_NoSerializer));
            }

            Toolbox.EmitEvent(EventTrace.Event.WClientDRXSavePageEnd);
        }
        PersistObjectData(
            SerializableObjectContext serializableObjectContext
            )
        {
            DocumentPaginator paginator = BeginPersistObjectData(serializableObjectContext);

            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);
                }
            }

            EndPersistObjectData();
        }
        SerializeUIElement(
            object uiElement
            )
        {
            Visual visual = uiElement as Visual;

            if (visual != null)
            {
                ReachSerializer serializer = SerializationManager.GetSerializer(visual);

                if (serializer != null)
                {
                    serializer.SerializeObject(visual);
                }
                else
                {
                    throw new XpsSerializationException(SR.Get(SRID.ReachSerialization_NoSerializer));
                }
            }
        }
        SerializeNextDocumentPage(
            NGCSerializerContext context
            )
        {
            NGCDocumentPaginatorSerializerContext paginatorContext = context as NGCDocumentPaginatorSerializerContext;

            if (paginatorContext != null)
            {
                DocumentPaginator paginator = paginatorContext.Paginator;
                int index = paginatorContext.Index;

                if (!paginator.IsPageCountValid ||
                    (index < paginator.PageCount))
                {
                    index++;


                    NGCDocumentPaginatorSerializerContext
                        nextContext = new NGCDocumentPaginatorSerializerContext(this,
                                                                                paginator,
                                                                                index,
                                                                                SerializerAction.serializeNextDocumentPage);


                    NgcSerializationManager.OperationStack.Push(nextContext);

                    DocumentPage page = Toolbox.GetPage(paginator, index - 1);

                    ReachSerializer serializer = SerializationManager.GetSerializer(page);

                    if (serializer != null)
                    {
                        serializer.SerializeObject(page);
                    }
                }
            }
            else
            {
            }
        }
Beispiel #20
0
        SerializeObject(
            Object serializedObject
            )
        {
            NgcSerializationManager ngcManager = SerializationManager as NgcSerializationManager;
            DocumentPaginator       paginator  = (DocumentPaginator)serializedObject;

            //
            // For FlowDocument, the application might attach a PrintTicket DP on it.
            //
            DependencyObject dependencyObject = paginator != null ? paginator.Source as DependencyObject : null;

            if (dependencyObject != null)
            {
                if (!ngcManager.IsPrintTicketEventHandlerEnabled)
                {
                    //ngcManager.FdPrintTicket = dependencyObject.GetValue(FixedDocument.PrintTicketProperty) as PrintTicket;
                }
            }

            ngcManager.StartDocument(paginator, true);

            if (paginator != null)
            {
                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);
                    }
                }
            }

            ngcManager.EndDocument();
        }
        PersistObjectData(
            SerializableObjectContext serializableObjectContext
            )
        {
            if (serializableObjectContext.IsComplexValue)
            {
                SerializeObjectCore(serializableObjectContext);

                // Loads the document
                FixedDocument document = ((DocumentReference)serializableObjectContext.TargetObject).GetDocument(false);

                if (document.IsInitialized == false)
                {
                    // Give a parser item a kick
                    document.Dispatcher.Invoke(DispatcherPriority.ApplicationIdle,
                                               new DispatcherOperationCallback(Idle), null);
                }

                if (document != null)
                {
                    ReachSerializer serializer = SerializationManager.GetSerializer(document);

                    if (serializer != null)
                    {
                        serializer.SerializeObject(document);
                    }
                    else
                    {
                        // This shouldn't ever happen.
                        throw new XpsSerializationException(SR.Get(SRID.ReachSerialization_NoSerializer));
                    }
                }
            }
            else
            {
                // What about this case?  Is IsComplexValue something we really want to check for this?
            }
        }
Beispiel #22
0
        SerializeObject(
            Object serializedObject
            )
        {
            if (serializedObject == null)
            {
                throw new ArgumentNullException("serializedObject");
            }
            FixedDocument fd = serializedObject as FixedDocument;

            if (fd == null)
            {
                throw new ArgumentException(SR.Get(SRID.ReachSerialization_ExpectedFixedDocument));
            }
            NgcSerializationManager ngcManager = SerializationManager as NgcSerializationManager;

            ngcManager.StartDocument(fd, true);

            ReachSerializer serializer = ngcManager.GetSerializer(fd.Pages);

            serializer.SerializeObject(fd.Pages);

            ngcManager.EndDocument();
        }
Beispiel #23
0
        SaveAsXaml(
            Object serializedObject
            )
        {
            Toolbox.EmitEvent(EventTrace.Event.WClientDRXSaveXpsBegin);

            XmlWriter pageXmlWriter = null;

            if (serializedObject == null)
            {
                throw new ArgumentNullException("serializedObject");
            }

            if (!IsSerializedObjectTypeSupported(serializedObject))
            {
                throw new XpsSerializationException(SR.Get(SRID.ReachSerialization_NotSupported));
            }

            if (serializedObject is DocumentPaginator)
            {
                // Prefast complains that serializedObject is not tested for null
                // It is tested a few lines up
                #pragma warning suppress 56506
                if ((serializedObject as DocumentPaginator).Source is FixedDocument &&
                    serializedObject.GetType().ToString().Contains("FixedDocumentPaginator"))
                {
                    serializedObject = (serializedObject as DocumentPaginator).Source;
                }
                else
                if ((serializedObject as DocumentPaginator).Source is FixedDocumentSequence &&
                    serializedObject.GetType().ToString().Contains("FixedDocumentSequencePaginator"))
                {
                    serializedObject = (serializedObject as DocumentPaginator).Source;
                }
            }

            if (_simulator == null)
            {
                _simulator = new ReachHierarchySimulator(this,
                                                         serializedObject);
            }

            if (!_isSimulating)
            {
                _simulator.BeginConfirmToXPSStructure(_isBatchMode);
                _isSimulating = true;
            }

            if (_isBatchMode)
            {
                pageXmlWriter = _simulator.SimulateBeginFixedPage();
            }

            ReachSerializer reachSerializer = GetSerializer(serializedObject);

            if (reachSerializer != null)
            {
                //
                // Things that need to be done at this stage
                // 1. Setting the stack context
                // 2. Setting the root of the graph for future references
                //
                reachSerializer.SerializeObject(serializedObject);

                if (_isBatchMode)
                {
                    _simulator.SimulateEndFixedPage(pageXmlWriter);
                }
                else
                {
                    _simulator.EndConfirmToXPSStructure(_isBatchMode);
                }
            }
            else
            {
                throw new XpsSerializationException(SR.Get(SRID.ReachSerialization_NoSerializer));
            }

            Toolbox.EmitEvent(EventTrace.Event.WClientDRXSaveXpsEnd);
        }
Beispiel #24
0
        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);

                ((IXpsSerializationManager)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();
            }
            ((IXpsSerializationManager)SerializationManager).OnXPSSerializationProgressChanged(progressEvent);
        }
        SaveAsXaml(
            Object serializedObject
            )
        {
            Toolbox.EmitEvent(EventTrace.Event.WClientDRXSaveXpsBegin);

            if (serializedObject == null)
            {
                throw new ArgumentNullException("serializedObject");
            }

            if (!IsSerializedObjectTypeSupported(serializedObject))
            {
                throw new XpsSerializationException(SR.Get(SRID.ReachSerialization_NotSupported));
            }

            if (_isBatchMode && !_isSimulating)
            {
                XpsSerializationPrintTicketRequiredEventArgs printTicketEvent =
                    new XpsSerializationPrintTicketRequiredEventArgs(PrintTicketLevel.FixedDocumentSequencePrintTicket,
                                                                     0);
                OnNGCSerializationPrintTicketRequired(printTicketEvent);

                StartDocument(null, true);
                _isSimulating = true;
            }

            if (_isBatchMode)
            {
                StartPage();
            }

            if (!_isBatchMode &&
                IsDocumentSequencePrintTicketRequired(serializedObject))
            {
                XpsSerializationPrintTicketRequiredEventArgs printTicketEvent =
                    new XpsSerializationPrintTicketRequiredEventArgs(PrintTicketLevel.FixedDocumentSequencePrintTicket,
                                                                     0);
                OnNGCSerializationPrintTicketRequired(printTicketEvent);
            }


            ReachSerializer reachSerializer = GetSerializer(serializedObject);


            if (reachSerializer != null)
            {
                //
                // Call top-level type serializer, it will walk through the contents and
                // all CLR and DP properties of the object and invoke the proper serializer
                // and typeconverter respectively
                //

                reachSerializer.SerializeObject(serializedObject);

                if (_isBatchMode)
                {
                    EndPage();
                }
            }
            else
            {
                throw new XpsSerializationException(SR.Get(SRID.ReachSerialization_NoSerializer));
            }

            Toolbox.EmitEvent(EventTrace.Event.WClientDRXSaveXpsEnd);
        }