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 INCLUDED_SVX_GALCTRL_HXX
21 #define INCLUDED_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 vcl::Window
, public DropTargetHelper
, public DragSourceHelper
47 GraphicObject aGraphicObj
;
48 tools::Rectangle aPreviewRect
;
49 GalleryTheme
* mpTheme
;
51 SVX_DLLPRIVATE
bool ImplGetGraphicCenterRect( const Graphic
& rGraphic
, tools::Rectangle
& rResultRect
) const;
52 SVX_DLLPRIVATE
void InitSettings();
55 SVX_DLLPRIVATE
virtual void Paint(vcl::RenderContext
& rRenderContext
, const tools::Rectangle
& rRect
) override
;
56 SVX_DLLPRIVATE
virtual Size
GetOptimalSize() const override
;
57 SVX_DLLPRIVATE
virtual void MouseButtonDown(const MouseEvent
& rMEvt
) override
;
58 SVX_DLLPRIVATE
virtual void Command(const CommandEvent
& rCEvt
) override
;
59 SVX_DLLPRIVATE
virtual void KeyInput( const KeyEvent
& rKEvt
) override
;
60 SVX_DLLPRIVATE
virtual void DataChanged( const DataChangedEvent
& rDCEvt
) override
;
64 SVX_DLLPRIVATE
virtual sal_Int8
AcceptDrop( const AcceptDropEvent
& rEvt
) override
;
65 SVX_DLLPRIVATE
virtual sal_Int8
ExecuteDrop( const ExecuteDropEvent
& rEvt
) override
;
68 SVX_DLLPRIVATE
virtual void StartDrag( sal_Int8 nAction
, const Point
& rPosPixel
) override
;
72 GalleryPreview(vcl::Window
* pParent
,
73 WinBits nStyle
= WB_TABSTOP
| WB_BORDER
,
74 GalleryTheme
* pTheme
= nullptr);
76 void SetGraphic( const Graphic
& rGraphic
) { aGraphicObj
.SetGraphic( rGraphic
); }
77 bool SetGraphic( const INetURLObject
& );
78 static void PreviewMedia( const INetURLObject
& rURL
);
81 class GalleryIconView
: public ValueSet
, public DropTargetHelper
, public DragSourceHelper
83 using ValueSet::StartDrag
;
87 GalleryTheme
* mpTheme
;
92 virtual void UserDraw( const UserDrawEvent
& rUDEvt
) override
;
95 virtual void MouseButtonDown( const MouseEvent
& rMEvt
) override
;
96 virtual void Command( const CommandEvent
& rCEvt
) override
;
97 virtual void KeyInput( const KeyEvent
& rKEvt
) override
;
98 virtual void DataChanged( const DataChangedEvent
& rDCEvt
) override
;
101 virtual sal_Int8
AcceptDrop( const AcceptDropEvent
& rEvt
) override
;
102 virtual sal_Int8
ExecuteDrop( const ExecuteDropEvent
& rEvt
) override
;
105 virtual void StartDrag( sal_Int8 nAction
, const Point
& rPosPixel
) override
;
109 GalleryIconView( GalleryBrowser2
* pParent
, GalleryTheme
* pTheme
);
112 class GalleryListView
: public BrowseBox
114 using BrowseBox::AcceptDrop
;
115 using BrowseBox::ExecuteDrop
;
119 Link
<GalleryListView
*,void> maSelectHdl
;
120 GalleryTheme
* mpTheme
;
126 virtual bool SeekRow( long nRow
) override
;
127 virtual void PaintField( OutputDevice
& rDev
, const tools::Rectangle
& rRect
, sal_uInt16 nColumnId
) const override
;
128 virtual void DoubleClick( const BrowserMouseEvent
& rEvt
) override
;
129 virtual void Select() override
;
130 virtual sal_Int8
AcceptDrop( const BrowserAcceptDropEvent
& rEvt
) override
;
131 virtual sal_Int8
ExecuteDrop( const BrowserExecuteDropEvent
& rEvt
) override
;
132 virtual void KeyInput( const KeyEvent
& rKEvt
) override
;
135 virtual void Command( const CommandEvent
& rCEvt
) override
;
136 virtual void DataChanged( const DataChangedEvent
& rDCEvt
) override
;
139 virtual void StartDrag( sal_Int8 nAction
, const Point
& rPosPixel
) override
;
143 GalleryListView( GalleryBrowser2
* pParent
, GalleryTheme
* pTheme
);
145 void SetSelectHdl( const Link
<GalleryListView
*,void>& rSelectHdl
) { maSelectHdl
= rSelectHdl
; }
147 /** GetCellText returns the text at the given position
149 the number of the row
153 the text out of the cell
155 virtual OUString
GetCellText(long _nRow
, sal_uInt16 _nColId
) const override
;
157 // from IAccessibleTableProvider
158 virtual tools::Rectangle
GetFieldCharacterBounds(sal_Int32 _nRow
,sal_Int32 _nColumnPos
,sal_Int32 nIndex
) override
;
159 virtual sal_Int32
GetFieldIndexAtPoint(sal_Int32 _nRow
,sal_Int32 _nColumnPos
,const Point
& _rPoint
) override
;
162 #endif // INCLUDED_SVX_GALCTRL_HXX
164 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */