tdf#137335 calculate paragraph height in RTF/DOCX
[LibreOffice.git] / include / svx / DocumentColorHelper.hxx
blob83884adcfa51252457defe9edfb0768089a55844
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/.
9 */
11 #pragma once
13 #include <editeng/brushitem.hxx>
14 #include <editeng/colritem.hxx>
15 #include <set>
16 #include <svl/itempool.hxx>
18 namespace svx
20 namespace DocumentColorHelper
22 inline Color getColorFromItem(const SvxColorItem* pItem) { return pItem->GetValue(); }
24 inline Color getColorFromItem(const SvxBrushItem* pItem) { return pItem->GetColor(); }
26 template <class T>
27 void queryColors(const sal_uInt16 nAttrib, const SfxItemPool* pPool, std::set<Color>& rOutput)
29 ItemSurrogates aSurrogates;
30 pPool->GetItemSurrogates(aSurrogates, nAttrib);
31 for (const SfxPoolItem* pItem : aSurrogates)
33 auto pColorItem = static_cast<const T*>(pItem);
34 Color aColor(getColorFromItem(pColorItem));
35 if (COL_AUTO != aColor)
36 rOutput.insert(aColor);
41 } // end of namespace svx
43 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */