Merge pull request #19907 from benj5378/getAttribute
Base: make getAttribute template
This commit is contained in:
@@ -728,19 +728,27 @@ void Cell::moveAbsolute(CellAddress newAddress)
|
||||
|
||||
void Cell::restore(Base::XMLReader& reader, bool checkAlias)
|
||||
{
|
||||
const char* style = reader.hasAttribute("style") ? reader.getAttribute("style") : nullptr;
|
||||
const char* style =
|
||||
reader.hasAttribute("style") ? reader.getAttribute<const char*>("style") : nullptr;
|
||||
const char* alignment =
|
||||
reader.hasAttribute("alignment") ? reader.getAttribute("alignment") : nullptr;
|
||||
const char* content = reader.hasAttribute("content") ? reader.getAttribute("content") : "";
|
||||
const char* foregroundColor =
|
||||
reader.hasAttribute("foregroundColor") ? reader.getAttribute("foregroundColor") : nullptr;
|
||||
const char* backgroundColor =
|
||||
reader.hasAttribute("backgroundColor") ? reader.getAttribute("backgroundColor") : nullptr;
|
||||
const char* displayUnit =
|
||||
reader.hasAttribute("displayUnit") ? reader.getAttribute("displayUnit") : nullptr;
|
||||
const char* alias = reader.hasAttribute("alias") ? reader.getAttribute("alias") : nullptr;
|
||||
const char* rowSpan = reader.hasAttribute("rowSpan") ? reader.getAttribute("rowSpan") : nullptr;
|
||||
const char* colSpan = reader.hasAttribute("colSpan") ? reader.getAttribute("colSpan") : nullptr;
|
||||
reader.hasAttribute("alignment") ? reader.getAttribute<const char*>("alignment") : nullptr;
|
||||
const char* content =
|
||||
reader.hasAttribute("content") ? reader.getAttribute<const char*>("content") : "";
|
||||
const char* foregroundColor = reader.hasAttribute("foregroundColor")
|
||||
? reader.getAttribute<const char*>("foregroundColor")
|
||||
: nullptr;
|
||||
const char* backgroundColor = reader.hasAttribute("backgroundColor")
|
||||
? reader.getAttribute<const char*>("backgroundColor")
|
||||
: nullptr;
|
||||
const char* displayUnit = reader.hasAttribute("displayUnit")
|
||||
? reader.getAttribute<const char*>("displayUnit")
|
||||
: nullptr;
|
||||
const char* alias =
|
||||
reader.hasAttribute("alias") ? reader.getAttribute<const char*>("alias") : nullptr;
|
||||
const char* rowSpan =
|
||||
reader.hasAttribute("rowSpan") ? reader.getAttribute<const char*>("rowSpan") : nullptr;
|
||||
const char* colSpan =
|
||||
reader.hasAttribute("colSpan") ? reader.getAttribute<const char*>("colSpan") : nullptr;
|
||||
|
||||
// Don't trigger multiple updates below; wait until everything is loaded by calling unfreeze()
|
||||
// below.
|
||||
|
||||
@@ -129,11 +129,13 @@ void PropertyColumnWidths::Restore(Base::XMLReader& reader)
|
||||
|
||||
// Column info
|
||||
reader.readElement("ColumnInfo");
|
||||
Cnt = reader.hasAttribute("Count") ? reader.getAttributeAsInteger("Count") : 0;
|
||||
Cnt = reader.hasAttribute("Count") ? reader.getAttribute<long>("Count") : 0;
|
||||
for (int i = 0; i < Cnt; i++) {
|
||||
reader.readElement("Column");
|
||||
const char* name = reader.hasAttribute("name") ? reader.getAttribute("name") : nullptr;
|
||||
const char* width = reader.hasAttribute("width") ? reader.getAttribute("width") : nullptr;
|
||||
const char* name =
|
||||
reader.hasAttribute("name") ? reader.getAttribute<const char*>("name") : nullptr;
|
||||
const char* width =
|
||||
reader.hasAttribute("width") ? reader.getAttribute<const char*>("width") : nullptr;
|
||||
|
||||
try {
|
||||
if (name && width) {
|
||||
|
||||
@@ -122,12 +122,13 @@ void PropertyRowHeights::Restore(Base::XMLReader& reader)
|
||||
|
||||
// Row info
|
||||
reader.readElement("RowInfo");
|
||||
Cnt = reader.hasAttribute("Count") ? reader.getAttributeAsInteger("Count") : 0;
|
||||
Cnt = reader.hasAttribute("Count") ? reader.getAttribute<long>("Count") : 0;
|
||||
for (int i = 0; i < Cnt; i++) {
|
||||
reader.readElement("Row");
|
||||
const char* name = reader.hasAttribute("name") ? reader.getAttribute("name") : nullptr;
|
||||
const char* name =
|
||||
reader.hasAttribute("name") ? reader.getAttribute<const char*>("name") : nullptr;
|
||||
const char* height =
|
||||
reader.hasAttribute("height") ? reader.getAttribute("height") : nullptr;
|
||||
reader.hasAttribute("height") ? reader.getAttribute<const char*>("height") : nullptr;
|
||||
|
||||
try {
|
||||
if (name && height) {
|
||||
|
||||
@@ -423,9 +423,9 @@ void PropertySheet::Restore(Base::XMLReader& reader)
|
||||
AtomicPropertyChange signaller(*this);
|
||||
|
||||
reader.readElement("Cells");
|
||||
Cnt = reader.getAttributeAsInteger("Count");
|
||||
Cnt = reader.getAttribute<long>("Count");
|
||||
|
||||
if (reader.hasAttribute("xlink") && reader.getAttributeAsInteger("xlink")) {
|
||||
if (reader.hasAttribute("xlink") && reader.getAttribute<bool>("xlink")) {
|
||||
PropertyExpressionContainer::Restore(reader);
|
||||
}
|
||||
|
||||
@@ -433,7 +433,7 @@ void PropertySheet::Restore(Base::XMLReader& reader)
|
||||
reader.readElement("Cell");
|
||||
|
||||
const char* strAddress =
|
||||
reader.hasAttribute("address") ? reader.getAttribute("address") : "";
|
||||
reader.hasAttribute("address") ? reader.getAttribute<const char*>("address") : "";
|
||||
|
||||
try {
|
||||
CellAddress address(strAddress);
|
||||
@@ -490,7 +490,7 @@ void PropertySheet::copyCells(Base::Writer& writer, const std::vector<Range>& ra
|
||||
void PropertySheet::pasteCells(XMLReader& reader, Range dstRange)
|
||||
{
|
||||
reader.readElement("Cells");
|
||||
int rangeCount = reader.getAttributeAsInteger("count");
|
||||
int rangeCount = reader.getAttribute<long>("count");
|
||||
if (rangeCount <= 0) {
|
||||
return;
|
||||
}
|
||||
@@ -504,9 +504,9 @@ void PropertySheet::pasteCells(XMLReader& reader, Range dstRange)
|
||||
AtomicPropertyChange signaller(*this);
|
||||
for (int ri = 0; ri < rangeCount; ++ri) {
|
||||
reader.readElement("Range");
|
||||
CellAddress from(reader.getAttribute("from"));
|
||||
CellAddress to(reader.getAttribute("to"));
|
||||
int cellCount = reader.getAttributeAsInteger("count");
|
||||
CellAddress from(reader.getAttribute<const char*>("from"));
|
||||
CellAddress to(reader.getAttribute<const char*>("to"));
|
||||
int cellCount = reader.getAttribute<long>("count");
|
||||
|
||||
Range range(from, to);
|
||||
|
||||
@@ -533,7 +533,7 @@ void PropertySheet::pasteCells(XMLReader& reader, Range dstRange)
|
||||
}
|
||||
for (int ci = 0; ci < cellCount; ++ci) {
|
||||
reader.readElement("Cell");
|
||||
CellAddress src(reader.getAttribute("address"));
|
||||
CellAddress src(reader.getAttribute<const char*>("address"));
|
||||
|
||||
if (ci) {
|
||||
range.next();
|
||||
|
||||
Reference in New Issue
Block a user