diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-09-05 11:57:59 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-09-06 12:45:15 +0200 |
commit | 587899f9ced03d02fbf8ffa9a3f52ba31be30818 (patch) | |
tree | 75b303c67aad161a1f9ac571bbb51f9536f9ab25 /svtools | |
parent | 83f12a2d4e410014c70844085f19190a50e83429 (diff) |
weld SwColumnPage and SwColumnDialog
Change-Id: Ia649785047db2551044b4d765881309f83b5c838
Reviewed-on: https://gerrit.libreoffice.org/60044
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/source/control/ctrlbox.cxx | 35 | ||||
-rw-r--r-- | svtools/source/control/valueset.cxx | 24 |
2 files changed, 43 insertions, 16 deletions
diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx index 3e3f2d9a7df2..162216ae1cbf 100644 --- a/svtools/source/control/ctrlbox.cxx +++ b/svtools/source/control/ctrlbox.cxx @@ -493,18 +493,6 @@ LineListBox::LineListBox( vcl::Window* pParent, WinBits nWinStyle ) : UpdatePaintLineColor(); } -extern "C" SAL_DLLPUBLIC_EXPORT void makeLineListBox(VclPtr<vcl::Window> & rRet, VclPtr<vcl::Window> & pParent, VclBuilder::stringmap & rMap) -{ - bool bDropdown = BuilderUtils::extractDropdown(rMap); - WinBits nWinBits = WB_LEFT|WB_VCENTER|WB_3DLOOK|WB_TABSTOP; - if (bDropdown) - nWinBits |= WB_DROPDOWN; - VclPtrInstance<LineListBox> pListBox(pParent, nWinBits); - if (bDropdown) - pListBox->EnableAutoSize(true); - rRet = pListBox; -} - LineListBox::~LineListBox() { disposeOnce(); @@ -1587,11 +1575,19 @@ SvxBorderLineStyle SvtLineListBox::GetSelectEntryStyle() const return static_cast<SvxBorderLineStyle>(nId - 1); } +namespace +{ + Size getPreviewSize(const weld::Widget& rControl) + { + return Size(rControl.get_approximate_digit_width() * 15, rControl.get_text_height()); + } +} + void SvtLineListBox::ImpGetLine( long nLine1, long nLine2, long nDistance, Color aColor1, Color aColor2, Color aColorDist, SvxBorderLineStyle nStyle, BitmapEx& rBmp ) { - Size aSize(m_xControl->get_approximate_digit_width() * 15, m_xControl->get_text_height()); + Size aSize(getPreviewSize(*m_xControl)); // SourceUnit to Twips if ( eSourceUnit == FUNIT_POINT ) @@ -1682,9 +1678,16 @@ SvtLineListBox::SvtLineListBox(std::unique_ptr<weld::MenuButton> pControl) m_xTopLevel->connect_focus_in(LINK(this, SvtLineListBox, FocusHdl)); m_xControl->set_popover(m_xTopLevel.get()); + + // lock size to these maxes height/width so it doesn't jump around in size m_xControl->set_label(GetLineStyleName(SvxBorderLineStyle::NONE)); - // lock to this text height - m_xControl->set_size_request(-1, m_xControl->get_preferred_size().Height()); + Size aNonePrefSize = m_xControl->get_preferred_size(); + m_xControl->set_label(""); + aVirDev->SetOutputSizePixel(getPreviewSize(*m_xControl)); + m_xControl->set_image(aVirDev); + Size aSolidPrefSize = m_xControl->get_preferred_size(); + m_xControl->set_size_request(std::max(aNonePrefSize.Width(), aSolidPrefSize.Width()), + std::max(aNonePrefSize.Height(), aSolidPrefSize.Height())); eSourceUnit = FUNIT_POINT; @@ -1868,8 +1871,8 @@ void SvtLineListBox::UpdatePreview() aVirDev->SetMapMode(MapMode(MapUnit::MapPixel)); aVirDev->Erase(); aVirDev->DrawImage(Point(0, nPos), aImage); - aVirDev->Pop(); m_xControl->set_image(aVirDev.get()); + aVirDev->Pop(); } } diff --git a/svtools/source/control/valueset.cxx b/svtools/source/control/valueset.cxx index e39650e61377..d61762644e98 100644 --- a/svtools/source/control/valueset.cxx +++ b/svtools/source/control/valueset.cxx @@ -2370,6 +2370,10 @@ void SvtValueSet::Select() maSelectHdl.Call( this ); } +void SvtValueSet::UserDraw( const UserDrawEvent& ) +{ +} + size_t SvtValueSet::ImplGetItem( const Point& rPos ) const { if (!mbHasVisibleItems) @@ -3514,6 +3518,8 @@ void SvtValueSet::ImplFormatItem(vcl::RenderContext const & rRenderContext, SvtV if (pItem->meType == VALUESETITEM_USERDRAW) { + UserDrawEvent aUDEvt(nullptr, maVirDev.get(), aRect, pItem->mnId); + UserDraw(aUDEvt); } else { @@ -3841,6 +3847,19 @@ void SvtValueSet::SetItemWidth( long nNewItemWidth ) } } +//method to set accessible when the style is user draw. +void SvtValueSet::InsertItem( sal_uInt16 nItemId, const OUString& rText, size_t nPos ) +{ + DBG_ASSERT( nItemId, "ValueSet::InsertItem(): ItemId == 0" ); + DBG_ASSERT( GetItemPos( nItemId ) == VALUESET_ITEM_NOTFOUND, + "ValueSet::InsertItem(): ItemId already exists" ); + SvtValueSetItem* pItem = new SvtValueSetItem( *this ); + pItem->mnId = nItemId; + pItem->meType = VALUESETITEM_USERDRAW; + pItem->maText = rText; + ImplInsertItem( pItem, nPos ); +} + void SvtValueSet::SetItemHeight( long nNewItemHeight ) { if ( mnUserItemHeight != nNewItemHeight ) @@ -3889,6 +3908,11 @@ void SvtValueSet::SetExtraSpacing( sal_uInt16 nNewSpacing ) } } +void SvtValueSet::SetFormat() +{ + mbFormat = true; +} + void SvtValueSet::SetItemText(sal_uInt16 nItemId, const OUString& rText) { size_t nPos = GetItemPos( nItemId ); |