summaryrefslogtreecommitdiff
path: root/sc/source/core
diff options
context:
space:
mode:
authorRafael Lima <rafael.palma.lima@gmail.com>2023-08-14 00:34:43 +0200
committerTomaž Vajngerl <quikee@gmail.com>2023-10-01 13:01:32 +0200
commit8938bc703980e3bdf4a32863f3e0193302a08cde (patch)
tree48ea2e72a2cf6e30e37e9667e071ba09249f09d5 /sc/source/core
parenteb68c77168db379d9d805a221a30581962040afb (diff)
tdf#154449 Add support for hidden named ranges
This patch adds the possibility of having "hidden" named ranges in Calc, in a way similar to what MS Excel has (i.e. they're not visible in the UI and can only be hidden/shown via scripting). This is done by creating a new HIDDEN flag in com.sun.star.sheet.NamedRangeFlag. Hence thia patch makes it so that named ranges can be made hidden/visible via scripting. For instance, consider a Calc document with a named range "NamedRange1". The following scripts hides "NamedRange1" from the UI (i.e. it's no longer visible in the Manage Names dialog): Sub SetHidden Dim eFlags : eFlags = com.sun.star.sheet.NamedRangeFlag aNamedRange = ThisComponent.NamedRanges.getByName("NamedRange1") nType = aNamedRange.getType() Or eFlags.HIDDEN aNamedRange.setType(nType) End Sub To make the named range visible again: Sub RemoveHidden Dim eFlags : eFlags = com.sun.star.sheet.NamedRangeFlag aNamedRange = ThisComponent.NamedRanges.getByName("NamedRange1") nType = aNamedRange.getType() nType = nType - (aNamedRange.getType() And eFlags.HIDDEN) aNamedRange.setType(nType) End Sub This patch also implements ODS and OOX import/export, as well as QA tests. Change-Id: I10efe46938fe772b87dc17fc597cb83648b5efb2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155599 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'sc/source/core')
-rw-r--r--sc/source/core/tool/rangenam.cxx1
1 files changed, 1 insertions, 0 deletions
diff --git a/sc/source/core/tool/rangenam.cxx b/sc/source/core/tool/rangenam.cxx
index b5578ca26590..051b0a5e77ac 100644
--- a/sc/source/core/tool/rangenam.cxx
+++ b/sc/source/core/tool/rangenam.cxx
@@ -529,6 +529,7 @@ sal_uInt32 ScRangeData::GetUnoType() const
if ( HasType(Type::PrintArea) ) nUnoType |= css::sheet::NamedRangeFlag::PRINT_AREA;
if ( HasType(Type::ColHeader) ) nUnoType |= css::sheet::NamedRangeFlag::COLUMN_HEADER;
if ( HasType(Type::RowHeader) ) nUnoType |= css::sheet::NamedRangeFlag::ROW_HEADER;
+ if ( HasType(Type::Hidden) ) nUnoType |= css::sheet::NamedRangeFlag::HIDDEN;
return nUnoType;
}