Controllable electrical, magnetoelectric and optical properties of BiFeO3 via domain engineering