Line data Source code
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 <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>
29 :
30 : #include <svx/dlgctrl.hxx>
31 :
32 : /*************************************************************************
33 : |*
34 : |* class SvxBmpMaskSelectItem
35 : |*
36 : \************************************************************************/
37 : class SvxBmpMask;
38 :
39 0 : class SvxBmpMaskSelectItem : public SfxControllerItem
40 : {
41 : private:
42 : SvxBmpMask &rBmpMask;
43 :
44 : protected:
45 : virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
46 : const SfxPoolItem* pState ) SAL_OVERRIDE;
47 :
48 : public:
49 : SvxBmpMaskSelectItem( sal_uInt16 nId, SvxBmpMask& rMask,
50 : SfxBindings& rBindings );
51 : };
52 :
53 : /*************************************************************************
54 : |*
55 : |* Derivative from SfxChildWindow as 'container' for Float
56 : |*
57 : \************************************************************************/
58 :
59 0 : class SVX_DLLPUBLIC SAL_WARN_UNUSED SvxBmpMaskChildWindow : public SfxChildWindow
60 : {
61 : public:
62 : SvxBmpMaskChildWindow( vcl::Window*,
63 : sal_uInt16, SfxBindings*,
64 : SfxChildWinInfo* );
65 :
66 : SFX_DECL_CHILDWINDOW_WITHID(SvxBmpMaskChildWindow);
67 : };
68 :
69 : /*************************************************************************
70 : |*
71 : |* class SvxBmpMask
72 : |*
73 : \************************************************************************/
74 :
75 : class MaskData;
76 : class MaskSet;
77 : class ColorWindow;
78 :
79 : class SVX_DLLPUBLIC SAL_WARN_UNUSED SvxBmpMask : public SfxDockingWindow
80 : {
81 : friend class MaskData;
82 : friend class MaskSet;
83 :
84 : VclPtr<ToolBox> m_pTbxPipette;
85 : VclPtr<ColorWindow> m_pCtlPipette;
86 : VclPtr<PushButton> m_pBtnExec;
87 :
88 : VclPtr<CheckBox> m_pCbx1;
89 : VclPtr<MaskSet> m_pQSet1;
90 : VclPtr<MetricField> m_pSp1;
91 : VclPtr<ColorLB> m_pLbColor1;
92 :
93 : VclPtr<CheckBox> m_pCbx2;
94 : VclPtr<MaskSet> m_pQSet2;
95 : VclPtr<MetricField> m_pSp2;
96 : VclPtr<ColorLB> m_pLbColor2;
97 :
98 : VclPtr<CheckBox> m_pCbx3;
99 : VclPtr<MaskSet> m_pQSet3;
100 : VclPtr<MetricField> m_pSp3;
101 : VclPtr<ColorLB> m_pLbColor3;
102 :
103 : VclPtr<CheckBox> m_pCbx4;
104 : VclPtr<MaskSet> m_pQSet4;
105 : VclPtr<MetricField> m_pSp4;
106 : VclPtr<ColorLB> m_pLbColor4;
107 :
108 : MaskData* pData;
109 : VclPtr<CheckBox> m_pCbxTrans;
110 : VclPtr<ColorLB> m_pLbColorTrans;
111 :
112 : XColorListRef pColLst;
113 : Color aPipetteColor;
114 : SvxBmpMaskSelectItem aSelItem;
115 :
116 : virtual bool Close() SAL_OVERRIDE;
117 :
118 : sal_uInt16 InitColorArrays( Color* pSrcCols, Color* pDstCols,
119 : sal_uIntPtr* pTols );
120 :
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 );
133 :
134 : public:
135 :
136 : SvxBmpMask(SfxBindings *pBindinx, SfxChildWindow *pCW, vcl::Window* pParent);
137 : virtual ~SvxBmpMask();
138 : virtual void dispose() SAL_OVERRIDE;
139 :
140 : void SetColor( const Color& rColor );
141 : void PipetteClicked();
142 :
143 : bool NeedsColorList() const;
144 : void SetColorList( const XColorListRef &pColorList );
145 :
146 : void SetExecState( bool bEnable );
147 :
148 : Graphic Mask( const Graphic& rGraphic );
149 :
150 : bool IsEyedropping() const;
151 :
152 : void onSelect( MaskSet* pSet );
153 :
154 : private:
155 :
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.
159 : */
160 : SVX_DLLPRIVATE void SetAccessibleNames();
161 : };
162 :
163 : #endif // INCLUDED_SVX_BMPMASK_HXX
164 :
165 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|