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