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>
33 #include <vcl/vclptr.hxx>
36 namespace vcl
{ class Window
; }
45 /*************************************************************************
47 |* class SvxBmpMaskSelectItem
49 \************************************************************************/
52 class SvxBmpMaskSelectItem final
: public SfxControllerItem
56 virtual void StateChanged( sal_uInt16 nSID
, SfxItemState eState
,
57 const SfxPoolItem
* pState
) override
;
60 SvxBmpMaskSelectItem( SvxBmpMask
& rMask
,
61 SfxBindings
& rBindings
);
64 /*************************************************************************
66 |* Derivative from SfxChildWindow as 'container' for Float
68 \************************************************************************/
70 class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxBmpMaskChildWindow final
: public SfxChildWindow
73 SvxBmpMaskChildWindow( vcl::Window
*,
74 sal_uInt16
, SfxBindings
*,
77 SFX_DECL_CHILDWINDOW_WITHID(SvxBmpMaskChildWindow
);
80 /*************************************************************************
84 \************************************************************************/
89 class SvxColorListBox
;
91 class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxBmpMask
: public SfxDockingWindow
93 friend class MaskData
;
96 VclPtr
<ToolBox
> m_pTbxPipette
;
97 VclPtr
<BmpColorWindow
> m_pCtlPipette
;
98 VclPtr
<PushButton
> m_pBtnExec
;
100 VclPtr
<CheckBox
> m_pCbx1
;
101 VclPtr
<MaskSet
> m_pQSet1
;
102 VclPtr
<MetricField
> m_pSp1
;
103 VclPtr
<SvxColorListBox
> m_pLbColor1
;
105 VclPtr
<CheckBox
> m_pCbx2
;
106 VclPtr
<MaskSet
> m_pQSet2
;
107 VclPtr
<MetricField
> m_pSp2
;
108 VclPtr
<SvxColorListBox
> m_pLbColor2
;
110 VclPtr
<CheckBox
> m_pCbx3
;
111 VclPtr
<MaskSet
> m_pQSet3
;
112 VclPtr
<MetricField
> m_pSp3
;
113 VclPtr
<SvxColorListBox
> m_pLbColor3
;
115 VclPtr
<CheckBox
> m_pCbx4
;
116 VclPtr
<MaskSet
> m_pQSet4
;
117 VclPtr
<MetricField
> m_pSp4
;
118 VclPtr
<SvxColorListBox
> m_pLbColor4
;
120 std::unique_ptr
<MaskData
> pData
;
121 VclPtr
<CheckBox
> m_pCbxTrans
;
122 VclPtr
<SvxColorListBox
> m_pLbColorTrans
;
125 SvxBmpMaskSelectItem aSelItem
;
127 virtual bool Close() override
;
129 sal_uInt16
InitColorArrays( Color
* pSrcCols
, Color
* pDstCols
,
132 void ImpMask( BitmapEx
& rBitmap
);
133 GDIMetaFile
ImpMask( const GDIMetaFile
& rMtf
);
134 Animation
ImpMask( const Animation
& rAnimation
);
135 BitmapEx
ImpMaskTransparent( const BitmapEx
& rBitmapEx
,
137 const sal_uInt8 nTol
);
139 GDIMetaFile
GetMetaFile(const Graphic
& rGraphic
);
141 static Animation
ImpReplaceTransparency( const Animation
& rAnim
,
142 const Color
& rColor
);
143 static GDIMetaFile
ImpReplaceTransparency( const GDIMetaFile
& rMtf
,
144 const Color
& rColor
);
148 SvxBmpMask(SfxBindings
*pBindinx
, SfxChildWindow
*pCW
, vcl::Window
* pParent
);
149 virtual ~SvxBmpMask() override
;
150 virtual void dispose() override
;
152 void SetColor( const Color
& rColor
);
153 void PipetteClicked();
155 void SetExecState( bool bEnable
);
157 Graphic
Mask( const Graphic
& rGraphic
);
159 bool IsEyedropping() const;
161 void onSelect( MaskSet
* pSet
);
165 /** Set names for accessible objects. This is necessary for objects
166 like the source color checkboxes which initially have no name and
167 for which the description would be read by AT.
169 SVX_DLLPRIVATE
void SetAccessibleNames();
172 #endif // INCLUDED_SVX_BMPMASK_HXX
174 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */