No code but LayerData is where you want to begin. You can get the root layer (a list head) of the Document using BaseDocument::GetLayerObjectRoot(). Search here for GetLayerObjectRoot for some topics and code.