diff options
author | Jim Raykowski <raykowj@gmail.com> | 2018-08-09 20:07:35 -0800 |
---|---|---|
committer | Tamás Zolnai <tamas.zolnai@collabora.com> | 2018-10-09 11:30:34 +0200 |
commit | 4f6e104499625d69d2b37271d0fee52848c0a6d4 (patch) | |
tree | 2d1bb1bade8399f5e285416eca47f81b7c96ad8c | |
parent | 383a4f883d4a2932167695c761611b998f773f0e (diff) |
tdf#111718 Fix interaction between bitmap and pattern settings
Change-Id: I1c68b9f1f51cb15a30f56eef08dc384d10355bf1
Reviewed-on: https://gerrit.libreoffice.org/58805
Tested-by: Jenkins
Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
-rw-r--r-- | cui/source/tabpages/tpbitmap.cxx | 23 | ||||
-rw-r--r-- | cui/source/tabpages/tppattern.cxx | 24 |
2 files changed, 33 insertions, 14 deletions
diff --git a/cui/source/tabpages/tpbitmap.cxx b/cui/source/tabpages/tpbitmap.cxx index 5f51cc11a92a..e2a80c4d9473 100644 --- a/cui/source/tabpages/tpbitmap.cxx +++ b/cui/source/tabpages/tpbitmap.cxx @@ -154,14 +154,24 @@ void SvxBitmapTabPage::ActivatePage( const SfxItemSet& rSet ) { XFillBitmapItem aItem( rSet.Get(XATTR_FILLBITMAP) ); - sal_Int32 nPos = SearchBitmapList( aItem.GetName() ); - if ( nPos != LISTBOX_ENTRY_NOTFOUND ) + sal_Int32 nPos( 0 ); + if ( !aItem.isPattern() ) { - sal_uInt16 nId = m_xBitmapLB->GetItemId( static_cast<size_t>( nPos ) ); - m_xBitmapLB->SelectItem( nId ); + nPos = SearchBitmapList( aItem.GetName() ); + if ( nPos == LISTBOX_ENTRY_NOTFOUND ) + nPos = 0; + } + else + { + m_xBitmapWidth->set_value( 100, FUNIT_NONE ); + m_xBitmapHeight->set_value( 100, FUNIT_NONE ); + const_cast<SfxItemSet&>(rSet).Put( XFillBmpSizeXItem( GetCoreValue( *m_xBitmapWidth, mePoolUnit ) ) ); + const_cast<SfxItemSet&>(rSet).Put( XFillBmpSizeYItem( GetCoreValue( *m_xBitmapHeight, mePoolUnit ) ) ); } -} + sal_uInt16 nId = m_xBitmapLB->GetItemId( static_cast<size_t>( nPos ) ); + m_xBitmapLB->SelectItem( nId ); +} DeactivateRC SvxBitmapTabPage::DeactivatePage( SfxItemSet* _pSet ) { @@ -496,8 +506,7 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ModifyBitmapHdl, SvtValueSet*, void) ModifyBitmapStyleHdl( *m_xBitmapStyleLB ); ModifyBitmapPositionHdl( *m_xPositionLB ); - m_rXFSet.ClearItem(); - + m_rXFSet.ClearItem(XATTR_FILLBITMAP); m_rXFSet.Put(XFillStyleItem(drawing::FillStyle_BITMAP)); m_rXFSet.Put(XFillBitmapItem(OUString(), *pGraphicObject)); diff --git a/cui/source/tabpages/tppattern.cxx b/cui/source/tabpages/tppattern.cxx index 724637f15b4c..261bfba4b0f0 100644 --- a/cui/source/tabpages/tppattern.cxx +++ b/cui/source/tabpages/tppattern.cxx @@ -176,12 +176,18 @@ void SvxPatternTabPage::ActivatePage( const SfxItemSet& rSet ) else aString += aURL.getBase(); - sal_Int32 nPos = SearchPatternList( rSet.Get(XATTR_FILLBITMAP).GetName() ); - if( nPos != LISTBOX_ENTRY_NOTFOUND ) + XFillBitmapItem aItem( rSet.Get( XATTR_FILLBITMAP ) ); + + sal_Int32 nPos( 0 ); + if ( aItem.isPattern() ) { - sal_uInt16 nId = m_xPatternLB->GetItemId( static_cast<size_t>( nPos ) ); - m_xPatternLB->SelectItem( nId ); + nPos = SearchPatternList( aItem.GetName() ); + if ( nPos == LISTBOX_ENTRY_NOTFOUND ) + nPos = 0; } + + sal_uInt16 nId = m_xPatternLB->GetItemId( static_cast<size_t>( nPos ) ); + m_xPatternLB->SelectItem( nId ); } } @@ -212,6 +218,7 @@ bool SvxPatternTabPage::FillItemSet( SfxItemSet* _rOutAttrs ) _rOutAttrs->Put(XFillBitmapItem(OUString(), Graphic(aBitmapEx))); } + _rOutAttrs->Put(XFillBmpTileItem(true)); return true; } @@ -224,9 +231,12 @@ void SvxPatternTabPage::Reset( const SfxItemSet* ) // get bitmap and display it const XFillBitmapItem aBmpItem(OUString(), Graphic(m_xBitmapCtl->GetBitmapEx())); - m_rXFSet.Put( aBmpItem ); - m_aCtlPreview.SetAttributes( m_aXFillAttr.GetItemSet() ); - m_aCtlPreview.Invalidate(); + if(aBmpItem.isPattern()) + { + m_rXFSet.Put( aBmpItem ); + m_aCtlPreview.SetAttributes( m_aXFillAttr.GetItemSet() ); + m_aCtlPreview.Invalidate(); + } ChangePatternHdl_Impl(m_xPatternLB.get()); |