In the late 1980s, I lived my own #MeToo moment, working in a newsroom where an editor showed up at my apartment uninvited on the pretense of discussing a story assignment — but wanting sex. Although he didn’t force himself when I said no, he routinely greeted me and other female reporters in the newsroom with vulgar comments (usually “Wanna f‑‑‑?”) and interrupted professional conversations to remark on women’s bodies.

I consulted an attorney. Told to confront him, I did so. When he slammed his fist on my desk in response, I told the publisher, who towered over me with arms folded. “Some of the women in this newsroom aren’t as attractive as you,” he said, suggesting that I should take it as a compliment.

But to see this simply as the product of the last few months, or even the last few generations, would be a mistake. My experience, like the revelations about so many powerful men over the past few months who abused and harassed female subordinates, was actually almost 200 years in the making.

The term “sexual harassment” was coined in the 1960s and 1970s as “consciousness raising” groups challenged the gendered paradigms driving society, and women found a way to articulate a problem with workplace aggressors dubbed with names like “the office wolf” or “Felix the Feeler.”

But harassment — and the attitudes that condone it — is actually far older, stemming from changes to the nature of work in the 19th and early 20th centuries and a backlash against women’s struggle for economic independence. These changes gave men the green light to objectify, mistreat and sexualize female colleagues and employees, a consequence we’re still grappling with today.

In the largely agrarian colonial society, economic necessity and the Calvinist notion that idleness was sin meant that all family members labored. Men headed households, but women worked alongside them on farms and small family businesses. They also spun yarn and made clothing, soap and other domestic goods. Some owned businesses.

That changed around the 1830s, when new machinery gave rise to factories and the invention of the railroad meant goods could be shipped. New wage jobs in factories, in stores, on railroads and elsewhere meant “home” and “work” became separate. Men went “to work,” but women, who could hardly be allowed to labor under the supervision of men who were not their husbands or fathers, were supposed to stay home.

As the workplace became the domain of men, a “Cult of True Womanhood,” characterized by piety, purity, domesticity and submission, came to define female roles.

It was a largely white, middle-class ideal, of course. Many women had to work, and factories were eager to hire women — mostly girls, widows and immigrants — as cheap machine operatives. Without the immediate protection of husbands or fathers, wage earning women came to be seen as immoral, fair game for abuse that was often sexualized. As one seamstress put it, “Why is it can a woman not be virtuous if she does mingle with the toilers?”

Women in male-dominated fields were subjected to the worst treatment. Men dominated clerical work as long as it was done with a quill pen — think of Bob Cratchit in Charles Dickens’s novella “A Christmas Carol.” When the federal government began hiring female clerks before the Civil War, men stared, blew smoke in their faces, spat tobacco juice at them and made catcalls. Hostility toward women, whether overtly sexualized or not, was about their supposed invasion of male territory.

For a brief moment, the development of the typewriter brought change. Companies began hiring more women, again because they were cheap machine operators. Reformers urged middle-class women to liberate themselves from dependence on men and Cult of True Womanhood ideals through paid labor, and typing was easy to learn and more genteel than factory work.

Until around the turn of the 20th century, these female “type-writers” were seen as adventurous. Juliet Appleton, the protagonist of an 1897 novel, “The Type-writer Girl,” was a bicycle-riding “New Woman” who pedaled from job to job with her typewriter, spurning her “Romeo” to remain on her own. Some professional opportunities also became available at this time, with more middle-class women earning college degrees and fields such as social work emerging.

Secretarial work provided a degree of liberation at a time when most women could not go to college. Secretaries were in high demand, the skills were easily picked up in high school or special secretarial programs, and the jobs offered a chance for a young woman to live on her own in the city.

Liberating though it could be, there was a darker side to secretarial work for women. Old notions about the domestic sphere being the place for a virtuous woman died hard. The very independence secretarial work brought so many young women also made it suspect.

By the 1920s, secretaries were sexually objectified. Although 1920 saw women win the franchise, it also brought comments like one in a business magazine urging men to consider questions such as “Is she a pleasant-looking girl?” and “Is she morally of the kind you wish to have about?” when hiring.

“Flapper” was a pejorative term for unruly, unsupervised young women, whom one employer termed “a rearing hoard of parasites.” During the 1920s, “working girl” — long a reference to employed women — became a euphemism for prostitutes. Once again, employed women were morally suspect and fair game for abuse. Over time, secretarial work descended into the pink-collar ghetto that restrained the talents of women like Mad Men’s Joan Holloway throughout much of the rest of the 20th century.

Women bristled at this treatment, even before Joan’s time. The author of a 1922 American Magazine article titled “Things I Wish My Employer Would Not Do” wondered why “every man who enters an office and finds a fairly good-looking girl at the desk feels called upon to make some playful remark? Why can’t he just say, ‘Good morning, Miss Perkins,’ and let it go at that? But no, it’s ‘How’s the little girl today?’ or ‘Hello, Bright Eyes!’”

A domestic discourse emerged to describe workplace relationships, with women becoming “office wives” — a precursor to the modern notion of the “work spouse.”

According to the Saturday Evening Post, men chose their “office wives” in much the same fashion and for many of the same reasons as they picked their wives — including looks. In 1935, Fortune laid out some of their expected tasks: “someone to balance his checkbook, buy his railroad tickets, check his baggage, get him seats in the fourth row, take his daughter to the dentist.”

Every office wife, supposedly, wanted to become the boss’s real wife. A series of Royal typewriter ads in the 1930s featured “Debutantes of Modern Business” — young women who would “sooner or later leave the office for new interests in homes of their own.”

As we’ve seen in the past few months, professional women are in no way immune from harassment. College professors and other women in positions of authority even experience contrapower harassment by technical subordinates.

But the patterns established for secretarial work in the first third of the 20th century arguably have affected all women.

New York Times job ads from 1960 expose the premium placed on looks and sexuality — secretarial ads targeted “Gal Fri ‘Vivacious’ $$$” and “Pretty Girl with Sparkle.” But they also reveal that secretarial work influenced the notices for professional jobs, limiting women’s professional options and shaping the way they were seen in the workplace.

Until the Supreme Court struck down the practice in 1973, the ads were sex-segregated. While male jobs were listed alphabetically by specialty (accountant, advertising, engineers, salesmen, etc.), women’s jobs were listed based on whether they required a common clerical skill — “With Steno.”

All other jobs were lumped into two categories: “Without Steno,” which applied to other office jobs ranging from designing advertising brochures to working in airline reservations, and “Miscellaneous.” The latter spanned the gamut from French translation to psychological research to graphic design. These jobs all required education and professional expertise and had nothing to do with each other — except that they were not secretarial.

Although professional women would have sought jobs through other networks, the assumption in the daily paper was that secretarial work was the norm. Anecdotally, this assumption persists today. In 2015, I found myself behind a female attorney in a Nashville courthouse line to get documents. I overheard the counterman skeptically ask the lawyer, “Do you work for an attorney?” clearly assuming she was a secretary. To which she replied, “I am an attorney.”

Sexual harassment persists because it has been treated as acceptable behavior. But seen in the historical context of outdated ideas about women, work and morality, it becomes easier to understand as sexualized aggression.

When industrialization split “home” and “workplace,” women with jobs were seen as immoral, particularly when they “invaded” male professions. When office work became feminized, secretaries were seen through a domestic lens — sexualized, objectified or treated as “wives.” Sex-segregated job ads perpetuated these ideas. Though law, policy and even morals have changed, these ideas remain embedded in present-day behavior.

Like rape, also a crime of power and not passion, sexual harassment has been difficult to articulate. In the first cited use in the Oxford English Dictionary, an unnamed woman quoted in the Yale Daily News in 1971 argued not only that “sex harassment is an integral component of sex discrimination” but that “Men perceive women in sexual categories and not in professional categories.” Certainly, not all men share these perceptions, but understanding their roots is essential for imagining workplace relationships in an equitable, professional way.