Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 : #ifndef _SVX_COLRCTRL_HXX
20 : #define _SVX_COLRCTRL_HXX
21 :
22 : #include <sfx2/dockwin.hxx>
23 : #include <sfx2/childwin.hxx>
24 : #include <svtools/valueset.hxx>
25 : #include <svtools/transfer.hxx>
26 : #include <svl/lstner.hxx>
27 : #include <svx/svxdllapi.h>
28 : #include <svx/xtable.hxx>
29 :
30 : class SvData;
31 :
32 : /*************************************************************************
33 : |*
34 : |* SvxColorValueSet
35 : |*
36 : \************************************************************************/
37 :
38 0 : class SvxColorValueSet : public ValueSet, public DragSourceHelper
39 : {
40 : using ValueSet::StartDrag;
41 :
42 : private:
43 :
44 : sal_Bool bLeft;
45 : Point aDragPosPixel;
46 :
47 : protected:
48 :
49 : void DoDrag();
50 :
51 : // ValueSet
52 : virtual void MouseButtonDown( const MouseEvent& rMEvt );
53 : virtual void MouseButtonUp( const MouseEvent& rMEvt );
54 : virtual void Command(const CommandEvent& rCEvt );
55 :
56 : // DragSourceHelper
57 : virtual void StartDrag( sal_Int8 nAction, const Point& rPtPixel );
58 :
59 : DECL_STATIC_LINK(SvxColorValueSet, ExecDragHdl, void*);
60 :
61 : public:
62 : SvxColorValueSet( Window* pParent, const ResId& rResId );
63 :
64 0 : sal_Bool IsLeftButton() const { return bLeft; }
65 : };
66 :
67 : /*************************************************************************
68 : |*
69 : |* Derivation from SfxChildWindow as "container" for Controller
70 : |*
71 : \************************************************************************/
72 :
73 0 : class SVX_DLLPUBLIC SvxColorChildWindow : public SfxChildWindow
74 : {
75 : public:
76 : SvxColorChildWindow( Window*, sal_uInt16, SfxBindings*,
77 : SfxChildWinInfo* );
78 :
79 : SFX_DECL_CHILDWINDOW_WITHID(SvxColorChildWindow);
80 : };
81 :
82 : /*************************************************************************
83 : |*
84 : |* SvxColorDockingWindow
85 : |*
86 : \************************************************************************/
87 :
88 : class SvxColorDockingWindow : public SfxDockingWindow, public SfxListener
89 : {
90 : friend class SvxColorChildWindow;
91 :
92 : private:
93 : XColorListRef pColorList;
94 : SvxColorValueSet aColorSet;
95 : sal_uInt16 nLeftSlot;
96 : sal_uInt16 nRightSlot;
97 : sal_uInt16 nCols;
98 : sal_uInt16 nLines;
99 : long nCount;
100 : Size aColorSize;
101 : Size aItemSize;
102 :
103 : void FillValueSet();
104 : void SetSize();
105 : DECL_LINK( SelectHdl, void * );
106 :
107 : /** This function is called when the window gets the focus. It grabs
108 : the focus to the color value set so that it can be controlled with
109 : the keyboard.
110 : */
111 : virtual void GetFocus (void);
112 :
113 : protected:
114 : virtual sal_Bool Close();
115 : virtual void Resize();
116 : virtual void Resizing( Size& rSize );
117 :
118 : public:
119 : SvxColorDockingWindow( SfxBindings* pBindings,
120 : SfxChildWindow *pCW,
121 : Window* pParent,
122 : const ResId& rResId );
123 : ~SvxColorDockingWindow();
124 :
125 : virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
126 :
127 : void SetSlotIDs( sal_uInt16 nLeft, sal_uInt16 nRight )
128 : { nLeftSlot = nLeft; nRightSlot = nRight; }
129 :
130 : virtual long Notify( NotifyEvent& rNEvt );
131 : };
132 :
133 : #endif
134 :
135 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|