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