🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.indesign.sdk
Article #52

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

#52
From: Jacques_TRIPOZ
Date: Thu, 12 Mar 2009 13:41
43 lines
2080 bytes
Hi again Pallavik,

What seems to be missing is the loop thru stories nextUID = iTextStoryThreadDictHier->NextUID(nextUID);
(and it was missing in my snippet too...)

I've just rewrite and tested the function hereunder (I've omitted controls about (iXXX != nil)) and it's working fine

bool GetTableList(IDocument *iDocument)
{
	bool bRetVal = true;

	do
	{
		InterfacePtr<IStoryList> iStoryList(iDocument,UseDefaultIID());
		int32 iNbStories = iStoryList->GetUserAccessibleStoryCount();
		for (int32 iNoStory = 0; iNoStory < iNbStories; iNoStory++ ) 		{			 			UIDRef uidrefStory = iStoryList->GetNthUserAccessibleStoryUID(iNoStory);
			InterfacePtr<ITextModel> iTextModel(uidrefStory,UseDefaultIID());
			InterfacePtr<ITextStoryThreadDictHier> iTextStoryThreadDictHier(iTextModel,UseDefaultIID());

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

			while(nextUID != kInvalidUID)
			{
				InterfacePtr<ITextStoryThreadDict> iTextStoryThreadDict(::GetDataBase(iTextStoryThreadDictHier),nextUID,UseDefaultIID());
				InterfacePtr<ITableModel> iTableModel(iTextStoryThreadDict, UseDefaultIID());
				if (iTableModel != nil)
				{
					UIDRef uidRefTable = ::GetUIDRef(iTableModel);
				}
				// Get the next text story thread dictionary in the collection
				nextUID = iTextStoryThreadDictHier->NextUID(nextUID);
			}			
		}

	}while(kFalse);

	return bRetVal;
}

HTH,

J.
Technical Details
Message-ID: <59b830a3.2@webcrossing.la2eafNXanI>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.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!g2news1.google.com!news2.google.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.2@webcrossing.la2eafNXanI>
Date: Thu, 12 Mar 2009 06:41:04 -0700
References: <59b830a3.-1@webcrossing.la2eafNXanI>
Lines: 51
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit