InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ILayoutUtils Class Referenceabstract

#include <ILayoutUtils.h>

Inheritance diagram for ILayoutUtils:
IPMUnknown

Public Types

enum  { kDefaultIID = IID_ILAYOUTUTILS }
 

Public Member Functions

virtual bool16 FindDocument (const UIDRef &docRef)=0
 
virtual UID GetOwnerPageUID (const IHierarchy *pageItemHier, bool16 enlargeForSlug=kFalse)=0
 
virtual UID GetDrawingPageUID (const IHierarchy *pageItemHier, bool16 enlargeForSlug=kFalse)=0
 
virtual void EnlargePagesRectBySlug (IDataBase *db, PMRect &pageRect, int32 pageIndex, int32 spreadPageCount, PageType pageType, bool16 bPrintingOrExporting=kFalse, int32 trueSpreadPageCount=0)=0
 
virtual UID GetIntersectingPageUID (const UIDRef &spreadRef, const PBPMRect &itemBounds, bool16 enlargeForSlug=kFalse, const Transform::CoordinateSpace &coordinateSpace=Transform::PasteboardCoordinates())=0
 
virtual PageType GetPageType (const UIDRef &pageRef)=0
 
virtual DocPageBinding GetDocumentPageBinding (const UIDRef &docRef)=0
 
virtual IPMUnknownQueryParentFor (const IPMUnknown *pUnknown, const PMIID &rIID)=0
 
virtual IPMUnknownQueryOutermostParentFor (const IPMUnknown *pUnknown, const PMIID &rIID)=0
 
virtual int32 GetMaxSpreadSize (const ISpread *theSpread=nil, bool16 bFactorInIslandness=kTrue, bool16 bFactorInFirstOddPage=kTrue, bool16 bFactorInPagesPerSpreadPref=kTrue)=0
 
virtual bool16 DoesPageHaveContent (const UIDList &pageUIDList)=0
 
virtual IMarginsQueryMargins (int32 whichPage, const ISpread *currentSpread)=0
 
virtual IColumnsQuery_Columns (int32 whichPage, const ISpread *currentSpread)=0
 
virtual ICommandMakeShuffleCmd (IDocument *doc, const UIDRef &firstSpread=UIDRef::gNull, const UIDRef &lastSpread=UIDRef::gNull)=0
 
virtual bool16 IsAMaster (UID spreadOrPageUID, IDataBase *db)=0
 
virtual void InvalidateViews (IDocument *document)=0
 
virtual IPMUnknownSpreadQueryHitTestPageItemNew (const ISpread *mySpread, const PBPMPoint &where, ClassID handlerClass, const PMIID &interfaceID, int16 tolerance=kHitTestTolerance)=0
 
Page-related min/max values.
virtual int32 GetMinNumPages ()=0
 
virtual int32 GetMaxNumPages ()=0
 
virtual int32 GetMinPagesPerSpread ()=0
 
virtual int32 GetMaxPagesPerSpread ()=0
 
virtual int32 GetMinPageWidth ()=0
 
virtual int32 GetMaxPageWidth ()=0
 
virtual int32 GetMinPageLength ()=0
 
virtual int32 GetMaxPageLength ()=0
 
- Public Member Functions inherited from IPMUnknown
virtual IPMUnknownQueryInterface (PMIID interfaceID) const =0
 
virtual void AddRef () const =0
 
virtual void Release () const =0
 

Detailed Description

Layout-related utilities on model side.

See Also
kUtilsBoss
ILayoutUIUtils for view-related methods

Member Function Documentation

virtual bool16 ILayoutUtils::DoesPageHaveContent (const UIDListpageUIDList)
pure virtual

Helper function to create a shuffle pages command for all the pages in a document. Be careful to shuffle the correct spreads, or just default to the whole document.

Parameters
doc[IN] The document to use. If nil, use the front document.
firstSpread[IN] If specified, start with this spread.
lastSpread[IN] If specified, end with this spread.
Returns
an ICommand pointer for the command.Determine there is content on any page in a range of pages
Parameters
pageUIDList[IN] UIDList of pages to check.
Returns
kTrue if any of the pages contain content.
virtual void ILayoutUtils::EnlargePagesRectBySlug (IDataBasedb,
PMRectpageRect,
int32 pageIndex,
int32 spreadPageCount,
PageType pageType,
bool16 bPrintingOrExporting = kFalse,
int32 trueSpreadPageCount = 0 
)
pure virtual

Given a PMRect for a page and some info about the page, enlarge the rect to account for the slug area.

Note: Special care must be paid to "middle" pages in a spread – we don't allow the rect to enlarge in such a way that it would result in a rect that overlaps a neighboring page on the spread. Thus, while all pages can grow vertically, only first and last pages of a spread can grow in both horizontal directions. Special attention must also be paid to binding direction (meaning of 'first' and 'last' differs in RtoL cases).

Parameters
db[IN] IDataBase pointer for the document.
pageRect[IN/OUT] Page's rectangle, potentially modified to account for slug area.
spreadPageCount[IN] The number of pages in the spread.
pageType[IN] What kind of page is represented by pageRect.
bPrintingOrExporting[IN] Whether rect is being computed while printing or exporting. Obsolete, and unused.
trueSpreadPageCount[IN] Used in situations where spreadPageCount "lies," like in cases where the master spread's pagecount is used instead of the layout spread.
See Also
PageType for allowable page types.
virtual bool16 ILayoutUtils::FindDocument (const UIDRefdocRef)
pure virtual

Searches the document list for a particular document.

Parameters
docRefUIDRef identifying the document being sought
Returns
kTrue if the document is in the document list
virtual DocPageBinding ILayoutUtils::GetDocumentPageBinding (const UIDRefdocRef)
pure virtual

Return the binding direction for the specified document

Parameters
docRef[IN] UIDRef of the document.
Returns
DocPageBinding for the binding being used. Note: One of kLeftToRightBinding or kRightToLeftBinding will be returned (default is kLeftToRightBinding; kDefaultBinding will not be returned).
virtual UID ILayoutUtils::GetDrawingPageUID (const IHierarchypageItemHier,
bool16 enlargeForSlug = kFalse 
)
pure virtual

Return the UID of the page on which a given page item is currently being drawn. This can be used to get the page UID of the layout page on which a master page item is being drawn–very useful for determining page number strings. For page items that lie on multiple pages, this routine returns the page on which the majority of the page item area falls. If the page item does not fall on a page at all, the routine returns the UID of the spread.

Parameters
pageItemHier[IN] An IHierarchy pointer for the page item.
Returns
UID of the page on which the page item is drawn, or the spread if the item is not drawn on a page.
virtual UID ILayoutUtils::GetIntersectingPageUID (const UIDRefspreadRef,
const PBPMRectitemBounds,
bool16 enlargeForSlug = kFalse,
const Transform::CoordinateSpacecoordinateSpace = Transform::PasteboardCoordinates() 
)
pure virtual

Given a PBPMRect and a UIDRef of a Spread, this helper function returns the UID of the page in the Spread on which the PBPMRect would fall.

Parameters
UIDRef[IN] UIDRef for the spread.
itemBounds[IN] Rectangle in pasteboard or spread coordinates as specified by coordinateSpace.
coordinateSpace[IN] The coordinate system in which itemBounds is specified. The possible values are Transform::PasteboardCoordinates() and Transform::SpreadCoordinates().
Returns
UID of page where itemBounds rect falls. For a rect that would fall on multiple pages, this routine returns the page on which the majority of the rect area falls. If the rect does not fall on a page at all, the routine returns the UID of the spread.
virtual int32 ILayoutUtils::GetMaxNumPages ()
pure virtual

Return the maximum number of pages in a document.

virtual int32 ILayoutUtils::GetMaxPageLength ()
pure virtual

Return the maximum page height in points.

virtual int32 ILayoutUtils::GetMaxPagesPerSpread ()
pure virtual

Return the maximum number of pages in a spread.

virtual int32 ILayoutUtils::GetMaxPageWidth ()
pure virtual

Return the maximum page width in points.

virtual int32 ILayoutUtils::GetMaxSpreadSize (const ISpreadtheSpread = nil,
bool16 bFactorInIslandness = kTrue,
bool16 bFactorInFirstOddPage = kTrue,
bool16 bFactorInPagesPerSpreadPref = kTrue 
)
pure virtual

Figure out how many pages a particular spread (or any spread, if theSpread == nil) can have.

Parameters
theSpread[IN] ISpread interface of spread to calculate. If nil, calculate for all spreads.
bFactorInIslandness[IN] Whether to take "island spread" capability into account.
bFactorInFirstOddPage[IN] Whether to assume the first page is odd-numbered (and hence a right page).
bFactorInPagesPerSpreadPref[IN] Whether to consider preference value for pages per spread.
Returns
the calculated number of pages for the spread(s).
virtual int32 ILayoutUtils::GetMinNumPages ()
pure virtual

Return the minimum number of pages in a document.

virtual int32 ILayoutUtils::GetMinPageLength ()
pure virtual

Return the minimum page height in points.

virtual int32 ILayoutUtils::GetMinPagesPerSpread ()
pure virtual

Return the minimum number of pages in a spread.

virtual int32 ILayoutUtils::GetMinPageWidth ()
pure virtual

Return the minimum page width in points.

virtual UID ILayoutUtils::GetOwnerPageUID (const IHierarchypageItemHier,
bool16 enlargeForSlug = kFalse 
)
pure virtual

Return the UID of the page on which a given page item falls. For page items that lie on multiple pages, this routine returns the page on which the majority of the page item area falls. If the page item does not fall on a page at all, the routine returns the UID of the spread.

Parameters
pageItemHier[IN] An IHierarchy pointer for the page item.
enlargeForSlug[IN] kTrue to take into consideration the slug area around the page.
Returns
UID of the page on which the page item falls, or the spread if the item does not fall on a page.
virtual PageType ILayoutUtils::GetPageType (const UIDRefpageRef)
pure virtual

Give a ref for a page, return if it is a left, unisex (neither left nor right), or right page. Used for determining what type of page tab to draw in Pages Panel, and has margin implications. For pages that are left pages, their actual left margin will be an outside margin, and their right margin will be an inside margin.

Parameters
pageRef[IN] UIDRef for the page.
Returns
PageType for the page.
virtual void ILayoutUtils::InvalidateViews (IDocumentdocument)
pure virtual

If there are any views, invalidate them, otherwise do nothing. This calls into the UI plug-in Layout UI to actually do the invalidation if there is a UI present.

Parameters
document[IN] to invalidate views for.
virtual bool16 ILayoutUtils::IsAMaster (UID spreadOrPageUID,
IDataBasedb 
)
pure virtual

Tell whether a page is a master page or a master spread.

Parameters
spreadOrPageUID[IN] UID of a page or a spread to check.
db[IN] IDataBase pointer for the document.
Returns
kTrue if the UID is a page in a master spread or is a master spread.
virtual ICommand* ILayoutUtils::MakeShuffleCmd (IDocumentdoc,
const UIDReffirstSpread = UIDRef::gNull,
const UIDReflastSpread = UIDRef::gNull 
)
pure virtual

Helper function to create a shuffle pages command for all the pages in a document. Be careful to shuffle the correct spreads, or just default to the whole document.

Parameters
doc[IN] The document to use. If nil, use the front document.
firstSpread[IN] If specified, start with this spread.
lastSpread[IN] If specified, end with this spread.
Returns
an ICommand pointer for the command.
virtual IColumns* ILayoutUtils::Query_Columns (int32 whichPage,
const ISpreadcurrentSpread 
)
pure virtual

Return the columns of the spread associated with the frontmost layout window, or the indicated spread if the optional argument is used.

Parameters
whichpage[IN] Optional zero-based page index for the desired page of the spread (zero is the left page in left-to-right binding documents, the right page in right-to-left documents).
currentSpread[IN] Optional ISpread pointer for the desired spread.
Returns
IColumns pointer for the columns. The reference count is incremented; the caller is responsible for calling Release();
virtual IMargins* ILayoutUtils::QueryMargins (int32 whichPage,
const ISpreadcurrentSpread 
)
pure virtual

Return the margins of the given spread.

Parameters
whichpage[IN] Optional zero-based page index for the desired page of the spread (zero is the left page in left-to-right binding documents, the right page in right-to-left documents).
currentSpread[IN] Optional ISpread pointer for the desired spread.
Returns
IMargins pointer for the margins. The reference count is incremented; the caller is responsible for calling Release();
virtual IPMUnknown* ILayoutUtils::QueryOutermostParentFor (const IPMUnknownpUnknown,
const PMIIDrIID 
)
pure virtual

Traverse up the hierarchy to the outermost frame looking for an item supporting the specified interface.

Parameters
pUnknown[IN] Interface pointer to the starting item.
rIID[IN] Interface ID for the interface being sought.
Returns
IPMUnknown pointer for item found, else nil. If non-nil, the reference count is incremented; the caller is responsible for calling Release().
virtual IPMUnknown* ILayoutUtils::QueryParentFor (const IPMUnknownpUnknown,
const PMIIDrIID 
)
pure virtual

Traverse up the hierarchy looking for an item supporting the specified interface.

Parameters
pUnknown[IN] Interface pointer to the starting item.
rIID[IN] Interface ID for the interface being sought.
Returns
IPMUnknown pointer for item found, else nil. If non-nil, the reference count is incremented; the caller is responsible for calling Release().
virtual IPMUnknown* ILayoutUtils::SpreadQueryHitTestPageItemNew (const ISpreadmySpread,
const PBPMPointwhere,
ClassID handlerClass,
const PMIIDinterfaceID,
int16 tolerance = kHitTestTolerance 
)
pure virtual

UI independant Hit testing code. If your hit testing can be done with the UI(not ID server), use the calls in ILayoutUIUtils to Hit test. Hit-test a point on the given spread

Parameters
mySpread[IN] the spread to hit-test
where[IN] point to hit-test in pasteboard coordinates.
handlerClass[IN] ClassID of handler boss for particular hit-test behavior desired.
interfaceID[IN] the interfaceID of the hit page item you want returned
tolerance[IN] The tolerance for how close 'where' must be to be considered a hit. Defaults to kHitTestTolerance.
Returns
item that was hit. Interface returned is the one specified with interfaceID parameter