🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.indesign.sdk
Article #49

Re: How to get the reference to tablemodel if table is not selected.

#49
From: Jacques_TRIPOZ
Date: Thu, 12 Mar 2009 09:25
36 lines
1728 bytes
Hi, i do it this way :

do{
		CHECK(uidrefStory != UIDRef(nil, kInvalidUID));

		GET_DEFAULT_INTERFACE(ITextModel,iTextModel,uidrefStory);
		GET_DEFAULT_INTERFACE(ITextStoryThreadDictHier,iTextStoryDictHier,iTextModel);

		UIDRef storyUIDRef(::GetUIDRef(iTextStoryDictHier));
		UID nextUID = storyUIDRef.GetUID();

		while(nextUID != kInvalidUID)
		{
			GET_DEFAULT_INTERFACE_FROM_UID(ITextStoryThreadDict,iTextStoryThreadDict,::GetDataBase(iTextStoryDictHier),nextUID);

			// Est-ce qu'on a une table ?
			InterfacePtr<ITableModel> iTableModel(iTextStoryThreadDict, UseDefaultIID());
			if (iTableModel != nil)
			{
			}
		}
	}while(kFalse);

'uidrefStory' is your 'storyRef'.

GET_DEFAULT_INTERFACE, GET_DEFAULT_INTERFACE_FROM_UID are macros which do the relevant InterfacePtr<...>, and break (with logging) if the interface is nil.

The may difference seems to be

UIDRef storyUIDRef(::GetUIDRef(iTextStoryDictHier));

even if the name 'storyUIDRef' isn't maybe the best choice...

HTH,

J.
Technical Details
Message-ID: <59b830a3.0@webcrossing.la2eafNXanI>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!newshub.sdsu.edu!webcrossing
References: <59b830a3.-1@webcrossing.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Thread: f63e9,c35f77239286b74a
X-Google-Attributes: gidf63e9,domainid0,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: Jacques_TRIPOZ@adobeforums.com
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!newshub.sdsu.edu!webcrossing
Newsgroups: adobe.indesign.sdk
Subject: Re: How to get the reference to tablemodel if
 table is not selected.
Message-ID: <59b830a3.0@webcrossing.la2eafNXanI>
Date: Thu, 12 Mar 2009 02:25:25 -0700
References: <59b830a3.-1@webcrossing.la2eafNXanI>
Lines: 41
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit