add sidebar entry for calc database ranges

Include limit UI and functionality only

for ranges with table styles. Do not allow for simple DbRanges.

Change-Id: I0b141c4e6fefd78bfcc7b30f4aad7fdcc42eee23
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193667
Tested-by: Andras Timar <andras.timar@collabora.com>
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196735
Tested-by: Balazs Varga <balazs.varga@collabora.com>
Reviewed-by: Balazs Varga <balazs.varga@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197963
Tested-by: Jenkins
This commit is contained in:
Markus Mohrhard
2026-01-29 09:26:14 +01:00
committed by Balazs Varga
parent 2950f734c5
commit c8b155c4d4
27 changed files with 878 additions and 6 deletions
+1
View File
@@ -134,6 +134,7 @@ enum class SfxItemType : sal_uInt16
SbxItemType,
ScCondFormatItemType,
ScConsolidateItemType,
ScDatabaseSettingItemType,
ScHyphenateCellType,
ScIndentItemType,
ScInputStatusItemType,
@@ -450,6 +450,7 @@
Calc, EditCell, visible ;
Calc, Pivot, visible ;
Calc, Sparkline, visible ;
Calc, Table, visible ;
</value>
</prop>
<prop oor:name="ImplementationURL" oor:type="xs:string">
@@ -486,6 +487,7 @@
Calc, EditCell, visible ;
Calc, Pivot, visible, .uno:CellTextDlg ;
Calc, Sparkline, visible ;
Calc, Table, visible ;
DrawImpress, Draw, hidden ;
DrawImpress, DrawFontwork, hidden ;
DrawImpress, DrawText, visible ;
@@ -1476,6 +1478,7 @@
Calc, EditCell, visible ;
Calc, Pivot, visible ;
Calc, Sparkline, visible ;
Calc, Table, visible ;
</value>
</prop>
<prop oor:name="ImplementationURL" oor:type="xs:string">
@@ -1510,6 +1513,7 @@
Calc, default, visible ;
Calc, Pivot, visible ;
Calc, Sparkline, visible ;
Calc, Table, visible ;
</value>
</prop>
<prop oor:name="ImplementationURL" oor:type="xs:string">
@@ -1523,6 +1527,35 @@
</prop>
</node>
<node oor:name="ScDatabasePropertyPanel" oor:op="replace">
<prop oor:name="Title" oor:type="xs:string">
<value xml:lang="en-US">Database Range</value>
</prop>
<prop oor:name="Id" oor:type="xs:string">
<value>ScDatabasePropertyPanel</value>
</prop>
<prop oor:name="DeckId" oor:type="xs:string">
<value>PropertyDeck</value>
</prop>
<prop oor:name="DefaultMenuCommand">
<value>.uno:FormatCellDialog</value>
</prop>
<prop oor:name="ContextList">
<value oor:separator=";">
Calc, Table, visible ;
</value>
</prop>
<prop oor:name="ImplementationURL" oor:type="xs:string">
<value>private:resource/toolpanel/ScPanelFactory/DatabasePropertyPanel</value>
</prop>
<prop oor:name="OrderIndex" oor:type="xs:int">
<value>500</value>
</prop>
<prop oor:name="WantsAWT" oor:type="xs:boolean">
<value>false</value>
</prop>
</node>
<node oor:name="ScNumberFormatPropertyPanel" oor:op="replace">
<prop oor:name="Title" oor:type="xs:string">
<value xml:lang="en-US">Number Format</value>
@@ -1544,6 +1577,7 @@
Calc, default, visible ;
Calc, Pivot, visible ;
Calc, Sparkline, visible ;
Calc, Table, visible ;
</value>
</prop>
<prop oor:name="ImplementationURL" oor:type="xs:string">
+2
View File
@@ -536,6 +536,7 @@ $(eval $(call gb_Library_add_exception_objects,sc,\
sc/source/ui/sidebar/CellLineStyleControl \
sc/source/ui/sidebar/CellAppearancePropertyPanel \
sc/source/ui/sidebar/CellBorderStyleControl \
sc/source/ui/sidebar/DatabasePropertyPanel \
sc/source/ui/sidebar/NumberFormatControl \
sc/source/ui/sidebar/NumberFormatPropertyPanel \
sc/source/ui/sidebar/ScPanelFactory \
@@ -692,6 +693,7 @@ $(eval $(call gb_Library_add_exception_objects,sc,\
sc/source/ui/view/spelleng \
sc/source/ui/view/spellcheckcontext \
sc/source/ui/view/tabcont \
sc/source/ui/view/tableshell \
sc/source/ui/view/tabsplit \
sc/source/ui/view/tabview \
sc/source/ui/view/tabview2 \
+1
View File
@@ -246,6 +246,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/scalc,\
sc/uiconfig/scalc/ui/sidebaralignment \
sc/uiconfig/scalc/ui/sidebarnumberformat \
sc/uiconfig/scalc/ui/sidebarcellappearance \
sc/uiconfig/scalc/ui/sidebardatabase \
sc/uiconfig/scalc/ui/simplerefdialog \
sc/uiconfig/scalc/ui/solverdlg \
sc/uiconfig/scalc/ui/solveroptionsdialog \
+35
View File
@@ -26,6 +26,7 @@
#include "rangelst.hxx"
#include <svl/listener.hxx>
#include <svl/poolitem.hxx>
#include <memory>
#include <set>
@@ -36,6 +37,40 @@ struct ScSortParam;
struct ScQueryParam;
struct ScSubTotalParam;
class SC_DLLPUBLIC ScDatabaseSettingItem final : public SfxPoolItem
{
bool mbHeaderRow;
bool mbTotalRow;
bool mbFirstCol;
bool mbLastCol;
bool mbStripedRows;
bool mbStripedCols;
bool mbShowFilters;
public:
static SfxPoolItem* CreateDefault();
DECLARE_ITEM_TYPE_FUNCTION(ScDatabaseSettingItem)
ScDatabaseSettingItem();
ScDatabaseSettingItem(bool bHeaderRow, bool bTotalRow, bool bFirstCol, bool bLastCol, bool bStripedRows, bool bStripedCols, bool bShowFilter);
ScDatabaseSettingItem( const ScDatabaseSettingItem& rItem );
virtual ~ScDatabaseSettingItem() override;
virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
ScDatabaseSettingItem& operator=( const ScDatabaseSettingItem& rItem );
virtual bool operator==( const SfxPoolItem& ) const override;
virtual ScDatabaseSettingItem* Clone( SfxItemPool *pPool = nullptr ) const override;
bool HasHeaderRow() const;
bool HasTotalRow() const;
bool HasFirstCol() const;
bool HasLastCol() const;
bool HasStripedRows() const;
bool HasStripedCols() const;
bool HasShowFilters() const;
};
/** Enum used to indicate which portion of the DBArea is to be considered. */
enum class ScDBDataPortion
{
+3
View File
@@ -24,6 +24,9 @@
#define MID_2 2
#define MID_3 3
#define MID_4 4
#define MID_5 4
#define MID_6 4
#define MID_7 4
#endif
+1
View File
@@ -638,6 +638,7 @@ static_assert(SID_PREVIEW_END < SID_KEYFUNC_START, "calc slots ids trampling inf
#define SID_EDIT_SPARKLINE (SID_NEW_SLOTS+116)
#define SID_SC_OPT_LINKS TypedWhichId<SfxBoolItem>(SID_NEW_SLOTS + 117)
#define SID_CLEAR_AUTO_FILTER (SID_NEW_SLOTS+118)
#define SID_DATABASE_SETTINGS (SID_NEW_SLOTS+119)
// idl parameter
+3 -1
View File
@@ -74,6 +74,7 @@ class SfxUInt16Item;
class ScPageHFItem;
class ScPageScaleToItem;
class SvxSetItem;
class ScDatabaseSetting;
// Item-IDs for UI-MsgPool:
@@ -90,8 +91,9 @@ class SvxSetItem;
#define SCITEM_PIVOTDATA TypedWhichId<ScPivotItem>(1106)
#define SCITEM_SOLVEDATA TypedWhichId<ScSolveItem>(1107)
#define SCITEM_USERLIST TypedWhichId<ScUserListItem>(1108)
#define SCITEM_DATABASE_SETTING TypedWhichId<ScDatabaseSetting>(1109)
#define MSGPOOL_END 1108
#define MSGPOOL_END 1109
// Item-IDs for attributes:
+1
View File
@@ -40,5 +40,6 @@
#define SCID_PAGEBREAK_SHELL (SFX_INTERFACE_SC_START+SfxInterfaceId(16))
#define SCID_MEDIA_SHELL (SFX_INTERFACE_SC_START+SfxInterfaceId(17))
#define SCID_SPARKLINE_SHELL (SFX_INTERFACE_SC_START+SfxInterfaceId(18))
#define SCID_TABLE_SHELL (SFX_INTERFACE_SC_START+SfxInterfaceId(19))
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+17
View File
@@ -6458,6 +6458,23 @@ SfxBoolItem CellProtection SID_SCATTR_CELLPROTECTION
GroupId = SfxGroupId::Format;
]
ScDatabaseSettingItem DatabaseSettings SID_DATABASE_SETTINGS
[
AutoUpdate = FALSE,
FastCall = TRUE,
ReadOnlyDoc = FALSE,
Toggle = FALSE,
Container = FALSE,
RecordAbsolute = FALSE,
RecordPerSet;
AccelConfig = FALSE,
MenuConfig = FALSE,
ToolBoxConfig = FALSE,
GroupId = SfxGroupId::Table;
]
SfxVoidItem SelectArrayFormula SID_MARKARRAYFORMULA
()
+13
View File
@@ -21,6 +21,18 @@ module StarCalc
SlotIdFile( "scslots.hrc" )
]
{
struct ScDatabaseSetting
{
BOOL HeaderRow MID_1;
BOOL TotalRow MID_2;
BOOL FirstCol MID_3;
BOOL LastCol MID_4;
BOOL StripedRows MID_5;
BOOL StripedCols MID_6;
BOOL ShowFilters MID_7;
};
item ScDatabaseSetting ScDatabaseSettingItem;
struct ScProtection
{
BOOL Locked MID_1;
@@ -59,6 +71,7 @@ module StarCalc
include "pgbrksh.sdi"
include "mediash.sdi"
include "SparklineShell.sdi"
include "tableshell.sdi"
}
+18
View File
@@ -0,0 +1,18 @@
/*
* 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/.
*
*/
interface Table
{
SID_DATABASE_SETTINGS [ ExecMethod = ExecuteDatabaseSettings; StateMethod = GetDatabaseSettings; ]
}
shell ScTableShell
{
import Table;
}
+181
View File
@@ -42,6 +42,187 @@
#include <memory>
#include <utility>
using namespace com::sun::star;
ScDatabaseSettingItem::ScDatabaseSettingItem():
SfxPoolItem(SCITEM_DATABASE_SETTING),
mbHeaderRow(false),
mbTotalRow(false),
mbFirstCol(false),
mbLastCol(false),
mbStripedRows(false),
mbStripedCols(false),
mbShowFilters(false)
{
}
ScDatabaseSettingItem::ScDatabaseSettingItem(bool bHeaderRow, bool bTotalRow, bool bFirstCol, bool bLastCol, bool bStripedRows, bool bStripedCols, bool bShowFilters):
SfxPoolItem(SCITEM_DATABASE_SETTING),
mbHeaderRow(bHeaderRow),
mbTotalRow(bTotalRow),
mbFirstCol(bFirstCol),
mbLastCol(bLastCol),
mbStripedRows(bStripedRows),
mbStripedCols(bStripedCols),
mbShowFilters(bShowFilters)
{
}
ScDatabaseSettingItem::ScDatabaseSettingItem(const ScDatabaseSettingItem& rItem):
SfxPoolItem(SCITEM_DATABASE_SETTING),
mbHeaderRow(rItem.mbHeaderRow),
mbTotalRow(rItem.mbTotalRow),
mbFirstCol(rItem.mbFirstCol),
mbLastCol(rItem.mbLastCol),
mbStripedRows(rItem.mbStripedRows),
mbStripedCols(rItem.mbStripedCols),
mbShowFilters(rItem.mbShowFilters)
{
}
ScDatabaseSettingItem::~ScDatabaseSettingItem()
{
}
bool ScDatabaseSettingItem::QueryValue(uno::Any& rVal, sal_uInt8 nMemberId ) const
{
switch (nMemberId)
{
case 0:
rVal <<= mbHeaderRow;
break;
case 1:
rVal <<= mbTotalRow;
break;
case 2:
rVal <<= mbFirstCol;
break;
case 3:
rVal <<= mbLastCol;
break;
case 4:
rVal <<= mbStripedRows;
break;
case 5:
rVal <<= mbStripedCols;
break;
case 6:
rVal <<= mbShowFilters;
break;
default:
return false;
}
return true;
}
bool ScDatabaseSettingItem::PutValue(const uno::Any& rVal, sal_uInt8 nMemberId )
{
bool bVal = false;
bool bRet = (rVal >>= bVal);
if(!bRet)
return false;
switch (nMemberId)
{
case 0:
mbHeaderRow = bVal;
break;
case 1:
mbTotalRow = bVal;
break;
case 2:
mbFirstCol = bVal;
break;
case 3:
mbLastCol = bVal;
break;
case 4:
mbStripedRows = bVal;
break;
case 5:
mbStripedCols = bVal;
break;
case 6:
mbShowFilters = bVal;
break;
default:
return false;
}
return true;
}
ScDatabaseSettingItem* ScDatabaseSettingItem::Clone(SfxItemPool* ) const
{
return new ScDatabaseSettingItem(*this);
}
SfxPoolItem* ScDatabaseSettingItem::CreateDefault()
{
return new ScDatabaseSettingItem;
}
ScDatabaseSettingItem& ScDatabaseSettingItem::operator=(const ScDatabaseSettingItem& rItem)
{
mbHeaderRow = rItem.mbHeaderRow;
mbTotalRow = rItem.mbTotalRow;
mbFirstCol = rItem.mbFirstCol;
mbLastCol = rItem.mbLastCol;
mbStripedRows = rItem.mbStripedRows;
mbStripedCols = rItem.mbStripedCols;
mbShowFilters = rItem.mbShowFilters;
return *this;
}
bool ScDatabaseSettingItem::operator==(const SfxPoolItem& rItem) const
{
bool bSameBase = SfxPoolItem::operator==(rItem);
if (!bSameBase)
return false;
const ScDatabaseSettingItem& rDBItem = static_cast<const ScDatabaseSettingItem&>(rItem);
return mbHeaderRow == rDBItem.mbHeaderRow && mbTotalRow == rDBItem.mbTotalRow && mbFirstCol == rDBItem.mbFirstCol && mbLastCol == rDBItem.mbLastCol && mbStripedRows == rDBItem.mbStripedRows && mbStripedCols == rDBItem.mbStripedCols && mbShowFilters == rDBItem.mbShowFilters;
}
bool ScDatabaseSettingItem::HasHeaderRow() const
{
return mbHeaderRow;
}
bool ScDatabaseSettingItem::HasTotalRow() const
{
return mbTotalRow;
}
bool ScDatabaseSettingItem::HasFirstCol() const
{
return mbFirstCol;
}
bool ScDatabaseSettingItem::HasLastCol() const
{
return mbLastCol;
}
bool ScDatabaseSettingItem::HasStripedRows() const
{
return mbStripedRows;
}
bool ScDatabaseSettingItem::HasStripedCols() const
{
return mbStripedCols;
}
bool ScDatabaseSettingItem::HasShowFilters() const
{
return mbShowFilters;
}
ScTableStyleParam::ScTableStyleParam():
mbRowStripes(true),
mbColumnStripes(false),
+3 -1
View File
@@ -22,6 +22,7 @@
#include <sc.hrc>
#include <docpool.hxx>
#include <msgpool.hxx>
#include <dbdata.hxx>
static ItemInfoPackage& getItemInfoPackageScMessage()
{
@@ -38,7 +39,8 @@ static ItemInfoPackage& getItemInfoPackageScMessage()
{ SCITEM_CONSOLIDATEDATA, new ScConsolidateItem(SCITEM_CONSOLIDATEDATA, nullptr ), SID_CONSOLIDATE, SFX_ITEMINFOFLAG_NONE },
{ SCITEM_PIVOTDATA, new ScPivotItem(SCITEM_PIVOTDATA, nullptr, nullptr, false ), SID_PIVOT_TABLE, SFX_ITEMINFOFLAG_NONE },
{ SCITEM_SOLVEDATA, new ScSolveItem(SCITEM_SOLVEDATA, nullptr ), SID_SOLVE, SFX_ITEMINFOFLAG_NONE },
{ SCITEM_USERLIST, new ScUserListItem(SCITEM_USERLIST ), SID_SCUSERLISTS, SFX_ITEMINFOFLAG_NONE }
{ SCITEM_USERLIST, new ScUserListItem(SCITEM_USERLIST ), SID_SCUSERLISTS, SFX_ITEMINFOFLAG_NONE },
{ SCITEM_DATABASE_SETTING, new ScDatabaseSettingItem(), SID_DATABASE_SETTINGS, SFX_ITEMINFOFLAG_NONE }
}};
virtual const ItemInfoStatic& getItemInfoStatic(size_t nIndex) const override { return maItemInfos[nIndex]; }
+2
View File
@@ -52,6 +52,7 @@
#include <pgbrksh.hxx>
#include <scdll.hxx>
#include <SparklineShell.hxx>
#include <tableshell.hxx>
#include <appoptio.hxx>
#include <searchresults.hxx>
@@ -129,6 +130,7 @@ void ScDLL::Init()
ScEditShell ::RegisterInterface(pMod);
ScPivotShell ::RegisterInterface(pMod);
sc::SparklineShell ::RegisterInterface(pMod);
ScTableShell ::RegisterInterface(pMod);
ScAuditingShell ::RegisterInterface(pMod);
ScFormatShell ::RegisterInterface(pMod);
ScCellShell ::RegisterInterface(pMod);
+1
View File
@@ -86,6 +86,7 @@
#include <avmedia/mediaitem.hxx>
#include <sfx2/frame.hxx>
#include <attrib.hxx>
#include <dbdata.hxx>
#include <svx/sdprcitm.hxx>
#include <svx/sdmetitm.hxx>
#include <svx/pageitem.hxx>
+42
View File
@@ -0,0 +1,42 @@
/* -*- 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/.
*
*/
#pragma once
#include <sfx2/shell.hxx>
#include <shellids.hxx>
class ScTabViewShell;
class SfxModule;
class ScDBData;
class ScTableShell final : public SfxShell
{
public:
SFX_DECL_INTERFACE(SCID_TABLE_SHELL)
private:
/// SfxInterface initializer.
static void InitInterface_Impl();
const ScDBData* GetDBDataAtCursor();
public:
ScTableShell(ScTabViewShell* pView);
virtual ~ScTableShell() override;
void ExecuteDatabaseSettings(SfxRequest& rReq);
void GetDatabaseSettings(SfxItemSet& rSet);
private:
ScTabViewShell* m_pViewShell;
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+7 -1
View File
@@ -66,8 +66,11 @@ class ScNavigatorSettings;
class ScDrawTransferObj;
class ScCondFormatDlgData;
class ScDispatchProviderInterceptor;
class ScTableShell;
namespace sc { class SparklineShell; }
namespace sc {
class SparklineShell;
}
struct ScHeaderFieldData;
@@ -93,6 +96,7 @@ enum ObjectSelectionType
OST_Graphic,
OST_Media,
OST_Sparkline,
OST_Table,
};
class ScFormEditData;
@@ -128,6 +132,7 @@ private:
std::unique_ptr<ScEditShell> pEditShell;
std::unique_ptr<ScPivotShell> pPivotShell;
std::unique_ptr<sc::SparklineShell> m_pSparklineShell;
std::unique_ptr<ScTableShell> m_pTableShell;
std::unique_ptr<ScAuditingShell> pAuditingShell;
std::unique_ptr<ScDrawFormShell> pDrawFormShell;
std::unique_ptr<ScCellShell> pCellShell;
@@ -332,6 +337,7 @@ public:
void SetPivotShell( bool bActive );
void SetSparklineShell(bool bActive);
void SetTableShell(bool bActive);
void SetDialogDPObject( std::unique_ptr<ScDPObject> pObj );
const ScDPObject* GetDialogDPObject() const { return pDialogDPObject.get(); }
@@ -0,0 +1,140 @@
/* -*- 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/.
*
*/
#include "DatabasePropertyPanel.hxx"
#include <editeng/justifyitem.hxx>
#include <sc.hrc>
#include <attrib.hxx>
#include <scitems.hxx>
#include <sfx2/bindings.hxx>
#include <sfx2/dispatch.hxx>
#include <svl/intitem.hxx>
#include <svl/itemset.hxx>
#include <svx/rotmodit.hxx>
#include <svtools/unitconv.hxx>
#include <com/sun/star/lang/IllegalArgumentException.hpp>
#include <dbdata.hxx>
using namespace css;
using namespace css::uno;
// namespace open
namespace sc::sidebar
{
ScDatabasePropertyPanel::ScDatabasePropertyPanel(weld::Widget* pParent,
const css::uno::Reference<css::frame::XFrame>&,
SfxBindings* pBindings)
: PanelLayout(pParent, u"DatabasePropertyPanel"_ustr,
u"modules/scalc/ui/sidebardatabase.ui"_ustr)
, m_xChkHeaderRow(m_xBuilder->weld_check_button(u"chk_header_row"_ustr))
, m_xChkTotalRow(m_xBuilder->weld_check_button(u"chk_total_row"_ustr))
, m_xChkFilterButtons(m_xBuilder->weld_check_button(u"chk_filter_buttons"_ustr))
, m_xChkBandedRows(m_xBuilder->weld_check_button(u"chk_banded_rows"_ustr))
, m_xChkBandedColumns(m_xBuilder->weld_check_button(u"chk_banded_cols"_ustr))
, m_xChkFirstColumn(m_xBuilder->weld_check_button(u"chk_first_column"_ustr))
, m_xChkLastColumn(m_xBuilder->weld_check_button(u"chk_last_column"_ustr))
, maHeaderRowCtrl(SID_DATABASE_SETTINGS, *pBindings, *this)
, mpBindings(pBindings)
{
Initialize();
}
ScDatabasePropertyPanel::~ScDatabasePropertyPanel()
{
m_xChkHeaderRow.reset();
m_xChkTotalRow.reset();
m_xChkFilterButtons.reset();
m_xChkBandedRows.reset();
m_xChkBandedColumns.reset();
m_xChkFirstColumn.reset();
m_xChkLastColumn.reset();
maHeaderRowCtrl.dispose();
}
void ScDatabasePropertyPanel::Initialize()
{
m_xChkHeaderRow->connect_toggled(LINK(this, ScDatabasePropertyPanel, EntryChanged));
m_xChkTotalRow->connect_toggled(LINK(this, ScDatabasePropertyPanel, EntryChanged));
m_xChkFilterButtons->connect_toggled(LINK(this, ScDatabasePropertyPanel, EntryChanged));
m_xChkBandedRows->connect_toggled(LINK(this, ScDatabasePropertyPanel, EntryChanged));
m_xChkBandedColumns->connect_toggled(LINK(this, ScDatabasePropertyPanel, EntryChanged));
m_xChkFirstColumn->connect_toggled(LINK(this, ScDatabasePropertyPanel, EntryChanged));
m_xChkLastColumn->connect_toggled(LINK(this, ScDatabasePropertyPanel, EntryChanged));
}
std::unique_ptr<PanelLayout>
ScDatabasePropertyPanel::Create(weld::Widget* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
SfxBindings* pBindings)
{
if (pParent == nullptr)
throw lang::IllegalArgumentException(
u"no parent Window given to ScDatabasePropertyPanel::Create"_ustr, nullptr, 0);
if (!rxFrame.is())
throw lang::IllegalArgumentException(
u"no XFrame given to ScDatabasePropertyPanel::Create"_ustr, nullptr, 1);
if (pBindings == nullptr)
throw lang::IllegalArgumentException(
u"no SfxBindings given to ScDatabasePropertyPanel::Create"_ustr, nullptr, 2);
return std::make_unique<ScDatabasePropertyPanel>(pParent, rxFrame, pBindings);
}
void ScDatabasePropertyPanel::HandleContextChange(const vcl::EnumContext& rContext)
{
if (maContext == rContext)
{
// Nothing to do.
return;
}
maContext = rContext;
}
void ScDatabasePropertyPanel::NotifyItemUpdate(sal_uInt16 nSID, SfxItemState eState,
const SfxPoolItem* pState)
{
switch (nSID)
{
case SID_DATABASE_SETTINGS:
if (eState >= SfxItemState::DEFAULT
&& dynamic_cast<const ScDatabaseSettingItem*>(pState))
{
const ScDatabaseSettingItem* pItem
= static_cast<const ScDatabaseSettingItem*>(pState);
m_xChkHeaderRow->set_active(pItem->HasHeaderRow());
m_xChkTotalRow->set_active(pItem->HasTotalRow());
m_xChkFirstColumn->set_active(pItem->HasFirstCol());
m_xChkLastColumn->set_active(pItem->HasLastCol());
m_xChkBandedRows->set_active(pItem->HasStripedRows());
m_xChkBandedColumns->set_active(pItem->HasStripedCols());
m_xChkFilterButtons->set_active(pItem->HasShowFilters());
}
break;
}
}
IMPL_LINK_NOARG(ScDatabasePropertyPanel, EntryChanged, weld::Toggleable&, void)
{
ScDatabaseSettingItem aItem(m_xChkHeaderRow->get_active(), m_xChkTotalRow->get_active(),
m_xChkFirstColumn->get_active(), m_xChkLastColumn->get_active(),
m_xChkBandedRows->get_active(), m_xChkBandedColumns->get_active(),
m_xChkFilterButtons->get_active());
GetBindings()->GetDispatcher()->ExecuteList(SID_DATABASE_SETTINGS, SfxCallMode::RECORD,
{ &aItem });
}
// namespace close
} // end of namespace ::sc::sidebar
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
@@ -0,0 +1,67 @@
/* -*- 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/.
*
*/
#pragma once
#include <sfx2/sidebar/ControllerItem.hxx>
#include <sfx2/sidebar/IContextChangeReceiver.hxx>
#include <sfx2/weldutils.hxx>
#include <sfx2/sidebar/PanelLayout.hxx>
#include <vcl/EnumContext.hxx>
namespace sc::sidebar
{
class ScDatabasePropertyPanel : public PanelLayout,
public ::sfx2::sidebar::IContextChangeReceiver,
public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
{
public:
static std::unique_ptr<PanelLayout>
Create(weld::Widget* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame,
SfxBindings* pBindings);
virtual void HandleContextChange(const vcl::EnumContext& rContext) override;
virtual void NotifyItemUpdate(const sal_uInt16 nSId, const SfxItemState eState,
const SfxPoolItem* pState) override;
virtual void GetControlState(const sal_uInt16 /*nSId*/,
boost::property_tree::ptree& /*rState*/) override{};
SfxBindings* GetBindings() { return mpBindings; }
// constructor/destructor
ScDatabasePropertyPanel(weld::Widget* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
SfxBindings* pBindings);
virtual ~ScDatabasePropertyPanel() override;
private:
//ui controls
std::unique_ptr<weld::CheckButton> m_xChkHeaderRow;
std::unique_ptr<weld::CheckButton> m_xChkTotalRow;
std::unique_ptr<weld::CheckButton> m_xChkFilterButtons;
std::unique_ptr<weld::CheckButton> m_xChkBandedRows;
std::unique_ptr<weld::CheckButton> m_xChkBandedColumns;
std::unique_ptr<weld::CheckButton> m_xChkFirstColumn;
std::unique_ptr<weld::CheckButton> m_xChkLastColumn;
::sfx2::sidebar::ControllerItem maHeaderRowCtrl;
DECL_LINK(EntryChanged, weld::Toggleable&, void);
vcl::EnumContext maContext;
SfxBindings* mpBindings;
void Initialize();
};
} // end of namespace ::sc::sidebar
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+6
View File
@@ -22,6 +22,7 @@
#include "AlignmentPropertyPanel.hxx"
#include "CellAppearancePropertyPanel.hxx"
#include "NumberFormatPropertyPanel.hxx"
#include "DatabasePropertyPanel.hxx"
#include <navipi.hxx>
#include <dwfunctr.hxx>
@@ -94,6 +95,11 @@ Reference<ui::XUIElement> SAL_CALL ScPanelFactory::createUIElement (
xPanel = std::make_unique<ScFunctionWin>(pParent, pBindings);
nMinimumSize = 0;
}
else if (rsResourceURL.endsWith("/DatabasePropertyPanel"))
{
xPanel = ScDatabasePropertyPanel::Create( pParent, xFrame, pBindings );
nMinimumSize = 0;
}
if (xPanel)
xElement = sfx2::sidebar::SidebarPanelBase::Create(
+3 -1
View File
@@ -6999,7 +6999,9 @@ void ScGridWindow::UpdateDatabaseOverlay()
ScAddress aCurrentAddress = mrViewData.GetCurPos();
std::vector<basegfx::B2DRange> aRanges;
ScRange aCurrRange;
if (ScDBData* pDBData = rDocument.GetDBAtCursor(aCurrentAddress.Col(), aCurrentAddress.Row(), aCurrentAddress.Tab(), ScDBDataPortion::AREA))
ScDBData* pDBData = rDocument.GetDBAtCursor(aCurrentAddress.Col(), aCurrentAddress.Row(),
aCurrentAddress.Tab(), ScDBDataPortion::AREA);
if (pDBData && pDBData->GetTableStyleInfo())
{
pDBData->GetArea(aCurrRange);
Point aStart = mrViewData.GetScrPos(aCurrRange.aStart.Col(),
+128
View File
@@ -0,0 +1,128 @@
/* -*- 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/.
*
*/
#include <scitems.hxx>
#include <sfx2/objface.hxx>
#include <sfx2/objsh.hxx>
#include <sfx2/bindings.hxx>
#include <sfx2/request.hxx>
#include <svl/whiter.hxx>
#include <vcl/EnumContext.hxx>
#include <sc.hrc>
#include <tableshell.hxx>
#include <tabvwsh.hxx>
#include <docsh.hxx>
#include <document.hxx>
#include <dbdata.hxx>
#include <dbdocfun.hxx>
#define ShellClass_ScTableShell
#include <scslots.hxx>
SFX_IMPL_INTERFACE(ScTableShell, SfxShell)
void ScTableShell::InitInterface_Impl() {}
ScTableShell::ScTableShell(ScTabViewShell* pViewShell)
: SfxShell(pViewShell)
, m_pViewShell(pViewShell)
{
SetPool(&m_pViewShell->GetPool());
ScViewData& rViewData = m_pViewShell->GetViewData();
SfxUndoManager* pUndoManager = rViewData.GetSfxDocShell()->GetUndoManager();
SetUndoManager(pUndoManager);
if (!rViewData.GetDocument().IsUndoEnabled())
{
pUndoManager->SetMaxUndoActionCount(0);
}
SetName("Table");
SfxShell::SetContextName(vcl::EnumContext::GetContextName(vcl::EnumContext::Context::Table));
}
ScTableShell::~ScTableShell() = default;
const ScDBData* ScTableShell::GetDBDataAtCursor()
{
ScViewData& rViewData = m_pViewShell->GetViewData();
const ScAddress aAddr = rViewData.GetCurPos();
return rViewData.GetDocument().GetDBAtCursor(aAddr.Col(), aAddr.Row(), aAddr.Tab(),
ScDBDataPortion::AREA);
}
void ScTableShell::ExecuteDatabaseSettings(SfxRequest& rReq)
{
const SfxItemSet* pSet = rReq.GetArgs();
sal_uInt16 nSlot = rReq.GetSlot();
ScViewData& rViewData = m_pViewShell->GetViewData();
SfxBindings& rBindings = rViewData.GetBindings();
switch (nSlot)
{
case SID_DATABASE_SETTINGS:
{
const SfxPoolItem* pItem;
SfxItemState eItemState = pSet->GetItemState(SCITEM_DATABASE_SETTING, true, &pItem);
if (eItemState == SfxItemState::SET
&& dynamic_cast<const ScDatabaseSettingItem*>(pItem))
{
const ScDatabaseSettingItem* pDBItem
= static_cast<const ScDatabaseSettingItem*>(pItem);
const ScDBData* pDBData = GetDBDataAtCursor();
if (pDBData && pDBData->GetTableStyleInfo())
{
ScDBData aNewDBData(*pDBData);
aNewDBData.SetAutoFilter(pDBItem->HasShowFilters());
aNewDBData.SetHeader(pDBItem->HasHeaderRow());
aNewDBData.SetTotals(pDBItem->HasTotalRow());
ScTableStyleParam aNewParam(*pDBData->GetTableStyleInfo());
aNewParam.mbRowStripes = pDBItem->HasStripedRows();
aNewParam.mbColumnStripes = pDBItem->HasStripedCols();
aNewParam.mbFirstColumn = pDBItem->HasFirstCol();
aNewParam.mbLastColumn = pDBItem->HasLastCol();
aNewDBData.SetTableStyleInfo(aNewParam);
ScDBDocFunc aFunc(*rViewData.GetDocShell());
aFunc.ModifyDBData(aNewDBData);
}
}
break;
}
}
rBindings.Invalidate(SID_DATABASE_SETTINGS);
}
void ScTableShell::GetDatabaseSettings(SfxItemSet& rSet)
{
SfxWhichIter aIter(rSet);
sal_uInt16 nWhich = aIter.FirstWhich();
while (nWhich)
{
switch (nWhich)
{
case SCITEM_DATABASE_SETTING:
const ScDBData* pDBData = GetDBDataAtCursor();
if (pDBData)
{
const ScTableStyleParam* pParam = pDBData->GetTableStyleInfo();
rSet.Put(ScDatabaseSettingItem(pDBData->HasHeader(), pDBData->HasTotals(),
pParam->mbFirstColumn, pParam->mbLastColumn,
pParam->mbRowStripes, pParam->mbColumnStripes,
pDBData->HasAutoFilter()));
}
break;
}
nWhich = aIter.NextWhich();
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+8 -1
View File
@@ -674,8 +674,15 @@ void ScTabView::CursorPosChanged()
if (!bDataPilot)
{
bool bSparkline = rDocument.HasSparkline(aViewData.GetCurPos());
const ScAddress rAddr = aViewData.GetCurPos();
bool bSparkline = rDocument.HasSparkline(rAddr);
aViewData.GetViewShell()->SetSparklineShell(bSparkline);
if (!bSparkline)
{
const ScDBData* pDbData = rDocument.GetDBAtCursor(rAddr.Col(), rAddr.Row(), rAddr.Tab(), ScDBDataPortion::AREA);
bool bHasDBTableStyle = pDbData && pDbData->GetTableStyleInfo();
aViewData.GetViewShell()->SetTableShell(bHasDBTableStyle);
}
}
// UpdateInputHandler now in CellContentChanged
+36 -1
View File
@@ -47,6 +47,7 @@
#include <editsh.hxx>
#include <pivotsh.hxx>
#include <SparklineShell.hxx>
#include <tableshell.hxx>
#include <auditsh.hxx>
#include <drtxtob.hxx>
#include <inputhdl.hxx>
@@ -717,6 +718,25 @@ void ScTabViewShell::SetSparklineShell(bool bActive)
SetCurSubShell(OST_Cell);
}
void ScTabViewShell::SetTableShell(bool bActive)
{
if (eCurOST != OST_Table && eCurOST != OST_Cell)
return;
if (bActive)
{
bActiveDrawTextSh = bActiveDrawSh = false;
bActiveDrawFormSh=false;
bActiveGraphicSh=false;
bActiveMediaSh=false;
bActiveOleObjectSh=false;
bActiveChartSh=false;
SetCurSubShell(OST_Table);
}
else
SetCurSubShell(OST_Cell);
}
void ScTabViewShell::SetAuditShell( bool bActive )
{
if ( bActive )
@@ -990,6 +1010,20 @@ void ScTabViewShell::SetCurSubShell(ObjectSelectionType eOST, bool bForce)
bCellBrush = true;
}
break;
case OST_Table:
{
AddSubShell(*pCellShell);
if(bPgBrk) AddSubShell(*pPageBreakShell);
if (!m_pTableShell)
{
m_pTableShell.reset(new ScTableShell(this));
m_pTableShell->SetRepeatTarget(&aTarget);
}
AddSubShell(*m_pTableShell);
bCellBrush = true;
}
break;
default:
OSL_FAIL("wrong shell requested");
break;
@@ -1038,7 +1072,7 @@ SfxShell* ScTabViewShell::GetMySubShell() const
pSub == pPivotShell.get() || pSub == pAuditingShell.get() || pSub == pDrawFormShell.get() ||
pSub == pCellShell.get() || pSub == pOleObjectShell.get() || pSub == pChartShell.get() ||
pSub == pGraphicShell.get() || pSub == pMediaShell.get() || pSub == pPageBreakShell.get() ||
pSub == m_pSparklineShell.get())
pSub == m_pSparklineShell.get() || pSub == m_pTableShell.get())
{
return pSub; // found
}
@@ -2206,6 +2240,7 @@ ScTabViewShell::~ScTabViewShell()
pEditShell.reset();
pPivotShell.reset();
m_pSparklineShell.reset();
m_pTableShell.reset();
pAuditingShell.reset();
pCurFrameLine.reset();
mpFormEditData.reset();
+124
View File
@@ -0,0 +1,124 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.40.0 -->
<interface domain="sc">
<requires lib="gtk+" version="3.20"/>
<!-- n-columns=2 n-rows=5 -->
<object class="GtkGrid" id="DatabasePropertyPanel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="GtkCheckButton" id="chk_header_row">
<property name="label" translatable="yes" context="sidebardatabase|show_header_row_checkbox">Show Header Row</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="draw-indicator">True</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="chk_first_column">
<property name="label" translatable="yes" context="sidebardatabase|first_column_formatting_checkbox">First Column</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="draw-indicator">True</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">4</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="chk_last_column">
<property name="label" translatable="yes" context="sidebardatabase|last_column_formatting_checkbox">Last Column</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="draw-indicator">True</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">4</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="chk_banded_cols">
<property name="label" translatable="yes" context="sidebardatabase|banded_columns_formatting_checkbox">Banded Columns</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="draw-indicator">True</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">3</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="chk_banded_rows">
<property name="label" translatable="yes" context="sidebardatabase|banded_rows_formatting_checkbox">Banded Rows</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="draw-indicator">True</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">3</property>
</packing>
</child>
<child>
<object class="GtkSeparator">
<property name="visible">True</property>
<property name="can-focus">False</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkSeparator">
<property name="visible">True</property>
<property name="can-focus">False</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="chk_filter_buttons">
<property name="label" translatable="yes" context="sidebardatabase|show_filter_buttons_checkbox">Show Filter Buttons</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="draw-indicator">True</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="chk_total_row">
<property name="label" translatable="yes" context="sidebardatabase|show_total_row_checkbox">Show Total Row</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="draw-indicator">True</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
</interface>
@@ -125,6 +125,7 @@ void ParaPropertyPanel::HandleContextChange (
case CombinedEnumContext(Application::Calc, Context::Cell):
case CombinedEnumContext(Application::Calc, Context::Pivot):
case CombinedEnumContext(Application::Calc, Context::Sparkline):
case CombinedEnumContext(Application::Calc, Context::Table):
case CombinedEnumContext(Application::DrawImpress, Context::Text):
case CombinedEnumContext(Application::DrawImpress, Context::OutlineText):
set_hyphenation_base_visible(false);