From The Document Foundation Wiki
- in the list of the applied styles in Styles and Formatting sidebar, right-click on Heading 2;
- click on the Organizer tab;
- under the Style section, click on the Next style dropdown menu and choose After Heading 2;
- click OK; and
- repeat it for the Heading 3 style (but choose After Heading 3 this time).