summaryrefslogtreecommitdiff
path: root/cui
diff options
context:
space:
mode:
authorJim Raykowski <raykowj@gmail.com>2018-01-28 09:20:06 -0900
committerSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2018-04-09 09:14:07 +0200
commit41f1a38b9e8b5e0567bf642d3e14a549e82ee0d9 (patch)
treec0210ebfb55bb70ce139e5134db89ba5edf82910 /cui
parentb9d709e84728270acb00c3952551f5c608260e62 (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>
Diffstat (limited to 'cui')
-rw-r--r--cui/source/factory/dlgfact.cxx2
-rw-r--r--cui/source/inc/backgrnd.hxx18
-rw-r--r--cui/source/inc/cuitabarea.hxx3
-rw-r--r--cui/source/tabpages/backgrnd.cxx130
-rw-r--r--cui/uiconfig/ui/areatabpage.ui42
5 files changed, 181 insertions, 14 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>