bump product version to 7.2.5.1
[LibreOffice.git] / svx / source / sidebar / area / AreaPropertyPanelBase.cxx
blob8234ee9c4dbfcaa65886466fedbfb57aac44103d
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 .
20 #include <osl/diagnose.h>
21 #include <svx/sidebar/AreaPropertyPanelBase.hxx>
22 #include <svx/drawitem.hxx>
23 #include <svx/itemwin.hxx>
24 #include <svx/svxids.hrc>
25 #include <sfx2/objsh.hxx>
26 #include <svx/xfltrit.hxx>
27 #include <svx/xflftrit.hxx>
28 #include <svx/xtable.hxx>
29 #include <sfx2/sidebar/Panel.hxx>
30 #include <sfx2/opengrf.hxx>
31 #include <sfx2/weldutils.hxx>
32 #include <tools/urlobj.hxx>
33 #include <bitmaps.hlst>
34 #include <comphelper/lok.hxx>
36 using namespace css;
37 using namespace css::uno;
39 constexpr OStringLiteral SIDEBARGRADIENT = "sidebargradient";
41 namespace svx::sidebar {
43 namespace {
45 enum eFillStyle
47 NONE,
48 SOLID,
49 GRADIENT,
50 HATCH,
51 BITMAP,
52 PATTERN
57 const sal_Int32 AreaPropertyPanelBase::DEFAULT_CENTERX = 50;
58 const sal_Int32 AreaPropertyPanelBase::DEFAULT_CENTERY = 50;
59 const sal_Int32 AreaPropertyPanelBase::DEFAULT_ANGLE = 0;
60 const sal_Int32 AreaPropertyPanelBase::DEFAULT_STARTVALUE = 0;
61 const sal_Int32 AreaPropertyPanelBase::DEFAULT_ENDVALUE = 16777215;
62 const sal_Int32 AreaPropertyPanelBase::DEFAULT_BORDER = 0;
64 AreaPropertyPanelBase::AreaPropertyPanelBase(
65 weld::Widget* pParent,
66 const css::uno::Reference<css::frame::XFrame>& rxFrame)
67 : PanelLayout(pParent, "AreaPropertyPanel", "svx/ui/sidebararea.ui"),
68 meLastXFS(static_cast<sal_uInt16>(-1)),
69 mnLastPosHatch(0),
70 mnLastPosBitmap(0),
71 mnLastPosPattern(0),
72 mnLastTransSolid(50),
73 maGradientLinear(),
74 maGradientAxial(),
75 maGradientRadial(),
76 maGradientElliptical(),
77 maGradientSquare(),
78 maGradientRect(),
79 mxColorTextFT(m_xBuilder->weld_label("filllabel")),
80 mxLbFillType(m_xBuilder->weld_combo_box("fillstylearea")),
81 mxLbFillAttr(m_xBuilder->weld_combo_box("fillattrhb")),
82 mxLbFillGradFrom(new ColorListBox(m_xBuilder->weld_menu_button("fillgrad1"), [this]{ return GetFrameWeld(); })),
83 mxLbFillGradTo(new ColorListBox(m_xBuilder->weld_menu_button("fillgrad2"), [this]{ return GetFrameWeld(); })),
84 mxToolBoxColor(m_xBuilder->weld_toolbar("selectcolor")),
85 mxColorDispatch(new ToolbarUnoDispatcher(*mxToolBoxColor, *m_xBuilder, rxFrame)),
86 mxTrspTextFT(m_xBuilder->weld_label("transparencylabel")),
87 mxLBTransType(m_xBuilder->weld_combo_box("transtype")),
88 mxMTRTransparent(m_xBuilder->weld_metric_spin_button("settransparency", FieldUnit::PERCENT)),
89 mxSldTransparent(m_xBuilder->weld_scale("transparencyslider")),
90 mxBTNGradient(m_xBuilder->weld_toolbar("selectgradient")),
91 mxMTRAngle(m_xBuilder->weld_metric_spin_button("gradangle", FieldUnit::DEGREE)),
92 mxGradientStyle(m_xBuilder->weld_combo_box("gradientstyle")),
93 mxBmpImport(m_xBuilder->weld_button("bmpimport")),
94 mpStyleItem(),
95 mpColorItem(),
96 mpFillGradientItem(),
97 mpHatchItem(),
98 mpBitmapItem(),
99 maImgAxial(BMP_AXIAL),
100 maImgElli(BMP_ELLI),
101 maImgQuad(BMP_QUAD),
102 maImgRadial(BMP_RADIAL),
103 maImgSquare(BMP_SQUARE),
104 maImgLinear(BMP_LINEAR),
105 mpFloatTransparenceItem(),
106 mpTransparanceItem()
108 Initialize();
111 AreaPropertyPanelBase::~AreaPropertyPanelBase()
113 mxTrGrPopup.reset();
114 mxColorTextFT.reset();
115 mxLbFillType.reset();
116 mxLbFillAttr.reset();
117 mxColorDispatch.reset();
118 mxToolBoxColor.reset();
119 mxTrspTextFT.reset();
120 mxLBTransType.reset();
121 mxMTRTransparent.reset();
122 mxSldTransparent.reset();
123 mxBTNGradient.reset();
124 mxMTRAngle.reset();
125 mxLbFillGradFrom.reset();
126 mxLbFillGradTo.reset();
127 mxGradientStyle.reset();
128 mxBmpImport.reset();
131 void AreaPropertyPanelBase::Initialize()
133 SvxFillTypeBox::Fill(*mxLbFillType);
135 mxLbFillAttr->set_size_request(42, -1);
137 maGradientLinear.SetXOffset(DEFAULT_CENTERX);
138 maGradientLinear.SetYOffset(DEFAULT_CENTERY);
139 maGradientLinear.SetAngle(Degree10(DEFAULT_ANGLE));
140 maGradientLinear.SetStartColor(Color(DEFAULT_STARTVALUE));
141 maGradientLinear.SetEndColor(Color(DEFAULT_ENDVALUE));
142 maGradientLinear.SetBorder(DEFAULT_BORDER);
143 maGradientLinear.SetGradientStyle(css::awt::GradientStyle_LINEAR);
145 maGradientAxial = maGradientLinear;
146 maGradientAxial.SetGradientStyle(css::awt::GradientStyle_AXIAL);
148 maGradientRadial = maGradientLinear;
149 maGradientRadial.SetGradientStyle(css::awt::GradientStyle_RADIAL);
151 maGradientElliptical = maGradientLinear;
152 maGradientElliptical.SetGradientStyle(css::awt::GradientStyle_ELLIPTICAL);
154 maGradientSquare = maGradientLinear;
155 maGradientSquare.SetGradientStyle(css::awt::GradientStyle_SQUARE);
157 maGradientRect = maGradientLinear;
158 maGradientRect.SetGradientStyle(css::awt::GradientStyle_RECT);
161 mxLbFillType->connect_changed( LINK( this, AreaPropertyPanelBase, SelectFillTypeHdl ) );
163 Link<weld::ComboBox&,void> aLink = LINK( this, AreaPropertyPanelBase, SelectFillAttrHdl );
164 mxLbFillAttr->connect_changed( aLink );
165 mxGradientStyle->connect_changed( aLink );
166 Link<ColorListBox&,void> aLink3 = LINK( this, AreaPropertyPanelBase, SelectFillColorHdl );
167 mxLbFillGradFrom->SetSelectHdl( aLink3 );
168 mxLbFillGradTo->SetSelectHdl( aLink3 );
169 mxMTRAngle->connect_value_changed(LINK(this,AreaPropertyPanelBase, ChangeGradientAngle));
171 // https://gerrit.libreoffice.org/c/core/+/87313 set a small width to force widgets to
172 // take their final width from other widgets in the grid
173 mxLbFillGradFrom->get_widget().set_size_request(42, -1);
174 mxLbFillGradTo->get_widget().set_size_request(42, -1);
176 mxLBTransType->connect_changed(LINK(this, AreaPropertyPanelBase, ChangeTrgrTypeHdl_Impl));
178 SetTransparency( 50 );
179 mxMTRTransparent->connect_value_changed(LINK(this, AreaPropertyPanelBase, ModifyTransparentHdl_Impl));
180 mxSldTransparent->connect_value_changed(LINK(this, AreaPropertyPanelBase, ModifyTransSliderHdl));
182 mxTrGrPopup = std::make_unique<AreaTransparencyGradientPopup>(*this, mxBTNGradient.get());
184 mxBTNGradient->set_item_popover(SIDEBARGRADIENT, mxTrGrPopup->getTopLevel());
185 mxBTNGradient->connect_clicked(LINK(this, AreaPropertyPanelBase, ToolbarHdl_Impl));
187 mxBTNGradient->set_item_icon_name(SIDEBARGRADIENT, maImgLinear);
188 mxBTNGradient->hide();
189 mxBmpImport->connect_clicked( LINK(this, AreaPropertyPanelBase, ClickImportBitmapHdl));
192 IMPL_LINK_NOARG(AreaPropertyPanelBase, ToolbarHdl_Impl, const OString&, void)
194 mxBTNGradient->set_menu_item_active(SIDEBARGRADIENT, !mxBTNGradient->get_menu_item_active(SIDEBARGRADIENT));
197 void AreaPropertyPanelBase::SetTransparency(sal_uInt16 nVal)
199 mxSldTransparent->set_value(nVal);
200 mxMTRTransparent->set_value(nVal, FieldUnit::PERCENT);
203 IMPL_LINK_NOARG(AreaPropertyPanelBase, ClickImportBitmapHdl, weld::Button&, void)
205 SvxOpenGraphicDialog aDlg("Import", GetFrameWeld());
206 aDlg.EnableLink(false);
207 if( aDlg.Execute() != ERRCODE_NONE )
208 return;
210 Graphic aGraphic;
211 auto xWait = std::make_unique<weld::WaitObject>(m_xContainer.get());
212 ErrCode nError = aDlg.GetGraphic( aGraphic );
213 xWait.reset();
214 if( nError != ERRCODE_NONE )
215 return;
217 XBitmapListRef pList = SfxObjectShell::Current()->GetItem(SID_BITMAP_LIST)->GetBitmapList();
218 INetURLObject aURL( aDlg.GetPath() );
219 OUString aFileName = aURL.GetLastName().getToken(0, '.');
220 OUString aName = aFileName;
221 tools::Long j = 1;
222 bool bValidBitmapName = false;
223 while( !bValidBitmapName )
225 bValidBitmapName = true;
226 for( tools::Long i = 0; i < pList->Count() && bValidBitmapName; i++ )
228 if( aName == pList->GetBitmap(i)->GetName() )
230 bValidBitmapName = false;
231 aName = aFileName + OUString::number(j++);
236 pList->Insert(std::make_unique<XBitmapEntry>(aGraphic, aName));
237 pList->Save();
238 mxLbFillAttr->clear();
239 SvxFillAttrBox::Fill(*mxLbFillAttr, pList);
240 mxLbFillAttr->set_active_text(aName);
241 SelectFillAttrHdl(*mxLbFillAttr);
244 IMPL_LINK_NOARG(AreaPropertyPanelBase, SelectFillTypeHdl, weld::ComboBox&, void)
246 sal_Int32 nPos = static_cast<eFillStyle>(mxLbFillType->get_active());
247 mxLbFillAttr->clear();
248 SfxObjectShell* pSh = SfxObjectShell::Current();
249 if(!pSh)
250 return;
252 // #i122676# Do no longer trigger two Execute calls, one for SID_ATTR_FILL_STYLE
253 // and one for setting the fill attribute itself, but add two SfxPoolItems to the
254 // call to get just one action at the SdrObject and to create only one Undo action, too.
255 // Checked that this works in all apps.
256 switch( nPos )
258 default:
259 case NONE:
261 mxLbFillAttr->show();
262 mxLbFillGradFrom->hide();
263 mxLbFillGradTo->hide();
264 mxGradientStyle->hide();
265 mxMTRAngle->hide();
266 mxToolBoxColor->hide();
267 mxBmpImport->hide();
268 mxLbFillAttr->set_sensitive(false);
270 // #i122676# need to call a single SID_ATTR_FILL_STYLE change
271 setFillStyle(XFillStyleItem(drawing::FillStyle_NONE));
272 break;
274 case SOLID:
276 mxLbFillAttr->hide();
277 mxLbFillGradFrom->hide();
278 mxLbFillGradTo->hide();
279 mxGradientStyle->hide();
280 mxMTRAngle->hide();
281 mxBmpImport->hide();
282 mxToolBoxColor->show();
283 const Color aColor = mpColorItem ? mpColorItem->GetColorValue() : COL_AUTO;
284 const XFillColorItem aXFillColorItem( "", aColor );
286 // #i122676# change FillStyle and Color in one call
287 XFillStyleItem aXFillStyleItem(drawing::FillStyle_SOLID);
288 setFillStyleAndColor(&aXFillStyleItem, aXFillColorItem);
289 break;
291 case GRADIENT:
293 mxLbFillAttr->hide();
294 mxLbFillGradFrom->show();
295 mxLbFillGradTo->show();
296 mxGradientStyle->show();
297 mxMTRAngle->show();
298 mxToolBoxColor->hide();
299 mxBmpImport->hide();
301 mxLbFillAttr->set_sensitive(true);
302 mxLbFillGradTo->set_sensitive(true);
303 mxLbFillGradFrom->set_sensitive(true);
304 mxGradientStyle->set_sensitive(true);
305 mxMTRAngle->set_sensitive(true);
306 mxLbFillAttr->clear();
308 const SvxGradientListItem * pItem = pSh->GetItem(SID_GRADIENT_LIST);
310 if(0 < pItem->GetGradientList()->Count())
312 const XGradient aGradient = pItem->GetGradientList()->GetGradient(0)->GetGradient();
313 const OUString aName = pItem->GetGradientList()->GetGradient(0)->GetName();
314 const XFillGradientItem aXFillGradientItem(aName, aGradient);
316 // #i122676# change FillStyle and Gradient in one call
317 XFillStyleItem aXFillStyleItem(drawing::FillStyle_GRADIENT);
318 setFillStyleAndGradient(&aXFillStyleItem, aXFillGradientItem);
319 mxLbFillGradFrom->SelectEntry(aGradient.GetStartColor());
320 mxLbFillGradTo->SelectEntry(aGradient.GetEndColor());
322 mxMTRAngle->set_value(aGradient.GetAngle().get() / 10, FieldUnit::DEGREE);
323 css::awt::GradientStyle eXGS = aGradient.GetGradientStyle();
324 mxGradientStyle->set_active(sal::static_int_cast< sal_Int32 >( eXGS ));
326 break;
328 case HATCH:
330 mxLbFillAttr->show();
331 mxLbFillGradFrom->hide();
332 mxLbFillGradTo->hide();
333 mxMTRAngle->hide();
334 mxGradientStyle->hide();
335 mxToolBoxColor->hide();
336 mxBmpImport->hide();
338 const SvxHatchListItem* pItem( pSh->GetItem(SID_HATCH_LIST) );
339 if(pItem)
341 const XHatchListRef& pXHatchList(pItem->GetHatchList());
342 mxLbFillAttr->set_sensitive(true);
343 mxLbFillAttr->clear();
344 SvxFillAttrBox::Fill(*mxLbFillAttr, pXHatchList);
346 if (mnLastPosHatch != -1)
348 if(mnLastPosHatch < pXHatchList->Count())
350 const XHatch aHatch = pXHatchList->GetHatch(mnLastPosHatch)->GetHatch();
351 const OUString aName = pXHatchList->GetHatch(mnLastPosHatch)->GetName();
352 const XFillHatchItem aXFillHatchItem(aName, aHatch);
354 // #i122676# change FillStyle and Hatch in one call
355 XFillStyleItem aXFillStyleItem(drawing::FillStyle_HATCH);
356 setFillStyleAndHatch(&aXFillStyleItem, aXFillHatchItem);
357 mxLbFillAttr->set_active(mnLastPosHatch);
361 else
363 mxLbFillAttr->set_sensitive(false);
365 break;
367 case BITMAP:
368 case PATTERN:
370 mxLbFillAttr->show();
371 mxLbFillAttr->set_sensitive(true);
372 mxLbFillAttr->clear();
373 mxLbFillGradFrom->hide();
374 mxLbFillGradTo->hide();
375 mxMTRAngle->hide();
376 mxGradientStyle->hide();
377 mxToolBoxColor->hide();
379 OUString aName;
380 GraphicObject aBitmap;
381 if(nPos == static_cast< sal_Int32 >(BITMAP))
383 if (!comphelper::LibreOfficeKit::isActive())
384 mxBmpImport->show();
385 const SvxBitmapListItem* pItem = pSh->GetItem(SID_BITMAP_LIST);
386 if(pItem)
388 const XBitmapListRef& pXBitmapList(pItem->GetBitmapList());
389 SvxFillAttrBox::Fill(*mxLbFillAttr, pXBitmapList);
391 if (mnLastPosBitmap != -1)
393 if(mnLastPosBitmap < pXBitmapList->Count())
395 const XBitmapEntry* pXBitmapEntry = pXBitmapList->GetBitmap(mnLastPosBitmap);
396 aBitmap = pXBitmapEntry->GetGraphicObject();
397 aName = pXBitmapEntry->GetName();
398 mxLbFillAttr->set_active(mnLastPosBitmap);
402 else
404 mxLbFillAttr->hide();
407 else if(nPos == static_cast< sal_Int32 >(PATTERN))
409 mxBmpImport->hide();
410 const SvxPatternListItem* pItem = pSh->GetItem(SID_PATTERN_LIST);
411 if(pItem)
413 const XPatternListRef& pXPatternList(pItem->GetPatternList());
414 SvxFillAttrBox::Fill(*mxLbFillAttr, pXPatternList);
416 if (mnLastPosPattern != -1)
418 if(mnLastPosPattern < pXPatternList->Count())
420 const XBitmapEntry* pXPatternEntry = pXPatternList->GetBitmap(mnLastPosPattern);
421 aBitmap = pXPatternEntry->GetGraphicObject();
422 aName = pXPatternEntry->GetName();
423 mxLbFillAttr->set_active(mnLastPosPattern);
427 else
429 mxLbFillAttr->hide();
432 const XFillBitmapItem aXFillBitmapItem( aName, aBitmap );
433 const XFillStyleItem aXFillStyleItem(drawing::FillStyle_BITMAP);
434 setFillStyleAndBitmap(&aXFillStyleItem, aXFillBitmapItem);
435 break;
439 meLastXFS = static_cast<sal_uInt16>(nPos);
441 if (m_pPanel)
442 m_pPanel->TriggerDeckLayouting();
445 IMPL_LINK_NOARG(AreaPropertyPanelBase, SelectFillColorHdl, ColorListBox&, void)
447 SelectFillAttrHdl_Impl();
450 IMPL_LINK_NOARG(AreaPropertyPanelBase, SelectFillAttrHdl, weld::ComboBox&, void)
452 SelectFillAttrHdl_Impl();
455 IMPL_LINK_NOARG(AreaPropertyPanelBase, ChangeGradientAngle, weld::MetricSpinButton&, void)
457 SelectFillAttrHdl_Impl();
460 void AreaPropertyPanelBase::SelectFillAttrHdl_Impl()
462 sal_Int32 nPosFillStyle = static_cast<eFillStyle>(mxLbFillType->get_active());
463 SfxObjectShell* pSh = SfxObjectShell::Current();
465 // #i122676# dependent from bFillStyleChange, do execute a single or two
466 // changes in one Execute call
467 const bool bFillStyleChange(static_cast<eFillStyle>(meLastXFS) != static_cast<eFillStyle>(nPosFillStyle));
469 switch(nPosFillStyle)
471 case eFillStyle::NONE:
473 if(bFillStyleChange)
475 XFillStyleItem aXFillStyleItem(drawing::FillStyle_NONE);
476 setFillStyle(aXFillStyleItem);
478 break;
480 case eFillStyle::SOLID:
482 if(bFillStyleChange)
484 // #i122676# Single FillStyle change call needed here
485 XFillStyleItem aXFillStyleItem(drawing::FillStyle_SOLID);
486 setFillStyle(aXFillStyleItem);
488 break;
490 case eFillStyle::GRADIENT:
493 if(pSh && pSh->GetItem(SID_COLOR_TABLE))
495 XGradient aGradient;
496 aGradient.SetAngle(Degree10(mxMTRAngle->get_value(FieldUnit::DEGREE) * 10));
497 aGradient.SetGradientStyle(static_cast<css::awt::GradientStyle>(mxGradientStyle->get_active()));
498 aGradient.SetStartColor(mxLbFillGradFrom->GetSelectEntryColor());
499 aGradient.SetEndColor(mxLbFillGradTo->GetSelectEntryColor());
501 const XFillGradientItem aXFillGradientItem(mxLbFillAttr->get_active_text(), aGradient);
503 // #i122676# Change FillStyle and Gradient in one call
504 XFillStyleItem aXFillStyleItem(drawing::FillStyle_GRADIENT);
505 setFillStyleAndGradient(bFillStyleChange ? &aXFillStyleItem : nullptr, aXFillGradientItem);
507 break;
509 case eFillStyle::HATCH:
511 sal_Int32 nPos = mxLbFillAttr->get_active();
513 if (nPos == -1)
515 nPos = mnLastPosHatch;
518 if (nPos != -1 && pSh && pSh->GetItem(SID_HATCH_LIST))
520 const SvxHatchListItem * pItem = pSh->GetItem(SID_HATCH_LIST);
522 if(nPos < pItem->GetHatchList()->Count())
524 const XHatch aHatch = pItem->GetHatchList()->GetHatch(nPos)->GetHatch();
525 const XFillHatchItem aXFillHatchItem( mxLbFillAttr->get_active_text(), aHatch);
527 // #i122676# Change FillStyle and Hatch in one call
528 XFillStyleItem aXFillStyleItem(drawing::FillStyle_HATCH);
529 setFillStyleAndHatch(bFillStyleChange ? &aXFillStyleItem : nullptr, aXFillHatchItem);
533 if (nPos != -1)
535 mnLastPosHatch = nPos;
537 break;
539 case eFillStyle::BITMAP:
541 sal_Int32 nPos = mxLbFillAttr->get_active();
543 if (nPos == -1)
545 nPos = mnLastPosBitmap;
548 if (nPos != -1 && pSh && pSh->GetItem(SID_BITMAP_LIST))
550 const SvxBitmapListItem * pItem = pSh->GetItem(SID_BITMAP_LIST);
552 if(nPos < pItem->GetBitmapList()->Count())
554 const XBitmapEntry* pXBitmapEntry = pItem->GetBitmapList()->GetBitmap(nPos);
555 const XFillBitmapItem aXFillBitmapItem(mxLbFillAttr->get_active_text(), pXBitmapEntry->GetGraphicObject());
557 // #i122676# Change FillStyle and Bitmap in one call
558 XFillStyleItem aXFillStyleItem(drawing::FillStyle_BITMAP);
559 setFillStyleAndBitmap(bFillStyleChange ? &aXFillStyleItem : nullptr, aXFillBitmapItem);
563 if (nPos != -1)
565 mnLastPosBitmap = nPos;
567 break;
569 case eFillStyle::PATTERN:
571 sal_Int32 nPos = mxLbFillAttr->get_active();
573 if (nPos == -1)
575 nPos = mnLastPosPattern;
578 if (nPos != -1 && pSh && pSh->GetItem(SID_PATTERN_LIST))
580 const SvxPatternListItem * pItem = pSh->GetItem(SID_PATTERN_LIST);
582 if(nPos < pItem->GetPatternList()->Count())
584 const XBitmapEntry* pXPatternEntry = pItem->GetPatternList()->GetBitmap(nPos);
585 const XFillBitmapItem aXFillBitmapItem(mxLbFillAttr->get_active_text(), pXPatternEntry->GetGraphicObject());
587 // #i122676# Change FillStyle and Bitmap in one call
588 XFillStyleItem aXFillStyleItem(drawing::FillStyle_BITMAP);
589 setFillStyleAndBitmap(bFillStyleChange ? &aXFillStyleItem : nullptr, aXFillBitmapItem);
593 if (nPos != -1)
595 mnLastPosPattern = nPos;
597 break;
600 if (m_pPanel)
601 m_pPanel->TriggerDeckLayouting();
604 void AreaPropertyPanelBase::ImpUpdateTransparencies()
606 if(mpTransparanceItem || mpFloatTransparenceItem)
608 bool bZeroValue(false);
610 if (mpTransparanceItem)
612 const sal_uInt16 nValue(mpTransparanceItem->GetValue());
614 if(!nValue)
616 bZeroValue = true;
618 else if(nValue <= 100)
620 mxLBTransType->set_sensitive(true);
621 mxTrspTextFT->set_sensitive(true);
622 mxLBTransType->set_active(1);
623 mxBTNGradient->hide();
624 mxMTRTransparent->show();
625 mxSldTransparent->show();
626 mxMTRTransparent->set_sensitive(true);
627 mxSldTransparent->set_sensitive(true);
628 SetTransparency(nValue);
631 if (!bZeroValue && mxTrGrPopup)
633 mxBTNGradient->set_menu_item_active(SIDEBARGRADIENT, false);
637 if(bZeroValue && mpFloatTransparenceItem)
639 if(mpFloatTransparenceItem->IsEnabled())
641 const XGradient& rGradient = mpFloatTransparenceItem->GetGradientValue();
642 sal_Int32 nEntryPos(0);
643 OUString* pImage = nullptr;
645 mxLBTransType->set_sensitive(true);
646 mxTrspTextFT->set_sensitive(true);
647 mxMTRTransparent->hide();
648 mxSldTransparent->hide();
649 mxBTNGradient->set_sensitive(true);
650 mxBTNGradient->show();
652 switch(rGradient.GetGradientStyle())
654 default:
655 case css::awt::GradientStyle_LINEAR:
657 nEntryPos = 2;
658 pImage = &maImgLinear;
659 break;
661 case css::awt::GradientStyle_AXIAL:
663 nEntryPos = 3;
664 pImage = &maImgAxial;
665 break;
667 case css::awt::GradientStyle_RADIAL:
669 nEntryPos = 4;
670 pImage = &maImgRadial;
671 break;
673 case css::awt::GradientStyle_ELLIPTICAL:
675 nEntryPos = 5;
676 pImage = &maImgElli;
677 break;
679 case css::awt::GradientStyle_SQUARE:
681 nEntryPos = 6;
682 pImage = &maImgQuad;
683 break;
685 case css::awt::GradientStyle_RECT:
687 nEntryPos = 7;
688 pImage = &maImgSquare;
689 break;
692 mxLBTransType->set_active(nEntryPos);
693 mxBTNGradient->set_item_icon_name(SIDEBARGRADIENT, *pImage);
694 mxTrGrPopup->Rearrange(mpFloatTransparenceItem.get());
695 bZeroValue = false;
697 else
699 bZeroValue = true;
703 if(bZeroValue)
705 mxLBTransType->set_sensitive(true);
706 mxTrspTextFT->set_sensitive(true);
707 mxLBTransType->set_active(0);
708 mxBTNGradient->hide();
709 mxMTRTransparent->set_sensitive(true);
710 mxSldTransparent->set_sensitive(true);
711 mxMTRTransparent->show();
712 mxSldTransparent->show();
713 SetTransparency(0);
716 else
718 // no transparency at all
719 mxLBTransType->set_active(-1);
720 mxLBTransType->set_sensitive(false);
721 mxTrspTextFT->set_sensitive(false);
722 mxMTRTransparent->set_sensitive(false);
723 mxSldTransparent->set_sensitive(false);
724 mxMTRTransparent->show();
725 mxSldTransparent->show();
726 mxBTNGradient->set_sensitive(false);
727 mxBTNGradient->hide();
731 void AreaPropertyPanelBase::updateFillTransparence(bool bDisabled, bool bDefaultOrSet, const SfxPoolItem* pState)
733 if (bDisabled)
735 mpTransparanceItem.reset();
736 return;
738 else if (bDefaultOrSet)
740 if (pState)
742 const SfxUInt16Item* pItem = static_cast<const SfxUInt16Item*>(pState);
743 mpTransparanceItem.reset(pItem->Clone());
745 else
747 mpTransparanceItem.reset();
750 else
752 mpTransparanceItem.reset();
755 // update transparency settings dependent of mpTransparanceItem and mpFloatTransparenceItem
756 ImpUpdateTransparencies();
759 void AreaPropertyPanelBase::updateFillFloatTransparence(bool bDisabled, bool bDefaultOrSet, const SfxPoolItem* pState)
761 if (bDisabled)
763 mpFloatTransparenceItem.reset();
764 return;
767 if (bDefaultOrSet)
769 if (pState)
771 const XFillFloatTransparenceItem* pItem = static_cast<const XFillFloatTransparenceItem*>(pState);
772 mpFloatTransparenceItem.reset(pItem->Clone());
774 else
776 mpFloatTransparenceItem.reset();
779 else
781 mpFloatTransparenceItem.reset();
784 // update transparency settings dependent of mpTransparanceItem and mpFloatTransparenceItem
785 ImpUpdateTransparencies();
788 void AreaPropertyPanelBase::updateFillStyle(bool bDisabled, bool bDefaultOrSet, const SfxPoolItem* pState)
790 if(bDisabled)
792 mxLbFillType->set_sensitive(false);
793 mxColorTextFT->set_sensitive(false);
794 mxLbFillType->set_active(-1);
795 mxLbFillAttr->show();
796 mxLbFillAttr->set_sensitive(false);
797 mxLbFillAttr->set_active(-1);
798 mxToolBoxColor->hide();
799 meLastXFS = static_cast<sal_uInt16>(-1);
800 mpStyleItem.reset();
802 else if (bDefaultOrSet && pState)
804 const XFillStyleItem* pItem = static_cast<const XFillStyleItem*>(pState);
805 mpStyleItem.reset(pItem->Clone());
806 mxLbFillType->set_sensitive(true);
807 mxColorTextFT->set_sensitive(true);
808 drawing::FillStyle eXFS = mpStyleItem->GetValue();
809 eFillStyle nPos = NONE;
810 switch(eXFS)
812 default:
813 case drawing::FillStyle_NONE:
815 mxLbFillAttr->set_active(-1);
816 mxLbFillAttr->set_sensitive(false);
817 nPos = NONE;
818 break;
820 case drawing::FillStyle_SOLID:
821 nPos = SOLID;
822 break;
823 case drawing::FillStyle_GRADIENT:
824 nPos = GRADIENT;
825 break;
826 case drawing::FillStyle_HATCH:
827 nPos = HATCH;
828 break;
829 case drawing::FillStyle_BITMAP:
831 if(mpBitmapItem)
833 if(!mpBitmapItem->isPattern())
834 nPos = BITMAP;
835 else
836 nPos = PATTERN;
838 else
839 nPos = BITMAP;
840 break;
843 meLastXFS = static_cast< sal_uInt16 >(mxLbFillType->get_active());
844 mxLbFillType->set_active(static_cast< sal_Int32 >(nPos));
845 Update();
846 return;
849 mxLbFillType->set_active(-1);
850 mxLbFillAttr->show();
851 mxLbFillAttr->set_sensitive(false);
852 mxLbFillAttr->set_active(-1);
853 mxToolBoxColor->hide();
854 meLastXFS = static_cast<sal_uInt16>(-1);
855 mpStyleItem.reset();
856 if (m_pPanel)
857 m_pPanel->TriggerDeckLayouting();
860 void AreaPropertyPanelBase::updateFillGradient(bool bDisabled, bool bDefaultOrSet, const SfxPoolItem* pState)
862 if (bDefaultOrSet)
864 const XFillGradientItem* pItem = static_cast<const XFillGradientItem*>(pState);
865 mpFillGradientItem.reset(pItem ? pItem->Clone() : nullptr);
868 if(mpStyleItem && drawing::FillStyle_GRADIENT == mpStyleItem->GetValue())
870 mxLbFillAttr->hide();
871 mxLbFillGradFrom->show();
872 mxLbFillGradTo->show();
873 mxMTRAngle->show();
874 mxGradientStyle->show();
875 mxToolBoxColor->hide();
877 if (bDefaultOrSet)
879 mxLbFillType->set_active(GRADIENT);
880 Update();
882 else if(bDisabled)
884 mxLbFillGradFrom->SetNoSelection();
885 mxLbFillGradTo->SetNoSelection();
886 mxLbFillGradFrom->set_sensitive(false);
887 mxLbFillGradTo->set_sensitive(false);
888 mxMTRAngle->set_sensitive(false);
889 mxGradientStyle->set_sensitive(false);
891 else
893 mxLbFillGradFrom->SetNoSelection();
894 mxLbFillGradTo->SetNoSelection();
897 if (m_pPanel)
898 m_pPanel->TriggerDeckLayouting();
901 void AreaPropertyPanelBase::updateFillHatch(bool bDisabled, bool bDefaultOrSet, const SfxPoolItem* pState)
903 if (bDefaultOrSet)
905 const XFillHatchItem* pItem = static_cast<const XFillHatchItem*>(pState);
906 mpHatchItem.reset(pItem ? pItem->Clone() : nullptr);
909 if(mpStyleItem && drawing::FillStyle_HATCH == mpStyleItem->GetValue())
911 mxLbFillAttr->show();
912 mxToolBoxColor->hide();
914 if (bDefaultOrSet)
916 mxLbFillAttr->set_sensitive(true);
917 mxLbFillType->set_active(HATCH);
918 Update();
920 else if(bDisabled)
922 mxLbFillAttr->set_sensitive(false);
923 mxLbFillAttr->set_active(-1);
925 else
927 mxLbFillAttr->set_active(-1);
930 if (m_pPanel)
931 m_pPanel->TriggerDeckLayouting();
934 void AreaPropertyPanelBase::updateFillColor(bool bDefaultOrSet, const SfxPoolItem* pState)
936 if (bDefaultOrSet)
938 const XFillColorItem* pItem = static_cast<const XFillColorItem*>(pState);
939 mpColorItem.reset(pItem ? pItem->Clone() : nullptr);
942 if(mpStyleItem && drawing::FillStyle_SOLID == mpStyleItem->GetValue())
944 mxLbFillAttr->hide();
945 mxToolBoxColor->show();
946 mxLbFillType->set_active(SOLID);
947 Update();
949 if (m_pPanel)
950 m_pPanel->TriggerDeckLayouting();
953 void AreaPropertyPanelBase::updateFillBitmap(bool bDisabled, bool bDefaultOrSet, const SfxPoolItem* pState)
955 if (bDefaultOrSet)
957 const XFillBitmapItem* pItem = static_cast<const XFillBitmapItem*>(pState);
958 mpBitmapItem.reset(pItem ? pItem->Clone() : nullptr);
961 if(mpStyleItem && drawing::FillStyle_BITMAP == mpStyleItem->GetValue())
963 mxLbFillAttr->show();
964 mxToolBoxColor->hide();
966 if (bDefaultOrSet)
968 if(mpBitmapItem->isPattern())
969 mxLbFillType->set_active(PATTERN);
970 else
971 mxLbFillType->set_active(BITMAP);
972 Update();
974 else if(bDisabled)
976 mxLbFillAttr->hide();
977 mxLbFillAttr->set_active(-1);
979 else
981 mxLbFillAttr->set_active(-1);
984 if (m_pPanel)
985 m_pPanel->TriggerDeckLayouting();
988 void AreaPropertyPanelBase::NotifyItemUpdate(
989 sal_uInt16 nSID,
990 SfxItemState eState,
991 const SfxPoolItem* pState)
993 const bool bDisabled(SfxItemState::DISABLED == eState);
994 const bool bDefaultOrSet(SfxItemState::DEFAULT <= eState);
995 const bool bDefault(SfxItemState::DEFAULT == eState);
997 switch(nSID)
999 case SID_ATTR_FILL_TRANSPARENCE:
1000 updateFillTransparence(bDisabled, bDefaultOrSet, pState);
1001 break;
1002 case SID_ATTR_FILL_FLOATTRANSPARENCE:
1003 updateFillFloatTransparence(bDisabled, bDefaultOrSet, pState);
1004 break;
1005 case SID_ATTR_FILL_STYLE:
1006 updateFillStyle(bDisabled, bDefaultOrSet, pState);
1007 break;
1008 case SID_ATTR_FILL_COLOR:
1009 updateFillColor(bDefaultOrSet, pState);
1010 break;
1011 case SID_ATTR_FILL_GRADIENT:
1012 updateFillGradient(bDisabled, bDefaultOrSet, pState);
1013 break;
1014 case SID_ATTR_FILL_HATCH:
1015 updateFillHatch(bDisabled, bDefaultOrSet, pState);
1016 break;
1017 case SID_ATTR_FILL_BITMAP:
1018 updateFillBitmap(bDisabled, bDefaultOrSet, pState);
1019 break;
1020 case SID_GRADIENT_LIST:
1022 if(bDefault)
1024 if(mpStyleItem && drawing::FillStyle_GRADIENT == mpStyleItem->GetValue())
1026 if(mpFillGradientItem)
1028 const OUString aString( mpFillGradientItem->GetName() );
1029 const SfxObjectShell* pSh = SfxObjectShell::Current();
1031 mxLbFillAttr->clear();
1032 mxLbFillAttr->set_sensitive(true);
1033 SvxFillAttrBox::Fill(*mxLbFillAttr, pSh->GetItem(SID_GRADIENT_LIST)->GetGradientList());
1034 mxLbFillAttr->set_active_text(aString);
1036 else
1038 mxLbFillAttr->set_active(-1);
1042 break;
1044 case SID_HATCH_LIST:
1046 if(bDefault)
1048 if(mpStyleItem && drawing::FillStyle_HATCH == mpStyleItem->GetValue())
1050 if(mpHatchItem)
1052 const OUString aString( mpHatchItem->GetName() );
1053 const SfxObjectShell* pSh = SfxObjectShell::Current();
1055 mxLbFillAttr->clear();
1056 mxLbFillAttr->set_sensitive(true);
1057 SvxFillAttrBox::Fill(*mxLbFillAttr, pSh->GetItem(SID_HATCH_LIST)->GetHatchList());
1058 mxLbFillAttr->set_active_text(aString);
1060 else
1062 mxLbFillAttr->set_active(-1);
1066 break;
1068 case SID_BITMAP_LIST:
1069 case SID_PATTERN_LIST:
1071 if(bDefault)
1073 if(mpStyleItem && drawing::FillStyle_BITMAP == mpStyleItem->GetValue())
1075 if(mpBitmapItem)
1077 const OUString aString( mpBitmapItem->GetName() );
1078 const SfxObjectShell* pSh = SfxObjectShell::Current();
1079 mxLbFillAttr->clear();
1080 mxLbFillAttr->show();
1081 if(nSID == SID_BITMAP_LIST)
1083 SvxFillAttrBox::Fill(*mxLbFillAttr, pSh->GetItem(SID_BITMAP_LIST)->GetBitmapList());
1085 else if(nSID == SID_PATTERN_LIST)
1087 SvxFillAttrBox::Fill(*mxLbFillAttr, pSh->GetItem(SID_PATTERN_LIST)->GetPatternList());
1089 mxLbFillAttr->set_active_text(aString);
1091 else
1093 mxLbFillAttr->set_active(-1);
1097 break;
1102 void AreaPropertyPanelBase::Update()
1104 const eFillStyle eXFS = static_cast<eFillStyle>(mxLbFillType->get_active());
1105 SfxObjectShell* pSh = SfxObjectShell::Current();
1107 switch( eXFS )
1109 case eFillStyle::NONE:
1111 mxLbFillAttr->show();
1112 mxLbFillGradFrom->hide();
1113 mxLbFillGradTo->hide();
1114 mxMTRAngle->hide();
1115 mxGradientStyle->hide();
1116 mxToolBoxColor->hide();
1117 mxBmpImport->hide();
1118 break;
1120 case eFillStyle::SOLID:
1122 if(mpColorItem)
1124 mxLbFillAttr->hide();
1125 mxLbFillGradFrom->hide();
1126 mxLbFillGradTo->hide();
1127 mxMTRAngle->hide();
1128 mxGradientStyle->hide();
1129 mxToolBoxColor->show();
1130 mxBmpImport->hide();
1132 break;
1134 case eFillStyle::GRADIENT:
1136 mxLbFillAttr->hide();
1137 mxLbFillGradFrom->show();
1138 mxLbFillGradTo->show();
1139 mxMTRAngle->set_sensitive(true);
1140 mxMTRAngle->show();
1141 mxGradientStyle->show();
1142 mxToolBoxColor->hide();
1143 mxBmpImport->hide();
1145 if(pSh && pSh->GetItem(SID_GRADIENT_LIST))
1147 mxLbFillAttr->set_sensitive(true);
1148 mxLbFillAttr->clear();
1149 SvxFillAttrBox::Fill(*mxLbFillAttr, pSh->GetItem(SID_GRADIENT_LIST)->GetGradientList());
1150 mxLbFillGradTo->SetNoSelection();
1151 mxLbFillGradFrom->SetNoSelection();
1152 if (mpFillGradientItem)
1154 const OUString aString(mpFillGradientItem->GetName());
1155 mxLbFillAttr->set_active_text(aString);
1156 const XGradient aGradient = mpFillGradientItem->GetGradientValue();
1157 mxLbFillGradFrom->SelectEntry(aGradient.GetStartColor());
1158 mxLbFillGradTo->SelectEntry(aGradient.GetEndColor());
1159 mxGradientStyle->set_active(sal::static_int_cast< sal_Int32 >( aGradient.GetGradientStyle() ));
1160 if(mxGradientStyle->get_active() == sal_Int32(GradientStyle::Radial))
1161 mxMTRAngle->set_sensitive(false);
1162 else
1163 mxMTRAngle->set_value(aGradient.GetAngle().get() / 10, FieldUnit::DEGREE);
1165 else
1167 mxLbFillAttr->set_active(-1);
1170 else
1172 mxLbFillAttr->set_active(-1);
1174 break;
1176 case eFillStyle::HATCH:
1178 mxLbFillAttr->show();
1179 mxLbFillGradFrom->hide();
1180 mxLbFillGradTo->hide();
1181 mxMTRAngle->hide();
1182 mxGradientStyle->hide();
1183 mxToolBoxColor->hide();
1184 mxBmpImport->hide();
1185 mxBmpImport->hide();
1187 if(pSh && pSh->GetItem(SID_HATCH_LIST))
1189 mxLbFillAttr->set_sensitive(true);
1190 mxLbFillAttr->clear();
1191 SvxFillAttrBox::Fill(*mxLbFillAttr, pSh->GetItem(SID_HATCH_LIST)->GetHatchList());
1193 if(mpHatchItem)
1195 const OUString aString(mpHatchItem->GetName());
1197 mxLbFillAttr->set_active_text( aString );
1199 else
1201 mxLbFillAttr->set_active(-1);
1204 else
1206 mxLbFillAttr->set_active(-1);
1208 break;
1210 case eFillStyle::BITMAP:
1211 case eFillStyle::PATTERN:
1213 mxLbFillAttr->show();
1214 mxLbFillAttr->set_sensitive(true);
1215 mxLbFillAttr->clear();
1216 mxToolBoxColor->hide();
1217 mxLbFillGradFrom->hide();
1218 mxLbFillGradTo->hide();
1219 mxMTRAngle->hide();
1220 mxGradientStyle->hide();
1222 if(mpBitmapItem)
1224 if(pSh && pSh->GetItem(SID_BITMAP_LIST) && eXFS == BITMAP)
1226 if (!comphelper::LibreOfficeKit::isActive())
1227 mxBmpImport->show();
1228 mxLbFillType->set_active(sal_uInt32(BITMAP));
1229 SvxFillAttrBox::Fill(*mxLbFillAttr, pSh->GetItem(SID_BITMAP_LIST)->GetBitmapList());
1231 const OUString aString(mpBitmapItem->GetName());
1232 mxLbFillAttr->set_active_text(aString);
1234 else if(pSh && pSh->GetItem(SID_PATTERN_LIST) && eXFS == PATTERN)
1236 mxBmpImport->hide();
1237 mxLbFillType->set_active(sal_uInt32(PATTERN));
1238 SvxFillAttrBox::Fill(*mxLbFillAttr, pSh->GetItem(SID_PATTERN_LIST)->GetPatternList());
1240 const OUString aString(mpBitmapItem->GetName());
1241 mxLbFillAttr->set_active_text(aString);
1244 else
1245 mxLbFillAttr->set_active(-1);
1246 break;
1248 default:
1249 OSL_ENSURE(false, "Non supported FillType (!)");
1250 break;
1252 if (m_pPanel)
1253 m_pPanel->TriggerDeckLayouting();
1256 IMPL_LINK_NOARG(AreaPropertyPanelBase, ModifyTransSliderHdl, weld::Scale&, void)
1258 const sal_uInt16 nVal = mxSldTransparent->get_value();
1259 SetTransparency(nVal);
1260 const XFillTransparenceItem aLinearItem(nVal);
1261 setFillTransparence(aLinearItem);
1264 IMPL_LINK_NOARG(AreaPropertyPanelBase, ChangeTrgrTypeHdl_Impl, weld::ComboBox&, void)
1266 sal_Int32 nSelectType = mxLBTransType->get_active();
1267 bool bGradient = false;
1268 sal_uInt16 nTrans = 0;
1270 if(!nSelectType)
1272 mxBTNGradient->hide();
1273 mxMTRTransparent->show();
1274 mxSldTransparent->show();
1275 mxMTRTransparent->set_sensitive(true);
1276 mxSldTransparent->set_sensitive(true);
1277 SetTransparency(0);
1279 else if(1 == nSelectType)
1281 mxBTNGradient->hide();
1282 mxMTRTransparent->show();
1283 mxSldTransparent->show();
1284 nTrans = mnLastTransSolid;
1285 mxMTRTransparent->set_value(nTrans, FieldUnit::PERCENT);
1286 mxLBTransType->set_active(1);
1287 mxMTRTransparent->set_sensitive(true);
1288 mxSldTransparent->set_sensitive(true);
1290 else
1292 mxBTNGradient->show();
1294 switch (nSelectType)
1296 case 2:
1297 mxBTNGradient->set_item_icon_name(SIDEBARGRADIENT, maImgLinear);
1298 break;
1299 case 3:
1300 mxBTNGradient->set_item_icon_name(SIDEBARGRADIENT, maImgAxial);
1301 break;
1302 case 4:
1303 mxBTNGradient->set_item_icon_name(SIDEBARGRADIENT, maImgRadial);
1304 break;
1305 case 5:
1306 mxBTNGradient->set_item_icon_name(SIDEBARGRADIENT, maImgElli);
1307 break;
1308 case 6:
1309 mxBTNGradient->set_item_icon_name(SIDEBARGRADIENT, maImgQuad);
1310 break;
1311 case 7:
1312 mxBTNGradient->set_item_icon_name(SIDEBARGRADIENT, maImgSquare);
1313 break;
1316 mxMTRTransparent->hide();
1317 mxSldTransparent->hide();
1318 mxBTNGradient->set_sensitive(true);
1319 bGradient = true;
1322 const XFillTransparenceItem aLinearItem(nTrans);
1323 setFillTransparence(aLinearItem);
1325 if(nSelectType > 1)
1327 nSelectType -= 2;
1330 XGradient aTmpGradient;
1332 switch(static_cast<css::awt::GradientStyle>(nSelectType))
1334 case css::awt::GradientStyle_LINEAR:
1335 aTmpGradient = maGradientLinear;
1336 break;
1337 case css::awt::GradientStyle_AXIAL:
1338 aTmpGradient = maGradientAxial;
1339 break;
1340 case css::awt::GradientStyle_RADIAL:
1341 aTmpGradient = maGradientRadial;
1342 break;
1343 case css::awt::GradientStyle_ELLIPTICAL:
1344 aTmpGradient = maGradientElliptical;
1345 break;
1346 case css::awt::GradientStyle_SQUARE:
1347 aTmpGradient = maGradientSquare;
1348 break;
1349 case css::awt::GradientStyle_RECT:
1350 aTmpGradient = maGradientRect;
1351 break;
1352 default:
1353 break;
1356 const XFillFloatTransparenceItem aGradientItem(aTmpGradient, bGradient);
1357 setFillFloatTransparence(aGradientItem);
1360 IMPL_LINK_NOARG(AreaPropertyPanelBase, ModifyTransparentHdl_Impl, weld::MetricSpinButton&, void)
1362 const sal_uInt16 nTrans = static_cast<sal_uInt16>(mxMTRTransparent->get_value(FieldUnit::PERCENT));
1363 mnLastTransSolid = nTrans;
1364 SetTransparency(nTrans);
1365 const sal_Int32 nSelectType = mxLBTransType->get_active();
1367 if(nTrans && !nSelectType)
1369 mxLBTransType->set_active(1);
1372 const XFillTransparenceItem aLinearItem(nTrans);
1373 setFillTransparence(aLinearItem);
1376 const XGradient& AreaPropertyPanelBase::GetGradient (const css::awt::GradientStyle eStyle) const
1378 switch (eStyle)
1380 default:
1381 case css::awt::GradientStyle_LINEAR:
1382 return maGradientLinear;
1383 case css::awt::GradientStyle_AXIAL:
1384 return maGradientAxial;
1385 case css::awt::GradientStyle_RADIAL:
1386 return maGradientRadial;
1387 case css::awt::GradientStyle_ELLIPTICAL:
1388 return maGradientElliptical;
1389 case css::awt::GradientStyle_SQUARE:
1390 return maGradientSquare;
1391 case css::awt::GradientStyle_RECT:
1392 return maGradientRect;
1396 void AreaPropertyPanelBase::SetGradient (const XGradient& rGradient)
1398 switch (rGradient.GetGradientStyle())
1400 case css::awt::GradientStyle_LINEAR:
1401 maGradientLinear = rGradient;
1402 break;
1403 case css::awt::GradientStyle_AXIAL:
1404 maGradientAxial = rGradient;
1405 break;
1406 case css::awt::GradientStyle_RADIAL:
1407 maGradientRadial = rGradient;
1408 break;
1409 case css::awt::GradientStyle_ELLIPTICAL:
1410 maGradientElliptical = rGradient;
1411 break;
1412 case css::awt::GradientStyle_SQUARE:
1413 maGradientSquare = rGradient;
1414 break;
1415 case css::awt::GradientStyle_RECT:
1416 maGradientRect = rGradient;
1417 break;
1418 default:
1419 break;
1423 sal_Int32 AreaPropertyPanelBase::GetSelectedTransparencyTypeIndex() const
1425 return mxLBTransType->get_active();
1428 } // end of namespace svx::sidebar
1430 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */