summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortagezi <lera.goncharuk@gmail.com>2017-12-23 00:17:22 +0200
committerMike Kaganski <mike.kaganski@collabora.com>2017-12-23 11:42:06 +0100
commite76bdaeb300e8420a8bc96e5e38b858821d22564 (patch)
tree28318ad341b704f0575b3b8b7768332de23c93b9
parentfe652ec259f7ca9e79810553ce6c884688963102 (diff)
tdf#39593 deduplicate code in ScCellShell
Change-Id: Ia2a4219a9e21cdbaeaab99df52c79dfa1ce9e184 Reviewed-on: https://gerrit.libreoffice.org/47003 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
-rw-r--r--sc/source/ui/view/cellsh1.cxx73
1 files changed, 27 insertions, 46 deletions
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index 0ee77d29ba6c..7a7ecf3da833 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -130,6 +130,30 @@ InsertDeleteFlags FlagsFromString(const OUString& rFlagsStr,
}
return nFlags;
}
+
+OUString FlagsToString( InsertDeleteFlags nFlags,
+ InsertDeleteFlags nFlagsMask = InsertDeleteFlags::CONTENTS | InsertDeleteFlags::ATTRIB )
+{
+ OUString aFlagsStr;
+
+ if( nFlags == InsertDeleteFlags::ALL )
+ {
+ aFlagsStr = "A";
+ }
+ else
+ {
+ nFlags &= nFlagsMask;
+
+ if( nFlags & InsertDeleteFlags::STRING ) aFlagsStr += "S";
+ if( nFlags & InsertDeleteFlags::VALUE ) aFlagsStr += "V";
+ if( nFlags & InsertDeleteFlags::DATETIME ) aFlagsStr += "D";
+ if( nFlags & InsertDeleteFlags::FORMULA ) aFlagsStr += "F";
+ if( nFlags & InsertDeleteFlags::NOTE ) aFlagsStr += "N";
+ if( nFlags & InsertDeleteFlags::ATTRIB ) aFlagsStr += "T";
+ if( nFlags & InsertDeleteFlags::OBJECTS ) aFlagsStr += "O";
+ }
+ return aFlagsStr;
+}
}
void ScCellShell::ExecuteEdit( SfxRequest& rReq )
@@ -404,22 +428,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
if( ! rReq.IsAPI() )
{
- OUString aFlags;
-
- if( nFlags == InsertDeleteFlags::ALL )
- {
- aFlags += "A";
- }
- else
- {
- if( nFlags & InsertDeleteFlags::STRING ) aFlags += "S";
- if( nFlags & InsertDeleteFlags::VALUE ) aFlags += "V";
- if( nFlags & InsertDeleteFlags::DATETIME ) aFlags += "D";
- if( nFlags & InsertDeleteFlags::FORMULA ) aFlags += "F";
- if( nFlags & InsertDeleteFlags::NOTE ) aFlags += "N";
- if( nFlags & InsertDeleteFlags::ATTRIB ) aFlags += "T";
- if( nFlags & InsertDeleteFlags::OBJECTS ) aFlags += "O";
- }
+ OUString aFlags = FlagsToString( nFlags, InsertDeleteFlags::ALL );
rReq.AppendItem( SfxStringItem( SID_DELETE, aFlags ) );
rReq.Done();
@@ -493,21 +502,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
if( ! rReq.IsAPI() )
{
- OUString aFlags;
-
- if( nFlags == InsertDeleteFlags::ALL )
- {
- aFlags += "A";
- }
- else
- {
- if( nFlags & InsertDeleteFlags::STRING ) aFlags += "S";
- if( nFlags & InsertDeleteFlags::VALUE ) aFlags += "V";
- if( nFlags & InsertDeleteFlags::DATETIME ) aFlags += "D";
- if( nFlags & InsertDeleteFlags::FORMULA ) aFlags += "F";
- if( nFlags & InsertDeleteFlags::NOTE ) aFlags += "N";
- if( nFlags & InsertDeleteFlags::ATTRIB ) aFlags += "T";
- }
+ OUString aFlags = FlagsToString( nFlags );
rReq.AppendItem( SfxStringItem( FID_FILL_TAB, aFlags ) );
rReq.Done();
@@ -1463,21 +1458,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
if( !pReqArgs )
{
- OUString aFlags;
-
- if( nFlags == InsertDeleteFlags::ALL )
- {
- aFlags += "A";
- }
- else
- {
- if( nFlags & InsertDeleteFlags::STRING ) aFlags += "S";
- if( nFlags & InsertDeleteFlags::VALUE ) aFlags += "V";
- if( nFlags & InsertDeleteFlags::DATETIME ) aFlags += "D";
- if( nFlags & InsertDeleteFlags::FORMULA ) aFlags += "F";
- if( nFlags & InsertDeleteFlags::NOTE ) aFlags += "N";
- if( nFlags & InsertDeleteFlags::ATTRIB ) aFlags += "T";
- }
+ OUString aFlags = FlagsToString( nFlags );
rReq.AppendItem( SfxStringItem( FID_INS_CELL_CONTENTS, aFlags ) );
rReq.AppendItem( SfxBoolItem( FN_PARAM_2, bSkipEmpty ) );