CherryTree is a note taking application with all the desired features. It can also be used to write a book. In fact, it is perhaps one of the best programs to write a book whether you are a professional writer or an amateur. You can clearly divide all the parts of a book into chapters, sections and special pages. All these parts are accessible from a treeview control from the left side and can be assigned names and tags using which you can search for them.
You cannot compare it with the editors like Microsoft Word or LibreOffice Writer, but it does offer all the text formatting features. It also supports adding page numbering, tables, bullet-lists, media files, images, hyperlinks etc. You can use the same hotkeys for text formatting, for example, the hotkey Ctrl+B makes the text have strong emphasis.
When writing, you have to add nodes in the treeview control. These nodes can be used for separating different types of notes or can be assigned to various sections or sub-sections of a book. Each node has a name, color, icon and tags. You can also choose whether the node will be plain-text or will use rich text formatting. You can also create sub-nodes under every node.
All of the data that you typed into CherryTree can be saved into a password protected database. Actually it can save your notes into either SQLite or XML databases giving you option to either leave it unprotected or password protect it.
You can import the text from the files saved by other applications. It supports importing from a large number of note taking software including KeepNote, KeyNote, Gnote, Mempad, Knowit etc. You can also export the saved data into PDF, HTML or Text files.
If you want to write without getting distracted by any other app on your PC, then you can switch CherryTree to the fullscreen mode. You can select the fullscreen mode from the menubar or by using the hotkey F11. In the fullscreen mode only the editor and the toolbar is visible so that you can focus on your writing work.
You can download CherryTree from https://www.giuspen.com/cherrytree/.