28static sw::mark::IFieldmark*
lcl_getFieldmark(std::string_view rName, sal_Int32& rIndex,
29 const uno::Reference<frame::XModel>& xModel,
30 uno::Sequence<OUString>* pElementNames =
nullptr)
41 sal_Int32 nCounter = 0;
42 std::vector<OUString> vElementNames;
53 && (*aIter)->GetName().equalsIgnoreAsciiCase(OUString::fromUtf8(rName)))
56 return dynamic_cast<sw::mark::IFieldmark*
>(*aIter);
58 else if (rIndex == nCounter)
59 return dynamic_cast<sw::mark::IFieldmark*
>(*aIter);
63 vElementNames.push_back((*aIter)->GetName());
80 uno::Reference<container::XIndexAccess> mxIndexAccess;
84 explicit FormFieldsEnumWrapper(uno::Reference<container::XIndexAccess> xIndexAccess)
85 : mxIndexAccess(xIndexAccess)
89 sal_Bool SAL_CALL hasMoreElements()
override {
return (mnIndex < mxIndexAccess->getCount()); }
91 uno::Any SAL_CALL nextElement()
override
93 if (mnIndex < mxIndexAccess->getCount())
95 return mxIndexAccess->getByIndex(mnIndex++);
97 throw container::NoSuchElementException();
101class FormFieldCollectionHelper
102 :
public ::cppu::WeakImplHelper<container::XNameAccess, container::XIndexAccess,
103 container::XEnumerationAccess>
106 uno::Reference<XHelperInterface>
mxParent;
107 uno::Reference<uno::XComponentContext>
mxContext;
108 uno::Reference<text::XTextDocument> mxTextDocument;
113 FormFieldCollectionHelper(uno::Reference<ov::XHelperInterface> xParent,
114 uno::Reference<uno::XComponentContext> xContext,
115 uno::Reference<text::XTextDocument> xTextDocument)
118 , mxTextDocument(
std::move(xTextDocument))
124 sal_Int32 SAL_CALL getCount()
override
135 throw lang::IndexOutOfBoundsException();
137 return uno::Any(uno::Reference<word::XFormField>(
138 new SwVbaFormField(mxParent, mxContext, mxTextDocument, *m_pCache)));
142 uno::Sequence<OUString> SAL_CALL getElementNames()
override
145 uno::Sequence<OUString>
aSeq;
150 uno::Any SAL_CALL getByName(
const OUString& aName)
override
152 if (!hasByName(aName))
153 throw container::NoSuchElementException();
155 return uno::Any(uno::Reference<word::XFormField>(
156 new SwVbaFormField(mxParent, mxContext, mxTextDocument, *m_pCache)));
159 sal_Bool SAL_CALL hasByName(
const OUString& aName)
override
169 sal_Bool SAL_CALL hasElements()
override {
return getCount() != 0; }
172 uno::Reference<container::XEnumeration> SAL_CALL createEnumeration()
override
174 return new FormFieldsEnumWrapper(
this);
180 const uno::Reference<uno::XComponentContext>& xContext,
181 const uno::Reference<text::XTextDocument>& xTextDocument)
184 new FormFieldCollectionHelper(xParent, xContext, xTextDocument)))
190 SAL_INFO(
"sw.vba",
"SwVbaFormFields::getShaded stub");
196 SAL_INFO(
"sw.vba",
"SwVbaFormFields::setShaded stub");
231 static uno::Sequence<OUString>
const sNames{
"ooo.vba.word.FormFields" };
unotools::WeakReference< AnimationNode > mxParent
wrapper iterator: wraps iterator of implementation while hiding MarkBase class; only IMark instances ...
Provides access to the marks of a document.
virtual const_iterator_t getFieldmarksBegin() const =0
returns a STL-like random access iterator to the begin of the sequence of fieldmarks.
virtual const_iterator_t getFieldmarksEnd() const =0
returns a STL-like random access iterator to the end of the sequence of fieldmarks.
static SW_DLLPUBLIC MarkType GetType(const ::sw::mark::IMark &rMark)
Returns the MarkType used to create the mark.
css::uno::Reference< css::container::XIndexAccess > m_xIndexAccess
SwDoc * GetDoc()
returns Doc. But be careful!
IDocumentMarkAccess * getIDocumentMarkAccess()
css::uno::Type const & get()
Sequence< sal_Int8 > aSeq
#define SAL_INFO(area, stream)
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
SwDocShell * getDocShell(const uno::Reference< frame::XModel > &xModel)
Reference< XModel > xModel
::cppu::WeakImplHelper< css::container::XEnumeration > EnumerationHelper_BASE