diff options
author | Noel Power <noel.power@suse.com> | 2013-11-21 18:12:50 +0000 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2013-11-27 23:46:27 +0100 |
commit | bf35ce3f91c8ee3f06a7a6c7a10dd17f05198ce5 (patch) | |
tree | a41312b7deb1e61d36f15d0c21d63e165d6cb984 | |
parent | 56805bab63f30496c7f13a0e88c2b265044cad30 (diff) |
fdo#70499 selectn of lock/unlocked cells with worksheet protection reversed
The ooxml spec documentation is rather confusing ( for me at least ) and the
sense of the of the sheetProtection attributes as described seems reversed to
how I read it ( or maybe it is the equivelant option in ScTableProtection that
operates with the reverse sense <shrug> ) In anycase the import ( and export )
have been adjusted to take that into consideration, also the export now actually
deals with the defaults correctly.
Change-Id: Ia69567b8898b39c9d171486cfa800e1748c5814b
-rw-r--r-- | sc/qa/unit/subsequent_export-test.cxx | 4 | ||||
-rw-r--r-- | sc/source/filter/excel/excrecds.cxx | 30 | ||||
-rw-r--r-- | sc/source/filter/oox/worksheetsettings.cxx | 30 |
3 files changed, 32 insertions, 32 deletions
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 0e8ff65b0f1d..ad2e2ee03e56 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -800,8 +800,8 @@ void ScExportTest::testSheetProtectionXLSX() CPPUNIT_ASSERT( (sal_uInt8)aHash[1] == 61 ); } // we could flesh out this check I guess - CPPUNIT_ASSERT ( pTabProtect->isOptionEnabled( ScTableProtection::OBJECTS ) ); - CPPUNIT_ASSERT ( pTabProtect->isOptionEnabled( ScTableProtection::SCENARIOS ) ); + CPPUNIT_ASSERT ( !pTabProtect->isOptionEnabled( ScTableProtection::OBJECTS ) ); + CPPUNIT_ASSERT ( !pTabProtect->isOptionEnabled( ScTableProtection::SCENARIOS ) ); } xDocSh->DoClose(); } diff --git a/sc/source/filter/excel/excrecds.cxx b/sc/source/filter/excel/excrecds.cxx index 232371b65bce..01b2432a6062 100644 --- a/sc/source/filter/excel/excrecds.cxx +++ b/sc/source/filter/excel/excrecds.cxx @@ -520,21 +520,21 @@ void XclExpSheetProtection::SaveXml( XclExpXmlStream& rStrm ) rWorksheet->singleElement( XML_sheetProtection, XML_sheet, XclXmlUtils::ToPsz( true ), XML_password, sHash.getStr(), - XML_objects, pTabProtect->isOptionEnabled( ScTableProtection::OBJECTS ) ? XclXmlUtils::ToPsz( true ) : NULL, - XML_scenarios, pTabProtect->isOptionEnabled( ScTableProtection::SCENARIOS ) ? XclXmlUtils::ToPsz( true ) : NULL, - XML_formatCells, pTabProtect->isOptionEnabled( ScTableProtection::FORMAT_CELLS ) ? NULL : XclXmlUtils::ToPsz( true ), - XML_formatColumns, pTabProtect->isOptionEnabled( ScTableProtection::FORMAT_COLUMNS ) ? NULL : XclXmlUtils::ToPsz( true ), - XML_formatRows, pTabProtect->isOptionEnabled( ScTableProtection::FORMAT_ROWS ) ? NULL : XclXmlUtils::ToPsz( true ), - XML_insertColumns, pTabProtect->isOptionEnabled( ScTableProtection::INSERT_COLUMNS ) ? NULL : XclXmlUtils::ToPsz( true ), - XML_insertRows, pTabProtect->isOptionEnabled( ScTableProtection::INSERT_ROWS ) ? NULL : XclXmlUtils::ToPsz( true ), - XML_insertHyperlinks, pTabProtect->isOptionEnabled( ScTableProtection::INSERT_HYPERLINKS ) ? NULL : XclXmlUtils::ToPsz( true ), - XML_deleteColumns, pTabProtect->isOptionEnabled( ScTableProtection::DELETE_COLUMNS ) ? NULL : XclXmlUtils::ToPsz( true ), - XML_deleteRows, pTabProtect->isOptionEnabled( ScTableProtection::DELETE_ROWS ) ? NULL : XclXmlUtils::ToPsz( true ), - XML_selectLockedCells, pTabProtect->isOptionEnabled( ScTableProtection::SELECT_LOCKED_CELLS ) ? XclXmlUtils::ToPsz( true ) : NULL, - XML_sort, pTabProtect->isOptionEnabled( ScTableProtection::SORT ) ? NULL : XclXmlUtils::ToPsz( true ), - XML_autoFilter, pTabProtect->isOptionEnabled( ScTableProtection::AUTOFILTER ) ? NULL : XclXmlUtils::ToPsz( true ), - XML_pivotTables, pTabProtect->isOptionEnabled( ScTableProtection::PIVOT_TABLES ) ? NULL : XclXmlUtils::ToPsz( true ), - XML_selectUnlockedCells, pTabProtect->isOptionEnabled( ScTableProtection::SELECT_UNLOCKED_CELLS ) ? XclXmlUtils::ToPsz( true ) : NULL, + XML_objects, pTabProtect->isOptionEnabled( ScTableProtection::OBJECTS ) ? NULL : XclXmlUtils::ToPsz( true ), + XML_scenarios, pTabProtect->isOptionEnabled( ScTableProtection::SCENARIOS ) ? NULL : XclXmlUtils::ToPsz( true ), + XML_formatCells, pTabProtect->isOptionEnabled( ScTableProtection::FORMAT_CELLS ) ? XclXmlUtils::ToPsz( false ) : NULL, + XML_formatColumns, pTabProtect->isOptionEnabled( ScTableProtection::FORMAT_COLUMNS ) ? XclXmlUtils::ToPsz( false ) : NULL, + XML_formatRows, pTabProtect->isOptionEnabled( ScTableProtection::FORMAT_ROWS ) ? XclXmlUtils::ToPsz( false ) : NULL, + XML_insertColumns, pTabProtect->isOptionEnabled( ScTableProtection::INSERT_COLUMNS ) ? XclXmlUtils::ToPsz( false ) : NULL, + XML_insertRows, pTabProtect->isOptionEnabled( ScTableProtection::INSERT_ROWS ) ? XclXmlUtils::ToPsz( false ) : NULL, + XML_insertHyperlinks, pTabProtect->isOptionEnabled( ScTableProtection::INSERT_HYPERLINKS ) ? XclXmlUtils::ToPsz( false ) : NULL, + XML_deleteColumns, pTabProtect->isOptionEnabled( ScTableProtection::DELETE_COLUMNS ) ? XclXmlUtils::ToPsz( false ) : NULL, + XML_deleteRows, pTabProtect->isOptionEnabled( ScTableProtection::DELETE_ROWS ) ? XclXmlUtils::ToPsz( false ) : NULL, + XML_selectLockedCells, pTabProtect->isOptionEnabled( ScTableProtection::SELECT_LOCKED_CELLS ) ? NULL : XclXmlUtils::ToPsz( true ), + XML_sort, pTabProtect->isOptionEnabled( ScTableProtection::SORT ) ? XclXmlUtils::ToPsz( false ) : NULL, + XML_autoFilter, pTabProtect->isOptionEnabled( ScTableProtection::AUTOFILTER ) ? XclXmlUtils::ToPsz( false ) : NULL, + XML_pivotTables, pTabProtect->isOptionEnabled( ScTableProtection::PIVOT_TABLES ) ? XclXmlUtils::ToPsz( false ) : NULL, + XML_selectUnlockedCells, pTabProtect->isOptionEnabled( ScTableProtection::SELECT_UNLOCKED_CELLS ) ? NULL : XclXmlUtils::ToPsz( true ), FSEND ); } } diff --git a/sc/source/filter/oox/worksheetsettings.cxx b/sc/source/filter/oox/worksheetsettings.cxx index ee32cf29ccbf..ddaf69a6857b 100644 --- a/sc/source/filter/oox/worksheetsettings.cxx +++ b/sc/source/filter/oox/worksheetsettings.cxx @@ -223,21 +223,21 @@ void WorksheetSettings::finalizeImport() aPass[1] = maSheetProt.mnPasswordHash & 0xFF; aProtect.setPasswordHash(aPass, PASSHASH_XL); } - aProtect.setOption( ScTableProtection::OBJECTS, maSheetProt.mbObjects); - aProtect.setOption( ScTableProtection::SCENARIOS, maSheetProt.mbScenarios ); - aProtect.setOption( ScTableProtection::FORMAT_CELLS, maSheetProt.mbFormatCells ); - aProtect.setOption( ScTableProtection::FORMAT_COLUMNS, maSheetProt.mbFormatColumns ); - aProtect.setOption( ScTableProtection::FORMAT_ROWS, maSheetProt.mbFormatRows ); - aProtect.setOption( ScTableProtection::INSERT_COLUMNS, maSheetProt.mbInsertColumns ); - aProtect.setOption( ScTableProtection::INSERT_ROWS, maSheetProt.mbInsertRows ); - aProtect.setOption( ScTableProtection::INSERT_HYPERLINKS, maSheetProt.mbInsertHyperlinks ); - aProtect.setOption( ScTableProtection::DELETE_COLUMNS, maSheetProt.mbDeleteColumns ); - aProtect.setOption( ScTableProtection::DELETE_ROWS,maSheetProt.mbDeleteRows ); - aProtect.setOption( ScTableProtection::SELECT_LOCKED_CELLS, maSheetProt.mbSelectLocked ); - aProtect.setOption( ScTableProtection::SORT, maSheetProt.mbSort ); - aProtect.setOption( ScTableProtection::AUTOFILTER, maSheetProt.mbAutoFilter ); - aProtect.setOption( ScTableProtection::PIVOT_TABLES, maSheetProt.mbPivotTables ); - aProtect.setOption( ScTableProtection::SELECT_UNLOCKED_CELLS, maSheetProt.mbSelectUnlocked ); + aProtect.setOption( ScTableProtection::OBJECTS, !maSheetProt.mbObjects); + aProtect.setOption( ScTableProtection::SCENARIOS, !maSheetProt.mbScenarios ); + aProtect.setOption( ScTableProtection::FORMAT_CELLS, !maSheetProt.mbFormatCells ); + aProtect.setOption( ScTableProtection::FORMAT_COLUMNS, !maSheetProt.mbFormatColumns ); + aProtect.setOption( ScTableProtection::FORMAT_ROWS, !maSheetProt.mbFormatRows ); + aProtect.setOption( ScTableProtection::INSERT_COLUMNS, !maSheetProt.mbInsertColumns ); + aProtect.setOption( ScTableProtection::INSERT_ROWS, !maSheetProt.mbInsertRows ); + aProtect.setOption( ScTableProtection::INSERT_HYPERLINKS, !maSheetProt.mbInsertHyperlinks ); + aProtect.setOption( ScTableProtection::DELETE_COLUMNS, !maSheetProt.mbDeleteColumns ); + aProtect.setOption( ScTableProtection::DELETE_ROWS,!maSheetProt.mbDeleteRows ); + aProtect.setOption( ScTableProtection::SELECT_LOCKED_CELLS, !maSheetProt.mbSelectLocked ); + aProtect.setOption( ScTableProtection::SORT, !maSheetProt.mbSort ); + aProtect.setOption( ScTableProtection::AUTOFILTER, !maSheetProt.mbAutoFilter ); + aProtect.setOption( ScTableProtection::PIVOT_TABLES, !maSheetProt.mbPivotTables ); + aProtect.setOption( ScTableProtection::SELECT_UNLOCKED_CELLS, !maSheetProt.mbSelectUnlocked ); getScDocument().SetTabProtection( getSheetIndex(), &aProtect ); } |