diff options
Diffstat (limited to 'connectivity/source/drivers/writer/WConnection.cxx')
-rw-r--r-- | connectivity/source/drivers/writer/WConnection.cxx | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/connectivity/source/drivers/writer/WConnection.cxx b/connectivity/source/drivers/writer/WConnection.cxx index d8fd10302e00..385692951518 100644 --- a/connectivity/source/drivers/writer/WConnection.cxx +++ b/connectivity/source/drivers/writer/WConnection.cxx @@ -97,18 +97,17 @@ uno::Reference<text::XTextDocument> const& OWriterConnection::acquireDoc() return m_xDoc; } // open read-only as long as updating isn't implemented - uno::Sequence<beans::PropertyValue> aArgs(2); - aArgs[0].Name = "Hidden"; - aArgs[0].Value <<= true; - aArgs[1].Name = "ReadOnly"; - aArgs[1].Value <<= true; + uno::Sequence<beans::PropertyValue> aArgs(m_sPassword.isEmpty() ? 2 : 3); + auto pArgs = aArgs.getArray(); + pArgs[0].Name = "Hidden"; + pArgs[0].Value <<= true; + pArgs[1].Name = "ReadOnly"; + pArgs[1].Value <<= true; if (!m_sPassword.isEmpty()) { - const sal_Int32 nPos = aArgs.getLength(); - aArgs.realloc(nPos + 1); - aArgs[nPos].Name = "Password"; - aArgs[nPos].Value <<= m_sPassword; + pArgs[2].Name = "Password"; + pArgs[2].Value <<= m_sPassword; } uno::Reference<frame::XDesktop2> xDesktop |