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/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef INCLUDED_SVX_UNOBRUSHITEMHELPER_HXX
20 #define INCLUDED_SVX_UNOBRUSHITEMHELPER_HXX
22 #include <svx/svxdllapi.h>
23 #include <editeng/brushitem.hxx>
25 // Helper function definitions for UNO API fallbacks to replace SvxBrushItem. The
26 // idea is to have fallbacks to create a SvxBrushItem if needed for backwards compatibility
27 // if needed from the SfxItemSet and vice versa. This is used in cases where e.g. UNO API
28 // accesses to slots in the SvxBrushItem are used (see cases in SvxBrushItem::QueryValue
29 // and SvxBrushItem::PutValue as MID_BACK_COLOR and similar).
30 // To make this work, a cycle of creating a SvxBrushItem from a SfxItemSet, changing a value
31 // using PutValue, putting back to the SfxItemSet should create the *same* SvxBrushItem
32 // the next time this will be created using getSvxBrushItemFromSourceSet. For more details,
33 // see comments at the implementations of that two methods.
35 // Set the equivalent in the range [XATTR_FILL_FIRST .. XATTR_FILL_LAST] in the given
36 // SfxItemSet to create the same FillStyle as is expressed by the given SvxBrushItem.
37 // This method will reset all items in the XATTR_FILL_* range first.
38 SVXCORE_DLLPUBLIC
void setSvxBrushItemAsFillAttributesToTargetSet(
39 const SvxBrushItem
& rBrush
,
42 // Create a SvxBrushItem as close as possible to the settings in the DrawingLayer
43 // items in the range [XATTR_FILL_FIRST .. XATTR_FILL_LAST]. Since this is not 100%
44 // representable this may lead to reduced data. With nBackgroundID a Which-ID for the
45 // to-be-created SvxBrushItem has to be given (default should be 99 as in RES_BACKGROUND).
46 SVXCORE_DLLPUBLIC
std::unique_ptr
<SvxBrushItem
> getSvxBrushItemFromSourceSet(
47 const SfxItemSet
& rSourceSet
,
48 sal_uInt16 nBackgroundID
,
49 bool bSearchInParents
= true,
50 bool bXMLImportHack
= false);
54 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */