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>
This commit is contained in:
committed by
Samuel Mehrbrodt
parent
b9d709e847
commit
41f1a38b9e
@@ -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 :
|
||||
|
@@ -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
|
||||
|
||||
|
||||
|
@@ -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;
|
||||
|
@@ -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: */
|
||||
|
@@ -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 -->
|
||||
@@ -24,6 +24,22 @@
|
||||
<property name="hexpand">True</property>
|
||||
<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>
|
||||
@@ -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,20 +76,7 @@
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<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>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">5</property>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@@ -86,7 +89,7 @@
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">3</property>
|
||||
<property name="position">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@@ -99,7 +102,20 @@
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">4</property>
|
||||
<property name="position">5</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<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>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">6</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
|
@@ -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)
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -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!");
|
||||
|
||||
|
Reference in New Issue
Block a user