Hi all, [sorry for the crosspost, i'm unsure where my question belongs to]
From C++ code, i'm tyring to load a document, then invoke ".uno:CompareDocuments" with a second file, hoping that OOo opens a frame with the document compare view in place. (without any neccessary user interaction) googling and searching OOo Forums for a whole day yielded no results, so i hope someone can guide me at least where to find according documentation. I was unable figure out which parameters the dispatch call needs from the API docs. attached is the code i got so far, it just loads the first document and errors with 'called with invalid parameters' for the dispatch. any hints appreciated, TIA, / karl
/*
#define Ascii2OU(value) OUString::createFromAscii((const char *) value)
#define OU2Ascii(value) OUStringToOString(value, RTL_TEXTENCODING_ASCII_US).getStr()
*/
bool OpenOfficeClientImp::compareDocuments(const char *doc1, const char *doc2)
{
bool rc = false;
try {
Reference<XDesktop> desk(m_servicefactory->createInstance(Ascii2OU("com.sun.star.frame.Desktop")), UNO_QUERY);
Reference<XComponentLoader> loader(desk, UNO_QUERY);
Sequence<PropertyValue> loadproperties(2);
loadproperties[0].Name = Ascii2OU("Hidden");
loadproperties[0].Value <<= sal_False;
loadproperties[1].Name = Ascii2OU("Silent");
loadproperties[1].Value <<= sal_True;
Reference<XComponent> comp = loader->loadComponentFromURL(Ascii2OU(doc1), Ascii2OU("_blank"), 0, loadproperties);
Reference<XDispatchHelper> disphlp(m_servicefactory->createInstance(Ascii2OU("com.sun.star.frame.DispatchHelper")), UNO_QUERY);
Reference<XDispatchProvider> currentframe(desk->getCurrentFrame(), UNO_QUERY);
Sequence<PropertyValue> xprops(2);
xprops[0].Name = Ascii2OU("CompareDocuments");
xprops[0].Value <<= sal_True;
xprops[1].Name = OUString( RTL_CONSTASCII_USTRINGPARAM("FileName") );
xprops[1].Value <<= Ascii2OU(doc2);
disphlp->executeDispatch(currentframe, Ascii2OU(".uno:CompareDocuments"), Ascii2OU(""), 0, xprops);
}
catch (Exception &e) {
TRACE("OpenOfficeClientImp::compareDocuments: Error: %s", OU2Ascii(e.Message));
return false;
}
catch (char *finally) {
TRACE("OpenOfficeClientImp::compareDocuments: Error: Unspecified Error %s", finally);
return false;
}
return rc;
}
signature.asc
Description: This is a digitally signed message part
