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 
29 class GalleryDragDrop;
30 class GalleryTheme;
31 class GalleryBrowser2;
32 class INetURLObject;
33 
35 {
36 private:
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 
54 public:
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 {
71 private:
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 
79 public:
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 
88 class GalleryIconView final : public ValueSet
89 {
90 private:
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 
106 public:
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: */
GraphicObject aGraphicObj
Definition: galctrl.hxx:72
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea) override
Definition: galctrl.cxx:61
GraphicObject aGraphicObj
Definition: galctrl.hxx:40
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
Definition: galctrl.cxx:114
virtual ~GalleryPreview() override
Definition: galctrl.cxx:57
virtual bool Command(const CommandEvent &rCEvt) override
Definition: galctrl.cxx:382
virtual bool MouseButtonDown(const MouseEvent &rMEvt) override
Definition: galctrl.cxx:131
virtual ~GalleryIconView() override
Definition: galctrl.cxx:292
tools::Rectangle aPreviewRect
Definition: galctrl.hxx:73
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea) override
Definition: galctrl.cxx:296
void SetGraphic(const Graphic &rGraphic)
Definition: galctrl.hxx:84
virtual bool KeyInput(const KeyEvent &rKEvt) override
Definition: galctrl.cxx:394
void SetTheme(GalleryTheme *pTheme)
Definition: galctrl.hxx:57
GalleryTheme * mpTheme
Definition: galctrl.hxx:94
virtual bool Command(const CommandEvent &rCEvt) override
Definition: galctrl.cxx:138
std::unique_ptr< GalleryDragDrop > mxDragDropTargetHelper
Definition: galctrl.hxx:91
void SetGraphic(const Graphic &rGraphic)
Definition: galctrl.hxx:65
GalleryIconView(GalleryBrowser2 *pParent, std::unique_ptr< weld::ScrolledWindow > xScrolledWindow)
Definition: galctrl.cxx:285
std::unique_ptr< weld::ScrolledWindow > mxScrolledWindow
Definition: galctrl.hxx:39
virtual bool KeyInput(const KeyEvent &rKEvt) override
Definition: galctrl.cxx:148
static void PreviewMedia(const INetURLObject &rURL)
Definition: galctrl.cxx:198
bool ImplGetGraphicCenterRect(const Graphic &rGraphic, tools::Rectangle &rResultRect) const
Definition: galctrl.cxx:109
static void drawTransparenceBackground(vcl::RenderContext &rOut, const Point &rPos, const Size &rSize)
Definition: galctrl.cxx:275
void SetTheme(GalleryTheme *pTheme)
Definition: galctrl.hxx:109
virtual void Hide() override
Definition: galctrl.cxx:51
void SetGraphic(const Graphic &rGraphic)
GalleryBrowser2 * mpParent
Definition: galctrl.hxx:42
virtual void Show() override
Definition: galctrl.cxx:45
#define SVXCORE_DLLPUBLIC
Definition: svxdllapi.h:35
GalleryTheme * mpTheme
Definition: galctrl.hxx:43
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea)
tools::Rectangle aPreviewRect
Definition: galctrl.hxx:41
virtual bool StartDrag() override
Definition: galctrl.cxx:191
virtual bool StartDrag() override
Definition: galctrl.cxx:401
std::unique_ptr< GalleryDragDrop > mxDragDropTargetHelper
Definition: galctrl.hxx:38
GalleryBrowser2 * mpParent
Definition: galctrl.hxx:93
GalleryPreview(GalleryBrowser2 *pParent, std::unique_ptr< weld::ScrolledWindow > xScrolledWindow)
Definition: galctrl.cxx:38
virtual bool MouseButtonDown(const MouseEvent &rMEvt) override
Definition: galctrl.cxx:372
#define SVX_DLLPRIVATE
Definition: svxdllapi.h:30
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect)=0
virtual void UserDraw(const UserDrawEvent &rUDEvt) override
Definition: galctrl.cxx:311