How to use a boss class?
Hi everyone,
Please explain me how to use a boss class?
for example: kSetPageSetupPrefsCmdBoss, kWorkspaceBoss, kDocStyleBoss..
Hi everyone,
Please explain me how to use a boss class?
for example: kSetPageSetupPrefsCmdBoss, kWorkspaceBoss, kDocStyleBoss..
How to use boss class depends on what you would like to implement.
SDK documentation is the only resource to learn plug-in development in InDesign.
Few things you should understand:
-> InDesign uses its own object model.
This object model is constructed at runtime.
As you know, C++ has an object model, but InDesign although developed in C++ but has its own object model.
InDesign uses an abstraction called boss class.
A boss is a class in the InDesign object model.
-> Objects in InDesign are boss class objects.
This means that a document, page, spread, page item are not C++ objects but boss class objects.
document -> kDocBoss
spread -> kSpreadBoss
etc.
These boss classes have hierachical structure.
Boss class is a kind of InDesign class and not a C++ class.
Plug-ins in InDesign talk to each other via the boss classes.
-> You should have a basic understanding of interface-based programming.
Read basics of Component Object Model (COM).
Programming in InDesign in similar to COM where functionality is accessed via interfaces.
-> Your plug-in will create boss classes, or add features to existing boss classes.
The fr (resource) file is where you define the boss class.
-> You should be familiar with design patterns.
InDesign heavily uses design patterns like observer, command, responder, factory, etc.
-> You have lots of sample code in the SDK which you can refer to.
-> Believe me, InDesign API is very-well documented.
API documentation in products like Photoshop, Illustrator really sucks.
Example:
Suppose I would like to add some custom data to be stored inside each document.
I would add a persistent interface-impl to the kDocBoss.
Here, you add functionality to existing boss.
This would mean that I will create a new interface and impl IDs in the pluginID.h file.
Create a file with the corresponding C++ class.
Register the interface-impl and bind them.
Of course, will add the interface-impl to kDocBoss in the fr file.
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.