xref: /trunk/main/svx/inc/svx/unobrushitemhelper.hxx (revision 56b35d86)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 #ifndef _UNOBRUSHITEMHELPER_HXX
23 #define _UNOBRUSHITEMHELPER_HXX
24 
25 #include "svx/svxdllapi.h"
26 #include <editeng/brshitem.hxx>
27 
28 //UUUU Helper function definintions for UNO API fallbacks to replace SvxBrushItem. The
29 // idea is to have fallbacks to create a SvxBrushItem if needed for backwards compatibility
30 // if needed from the SfxItemSet and vice versa. This is used in cases where e.g. UNO API
31 // accesses to slots in the SvxBrushItem are used (see cases in SvxBrushItem::QueryValue
32 // and SvxBrushItem::PutValue as MID_BACK_COLOR and similar).
33 // To make this work, a cycle of creating a SvxBrushItem from a SfxItemSet, changing a value
34 // using PutValue, putting back to the SfxItemSet should create the *same* SvxBrushItem
35 // the next time this will be created using getSvxBrushItemFromSourceSet. For more details,
36 // see comments at the implementations of that two methods.
37 
38 // Set the equivalent in the range [XATTR_FILL_FIRST .. XATTR_FILL_LAST] in the given
39 // SfxItemSet to create the same FillStyle as is expressed by the given SvxBrushItem.
40 // This method will reset all items in the XATTR_FILL_* range first.
41 void SVX_DLLPUBLIC setSvxBrushItemAsFillAttributesToTargetSet(
42     const SvxBrushItem& rBrush,
43     SfxItemSet& rToSet);
44 
45 // Create a SvxBrushItem as close as possible to the settings in the DrawingLayer
46 // items in the range [XATTR_FILL_FIRST .. XATTR_FILL_LAST]. Since this is not 100%
47 // representable this may lead to reduced data. With nBackgroundID a Which-ID for the
48 // to-be-created SvxBrushItem has to be given (default should be 99 as in RES_BACKGROUND).
49 SvxBrushItem SVX_DLLPUBLIC getSvxBrushItemFromSourceSet(
50     const SfxItemSet& rSourceSet,
51     sal_uInt16 nBackgroundID,
52     sal_Bool bSearchInParents = sal_True);
53 
54 #endif // _UNOBRUSHITEMHELPER_HXX
55 
56 //eof
57