LibreOffice Module svx (master) 1
galctrl.hxx
Go to the documentation of this file.
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/graph.hxx>
24#include <vcl/customweld.hxx>
25#include <svtools/valueset.hxx>
26#include <vcl/GraphicObject.hxx>
27#include <svx/svxdllapi.h>
28
29class GalleryDragDrop;
30class GalleryTheme;
31class GalleryBrowser2;
32class INetURLObject;
33
35{
36private:
37
38 std::unique_ptr<GalleryDragDrop> mxDragDropTargetHelper;
39 std::unique_ptr<weld::ScrolledWindow> mxScrolledWindow;
44
45 bool ImplGetGraphicCenterRect( const Graphic& rGraphic, tools::Rectangle& rResultRect ) const;
46
47 // Window
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;
53
54public:
55
56 GalleryPreview(GalleryBrowser2* pParent, std::unique_ptr<weld::ScrolledWindow> xScrolledWindow);
57 void SetTheme(GalleryTheme* pTheme) { mpTheme = pTheme; }
58 virtual ~GalleryPreview() override;
59
60 virtual bool StartDrag() override;
61
62 virtual void Show() override;
63 virtual void Hide() override;
64
65 void SetGraphic( const Graphic& rGraphic ) { aGraphicObj.SetGraphic( rGraphic ); }
66 static void PreviewMedia( const INetURLObject& rURL );
67};
68
70{
71private:
74
75 SVX_DLLPRIVATE bool ImplGetGraphicCenterRect( const Graphic& rGraphic, tools::Rectangle& rResultRect ) const;
76
77 SVX_DLLPRIVATE virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
78
79public:
80
82
83 virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
84 void SetGraphic( const Graphic& rGraphic ) { aGraphicObj.SetGraphic( rGraphic ); }
85 bool SetGraphic( const INetURLObject& );
86};
87
88class GalleryIconView final : public ValueSet
89{
90private:
91 std::unique_ptr<GalleryDragDrop> mxDragDropTargetHelper;
92
95
96 // ValueSet
97 virtual void UserDraw( const UserDrawEvent& rUDEvt ) override;
98
99 // Window
100 virtual bool MouseButtonDown( const MouseEvent& rMEvt ) override;
101 virtual bool Command( const CommandEvent& rCEvt ) override;
102 virtual bool KeyInput( const KeyEvent& rKEvt ) override;
103
104 virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
105
106public:
107
108 GalleryIconView(GalleryBrowser2* pParent, std::unique_ptr<weld::ScrolledWindow> xScrolledWindow);
109 void SetTheme(GalleryTheme* pTheme) { mpTheme = pTheme; }
110 virtual ~GalleryIconView() override;
111
112 virtual bool StartDrag() override;
113
114 static void drawTransparenceBackground(vcl::RenderContext& rOut, const Point& rPos, const Size& rSize);
115};
116
117#endif // INCLUDED_SVX_GALCTRL_HXX
118
119/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void SetGraphic(const Graphic &rGraphic)
Definition: galctrl.hxx:84
GraphicObject aGraphicObj
Definition: galctrl.hxx:72
tools::Rectangle aPreviewRect
Definition: galctrl.hxx:73
virtual void UserDraw(const UserDrawEvent &rUDEvt) override
Definition: galctrl.cxx:312
virtual bool Command(const CommandEvent &rCEvt) override
Definition: galctrl.cxx:383
GalleryIconView(GalleryBrowser2 *pParent, std::unique_ptr< weld::ScrolledWindow > xScrolledWindow)
Definition: galctrl.cxx:286
GalleryTheme * mpTheme
Definition: galctrl.hxx:94
GalleryBrowser2 * mpParent
Definition: galctrl.hxx:93
virtual bool StartDrag() override
Definition: galctrl.cxx:402
static void drawTransparenceBackground(vcl::RenderContext &rOut, const Point &rPos, const Size &rSize)
Definition: galctrl.cxx:276
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea) override
Definition: galctrl.cxx:297
virtual bool KeyInput(const KeyEvent &rKEvt) override
Definition: galctrl.cxx:395
virtual bool MouseButtonDown(const MouseEvent &rMEvt) override
Definition: galctrl.cxx:373
void SetTheme(GalleryTheme *pTheme)
Definition: galctrl.hxx:109
virtual ~GalleryIconView() override
Definition: galctrl.cxx:293
std::unique_ptr< GalleryDragDrop > mxDragDropTargetHelper
Definition: galctrl.hxx:91
virtual bool Command(const CommandEvent &rCEvt) override
Definition: galctrl.cxx:138
virtual bool KeyInput(const KeyEvent &rKEvt) override
Definition: galctrl.cxx:148
virtual void Show() override
Definition: galctrl.cxx:45
virtual bool MouseButtonDown(const MouseEvent &rMEvt) override
Definition: galctrl.cxx:131
virtual bool StartDrag() override
Definition: galctrl.cxx:191
virtual void Hide() override
Definition: galctrl.cxx:51
tools::Rectangle aPreviewRect
Definition: galctrl.hxx:41
virtual ~GalleryPreview() override
Definition: galctrl.cxx:57
std::unique_ptr< weld::ScrolledWindow > mxScrolledWindow
Definition: galctrl.hxx:39
static void PreviewMedia(const INetURLObject &rURL)
Definition: galctrl.cxx:198
GalleryBrowser2 * mpParent
Definition: galctrl.hxx:42
GraphicObject aGraphicObj
Definition: galctrl.hxx:40
GalleryTheme * mpTheme
Definition: galctrl.hxx:43
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
Definition: galctrl.cxx:114
void SetTheme(GalleryTheme *pTheme)
Definition: galctrl.hxx:57
std::unique_ptr< GalleryDragDrop > mxDragDropTargetHelper
Definition: galctrl.hxx:38
bool ImplGetGraphicCenterRect(const Graphic &rGraphic, tools::Rectangle &rResultRect) const
Definition: galctrl.cxx:109
void SetGraphic(const Graphic &rGraphic)
Definition: galctrl.hxx:65
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea) override
Definition: galctrl.cxx:61
GalleryPreview(GalleryBrowser2 *pParent, std::unique_ptr< weld::ScrolledWindow > xScrolledWindow)
Definition: galctrl.cxx:38
void SetGraphic(const Graphic &rGraphic)
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea)
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect)=0
#define SVX_DLLPRIVATE
Definition: svxdllapi.h:30
#define SVXCORE_DLLPUBLIC
Definition: svxdllapi.h:35