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