1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_SVX_BMPMASK_HXX
20 #define INCLUDED_SVX_BMPMASK_HXX
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>
29 #include <vcl/animate/Animation.hxx>
30 #include <vcl/bitmapex.hxx>
31 #include <vcl/gdimtf.hxx>
32 #include <vcl/graph.hxx>
35 namespace vcl
{ class Window
; }
36 namespace weld
{ class CustomWeld
; }
41 /*************************************************************************
43 |* class SvxBmpMaskSelectItem
45 \************************************************************************/
48 class SvxBmpMaskSelectItem final
: public SfxControllerItem
52 virtual void StateChangedAtToolBoxControl( sal_uInt16 nSID
, SfxItemState eState
,
53 const SfxPoolItem
* pState
) override
;
56 SvxBmpMaskSelectItem( SvxBmpMask
& rMask
,
57 SfxBindings
& rBindings
);
60 /*************************************************************************
62 |* Derivative from SfxChildWindow as 'container' for Float
64 \************************************************************************/
66 class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxBmpMaskChildWindow final
: public SfxChildWindow
69 SvxBmpMaskChildWindow( vcl::Window
*,
70 sal_uInt16
, SfxBindings
*,
73 SFX_DECL_CHILDWINDOW_WITHID(SvxBmpMaskChildWindow
);
76 /*************************************************************************
80 \************************************************************************/
87 class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxBmpMask final
: public SfxDockingWindow
89 friend class MaskData
;
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
;
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
;
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
;
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
;
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
;
121 std::unique_ptr
<weld::CheckButton
> m_xCbxTrans
;
122 std::unique_ptr
<ColorListBox
> m_xLbColorTrans
;
124 std::unique_ptr
<MaskData
> m_xData
;
127 SvxBmpMaskSelectItem aSelItem
;
129 virtual bool Close() override
;
131 sal_uInt16
InitColorArrays( Color
* pSrcCols
, Color
* pDstCols
,
134 void ImpMask( BitmapEx
& rBitmap
);
135 GDIMetaFile
ImpMask( const GDIMetaFile
& rMtf
);
136 Animation
ImpMask( const Animation
& rAnimation
);
137 BitmapEx
ImpMaskTransparent( const BitmapEx
& rBitmapEx
,
139 const sal_uInt8 nTol
);
141 GDIMetaFile
GetMetaFile(const Graphic
& rGraphic
);
143 static Animation
ImpReplaceTransparency( const Animation
& rAnim
,
144 const Color
& rColor
);
145 static GDIMetaFile
ImpReplaceTransparency( const GDIMetaFile
& rMtf
,
146 const Color
& rColor
);
150 SvxBmpMask(SfxBindings
*pBindinx
, SfxChildWindow
*pCW
, vcl::Window
* pParent
);
151 virtual ~SvxBmpMask() override
;
152 virtual void dispose() override
;
154 void SetColor( const Color
& rColor
);
155 void PipetteClicked();
157 void SetExecState( bool bEnable
);
159 Graphic
Mask( const Graphic
& rGraphic
);
161 bool IsEyedropping() const;
163 void onSelect( const MaskSet
* pSet
);
167 /** Set names for accessible objects. This is necessary for objects
168 like the source color checkboxes which initially have no name and
169 for which the description would be read by AT.
171 SVX_DLLPRIVATE
void SetAccessibleNames();
174 #endif // INCLUDED_SVX_BMPMASK_HXX
176 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */