/** * This accept function is called by the parent IdmlSpread. * * @param IdmlVisitor $visitor * @param $depth is how deep in the traversal we are */ public function accept(IdmlVisitor $visitor, $depth) { // Skip the page in case it does not have any children elements. if (IdmlAssembler::getInstance()->isReflowable()) { if (count($this->childrenElements) == 0 || $this->hasOnlyEmptyTextFrames()) { return; } } $visitor->visitPage($this, $depth); // First walk the elements of the associated master spread. if (IdmlAssembler::getInstance()->isFixedLayout()) { $this->visitMasterPageItems($visitor, $this->inDesignPageName, $depth + 1); } // Then walk the elements of this page itself foreach ($this->childrenElements as $childElement) { $childElement->accept($visitor, $depth + 1); } $visitor->visitPageEnd($this, $depth); }