20#include <osl/diagnose.h>
24#include <svx/svxids.hrc>
34#include <bitmaps.hlst>
38using namespace css::uno;
68 const css::uno::Reference<css::frame::XFrame>& rxFrame)
69 :
PanelLayout(pParent,
"AreaPropertyPanel",
"svx/ui/sidebararea.ui"),
71 meLastXFS(static_cast<sal_uInt16>(-1)),
76 mxColorTextFT(m_xBuilder->weld_label(
"filllabel")),
77 mxLbFillType(m_xBuilder->weld_combo_box(
"fillstylearea")),
78 mxLbFillAttr(m_xBuilder->weld_combo_box(
"fillattrhb")),
80 mxLbFillGradTo(
new ColorListBox(m_xBuilder->weld_menu_button(
"fillgrad2"), [
this]{ return GetFrameWeld(); })),
81 mxToolBoxColor(m_xBuilder->weld_toolbar(
"selectcolor")),
83 mxTrspTextFT(m_xBuilder->weld_label(
"transparencylabel")),
84 mxLBTransType(m_xBuilder->weld_combo_box(
"transtype")),
85 mxMTRTransparent(m_xBuilder->weld_metric_spin_button(
"settransparency", FieldUnit::PERCENT)),
86 mxSldTransparent(m_xBuilder->weld_scale(
"transparencyslider")),
87 mxBTNGradient(m_xBuilder->weld_toolbar(
"selectgradient")),
88 mxMTRAngle(m_xBuilder->weld_metric_spin_button(
"gradangle", FieldUnit::DEGREE)),
89 mxGradientStyle(m_xBuilder->weld_combo_box(
"gradientstyle")),
90 mxBmpImport(m_xBuilder->weld_button(
"bmpimport")),
91 maImgAxial(BMP_AXIAL),
94 maImgRadial(BMP_RADIAL),
95 maImgSquare(BMP_SQUARE),
96 maImgLinear(BMP_LINEAR)
202 auto xWait = std::make_unique<weld::WaitObject>(
m_xContainer.get());
208 mxLbFillAttr->clear();
213 OUString aFileName =
aURL.GetLastName().getToken(0,
'.');
214 OUString
aName = aFileName;
216 XBitmapListRef pList = pSh->GetItem(SID_BITMAP_LIST)->GetBitmapList();
219 bool bValidBitmapName =
false;
220 while( !bValidBitmapName )
222 bValidBitmapName =
true;
223 for(
tools::Long i = 0;
i < pList->Count() && bValidBitmapName;
i++ )
225 if(
aName == pList->GetBitmap(
i)->GetName() )
227 bValidBitmapName =
false;
228 aName = aFileName + OUString::number(j++);
233 pList->Insert(std::make_unique<XBitmapEntry>(aGraphic,
aName));
238 mxLbFillAttr->set_active_text(
aName);
239 SelectFillAttrHdl(*mxLbFillAttr);
245 FillStyleChanged(
true);
250 SelectFillAttrHdl_Impl();
255 SelectFillAttrHdl_Impl();
260 SelectFillAttrHdl_Impl();
265 sal_Int32 nPosFillStyle =
static_cast<eFillStyle
>(
mxLbFillType->get_active());
270 const bool bFillStyleChange(
static_cast<eFillStyle
>(
meLastXFS) !=
static_cast<eFillStyle
>(nPosFillStyle));
272 switch(nPosFillStyle)
274 case eFillStyle::NONE:
285 case eFillStyle::SOLID:
295 case eFillStyle::GRADIENT:
298 if (pSh && pSh->
GetItem(SID_COLOR_TABLE))
312 case eFillStyle::HATCH:
321 if (
nPos != -1 && pSh && pSh->
GetItem(SID_HATCH_LIST))
325 if(nPos < pItem->GetHatchList()->
Count())
342 case eFillStyle::BITMAP:
351 if (
nPos != -1 && pSh && pSh->
GetItem(SID_BITMAP_LIST))
355 if(nPos < pItem->GetBitmapList()->
Count())
372 case eFillStyle::PATTERN:
381 if (
nPos != -1 && pSh && pSh->
GetItem(SID_PATTERN_LIST))
385 if(nPos < pItem->GetPatternList()->
Count())
415 bool bShowLbFillAttr =
false;
416 bool bShowLbFillGradFrom =
false;
417 bool bShowLbFillGradTo =
false;
418 bool bShowGradientStyle =
false;
419 bool bShowMTRAngle =
false;
420 bool bShowToolBoxColor =
false;
421 bool bShowBmpImport =
false;
444 bShowToolBoxColor =
true;
459 bShowLbFillGradFrom =
true;
460 bShowLbFillGradTo =
true;
461 bShowGradientStyle =
true;
462 bShowMTRAngle =
true;
505 if (pSh->
GetItem(SID_GRADIENT_LIST))
508 pSh->
GetItem(SID_GRADIENT_LIST)->GetGradientList());
528 if (
mxGradientStyle->get_active() == sal_Int32(css::awt::GradientStyle_RADIAL))
548 bShowLbFillAttr =
true;
560 if (mnLastPosHatch < pXHatchList->
Count())
585 bShowLbFillAttr =
true;
594 bShowBmpImport =
true;
603 if (mnLastPosBitmap < pXBitmapList->
Count())
615 bShowBmpImport =
false;
628 if (mnLastPosPattern < pXPatternList->
Count())
640 bShowLbFillAttr =
false;
687 bool bZeroValue(
false);
721 sal_Int32 nEntryPos(0);
722 OUString* pImage =
nullptr;
734 case css::awt::GradientStyle_LINEAR:
740 case css::awt::GradientStyle_AXIAL:
746 case css::awt::GradientStyle_RADIAL:
752 case css::awt::GradientStyle_ELLIPTICAL:
758 case css::awt::GradientStyle_SQUARE:
764 case css::awt::GradientStyle_RECT:
817 else if (bDefaultOrSet)
881 else if (bDefaultOrSet && pState)
892 case drawing::FillStyle_NONE:
900 case drawing::FillStyle_SOLID:
903 case drawing::FillStyle_GRADIENT:
906 case drawing::FillStyle_HATCH:
909 case drawing::FillStyle_BITMAP:
1082 const bool bDisabled(SfxItemState::DISABLED == eState);
1083 const bool bDefaultOrSet(SfxItemState::DEFAULT <= eState);
1084 const bool bDefault(SfxItemState::DEFAULT == eState);
1088 case SID_ATTR_FILL_TRANSPARENCE:
1091 case SID_ATTR_FILL_FLOATTRANSPARENCE:
1094 case SID_ATTR_FILL_STYLE:
1097 case SID_ATTR_FILL_COLOR:
1100 case SID_ATTR_FILL_GRADIENT:
1103 case SID_ATTR_FILL_HATCH:
1106 case SID_ATTR_FILL_BITMAP:
1109 case SID_ATTR_FILL_USE_SLIDE_BACKGROUND:
1112 case SID_GRADIENT_LIST:
1138 case SID_HATCH_LIST:
1164 case SID_BITMAP_LIST:
1165 case SID_PATTERN_LIST:
1179 if(nSID == SID_BITMAP_LIST)
1181 else if(nSID == SID_PATTERN_LIST)
1200 const sal_uInt16 nVal = mxSldTransparent->get_value();
1201 SetTransparency(nVal);
1203 setFillTransparence(aLinearItem);
1208 sal_Int32 nSelectType = mxLBTransType->get_active();
1209 bool bGradient =
false;
1210 sal_uInt16 nTrans = 0;
1214 mxBTNGradient->hide();
1215 mxMTRTransparent->show();
1216 mxSldTransparent->show();
1217 mxMTRTransparent->set_sensitive(
true);
1218 mxSldTransparent->set_sensitive(
true);
1221 else if(1 == nSelectType)
1223 mxBTNGradient->hide();
1224 mxMTRTransparent->show();
1225 mxSldTransparent->show();
1226 nTrans = mnLastTransSolid;
1227 mxMTRTransparent->set_value(nTrans, FieldUnit::PERCENT);
1228 mxLBTransType->set_active(1);
1229 mxMTRTransparent->set_sensitive(
true);
1230 mxSldTransparent->set_sensitive(
true);
1234 mxBTNGradient->show();
1236 switch (nSelectType)
1258 mxMTRTransparent->hide();
1259 mxSldTransparent->hide();
1260 mxBTNGradient->set_sensitive(
true);
1265 setFillTransparence(aLinearItem);
1274 switch(
static_cast<css::awt::GradientStyle
>(nSelectType))
1276 case css::awt::GradientStyle_LINEAR:
1277 aTmpGradient = maGradientLinear;
1279 case css::awt::GradientStyle_AXIAL:
1280 aTmpGradient = maGradientAxial;
1282 case css::awt::GradientStyle_RADIAL:
1283 aTmpGradient = maGradientRadial;
1285 case css::awt::GradientStyle_ELLIPTICAL:
1286 aTmpGradient = maGradientElliptical;
1288 case css::awt::GradientStyle_SQUARE:
1289 aTmpGradient = maGradientSquare;
1291 case css::awt::GradientStyle_RECT:
1292 aTmpGradient = maGradientRect;
1299 setFillFloatTransparence(aGradientItem);
1304 const sal_uInt16 nTrans =
static_cast<sal_uInt16
>(mxMTRTransparent->get_value(FieldUnit::PERCENT));
1305 mnLastTransSolid = nTrans;
1306 SetTransparency(nTrans);
1307 const sal_Int32 nSelectType = mxLBTransType->get_active();
1309 if(nTrans && !nSelectType)
1311 mxLBTransType->set_active(1);
1315 setFillTransparence(aLinearItem);
1323 case css::awt::GradientStyle_LINEAR:
1325 case css::awt::GradientStyle_AXIAL:
1327 case css::awt::GradientStyle_RADIAL:
1329 case css::awt::GradientStyle_ELLIPTICAL:
1331 case css::awt::GradientStyle_SQUARE:
1333 case css::awt::GradientStyle_RECT:
1342 case css::awt::GradientStyle_LINEAR:
1345 case css::awt::GradientStyle_AXIAL:
1348 case css::awt::GradientStyle_RADIAL:
1351 case css::awt::GradientStyle_ELLIPTICAL:
1354 case css::awt::GradientStyle_SQUARE:
1357 case css::awt::GradientStyle_RECT:
1384 aColorStops.emplace_back(0.0,
mxLbFillGradFrom->GetSelectEntryColor().getBColor());
1385 aColorStops.emplace_back(1.0,
mxLbFillGradTo->GetSelectEntryColor().getBColor());
constexpr OUStringLiteral SIDEBARGRADIENT
sfx2::sidebar::Panel * m_pPanel
virtual weld::Window * GetFrameWeld() const
static SAL_WARN_UNUSED_RESULT SfxObjectShell * Current()
const SfxPoolItem * GetItem(sal_uInt16 nSlotId) const
virtual SfxUInt16Item * Clone(SfxItemPool *=nullptr) const override
const XBitmapListRef & GetBitmapList() const
const XGradientListRef & GetGradientList() const
const XHatchListRef & GetHatchList() const
ErrCode GetGraphic(Graphic &) const
const XPatternListRef & GetPatternList() const
const GraphicObject & GetGraphicObject() const
virtual XFillBitmapItem * Clone(SfxItemPool *pPool=nullptr) const override
virtual XFillColorItem * Clone(SfxItemPool *pPool=nullptr) const override
virtual XFillFloatTransparenceItem * Clone(SfxItemPool *pPool=nullptr) const override
virtual XFillGradientItem * Clone(SfxItemPool *pPool=nullptr) const override
virtual XFillHatchItem * Clone(SfxItemPool *pPool=nullptr) const override
virtual XFillStyleItem * Clone(SfxItemPool *pPool=nullptr) const override
Item to enable slide background for filled objects.
const OUString & GetName() const
void SetGradientStyle(css::awt::GradientStyle eNewStyle)
void SetColorStops(const basegfx::BColorStops &rSteps)
void SetYOffset(sal_uInt16 nNewOffset)
void SetXOffset(sal_uInt16 nNewOffset)
void SetBorder(sal_uInt16 nNewBorder)
const basegfx::BColorStops & GetColorStops() const
Degree10 GetAngle() const
css::awt::GradientStyle GetGradientStyle() const
void SetAngle(Degree10 nNewAngle)
constexpr ::Color COL_AUTO(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
#define LINK(Instance, Class, Member)
SVX_DLLPUBLIC void Fill(weld::ComboBox &, const XHatchListRef &pList)
SVX_DLLPUBLIC void Fill(weld::ComboBox &rListBox)
Reference< XNameAccess > m_xContainer
constexpr OUStringLiteral PATTERN