简体   繁体   English

mac os x组件对象模型等价物

[英]mac os x Component Object Model equivalent

I'm trying to port an application I've written in Qt from the windows platform to the Mac OS X platform. 我正在尝试将我在Qt中编写的应用程序从Windows平台移植到Mac OS X平台。

The application is relatively simple: It queries the user for a document (either MS Word, or OOo Writer document). 该应用程序相对简单:它向用户查询文档(MS Word或OOo Writer文档)。 It than launches that that document inside the respective application, and than replaces various text elements with other data (Think Mailmerge). 它不是在相应的应用程序中启动该文档,而是用其他数据替换各种文本元素(Think Mailmerge)。 It starts up the application and does the text replacing using QAxObject which is wrapper for COM. 它启动应用程序并使用QAxObject替换文本,QAxObject是COM的包装器。

Now I'm wanting to port this to the Mac OS X. I've installed Qt Creator on the Mac etc., but obivously COM is a windows technique not available on the Mac OS X. So I've been looking around for techniques on the Mac OS X that are similiar to COM. 现在我想把它移植到Mac OS X.我已经在Mac等上安装了Qt Creator,但是很明显COM是Mac OS X上没有的Windows技术。所以我一直在寻找技术在Mac OS X上与COM类似。

For now, I'm especially interested in using the OOo API http://api.openoffice.org/ . 目前,我对使用OOo API http://api.openoffice.org/特别感兴趣。

I'd like some pointers which techniques I should be looking at. 我想要一些我应该关注的技巧。 I'm also willing to accept that this just plainly is not possible at all. 我也愿意接受这一点,显然根本不可能。

Thanks in advance. 提前致谢。

A bit of information about COM on OS X is available in this 2004 article from O'Reilly's MacDevCenter. 有关OS X上COM的一些信息可以在O'Reilly的MacDevCenter的2004年文章中找到。


From the description of your problem, however, you're looking for something that works with Apple Events. 但是,从您的问题描述中,您正在寻找适用于Apple Events的内容。 Apple has developed an entire language for working with Apple Events, so most people equate them with the language -- AppleScript. Apple开发了一种与Apple Events合作的完整语言,因此大多数人都将其与Apple语言等同起来。 You'll want to start exploring the field of scripting GUI applications with exploration of AppleScript, or Apple Events. 您将通过探索AppleScript或Apple Events开始探索脚本GUI应用程序领域。

Each directly scriptable app has a "dictionary" of "verbs" and "nouns" you can manipulate. 每个可直接编写脚本的应用程序都有一个“词典”,您可以操作“动词”和“名词”。 Nouns have properties, and name of the property is often either a string or the name of another noun (or a plural of a noun, which implies a collection - an array). 名词具有属性,属性的名称通常是字符串或另一个名词的名称(或名词的复数,暗示集合 - 数组)。

If the app doesn't have a dictionary (ie it isn't scriptable) or doesn't provide what you need via the dictionary, it is possible to send generic UI scripting commands to an "application" called "System Events". 如果应用程序没有字典(即它不可编写脚本)或者没有通过字典提供所需内容,则可以将通用UI脚本命令发送到名为“系统事件”的“应用程序”。

Hmmm -- not a lot of experience in the OOo arena, but have you considered using UNO, the component model that is part of OpenOffice? 嗯 - 在OOo领域没有很多经验,但您是否考虑过使用UNO,这是OpenOffice的组件模型?

Some documentation can be found in the Developer's Guide here . 有些文档可以在开发人员指南中找到

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM