summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGulsah Kose <gulsah.1004@gmail.com>2018-01-17 19:09:13 +0300
committerGülşah Köse <gulsah.1004@gmail.com>2018-01-24 13:29:55 +0100
commit844c92793c1399e2f14f671f964ea35e1bce24ac (patch)
tree678c6e33e945e70168a123d8e8d531ccb9ddc2eb
parent2adf811370116cfb0e6280d74abdd733e078e8ff (diff)
[Pardus] tdf#108989 Add contextual validity command.
When cursor is in a cell has following validity attributes SC_VALID_WHOLE, SC_VALID_DECIMAL, SC_VALID_DATE, SC_VALID_TIME,SC_VALID_TEXTLEN, SC_VALID_LIST, SC_VALID_CUSTOM, Validity command appears on context menu. This patch is sponsored by ULAKBIM/Pardus project. Change-Id: I47c0de7b62befdf02c343c1419cf32441d8f4df2 Signed-off-by: Gulsah Kose <gulsah.1004@gmail.com> Reviewed-on: https://gerrit.libreoffice.org/48067 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Heiko Tietze <tietze.heiko@gmail.com> Tested-by: Heiko Tietze <tietze.heiko@gmail.com>
-rw-r--r--officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu5
-rw-r--r--sc/inc/document.hxx1
-rw-r--r--sc/inc/sc.hrc1
-rw-r--r--sc/sdi/cellsh.sdi1
-rw-r--r--sc/sdi/scalc.sdi18
-rw-r--r--sc/source/core/data/document.cxx12
-rw-r--r--sc/source/ui/view/cellsh.cxx6
-rw-r--r--sc/source/ui/view/cellsh2.cxx1
-rw-r--r--sc/uiconfig/scalc/popupmenu/cell.xml1
9 files changed, 45 insertions, 1 deletions
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
index ff0052e97a4f..f87cc3f47f35 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
@@ -893,6 +893,11 @@
<value xml:lang="en-US">~Validity...</value>
</prop>
</node>
+ <node oor:name=".uno:CurrentValidation" oor:op="replace">
+ <prop oor:name="Label" oor:type="xs:string">
+ <value xml:lang="en-US">Data ~Validation...</value>
+ </prop>
+ </node>
<node oor:name=".uno:DeleteRows" oor:op="replace">
<prop oor:name="Label" oor:type="xs:string">
<value xml:lang="en-US">Delete Rows</value>
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 77ad1046294a..c1c628fb451f 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -1135,6 +1135,7 @@ public:
/** Returns true, if there is any data to create a selection list for rPos. */
bool HasSelectionData( SCCOL nCol, SCROW nRow, SCTAB nTab ) const;
+ bool HasValidationData( SCCOL nCol, SCROW nRow, SCTAB nTab ) const;
/**
* Check if the specified range contains either: 1) one non-empty cell, 2)
diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc
index ee3caa1d7e7c..b20f0680711f 100644
--- a/sc/inc/sc.hrc
+++ b/sc/inc/sc.hrc
@@ -549,6 +549,7 @@
#define SID_OLE_SELECT (SID_NEW_SLOTS+50)
+#define FID_CURRENTVALIDATION (SID_NEW_SLOTS+51)
#define SID_RANGE_NOTETEXT (SID_NEW_SLOTS+52)
#define FID_INSERT_FILE (SID_NEW_SLOTS+53)
diff --git a/sc/sdi/cellsh.sdi b/sc/sdi/cellsh.sdi
index decb76cfc659..b21769d8d258 100644
--- a/sc/sdi/cellsh.sdi
+++ b/sc/sdi/cellsh.sdi
@@ -60,6 +60,7 @@ interface CellSelection
SID_SUBTOTALS [ ExecMethod = ExecuteDB; StateMethod = GetDBState; ]
SID_PIVOT_TABLE [ ExecMethod = ExecuteDB; StateMethod = GetDBState; ]
FID_VALIDATION [ ExecMethod = ExecuteDB; StateMethod = GetBlockState; ]
+ FID_CURRENTVALIDATION [ ExecMethod = ExecuteDB; StateMethod = GetState; ]
SID_TEXT_TO_COLUMNS [ ExecMethod = ExecuteDB; StateMethod = GetDBState; ]
// } database operations
diff --git a/sc/sdi/scalc.sdi b/sc/sdi/scalc.sdi
index 6db3054a7cf6..956bacaae8e3 100644
--- a/sc/sdi/scalc.sdi
+++ b/sc/sdi/scalc.sdi
@@ -5618,6 +5618,24 @@ SfxVoidItem Validation FID_VALIDATION
]
+SfxVoidItem CurrentValidation FID_CURRENTVALIDATION
+()
+[
+ AutoUpdate = FALSE,
+ FastCall = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ ToolBoxConfig = TRUE,
+ GroupId = SfxGroupId::Data;
+]
+
+
ScDoubleItem Value SID_RANGE_VALUE
[
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index f4e2d98bb41c..44bef6c0310e 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -3820,6 +3820,18 @@ bool ScDocument::HasSelectionData( SCCOL nCol, SCROW nRow, SCTAB nTab ) const
return HasStringCells( ScRange( nCol, 0, nTab, nCol, MAXROW, nTab ) );
}
+bool ScDocument::HasValidationData( SCCOL nCol, SCROW nRow, SCTAB nTab ) const
+{
+ sal_uInt32 nValidation = static_cast< const SfxUInt32Item* >( GetAttr( nCol, nRow, nTab, ATTR_VALIDDATA ) )->GetValue();
+ if( nValidation )
+ {
+ const ScValidationData* pData = GetValidationEntry( nValidation );
+ if( pData && pData->GetDataMode() != ScValidationMode::SC_VALID_ANY )
+ return true;
+ }
+ return false;
+}
+
void ScDocument::CheckVectorizationState()
{
bool bOldAutoCalc = GetAutoCalc();
diff --git a/sc/source/ui/view/cellsh.cxx b/sc/source/ui/view/cellsh.cxx
index 92b389504b99..7157d112f766 100644
--- a/sc/source/ui/view/cellsh.cxx
+++ b/sc/source/ui/view/cellsh.cxx
@@ -301,7 +301,6 @@ void ScCellShell::GetBlockState( SfxItemSet& rSet )
}
}
break;
-
case SID_TRANSLITERATE_HALFWIDTH:
case SID_TRANSLITERATE_FULLWIDTH:
case SID_TRANSLITERATE_HIRAGANA:
@@ -836,6 +835,11 @@ void ScCellShell::GetState(SfxItemSet &rSet)
rSet.DisableItem( nWhich );
break;
+ case FID_CURRENTVALIDATION:
+ if ( !pDoc->HasValidationData( nPosX, nPosY, nTab ))
+ rSet.DisableItem( nWhich );
+ break;
+
case SID_STATUS_SUM:
{
OUString aFuncStr;
diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx
index ce5fb36a4bb7..cfd3a4cbe28a 100644
--- a/sc/source/ui/view/cellsh2.cxx
+++ b/sc/source/ui/view/cellsh2.cxx
@@ -806,6 +806,7 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq )
ExecuteXMLSourceDialog();
break;
case FID_VALIDATION:
+ case FID_CURRENTVALIDATION:
{
const SfxPoolItem* pItem;
const SfxItemSet* pArgs = rReq.GetArgs();
diff --git a/sc/uiconfig/scalc/popupmenu/cell.xml b/sc/uiconfig/scalc/popupmenu/cell.xml
index 7412caf636ff..fada79e703ce 100644
--- a/sc/uiconfig/scalc/popupmenu/cell.xml
+++ b/sc/uiconfig/scalc/popupmenu/cell.xml
@@ -39,4 +39,5 @@
<menu:menuitem menu:id=".uno:HideNote"/>
<menu:menuseparator/>
<menu:menuitem menu:id=".uno:DataSelect"/>
+ <menu:menuitem menu:id=".uno:CurrentValidation"/>
</menu:menupopup>