You can delete all textboxes and images by copying the entire document and pasting its content back into itself as unformatted text. This will also remove all other formatting, giving you a plain text document to work with.
Empty paragraphs can be deleted by a single Find/Replace, without a time-consuming loop through all paragraphs.
For some code to convert manually-numbered heading to proper Word headings and to apply Word's auto-numbering to those headings, see:
Convert Manual Numbering 1.0, 1.1, 1.1.1, 1.1.2 to automatic numbering - Microsoft Community