xref: /AOO41X/main/svx/inc/svx/colrctrl.hxx (revision 1ecadb572e7010ff3b3382ad9bf179dbc6efadbb)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef _SVX_COLRCTRL_HXX
28 #define _SVX_COLRCTRL_HXX
29 
30 #include <sfx2/dockwin.hxx>
31 #include <sfx2/childwin.hxx>
32 #include <svtools/valueset.hxx>
33 #include <svtools/transfer.hxx>
34 #include <svl/lstner.hxx>
35 #include "svx/svxdllapi.h"
36 
37 class XColorTable;
38 class SvData;
39 
40 /*************************************************************************
41 |*
42 |* SvxColorValueSet
43 |*
44 \************************************************************************/
45 
46 class SvxColorValueSet : public ValueSet, public DragSourceHelper
47 {
48 	using ValueSet::StartDrag;
49 
50 private:
51 
52 	sal_Bool			bLeft;
53 	Point           aDragPosPixel;
54 
55 protected:
56 
57 	void            DoDrag();
58 
59 	// ValueSet
60 	virtual void	MouseButtonDown( const MouseEvent& rMEvt );
61 	virtual void	MouseButtonUp( const MouseEvent& rMEvt );
62 	virtual void    Command(const CommandEvent& rCEvt );
63 
64 	// DragSourceHelper
65 	virtual void	StartDrag( sal_Int8 nAction, const Point& rPtPixel );
66 
67 					DECL_STATIC_LINK(SvxColorValueSet, ExecDragHdl, void*);
68 
69 public:
70 					SvxColorValueSet( Window* pParent, WinBits nWinStyle = WB_ITEMBORDER );
71 					SvxColorValueSet( Window* pParent, const ResId& rResId );
72 
73 	sal_Bool			IsLeftButton() const { return bLeft; }
74 };
75 
76 /*************************************************************************
77 |*
78 |* Ableitung vom SfxChildWindow als "Behaelter" fuer Controller
79 |*
80 \************************************************************************/
81 
82 class SVX_DLLPUBLIC SvxColorChildWindow : public SfxChildWindow
83 {
84  public:
85 	SvxColorChildWindow( Window*, sal_uInt16, SfxBindings*,
86 						 SfxChildWinInfo* );
87 
88 	SFX_DECL_CHILDWINDOW(SvxColorChildWindow);
89 };
90 
91 /*************************************************************************
92 |*
93 |* SvxColorDockingWindow
94 |*
95 \************************************************************************/
96 
97 class SvxColorDockingWindow : public SfxDockingWindow, public SfxListener
98 {
99  friend class SvxColorChildWindow;
100 
101 private:
102 	XColorTable*		pColorTable;
103 	SvxColorValueSet	aColorSet;
104 	sal_uInt16				nLeftSlot;
105 	sal_uInt16				nRightSlot;
106 	sal_uInt16				nCols;
107 	sal_uInt16				nLines;
108 	long				nCount;
109 	Size				aColorSize;
110 	Size				aItemSize;
111 
112 //#if 0 // _SOLAR__PRIVATE
113 	void				FillValueSet();
114 	void 				SetSize();
115 						DECL_LINK( SelectHdl, void * );
116 
117     /** This function is called when the window gets the focus.  It grabs
118         the focus to the color value set so that it can be controlled with
119         the keyboard.
120     */
121 	virtual void GetFocus (void);
122 //#endif
123 
124 protected:
125 	virtual sal_Bool	Close();
126 	virtual void	Resize();
127 	virtual void	Resizing( Size& rSize );
128 
129 public:
130 					SvxColorDockingWindow( SfxBindings* pBindings,
131 										   SfxChildWindow *pCW,
132 										   Window* pParent,
133 										   const ResId& rResId );
134 					~SvxColorDockingWindow();
135 
136 	virtual void 	Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
137 
138 	void			SetSlotIDs( sal_uInt16 nLeft, sal_uInt16 nRight )
139 						{ nLeftSlot = nLeft; nRightSlot = nRight; }
140 
141 	virtual long	Notify( NotifyEvent& rNEvt );
142 };
143 
144 #endif
145 
146