tdf#119491 sc odf export: fix password protection of shared files

Handle SID_ENCRYPTIONDATA for shared password protected docs.

Change-Id: If9554a991a39d6be45ed688a0bd638cd166589c5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137146
Tested-by: Jenkins
Tested-by: Gabor Kelemen <kelemeng@ubuntu.com>
Reviewed-by: Gabor Kelemen <kelemeng@ubuntu.com>
Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index e5ab8ce..74b1744 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -910,6 +910,14 @@ void ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
                                                pValues[1].Name = "Password";
                                                pValues[1].Value <<= pPasswordItem->GetValue();
                                            }
                                            const SfxUnoAnyItem* pEncryptionItem = SfxItemSet::GetItem<SfxUnoAnyItem>(GetMedium()->GetItemSet(), SID_ENCRYPTIONDATA, false);
                                            if (pEncryptionItem)
                                            {
                                                aValues.realloc(aValues.getLength() + 1);
                                                auto pValues = aValues.getArray();
                                                pValues[aValues.getLength() - 1].Name = "EncryptionData";
                                                pValues[aValues.getLength() - 1].Value = pEncryptionItem->GetValue();
                                            }

                                            SC_MOD()->SetInSharedDocSaving( true );
                                            xStor->storeToURL( GetSharedFileURL(), aValues );