As early as 1878, Pope Leo XIII's encyclical Quod Apostolici Muneris strongly denounced Socialism--however Christian--on the grounds that it opposed the natural institutions of authority and property, preferring to substitute forcible governmental distribution of goods for charity.
Quod Apostolici Muneris: Encyclical of Pope Leo XIII on Socialism.
Such legislation is merely the natural outgrowth of the socialist mindset, which Pope Leo XIII warned against in
Quod Apostolici Muneris, his encyclical of 1878.
Leo XIII, who succeeded Pius in 1878, shared his predecessor's evaluation of the contemporary world, as is clear from his second encyclical,
Quod Apostolici Muneris (1878): "The revered majesty and power of kings have won such fierce hatred from these seditious people that disloyal traitors ...