diff options
author | Justin Luth <justin.luth@collabora.com> | 2022-11-23 08:15:15 -0500 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2022-11-28 09:33:17 +0100 |
commit | c74ff490903ee04725e9dfee6fdc3598a3a61190 (patch) | |
tree | 93c3668dc470b03dbfe457e665864a0a8c51bcbd /sw/source/ui/vba | |
parent | a57b12fdf3787def3a3cd5658118420959b4ad7f (diff) |
tdf#151548 ContentControls: Add Invalidate()
Up until now, all changes made to a content control
have been triggered by the UI.
However, VBA makes changes by code,
and those property changes were just being ignored
until the control received the focus.
Change-Id: Ife865dd493f7eae4d4e95096071f05b8c27d51db
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143194
Reviewed-by: Justin Luth <jluth@mail.com>
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sw/source/ui/vba')
-rw-r--r-- | sw/source/ui/vba/vbacontentcontrol.cxx | 20 | ||||
-rw-r--r-- | sw/source/ui/vba/vbacontentcontrollistentry.cxx | 4 |
2 files changed, 10 insertions, 14 deletions
diff --git a/sw/source/ui/vba/vbacontentcontrol.cxx b/sw/source/ui/vba/vbacontentcontrol.cxx index 62ee4a4f7be6..66d104c567e6 100644 --- a/sw/source/ui/vba/vbacontentcontrol.cxx +++ b/sw/source/ui/vba/vbacontentcontrol.cxx @@ -99,7 +99,7 @@ void SwVbaContentControl::setChecked(sal_Bool bSet) if (pCC->GetCheckbox() && pCC->GetChecked() != static_cast<bool>(bSet)) { pCC->SetChecked(bSet); - //pCC->Invalidate(); + m_rCC.Invalidate(/*bKeepPlaceholderStatus=*/false); } } @@ -694,8 +694,9 @@ void SwVbaContentControl::SetCheckedSymbol(sal_Int32 Character, const uno::Any& std::shared_ptr<SwContentControl> pCC = m_rCC.GetContentControl().GetContentControl(); pCC->SetCheckedState(OUString(static_cast<sal_Unicode>(Character))); - //if (getChecked()) - // pCC->Invalidate(); + + if (pCC->GetCheckbox() && pCC->GetChecked()) + m_rCC.Invalidate(); } void SwVbaContentControl::SetUnCheckedSymbol(sal_Int32 Character, const uno::Any& Font) @@ -706,8 +707,9 @@ void SwVbaContentControl::SetUnCheckedSymbol(sal_Int32 Character, const uno::Any std::shared_ptr<SwContentControl> pCC = m_rCC.GetContentControl().GetContentControl(); pCC->SetUncheckedState(OUString(static_cast<sal_Unicode>(Character))); - //if (!getChecked()) - // pCC->Invalidate(); + + if (pCC->GetCheckbox() && !pCC->GetChecked()) + m_rCC.Invalidate(); } void SwVbaContentControl::SetPlaceholderText(const uno::Any& BuildingBlock, const uno::Any& Range, @@ -732,13 +734,7 @@ void SwVbaContentControl::SetPlaceholderText(const uno::Any& BuildingBlock, cons // Remove placeholder text. pCC->SetPlaceholderDocPart(""); } - //if (getShowingPlaceholderText()) - //{ - // if (!pCC->GetCheckbox()) - // pCC->Invalidate(); - // // Ensure that invalidation doesn't turn off showing placeholder as true - // pCC->SetShowingPlaceHolder(true); - //} + m_rCC.Invalidate(/*bKeepPlaceholderStatus=true*/); } void SwVbaContentControl::Ungroup() { SAL_INFO("sw.vba", "SwVbaContentControl::UnGroup stub"); } diff --git a/sw/source/ui/vba/vbacontentcontrollistentry.cxx b/sw/source/ui/vba/vbacontentcontrollistentry.cxx index 44bfd161bcdf..20bcff0bdcb3 100644 --- a/sw/source/ui/vba/vbacontentcontrollistentry.cxx +++ b/sw/source/ui/vba/vbacontentcontrollistentry.cxx @@ -64,7 +64,7 @@ void SwVbaContentControlListEntry::setText(const OUString& rSet) } vListItems[m_nZIndex].m_aDisplayText = rSet; pCC->SetListItems(vListItems); - //pCC->Invalidate(); + m_rCC.Invalidate(); } OUString SwVbaContentControlListEntry::getValue() @@ -138,7 +138,7 @@ void SwVbaContentControlListEntry::Select() std::shared_ptr<SwContentControl> pCC = m_rCC.GetContentControl().GetContentControl(); assert(m_nZIndex < pCC->GetListItems().size()); pCC->SetSelectedListItem(m_nZIndex); - //pCC->Invalidate(); + m_rCC.Invalidate(/*bKeepPlaceholderStatus=*/false); } // XHelperInterface |