diff options
author | Heiko Tietze <tietze.heiko@gmail.com> | 2024-09-18 14:06:55 +0200 |
---|---|---|
committer | Heiko Tietze <heiko.tietze@documentfoundation.org> | 2024-09-24 07:25:44 +0200 |
commit | 91c11939b477a0542edb05c45cd735752accbb40 (patch) | |
tree | c816e3ec3bd22e304e7e5a543c8b886a334a7260 /sw/source/ui | |
parent | 74e3f47723471f3ed4dc2dbffc95085bb04d9504 (diff) |
Resolves tdf#137298 - Show document info for respective fields
Change-Id: I3e410fe88a6402684153d1e1d1d074c2fe65dee9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173613
Tested-by: Jenkins
Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
Diffstat (limited to 'sw/source/ui')
-rw-r--r-- | sw/source/ui/fldui/fldedt.cxx | 67 |
1 files changed, 34 insertions, 33 deletions
diff --git a/sw/source/ui/fldui/fldedt.cxx b/sw/source/ui/fldui/fldedt.cxx index c51960e23bec..7de2e44135e7 100644 --- a/sw/source/ui/fldui/fldedt.cxx +++ b/sw/source/ui/fldui/fldedt.cxx @@ -37,6 +37,7 @@ #include <cmdid.h> #include <swabstdlg.hxx> +#include <comphelper/dispatchcommand.hxx> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/document/XDocumentProperties.hpp> @@ -157,11 +158,6 @@ void SwFieldEditDlg::Init() rMgr.GoNext(); m_xPrevBT->set_sensitive( bMove ); - if (pCurField->GetTypeId() == SwFieldTypesEnum::ExtendedUser) - m_xAddressBT->set_sensitive(true); - else - m_xAddressBT->set_sensitive(false); - m_pSh->DestroyCursor(); m_pSh->EndAction(); } @@ -297,38 +293,43 @@ IMPL_LINK_NOARG(SwFieldEditDlg, AddressHdl, weld::Button&, void) SwFieldMgr& rMgr = pTabPage->GetFieldMgr(); SwField *pCurField = rMgr.GetCurField(); - SfxItemSetFixed<SID_FIELD_GRABFOCUS, SID_FIELD_GRABFOCUS> aSet( m_pSh->GetAttrPool() ); + if (pCurField->GetTypeId() == SwFieldTypesEnum::DocumentInfo) + comphelper::dispatchCommand(u".uno:SetDocumentProperties"_ustr, {}); + else + { + SfxItemSetFixed<SID_FIELD_GRABFOCUS, SID_FIELD_GRABFOCUS> aSet( m_pSh->GetAttrPool() ); - EditPosition nEditPos = EditPosition::UNKNOWN; + EditPosition nEditPos = EditPosition::UNKNOWN; - switch(pCurField->GetSubType()) - { - case EU_FIRSTNAME: nEditPos = EditPosition::FIRSTNAME; break; - case EU_NAME: nEditPos = EditPosition::LASTNAME; break; - case EU_SHORTCUT: nEditPos = EditPosition::SHORTNAME; break; - case EU_COMPANY: nEditPos = EditPosition::COMPANY; break; - case EU_STREET: nEditPos = EditPosition::STREET; break; - case EU_TITLE: nEditPos = EditPosition::TITLE; break; - case EU_POSITION: nEditPos = EditPosition::POSITION; break; - case EU_PHONE_PRIVATE:nEditPos = EditPosition::TELPRIV; break; - case EU_PHONE_COMPANY:nEditPos = EditPosition::TELCOMPANY; break; - case EU_FAX: nEditPos = EditPosition::FAX; break; - case EU_EMAIL: nEditPos = EditPosition::EMAIL; break; - case EU_COUNTRY: nEditPos = EditPosition::COUNTRY; break; - case EU_ZIP: nEditPos = EditPosition::PLZ; break; - case EU_CITY: nEditPos = EditPosition::CITY; break; - case EU_STATE: nEditPos = EditPosition::STATE; break; - - default: nEditPos = EditPosition::UNKNOWN; break; + switch(pCurField->GetSubType()) + { + case EU_FIRSTNAME: nEditPos = EditPosition::FIRSTNAME; break; + case EU_NAME: nEditPos = EditPosition::LASTNAME; break; + case EU_SHORTCUT: nEditPos = EditPosition::SHORTNAME; break; + case EU_COMPANY: nEditPos = EditPosition::COMPANY; break; + case EU_STREET: nEditPos = EditPosition::STREET; break; + case EU_TITLE: nEditPos = EditPosition::TITLE; break; + case EU_POSITION: nEditPos = EditPosition::POSITION; break; + case EU_PHONE_PRIVATE:nEditPos = EditPosition::TELPRIV; break; + case EU_PHONE_COMPANY:nEditPos = EditPosition::TELCOMPANY; break; + case EU_FAX: nEditPos = EditPosition::FAX; break; + case EU_EMAIL: nEditPos = EditPosition::EMAIL; break; + case EU_COUNTRY: nEditPos = EditPosition::COUNTRY; break; + case EU_ZIP: nEditPos = EditPosition::PLZ; break; + case EU_CITY: nEditPos = EditPosition::CITY; break; + case EU_STATE: nEditPos = EditPosition::STATE; break; + + default: nEditPos = EditPosition::UNKNOWN; break; - } - aSet.Put(SfxUInt16Item(SID_FIELD_GRABFOCUS, static_cast<sal_uInt16>(nEditPos))); - SwAbstractDialogFactory& rFact = swui::GetFactory(); + } + aSet.Put(SfxUInt16Item(SID_FIELD_GRABFOCUS, static_cast<sal_uInt16>(nEditPos))); - ScopedVclPtr<SfxAbstractDialog> pDlg(rFact.CreateSwAddressAbstractDlg(m_xDialog.get(), aSet)); - if (RET_OK == pDlg->Execute()) - { - m_pSh->UpdateOneField(*pCurField); + SwAbstractDialogFactory& rFact = swui::GetFactory(); + ScopedVclPtr<SfxAbstractDialog> pDlg(rFact.CreateSwAddressAbstractDlg(m_xDialog.get(), aSet)); + if (RET_OK == pDlg->Execute()) + { + m_pSh->UpdateOneField(*pCurField); + } } } |