LibreOffice Module svx (master)  1
bmpmask.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 #ifndef INCLUDED_SVX_BMPMASK_HXX
20 #define INCLUDED_SVX_BMPMASK_HXX
21 
22 #include <sal/types.h>
23 #include <sfx2/childwin.hxx>
24 #include <sfx2/ctrlitem.hxx>
25 #include <sfx2/dockwin.hxx>
26 #include <svl/poolitem.hxx>
27 #include <svx/svxdllapi.h>
28 #include <tools/color.hxx>
30 #include <vcl/bitmapex.hxx>
31 #include <vcl/gdimtf.hxx>
32 #include <vcl/graph.hxx>
33 #include <memory>
34 
35 namespace vcl { class Window; }
36 namespace weld { class CustomWeld; }
37 
38 class SfxBindings;
39 class SfxModule;
40 
41 /*************************************************************************
42 |*
43 |* class SvxBmpMaskSelectItem
44 |*
45 \************************************************************************/
46 class SvxBmpMask;
47 
49 {
51 
52  virtual void StateChangedAtToolBoxControl( sal_uInt16 nSID, SfxItemState eState,
53  const SfxPoolItem* pState ) override;
54 
55 public:
57  SfxBindings& rBindings );
58 };
59 
60 /*************************************************************************
61 |*
62 |* Derivative from SfxChildWindow as 'container' for Float
63 |*
64 \************************************************************************/
65 
67 {
68  public:
70  sal_uInt16, SfxBindings*,
71  SfxChildWinInfo* );
72 
74 };
75 
76 /*************************************************************************
77 |*
78 |* class SvxBmpMask
79 |*
80 \************************************************************************/
81 
82 class MaskData;
83 class MaskSet;
84 class BmpColorWindow;
85 class ColorListBox;
86 
88 {
89  friend class MaskData;
90  friend class MaskSet;
91 
92  std::unique_ptr<weld::Toolbar> m_xTbxPipette;
93  std::unique_ptr<BmpColorWindow> m_xCtlPipette;
94  std::unique_ptr<weld::CustomWeld> m_xCtlPipetteWin;
95  std::unique_ptr<weld::Button> m_xBtnExec;
96 
97  std::unique_ptr<weld::CheckButton> m_xCbx1;
98  std::unique_ptr<MaskSet> m_xQSet1;
99  std::unique_ptr<weld::CustomWeld> m_xQSetWin1;
100  std::unique_ptr<weld::MetricSpinButton> m_xSp1;
101  std::unique_ptr<ColorListBox> m_xLbColor1;
102 
103  std::unique_ptr<weld::CheckButton> m_xCbx2;
104  std::unique_ptr<MaskSet> m_xQSet2;
105  std::unique_ptr<weld::CustomWeld> m_xQSetWin2;
106  std::unique_ptr<weld::MetricSpinButton> m_xSp2;
107  std::unique_ptr<ColorListBox> m_xLbColor2;
108 
109  std::unique_ptr<weld::CheckButton> m_xCbx3;
110  std::unique_ptr<MaskSet> m_xQSet3;
111  std::unique_ptr<weld::CustomWeld> m_xQSetWin3;
112  std::unique_ptr<weld::MetricSpinButton> m_xSp3;
113  std::unique_ptr<ColorListBox> m_xLbColor3;
114 
115  std::unique_ptr<weld::CheckButton> m_xCbx4;
116  std::unique_ptr<MaskSet> m_xQSet4;
117  std::unique_ptr<weld::CustomWeld> m_xQSetWin4;
118  std::unique_ptr<weld::MetricSpinButton> m_xSp4;
119  std::unique_ptr<ColorListBox> m_xLbColor4;
120 
121  std::unique_ptr<weld::CheckButton> m_xCbxTrans;
122  std::unique_ptr<ColorListBox> m_xLbColorTrans;
123 
124  std::unique_ptr<MaskData> m_xData;
125 
128 
129  virtual bool Close() override;
130 
131  sal_uInt16 InitColorArrays( Color* pSrcCols, Color* pDstCols,
132  sal_uInt8* pTols );
133 
134  void ImpMask( BitmapEx& rBitmap );
135  GDIMetaFile ImpMask( const GDIMetaFile& rMtf );
136  Animation ImpMask( const Animation& rAnimation );
137  BitmapEx ImpMaskTransparent( const BitmapEx& rBitmapEx,
138  const Color& rColor,
139  const sal_uInt8 nTol );
140 
141  GDIMetaFile GetMetaFile(const Graphic& rGraphic);
142 
143  static Animation ImpReplaceTransparency( const Animation& rAnim,
144  const Color& rColor );
145  static GDIMetaFile ImpReplaceTransparency( const GDIMetaFile& rMtf,
146  const Color& rColor );
147 
148 public:
149 
150  SvxBmpMask(SfxBindings *pBindinx, SfxChildWindow *pCW, vcl::Window* pParent);
151  virtual ~SvxBmpMask() override;
152  virtual void dispose() override;
153 
154  void SetColor( const Color& rColor );
155  void PipetteClicked();
156 
157  void SetExecState( bool bEnable );
158 
159  Graphic Mask( const Graphic& rGraphic );
160 
161  bool IsEyedropping() const;
162 
163  void onSelect( const MaskSet* pSet );
164 
165 private:
166 
171  SVX_DLLPRIVATE void SetAccessibleNames();
172 };
173 
174 #endif // INCLUDED_SVX_BMPMASK_HXX
175 
176 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::unique_ptr< weld::CheckButton > m_xCbxTrans
Definition: bmpmask.hxx:121
std::unique_ptr< weld::CheckButton > m_xCbx4
Definition: bmpmask.hxx:115
std::unique_ptr< weld::CheckButton > m_xCbx2
Definition: bmpmask.hxx:103
std::unique_ptr< weld::MetricSpinButton > m_xSp4
Definition: bmpmask.hxx:118
std::unique_ptr< weld::CustomWeld > m_xQSetWin4
Definition: bmpmask.hxx:117
std::unique_ptr< MaskSet > m_xQSet2
Definition: bmpmask.hxx:104
std::unique_ptr< MaskSet > m_xQSet4
Definition: bmpmask.hxx:116
std::unique_ptr< weld::CustomWeld > m_xCtlPipetteWin
Definition: bmpmask.hxx:94
#define SVX_DLLPUBLIC
Definition: svxdllapi.h:28
std::unique_ptr< weld::CheckButton > m_xCbx1
Definition: bmpmask.hxx:97
std::unique_ptr< weld::CustomWeld > m_xQSetWin3
Definition: bmpmask.hxx:111
std::unique_ptr< weld::MetricSpinButton > m_xSp2
Definition: bmpmask.hxx:106
std::unique_ptr< MaskData > m_xData
Definition: bmpmask.hxx:124
std::unique_ptr< weld::CustomWeld > m_xQSetWin2
Definition: bmpmask.hxx:105
std::unique_ptr< weld::CheckButton > m_xCbx3
Definition: bmpmask.hxx:109
std::unique_ptr< weld::CustomWeld > m_xQSetWin1
Definition: bmpmask.hxx:99
virtual bool Close() override
std::unique_ptr< ColorListBox > m_xLbColor1
Definition: bmpmask.hxx:101
std::unique_ptr< MaskSet > m_xQSet1
Definition: bmpmask.hxx:98
std::unique_ptr< weld::Toolbar > m_xTbxPipette
Definition: bmpmask.hxx:92
std::unique_ptr< weld::MetricSpinButton > m_xSp1
Definition: bmpmask.hxx:100
std::unique_ptr< weld::Button > m_xBtnExec
Definition: bmpmask.hxx:95
SvxBmpMaskSelectItem aSelItem
Definition: bmpmask.hxx:127
std::unique_ptr< BmpColorWindow > m_xCtlPipette
Definition: bmpmask.hxx:93
std::unique_ptr< ColorListBox > m_xLbColor3
Definition: bmpmask.hxx:113
void SetColor()
#define SAL_WARN_UNUSED
std::unique_ptr< ColorListBox > m_xLbColorTrans
Definition: bmpmask.hxx:122
SfxItemState
Color aPipetteColor
Definition: bmpmask.hxx:126
unsigned char sal_uInt8
SvxBmpMask & rBmpMask
Definition: bmpmask.hxx:50
std::unique_ptr< ColorListBox > m_xLbColor4
Definition: bmpmask.hxx:119
std::unique_ptr< weld::MetricSpinButton > m_xSp3
Definition: bmpmask.hxx:112
#define SFX_DECL_CHILDWINDOW_WITHID(Class)
std::unique_ptr< MaskSet > m_xQSet3
Definition: bmpmask.hxx:110
SvxBmpMaskSelectItem(SvxBmpMask &rMask, SfxBindings &rBindings)
Definition: _bmpmask.cxx:316
virtual void StateChangedAtToolBoxControl(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem *pState) override
Definition: _bmpmask.cxx:323
virtual void dispose() override
#define SVX_DLLPRIVATE
Definition: svxdllapi.h:30
std::unique_ptr< ColorListBox > m_xLbColor2
Definition: bmpmask.hxx:107