diff options
author | Jim Raykowski <raykowj@gmail.com> | 2018-01-28 09:20:06 -0900 |
---|---|---|
committer | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2018-04-09 09:14:07 +0200 |
commit | 41f1a38b9e8b5e0567bf642d3e14a549e82ee0d9 (patch) | |
tree | c0210ebfb55bb70ce139e5134db89ba5edf82910 | |
parent | b9d709e84728270acb00c3952551f5c608260e62 (diff) |
tdf#105225 A table properties background tab page
Change-Id: I86be7b0d9850ffe46f1033beac342739b3289fa8
Reviewed-on: https://gerrit.libreoffice.org/48797
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
-rw-r--r-- | cui/source/factory/dlgfact.cxx | 2 | ||||
-rw-r--r-- | cui/source/inc/backgrnd.hxx | 18 | ||||
-rw-r--r-- | cui/source/inc/cuitabarea.hxx | 3 | ||||
-rw-r--r-- | cui/source/tabpages/backgrnd.cxx | 130 | ||||
-rw-r--r-- | cui/uiconfig/ui/areatabpage.ui | 42 | ||||
-rw-r--r-- | include/svx/dialogs.hrc | 1 | ||||
-rw-r--r-- | sw/source/ui/table/tabledlg.cxx | 4 | ||||
-rw-r--r-- | sw/source/uibase/shells/tabsh.cxx | 5 |
8 files changed, 189 insertions, 16 deletions
diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx index f4a57b475ce3..091c920b9c5a 100644 --- a/cui/source/factory/dlgfact.cxx +++ b/cui/source/factory/dlgfact.cxx @@ -1348,6 +1348,8 @@ CreateTabPage AbstractDialogFactory_Impl::GetTabPageCreatorFunc( sal_uInt16 nId { switch ( nId ) { + case RID_SVXPAGE_BKG : + return SvxBkgTabPage::Create; case RID_SVXPAGE_TEXTANIMATION : return SvxTextAnimationPage::Create; case RID_SVXPAGE_TRANSPARENCE : diff --git a/cui/source/inc/backgrnd.hxx b/cui/source/inc/backgrnd.hxx index d7e71a0ceec9..88131fa61b80 100644 --- a/cui/source/inc/backgrnd.hxx +++ b/cui/source/inc/backgrnd.hxx @@ -139,6 +139,24 @@ private: DECL_LINK( TblDestinationHdl_Impl, ListBox&, void ); }; +#include "cuitabarea.hxx" + +class SvxBkgTabPage : public SvxAreaTabPage +{ + VclPtr<ListBox> m_pTblLBox; +public: + using SvxAreaTabPage::DeactivatePage; + + SvxBkgTabPage( vcl::Window* pParent, const SfxItemSet& rInAttrs ); + virtual ~SvxBkgTabPage() override; + virtual void dispose() override; + + static VclPtr<SfxTabPage> Create( vcl::Window*, const SfxItemSet* ); + virtual bool FillItemSet( SfxItemSet* ) override; + virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override; + virtual void PageCreated( const SfxAllItemSet& aSet ) override; +}; + #endif // INCLUDED_CUI_SOURCE_INC_BACKGRND_HXX diff --git a/cui/source/inc/cuitabarea.hxx b/cui/source/inc/cuitabarea.hxx index 81fabd1fb934..ba2760d4fb26 100644 --- a/cui/source/inc/cuitabarea.hxx +++ b/cui/source/inc/cuitabarea.hxx @@ -215,7 +215,6 @@ public: class SvxAreaTabPage : public SvxTabPage { using TabPage::ActivatePage; - using TabPage::DeactivatePage; static const sal_uInt16 pAreaRanges[]; private: ScopedVclPtr<SfxTabPage> m_pFillTabPage; @@ -258,6 +257,8 @@ private: template< typename TabPage > DeactivateRC DeactivatePage_Impl( SfxItemSet* pSet ); public: + using TabPage::DeactivatePage; + SvxAreaTabPage( vcl::Window* pParent, const SfxItemSet& rInAttrs ); virtual ~SvxAreaTabPage() override; virtual void dispose() override; diff --git a/cui/source/tabpages/backgrnd.cxx b/cui/source/tabpages/backgrnd.cxx index ebac89286d83..6ef959108360 100644 --- a/cui/source/tabpages/backgrnd.cxx +++ b/cui/source/tabpages/backgrnd.cxx @@ -1442,4 +1442,134 @@ void SvxBackgroundTabPage::PageCreated(const SfxAllItemSet& aSet) } } +#include <svx/unobrushitemhelper.hxx> + +SvxBkgTabPage::SvxBkgTabPage( vcl::Window* pParent, const SfxItemSet& rInAttrs ) : + SvxAreaTabPage( pParent, rInAttrs ), + m_pTblLBox(nullptr) +{ + VclPtr<vcl::Window> pBtn; + get(pBtn, "btngradient"); pBtn->Hide(); + get(pBtn, "btnhatch"); pBtn->Hide(); + get(pBtn, "btnbitmap"); pBtn->Hide(); + get(pBtn, "btnpattern"); pBtn->Hide(); + + SfxObjectShell* pDocSh = SfxObjectShell::Current(); + const SfxPoolItem* pItem = nullptr; + + XColorListRef pColorTable = nullptr; + if ( pDocSh && ( nullptr != ( pItem = pDocSh->GetItem( SID_COLOR_TABLE ) ) ) ) + { + pColorTable = static_cast<const SvxColorListItem*>(pItem)->GetColorList(); + } + + if ( !pColorTable.is() ) + pColorTable = XColorList::CreateStdColorList(); + + XBitmapListRef pBitmapList = nullptr; + if ( pDocSh && ( nullptr != ( pItem = pDocSh->GetItem( SID_BITMAP_LIST ) ) ) ) + { + pBitmapList = static_cast<const SvxBitmapListItem*>(pItem)->GetBitmapList(); + } + + SetColorList(pColorTable); + SetBitmapList(pBitmapList); +} + +SvxBkgTabPage::~SvxBkgTabPage() +{ + disposeOnce(); +} + +void SvxBkgTabPage::dispose() +{ + m_pTblLBox.clear(); + SvxAreaTabPage::dispose(); +} + +DeactivateRC SvxBkgTabPage::DeactivatePage( SfxItemSet* _pSet ) +{ + if ( DeactivateRC::KeepPage == SvxAreaTabPage::DeactivatePage( _pSet ) ) + return DeactivateRC::KeepPage; + + if ( _pSet ) + FillItemSet( _pSet ); + + return DeactivateRC::LeavePage; +} + +bool SvxBkgTabPage::FillItemSet( SfxItemSet* rCoreSet ) +{ + sal_uInt16 nSlot = SID_ATTR_BRUSH; + if ( m_pTblLBox && m_pTblLBox->IsVisible() ) + { + switch( m_pTblLBox->GetSelectedEntryPos() ) + { + case TBL_DEST_CELL: + nSlot = SID_ATTR_BRUSH; + break; + case TBL_DEST_ROW: + nSlot = SID_ATTR_BRUSH_ROW; + break; + case TBL_DEST_TBL: + nSlot = SID_ATTR_BRUSH_TABLE; + break; + } + } + + sal_uInt16 nWhich = GetWhich(nSlot); + + drawing::FillStyle eFillType = rCoreSet->Get( XATTR_FILLSTYLE ).GetValue(); + switch( eFillType ) + { + case drawing::FillStyle_NONE: + { + rCoreSet->Put( SvxBrushItem( COL_TRANSPARENT, nWhich ) ); + break; + } + case drawing::FillStyle_SOLID: + { + XFillColorItem aColorItem( rCoreSet->Get( XATTR_FILLCOLOR ) ); + rCoreSet->Put( SvxBrushItem( aColorItem.GetColorValue(), nWhich ) ); + break; + } + case drawing::FillStyle_BITMAP: + { + SvxBrushItem aBrushItem( getSvxBrushItemFromSourceSet( *rCoreSet, nWhich ) ); + if ( GraphicType::NONE != aBrushItem.GetGraphicObject()->GetType() ) // no selection so use current + rCoreSet->Put( aBrushItem ); + break; + } + default: + break; + } + + return true; +} + +VclPtr<SfxTabPage> SvxBkgTabPage::Create( vcl::Window* pWindow, + const SfxItemSet* rAttrs ) +{ + return VclPtr<SvxBkgTabPage>::Create( pWindow, *rAttrs ); +} + +void SvxBkgTabPage::PageCreated(const SfxAllItemSet& aSet) +{ + const SfxUInt32Item* pFlagItem = aSet.GetItem<SfxUInt32Item>(SID_FLAG_TYPE, false); + if (pFlagItem) + { + SvxBackgroundTabFlags nFlags = static_cast<SvxBackgroundTabFlags>(pFlagItem->GetValue()); + if ( nFlags & SvxBackgroundTabFlags::SHOW_TBLCTL ) + { + VclPtr<vcl::Window> pBtn; + get(pBtn, "btnbitmap"); + pBtn->Show(); + get(m_pTblLBox, "tablelb"); + m_pTblLBox->SelectEntryPos(0); + m_pTblLBox->Show(); + } + } + SvxAreaTabPage::PageCreated( aSet ); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/uiconfig/ui/areatabpage.ui b/cui/uiconfig/ui/areatabpage.ui index 3e1b746a3815..f1165815fe4c 100644 --- a/cui/uiconfig/ui/areatabpage.ui +++ b/cui/uiconfig/ui/areatabpage.ui @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.16.1 --> +<!-- Generated with glade 3.20.0 --> <interface domain="cui"> <requires lib="gtk+" version="3.18"/> <!-- interface-requires LibreOffice 1.0 --> @@ -25,6 +25,22 @@ <property name="spacing">12</property> <property name="layout_style">center</property> <child> + <object class="GtkComboBoxText" id="tablelb"> + <property name="can_focus">False</property> + <property name="active">0</property> + <items> + <item id="cellid" translatable="yes" context="areatabpage|tablelb">Cell</item> + <item id="rowid" translatable="yes" context="areatabpage|tablelb">Row</item> + <item id="tableid" translatable="yes" context="areatabpage|tablelb">Table</item> + </items> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> <object class="GtkButton" id="btnnone"> <property name="label" translatable="yes" context="areatabpage|btnnone">None</property> <property name="visible">True</property> @@ -34,7 +50,7 @@ <packing> <property name="expand">True</property> <property name="fill">True</property> - <property name="position">0</property> + <property name="position">1</property> </packing> </child> <child> @@ -47,7 +63,7 @@ <packing> <property name="expand">True</property> <property name="fill">True</property> - <property name="position">1</property> + <property name="position">2</property> </packing> </child> <child> @@ -60,12 +76,12 @@ <packing> <property name="expand">True</property> <property name="fill">True</property> - <property name="position">2</property> + <property name="position">3</property> </packing> </child> <child> - <object class="GtkButton" id="btnhatch"> - <property name="label" translatable="yes" context="areatabpage|btnhatch">Hatch</property> + <object class="GtkButton" id="btnbitmap"> + <property name="label" translatable="yes" context="areatabpage|btnbitmap">Bitmap</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> @@ -73,12 +89,12 @@ <packing> <property name="expand">True</property> <property name="fill">True</property> - <property name="position">5</property> + <property name="position">4</property> </packing> </child> <child> - <object class="GtkButton" id="btnbitmap"> - <property name="label" translatable="yes" context="areatabpage|btnbitmap">Bitmap</property> + <object class="GtkButton" id="btnpattern"> + <property name="label" translatable="yes" context="areatabpage|btnpattern">Pattern</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> @@ -86,12 +102,12 @@ <packing> <property name="expand">True</property> <property name="fill">True</property> - <property name="position">3</property> + <property name="position">5</property> </packing> </child> <child> - <object class="GtkButton" id="btnpattern"> - <property name="label" translatable="yes" context="areatabpage|btnpattern">Pattern</property> + <object class="GtkButton" id="btnhatch"> + <property name="label" translatable="yes" context="areatabpage|btnhatch">Hatch</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> @@ -99,7 +115,7 @@ <packing> <property name="expand">True</property> <property name="fill">True</property> - <property name="position">4</property> + <property name="position">6</property> </packing> </child> </object> diff --git a/include/svx/dialogs.hrc b/include/svx/dialogs.hrc index 1c620a67c697..103a07073c93 100644 --- a/include/svx/dialogs.hrc +++ b/include/svx/dialogs.hrc @@ -42,6 +42,7 @@ #define RID_SVXPAGE_PAGE (RID_SVX_START + 25) #define RID_SVXPAGE_LINE (RID_SVX_START + 51) #define RID_SVXPAGE_AREA (RID_SVX_START + 56) +#define RID_SVXPAGE_BKG (RID_SVX_START + 57) #define RID_SVXPAGE_SHADOW (RID_SVX_START + 61) #define RID_SVXPAGE_TRANSPARENCE (RID_SVX_START + 54) #define RID_SVXPAGE_TEXTATTR (RID_SVX_START + 153) diff --git a/sw/source/ui/table/tabledlg.cxx b/sw/source/ui/table/tabledlg.cxx index 52da54c14c00..e25d0b12dce5 100644 --- a/sw/source/ui/table/tabledlg.cxx +++ b/sw/source/ui/table/tabledlg.cxx @@ -1245,7 +1245,7 @@ SwTableTabDlg::SwTableTabDlg(vcl::Window* pParent, AddTabPage("table", &SwFormatTablePage::Create, nullptr); m_nTextFlowId = AddTabPage("textflow", &SwTextFlowPage::Create, nullptr); AddTabPage("columns", &SwTableColumnPage::Create, nullptr); - m_nBackgroundId = AddTabPage("background", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_BACKGROUND), nullptr); + m_nBackgroundId = AddTabPage("background", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_BKG), nullptr); m_nBorderId = AddTabPage("borders", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_BORDER), nullptr); } @@ -1254,7 +1254,7 @@ void SwTableTabDlg::PageCreated(sal_uInt16 nId, SfxTabPage& rPage) SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool())); if (nId == m_nBackgroundId) { - SvxBackgroundTabFlags const nFlagType = SvxBackgroundTabFlags::SHOW_TBLCTL | SvxBackgroundTabFlags::SHOW_SELECTOR; + SvxBackgroundTabFlags const nFlagType = SvxBackgroundTabFlags::SHOW_TBLCTL; aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, static_cast<sal_uInt32>(nFlagType))); rPage.PageCreated(aSet); } diff --git a/sw/source/uibase/shells/tabsh.cxx b/sw/source/uibase/shells/tabsh.cxx index 993203be5690..e8d6de529462 100644 --- a/sw/source/uibase/shells/tabsh.cxx +++ b/sw/source/uibase/shells/tabsh.cxx @@ -84,6 +84,8 @@ #include <memory> +#include <svx/unobrushitemhelper.hxx> + using ::editeng::SvxBorderLine; using namespace ::com::sun::star; @@ -98,6 +100,7 @@ void SwTableShell::InitInterface_Impl() static const sal_uInt16 aUITableAttrRange[] = { + XATTR_FILL_FIRST, XATTR_FILL_LAST, FN_PARAM_TABLE_NAME, FN_PARAM_TABLE_NAME, FN_PARAM_TABLE_HEADLINE, FN_PARAM_TABLE_HEADLINE, FN_PARAM_TABLE_SPACE, FN_PARAM_TABLE_SPACE, @@ -587,6 +590,8 @@ void SwTableShell::Execute(SfxRequest &rReq) else aCoreSet.InvalidateItem( RES_BACKGROUND ); + setSvxBrushItemAsFillAttributesToTargetSet(aBrush, aCoreSet); + SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!"); |