See AbstractViewPE.h. This protocol extension can be applied to OdDbViewport, OdDbViewportTableRecord and OdDbViewTableRecord.
You can find sample code in Kernel/Exports/RasterExport. AbstractViewPE in its zoomExtents() and viewExtents() takes into account only visible geometry, honoring layer state (if a layer is off or frozen).