tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / sc / source / ui / docshell / DocumentModelAccessor.cxx
blob0b7425c05d0369a4961e8f0eef56f39e6272cca7
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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/.
8 */
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>
20 namespace sc
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();
33 if (pFormatter)
35 SvNumberformat const* pEntry = pFormatter->GetEntry(nFormat);
36 if (pEntry && pEntry->GetMaskedType() == SvNumFormatType::CURRENCY
37 && pEntry->HasNewCurrency() && pEntry->GetLanguage() != LANGUAGE_SYSTEM)
39 OUString aSymbol;
40 OUString aExtension;
41 pEntry->GetNewCurrencySymbol(aSymbol, aExtension);
42 aCurrencyIDs.push_back({ aSymbol, aExtension, pEntry->GetLanguage() });
46 return aCurrencyIDs;
49 } // end sc
51 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */