/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
// Helper function to access the fieldmarks // @param rIndex serves multiple purposes // [in] -1 to indicate searching using the provided name, SAL_MAX_INT32 for totals // [out] rIndex indicates the found index, or the total number of fieldmarks static sw::mark::Fieldmark* lcl_getFieldmark(std::string_view rName, sal_Int32& rIndex, const rtl::Reference<SwXTextDocument>& xModel,
uno::Sequence<OUString>* pElementNames = nullptr)
{
SwDoc* pDoc = xModel->GetDocShell()->GetDoc(); if (!pDoc) return nullptr;
IDocumentMarkAccess* pMarkAccess = pDoc->getIDocumentMarkAccess(); if (!pMarkAccess) return nullptr;
sal_Int32 nCounter = 0;
std::vector<OUString> vElementNames; auto aIter = pMarkAccess->getFieldmarksBegin(); while (aIter != pMarkAccess->getFieldmarksEnd())
{ switch (IDocumentMarkAccess::GetType(**aIter))
{ case IDocumentMarkAccess::MarkType::CHECKBOX_FIELDMARK: case IDocumentMarkAccess::MarkType::DROPDOWN_FIELDMARK: case IDocumentMarkAccess::MarkType::TEXT_FIELDMARK:
{ if (rIndex < 0
&& (*aIter)->GetName().toString().equalsIgnoreAsciiCase(
OUString::fromUtf8(rName)))
{
rIndex = nCounter; return *aIter;
} elseif (rIndex == nCounter) return *aIter;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.