prntvpt: Add support for PageOutputColor to ticket XML reader.

Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Dmitry Timoshkov 2020-06-11 13:59:33 +08:00 committed by Alexandre Julliard
parent 23e69644e0
commit bebff23647

View file

@ -252,6 +252,48 @@ static void read_PageMediaSize(IXMLDOMDocument2 *doc, struct ticket *ticket)
IXMLDOMNode_Release(node);
}
static void read_PageOutputColor(IXMLDOMDocument2 *doc, struct ticket *ticket)
{
IXMLDOMNode *node, *option;
HRESULT hr;
hr = IXMLDOMDocument2_selectSingleNode(doc, (BSTR)L"psf:PrintTicket/psf:Feature[@name='psk:PageOutputColor']", &node);
if (hr != S_OK) return;
hr = IXMLDOMNode_selectSingleNode(node, (BSTR)L"./psf:Option", &option);
if (hr == S_OK)
{
IXMLDOMElement *element;
hr = IXMLDOMNode_QueryInterface(option, &IID_IXMLDOMElement, (void **)&element);
if (hr == S_OK)
{
VARIANT var;
VariantInit(&var);
hr = IXMLDOMElement_getAttribute(element, (BSTR)L"name", &var);
if (hr == S_OK && V_VT(&var) == VT_BSTR)
{
if (!wcscmp(V_BSTR(&var), L"psk:Color"))
ticket->page.color = DMCOLOR_COLOR;
else if (!wcscmp(V_BSTR(&var), L"psk:Monochrome"))
ticket->page.color = DMCOLOR_MONOCHROME;
else
{
FIXME("%s\n", wine_dbgstr_w(V_BSTR(&var)));
ticket->page.color = DMCOLOR_MONOCHROME;
}
TRACE("color: %s => %d\n", wine_dbgstr_w(V_BSTR(&var)), ticket->page.color);
}
VariantClear(&var);
IXMLDOMElement_Release(element);
}
}
IXMLDOMNode_Release(node);
}
static void set_SelectionNamespaces(IXMLDOMDocument2 *doc)
{
IStream *stream;
@ -346,6 +388,7 @@ static HRESULT parse_ticket(IStream *stream, EPrintTicketScope scope, struct tic
/* PageScope is always added */
read_PageMediaSize(doc, ticket);
read_PageOutputColor(doc, ticket);
fail:
IXMLDOMDocument2_Release(doc);