Suppose I invented something and need to patent it. So, I submit all the documents to the patent office. So, the officers who examine my documents containing new invention at the patent office, could rob the idea and sell it a other big company and get the money from them and help them to file a patent while delaying my submission. So, they will tell me that there is a previous submission of the same invention and reject mine. Is this a possibility to happen? what kind of measures have taken or can be taken to eliminate such activities? Is there any law to help the inventor?
You don't say what jurisdiction's patent laws you're interested in, and priority dates can differ in different schemes. I'm answering as to U.S. law only.
In the United States, under the current hybrid "first-inventor-to-file" system, the priority date--the date that determines who "wins" if there are multiple claims to a specific invention--is, with some exceptions that I won't go into, the date of your first application. In other words, the date that the PTO got it in the mail.
Once your application is submitted, it is--again, with some limitations I won't get into--prior art for the purposes of any later-submitted application. They can't get another application later, grant it first, and then deny your application based on the later-submitted application. Your application date would still win out.
Could someone in the USPTO slip your application out of the stack, fudge the dates, and convince some other company to submit a similar application to get priority over you? Not as a practical matter, no. The USPTO isn't one guy in a room; it's a large organization, and the person who opens the mail, types in your application details, and sends you a receipt, isn't the same guy who knows whether your invention is any good or not. And, frankly, very few patentable inventions are going to be worth someone risking their job and/or jail time over--especially when there would be significant evidence of the misconduct--for example, your patent agent's files.
So what are the chances that the examiner on your patent:
1) Is a nefarious character who has lived a life of public service long enough and wants to go rogue;
2) Has a friend in the mailroom who is also an expert in the field of your invention; and
3) Has a conduct in industry who is willing to break the law for the rights to your invention?
Slim to none. And if you have an invention that is really so revolutionary that it's going to be worth so many people risking so much to steal it, odds are there will be other evidence that you were the inventor.