LibreOffice Module svx (master) 1
_bmpmask.cxx
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
20#include <vcl/event.hxx>
21#include <vcl/metaact.hxx>
22#include <vcl/virdev.hxx>
23#include <svtools/valueset.hxx>
24#include <svl/eitem.hxx>
25#include <sfx2/dispatch.hxx>
26#include <svtools/colrdlg.hxx>
27
28#include <svx/colorbox.hxx>
29#include <svx/dialmgr.hxx>
30#include <svx/bmpmask.hxx>
31#include <svx/strings.hrc>
32#include <svx/svxids.hrc>
33#include <memory>
34#include <helpids.h>
35
36#define OWN_CALLMODE SfxCallMode::ASYNCHRON | SfxCallMode::RECORD
37
38
39#define TEST_COLS() \
40{ \
41 nR = aCol.GetRed(); nG = aCol.GetGreen(); nB = aCol.GetBlue(); \
42 for( i = 0; i < nCount; i++ ) \
43 { \
44 if ( ( pMinR[i] <= nR ) && ( pMaxR[i] >= nR ) && \
45 ( pMinG[i] <= nG ) && ( pMaxG[i] >= nG ) && \
46 ( pMinB[i] <= nB ) && ( pMaxB[i] >= nB ) ) \
47 { \
48 aCol = pDstCols[i]; bReplace = true; break; \
49 } \
50 } \
51}
52
54
55class BmpColorWindow : public weld::CustomWidgetController
56{
58
59
60public:
61 explicit BmpColorWindow()
62 : aColor( COL_WHITE )
63 {
64 }
65
66 void SetColor( const Color& rColor )
67 {
68 aColor = rColor;
69 Invalidate();
70 }
71
72 virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
73
74 virtual void SetDrawingArea(weld::DrawingArea* pArea) override
75 {
76 Size aSize(pArea->get_ref_device().LogicToPixel(Size(43, 14), MapMode(MapUnit::MapAppFont)));
77 CustomWidgetController::SetDrawingArea(pArea);
78 pArea->set_size_request(aSize.Width(), aSize.Height());
79 SetOutputSizePixel(aSize);
80 }
81};
82
83class MaskSet : public ValueSet
84{
86
87public:
88 MaskSet(SvxBmpMask* pMask);
89 virtual void Select() override;
90 virtual bool KeyInput( const KeyEvent& rKEvt ) override;
91 virtual void GetFocus() override;
92 virtual void SetDrawingArea(weld::DrawingArea* pArea) override
93 {
94 Size aSize(pArea->get_ref_device().LogicToPixel(Size(24, 12), MapMode(MapUnit::MapAppFont)));
96 pArea->set_size_request(aSize.Width(), aSize.Height());
97 SetOutputSizePixel(aSize);
99 }
100 void onEditColor();
101};
102
104 : ValueSet(nullptr)
105 , pSvxBmpMask(pMask)
106{
107}
108
110{
112
113 pSvxBmpMask->onSelect( this );
114}
115
117{
119 SelectItem( 1 );
120 pSvxBmpMask->onSelect( this );
121}
122
123bool MaskSet::KeyInput( const KeyEvent& rKEvt )
124{
125 bool bRet = false;
126
127 vcl::KeyCode aCode = rKEvt.GetKeyCode();
128
129 // if the key has a modifier we don't care
130 if( aCode.GetModifier() )
131 {
132 bRet = ValueSet::KeyInput( rKEvt );
133 }
134 else
135 {
136 // check for keys that interests us
137 switch ( aCode.GetCode() )
138 {
139 case KEY_SPACE:
140 onEditColor();
141 bRet = true;
142 break;
143 default:
144 bRet = ValueSet::KeyInput( rKEvt );
145 }
146 }
147 return bRet;
148}
149
151{
152 SvColorDialog aColorDlg;
153
154 aColorDlg.SetColor(GetItemColor(1));
155
156 if (aColorDlg.Execute(pSvxBmpMask->GetFrameWeld()))
157 SetItemColor(1, aColorDlg.GetColor());
158}
159
161{
166
167public:
168 MaskData( SvxBmpMask* pBmpMask, SfxBindings& rBind );
169
170 bool IsCbxReady() const { return bIsReady; }
171 void SetExecState( bool bState ) { bExecState = bState; }
172 bool IsExecReady() const { return bExecState; }
173
174 DECL_LINK( PipetteHdl, const OUString&, void );
175 DECL_LINK( CbxHdl, weld::Toggleable&, void);
176 DECL_LINK( CbxTransHdl, weld::Toggleable&, void );
177 DECL_LINK( FocusLbHdl, weld::Widget&, void );
178 DECL_LINK(ExecHdl, weld::Button&, void);
179};
180
181
183
184 pMask ( pBmpMask ),
185 bIsReady ( false ),
186 bExecState ( false ),
187 rBindings ( rBind )
188
189{
190}
191
192IMPL_LINK( MaskData, PipetteHdl, const OUString&, rId, void )
193{
194 SfxBoolItem aBItem( SID_BMPMASK_PIPETTE,
195 pMask->m_xTbxPipette->get_item_active(rId) );
196
197 rBindings.GetDispatcher()->ExecuteList(SID_BMPMASK_PIPETTE, OWN_CALLMODE,
198 { &aBItem });
199}
200
201IMPL_LINK( MaskData, CbxHdl, weld::Toggleable&, rCbx, void )
202{
203 bIsReady = pMask->m_xCbx1->get_active() || pMask->m_xCbx2->get_active() ||
204 pMask->m_xCbx3->get_active() || pMask->m_xCbx4->get_active();
205
206 if ( bIsReady && IsExecReady() )
207 pMask->m_xBtnExec->set_sensitive(true);
208 else
209 pMask->m_xBtnExec->set_sensitive(false);
210
211 // When a checkbox is checked, the pipette is enabled
212 if ( !rCbx.get_active() )
213 return;
214
215 MaskSet* pSet = nullptr;
216
217 if (&rCbx == pMask->m_xCbx1.get())
218 pSet = pMask->m_xQSet1.get();
219 else if (&rCbx == pMask->m_xCbx2.get())
220 pSet = pMask->m_xQSet2.get();
221 else if (&rCbx == pMask->m_xCbx3.get())
222 pSet = pMask->m_xQSet3.get();
223 else // if ( &rCbx == pMask->m_xCbx4 )
224 pSet = pMask->m_xQSet4.get();
225
226 pSet->SelectItem( 1 );
227 pSet->Select();
228
229 pMask->m_xTbxPipette->set_item_active("pipette", true);
230 PipetteHdl("pipette");
231}
232
233IMPL_LINK( MaskData, CbxTransHdl, weld::Toggleable&, rCbx, void )
234{
235 bIsReady = rCbx.get_active();
236 if ( bIsReady )
237 {
238 pMask->m_xQSet1->Disable();
239 pMask->m_xQSet2->Disable();
240 pMask->m_xQSet3->Disable();
241 pMask->m_xQSet4->Disable();
242 pMask->m_xCtlPipette->Disable();
243 pMask->m_xCbx1->set_sensitive(false);
244 pMask->m_xSp1->set_sensitive(false);
245 pMask->m_xCbx2->set_sensitive(false);
246 pMask->m_xSp2->set_sensitive(false);
247 pMask->m_xCbx3->set_sensitive(false);
248 pMask->m_xSp3->set_sensitive(false);
249 pMask->m_xCbx4->set_sensitive(false);
250 pMask->m_xSp4->set_sensitive(false);
251 pMask->m_xTbxPipette->set_sensitive(false);
252
253 pMask->m_xLbColor1->set_sensitive(false);
254 pMask->m_xLbColor2->set_sensitive(false);
255 pMask->m_xLbColor3->set_sensitive(false);
256 pMask->m_xLbColor4->set_sensitive(false);
257 pMask->m_xLbColorTrans->set_sensitive(true);
258 }
259 else
260 {
261 pMask->m_xQSet1->Enable();
262 pMask->m_xQSet2->Enable();
263 pMask->m_xQSet3->Enable();
264 pMask->m_xQSet4->Enable();
265 pMask->m_xCtlPipette->Enable();
266 pMask->m_xCbx1->set_sensitive(true);
267 pMask->m_xSp1->set_sensitive(true);
268 pMask->m_xCbx2->set_sensitive(true);
269 pMask->m_xSp2->set_sensitive(true);
270 pMask->m_xCbx3->set_sensitive(true);
271 pMask->m_xSp3->set_sensitive(true);
272 pMask->m_xCbx4->set_sensitive(true);
273 pMask->m_xSp4->set_sensitive(true);
274 pMask->m_xTbxPipette->set_sensitive(true);
275
276 pMask->m_xLbColor1->set_sensitive(true);
277 pMask->m_xLbColor2->set_sensitive(true);
278 pMask->m_xLbColor3->set_sensitive(true);
279 pMask->m_xLbColor4->set_sensitive(true);
280 pMask->m_xLbColorTrans->set_sensitive(false);
281
282 bIsReady = pMask->m_xCbx1->get_active() || pMask->m_xCbx2->get_active() ||
283 pMask->m_xCbx3->get_active() || pMask->m_xCbx4->get_active();
284 }
285
286 if ( bIsReady && IsExecReady() )
287 pMask->m_xBtnExec->set_sensitive(true);
288 else
289 pMask->m_xBtnExec->set_sensitive(false);
290}
291
292IMPL_LINK( MaskData, FocusLbHdl, weld::Widget&, rLb, void )
293{
294 pMask->m_xQSet1->SelectItem( &rLb == &pMask->m_xLbColor1->get_widget() ? 1 : 0 /* , false */ );
295 pMask->m_xQSet2->SelectItem( &rLb == &pMask->m_xLbColor2->get_widget() ? 1 : 0 /* , false */ );
296 pMask->m_xQSet3->SelectItem( &rLb == &pMask->m_xLbColor3->get_widget() ? 1 : 0 /* , false */ );
297 pMask->m_xQSet4->SelectItem( &rLb == &pMask->m_xLbColor4->get_widget() ? 1 : 0 /* , false */ );
298}
299
301{
302 SfxBoolItem aBItem( SID_BMPMASK_EXEC, true );
303 rBindings.GetDispatcher()->ExecuteList(SID_BMPMASK_EXEC, OWN_CALLMODE,
304 { &aBItem });
305}
306
307void BmpColorWindow::Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& /*Rect*/)
308{
310 rRenderContext.SetLineColor(aColor);
311 rRenderContext.SetFillColor(aColor);
313 rRenderContext.Pop();
314}
315
317 SfxBindings& rBindings ) :
318 SfxControllerItem ( SID_BMPMASK_EXEC, rBindings ),
319 rBmpMask ( rMask)
320{
321}
322
324 const SfxPoolItem* pItem )
325{
326 if ( ( nSID == SID_BMPMASK_EXEC ) && pItem )
327 {
328 const SfxBoolItem* pStateItem = dynamic_cast<const SfxBoolItem*>( pItem );
329 assert(pStateItem); // SfxBoolItem expected
330 if (pStateItem)
331 rBmpMask.SetExecState( pStateItem->GetValue() );
332 }
333}
334
336 SfxBindings* pBindings,
337 SfxChildWinInfo* pInfo)
338 : SfxChildWindow(pParent_, nId)
339{
340 VclPtr<SvxBmpMask> pDlg = VclPtr<SvxBmpMask>::Create(pBindings, this, pParent_);
341
342 SetWindow( pDlg );
343
344 pDlg->Initialize( pInfo );
345}
346
348 : SfxDockingWindow(pBindinx, pCW, pParent, "DockingColorReplace",
349 "svx/ui/dockingcolorreplace.ui")
350 , m_xTbxPipette(m_xBuilder->weld_toolbar("toolbar"))
351 , m_xCtlPipette(new BmpColorWindow)
352 , m_xCtlPipetteWin(new weld::CustomWeld(*m_xBuilder, "toolcolor", *m_xCtlPipette))
353 , m_xBtnExec(m_xBuilder->weld_button("replace"))
354 , m_xCbx1(m_xBuilder->weld_check_button("cbx1"))
355 , m_xQSet1(new MaskSet(this))
356 , m_xQSetWin1(new weld::CustomWeld(*m_xBuilder, "qset1", *m_xQSet1))
357 , m_xSp1(m_xBuilder->weld_metric_spin_button("tol1", FieldUnit::PERCENT))
358 , m_xLbColor1(new ColorListBox(m_xBuilder->weld_menu_button("color1"), [this]{ return GetFrameWeld(); }))
359 , m_xCbx2(m_xBuilder->weld_check_button("cbx2"))
360 , m_xQSet2(new MaskSet(this))
361 , m_xQSetWin2(new weld::CustomWeld(*m_xBuilder, "qset2", *m_xQSet2))
362 , m_xSp2(m_xBuilder->weld_metric_spin_button("tol2", FieldUnit::PERCENT))
363 , m_xLbColor2(new ColorListBox(m_xBuilder->weld_menu_button("color2"), [this]{ return GetFrameWeld(); }))
364 , m_xCbx3(m_xBuilder->weld_check_button("cbx3"))
365 , m_xQSet3(new MaskSet(this))
366 , m_xQSetWin3(new weld::CustomWeld(*m_xBuilder, "qset3", *m_xQSet3))
367 , m_xSp3(m_xBuilder->weld_metric_spin_button("tol3", FieldUnit::PERCENT))
368 , m_xLbColor3(new ColorListBox(m_xBuilder->weld_menu_button("color3"), [this]{ return GetFrameWeld(); }))
369 , m_xCbx4(m_xBuilder->weld_check_button("cbx4"))
370 , m_xQSet4(new MaskSet(this))
371 , m_xQSetWin4(new weld::CustomWeld(*m_xBuilder, "qset4", *m_xQSet4))
372 , m_xSp4(m_xBuilder->weld_metric_spin_button("tol4", FieldUnit::PERCENT))
373 , m_xLbColor4(new ColorListBox(m_xBuilder->weld_menu_button("color4"), [this]{ return GetFrameWeld(); }))
374 , m_xCbxTrans(m_xBuilder->weld_check_button("cbx5"))
375 , m_xLbColorTrans(new ColorListBox(m_xBuilder->weld_menu_button("color5"), [this]{ return GetFrameWeld(); }))
376 , m_xData(new MaskData(this, *pBindinx))
377 , aPipetteColor(COL_WHITE)
378 , aSelItem(*this, *pBindinx)
379{
380 SetText(SvxResId(RID_SVXDLG_BMPMASK_STR_TITLE));
381
382 m_xLbColor1->SetSlotId(SID_BMPMASK_COLOR);
383 m_xLbColor2->SetSlotId(SID_BMPMASK_COLOR);
384 m_xLbColor3->SetSlotId(SID_BMPMASK_COLOR);
385 m_xLbColor4->SetSlotId(SID_BMPMASK_COLOR);
386
387 m_xLbColorTrans->SelectEntry(COL_BLACK);
388 m_xLbColor1->SelectEntry(COL_TRANSPARENT);
389 m_xLbColor2->SelectEntry(COL_TRANSPARENT);
390 m_xLbColor3->SelectEntry(COL_TRANSPARENT);
391 m_xLbColor4->SelectEntry(COL_TRANSPARENT);
392
393 m_xTbxPipette->connect_clicked( LINK( m_xData.get(), MaskData, PipetteHdl ) );
394 m_xBtnExec->connect_clicked( LINK( m_xData.get(), MaskData, ExecHdl ) );
395
396 m_xCbx1->connect_toggled( LINK( m_xData.get(), MaskData, CbxHdl ) );
397 m_xCbx2->connect_toggled( LINK( m_xData.get(), MaskData, CbxHdl ) );
398 m_xCbx3->connect_toggled( LINK( m_xData.get(), MaskData, CbxHdl ) );
399 m_xCbx4->connect_toggled( LINK( m_xData.get(), MaskData, CbxHdl ) );
400 m_xCbxTrans->connect_toggled( LINK( m_xData.get(), MaskData, CbxTransHdl ) );
401
402 SetAccessibleNames ();
403
404 m_xLbColor1->connect_focus_in( LINK( m_xData.get(), MaskData, FocusLbHdl ) );
405 m_xLbColor2->connect_focus_in( LINK( m_xData.get(), MaskData, FocusLbHdl ) );
406 m_xLbColor3->connect_focus_in( LINK( m_xData.get(), MaskData, FocusLbHdl ) );
407 m_xLbColor4->connect_focus_in( LINK( m_xData.get(), MaskData, FocusLbHdl ) );
408 m_xLbColorTrans->set_sensitive(false);
409
410 OUString sColorPalette (SvxResId( RID_SVXDLG_BMPMASK_STR_PALETTE));
411 OUString sColorPaletteN;
412
413 m_xQSet1->SetStyle( m_xQSet1->GetStyle() | WB_DOUBLEBORDER | WB_ITEMBORDER );
414 m_xQSet1->SetColCount();
415 m_xQSet1->SetLineCount( 1 );
416 sColorPaletteN = sColorPalette + " 1";
417 m_xQSet1->InsertItem( 1, aPipetteColor, sColorPaletteN);
418 m_xQSet1->SelectItem( 1 );
419
420 m_xQSet2->SetStyle( m_xQSet2->GetStyle() | WB_DOUBLEBORDER | WB_ITEMBORDER );
421 m_xQSet2->SetColCount();
422 m_xQSet2->SetLineCount( 1 );
423 sColorPaletteN = sColorPalette + " 2";
424 m_xQSet2->InsertItem( 1, aPipetteColor, sColorPaletteN);
425 m_xQSet2->SelectItem( 0 );
426
427 m_xQSet3->SetStyle( m_xQSet3->GetStyle() | WB_DOUBLEBORDER | WB_ITEMBORDER );
428 m_xQSet3->SetColCount();
429 m_xQSet3->SetLineCount( 1 );
430 sColorPaletteN = sColorPalette + " 3";
431 m_xQSet3->InsertItem( 1, aPipetteColor, sColorPaletteN);
432 m_xQSet3->SelectItem( 0 );
433
434 m_xQSet4->SetStyle( m_xQSet4->GetStyle() | WB_DOUBLEBORDER | WB_ITEMBORDER );
435 m_xQSet4->SetColCount();
436 m_xQSet4->SetLineCount( 1 );
437 sColorPaletteN = sColorPalette + " 4";
438 m_xQSet4->InsertItem( 1, aPipetteColor, sColorPaletteN);
439 m_xQSet4->SelectItem( 0 );
440
441 m_xQSet1->Show();
442 m_xQSet2->Show();
443 m_xQSet3->Show();
444 m_xQSet4->Show();
445}
446
448{
449 disposeOnce();
450}
451
453{
454 m_xQSetWin1.reset();
455 m_xQSet1.reset();
456 m_xQSetWin2.reset();
457 m_xQSet2.reset();
458 m_xQSetWin3.reset();
459 m_xQSet3.reset();
460 m_xQSetWin4.reset();
461 m_xQSet4.reset();
462 m_xCtlPipetteWin.reset();
463 m_xCtlPipette.reset();
464 m_xData.reset();
465 m_xTbxPipette.reset();
466 m_xBtnExec.reset();
467 m_xCbx1.reset();
468 m_xSp1.reset();
469 m_xLbColor1.reset();
470 m_xCbx2.reset();
471 m_xSp2.reset();
472 m_xLbColor2.reset();
473 m_xCbx3.reset();
474 m_xSp3.reset();
475 m_xLbColor3.reset();
476 m_xCbx4.reset();
477 m_xSp4.reset();
478 m_xLbColor4.reset();
479 m_xCbxTrans.reset();
480 m_xLbColorTrans.reset();
483}
484
486void SvxBmpMask::onSelect( const MaskSet* pSet )
487{
488 // now deselect all other value sets
489 if( pSet != m_xQSet1.get() )
490 m_xQSet1->SelectItem( 0 );
491
492 if( pSet != m_xQSet2.get() )
493 m_xQSet2->SelectItem( 0 );
494
495 if( pSet != m_xQSet3.get() )
496 m_xQSet3->SelectItem( 0 );
497
498 if( pSet != m_xQSet4.get() )
499 m_xQSet4->SelectItem( 0 );
500}
501
503{
504 SfxBoolItem aItem2( SID_BMPMASK_PIPETTE, false );
505 GetBindings().GetDispatcher()->ExecuteList(SID_BMPMASK_PIPETTE,
506 OWN_CALLMODE, { &aItem2 });
507
509}
510
511void SvxBmpMask::SetColor( const Color& rColor )
512{
513 aPipetteColor = rColor;
514 m_xCtlPipette->SetColor( aPipetteColor );
515}
516
518{
519 if( m_xQSet1->GetSelectedItemId() == 1 )
520 {
521 m_xCbx1->set_active(true);
522 m_xData->CbxHdl(*m_xCbx1);
523 m_xQSet1->SetItemColor( 1, aPipetteColor );
524 m_xQSet1->SetFormat();
525 }
526 else if( m_xQSet2->GetSelectedItemId() == 1 )
527 {
528 m_xCbx2->set_active(true);
529 m_xData->CbxHdl(*m_xCbx2);
530 m_xQSet2->SetItemColor( 1, aPipetteColor );
531 m_xQSet2->SetFormat();
532 }
533 else if( m_xQSet3->GetSelectedItemId() == 1 )
534 {
535 m_xCbx3->set_active(true);
536 m_xData->CbxHdl(*m_xCbx3);
537 m_xQSet3->SetItemColor( 1, aPipetteColor );
538 m_xQSet3->SetFormat();
539 }
540 else if( m_xQSet4->GetSelectedItemId() == 1 )
541 {
542 m_xCbx4->set_active(true);
543 m_xData->CbxHdl(*m_xCbx4);
544 m_xQSet4->SetItemColor( 1, aPipetteColor );
545 m_xQSet4->SetFormat();
546 }
547
548 m_xTbxPipette->set_item_active("pipette", false);
549 m_xData->PipetteHdl("pipette");
550}
551
552void SvxBmpMask::SetExecState( bool bEnable )
553{
554 m_xData->SetExecState( bEnable );
555
556 if ( m_xData->IsExecReady() && m_xData->IsCbxReady() )
557 m_xBtnExec->set_sensitive(true);
558 else
559 m_xBtnExec->set_sensitive(false);
560}
561
562
563sal_uInt16 SvxBmpMask::InitColorArrays( Color* pSrcCols, Color* pDstCols, sal_uInt8* pTols )
564{
565 sal_uInt16 nCount = 0;
566
567 if ( m_xCbx1->get_active() )
568 {
569 pSrcCols[nCount] = m_xQSet1->GetItemColor( 1 );
570 pDstCols[nCount] = m_xLbColor1->GetSelectEntryColor();
571 pTols[nCount++] = static_cast<sal_uInt8>(m_xSp1->get_value(FieldUnit::PERCENT));
572 }
573
574 if ( m_xCbx2->get_active() )
575 {
576 pSrcCols[nCount] = m_xQSet2->GetItemColor( 1 );
577 pDstCols[nCount] = m_xLbColor2->GetSelectEntryColor();
578 pTols[nCount++] = static_cast<sal_uInt8>(m_xSp2->get_value(FieldUnit::PERCENT));
579 }
580
581 if ( m_xCbx3->get_active() )
582 {
583 pSrcCols[nCount] = m_xQSet3->GetItemColor( 1 );
584 pDstCols[nCount] = m_xLbColor3->GetSelectEntryColor();
585 pTols[nCount++] = static_cast<sal_uInt8>(m_xSp3->get_value(FieldUnit::PERCENT));
586 }
587
588 if ( m_xCbx4->get_active() )
589 {
590 pSrcCols[nCount] = m_xQSet4->GetItemColor( 1 );
591 pDstCols[nCount] = m_xLbColor4->GetSelectEntryColor();
592 pTols[nCount++] = static_cast<sal_uInt8>(m_xSp4->get_value(FieldUnit::PERCENT));
593 }
594
595 return nCount;
596}
597
599{
600 Color pSrcCols[4];
601 Color pDstCols[4];
602 sal_uInt8 pTols[4];
603 const sal_uInt16 nCount = InitColorArrays( pSrcCols, pDstCols, pTols );
604
605 EnterWait();
606 rBitmap.Replace( pSrcCols, pDstCols, nCount, pTols );
607 LeaveWait();
608}
609
610BitmapEx SvxBmpMask::ImpMaskTransparent( const BitmapEx& rBitmapEx, const Color& rColor, const sal_uInt8 nTol )
611{
612 EnterWait();
613
614 BitmapEx aBmpEx;
615 Bitmap aMask( rBitmapEx.GetBitmap().CreateMask( rColor, nTol ) );
616
617 if( rBitmapEx.IsAlpha() )
618 aMask.CombineOr( rBitmapEx.GetAlphaMask() );
619
620 aBmpEx = BitmapEx( rBitmapEx.GetBitmap(), aMask );
621 LeaveWait();
622
623 return aBmpEx;
624}
625
626
628{
629 Animation aAnimation( rAnimation );
630 Color pSrcCols[4];
631 Color pDstCols[4];
632 sal_uInt8 pTols[4];
633 InitColorArrays( pSrcCols, pDstCols, pTols );
634 sal_uInt16 nAnimationCount = aAnimation.Count();
635
636 for( sal_uInt16 i = 0; i < nAnimationCount; i++ )
637 {
638 AnimationFrame aAnimationFrame( aAnimation.Get( i ) );
639 aAnimationFrame.maBitmapEx = Mask(aAnimationFrame.maBitmapEx).GetBitmapEx();
640 aAnimation.Replace(aAnimationFrame, i);
641 }
642
643 return aAnimation;
644}
645
646
648{
649 GDIMetaFile aMtf;
650 Color pSrcCols[4];
651 Color pDstCols[4];
652 sal_uInt8 pTols[4];
653 sal_uInt16 nCount = InitColorArrays( pSrcCols, pDstCols, pTols );
654
655 // If no color is selected, we copy only the Mtf
656 if( !nCount )
657 aMtf = rMtf;
658 else
659 {
660 bool pTrans[4];
661 Color aCol;
662 tools::Long nR;
663 tools::Long nG;
664 tools::Long nB;
665 std::unique_ptr<tools::Long[]> pMinR(new tools::Long[nCount]);
666 std::unique_ptr<tools::Long[]> pMaxR(new tools::Long[nCount]);
667 std::unique_ptr<tools::Long[]> pMinG(new tools::Long[nCount]);
668 std::unique_ptr<tools::Long[]> pMaxG(new tools::Long[nCount]);
669 std::unique_ptr<tools::Long[]> pMinB(new tools::Long[nCount]);
670 std::unique_ptr<tools::Long[]> pMaxB(new tools::Long[nCount]);
671 sal_uInt16 i;
672
673 aMtf.SetPrefSize( rMtf.GetPrefSize() );
674 aMtf.SetPrefMapMode( rMtf.GetPrefMapMode() );
675
676 // Prepare Color comparison array
677 for( i = 0; i < nCount; i++ )
678 {
679 tools::Long nTol = ( pTols[i] * 255 ) / 100;
680
681 tools::Long nVal = static_cast<tools::Long>(pSrcCols[i].GetRed());
682 pMinR[i] = std::max( nVal - nTol, tools::Long(0) );
683 pMaxR[i] = std::min( nVal + nTol, tools::Long(255) );
684
685 nVal = static_cast<tools::Long>(pSrcCols[i].GetGreen());
686 pMinG[i] = std::max( nVal - nTol, tools::Long(0) );
687 pMaxG[i] = std::min( nVal + nTol, tools::Long(255) );
688
689 nVal = static_cast<tools::Long>(pSrcCols[i].GetBlue());
690 pMinB[i] = std::max( nVal - nTol, tools::Long(0) );
691 pMaxB[i] = std::min( nVal + nTol, tools::Long(255) );
692
693 pTrans[ i ] = (pDstCols[ i ] == COL_TRANSPARENT);
694 }
695
696 // Investigate actions and if necessary replace colors
697 for( size_t nAct = 0, nActCount = rMtf.GetActionSize(); nAct < nActCount; nAct++ )
698 {
699 MetaAction* pAction = rMtf.GetAction( nAct );
700
701 bool bReplace = false;
702
703 switch( pAction->GetType() )
704 {
705 case MetaActionType::PIXEL:
706 {
707 MetaPixelAction* pAct = static_cast<MetaPixelAction*>(pAction);
708
709 aCol = pAct->GetColor();
710 TEST_COLS();
711
712 if( bReplace )
713 pAct = new MetaPixelAction( pAct->GetPoint(), aCol );
714
715 aMtf.AddAction( pAct );
716 }
717 break;
718
719 case MetaActionType::LINECOLOR:
720 {
721 MetaLineColorAction* pAct = static_cast<MetaLineColorAction*>(pAction);
722
723 aCol = pAct->GetColor();
724 TEST_COLS();
725
726 if( bReplace )
727 pAct = new MetaLineColorAction( aCol, !pTrans[ i ] );
728
729 aMtf.AddAction( pAct );
730 }
731 break;
732
733 case MetaActionType::FILLCOLOR:
734 {
735 MetaFillColorAction* pAct = static_cast<MetaFillColorAction*>(pAction);
736
737 aCol = pAct->GetColor();
738 TEST_COLS();
739
740 if( bReplace )
741 pAct = new MetaFillColorAction( aCol, !pTrans[ i ] );
742
743 aMtf.AddAction( pAct );
744 }
745 break;
746
747 case MetaActionType::TEXTCOLOR:
748 {
749 MetaTextColorAction* pAct = static_cast<MetaTextColorAction*>(pAction);
750
751 aCol = pAct->GetColor();
752 TEST_COLS();
753
754 if( bReplace )
755 pAct = new MetaTextColorAction( aCol );
756
757 aMtf.AddAction( pAct );
758 }
759 break;
760
761 case MetaActionType::TEXTFILLCOLOR:
762 {
763 MetaTextFillColorAction* pAct = static_cast<MetaTextFillColorAction*>(pAction);
764
765 aCol = pAct->GetColor();
766 TEST_COLS();
767
768 if( bReplace )
769 pAct = new MetaTextFillColorAction( aCol, !pTrans[ i ] );
770
771 aMtf.AddAction( pAct );
772 }
773 break;
774
775 case MetaActionType::FONT:
776 {
777 MetaFontAction* pAct = static_cast<MetaFontAction*>(pAction);
778 vcl::Font aFont( pAct->GetFont() );
779
780 aCol = aFont.GetColor();
781 TEST_COLS();
782
783 if( bReplace )
784 {
785 aFont.SetColor( aCol );
786 pAct = new MetaFontAction( std::move(aFont) );
787 }
788
789 aMtf.AddAction( pAct );
790 }
791 break;
792
793 case MetaActionType::WALLPAPER:
794 {
795 MetaWallpaperAction* pAct = static_cast<MetaWallpaperAction*>(pAction);
796 Wallpaper aWall( pAct->GetWallpaper() );
797
798 aCol = aWall.GetColor();
799 TEST_COLS();
800
801 if( bReplace )
802 {
803 aWall.SetColor( aCol );
804 pAct = new MetaWallpaperAction( pAct->GetRect(), std::move(aWall) );
805 }
806
807 aMtf.AddAction( pAct );
808 }
809 break;
810
811 case MetaActionType::BMP:
812 {
813 MetaBmpAction* pAct = static_cast<MetaBmpAction*>(pAction);
814 const Bitmap aBmp( Mask(BitmapEx(pAct->GetBitmap())).GetBitmapEx().GetBitmap() );
815
816 pAct = new MetaBmpAction( pAct->GetPoint(), aBmp );
817 aMtf.AddAction( pAct );
818 }
819 break;
820
821 case MetaActionType::BMPSCALE:
822 {
823 MetaBmpScaleAction* pAct = static_cast<MetaBmpScaleAction*>(pAction);
824 const Bitmap aBmp( Mask(BitmapEx(pAct->GetBitmap())).GetBitmapEx().GetBitmap() );
825
826 pAct = new MetaBmpScaleAction( pAct->GetPoint(), pAct->GetSize(), aBmp );
827 aMtf.AddAction( pAct );
828 }
829 break;
830
831 case MetaActionType::BMPSCALEPART:
832 {
833 MetaBmpScalePartAction* pAct = static_cast<MetaBmpScalePartAction*>(pAction);
834 const Bitmap aBmp( Mask(BitmapEx(pAct->GetBitmap())).GetBitmapEx().GetBitmap() );
835
836 pAct = new MetaBmpScalePartAction( pAct->GetDestPoint(), pAct->GetDestSize(),
837 pAct->GetSrcPoint(), pAct->GetSrcSize(), aBmp );
838 aMtf.AddAction( pAct );
839 }
840 break;
841
842 case MetaActionType::BMPEX:
843 {
844 MetaBmpExAction* pAct = static_cast<MetaBmpExAction*>(pAction);
845 const BitmapEx aBmpEx( Mask( pAct->GetBitmapEx() ).GetBitmapEx() );
846
847 pAct = new MetaBmpExAction( pAct->GetPoint(), aBmpEx );
848 aMtf.AddAction( pAct );
849 }
850 break;
851
852 case MetaActionType::BMPEXSCALE:
853 {
854 MetaBmpExScaleAction* pAct = static_cast<MetaBmpExScaleAction*>(pAction);
855 const BitmapEx aBmpEx( Mask( pAct->GetBitmapEx() ).GetBitmapEx() );
856
857 pAct = new MetaBmpExScaleAction( pAct->GetPoint(), pAct->GetSize(), aBmpEx );
858 aMtf.AddAction( pAct );
859 }
860 break;
861
862 case MetaActionType::BMPEXSCALEPART:
863 {
864 MetaBmpExScalePartAction* pAct = static_cast<MetaBmpExScalePartAction*>(pAction);
865 const BitmapEx aBmpEx( Mask( pAct->GetBitmapEx() ).GetBitmapEx() );
866
867 pAct = new MetaBmpExScalePartAction( pAct->GetDestPoint(), pAct->GetDestSize(),
868 pAct->GetSrcPoint(), pAct->GetSrcSize(), aBmpEx );
869 aMtf.AddAction( pAct );
870 }
871 break;
872
873 default:
874 {
875 aMtf.AddAction( pAction );
876 }
877 break;
878 }
879 }
880 }
881
882 LeaveWait();
883
884 return aMtf;
885}
886
887
889{
890 Animation aAnimation( rAnim );
891 sal_uInt16 nAnimationCount = aAnimation.Count();
892
893 for( sal_uInt16 i = 0; i < nAnimationCount; i++ )
894 {
895 AnimationFrame aAnimationFrame(aAnimation.Get(i));
896 aAnimationFrame.maBitmapEx.ReplaceTransparency(rColor);
897 aAnimation.Replace(aAnimationFrame, i);
898 }
899
900 return aAnimation;
901}
902
903
905{
907 GDIMetaFile aMtf;
908 const MapMode& rPrefMap = rMtf.GetPrefMapMode();
909 const Size& rPrefSize = rMtf.GetPrefSize();
910 const size_t nActionCount = rMtf.GetActionSize();
911
912 pVDev->EnableOutput( false );
913 aMtf.Record( pVDev );
914 aMtf.SetPrefSize( rPrefSize );
915 aMtf.SetPrefMapMode( rPrefMap );
916 pVDev->SetLineColor( rColor );
917 pVDev->SetFillColor( rColor );
918
919 // retrieve one action at the time; first
920 // set the whole area to the replacement color.
921 pVDev->DrawRect( tools::Rectangle( rPrefMap.GetOrigin(), rPrefSize ) );
922 for ( size_t i = 0; i < nActionCount; i++ )
923 {
924 MetaAction* pAct = rMtf.GetAction( i );
925 aMtf.AddAction( pAct );
926 }
927
928 aMtf.Stop();
929 aMtf.WindStart();
930
931 return aMtf;
932}
933
935{
936 // Replace transparency?
937 if (m_xCbxTrans->get_active())
938 return ImpReplaceTransparency(rGraphic.GetGDIMetaFile(), m_xLbColorTrans->GetSelectEntryColor());
939 return ImpMask(rGraphic.GetGDIMetaFile());
940}
941
943{
944 Graphic aGraphic( rGraphic );
945 const Color aReplColor( m_xLbColorTrans->GetSelectEntryColor() );
946
947 switch( rGraphic.GetType() )
948 {
949 case GraphicType::Bitmap:
950 {
951 if( rGraphic.IsAnimated() )
952 {
953 // Replace transparency?
954 if ( m_xCbxTrans->get_active() )
955 aGraphic = ImpReplaceTransparency( rGraphic.GetAnimation(), aReplColor );
956 else
957 aGraphic = ImpMask( rGraphic.GetAnimation() );
958 }
959 else
960 {
961 // Replace transparency?
962 if( m_xCbxTrans->get_active() )
963 {
964 BitmapEx aBmpEx = aGraphic.GetBitmapEx();
965 aBmpEx.ReplaceTransparency(aReplColor);
966 aGraphic = aBmpEx;
967 }
968 else
969 {
970 Color pSrcCols[4];
971 Color pDstCols[4];
972 sal_uInt8 pTols[4];
973 sal_uInt16 nCount = InitColorArrays( pSrcCols, pDstCols, pTols );
974
975 if( nCount )
976 {
977 // first set all transparent colors
978 for( sal_uInt16 i = 0; i < nCount; i++ )
979 {
980 // Do we have a transparent color?
981 if (pDstCols[i] == COL_TRANSPARENT)
982 {
983 BitmapEx aBmpEx( ImpMaskTransparent( aGraphic.GetBitmapEx(),
984 pSrcCols[ i ], pTols[ i ] ) );
985 const Size aSize( aBmpEx.GetSizePixel() );
986
987 if( aSize.Width() && aSize.Height() )
988 aGraphic = aBmpEx;
989 }
990 }
991
992 // now replace it again with the normal colors
993 BitmapEx aBitmapEx( aGraphic.GetBitmapEx() );
994 if ( aBitmapEx.GetSizePixel().Width() && aBitmapEx.GetSizePixel().Height() )
995 {
996 ImpMask( aBitmapEx );
997 if ( aGraphic.IsTransparent() )
998 aGraphic = Graphic( BitmapEx( aBitmapEx.GetBitmap(), aBitmapEx.GetAlphaMask() ) );
999 else
1000 aGraphic = aBitmapEx;
1001 }
1002 }
1003 }
1004 }
1005 }
1006 break;
1007
1008 case GraphicType::GdiMetafile:
1009 {
1010 GDIMetaFile aMtf(GetMetaFile(rGraphic));
1011 Size aSize( aMtf.GetPrefSize() );
1012 if ( aSize.Width() && aSize.Height() )
1013 aGraphic = Graphic( aMtf );
1014 else
1015 aGraphic = rGraphic;
1016 }
1017 break;
1018
1019 default:
1020 aGraphic = rGraphic;
1021 break;
1022 }
1023
1024 if( aGraphic != rGraphic )
1025 {
1026 aGraphic.SetPrefSize( rGraphic.GetPrefSize() );
1027 aGraphic.SetPrefMapMode( rGraphic.GetPrefMapMode() );
1028 }
1029
1030 return aGraphic;
1031}
1032
1034{
1035 return m_xTbxPipette->get_item_active("pipette");
1036}
1037
1042{
1043 // set the accessible name for valueset
1044 OUString sColorPalette (SvxResId( RID_SVXDLG_BMPMASK_STR_PALETTE));
1045 OUString sColorPaletteN;
1046
1047 sColorPaletteN = sColorPalette + " 1";
1048 m_xQSet1->SetText (sColorPaletteN);
1049 sColorPaletteN = sColorPalette + " 2";
1050 m_xQSet2->SetText (sColorPaletteN);
1051 sColorPaletteN = sColorPalette + " 3";
1052 m_xQSet3->SetText (sColorPaletteN);
1053 sColorPaletteN = sColorPalette + " 4";
1054 m_xQSet4->SetText (sColorPaletteN);
1055}
1056
1057/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
IMPL_LINK(MaskData, PipetteHdl, const OUString &, rId, void)
Definition: _bmpmask.cxx:192
IMPL_LINK_NOARG(MaskData, ExecHdl, weld::Button &, void)
Definition: _bmpmask.cxx:300
#define OWN_CALLMODE
Definition: _bmpmask.cxx:36
#define TEST_COLS()
Definition: _bmpmask.cxx:39
void Replace(const AnimationFrame &rNewAnimationBmp, sal_uInt16 nAnimation)
size_t Count() const
const AnimationFrame & Get(sal_uInt16 nAnimation) const
const AlphaMask & GetAlphaMask() const
void ReplaceTransparency(const Color &rColor)
bool IsAlpha() const
Bitmap GetBitmap(Color aTransparentReplaceColor) const
void Replace(const Color &rSearchColor, const Color &rReplaceColor)
const Size & GetSizePixel() const
bool CombineOr(const Bitmap &rMask)
Bitmap CreateMask(const Color &rTransColor) const
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
Definition: _bmpmask.cxx:307
virtual void SetDrawingArea(weld::DrawingArea *pArea) override
Definition: _bmpmask.cxx:74
void SetColor(const Color &rColor)
Definition: _bmpmask.cxx:66
sal_uInt8 GetBlue() const
sal_uInt8 GetRed() const
sal_uInt8 GetGreen() const
size_t GetActionSize() const
void WindStart()
const Size & GetPrefSize() const
MetaAction * GetAction(size_t nAction) const
void AddAction(const rtl::Reference< MetaAction > &pAction)
void SetPrefMapMode(const MapMode &rMapMode)
void Record(OutputDevice *pOutDev)
const MapMode & GetPrefMapMode() const
void SetPrefSize(const Size &rSize)
Size GetPrefSize() const
Animation GetAnimation() const
void SetPrefMapMode(const MapMode &rPrefMapMode)
const GDIMetaFile & GetGDIMetaFile() const
GraphicType GetType() const
bool IsAnimated() const
BitmapEx GetBitmapEx(const GraphicConversionParameters &rParameters=GraphicConversionParameters()) const
MapMode GetPrefMapMode() const
void SetPrefSize(const Size &rPrefSize)
bool IsTransparent() const
const vcl::KeyCode & GetKeyCode() const
const Point & GetOrigin() const
DECL_LINK(PipetteHdl, const OUString &, void)
DECL_LINK(FocusLbHdl, weld::Widget &, void)
bool IsExecReady() const
Definition: _bmpmask.cxx:172
bool bExecState
Definition: _bmpmask.cxx:164
bool bIsReady
Definition: _bmpmask.cxx:163
bool IsCbxReady() const
Definition: _bmpmask.cxx:170
DECL_LINK(CbxHdl, weld::Toggleable &, void)
DECL_LINK(ExecHdl, weld::Button &, void)
MaskData(SvxBmpMask *pBmpMask, SfxBindings &rBind)
Definition: _bmpmask.cxx:182
SfxBindings & rBindings
Definition: _bmpmask.cxx:165
VclPtr< SvxBmpMask > pMask
Definition: _bmpmask.cxx:162
void SetExecState(bool bState)
Definition: _bmpmask.cxx:171
DECL_LINK(CbxTransHdl, weld::Toggleable &, void)
virtual void GetFocus() override
Definition: _bmpmask.cxx:116
virtual bool KeyInput(const KeyEvent &rKEvt) override
Definition: _bmpmask.cxx:123
virtual void SetDrawingArea(weld::DrawingArea *pArea) override
Definition: _bmpmask.cxx:92
virtual void Select() override
Definition: _bmpmask.cxx:109
MaskSet(SvxBmpMask *pMask)
Definition: _bmpmask.cxx:103
VclPtr< SvxBmpMask > pSvxBmpMask
Definition: _bmpmask.cxx:85
void onEditColor()
Definition: _bmpmask.cxx:150
MetaActionType GetType() const
const Bitmap & GetBitmap() const
const Point & GetPoint() const
const BitmapEx & GetBitmapEx() const
const Point & GetPoint() const
const Size & GetSize() const
const Point & GetPoint() const
const BitmapEx & GetBitmapEx() const
const Point & GetSrcPoint() const
const Size & GetDestSize() const
const Point & GetDestPoint() const
const Size & GetSrcSize() const
const BitmapEx & GetBitmapEx() const
const Point & GetPoint() const
const Size & GetSize() const
const Bitmap & GetBitmap() const
const Bitmap & GetBitmap() const
const Point & GetDestPoint() const
const Point & GetSrcPoint() const
const Size & GetSrcSize() const
const Size & GetDestSize() const
const Color & GetColor() const
const vcl::Font & GetFont() const
const Color & GetColor() const
const Point & GetPoint() const
const Color & GetColor() const
const Color & GetColor() const
const Color & GetColor() const
const Wallpaper & GetWallpaper() const
const tools::Rectangle & GetRect() const
void DrawRect(const tools::Rectangle &rRect)
void SetLineColor()
void SetFillColor()
SAL_WARN_UNUSED_RESULT Point LogicToPixel(const Point &rLogicPt) const
void Push(vcl::PushFlags nFlags=vcl::PushFlags::ALL)
SfxDispatcher * GetDispatcher() const
bool GetValue() const
void SetWindow(const VclPtr< vcl::Window > &p)
virtual void dispose()
const SfxPoolItem * ExecuteList(sal_uInt16 nSlot, SfxCallMode nCall, std::initializer_list< SfxPoolItem const * > args, std::initializer_list< SfxPoolItem const * > internalargs=std::initializer_list< SfxPoolItem const * >())
SfxBindings & GetBindings() const
virtual bool Close() override
virtual void dispose() override
constexpr tools::Long Height() const
constexpr tools::Long Width() const
const Color & GetColor() const
short Execute(weld::Window *pParent)
void SetColor(const Color &rColor)
SvxBmpMaskChildWindow(vcl::Window *, sal_uInt16, SfxBindings *, SfxChildWinInfo *)
Definition: _bmpmask.cxx:335
SvxBmpMask & rBmpMask
Definition: bmpmask.hxx:50
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
std::unique_ptr< weld::CheckButton > m_xCbx1
Definition: bmpmask.hxx:97
void SetColor(const Color &rColor)
Definition: _bmpmask.cxx:511
void ImpMask(BitmapEx &rBitmap)
Definition: _bmpmask.cxx:598
std::unique_ptr< MaskSet > m_xQSet2
Definition: bmpmask.hxx:104
void SetExecState(bool bEnable)
Definition: _bmpmask.cxx:552
std::unique_ptr< weld::CustomWeld > m_xQSetWin3
Definition: bmpmask.hxx:111
std::unique_ptr< weld::CheckButton > m_xCbx3
Definition: bmpmask.hxx:109
std::unique_ptr< ColorListBox > m_xLbColor2
Definition: bmpmask.hxx:107
std::unique_ptr< weld::CustomWeld > m_xQSetWin2
Definition: bmpmask.hxx:105
std::unique_ptr< MaskSet > m_xQSet3
Definition: bmpmask.hxx:110
std::unique_ptr< ColorListBox > m_xLbColor3
Definition: bmpmask.hxx:113
Color aPipetteColor
Definition: bmpmask.hxx:126
BitmapEx ImpMaskTransparent(const BitmapEx &rBitmapEx, const Color &rColor, const sal_uInt8 nTol)
Definition: _bmpmask.cxx:610
std::unique_ptr< ColorListBox > m_xLbColorTrans
Definition: bmpmask.hxx:122
SVX_DLLPRIVATE void SetAccessibleNames()
Set names for accessible objects.
Definition: _bmpmask.cxx:1041
bool IsEyedropping() const
Definition: _bmpmask.cxx:1033
virtual ~SvxBmpMask() override
Definition: _bmpmask.cxx:447
std::unique_ptr< weld::MetricSpinButton > m_xSp3
Definition: bmpmask.hxx:112
void onSelect(const MaskSet *pSet)
is called by a MaskSet when it is selected
Definition: _bmpmask.cxx:486
std::unique_ptr< ColorListBox > m_xLbColor4
Definition: bmpmask.hxx:119
virtual void dispose() override
Definition: _bmpmask.cxx:452
std::unique_ptr< weld::CheckButton > m_xCbxTrans
Definition: bmpmask.hxx:121
void PipetteClicked()
Definition: _bmpmask.cxx:517
GDIMetaFile GetMetaFile(const Graphic &rGraphic)
Definition: _bmpmask.cxx:934
SvxBmpMask(SfxBindings *pBindinx, SfxChildWindow *pCW, vcl::Window *pParent)
Definition: _bmpmask.cxx:347
static Animation ImpReplaceTransparency(const Animation &rAnim, const Color &rColor)
Definition: _bmpmask.cxx:888
std::unique_ptr< weld::CustomWeld > m_xCtlPipetteWin
Definition: bmpmask.hxx:94
std::unique_ptr< MaskSet > m_xQSet4
Definition: bmpmask.hxx:116
std::unique_ptr< weld::Toolbar > m_xTbxPipette
Definition: bmpmask.hxx:92
std::unique_ptr< MaskSet > m_xQSet1
Definition: bmpmask.hxx:98
std::unique_ptr< weld::MetricSpinButton > m_xSp4
Definition: bmpmask.hxx:118
virtual bool Close() override
Definition: _bmpmask.cxx:502
std::unique_ptr< weld::MetricSpinButton > m_xSp1
Definition: bmpmask.hxx:100
std::unique_ptr< weld::CheckButton > m_xCbx2
Definition: bmpmask.hxx:103
SvxBmpMaskSelectItem aSelItem
Definition: bmpmask.hxx:127
std::unique_ptr< weld::CustomWeld > m_xQSetWin1
Definition: bmpmask.hxx:99
std::unique_ptr< weld::Button > m_xBtnExec
Definition: bmpmask.hxx:95
std::unique_ptr< weld::CustomWeld > m_xQSetWin4
Definition: bmpmask.hxx:117
sal_uInt16 InitColorArrays(Color *pSrcCols, Color *pDstCols, sal_uInt8 *pTols)
Definition: _bmpmask.cxx:563
std::unique_ptr< MaskData > m_xData
Definition: bmpmask.hxx:124
std::unique_ptr< weld::CheckButton > m_xCbx4
Definition: bmpmask.hxx:115
std::unique_ptr< weld::MetricSpinButton > m_xSp2
Definition: bmpmask.hxx:106
std::unique_ptr< ColorListBox > m_xLbColor1
Definition: bmpmask.hxx:101
std::unique_ptr< BmpColorWindow > m_xCtlPipette
Definition: bmpmask.hxx:93
Graphic Mask(const Graphic &rGraphic)
Definition: _bmpmask.cxx:942
void SelectItem(sal_uInt16 nItemId)
virtual void Select()
Color GetItemColor(sal_uInt16 nItemId) const
void SetItemColor(sal_uInt16 nItemId, const Color &rColor)
virtual void GetFocus() override
virtual bool KeyInput(const KeyEvent &rKEvt) override
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea) override
static VclPtr< reference_type > Create(Arg &&... arg)
const Color & GetColor() const
void SetColor(const Color &rColor)
void SetColor(const Color &)
const Color & GetColor() const
sal_uInt16 GetCode() const
sal_uInt16 GetModifier() const
Size const & GetOutputSizePixel() const
virtual OutputDevice & get_ref_device()=0
virtual void set_size_request(int nWidth, int nHeight)=0
constexpr ::Color COL_WHITE(0xFF, 0xFF, 0xFF)
constexpr ::Color COL_TRANSPARENT(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
int nCount
OUString SvxResId(TranslateId aId)
Definition: dialmgr.cxx:24
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
virtual void SetText(const OUString &rStr) override
virtual void SetHelpId(const OUString &) override
FieldUnit
SFX_IMPL_DOCKINGWINDOW_WITHID(SvxFontWorkChildWindow, SID_FONTWORK)
constexpr OUStringLiteral HID_BMPMASK_CTL_QCOL_1
Definition: helpids.h:24
constexpr sal_uInt16 KEY_SPACE
int i
long Long
sal_Int16 nId
SfxItemState
BitmapEx maBitmapEx
unsigned char sal_uInt8
constexpr OUStringLiteral PERCENT(u"Percent")