Personally for me, I find that once i really allow myself to 'indulge' or eat alot of sweets in a short period of time (can be within a day or say, a week) i find it hard to stop and find that i will continue eating sugar the next day, etc. I think simply building a habit of eating less sugar helps for sure, and not buying the sugary junk food. Also, if there is free food at work (i love free food...) and it happens to be sugary and junky which is not uncommon, i would suggest to just think of whether you would still eat it if you had to pay for it. Just because its free, it can work against you as you will be paying for your medical bills later on (think in that kind of a mindset). As often we eat the free food in ADDITION to our own lunch etc. If its something satisfying and not too bad then sure.
in regards to eating alot of carbs in general, i suggest trying to eat mostly veggies (still have carbs but are soo filling and seriously delicious - well to me - if prepared in a way you enjoy), BUT having a small portion of good carbs with your veggies such that when you do consume carbs (and just a little , though the reduced amount may take some time to get used to) its bloodsugar spiking effect may be largely reduced by the fibrous veggies (and fats n proteins). A way to get more veggies is to cook em (personally for me that increases its palatability alot more) as its easier to chew, often sweeter, etc. Though one can argue raw veggies are healthier, this is a place to start, to simply make the bulk of your meals and foods, vegetables. Personally, i find when i cook the veggies, they already seem starchy to me, such that i dont feel the need for large amounts of other carbs like bread, rice, etc. Not to mention you can eat a huge amount of it without the extra calories.
nonetheless, i think finding a way of eating less carbs that works for you (often involves eating mostly veggies if done the 'healthy' way) and that you actually enjoy, and is convenient (because if you home from work hungry you probably wont want to cook any veggies and will likely go for high glycemic carby foods) then building a habit of that so it becomes mindless and routine.