xref: /AOO41X/main/svx/inc/svx/colrctrl.hxx (revision f0af996cce404202b810dded877b68a933d4305c)
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 
23 #ifndef _SVX_COLRCTRL_HXX
24 #define _SVX_COLRCTRL_HXX
25 
26 #include <sfx2/dockwin.hxx>
27 #include <sfx2/childwin.hxx>
28 #include <svtools/valueset.hxx>
29 #include <svtools/transfer.hxx>
30 #include <svl/lstner.hxx>
31 #include "svx/svxdllapi.h"
32 
33 class XColorTable;
34 class SvData;
35 
36 /*************************************************************************
37 |*
38 |* SvxColorValueSet
39 |*
40 \************************************************************************/
41 
42 class SvxColorValueSet : public ValueSet, public DragSourceHelper
43 {
44 	using ValueSet::StartDrag;
45 
46 private:
47 
48 	sal_Bool			bLeft;
49 	Point           aDragPosPixel;
50 
51 protected:
52 
53 	void            DoDrag();
54 
55 	// ValueSet
56 	virtual void	MouseButtonDown( const MouseEvent& rMEvt );
57 	virtual void	MouseButtonUp( const MouseEvent& rMEvt );
58 	virtual void    Command(const CommandEvent& rCEvt );
59 
60 	// DragSourceHelper
61 	virtual void	StartDrag( sal_Int8 nAction, const Point& rPtPixel );
62 
63 					DECL_STATIC_LINK(SvxColorValueSet, ExecDragHdl, void*);
64 
65 public:
66 					SvxColorValueSet( Window* pParent, WinBits nWinStyle = WB_ITEMBORDER );
67 					SvxColorValueSet( Window* pParent, const ResId& rResId );
68 
69 	sal_Bool			IsLeftButton() const { return bLeft; }
70 };
71 
72 /*************************************************************************
73 |*
74 |* Ableitung vom SfxChildWindow als "Behaelter" fuer Controller
75 |*
76 \************************************************************************/
77 
78 class SVX_DLLPUBLIC SvxColorChildWindow : public SfxChildWindow
79 {
80  public:
81 	SvxColorChildWindow( Window*, sal_uInt16, SfxBindings*,
82 						 SfxChildWinInfo* );
83 
84 	SFX_DECL_CHILDWINDOW(SvxColorChildWindow);
85 };
86 
87 /*************************************************************************
88 |*
89 |* SvxColorDockingWindow
90 |*
91 \************************************************************************/
92 
93 class SvxColorDockingWindow : public SfxDockingWindow, public SfxListener
94 {
95  friend class SvxColorChildWindow;
96 
97 private:
98 	XColorTable*		pColorTable;
99 	SvxColorValueSet	aColorSet;
100 	sal_uInt16				nLeftSlot;
101 	sal_uInt16				nRightSlot;
102 	sal_uInt16				nCols;
103 	sal_uInt16				nLines;
104 	long				nCount;
105 	Size				aColorSize;
106 	Size				aItemSize;
107 
108 //#if 0 // _SOLAR__PRIVATE
109 	void				FillValueSet();
110 	void 				SetSize();
111 						DECL_LINK( SelectHdl, void * );
112 
113     /** This function is called when the window gets the focus.  It grabs
114         the focus to the color value set so that it can be controlled with
115         the keyboard.
116     */
117 	virtual void GetFocus (void);
118 //#endif
119 
120 protected:
121 	virtual sal_Bool	Close();
122 	virtual void	Resize();
123 	virtual void	Resizing( Size& rSize );
124 
125 public:
126 					SvxColorDockingWindow( SfxBindings* pBindings,
127 										   SfxChildWindow *pCW,
128 										   Window* pParent,
129 										   const ResId& rResId );
130 					~SvxColorDockingWindow();
131 
132 	virtual void 	Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
133 
134 	void			SetSlotIDs( sal_uInt16 nLeft, sal_uInt16 nRight )
135 						{ nLeftSlot = nLeft; nRightSlot = nRight; }
136 
137 	virtual long	Notify( NotifyEvent& rNEvt );
138 };
139 
140 #endif
141 
142