XpsOMHierarchySimulator(
     XpsOMSerializationManager manager,
     Object serializedObject
     ) : base(manager, serializedObject)
 {
     _xpsOMSerializationManager = manager;
 }
Example #2
0
        BeginConfirmToXPSStructure(
            bool mode
            )
        {
            //
            // In case we have a FixedPage or a Visual as a root, we have to simulate
            // a containing FixedDocument-FixedPage ... etc.
            //
            if ((_serializedObject.GetType() == typeof(System.Windows.Documents.FixedDocument)) ||
                (typeof(System.Windows.Documents.DocumentPaginator).IsAssignableFrom(_serializedObject.GetType()) &&
                 (_serializedObject.GetType() != typeof(System.Windows.Documents.FixedDocumentSequence))))
            {
                //
                // Build the necessary wrapper for a FixedDocument
                //
                _documentSequenceXmlWriter = SimulateBeginFixedDocumentSequence();
            }
            else if (_serializedObject.GetType() == typeof(System.Windows.Documents.FixedPage))
            {
                //
                // Build the necessary wrapper for a FixedPage
                //
                _documentSequenceXmlWriter = SimulateBeginFixedDocumentSequence();
                _documentXmlWriter         = SimulateBeginFixedDocument();
                XpsSerializationPrintTicketRequiredEventArgs e =
                    new XpsSerializationPrintTicketRequiredEventArgs(PrintTicketLevel.FixedPagePrintTicket,
                                                                     0);
                ((IXpsSerializationManager)_serializationManager).OnXPSSerializationPrintTicketRequired(e);
                XpsOMSerializationManager xpsOMSerializationManager = _serializationManager as XpsOMSerializationManager;

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

                ((IXpsSerializationManager)_serializationManager).FixedPagePrintTicket = printTicket;
            }
            else if (typeof(System.Windows.Media.Visual).IsAssignableFrom(_serializedObject.GetType()))
            {
                _documentSequenceXmlWriter = SimulateBeginFixedDocumentSequence();
                _documentXmlWriter         = SimulateBeginFixedDocument();
                if (!mode)
                {
                    _pageXmlWriter = SimulateBeginFixedPage();
                }
            }
        }