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/graph.hxx>
24 #include <vcl/customweld.hxx>
25 #include <svtools/valueset.hxx>
26 #include <vcl/GraphicObject.hxx>
27 #include <svx/svxdllapi.h>
29 class GalleryDragDrop
;
31 class GalleryBrowser1
;
34 class GalleryPreview final
: public weld::CustomWidgetController
38 std::unique_ptr
<GalleryDragDrop
> mxDragDropTargetHelper
;
39 std::unique_ptr
<weld::ScrolledWindow
> mxScrolledWindow
;
40 GraphicObject aGraphicObj
;
41 tools::Rectangle aPreviewRect
;
42 GalleryBrowser1
* mpParent
;
43 GalleryTheme
* mpTheme
;
45 bool ImplGetGraphicCenterRect( const Graphic
& rGraphic
, tools::Rectangle
& rResultRect
) const;
48 virtual void Paint(vcl::RenderContext
& rRenderContext
, const tools::Rectangle
& rRect
) override
;
49 virtual void SetDrawingArea(weld::DrawingArea
* pDrawingArea
) override
;
50 virtual bool MouseButtonDown(const MouseEvent
& rMEvt
) override
;
51 virtual bool Command(const CommandEvent
& rCEvt
) override
;
52 virtual bool KeyInput( const KeyEvent
& rKEvt
) override
;
56 GalleryPreview(GalleryBrowser1
* pParent
, std::unique_ptr
<weld::ScrolledWindow
> xScrolledWindow
);
57 void SetTheme(GalleryTheme
* pTheme
) { mpTheme
= pTheme
; }
58 virtual ~GalleryPreview() override
;
60 virtual bool StartDrag() override
;
62 virtual void Show() override
;
63 virtual void Hide() override
;
65 void SetGraphic( const Graphic
& rGraphic
) { aGraphicObj
.SetGraphic( rGraphic
); }
66 static void PreviewMedia( const INetURLObject
& rURL
);
69 class SVXCORE_DLLPUBLIC DialogGalleryPreview final
: public weld::CustomWidgetController
72 GraphicObject aGraphicObj
;
73 tools::Rectangle aPreviewRect
;
75 SVX_DLLPRIVATE
bool ImplGetGraphicCenterRect( const Graphic
& rGraphic
, tools::Rectangle
& rResultRect
) const;
77 SVX_DLLPRIVATE
virtual void Paint(vcl::RenderContext
& rRenderContext
, const tools::Rectangle
& rRect
) override
;
81 DialogGalleryPreview();
83 virtual void SetDrawingArea(weld::DrawingArea
* pDrawingArea
) override
;
84 void SetGraphic( const Graphic
& rGraphic
) { aGraphicObj
.SetGraphic( rGraphic
); }
85 bool SetGraphic( const INetURLObject
& );
88 class GalleryIconView final
: public ValueSet
91 std::unique_ptr
<GalleryDragDrop
> mxDragDropTargetHelper
;
93 GalleryBrowser1
* mpParent
;
94 GalleryTheme
* mpTheme
;
97 virtual void UserDraw( const UserDrawEvent
& rUDEvt
) override
;
100 virtual bool MouseButtonDown( const MouseEvent
& rMEvt
) override
;
101 virtual bool Command( const CommandEvent
& rCEvt
) override
;
102 virtual bool KeyInput( const KeyEvent
& rKEvt
) override
;
104 virtual void SetDrawingArea(weld::DrawingArea
* pDrawingArea
) override
;
108 GalleryIconView(GalleryBrowser1
* pParent
, std::unique_ptr
<weld::ScrolledWindow
> xScrolledWindow
);
109 void SetTheme(GalleryTheme
* pTheme
) { mpTheme
= pTheme
; }
110 virtual ~GalleryIconView() override
;
112 virtual bool StartDrag() override
;
114 static void drawTransparenceBackground(vcl::RenderContext
& rOut
, const Point
& rPos
, const Size
& rSize
);
117 #endif // INCLUDED_SVX_GALCTRL_HXX
119 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */