There are two main different types of to in English. One of these is the to we find in to-infinitive constructions (e.g. To err is human), the other is the directional preposition (e.g. I drove to the farm).
The English verb use(d) takes a to-infinitive as a Complement. The English adjective used takes a to preposition phrase as a Complement. If we want to use a verb after a preposition such as to, we need an -ing form of the verb.
The Original Poster's example uses the adjective used and therefore we need a to preposition phrase using an -ing form of the verb. The adjective used cannot take a to-infinitive as a Complement.
The full story
The verb use(d):
There is a defective English verb use(d) which describes a situation or habit in the past:
- I used to be a lawyer.
This verb has no present or past participles, and also no present tense form. This verb is completely different from the verb use meaning to exploit something. The former is pronounced /ju:s(t)/ and has an unvoiced sibilant, the latter is pronounced/ju:z/ and uses a voiced sibilant.
As can be seen from (1), the verb use(d) takes to-infinitives as Complements. It cannot take an -ing form of the verb:
- *I used to being a lawyer. ( * = ungrammatical)
The adjective used:
There is an English adjective used, which means accustomed. Like the adjective accustomed, the adjective used takes a preposition phrase as a Complement. It cannot take a verb as a Complement:
- *I am used [eat cheese].
- *I became used [eating cheese].
- *I felt used [to eat cheese].
- *He looked used [eat cheese].
More specifically the adjectives accustomed and used take preposition phrases headed by the preposition to. Note that this is not the infinitival particle that we find in infinitival constructions such as I want to sing. Notice as well that this adjective usually appears as the Complement of a so-called linking verb such as be, seem, feel, look. [In other words it appears as an ascriptive Predicative Complement]
Now those prepositions which take noun phrases as Complements, such as the prepositions to or of or from, can take -ing verb phrases or clauses (also known as gerund-participial clauses) as Complements:
- look forward [to Christmas]
- look forward [to celebrating]
- tired [of lessons]
- tired [of studying]
- shrank [from his work]
- shrank [from carrying out his duties]
Notice that these -ing clauses are not Complements of look, tired, or shrank, rather they are Complements of the prepositions to, of and from respectively. If we take a look at the adjectives used and accustomed, we will see that they work in exactly the same way:
- used [to French food]
- used [to eating French food]
- accustomed [to French food]
- accustomed [to eating French food]
The Original Poster's question:
- She hadn't been used [to [being treated like that]].
Because this sentence is quite complicated, it might be difficult to tell whether the item used here, is the verb or the adjective. A good test is to see whether we can substitute in the adjective accustomed accustomed instead. If so, this used is the adjective, if not then it is the verb:
- She hadn't been accustomed [to [being treated like that].
Although somewhat clunky, this is perfectly grammatical, and the meaning of the sentence is basically the same. This means that we are talking about the adjective used. As we have seen above this adjective takes preposition phrases with the preposition to. and as we have also seen, if we want to use a verb after a preposition like to, we need to use an ing form of the verb. We cannot use a plane form of the verb or a to-infinitive:
- *I wasn't used [to [eat cheese]].
- *I wasn't used [to [to eat cheese]].
For that reason, the following is also ungrammatical:
- *She hadn't been accustomed [to [be treated like that]].