diff options
author | Rishabh Kumar <kris.kr296@gmail.com> | 2016-06-07 16:58:20 +0530 |
---|---|---|
committer | Katarina Behrens <Katarina.Behrens@cib.de> | 2016-06-28 19:37:44 +0000 |
commit | 76585ae33f3ca75c05c0ccbf6a621b6e2d42bc00 (patch) | |
tree | c33a276de22708658312fb3adefa50907518da17 /svx | |
parent | 6af8c9ef2de39b933274c96fd661d219b2bed8a3 (diff) |
Convert Bitmap tab to Pattern tab
Change-Id: I5cf02f1889090539f7adb826483c91a1ef3c3925
Reviewed-on: https://gerrit.libreoffice.org/26015
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/Library_svxcore.mk | 1 | ||||
-rw-r--r-- | svx/sdi/svx.sdi | 16 | ||||
-rw-r--r-- | svx/sdi/svxitems.sdi | 1 | ||||
-rw-r--r-- | svx/source/dialog/dlgctrl.cxx | 155 | ||||
-rw-r--r-- | svx/source/dialog/hdft.cxx | 3 | ||||
-rw-r--r-- | svx/source/dialog/sdstring.src | 10 | ||||
-rw-r--r-- | svx/source/items/drawitem.cxx | 42 | ||||
-rw-r--r-- | svx/source/sidebar/area/AreaPropertyPanel.cxx | 2 | ||||
-rw-r--r-- | svx/source/sidebar/area/AreaPropertyPanel.hxx | 1 | ||||
-rw-r--r-- | svx/source/sidebar/area/AreaPropertyPanelBase.cxx | 567 | ||||
-rw-r--r-- | svx/source/xoutdev/xattrbmp.cxx | 5 | ||||
-rw-r--r-- | svx/source/xoutdev/xtabbtmp.cxx | 33 | ||||
-rw-r--r-- | svx/source/xoutdev/xtable.cxx | 6 | ||||
-rw-r--r-- | svx/source/xoutdev/xtabptrn.cxx | 92 | ||||
-rw-r--r-- | svx/uiconfig/ui/sidebararea.ui | 170 |
15 files changed, 751 insertions, 353 deletions
diff --git a/svx/Library_svxcore.mk b/svx/Library_svxcore.mk index f5c38f373b08..362cdae46bf0 100644 --- a/svx/Library_svxcore.mk +++ b/svx/Library_svxcore.mk @@ -416,6 +416,7 @@ $(eval $(call gb_Library_add_exception_objects,svxcore,\ svx/source/xoutdev/xtabgrdt \ svx/source/xoutdev/xtabhtch \ svx/source/xoutdev/xtable \ + svx/source/xoutdev/xtabptrn \ svx/source/xoutdev/XPropertyEntry \ svx/source/xoutdev/xtablend \ )) diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi index ddab822c42cf..916ecc486f9b 100644 --- a/svx/sdi/svx.sdi +++ b/svx/sdi/svx.sdi @@ -10414,6 +10414,22 @@ SvxBitmapListItem BitmapListState SID_BITMAP_LIST GroupId = GID_EDIT; ] +SvxPatternListItem PatternListState SID_PATTERN_LIST +[ + AutoUpdate = FALSE, + FastCall = FALSE, + ReadOnlyDoc = TRUE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + + AccelConfig = FALSE, + MenuConfig = FALSE, + ToolBoxConfig = FALSE, + GroupId = GID_EDIT; +] + SvxEmphasisMarkItem EmphasisMark SID_ATTR_CHAR_EMPHASISMARK [ diff --git a/svx/sdi/svxitems.sdi b/svx/sdi/svxitems.sdi index e44ae28b72b8..1e73fc11bc8c 100644 --- a/svx/sdi/svxitems.sdi +++ b/svx/sdi/svxitems.sdi @@ -244,6 +244,7 @@ item String SvxColorListItem; item String SvxGradientListItem; item String SvxHatchListItem; item String SvxBitmapListItem; +item String SvxPatternListItem; item String SfxLockBytesItem; item String SvxFontListItem; item String avmedia_MediaItem; diff --git a/svx/source/dialog/dlgctrl.cxx b/svx/source/dialog/dlgctrl.cxx index 9ac13bbf7e6d..0d3b62686cda 100644 --- a/svx/source/dialog/dlgctrl.cxx +++ b/svx/source/dialog/dlgctrl.cxx @@ -1511,6 +1511,139 @@ void BitmapLB::Modify(const Size& rSize, const XBitmapEntry& rEntry, sal_Int32 n } } +// BitmapLB Constructor + +PatternLB::PatternLB( vcl::Window* pParent, WinBits aWB) +: ListBox( pParent, aWB ), + maBitmapEx(), + mpList(nullptr) +{ + SetEdgeBlending(true); +} + +VCL_BUILDER_DECL_FACTORY(PatternLB) +{ + WinBits nWinStyle = WB_LEFT|WB_VCENTER|WB_3DLOOK|WB_SIMPLEMODE; + OString sBorder = VclBuilder::extractCustomProperty(rMap); + if (!sBorder.isEmpty()) + nWinStyle |= WB_BORDER; + VclPtrInstance<BitmapLB> pListBox(pParent, nWinStyle); + pListBox->EnableAutoSize(true); + rRet = pListBox; +} + +namespace +{ + void formatPatternExToSize(BitmapEx& rBitmapEx, const Size& rSize) + { + if(!rBitmapEx.IsEmpty() && rSize.Width() > 0 && rSize.Height() > 0) + { + ScopedVclPtrInstance< VirtualDevice > pVirtualDevice; + pVirtualDevice->SetOutputSizePixel(rSize); + + if(rBitmapEx.IsTransparent()) + { + const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); + + if(rStyleSettings.GetPreviewUsesCheckeredBackground()) + { + const Point aNull(0, 0); + static const sal_uInt32 nLen(8); + static const Color aW(COL_WHITE); + static const Color aG(0xef, 0xef, 0xef); + + pVirtualDevice->DrawCheckered(aNull, rSize, nLen, aW, aG); + } + else + { + pVirtualDevice->SetBackground(rStyleSettings.GetFieldColor()); + pVirtualDevice->Erase(); + } + } + + if(rBitmapEx.GetSizePixel().Width() >= rSize.Width() && rBitmapEx.GetSizePixel().Height() >= rSize.Height()) + { + rBitmapEx.Scale(rSize); + pVirtualDevice->DrawBitmapEx(Point(0, 0), rBitmapEx); + } + else + { + const Size aBitmapSize(rBitmapEx.GetSizePixel()); + + for(long y(0); y < rSize.Height(); y += aBitmapSize.Height()) + { + for(long x(0); x < rSize.Width(); x += aBitmapSize.Width()) + { + pVirtualDevice->DrawBitmapEx( + Point(x, y), + rBitmapEx); + } + } + } + + rBitmapEx = pVirtualDevice->GetBitmap(Point(0, 0), rSize); + } + } +} // end of anonymous namespace + +void PatternLB::Fill( const XPatternListRef &pList ) +{ + if( !pList.is() ) + return; + + mpList = pList; + XBitmapEntry* pEntry; + const long nCount(pList->Count()); + const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); + const Size aSize(rStyleSettings.GetListBoxPreviewDefaultPixelSize()); + + SetUpdateMode(false); + + for(long i(0); i < nCount; i++) + { + pEntry = pList->GetBitmap(i); + maBitmapEx = pEntry->GetGraphicObject().GetGraphic().GetBitmapEx(); + formatPatternExToSize(maBitmapEx, aSize); + InsertEntry(pEntry->GetName(), Image(maBitmapEx)); + } + + AdaptDropDownLineCountToMaximum(); + SetUpdateMode(true); +} + +void PatternLB::Append(const Size& rSize, const XBitmapEntry& rEntry) +{ + maBitmapEx = rEntry.GetGraphicObject().GetGraphic().GetBitmapEx(); + + if(!maBitmapEx.IsEmpty()) + { + formatPatternExToSize(maBitmapEx, rSize); + InsertEntry(rEntry.GetName(), Image(maBitmapEx)); + } + else + { + InsertEntry(rEntry.GetName()); + } + + AdaptDropDownLineCountToMaximum(); +} + +void PatternLB::Modify(const Size& rSize, const XBitmapEntry& rEntry, sal_Int32 nPos) +{ + RemoveEntry(nPos); + maBitmapEx = rEntry.GetGraphicObject().GetGraphic().GetBitmapEx(); + + if(!maBitmapEx.IsEmpty()) + { + formatPatternExToSize(maBitmapEx, rSize); + InsertEntry(rEntry.GetName(), Image(maBitmapEx), nPos); + } + else + { + InsertEntry(rEntry.GetName()); + } +} + FillAttrLB::FillAttrLB(vcl::Window* pParent, WinBits aWB) : ColorListBox(pParent, aWB) { @@ -1537,6 +1670,27 @@ void FillAttrLB::Fill( const XBitmapListRef &pList ) ListBox::SetUpdateMode(true); } +void FillAttrLB::Fill( const XPatternListRef &pList ) +{ + const long nCount(pList->Count()); + XBitmapEntry* pEntry; + const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); + const Size aSize(rStyleSettings.GetListBoxPreviewDefaultPixelSize()); + + ListBox::SetUpdateMode(false); + + for(long i(0); i < nCount; i++) + { + pEntry = pList->GetBitmap( i ); + maBitmapEx = pEntry->GetGraphicObject().GetGraphic().GetBitmapEx(); + formatBitmapExToSize(maBitmapEx, aSize); + ListBox::InsertEntry(pEntry->GetName(), Image(maBitmapEx)); + } + + AdaptDropDownLineCountToMaximum(); + ListBox::SetUpdateMode(true); +} + void FillTypeLB::Fill() { SetUpdateMode( false ); @@ -1546,6 +1700,7 @@ void FillTypeLB::Fill() InsertEntry( SVX_RESSTR(RID_SVXSTR_GRADIENT) ); InsertEntry( SVX_RESSTR(RID_SVXSTR_HATCH) ); InsertEntry( SVX_RESSTR(RID_SVXSTR_BITMAP) ); + InsertEntry( SVX_RESSTR(RID_SVXSTR_PATTERN) ); AdaptDropDownLineCountToMaximum(); SetUpdateMode( true ); diff --git a/svx/source/dialog/hdft.cxx b/svx/source/dialog/hdft.cxx index 182c6a1af7bc..8386822eef4a 100644 --- a/svx/source/dialog/hdft.cxx +++ b/svx/source/dialog/hdft.cxx @@ -589,7 +589,7 @@ IMPL_LINK_NOARG_TYPED(SvxHFPage, BackgroundHdl, Button*, void) pBBSet = new SfxItemSet( *GetItemSet().GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST, // DrawingLayer FillStyle definitions - SID_COLOR_TABLE, SID_BITMAP_LIST, // XPropertyLists for Color, Gradient, Hatch and Graphic fills + SID_COLOR_TABLE, SID_PATTERN_LIST, // XPropertyLists for Color, Gradient, Hatch and Graphic fills nOuter, nOuter, nInner, nInner, nShadow, nShadow, @@ -602,6 +602,7 @@ IMPL_LINK_NOARG_TYPED(SvxHFPage, BackgroundHdl, Button*, void) SID_GRADIENT_LIST, SID_HATCH_LIST, SID_BITMAP_LIST, + SID_PATTERN_LIST, 0 }; diff --git a/svx/source/dialog/sdstring.src b/svx/source/dialog/sdstring.src index b43fbc19e2c3..b70348583cb1 100644 --- a/svx/source/dialog/sdstring.src +++ b/svx/source/dialog/sdstring.src @@ -32,6 +32,14 @@ String RID_SVXSTR_BITMAP { Text [ en-US ] = "Bitmap" ; }; +String RID_SVXSTR_PATTERN +{ + Text [ en-US ] = "Pattern"; +}; +String RID_SVXSTR_PATTERN_UNTITLED +{ + Text [ en-US ] = "Untitled Pattern"; +}; String RID_SVXSTR_LINESTYLE { Text [ en-US ] = "Line Style" ; @@ -1659,7 +1667,7 @@ String RID_SVXSTR_BMP21_DEF String RID_SVXSTR_BMP0 { - Text [ en-US ] = "Blank"; + Text [ en-US ] = "Empty"; }; String RID_SVXSTR_BMP1 { diff --git a/svx/source/items/drawitem.cxx b/svx/source/items/drawitem.cxx index a0aec77420b3..1771e54a37c1 100644 --- a/svx/source/items/drawitem.cxx +++ b/svx/source/items/drawitem.cxx @@ -28,6 +28,7 @@ SfxPoolItem* SvxColorListItem::CreateDefault() { return new SvxColorListItem ;} SfxPoolItem* SvxGradientListItem::CreateDefault() { return new SvxGradientListItem ;} SfxPoolItem* SvxHatchListItem::CreateDefault() { return new SvxHatchListItem ;} SfxPoolItem* SvxBitmapListItem::CreateDefault() { return new SvxBitmapListItem ;} +SfxPoolItem* SvxPatternListItem::CreateDefault() { return new SvxPatternListItem ;} SfxPoolItem* SvxDashListItem::CreateDefault() { return new SvxDashListItem ;} SfxPoolItem* SvxLineEndListItem::CreateDefault() { return new SvxLineEndListItem ;} @@ -226,6 +227,47 @@ SfxPoolItem* SvxBitmapListItem::Clone( SfxItemPool * ) const QUERY_PUT_IMPL( SvxBitmapListItem, BitmapList ) +SvxPatternListItem::SvxPatternListItem() +{ +} + +SvxPatternListItem::SvxPatternListItem( XPatternListRef pList, sal_uInt16 nW ) : + SfxPoolItem( nW ), + pPatternList( pList ) +{ +} + +SvxPatternListItem::SvxPatternListItem( const SvxPatternListItem& rItem ) : + SfxPoolItem( rItem ), + pPatternList( rItem.pPatternList ) +{ +} + +bool SvxPatternListItem::GetPresentation +( + SfxItemPresentation /*ePres*/, + SfxMapUnit /*eCoreUnit*/, + SfxMapUnit /*ePresUnit*/, + OUString& rText, const IntlWrapper * +) const +{ + rText.clear(); + return false; +} + +bool SvxPatternListItem::operator==( const SfxPoolItem& rItem ) const +{ + DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" ); + return static_cast<const SvxPatternListItem&>(rItem).pPatternList == pPatternList; +} + +SfxPoolItem* SvxPatternListItem::Clone( SfxItemPool * ) const +{ + return new SvxPatternListItem( *this ); +} + +QUERY_PUT_IMPL( SvxPatternListItem, PatternList ) + SvxDashListItem::SvxDashListItem() : pDashList( nullptr ) { diff --git a/svx/source/sidebar/area/AreaPropertyPanel.cxx b/svx/source/sidebar/area/AreaPropertyPanel.cxx index c0092c2a3fd8..1afba46385f1 100644 --- a/svx/source/sidebar/area/AreaPropertyPanel.cxx +++ b/svx/source/sidebar/area/AreaPropertyPanel.cxx @@ -57,6 +57,7 @@ AreaPropertyPanel::AreaPropertyPanel( maGradientListControl(SID_GRADIENT_LIST, *pBindings, *this), maHatchListControl(SID_HATCH_LIST, *pBindings, *this), maBitmapListControl(SID_BITMAP_LIST, *pBindings, *this), + maPatternListControl(SID_PATTERN_LIST, *pBindings, *this), maFillTransparenceController(SID_ATTR_FILL_TRANSPARENCE, *pBindings, *this), maFillFloatTransparenceController(SID_ATTR_FILL_FLOATTRANSPARENCE, *pBindings, *this), mpBindings(pBindings) @@ -79,6 +80,7 @@ void AreaPropertyPanel::dispose() maGradientListControl.dispose(); maHatchListControl.dispose(); maBitmapListControl.dispose(); + maPatternListControl.dispose(); maFillTransparenceController.dispose(); maFillFloatTransparenceController.dispose(); diff --git a/svx/source/sidebar/area/AreaPropertyPanel.hxx b/svx/source/sidebar/area/AreaPropertyPanel.hxx index 5d2878fb0637..f8fc55faeeb3 100644 --- a/svx/source/sidebar/area/AreaPropertyPanel.hxx +++ b/svx/source/sidebar/area/AreaPropertyPanel.hxx @@ -85,6 +85,7 @@ private: ::sfx2::sidebar::ControllerItem maGradientListControl; ::sfx2::sidebar::ControllerItem maHatchListControl; ::sfx2::sidebar::ControllerItem maBitmapListControl; + ::sfx2::sidebar::ControllerItem maPatternListControl; ::sfx2::sidebar::ControllerItem maFillTransparenceController; ::sfx2::sidebar::ControllerItem maFillFloatTransparenceController; diff --git a/svx/source/sidebar/area/AreaPropertyPanelBase.cxx b/svx/source/sidebar/area/AreaPropertyPanelBase.cxx index 65be70b7b933..52a2deb49e61 100644 --- a/svx/source/sidebar/area/AreaPropertyPanelBase.cxx +++ b/svx/source/sidebar/area/AreaPropertyPanelBase.cxx @@ -37,6 +37,7 @@ #include <unotools/pathoptions.hxx> #include <svx/svxitems.hrc> #include <vcl/toolbox.hxx> +#include <vcl/salbtype.hxx> #include <svtools/toolbarmenu.hxx> #include <svx/tbcontrl.hxx> #include "sfx2/opengrf.hxx" @@ -48,6 +49,16 @@ const char UNO_SIDEBARGRADIENT[] = ".uno:sidebargradient"; namespace svx { namespace sidebar { +enum eFillStyle +{ + NONE, + SOLID, + GRADIENT, + HATCH, + BITMAP, + PATTERN +}; + const sal_Int32 AreaPropertyPanelBase::DEFAULT_CENTERX = 50; const sal_Int32 AreaPropertyPanelBase::DEFAULT_CENTERY = 50; const sal_Int32 AreaPropertyPanelBase::DEFAULT_ANGLE = 0; @@ -63,6 +74,7 @@ AreaPropertyPanelBase::AreaPropertyPanelBase( mnLastPosGradient(0), mnLastPosHatch(0), mnLastPosBitmap(0), + mnLastPosPattern(0), mnLastTransSolid(50), maGradientLinear(), maGradientAxial(), @@ -100,7 +112,6 @@ AreaPropertyPanelBase::AreaPropertyPanelBase( get(mpLbFillGradFrom, "fillgrad1"); get(mpLbFillGradTo, "fillgrad2"); get(mpGradientStyle, "gradientstyle"); - get(mpLbFillBitmap, "fillbitmap"); get(mpBmpImport, "bmpimport"); Initialize(); @@ -126,7 +137,6 @@ void AreaPropertyPanelBase::dispose() mpLbFillGradFrom.clear(); mpLbFillGradTo.clear(); mpGradientStyle.clear(); - mpLbFillBitmap.clear(); mpBmpImport.clear(); PanelLayout::dispose(); @@ -165,7 +175,6 @@ void AreaPropertyPanelBase::Initialize() mpGradientStyle->SetSelectHdl( aLink ); mpLbFillGradFrom->SetSelectHdl( aLink ); mpLbFillGradTo->SetSelectHdl( aLink ); - mpLbFillBitmap->SetSelectHdl( aLink ); mpMTRAngle->SetModifyHdl(LINK(this,AreaPropertyPanelBase, ChangeGradientAngle)); mpLBTransType->SetSelectHdl(LINK(this, AreaPropertyPanelBase, ChangeTrgrTypeHdl_Impl)); @@ -227,229 +236,249 @@ IMPL_LINK_NOARG_TYPED(AreaPropertyPanelBase, ClickImportBitmapHdl, Button*, void XBitmapEntry* pEntry = new XBitmapEntry( aGraphic, aName ); pList->Insert(pEntry); pList->Save(); - mpLbFillBitmap->Clear(); - mpLbFillBitmap->Fill(pList); - mpLbFillBitmap->SelectEntry(aName); - SelectFillAttrHdl(*mpLbFillBitmap); + mpLbFillAttr->Clear(); + mpLbFillAttr->Fill(pList); + mpLbFillAttr->SelectEntry(aName); + SelectFillAttrHdl(*mpLbFillAttr); } } } IMPL_LINK_NOARG_TYPED(AreaPropertyPanelBase, SelectFillTypeHdl, ListBox&, void) { - const drawing::FillStyle eXFS = (drawing::FillStyle)mpLbFillType->GetSelectEntryPos(); + sal_Int32 nPos = (eFillStyle)mpLbFillType->GetSelectEntryPos(); + mpLbFillAttr->Clear(); + SfxObjectShell* pSh = SfxObjectShell::Current(); + if(!pSh) + return; - if((drawing::FillStyle)meLastXFS != eXFS) + // #i122676# Do no longer trigger two Execute calls, one for SID_ATTR_FILL_STYLE + // and one for setting the fill attribute itself, but add two SfxPoolItems to the + // call to get just one action at the SdrObject and to create only one Undo action, too. + // Checked that this works in all apps. + switch( nPos ) { - mpLbFillAttr->Clear(); - SfxObjectShell* pSh = SfxObjectShell::Current(); - const XFillStyleItem aXFillStyleItem(eXFS); - - // #i122676# Do no longer trigger two Execute calls, one for SID_ATTR_FILL_STYLE - // and one for setting the fill attribute itself, but add two SfxPoolItems to the - // call to get just one action at the SdrObject and to create only one Undo action, too. - // Checked that this works in all apps. - switch( eXFS ) + default: + case NONE: { - default: - case drawing::FillStyle_NONE: - { - mpLbFillAttr->Show(); - mpLbFillGradFrom->Hide(); - mpLbFillGradTo->Hide(); - mpGradientStyle->Hide(); - mpMTRAngle->Hide(); - mpToolBoxColor->Hide(); - mpLbFillBitmap->Hide(); - mpBmpImport->Hide(); - mpLbFillType->Selected(); - mpLbFillAttr->Disable(); + mpLbFillAttr->Show(); + mpLbFillGradFrom->Hide(); + mpLbFillGradTo->Hide(); + mpGradientStyle->Hide(); + mpMTRAngle->Hide(); + mpToolBoxColor->Hide(); + mpBmpImport->Hide(); + mpLbFillType->Selected(); + mpLbFillAttr->Disable(); - // #i122676# need to call a single SID_ATTR_FILL_STYLE change - setFillStyle(aXFillStyleItem); - break; - } - case drawing::FillStyle_SOLID: + // #i122676# need to call a single SID_ATTR_FILL_STYLE change + setFillStyle(XFillStyleItem(drawing::FillStyle_NONE)); + break; + } + case SOLID: + { + mpLbFillAttr->Hide(); + mpLbFillGradFrom->Hide(); + mpLbFillGradTo->Hide(); + mpGradientStyle->Hide(); + mpMTRAngle->Hide(); + mpBmpImport->Hide(); + mpToolBoxColor->Show(); + const OUString aTmpStr; + const Color aColor = mpColorItem ? mpColorItem->GetColorValue() : COL_AUTO; + const XFillColorItem aXFillColorItem( aTmpStr, aColor ); + + // #i122676# change FillStyle and Color in one call + XFillStyleItem aXFillStyleItem(drawing::FillStyle_SOLID); + setFillStyleAndColor(&aXFillStyleItem, aXFillColorItem); + break; + } + case GRADIENT: + { + mpLbFillAttr->Hide(); + mpLbFillGradFrom->Show(); + mpLbFillGradTo->Show(); + mpGradientStyle->Show(); + mpMTRAngle->Show(); + mpToolBoxColor->Hide(); + mpBmpImport->Hide(); + + const SvxColorListItem* pColorListItem = static_cast<const SvxColorListItem*>(pSh->GetItem(SID_COLOR_TABLE)); + if(pColorListItem) { - mpLbFillAttr->Hide(); - mpLbFillGradFrom->Hide(); - mpLbFillGradTo->Hide(); - mpGradientStyle->Hide(); - mpMTRAngle->Hide(); - mpLbFillBitmap->Hide(); - mpBmpImport->Hide(); - mpToolBoxColor->Show(); - const OUString aTmpStr; - const Color aColor = mpColorItem ? mpColorItem->GetColorValue() : COL_AUTO; - const XFillColorItem aXFillColorItem( aTmpStr, aColor ); + mpLbFillAttr->Enable(); + mpLbFillGradTo->Enable(); + mpLbFillGradFrom->Enable(); + mpGradientStyle->Enable(); + mpMTRAngle->Enable(); + mpLbFillAttr->Clear(); + mpLbFillGradTo->Clear(); + mpLbFillGradFrom->Clear(); + mpLbFillGradTo->Fill(pColorListItem->GetColorList()); + mpLbFillGradFrom->Fill(pColorListItem->GetColorList()); - // #i122676# change FillStyle and Color in one call - setFillStyleAndColor(&aXFillStyleItem, aXFillColorItem); - break; - } - case drawing::FillStyle_GRADIENT: - { - mpLbFillAttr->Hide(); - mpLbFillGradFrom->Show(); - mpLbFillGradTo->Show(); - mpGradientStyle->Show(); - mpMTRAngle->Show(); - mpToolBoxColor->Hide(); - mpLbFillBitmap->Hide(); - mpBmpImport->Hide(); + mpLbFillGradFrom->AdaptDropDownLineCountToMaximum(); + mpLbFillGradTo->AdaptDropDownLineCountToMaximum(); - const SvxColorListItem* pColorListItem = static_cast<const SvxColorListItem*>(pSh ? pSh->GetItem(SID_COLOR_TABLE) : nullptr); - if (pColorListItem) + if(LISTBOX_ENTRY_NOTFOUND != mnLastPosGradient) { - mpLbFillAttr->Enable(); - mpLbFillGradTo->Enable(); - mpLbFillGradFrom->Enable(); - mpGradientStyle->Enable(); - mpMTRAngle->Enable(); - mpLbFillAttr->Clear(); - mpLbFillGradTo->Clear(); - mpLbFillGradFrom->Clear(); - mpLbFillGradTo->Fill(pColorListItem->GetColorList()); - mpLbFillGradFrom->Fill(pColorListItem->GetColorList()); - - mpLbFillGradFrom->AdaptDropDownLineCountToMaximum(); - mpLbFillGradTo->AdaptDropDownLineCountToMaximum(); + const SvxGradientListItem aItem(*static_cast<const SvxGradientListItem*>(pSh->GetItem(SID_GRADIENT_LIST))); - if(LISTBOX_ENTRY_NOTFOUND != mnLastPosGradient) + if(mnLastPosGradient < aItem.GetGradientList()->Count()) { - const SvxGradientListItem aItem(*static_cast<const SvxGradientListItem*>(pSh->GetItem(SID_GRADIENT_LIST))); + const XGradient aGradient = aItem.GetGradientList()->GetGradient(mnLastPosGradient)->GetGradient(); + const XFillGradientItem aXFillGradientItem(aGradient); - if(mnLastPosGradient < aItem.GetGradientList()->Count()) + // #i122676# change FillStyle and Gradient in one call + XFillStyleItem aXFillStyleItem(drawing::FillStyle_SOLID); + setFillStyleAndGradient(&aXFillStyleItem, aXFillGradientItem); + mpLbFillGradFrom->SelectEntry(aGradient.GetStartColor()); + if(mpLbFillGradFrom->GetSelectEntryCount() == 0) { - const XGradient aGradient = aItem.GetGradientList()->GetGradient(mnLastPosGradient)->GetGradient(); - const XFillGradientItem aXFillGradientItem(aGradient); - - // #i122676# change FillStyle and Gradient in one call - setFillStyleAndGradient(&aXFillStyleItem, aXFillGradientItem); + mpLbFillGradFrom->InsertEntry(aGradient.GetStartColor(), OUString()); mpLbFillGradFrom->SelectEntry(aGradient.GetStartColor()); - if(mpLbFillGradFrom->GetSelectEntryCount() == 0) - { - mpLbFillGradFrom->InsertEntry(aGradient.GetStartColor(), OUString()); - mpLbFillGradFrom->SelectEntry(aGradient.GetStartColor()); - } + } + mpLbFillGradTo->SelectEntry(aGradient.GetEndColor()); + if(mpLbFillGradTo->GetSelectEntryCount() == 0) + { + mpLbFillGradTo->InsertEntry(aGradient.GetEndColor(), OUString()); mpLbFillGradTo->SelectEntry(aGradient.GetEndColor()); - if(mpLbFillGradTo->GetSelectEntryCount() == 0) - { - mpLbFillGradTo->InsertEntry(aGradient.GetEndColor(), OUString()); - mpLbFillGradTo->SelectEntry(aGradient.GetEndColor()); - } - - mpMTRAngle->SetValue(aGradient.GetAngle() / 10); - css::awt::GradientStyle eXGS = aGradient.GetGradientStyle(); - mpGradientStyle->SelectEntryPos(sal::static_int_cast< sal_Int32 >( eXGS )); - } + + mpMTRAngle->SetValue(aGradient.GetAngle() / 10); + css::awt::GradientStyle eXGS = aGradient.GetGradientStyle(); + mpGradientStyle->SelectEntryPos(sal::static_int_cast< sal_Int32 >( eXGS )); } } - else - { - mpLbFillGradFrom->Disable(); - mpLbFillGradTo->Disable(); - mpMTRAngle->Disable(); - mpGradientStyle->Disable(); - } - break; } - case drawing::FillStyle_HATCH: + else { - mpLbFillAttr->Show(); - mpLbFillGradFrom->Hide(); - mpLbFillGradTo->Hide(); - mpMTRAngle->Hide(); - mpGradientStyle->Hide(); - mpToolBoxColor->Hide(); - mpLbFillBitmap->Hide(); - mpBmpImport->Hide(); + mpLbFillGradFrom->Disable(); + mpLbFillGradTo->Disable(); + mpMTRAngle->Disable(); + mpGradientStyle->Disable(); + } + break; + } + case HATCH: + { + mpLbFillAttr->Show(); + mpLbFillGradFrom->Hide(); + mpLbFillGradTo->Hide(); + mpMTRAngle->Hide(); + mpGradientStyle->Hide(); + mpToolBoxColor->Hide(); + mpBmpImport->Hide(); + + const SvxHatchListItem* aItem( static_cast<const SvxHatchListItem*>(pSh->GetItem(SID_HATCH_LIST))); + if(aItem) + { + XHatchListRef pXHatchList(aItem->GetHatchList()); + mpLbFillAttr->Enable(); + mpLbFillAttr->Clear(); + mpLbFillAttr->Fill(pXHatchList); - if(pSh && pSh->GetItem(SID_HATCH_LIST)) + mpLbFillAttr->AdaptDropDownLineCountToMaximum(); + + if(LISTBOX_ENTRY_NOTFOUND != mnLastPosHatch) { - if(!mpLbFillAttr->GetEntryCount()) + if(mnLastPosHatch < pXHatchList->Count()) { - const SvxHatchListItem aItem( *static_cast<const SvxHatchListItem*>(pSh->GetItem(SID_HATCH_LIST))); - mpLbFillAttr->Enable(); - mpLbFillAttr->Clear(); - mpLbFillAttr->Fill(aItem.GetHatchList()); + const XHatch aHatch = pXHatchList->GetHatch(mnLastPosHatch)->GetHatch(); + const XFillHatchItem aXFillHatchItem(mpLbFillAttr->GetSelectEntry(), aHatch); + + // #i122676# change FillStyle and Hatch in one call + XFillStyleItem aXFillStyleItem(drawing::FillStyle_HATCH); + setFillStyleAndHatch(&aXFillStyleItem, aXFillHatchItem); + mpLbFillAttr->SelectEntryPos(mnLastPosHatch); } + } + } + else + { + mpLbFillAttr->Disable(); + } + break; + } + case BITMAP: + case PATTERN: + { + mpLbFillAttr->Show(); + mpLbFillAttr->Enable(); + mpLbFillAttr->Clear(); + mpLbFillGradFrom->Hide(); + mpLbFillGradTo->Hide(); + mpMTRAngle->Hide(); + mpGradientStyle->Hide(); + mpToolBoxColor->Hide(); + + OUString aName; + GraphicObject aBitmap; + if(nPos == static_cast< sal_Int32 >(BITMAP)) + { + mpBmpImport->Show(); + const SvxBitmapListItem* aItem( static_cast<const SvxBitmapListItem*>(pSh->GetItem(SID_BITMAP_LIST))); + if(aItem) + { + XBitmapListRef pXBitmapList(aItem->GetBitmapList()); + mpLbFillAttr->Fill(pXBitmapList); mpLbFillAttr->AdaptDropDownLineCountToMaximum(); - if(LISTBOX_ENTRY_NOTFOUND != mnLastPosHatch) + if(LISTBOX_ENTRY_NOTFOUND != mnLastPosBitmap) { - const SvxHatchListItem aItem(*static_cast<const SvxHatchListItem*>(pSh->GetItem(SID_HATCH_LIST))); - - if(mnLastPosHatch < aItem.GetHatchList()->Count()) + if(mnLastPosBitmap < pXBitmapList->Count()) { - const XHatch aHatch = aItem.GetHatchList()->GetHatch(mnLastPosHatch)->GetHatch(); - const XFillHatchItem aXFillHatchItem(mpLbFillAttr->GetSelectEntry(), aHatch); - - // #i122676# change FillStyle and Hatch in one call - setFillStyleAndHatch(&aXFillStyleItem, aXFillHatchItem); - mpLbFillAttr->SelectEntryPos(mnLastPosHatch); + const XBitmapEntry* pXBitmapEntry = pXBitmapList->GetBitmap(mnLastPosBitmap); + aBitmap = pXBitmapEntry->GetGraphicObject(); + aName = mpLbFillAttr->GetSelectEntry(); + mpLbFillAttr->SelectEntryPos(mnLastPosBitmap); } } } else { - mpLbFillAttr->Disable(); + mpLbFillAttr->Hide(); } - break; } - case drawing::FillStyle_BITMAP: + else if(nPos == static_cast< sal_Int32 >(PATTERN)) { - mpLbFillAttr->Hide(); - mpLbFillGradFrom->Hide(); - mpLbFillGradTo->Hide(); - mpMTRAngle->Hide(); - mpGradientStyle->Hide(); - mpToolBoxColor->Hide(); - mpLbFillBitmap->Show(); - mpBmpImport->Show(); - - if(pSh && pSh->GetItem(SID_BITMAP_LIST)) + mpBmpImport->Hide(); + const SvxPatternListItem* aItem( static_cast<const SvxPatternListItem*>(pSh->GetItem(SID_PATTERN_LIST))); + if(aItem) { - if(!mpLbFillBitmap->GetEntryCount()) - { - const SvxBitmapListItem aItem( *static_cast<const SvxBitmapListItem*>(pSh->GetItem(SID_BITMAP_LIST))); - mpLbFillBitmap->Clear(); - mpLbFillBitmap->Fill(aItem.GetBitmapList()); - } - - mpLbFillBitmap->AdaptDropDownLineCountToMaximum(); + XPatternListRef pXPatternList(aItem->GetPatternList()); + mpLbFillAttr->Fill(pXPatternList); - if(LISTBOX_ENTRY_NOTFOUND != mnLastPosBitmap) + mpLbFillAttr->AdaptDropDownLineCountToMaximum(); + if(LISTBOX_ENTRY_NOTFOUND != mnLastPosPattern) { - const SvxBitmapListItem aItem(*static_cast<const SvxBitmapListItem*>(pSh->GetItem(SID_BITMAP_LIST))); - - if(mnLastPosBitmap < aItem.GetBitmapList()->Count()) + if(mnLastPosPattern < pXPatternList->Count()) { - const XBitmapEntry* pXBitmapEntry = aItem.GetBitmapList()->GetBitmap(mnLastPosBitmap); - const XFillBitmapItem aXFillBitmapItem(mpLbFillBitmap->GetSelectEntry(), pXBitmapEntry->GetGraphicObject()); - - // #i122676# change FillStyle and Bitmap in one call - setFillStyleAndBitmap(&aXFillStyleItem, aXFillBitmapItem); - mpLbFillBitmap->SelectEntryPos(mnLastPosBitmap); + const XBitmapEntry* pXPatternEntry = pXPatternList->GetBitmap(mnLastPosPattern); + aBitmap = pXPatternEntry->GetGraphicObject(); + aName = mpLbFillAttr->GetSelectEntry(); + mpLbFillAttr->SelectEntryPos(mnLastPosPattern); } } } else { - mpLbFillBitmap->Hide(); + mpLbFillAttr->Hide(); } - break; } + const XFillBitmapItem aXFillBitmapItem( aName, aBitmap ); + const XFillStyleItem aXFillStyleItem(drawing::FillStyle_BITMAP); + setFillStyleAndBitmap(&aXFillStyleItem, aXFillBitmapItem); + break; } + } - meLastXFS = (sal_uInt16)eXFS; + meLastXFS = (sal_uInt16)nPos; - if(drawing::FillStyle_NONE != eXFS) - { - mpLbFillType->Selected(); - } + if(eFillStyle::NONE != (eFillStyle)nPos) + { + mpLbFillType->Selected(); } mpSidebarController->NotifyResize(); @@ -477,26 +506,35 @@ void AreaPropertyPanelBase::DataChanged( void AreaPropertyPanelBase::SelectFillAttrHdl_Impl() { - const drawing::FillStyle eXFS = (drawing::FillStyle)mpLbFillType->GetSelectEntryPos(); - const XFillStyleItem aXFillStyleItem(eXFS); + sal_Int32 nPosFillStyle = (eFillStyle)mpLbFillType->GetSelectEntryPos(); SfxObjectShell* pSh = SfxObjectShell::Current(); // #i122676# dependent from bFillStyleChange, do execute a single or two // changes in one Execute call - const bool bFillStyleChange((drawing::FillStyle) meLastXFS != eXFS); + const bool bFillStyleChange((eFillStyle) meLastXFS != (eFillStyle)nPosFillStyle); - switch(eXFS) + switch(nPosFillStyle) { - case drawing::FillStyle_SOLID: + case eFillStyle::NONE: + { + if(bFillStyleChange) + { + XFillStyleItem aXFillStyleItem(drawing::FillStyle_NONE); + setFillStyle(aXFillStyleItem); + } + break; + } + case eFillStyle::SOLID: { if(bFillStyleChange) { // #i122676# Single FillStyle change call needed here + XFillStyleItem aXFillStyleItem(drawing::FillStyle_SOLID); setFillStyle(aXFillStyleItem); } break; } - case drawing::FillStyle_GRADIENT: + case eFillStyle::GRADIENT: { if(pSh && pSh->GetItem(SID_COLOR_TABLE)) @@ -510,12 +548,12 @@ void AreaPropertyPanelBase::SelectFillAttrHdl_Impl() const XFillGradientItem aXFillGradientItem(mpLbFillAttr->GetSelectEntry(), aGradient); // #i122676# Change FillStyle and Gradinet in one call + XFillStyleItem aXFillStyleItem(drawing::FillStyle_GRADIENT); setFillStyleAndGradient(bFillStyleChange ? &aXFillStyleItem : nullptr, aXFillGradientItem); } - break; } - case drawing::FillStyle_HATCH: + case eFillStyle::HATCH: { sal_Int32 nPos = mpLbFillAttr->GetSelectEntryPos(); @@ -534,6 +572,7 @@ void AreaPropertyPanelBase::SelectFillAttrHdl_Impl() const XFillHatchItem aXFillHatchItem( mpLbFillAttr->GetSelectEntry(), aHatch); // #i122676# Change FillStyle and Hatch in one call + XFillStyleItem aXFillStyleItem(drawing::FillStyle_HATCH); setFillStyleAndHatch(bFillStyleChange ? &aXFillStyleItem : nullptr, aXFillHatchItem); } } @@ -544,9 +583,9 @@ void AreaPropertyPanelBase::SelectFillAttrHdl_Impl() } break; } - case drawing::FillStyle_BITMAP: + case eFillStyle::BITMAP: { - sal_Int32 nPos = mpLbFillBitmap->GetSelectEntryPos(); + sal_Int32 nPos = mpLbFillAttr->GetSelectEntryPos(); if(LISTBOX_ENTRY_NOTFOUND == nPos) { @@ -560,9 +599,10 @@ void AreaPropertyPanelBase::SelectFillAttrHdl_Impl() if(nPos < aItem.GetBitmapList()->Count()) { const XBitmapEntry* pXBitmapEntry = aItem.GetBitmapList()->GetBitmap(nPos); - const XFillBitmapItem aXFillBitmapItem(mpLbFillBitmap->GetSelectEntry(), pXBitmapEntry->GetGraphicObject()); + const XFillBitmapItem aXFillBitmapItem(mpLbFillAttr->GetSelectEntry(), pXBitmapEntry->GetGraphicObject()); // #i122676# Change FillStyle and Bitmap in one call + XFillStyleItem aXFillStyleItem(drawing::FillStyle_BITMAP); setFillStyleAndBitmap(bFillStyleChange ? &aXFillStyleItem : nullptr, aXFillBitmapItem); } } @@ -573,7 +613,36 @@ void AreaPropertyPanelBase::SelectFillAttrHdl_Impl() } break; } - default: break; + case eFillStyle::PATTERN: + { + sal_Int32 nPos = mpLbFillAttr->GetSelectEntryPos(); + + if(LISTBOX_ENTRY_NOTFOUND == nPos) + { + nPos = mnLastPosPattern; + } + + if(LISTBOX_ENTRY_NOTFOUND != nPos && pSh && pSh->GetItem(SID_PATTERN_LIST)) + { + const SvxPatternListItem aItem(*static_cast<const SvxPatternListItem*>(pSh->GetItem(SID_PATTERN_LIST))); + + if(nPos < aItem.GetPatternList()->Count()) + { + const XBitmapEntry* pXPatternEntry = aItem.GetPatternList()->GetBitmap(nPos); + const XFillBitmapItem aXFillBitmapItem(mpLbFillAttr->GetSelectEntry(), pXPatternEntry->GetGraphicObject()); + + // #i122676# Change FillStyle and Bitmap in one call + XFillStyleItem aXFillStyleItem(drawing::FillStyle_BITMAP); + setFillStyleAndBitmap(bFillStyleChange ? &aXFillStyleItem : nullptr, aXFillBitmapItem); + } + } + + if(LISTBOX_ENTRY_NOTFOUND != nPos) + { + mnLastPosPattern = nPos; + } + break; + } } mpSidebarController->NotifyResize(); } @@ -781,15 +850,42 @@ void AreaPropertyPanelBase::updateFillStyle(bool bDisabled, bool bDefault, const 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) + eFillStyle nPos = NONE; + switch(eXFS) { - mpLbFillAttr->SetNoSelection(); - mpLbFillAttr->Disable(); + default: + case drawing::FillStyle_NONE: + { + mpLbFillAttr->SetNoSelection(); + mpLbFillAttr->Disable(); + nPos = NONE; + break; + } + case drawing::FillStyle_SOLID: + nPos = SOLID; + break; + case drawing::FillStyle_GRADIENT: + nPos = GRADIENT; + break; + case drawing::FillStyle_HATCH: + nPos = HATCH; + break; + case drawing::FillStyle_BITMAP: + { + if(mpBitmapItem) + { + if(!mpBitmapItem->isPattern()) + nPos = BITMAP; + else + nPos = PATTERN; + } + else + nPos = BITMAP; + break; + } } - + meLastXFS = static_cast< sal_uInt16 >(mpLbFillType->GetSelectEntryPos()); + mpLbFillType->SelectEntryPos(static_cast< sal_Int32 >(nPos)); Update(); return; } @@ -822,6 +918,7 @@ void AreaPropertyPanelBase::updateFillGradient(bool bDisabled, bool bDefault, co if(bDefault) { + mpLbFillType->SelectEntryPos(GRADIENT); Update(); } else if(bDisabled) @@ -857,6 +954,7 @@ void AreaPropertyPanelBase::updateFillHatch(bool bDisabled, bool bDefault, const if(bDefault) { mpLbFillAttr->Enable(); + mpLbFillType->SelectEntryPos(HATCH); Update(); } else if(bDisabled) @@ -883,7 +981,7 @@ void AreaPropertyPanelBase::updateFillColor(bool bDefault, const XFillColorItem* { mpLbFillAttr->Hide(); mpToolBoxColor->Show(); - + mpLbFillType->SelectEntryPos(SOLID); Update(); } mpSidebarController->NotifyResize(); @@ -898,20 +996,25 @@ void AreaPropertyPanelBase::updateFillBitmap(bool bDisabled, bool bDefault, cons if(mpStyleItem && drawing::FillStyle_BITMAP == (drawing::FillStyle)mpStyleItem->GetValue()) { - mpLbFillBitmap->Show(); + mpLbFillAttr->Show(); mpToolBoxColor->Hide(); if(bDefault) { + if(mpBitmapItem->isPattern()) + mpLbFillType->SelectEntryPos(PATTERN); + else + mpLbFillType->SelectEntryPos(BITMAP); Update(); } else if(bDisabled) { - mpLbFillBitmap->Hide(); + mpLbFillAttr->Hide(); + mpLbFillAttr->SetNoSelection(); } else { - mpLbFillBitmap->SetNoSelection(); + mpLbFillAttr->SetNoSelection(); } } mpSidebarController->NotifyResize(); @@ -1008,6 +1111,7 @@ void AreaPropertyPanelBase::NotifyItemUpdate( break; } case SID_BITMAP_LIST: + case SID_PATTERN_LIST: { if(bDefault) { @@ -1017,16 +1121,24 @@ void AreaPropertyPanelBase::NotifyItemUpdate( { const OUString aString( mpBitmapItem->GetName() ); const SfxObjectShell* pSh = SfxObjectShell::Current(); - const SvxBitmapListItem aItem(*static_cast<const SvxBitmapListItem*>(pSh->GetItem(SID_BITMAP_LIST))); + mpLbFillAttr->Clear(); + mpLbFillAttr->Show(); + if(nSID == SID_BITMAP_LIST) + { + const SvxBitmapListItem aItem(*static_cast<const SvxBitmapListItem*>(pSh->GetItem(SID_BITMAP_LIST))); - mpLbFillBitmap->Clear(); - mpLbFillBitmap->Show(); - mpLbFillBitmap->Fill(aItem.GetBitmapList()); - mpLbFillBitmap->SelectEntry(aString); + mpLbFillAttr->Fill(aItem.GetBitmapList()); + } + else if(nSID == SID_PATTERN_LIST) + { + const SvxPatternListItem aItem(*static_cast<const SvxPatternListItem*>(pSh->GetItem(SID_PATTERN_LIST))); + mpLbFillAttr->Fill(aItem.GetPatternList()); + } + mpLbFillAttr->SelectEntry(aString); } else { - mpLbFillBitmap->SetNoSelection(); + mpLbFillAttr->SetNoSelection(); } } } @@ -1037,14 +1149,12 @@ void AreaPropertyPanelBase::NotifyItemUpdate( void AreaPropertyPanelBase::Update() { - if(mpStyleItem) - { - const drawing::FillStyle eXFS = (drawing::FillStyle)mpStyleItem->GetValue(); + const eFillStyle eXFS = (eFillStyle)mpLbFillType->GetSelectEntryPos(); SfxObjectShell* pSh = SfxObjectShell::Current(); switch( eXFS ) { - case drawing::FillStyle_NONE: + case eFillStyle::NONE: { mpLbFillAttr->Show(); mpLbFillGradFrom->Hide(); @@ -1052,11 +1162,10 @@ void AreaPropertyPanelBase::Update() mpMTRAngle->Hide(); mpGradientStyle->Hide(); mpToolBoxColor->Hide(); - mpLbFillBitmap->Hide(); mpBmpImport->Hide(); break; } - case drawing::FillStyle_SOLID: + case eFillStyle::SOLID: { if(mpColorItem) { @@ -1066,12 +1175,11 @@ void AreaPropertyPanelBase::Update() mpMTRAngle->Hide(); mpGradientStyle->Hide(); mpToolBoxColor->Show(); - mpLbFillBitmap->Hide(); mpBmpImport->Hide(); } break; } - case drawing::FillStyle_GRADIENT: + case eFillStyle::GRADIENT: { mpLbFillAttr->Hide(); mpLbFillGradFrom->Show(); @@ -1080,7 +1188,6 @@ void AreaPropertyPanelBase::Update() mpMTRAngle->Show(); mpGradientStyle->Show(); mpToolBoxColor->Hide(); - mpLbFillBitmap->Hide(); mpBmpImport->Hide(); if(pSh && pSh->GetItem(SID_GRADIENT_LIST)) @@ -1128,7 +1235,7 @@ void AreaPropertyPanelBase::Update() } break; } - case drawing::FillStyle_HATCH: + case eFillStyle::HATCH: { mpLbFillAttr->Show(); mpLbFillGradFrom->Hide(); @@ -1136,9 +1243,7 @@ void AreaPropertyPanelBase::Update() mpMTRAngle->Hide(); mpGradientStyle->Hide(); mpToolBoxColor->Hide(); - mpLbFillBitmap->Hide(); mpBmpImport->Hide(); - mpLbFillBitmap->Hide(); mpBmpImport->Hide(); if(pSh && pSh->GetItem(SID_HATCH_LIST)) @@ -1165,38 +1270,43 @@ void AreaPropertyPanelBase::Update() } break; } - case drawing::FillStyle_BITMAP: + case eFillStyle::BITMAP: + case eFillStyle::PATTERN: { - mpLbFillAttr->Hide(); + mpLbFillAttr->Show(); + mpLbFillAttr->Enable(); + mpLbFillAttr->Clear(); mpToolBoxColor->Hide(); mpLbFillGradFrom->Hide(); mpLbFillGradTo->Hide(); mpMTRAngle->Hide(); mpGradientStyle->Hide(); - mpLbFillBitmap->Show(); - mpBmpImport->Show(); - if(pSh && pSh->GetItem(SID_BITMAP_LIST)) + if(mpBitmapItem) { - const SvxBitmapListItem aItem(*static_cast<const SvxBitmapListItem*>(pSh->GetItem(SID_BITMAP_LIST))); - mpLbFillBitmap->Clear(); - mpLbFillBitmap->Fill(aItem.GetBitmapList()); - - if(mpBitmapItem) + if(pSh && pSh->GetItem(SID_BITMAP_LIST) && eXFS == BITMAP) { - const OUString aString(mpBitmapItem->GetName()); + mpBmpImport->Show(); + mpLbFillType->SelectEntryPos((sal_uInt32)BITMAP); + const SvxBitmapListItem aItem(*static_cast<const SvxBitmapListItem*>(pSh->GetItem(SID_BITMAP_LIST))); + mpLbFillAttr->Fill(aItem.GetBitmapList()); - mpLbFillBitmap->SelectEntry(aString); + const OUString aString(mpBitmapItem->GetName()); + mpLbFillAttr->SelectEntry(aString); } - else + else if(pSh && pSh->GetItem(SID_PATTERN_LIST) && eXFS == PATTERN) { - mpLbFillBitmap->SetNoSelection(); + mpBmpImport->Hide(); + mpLbFillType->SelectEntryPos((sal_uInt32)PATTERN); + const SvxPatternListItem aItem(*static_cast<const SvxPatternListItem*>(pSh->GetItem(SID_PATTERN_LIST))); + mpLbFillAttr->Fill(aItem.GetPatternList()); + + const OUString aString(mpBitmapItem->GetName()); + mpLbFillAttr->SelectEntry(aString); } } else - { - mpLbFillBitmap->SetNoSelection(); - } + mpLbFillAttr->SetNoSelection(); break; } default: @@ -1204,7 +1314,6 @@ void AreaPropertyPanelBase::Update() break; } mpSidebarController->NotifyResize(); - } } IMPL_LINK_NOARG_TYPED(AreaPropertyPanelBase, ModifyTransSliderHdl, Slider*, void) diff --git a/svx/source/xoutdev/xattrbmp.cxx b/svx/source/xoutdev/xattrbmp.cxx index 1d7572ea9d64..31129f4d748c 100644 --- a/svx/source/xoutdev/xattrbmp.cxx +++ b/svx/source/xoutdev/xattrbmp.cxx @@ -523,11 +523,14 @@ XFillBitmapItem* XFillBitmapItem::checkForUniqueItem( SdrModel* pModel ) const { if( pModel ) { + XPropertyListType aListType = XBITMAP_LIST; + if(isPattern()) + aListType = XPATTERN_LIST; const OUString aUniqueName = NameOrIndex::CheckNamedItem( this, XATTR_FILLBITMAP, &pModel->GetItemPool(), pModel->GetStyleSheetPool() ? &pModel->GetStyleSheetPool()->GetPool() : nullptr, XFillBitmapItem::CompareValueFunc, RID_SVXSTR_BMP21, - pModel->GetPropertyList( XBITMAP_LIST ) ); + pModel->GetPropertyList( aListType ) ); // if the given name is not valid, replace it! if( aUniqueName != GetName() ) diff --git a/svx/source/xoutdev/xtabbtmp.cxx b/svx/source/xoutdev/xtabbtmp.cxx index d5ed9d543d7f..bfc086671559 100644 --- a/svx/source/xoutdev/xtabbtmp.cxx +++ b/svx/source/xoutdev/xtabbtmp.cxx @@ -48,39 +48,6 @@ uno::Reference< container::XNameContainer > XBitmapList::createInstance() bool XBitmapList::Create() { - OUStringBuffer aStr(SVX_RESSTR(RID_SVXSTR_BITMAP)); - sal_uInt16 aArray[64]; - Bitmap aBitmap; - const sal_Int32 nLen(aStr.getLength() - 1); - - memset(aArray, 0, sizeof(aArray)); - - // white/white bitmap - aStr.append(" 1"); - aBitmap = createHistorical8x8FromArray(aArray, RGB_Color(COL_WHITE), RGB_Color(COL_WHITE)); - Insert(new XBitmapEntry(Graphic(aBitmap), aStr.toString())); - - // black/white bitmap - aArray[ 0] = 1; aArray[ 9] = 1; aArray[18] = 1; aArray[27] = 1; - aArray[36] = 1; aArray[45] = 1; aArray[54] = 1; aArray[63] = 1; - aStr[nLen] = '2'; - aBitmap = createHistorical8x8FromArray(aArray, RGB_Color(COL_BLACK), RGB_Color(COL_WHITE)); - Insert(new XBitmapEntry(Graphic(aBitmap), aStr.toString())); - - // lightred/white bitmap - aArray[ 7] = 1; aArray[14] = 1; aArray[21] = 1; aArray[28] = 1; - aArray[35] = 1; aArray[42] = 1; aArray[49] = 1; aArray[56] = 1; - aStr[nLen] = '3'; - aBitmap = createHistorical8x8FromArray(aArray, RGB_Color(COL_LIGHTRED), RGB_Color(COL_WHITE)); - Insert(new XBitmapEntry(Graphic(aBitmap), aStr.toString())); - - // lightblue/white bitmap - aArray[24] = 1; aArray[25] = 1; aArray[26] = 1; - aArray[29] = 1; aArray[30] = 1; aArray[31] = 1; - aStr[nLen] = '4'; - aBitmap = createHistorical8x8FromArray(aArray, RGB_Color(COL_LIGHTBLUE), RGB_Color(COL_WHITE)); - Insert(new XBitmapEntry(Graphic(aBitmap), aStr.toString())); - return true; } diff --git a/svx/source/xoutdev/xtable.cxx b/svx/source/xoutdev/xtable.cxx index e73fd080a4be..aebf849ccd74 100644 --- a/svx/source/xoutdev/xtable.cxx +++ b/svx/source/xoutdev/xtable.cxx @@ -334,6 +334,9 @@ XPropertyListRef XPropertyList::CreatePropertyList( XPropertyListType aType, case XBITMAP_LIST: pRet = XPropertyListRef(new XBitmapList(rPath, rReferer)); break; + case XPATTERN_LIST: + pRet = XPropertyListRef(new XPatternList(rPath, rReferer)); + break; default: OSL_FAIL("unknown xproperty type"); break; @@ -381,7 +384,8 @@ static struct { { XDASH_LIST, "sod" }, { XHATCH_LIST, "soh" }, { XGRADIENT_LIST, "sog" }, - { XBITMAP_LIST, "sob" } + { XBITMAP_LIST, "sob" }, + { XPATTERN_LIST, "sop"} }; OUString XPropertyList::GetDefaultExt( XPropertyListType t ) diff --git a/svx/source/xoutdev/xtabptrn.cxx b/svx/source/xoutdev/xtabptrn.cxx new file mode 100644 index 000000000000..6fcfec98e32f --- /dev/null +++ b/svx/source/xoutdev/xtabptrn.cxx @@ -0,0 +1,92 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "svx/XPropertyTable.hxx" + +#include <vcl/virdev.hxx> +#include <svl/itemset.hxx> +#include <sfx2/docfile.hxx> +#include <svx/dialogs.hrc> +#include <svx/dialmgr.hxx> +#include <svx/xtable.hxx> +#include <svx/xpool.hxx> +#include <svx/xbtmpit.hxx> + +using namespace com::sun::star; + +XBitmapEntry* XPatternList::Remove(long nIndex) +{ + return static_cast<XBitmapEntry*>( XPropertyList::Remove(nIndex) ); +} + +XBitmapEntry* XPatternList::GetBitmap(long nIndex) const +{ + return static_cast<XBitmapEntry*>( XPropertyList::Get(nIndex) ); +} + +uno::Reference< container::XNameContainer > XPatternList::createInstance() +{ + return uno::Reference< container::XNameContainer >( + SvxUnoXBitmapTable_createInstance( this ), uno::UNO_QUERY ); +} + +bool XPatternList::Create() +{ + OUStringBuffer aStr(SVX_RESSTR(RID_SVXSTR_PATTERN)); + sal_uInt16 aArray[64]; + Bitmap aBitmap; + const sal_Int32 nLen(aStr.getLength() - 1); + + memset(aArray, 0, sizeof(aArray)); + + // white/white bitmap + aStr.append(" 1"); + aBitmap = createHistorical8x8FromArray(aArray, RGB_Color(COL_WHITE), RGB_Color(COL_WHITE)); + Insert(new XBitmapEntry(Graphic(aBitmap), aStr.toString())); + + // black/white bitmap + aArray[ 0] = 1; aArray[ 9] = 1; aArray[18] = 1; aArray[27] = 1; + aArray[36] = 1; aArray[45] = 1; aArray[54] = 1; aArray[63] = 1; + aStr[nLen] = '2'; + aBitmap = createHistorical8x8FromArray(aArray, RGB_Color(COL_BLACK), RGB_Color(COL_WHITE)); + Insert(new XBitmapEntry(Graphic(aBitmap), aStr.toString())); + + // lightred/white bitmap + aArray[ 7] = 1; aArray[14] = 1; aArray[21] = 1; aArray[28] = 1; + aArray[35] = 1; aArray[42] = 1; aArray[49] = 1; aArray[56] = 1; + aStr[nLen] = '3'; + aBitmap = createHistorical8x8FromArray(aArray, RGB_Color(COL_LIGHTRED), RGB_Color(COL_WHITE)); + Insert(new XBitmapEntry(Graphic(aBitmap), aStr.toString())); + + // lightblue/white bitmap + aArray[24] = 1; aArray[25] = 1; aArray[26] = 1; + aArray[29] = 1; aArray[30] = 1; aArray[31] = 1; + aStr[nLen] = '4'; + aBitmap = createHistorical8x8FromArray(aArray, RGB_Color(COL_LIGHTBLUE), RGB_Color(COL_WHITE)); + Insert(new XBitmapEntry(Graphic(aBitmap), aStr.toString())); + + return true; +} + +Bitmap XPatternList::CreateBitmapForUI( long /*nIndex*/ ) +{ + return Bitmap(); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/uiconfig/ui/sidebararea.ui b/svx/uiconfig/ui/sidebararea.ui index efd1bcba568b..a11a4ea0cb23 100644 --- a/svx/uiconfig/ui/sidebararea.ui +++ b/svx/uiconfig/ui/sidebararea.ui @@ -150,52 +150,73 @@ </packing> </child> <child> - <object class="GtkToolbar" id="selectgradient"> + <object class="svxlo-ColorLB" id="fillgrad2"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="halign">start</property> - <child> - <object class="GtkMenuToolButton" id="gradient"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="has_tooltip">True</property> - <property name="tooltip_markup" translatable="yes">Specify the variation of gradient transparency.</property> - <property name="tooltip_text" translatable="yes">Specify the variation of gradient transparency.</property> - <property name="hexpand">True</property> - <property name="action_name">.uno:sidebargradient</property> - <property name="use_underline">True</property> - </object> - <packing> - <property name="expand">True</property> - <property name="homogeneous">True</property> - </packing> - </child> + <property name="has_tooltip">True</property> + <property name="tooltip_markup" translatable="yes">Fill gradient to.</property> + <property name="tooltip_text" translatable="yes">Fill gradient to.</property> </object> <packing> <property name="left_attach">1</property> - <property name="top_attach">5</property> + <property name="top_attach">2</property> <property name="width">1</property> <property name="height">1</property> </packing> </child> <child> - <object class="svxlo-ColorLB" id="fillgrad2"> + <object class="GtkBox" id="box2"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="has_tooltip">True</property> - <property name="tooltip_markup" translatable="yes">Fill gradient to.</property> - <property name="tooltip_text" translatable="yes">Fill gradient to.</property> + <child> + <object class="GtkComboBoxText" id="gradientstyle"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="tooltip_markup" translatable="yes">Select the gradient style.</property> + <property name="tooltip_text" translatable="yes">Select the gradient style.</property> + <items> + <item translatable="yes">Linear</item> + <item translatable="yes">Axial</item> + <item translatable="yes">Radial</item> + <item translatable="yes">Ellipsoid</item> + <item translatable="yes">Quadratic</item> + <item translatable="yes">Square</item> + </items> + <child internal-child="accessible"> + <object class="AtkObject" id="gradientstyle-atkobject"> + <property name="AtkObject::accessible-name" translatable="yes">Gradient Type</property> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkButton" id="bmpimport"> + <property name="label" translatable="yes">_Import</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_underline">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> </object> <packing> - <property name="left_attach">1</property> - <property name="top_attach">2</property> + <property name="left_attach">0</property> + <property name="top_attach">1</property> <property name="width">1</property> <property name="height">1</property> </packing> </child> <child> <object class="GtkSpinButton" id="gradangle:0degrees"> - <property name="visible">True</property> <property name="can_focus">True</property> <property name="tooltip_markup" translatable="yes">Select the gradient angle.</property> <property name="tooltip_text" translatable="yes">Select the gradient angle.</property> @@ -214,28 +235,19 @@ </packing> </child> <child> - <object class="GtkComboBoxText" id="gradientstyle"> + <object class="GtkLabel" id="transparencylabel"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="tooltip_markup" translatable="yes">Select the gradient style.</property> - <property name="tooltip_text" translatable="yes">Select the gradient style.</property> - <items> - <item translatable="yes">Linear</item> - <item translatable="yes">Axial</item> - <item translatable="yes">Radial</item> - <item translatable="yes">Ellipsoid</item> - <item translatable="yes">Quadratic</item> - <item translatable="yes">Square</item> - </items> - <child internal-child="accessible"> - <object class="AtkObject" id="gradientstyle-atkobject"> - <property name="AtkObject::accessible-name" translatable="yes">Gradient Type</property> - </object> - </child> + <property name="has_tooltip">True</property> + <property name="tooltip_markup" translatable="yes">Transparency</property> + <property name="tooltip_text" translatable="yes">Transparency</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">_Transparency:</property> + <property name="use_underline">True</property> </object> <packing> <property name="left_attach">0</property> - <property name="top_attach">1</property> + <property name="top_attach">3</property> <property name="width">1</property> <property name="height">1</property> </packing> @@ -265,62 +277,36 @@ </object> <packing> <property name="left_attach">1</property> - <property name="top_attach">4</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="transparencylabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="has_tooltip">True</property> - <property name="tooltip_markup" translatable="yes">Transparency</property> - <property name="tooltip_text" translatable="yes">Transparency</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">_Transparency:</property> - <property name="use_underline">True</property> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">4</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="GtkButton" id="bmpimport"> - <property name="label" translatable="yes">_Import</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="use_underline">True</property> - </object> - <packing> - <property name="left_attach">0</property> <property name="top_attach">3</property> <property name="width">1</property> <property name="height">1</property> </packing> </child> <child> - <object class="svxlo-SvxFillAttrBox" id="fillbitmap"> + <object class="GtkToolbar" id="selectgradient"> + <property name="visible">True</property> <property name="can_focus">False</property> - <property name="has_tooltip">True</property> - <property name="tooltip_markup" translatable="yes">Select the effect to apply.</property> - <property name="tooltip_text" translatable="yes">Select the effect to apply.</property> - <accessibility> - <relation type="labelled-by" target="filllabel"/> - </accessibility> - <child internal-child="accessible"> - <object class="AtkObject" id="fillbitmap-atkobject"> - <property name="AtkObject::accessible-name" translatable="yes">Hatching/Bitmap</property> + <property name="halign">start</property> + <child> + <object class="GtkMenuToolButton" id="gradient"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="has_tooltip">True</property> + <property name="tooltip_markup" translatable="yes">Specify the variation of gradient transparency.</property> + <property name="tooltip_text" translatable="yes">Specify the variation of gradient transparency.</property> + <property name="hexpand">True</property> + <property name="action_name">.uno:sidebargradient</property> + <property name="use_underline">True</property> </object> + <packing> + <property name="expand">True</property> + <property name="homogeneous">True</property> + </packing> </child> </object> <packing> <property name="left_attach">1</property> - <property name="top_attach">3</property> + <property name="top_attach">4</property> <property name="width">1</property> <property name="height">1</property> </packing> @@ -406,4 +392,14 @@ <widget name="fillattr"/> </widgets> </object> + <object class="GtkSizeGroup" id="sizegroup2"> + <property name="ignore_hidden">True</property> + <widgets> + <widget name="filllabel"/> + <widget name="gradientstyle"/> + <widget name="bmpimport"/> + <widget name="gradangle:0degrees"/> + <widget name="transparencylabel"/> + </widgets> + </object> </interface> |