int TDocManager::GetViewTemplates(TDocTemplate** tplList, int size, TDocument& doc) #endif { // Check for no registered templates // if (!TemplateList) { TRACEX(OwlDocView, 0, _T("GetViewTemplates(): No registered templates!")); return 0; } // Grab a list of templates for creating views // int tplCount = 0; for (TDocTemplate* tpl = TemplateList; tpl; tpl = tpl->GetNextTemplate()) { if (tpl->IsMyKindOfDoc(doc)) { // Don't grab the same view more than once // LPCTSTR viewName = tpl->GetViewName(); int index; for (index = 0; index < tplCount; index++) { if (tplList[index]->GetViewName() == viewName) break; } // Skip a view if the document already has one and the template // specifies 'SingleView'. // if (tpl->IsFlagSet(dtSingleView)) { TView* pview = 0; while ((pview = doc.NextView(pview)) != 0) if (tpl->IsMyKindOfView(*pview)) index = -1; } // Store the template if we have a match... // if (index == tplCount) { CHECK(tplList); CHECK(tplCount < size); tplList[tplCount++] = tpl; } } } return tplCount; }