Blame SOURCES/0061-fdo-70499-selectn-of-lock-unlocked-cells-with-worksh.patch

f0633d
From ed0f9df37cac6c2e8d886488b2dbbe1034e0d385 Mon Sep 17 00:00:00 2001
f0633d
From: Noel Power <noel.power@suse.com>
f0633d
Date: Thu, 21 Nov 2013 18:12:50 +0000
f0633d
Subject: [PATCH 061/109] fdo#70499 selectn of lock/unlocked cells with
f0633d
 worksheet protection reversed
f0633d
f0633d
The ooxml spec documentation is rather confusing ( for me at least ) and the
f0633d
sense of the of the sheetProtection attributes as described seems reversed to
f0633d
how I read it ( or maybe it is the equivelant option in ScTableProtection that
f0633d
operates with the reverse sense <shrug>  ) In anycase the import ( and export )
f0633d
have been adjusted to take that into consideration, also the export now actually
f0633d
deals with the defaults correctly.
f0633d
f0633d
Change-Id: Ia69567b8898b39c9d171486cfa800e1748c5814b
f0633d
Reviewed-on: https://gerrit.libreoffice.org/7075
f0633d
Reviewed-by: Kohei Yoshida <libreoffice@kohei.us>
f0633d
Tested-by: Kohei Yoshida <libreoffice@kohei.us>
f0633d
---
f0633d
 sc/qa/unit/subsequent_export-test.cxx      |  4 ++--
f0633d
 sc/source/filter/excel/excrecds.cxx        | 30 +++++++++++++++---------------
f0633d
 sc/source/filter/oox/worksheetsettings.cxx | 30 +++++++++++++++---------------
f0633d
 3 files changed, 32 insertions(+), 32 deletions(-)
f0633d
f0633d
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
f0633d
index 9a06e9a..f7b5141 100644
f0633d
--- a/sc/qa/unit/subsequent_export-test.cxx
f0633d
+++ b/sc/qa/unit/subsequent_export-test.cxx
f0633d
@@ -347,8 +347,8 @@ void ScExportTest::testSheetProtectionXLSX()
f0633d
             CPPUNIT_ASSERT( (sal_uInt8)aHash[1] == 61 );
f0633d
         }
f0633d
         // we could flesh out this check I guess
f0633d
-        CPPUNIT_ASSERT ( pTabProtect->isOptionEnabled( ScTableProtection::OBJECTS ) );
f0633d
-        CPPUNIT_ASSERT ( pTabProtect->isOptionEnabled( ScTableProtection::SCENARIOS ) );
f0633d
+        CPPUNIT_ASSERT ( !pTabProtect->isOptionEnabled( ScTableProtection::OBJECTS ) );
f0633d
+        CPPUNIT_ASSERT ( !pTabProtect->isOptionEnabled( ScTableProtection::SCENARIOS ) );
f0633d
     }
f0633d
     xDocSh->DoClose();
f0633d
 }
f0633d
diff --git a/sc/source/filter/excel/excrecds.cxx b/sc/source/filter/excel/excrecds.cxx
f0633d
index 39e4222..4330fe0 100644
f0633d
--- a/sc/source/filter/excel/excrecds.cxx
f0633d
+++ b/sc/source/filter/excel/excrecds.cxx
f0633d
@@ -520,21 +520,21 @@ void XclExpSheetProtection::SaveXml( XclExpXmlStream& rStrm )
f0633d
         rWorksheet->singleElement( XML_sheetProtection,
f0633d
             XML_sheet,  XclXmlUtils::ToPsz( true ),
f0633d
             XML_password, sHash.getStr(),
f0633d
-            XML_objects, pTabProtect->isOptionEnabled( ScTableProtection::OBJECTS ) ? XclXmlUtils::ToPsz( true ) : NULL,
f0633d
-            XML_scenarios, pTabProtect->isOptionEnabled( ScTableProtection::SCENARIOS ) ? XclXmlUtils::ToPsz( true ) : NULL,
f0633d
-            XML_formatCells, pTabProtect->isOptionEnabled( ScTableProtection::FORMAT_CELLS ) ? NULL : XclXmlUtils::ToPsz( true ),
f0633d
-            XML_formatColumns, pTabProtect->isOptionEnabled( ScTableProtection::FORMAT_COLUMNS ) ? NULL : XclXmlUtils::ToPsz( true ),
f0633d
-            XML_formatRows, pTabProtect->isOptionEnabled( ScTableProtection::FORMAT_ROWS ) ? NULL : XclXmlUtils::ToPsz( true ),
f0633d
-            XML_insertColumns, pTabProtect->isOptionEnabled( ScTableProtection::INSERT_COLUMNS ) ? NULL : XclXmlUtils::ToPsz( true ),
f0633d
-            XML_insertRows, pTabProtect->isOptionEnabled( ScTableProtection::INSERT_ROWS ) ? NULL : XclXmlUtils::ToPsz( true ),
f0633d
-            XML_insertHyperlinks, pTabProtect->isOptionEnabled( ScTableProtection::INSERT_HYPERLINKS ) ? NULL : XclXmlUtils::ToPsz( true ),
f0633d
-            XML_deleteColumns, pTabProtect->isOptionEnabled( ScTableProtection::DELETE_COLUMNS ) ? NULL : XclXmlUtils::ToPsz( true ),
f0633d
-            XML_deleteRows, pTabProtect->isOptionEnabled( ScTableProtection::DELETE_ROWS ) ? NULL : XclXmlUtils::ToPsz( true ),
f0633d
-            XML_selectLockedCells, pTabProtect->isOptionEnabled( ScTableProtection::SELECT_LOCKED_CELLS ) ? XclXmlUtils::ToPsz( true ) : NULL,
f0633d
-            XML_sort, pTabProtect->isOptionEnabled( ScTableProtection::SORT ) ? NULL : XclXmlUtils::ToPsz( true ),
f0633d
-            XML_autoFilter, pTabProtect->isOptionEnabled( ScTableProtection::AUTOFILTER ) ? NULL : XclXmlUtils::ToPsz( true ),
f0633d
-            XML_pivotTables, pTabProtect->isOptionEnabled( ScTableProtection::PIVOT_TABLES ) ? NULL : XclXmlUtils::ToPsz( true ),
f0633d
-            XML_selectUnlockedCells, pTabProtect->isOptionEnabled( ScTableProtection::SELECT_UNLOCKED_CELLS ) ? XclXmlUtils::ToPsz( true ) : NULL,
f0633d
+            XML_objects, pTabProtect->isOptionEnabled( ScTableProtection::OBJECTS ) ? NULL : XclXmlUtils::ToPsz( true ),
f0633d
+            XML_scenarios, pTabProtect->isOptionEnabled( ScTableProtection::SCENARIOS ) ? NULL : XclXmlUtils::ToPsz( true ),
f0633d
+            XML_formatCells, pTabProtect->isOptionEnabled( ScTableProtection::FORMAT_CELLS ) ? XclXmlUtils::ToPsz( false ) : NULL,
f0633d
+            XML_formatColumns, pTabProtect->isOptionEnabled( ScTableProtection::FORMAT_COLUMNS ) ? XclXmlUtils::ToPsz( false ) : NULL,
f0633d
+            XML_formatRows, pTabProtect->isOptionEnabled( ScTableProtection::FORMAT_ROWS ) ? XclXmlUtils::ToPsz( false ) : NULL,
f0633d
+            XML_insertColumns, pTabProtect->isOptionEnabled( ScTableProtection::INSERT_COLUMNS ) ? XclXmlUtils::ToPsz( false ) : NULL,
f0633d
+            XML_insertRows, pTabProtect->isOptionEnabled( ScTableProtection::INSERT_ROWS ) ? XclXmlUtils::ToPsz( false ) : NULL,
f0633d
+            XML_insertHyperlinks, pTabProtect->isOptionEnabled( ScTableProtection::INSERT_HYPERLINKS ) ? XclXmlUtils::ToPsz( false ) : NULL,
f0633d
+            XML_deleteColumns, pTabProtect->isOptionEnabled( ScTableProtection::DELETE_COLUMNS ) ? XclXmlUtils::ToPsz( false ) : NULL,
f0633d
+            XML_deleteRows, pTabProtect->isOptionEnabled( ScTableProtection::DELETE_ROWS ) ? XclXmlUtils::ToPsz( false ) : NULL,
f0633d
+            XML_selectLockedCells, pTabProtect->isOptionEnabled( ScTableProtection::SELECT_LOCKED_CELLS ) ? NULL : XclXmlUtils::ToPsz( true ),
f0633d
+            XML_sort, pTabProtect->isOptionEnabled( ScTableProtection::SORT ) ? XclXmlUtils::ToPsz( false ) : NULL,
f0633d
+            XML_autoFilter, pTabProtect->isOptionEnabled( ScTableProtection::AUTOFILTER ) ? XclXmlUtils::ToPsz( false ) : NULL,
f0633d
+            XML_pivotTables, pTabProtect->isOptionEnabled( ScTableProtection::PIVOT_TABLES ) ? XclXmlUtils::ToPsz( false ) : NULL,
f0633d
+            XML_selectUnlockedCells, pTabProtect->isOptionEnabled( ScTableProtection::SELECT_UNLOCKED_CELLS ) ? NULL : XclXmlUtils::ToPsz( true ),
f0633d
             FSEND );
f0633d
     }
f0633d
 }
f0633d
diff --git a/sc/source/filter/oox/worksheetsettings.cxx b/sc/source/filter/oox/worksheetsettings.cxx
f0633d
index 96ca193..aa13f9c 100644
f0633d
--- a/sc/source/filter/oox/worksheetsettings.cxx
f0633d
+++ b/sc/source/filter/oox/worksheetsettings.cxx
f0633d
@@ -244,21 +244,21 @@ void WorksheetSettings::finalizeImport()
f0633d
             aPass[1] = maSheetProt.mnPasswordHash & 0xFF;
f0633d
             aProtect.setPasswordHash(aPass, PASSHASH_XL);
f0633d
         }
f0633d
-        aProtect.setOption( ScTableProtection::OBJECTS, maSheetProt.mbObjects);
f0633d
-        aProtect.setOption( ScTableProtection::SCENARIOS, maSheetProt.mbScenarios );
f0633d
-        aProtect.setOption( ScTableProtection::FORMAT_CELLS, maSheetProt.mbFormatCells );
f0633d
-        aProtect.setOption( ScTableProtection::FORMAT_COLUMNS, maSheetProt.mbFormatColumns );
f0633d
-        aProtect.setOption( ScTableProtection::FORMAT_ROWS, maSheetProt.mbFormatRows );
f0633d
-        aProtect.setOption( ScTableProtection::INSERT_COLUMNS, maSheetProt.mbInsertColumns );
f0633d
-        aProtect.setOption( ScTableProtection::INSERT_ROWS,  maSheetProt.mbInsertRows );
f0633d
-        aProtect.setOption( ScTableProtection::INSERT_HYPERLINKS, maSheetProt.mbInsertHyperlinks );
f0633d
-        aProtect.setOption( ScTableProtection::DELETE_COLUMNS, maSheetProt.mbDeleteColumns );
f0633d
-        aProtect.setOption( ScTableProtection::DELETE_ROWS,maSheetProt.mbDeleteRows );
f0633d
-        aProtect.setOption( ScTableProtection::SELECT_LOCKED_CELLS, maSheetProt.mbSelectLocked );
f0633d
-        aProtect.setOption( ScTableProtection::SORT, maSheetProt.mbSort );
f0633d
-        aProtect.setOption( ScTableProtection::AUTOFILTER, maSheetProt.mbAutoFilter );
f0633d
-        aProtect.setOption( ScTableProtection::PIVOT_TABLES, maSheetProt.mbPivotTables );
f0633d
-        aProtect.setOption( ScTableProtection::SELECT_UNLOCKED_CELLS, maSheetProt.mbSelectUnlocked );
f0633d
+        aProtect.setOption( ScTableProtection::OBJECTS, !maSheetProt.mbObjects);
f0633d
+        aProtect.setOption( ScTableProtection::SCENARIOS, !maSheetProt.mbScenarios );
f0633d
+        aProtect.setOption( ScTableProtection::FORMAT_CELLS, !maSheetProt.mbFormatCells );
f0633d
+        aProtect.setOption( ScTableProtection::FORMAT_COLUMNS, !maSheetProt.mbFormatColumns );
f0633d
+        aProtect.setOption( ScTableProtection::FORMAT_ROWS, !maSheetProt.mbFormatRows );
f0633d
+        aProtect.setOption( ScTableProtection::INSERT_COLUMNS, !maSheetProt.mbInsertColumns );
f0633d
+        aProtect.setOption( ScTableProtection::INSERT_ROWS,  !maSheetProt.mbInsertRows );
f0633d
+        aProtect.setOption( ScTableProtection::INSERT_HYPERLINKS, !maSheetProt.mbInsertHyperlinks );
f0633d
+        aProtect.setOption( ScTableProtection::DELETE_COLUMNS, !maSheetProt.mbDeleteColumns );
f0633d
+        aProtect.setOption( ScTableProtection::DELETE_ROWS,!maSheetProt.mbDeleteRows );
f0633d
+        aProtect.setOption( ScTableProtection::SELECT_LOCKED_CELLS, !maSheetProt.mbSelectLocked );
f0633d
+        aProtect.setOption( ScTableProtection::SORT, !maSheetProt.mbSort );
f0633d
+        aProtect.setOption( ScTableProtection::AUTOFILTER, !maSheetProt.mbAutoFilter );
f0633d
+        aProtect.setOption( ScTableProtection::PIVOT_TABLES, !maSheetProt.mbPivotTables );
f0633d
+        aProtect.setOption( ScTableProtection::SELECT_UNLOCKED_CELLS, !maSheetProt.mbSelectUnlocked );
f0633d
 
f0633d
         getScDocument().SetTabProtection( getSheetIndex(), &aProtect );
f0633d
     }
f0633d
-- 
f0633d
1.8.4.2
f0633d