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 INCLUDED_SVX_GALCTRL_HXX
21 : #define INCLUDED_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 0 : class SVX_DLLPUBLIC GalleryPreview : public vcl::Window, public DropTargetHelper, public DragSourceHelper
44 : {
45 : private:
46 :
47 : GraphicObject aGraphicObj;
48 : Rectangle aPreviewRect;
49 : GalleryTheme* mpTheme;
50 :
51 : SVX_DLLPRIVATE bool ImplGetGraphicCenterRect( const Graphic& rGraphic, Rectangle& rResultRect ) const;
52 : SVX_DLLPRIVATE void InitSettings();
53 :
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;
61 :
62 :
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;
66 :
67 : // DragSourceHelper
68 : SVX_DLLPRIVATE virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel ) SAL_OVERRIDE;
69 :
70 : DECL_LINK( MenuSelectHdl, Menu* );
71 :
72 : public:
73 :
74 : GalleryPreview(vcl::Window* pParent,
75 : WinBits nStyle = WB_TABSTOP | WB_BORDER,
76 : GalleryTheme* pTheme = NULL);
77 :
78 0 : void SetGraphic( const Graphic& rGraphic ) { aGraphicObj.SetGraphic( rGraphic ); }
79 : bool SetGraphic( const INetURLObject& );
80 : static void PreviewMedia( const INetURLObject& rURL );
81 : };
82 :
83 0 : class GalleryIconView : public ValueSet, public DropTargetHelper, public DragSourceHelper
84 : {
85 : using ValueSet::StartDrag;
86 :
87 : private:
88 :
89 : GalleryTheme* mpTheme;
90 :
91 : void InitSettings();
92 :
93 : // ValueSet
94 : virtual void UserDraw( const UserDrawEvent& rUDEvt ) SAL_OVERRIDE;
95 :
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;
101 :
102 : // DropTargetHelper
103 : virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) SAL_OVERRIDE;
104 : virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) SAL_OVERRIDE;
105 :
106 : // DragSourceHelper
107 : virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel ) SAL_OVERRIDE;
108 :
109 : public:
110 :
111 : GalleryIconView( GalleryBrowser2* pParent, GalleryTheme* pTheme );
112 : };
113 :
114 0 : class GalleryListView : public BrowseBox
115 : {
116 : using BrowseBox::AcceptDrop;
117 : using BrowseBox::ExecuteDrop;
118 :
119 : private:
120 :
121 : Link<> maSelectHdl;
122 : GalleryTheme* mpTheme;
123 : long mnCurRow;
124 :
125 : void InitSettings();
126 :
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;
135 :
136 : // Window
137 : virtual void Command( const CommandEvent& rCEvt ) SAL_OVERRIDE;
138 : virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
139 :
140 : // DragSourceHelper
141 : virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel ) SAL_OVERRIDE;
142 :
143 : public:
144 :
145 : GalleryListView( GalleryBrowser2* pParent, GalleryTheme* pTheme );
146 :
147 0 : void SetSelectHdl( const Link<>& rSelectHdl ) { maSelectHdl = rSelectHdl; }
148 :
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
156 : */
157 : virtual OUString GetCellText(long _nRow, sal_uInt16 _nColId) const SAL_OVERRIDE;
158 :
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;
162 : };
163 :
164 : #endif // INCLUDED_SVX_GALCTRL_HXX
165 :
166 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|