Branch libreoffice-5-0-4
[LibreOffice.git] / include / svx / bmpmask.hxx
blob81bdd06253cd7421e81a5898b199a9968332ab88
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 <sfx2/ctrlitem.hxx>
23 #include <sfx2/dockwin.hxx>
24 #include <vcl/toolbox.hxx>
25 #include <vcl/fixed.hxx>
26 #include <vcl/group.hxx>
27 #include <vcl/graph.hxx>
28 #include <svx/svxdllapi.h>
30 #include <svx/dlgctrl.hxx>
32 /*************************************************************************
34 |* class SvxBmpMaskSelectItem
36 \************************************************************************/
37 class SvxBmpMask;
39 class SvxBmpMaskSelectItem : public SfxControllerItem
41 private:
42 SvxBmpMask &rBmpMask;
44 protected:
45 virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
46 const SfxPoolItem* pState ) SAL_OVERRIDE;
48 public:
49 SvxBmpMaskSelectItem( sal_uInt16 nId, SvxBmpMask& rMask,
50 SfxBindings& rBindings );
53 /*************************************************************************
55 |* Derivative from SfxChildWindow as 'container' for Float
57 \************************************************************************/
59 class SVX_DLLPUBLIC SAL_WARN_UNUSED SvxBmpMaskChildWindow : public SfxChildWindow
61 public:
62 SvxBmpMaskChildWindow( vcl::Window*,
63 sal_uInt16, SfxBindings*,
64 SfxChildWinInfo* );
66 SFX_DECL_CHILDWINDOW_WITHID(SvxBmpMaskChildWindow);
69 /*************************************************************************
71 |* class SvxBmpMask
73 \************************************************************************/
75 class MaskData;
76 class MaskSet;
77 class ColorWindow;
79 class SVX_DLLPUBLIC SAL_WARN_UNUSED SvxBmpMask : public SfxDockingWindow
81 friend class MaskData;
82 friend class MaskSet;
84 VclPtr<ToolBox> m_pTbxPipette;
85 VclPtr<ColorWindow> m_pCtlPipette;
86 VclPtr<PushButton> m_pBtnExec;
88 VclPtr<CheckBox> m_pCbx1;
89 VclPtr<MaskSet> m_pQSet1;
90 VclPtr<MetricField> m_pSp1;
91 VclPtr<ColorLB> m_pLbColor1;
93 VclPtr<CheckBox> m_pCbx2;
94 VclPtr<MaskSet> m_pQSet2;
95 VclPtr<MetricField> m_pSp2;
96 VclPtr<ColorLB> m_pLbColor2;
98 VclPtr<CheckBox> m_pCbx3;
99 VclPtr<MaskSet> m_pQSet3;
100 VclPtr<MetricField> m_pSp3;
101 VclPtr<ColorLB> m_pLbColor3;
103 VclPtr<CheckBox> m_pCbx4;
104 VclPtr<MaskSet> m_pQSet4;
105 VclPtr<MetricField> m_pSp4;
106 VclPtr<ColorLB> m_pLbColor4;
108 MaskData* pData;
109 VclPtr<CheckBox> m_pCbxTrans;
110 VclPtr<ColorLB> m_pLbColorTrans;
112 XColorListRef pColLst;
113 Color aPipetteColor;
114 SvxBmpMaskSelectItem aSelItem;
116 virtual bool Close() SAL_OVERRIDE;
118 sal_uInt16 InitColorArrays( Color* pSrcCols, Color* pDstCols,
119 sal_uIntPtr* pTols );
121 Bitmap ImpMask( const Bitmap& rBitmap );
122 GDIMetaFile ImpMask( const GDIMetaFile& rMtf );
123 Animation ImpMask( const Animation& rAnimation );
124 BitmapEx ImpMaskTransparent( const BitmapEx& rBitmapEx,
125 const Color& rColor,
126 const long nTol );
127 static BitmapEx ImpReplaceTransparency( const BitmapEx& rBmpEx,
128 const Color& rColor );
129 static Animation ImpReplaceTransparency( const Animation& rAnim,
130 const Color& rColor );
131 static GDIMetaFile ImpReplaceTransparency( const GDIMetaFile& rMtf,
132 const Color& rColor );
134 public:
136 SvxBmpMask(SfxBindings *pBindinx, SfxChildWindow *pCW, vcl::Window* pParent);
137 virtual ~SvxBmpMask();
138 virtual void dispose() SAL_OVERRIDE;
140 void SetColor( const Color& rColor );
141 void PipetteClicked();
143 bool NeedsColorList() const;
144 void SetColorList( const XColorListRef &pColorList );
146 void SetExecState( bool bEnable );
148 Graphic Mask( const Graphic& rGraphic );
150 bool IsEyedropping() const;
152 void onSelect( MaskSet* pSet );
154 private:
156 /** Set names for accessible objects. This is necessary for objects
157 like the source color checkboxes which initially have no name and
158 for which the description would be read by AT.
160 SVX_DLLPRIVATE void SetAccessibleNames();
163 #endif // INCLUDED_SVX_BMPMASK_HXX
165 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */