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(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 : void PreviewMedia( const INetURLObject& rURL );
81 : };
82 :
83 : 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 : virtual ~GalleryIconView();
113 : };
114 :
115 : class GalleryListView : public BrowseBox
116 : {
117 : using BrowseBox::AcceptDrop;
118 : using BrowseBox::ExecuteDrop;
119 :
120 : private:
121 :
122 : Link maSelectHdl;
123 : GalleryTheme* mpTheme;
124 : sal_uIntPtr mnCurRow;
125 :
126 : void InitSettings();
127 :
128 : // BrowseBox
129 : virtual bool SeekRow( long nRow ) SAL_OVERRIDE;
130 : virtual void PaintField( OutputDevice& rDev, const Rectangle& rRect, sal_uInt16 nColumnId ) const SAL_OVERRIDE;
131 : virtual void DoubleClick( const BrowserMouseEvent& rEvt ) SAL_OVERRIDE;
132 : virtual void Select() SAL_OVERRIDE;
133 : virtual sal_Int8 AcceptDrop( const BrowserAcceptDropEvent& rEvt ) SAL_OVERRIDE;
134 : virtual sal_Int8 ExecuteDrop( const BrowserExecuteDropEvent& rEvt ) SAL_OVERRIDE;
135 : virtual void KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE;
136 :
137 : // Window
138 : virtual void Command( const CommandEvent& rCEvt ) SAL_OVERRIDE;
139 : virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
140 :
141 : // DragSourceHelper
142 : virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel ) SAL_OVERRIDE;
143 :
144 : public:
145 :
146 : GalleryListView( GalleryBrowser2* pParent, GalleryTheme* pTheme );
147 : virtual ~GalleryListView();
148 :
149 0 : void SetSelectHdl( const Link& rSelectHdl ) { maSelectHdl = rSelectHdl; }
150 :
151 : /** GetCellText returns the text at the given position
152 : @param _nRow
153 : the number of the row
154 : @param _nColId
155 : the ID of the column
156 : @return
157 : the text out of the cell
158 : */
159 : virtual OUString GetCellText(long _nRow, sal_uInt16 _nColId) const SAL_OVERRIDE;
160 :
161 : // from IAccessibleTableProvider
162 : virtual Rectangle GetFieldCharacterBounds(sal_Int32 _nRow,sal_Int32 _nColumnPos,sal_Int32 nIndex) SAL_OVERRIDE;
163 : virtual sal_Int32 GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColumnPos,const Point& _rPoint) SAL_OVERRIDE;
164 : };
165 :
166 : #endif // INCLUDED_SVX_GALCTRL_HXX
167 :
168 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|