problems on the transferring from the arduino-uno to arduino-leonardo

Hi,
I am a CS student, pretty new to this. So some explain would help a lot.

I use a bluetooth shield to remote control the arduino-uno as a USB keyboard connected to the computer. The Arduino code deals with the bluetooth setting, fetching and sending data to the USB chip(mega16u2). On the other hand, compile the hex file with the help of LUFA library and upload it as the firmware on the mega16u2 to let it behave like a keyboard.
Now we have Leonardo which only has one chip - atmega32u4.
I was wondering how everything works within one microcontroller. Do we still need to upload the arduino code and hex file separately or we need a different method to achieve my previous goal?

Thanks a lot!