1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 #include <DocumentModelAccessor.hxx>
12 #include <document.hxx>
13 #include <docpool.hxx>
14 #include <svl/intitem.hxx>
15 #include <svl/zformat.hxx>
16 #include <svl/zforlist.hxx>
17 #include <svl/numformat.hxx>
18 #include <svl/itempool.hxx>
22 std::vector
<sfx::CurrencyID
> DocumentModelAccessor::getDocumentCurrencies() const
24 std::vector
<sfx::CurrencyID
> aCurrencyIDs
;
26 ItemSurrogates aSurrogates
;
27 m_pDocument
->GetPool()->GetItemSurrogates(aSurrogates
, ATTR_VALUE_FORMAT
);
28 for (const SfxPoolItem
* pItem
: aSurrogates
)
30 auto* pIntItem
= static_cast<const SfxUInt32Item
*>(pItem
);
31 sal_Int32 nFormat
= pIntItem
->GetValue();
32 SvNumberFormatter
* pFormatter
= m_pDocument
->GetFormatTable();
35 SvNumberformat
const* pEntry
= pFormatter
->GetEntry(nFormat
);
36 if (pEntry
&& pEntry
->GetMaskedType() == SvNumFormatType::CURRENCY
37 && pEntry
->HasNewCurrency() && pEntry
->GetLanguage() != LANGUAGE_SYSTEM
)
41 pEntry
->GetNewCurrencySymbol(aSymbol
, aExtension
);
42 aCurrencyIDs
.push_back({ aSymbol
, aExtension
, pEntry
->GetLanguage() });
51 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */