diff options
author | Armin Le Grand <alg@apache.org> | 2013-04-23 12:53:29 +0000 |
---|---|---|
committer | Michael Meeks <michael.meeks@suse.com> | 2013-05-20 11:33:19 +0100 |
commit | 1820bc972ba8eb64cae4451ce4dcf73800d88937 (patch) | |
tree | b1f7f88deb173a39a7b207c819784e1961ea1723 /svx/source/sidebar/line | |
parent | a84a71b9fc4375908c1ae3bff70fc60a563cdc31 (diff) |
Resolves: #ii122111# Corrected LinePropertyPanel::NotifyItemUpdate
to use pState with more care
(cherry picked from commit 12df8f6dd3ed9ea37d9d0dd61bc56ada3bc062b1)
Conflicts:
svx/source/sidebar/line/LinePropertyPanel.cxx
Change-Id: I380a4f9f8e43340ee03a1cd10546367b6818f74e
Diffstat (limited to 'svx/source/sidebar/line')
-rw-r--r-- | svx/source/sidebar/line/LinePropertyPanel.cxx | 225 | ||||
-rw-r--r-- | svx/source/sidebar/line/LinePropertyPanel.hxx | 5 |
2 files changed, 126 insertions, 104 deletions
diff --git a/svx/source/sidebar/line/LinePropertyPanel.cxx b/svx/source/sidebar/line/LinePropertyPanel.cxx index c6da70028826..61f07b0ec3ca 100644 --- a/svx/source/sidebar/line/LinePropertyPanel.cxx +++ b/svx/source/sidebar/line/LinePropertyPanel.cxx @@ -224,12 +224,7 @@ LinePropertyPanel::LinePropertyPanel( mxFrame(rxFrame), mpBindings(pBindings), mbColorAvailable(true), - mbStyleAvailable(false), - mbDashAvailable(false), - mbTransAvailable(true), - mbWidthValuable(true), - mbStartAvailable(true), - mbEndAvailable(true) + mbWidthValuable(true) { Initialize(); FreeResource(); @@ -387,42 +382,43 @@ void LinePropertyPanel::NotifyItemUpdate( const bool bIsEnabled) { (void)bIsEnabled; + const bool bDisabled(SFX_ITEM_DISABLED == eState); switch(nSID) { case SID_ATTR_LINE_COLOR: { - if( eState == SFX_ITEM_DISABLED) + if(bDisabled) { mpFTColor->Disable(); mpTBColor->Disable(); - mbColorAvailable = false; - mpColorUpdater->Update(COL_WHITE); } else { mpFTColor->Enable(); mpTBColor->Enable(); - const XLineColorItem* pItem = dynamic_cast< const XLineColorItem* >(pState); + } - if(eState >= SFX_ITEM_DEFAULT && pItem) + if(eState >= SFX_ITEM_DEFAULT) + { + const XLineColorItem* pItem = dynamic_cast< const XLineColorItem* >(pState); + if(pItem) { maColor = pItem->GetColorValue(); mbColorAvailable = true; mpColorUpdater->Update(maColor); - } - else - { - mbColorAvailable = false; - mpColorUpdater->Update(COL_WHITE); + break; } } + + mbColorAvailable = false; + mpColorUpdater->Update(COL_WHITE); break; } case SID_ATTR_LINE_DASH: case SID_ATTR_LINE_STYLE: { - if( eState == SFX_ITEM_DISABLED) + if(bDisabled) { mpFTStyle->Disable(); mpLBStyle->Disable(); @@ -431,140 +427,159 @@ void LinePropertyPanel::NotifyItemUpdate( { mpFTStyle->Enable(); mpLBStyle->Enable(); - if( eState >= SFX_ITEM_DEFAULT ) + } + + if(eState >= SFX_ITEM_DEFAULT) + { + if(nSID == SID_ATTR_LINE_STYLE) { - if(nSID == SID_ATTR_LINE_STYLE) - { - const XLineStyleItem* pItem = dynamic_cast< const XLineStyleItem* >(pState); + const XLineStyleItem* pItem = dynamic_cast< const XLineStyleItem* >(pState); - if(pItem) - { - mbStyleAvailable =true; - mpStyleItem.reset(pState ? (XLineStyleItem*)pItem->Clone() : 0); - } - } - else if(nSID == SID_ATTR_LINE_DASH) + if(pItem) { - const XLineDashItem* pItem = dynamic_cast< const XLineDashItem* >(pState); + mpStyleItem.reset(pState ? (XLineStyleItem*)pItem->Clone() : 0); + } + } + else // if(nSID == SID_ATTR_LINE_DASH) + { + const XLineDashItem* pItem = dynamic_cast< const XLineDashItem* >(pState); - if(pItem) - { - mbDashAvailable = true; - mpDashItem.reset(pState ? (XLineDashItem*)pItem->Clone() : 0); - } + if(pItem) + { + mpDashItem.reset(pState ? (XLineDashItem*)pItem->Clone() : 0); } } + } + else + { + if(nSID == SID_ATTR_LINE_STYLE) + { + mpStyleItem.reset(0); + } else { - if(nSID == SID_ATTR_LINE_STYLE) - mbStyleAvailable = false; - else - mbDashAvailable = false; + mpDashItem.reset(0); } - - SelectLineStyle(); } + + SelectLineStyle(); break; } case SID_ATTR_LINE_TRANSPARENCE: { - if( eState == SFX_ITEM_DISABLED ) + if(bDisabled) { mpFTTrancparency->Disable(); mpMFTransparent->Disable(); - mpMFTransparent->SetValue(0);//add - mpMFTransparent->SetText(String()); - mbTransAvailable = false; } else { mpFTTrancparency->Enable(); mpMFTransparent->Enable(); - mbTransAvailable = true; + } + + if(eState >= SFX_ITEM_DEFAULT) + { const XLineTransparenceItem* pItem = dynamic_cast< const XLineTransparenceItem* >(pState); - if(eState != SFX_ITEM_DONTCARE && pItem) + if(pItem) { mnTrans = pItem->GetValue(); mpMFTransparent->SetValue(mnTrans); - } - else - { - mpMFTransparent->SetValue(0);//add - mpMFTransparent->SetText(String()); + break; } } + + mpMFTransparent->SetValue(0);//add + mpMFTransparent->SetText(String()); break; } case SID_ATTR_LINE_WIDTH: { - if(eState == SFX_ITEM_DISABLED) + if(bDisabled) { mpTBWidth->Disable(); mpFTWidth->Disable(); } else { - //enable mpTBWidth->Enable(); mpFTWidth->Enable(); + } + + if(eState >= SFX_ITEM_DEFAULT) + { const XLineWidthItem* pItem = dynamic_cast< const XLineWidthItem* >(pState); - if(eState >= SFX_ITEM_AVAILABLE && pItem) + if(pItem) { mnWidthCoreValue = pItem->GetValue(); mbWidthValuable = true; - } - else - { - mbWidthValuable = false; + SetWidthIcon(); + break; } } + + mbWidthValuable = false; SetWidthIcon(); break; } case SID_ATTR_LINE_START: { - mpFTArrow->Enable(); - mpLBStart->Enable(); + if(bDisabled) + { + mpFTArrow->Disable(); + mpLBStart->Disable(); + } + else + { + mpFTArrow->Enable(); + mpLBStart->Enable(); + } - if(eState != SFX_ITEM_DONTCARE) + if(eState >= SFX_ITEM_DEFAULT) { const XLineStartItem* pItem = dynamic_cast< const XLineStartItem* >(pState); if(pItem) { - mbStartAvailable = true; //add mpStartItem.reset(pItem ? (XLineStartItem*)pItem->Clone() : 0); SelectEndStyle(true); break; } } - mpLBStart->SetNoSelection(); - mbStartAvailable = false; //add + mpStartItem.reset(0); + SelectEndStyle(true); break; } case SID_ATTR_LINE_END: { - mpFTArrow->Enable(); - mpLBEnd->Enable(); + if(bDisabled) + { + mpFTArrow->Disable(); + mpLBEnd->Disable(); + } + else + { + mpFTArrow->Enable(); + mpLBEnd->Enable(); + } - if(eState != SFX_ITEM_DONTCARE) + if(eState >= SFX_ITEM_DEFAULT) { const XLineEndItem* pItem = dynamic_cast< const XLineEndItem* >(pState); if(pItem) { - mbEndAvailable = true; //add mpEndItem.reset(pItem ? (XLineEndItem*)pItem->Clone() : 0); SelectEndStyle(false); break; } } - mpLBEnd->SetNoSelection(); - mbEndAvailable = false; //add + mpEndItem.reset(0); + SelectEndStyle(false); break; } case SID_LINEEND_LIST: @@ -582,18 +597,23 @@ void LinePropertyPanel::NotifyItemUpdate( } case SID_ATTR_LINE_JOINT: { - if(eState == SFX_ITEM_DISABLED) + if(bDisabled) { mpLBEdgeStyle->Disable(); } else { mpLBEdgeStyle->Enable(); + } + + if(eState >= SFX_ITEM_DEFAULT) + { const XLineJointItem* pItem = dynamic_cast< const XLineJointItem* >(pState); - sal_uInt16 nEntryPos(0); - if(eState >= SFX_ITEM_AVAILABLE && pItem) + if(pItem) { + sal_uInt16 nEntryPos(0); + switch(pItem->GetValue()) { case com::sun::star::drawing::LineJoint_MIDDLE: @@ -621,33 +641,37 @@ void LinePropertyPanel::NotifyItemUpdate( default: break; } - } - if(nEntryPos) - { - mpLBEdgeStyle->SelectEntryPos(nEntryPos - 1); - } - else - { - mpLBEdgeStyle->SetNoSelection(); + if(nEntryPos) + { + mpLBEdgeStyle->SelectEntryPos(nEntryPos - 1); + break; + } } } + + mpLBEdgeStyle->SetNoSelection(); break; } case SID_ATTR_LINE_CAP: { - if(eState == SFX_ITEM_DISABLED) + if(bDisabled) { mpLBCapStyle->Disable(); } else { mpLBCapStyle->Enable(); + } + + if(eState >= SFX_ITEM_DEFAULT) + { const XLineCapItem* pItem = dynamic_cast< const XLineCapItem* >(pState); - sal_uInt16 nEntryPos(0); - if(eState >= SFX_ITEM_AVAILABLE && pItem) + if(pItem) { + sal_uInt16 nEntryPos(0); + switch(pItem->GetValue()) { case com::sun::star::drawing::LineCap_BUTT: @@ -669,16 +693,15 @@ void LinePropertyPanel::NotifyItemUpdate( default: break; } - } - if(nEntryPos) - { - mpLBCapStyle->SelectEntryPos(nEntryPos - 1); - } - else - { - mpLBCapStyle->SetNoSelection(); + if(nEntryPos) + { + mpLBCapStyle->SelectEntryPos(nEntryPos - 1); + break; + } } + + mpLBCapStyle->SetNoSelection(); } break; } @@ -1049,7 +1072,7 @@ void LinePropertyPanel::FillLineStyleList() void LinePropertyPanel::SelectLineStyle() { - if( !mbStyleAvailable || !mbDashAvailable ) + if( !mpStyleItem.get() || !mpDashItem.get() ) { mpLBStyle->SetNoSelection(); return; @@ -1094,13 +1117,12 @@ void LinePropertyPanel::SelectEndStyle(bool bStart) if(bStart) { - //<<add - if( !mbStartAvailable ) + if( !mpStartItem.get() ) { mpLBStart->SetNoSelection(); return; } - //add end>> + if (mpStartItem && mxLineEndList.is()) { const basegfx::B2DPolyPolygon& rItemPolygon = mpStartItem->GetLineStartValue(); @@ -1115,18 +1137,20 @@ void LinePropertyPanel::SelectEndStyle(bool bStart) } } } + if(!bSelected) + { mpLBStart->SelectEntryPos( 0 ); + } } else { - //<<add - if( !mbEndAvailable ) + if( !mpEndItem.get() ) { mpLBEnd->SetNoSelection(); return; } - //add end>> + if (mpEndItem && mxLineEndList.is()) { const basegfx::B2DPolyPolygon& rItemPolygon = mpEndItem->GetLineEndValue(); @@ -1141,8 +1165,11 @@ void LinePropertyPanel::SelectEndStyle(bool bStart) } } } + if(!bSelected) + { mpLBEnd->SelectEntryPos( 0 ); + } } } diff --git a/svx/source/sidebar/line/LinePropertyPanel.hxx b/svx/source/sidebar/line/LinePropertyPanel.hxx index ba77e5a5dc21..b2f97bd1c067 100644 --- a/svx/source/sidebar/line/LinePropertyPanel.hxx +++ b/svx/source/sidebar/line/LinePropertyPanel.hxx @@ -148,12 +148,7 @@ private: /// bitfield bool mbColorAvailable : 1; - bool mbStyleAvailable : 1; - bool mbDashAvailable : 1; - bool mbTransAvailable : 1; bool mbWidthValuable : 1; - bool mbStartAvailable : 1; - bool mbEndAvailable : 1; void SetupIcons(void); void Initialize(); |