Branch libreoffice-5-0-4
[LibreOffice.git] / include / svx / galctrl.hxx
blobfa9f5dab4d5290e66c1b07315c093f515d33860c
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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>
40 class GalleryTheme;
41 class GalleryBrowser2;
43 class SVX_DLLPUBLIC GalleryPreview : public vcl::Window, public DropTargetHelper, public DragSourceHelper
45 private:
47 GraphicObject aGraphicObj;
48 Rectangle aPreviewRect;
49 GalleryTheme* mpTheme;
51 SVX_DLLPRIVATE bool ImplGetGraphicCenterRect( const Graphic& rGraphic, Rectangle& rResultRect ) const;
52 SVX_DLLPRIVATE void InitSettings();
54 // Window
55 SVX_DLLPRIVATE virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect) SAL_OVERRIDE;
56 SVX_DLLPRIVATE virtual Size GetOptimalSize() const SAL_OVERRIDE;
57 SVX_DLLPRIVATE virtual void MouseButtonDown(const MouseEvent& rMEvt) SAL_OVERRIDE;
58 SVX_DLLPRIVATE virtual void Command(const CommandEvent& rCEvt) SAL_OVERRIDE;
59 SVX_DLLPRIVATE virtual void KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE;
60 SVX_DLLPRIVATE virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
63 // DropTargetHelper
64 SVX_DLLPRIVATE virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) SAL_OVERRIDE;
65 SVX_DLLPRIVATE virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) SAL_OVERRIDE;
67 // DragSourceHelper
68 SVX_DLLPRIVATE virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel ) SAL_OVERRIDE;
70 DECL_LINK( MenuSelectHdl, Menu* );
72 public:
74 GalleryPreview(vcl::Window* pParent,
75 WinBits nStyle = WB_TABSTOP | WB_BORDER,
76 GalleryTheme* pTheme = NULL);
78 void SetGraphic( const Graphic& rGraphic ) { aGraphicObj.SetGraphic( rGraphic ); }
79 bool SetGraphic( const INetURLObject& );
80 static void PreviewMedia( const INetURLObject& rURL );
83 class GalleryIconView : public ValueSet, public DropTargetHelper, public DragSourceHelper
85 using ValueSet::StartDrag;
87 private:
89 GalleryTheme* mpTheme;
91 void InitSettings();
93 // ValueSet
94 virtual void UserDraw( const UserDrawEvent& rUDEvt ) SAL_OVERRIDE;
96 // Window
97 virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
98 virtual void Command( const CommandEvent& rCEvt ) SAL_OVERRIDE;
99 virtual void KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE;
100 virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
102 // DropTargetHelper
103 virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) SAL_OVERRIDE;
104 virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) SAL_OVERRIDE;
106 // DragSourceHelper
107 virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel ) SAL_OVERRIDE;
109 public:
111 GalleryIconView( GalleryBrowser2* pParent, GalleryTheme* pTheme );
114 class GalleryListView : public BrowseBox
116 using BrowseBox::AcceptDrop;
117 using BrowseBox::ExecuteDrop;
119 private:
121 Link<> maSelectHdl;
122 GalleryTheme* mpTheme;
123 long mnCurRow;
125 void InitSettings();
127 // BrowseBox
128 virtual bool SeekRow( long nRow ) SAL_OVERRIDE;
129 virtual void PaintField( OutputDevice& rDev, const Rectangle& rRect, sal_uInt16 nColumnId ) const SAL_OVERRIDE;
130 virtual void DoubleClick( const BrowserMouseEvent& rEvt ) SAL_OVERRIDE;
131 virtual void Select() SAL_OVERRIDE;
132 virtual sal_Int8 AcceptDrop( const BrowserAcceptDropEvent& rEvt ) SAL_OVERRIDE;
133 virtual sal_Int8 ExecuteDrop( const BrowserExecuteDropEvent& rEvt ) SAL_OVERRIDE;
134 virtual void KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE;
136 // Window
137 virtual void Command( const CommandEvent& rCEvt ) SAL_OVERRIDE;
138 virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
140 // DragSourceHelper
141 virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel ) SAL_OVERRIDE;
143 public:
145 GalleryListView( GalleryBrowser2* pParent, GalleryTheme* pTheme );
147 void SetSelectHdl( const Link<>& rSelectHdl ) { maSelectHdl = rSelectHdl; }
149 /** GetCellText returns the text at the given position
150 @param _nRow
151 the number of the row
152 @param _nColId
153 the ID of the column
154 @return
155 the text out of the cell
157 virtual OUString GetCellText(long _nRow, sal_uInt16 _nColId) const SAL_OVERRIDE;
159 // from IAccessibleTableProvider
160 virtual Rectangle GetFieldCharacterBounds(sal_Int32 _nRow,sal_Int32 _nColumnPos,sal_Int32 nIndex) SAL_OVERRIDE;
161 virtual sal_Int32 GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColumnPos,const Point& _rPoint) SAL_OVERRIDE;
164 #endif // INCLUDED_SVX_GALCTRL_HXX
166 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */