LibreOffice Module svx (master)  1
unobrushitemhelper.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 #ifndef INCLUDED_SVX_UNOBRUSHITEMHELPER_HXX
20 #define INCLUDED_SVX_UNOBRUSHITEMHELPER_HXX
21 
22 #include <svx/svxdllapi.h>
23 #include <editeng/brushitem.hxx>
24 
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.
34 
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.
39  const SvxBrushItem& rBrush,
40  SfxItemSet& rToSet);
41 
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);
51 
52 #endif
53 
54 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SVXCORE_DLLPUBLIC void setSvxBrushItemAsFillAttributesToTargetSet(const SvxBrushItem &rBrush, SfxItemSet &rToSet)
#define SVXCORE_DLLPUBLIC
Definition: svxdllapi.h:35
SVXCORE_DLLPUBLIC std::unique_ptr< SvxBrushItem > getSvxBrushItemFromSourceSet(const SfxItemSet &rSourceSet, sal_uInt16 nBackgroundID, bool bSearchInParents=true, bool bXMLImportHack=false)