xref: /AOO41X/main/svx/inc/svx/colrctrl.hxx (revision 3334a7e6acdae9820fa1a6f556bb10129a8de6b2)
1*3334a7e6SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*3334a7e6SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*3334a7e6SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*3334a7e6SAndrew Rist  * distributed with this work for additional information
6*3334a7e6SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*3334a7e6SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*3334a7e6SAndrew Rist  * "License"); you may not use this file except in compliance
9*3334a7e6SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*3334a7e6SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*3334a7e6SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*3334a7e6SAndrew Rist  * software distributed under the License is distributed on an
15*3334a7e6SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*3334a7e6SAndrew Rist  * KIND, either express or implied.  See the License for the
17*3334a7e6SAndrew Rist  * specific language governing permissions and limitations
18*3334a7e6SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*3334a7e6SAndrew Rist  *************************************************************/
21*3334a7e6SAndrew Rist 
22*3334a7e6SAndrew Rist 
23cdf0e10cSrcweir #ifndef _SVX_COLRCTRL_HXX
24cdf0e10cSrcweir #define _SVX_COLRCTRL_HXX
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include <sfx2/dockwin.hxx>
27cdf0e10cSrcweir #include <sfx2/childwin.hxx>
28cdf0e10cSrcweir #include <svtools/valueset.hxx>
29cdf0e10cSrcweir #include <svtools/transfer.hxx>
30cdf0e10cSrcweir #include <svl/lstner.hxx>
31cdf0e10cSrcweir #include "svx/svxdllapi.h"
32cdf0e10cSrcweir 
33cdf0e10cSrcweir class XColorTable;
34cdf0e10cSrcweir class SvData;
35cdf0e10cSrcweir 
36cdf0e10cSrcweir /*************************************************************************
37cdf0e10cSrcweir |*
38cdf0e10cSrcweir |* SvxColorValueSet
39cdf0e10cSrcweir |*
40cdf0e10cSrcweir \************************************************************************/
41cdf0e10cSrcweir 
42cdf0e10cSrcweir class SvxColorValueSet : public ValueSet, public DragSourceHelper
43cdf0e10cSrcweir {
44cdf0e10cSrcweir 	using ValueSet::StartDrag;
45cdf0e10cSrcweir 
46cdf0e10cSrcweir private:
47cdf0e10cSrcweir 
48cdf0e10cSrcweir 	sal_Bool			bLeft;
49cdf0e10cSrcweir 	Point           aDragPosPixel;
50cdf0e10cSrcweir 
51cdf0e10cSrcweir protected:
52cdf0e10cSrcweir 
53cdf0e10cSrcweir 	void            DoDrag();
54cdf0e10cSrcweir 
55cdf0e10cSrcweir 	// ValueSet
56cdf0e10cSrcweir 	virtual void	MouseButtonDown( const MouseEvent& rMEvt );
57cdf0e10cSrcweir 	virtual void	MouseButtonUp( const MouseEvent& rMEvt );
58cdf0e10cSrcweir 	virtual void    Command(const CommandEvent& rCEvt );
59cdf0e10cSrcweir 
60cdf0e10cSrcweir 	// DragSourceHelper
61cdf0e10cSrcweir 	virtual void	StartDrag( sal_Int8 nAction, const Point& rPtPixel );
62cdf0e10cSrcweir 
63cdf0e10cSrcweir 					DECL_STATIC_LINK(SvxColorValueSet, ExecDragHdl, void*);
64cdf0e10cSrcweir 
65cdf0e10cSrcweir public:
66cdf0e10cSrcweir 					SvxColorValueSet( Window* pParent, WinBits nWinStyle = WB_ITEMBORDER );
67cdf0e10cSrcweir 					SvxColorValueSet( Window* pParent, const ResId& rResId );
68cdf0e10cSrcweir 
69cdf0e10cSrcweir 	sal_Bool			IsLeftButton() const { return bLeft; }
70cdf0e10cSrcweir };
71cdf0e10cSrcweir 
72cdf0e10cSrcweir /*************************************************************************
73cdf0e10cSrcweir |*
74cdf0e10cSrcweir |* Ableitung vom SfxChildWindow als "Behaelter" fuer Controller
75cdf0e10cSrcweir |*
76cdf0e10cSrcweir \************************************************************************/
77cdf0e10cSrcweir 
78cdf0e10cSrcweir class SVX_DLLPUBLIC SvxColorChildWindow : public SfxChildWindow
79cdf0e10cSrcweir {
80cdf0e10cSrcweir  public:
81cdf0e10cSrcweir 	SvxColorChildWindow( Window*, sal_uInt16, SfxBindings*,
82cdf0e10cSrcweir 						 SfxChildWinInfo* );
83cdf0e10cSrcweir 
84cdf0e10cSrcweir 	SFX_DECL_CHILDWINDOW(SvxColorChildWindow);
85cdf0e10cSrcweir };
86cdf0e10cSrcweir 
87cdf0e10cSrcweir /*************************************************************************
88cdf0e10cSrcweir |*
89cdf0e10cSrcweir |* SvxColorDockingWindow
90cdf0e10cSrcweir |*
91cdf0e10cSrcweir \************************************************************************/
92cdf0e10cSrcweir 
93cdf0e10cSrcweir class SvxColorDockingWindow : public SfxDockingWindow, public SfxListener
94cdf0e10cSrcweir {
95cdf0e10cSrcweir  friend class SvxColorChildWindow;
96cdf0e10cSrcweir 
97cdf0e10cSrcweir private:
98cdf0e10cSrcweir 	XColorTable*		pColorTable;
99cdf0e10cSrcweir 	SvxColorValueSet	aColorSet;
100cdf0e10cSrcweir 	sal_uInt16				nLeftSlot;
101cdf0e10cSrcweir 	sal_uInt16				nRightSlot;
102cdf0e10cSrcweir 	sal_uInt16				nCols;
103cdf0e10cSrcweir 	sal_uInt16				nLines;
104cdf0e10cSrcweir 	long				nCount;
105cdf0e10cSrcweir 	Size				aColorSize;
106cdf0e10cSrcweir 	Size				aItemSize;
107cdf0e10cSrcweir 
108cdf0e10cSrcweir //#if 0 // _SOLAR__PRIVATE
109cdf0e10cSrcweir 	void				FillValueSet();
110cdf0e10cSrcweir 	void 				SetSize();
111cdf0e10cSrcweir 						DECL_LINK( SelectHdl, void * );
112cdf0e10cSrcweir 
113cdf0e10cSrcweir     /** This function is called when the window gets the focus.  It grabs
114cdf0e10cSrcweir         the focus to the color value set so that it can be controlled with
115cdf0e10cSrcweir         the keyboard.
116cdf0e10cSrcweir     */
117cdf0e10cSrcweir 	virtual void GetFocus (void);
118cdf0e10cSrcweir //#endif
119cdf0e10cSrcweir 
120cdf0e10cSrcweir protected:
121cdf0e10cSrcweir 	virtual sal_Bool	Close();
122cdf0e10cSrcweir 	virtual void	Resize();
123cdf0e10cSrcweir 	virtual void	Resizing( Size& rSize );
124cdf0e10cSrcweir 
125cdf0e10cSrcweir public:
126cdf0e10cSrcweir 					SvxColorDockingWindow( SfxBindings* pBindings,
127cdf0e10cSrcweir 										   SfxChildWindow *pCW,
128cdf0e10cSrcweir 										   Window* pParent,
129cdf0e10cSrcweir 										   const ResId& rResId );
130cdf0e10cSrcweir 					~SvxColorDockingWindow();
131cdf0e10cSrcweir 
132cdf0e10cSrcweir 	virtual void 	Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
133cdf0e10cSrcweir 
134cdf0e10cSrcweir 	void			SetSlotIDs( sal_uInt16 nLeft, sal_uInt16 nRight )
135cdf0e10cSrcweir 						{ nLeftSlot = nLeft; nRightSlot = nRight; }
136cdf0e10cSrcweir 
137cdf0e10cSrcweir 	virtual long	Notify( NotifyEvent& rNEvt );
138cdf0e10cSrcweir };
139cdf0e10cSrcweir 
140cdf0e10cSrcweir #endif
141cdf0e10cSrcweir 
142