LibreOffice Module cui (master) 1
cuigrfflt.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#pragma once
21
22#include <vcl/timer.hxx>
23#include <svx/dlgctrl.hxx>
24#include <svx/rectenum.hxx>
25
27{
28private:
35 double mfScaleX;
36 double mfScaleY;
37
38 virtual void Paint(vcl::RenderContext& rRenderContext, const ::tools::Rectangle& rRect) override;
39 virtual void Resize() override;
40
41 void ScaleImageToFit();
42
43public:
45 virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
46 void init(const Graphic* pOrigGraphic, const Link<LinkParamNone*,void>& rLink)
47 {
48 mpOrigGraphic = pOrigGraphic;
49 maModifyHdl = rLink;
53 }
54
55 void SetPreview(const Graphic& rGraphic);
56 const Graphic& GetScaledOriginal() const { return maScaledOrig; }
57 double GetScaleX() const { return mfScaleX; }
58 double GetScaleY() const { return mfScaleY; }
60};
61
63{
64private:
65
69
70 DECL_LINK( ImplPreviewTimeoutHdl, Timer *, void );
71 DECL_LINK( ImplModifyHdl, LinkParamNone*, void);
72
74 std::unique_ptr<weld::CustomWeld> mxPreview;
75
76protected:
79
80public:
81
82 GraphicFilterDialog(weld::Window* pParent, const OUString& rUIXMLDescription, const OUString& rID, const Graphic& rGraphic);
83 virtual Graphic GetFilteredGraphic(const Graphic& rGraphic, double fScaleX, double fScaleY) = 0;
84};
85
87{
88private:
89 std::unique_ptr<weld::SpinButton> mxMtrRadius;
90 DECL_LINK(EditModifyHdl, weld::SpinButton&, void);
91
92public:
93
94 GraphicFilterSmooth(weld::Window* pParent, const Graphic& rGraphic, double nRadius);
95 virtual Graphic GetFilteredGraphic( const Graphic& rGraphic, double fScaleX, double fScaleY ) override;
96};
97
99{
100private:
101 std::unique_ptr<weld::MetricSpinButton> mxMtrWidth;
102 std::unique_ptr<weld::MetricSpinButton> mxMtrHeight;
103 std::unique_ptr<weld::CheckButton> mxCbxEdges;
104 DECL_LINK(CheckBoxModifyHdl, weld::Toggleable&, void);
105 DECL_LINK(EditModifyHdl, weld::MetricSpinButton&, void);
106public:
107
108 GraphicFilterMosaic(weld::Window* pParent, const Graphic& rGraphic,
109 sal_uInt16 nTileWidth, sal_uInt16 nTileHeight, bool bEnhanceEdges);
110
111 virtual Graphic GetFilteredGraphic( const Graphic& rGraphic, double fScaleX, double fScaleY ) override;
112 bool IsEnhanceEdges() const { return mxCbxEdges->get_active(); }
113};
114
116{
117private:
118 std::unique_ptr<weld::MetricSpinButton> mxMtrThreshold;
119 std::unique_ptr<weld::CheckButton> mxCbxInvert;
120 DECL_LINK(CheckBoxModifyHdl, weld::Toggleable&, void);
121 DECL_LINK(EditModifyHdl, weld::MetricSpinButton&, void);
122
123public:
124 GraphicFilterSolarize(weld::Window* pParent, const Graphic& rGraphic,
125 sal_uInt8 nGreyThreshold, bool bInvert);
126 virtual Graphic GetFilteredGraphic( const Graphic& rGraphic, double fScaleX, double fScaleY ) override;
127 bool IsInvert() const { return mxCbxInvert->get_active(); }
128};
129
131{
132private:
133 std::unique_ptr<weld::MetricSpinButton> mxMtrSepia;
134 DECL_LINK(EditModifyHdl, weld::MetricSpinButton&, void);
135public:
136 GraphicFilterSepia(weld::Window* pParent, const Graphic& rGraphic,
137 sal_uInt16 nSepiaPercent);
138 virtual Graphic GetFilteredGraphic( const Graphic& rGraphic, double fScaleX, double fScaleY ) override;
139};
140
142{
143private:
144 std::unique_ptr<weld::SpinButton> mxNumPoster;
145 DECL_LINK(EditModifyHdl, weld::SpinButton&, void);
146public:
147 GraphicFilterPoster(weld::Window* pParent, const Graphic& rGraphic,
148 sal_uInt16 nPosterColorCount);
149 virtual Graphic GetFilteredGraphic( const Graphic& rGraphic, double fScaleX, double fScaleY ) override;
150};
151
153{
154private:
156 virtual bool MouseButtonDown( const MouseEvent& rEvt ) override;
157 virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
158public:
160 : SvxRectCtl(nullptr)
161 {
162 }
163
164 void SetModifyHdl( const Link<LinkParamNone*,void>& rHdl ) { maModifyHdl = rHdl; }
165};
166
168{
169private:
171 std::unique_ptr<weld::CustomWeld> mxCtlLight;
172public:
173 GraphicFilterEmboss(weld::Window* pParent, const Graphic& rGraphic,
174 RectPoint eLightSource);
175 virtual ~GraphicFilterEmboss() override;
176
177 virtual Graphic GetFilteredGraphic(const Graphic& rGraphic, double fScaleX, double fScaleY) override;
178};
179
180/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void Resize() override
Definition: cuigrfflt.cxx:120
const Graphic * mpOrigGraphic
Definition: cuigrfflt.hxx:29
Link< LinkParamNone *, void > maModifyHdl
Definition: cuigrfflt.hxx:32
double GetScaleX() const
Definition: cuigrfflt.hxx:57
double GetScaleY() const
Definition: cuigrfflt.hxx:58
void SetPreview(const Graphic &rGraphic)
Definition: cuigrfflt.cxx:71
void init(const Graphic *pOrigGraphic, const Link< LinkParamNone *, void > &rLink)
Definition: cuigrfflt.hxx:46
virtual void Paint(vcl::RenderContext &rRenderContext, const ::tools::Rectangle &rRect) override
Definition: cuigrfflt.cxx:48
const Size & GetGraphicSizePixel() const
Definition: cuigrfflt.hxx:59
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea) override
Definition: cuigrfflt.cxx:40
const Graphic & GetScaledOriginal() const
Definition: cuigrfflt.hxx:56
void SetModifyHdl(const Link< LinkParamNone *, void > &rHdl)
Definition: cuigrfflt.hxx:164
virtual bool MouseButtonDown(const MouseEvent &rEvt) override
Definition: cuigrfflt.cxx:398
Link< LinkParamNone *, void > maModifyHdl
Definition: cuigrfflt.hxx:155
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea) override
Definition: cuigrfflt.cxx:410
CuiGraphicPreviewWindow maPreview
Definition: cuigrfflt.hxx:73
const Link< LinkParamNone *, void > & GetModifyHdl() const
Definition: cuigrfflt.hxx:77
virtual Graphic GetFilteredGraphic(const Graphic &rGraphic, double fScaleX, double fScaleY)=0
GraphicFilterDialog(weld::Window *pParent, const OUString &rUIXMLDescription, const OUString &rID, const Graphic &rGraphic)
Definition: cuigrfflt.cxx:126
DECL_LINK(ImplPreviewTimeoutHdl, Timer *, void)
const Size & GetGraphicSizePixel() const
Definition: cuigrfflt.hxx:78
Link< LinkParamNone *, void > maModifyHdl
Definition: cuigrfflt.hxx:67
DECL_LINK(ImplModifyHdl, LinkParamNone *, void)
std::unique_ptr< weld::CustomWeld > mxPreview
Definition: cuigrfflt.hxx:74
virtual ~GraphicFilterEmboss() override
Definition: cuigrfflt.cxx:427
std::unique_ptr< weld::CustomWeld > mxCtlLight
Definition: cuigrfflt.hxx:171
EmbossControl maCtlLight
Definition: cuigrfflt.hxx:170
virtual Graphic GetFilteredGraphic(const Graphic &rGraphic, double fScaleX, double fScaleY) override
Definition: cuigrfflt.cxx:431
GraphicFilterEmboss(weld::Window *pParent, const Graphic &rGraphic, RectPoint eLightSource)
Definition: cuigrfflt.cxx:417
std::unique_ptr< weld::MetricSpinButton > mxMtrWidth
Definition: cuigrfflt.hxx:101
bool IsEnhanceEdges() const
Definition: cuigrfflt.hxx:112
std::unique_ptr< weld::CheckButton > mxCbxEdges
Definition: cuigrfflt.hxx:103
GraphicFilterMosaic(weld::Window *pParent, const Graphic &rGraphic, sal_uInt16 nTileWidth, sal_uInt16 nTileHeight, bool bEnhanceEdges)
Definition: cuigrfflt.cxx:158
virtual Graphic GetFilteredGraphic(const Graphic &rGraphic, double fScaleX, double fScaleY) override
Definition: cuigrfflt.cxx:189
DECL_LINK(CheckBoxModifyHdl, weld::Toggleable &, void)
std::unique_ptr< weld::MetricSpinButton > mxMtrHeight
Definition: cuigrfflt.hxx:102
DECL_LINK(EditModifyHdl, weld::MetricSpinButton &, void)
GraphicFilterPoster(weld::Window *pParent, const Graphic &rGraphic, sal_uInt16 nPosterColorCount)
Definition: cuigrfflt.cxx:360
std::unique_ptr< weld::SpinButton > mxNumPoster
Definition: cuigrfflt.hxx:144
DECL_LINK(EditModifyHdl, weld::SpinButton &, void)
virtual Graphic GetFilteredGraphic(const Graphic &rGraphic, double fScaleX, double fScaleY) override
Definition: cuigrfflt.cxx:375
DECL_LINK(EditModifyHdl, weld::MetricSpinButton &, void)
std::unique_ptr< weld::MetricSpinButton > mxMtrSepia
Definition: cuigrfflt.hxx:133
virtual Graphic GetFilteredGraphic(const Graphic &rGraphic, double fScaleX, double fScaleY) override
Definition: cuigrfflt.cxx:337
GraphicFilterSepia(weld::Window *pParent, const Graphic &rGraphic, sal_uInt16 nSepiaPercent)
Definition: cuigrfflt.cxx:323
virtual Graphic GetFilteredGraphic(const Graphic &rGraphic, double fScaleX, double fScaleY) override
Definition: cuigrfflt.cxx:240
DECL_LINK(EditModifyHdl, weld::SpinButton &, void)
GraphicFilterSmooth(weld::Window *pParent, const Graphic &rGraphic, double nRadius)
Definition: cuigrfflt.cxx:226
std::unique_ptr< weld::SpinButton > mxMtrRadius
Definition: cuigrfflt.hxx:89
bool IsInvert() const
Definition: cuigrfflt.hxx:127
DECL_LINK(CheckBoxModifyHdl, weld::Toggleable &, void)
DECL_LINK(EditModifyHdl, weld::MetricSpinButton &, void)
GraphicFilterSolarize(weld::Window *pParent, const Graphic &rGraphic, sal_uInt8 nGreyThreshold, bool bInvert)
Definition: cuigrfflt.cxx:267
std::unique_ptr< weld::MetricSpinButton > mxMtrThreshold
Definition: cuigrfflt.hxx:118
std::unique_ptr< weld::CheckButton > mxCbxInvert
Definition: cuigrfflt.hxx:119
virtual Graphic GetFilteredGraphic(const Graphic &rGraphic, double fScaleX, double fScaleY) override
Definition: cuigrfflt.cxx:290
Size GetPrefSize() const
MapMode GetPrefMapMode() const
SAL_WARN_UNUSED_RESULT Point LogicToPixel(const Point &rLogicPt) const
weld::DrawingArea * GetDrawingArea() const
virtual OutputDevice & get_ref_device()=0
RectPoint
unsigned char sal_uInt8