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