diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2021-04-21 10:51:05 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2021-04-21 12:00:47 +0200 |
commit | adea8835d417379447cb8de6f30e959808b8db91 (patch) | |
tree | fcfde0883dc0ae5c4c02d791668b22b73e3c9134 /sw/source/uibase | |
parent | b82f39f29a9ceeacb06ae9d1571665327d3e3019 (diff) |
sw bibliography, refer to a page: edit the page number of individual entries
Usually it's handy that editing a bibliography entry field updates all
other fields referring to the same source. But avoid doing this in case
only the page number changes, that's typically specific to that field.
Change-Id: I2b2608c6c4fdb859c430294eaecdadfeb1c802a2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114380
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'sw/source/uibase')
-rw-r--r-- | sw/source/uibase/fldui/fldmgr.cxx | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/sw/source/uibase/fldui/fldmgr.cxx b/sw/source/uibase/fldui/fldmgr.cxx index 6609c454038a..90b12e34c32d 100644 --- a/sw/source/uibase/fldui/fldmgr.cxx +++ b/sw/source/uibase/fldui/fldmgr.cxx @@ -67,6 +67,7 @@ #include <strings.hrc> #include <tox.hxx> #include <viewopt.hxx> +#include <txmsrt.hxx> #include <unotools/useroptions.hxx> using namespace com::sun::star::uno; @@ -1644,6 +1645,38 @@ void SwFieldMgr::UpdateCurField(sal_uInt32 nFormat, for( sal_Int32 i = 0, nIdx = 0; i < AUTH_FIELD_END; ++i ) xTempEntry->SetAuthorField( static_cast<ToxAuthorityField>(i), rPar1.getToken( 0, TOX_STYLE_DELIMITER, nIdx )); + + // If just the page number of the URL changed, then update the current field and not + // others. + bool bEquivalent = true; + for (int i = 0; i < AUTH_FIELD_END; ++i) + { + auto eField = static_cast<ToxAuthorityField>(i); + if (eField == AUTH_FIELD_URL) + { + if (SwTOXAuthority::GetSourceURL(xTempEntry->GetAuthorField(AUTH_FIELD_URL)) + != SwTOXAuthority::GetSourceURL( + pAuthorityField->GetFieldText(AUTH_FIELD_URL))) + { + bEquivalent = false; + break; + } + } + else + { + if (xTempEntry->GetAuthorField(eField) != pAuthorityField->GetFieldText(eField)) + { + bEquivalent = false; + break; + } + } + } + + if (bEquivalent) + { + break; + } + if( pAuthorityType->ChangeEntryContent( xTempEntry.get() ) ) { pType->UpdateFields(); |