diff --git a/indra/llui/llaccordionctrltab.h b/indra/llui/llaccordionctrltab.h
index 462ccc6d5392f45090e84883f3b16d0e607b4baa..4b8b22405ea2fc3e4e6326e6ee51508b162478a3 100644
--- a/indra/llui/llaccordionctrltab.h
+++ b/indra/llui/llaccordionctrltab.h
@@ -35,8 +35,9 @@
 
 #include <string>
 #include "llrect.h"
+#include "lluictrl.h"
+#include "lluicolor.h"
 
-class LLUICtrl;
 class LLUICtrlFactory;
 class LLUIImage;
 class LLButton;
diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp
index 1fb4cff31aa48e91d842dffbef448093badf506c..36c03aca5773d45dcc15befb94e15db4c958131a 100644
--- a/indra/newview/llagentwearables.cpp
+++ b/indra/newview/llagentwearables.cpp
@@ -31,28 +31,28 @@
  */
 
 #include "llviewerprecompiledheaders.h"
+#include "llagentwearables.h"
 
+#include "llaccordionctrltab.h"
 #include "llagent.h"
 #include "llagentcamera.h"
-#include "llagentwearables.h"
-
+#include "llappearancemgr.h"
 #include "llcallbacklist.h"
 #include "llfloatercustomize.h"
+#include "llfolderview.h"
+#include "llgesturemgr.h"
 #include "llinventorybridge.h"
+#include "llinventoryfunctions.h"
 #include "llinventoryobserver.h"
 #include "llinventorypanel.h"
 #include "llnotificationsutil.h"
+#include "llpaneloutfitsinventory.h"
+#include "llsidetray.h"
+#include "lltexlayer.h"
 #include "llviewerregion.h"
 #include "llvoavatarself.h"
 #include "llwearable.h"
 #include "llwearablelist.h"
-#include "llgesturemgr.h"
-#include "llappearancemgr.h"
-#include "lltexlayer.h"
-#include "llsidetray.h"
-#include "llpaneloutfitsinventory.h"
-#include "llfolderview.h"
-#include "llaccordionctrltab.h"
 
 #include <boost/scoped_ptr.hpp>
 
diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp
index 80d24f75b99266b6e83bb4a7e1d10f4a3102a275..5b034b53c0edf702b053d34ced68a620637b6543 100644
--- a/indra/newview/llappearancemgr.cpp
+++ b/indra/newview/llappearancemgr.cpp
@@ -39,6 +39,7 @@
 #include "llfloatercustomize.h"
 #include "llgesturemgr.h"
 #include "llinventorybridge.h"
+#include "llinventoryfunctions.h"
 #include "llinventoryobserver.h"
 #include "llnotificationsutil.h"
 #include "llsidepanelappearance.h"
diff --git a/indra/newview/llfavoritesbar.cpp b/indra/newview/llfavoritesbar.cpp
index bf7c73548833c360e999392861a6a858d483f363..ba92c33d5914bbf6a08d0525c36657bc935fac94 100644
--- a/indra/newview/llfavoritesbar.cpp
+++ b/indra/newview/llfavoritesbar.cpp
@@ -31,7 +31,6 @@
  */
 
 #include "llviewerprecompiledheaders.h"
-
 #include "llfavoritesbar.h"
 
 #include "llfloaterreg.h"
@@ -47,6 +46,7 @@
 #include "llclipboard.h"
 #include "llinventoryclipboard.h"
 #include "llinventorybridge.h"
+#include "llinventoryfunctions.h"
 #include "llfloaterworldmap.h"
 #include "lllandmarkactions.h"
 #include "llnotificationsutil.h"
diff --git a/indra/newview/llfloatergesture.cpp b/indra/newview/llfloatergesture.cpp
index bf034126967b6f6a6b8f01ee145ae76421b807c2..5a332726b2f0e93ce5c5cb02bd8037f55fde5022 100644
--- a/indra/newview/llfloatergesture.cpp
+++ b/indra/newview/llfloatergesture.cpp
@@ -36,6 +36,7 @@
 
 #include "llinventory.h"
 #include "llinventorybridge.h"
+#include "llinventoryfunctions.h"
 #include "llinventorymodel.h"
 #include "llinventoryclipboard.h"
 
diff --git a/indra/newview/llfloaterworldmap.cpp b/indra/newview/llfloaterworldmap.cpp
index f05bd8574fbddc7d775ae24837bb058824ebf9cf..f17c9765b9f167e7db5bfb93a93674419fef0f3e 100644
--- a/indra/newview/llfloaterworldmap.cpp
+++ b/indra/newview/llfloaterworldmap.cpp
@@ -51,6 +51,7 @@
 //#include "llfirstuse.h"
 #include "llfloaterreg.h"		// getTypedInstance()
 #include "llfocusmgr.h"
+#include "llinventoryfunctions.h"
 #include "llinventorymodel.h"
 #include "llinventorymodelbackgroundfetch.h"
 #include "llinventoryobserver.h"
diff --git a/indra/newview/llfriendcard.cpp b/indra/newview/llfriendcard.cpp
index 1a06bef6cb2e60b5bdc4f068d65d837fa3938506..a848128d67026ba7c1d16b83132ea727f76a4e37 100644
--- a/indra/newview/llfriendcard.cpp
+++ b/indra/newview/llfriendcard.cpp
@@ -33,6 +33,7 @@
 #include "llviewerprecompiledheaders.h"
 
 #include "llinventory.h"
+#include "llinventoryfunctions.h"
 #include "llinventoryobserver.h"
 #include "lltrans.h"
 
diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp
index 9c477791b3c94c32c5258e298ce1d4a8d5197c86..3ec8d11fb0cd7c72b5bb092085f2f359494e7276 100644
--- a/indra/newview/llimfloater.cpp
+++ b/indra/newview/llimfloater.cpp
@@ -44,6 +44,7 @@
 #include "llchiclet.h"
 #include "llfloaterreg.h"
 #include "llimfloatercontainer.h" // to replace separate IM Floaters with multifloater container
+#include "llinventoryfunctions.h"
 #include "lllayoutstack.h"
 #include "lllineeditor.h"
 #include "lllogchat.h"
diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp
index 1e0abeadf15af5f01b1ed1478bac35460d649ebe..ab2133d779579934d7788658f603e559cb4a88e3 100644
--- a/indra/newview/llinventoryfunctions.cpp
+++ b/indra/newview/llinventoryfunctions.cpp
@@ -86,6 +86,177 @@
 BOOL LLInventoryState::sWearNewClothing = FALSE;
 LLUUID LLInventoryState::sWearNewClothingTransactionID;
 
+
+///----------------------------------------------------------------------------
+/// LLInventoryCollectFunctor implementations
+///----------------------------------------------------------------------------
+
+// static
+bool LLInventoryCollectFunctor::itemTransferCommonlyAllowed(LLInventoryItem* item)
+{
+	if (!item)
+		return false;
+
+	bool allowed = false;
+
+	switch(item->getType())
+	{
+	case LLAssetType::AT_CALLINGCARD:
+		// not allowed
+		break;
+		
+	case LLAssetType::AT_OBJECT:
+		if (isAgentAvatarValid() && !gAgentAvatarp->isWearingAttachment(item->getUUID()))
+		{
+			allowed = true;
+		}
+		break;
+		
+	case LLAssetType::AT_BODYPART:
+	case LLAssetType::AT_CLOTHING:
+		if(!gAgentWearables.isWearingItem(item->getUUID()))
+		{
+			allowed = true;
+		}
+		break;
+		
+	default:
+		allowed = true;
+		break;
+	}
+
+	return allowed;
+}
+
+bool LLIsType::operator()(LLInventoryCategory* cat, LLInventoryItem* item)
+{
+	if(mType == LLAssetType::AT_CATEGORY)
+	{
+		if(cat) return TRUE;
+	}
+	if(item)
+	{
+		if(item->getType() == mType) return TRUE;
+	}
+	return FALSE;
+}
+
+bool LLIsNotType::operator()(LLInventoryCategory* cat, LLInventoryItem* item)
+{
+	if(mType == LLAssetType::AT_CATEGORY)
+	{
+		if(cat) return FALSE;
+	}
+	if(item)
+	{
+		if(item->getType() == mType) return FALSE;
+		else return TRUE;
+	}
+	return TRUE;
+}
+
+bool LLIsTypeWithPermissions::operator()(LLInventoryCategory* cat, LLInventoryItem* item)
+{
+	if(mType == LLAssetType::AT_CATEGORY)
+	{
+		if(cat) 
+		{
+			return TRUE;
+		}
+	}
+	if(item)
+	{
+		if(item->getType() == mType)
+		{
+			LLPermissions perm = item->getPermissions();
+			if ((perm.getMaskBase() & mPerm) == mPerm)
+			{
+				return TRUE;
+			}
+		}
+	}
+	return FALSE;
+}
+
+bool LLBuddyCollector::operator()(LLInventoryCategory* cat,
+								  LLInventoryItem* item)
+{
+	if(item)
+	{
+		if((LLAssetType::AT_CALLINGCARD == item->getType())
+		   && (!item->getCreatorUUID().isNull())
+		   && (item->getCreatorUUID() != gAgent.getID()))
+		{
+			return true;
+		}
+	}
+	return false;
+}
+
+
+bool LLUniqueBuddyCollector::operator()(LLInventoryCategory* cat,
+										LLInventoryItem* item)
+{
+	if(item)
+	{
+		if((LLAssetType::AT_CALLINGCARD == item->getType())
+ 		   && (item->getCreatorUUID().notNull())
+ 		   && (item->getCreatorUUID() != gAgent.getID()))
+		{
+			mSeen.insert(item->getCreatorUUID());
+			return true;
+		}
+	}
+	return false;
+}
+
+
+bool LLParticularBuddyCollector::operator()(LLInventoryCategory* cat,
+											LLInventoryItem* item)
+{
+	if(item)
+	{
+		if((LLAssetType::AT_CALLINGCARD == item->getType())
+		   && (item->getCreatorUUID() == mBuddyID))
+		{
+			return TRUE;
+		}
+	}
+	return FALSE;
+}
+
+
+bool LLNameCategoryCollector::operator()(
+	LLInventoryCategory* cat, LLInventoryItem* item)
+{
+	if(cat)
+	{
+		if (!LLStringUtil::compareInsensitive(mName, cat->getName()))
+		{
+			return true;
+		}
+	}
+	return false;
+}
+
+///----------------------------------------------------------------------------
+/// LLAssetIDMatches 
+///----------------------------------------------------------------------------
+bool LLAssetIDMatches::operator()(LLInventoryCategory* cat, LLInventoryItem* item)
+{
+	return (item && item->getAssetUUID() == mAssetID);
+}
+
+///----------------------------------------------------------------------------
+/// LLLinkedItemIDMatches 
+///----------------------------------------------------------------------------
+bool LLLinkedItemIDMatches::operator()(LLInventoryCategory* cat, LLInventoryItem* item)
+{
+	return (item && 
+			(item->getIsLinkType()) &&
+			(item->getLinkedUUID() == mBaseItemID)); // A linked item's assetID will be the compared-to item's itemID.
+}
+
 void LLSaveFolderState::setApply(BOOL apply)
 {
 	mApply = apply; 
diff --git a/indra/newview/llinventoryfunctions.h b/indra/newview/llinventoryfunctions.h
index 968db84819bcb797615139b5c5ce1ec6880fbe3f..eb337636704f1ece52b75194438e8d530e4d1e35 100644
--- a/indra/newview/llinventoryfunctions.h
+++ b/indra/newview/llinventoryfunctions.h
@@ -38,15 +38,221 @@
 #include "llfolderview.h"
 #include "llfolderviewitem.h"
 
+/********************************************************************************
+ **                                                                            **
+ **                    INVENTORY COLLECTOR FUNCTIONS
+ **/
+
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// Class LLInventoryCollectFunctor
+//
+// Base class for LLInventoryModel::collectDescendentsIf() method
+// which accepts an instance of one of these objects to use as the
+// function to determine if it should be added. Derive from this class
+// and override the () operator to return TRUE if you want to collect
+// the category or item passed in.
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+class LLInventoryCollectFunctor
+{
+public:
+	virtual ~LLInventoryCollectFunctor(){};
+	virtual bool operator()(LLInventoryCategory* cat, LLInventoryItem* item) = 0;
+
+	static bool itemTransferCommonlyAllowed(LLInventoryItem* item);
+};
+
+
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// Class LLAssetIDMatches
+//
+// This functor finds inventory items pointing to the specified asset
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+class LLViewerInventoryItem;
+
+class LLAssetIDMatches : public LLInventoryCollectFunctor
+{
+public:
+	LLAssetIDMatches(const LLUUID& asset_id) : mAssetID(asset_id) {}
+	virtual ~LLAssetIDMatches() {}
+	bool operator()(LLInventoryCategory* cat, LLInventoryItem* item);
+	
+protected:
+	LLUUID mAssetID;
+};
+
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// Class LLLinkedItemIDMatches
+//
+// This functor finds inventory items linked to the specific inventory id.
+// Assumes the inventory id is itself not a linked item.
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+class LLLinkedItemIDMatches : public LLInventoryCollectFunctor
+{
+public:
+	LLLinkedItemIDMatches(const LLUUID& item_id) : mBaseItemID(item_id) {}
+	virtual ~LLLinkedItemIDMatches() {}
+	bool operator()(LLInventoryCategory* cat, LLInventoryItem* item);
+	
+protected:
+	LLUUID mBaseItemID;
+};
+
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// Class LLIsType
 //
-// This is a collection of miscellaneous functions and classes
-// that don't fit cleanly into any other class header.  Eventually,
-// we should figure out where to put these functions so that we can
-// get rid of this generic file.
+// Implementation of a LLInventoryCollectFunctor which returns TRUE if
+// the type is the type passed in during construction.
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+class LLIsType : public LLInventoryCollectFunctor
+{
+public:
+	LLIsType(LLAssetType::EType type) : mType(type) {}
+	virtual ~LLIsType() {}
+	virtual bool operator()(LLInventoryCategory* cat,
+							LLInventoryItem* item);
+protected:
+	LLAssetType::EType mType;
+};
+
+
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// Class LLIsNotType
 //
+// Implementation of a LLInventoryCollectFunctor which returns FALSE if the
+// type is the type passed in during construction, otherwise false.
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
+class LLIsNotType : public LLInventoryCollectFunctor
+{
+public:
+	LLIsNotType(LLAssetType::EType type) : mType(type) {}
+	virtual ~LLIsNotType() {}
+	virtual bool operator()(LLInventoryCategory* cat,
+							LLInventoryItem* item);
+protected:
+	LLAssetType::EType mType;
+};
+
+class LLIsTypeWithPermissions : public LLInventoryCollectFunctor
+{
+public:
+	LLIsTypeWithPermissions(LLAssetType::EType type, const PermissionBit perms, const LLUUID &agent_id, const LLUUID &group_id) 
+		: mType(type), mPerm(perms), mAgentID(agent_id), mGroupID(group_id) {}
+	virtual ~LLIsTypeWithPermissions() {}
+	virtual bool operator()(LLInventoryCategory* cat,
+							LLInventoryItem* item);
+protected:
+	LLAssetType::EType mType;
+	PermissionBit mPerm;
+	LLUUID			mAgentID;
+	LLUUID			mGroupID;
+};
+
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// Class LLBuddyCollector
+//
+// Simple class that collects calling cards that are not null, and not
+// the agent. Duplicates are possible.
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+class LLBuddyCollector : public LLInventoryCollectFunctor
+{
+public:
+	LLBuddyCollector() {}
+	virtual ~LLBuddyCollector() {}
+	virtual bool operator()(LLInventoryCategory* cat,
+							LLInventoryItem* item);
+};
+
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// Class LLUniqueBuddyCollector
+//
+// Simple class that collects calling cards that are not null, and not
+// the agent. Duplicates are discarded.
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+class LLUniqueBuddyCollector : public LLInventoryCollectFunctor
+{
+public:
+	LLUniqueBuddyCollector() {}
+	virtual ~LLUniqueBuddyCollector() {}
+	virtual bool operator()(LLInventoryCategory* cat,
+							LLInventoryItem* item);
+
+protected:
+	std::set<LLUUID> mSeen;
+};
+
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// Class LLParticularBuddyCollector
+//
+// Simple class that collects calling cards that match a particular uuid
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+class LLParticularBuddyCollector : public LLInventoryCollectFunctor
+{
+public:
+	LLParticularBuddyCollector(const LLUUID& id) : mBuddyID(id) {}
+	virtual ~LLParticularBuddyCollector() {}
+	virtual bool operator()(LLInventoryCategory* cat,
+							LLInventoryItem* item);
+protected:
+	LLUUID mBuddyID;
+};
+
+
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// Class LLNameCategoryCollector
+//
+// Collects categories based on case-insensitive match of prefix
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+class LLNameCategoryCollector : public LLInventoryCollectFunctor
+{
+public:
+	LLNameCategoryCollector(const std::string& name) : mName(name) {}
+	virtual ~LLNameCategoryCollector() {}
+	virtual bool operator()(LLInventoryCategory* cat,
+							LLInventoryItem* item);
+protected:
+	std::string mName;
+};
+
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// Class LLFindCOFValidItems
+//
+// Collects items that can be legitimately linked to in the COF.
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+class LLFindCOFValidItems : public LLInventoryCollectFunctor
+{
+public:
+	LLFindCOFValidItems() {}
+	virtual ~LLFindCOFValidItems() {}
+	virtual bool operator()(LLInventoryCategory* cat,
+							LLInventoryItem* item);
+	
+};
+
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// Class LLFindWearables
+//
+// Collects wearables based on item type.
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+class LLFindWearables : public LLInventoryCollectFunctor
+{
+public:
+	LLFindWearables() {}
+	virtual ~LLFindWearables() {}
+	virtual bool operator()(LLInventoryCategory* cat,
+							LLInventoryItem* item);
+};
+
+/**                    Inventory Collector Functions
+ **                                                                            **
+ *******************************************************************************/
+
 class LLInventoryState
 {
 public:
diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp
index 96b9bbb725cf0b0b77c4114e98fd25487aaa6554..d1cc0ae936d7032bee8168a3a2b0b6ea0e02ff63 100644
--- a/indra/newview/llinventorymodel.cpp
+++ b/indra/newview/llinventorymodel.cpp
@@ -3211,205 +3211,6 @@ void LLInventoryModel::dumpInventory() const
 	llinfos << "\n**********************\nEnd Inventory Dump" << llendl;
 }
 
-///----------------------------------------------------------------------------
-/// LLInventoryCollectFunctor implementations
-///----------------------------------------------------------------------------
-
-// static
-bool LLInventoryCollectFunctor::itemTransferCommonlyAllowed(LLInventoryItem* item)
-{
-	if (!item)
-		return false;
-
-	bool allowed = false;
-
-	switch(item->getType())
-	{
-	case LLAssetType::AT_CALLINGCARD:
-		// not allowed
-		break;
-		
-	case LLAssetType::AT_OBJECT:
-		if (isAgentAvatarValid() && !gAgentAvatarp->isWearingAttachment(item->getUUID()))
-		{
-			allowed = true;
-		}
-		break;
-		
-	case LLAssetType::AT_BODYPART:
-	case LLAssetType::AT_CLOTHING:
-		if(!gAgentWearables.isWearingItem(item->getUUID()))
-		{
-			allowed = true;
-		}
-		break;
-		
-	default:
-		allowed = true;
-		break;
-	}
-
-	return allowed;
-}
-
-bool LLIsType::operator()(LLInventoryCategory* cat, LLInventoryItem* item)
-{
-	if(mType == LLAssetType::AT_CATEGORY)
-	{
-		if(cat) return TRUE;
-	}
-	if(item)
-	{
-		if(item->getType() == mType) return TRUE;
-	}
-	return FALSE;
-}
-
-bool LLIsNotType::operator()(LLInventoryCategory* cat, LLInventoryItem* item)
-{
-	if(mType == LLAssetType::AT_CATEGORY)
-	{
-		if(cat) return FALSE;
-	}
-	if(item)
-	{
-		if(item->getType() == mType) return FALSE;
-		else return TRUE;
-	}
-	return TRUE;
-}
-
-bool LLIsTypeWithPermissions::operator()(LLInventoryCategory* cat, LLInventoryItem* item)
-{
-	if(mType == LLAssetType::AT_CATEGORY)
-	{
-		if(cat) 
-		{
-			return TRUE;
-		}
-	}
-	if(item)
-	{
-		if(item->getType() == mType)
-		{
-			LLPermissions perm = item->getPermissions();
-			if ((perm.getMaskBase() & mPerm) == mPerm)
-			{
-				return TRUE;
-			}
-		}
-	}
-	return FALSE;
-}
-
-
-//bool LLIsClone::operator()(LLInventoryCategory* cat, LLInventoryItem* item)
-//{
-//	if(cat) return FALSE;
-//	if(item)
-//	{
-//		if(mItemMap->getType() == LLAssetType::AT_CALLINGCARD)
-//		{
-//			if((item->getType() == LLAssetType::AT_CALLINGCARD)
-//			   && !(item->getCreatorUUID().isNull())
-//			   && (item->getCreatorUUID() == mItemMap->getCreatorUUID()))
-//			{
-//				return TRUE;
-//			}
-//		}
-//		else
-//		{
-//			if((item->getType() == mItemMap->getType())
-//			   && !(item->getAssetUUID().isNull())
-//			   && (item->getAssetUUID() == mItemMap->getAssetUUID())
-//			   && (item->getName() == mItemMap->getName()))
-//			{
-//				return TRUE;
-//			}
-//		}
-//	}
-//	return FALSE;
-//}
-
-bool LLBuddyCollector::operator()(LLInventoryCategory* cat,
-								  LLInventoryItem* item)
-{
-	if(item)
-	{
-		if((LLAssetType::AT_CALLINGCARD == item->getType())
-		   && (!item->getCreatorUUID().isNull())
-		   && (item->getCreatorUUID() != gAgent.getID()))
-		{
-			return true;
-		}
-	}
-	return false;
-}
-
-
-bool LLUniqueBuddyCollector::operator()(LLInventoryCategory* cat,
-										LLInventoryItem* item)
-{
-	if(item)
-	{
-		if((LLAssetType::AT_CALLINGCARD == item->getType())
- 		   && (item->getCreatorUUID().notNull())
- 		   && (item->getCreatorUUID() != gAgent.getID()))
-		{
-			mSeen.insert(item->getCreatorUUID());
-			return true;
-		}
-	}
-	return false;
-}
-
-
-bool LLParticularBuddyCollector::operator()(LLInventoryCategory* cat,
-											LLInventoryItem* item)
-{
-	if(item)
-	{
-		if((LLAssetType::AT_CALLINGCARD == item->getType())
-		   && (item->getCreatorUUID() == mBuddyID))
-		{
-			return TRUE;
-		}
-	}
-	return FALSE;
-}
-
-
-bool LLNameCategoryCollector::operator()(
-	LLInventoryCategory* cat, LLInventoryItem* item)
-{
-	if(cat)
-	{
-		if (!LLStringUtil::compareInsensitive(mName, cat->getName()))
-		{
-			return true;
-		}
-	}
-	return false;
-}
-
-///----------------------------------------------------------------------------
-/// LLAssetIDMatches 
-///----------------------------------------------------------------------------
-bool LLAssetIDMatches::operator()(LLInventoryCategory* cat, LLInventoryItem* item)
-{
-	return (item && item->getAssetUUID() == mAssetID);
-}
-
-///----------------------------------------------------------------------------
-/// LLLinkedItemIDMatches 
-///----------------------------------------------------------------------------
-bool LLLinkedItemIDMatches::operator()(LLInventoryCategory* cat, LLInventoryItem* item)
-{
-	return (item && 
-			(item->getIsLinkType()) &&
-			(item->getLinkedUUID() == mBaseItemID)); // A linked item's assetID will be the compared-to item's itemID.
-}
-
 ///----------------------------------------------------------------------------
 /// Local function definitions
 ///----------------------------------------------------------------------------
diff --git a/indra/newview/llinventorymodel.h b/indra/newview/llinventorymodel.h
index 700e5317f77d9a00e693701a967bdcbc6d057da2..b7c1b573970269a4a073d1264dd37caf44a97fa2 100644
--- a/indra/newview/llinventorymodel.h
+++ b/indra/newview/llinventorymodel.h
@@ -534,234 +534,5 @@ class LLInventoryModel
 // a special inventory model for the agent
 extern LLInventoryModel gInventory;
 
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-// Class LLInventoryCollectFunctor
-//
-// Base class for LLInventoryModel::collectDescendentsIf() method
-// which accepts an instance of one of these objects to use as the
-// function to determine if it should be added. Derive from this class
-// and override the () operator to return TRUE if you want to collect
-// the category or item passed in.
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-class LLInventoryCollectFunctor
-{
-public:
-	virtual ~LLInventoryCollectFunctor(){};
-	virtual bool operator()(LLInventoryCategory* cat, LLInventoryItem* item) = 0;
-
-	static bool itemTransferCommonlyAllowed(LLInventoryItem* item);
-};
-
-
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-// Class LLAssetIDMatches
-//
-// This functor finds inventory items pointing to the specified asset
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-class LLViewerInventoryItem;
-
-class LLAssetIDMatches : public LLInventoryCollectFunctor
-{
-public:
-	LLAssetIDMatches(const LLUUID& asset_id) : mAssetID(asset_id) {}
-	virtual ~LLAssetIDMatches() {}
-	bool operator()(LLInventoryCategory* cat, LLInventoryItem* item);
-	
-protected:
-	LLUUID mAssetID;
-};
-
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-// Class LLLinkedItemIDMatches
-//
-// This functor finds inventory items linked to the specific inventory id.
-// Assumes the inventory id is itself not a linked item.
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-class LLLinkedItemIDMatches : public LLInventoryCollectFunctor
-{
-public:
-	LLLinkedItemIDMatches(const LLUUID& item_id) : mBaseItemID(item_id) {}
-	virtual ~LLLinkedItemIDMatches() {}
-	bool operator()(LLInventoryCategory* cat, LLInventoryItem* item);
-	
-protected:
-	LLUUID mBaseItemID;
-};
-
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-// Class LLIsType
-//
-// Implementation of a LLInventoryCollectFunctor which returns TRUE if
-// the type is the type passed in during construction.
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-class LLIsType : public LLInventoryCollectFunctor
-{
-public:
-	LLIsType(LLAssetType::EType type) : mType(type) {}
-	virtual ~LLIsType() {}
-	virtual bool operator()(LLInventoryCategory* cat,
-							LLInventoryItem* item);
-protected:
-	LLAssetType::EType mType;
-};
-
-
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-// Class LLIsNotType
-//
-// Implementation of a LLInventoryCollectFunctor which returns FALSE if the
-// type is the type passed in during construction, otherwise false.
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-class LLIsNotType : public LLInventoryCollectFunctor
-{
-public:
-	LLIsNotType(LLAssetType::EType type) : mType(type) {}
-	virtual ~LLIsNotType() {}
-	virtual bool operator()(LLInventoryCategory* cat,
-							LLInventoryItem* item);
-protected:
-	LLAssetType::EType mType;
-};
-
-class LLIsTypeWithPermissions : public LLInventoryCollectFunctor
-{
-public:
-	LLIsTypeWithPermissions(LLAssetType::EType type, const PermissionBit perms, const LLUUID &agent_id, const LLUUID &group_id) 
-		: mType(type), mPerm(perms), mAgentID(agent_id), mGroupID(group_id) {}
-	virtual ~LLIsTypeWithPermissions() {}
-	virtual bool operator()(LLInventoryCategory* cat,
-							LLInventoryItem* item);
-protected:
-	LLAssetType::EType mType;
-	PermissionBit mPerm;
-	LLUUID			mAgentID;
-	LLUUID			mGroupID;
-};
-
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-// Class LLIsClone
-//
-// Implementation of a LLInventoryCollectFunctor which returns TRUE if
-// the object is a clone of the item passed in during
-// construction.
-//
-// *NOTE: Since clone information is determined based off of asset id
-// (or creator with calling cards), if the id is NULL, it has no
-// clones - even itself.
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-//class LLIsClone : public LLInventoryCollectFunctor
-//{
-//public:
-//	LLIsClone(LLViewerInventoryItem* item) : mItem(item) {}
-//	virtual ~LLIsClone() {}
-//	virtual bool operator()(LLViewerInventoryCategory* cat,
-//							LLViewerInventoryItem* item);
-//protected:
-//	LLPointer<LLViewerInventoryItem> mItem;
-//};
-
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-// Class LLBuddyCollector
-//
-// Simple class that collects calling cards that are not null, and not
-// the agent. Duplicates are possible.
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-class LLBuddyCollector : public LLInventoryCollectFunctor
-{
-public:
-	LLBuddyCollector() {}
-	virtual ~LLBuddyCollector() {}
-	virtual bool operator()(LLInventoryCategory* cat,
-							LLInventoryItem* item);
-};
-
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-// Class LLUniqueBuddyCollector
-//
-// Simple class that collects calling cards that are not null, and not
-// the agent. Duplicates are discarded.
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-class LLUniqueBuddyCollector : public LLInventoryCollectFunctor
-{
-public:
-	LLUniqueBuddyCollector() {}
-	virtual ~LLUniqueBuddyCollector() {}
-	virtual bool operator()(LLInventoryCategory* cat,
-							LLInventoryItem* item);
-
-protected:
-	std::set<LLUUID> mSeen;
-};
-
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-// Class LLParticularBuddyCollector
-//
-// Simple class that collects calling cards that match a particular uuid
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-class LLParticularBuddyCollector : public LLInventoryCollectFunctor
-{
-public:
-	LLParticularBuddyCollector(const LLUUID& id) : mBuddyID(id) {}
-	virtual ~LLParticularBuddyCollector() {}
-	virtual bool operator()(LLInventoryCategory* cat,
-							LLInventoryItem* item);
-protected:
-	LLUUID mBuddyID;
-};
-
-
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-// Class LLNameCategoryCollector
-//
-// Collects categories based on case-insensitive match of prefix
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-class LLNameCategoryCollector : public LLInventoryCollectFunctor
-{
-public:
-	LLNameCategoryCollector(const std::string& name) : mName(name) {}
-	virtual ~LLNameCategoryCollector() {}
-	virtual bool operator()(LLInventoryCategory* cat,
-							LLInventoryItem* item);
-protected:
-	std::string mName;
-};
-
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-// Class LLFindCOFValidItems
-//
-// Collects items that can be legitimately linked to in the COF.
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-class LLFindCOFValidItems : public LLInventoryCollectFunctor
-{
-public:
-	LLFindCOFValidItems() {}
-	virtual ~LLFindCOFValidItems() {}
-	virtual bool operator()(LLInventoryCategory* cat,
-							LLInventoryItem* item);
-	
-};
-
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-// Class LLFindWearables
-//
-// Collects wearables based on item type.
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-class LLFindWearables : public LLInventoryCollectFunctor
-{
-public:
-	LLFindWearables() {}
-	virtual ~LLFindWearables() {}
-	virtual bool operator()(LLInventoryCategory* cat,
-							LLInventoryItem* item);
-};
-
 #endif // LL_LLINVENTORYMODEL_H
 
diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp
index f38659ba5f4c00f73bc5943a6df2dc69958a0325..83c2d62ee8b9a10302f835d351efa73a4c62528f 100644
--- a/indra/newview/llinventorypanel.cpp
+++ b/indra/newview/llinventorypanel.cpp
@@ -43,6 +43,7 @@
 #include "llimfloater.h"
 #include "llimview.h"
 #include "llinventorybridge.h"
+#include "llinventoryfunctions.h"
 #include "llinventorymodelbackgroundfetch.h"
 #include "llsidepanelinventory.h"
 #include "llsidetray.h"
diff --git a/indra/newview/lllandmarkactions.cpp b/indra/newview/lllandmarkactions.cpp
index f25d2ef5743fb8e05b2828318dbc1853ab7789af..7336efb62a25c5e3fbb7f8c38bf3636b2203a529 100644
--- a/indra/newview/lllandmarkactions.cpp
+++ b/indra/newview/lllandmarkactions.cpp
@@ -36,6 +36,7 @@
 #include "roles_constants.h"
 
 #include "llinventory.h"
+#include "llinventoryfunctions.h"
 #include "lllandmark.h"
 #include "llparcel.h"
 #include "llregionhandle.h"
diff --git a/indra/newview/llpanellandmarkinfo.cpp b/indra/newview/llpanellandmarkinfo.cpp
index 143a64d08b1f1b4d678a7c5e0f66f625a02cc17c..3dbe9a7f59b831261d86b9ae68486f32e13942b1 100644
--- a/indra/newview/llpanellandmarkinfo.cpp
+++ b/indra/newview/llpanellandmarkinfo.cpp
@@ -36,6 +36,7 @@
 
 #include "llcombobox.h"
 #include "lliconctrl.h"
+#include "llinventoryfunctions.h"
 #include "lllineeditor.h"
 #include "lltextbox.h"
 #include "lltexteditor.h"
diff --git a/indra/newview/llpreviewgesture.cpp b/indra/newview/llpreviewgesture.cpp
index 77b72dc728eb44f959359557e4ed1da367dd68c4..11cde477445d635ceb923e3f9acf14b7b2766fcf 100644
--- a/indra/newview/llpreviewgesture.cpp
+++ b/indra/newview/llpreviewgesture.cpp
@@ -42,6 +42,7 @@
 #include "llstring.h"
 #include "lldir.h"
 #include "llfloaterreg.h"
+#include "llinventoryfunctions.h"
 #include "llinventorymodelbackgroundfetch.h"
 #include "llmultigesture.h"
 #include "llnotificationsutil.h"
diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp
index 4f5eeb254b53bd27bc4ca2b82f478235c0335721..394f550f2e6b2218ecd469caeada80e10a8c436f 100644
--- a/indra/newview/lltooldraganddrop.cpp
+++ b/indra/newview/lltooldraganddrop.cpp
@@ -50,6 +50,7 @@
 #include "llhudeffecttrail.h"
 #include "llimview.h"
 #include "llinventorybridge.h"
+#include "llinventoryfunctions.h"
 #include "llmutelist.h"
 #include "llpreviewnotecard.h"
 #include "llrecentpeople.h"
diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp
index 58d02be99a52b2b39987a9c857d80b767f48e904..b42d25c1d88638a3e6c635d26a975319bb83eb5e 100644
--- a/indra/newview/llviewerinventory.cpp
+++ b/indra/newview/llviewerinventory.cpp
@@ -44,6 +44,7 @@
 #include "llfolderview.h"
 #include "llviewercontrol.h"
 #include "llconsole.h"
+#include "llinventoryfunctions.h"
 #include "llinventorymodel.h"
 #include "llinventorymodelbackgroundfetch.h"
 #include "llgesturemgr.h"
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index fe924d68a5a3a729044312e79e49e130b8e2bfcb..3a6aed01cefb8fdd82994eadcabaca1b6cf75dbb 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -73,6 +73,7 @@
 #include "llhudmanager.h"
 #include "llimview.h"
 #include "llinventorybridge.h"
+#include "llinventoryfunctions.h"
 #include "llpanellogin.h"
 #include "llpanelblockedlist.h"
 #include "llmenucommands.h"
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index 42c8b4ee64e4c456865d3151c745559ca98999f8..6dc0983f102e9a80d866c9253a75a5584372e4ce 100644
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -63,6 +63,7 @@
 #include "llfloaterpreference.h"
 #include "llhudeffecttrail.h"
 #include "llhudmanager.h"
+#include "llinventoryfunctions.h"
 #include "llinventoryobserver.h"
 #include "llinventorypanel.h"
 #include "llnearbychat.h"
diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp
index 9c2e5461b2e31e2ac86627b21d795b9fc00bcd87..fe6990eae998a371a934879a151cccf7d3adc767 100644
--- a/indra/newview/llvoavatarself.cpp
+++ b/indra/newview/llvoavatarself.cpp
@@ -48,6 +48,7 @@
 #include "llagentwearables.h"
 #include "llhudeffecttrail.h"
 #include "llhudmanager.h"
+#include "llinventoryfunctions.h"
 #include "llselectmgr.h"
 #include "lltoolgrab.h"	// for needsRenderBeam
 #include "lltoolmgr.h" // for needsRenderBeam