From 8938bc703980e3bdf4a32863f3e0193302a08cde Mon Sep 17 00:00:00 2001 From: Rafael Lima Date: Mon, 14 Aug 2023 00:34:43 +0200 Subject: tdf#154449 Add support for hidden named ranges MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- offapi/com/sun/star/sheet/NamedRangeFlag.idl | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'offapi') diff --git a/offapi/com/sun/star/sheet/NamedRangeFlag.idl b/offapi/com/sun/star/sheet/NamedRangeFlag.idl index 3c42431cb992..5addc08ad561 100644 --- a/offapi/com/sun/star/sheet/NamedRangeFlag.idl +++ b/offapi/com/sun/star/sheet/NamedRangeFlag.idl @@ -45,6 +45,13 @@ published constants NamedRangeFlag */ const long ROW_HEADER = 8; + + /** The range is hidden from the user interface + + @since LibreOffice 24.2 + */ + const long HIDDEN = 16; + }; -- cgit v1.2.3