How to change the default Object Style
Hi everyone,
I Should change default Object Style and I found out these methods, but How should I behave in these cases where nothing is documented?
It's really difficult to have a good workflow when I encounter these commands which are not documented, so I have to try and try, also every time I encounter IPMUnknown interfaces I don't know how to behave, should they be left empty? do they have to be filled? I have no idea without some documentation.
I would need some tips from someone with a lot of experience to know how to behave in these situations, because I'm always reduced to asking the community slowing down my workflow considerably.
Anyway, back to changing the default object style, I've tried these methods:
1) Using kChangeDefaultTFObjStyleCmdBoss

InterfacePtr<ICommand> changeDefaultTFObjStyleCmd(CmdUtils::CreateCommand(kChangeDefaultTFObjStyleCmdBoss));
if(!changeDefaultTFObjStyleCmd)
break;
InterfacePtr<IUIDData> UIDData(changeDefaultTFObjStyleCmd, UseDefaultIID());
if(!UIDData)
break;
UIDData->Set(DATABASE, UIDStyle);
if(CmdUtils::ProcessCommand(changeDefaultTFObjStyleCmd) != kSuccess) // Thread 1: EXC_BAD_ACCESS (code=1, address=0x0)
break;
2) Using kApplyObjStyleToDefaultsCmdBoss

InterfacePtr<ICommand> applyObjStyleToDefaultsCmd(CmdUtils::CreateCommand(kApplyObjStyleToDefaultsCmdBoss));
if(!applyObjStyleToDefaultsCmd)
break;
InterfacePtr<IUIDData> UIDData(applyObjStyleToDefaultsCmd, UseDefaultIID());
if(!UIDData)
break;
UIDData->Set(DATABASE, UIDStyle);
if(CmdUtils::ProcessCommand(applyObjStyleToDefaultsCmd) != kSuccess) // Thread 1: EXC_BAD_ACCESS (code=1, address=0x0)
break;
3) Using IStyleGroupManager::Set______()

InterfacePtr<IStyleGroupManager> styleGroupManager(DOCUMENT->GetDocWorkSpace(), IID_IOBJECTSTYLEGROUPMANAGER);
if(!styleGroupManager)
break;
styleGroupManager->SetDefaultStyleUID(UIDStyle);
styleGroupManager->SetDefaultTextStyleUID(UIDStyle);
styleGroupManager->SetDefaultFrameGridStyleUID(UIDStyle);
But when I try to create new text frame apply [None] anyway, so I think that I sholud usekChangeDefaultTFObjStyleCmdBoss or kApplyObjStyleToDefaultsCmdBoss.
Stefano