Magnetic activity in the HARPS M-dwarf sample. The rotation-activity relationship for very low-mass stars through R'HK