correct loops in UpdateNoteCaptions for notes

Change-Id: Icec072eea61a194d72ce00c58dfbd85b1ec85abb
Reviewed-on: https://gerrit.libreoffice.org/7390
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
(cherry picked from commit 20ecc5b59d757307fbc9c3222af2a34ab8fb5bde)
Reviewed-on: https://gerrit.libreoffice.org/7391
(cherry picked from commit 81c4f9c4f957a08eeaed3967260e3d700320f5de)
Reviewed-on: https://gerrit.libreoffice.org/7392
Reviewed-by: Kohei Yoshida <libreoffice@kohei.us>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>