diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-08-29 17:57:05 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-08-29 19:27:14 +0200 |
commit | e2c240627c8a1a9cea1f9eedfb064214c8e93a39 (patch) | |
tree | 8ed2cea01ecf2a1eee979bb95ebdb3993584a363 /sw | |
parent | fae3b4cc192dbce54f87a6e1c67ab5d824eda947 (diff) |
sw: use SwModule::GetRedlineAuthor() in SwTextShell::ExecField()
This avoids some code duplication, and also means that the redline
author set by SwDocShell::SetView() affects the inserted Writer comments
as well, while those were 'Unknown Author' in the LOK case.
Change-Id: Ib51183302ee6904fdf69fb16f27ecfe6df39e6cb
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter.cxx | 9 | ||||
-rw-r--r-- | sw/source/uibase/shells/textfld.cxx | 7 |
2 files changed, 12 insertions, 4 deletions
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index dd63e8cecad9..5f5e8339495b 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -3888,6 +3888,15 @@ void SwUiWriterTest::testRedlineViewAuthor() SwRangeRedline* pRedline = rTable[0]; // This was 'Unknown Author' instead of 'A U. Thor'. CPPUNIT_ASSERT_EQUAL(aAuthor, pRedline->GetAuthorString()); + + // Insert a comment and assert that SwView::SetRedlineAuthor() affects this as well. + lcl_dispatchCommand(mxComponent, ".uno:.uno:InsertAnnotation", {}); + uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XEnumerationAccess> xFieldsAccess(xTextFieldsSupplier->getTextFields()); + uno::Reference<container::XEnumeration> xFields(xFieldsAccess->createEnumeration()); + uno::Reference<beans::XPropertySet> xField(xFields->nextElement(), uno::UNO_QUERY); + // This was 'Unknown Author' instead of 'A U. Thor'. + CPPUNIT_ASSERT_EQUAL(aAuthor, xField->getPropertyValue("Author").get<OUString>()); } CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest); diff --git a/sw/source/uibase/shells/textfld.cxx b/sw/source/uibase/shells/textfld.cxx index 04f3ea1dcd93..4279963a607c 100644 --- a/sw/source/uibase/shells/textfld.cxx +++ b/sw/source/uibase/shells/textfld.cxx @@ -70,6 +70,7 @@ #include <PostItMgr.hxx> #include <calbck.hxx> #include <memory> +#include <swmodule.hxx> using namespace nsSwDocInfoSubType; @@ -381,10 +382,8 @@ void SwTextShell::ExecField(SfxRequest &rReq) sAuthor = pAuthorItem->GetValue(); else { - SvtUserOptions aUserOpt; - if( (sAuthor = aUserOpt.GetFullName()).isEmpty()) - if( (sAuthor = aUserOpt.GetID()).isEmpty() ) - sAuthor = SW_RES( STR_REDLINE_UNKNOWN_AUTHOR ); + sal_uInt16 nAuthor = SW_MOD()->GetRedlineAuthor(); + sAuthor = SW_MOD()->GetRedlineAuthor(nAuthor); } const SvxPostItTextItem* pTextItem = rReq.GetArg<SvxPostItTextItem>(SID_ATTR_POSTIT_TEXT); |