diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2015-07-21 18:11:08 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2015-07-26 00:24:39 +0200 |
commit | c6ac33db57df1a7e8b2faf45c0bc23d86503a813 (patch) | |
tree | 86709165e96eb41983cfeb7dd5ca2877a49f2149 /svx | |
parent | ab0c81c09798ae5d028a87dfcf249953f1b42f8e (diff) |
extract some code for reuse by chart2 sidebar
Change-Id: I44e2378dafa66f53588027cca56dc52cb4cec794
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/sidebar/area/AreaPropertyPanelBase.cxx | 404 |
1 files changed, 213 insertions, 191 deletions
diff --git a/svx/source/sidebar/area/AreaPropertyPanelBase.cxx b/svx/source/sidebar/area/AreaPropertyPanelBase.cxx index 890abe3b823c..bf48573077c3 100644 --- a/svx/source/sidebar/area/AreaPropertyPanelBase.cxx +++ b/svx/source/sidebar/area/AreaPropertyPanelBase.cxx @@ -592,226 +592,248 @@ void AreaPropertyPanelBase::ImpUpdateTransparencies() } } -void AreaPropertyPanelBase::NotifyItemUpdate( - sal_uInt16 nSID, - SfxItemState eState, - const SfxPoolItem* pState, - const bool /*bIsEnabled*/) +void AreaPropertyPanelBase::updateFillTransparence(bool bDisabled, bool bDefault, const SfxUInt16Item* pItem) { - const bool bDisabled(SfxItemState::DISABLED == eState); + if (bDisabled) + { + mpTransparanceItem.reset(); + return; + } + else if(bDefault) + { + if(pItem && (!mpTransparanceItem || *pItem != *mpTransparanceItem)) + { + mpTransparanceItem.reset(static_cast<SfxUInt16Item*>(pItem->Clone())); + } + else + { + mpTransparanceItem.reset(); + } + } + else + { + mpTransparanceItem.reset(); + } - switch(nSID) + // update transparency settings dependent of mpTransparanceItem and mpFloatTransparenceItem + ImpUpdateTransparencies(); +} + +void AreaPropertyPanelBase::updateFillFloatTransparence(bool bDisabled, bool bDefault, const XFillFloatTransparenceItem* pItem) +{ + if (bDisabled) { - case SID_ATTR_FILL_TRANSPARENCE: - case SID_ATTR_FILL_FLOATTRANSPARENCE: + mpFloatTransparenceItem.reset(); + return; + } + + if(bDefault) + { + if(pItem && (!mpFloatTransparenceItem || *pItem != *mpFloatTransparenceItem)) + { + mpFloatTransparenceItem.reset(static_cast<XFillFloatTransparenceItem*>(pItem->Clone())); + } + else { - bool bFillTransparenceChanged(false); + mpFloatTransparenceItem.reset(); + } + } + else + { + mpFloatTransparenceItem.reset(); + } - if(SID_ATTR_FILL_TRANSPARENCE == nSID) - { - bFillTransparenceChanged = true; + // update transparency settings dependent of mpTransparanceItem and mpFloatTransparenceItem + ImpUpdateTransparencies(); +} - if(eState >= SfxItemState::DEFAULT) - { - const SfxUInt16Item* pItem = dynamic_cast< const SfxUInt16Item* >(pState); +void AreaPropertyPanelBase::updateFillStyle(bool bDisabled, bool bDefault, const XFillStyleItem* pItem) +{ + if(bDisabled) + { + mpLbFillType->Disable(); + mpColorTextFT->Disable(); + mpLbFillType->SetNoSelection(); + mpLbFillAttr->Show(); + mpLbFillAttr->Disable(); + mpLbFillAttr->SetNoSelection(); + mpToolBoxColor->Hide(); + meLastXFS = static_cast<sal_uInt16>(-1); + mpStyleItem.reset(); + } + else if(bDefault && pItem) + { + mpStyleItem.reset(dynamic_cast< XFillStyleItem* >(pItem->Clone())); + mpLbFillType->Enable(); + mpColorTextFT->Enable(); + drawing::FillStyle eXFS = (drawing::FillStyle)mpStyleItem->GetValue(); + meLastXFS = eXFS; + mpLbFillType->SelectEntryPos(sal::static_int_cast< sal_Int32 >(eXFS)); + + if(drawing::FillStyle_NONE == eXFS) + { + mpLbFillAttr->SetNoSelection(); + mpLbFillAttr->Disable(); + } - if(pItem && (!mpTransparanceItem || *pItem != *mpTransparanceItem)) - { - mpTransparanceItem.reset(static_cast<SfxUInt16Item*>(pItem->Clone())); - } - else - { - mpTransparanceItem.reset(); - } - } - else - { - mpTransparanceItem.reset(); - } - } - else // if(SID_ATTR_FILL_FLOATTRANSPARENCE == nSID) - { - bFillTransparenceChanged = true; + Update(); + return; + } - if(eState >= SfxItemState::DEFAULT) - { - const XFillFloatTransparenceItem* pItem = dynamic_cast< const XFillFloatTransparenceItem* >(pState); + mpLbFillType->SetNoSelection(); + mpLbFillAttr->Show(); + mpLbFillAttr->Disable(); + mpLbFillAttr->SetNoSelection(); + mpToolBoxColor->Hide(); + meLastXFS = static_cast<sal_uInt16>(-1); + mpStyleItem.reset(); +} - if(pItem && (!mpFloatTransparenceItem || *pItem != *mpFloatTransparenceItem)) - { - mpFloatTransparenceItem.reset(static_cast<XFillFloatTransparenceItem*>(pItem->Clone())); - } - else - { - mpFloatTransparenceItem.reset(); - } - } - else - { - mpFloatTransparenceItem.reset(); - } - } +void AreaPropertyPanelBase::updateFillGradient(bool bDisabled, bool bDefault, const XFillGradientItem* pItem) +{ + if(bDefault) + { + mpFillGradientItem.reset(pItem ? static_cast<XFillGradientItem*>(pItem->Clone()) : 0); + } - if(bFillTransparenceChanged) - { - // update transparency settings dependent of mpTransparanceItem and mpFloatTransparenceItem - ImpUpdateTransparencies(); - } - break; + if(mpStyleItem && drawing::FillStyle_GRADIENT == (drawing::FillStyle)mpStyleItem->GetValue()) + { + mpLbFillAttr->Show(); + mpToolBoxColor->Hide(); + + if(bDefault) + { + mpLbFillAttr->Enable(); + Update(); } - case SID_ATTR_FILL_STYLE: + else if(bDisabled) { - if(bDisabled) - { - mpLbFillType->Disable(); - mpColorTextFT->Disable(); - mpLbFillType->SetNoSelection(); - mpLbFillAttr->Show(); - mpLbFillAttr->Disable(); - mpLbFillAttr->SetNoSelection(); - mpToolBoxColor->Hide(); - meLastXFS = static_cast<sal_uInt16>(-1); - mpStyleItem.reset(); - } - else if(eState >= SfxItemState::DEFAULT) - { - const XFillStyleItem* pItem = dynamic_cast< const XFillStyleItem* >(pState); + mpLbFillAttr->Disable(); + mpLbFillAttr->SetNoSelection(); + } + else + { + mpLbFillAttr->SetNoSelection(); + } + } +} - if(pItem) - { - mpStyleItem.reset(dynamic_cast< XFillStyleItem* >(pItem->Clone())); - mpLbFillType->Enable(); - mpColorTextFT->Enable(); - drawing::FillStyle eXFS = (drawing::FillStyle)mpStyleItem->GetValue(); - meLastXFS = eXFS; - mpLbFillType->SelectEntryPos(sal::static_int_cast< sal_Int32 >(eXFS)); - - if(drawing::FillStyle_NONE == eXFS) - { - mpLbFillAttr->SetNoSelection(); - mpLbFillAttr->Disable(); - } +void AreaPropertyPanelBase::updateFillHatch(bool bDisabled, bool bDefault, const XFillHatchItem* pItem) +{ + if(bDefault) + { + mpHatchItem.reset(pItem ? static_cast<XFillHatchItem*>(pItem->Clone()) : 0); + } - Update(); - break; - } - } + if(mpStyleItem && drawing::FillStyle_HATCH == (drawing::FillStyle)mpStyleItem->GetValue()) + { + mpLbFillAttr->Show(); + mpToolBoxColor->Hide(); - mpLbFillType->SetNoSelection(); - mpLbFillAttr->Show(); + if(bDefault) + { + mpLbFillAttr->Enable(); + Update(); + } + else if(bDisabled) + { mpLbFillAttr->Disable(); mpLbFillAttr->SetNoSelection(); - mpToolBoxColor->Hide(); - meLastXFS = static_cast<sal_uInt16>(-1); - mpStyleItem.reset(); - break; } - case SID_ATTR_FILL_COLOR: + else { - if(SfxItemState::DEFAULT == eState) - { - mpColorItem.reset(pState ? static_cast<XFillColorItem*>(pState->Clone()) : 0); - } + mpLbFillAttr->SetNoSelection(); + } + } +} - if(mpStyleItem && drawing::FillStyle_SOLID == (drawing::FillStyle)mpStyleItem->GetValue()) - { - mpLbFillAttr->Hide(); - mpToolBoxColor->Show(); +void AreaPropertyPanelBase::updateFillColor(bool bDefault, const XFillColorItem* pItem) +{ + if(bDefault) + { + mpColorItem.reset(pItem ? static_cast<XFillColorItem*>(pItem->Clone()) : 0); + } - Update(); - } - break; - } - case SID_ATTR_FILL_GRADIENT: - { - if(SfxItemState::DEFAULT == eState) - { - mpFillGradientItem.reset(pState ? static_cast<XFillGradientItem*>(pState->Clone()) : 0); - } + if(mpStyleItem && drawing::FillStyle_SOLID == (drawing::FillStyle)mpStyleItem->GetValue()) + { + mpLbFillAttr->Hide(); + mpToolBoxColor->Show(); - if(mpStyleItem && drawing::FillStyle_GRADIENT == (drawing::FillStyle)mpStyleItem->GetValue()) - { - mpLbFillAttr->Show(); - mpToolBoxColor->Hide(); + Update(); + } +} - if(SfxItemState::DEFAULT == eState) - { - mpLbFillAttr->Enable(); - Update(); - } - else if(SfxItemState::DISABLED == eState ) - { - mpLbFillAttr->Disable(); - mpLbFillAttr->SetNoSelection(); - } - else - { - mpLbFillAttr->SetNoSelection(); - } - } - break; - } - case SID_ATTR_FILL_HATCH: - { - if(SfxItemState::DEFAULT == eState) - { - mpHatchItem.reset(pState ? static_cast<XFillHatchItem*>(pState->Clone()) : 0); - } +void AreaPropertyPanelBase::updateFillBitmap(bool bDisabled, bool bDefault, const XFillBitmapItem* pItem) +{ + if(bDefault) + { + mpBitmapItem.reset(pItem ? static_cast<XFillBitmapItem*>(pItem->Clone()) : 0); + } - if(mpStyleItem && drawing::FillStyle_HATCH == (drawing::FillStyle)mpStyleItem->GetValue()) - { - mpLbFillAttr->Show(); - mpToolBoxColor->Hide(); + if(mpStyleItem && drawing::FillStyle_BITMAP == (drawing::FillStyle)mpStyleItem->GetValue()) + { + mpLbFillAttr->Show(); + mpToolBoxColor->Hide(); - if(SfxItemState::DEFAULT == eState) - { - mpLbFillAttr->Enable(); - Update(); - } - else if(SfxItemState::DISABLED == eState ) - { - mpLbFillAttr->Disable(); - mpLbFillAttr->SetNoSelection(); - } - else - { - mpLbFillAttr->SetNoSelection(); - } - } - break; + if(bDefault) + { + mpLbFillAttr->Enable(); + Update(); } - case SID_ATTR_FILL_BITMAP: + else if(bDisabled) { - if(SfxItemState::DEFAULT == eState) - { - mpBitmapItem.reset(pState ? static_cast<XFillBitmapItem*>(pState->Clone()) : 0); - } + mpLbFillAttr->Disable(); + mpLbFillAttr->SetNoSelection(); + } + else + { + mpLbFillAttr->SetNoSelection(); + } + } +} - if(mpStyleItem && drawing::FillStyle_BITMAP == (drawing::FillStyle)mpStyleItem->GetValue()) - { - mpLbFillAttr->Show(); - mpToolBoxColor->Hide(); +void AreaPropertyPanelBase::NotifyItemUpdate( + sal_uInt16 nSID, + SfxItemState eState, + const SfxPoolItem* pState, + const bool /*bIsEnabled*/) +{ + const bool bDisabled(SfxItemState::DISABLED == eState); + const bool bDefault(SfxItemState::DEFAULT == eState); - if(SfxItemState::DEFAULT == eState) - { - mpLbFillAttr->Enable(); - Update(); - } - else if(SfxItemState::DISABLED == eState ) - { - mpLbFillAttr->Disable(); - mpLbFillAttr->SetNoSelection(); - } - else - { - mpLbFillAttr->SetNoSelection(); - } - } - break; - } + switch(nSID) + { + case SID_ATTR_FILL_TRANSPARENCE: + updateFillTransparence(bDisabled, bDefault, + static_cast<const SfxUInt16Item*>(pState)); + break; + case SID_ATTR_FILL_FLOATTRANSPARENCE: + updateFillFloatTransparence(bDisabled, bDefault, + static_cast<const XFillFloatTransparenceItem*>(pState)); + break; + case SID_ATTR_FILL_STYLE: + updateFillStyle(bDisabled, bDefault, + static_cast<const XFillStyleItem*>(pState)); + break; + case SID_ATTR_FILL_COLOR: + updateFillColor(bDefault, + static_cast<const XFillColorItem*>(pState)); + break; + case SID_ATTR_FILL_GRADIENT: + updateFillGradient(bDisabled, bDefault, + static_cast<const XFillGradientItem*>(pState)); + break; + case SID_ATTR_FILL_HATCH: + updateFillHatch(bDisabled, bDefault, + static_cast<const XFillHatchItem*>(pState)); + break; + case SID_ATTR_FILL_BITMAP: + updateFillBitmap(bDisabled, bDefault, + static_cast<const XFillBitmapItem*>(pState)); + break; case SID_GRADIENT_LIST: { - if(SfxItemState::DEFAULT == eState) + if(bDefault) { if(mpStyleItem && drawing::FillStyle_GRADIENT == (drawing::FillStyle)mpStyleItem->GetValue()) { @@ -836,7 +858,7 @@ void AreaPropertyPanelBase::NotifyItemUpdate( } case SID_HATCH_LIST: { - if(SfxItemState::DEFAULT == eState) + if(bDefault) { if(mpStyleItem && drawing::FillStyle_HATCH == (drawing::FillStyle)mpStyleItem->GetValue()) { @@ -861,7 +883,7 @@ void AreaPropertyPanelBase::NotifyItemUpdate( } case SID_BITMAP_LIST: { - if(SfxItemState::DEFAULT == eState) + if(bDefault) { if(mpStyleItem && drawing::FillStyle_BITMAP == (drawing::FillStyle)mpStyleItem->GetValue()) { |