you would put a splitter (3.5mm stereo male to 2x 3.5mm stereo female) on each of the three speaker jacks on the subwoofer. the three cables from pc would connect on one side of the splitters while the three cables from the box would connect on the other side. ie, the LF/RF cable from the pc would go on one side of the Y splitter, the LF/RF cable from the box would go on the other side and the single plugged side would go into the green LF/RF connector input on the subwoofer.
of course you also have the option of just switching out the cables on the subwoofer each and every time however i dont think you want to do that.
the first device i listed has a single hdmi input which should work for the XBO however likely is not going to work for the television (sorry i missed the fact that the second device was a tv when i first read through). it will work with another hdmi device though if you use a hdmi splitter on the input (if you had an external tv tuner... explained below). or, you might be able to find one with 2x hdmi inputs... i only gave a quick look to let you know what to look for..
the second device i listed has 2x optical connections which should work for both the XBO and the tv if the tv uses optical output.
if your tv has no audio outputs at all.... then the only way to get sound out of it would be if it supported ARC and if you were using an audio extractor which supports ARC (audio return channel). however, that narrows down your choices even more (as well as increases budget) and you might not be able to find one easily which can do both 5.1 and arc. you might have to get one which splits the signal off into optical and has ARC and connect that to another box which takes optical inputs and turns them analog.
alternatively... if the only reason why you need sound to be output is because you use the tuner inside for cable tv then its possible to buy external tuner boxes which would offer more connectivity.
the devices i listed were just what i could google fastest and easiest. you might be able to find cheaper or better if you expand your search from there now that you know what you are looking for.