summaryrefslogtreecommitdiffstats
path: root/extensions/source/propctrlr/standardcontrol.cxx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2016-11-05 20:28:27 +0000
committerCaolán McNamara <caolanm@redhat.com>2016-11-07 21:04:50 +0000
commit64a708cba9b954afe3331f63c58218eb53b3d0ce (patch)
treeddc1bea3b63f32a1c6d377c1d1dd7aee0803fb70 /extensions/source/propctrlr/standardcontrol.cxx
parentstyle fix for cppcheck duplicateBreak (diff)
downloadcore-64a708cba9b954afe3331f63c58218eb53b3d0ce.tar.gz
core-64a708cba9b954afe3331f63c58218eb53b3d0ce.zip
Revert "Reverts a commit series that cripple windows ci."
with addition of... - svxlo-SvxColorListBox + svxcorelo-SvxColorListBox This reverts commit db380aab1063e8a5e40111c40ee9f7921aa82601. Change-Id: I3af7aa0abb1a430bce64188244404fcbd480b128 Reviewed-on: https://gerrit.libreoffice.org/30598 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'extensions/source/propctrlr/standardcontrol.cxx')
-rw-r--r--extensions/source/propctrlr/standardcontrol.cxx109
1 files changed, 9 insertions, 100 deletions
diff --git a/extensions/source/propctrlr/standardcontrol.cxx b/extensions/source/propctrlr/standardcontrol.cxx
index ca2412f9dbad..7d422966aff4 100644
--- a/extensions/source/propctrlr/standardcontrol.cxx
+++ b/extensions/source/propctrlr/standardcontrol.cxx
@@ -657,141 +657,50 @@ namespace pcr
return aStr.makeStringAndClear();
}
-
OColorControl::OColorControl(vcl::Window* pParent, WinBits nWinStyle)
- :OColorControl_Base( PropertyControlType::ColorListBox, pParent, nWinStyle )
+ : OColorControl_Base(PropertyControlType::ColorListBox, pParent, nWinStyle)
{
- // initialize the color listbox
- XColorListRef pColorList;
- SfxObjectShell* pDocSh = SfxObjectShell::Current();
- const SfxPoolItem* pItem = pDocSh ? pDocSh->GetItem( SID_COLOR_TABLE ) : nullptr;
- if ( pItem )
- {
- DBG_ASSERT(dynamic_cast< const SvxColorListItem* >(pItem) != nullptr, "OColorControl::OColorControl: invalid color item!");
- pColorList = static_cast<const SvxColorListItem*>( pItem )->GetColorList();
- }
-
- if ( !pColorList.is() )
- pColorList = XColorList::GetStdColorList();
-
-
- DBG_ASSERT(pColorList.is(), "OColorControl::OColorControl: no color table!");
-
- if ( pColorList.is() )
- {
- for (long i = 0; i < pColorList->Count(); ++i)
- {
- const XColorEntry* pEntry = pColorList->GetColor(i);
- getTypedControlWindow()->InsertEntry( pEntry->GetColor(), pEntry->GetName() );
- }
- }
-
- getTypedControlWindow()->SetDropDownLineCount( LB_DEFAULT_COUNT );
- if ( ( nWinStyle & WB_READONLY ) != 0 )
- {
- getTypedControlWindow()->SetReadOnly();
- getTypedControlWindow()->Enable();
- }
}
-
void SAL_CALL OColorControl::setValue( const Any& _rValue ) throw (IllegalTypeException, RuntimeException, std::exception)
{
if ( _rValue.hasValue() )
{
css::util::Color nColor = COL_TRANSPARENT;
- if ( _rValue >>= nColor )
- {
- ::Color aRgbCol((ColorData)nColor);
-
- getTypedControlWindow()->SelectEntry( aRgbCol );
- if ( !getTypedControlWindow()->IsEntrySelected( aRgbCol ) )
- { // the given color is not part of the list -> insert a new entry with the hex code of the color
- OUString aStr("0x");
- aStr += MakeHexStr(nColor,8);
- getTypedControlWindow()->InsertEntry( aRgbCol, aStr );
- getTypedControlWindow()->SelectEntry( aRgbCol );
- }
- }
- else
- {
- OUString sNonColorValue;
- if ( !( _rValue >>= sNonColorValue ) )
- throw IllegalTypeException();
- getTypedControlWindow()->SelectEntry( sNonColorValue );
- if ( !getTypedControlWindow()->IsEntrySelected( sNonColorValue ) )
- getTypedControlWindow()->SetNoSelection();
- }
+ _rValue >>= nColor;
+ ::Color aRgbCol((ColorData)nColor);
+ getTypedControlWindow()->SelectEntry(std::make_pair(aRgbCol, MakeHexStr(nColor, 8)));
}
else
getTypedControlWindow()->SetNoSelection();
}
-
Any SAL_CALL OColorControl::getValue() throw (RuntimeException, std::exception)
{
Any aPropValue;
- if ( getTypedControlWindow()->GetSelectEntryCount() > 0 )
+ if (!getTypedControlWindow()->IsNoSelection())
{
- OUString sSelectedEntry = getTypedControlWindow()->GetSelectEntry();
- if ( m_aNonColorEntries.find( sSelectedEntry ) != m_aNonColorEntries.end() )
- aPropValue <<= sSelectedEntry;
- else
- {
- ::Color aRgbCol = getTypedControlWindow()->GetSelectEntryColor();
- aPropValue <<= (css::util::Color)aRgbCol.GetColor();
- }
+ ::Color aRgbCol = getTypedControlWindow()->GetSelectEntryColor();
+ aPropValue <<= (css::util::Color)aRgbCol.GetColor();
}
return aPropValue;
}
-
Type SAL_CALL OColorControl::getValueType() throw (RuntimeException, std::exception)
{
return ::cppu::UnoType<sal_Int32>::get();
}
-
- void SAL_CALL OColorControl::clearList() throw (RuntimeException, std::exception)
- {
- getTypedControlWindow()->Clear();
- }
-
-
- void SAL_CALL OColorControl::prependListEntry( const OUString& NewEntry ) throw (RuntimeException, std::exception)
- {
- getTypedControlWindow()->InsertEntry( NewEntry, 0 );
- m_aNonColorEntries.insert( NewEntry );
- }
-
-
- void SAL_CALL OColorControl::appendListEntry( const OUString& NewEntry ) throw (RuntimeException, std::exception)
- {
- getTypedControlWindow()->InsertEntry( NewEntry );
- m_aNonColorEntries.insert( NewEntry );
- }
-
- Sequence< OUString > SAL_CALL OColorControl::getListEntries( ) throw (RuntimeException, std::exception)
- {
- if ( !m_aNonColorEntries.empty() )
- return Sequence< OUString >(&(*m_aNonColorEntries.begin()),m_aNonColorEntries.size());
- return Sequence< OUString >();
- }
-
-
void OColorControl::setModified()
{
OColorControl_Base::setModified();
- if ( !getTypedControlWindow()->IsTravelSelect() )
- // fire a commit
- notifyModifiedValue();
+ // fire a commit
+ notifyModifiedValue();
}
-
//= OListboxControl
-
OListboxControl::OListboxControl( vcl::Window* pParent, WinBits nWinStyle)
:OListboxControl_Base( PropertyControlType::ListBox, pParent, nWinStyle )
{