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 :
20 : #ifndef _SVX_GALCTRL_HXX_
21 : #define _SVX_GALCTRL_HXX_
22 :
23 : #include <vcl/dialog.hxx>
24 : #include <vcl/graph.hxx>
25 : #include <vcl/fixed.hxx>
26 : #include <vcl/group.hxx>
27 : #include <vcl/button.hxx>
28 : #include <vcl/lstbox.hxx>
29 : #include <vcl/menu.hxx>
30 : #include <vcl/edit.hxx>
31 : #include <vcl/combobox.hxx>
32 : #include <svl/slstitm.hxx>
33 : #include <svtools/transfer.hxx>
34 : #include <svtools/valueset.hxx>
35 : #include <svtools/brwbox.hxx>
36 : #include <svtools/grfmgr.hxx>
37 : #include "svx/galmisc.hxx"
38 : #include "svx/svxdllapi.h"
39 :
40 : // ------------
41 : // - Forwards -
42 : // ------------
43 :
44 : class GalleryTheme;
45 : class GalleryBrowser2;
46 :
47 : // ------------------
48 : // - GalleryPreview -
49 : // ------------------
50 :
51 : class SVX_DLLPUBLIC GalleryPreview : public Window, public DropTargetHelper, public DragSourceHelper
52 : {
53 : private:
54 :
55 : GraphicObject aGraphicObj;
56 : Rectangle aPreviewRect;
57 : GalleryTheme* mpTheme;
58 :
59 : SVX_DLLPRIVATE sal_Bool ImplGetGraphicCenterRect( const Graphic& rGraphic, Rectangle& rResultRect ) const;
60 : SVX_DLLPRIVATE void InitSettings();
61 :
62 : // Window
63 : SVX_DLLPRIVATE virtual void Paint(const Rectangle& rRect);
64 : SVX_DLLPRIVATE virtual void MouseButtonDown(const MouseEvent& rMEvt);
65 : SVX_DLLPRIVATE virtual void Command(const CommandEvent& rCEvt);
66 : SVX_DLLPRIVATE virtual void KeyInput( const KeyEvent& rKEvt );
67 : SVX_DLLPRIVATE virtual void DataChanged( const DataChangedEvent& rDCEvt );
68 :
69 :
70 : // DropTargetHelper
71 : SVX_DLLPRIVATE virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt );
72 : SVX_DLLPRIVATE virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt );
73 :
74 : // DragSourceHelper
75 : SVX_DLLPRIVATE virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel );
76 :
77 : DECL_LINK( MenuSelectHdl, Menu* );
78 :
79 : public:
80 :
81 : GalleryPreview( GalleryBrowser2* pParent, GalleryTheme* pTheme );
82 : GalleryPreview( Window* pParent, const ResId& rResId );
83 : ~GalleryPreview();
84 :
85 0 : void SetGraphic( const Graphic& rGraphic ) { aGraphicObj.SetGraphic( rGraphic ); }
86 : bool SetGraphic( const INetURLObject& );
87 : void PreviewMedia( const INetURLObject& rURL );
88 : };
89 :
90 : // -------------------
91 : // - GalleryIconView -
92 : // -------------------
93 :
94 : class GalleryIconView : public ValueSet, public DropTargetHelper, public DragSourceHelper
95 : {
96 : using ValueSet::StartDrag;
97 :
98 : private:
99 :
100 : GalleryTheme* mpTheme;
101 :
102 : void InitSettings();
103 :
104 : // ValueSet
105 : virtual void UserDraw( const UserDrawEvent& rUDEvt );
106 :
107 : // Window
108 : virtual void MouseButtonDown( const MouseEvent& rMEvt );
109 : virtual void Command( const CommandEvent& rCEvt );
110 : virtual void KeyInput( const KeyEvent& rKEvt );
111 : virtual void DataChanged( const DataChangedEvent& rDCEvt );
112 :
113 : // DropTargetHelper
114 : virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt );
115 : virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt );
116 :
117 : // DragSourceHelper
118 : virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel );
119 :
120 : public:
121 :
122 : GalleryIconView( GalleryBrowser2* pParent, GalleryTheme* pTheme );
123 : ~GalleryIconView();
124 : };
125 :
126 : // -------------------
127 : // - GalleryListView -
128 : // -------------------
129 :
130 : class GalleryListView : public BrowseBox
131 : {
132 : using BrowseBox::AcceptDrop;
133 : using BrowseBox::ExecuteDrop;
134 :
135 : private:
136 :
137 : Link maSelectHdl;
138 : GalleryTheme* mpTheme;
139 : sal_uIntPtr mnCurRow;
140 :
141 : void InitSettings();
142 :
143 : // BrowseBox
144 : virtual sal_Bool SeekRow( long nRow );
145 : virtual void PaintField( OutputDevice& rDev, const Rectangle& rRect, sal_uInt16 nColumnId ) const;
146 : virtual void DoubleClick( const BrowserMouseEvent& rEvt );
147 : virtual void Select();
148 : virtual sal_Int8 AcceptDrop( const BrowserAcceptDropEvent& rEvt );
149 : virtual sal_Int8 ExecuteDrop( const BrowserExecuteDropEvent& rEvt );
150 : virtual void KeyInput( const KeyEvent& rKEvt );
151 :
152 : // Window
153 : virtual void Command( const CommandEvent& rCEvt );
154 : virtual void DataChanged( const DataChangedEvent& rDCEvt );
155 :
156 : // DragSourceHelper
157 : virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel );
158 :
159 : public:
160 :
161 : GalleryListView( GalleryBrowser2* pParent, GalleryTheme* pTheme );
162 : ~GalleryListView();
163 :
164 : void SetSelectHdl( const Link& rSelectHdl ) { maSelectHdl = rSelectHdl; }
165 :
166 : /** GetCellText returns the text at the given position
167 : @param _nRow
168 : the number of the row
169 : @param _nColId
170 : the ID of the column
171 : @return
172 : the text out of the cell
173 : */
174 : virtual String GetCellText(long _nRow, sal_uInt16 _nColId) const;
175 :
176 : // from IAccessibleTableProvider
177 : virtual Rectangle GetFieldCharacterBounds(sal_Int32 _nRow,sal_Int32 _nColumnPos,sal_Int32 nIndex);
178 : virtual sal_Int32 GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColumnPos,const Point& _rPoint);
179 : };
180 :
181 : #endif // _SVX_GALCTRL_HXX_
182 :
183 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|