xref: /trunk/main/svx/inc/svx/fillctrl.hxx (revision 4b49cd3e)
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 _FILLCTRL_HXX
23 #define _FILLCTRL_HXX
24 
25 #include <svl/lstner.hxx>
26 #include <sfx2/tbxctrl.hxx>
27 #include "svx/svxdllapi.h"
28 #include <svx/xenum.hxx>
29 
30 class XFillStyleItem;
31 class XFillColorItem;
32 class XFillGradientItem;
33 class XFillHatchItem;
34 class XFillBitmapItem;
35 class FillControl;
36 class SvxFillTypeBox;
37 class SvxFillAttrBox;
38 class ListBox;
39 
40 /*************************************************************************
41 |*
42 |* Klassen fuer Flaechenattribute (Controls und Controller)
43 |*
44 \************************************************************************/
45 
46 class SVX_DLLPUBLIC SvxFillToolBoxControl : public SfxToolBoxControl
47 {
48 private:
49     XFillStyleItem*     mpStyleItem;
50     XFillColorItem*     mpColorItem;
51     XFillGradientItem*  mpGradientItem;
52     XFillHatchItem*     mpHatchItem;
53     XFillBitmapItem*    mpBitmapItem;
54 
55     FillControl*        mpFillControl;
56     SvxFillTypeBox*     mpFillTypeLB;
57     SvxFillAttrBox*     mpFillAttrLB;
58 
59     XFillStyle          meLastXFS;
60 
61     /// bitfield
62     bool                mbUpdate : 1;
63 
64 public:
65     SFX_DECL_TOOLBOX_CONTROL();
66 
67     SvxFillToolBoxControl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx);
68     ~SvxFillToolBoxControl();
69 
70     virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState);
71     void Update(const SfxPoolItem* pState);
72     virtual Window* CreateItemWindow(Window* pParent);
73 };
74 
75 //========================================================================
76 
77 class FillControl : public Window
78 {
79 private:
80     friend class SvxFillToolBoxControl;
81 
82     SvxFillTypeBox*     mpLbFillType;
83     SvxFillAttrBox*     mpLbFillAttr;
84     Size                maLogicalFillSize;
85     Size                maLogicalAttrSize;
86 
87     //
88     sal_uInt16          mnLastFillTypeControlSelectEntryPos;
89     sal_uInt16          mnLastFillAttrControlSelectEntryPos;
90 
91     /// bitfield
92     bool                mbFillTypeChanged : 1;
93 
94     DECL_LINK(SelectFillTypeHdl,ListBox *);
95     DECL_LINK(SelectFillAttrHdl,ListBox *);
96 
97     virtual void DataChanged(const DataChangedEvent& rDCEvt);
98 
99     void InitializeFillStyleAccordingToGivenFillType(XFillStyle aFillStyle);
100     void updateLastFillTypeControlSelectEntryPos();
101     void updateLastFillAttrControlSelectEntryPos();
102 
103 public:
104     FillControl(Window* pParent, WinBits nStyle = 0);
105     ~FillControl();
106 
107     virtual void Resize();
108 };
109 
110 #endif // _FILLCTRL_HXX
111 
112 // eof
113