Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 24689 → Rev 24690

/trunk/Scribus/scribus/scribusdoc.cpp
6432,28 → 6432,34
}
 
 
bool ScribusDoc::itemNameExists(const QString& checkItemName)
bool ScribusDoc::itemNameExists(const QString& checkItemName) const
{
bool found = false;
QList<PageItem*> allItems;
int docItemCount = Items->count();
for (int i = 0; i < docItemCount; ++i)
std::vector<PageItem*> groups;
groups.reserve(32);
 
// Process root elements of the doc and remember groups
for (PageItem* item: *Items)
{
PageItem *currItem = Items->at(i);
if (checkItemName == currItem->itemName())
if (item->itemName() == checkItemName)
return true;
if (currItem->isGroup())
if (item->isGroup())
groups.push_back(item);
}
 
// Process groups
while (!groups.empty())
{
PageItem* item = groups.back();
groups.pop_back();
for (PageItem* item: item->groupItemList)
{
allItems = currItem->getAllChildren();
for (int ii = 0; ii < allItems.count(); ii++)
{
if (checkItemName == allItems.at(ii)->itemName())
return true;
}
if (item->itemName() == checkItemName)
return true;
if (item->isGroup())
groups.push_back(item);
}
allItems.clear();
}
return found;
return false;
}
 
 
/trunk/Scribus/scribus/scribusdoc.h
960,7 → 960,7
* @author Craig Ringer
** CB Moved from PageItem
*/
bool itemNameExists(const QString& itemName);
bool itemNameExists(const QString& itemName) const;
/**
* @brief Set the doc into Master page mode