mac os x 组件对象模型等效项
我正在尝试将我用 Qt 编写的应用程序从 Windows 平台移植到 Mac OS X 平台。
应用比较简单: 它向用户查询文档(MS Word 或 OOo Writer 文档)。然后它会启动该文件 各自的应用程序,然后用其他数据替换各种文本元素(Think Mailmerge)。 它启动应用程序并使用 QAxObject(COM 的包装器)进行文本替换。
现在我想将其移植到 Mac OS X。我已经在 Mac 等上安装了 Qt Creator,但显然 COM 是一种 Windows 技术,在 Mac OS X 上不可用。 因此,我一直在 Mac OS X 上寻找与 COM 类似的技术。
目前,我对使用 OOo API http://api.openoffice.org/ 特别感兴趣。
我想要一些我应该关注哪些技术的建议。我也愿意接受这显然是根本不可能的。
提前致谢。
I'm trying to port an application I've written in Qt from the windows platform to the Mac OS X platform.
The application is relatively simple:
It queries the user for a document (either MS Word, or OOo Writer document). It than launches that that document inside the
respective application, and than replaces various text elements with other data (Think Mailmerge).
It starts up the application and does the text replacing using QAxObject which is wrapper for 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.
For now, I'm especially interested in using the 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
有关 OS X 上 COM 的一些信息,请参阅 这篇 2004 年的文章 来自 O'Reilly 的 MacDevCenter。
但是,从问题的描述来看,您正在寻找适用于 Apple Events 的东西。 Apple 开发了一种用于处理 Apple Events 的完整语言,因此大多数人将它们等同于 AppleScript 语言。您将希望通过探索 AppleScript 或 Apple Events 来开始探索 GUI 应用程序脚本编写领域。
每个可直接编写脚本的应用程序都有一个可以操作的“动词”和“名词”的“字典”。名词具有属性,属性的名称通常是字符串或另一个名词的名称(或名词的复数形式,这意味着集合 - 数组)。
如果应用程序没有字典(即不可编写脚本)或无法通过字典提供您所需的内容,则可以将通用 UI 脚本命令发送到名为“系统事件”的“应用程序”。
A bit of information about COM on OS X is available in this 2004 article from O'Reilly's MacDevCenter.
From the description of your problem, however, you're looking for something that works with Apple Events. Apple has developed an entire language for working with Apple Events, so most people equate them with the language -- AppleScript. You'll want to start exploring the field of scripting GUI applications with exploration of AppleScript, or Apple Events.
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 (i.e. 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".
嗯——在 OOo 领域的经验不多,但是您是否考虑过使用 UNO(OpenOffice 的组件模型)?
一些文档可以在此处的开发人员指南中找到。
Hmmm -- not a lot of experience in the OOo arena, but have you considered using UNO, the component model that is part of OpenOffice?
Some documentation can be found in the Developer's Guide here.