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