lok: calc - send other views our selection in their co-ordinates.
[LibreOffice.git] / include / svx / galctrl.hxx
blobddbcbb3a60cf177108b735ac78882812bdb350c9
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/graph.hxx>
24 #include <vcl/customweld.hxx>
25 #include <vcl/transfer.hxx>
26 #include <svtools/valueset.hxx>
27 #include <svtools/brwbox.hxx>
28 #include <vcl/GraphicObject.hxx>
29 #include <svx/svxdllapi.h>
31 class GalleryTheme;
32 class GalleryBrowser2;
33 class INetURLObject;
35 class GalleryPreview final : public vcl::Window, public DropTargetHelper, public DragSourceHelper
37 private:
39 GraphicObject aGraphicObj;
40 tools::Rectangle aPreviewRect;
41 GalleryTheme* const mpTheme;
43 bool ImplGetGraphicCenterRect( const Graphic& rGraphic, tools::Rectangle& rResultRect ) const;
44 void InitSettings();
46 // Window
47 virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
48 virtual Size GetOptimalSize() const override;
49 virtual void MouseButtonDown(const MouseEvent& rMEvt) override;
50 virtual void Command(const CommandEvent& rCEvt) override;
51 virtual void KeyInput( const KeyEvent& rKEvt ) override;
52 virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
55 // DropTargetHelper
56 virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) override;
57 virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) override;
59 // DragSourceHelper
60 virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel ) override;
62 public:
64 GalleryPreview(vcl::Window* pParent,
65 WinBits nStyle = WB_TABSTOP | WB_BORDER,
66 GalleryTheme* pTheme = nullptr);
68 void SetGraphic( const Graphic& rGraphic ) { aGraphicObj.SetGraphic( rGraphic ); }
69 static void PreviewMedia( const INetURLObject& rURL );
72 class SVX_DLLPUBLIC SvxGalleryPreview final : public weld::CustomWidgetController
74 private:
75 GraphicObject aGraphicObj;
76 tools::Rectangle aPreviewRect;
78 SVX_DLLPRIVATE bool ImplGetGraphicCenterRect( const Graphic& rGraphic, tools::Rectangle& rResultRect ) const;
80 SVX_DLLPRIVATE virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
82 public:
84 SvxGalleryPreview();
86 virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
87 void SetGraphic( const Graphic& rGraphic ) { aGraphicObj.SetGraphic( rGraphic ); }
88 bool SetGraphic( const INetURLObject& );
91 class GalleryIconView final : public ValueSet, public DropTargetHelper, public DragSourceHelper
93 using ValueSet::StartDrag;
95 private:
97 GalleryTheme* mpTheme;
99 void InitSettings();
101 // ValueSet
102 virtual void UserDraw( const UserDrawEvent& rUDEvt ) override;
104 // Window
105 virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
106 virtual void Command( const CommandEvent& rCEvt ) override;
107 virtual void KeyInput( const KeyEvent& rKEvt ) override;
108 virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
110 // DropTargetHelper
111 virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) override;
112 virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) override;
114 // DragSourceHelper
115 virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel ) override;
117 public:
119 GalleryIconView( GalleryBrowser2* pParent, GalleryTheme* pTheme );
122 class GalleryListView final : public BrowseBox
124 using BrowseBox::AcceptDrop;
125 using BrowseBox::ExecuteDrop;
127 private:
129 Link<GalleryListView*,void> maSelectHdl;
130 GalleryTheme* mpTheme;
131 sal_uInt32 mnCurRow;
133 void InitSettings();
135 // BrowseBox
136 virtual bool SeekRow( long nRow ) override;
137 virtual void PaintField( vcl::RenderContext& rDev, const tools::Rectangle& rRect, sal_uInt16 nColumnId ) const override;
138 virtual void DoubleClick( const BrowserMouseEvent& rEvt ) override;
139 virtual void Select() override;
140 virtual sal_Int8 AcceptDrop( const BrowserAcceptDropEvent& rEvt ) override;
141 virtual sal_Int8 ExecuteDrop( const BrowserExecuteDropEvent& rEvt ) override;
142 virtual void KeyInput( const KeyEvent& rKEvt ) override;
144 // Window
145 virtual void Command( const CommandEvent& rCEvt ) override;
146 virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
148 // DragSourceHelper
149 virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel ) override;
151 public:
153 GalleryListView( GalleryBrowser2* pParent, GalleryTheme* pTheme );
155 void SetSelectHdl( const Link<GalleryListView*,void>& rSelectHdl ) { maSelectHdl = rSelectHdl; }
157 /** GetCellText returns the text at the given position
158 @param _nRow
159 the number of the row
160 @param _nColId
161 the ID of the column
162 @return
163 the text out of the cell
165 virtual OUString GetCellText(long _nRow, sal_uInt16 _nColId) const override;
167 // from IAccessibleTableProvider
168 virtual tools::Rectangle GetFieldCharacterBounds(sal_Int32 _nRow,sal_Int32 _nColumnPos,sal_Int32 nIndex) override;
169 virtual sal_Int32 GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColumnPos,const Point& _rPoint) override;
172 #endif // INCLUDED_SVX_GALCTRL_HXX
174 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */