1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef _SVX_GALCTRL_HXX_
21 #define _SVX_GALCTRL_HXX_
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"
41 class GalleryBrowser2
;
43 class SVX_DLLPUBLIC GalleryPreview
: public Window
, public DropTargetHelper
, public DragSourceHelper
47 GraphicObject aGraphicObj
;
48 Rectangle aPreviewRect
;
49 GalleryTheme
* mpTheme
;
51 SVX_DLLPRIVATE sal_Bool
ImplGetGraphicCenterRect( const Graphic
& rGraphic
, Rectangle
& rResultRect
) const;
52 SVX_DLLPRIVATE
void InitSettings();
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
);
63 SVX_DLLPRIVATE
virtual sal_Int8
AcceptDrop( const AcceptDropEvent
& rEvt
);
64 SVX_DLLPRIVATE
virtual sal_Int8
ExecuteDrop( const ExecuteDropEvent
& rEvt
);
67 SVX_DLLPRIVATE
virtual void StartDrag( sal_Int8 nAction
, const Point
& rPosPixel
);
69 DECL_LINK( MenuSelectHdl
, Menu
* );
73 GalleryPreview( GalleryBrowser2
* pParent
, GalleryTheme
* pTheme
);
74 GalleryPreview( Window
* pParent
, const ResId
& rResId
);
77 void SetGraphic( const Graphic
& rGraphic
) { aGraphicObj
.SetGraphic( rGraphic
); }
78 bool SetGraphic( const INetURLObject
& );
79 void PreviewMedia( const INetURLObject
& rURL
);
82 class GalleryIconView
: public ValueSet
, public DropTargetHelper
, public DragSourceHelper
84 using ValueSet::StartDrag
;
88 GalleryTheme
* mpTheme
;
93 virtual void UserDraw( const UserDrawEvent
& rUDEvt
);
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
);
102 virtual sal_Int8
AcceptDrop( const AcceptDropEvent
& rEvt
);
103 virtual sal_Int8
ExecuteDrop( const ExecuteDropEvent
& rEvt
);
106 virtual void StartDrag( sal_Int8 nAction
, const Point
& rPosPixel
);
110 GalleryIconView( GalleryBrowser2
* pParent
, GalleryTheme
* pTheme
);
114 class GalleryListView
: public BrowseBox
116 using BrowseBox::AcceptDrop
;
117 using BrowseBox::ExecuteDrop
;
122 GalleryTheme
* mpTheme
;
123 sal_uIntPtr mnCurRow
;
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
);
137 virtual void Command( const CommandEvent
& rCEvt
);
138 virtual void DataChanged( const DataChangedEvent
& rDCEvt
);
141 virtual void StartDrag( sal_Int8 nAction
, const Point
& rPosPixel
);
145 GalleryListView( GalleryBrowser2
* pParent
, GalleryTheme
* pTheme
);
148 void SetSelectHdl( const Link
& rSelectHdl
) { maSelectHdl
= rSelectHdl
; }
150 /** GetCellText returns the text at the given position
152 the number of the row
156 the text out of the cell
158 virtual String
GetCellText(long _nRow
, sal_uInt16 _nColId
) const;
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
);
165 #endif // _SVX_GALCTRL_HXX_
167 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */