31#include <svx/strings.hrc>
32#include <svx/svxids.hrc>
36#define OWN_CALLMODE SfxCallMode::ASYNCHRON | SfxCallMode::RECORD
41 nR = aCol.GetRed(); nG = aCol.GetGreen(); nB = aCol.GetBlue(); \
42 for( i = 0; i < nCount; i++ ) \
44 if ( ( pMinR[i] <= nR ) && ( pMaxR[i] >= nR ) && \
45 ( pMinG[i] <= nG ) && ( pMaxG[i] >= nG ) && \
46 ( pMinB[i] <= nB ) && ( pMaxB[i] >= nB ) ) \
48 aCol = pDstCols[i]; bReplace = true; break; \
77 CustomWidgetController::SetDrawingArea(pArea);
79 SetOutputSizePixel(aSize);
89 virtual void Select()
override;
97 SetOutputSizePixel(aSize);
186 bExecState ( false ),
195 pMask->m_xTbxPipette->get_item_active(rId) );
197 rBindings.GetDispatcher()->ExecuteList(SID_BMPMASK_PIPETTE,
OWN_CALLMODE,
203 bIsReady = pMask->m_xCbx1->get_active() || pMask->m_xCbx2->get_active() ||
204 pMask->m_xCbx3->get_active() || pMask->m_xCbx4->get_active();
206 if ( bIsReady && IsExecReady() )
207 pMask->m_xBtnExec->set_sensitive(
true);
209 pMask->m_xBtnExec->set_sensitive(
false);
212 if ( !rCbx.get_active() )
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();
224 pSet = pMask->m_xQSet4.get();
229 pMask->m_xTbxPipette->set_item_active(
"pipette",
true);
230 PipetteHdl(
"pipette");
235 bIsReady = rCbx.get_active();
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);
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);
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);
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);
282 bIsReady = pMask->m_xCbx1->get_active() || pMask->m_xCbx2->get_active() ||
283 pMask->m_xCbx3->get_active() || pMask->m_xCbx4->get_active();
286 if ( bIsReady && IsExecReady() )
287 pMask->m_xBtnExec->set_sensitive(
true);
289 pMask->m_xBtnExec->set_sensitive(
false);
294 pMask->m_xQSet1->SelectItem( &rLb == &pMask->m_xLbColor1->get_widget() ? 1 : 0 );
295 pMask->m_xQSet2->SelectItem( &rLb == &pMask->m_xLbColor2->get_widget() ? 1 : 0 );
296 pMask->m_xQSet3->SelectItem( &rLb == &pMask->m_xLbColor3->get_widget() ? 1 : 0 );
297 pMask->m_xQSet4->SelectItem( &rLb == &pMask->m_xLbColor4->get_widget() ? 1 : 0 );
303 rBindings.GetDispatcher()->ExecuteList(SID_BMPMASK_EXEC,
OWN_CALLMODE,
313 rRenderContext.
Pop();
326 if ( ( nSID == SID_BMPMASK_EXEC ) && pItem )
344 pDlg->Initialize( pInfo );
349 "svx/ui/dockingcolorreplace.ui")
350 , m_xTbxPipette(m_xBuilder->weld_toolbar(
"toolbar"))
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"))
356 , m_xQSetWin1(new
weld::CustomWeld(*m_xBuilder,
"qset1", *m_xQSet1))
359 , m_xCbx2(m_xBuilder->weld_check_button(
"cbx2"))
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"))
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"))
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)
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);
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);
393 m_xTbxPipette->connect_clicked(
LINK( m_xData.get(),
MaskData, PipetteHdl ) );
394 m_xBtnExec->connect_clicked(
LINK( m_xData.get(),
MaskData, ExecHdl ) );
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 ) );
402 SetAccessibleNames ();
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);
410 OUString sColorPalette (
SvxResId( RID_SVXDLG_BMPMASK_STR_PALETTE));
411 OUString sColorPaletteN;
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 );
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 );
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 );
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 );
519 if(
m_xQSet1->GetSelectedItemId() == 1 )
526 else if(
m_xQSet2->GetSelectedItemId() == 1 )
533 else if(
m_xQSet3->GetSelectedItemId() == 1 )
540 else if(
m_xQSet4->GetSelectedItemId() == 1 )
549 m_xData->PipetteHdl(
"pipette");
554 m_xData->SetExecState( bEnable );
634 sal_uInt16 nAnimationCount = aAnimation.
Count();
636 for( sal_uInt16
i = 0;
i < nAnimationCount;
i++ )
640 aAnimation.
Replace(aAnimationFrame,
i);
697 for(
size_t nAct = 0, nActCount = rMtf.
GetActionSize(); nAct < nActCount; nAct++ )
701 bool bReplace =
false;
705 case MetaActionType::PIXEL:
719 case MetaActionType::LINECOLOR:
733 case MetaActionType::FILLCOLOR:
747 case MetaActionType::TEXTCOLOR:
761 case MetaActionType::TEXTFILLCOLOR:
775 case MetaActionType::FONT:
793 case MetaActionType::WALLPAPER:
811 case MetaActionType::BMP:
821 case MetaActionType::BMPSCALE:
831 case MetaActionType::BMPSCALEPART:
842 case MetaActionType::BMPEX:
852 case MetaActionType::BMPEXSCALE:
862 case MetaActionType::BMPEXSCALEPART:
891 sal_uInt16 nAnimationCount = aAnimation.
Count();
893 for( sal_uInt16
i = 0;
i < nAnimationCount;
i++ )
897 aAnimation.
Replace(aAnimationFrame,
i);
912 pVDev->EnableOutput(
false );
916 pVDev->SetLineColor( rColor );
917 pVDev->SetFillColor( rColor );
922 for (
size_t i = 0;
i < nActionCount;
i++ )
949 case GraphicType::Bitmap:
984 pSrcCols[
i ], pTols[
i ] ) );
1000 aGraphic = aBitmapEx;
1008 case GraphicType::GdiMetafile:
1015 aGraphic = rGraphic;
1020 aGraphic = rGraphic;
1024 if( aGraphic != rGraphic )
1044 OUString sColorPalette (
SvxResId( RID_SVXDLG_BMPMASK_STR_PALETTE));
1045 OUString sColorPaletteN;
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);
IMPL_LINK(MaskData, PipetteHdl, const OUString &, rId, void)
IMPL_LINK_NOARG(MaskData, ExecHdl, weld::Button &, void)
void Replace(const AnimationFrame &rNewAnimationBmp, sal_uInt16 nAnimation)
const AnimationFrame & Get(sal_uInt16 nAnimation) const
const AlphaMask & GetAlphaMask() const
void ReplaceTransparency(const Color &rColor)
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
virtual void SetDrawingArea(weld::DrawingArea *pArea) override
void SetColor(const Color &rColor)
sal_uInt8 GetBlue() const
sal_uInt8 GetGreen() const
Animation GetAnimation() const
void SetPrefMapMode(const MapMode &rPrefMapMode)
const GDIMetaFile & GetGDIMetaFile() const
GraphicType GetType() 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)
DECL_LINK(CbxHdl, weld::Toggleable &, void)
DECL_LINK(ExecHdl, weld::Button &, void)
MaskData(SvxBmpMask *pBmpMask, SfxBindings &rBind)
VclPtr< SvxBmpMask > pMask
void SetExecState(bool bState)
DECL_LINK(CbxTransHdl, weld::Toggleable &, void)
virtual void GetFocus() override
virtual bool KeyInput(const KeyEvent &rKEvt) override
virtual void SetDrawingArea(weld::DrawingArea *pArea) override
virtual void Select() override
MaskSet(SvxBmpMask *pMask)
VclPtr< SvxBmpMask > pSvxBmpMask
const Color & GetColor() const
const Color & GetColor() const
void DrawRect(const tools::Rectangle &rRect)
SAL_WARN_UNUSED_RESULT Point LogicToPixel(const Point &rLogicPt) const
void Push(vcl::PushFlags nFlags=vcl::PushFlags::ALL)
SfxDispatcher * GetDispatcher() const
void SetWindow(const VclPtr< vcl::Window > &p)
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 *)
SvxBmpMaskSelectItem(SvxBmpMask &rMask, SfxBindings &rBindings)
virtual void StateChangedAtToolBoxControl(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem *pState) override
std::unique_ptr< weld::CheckButton > m_xCbx1
void SetColor(const Color &rColor)
void ImpMask(BitmapEx &rBitmap)
std::unique_ptr< MaskSet > m_xQSet2
void SetExecState(bool bEnable)
std::unique_ptr< weld::CustomWeld > m_xQSetWin3
std::unique_ptr< weld::CheckButton > m_xCbx3
std::unique_ptr< ColorListBox > m_xLbColor2
std::unique_ptr< weld::CustomWeld > m_xQSetWin2
std::unique_ptr< MaskSet > m_xQSet3
std::unique_ptr< ColorListBox > m_xLbColor3
BitmapEx ImpMaskTransparent(const BitmapEx &rBitmapEx, const Color &rColor, const sal_uInt8 nTol)
std::unique_ptr< ColorListBox > m_xLbColorTrans
SVX_DLLPRIVATE void SetAccessibleNames()
Set names for accessible objects.
bool IsEyedropping() const
virtual ~SvxBmpMask() override
std::unique_ptr< weld::MetricSpinButton > m_xSp3
void onSelect(const MaskSet *pSet)
is called by a MaskSet when it is selected
std::unique_ptr< ColorListBox > m_xLbColor4
virtual void dispose() override
std::unique_ptr< weld::CheckButton > m_xCbxTrans
GDIMetaFile GetMetaFile(const Graphic &rGraphic)
SvxBmpMask(SfxBindings *pBindinx, SfxChildWindow *pCW, vcl::Window *pParent)
static Animation ImpReplaceTransparency(const Animation &rAnim, const Color &rColor)
std::unique_ptr< weld::CustomWeld > m_xCtlPipetteWin
std::unique_ptr< MaskSet > m_xQSet4
std::unique_ptr< weld::Toolbar > m_xTbxPipette
std::unique_ptr< MaskSet > m_xQSet1
std::unique_ptr< weld::MetricSpinButton > m_xSp4
virtual bool Close() override
std::unique_ptr< weld::MetricSpinButton > m_xSp1
std::unique_ptr< weld::CheckButton > m_xCbx2
SvxBmpMaskSelectItem aSelItem
std::unique_ptr< weld::CustomWeld > m_xQSetWin1
std::unique_ptr< weld::Button > m_xBtnExec
std::unique_ptr< weld::CustomWeld > m_xQSetWin4
sal_uInt16 InitColorArrays(Color *pSrcCols, Color *pDstCols, sal_uInt8 *pTols)
std::unique_ptr< MaskData > m_xData
std::unique_ptr< weld::CheckButton > m_xCbx4
std::unique_ptr< weld::MetricSpinButton > m_xSp2
std::unique_ptr< ColorListBox > m_xLbColor1
std::unique_ptr< BmpColorWindow > m_xCtlPipette
Graphic Mask(const Graphic &rGraphic)
void SelectItem(sal_uInt16 nItemId)
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
virtual OutputDevice & get_ref_device()=0
constexpr ::Color COL_WHITE(0xFF, 0xFF, 0xFF)
constexpr ::Color COL_TRANSPARENT(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
OUString SvxResId(TranslateId aId)
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
virtual void SetText(const OUString &rStr) override
virtual void SetHelpId(const OUString &) override
SFX_IMPL_DOCKINGWINDOW_WITHID(SvxFontWorkChildWindow, SID_FONTWORK)
constexpr OUStringLiteral HID_BMPMASK_CTL_QCOL_1
constexpr sal_uInt16 KEY_SPACE
#define LINK(Instance, Class, Member)
constexpr OUStringLiteral PERCENT(u"Percent")