16 const uno::Reference<ooo::vba::XHelperInterface>& rParent,
17 const uno::Reference<uno::XComponentContext>& rContext, std::shared_ptr<SwContentControl> pCC,
31 if (nSet < 1 ||
static_cast<size_t>(nSet) ==
m_nZIndex + 1)
46 assert(m_nZIndex < m_pCC->GetListItems().
size());
53 std::vector<SwContentControlListItem> vListItems =
m_pCC->GetListItems();
57 for (
size_t i = 0;
i < vListItems.size(); ++
i)
59 if (vListItems[
i].ToString() ==
rSet)
63 const std::optional<size_t> oSel(
m_pCC->GetSelectedListItem(
true));
64 const bool bNeedsInvalidation =
m_pCC->GetDropDown() && oSel && *oSel ==
m_nZIndex;
67 m_pCC->SetListItems(vListItems);
69 if (bNeedsInvalidation)
72 if (
m_pCC->GetTextAttr())
73 m_pCC->GetTextAttr()->Invalidate();
79 assert(m_nZIndex < m_pCC->GetListItems().
size());
87 assert(m_nZIndex < m_pCC->GetListItems().
size());
88 std::vector<SwContentControlListItem> vListItems =
m_pCC->GetListItems();
91 if (vListItems[
m_nZIndex].m_aDisplayText.isEmpty())
95 m_pCC->SetListItems(vListItems);
106 const std::optional<size_t> oSelected =
m_pCC->GetSelectedListItem(
false);
112 m_pCC->SetSelectedListItem(*oSelected - 1);
114 std::vector<SwContentControlListItem> vListItems =
m_pCC->GetListItems();
116 m_pCC->SetListItems(vListItems);
126 const std::optional<size_t> oSelected =
m_pCC->GetSelectedListItem(
false);
132 m_pCC->SetSelectedListItem(*oSelected + 1);
134 std::vector<SwContentControlListItem> vListItems =
m_pCC->GetListItems();
136 m_pCC->SetListItems(vListItems);
142 assert(m_nZIndex < m_pCC->GetListItems().
size());
144 m_pCC->SetShowingPlaceHolder(
false);
145 if (
m_pCC->GetTextAttr())
146 m_pCC->GetTextAttr()->Invalidate();
152 return "SwVbaContentControlListEntry";
157 static uno::Sequence<OUString>
const aServiceNames{
"ooo.vba.word.ContentControlListEntry" };
Represents one list item in a content control dropdown list.
OUString m_aValue
This must not be empty.
const OUString & ToString() const
void SAL_CALL MoveDown() override
~SwVbaContentControlListEntry() override
void SAL_CALL setText(const OUString &sSet) override
void SAL_CALL Select() override
css::uno::Sequence< OUString > getServiceNames() override
sal_Int32 SAL_CALL getIndex() override
void SAL_CALL MoveUp() override
OUString getServiceImplName() override
OUString SAL_CALL getText() override
void SAL_CALL Delete() override
void SAL_CALL setIndex(sal_Int32 nSet) override
OUString SAL_CALL getValue() override
SwVbaContentControlListEntry(const css::uno::Reference< ooo::vba::XHelperInterface > &rParent, const css::uno::Reference< css::uno::XComponentContext > &rContext, std::shared_ptr< SwContentControl > pCC, size_t nZIndex)
std::shared_ptr< SwContentControl > m_pCC
void SAL_CALL setValue(const OUString &sSet) override
Sequence< OUString > aServiceNames
SwNodeOffset min(const SwNodeOffset &a, const SwNodeOffset &b)