19 uno::Reference<container::XIndexAccess> mxIndexAccess;
23 explicit ContentControlListEntriesEnumWrapper(
24 uno::Reference<container::XIndexAccess> xIndexAccess)
25 : mxIndexAccess(xIndexAccess)
30 virtual sal_Bool SAL_CALL hasMoreElements()
override
32 return (mnIndex < mxIndexAccess->getCount());
35 virtual uno::Any SAL_CALL nextElement()
override
37 if (mnIndex < mxIndexAccess->getCount())
39 return mxIndexAccess->getByIndex(mnIndex++);
41 throw container::NoSuchElementException();
45class ContentControlListEntryCollectionHelper
46 :
public ::cppu::WeakImplHelper<container::XIndexAccess, container::XEnumerationAccess>
49 uno::Reference<XHelperInterface>
mxParent;
50 uno::Reference<uno::XComponentContext>
mxContext;
51 std::shared_ptr<SwContentControl> m_pCC;
55 ContentControlListEntryCollectionHelper(uno::Reference<ov::XHelperInterface> xParent,
56 uno::Reference<uno::XComponentContext> xContext,
57 std::shared_ptr<SwContentControl> pCC)
64 sal_Int32 SAL_CALL getCount()
override {
return m_pCC->GetListItems().size(); }
69 throw lang::IndexOutOfBoundsException();
71 return uno::Any(uno::Reference<word::XContentControlListEntry>(
75 uno::Type SAL_CALL getElementType()
override
80 sal_Bool SAL_CALL hasElements()
override {
return getCount() != 0; }
83 uno::Reference<container::XEnumeration> SAL_CALL createEnumeration()
override
85 return new ContentControlListEntriesEnumWrapper(
this);
95 const uno::Reference<XHelperInterface>& xParent,
96 const uno::Reference<uno::XComponentContext>& xContext, std::shared_ptr<SwContentControl> pCC)
100 new ContentControlListEntryCollectionHelper(xParent, xContext, pCC)))
105uno::Reference<word::XContentControlListEntry>
110 for (
auto& rListItem :
m_pCC->GetListItems())
112 if (rListItem.ToString() == rName)
113 return uno::Reference<word::XContentControlListEntry>();
121 nZIndex =
std::min(
static_cast<size_t>(nZIndex),
m_pCC->GetListItems().size());
125 if (
m_pCC->AddListItem(nZIndex, rName, sValue))
127 return uno::Reference<word::XContentControlListEntry>(
131 return uno::Reference<word::XContentControlListEntry>();
157 return "SwVbaContentControlListEntries";
162 static uno::Sequence<OUString>
const sNames{
"ooo.vba.word.ContentControlListEntries" };
unotools::WeakReference< AnimationNode > mxParent
css::uno::Reference< css::uno::XComponentContext > mxContext
css::uno::WeakReference< ov::XHelperInterface > mxParent
css::uno::Reference< css::container::XIndexAccess > m_xIndexAccess
std::shared_ptr< SwContentControl > m_pCC
css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override
void SAL_CALL Clear() override
OUString getServiceImplName() override
SwVbaContentControlListEntries(const css::uno::Reference< ov::XHelperInterface > &xParent, const css::uno::Reference< css::uno::XComponentContext > &xContext, std::shared_ptr< SwContentControl > pCC)
DropDownLists and ComboBoxes contain a list of name/value pairs to choose from.
css::uno::Any createCollectionObject(const css::uno::Any &aSource) override
css::uno::Reference< ooo::vba::word::XContentControlListEntry > SAL_CALL Add(const OUString &rName, const css::uno::Any &rValue, const css::uno::Any &rIndex) override
css::uno::Sequence< OUString > getServiceNames() override
css::uno::Type SAL_CALL getElementType() override
sal_Int32 SAL_CALL getCount() override
css::uno::Type const & get()
SwNodeOffset min(const SwNodeOffset &a, const SwNodeOffset &b)
::cppu::WeakImplHelper< css::container::XEnumeration > EnumerationHelper_BASE