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