Spreadsheet: modernize C++11
* use nullptr
This commit is contained in:
@@ -706,15 +706,15 @@ void Cell::moveAbsolute(CellAddress newAddress)
|
||||
|
||||
void Cell::restore(Base::XMLReader &reader, bool checkAlias)
|
||||
{
|
||||
const char* style = reader.hasAttribute("style") ? reader.getAttribute("style") : 0;
|
||||
const char* alignment = reader.hasAttribute("alignment") ? reader.getAttribute("alignment") : 0;
|
||||
const char* style = reader.hasAttribute("style") ? reader.getAttribute("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") : 0;
|
||||
const char* backgroundColor = reader.hasAttribute("backgroundColor") ? reader.getAttribute("backgroundColor") : 0;
|
||||
const char* displayUnit = reader.hasAttribute("displayUnit") ? reader.getAttribute("displayUnit") : 0;
|
||||
const char* alias = reader.hasAttribute("alias") ? reader.getAttribute("alias") : 0;
|
||||
const char* rowSpan = reader.hasAttribute("rowSpan") ? reader.getAttribute("rowSpan") : 0;
|
||||
const char* colSpan = reader.hasAttribute("colSpan") ? reader.getAttribute("colSpan") : 0;
|
||||
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;
|
||||
|
||||
// Don't trigger multiple updates below; wait until everything is loaded by calling unfreeze() below.
|
||||
PropertySheet::AtomicPropertyChange signaller(*owner);
|
||||
@@ -1001,7 +1001,7 @@ App::Color Cell::decodeColor(const std::string & color, const App::Color & defau
|
||||
|
||||
if (color[0] != '#')
|
||||
return defaultColor;
|
||||
unsigned int value = strtoul(color.c_str() + 1, 0, 16);
|
||||
unsigned int value = strtoul(color.c_str() + 1, nullptr, 16);
|
||||
|
||||
if (color.size() == 7)
|
||||
value = (value << 8) | 0xff;
|
||||
|
||||
@@ -132,8 +132,8 @@ void PropertyColumnWidths::Restore(Base::XMLReader &reader)
|
||||
Cnt = reader.hasAttribute("Count") ? reader.getAttributeAsInteger("Count") : 0;
|
||||
for (int i = 0; i < Cnt; i++) {
|
||||
reader.readElement("Column");
|
||||
const char* name = reader.hasAttribute("name") ? reader.getAttribute("name") : 0;
|
||||
const char * width = reader.hasAttribute("width") ? reader.getAttribute("width") : 0;
|
||||
const char* name = reader.hasAttribute("name") ? reader.getAttribute("name") : nullptr;
|
||||
const char * width = reader.hasAttribute("width") ? reader.getAttribute("width") : nullptr;
|
||||
|
||||
try {
|
||||
if (name && width) {
|
||||
|
||||
@@ -51,7 +51,7 @@ int PropertyColumnWidthsPy::PyInit(PyObject* /*args*/, PyObject* /*kwd*/)
|
||||
|
||||
PyObject *PropertyColumnWidthsPy::getCustomAttributes(const char* /*attr*/) const
|
||||
{
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int PropertyColumnWidthsPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/)
|
||||
|
||||
@@ -126,8 +126,8 @@ void PropertyRowHeights::Restore(Base::XMLReader &reader)
|
||||
Cnt = reader.hasAttribute("Count") ? reader.getAttributeAsInteger("Count") : 0;
|
||||
for (int i = 0; i < Cnt; i++) {
|
||||
reader.readElement("Row");
|
||||
const char* name = reader.hasAttribute("name") ? reader.getAttribute("name") : 0;
|
||||
const char * height = reader.hasAttribute("height") ? reader.getAttribute("height") : 0;
|
||||
const char* name = reader.hasAttribute("name") ? reader.getAttribute("name") : nullptr;
|
||||
const char * height = reader.hasAttribute("height") ? reader.getAttribute("height") : nullptr;
|
||||
|
||||
try {
|
||||
if (name && height) {
|
||||
|
||||
@@ -51,7 +51,7 @@ int PropertyRowHeightsPy::PyInit(PyObject* /*args*/, PyObject* /*kwd*/)
|
||||
|
||||
PyObject *PropertyRowHeightsPy::getCustomAttributes(const char* /*attr*/) const
|
||||
{
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int PropertyRowHeightsPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/)
|
||||
|
||||
@@ -86,7 +86,7 @@ Cell *PropertySheet::getValue(CellAddress key)
|
||||
std::map<CellAddress, Cell*>::const_iterator i = data.find(key);
|
||||
|
||||
if (i == data.end())
|
||||
return 0;
|
||||
return nullptr;
|
||||
else
|
||||
return i->second;
|
||||
}
|
||||
@@ -96,7 +96,7 @@ const Cell *PropertySheet::getValue(CellAddress key) const
|
||||
std::map<CellAddress, Cell*>::const_iterator i = data.find(key);
|
||||
|
||||
if (i == data.end())
|
||||
return 0;
|
||||
return nullptr;
|
||||
else
|
||||
return i->second;
|
||||
}
|
||||
@@ -108,7 +108,7 @@ Cell * PropertySheet::getValueFromAlias(const std::string &alias)
|
||||
if (it != revAliasProp.end())
|
||||
return getValue(it->second);
|
||||
else
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const Cell * PropertySheet::getValueFromAlias(const std::string &alias) const
|
||||
@@ -118,7 +118,7 @@ const Cell * PropertySheet::getValueFromAlias(const std::string &alias) const
|
||||
if (it != revAliasProp.end())
|
||||
return getValue(it->second);
|
||||
else
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool PropertySheet::isValidAlias(const std::string &candidate)
|
||||
@@ -127,7 +127,7 @@ bool PropertySheet::isValidAlias(const std::string &candidate)
|
||||
boost::cmatch cm;
|
||||
|
||||
/* Check if it is used before */
|
||||
if (getValueFromAlias(candidate) != 0)
|
||||
if (getValueFromAlias(candidate) != nullptr)
|
||||
return false;
|
||||
|
||||
/* Check to make sure it doesn't clash with a predefined unit */
|
||||
@@ -517,7 +517,7 @@ Cell * PropertySheet::cellAt(CellAddress address)
|
||||
std::map<CellAddress, Cell*>::const_iterator i = data.find(address);
|
||||
|
||||
if (i == data.end())
|
||||
return 0;
|
||||
return nullptr;
|
||||
else
|
||||
return i->second;
|
||||
}
|
||||
@@ -537,7 +537,7 @@ const Cell * PropertySheet::cellAt(CellAddress address) const
|
||||
std::map<CellAddress, Cell*>::const_iterator i = data.find(address);
|
||||
|
||||
if (i == data.end())
|
||||
return 0;
|
||||
return nullptr;
|
||||
else
|
||||
return i->second;
|
||||
}
|
||||
@@ -566,14 +566,14 @@ Cell * PropertySheet::nonNullCellAt(CellAddress address)
|
||||
void PropertySheet::setContent(CellAddress address, const char *value)
|
||||
{
|
||||
Cell * cell = nonNullCellAt(address);
|
||||
assert(cell != 0);
|
||||
assert(cell != nullptr);
|
||||
cell->setContent(value);
|
||||
}
|
||||
|
||||
void PropertySheet::setAlignment(CellAddress address, int _alignment)
|
||||
{
|
||||
Cell * cell = nonNullCellAt(address);
|
||||
assert(cell != 0);
|
||||
assert(cell != nullptr);
|
||||
if (cell->address != address) return; //Reject alignment change for merged cell except top-left one
|
||||
cell->setAlignment(_alignment);
|
||||
}
|
||||
@@ -581,28 +581,28 @@ void PropertySheet::setAlignment(CellAddress address, int _alignment)
|
||||
void PropertySheet::setStyle(CellAddress address, const std::set<std::string> &_style)
|
||||
{
|
||||
Cell * cell = nonNullCellAt(address);
|
||||
assert(cell != 0);
|
||||
assert(cell != nullptr);
|
||||
cell->setStyle(_style);
|
||||
}
|
||||
|
||||
void PropertySheet::setForeground(CellAddress address, const App::Color &color)
|
||||
{
|
||||
Cell * cell = nonNullCellAt(address);
|
||||
assert(cell != 0);
|
||||
assert(cell != nullptr);
|
||||
cell->setForeground(color);
|
||||
}
|
||||
|
||||
void PropertySheet::setBackground(CellAddress address, const App::Color &color)
|
||||
{
|
||||
Cell * cell = nonNullCellAt(address);
|
||||
assert(cell != 0);
|
||||
assert(cell != nullptr);
|
||||
cell->setBackground(color);
|
||||
}
|
||||
|
||||
void PropertySheet::setDisplayUnit(CellAddress address, const std::string &unit)
|
||||
{
|
||||
Cell * cell = nonNullCellAt(address);
|
||||
assert(cell != 0);
|
||||
assert(cell != nullptr);
|
||||
cell->setDisplayUnit(unit);
|
||||
}
|
||||
|
||||
@@ -614,7 +614,7 @@ void PropertySheet::setAlias(CellAddress address, const std::string &alias)
|
||||
|
||||
const Cell * aliasedCell = getValueFromAlias(alias);
|
||||
Cell * cell = nonNullCellAt(address);
|
||||
assert(cell != 0);
|
||||
assert(cell != nullptr);
|
||||
|
||||
if(aliasedCell == cell)
|
||||
return;
|
||||
@@ -658,14 +658,14 @@ void PropertySheet::setAlias(CellAddress address, const std::string &alias)
|
||||
void PropertySheet::setComputedUnit(CellAddress address, const Base::Unit &unit)
|
||||
{
|
||||
Cell * cell = nonNullCellAt(address);
|
||||
assert(cell != 0);
|
||||
assert(cell != nullptr);
|
||||
cell->setComputedUnit(unit);
|
||||
}
|
||||
|
||||
void PropertySheet::setSpans(CellAddress address, int rows, int columns)
|
||||
{
|
||||
Cell * cell = nonNullCellAt(address);
|
||||
assert(cell != 0);
|
||||
assert(cell != nullptr);
|
||||
cell->setSpans(rows, columns);
|
||||
}
|
||||
|
||||
@@ -1118,7 +1118,7 @@ void PropertySheet::addDependencies(CellAddress key)
|
||||
|
||||
const Expression * expression = cell->getExpression();
|
||||
|
||||
if (expression == 0)
|
||||
if (expression == nullptr)
|
||||
return;
|
||||
|
||||
for(auto &var : expression->getIdentifiers()) {
|
||||
@@ -1589,7 +1589,7 @@ Property *PropertySheet::CopyOnImportExternal(
|
||||
changed[d.first] = std::move(expr);
|
||||
}
|
||||
if(changed.empty())
|
||||
return 0;
|
||||
return nullptr;
|
||||
std::unique_ptr<PropertySheet> copy(new PropertySheet(*this));
|
||||
for(auto &change : changed)
|
||||
copy->data[change.first]->setExpression(std::move(change.second));
|
||||
@@ -1609,7 +1609,7 @@ Property *PropertySheet::CopyOnLabelChange(App::DocumentObject *obj,
|
||||
changed[d.first] = std::move(expr);
|
||||
}
|
||||
if(changed.empty())
|
||||
return 0;
|
||||
return nullptr;
|
||||
std::unique_ptr<PropertySheet> copy(new PropertySheet(*this));
|
||||
for(auto &change : changed)
|
||||
copy->data[change.first]->setExpression(std::move(change.second));
|
||||
@@ -1629,7 +1629,7 @@ Property *PropertySheet::CopyOnLinkReplace(const App::DocumentObject *parent,
|
||||
changed[d.first] = std::move(expr);
|
||||
}
|
||||
if(changed.empty())
|
||||
return 0;
|
||||
return nullptr;
|
||||
std::unique_ptr<PropertySheet> copy(new PropertySheet(*this));
|
||||
for(auto &change : changed)
|
||||
copy->data[change.first]->setExpression(std::move(change.second));
|
||||
|
||||
@@ -43,7 +43,7 @@ class SpreadsheetExport PropertySheet : public App::PropertyExpressionContainer
|
||||
TYPESYSTEM_HEADER_WITH_OVERRIDE();
|
||||
public:
|
||||
|
||||
PropertySheet(Sheet * _owner = 0);
|
||||
PropertySheet(Sheet * _owner = nullptr);
|
||||
|
||||
~PropertySheet();
|
||||
|
||||
@@ -190,7 +190,7 @@ public:
|
||||
unsigned getBindingBorder(App::CellAddress address) const;
|
||||
|
||||
bool isBindingPath(const App::ObjectIdentifier &path,
|
||||
App::CellAddress *from=0, App::CellAddress *to=0, bool *href=0) const;
|
||||
App::CellAddress *from=nullptr, App::CellAddress *to=nullptr, bool *href=nullptr) const;
|
||||
|
||||
enum BindingType {
|
||||
BindingNone,
|
||||
@@ -198,7 +198,7 @@ public:
|
||||
BindingHiddenRef,
|
||||
};
|
||||
BindingType getBinding(const App::Range &range,
|
||||
App::ExpressionPtr *pStart=0, App::ExpressionPtr *pEnd=0) const;
|
||||
App::ExpressionPtr *pStart=nullptr, App::ExpressionPtr *pEnd=nullptr) const;
|
||||
|
||||
protected:
|
||||
virtual void hasSetValue() override;
|
||||
|
||||
@@ -368,7 +368,7 @@ Cell *Sheet::getNewCell(CellAddress address)
|
||||
{
|
||||
Cell * cell = getCell(address);
|
||||
|
||||
if (cell == 0)
|
||||
if (cell == nullptr)
|
||||
cell = cells.createCell(address);
|
||||
|
||||
return cell;
|
||||
@@ -384,7 +384,7 @@ Cell *Sheet::getNewCell(CellAddress address)
|
||||
|
||||
void Sheet::setCell(const char * address, const char * contents)
|
||||
{
|
||||
assert(address != 0 && contents != 0);
|
||||
assert(address != nullptr && contents != nullptr);
|
||||
|
||||
setCell(CellAddress(address), contents);
|
||||
}
|
||||
@@ -400,7 +400,7 @@ void Sheet::setCell(const char * address, const char * contents)
|
||||
|
||||
void Sheet::setCell(CellAddress address, const char * value)
|
||||
{
|
||||
assert(value != 0);
|
||||
assert(value != nullptr);
|
||||
|
||||
|
||||
if (*value == '\0') {
|
||||
@@ -524,7 +524,7 @@ Property * Sheet::setFloatProperty(CellAddress key, double value)
|
||||
this->removeDynamicProperty(name.c_str());
|
||||
propAddress.erase(prop);
|
||||
}
|
||||
floatProp = freecad_dynamic_cast<PropertyFloat>(addDynamicProperty("App::PropertyFloat", name.c_str(), 0, 0, Prop_ReadOnly | Prop_Hidden | Prop_NoPersist));
|
||||
floatProp = freecad_dynamic_cast<PropertyFloat>(addDynamicProperty("App::PropertyFloat", name.c_str(), nullptr, nullptr, Prop_ReadOnly | Prop_Hidden | Prop_NoPersist));
|
||||
}
|
||||
else
|
||||
floatProp = static_cast<PropertyFloat*>(prop);
|
||||
@@ -547,7 +547,7 @@ Property * Sheet::setIntegerProperty(CellAddress key, long value)
|
||||
propAddress.erase(prop);
|
||||
}
|
||||
intProp = freecad_dynamic_cast<PropertyInteger>(addDynamicProperty(
|
||||
"App::PropertyInteger", name.c_str(), 0, 0,
|
||||
"App::PropertyInteger", name.c_str(), nullptr, nullptr,
|
||||
Prop_ReadOnly | Prop_Hidden | Prop_NoPersist));
|
||||
}
|
||||
else
|
||||
@@ -581,7 +581,7 @@ Property * Sheet::setQuantityProperty(CellAddress key, double value, const Base:
|
||||
this->removeDynamicProperty(name.c_str());
|
||||
propAddress.erase(prop);
|
||||
}
|
||||
Property * p = addDynamicProperty("Spreadsheet::PropertySpreadsheetQuantity", name.c_str(), 0, 0, Prop_ReadOnly | Prop_Hidden | Prop_NoPersist);
|
||||
Property * p = addDynamicProperty("Spreadsheet::PropertySpreadsheetQuantity", name.c_str(), nullptr, nullptr, Prop_ReadOnly | Prop_Hidden | Prop_NoPersist);
|
||||
quantityProp = freecad_dynamic_cast<PropertySpreadsheetQuantity>(p);
|
||||
}
|
||||
else
|
||||
@@ -616,7 +616,7 @@ Property * Sheet::setStringProperty(CellAddress key, const std::string & value)
|
||||
this->removeDynamicProperty(name.c_str());
|
||||
propAddress.erase(prop);
|
||||
}
|
||||
stringProp = freecad_dynamic_cast<PropertyString>(addDynamicProperty("App::PropertyString", name.c_str(), 0, 0, Prop_ReadOnly | Prop_Hidden | Prop_NoPersist));
|
||||
stringProp = freecad_dynamic_cast<PropertyString>(addDynamicProperty("App::PropertyString", name.c_str(), nullptr, nullptr, Prop_ReadOnly | Prop_Hidden | Prop_NoPersist));
|
||||
}
|
||||
|
||||
propAddress[stringProp] = key;
|
||||
@@ -636,7 +636,7 @@ Property * Sheet::setObjectProperty(CellAddress key, Py::Object object)
|
||||
this->removeDynamicProperty(name.c_str());
|
||||
propAddress.erase(prop);
|
||||
}
|
||||
pyProp = freecad_dynamic_cast<PropertyPythonObject>(addDynamicProperty("App::PropertyPythonObject", name.c_str(), 0, 0, Prop_ReadOnly | Prop_Hidden | Prop_NoPersist));
|
||||
pyProp = freecad_dynamic_cast<PropertyPythonObject>(addDynamicProperty("App::PropertyPythonObject", name.c_str(), nullptr, nullptr, Prop_ReadOnly | Prop_Hidden | Prop_NoPersist));
|
||||
}
|
||||
|
||||
propAddress[pyProp] = key;
|
||||
@@ -672,7 +672,7 @@ void Sheet::updateProperty(CellAddress key)
|
||||
{
|
||||
Cell * cell = getCell(key);
|
||||
|
||||
if (cell != 0) {
|
||||
if (cell != nullptr) {
|
||||
std::unique_ptr<Expression> output;
|
||||
const Expression * input = cell->getExpression();
|
||||
|
||||
@@ -736,7 +736,7 @@ void Sheet::updateProperty(CellAddress key)
|
||||
Property *Sheet::getPropertyByName(const char* name) const
|
||||
{
|
||||
CellAddress addr = getCellAddress(name,true);
|
||||
Property *prop = 0;
|
||||
Property *prop = nullptr;
|
||||
if(addr.isValid())
|
||||
prop = getProperty(addr);
|
||||
if (prop)
|
||||
@@ -747,7 +747,7 @@ Property *Sheet::getPropertyByName(const char* name) const
|
||||
|
||||
Property *Sheet::getDynamicPropertyByName(const char* name) const {
|
||||
CellAddress addr = getCellAddress(name,true);
|
||||
Property *prop = 0;
|
||||
Property *prop = nullptr;
|
||||
if(addr.isValid())
|
||||
prop = getProperty(addr);
|
||||
if (prop)
|
||||
|
||||
@@ -108,7 +108,7 @@ public:
|
||||
unsigned getCellBindingBorder(App::CellAddress address) const;
|
||||
|
||||
PropertySheet::BindingType getCellBinding(App::Range &range,
|
||||
App::ExpressionPtr *pStart=0, App::ExpressionPtr *pEnd=0) const;
|
||||
App::ExpressionPtr *pStart=nullptr, App::ExpressionPtr *pEnd=nullptr) const;
|
||||
|
||||
void setCell(const char *address, const char *value);
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ void SheetObserver::slotChangedObject(const DocumentObject &Obj, const Property
|
||||
else {
|
||||
const char * name = Obj.getPropertyName(&Prop);
|
||||
|
||||
if (name == 0)
|
||||
if (name == nullptr)
|
||||
return;
|
||||
|
||||
if (isUpdating.find(name) != isUpdating.end())
|
||||
|
||||
@@ -64,7 +64,7 @@ PyObject* SheetPy::set(PyObject *args)
|
||||
|
||||
|
||||
if (!PyArg_ParseTuple(args, "ss:set", &address, &contents))
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
try {
|
||||
Sheet * sheet = getSheetPtr();
|
||||
@@ -83,7 +83,7 @@ PyObject* SheetPy::set(PyObject *args)
|
||||
}
|
||||
catch (const Base::Exception & e) {
|
||||
PyErr_SetString(PyExc_ValueError, e.what());
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Py_Return;
|
||||
@@ -92,10 +92,10 @@ PyObject* SheetPy::set(PyObject *args)
|
||||
PyObject* SheetPy::get(PyObject *args)
|
||||
{
|
||||
const char *address;
|
||||
const char *address2=0;
|
||||
const char *address2=nullptr;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "s|s:get", &address, &address2))
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
PY_TRY {
|
||||
if(address2) {
|
||||
@@ -113,7 +113,7 @@ PyObject* SheetPy::get(PyObject *args)
|
||||
if(!prop) {
|
||||
PyErr_Format(PyExc_ValueError, "Invalid address '%s' in range %s:%s",
|
||||
range.address().c_str(), address, address2);
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
tuple.setItem(i++,Py::Object(prop->getPyObject(),true));
|
||||
}while(range.next());
|
||||
@@ -123,10 +123,10 @@ PyObject* SheetPy::get(PyObject *args)
|
||||
|
||||
App::Property * prop = this->getSheetPtr()->getPropertyByName(address);
|
||||
|
||||
if (prop == 0) {
|
||||
if (prop == nullptr) {
|
||||
PyErr_Format(PyExc_ValueError,
|
||||
"Invalid cell address or property: %s",address);
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
return prop->getPyObject();
|
||||
}
|
||||
@@ -137,7 +137,7 @@ PyObject* SheetPy::getContents(PyObject *args)
|
||||
CellAddress address;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "s:getContents", &strAddress))
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
PY_TRY {
|
||||
try {
|
||||
@@ -151,7 +151,7 @@ PyObject* SheetPy::getContents(PyObject *args)
|
||||
}
|
||||
catch (const Base::Exception & e) {
|
||||
PyErr_SetString(PyExc_ValueError, e.what());
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::string contents;
|
||||
@@ -170,7 +170,7 @@ PyObject* SheetPy::clear(PyObject *args)
|
||||
int all = 1;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "s|p:clear", &strAddress, &all))
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
try {
|
||||
Range rangeIter(strAddress);
|
||||
@@ -180,7 +180,7 @@ PyObject* SheetPy::clear(PyObject *args)
|
||||
}
|
||||
catch (const Base::Exception & e) {
|
||||
PyErr_SetString(PyExc_ValueError, e.what());
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Py_Return;
|
||||
@@ -189,7 +189,7 @@ PyObject* SheetPy::clear(PyObject *args)
|
||||
PyObject* SheetPy::clearAll(PyObject *args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
this->getSheetPtr()->clearAll();
|
||||
Py_Return;
|
||||
@@ -203,7 +203,7 @@ PyObject* SheetPy::importFile(PyObject *args)
|
||||
const char * escapeChar = "\\";
|
||||
|
||||
if (!PyArg_ParseTuple(args, "s|sss:importFile", &filename, &delimiter, "eChar, &escapeChar))
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
if (getSheetPtr()->importFromFile(filename, delimiter[0], quoteChar[0], escapeChar[0]))
|
||||
return Py::new_reference_to( Py::Boolean(true) );
|
||||
@@ -219,7 +219,7 @@ PyObject* SheetPy::exportFile(PyObject *args)
|
||||
const char * escapeChar = "\\";
|
||||
|
||||
if (!PyArg_ParseTuple(args, "s|sss:exportFile", &filename, &delimiter, "eChar, &escapeChar))
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
if (getSheetPtr()->exportToFile(filename, delimiter[0], quoteChar[0], escapeChar[0]))
|
||||
return Py::new_reference_to( Py::Boolean(true) );
|
||||
@@ -232,7 +232,7 @@ PyObject* SheetPy::mergeCells(PyObject *args)
|
||||
const char * range;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "s:mergeCells", &range))
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
getSheetPtr()->mergeCells(Range(range));
|
||||
Py_Return;
|
||||
@@ -243,7 +243,7 @@ PyObject* SheetPy::splitCell(PyObject *args)
|
||||
const char * strAddress;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "s:splitCell", &strAddress))
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
CellAddress address;
|
||||
try {
|
||||
@@ -251,7 +251,7 @@ PyObject* SheetPy::splitCell(PyObject *args)
|
||||
}
|
||||
catch (const Base::Exception & e) {
|
||||
PyErr_SetString(PyExc_ValueError, e.what());
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
getSheetPtr()->splitCell(address);
|
||||
@@ -264,7 +264,7 @@ PyObject* SheetPy::insertColumns(PyObject *args)
|
||||
int count;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "si:insertColumns", &column, &count))
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
getSheetPtr()->insertColumns(decodeColumn(column), count);
|
||||
Py_Return;
|
||||
@@ -276,7 +276,7 @@ PyObject* SheetPy::removeColumns(PyObject *args)
|
||||
int count;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "si:removeColumns", &column, &count))
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
getSheetPtr()->removeColumns(decodeColumn(column), count);
|
||||
Py_Return;
|
||||
@@ -288,7 +288,7 @@ PyObject* SheetPy::insertRows(PyObject *args)
|
||||
int count;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "si:insertRows", &row, &count))
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
getSheetPtr()->insertRows(decodeRow(std::string(row)), count);
|
||||
Py_Return;
|
||||
@@ -300,7 +300,7 @@ PyObject* SheetPy::removeRows(PyObject *args)
|
||||
int count;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "si:removeRows", &row, &count))
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
getSheetPtr()->removeRows(decodeRow(std::string(row)), count);
|
||||
Py_Return;
|
||||
@@ -314,7 +314,7 @@ PyObject* SheetPy::setStyle(PyObject *args)
|
||||
const char * options = "replace";
|
||||
|
||||
if (!PyArg_ParseTuple(args, "sO|s:setStyle", &cell, &value, &options))
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
if (PySet_Check(value)) {
|
||||
PyObject * copy = PySet_New(value);
|
||||
@@ -329,7 +329,7 @@ PyObject* SheetPy::setStyle(PyObject *args)
|
||||
std::string error = std::string("type of the set need to be a string, not ") + item->ob_type->tp_name;
|
||||
PyErr_SetString(PyExc_TypeError, error.c_str());
|
||||
Py_DECREF(copy);
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
Py_DECREF(copy);
|
||||
@@ -347,7 +347,7 @@ PyObject* SheetPy::setStyle(PyObject *args)
|
||||
else {
|
||||
std::string error = std::string("style must be either set or string, not ") + value->ob_type->tp_name;
|
||||
PyErr_SetString(PyExc_TypeError, error.c_str());
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (strcmp(options, "replace") == 0) {
|
||||
@@ -421,7 +421,7 @@ PyObject* SheetPy::setStyle(PyObject *args)
|
||||
}
|
||||
else {
|
||||
PyErr_SetString(PyExc_ValueError, "Optional parameter must be either 'replace', 'add', 'remove', or 'invert'");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Py_Return;
|
||||
@@ -433,21 +433,21 @@ PyObject* SheetPy::getStyle(PyObject *args)
|
||||
CellAddress address;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "s:getStyle", &strAddress))
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
try {
|
||||
address = stringToAddress(strAddress);
|
||||
}
|
||||
catch (const Base::Exception & e) {
|
||||
PyErr_SetString(PyExc_ValueError, e.what());
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::set<std::string> style;
|
||||
const Cell * cell = getSheetPtr()->getCell(address);
|
||||
|
||||
if (cell && cell->getStyle(style)) {
|
||||
PyObject * s = PySet_New(NULL);
|
||||
PyObject * s = PySet_New(nullptr);
|
||||
|
||||
for (std::set<std::string>::const_iterator i = style.begin(); i != style.end(); ++i)
|
||||
PySet_Add(s, PyUnicode_FromString((*i).c_str()));
|
||||
@@ -466,7 +466,7 @@ PyObject* SheetPy::setDisplayUnit(PyObject *args)
|
||||
const char * value;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "ss:setDisplayUnit", &cell, &value))
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
try {
|
||||
Range rangeIter(cell);
|
||||
@@ -477,7 +477,7 @@ PyObject* SheetPy::setDisplayUnit(PyObject *args)
|
||||
}
|
||||
catch (const Base::Exception & e) {
|
||||
PyErr_SetString(PyExc_ValueError, e.what());
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Py_Return;
|
||||
@@ -490,7 +490,7 @@ PyObject* SheetPy::setAlias(PyObject *args)
|
||||
PyObject * value;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "sO:setAlias", &strAddress, &value))
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
try {
|
||||
address = stringToAddress(strAddress);
|
||||
@@ -505,7 +505,7 @@ PyObject* SheetPy::setAlias(PyObject *args)
|
||||
}
|
||||
catch (const Base::Exception & e) {
|
||||
PyErr_SetString(PyExc_ValueError, e.what());
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -514,7 +514,7 @@ PyObject* SheetPy::getAlias(PyObject *args)
|
||||
const char * strAddress;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "s:getAlias", &strAddress))
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
try {
|
||||
CellAddress address(strAddress);
|
||||
@@ -530,7 +530,7 @@ PyObject* SheetPy::getAlias(PyObject *args)
|
||||
}
|
||||
catch (const Base::Exception & e) {
|
||||
PyErr_SetString(PyExc_ValueError, e.what());
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -539,7 +539,7 @@ PyObject* SheetPy::getCellFromAlias(PyObject *args)
|
||||
const char * alias;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "s:getAlias", &alias))
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
try {
|
||||
std::string address = getSheetPtr()->getAddressFromAlias(alias);
|
||||
@@ -553,7 +553,7 @@ PyObject* SheetPy::getCellFromAlias(PyObject *args)
|
||||
}
|
||||
catch (const Base::Exception & e) {
|
||||
PyErr_SetString(PyExc_ValueError, e.what());
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -563,7 +563,7 @@ PyObject* SheetPy::getDisplayUnit(PyObject *args)
|
||||
CellAddress address;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "s:getDisplayUnit", &strAddress))
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
try {
|
||||
address = stringToAddress(strAddress);
|
||||
@@ -579,7 +579,7 @@ PyObject* SheetPy::getDisplayUnit(PyObject *args)
|
||||
}
|
||||
catch (const Base::Exception & e) {
|
||||
PyErr_SetString(PyExc_ValueError, e.what());
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -591,7 +591,7 @@ PyObject* SheetPy::setAlignment(PyObject *args)
|
||||
const char * options = "replace";
|
||||
|
||||
if (!PyArg_ParseTuple(args, "sO|s:setAlignment", &cell, &value, &options))
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
if (PySet_Check(value)) {
|
||||
// Argument is a set of strings
|
||||
@@ -607,7 +607,7 @@ PyObject* SheetPy::setAlignment(PyObject *args)
|
||||
std::string error = std::string("type of the key need to be a string, not") + item->ob_type->tp_name;
|
||||
PyErr_SetString(PyExc_TypeError, error.c_str());
|
||||
Py_DECREF(copy);
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -629,7 +629,7 @@ PyObject* SheetPy::setAlignment(PyObject *args)
|
||||
else {
|
||||
std::string error = std::string("style must be either set or string, not ") + value->ob_type->tp_name;
|
||||
PyErr_SetString(PyExc_TypeError, error.c_str());
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Set alignment depending on 'options' variable
|
||||
@@ -660,7 +660,7 @@ PyObject* SheetPy::setAlignment(PyObject *args)
|
||||
}
|
||||
else {
|
||||
PyErr_SetString(PyExc_ValueError, "Optional parameter must be either 'replace' or 'keep'");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
Py_Return;
|
||||
}
|
||||
@@ -671,21 +671,21 @@ PyObject* SheetPy::getAlignment(PyObject *args)
|
||||
CellAddress address;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "s:getAlignment", &strAddress))
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
try {
|
||||
address = stringToAddress(strAddress);
|
||||
}
|
||||
catch (const Base::Exception & e) {
|
||||
PyErr_SetString(PyExc_ValueError, e.what());
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
int alignment;
|
||||
const Cell * cell = getSheetPtr()->getCell(address);
|
||||
if (cell && cell->getAlignment(alignment)) {
|
||||
PyObject * s = PySet_New(NULL);
|
||||
PyObject * s = PySet_New(nullptr);
|
||||
|
||||
if (alignment & Cell::ALIGNMENT_LEFT)
|
||||
PySet_Add(s, PyUnicode_FromString("left"));
|
||||
@@ -745,7 +745,7 @@ PyObject* SheetPy::setForeground(PyObject *args)
|
||||
Color c;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "sO:setForeground", &range, &value))
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
decodeColor(value, c);
|
||||
|
||||
@@ -757,11 +757,11 @@ PyObject* SheetPy::setForeground(PyObject *args)
|
||||
}
|
||||
catch (const Base::TypeError & e) {
|
||||
PyErr_SetString(PyExc_TypeError, e.what());
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
catch (const Base::Exception & e) {
|
||||
PyErr_SetString(PyExc_ValueError, e.what());
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -771,14 +771,14 @@ PyObject* SheetPy::getForeground(PyObject *args)
|
||||
CellAddress address;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "s:getForeground", &strAddress))
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
try {
|
||||
address = stringToAddress(strAddress);
|
||||
}
|
||||
catch (const Base::Exception & e) {
|
||||
PyErr_SetString(PyExc_ValueError, e.what());
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Color c;
|
||||
@@ -807,7 +807,7 @@ PyObject* SheetPy::setBackground(PyObject *args)
|
||||
Color c;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "sO:setBackground", &strAddress, &value))
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
decodeColor(value, c);
|
||||
Range rangeIter(strAddress);
|
||||
@@ -819,11 +819,11 @@ PyObject* SheetPy::setBackground(PyObject *args)
|
||||
}
|
||||
catch (const Base::TypeError & e) {
|
||||
PyErr_SetString(PyExc_TypeError, e.what());
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
catch (const Base::Exception & e) {
|
||||
PyErr_SetString(PyExc_ValueError, e.what());
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -833,14 +833,14 @@ PyObject* SheetPy::getBackground(PyObject *args)
|
||||
CellAddress address;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "s:setStyle", &strAddress))
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
try {
|
||||
address = stringToAddress(strAddress);
|
||||
}
|
||||
catch (const Base::Exception & e) {
|
||||
PyErr_SetString(PyExc_ValueError, e.what());
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Color c;
|
||||
@@ -868,7 +868,7 @@ PyObject* SheetPy::setColumnWidth(PyObject *args)
|
||||
CellAddress address;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "si:setColumnWidth", &columnStr, &width))
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
try {
|
||||
std::string cellAddr = std::string(columnStr) + "1";
|
||||
@@ -879,7 +879,7 @@ PyObject* SheetPy::setColumnWidth(PyObject *args)
|
||||
}
|
||||
catch (const Base::Exception & e) {
|
||||
PyErr_SetString(PyExc_ValueError, e.what());
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -888,7 +888,7 @@ PyObject* SheetPy::getColumnWidth(PyObject *args)
|
||||
const char * columnStr;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "s:getColumnWidth", &columnStr))
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
try {
|
||||
CellAddress address(std::string(columnStr) + "1");
|
||||
@@ -897,7 +897,7 @@ PyObject* SheetPy::getColumnWidth(PyObject *args)
|
||||
}
|
||||
catch (const Base::Exception & e) {
|
||||
PyErr_SetString(PyExc_ValueError, e.what());
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -907,7 +907,7 @@ PyObject* SheetPy::setRowHeight(PyObject *args)
|
||||
int height;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "si:setRowHeight", &rowStr, &height))
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
try {
|
||||
CellAddress address("A" + std::string(rowStr));
|
||||
@@ -917,7 +917,7 @@ PyObject* SheetPy::setRowHeight(PyObject *args)
|
||||
}
|
||||
catch (const Base::Exception & e) {
|
||||
PyErr_SetString(PyExc_ValueError, e.what());
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -926,7 +926,7 @@ PyObject* SheetPy::getRowHeight(PyObject *args)
|
||||
const char * rowStr;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "s:getRowHeight", &rowStr))
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
try {
|
||||
CellAddress address("A" + std::string(rowStr));
|
||||
@@ -935,16 +935,16 @@ PyObject* SheetPy::getRowHeight(PyObject *args)
|
||||
}
|
||||
catch (const Base::Exception & e) {
|
||||
PyErr_SetString(PyExc_ValueError, e.what());
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
PyObject *SheetPy::touchCells(PyObject *args) {
|
||||
const char *address;
|
||||
const char *address2=0;
|
||||
const char *address2=nullptr;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "s|s:touchCells", &address, &address2))
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
PY_TRY {
|
||||
std::string a1 = getSheetPtr()->getAddressFromAlias(address);
|
||||
@@ -966,10 +966,10 @@ PyObject *SheetPy::touchCells(PyObject *args) {
|
||||
|
||||
PyObject *SheetPy::recomputeCells(PyObject *args) {
|
||||
const char *address;
|
||||
const char *address2=0;
|
||||
const char *address2=nullptr;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "s|s:touchCells", &address, &address2))
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
PY_TRY {
|
||||
std::string a1 = getSheetPtr()->getAddressFromAlias(address);
|
||||
@@ -993,7 +993,7 @@ PyObject *SheetPy::recomputeCells(PyObject *args) {
|
||||
|
||||
PyObject *SheetPy::getCustomAttributes(const char*) const
|
||||
{
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int SheetPy::setCustomAttributes(const char* , PyObject* )
|
||||
|
||||
@@ -77,7 +77,7 @@ private:
|
||||
Py::Object open(const Py::Tuple& args)
|
||||
{
|
||||
char* Name;
|
||||
const char* DocName=0;
|
||||
const char* DocName=nullptr;
|
||||
if (!PyArg_ParseTuple(args.ptr(), "et|s","utf-8",&Name,&DocName))
|
||||
throw Py::Exception();
|
||||
std::string EncodedName = std::string(Name);
|
||||
@@ -112,7 +112,7 @@ PyMOD_INIT_FUNC(SpreadsheetGui)
|
||||
{
|
||||
if (!Gui::Application::Instance) {
|
||||
PyErr_SetString(PyExc_ImportError, "Cannot load Gui module in console application.");
|
||||
PyMOD_Return(0);
|
||||
PyMOD_Return(nullptr);
|
||||
}
|
||||
|
||||
// instantiating the commands
|
||||
|
||||
@@ -37,7 +37,7 @@ class DlgBindSheet : public QDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit DlgBindSheet(Spreadsheet::Sheet *sheet, const std::vector<App::Range> &range, QWidget *parent = 0);
|
||||
explicit DlgBindSheet(Spreadsheet::Sheet *sheet, const std::vector<App::Range> &range, QWidget *parent = nullptr);
|
||||
~DlgBindSheet();
|
||||
|
||||
void accept();
|
||||
|
||||
@@ -40,7 +40,7 @@ class DlgSettingsImp : public Gui::Dialog::PreferencePage
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
DlgSettingsImp( QWidget* parent = 0 );
|
||||
DlgSettingsImp( QWidget* parent = nullptr );
|
||||
~DlgSettingsImp();
|
||||
|
||||
protected:
|
||||
|
||||
@@ -150,7 +150,7 @@ App::Property *DlgSheetConf::prepare(CellAddress &from, CellAddress &to,
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void DlgSheetConf::accept()
|
||||
|
||||
@@ -37,7 +37,7 @@ class DlgSheetConf : public QDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit DlgSheetConf(Spreadsheet::Sheet *sheet, App::Range range, QWidget *parent = 0);
|
||||
explicit DlgSheetConf(Spreadsheet::Sheet *sheet, App::Range range, QWidget *parent = nullptr);
|
||||
~DlgSheetConf();
|
||||
|
||||
void accept();
|
||||
|
||||
@@ -33,7 +33,7 @@ class LineEdit : public Gui::ExpressionLineEdit
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit LineEdit(QWidget *parent = 0);
|
||||
explicit LineEdit(QWidget *parent = nullptr);
|
||||
|
||||
bool event(QEvent *event);
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ PropertiesDialog::PropertiesDialog(Sheet *_sheet, const std::vector<Range> &_ran
|
||||
|
||||
Cell * cell = sheet->getNewCell(*range);
|
||||
|
||||
assert(cell != 0);
|
||||
assert(cell != nullptr);
|
||||
|
||||
(void)cell->getForeground(foregroundColor);
|
||||
(void)cell->getBackground(backgroundColor);
|
||||
|
||||
@@ -37,7 +37,7 @@ class PropertiesDialog : public QDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit PropertiesDialog(Spreadsheet::Sheet *_sheet, const std::vector<App::Range> & _ranges, QWidget *parent = 0);
|
||||
explicit PropertiesDialog(Spreadsheet::Sheet *_sheet, const std::vector<App::Range> & _ranges, QWidget *parent = nullptr);
|
||||
~PropertiesDialog();
|
||||
|
||||
void apply();
|
||||
|
||||
@@ -81,12 +81,12 @@ int SheetModel::columnCount(const QModelIndex &parent) const
|
||||
|
||||
QVariant SheetModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
static const Cell * emptyCell = new Cell(CellAddress(0, 0), 0);
|
||||
static const Cell * emptyCell = new Cell(CellAddress(0, 0), nullptr);
|
||||
int row = index.row();
|
||||
int col = index.column();
|
||||
const Cell * cell = sheet->getCell(CellAddress(row, col));
|
||||
|
||||
if (cell == 0)
|
||||
if (cell == nullptr)
|
||||
cell = emptyCell;
|
||||
|
||||
//#define DEBUG_DEPS
|
||||
|
||||
@@ -37,7 +37,7 @@ class SheetModel : public QAbstractTableModel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit SheetModel(Spreadsheet::Sheet * _sheet, QObject *parent = 0);
|
||||
explicit SheetModel(Spreadsheet::Sheet * _sheet, QObject *parent = nullptr);
|
||||
~SheetModel();
|
||||
|
||||
SheetModel(QObject *parent);
|
||||
|
||||
@@ -109,7 +109,7 @@ static std::pair<int, int> selectedMinMaxColumns(QModelIndexList list)
|
||||
|
||||
SheetTableView::SheetTableView(QWidget *parent)
|
||||
: QTableView(parent)
|
||||
, sheet(0)
|
||||
, sheet(nullptr)
|
||||
, tabCounter(0)
|
||||
{
|
||||
setHorizontalHeader(new SheetViewHeader(this,Qt::Horizontal));
|
||||
@@ -276,7 +276,7 @@ std::vector<Range> SheetTableView::selectedRanges() const
|
||||
|
||||
void SheetTableView::insertRows()
|
||||
{
|
||||
assert(sheet != 0);
|
||||
assert(sheet != nullptr);
|
||||
|
||||
QModelIndexList rows = selectionModel()->selectedRows();
|
||||
std::vector<int> sortedRows;
|
||||
@@ -313,7 +313,7 @@ void SheetTableView::insertRows()
|
||||
|
||||
void SheetTableView::insertRowsAfter()
|
||||
{
|
||||
assert(sheet != 0);
|
||||
assert(sheet != nullptr);
|
||||
const auto rows = selectionModel()->selectedRows();
|
||||
const auto & [min, max] = selectedMinMaxRows(rows);
|
||||
assert(max - min == rows.size() - 1);
|
||||
@@ -327,7 +327,7 @@ void SheetTableView::insertRowsAfter()
|
||||
|
||||
void SheetTableView::removeRows()
|
||||
{
|
||||
assert(sheet != 0);
|
||||
assert(sheet != nullptr);
|
||||
|
||||
QModelIndexList rows = selectionModel()->selectedRows();
|
||||
std::vector<int> sortedRows;
|
||||
@@ -348,7 +348,7 @@ void SheetTableView::removeRows()
|
||||
|
||||
void SheetTableView::insertColumns()
|
||||
{
|
||||
assert(sheet != 0);
|
||||
assert(sheet != nullptr);
|
||||
|
||||
QModelIndexList cols = selectionModel()->selectedColumns();
|
||||
std::vector<int> sortedColumns;
|
||||
@@ -386,7 +386,7 @@ void SheetTableView::insertColumns()
|
||||
|
||||
void SheetTableView::insertColumnsAfter()
|
||||
{
|
||||
assert(sheet != 0);
|
||||
assert(sheet != nullptr);
|
||||
const auto columns = selectionModel()->selectedColumns();
|
||||
const auto& [min, max] = selectedMinMaxColumns(columns);
|
||||
assert(max - min == columns.size() - 1);
|
||||
@@ -400,7 +400,7 @@ void SheetTableView::insertColumnsAfter()
|
||||
|
||||
void SheetTableView::removeColumns()
|
||||
{
|
||||
assert(sheet != 0);
|
||||
assert(sheet != nullptr);
|
||||
|
||||
QModelIndexList cols = selectionModel()->selectedColumns();
|
||||
std::vector<int> sortedColumns;
|
||||
@@ -678,7 +678,7 @@ void SheetTableView::pasteClipboard()
|
||||
}else{
|
||||
QByteArray res = mimeData->data(_SheetMime);
|
||||
Base::ByteArrayIStreambuf buf(res);
|
||||
std::istream in(0);
|
||||
std::istream in(nullptr);
|
||||
in.rdbuf(&buf);
|
||||
Base::XMLReader reader("<memory>", in);
|
||||
sheet->getCells()->pasteCells(reader,range);
|
||||
|
||||
@@ -52,7 +52,7 @@ class SheetTableView : public QTableView
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit SheetTableView(QWidget *parent = 0);
|
||||
explicit SheetTableView(QWidget *parent = nullptr);
|
||||
~SheetTableView();
|
||||
|
||||
void edit(const QModelIndex &index);
|
||||
|
||||
@@ -56,7 +56,7 @@ QWidget *SpreadsheetDelegate::createEditor(QWidget *parent,
|
||||
App::Range range(addr,addr);
|
||||
if(sheet && sheet->getCellBinding(range)) {
|
||||
FC_ERR("Bound cell " << addr.toString() << " cannot be edited");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
SpreadsheetGui::LineEdit *editor = new SpreadsheetGui::LineEdit(parent);
|
||||
|
||||
@@ -37,7 +37,7 @@ class SpreadsheetDelegate : public QStyledItemDelegate
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit SpreadsheetDelegate(Spreadsheet::Sheet * sheet, QWidget *parent = 0);
|
||||
explicit SpreadsheetDelegate(Spreadsheet::Sheet * sheet, QWidget *parent = nullptr);
|
||||
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &,
|
||||
const QModelIndex &index) const;
|
||||
void setEditorData(QWidget *editor, const QModelIndex &index) const;
|
||||
|
||||
@@ -153,7 +153,7 @@ void ViewProviderSheet::beforeDelete()
|
||||
if(!view)
|
||||
return;
|
||||
if(view==Gui::getMainWindow()->activeWindow())
|
||||
getDocument()->setActiveView(0,Gui::View3DInventor::getClassTypeId());
|
||||
getDocument()->setActiveView(nullptr,Gui::View3DInventor::getClassTypeId());
|
||||
Gui::getMainWindow()->removeWindow(view);
|
||||
}
|
||||
|
||||
|
||||
@@ -171,7 +171,7 @@ class ColorPickerItem : public QFrame
|
||||
|
||||
public:
|
||||
ColorPickerItem(const QColor &color = Qt::white, const QString &text = QString(),
|
||||
QWidget *parent = 0);
|
||||
QWidget *parent = nullptr);
|
||||
~ColorPickerItem();
|
||||
|
||||
QColor color() const;
|
||||
@@ -207,7 +207,7 @@ class ColorPickerPopup : public QFrame
|
||||
|
||||
public:
|
||||
ColorPickerPopup(int width, bool withColorDialog,
|
||||
QWidget *parent = 0);
|
||||
QWidget *parent = nullptr);
|
||||
~ColorPickerPopup();
|
||||
|
||||
void insertColor(const QColor &col, const QString &text, int index);
|
||||
@@ -271,7 +271,7 @@ private:
|
||||
*/
|
||||
QtColorPicker::QtColorPicker(QWidget *parent,
|
||||
int cols, bool enableColorDialog)
|
||||
: QPushButton(parent), popup(0), withColorDialog(enableColorDialog)
|
||||
: QPushButton(parent), popup(nullptr), withColorDialog(enableColorDialog)
|
||||
{
|
||||
setFocusPolicy(Qt::StrongFocus);
|
||||
setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
|
||||
@@ -562,11 +562,11 @@ ColorPickerPopup::ColorPickerPopup(int width, bool withColorDialog,
|
||||
moreButton->setFrameRect(QRect(2, 2, 20, 17));
|
||||
connect(moreButton, SIGNAL(clicked()), SLOT(getColorFromDialog()));
|
||||
} else {
|
||||
moreButton = 0;
|
||||
moreButton = nullptr;
|
||||
}
|
||||
|
||||
eventLoop = 0;
|
||||
grid = 0;
|
||||
eventLoop = nullptr;
|
||||
grid = nullptr;
|
||||
regenerateGrid();
|
||||
}
|
||||
|
||||
@@ -593,7 +593,7 @@ ColorPickerItem *ColorPickerPopup::find(const QColor &col) const
|
||||
return items.at(i);
|
||||
}
|
||||
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/*! \internal
|
||||
@@ -659,7 +659,7 @@ void ColorPickerPopup::exec()
|
||||
QEventLoop e;
|
||||
eventLoop = &e;
|
||||
(void) e.exec();
|
||||
eventLoop = 0;
|
||||
eventLoop = nullptr;
|
||||
}
|
||||
|
||||
/*! \internal
|
||||
@@ -669,7 +669,7 @@ void ColorPickerPopup::updateSelected()
|
||||
{
|
||||
QLayoutItem *layoutItem;
|
||||
int i = 0;
|
||||
while ((layoutItem = grid->itemAt(i)) != 0) {
|
||||
while ((layoutItem = grid->itemAt(i)) != nullptr) {
|
||||
QWidget *w = layoutItem->widget();
|
||||
if (w && w->inherits("ColorPickerItem")) {
|
||||
ColorPickerItem *litem = reinterpret_cast<ColorPickerItem *>(layoutItem->widget());
|
||||
@@ -755,7 +755,7 @@ void ColorPickerPopup::keyPressEvent(QKeyEvent *e)
|
||||
|
||||
QLayoutItem *layoutItem;
|
||||
int i = 0;
|
||||
while ((layoutItem = grid->itemAt(i)) != 0) {
|
||||
while ((layoutItem = grid->itemAt(i)) != nullptr) {
|
||||
QWidget *w = layoutItem->widget();
|
||||
if (w && w->inherits("ColorPickerItem")) {
|
||||
ColorPickerItem *litem
|
||||
@@ -775,7 +775,7 @@ void ColorPickerPopup::keyPressEvent(QKeyEvent *e)
|
||||
|
||||
QLayoutItem *layoutItem;
|
||||
int i = 0;
|
||||
while ((layoutItem = grid->itemAt(i)) != 0) {
|
||||
while ((layoutItem = grid->itemAt(i)) != nullptr) {
|
||||
QWidget *w = layoutItem->widget();
|
||||
if (w && w->inherits("ColorPickerItem")) {
|
||||
ColorPickerItem *litem
|
||||
@@ -904,9 +904,9 @@ void ColorPickerPopup::getColorFromDialog()
|
||||
//QRgb rgb = QColorDialog::getRgba(lastSel.rgba(), &ok, parentWidget());
|
||||
QColor col;
|
||||
if (Gui::DialogOptions::dontUseNativeColorDialog()){
|
||||
col = QColorDialog::getColor(lastSel, parentWidget(), 0, QColorDialog::ShowAlphaChannel|QColorDialog::DontUseNativeDialog);
|
||||
col = QColorDialog::getColor(lastSel, parentWidget(), nullptr, QColorDialog::ShowAlphaChannel|QColorDialog::DontUseNativeDialog);
|
||||
} else {
|
||||
col = QColorDialog::getColor(lastSel, parentWidget(), 0, QColorDialog::ShowAlphaChannel);
|
||||
col = QColorDialog::getColor(lastSel, parentWidget(), nullptr, QColorDialog::ShowAlphaChannel);
|
||||
}
|
||||
if (!col.isValid())
|
||||
return;
|
||||
|
||||
@@ -79,7 +79,7 @@ class QT_QTCOLORPICKER_EXPORT QtColorPicker : public QPushButton
|
||||
Q_PROPERTY(bool colorDialog READ colorDialogEnabled WRITE setColorDialogEnabled)
|
||||
|
||||
public:
|
||||
QtColorPicker(QWidget *parent = 0,
|
||||
QtColorPicker(QWidget *parent = nullptr,
|
||||
int columns = -1, bool enableColorDialog = true);
|
||||
|
||||
~QtColorPicker();
|
||||
|
||||
Reference in New Issue
Block a user