Office Depot agrees to buy OfficeMax in stock deal