Collective excitations of trapped one-dimensional dipolar quantum gases