![]() | InDesign SDK 20.5 |
#include <DocumentPresFindCriteria.h>
This file contains declarations of simple selector and comparison functions designed to be used with two methods from IDocumentUIUtils.
FindPresentationsForDocument: used to find and optionally order a subset of the presentations on a document (or on all documents)
FindRelatedPresentations: used to find and optionally order a subset of the presentations on a document (or on all documents) that are related to
a particular presentation (most commonly are the presentations of the same type)
The implementations of these functions are found in the WidgetBin shared library, so you cannot use them from a model only plugin. Should the need arise you can create local implementations, such as:
static bool private_is_active(IDocumentPresentation* p) { return p->IsActive(); } FindPresCriteria: are unary predicates (one parameter boolean functions) used to select and order the set of document presentations returned from IDocumentUIUtils::FindPresentationsForDocument.
Examples: Find all minimized presentations, ordered so that the layout presentations come before any story editors. whichDocument: NIL acceptCriteria: is_minimized preferCriteria: is_layout
Find all presentations, and order them loosely by activation (active one first followed by the frontmost ones in any tab groups, followed by the obscured ones in tab groups. whichDocument: NIL acceptCriteria: accept_all preferCriteria: is_active + is_frontmost_in_tabgroup
Find all floating presentations, and order them loosely by activation whichDocument: NIL acceptCriteria: is_floating preferCriteria: is_active + is_frontmost_in_tabgroup
Code snippet: PresentationSequence plist; FindPresentation_Criteria require = FindPresCriteria::is_floating; // only the floating ones FindPresentation_PreferCriteria prefer; prefer.push_back(FindPresCriteria::is_active); prefer.push_back(FindPresCriteria::is_frontmost_in_tabgroup); int32 count = Utils<IDocumentUIUtils>()->FindPresentationsForDocument(nil, plist, require, prefer);