summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/qa/extras/uiwriter/data3/tdf132637_protectTrackChanges.docbin0 -> 26624 bytes
-rw-r--r--sw/qa/extras/uiwriter/uiwriter3.cxx12
-rw-r--r--sw/source/filter/ww8/ww8par.cxx7
3 files changed, 17 insertions, 2 deletions
diff --git a/sw/qa/extras/uiwriter/data3/tdf132637_protectTrackChanges.doc b/sw/qa/extras/uiwriter/data3/tdf132637_protectTrackChanges.doc
new file mode 100644
index 000000000000..2f75e60278e1
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data3/tdf132637_protectTrackChanges.doc
Binary files differ
diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx
index 7818a1f9cb0e..c60d5f9db739 100644
--- a/sw/qa/extras/uiwriter/uiwriter3.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter3.cxx
@@ -14,6 +14,8 @@
#include <comphelper/propertysequence.hxx>
#include <boost/property_tree/json_parser.hpp>
+#include <wrtsh.hxx>
+
namespace
{
char const DATA_DIRECTORY[] = "/sw/qa/extras/uiwriter/data3/";
@@ -689,4 +691,14 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf117601)
CPPUNIT_ASSERT(xCellB1->getString().endsWith("test1"));
}
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf132637_protectTrackChanges)
+{
+ load(DATA_DIRECTORY, "tdf132637_protectTrackChanges.doc");
+ SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
+ CPPUNIT_ASSERT(pTextDoc);
+
+ // The password should only prevent turning off track changes, not open as read-only
+ CPPUNIT_ASSERT(!pTextDoc->GetDocShell()->IsReadOnly());
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index cad890294a36..514a5ec9e3d1 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -1936,8 +1936,11 @@ void SwWW8ImplReader::ImportDop()
}
}
- // Still allow editing of form fields.
- if (!m_xWDop->fProtEnabled)
+ // The password can force read-only, comments-only, fill-in-form-only, or require track-changes.
+ // Treat comments-only like read-only since Writer has no support for that.
+ // Still allow editing of form fields, without requiring the password.
+ // Still allow editing if track-changes is locked on. (Currently LockRev is ignored/lost on export anyway.)
+ if (!m_xWDop->fProtEnabled && !m_xWDop->fLockRev)
m_pDocShell->SetModifyPasswordHash(m_xWDop->lKeyProtDoc);
else if ( xDocProps.is() )
{