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/.
13 #include <editeng/brushitem.hxx>
14 #include <editeng/colritem.hxx>
16 #include <svl/itempool.hxx>
20 namespace DocumentColorHelper
22 inline Color
getColorFromItem(const SvxColorItem
* pItem
) { return pItem
->GetValue(); }
24 inline Color
getColorFromItem(const SvxBrushItem
* pItem
) { return pItem
->GetColor(); }
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: */