[Libreoffice-commits] core.git: 3 commits - sc/inc sc/qa sc/source
Markus Mohrhard
markus.mohrhard at collabora.co.uk
Fri Aug 15 15:23:19 PDT 2014
sc/inc/tabprotection.hxx | 6 ++---
sc/qa/unit/data/ods/sheet-protection.ods |binary
sc/qa/unit/subsequent_export-test.cxx | 33 +++++++++++++++++++++++++++++++
sc/source/filter/xml/xmlexprt.cxx | 6 ++---
sc/source/filter/xml/xmlimprt.cxx | 3 ++
sc/source/filter/xml/xmltabi.cxx | 2 -
6 files changed, 43 insertions(+), 7 deletions(-)
New commits:
commit 08d4ea4b48f9d6419e76fe31d5b53c1ea0b427df
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Sat Aug 16 00:14:00 2014 +0200
use scoped_ptr instead of shared_ptr
Change-Id: Ic814a2301aaf6e57aa8ca04b837acafb6e4f4566
diff --git a/sc/inc/tabprotection.hxx b/sc/inc/tabprotection.hxx
index 9acfefd..0843a1f 100644
--- a/sc/inc/tabprotection.hxx
+++ b/sc/inc/tabprotection.hxx
@@ -25,7 +25,7 @@
#include "global.hxx"
#include "rangelst.hxx"
-#include <boost/shared_ptr.hpp>
+#include <boost/scoped_ptr.hpp>
class ScDocument;
class ScTableProtectionImpl;
@@ -108,7 +108,7 @@ public:
void setOption(Option eOption, bool bEnabled);
private:
- ::boost::shared_ptr<ScTableProtectionImpl> mpImpl;
+ ::boost::scoped_ptr<ScTableProtectionImpl> mpImpl;
};
/** Container for the Excel EnhancedProtection feature.
@@ -200,7 +200,7 @@ public:
bool isSelectionEditable( const ScRangeList& rRangeList ) const;
private:
- ::boost::shared_ptr<ScTableProtectionImpl> mpImpl;
+ ::boost::scoped_ptr<ScTableProtectionImpl> mpImpl;
};
#endif
commit 0e633c51d8ed0c0d4050a3d0781c5bc036607616
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Sat Aug 16 00:11:56 2014 +0200
add test for fdo#82128
Change-Id: I3dd0005f00c4a861103ffd1a0422b9fc9397f6fb
diff --git a/sc/qa/unit/data/ods/sheet-protection.ods b/sc/qa/unit/data/ods/sheet-protection.ods
new file mode 100644
index 0000000..8cfbbd2
Binary files /dev/null and b/sc/qa/unit/data/ods/sheet-protection.ods differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index 0be4d5e..466ca67 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -116,6 +116,7 @@ public:
#endif
void testRelativePaths();
+ void testSheetProtection();
CPPUNIT_TEST_SUITE(ScExportTest);
CPPUNIT_TEST(test);
@@ -152,6 +153,7 @@ public:
#if !defined(WNT)
CPPUNIT_TEST(testRelativePaths);
#endif
+ CPPUNIT_TEST(testSheetProtection);
/* TODO: export to ODS currently (2014-04-28) makes the validator stumble,
* probably due to a loext:fill-character attribute in a
@@ -1932,6 +1934,37 @@ void ScExportTest::testRelativePaths()
CPPUNIT_ASSERT(aURL.startsWith(".."));
}
+namespace {
+
+void testSheetProtection_Impl(ScDocument& rDoc)
+{
+ CPPUNIT_ASSERT(rDoc.IsTabProtected(0));
+
+ ScTableProtection* pTabProtection = rDoc.GetTabProtection(0);
+ CPPUNIT_ASSERT(pTabProtection->isOptionEnabled(ScTableProtection::SELECT_UNLOCKED_CELLS));
+ CPPUNIT_ASSERT(!pTabProtection->isOptionEnabled(ScTableProtection::SELECT_LOCKED_CELLS));
+}
+
+}
+void ScExportTest::testSheetProtection()
+{
+ ScDocShellRef xDocSh = loadDoc("sheet-protection.", ODS);
+ CPPUNIT_ASSERT(xDocSh.Is());
+
+ {
+ ScDocument& rDoc = xDocSh->GetDocument();
+ testSheetProtection_Impl(rDoc);
+ }
+
+ ScDocShellRef xDocSh2 = saveAndReload(xDocSh, ODS);
+ {
+ ScDocument& rDoc = xDocSh2->GetDocument();
+ testSheetProtection_Impl(rDoc);
+ }
+
+ xDocSh2->DoClose();
+}
+
#if 0
void ScExportTest::testFunctionsExcel2010ODS()
{
commit 2cc0109c0a1a8ff9a6bdb1cd5fc38f0c3520585a
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Thu Aug 14 11:07:16 2014 +0200
use correct namespace for table protection elements, fdo#82128
Change-Id: I5b9cb4a76739a0c91597c0470c737439d2b07e4f
diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index 9c44f8d..6e7b52d 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -2939,12 +2939,12 @@ void ScXMLExport::WriteTable(sal_Int32 nTable, const Reference<sheet::XSpreadshe
if (pProtect && pProtect->isProtected() && getDefaultVersion() > SvtSaveOptions::ODFVER_012)
{
if (pProtect->isOptionEnabled(ScTableProtection::SELECT_LOCKED_CELLS))
- AddAttribute(XML_NAMESPACE_OFFICE_EXT, XML_SELECT_PROTECTED_CELLS, XML_TRUE);
+ AddAttribute(XML_NAMESPACE_LO_EXT, XML_SELECT_PROTECTED_CELLS, XML_TRUE);
if (pProtect->isOptionEnabled(ScTableProtection::SELECT_UNLOCKED_CELLS))
- AddAttribute(XML_NAMESPACE_OFFICE_EXT, XML_SELECT_UNPROTECTED_CELLS, XML_TRUE);
+ AddAttribute(XML_NAMESPACE_LO_EXT, XML_SELECT_UNPROTECTED_CELLS, XML_TRUE);
OUString aElemName = GetNamespaceMap().GetQNameByKey(
- XML_NAMESPACE_OFFICE_EXT, GetXMLToken(XML_TABLE_PROTECTION));
+ XML_NAMESPACE_LO_EXT, GetXMLToken(XML_TABLE_PROTECTION));
SvXMLElementExport aElemProtected(*this, aElemName, true, true);
}
diff --git a/sc/source/filter/xml/xmlimprt.cxx b/sc/source/filter/xml/xmlimprt.cxx
index 5c817fa..1b9d10a 100644
--- a/sc/source/filter/xml/xmlimprt.cxx
+++ b/sc/source/filter/xml/xmlimprt.cxx
@@ -805,6 +805,7 @@ const SvXMLTokenMap& ScXMLImport::GetTableElemTokenMap()
{ XML_NAMESPACE_TABLE, XML_TABLE_COLUMNS, XML_TOK_TABLE_COLS },
{ XML_NAMESPACE_TABLE, XML_TABLE_COLUMN, XML_TOK_TABLE_COL },
{ XML_NAMESPACE_TABLE, XML_TABLE_PROTECTION, XML_TOK_TABLE_PROTECTION },
+ { XML_NAMESPACE_LO_EXT, XML_TABLE_PROTECTION, XML_TOK_TABLE_PROTECTION_EXT },
{ XML_NAMESPACE_OFFICE_EXT, XML_TABLE_PROTECTION, XML_TOK_TABLE_PROTECTION_EXT },
{ XML_NAMESPACE_TABLE, XML_TABLE_ROW_GROUP, XML_TOK_TABLE_ROW_GROUP },
{ XML_NAMESPACE_TABLE, XML_TABLE_HEADER_ROWS, XML_TOK_TABLE_HEADER_ROWS },
@@ -835,7 +836,9 @@ const SvXMLTokenMap& ScXMLImport::GetTableProtectionAttrTokenMap()
{ XML_NAMESPACE_TABLE, XML_SELECT_PROTECTED_CELLS, XML_TOK_TABLE_SELECT_PROTECTED_CELLS },
{ XML_NAMESPACE_TABLE, XML_SELECT_UNPROTECTED_CELLS, XML_TOK_TABLE_SELECT_UNPROTECTED_CELLS },
{ XML_NAMESPACE_OFFICE_EXT, XML_SELECT_PROTECTED_CELLS, XML_TOK_TABLE_SELECT_PROTECTED_CELLS_EXT },
+ { XML_NAMESPACE_LO_EXT, XML_SELECT_PROTECTED_CELLS, XML_TOK_TABLE_SELECT_PROTECTED_CELLS_EXT },
{ XML_NAMESPACE_OFFICE_EXT, XML_SELECT_UNPROTECTED_CELLS, XML_TOK_TABLE_SELECT_UNPROTECTED_CELLS_EXT },
+ { XML_NAMESPACE_LO_EXT, XML_SELECT_UNPROTECTED_CELLS, XML_TOK_TABLE_SELECT_UNPROTECTED_CELLS_EXT },
XML_TOKEN_MAP_END
};
pTableProtectionElemTokenMap = new SvXMLTokenMap(aTableProtectionTokenMap);
diff --git a/sc/source/filter/xml/xmltabi.cxx b/sc/source/filter/xml/xmltabi.cxx
index b0f836d..548763e 100644
--- a/sc/source/filter/xml/xmltabi.cxx
+++ b/sc/source/filter/xml/xmltabi.cxx
@@ -459,7 +459,7 @@ ScXMLTableProtectionContext::ScXMLTableProtectionContext(
bSelectUnprotectedCells = IsXMLToken(aValue, XML_TRUE);
break;
default:
- ;
+ SAL_WARN("sc", "unknown attribute: " << aAttrName);
}
}
More information about the Libreoffice-commits
mailing list