init repo
This commit is contained in:
48
ActiveX/Common/ASCDocxFormat/Source/XML/Exception/Base.cpp
Normal file
48
ActiveX/Common/ASCDocxFormat/Source/XML/Exception/Base.cpp
Normal file
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled_xml.h"
|
||||
|
||||
|
||||
#include "Base.h"
|
||||
|
||||
|
||||
namespace XML
|
||||
{
|
||||
namespace Exception
|
||||
{
|
||||
Base::Base(const std::string& message)
|
||||
: log_invalid_argument(message)
|
||||
{
|
||||
}
|
||||
}
|
||||
} // namespace XML
|
||||
51
ActiveX/Common/ASCDocxFormat/Source/XML/Exception/Base.h
Normal file
51
ActiveX/Common/ASCDocxFormat/Source/XML/Exception/Base.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef XML_EXCEPTION_BASE_INCLUDE_H_
|
||||
#define XML_EXCEPTION_BASE_INCLUDE_H_
|
||||
|
||||
#include "Exception/log_invalid_argument.h"
|
||||
#include <string>
|
||||
|
||||
namespace XML
|
||||
{
|
||||
namespace Exception
|
||||
{
|
||||
class Base : public log_invalid_argument
|
||||
{
|
||||
public:
|
||||
Base(const std::string& message);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // XML_EXCEPTION_BASE_INCLUDE_H_
|
||||
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled_xml.h"
|
||||
|
||||
|
||||
#include "Declaration.h"
|
||||
|
||||
|
||||
namespace XML
|
||||
{
|
||||
namespace Exception
|
||||
{
|
||||
Declaration::Declaration(const std::string& message)
|
||||
: Base(message)
|
||||
{
|
||||
}
|
||||
}
|
||||
} // namespace XML
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef XML_EXCEPTION_DECLARATION_INCLUDE_H_
|
||||
#define XML_EXCEPTION_DECLARATION_INCLUDE_H_
|
||||
|
||||
#include "Base.h"
|
||||
|
||||
|
||||
namespace XML
|
||||
{
|
||||
namespace Exception
|
||||
{
|
||||
class Declaration : public Base
|
||||
{
|
||||
public:
|
||||
Declaration(const std::string& message);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // XML_EXCEPTION_DECLARATION_INCLUDE_H_
|
||||
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled_xml.h"
|
||||
|
||||
|
||||
#include "Namespace.h"
|
||||
|
||||
|
||||
namespace XML
|
||||
{
|
||||
namespace Exception
|
||||
{
|
||||
Namespace::Namespace(const std::string& message)
|
||||
: Base(message)
|
||||
{
|
||||
}
|
||||
}
|
||||
} // namespace XML
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef XML_EXCEPTION_NAMESPACE_INCLUDE_H_
|
||||
#define XML_EXCEPTION_NAMESPACE_INCLUDE_H_
|
||||
|
||||
#include "Base.h"
|
||||
|
||||
|
||||
namespace XML
|
||||
{
|
||||
namespace Exception
|
||||
{
|
||||
class Namespace : public Base
|
||||
{
|
||||
public:
|
||||
Namespace(const std::string& message);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // XML_EXCEPTION_NAMESPACE_INCLUDE_H_
|
||||
48
ActiveX/Common/ASCDocxFormat/Source/XML/Exception/Parse.cpp
Normal file
48
ActiveX/Common/ASCDocxFormat/Source/XML/Exception/Parse.cpp
Normal file
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled_xml.h"
|
||||
|
||||
|
||||
#include "Parse.h"
|
||||
|
||||
|
||||
namespace XML
|
||||
{
|
||||
namespace Exception
|
||||
{
|
||||
Parse::Parse(const std::string& message)
|
||||
: Base(message)
|
||||
{
|
||||
}
|
||||
}
|
||||
} // namespace XML
|
||||
51
ActiveX/Common/ASCDocxFormat/Source/XML/Exception/Parse.h
Normal file
51
ActiveX/Common/ASCDocxFormat/Source/XML/Exception/Parse.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef XML_EXCEPTION_PARSE_INCLUDE_H_
|
||||
#define XML_EXCEPTION_PARSE_INCLUDE_H_
|
||||
|
||||
#include "Base.h"
|
||||
|
||||
|
||||
namespace XML
|
||||
{
|
||||
namespace Exception
|
||||
{
|
||||
class Parse : public Base
|
||||
{
|
||||
public:
|
||||
Parse(const std::string& message);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // XML_EXCEPTION_PARSE_INCLUDE_H_
|
||||
327
ActiveX/Common/ASCDocxFormat/Source/XML/Extension/Fill.h
Normal file
327
ActiveX/Common/ASCDocxFormat/Source/XML/Extension/Fill.h
Normal file
@@ -0,0 +1,327 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef XML_FILL_INCLUDE_H_
|
||||
#define XML_FILL_INCLUDE_H_
|
||||
|
||||
#include "property.h"
|
||||
#include "./../XElement.h"
|
||||
#include "./../Private/XElementContainer.h"
|
||||
|
||||
namespace XML
|
||||
{
|
||||
template<class T> void Fill(T& container, const XML::XElement& element)
|
||||
{
|
||||
for (Private::XElementContainer::const_iterator i = element.Elements.begin(); i != element.Elements.end(); ++i)
|
||||
{
|
||||
container.push_back(T::value_type(XElement(*i)));
|
||||
container.back().this_is_not_xobject_class();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class T> void Fill(property<T>& container, const XML::XElement& element)
|
||||
{
|
||||
for (Private::XElementContainer::const_iterator i = element.Elements.begin(); i != element.Elements.end(); ++i)
|
||||
{
|
||||
container->push_back(T::value_type(XElement(*i)));
|
||||
container->back().this_is_not_xobject_class();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class T> void Fill(T& container, const XML::XElement& element, const std::string& name)
|
||||
{
|
||||
for (Private::XElementContainer::const_iterator i = element.Elements.begin(); i != element.Elements.end(); ++i)
|
||||
{
|
||||
if (XElement(*i)->XName == name)
|
||||
{
|
||||
container.push_back(T::value_type(XElement(*i)));
|
||||
container.back().this_is_not_xobject_class();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class T> void Fill(property<T>& container, const XML::XElement& element, const std::string& name)
|
||||
{
|
||||
for (Private::XElementContainer::const_iterator i = element.Elements.begin(); i != element.Elements.end(); ++i)
|
||||
{
|
||||
if (XElement(*i)->XName == name)
|
||||
{
|
||||
container->push_back(T::value_type(XElement(*i)));
|
||||
container->back().this_is_not_xobject_class();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class T> void Fill(T& container, const XML::XElement& element, const std::string& name1, const std::string& name2)
|
||||
{
|
||||
for (Private::XElementContainer::const_iterator i = element.Elements.begin(); i != element.Elements.end(); ++i)
|
||||
{
|
||||
const std::string name = XElement(*i)->XName->Name;
|
||||
if (name == name1 || name == name2)
|
||||
{
|
||||
container.push_back(T::value_type(XElement(*i)));
|
||||
container.back().this_is_not_xobject_class();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class T> void Fill(property<T>& container, const XML::XElement& element, const std::string& name1, const std::string& name2)
|
||||
{
|
||||
for (Private::XElementContainer::const_iterator i = element.Elements.begin(); i != element.Elements.end(); ++i)
|
||||
{
|
||||
const std::string name = XElement(*i)->XName->Name;
|
||||
if (name == name1 || name == name2)
|
||||
{
|
||||
container->push_back(T::value_type(XElement(*i)));
|
||||
container->back().this_is_not_xobject_class();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class T> void Fill(T& container, const XML::XElement& element, const std::string& name1, const std::string& name2, const std::string& name3)
|
||||
{
|
||||
for (Private::XElementContainer::const_iterator i = element.Elements.begin(); i != element.Elements.end(); ++i)
|
||||
{
|
||||
const std::string name = XElement(*i)->XName->Name;
|
||||
if (name == name1 || name == name2 || name == name3)
|
||||
{
|
||||
container.push_back(T::value_type(XElement(*i)));
|
||||
container.back().this_is_not_xobject_class();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class T> void Fill(property<T>& container, const XML::XElement& element, const std::string& name1, const std::string& name2, const std::string& name3)
|
||||
{
|
||||
for (Private::XElementContainer::const_iterator i = element.Elements.begin(); i != element.Elements.end(); ++i)
|
||||
{
|
||||
const std::string name = XElement(*i)->XName->Name;
|
||||
if (name == name1 || name == name2 || name == name3)
|
||||
{
|
||||
container->push_back(T::value_type(XElement(*i)));
|
||||
container->back().this_is_not_xobject_class();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template<class T> void Fill(T& container, const XML::XElement& element, const std::string& name1, const std::string& name2, const std::string& name3, const std::string& name4)
|
||||
{
|
||||
for (Private::XElementContainer::const_iterator i = element.Elements.begin(); i != element.Elements.end(); ++i)
|
||||
{
|
||||
const std::string name = XElement(*i)->XName->Name;
|
||||
if (name == name1 || name == name2 || name == name3 || name == name4)
|
||||
{
|
||||
container.push_back(T::value_type(XElement(*i)));
|
||||
container.back().this_is_not_xobject_class();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template<class T> void Fill(property<T>& container, const XML::XElement& element, const std::string& name1, const std::string& name2, const std::string& name3, const std::string& name4)
|
||||
{
|
||||
for (Private::XElementContainer::const_iterator i = element.Elements.begin(); i != element.Elements.end(); ++i)
|
||||
{
|
||||
const std::string name = XElement(*i)->XName->Name;
|
||||
if (name == name1 || name == name2 || name == name3 || name == name4)
|
||||
{
|
||||
container->push_back(T::value_type(XElement(*i)));
|
||||
container->back().this_is_not_xobject_class();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template<class T> void Fill(T& container, const XML::XElement& element, const std::string& name1, const std::string& name2, const std::string& name3, const std::string& name4, const std::string& name5)
|
||||
{
|
||||
for (Private::XElementContainer::const_iterator i = element.Elements.begin(); i != element.Elements.end(); ++i)
|
||||
{
|
||||
const std::string name = XElement(*i)->XName->Name;
|
||||
if (name == name1 || name == name2 || name == name3 || name == name4 || name == name5)
|
||||
{
|
||||
container.push_back(T::value_type(XElement(*i)));
|
||||
container.back().this_is_not_xobject_class();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template<class T> void Fill(property<T>& container, const XML::XElement& element, const std::string& name1, const std::string& name2, const std::string& name3, const std::string& name4, const std::string& name5)
|
||||
{
|
||||
for (Private::XElementContainer::const_iterator i = element.Elements.begin(); i != element.Elements.end(); ++i)
|
||||
{
|
||||
const std::string name = XElement(*i)->XName->Name;
|
||||
if (name == name1 || name == name2 || name == name3 || name == name4 || name == name5)
|
||||
{
|
||||
container->push_back(T::value_type(XElement(*i)));
|
||||
container->back().this_is_not_xobject_class();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template<class T> void Fill(T& container, const XML::XElement& element, const std::string& name1, const std::string& name2, const std::string& name3, const std::string& name4, const std::string& name5, const std::string& name6)
|
||||
{
|
||||
for (Private::XElementContainer::const_iterator i = element.Elements.begin(); i != element.Elements.end(); ++i)
|
||||
{
|
||||
const std::string name = XElement(*i)->XName->Name;
|
||||
if (name == name1 || name == name2 || name == name3 || name == name4 || name == name5 || name == name6)
|
||||
{
|
||||
container.push_back(T::value_type(XElement(*i)));
|
||||
container.back().this_is_not_xobject_class();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template<class T> void Fill(property<T>& container, const XML::XElement& element, const std::string& name1, const std::string& name2, const std::string& name3, const std::string& name4, const std::string& name5, const std::string& name6)
|
||||
{
|
||||
for (Private::XElementContainer::const_iterator i = element.Elements.begin(); i != element.Elements.end(); ++i)
|
||||
{
|
||||
const std::string name = XElement(*i)->XName->Name;
|
||||
if (name == name1 || name == name2 || name == name3 || name == name4 || name == name5 || name == name6)
|
||||
{
|
||||
container->push_back(T::value_type(XElement(*i)));
|
||||
container->back().this_is_not_xobject_class();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template<class T> void Fill(T& container, const XML::XElement& element, const std::string& name1, const std::string& name2, const std::string& name3, const std::string& name4, const std::string& name5, const std::string& name6, const std::string& name7)
|
||||
{
|
||||
for (Private::XElementContainer::const_iterator i = element.Elements.begin(); i != element.Elements.end(); ++i)
|
||||
{
|
||||
const std::string name = XElement(*i)->XName->Name;
|
||||
if (name == name1 || name == name2 || name == name3 || name == name4 || name == name5 || name == name6 || name == name7)
|
||||
{
|
||||
container.push_back(T::value_type(XElement(*i)));
|
||||
container.back().this_is_not_xobject_class();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template<class T> void Fill(property<T>& container, const XML::XElement& element, const std::string& name1, const std::string& name2, const std::string& name3, const std::string& name4, const std::string& name5, const std::string& name6, const std::string& name7)
|
||||
{
|
||||
for (Private::XElementContainer::const_iterator i = element.Elements.begin(); i != element.Elements.end(); ++i)
|
||||
{
|
||||
const std::string name = XElement(*i)->XName->Name;
|
||||
if (name == name1 || name == name2 || name == name3 || name == name4 || name == name5 || name == name6 || name == name7)
|
||||
{
|
||||
container->push_back(T::value_type(XElement(*i)));
|
||||
container->back().this_is_not_xobject_class();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template<class T> void Fill(T& container, const XML::XElement& element, const std::string& name1, const std::string& name2, const std::string& name3, const std::string& name4, const std::string& name5, const std::string& name6, const std::string& name7, const std::string& name8)
|
||||
{
|
||||
for (Private::XElementContainer::const_iterator i = element.Elements.begin(); i != element.Elements.end(); ++i)
|
||||
{
|
||||
const std::string name = XElement(*i)->XName->Name;
|
||||
if (name == name1 || name == name2 || name == name3 || name == name4 || name == name5 || name == name6 || name == name7 || name == name8)
|
||||
{
|
||||
container.push_back(T::value_type(XElement(*i)));
|
||||
container.back().this_is_not_xobject_class();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template<class T> void Fill(property<T>& container, const XML::XElement& element, const std::string& name1, const std::string& name2, const std::string& name3, const std::string& name4, const std::string& name5, const std::string& name6, const std::string& name7, const std::string& name8)
|
||||
{
|
||||
for (Private::XElementContainer::const_iterator i = element.Elements.begin(); i != element.Elements.end(); ++i)
|
||||
{
|
||||
const std::string name = XElement(*i)->XName->Name;
|
||||
if (name == name1 || name == name2 || name == name3 || name == name4 || name == name5 || name == name6 || name == name7 || name == name8)
|
||||
{
|
||||
container->push_back(T::value_type(XElement(*i)));
|
||||
container->back().this_is_not_xobject_class();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template<class T> void Fill(T& container, const XML::XElement& element, const std::string& name1, const std::string& name2, const std::string& name3, const std::string& name4, const std::string& name5, const std::string& name6, const std::string& name7, const std::string& name8, const std::string& name9)
|
||||
{
|
||||
for (Private::XElementContainer::const_iterator i = element.Elements.begin(); i != element.Elements.end(); ++i)
|
||||
{
|
||||
const std::string name = XElement(*i)->XName->Name;
|
||||
if (name == name1 || name == name2 || name == name3 || name == name4 || name == name5 || name == name6 || name == name7 || name == name8 || name == name9)
|
||||
{
|
||||
container.push_back(T::value_type(XElement(*i)));
|
||||
container.back().this_is_not_xobject_class();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template<class T> void Fill(property<T>& container, const XML::XElement& element, const std::string& name1, const std::string& name2, const std::string& name3, const std::string& name4, const std::string& name5, const std::string& name6, const std::string& name7, const std::string& name8, const std::string& name9)
|
||||
{
|
||||
for (Private::XElementContainer::const_iterator i = element.Elements.begin(); i != element.Elements.end(); ++i)
|
||||
{
|
||||
const std::string name = XElement(*i)->XName->Name;
|
||||
if (name == name1 || name == name2 || name == name3 || name == name4 || name == name5 || name == name6 || name == name7 || name == name8 || name == name9)
|
||||
{
|
||||
container->push_back(T::value_type(XElement(*i)));
|
||||
container->back().this_is_not_xobject_class();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template<class T> void Fill(T& container, const XML::XElement& element, const std::string& name1, const std::string& name2, const std::string& name3, const std::string& name4, const std::string& name5, const std::string& name6, const std::string& name7, const std::string& name8, const std::string& name9, const std::string& name10)
|
||||
{
|
||||
for (Private::XElementContainer::const_iterator i = element.Elements.begin(); i != element.Elements.end(); ++i)
|
||||
{
|
||||
const std::string name = XElement(*i)->XName->Name;
|
||||
if (name == name1 || name == name2 || name == name3 || name == name4 || name == name5 || name == name6 || name == name7 || name == name8 || name == name9 || name == name10)
|
||||
{
|
||||
container.push_back(T::value_type(XElement(*i)));
|
||||
container.back().this_is_not_xobject_class();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template<class T> void Fill(property<T>& container, const XML::XElement& element, const std::string& name1, const std::string& name2, const std::string& name3, const std::string& name4, const std::string& name5, const std::string& name6, const std::string& name7, const std::string& name8, const std::string& name9, const std::string& name10)
|
||||
{
|
||||
for (Private::XElementContainer::const_iterator i = element.Elements.begin(); i != element.Elements.end(); ++i)
|
||||
{
|
||||
const std::string name = XElement(*i)->XName->Name;
|
||||
if (name == name1 || name == name2 || name == name3 || name == name4 || name == name5 || name == name6 || name == name7 || name == name8 || name == name9 || name == name10)
|
||||
{
|
||||
container->push_back(T::value_type(XElement(*i)));
|
||||
container->back().this_is_not_xobject_class();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif // XML_FILL_INCLUDE_H_
|
||||
55
ActiveX/Common/ASCDocxFormat/Source/XML/Limit/Encoding.cpp
Normal file
55
ActiveX/Common/ASCDocxFormat/Source/XML/Limit/Encoding.cpp
Normal file
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled_xml.h"
|
||||
|
||||
|
||||
#include "Encoding.h"
|
||||
#include "./../Exception/Declaration.h"
|
||||
|
||||
|
||||
namespace XML
|
||||
{
|
||||
namespace Limit
|
||||
{
|
||||
Encoding::Encoding()
|
||||
{
|
||||
add("UTF-8");
|
||||
add("utf-8");
|
||||
}
|
||||
|
||||
const std::string Encoding::no_find() const
|
||||
{
|
||||
throw Exception::Declaration("declaration encoding error");
|
||||
}
|
||||
}
|
||||
} // namespace XML
|
||||
53
ActiveX/Common/ASCDocxFormat/Source/XML/Limit/Encoding.h
Normal file
53
ActiveX/Common/ASCDocxFormat/Source/XML/Limit/Encoding.h
Normal file
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef XML_LIMIT_ENCODING_INCLUDE_H_
|
||||
#define XML_LIMIT_ENCODING_INCLUDE_H_
|
||||
|
||||
#include <string>
|
||||
#include "setter.h"
|
||||
|
||||
|
||||
namespace XML
|
||||
{
|
||||
namespace Limit
|
||||
{
|
||||
class Encoding : public setter::from<std::string>
|
||||
{
|
||||
public:
|
||||
Encoding();
|
||||
const std::string no_find() const;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // XML_LIMIT_ENCODING_INCLUDE_H_
|
||||
55
ActiveX/Common/ASCDocxFormat/Source/XML/Limit/Standalone.cpp
Normal file
55
ActiveX/Common/ASCDocxFormat/Source/XML/Limit/Standalone.cpp
Normal file
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled_xml.h"
|
||||
|
||||
|
||||
#include "Standalone.h"
|
||||
#include "./../Exception/Declaration.h"
|
||||
|
||||
|
||||
namespace XML
|
||||
{
|
||||
namespace Limit
|
||||
{
|
||||
Standalone::Standalone()
|
||||
{
|
||||
add("yes");
|
||||
add("no");
|
||||
}
|
||||
|
||||
const std::string Standalone::no_find() const
|
||||
{
|
||||
throw Exception::Declaration("declaration standalone error");
|
||||
}
|
||||
}
|
||||
} // namespace XML
|
||||
53
ActiveX/Common/ASCDocxFormat/Source/XML/Limit/Standalone.h
Normal file
53
ActiveX/Common/ASCDocxFormat/Source/XML/Limit/Standalone.h
Normal file
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef XML_LIMIT_STANDALONE_INCLUDE_H_
|
||||
#define XML_LIMIT_STANDALONE_INCLUDE_H_
|
||||
|
||||
#include <string>
|
||||
#include "setter.h"
|
||||
|
||||
|
||||
namespace XML
|
||||
{
|
||||
namespace Limit
|
||||
{
|
||||
class Standalone : public setter::from<std::string>
|
||||
{
|
||||
public:
|
||||
Standalone();
|
||||
const std::string no_find() const;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // XML_LIMIT_STANDALONE_INCLUDE_H_
|
||||
54
ActiveX/Common/ASCDocxFormat/Source/XML/Limit/Version.cpp
Normal file
54
ActiveX/Common/ASCDocxFormat/Source/XML/Limit/Version.cpp
Normal file
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled_xml.h"
|
||||
|
||||
|
||||
#include "Version.h"
|
||||
#include "./../Exception/Declaration.h"
|
||||
|
||||
|
||||
namespace XML
|
||||
{
|
||||
namespace Limit
|
||||
{
|
||||
Version::Version()
|
||||
{
|
||||
add("1.0");
|
||||
}
|
||||
|
||||
const std::string Version::no_find() const
|
||||
{
|
||||
throw Exception::Declaration("declaration version error");
|
||||
}
|
||||
}
|
||||
} // namespace XML
|
||||
22
ActiveX/Common/ASCDocxFormat/Source/XML/Limit/Version.h
Normal file
22
ActiveX/Common/ASCDocxFormat/Source/XML/Limit/Version.h
Normal file
@@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
#ifndef XML_LIMIT_VERSION_INCLUDE_H_
|
||||
#define XML_LIMIT_VERSION_INCLUDE_H_
|
||||
|
||||
#include <string>
|
||||
#include "setter.h"
|
||||
|
||||
|
||||
namespace XML
|
||||
{
|
||||
namespace Limit
|
||||
{
|
||||
class Version : public setter::from<std::string>
|
||||
{
|
||||
public:
|
||||
Version();
|
||||
const std::string no_find() const;
|
||||
};
|
||||
} // namespace Limit
|
||||
} // namespace XML
|
||||
|
||||
#endif // XML_LIMIT_VERSION_INCLUDE_H_
|
||||
113
ActiveX/Common/ASCDocxFormat/Source/XML/Private/Attribute.cpp
Normal file
113
ActiveX/Common/ASCDocxFormat/Source/XML/Private/Attribute.cpp
Normal file
@@ -0,0 +1,113 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled_xml.h"
|
||||
|
||||
|
||||
#include "Attribute.h"
|
||||
#include "Lexigraph.h"
|
||||
#include "Encoding.h"
|
||||
|
||||
|
||||
namespace XML
|
||||
{
|
||||
namespace Private
|
||||
{
|
||||
|
||||
Attribute::Attribute(const XML::XName& xname, const std::string& value)
|
||||
: XName(xname),
|
||||
Value(value)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Attribute::Attribute()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
const bool Attribute::operator ==(const Attribute& rhs) const
|
||||
{
|
||||
|
||||
return (XName->Equal(*rhs.XName));
|
||||
}
|
||||
|
||||
|
||||
const bool Attribute::operator <(const Attribute& rhs) const
|
||||
{
|
||||
return ((*XName->Name) < (*rhs.XName->Name));
|
||||
}
|
||||
|
||||
|
||||
const bool Attribute::exist() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
const std::string Attribute::ToString() const
|
||||
{
|
||||
return XName->ToString() + "=\"" + Private::Lexigraph::toSource(Value->ToString()) + "\"";
|
||||
}
|
||||
|
||||
|
||||
const std::wstring Attribute::ToWString() const
|
||||
{
|
||||
return XName->ToWString() + L"=\"" + Encoding::utf82unicode(Private::Lexigraph::toSource(Value->ToString())) + L"\"";
|
||||
}
|
||||
|
||||
|
||||
void Attribute::SaveToStringList(std::list<std::string>& strList)const
|
||||
{
|
||||
XName->SaveToStringList(strList);
|
||||
strList.push_back("=\"");
|
||||
strList.push_back(Private::Lexigraph::toSource(Value->ToString()));
|
||||
strList.push_back("\"");
|
||||
}
|
||||
|
||||
|
||||
void Attribute::SaveToWStringList(std::list<std::wstring>& strList)const
|
||||
{
|
||||
XName->SaveToWStringList(strList);
|
||||
strList.push_back(L"=\"");
|
||||
strList.push_back(Encoding::utf82unicode(Private::Lexigraph::toSource(Value->ToString())));
|
||||
strList.push_back(L"\"");
|
||||
}
|
||||
|
||||
|
||||
const XString Attribute::value() const
|
||||
{
|
||||
return *Value;
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace XML
|
||||
76
ActiveX/Common/ASCDocxFormat/Source/XML/Private/Attribute.h
Normal file
76
ActiveX/Common/ASCDocxFormat/Source/XML/Private/Attribute.h
Normal file
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef XML_PRIVATE_XATTRIBUTE_INCLUDE_H_
|
||||
#define XML_PRIVATE_XATTRIBUTE_INNLUDE_H_
|
||||
|
||||
#include <string>
|
||||
#include "XString.h"
|
||||
#include "./../XName.h"
|
||||
#include "property.h"
|
||||
#include <list>
|
||||
|
||||
|
||||
namespace XML
|
||||
{
|
||||
namespace Private
|
||||
{
|
||||
class Attribute
|
||||
{
|
||||
public:
|
||||
Attribute(const XName& xname, const std::string& value);
|
||||
|
||||
public:
|
||||
const bool operator ==(const Attribute& rhs) const;
|
||||
const bool operator <(const Attribute& rhs) const;
|
||||
virtual const bool exist() const;
|
||||
|
||||
public:
|
||||
const std::string ToString() const;
|
||||
const std::wstring ToWString() const;
|
||||
virtual void SaveToStringList(std::list<std::string>& strList)const;
|
||||
virtual void SaveToWStringList(std::list<std::wstring>& strList)const;
|
||||
|
||||
public:
|
||||
const XString value() const;
|
||||
|
||||
public:
|
||||
property<XName> XName;
|
||||
property<Private::XString> Value;
|
||||
|
||||
protected:
|
||||
Attribute();
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // XML_PRIVATE_ATTRIBUTE_INCLUDE_H_
|
||||
108
ActiveX/Common/ASCDocxFormat/Source/XML/Private/Comment.cpp
Normal file
108
ActiveX/Common/ASCDocxFormat/Source/XML/Private/Comment.cpp
Normal file
@@ -0,0 +1,108 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled_xml.h"
|
||||
|
||||
|
||||
#include "Comment.h"
|
||||
#include "Lexigraph.h"
|
||||
#include "Encoding.h"
|
||||
|
||||
|
||||
namespace XML
|
||||
{
|
||||
namespace Private
|
||||
{
|
||||
|
||||
Comment::Comment()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Comment::Comment(const std::string& value)
|
||||
: Value(value)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Comment::~Comment()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
const bool Comment::isElement() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
const bool Comment::isText() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
const bool Comment::isComment() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
const std::string Comment::ToString() const
|
||||
{
|
||||
return "<!--" + Private::Lexigraph::toSource(Value.ToString()) + "-->";
|
||||
}
|
||||
|
||||
|
||||
const std::wstring Comment::ToWString() const
|
||||
{
|
||||
return L"<!--" + Private::Lexigraph::toSource(Value.ToWString()) + L"-->";
|
||||
}
|
||||
|
||||
|
||||
void Comment::SaveToStringList(std::list<std::string>& strList)const
|
||||
{
|
||||
strList.push_back("<!--");
|
||||
strList.push_back(Private::Lexigraph::toSource(Value.ToString()));
|
||||
strList.push_back("-->");
|
||||
}
|
||||
|
||||
|
||||
void Comment::SaveToWStringList(std::list<std::wstring>& strList)const
|
||||
{
|
||||
strList.push_back(L"<!--");
|
||||
strList.push_back(Private::Lexigraph::toSource(Value.ToWString()));
|
||||
strList.push_back(L"-->");
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace XML
|
||||
72
ActiveX/Common/ASCDocxFormat/Source/XML/Private/Comment.h
Normal file
72
ActiveX/Common/ASCDocxFormat/Source/XML/Private/Comment.h
Normal file
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef XML_PRIVATE_COMMENT_INCLUDE_H_
|
||||
#define XML_PRIVATE_COMMENT_INCLUDE_H_
|
||||
|
||||
#include "Node.h"
|
||||
#include <string>
|
||||
#include "XString.h"
|
||||
#include "property.h"
|
||||
|
||||
|
||||
namespace XML
|
||||
{
|
||||
namespace Private
|
||||
{
|
||||
class Comment : public Node
|
||||
{
|
||||
public:
|
||||
explicit Comment(const std::string& value);
|
||||
virtual ~Comment();
|
||||
|
||||
public:
|
||||
virtual const bool isElement() const;
|
||||
virtual const bool isText() const;
|
||||
virtual const bool isComment() const;
|
||||
|
||||
public:
|
||||
virtual const std::string ToString() const;
|
||||
virtual const std::wstring ToWString() const;
|
||||
virtual void SaveToStringList(std::list<std::string>& strList)const;
|
||||
virtual void SaveToWStringList(std::list<std::wstring>& strList)const;
|
||||
|
||||
public:
|
||||
XString Value;
|
||||
|
||||
protected:
|
||||
Comment();
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // XML_PRIVATE_COMMENT_INCLUDE_H_
|
||||
491
ActiveX/Common/ASCDocxFormat/Source/XML/Private/Element.cpp
Normal file
491
ActiveX/Common/ASCDocxFormat/Source/XML/Private/Element.cpp
Normal file
@@ -0,0 +1,491 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled_xml.h"
|
||||
|
||||
|
||||
#include "Element.h"
|
||||
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "XList.h"
|
||||
|
||||
#include "./../Exception/Parse.h"
|
||||
#include "./../Exception/Namespace.h"
|
||||
#include "Namespace.h"
|
||||
#include "./../XAttribute.h"
|
||||
#include "./../XAttribute.h"
|
||||
#include "./../XNode.h"
|
||||
#include "./../XElement.h"
|
||||
#include "./../XText.h"
|
||||
#include "./../XContainer.h"
|
||||
#include "Exception/not_implement.h"
|
||||
#include "Utility.h"
|
||||
|
||||
namespace XML
|
||||
{
|
||||
namespace Private
|
||||
{
|
||||
|
||||
Element::Element()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Element::Element(const XML::XName& xname)
|
||||
: XName(xname)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Element::Element(const XML::XName& xname, const XList& list)
|
||||
: NodeContainer(list.Nodes),
|
||||
XName(xname),
|
||||
Attributes(list.Attributes),
|
||||
Namespaces(list.Namespaces)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Element::Element(NSCommon::smart_ptr<XSingleSource> source, const XNamespaceContainer& ns, const XSpace& space)
|
||||
: Space(space)
|
||||
{
|
||||
fromSource(source, ns, Space);
|
||||
}
|
||||
|
||||
|
||||
Element::Element(NSCommon::smart_ptr<XWideSource> source, const XNamespaceContainer& ns, const XSpace& space)
|
||||
: Space(space)
|
||||
{
|
||||
fromSource(source, ns, Space);
|
||||
}
|
||||
|
||||
|
||||
Element::~Element()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
const bool Element::isElement() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
const bool Element::isText() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
const bool Element::isComment() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void Element::fromSource(NSCommon::smart_ptr<XSingleSource> source, const XNamespaceContainer& defineNamespaces, const XSpace& space)
|
||||
{
|
||||
Space = space;
|
||||
source->skipSpace();
|
||||
|
||||
const std::pair<const std::string, const std::string> name = source->getName();
|
||||
source->skipSpace();
|
||||
std::list<std::pair<std::pair<std::string, std::string>, std::string> > attributes;
|
||||
|
||||
while (source->get() != '/' && source->get() != '>')
|
||||
{
|
||||
const std::pair<const std::pair<const std::string, const std::string>, const std::string> attribute = source->getAttribute();
|
||||
|
||||
if (attribute.first.first == "xmlns" || attribute.first.first.empty() && attribute.first.second == "xmlns")
|
||||
{
|
||||
Namespaces->push_back(XNamespace(attribute.first.second, attribute.second));
|
||||
}
|
||||
else if (attribute.first.first == "xml")
|
||||
{
|
||||
if (attribute.first.second == "space")
|
||||
{
|
||||
if (attribute.second == "default")
|
||||
Space->setDefault();
|
||||
else if (attribute.second == "preserve")
|
||||
Space->setPreserve();
|
||||
else
|
||||
throw Exception::Parse("bad space parametr");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
attributes.push_back(attribute);
|
||||
}
|
||||
source->skipSpace();
|
||||
}
|
||||
|
||||
typedef std::pair<std::pair<std::string, std::string>, std::string> attribute_type;
|
||||
|
||||
for (std::list<attribute_type>::iterator iter = attributes.begin(); iter != attributes.end();++iter)
|
||||
{
|
||||
if ((*iter).first.first.empty())
|
||||
{
|
||||
Attributes.push_back(XAttribute((*iter).first.second, (*iter).second));
|
||||
}
|
||||
else
|
||||
{
|
||||
XNamespace thisNs = Namespaces[(*iter).first.first];
|
||||
XNamespace defineNs = defineNamespaces[(*iter).first.first];
|
||||
|
||||
if (thisNs.exist())
|
||||
Attributes.push_back(XAttribute(thisNs + (*iter).first.second, (*iter).second));
|
||||
else if (defineNs.exist())
|
||||
Attributes.push_back(XAttribute(defineNs + (*iter).first.second, (*iter).second));
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
XName->Name = name.second;
|
||||
|
||||
if (!name.first.empty())
|
||||
{
|
||||
XNamespace thisNs = Namespaces[name.first];
|
||||
XNamespace defineNs = defineNamespaces[name.first];
|
||||
|
||||
if (thisNs.exist())
|
||||
XName->Ns = thisNs;
|
||||
else if (defineNs.exist())
|
||||
XName->Ns = defineNs;
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (source->get() == '/')
|
||||
{
|
||||
source->findAndSkip('>');
|
||||
}
|
||||
else
|
||||
{
|
||||
source->findAndSkip('>');
|
||||
XNamespaceContainer summaryNamespaces = Namespaces;
|
||||
summaryNamespaces.merge(defineNamespaces);
|
||||
NodeContainer::fromSource(source, summaryNamespaces, Space);
|
||||
source->skipSpace();
|
||||
const std::pair<const std::string, const std::string> name = source->getName();
|
||||
source->findAndSkip('>');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Element::fromSource(NSCommon::smart_ptr<XWideSource> source, const XNamespaceContainer& defineNamespaces, const XSpace& space)
|
||||
{
|
||||
Space = space;
|
||||
source->skipSpace();
|
||||
|
||||
const std::pair<const std::wstring, const std::wstring> name = source->getName();
|
||||
source->skipSpace();
|
||||
std::list<std::pair<std::pair<std::wstring, std::wstring>, std::wstring> > attributes;
|
||||
|
||||
while (source->get() != L'/' && source->get() != L'>')
|
||||
{
|
||||
const std::pair<const std::pair<const std::wstring, const std::wstring>, const std::wstring> attribute = source->getAttribute();
|
||||
|
||||
if ((attribute.first.first == L"xmlns") || ((attribute.first.first.empty()) && (attribute.first.second == L"xmlns")))
|
||||
{
|
||||
Namespaces->push_back(XNamespace(Encoding::unicode2utf8(attribute.first.second), Encoding::unicode2utf8(attribute.second)));
|
||||
}
|
||||
else if (attribute.first.first == L"xml")
|
||||
{
|
||||
if (attribute.first.second == L"space")
|
||||
{
|
||||
if (attribute.second == L"default")
|
||||
Space->setDefault();
|
||||
else if (attribute.second == L"preserve")
|
||||
Space->setPreserve();
|
||||
else
|
||||
throw Exception::Parse("bad space parametr");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
attributes.push_back(attribute);
|
||||
}
|
||||
source->skipSpace();
|
||||
}
|
||||
|
||||
typedef std::pair<std::pair<std::wstring, std::wstring>, std::wstring> attribute_type;
|
||||
|
||||
for (std::list<attribute_type >::iterator iter = attributes.begin(); iter != attributes.end(); ++iter)
|
||||
{
|
||||
if ((*iter).first.first.empty())
|
||||
{
|
||||
Attributes.push_back(XAttribute(Encoding::unicode2utf8((*iter).first.second), Encoding::unicode2utf8((*iter).second)));
|
||||
}
|
||||
else
|
||||
{
|
||||
XNamespace thisNs = Namespaces[Encoding::unicode2utf8((*iter).first.first)];
|
||||
XNamespace defineNs = defineNamespaces[Encoding::unicode2utf8((*iter).first.first)];
|
||||
|
||||
if (thisNs.exist())
|
||||
Attributes.push_back(XAttribute(thisNs + Encoding::unicode2utf8((*iter).first.second), Encoding::unicode2utf8((*iter).second)));
|
||||
else if (defineNs.exist())
|
||||
Attributes.push_back(XAttribute(defineNs + Encoding::unicode2utf8((*iter).first.second), Encoding::unicode2utf8((*iter).second)));
|
||||
else
|
||||
throw Exception::Namespace("not define namespace");
|
||||
}
|
||||
}
|
||||
|
||||
XName->Name = Encoding::unicode2utf8(name.second);
|
||||
|
||||
if (!name.first.empty())
|
||||
{
|
||||
XNamespace thisNs = Namespaces[Encoding::unicode2utf8(name.first)];
|
||||
XNamespace defineNs = defineNamespaces[Encoding::unicode2utf8(name.first)];
|
||||
|
||||
if (thisNs.exist())
|
||||
XName->Ns = thisNs;
|
||||
else if (defineNs.exist())
|
||||
XName->Ns = defineNs;
|
||||
else
|
||||
throw Exception::Namespace("not define namespace");
|
||||
}
|
||||
|
||||
if (source->get() == L'/')
|
||||
{
|
||||
source->findAndSkip(L'>');
|
||||
}
|
||||
else
|
||||
{
|
||||
source->findAndSkip(L'>');
|
||||
XNamespaceContainer summaryNamespaces = Namespaces;
|
||||
summaryNamespaces.merge(defineNamespaces);
|
||||
NodeContainer::fromSource(source, summaryNamespaces, Space);
|
||||
source->skipSpace();
|
||||
const std::pair<const std::wstring, const std::wstring> name = source->getName();
|
||||
source->findAndSkip(L'>');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const std::string Element::ToString() const
|
||||
{
|
||||
std::string node;
|
||||
node += "<" + XName->ToString();
|
||||
if (Space->isPreserve())
|
||||
node += " xml:space=\"preserve\" ";
|
||||
node += Namespaces->ToString();
|
||||
node += Attributes->ToString();
|
||||
|
||||
if (Nodes->empty())
|
||||
node += "/>";
|
||||
else
|
||||
node += ">" + Nodes->ToString() + "</" + XName->ToString() + ">";
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
|
||||
const std::wstring Element::ToWString() const
|
||||
{
|
||||
std::wstring node;
|
||||
node += L"<" + XName->ToWString();
|
||||
if (Space->isPreserve())
|
||||
node += L" xml:space=\"preserve\" ";
|
||||
node += Namespaces->ToWString();
|
||||
node += Attributes->ToWString();
|
||||
|
||||
if (Nodes->empty())
|
||||
node += L"/>";
|
||||
else
|
||||
node += L">" + Nodes->ToWString() + L"</" + XName->ToWString() + L">";
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
|
||||
void Element::SaveToStringList(std::list<std::string>& strList)const
|
||||
{
|
||||
|
||||
strList.push_back("<");
|
||||
XName->SaveToStringList(strList);
|
||||
|
||||
if (Space->isPreserve())
|
||||
strList.push_back(" xml:space=\"preserve\" ");
|
||||
Namespaces->SaveToStringList(strList);
|
||||
Attributes->SaveToStringList(strList);
|
||||
|
||||
if (Nodes->empty())
|
||||
strList.push_back("/>");
|
||||
else
|
||||
{
|
||||
strList.push_back(">");
|
||||
Nodes->SaveToStringList(strList);
|
||||
strList.push_back("</");
|
||||
XName->SaveToStringList(strList);
|
||||
strList.push_back(">");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Element::SaveToWStringList(std::list<std::wstring>& strList)const
|
||||
{
|
||||
|
||||
strList.push_back(L"<");
|
||||
XName->SaveToWStringList(strList);
|
||||
|
||||
if (Space->isPreserve())
|
||||
strList.push_back(L" xml:space=\"preserve\" ");
|
||||
Namespaces->SaveToWStringList(strList);
|
||||
Attributes->SaveToWStringList(strList);
|
||||
|
||||
if (Nodes->empty())
|
||||
strList.push_back(L"/>");
|
||||
else
|
||||
{
|
||||
strList.push_back(L">");
|
||||
Nodes->SaveToWStringList(strList);
|
||||
strList.push_back(L"</");
|
||||
XName->SaveToWStringList(strList);
|
||||
strList.push_back(L">");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const bool Element::exist() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
const XString Element::text() const
|
||||
{
|
||||
return Texts->text();
|
||||
}
|
||||
|
||||
|
||||
void Element::Add(const XAttribute& attribute)
|
||||
{
|
||||
Attributes.Add(attribute);
|
||||
}
|
||||
|
||||
|
||||
void Element::Add(const XNamespace& ns)
|
||||
{
|
||||
Namespaces.Add(ns);
|
||||
}
|
||||
|
||||
|
||||
void Element::Add(const XNode& node)
|
||||
{
|
||||
Nodes.Add(node);
|
||||
}
|
||||
|
||||
|
||||
void Element::Add(const XElement& element)
|
||||
{
|
||||
Nodes.Add(element);
|
||||
}
|
||||
|
||||
|
||||
void Element::Add(const XText& text)
|
||||
{
|
||||
Nodes.Add(text);
|
||||
}
|
||||
|
||||
|
||||
void Element::Add(const XML::XContainer& container)
|
||||
{
|
||||
Nodes.Add(container);
|
||||
}
|
||||
|
||||
|
||||
void Element::Add(const XML::Private::XList& list)
|
||||
{
|
||||
Attributes->merge(list.Attributes);
|
||||
Namespaces->merge(list.Namespaces);
|
||||
Nodes->merge(list.Nodes);
|
||||
}
|
||||
|
||||
|
||||
const XNamespaceContainer Element::usedNamespace() const
|
||||
{
|
||||
XNamespaceContainer container;
|
||||
if (XName->Ns.is_init())
|
||||
container.push_back(XName->Ns);
|
||||
|
||||
container.merge(Attributes.usedNamespace());
|
||||
container.merge(Elements.usedNamespace());
|
||||
|
||||
return container;
|
||||
}
|
||||
|
||||
|
||||
XAttribute& Element::attribute(const XML::XName& xname)
|
||||
{
|
||||
return Attributes[xname];
|
||||
}
|
||||
|
||||
|
||||
const XAttribute& Element::attribute(const XML::XName& xname) const
|
||||
{
|
||||
return Attributes[xname];
|
||||
}
|
||||
|
||||
|
||||
XElement Element::element(const XML::XName& xname)
|
||||
{
|
||||
return Elements[xname];
|
||||
}
|
||||
|
||||
|
||||
const XElement Element::element(const XML::XName& xname) const
|
||||
{
|
||||
return Elements[xname];
|
||||
}
|
||||
|
||||
|
||||
XElement Element::element(const XML::XName& xname, const std::string& value)
|
||||
{
|
||||
return Elements.get(xname, value);
|
||||
}
|
||||
|
||||
|
||||
const XElement Element::element(const XML::XName& xname, const std::string& value) const
|
||||
{
|
||||
return Elements.get(xname, value);
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace XML
|
||||
118
ActiveX/Common/ASCDocxFormat/Source/XML/Private/Element.h
Normal file
118
ActiveX/Common/ASCDocxFormat/Source/XML/Private/Element.h
Normal file
@@ -0,0 +1,118 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef XML_PRIVATE_ELEMENT_INCLUDE_H_
|
||||
#define XML_PRIVATE_XELEMENT_INCLUDE_H_
|
||||
|
||||
#include <list>
|
||||
#include <string>
|
||||
|
||||
#include "NodeContainer.h"
|
||||
#include "property.h"
|
||||
#include "XAttributeContainer.h"
|
||||
#include "XNamespaceContainer.h"
|
||||
#include "./../XName.h"
|
||||
#include "XString.h"
|
||||
#include "XSpace.h"
|
||||
#include "XSingleSource.h"
|
||||
#include "XWideSource.h"
|
||||
|
||||
namespace XML
|
||||
{
|
||||
class XAttribute;
|
||||
class XNamespace;
|
||||
class XNode;
|
||||
class XText;
|
||||
class XContainer;
|
||||
|
||||
namespace Private
|
||||
{
|
||||
class XList;
|
||||
|
||||
class Element : public NodeContainer
|
||||
{
|
||||
public:
|
||||
Element();
|
||||
Element(const XML::XName& xname);
|
||||
Element(const XML::XName& xname, const XList& list);
|
||||
Element(NSCommon::smart_ptr<XSingleSource> source, const XNamespaceContainer& ns, const XSpace& space);
|
||||
Element(NSCommon::smart_ptr<XWideSource> source, const XNamespaceContainer& ns, const XSpace& space);
|
||||
|
||||
virtual ~Element();
|
||||
|
||||
public:
|
||||
virtual const bool isElement() const;
|
||||
virtual const bool isText() const;
|
||||
virtual const bool isComment() const;
|
||||
|
||||
public:
|
||||
void fromSource(NSCommon::smart_ptr<XSingleSource> source, const XNamespaceContainer& defineNamespaces, const XSpace& space);
|
||||
void fromSource(NSCommon::smart_ptr<XWideSource> source, const XNamespaceContainer& defineNamespaces, const XSpace& space);
|
||||
virtual const std::string ToString() const;
|
||||
virtual const std::wstring ToWString() const;
|
||||
virtual void SaveToStringList(std::list<std::string>& strList)const;
|
||||
virtual void SaveToWStringList(std::list<std::wstring>& strList)const;
|
||||
|
||||
public:
|
||||
virtual const bool exist() const;
|
||||
virtual const XString text() const;
|
||||
const XNamespaceContainer usedNamespace() const;
|
||||
|
||||
public:
|
||||
void Add(const XAttribute& attribute);
|
||||
void Add(const XNamespace& ns);
|
||||
void Add(const XNode& node);
|
||||
void Add(const XElement& element);
|
||||
void Add(const XText& text);
|
||||
void Add(const XML::XContainer& container);
|
||||
void Add(const XML::Private::XList& list);
|
||||
|
||||
public:
|
||||
XAttribute& attribute(const XName& xname);
|
||||
const XAttribute& attribute(const XName& xname) const;
|
||||
|
||||
XElement element(const XName& xname);
|
||||
const XElement element(const XName& xname) const;
|
||||
|
||||
XElement element(const XName& xname, const std::string& value);
|
||||
const XElement element(const XName& xname, const std::string& value) const;
|
||||
|
||||
public:
|
||||
property<XName> XName;
|
||||
XAttributeContainer Attributes;
|
||||
XNamespaceContainer Namespaces;
|
||||
property<XSpace> Space;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // XML_XELEMENT_INCLUDE_H_
|
||||
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef XML_PRIVATE_FILTER_ELEMENT_INCLUDE_H_
|
||||
#define XML_PRIVATE_FILTER_ELEMENT_INCLUDE_H_
|
||||
|
||||
#include <functional>
|
||||
#include "./../../XNode.h"
|
||||
|
||||
|
||||
namespace XML
|
||||
{
|
||||
namespace Private
|
||||
{
|
||||
namespace Filter
|
||||
{
|
||||
struct Element : public std::unary_function<XNode, const bool>
|
||||
{
|
||||
const bool operator ()(const XNode& xnode) const
|
||||
{
|
||||
return xnode.isElement();
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif // XML_PRIVATE_FILTER_ELEMENT_INCLUDE_H_
|
||||
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef XML_PRIVATE_FILTER_TEXT_INCLUDE_H_
|
||||
#define XML_PRIVATE_FILTER_TEXT_INCLUDE_H_
|
||||
|
||||
#include <functional>
|
||||
#include "./../../XNode.h"
|
||||
|
||||
|
||||
namespace XML
|
||||
{
|
||||
namespace Private
|
||||
{
|
||||
namespace Filter
|
||||
{
|
||||
struct Text : public std::unary_function<XNode, const bool>
|
||||
{
|
||||
const bool operator ()(const XNode& xnode) const
|
||||
{
|
||||
return xnode.isText();
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif // XML_PRIVATE_FILTER_TEXT_INCLUDE_H_
|
||||
213
ActiveX/Common/ASCDocxFormat/Source/XML/Private/Lexigraph.cpp
Normal file
213
ActiveX/Common/ASCDocxFormat/Source/XML/Private/Lexigraph.cpp
Normal file
@@ -0,0 +1,213 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled_xml.h"
|
||||
|
||||
|
||||
#include "Lexigraph.h"
|
||||
|
||||
namespace XML
|
||||
{
|
||||
namespace Private
|
||||
{
|
||||
|
||||
const std::string Lexigraph::fromSource(const std::string& input)
|
||||
{
|
||||
std::string output = input;
|
||||
|
||||
size_t pos = output.find("<");
|
||||
while(pos != output.npos)
|
||||
{
|
||||
output.replace(pos, 4, "<");
|
||||
pos = output.find("<", pos + 1);
|
||||
}
|
||||
|
||||
pos = output.find(">");
|
||||
while(pos != output.npos)
|
||||
{
|
||||
output.replace(pos, 4, ">");
|
||||
pos = output.find(">", pos + 1);
|
||||
}
|
||||
|
||||
pos = output.find("'");
|
||||
while(pos != output.npos)
|
||||
{
|
||||
output.replace(pos, 6, "\'");
|
||||
pos = output.find("'", pos + 1);
|
||||
}
|
||||
|
||||
pos = output.find(""");
|
||||
while(pos != output.npos)
|
||||
{
|
||||
output.replace(pos, 6, "\"");
|
||||
pos = output.find(""", pos + 1);
|
||||
}
|
||||
|
||||
pos = output.find("&");
|
||||
while(pos != output.npos)
|
||||
{
|
||||
output.replace(pos, 5, "&");
|
||||
pos = output.find("&", pos + 1);
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
const std::string Lexigraph::toSource(const std::string& input)
|
||||
{
|
||||
std::string output = input;
|
||||
size_t pos = output.find('&');
|
||||
while(pos != output.npos)
|
||||
{
|
||||
output.replace(pos, 1, "&");
|
||||
pos = output.find('&', pos + 1);
|
||||
}
|
||||
|
||||
pos = output.find('<');
|
||||
while(pos != output.npos)
|
||||
{
|
||||
output.replace(pos, 1, "<");
|
||||
pos = output.find('<', pos + 1);
|
||||
}
|
||||
|
||||
pos = output.find('>');
|
||||
while(pos != output.npos)
|
||||
{
|
||||
output.replace(pos, 1, ">");
|
||||
pos = output.find('>', pos + 1);
|
||||
}
|
||||
|
||||
pos = output.find('\'');
|
||||
while(pos != output.npos)
|
||||
{
|
||||
output.replace(pos, 1, "'");
|
||||
pos = output.find('\'', pos + 1);
|
||||
}
|
||||
|
||||
pos = output.find('\"');
|
||||
while(pos != output.npos)
|
||||
{
|
||||
output.replace(pos, 1, """);
|
||||
pos = output.find('\"', pos + 1);
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
const std::wstring Lexigraph::fromSource(const std::wstring& input)
|
||||
{
|
||||
std::wstring output = input;
|
||||
|
||||
size_t pos = output.find(L"<");
|
||||
while(pos != output.npos)
|
||||
{
|
||||
output.replace(pos, 4, L"<");
|
||||
pos = output.find(L"<", pos + 1);
|
||||
}
|
||||
|
||||
pos = output.find(L">");
|
||||
while(pos != output.npos)
|
||||
{
|
||||
output.replace(pos, 4, L">");
|
||||
pos = output.find(L">", pos + 1);
|
||||
}
|
||||
|
||||
pos = output.find(L"'");
|
||||
while(pos != output.npos)
|
||||
{
|
||||
output.replace(pos, 6, L"\'");
|
||||
pos = output.find(L"'", pos + 1);
|
||||
}
|
||||
|
||||
pos = output.find(L""");
|
||||
while(pos != output.npos)
|
||||
{
|
||||
output.replace(pos, 6, L"\"");
|
||||
pos = output.find(L""", pos + 1);
|
||||
}
|
||||
|
||||
pos = output.find(L"&");
|
||||
while(pos != output.npos)
|
||||
{
|
||||
output.replace(pos, 5, L"&");
|
||||
pos = output.find(L"&", pos + 1);
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
const std::wstring Lexigraph::toSource(const std::wstring& input)
|
||||
{
|
||||
std::wstring output = input;
|
||||
size_t pos = output.find(L'&');
|
||||
while(pos != output.npos)
|
||||
{
|
||||
output.replace(pos, 1, L"&");
|
||||
pos = output.find(L'&', pos + 1);
|
||||
}
|
||||
|
||||
pos = output.find(L'<');
|
||||
while(pos != output.npos)
|
||||
{
|
||||
output.replace(pos, 1, L"<");
|
||||
pos = output.find(L'<', pos + 1);
|
||||
}
|
||||
|
||||
pos = output.find(L'>');
|
||||
while(pos != output.npos)
|
||||
{
|
||||
output.replace(pos, 1, L">");
|
||||
pos = output.find(L'>', pos + 1);
|
||||
}
|
||||
|
||||
pos = output.find(L'\'');
|
||||
while(pos != output.npos)
|
||||
{
|
||||
output.replace(pos, 1, L"'");
|
||||
pos = output.find(L'\'', pos + 1);
|
||||
}
|
||||
|
||||
pos = output.find(L'\"');
|
||||
while(pos != output.npos)
|
||||
{
|
||||
output.replace(pos, 1, L""");
|
||||
pos = output.find(L'\"', pos + 1);
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace XML
|
||||
55
ActiveX/Common/ASCDocxFormat/Source/XML/Private/Lexigraph.h
Normal file
55
ActiveX/Common/ASCDocxFormat/Source/XML/Private/Lexigraph.h
Normal file
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef XML_PRIVATE_LEXIGRAPH_INCLUDE_H_
|
||||
#define XML_PRIVATE_LEXIGRAPH_INCLUDE_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
|
||||
namespace XML
|
||||
{
|
||||
namespace Private
|
||||
{
|
||||
class Lexigraph
|
||||
{
|
||||
public:
|
||||
static const std::string fromSource(const std::string& input);
|
||||
static const std::string toSource(const std::string& input);
|
||||
|
||||
static const std::wstring fromSource(const std::wstring& input);
|
||||
static const std::wstring toSource(const std::wstring& input);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // XML_PRIVATE_LEXIGRAPH_INCLUDE_H_
|
||||
141
ActiveX/Common/ASCDocxFormat/Source/XML/Private/Namespace.cpp
Normal file
141
ActiveX/Common/ASCDocxFormat/Source/XML/Private/Namespace.cpp
Normal file
@@ -0,0 +1,141 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled_xml.h"
|
||||
|
||||
|
||||
#include "Namespace.h"
|
||||
#include "Lexigraph.h"
|
||||
#include "Encoding.h"
|
||||
|
||||
|
||||
namespace XML
|
||||
{
|
||||
namespace Private
|
||||
{
|
||||
|
||||
|
||||
Namespace::Namespace()
|
||||
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Namespace::Namespace(const std::string& prefix, const std::string& name)
|
||||
: Prefix(prefix),
|
||||
Name(name)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
const bool Namespace::operator ==(const Namespace& rhs) const
|
||||
{
|
||||
return Prefix == rhs.Prefix;
|
||||
}
|
||||
|
||||
|
||||
const bool Namespace::operator <(const Namespace& rhs) const
|
||||
{
|
||||
return Prefix < rhs.Prefix;
|
||||
}
|
||||
|
||||
|
||||
const bool Namespace::exist() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
const std::string Namespace::ToString() const
|
||||
{
|
||||
if (Prefix != "xmlns")
|
||||
return "xmlns:" + (Prefix) + "=\"" + Private::Lexigraph::toSource(Name) + "\"";
|
||||
return "xmlns=\"" + Private::Lexigraph::toSource(Name) + "\"";
|
||||
}
|
||||
|
||||
|
||||
const std::wstring Namespace::ToWString() const
|
||||
{
|
||||
if (Prefix != "xmlns")
|
||||
return L"xmlns:" + Encoding::utf82unicode(Prefix) + L"=\""
|
||||
+ Encoding::utf82unicode(Private::Lexigraph::toSource(Name)) + L"\"";
|
||||
return L"xmlns=\"" + Encoding::utf82unicode(Private::Lexigraph::toSource(Name)) + L"\"";
|
||||
}
|
||||
|
||||
|
||||
void Namespace::SaveToStringList(std::list<std::string>& strList)const
|
||||
{
|
||||
if (Prefix != "xmlns")
|
||||
{
|
||||
strList.push_back("xmlns:");
|
||||
strList.push_back(Prefix);
|
||||
strList.push_back("=\"");
|
||||
strList.push_back(Private::Lexigraph::toSource(Name));
|
||||
strList.push_back("\"");
|
||||
return;
|
||||
}
|
||||
strList.push_back("xmlns=\"");
|
||||
strList.push_back(Private::Lexigraph::toSource(Name));
|
||||
strList.push_back("\"");
|
||||
}
|
||||
|
||||
|
||||
void Namespace::SaveToWStringList(std::list<std::wstring>& strList)const
|
||||
{
|
||||
if (Prefix != "xmlns")
|
||||
{
|
||||
strList.push_back(L"xmlns:");
|
||||
strList.push_back(Encoding::utf82unicode(Prefix));
|
||||
strList.push_back(L"=\"");
|
||||
strList.push_back(Encoding::utf82unicode(Private::Lexigraph::toSource(Name)));
|
||||
strList.push_back(L"\"");
|
||||
return;
|
||||
}
|
||||
strList.push_back(L"xmlns=\"");
|
||||
strList.push_back(Encoding::utf82unicode(Private::Lexigraph::toSource(Name)));
|
||||
strList.push_back(L"\"");
|
||||
}
|
||||
|
||||
|
||||
const std::string Namespace::GetPrefix()const
|
||||
{
|
||||
return Prefix;
|
||||
}
|
||||
|
||||
|
||||
const std::string Namespace::GetName()const
|
||||
{
|
||||
return Name;
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace XML
|
||||
71
ActiveX/Common/ASCDocxFormat/Source/XML/Private/Namespace.h
Normal file
71
ActiveX/Common/ASCDocxFormat/Source/XML/Private/Namespace.h
Normal file
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef XML_PRIVATE_INCLUDE_H_
|
||||
#define XML_PRIVATE_INCLUDE_H_
|
||||
|
||||
#include <string>
|
||||
#include <list>
|
||||
|
||||
#include "property.h"
|
||||
|
||||
namespace XML
|
||||
{
|
||||
namespace Private
|
||||
{
|
||||
class Namespace
|
||||
{
|
||||
public:
|
||||
Namespace(const std::string& prefix, const std::string& name);
|
||||
const bool operator==(const Namespace& rhs) const;
|
||||
const bool operator<(const Namespace& rhs) const;
|
||||
|
||||
public:
|
||||
virtual const bool exist() const;
|
||||
const std::string ToString() const;
|
||||
const std::wstring ToWString() const;
|
||||
virtual void SaveToStringList(std::list<std::string>& strList)const;
|
||||
virtual void SaveToWStringList(std::list<std::wstring>& strList)const;
|
||||
private:
|
||||
std::string Prefix;
|
||||
std::string Name;
|
||||
public:
|
||||
const std::string GetPrefix()const;
|
||||
const std::string GetName()const;
|
||||
|
||||
protected:
|
||||
Namespace();
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // XML_PRIVATE_INCLUDE_H_
|
||||
45
ActiveX/Common/ASCDocxFormat/Source/XML/Private/Node.cpp
Normal file
45
ActiveX/Common/ASCDocxFormat/Source/XML/Private/Node.cpp
Normal file
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled_xml.h"
|
||||
|
||||
|
||||
#include "Node.h"
|
||||
|
||||
|
||||
namespace XML
|
||||
{
|
||||
namespace Private
|
||||
{
|
||||
|
||||
}
|
||||
} // namespace XML
|
||||
62
ActiveX/Common/ASCDocxFormat/Source/XML/Private/Node.h
Normal file
62
ActiveX/Common/ASCDocxFormat/Source/XML/Private/Node.h
Normal file
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef XML_PRIVATE_NODE_INCLUDE_H_
|
||||
#define XML_PRIVATE_NODE_INCLUDE_H_
|
||||
|
||||
#include <string>
|
||||
#include <list>
|
||||
|
||||
namespace XML
|
||||
{
|
||||
namespace Private
|
||||
{
|
||||
class Node
|
||||
{
|
||||
public:
|
||||
virtual ~Node() = 0 {};
|
||||
|
||||
public:
|
||||
virtual const bool isElement() const = 0;
|
||||
virtual const bool isText() const = 0;
|
||||
virtual const bool isComment() const = 0;
|
||||
|
||||
public:
|
||||
virtual const std::string ToString() const = 0;
|
||||
virtual const std::wstring ToWString() const = 0;
|
||||
virtual void SaveToStringList(std::list<std::string>& strList)const = 0;
|
||||
virtual void SaveToWStringList(std::list<std::wstring>& strList)const = 0;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // XML_PRIVATE_NODE_INCLUDE_H_
|
||||
@@ -0,0 +1,333 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled_xml.h"
|
||||
|
||||
|
||||
#include "NodeContainer.h"
|
||||
#include "./../XElement.h"
|
||||
#include "./../XComment.h"
|
||||
#include "./../XText.h"
|
||||
#include "XList.h"
|
||||
#include "XNamespaceContainer.h"
|
||||
#include "Exception/not_implement.h"
|
||||
#include "Utility.h"
|
||||
|
||||
|
||||
namespace XML
|
||||
{
|
||||
namespace Private
|
||||
{
|
||||
|
||||
NodeContainer::NodeContainer()
|
||||
: Nodes(),
|
||||
Elements(Nodes),
|
||||
Texts(Nodes)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
NodeContainer::NodeContainer(const XNodeContainer& nodes)
|
||||
: Nodes(nodes),
|
||||
Elements(Nodes),
|
||||
Texts(Nodes)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
NodeContainer::~NodeContainer()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
NodeContainer::NodeContainer(const XElement& element)
|
||||
: Nodes(),
|
||||
Elements(Nodes),
|
||||
Texts(Nodes)
|
||||
{
|
||||
Elements.Add(element);
|
||||
}
|
||||
|
||||
|
||||
NodeContainer::NodeContainer(const XText& text)
|
||||
: Nodes(),
|
||||
Elements(Nodes),
|
||||
Texts(Nodes)
|
||||
{
|
||||
Texts.Add(text);
|
||||
}
|
||||
|
||||
|
||||
NodeContainer::NodeContainer(const XComment& comment)
|
||||
: Nodes(),
|
||||
Elements(Nodes),
|
||||
Texts(Nodes)
|
||||
{
|
||||
Nodes.Add(comment);
|
||||
}
|
||||
|
||||
|
||||
NodeContainer::NodeContainer(const XList& list)
|
||||
: Nodes(),
|
||||
Elements(Nodes),
|
||||
Texts(Nodes)
|
||||
{
|
||||
Nodes.merge(list.Nodes);
|
||||
}
|
||||
|
||||
|
||||
const bool NodeContainer::isElement() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
const bool NodeContainer::isText() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
const bool NodeContainer::isComment() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void NodeContainer::fromSource(NSCommon::smart_ptr<XSingleSource> source, const XNamespaceContainer& ns, const XSpace& space)
|
||||
{
|
||||
if (space.isDefault())
|
||||
source->skipSpace();
|
||||
|
||||
while (true)
|
||||
{
|
||||
if (source->get() == '<')
|
||||
{
|
||||
source->next();
|
||||
if (source->get() == '/')
|
||||
break;
|
||||
if (isComment(source))
|
||||
insertComment(source);
|
||||
else
|
||||
Nodes.push_back(XElement(source, ns, space));
|
||||
}
|
||||
else
|
||||
{
|
||||
Nodes.push_back(XText(source->getString('<')));
|
||||
}
|
||||
if (space.isDefault())
|
||||
source->skipSpace();
|
||||
}
|
||||
source->next();
|
||||
}
|
||||
|
||||
|
||||
void NodeContainer::fromSource(NSCommon::smart_ptr<XWideSource> source, const XNamespaceContainer& ns, const XSpace& space)
|
||||
{
|
||||
if (space.isDefault())
|
||||
source->skipSpace();
|
||||
|
||||
while (true)
|
||||
{
|
||||
if (source->get() == L'<')
|
||||
{
|
||||
source->next();
|
||||
if (source->get() == L'/')
|
||||
break;
|
||||
if (isComment(source))
|
||||
insertComment(source);
|
||||
else
|
||||
Nodes.push_back(XElement(source, ns, space));
|
||||
}
|
||||
else
|
||||
{
|
||||
Nodes.push_back(XText(Encoding::unicode2utf8(source->getString(L'<'))));
|
||||
}
|
||||
if (space.isDefault())
|
||||
source->skipSpace();
|
||||
}
|
||||
source->next();
|
||||
}
|
||||
|
||||
|
||||
const std::string NodeContainer::ToString() const
|
||||
{
|
||||
return Nodes.ToString();
|
||||
}
|
||||
|
||||
|
||||
const std::wstring NodeContainer::ToWString() const
|
||||
{
|
||||
|
||||
throw not_implement();
|
||||
}
|
||||
|
||||
|
||||
void NodeContainer::SaveToStringList(std::list<std::string>& strList) const
|
||||
{
|
||||
Nodes.SaveToStringList(strList);
|
||||
}
|
||||
|
||||
|
||||
void NodeContainer::SaveToWStringList(std::list<std::wstring>& strList) const
|
||||
{
|
||||
Nodes.SaveToWStringList(strList);
|
||||
}
|
||||
|
||||
|
||||
void NodeContainer::Add(const XNode& node)
|
||||
{
|
||||
Nodes.Add(node);
|
||||
}
|
||||
|
||||
|
||||
void NodeContainer::Add(const XElement& element)
|
||||
{
|
||||
Elements.Add(element);
|
||||
}
|
||||
|
||||
|
||||
void NodeContainer::Add(const XText& text)
|
||||
{
|
||||
Texts.Add(text);
|
||||
}
|
||||
|
||||
|
||||
void NodeContainer::Add(const XComment& comment)
|
||||
{
|
||||
Nodes.Add(comment);
|
||||
}
|
||||
|
||||
|
||||
void NodeContainer::Add(const XList& list)
|
||||
{
|
||||
Nodes.merge(list.Nodes);
|
||||
}
|
||||
|
||||
|
||||
const bool NodeContainer::isComment(NSCommon::smart_ptr<XSingleSource> source)
|
||||
{
|
||||
if (source->get() == '!')
|
||||
{
|
||||
source->next();
|
||||
if (source->get() == '-')
|
||||
{
|
||||
source->next();
|
||||
if (source->get() == '-')
|
||||
{
|
||||
source->next();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void NodeContainer::insertComment(NSCommon::smart_ptr<XSingleSource> source)
|
||||
{
|
||||
std::string comment;
|
||||
while(true)
|
||||
{
|
||||
comment += source->getString('-');
|
||||
source->next();
|
||||
if (source->get() == '-')
|
||||
{
|
||||
source->next();
|
||||
if (source->get() == '>')
|
||||
{
|
||||
source->next();
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
comment += "--";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
comment += "-";
|
||||
}
|
||||
}
|
||||
Nodes.push_back(XComment(comment));
|
||||
}
|
||||
|
||||
|
||||
const bool NodeContainer::isComment(NSCommon::smart_ptr<XWideSource> source)
|
||||
{
|
||||
if (source->get() == L'!')
|
||||
{
|
||||
source->next();
|
||||
if (source->get() == L'-')
|
||||
{
|
||||
source->next();
|
||||
if (source->get() == L'-')
|
||||
{
|
||||
source->next();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void NodeContainer::insertComment(NSCommon::smart_ptr<XWideSource> source)
|
||||
{
|
||||
std::wstring comment;
|
||||
while(true)
|
||||
{
|
||||
comment += source->getString(L'-');
|
||||
source->next();
|
||||
if (source->get() == L'-')
|
||||
{
|
||||
source->next();
|
||||
if (source->get() == L'>')
|
||||
{
|
||||
source->next();
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
comment += L"--";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
comment += L"-";
|
||||
}
|
||||
}
|
||||
Nodes.push_back(XComment(Encoding::unicode2utf8(comment)));
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace XML
|
||||
116
ActiveX/Common/ASCDocxFormat/Source/XML/Private/NodeContainer.h
Normal file
116
ActiveX/Common/ASCDocxFormat/Source/XML/Private/NodeContainer.h
Normal file
@@ -0,0 +1,116 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef XML_PRIVATE_NODE_CONTAINER_INCLUDE_H_
|
||||
#define XML_PRIVATE_NODE_CONTAINER_INCLUDE_H_
|
||||
|
||||
#include <string>
|
||||
#include <list>
|
||||
|
||||
#include "Node.h"
|
||||
#include "XNodeContainer.h"
|
||||
#include "XElementContainer.h"
|
||||
#include "XTextContainer.h"
|
||||
#include "property.h"
|
||||
#include "XSpace.h"
|
||||
#include "XSingleSource.h"
|
||||
#include "XWideSource.h"
|
||||
|
||||
#include "../../../../../Common/DocxFormat/Source/Base/SmartPtr.h"
|
||||
|
||||
namespace XML
|
||||
{
|
||||
class XElement;
|
||||
class XComment;
|
||||
class XText;
|
||||
|
||||
namespace Private
|
||||
{
|
||||
class XNamespaceContainer;
|
||||
class XList;
|
||||
|
||||
class NodeContainer : public Node
|
||||
{
|
||||
public:
|
||||
NodeContainer();
|
||||
NodeContainer(const XNodeContainer& nodes);
|
||||
virtual ~NodeContainer();
|
||||
|
||||
public:
|
||||
explicit NodeContainer(const XElement& element);
|
||||
explicit NodeContainer(const XText& text);
|
||||
explicit NodeContainer(const XComment& comment);
|
||||
explicit NodeContainer(const XList& list);
|
||||
|
||||
public:
|
||||
virtual const bool isElement() const;
|
||||
virtual const bool isText() const;
|
||||
virtual const bool isComment() const;
|
||||
|
||||
public:
|
||||
void fromSource(NSCommon::smart_ptr<XSingleSource> source, const XNamespaceContainer& ns, const XSpace& space);
|
||||
void fromSource(NSCommon::smart_ptr<XWideSource> source, const XNamespaceContainer& ns, const XSpace& space);
|
||||
virtual const std::string ToString() const;
|
||||
virtual const std::wstring ToWString() const;
|
||||
virtual void SaveToStringList(std::list<std::string>& strList)const;
|
||||
virtual void SaveToWStringList(std::list<std::wstring>& strList)const;
|
||||
|
||||
public:
|
||||
template<template<typename T, typename A> class C, typename T, typename A>
|
||||
explicit NodeContainer(const C<T, A>& container) : Nodes(), Elements(Nodes), Texts(Nodes)
|
||||
{
|
||||
for (C<T, A>::const_iterator i = container.begin(); i != container.end(); ++i)
|
||||
Nodes.push_back(Write(*i));
|
||||
}
|
||||
|
||||
public:
|
||||
void Add(const XNode& node);
|
||||
void Add(const XElement& node);
|
||||
void Add(const XText& text);
|
||||
void Add(const XComment& comment);
|
||||
void Add(const XList& list);
|
||||
|
||||
private:
|
||||
const bool isComment(NSCommon::smart_ptr<XSingleSource> source);
|
||||
void insertComment(NSCommon::smart_ptr<XSingleSource> source);
|
||||
const bool isComment(NSCommon::smart_ptr<XWideSource> source);
|
||||
void insertComment(NSCommon::smart_ptr<XWideSource> source);
|
||||
|
||||
public:
|
||||
XNodeContainer Nodes;
|
||||
XElementContainer Elements;
|
||||
XTextContainer Texts;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // XML_PRIVATE_NODE_CONTAINER_INCLUDE_H_
|
||||
52
ActiveX/Common/ASCDocxFormat/Source/XML/Private/Null.cpp
Normal file
52
ActiveX/Common/ASCDocxFormat/Source/XML/Private/Null.cpp
Normal file
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled_xml.h"
|
||||
|
||||
|
||||
#include "Null.h"
|
||||
#include "NullText.h"
|
||||
|
||||
|
||||
namespace XML
|
||||
{
|
||||
namespace Private
|
||||
{
|
||||
|
||||
NullText& Null::Text()
|
||||
{
|
||||
static NullText text;
|
||||
return text;
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace XML
|
||||
51
ActiveX/Common/ASCDocxFormat/Source/XML/Private/Null.h
Normal file
51
ActiveX/Common/ASCDocxFormat/Source/XML/Private/Null.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef XML_PRIVATE_NULL_INCLUDE_H_
|
||||
#define XML_PRIVATE_NULL_INCLUDE_H_
|
||||
|
||||
|
||||
namespace XML
|
||||
{
|
||||
namespace Private
|
||||
{
|
||||
class NullText;
|
||||
|
||||
class Null
|
||||
{
|
||||
public:
|
||||
static NullText& Text();
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // XML_PRIVATE_NULL_INCLUDE_H_
|
||||
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled_xml.h"
|
||||
|
||||
|
||||
#include "NullAttribute.h"
|
||||
|
||||
|
||||
namespace XML
|
||||
{
|
||||
namespace Private
|
||||
{
|
||||
const bool NullAttribute::exist() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} // namespace XML
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef XML_PRIVATE_NULL_ATTRIBUTE_INCLUDE_H_
|
||||
#define XML_PRIVATE_NULL_ATTRIBUTE_INCLUDE_H_
|
||||
|
||||
#include "Attribute.h"
|
||||
|
||||
|
||||
namespace XML
|
||||
{
|
||||
namespace Private
|
||||
{
|
||||
class NullAttribute : public Attribute
|
||||
{
|
||||
public:
|
||||
virtual const bool exist() const;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // XML_PRIVATE_NULL_ATTRIBUTE_INCLUDE_H_
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled_xml.h"
|
||||
|
||||
|
||||
#include "NullElement.h"
|
||||
|
||||
|
||||
namespace XML
|
||||
{
|
||||
namespace Private
|
||||
{
|
||||
|
||||
const bool NullElement::exist() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
const XString NullElement::text() const
|
||||
{
|
||||
return XString();
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace XML
|
||||
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef XML_PRIVATE_NULL_ELEMENT_INCLUDE_H_
|
||||
#define XML_PRIVATE_NULL_ELEMENT_INCLUDE_H_
|
||||
|
||||
|
||||
#include "Element.h"
|
||||
|
||||
|
||||
namespace XML
|
||||
{
|
||||
namespace Private
|
||||
{
|
||||
class NullElement : public Element
|
||||
{
|
||||
public:
|
||||
virtual const bool exist() const;
|
||||
virtual const XString text() const;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // XML_PRIVATE_NULL_ELEMENT_INCLUDE_H_
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled_xml.h"
|
||||
|
||||
|
||||
#include "NullNamespace.h"
|
||||
|
||||
|
||||
namespace XML
|
||||
{
|
||||
namespace Private
|
||||
{
|
||||
|
||||
const bool NullNamespace::exist() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace XML
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef XML_PRIVATE_NULL_NAMESPACE_INCLUDE_H_
|
||||
#define XML_PRIVATE_NULL_NAMESPACE_INCLUDE_H_
|
||||
|
||||
#include "Namespace.h"
|
||||
|
||||
|
||||
namespace XML
|
||||
{
|
||||
namespace Private
|
||||
{
|
||||
class NullNamespace : public Namespace
|
||||
{
|
||||
public:
|
||||
virtual const bool exist() const;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // XML_PRIVATE_NULL_NAMESPACE_INCLUDE_H_
|
||||
46
ActiveX/Common/ASCDocxFormat/Source/XML/Private/NullText.cpp
Normal file
46
ActiveX/Common/ASCDocxFormat/Source/XML/Private/NullText.cpp
Normal file
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled_xml.h"
|
||||
|
||||
|
||||
#include "NullText.h"
|
||||
|
||||
|
||||
namespace XML
|
||||
{
|
||||
namespace Private
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
} // namespace XML
|
||||
52
ActiveX/Common/ASCDocxFormat/Source/XML/Private/NullText.h
Normal file
52
ActiveX/Common/ASCDocxFormat/Source/XML/Private/NullText.h
Normal file
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef XML_PRIVATE_NULL_TEXT_INCLUDE_H_
|
||||
#define XML_PRIVATE_NULL_TEXT_INCLUDE_H_
|
||||
|
||||
#include "Text.h"
|
||||
|
||||
|
||||
namespace XML
|
||||
{
|
||||
namespace Private
|
||||
{
|
||||
class NullText : public Text
|
||||
{
|
||||
};
|
||||
|
||||
static NullText nullText;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif // XML_PRIVATE_NULL_TEXT_INCLUDE_H_
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled_xml.h"
|
||||
|
||||
|
||||
#include "NullXAttribute.h"
|
||||
#include "NullAttribute.h"
|
||||
|
||||
|
||||
namespace XML
|
||||
{
|
||||
namespace Private
|
||||
{
|
||||
NullXAttribute::NullXAttribute()
|
||||
: XAttribute(NullAttribute())
|
||||
{
|
||||
}
|
||||
|
||||
const bool NullXAttribute::exist() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} // namespace XML
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef XML_PRIVATE_NULL_XATTRIBUTE_INCLUDE_H_
|
||||
#define XML_PRIVATE_NULL_XATTRIBUTE_INCLUDE_H_
|
||||
|
||||
#include "./../XAttribute.h"
|
||||
|
||||
|
||||
namespace XML
|
||||
{
|
||||
namespace Private
|
||||
{
|
||||
class NullXAttribute : public XAttribute
|
||||
{
|
||||
public:
|
||||
NullXAttribute();
|
||||
|
||||
public:
|
||||
virtual const bool exist() const;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // XML_PRIVATE_NULL_XATTRIBUTE_INCLUDE_H_
|
||||
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled_xml.h"
|
||||
|
||||
|
||||
#include "NullXElement.h"
|
||||
|
||||
namespace XML
|
||||
{
|
||||
namespace Private
|
||||
{
|
||||
NullXElement::NullXElement() : XElement(*this)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
const bool NullXElement::exist() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace XML
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef XML_PRIVATE_NULL_XELEMENT_INCLUDE_H_
|
||||
#define XML_PRIVATE_NULL_XELEMENT_INCLUDE_H_
|
||||
|
||||
#include "./../XElement.h"
|
||||
|
||||
|
||||
namespace XML
|
||||
{
|
||||
namespace Private
|
||||
{
|
||||
class NullXElement : public XElement
|
||||
{
|
||||
public:
|
||||
NullXElement();
|
||||
|
||||
public:
|
||||
virtual const bool exist() const;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // XML_PRIVATE_NULL_XELEMENT_INCLUDE_H_
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled_xml.h"
|
||||
|
||||
|
||||
#include "NullXNamespace.h"
|
||||
|
||||
|
||||
namespace XML
|
||||
{
|
||||
namespace Private
|
||||
{
|
||||
|
||||
const bool NullXNamespace::exist() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace XML
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef XML_PRIVATE_NULL_XNAMESPACE_INCLUDE_H_
|
||||
#define XML_PRIVATE_NULL_XNAMESPACE_INCLUDE_H_
|
||||
|
||||
#include "./../XNamespace.h"
|
||||
|
||||
|
||||
namespace XML
|
||||
{
|
||||
namespace Private
|
||||
{
|
||||
class NullXNamespace : public XNamespace
|
||||
{
|
||||
virtual const bool exist() const;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // XML_PRIVATE_NULL_XNAMESPACE_INCLUDE_H_
|
||||
104
ActiveX/Common/ASCDocxFormat/Source/XML/Private/Text.cpp
Normal file
104
ActiveX/Common/ASCDocxFormat/Source/XML/Private/Text.cpp
Normal file
@@ -0,0 +1,104 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled_xml.h"
|
||||
|
||||
|
||||
#include "Text.h"
|
||||
#include "Lexigraph.h"
|
||||
#include "Encoding.h"
|
||||
|
||||
|
||||
namespace XML
|
||||
{
|
||||
namespace Private
|
||||
{
|
||||
|
||||
Text::Text()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Text::Text(const std::string& value)
|
||||
: Value(value)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Text::~Text()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
const bool Text::isElement() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
const bool Text::isText() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
const bool Text::isComment() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
const std::string Text::ToString() const
|
||||
{
|
||||
return Private::Lexigraph::toSource(Value.ToString());
|
||||
}
|
||||
|
||||
|
||||
const std::wstring Text::ToWString() const
|
||||
{
|
||||
return Private::Lexigraph::toSource(Value.ToWString());
|
||||
}
|
||||
|
||||
|
||||
void Text::SaveToStringList(std::list<std::string>& strList)const
|
||||
{
|
||||
strList.push_back(Private::Lexigraph::toSource(Value.ToString()));
|
||||
}
|
||||
|
||||
|
||||
void Text::SaveToWStringList(std::list<std::wstring>& strList)const
|
||||
{
|
||||
strList.push_back(Private::Lexigraph::toSource(Value.ToWString()));
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace XML
|
||||
72
ActiveX/Common/ASCDocxFormat/Source/XML/Private/Text.h
Normal file
72
ActiveX/Common/ASCDocxFormat/Source/XML/Private/Text.h
Normal file
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef XML_PRIVATE_TEXT_INCLUDE_H_
|
||||
#define XML_PRIVATE_TEXT_INCLUDE_H_
|
||||
|
||||
#include "Node.h"
|
||||
#include <string>
|
||||
#include "XString.h"
|
||||
#include "property.h"
|
||||
|
||||
|
||||
namespace XML
|
||||
{
|
||||
namespace Private
|
||||
{
|
||||
class Text : public Node
|
||||
{
|
||||
public:
|
||||
explicit Text(const std::string& value);
|
||||
virtual ~Text();
|
||||
|
||||
public:
|
||||
virtual const bool isElement() const;
|
||||
virtual const bool isText() const;
|
||||
virtual const bool isComment() const;
|
||||
|
||||
public:
|
||||
virtual const std::string ToString() const;
|
||||
virtual const std::wstring ToWString() const;
|
||||
virtual void SaveToStringList(std::list<std::string>& strList)const;
|
||||
virtual void SaveToWStringList(std::list<std::wstring>& strList)const;
|
||||
|
||||
public:
|
||||
XString Value;
|
||||
|
||||
protected:
|
||||
Text();
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // XML_XTEXT_INCLUDE_H_
|
||||
@@ -0,0 +1,127 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled_xml.h"
|
||||
|
||||
|
||||
#include "XAttributeContainer.h"
|
||||
#include "./../XName.h"
|
||||
#include <algorithm>
|
||||
#include "NullXAttribute.h"
|
||||
|
||||
namespace XML
|
||||
{
|
||||
namespace Private
|
||||
{
|
||||
static NullXAttribute nullXAttribute;
|
||||
|
||||
const bool XAttributeContainer::exist(const XName& xname) const
|
||||
{
|
||||
for(const_iterator current = begin(); current != end(); current++)
|
||||
{
|
||||
if ((*current)->XName->Equal(xname))
|
||||
return true;
|
||||
}
|
||||
|
||||
for(const_iterator current = begin(); current != end(); current++)
|
||||
{
|
||||
if ((*current)->XName == xname)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
XAttribute& XAttributeContainer::operator[] (const XName& xname)
|
||||
{
|
||||
for(iterator current = begin(); current != end(); current++)
|
||||
{
|
||||
if ((*current)->XName->Equal(xname))
|
||||
return *current;
|
||||
}
|
||||
for(iterator current = begin(); current != end(); current++)
|
||||
{
|
||||
if ((*current)->XName == xname)
|
||||
return *current;
|
||||
}
|
||||
return nullXAttribute;
|
||||
}
|
||||
|
||||
const XAttribute& XAttributeContainer::operator[] (const XName& xname) const
|
||||
{
|
||||
for(const_iterator current = begin(); current != end(); current++)
|
||||
{
|
||||
if ((*current)->XName->Equal(xname))
|
||||
return *current;
|
||||
}
|
||||
for(const_iterator current = begin(); current != end(); current++)
|
||||
{
|
||||
if ((*current)->XName == xname)
|
||||
return *current;
|
||||
}
|
||||
return nullXAttribute;
|
||||
}
|
||||
|
||||
const XNamespaceContainer XAttributeContainer::usedNamespace() const
|
||||
{
|
||||
XNamespaceContainer container;
|
||||
|
||||
for(const_iterator current = begin(); current != end(); current++)
|
||||
{
|
||||
if ((*current)->XName->Ns.is_init())
|
||||
container.Add((*current)->XName->Ns);
|
||||
}
|
||||
|
||||
return container;
|
||||
}
|
||||
|
||||
XAttributeContainer::iterator XAttributeContainer:: begin()
|
||||
{
|
||||
return m_container.begin();
|
||||
}
|
||||
|
||||
XAttributeContainer::iterator XAttributeContainer::end()
|
||||
{
|
||||
return m_container.end();
|
||||
}
|
||||
|
||||
XAttributeContainer::const_iterator XAttributeContainer::begin() const
|
||||
{
|
||||
return m_container.begin();
|
||||
}
|
||||
|
||||
XAttributeContainer::const_iterator XAttributeContainer::end() const
|
||||
{
|
||||
return m_container.end();
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace XML
|
||||
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef XML_PRIVATE_XATTRIBUTE_CONTAINER_INCLUDE_H_
|
||||
#define XML_PRIVATE_XATTRIBUTE_CONTAINER_INCLUDE_H_
|
||||
|
||||
#include "XContainer.h"
|
||||
#include "./../XAttribute.h"
|
||||
#include "XNamespaceContainer.h"
|
||||
|
||||
|
||||
namespace XML
|
||||
{
|
||||
class XName;
|
||||
|
||||
namespace Private
|
||||
{
|
||||
class XAttributeContainer : public XContainer<XAttribute>
|
||||
{
|
||||
public:
|
||||
const bool exist(const XName& xname) const;
|
||||
|
||||
XAttributeContainer const* const operator->() const {return this;}
|
||||
XAttributeContainer* operator->() {return this;}
|
||||
|
||||
XAttribute& operator[] (const XName& xname);
|
||||
const XAttribute& operator[] (const XName& xname) const;
|
||||
|
||||
const XNamespaceContainer usedNamespace() const;
|
||||
|
||||
public:
|
||||
typedef std::list<XAttribute>::iterator iterator;
|
||||
typedef std::list<XAttribute>::const_iterator const_iterator;
|
||||
|
||||
public:
|
||||
iterator begin();
|
||||
iterator end();
|
||||
const_iterator begin() const;
|
||||
const_iterator end() const;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // XML_PRIVATE_XATTRIBUTE_CONTAINER_INCLUDE_H_
|
||||
169
ActiveX/Common/ASCDocxFormat/Source/XML/Private/XContainer.h
Normal file
169
ActiveX/Common/ASCDocxFormat/Source/XML/Private/XContainer.h
Normal file
@@ -0,0 +1,169 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef XML_PRIVATE_XCONTAINER_INCLUDE_H_
|
||||
#define XML_PRIVATE_XCONTAINER_INCLUDE_H_
|
||||
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
#include <list>
|
||||
|
||||
namespace XML
|
||||
{
|
||||
namespace Private
|
||||
{
|
||||
template<class T>
|
||||
class XContainer
|
||||
{
|
||||
public:
|
||||
void push_back(const T& value);
|
||||
void Add(const T& value);
|
||||
const bool content(const T& other) const;
|
||||
void merge(const XContainer<T>& other);
|
||||
|
||||
const size_t size() const;
|
||||
const bool empty() const;
|
||||
|
||||
XContainer<T> const* const operator->() const {return this;}
|
||||
XContainer<T>* operator->() {return this;}
|
||||
|
||||
public:
|
||||
const std::string ToString() const;
|
||||
const std::wstring ToWString() const;
|
||||
virtual void SaveToStringList(std::list<std::string>& strList)const;
|
||||
virtual void SaveToWStringList(std::list<std::wstring>& strList)const;
|
||||
|
||||
protected:
|
||||
std::list<T> m_container;
|
||||
|
||||
};
|
||||
|
||||
|
||||
template<class T>
|
||||
void XContainer<T>::push_back(const T& value)
|
||||
{
|
||||
if (value.is_init() && !content(value))
|
||||
m_container.push_back(value);
|
||||
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
void XContainer<T>::Add(const T& value)
|
||||
{
|
||||
push_back(value);
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
const bool XContainer<T>::content(const T& other) const
|
||||
{
|
||||
for(std::list<T>::const_iterator current = m_container.begin(); current != m_container.end(); current++)
|
||||
{
|
||||
if(*(*current) == *other)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
void XContainer<T>::merge(const XContainer<T>& other)
|
||||
{
|
||||
for(std::list<T>::const_iterator current = other.m_container.begin(); current != other.m_container.end(); current++)
|
||||
push_back(*current);
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
const size_t XContainer<T>::size() const
|
||||
{
|
||||
return m_container.size();
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
const bool XContainer<T>::empty() const
|
||||
{
|
||||
return m_container.empty();
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
const std::string XContainer<T>::ToString() const
|
||||
{
|
||||
std::string result;
|
||||
for(std::list<T>::const_iterator current = m_container.begin(); current != m_container.end(); current++)
|
||||
{
|
||||
result += " ";
|
||||
result += (*current)->ToString();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
const std::wstring XContainer<T>::ToWString() const
|
||||
{
|
||||
std::wstring result;
|
||||
for(std::list<T>::const_iterator current = m_container.begin(); current != m_container.end(); current++)
|
||||
{
|
||||
result += L" ";
|
||||
result += (*current)->ToWString();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
void XContainer<T>::SaveToStringList(std::list<std::string>& strList)const
|
||||
{
|
||||
for(std::list<T>::const_iterator current = m_container.begin(); current != m_container.end(); current++)
|
||||
{
|
||||
strList.push_back(" ");
|
||||
(*current)->SaveToStringList(strList);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
void XContainer<T>::SaveToWStringList(std::list<std::wstring>& strList)const
|
||||
{
|
||||
for(std::list<T>::const_iterator current = m_container.begin(); current != m_container.end(); current++)
|
||||
{
|
||||
strList.push_back(L" ");
|
||||
(*current)->SaveToWStringList(strList);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif // XML_PRIVATE_XCONTAINER_INCLUDE_H_
|
||||
102
ActiveX/Common/ASCDocxFormat/Source/XML/Private/XDeclaration.cpp
Normal file
102
ActiveX/Common/ASCDocxFormat/Source/XML/Private/XDeclaration.cpp
Normal file
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled_xml.h"
|
||||
|
||||
|
||||
#include "XDeclaration.h"
|
||||
#include "Encoding.h"
|
||||
|
||||
namespace XML
|
||||
{
|
||||
namespace Private
|
||||
{
|
||||
XDeclaration::XDeclaration() : Version("1.0"), Encoding("UTF-8"), Standalone("yes")
|
||||
{
|
||||
}
|
||||
|
||||
void XDeclaration::fromSource(NSCommon::smart_ptr<XSingleSource> source)
|
||||
{
|
||||
source->find('?');
|
||||
source->next();
|
||||
source->skipSpace();
|
||||
|
||||
while (source->get() != '?')
|
||||
{
|
||||
const std::pair<const std::string, const std::string> pair = source->getPair();
|
||||
setValue(pair.first, pair.second);
|
||||
source->skipSpace();
|
||||
}
|
||||
source->find('>');
|
||||
source->next();
|
||||
}
|
||||
|
||||
void XDeclaration::fromSource(NSCommon::smart_ptr<XWideSource> source)
|
||||
{
|
||||
source->find(L'?');
|
||||
source->next();
|
||||
source->skipSpace();
|
||||
|
||||
while (source->get() != L'?')
|
||||
{
|
||||
const std::pair<const std::wstring, const std::wstring> pair = source->getPair();
|
||||
setValue(Encoding::unicode2utf8(pair.first), Encoding::unicode2utf8(pair.second));
|
||||
source->skipSpace();
|
||||
}
|
||||
source->find(L'>');
|
||||
source->next();
|
||||
}
|
||||
|
||||
const std::string XDeclaration::ToString() const
|
||||
{
|
||||
return "<?xml version=\"" + Version.ToString() + "\" encoding=\"" + Encoding.ToString() +
|
||||
(Standalone.is_init() ? ("\" standalone=\"" + Standalone.ToString()) : "") + "\" ?>";
|
||||
}
|
||||
|
||||
const std::wstring XDeclaration::ToWString() const
|
||||
{
|
||||
return L"<?xml version=\"" + Encoding::utf82unicode(Version.ToString()) + L"\" encoding=\"" + L"Unicode" +
|
||||
(Standalone.is_init() ? (L"\" standalone=\"" + Encoding::utf82unicode(Standalone.ToString())) : L"") + L"\" ?>";
|
||||
}
|
||||
|
||||
void XDeclaration::setValue(const std::string& name, const std::string& value)
|
||||
{
|
||||
if (name == "version")
|
||||
Version = value;
|
||||
else if (name == "encoding")
|
||||
Encoding = value;
|
||||
else if (name == "standalone")
|
||||
Standalone = value;
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace XML
|
||||
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef XML_XDECLARATION_INCLUDE_H_
|
||||
#define XML_XDECLARATION_INCLUDE_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "property.h"
|
||||
#include "nullable_property.h"
|
||||
#include "./../Limit/Version.h"
|
||||
#include "./../Limit/Encoding.h"
|
||||
#include "./../Limit/Standalone.h"
|
||||
#include "XSingleSource.h"
|
||||
#include "XWideSource.h"
|
||||
|
||||
#include "../../../../../Common/DocxFormat/Source/Base/SmartPtr.h"
|
||||
|
||||
namespace XML
|
||||
{
|
||||
namespace Private
|
||||
{
|
||||
class XDeclaration
|
||||
{
|
||||
public:
|
||||
XDeclaration();
|
||||
|
||||
public:
|
||||
void fromSource(NSCommon::smart_ptr<XSingleSource> source);
|
||||
void fromSource(NSCommon::smart_ptr<XWideSource> source);
|
||||
const std::string ToString() const;
|
||||
const std::wstring ToWString() const;
|
||||
|
||||
public:
|
||||
property<std::string, Limit::Version> Version;
|
||||
property<std::string, Limit::Encoding> Encoding;
|
||||
nullable_property<std::string, Limit::Standalone> Standalone;
|
||||
|
||||
private:
|
||||
void setValue(const std::string& name, const std::string& value);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // XML_XDECLARATION_INCLUDE_H_
|
||||
@@ -0,0 +1,195 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled_xml.h"
|
||||
|
||||
|
||||
#include "XElementContainer.h"
|
||||
#include "XNodeContainer.h"
|
||||
#include "./../XNode.h"
|
||||
#include "./../XElement.h"
|
||||
#include "./../XName.h"
|
||||
#include "NullXElement.h"
|
||||
|
||||
namespace XML
|
||||
{
|
||||
namespace Private
|
||||
{
|
||||
static NullXElement nullXElement;
|
||||
|
||||
XElementContainer::XElementContainer(const XNodeContainer& nodes) : m_container(nodes.container())
|
||||
{
|
||||
}
|
||||
|
||||
const bool XElementContainer::empty() const
|
||||
{
|
||||
return size() == 0;
|
||||
}
|
||||
|
||||
const size_t XElementContainer::size() const
|
||||
{
|
||||
size_t size = 0;
|
||||
for (const_iterator i = begin(); i != end(); ++i)
|
||||
++size;
|
||||
return size;
|
||||
}
|
||||
|
||||
void XElementContainer::push_back(const XElement& element)
|
||||
{
|
||||
if (element.is_init() && element.exist())
|
||||
{
|
||||
m_container->push_back(element);
|
||||
}
|
||||
}
|
||||
|
||||
void XElementContainer::Add(const XElement& element)
|
||||
{
|
||||
push_back(element);
|
||||
}
|
||||
|
||||
const bool XElementContainer::exist(const XName& xname) const
|
||||
{
|
||||
if (m_container.IsInit())
|
||||
{
|
||||
const std::list<XNode>& container = m_container.operator*();
|
||||
for (std::list<XNode>::const_iterator i = container.begin(); i != container.end(); ++i)
|
||||
{
|
||||
if(i->isElement())
|
||||
{
|
||||
if (XElement(*i)->XName == xname)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
XElement XElementContainer::operator[] (const XName& xname)
|
||||
{
|
||||
const std::list<XNode>& container = m_container.operator*();
|
||||
for (std::list<XNode>::const_iterator i = container.begin(); i != container.end(); ++i)
|
||||
{
|
||||
if(i->isElement())
|
||||
{
|
||||
if (XElement(*i)->XName->Equal(xname))
|
||||
return *i;
|
||||
}
|
||||
}
|
||||
for (std::list<XNode>::const_iterator i = container.begin(); i != container.end(); ++i)
|
||||
{
|
||||
if(i->isElement())
|
||||
{
|
||||
if (XElement(*i)->XName == xname)
|
||||
return *i;
|
||||
}
|
||||
}
|
||||
return nullXElement;
|
||||
}
|
||||
|
||||
const XElement XElementContainer::operator[] (const XName& xname) const
|
||||
{
|
||||
const std::list<XNode>& container = m_container.operator*();
|
||||
for (std::list<XNode>::const_iterator i = container.begin(); i != container.end(); ++i)
|
||||
{
|
||||
if(i->isElement())
|
||||
{
|
||||
if (XElement(*i)->XName->Equal(xname))
|
||||
return *i;
|
||||
}
|
||||
}
|
||||
|
||||
for (std::list<XNode>::const_iterator i = container.begin(); i != container.end(); ++i)
|
||||
{
|
||||
if(i->isElement())
|
||||
{
|
||||
if (XElement(*i)->XName == xname)
|
||||
return *i;
|
||||
}
|
||||
}
|
||||
|
||||
return nullXElement;
|
||||
}
|
||||
|
||||
XElement XElementContainer::get(const XName& xname, const std::string& value)
|
||||
{
|
||||
for (iterator i = begin(); i != end(); ++i)
|
||||
{
|
||||
XElement element(*i);
|
||||
if (element.Attributes.exist(xname) && element.Attributes[xname].value().ToString() == value)
|
||||
return *i;
|
||||
}
|
||||
return nullXElement;
|
||||
}
|
||||
|
||||
const XElement XElementContainer::get(const XName& xname, const std::string& value) const
|
||||
{
|
||||
for (const_iterator i = begin(); i != end(); ++i)
|
||||
{
|
||||
XElement element(*i);
|
||||
if (element.Attributes.exist(xname) && element.Attributes[xname].value().ToString() == value)
|
||||
return *i;
|
||||
}
|
||||
return nullXElement;
|
||||
}
|
||||
|
||||
XElementContainer::iterator XElementContainer:: begin()
|
||||
{
|
||||
return m_container->begin();
|
||||
}
|
||||
|
||||
XElementContainer::iterator XElementContainer::end()
|
||||
{
|
||||
return m_container->end();
|
||||
}
|
||||
|
||||
XElementContainer::const_iterator XElementContainer::begin() const
|
||||
{
|
||||
return m_container->begin();
|
||||
}
|
||||
|
||||
XElementContainer::const_iterator XElementContainer::end() const
|
||||
{
|
||||
return m_container->end();
|
||||
}
|
||||
|
||||
const XNamespaceContainer XElementContainer::usedNamespace() const
|
||||
{
|
||||
XNamespaceContainer container;
|
||||
|
||||
for (const_iterator i = begin(); i != end(); ++i)
|
||||
container.merge(XElement(*i)->usedNamespace());
|
||||
|
||||
return container;
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace XML
|
||||
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef XML_PRIVATE_XELEMENT_CONTAINER_INCLUDE_H_
|
||||
#define XML_PRIVATE_XELEMENT_CONTAINER_INCLUDE_H_
|
||||
|
||||
#include <list>
|
||||
|
||||
#include "Filter/Element.h"
|
||||
#include "XNamespaceContainer.h"
|
||||
|
||||
#include "../../../../../Common/DocxFormat/Source/Base/SmartPtr.h"
|
||||
|
||||
namespace XML
|
||||
{
|
||||
class XNode;
|
||||
class XElement;
|
||||
class XName;
|
||||
|
||||
namespace Private
|
||||
{
|
||||
class XNodeContainer;
|
||||
|
||||
class XElementContainer
|
||||
{
|
||||
public:
|
||||
XElementContainer(const XNodeContainer& nodes);
|
||||
|
||||
public:
|
||||
const bool empty() const;
|
||||
const size_t size() const;
|
||||
void push_back(const XElement& element);
|
||||
void Add(const XElement& element);
|
||||
|
||||
public:
|
||||
|
||||
typedef std::list<XNode>::iterator iterator;
|
||||
typedef std::list<XNode>::const_iterator const_iterator;
|
||||
|
||||
public:
|
||||
XElementContainer const* const operator->() const {return this;}
|
||||
XElementContainer* operator->() {return this;}
|
||||
|
||||
const bool exist(const XName& xname) const;
|
||||
XElement operator[] (const XName& xname);
|
||||
const XElement operator[] (const XName& xname) const;
|
||||
|
||||
XElement get(const XName& xname, const std::string& value);
|
||||
const XElement get(const XName& xname, const std::string& value) const;
|
||||
|
||||
const XNamespaceContainer usedNamespace() const;
|
||||
|
||||
public:
|
||||
iterator begin();
|
||||
iterator end();
|
||||
const_iterator begin() const;
|
||||
const_iterator end() const;
|
||||
|
||||
private:
|
||||
NSCommon::smart_ptr<std::list<XNode> > m_container;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif // XML_PRIVATE_XELEMENT_CONTAINER_INCLUDE_H_
|
||||
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled_xml.h"
|
||||
|
||||
|
||||
#include "XFileSource.h"
|
||||
#include "Exception\not_implement.h"
|
||||
|
||||
|
||||
namespace XML
|
||||
{
|
||||
namespace Private
|
||||
{
|
||||
XFileSource::XFileSource(const OOX::CPath& path)
|
||||
: m_stream(path.GetPath())
|
||||
{
|
||||
setBegin();
|
||||
}
|
||||
|
||||
|
||||
XFileSource::~XFileSource()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void XFileSource::setBegin()
|
||||
{
|
||||
m_iterator = m_stream;
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace XML
|
||||
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef XML_PRIVATE_XFILE_SOURCE_INCLUDE_H_
|
||||
#define XML_PRIVATE_XFILE_SOURCE_INCLUDE_H_
|
||||
|
||||
#include "XSingleSource.h"
|
||||
#include <fstream>
|
||||
#include <iterator>
|
||||
|
||||
#include "../../../../../Common/DocxFormat/Source/SystemUtility/SystemUtility.h"
|
||||
|
||||
namespace XML
|
||||
{
|
||||
namespace Private
|
||||
{
|
||||
class XFileSource : public XSingleSource
|
||||
{
|
||||
public:
|
||||
XFileSource(const OOX::CPath& path);
|
||||
virtual ~XFileSource();
|
||||
|
||||
private:
|
||||
void setBegin();
|
||||
|
||||
private:
|
||||
std::ifstream m_stream;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // XML_PRIVATE_XFILE_SOURCE_INCLUDE_H_
|
||||
153
ActiveX/Common/ASCDocxFormat/Source/XML/Private/XList.cpp
Normal file
153
ActiveX/Common/ASCDocxFormat/Source/XML/Private/XList.cpp
Normal file
@@ -0,0 +1,153 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled_xml.h"
|
||||
|
||||
|
||||
#include "XList.h"
|
||||
#include "./../XText.h"
|
||||
#include "./../XElement.h"
|
||||
#include "./../XComment.h"
|
||||
#include "./../XContainer.h"
|
||||
|
||||
|
||||
namespace XML
|
||||
{
|
||||
namespace Private
|
||||
{
|
||||
|
||||
XList::XList()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
XList::XList(const XAttribute& attribute)
|
||||
{
|
||||
Attributes->push_back(attribute);
|
||||
}
|
||||
|
||||
|
||||
XList::XList(const XNamespace& ns)
|
||||
{
|
||||
Namespaces->push_back(ns);
|
||||
}
|
||||
|
||||
|
||||
XList::XList(const XText& text)
|
||||
{
|
||||
Nodes->push_back(text);
|
||||
}
|
||||
|
||||
|
||||
XList::XList(const XElement& element)
|
||||
{
|
||||
Nodes->push_back(element);
|
||||
}
|
||||
|
||||
|
||||
XList::XList(const XComment& comment)
|
||||
{
|
||||
Nodes->push_back(comment);
|
||||
}
|
||||
|
||||
|
||||
XList::XList(const XML::XContainer& container)
|
||||
{
|
||||
Nodes = container->Nodes;
|
||||
}
|
||||
|
||||
|
||||
XList::XList(const XNode& node)
|
||||
{
|
||||
Nodes->push_back(node);
|
||||
}
|
||||
|
||||
|
||||
XList& XList::Add(const XList& list)
|
||||
{
|
||||
Attributes->merge(list.Attributes);
|
||||
Namespaces->merge(list.Namespaces);
|
||||
Nodes->merge(list.Nodes);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
XList& XList::Add(const XAttribute& attribute)
|
||||
{
|
||||
Attributes->push_back(attribute);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
XList& XList::Add(const XNamespace& ns)
|
||||
{
|
||||
Namespaces->push_back(ns);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
XList& XList::Add(const XText& text)
|
||||
{
|
||||
Nodes->push_back(text);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
XList& XList::Add(const XElement& element)
|
||||
{
|
||||
Nodes->push_back(element);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
XList& XList::Add(const XComment& comment)
|
||||
{
|
||||
Nodes->push_back(comment);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
XList& XList::Add(const XML::XContainer& container)
|
||||
{
|
||||
Nodes->push_back(container);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
XList& XList::Add(const XNode& node)
|
||||
{
|
||||
Nodes->push_back(node);
|
||||
return *this;
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace XML
|
||||
180
ActiveX/Common/ASCDocxFormat/Source/XML/Private/XList.h
Normal file
180
ActiveX/Common/ASCDocxFormat/Source/XML/Private/XList.h
Normal file
@@ -0,0 +1,180 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef XML_PRIVATE_XLIST_INCLUDE_H_
|
||||
#define XML_PRIVATE_XLIST_INCLUDE_H_
|
||||
|
||||
#include "XAttributeContainer.h"
|
||||
#include "XNamespaceContainer.h"
|
||||
#include "XNodeContainer.h"
|
||||
#include "property.h"
|
||||
|
||||
|
||||
namespace XML
|
||||
{
|
||||
class XText;
|
||||
class XElement;
|
||||
class XComment;
|
||||
class XContainer;
|
||||
class XNode;
|
||||
|
||||
namespace Private
|
||||
{
|
||||
class XList
|
||||
{
|
||||
public:
|
||||
XList();
|
||||
XList(const XAttribute& attribute);
|
||||
XList(const XNamespace& ns);
|
||||
XList(const XText& text);
|
||||
XList(const XElement& element);
|
||||
XList(const XComment& comment);
|
||||
XList(const XML::XContainer& container);
|
||||
XList(const XNode& node);
|
||||
|
||||
public:
|
||||
XList& Add(const XList& list);
|
||||
XList& Add(const XAttribute& attribute);
|
||||
XList& Add(const XNamespace& ns);
|
||||
XList& Add(const XText& text);
|
||||
XList& Add(const XElement& element);
|
||||
XList& Add(const XComment& comment);
|
||||
XList& Add(const XML::XContainer& container);
|
||||
XList& Add(const XNode& node);
|
||||
|
||||
public:
|
||||
property<XAttributeContainer> Attributes;
|
||||
property<XNamespaceContainer> Namespaces;
|
||||
property<XNodeContainer> Nodes;
|
||||
};
|
||||
}
|
||||
|
||||
template<class T>
|
||||
Private::XList& operator ,(Private::XList& rhs, const T& lhs)
|
||||
{
|
||||
return rhs.Add(lhs);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
Private::XList operator ,(const XNamespace& rhs, const T& lhs)
|
||||
{
|
||||
return Private::XList(rhs).Add(lhs);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
Private::XList operator ,(const XAttribute& rhs, const T& lhs)
|
||||
{
|
||||
return Private::XList(rhs).Add(lhs);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
Private::XList operator ,(const XText& rhs, const T& lhs)
|
||||
{
|
||||
return Private::XList(rhs).Add(lhs);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
Private::XList operator ,(const XElement& rhs, const T& lhs)
|
||||
{
|
||||
return Private::XList(rhs).Add(lhs);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
Private::XList operator ,(const XComment& rhs, const T& lhs)
|
||||
{
|
||||
return Private::XList(rhs).Add(lhs);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
Private::XList operator ,(const XContainer& rhs, const T& lhs)
|
||||
{
|
||||
return Private::XList(rhs).Add(lhs);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
Private::XList operator ,(const XNode& rhs, const T& lhs)
|
||||
{
|
||||
return Private::XList(rhs).Add(lhs);
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
Private::XList& operator +(Private::XList& rhs, const T& lhs)
|
||||
{
|
||||
return rhs.Add(lhs);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
Private::XList operator +(const XAttribute& rhs, const T& lhs)
|
||||
{
|
||||
return Private::XList(rhs).Add(lhs);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
Private::XList operator +(const XNamespace& rhs, const T& lhs)
|
||||
{
|
||||
return Private::XList(rhs).Add(lhs);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
Private::XList operator +(const XText& rhs, const T& lhs)
|
||||
{
|
||||
return Private::XList(rhs).Add(lhs);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
Private::XList operator +(const XElement& rhs, const T& lhs)
|
||||
{
|
||||
return Private::XList(rhs).Add(lhs);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
Private::XList operator +(const XComment& rhs, const T& lhs)
|
||||
{
|
||||
return Private::XList(rhs).Add(lhs);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
Private::XList operator +(const XContainer& rhs, const T& lhs)
|
||||
{
|
||||
return Private::XList(rhs).Add(lhs);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
Private::XList operator +(const XNode& rhs, const T& lhs)
|
||||
{
|
||||
return Private::XList(rhs).Add(lhs);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif // XML_PRIVATE_XLIST_INCLUDE_H_
|
||||
@@ -0,0 +1,119 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled_xml.h"
|
||||
|
||||
|
||||
#include "XNamespaceContainer.h"
|
||||
#include "NullXNamespace.h"
|
||||
|
||||
|
||||
namespace XML
|
||||
{
|
||||
namespace Private
|
||||
{
|
||||
static NullXNamespace nullXNamespace;
|
||||
|
||||
const bool XNamespaceContainer::exist(const std::string& name) const
|
||||
{
|
||||
for (std::list<XNamespace>::const_iterator current = m_container.begin(); current != m_container.end(); ++current)
|
||||
{
|
||||
if ((*current)->GetPrefix() == name)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
XNamespace& XNamespaceContainer::operator[] (const std::string& name)
|
||||
{
|
||||
for (std::list<XNamespace>::iterator current = m_container.begin(); current != m_container.end(); ++current)
|
||||
{
|
||||
if ((*current)->GetPrefix() == name)
|
||||
return (*current);
|
||||
}
|
||||
return nullXNamespace;
|
||||
}
|
||||
|
||||
const XNamespace& XNamespaceContainer::operator[] (const std::string& name) const
|
||||
{
|
||||
for (std::list<XNamespace>::const_iterator current = m_container.begin(); current != m_container.end(); ++current)
|
||||
{
|
||||
if ((*current)->GetPrefix() == name)
|
||||
return (*current);
|
||||
}
|
||||
|
||||
return nullXNamespace;
|
||||
}
|
||||
|
||||
void XNamespaceContainer::erase(const std::string& name)
|
||||
{
|
||||
for (std::list<XNamespace>::iterator i = m_container.begin(); i != m_container.end(); ++i)
|
||||
{
|
||||
if ((*i)->GetPrefix() == name)
|
||||
{
|
||||
m_container.erase(i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void XNamespaceContainer::erase(const XNamespaceContainer& rhs)
|
||||
{
|
||||
for (std::list<XNamespace>::iterator current = m_container.begin(); current != m_container.end(); ++current)
|
||||
{
|
||||
erase((*current)->GetPrefix());
|
||||
}
|
||||
}
|
||||
|
||||
XNamespaceContainer::iterator XNamespaceContainer:: begin()
|
||||
{
|
||||
return m_container.begin();
|
||||
}
|
||||
|
||||
XNamespaceContainer::iterator XNamespaceContainer::end()
|
||||
{
|
||||
return m_container.end();
|
||||
}
|
||||
|
||||
XNamespaceContainer::const_iterator XNamespaceContainer::begin() const
|
||||
{
|
||||
return m_container.begin();
|
||||
}
|
||||
|
||||
XNamespaceContainer::const_iterator XNamespaceContainer::end() const
|
||||
{
|
||||
return m_container.end();
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace XML
|
||||
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef XML_PRIVATE_XNAMESPACE_CONTAINER_INCLUDE_H_
|
||||
#define XML_PRIVATE_XNAMESPACE_CONTAINER_INCLUDE_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "XContainer.h"
|
||||
#include "./../XNamespace.h"
|
||||
|
||||
namespace XML
|
||||
{
|
||||
namespace Private
|
||||
{
|
||||
class XNamespaceContainer : public XContainer<XNamespace>
|
||||
{
|
||||
public:
|
||||
const bool exist(const std::string& name) const;
|
||||
|
||||
XNamespaceContainer const* const operator->() const {return this;}
|
||||
XNamespaceContainer* operator->() {return this;}
|
||||
|
||||
XNamespace& operator[] (const std::string& name);
|
||||
const XNamespace& operator[] (const std::string& name) const;
|
||||
|
||||
void erase(const std::string& name);
|
||||
void erase(const XNamespaceContainer& rhs);
|
||||
public:
|
||||
typedef std::list<XNamespace>::iterator iterator;
|
||||
typedef std::list<XNamespace>::const_iterator const_iterator;
|
||||
|
||||
public:
|
||||
iterator begin();
|
||||
iterator end();
|
||||
const_iterator begin() const;
|
||||
const_iterator end() const;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // XML_PRIVATE_XNAMESPACE_CONTAINER_INCLUDE_H_
|
||||
@@ -0,0 +1,116 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled_xml.h"
|
||||
|
||||
|
||||
#include "XNodeContainer.h"
|
||||
#include <algorithm>
|
||||
#include <numeric>
|
||||
#include "./../XNode.h"
|
||||
#include "./../XContainer.h"
|
||||
|
||||
namespace XML
|
||||
{
|
||||
namespace Private
|
||||
{
|
||||
XNodeContainer::XNodeContainer() : m_container(new std::list<XNode>())
|
||||
{
|
||||
}
|
||||
|
||||
const bool XNodeContainer::empty() const
|
||||
{
|
||||
return m_container->empty();
|
||||
}
|
||||
|
||||
const size_t XNodeContainer::size() const
|
||||
{
|
||||
return m_container->size();
|
||||
}
|
||||
|
||||
void XNodeContainer::Add(const XNode& node)
|
||||
{
|
||||
push_back(node);
|
||||
}
|
||||
|
||||
void XNodeContainer::push_back(const XNode& node)
|
||||
{
|
||||
if (node.is_init())
|
||||
{
|
||||
if (node.isElement() || node.isText() || node.isComment())
|
||||
m_container->push_back(node);
|
||||
else
|
||||
merge(XML::XContainer(node)->Nodes);
|
||||
}
|
||||
}
|
||||
|
||||
void XNodeContainer::merge(const XNodeContainer& other)
|
||||
{
|
||||
for(std::list<XNode>::const_iterator current = other.m_container->begin(); current != other.m_container->end(); current++)
|
||||
push_back(*current);
|
||||
}
|
||||
|
||||
const std::string XNodeContainer::ToString() const
|
||||
{
|
||||
|
||||
return std::string();
|
||||
}
|
||||
|
||||
const std::wstring XNodeContainer::ToWString() const
|
||||
{
|
||||
|
||||
return std::wstring();
|
||||
}
|
||||
|
||||
void XNodeContainer::SaveToStringList(std::list<std::string>& strList)const
|
||||
{
|
||||
for(std::list<XNode>::const_iterator iter = m_container->begin(); iter != m_container->end(); iter++)
|
||||
{
|
||||
iter->SaveToStringList(strList);
|
||||
}
|
||||
}
|
||||
|
||||
void XNodeContainer::SaveToWStringList(std::list<std::wstring>& strList)const
|
||||
{
|
||||
for(std::list<XNode>::const_iterator iter = m_container->begin(); iter != m_container->end(); iter++)
|
||||
{
|
||||
iter->SaveToWStringList(strList);
|
||||
}
|
||||
}
|
||||
|
||||
const NSCommon::smart_ptr<std::list<XNode> > XNodeContainer::container() const
|
||||
{
|
||||
return m_container;
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace XML
|
||||
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#ifndef XML_PRIVATE_XNODE_CONTAINER_INCLUDE_H_
|
||||
#define XML_PRIVATE_XNODE_CONTAINER_INCLUDE_H_
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <list>
|
||||
|
||||
#include "../../../../../Common/DocxFormat/Source/Base/SmartPtr.h"
|
||||
|
||||
namespace XML
|
||||
{
|
||||
class XNode;
|
||||
|
||||
namespace Private
|
||||
{
|
||||
class XNodeContainer
|
||||
{
|
||||
public:
|
||||
XNodeContainer();
|
||||
|
||||
public:
|
||||
const bool empty() const;
|
||||
const size_t size() const;
|
||||
void Add(const XNode& node);
|
||||
void push_back(const XNode& node);
|
||||
void merge(const XNodeContainer& other);
|
||||
|
||||
public:
|
||||
typedef std::list<XNode>::iterator iterator;
|
||||
typedef std::list<XNode>::const_iterator const_iterator;
|
||||
|
||||
public:
|
||||
XNodeContainer const* const operator->() const {return this;}
|
||||
XNodeContainer* operator->() {return this;}
|
||||
|
||||
public:
|
||||
const std::string ToString() const;
|
||||
const std::wstring ToWString() const;
|
||||
virtual void SaveToStringList(std::list<std::string>& strList)const;
|
||||
virtual void SaveToWStringList(std::list<std::wstring>& strList)const;
|
||||
|
||||
public:
|
||||
iterator begin() {return m_container->begin();}
|
||||
iterator end() {return m_container->end();}
|
||||
const_iterator begin() const {return m_container->begin();}
|
||||
const_iterator end() const {return m_container->end();}
|
||||
|
||||
public:
|
||||
const NSCommon::smart_ptr<std::list<XNode> > container() const;
|
||||
|
||||
private:
|
||||
NSCommon::smart_ptr<std::list<XNode> > m_container;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // XML_PRIVATE_XNODE_CONTAINER_INCLUDE_H_
|
||||
76
ActiveX/Common/ASCDocxFormat/Source/XML/Private/XPointer.h
Normal file
76
ActiveX/Common/ASCDocxFormat/Source/XML/Private/XPointer.h
Normal file
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef XML_PRIVATE_XPOINTER_INCLUDE_H_
|
||||
#define XML_PRIVATE_XPOINTER_INCLUDE_H_
|
||||
|
||||
#include "../../../../../Common/DocxFormat/Source/Base/SmartPtr.h"
|
||||
|
||||
namespace XML
|
||||
{
|
||||
namespace Private
|
||||
{
|
||||
template<class T>
|
||||
class XPointer
|
||||
{
|
||||
public:
|
||||
XPointer() {}
|
||||
XPointer(T* ptr) : m_ptr(ptr) {}
|
||||
XPointer(const NSCommon::smart_ptr<T>& ptr) : m_ptr(ptr) {}
|
||||
|
||||
template<class E>
|
||||
XPointer(const XPointer<E>& rhs)
|
||||
{
|
||||
m_ptr = rhs.get_ptr().smart_dynamic_cast<T>();
|
||||
}
|
||||
|
||||
NSCommon::smart_ptr<T> get_ptr() const {return m_ptr;}
|
||||
|
||||
public:
|
||||
T const* const operator->() const {return m_ptr.operator->();}
|
||||
T* operator->() {return m_ptr.operator->();}
|
||||
|
||||
const T& operator*() const {return (m_ptr.operator*());}
|
||||
T& operator*() {return (m_ptr.operator*());}
|
||||
|
||||
const bool is_init() const {return m_ptr.is_init();}
|
||||
|
||||
protected:
|
||||
NSCommon::smart_ptr<T> m_ptr;
|
||||
|
||||
protected:
|
||||
typedef XPointer<T> base;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // XML_PRIVATE_XPOINTER_INCLUDE_H_
|
||||
@@ -0,0 +1,200 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled_xml.h"
|
||||
|
||||
|
||||
#include "XSingleSource.h"
|
||||
#include "Lexigraph.h"
|
||||
#include "Exception\not_implement.h"
|
||||
|
||||
|
||||
namespace XML
|
||||
{
|
||||
namespace Private
|
||||
{
|
||||
|
||||
XSingleSource::~XSingleSource()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void XSingleSource::next()
|
||||
{
|
||||
++m_iterator;
|
||||
}
|
||||
|
||||
|
||||
void XSingleSource::skipSpace()
|
||||
{
|
||||
for (; isSpace() ; ++m_iterator);
|
||||
}
|
||||
|
||||
|
||||
void XSingleSource::find(const char value)
|
||||
{
|
||||
|
||||
|
||||
for (; *m_iterator != value; ++m_iterator);
|
||||
}
|
||||
|
||||
|
||||
void XSingleSource::find(const char value1, const char value2)
|
||||
{
|
||||
for (; ((*m_iterator != value1) && (*m_iterator != value2)); ++m_iterator);
|
||||
}
|
||||
|
||||
|
||||
void XSingleSource::findAndSkip(const char value)
|
||||
{
|
||||
find(value);
|
||||
next();
|
||||
}
|
||||
|
||||
|
||||
const char XSingleSource::get() const
|
||||
{
|
||||
|
||||
|
||||
return *m_iterator;
|
||||
}
|
||||
|
||||
|
||||
const std::string XSingleSource::getString(const char separator)
|
||||
{
|
||||
std::string result;
|
||||
while (*m_iterator != separator)
|
||||
result += *m_iterator++;
|
||||
return Lexigraph::fromSource(result);
|
||||
}
|
||||
|
||||
|
||||
const std::string XSingleSource::getString(const char separator1, const char separator2)
|
||||
{
|
||||
std::string result;
|
||||
while ((*m_iterator != separator1) && (*m_iterator != separator2))
|
||||
result += *m_iterator++;
|
||||
return Lexigraph::fromSource(result);
|
||||
}
|
||||
|
||||
|
||||
const std::pair<const std::string, const std::string> XSingleSource::getName()
|
||||
{
|
||||
std::string prefix = getToSeparator(':');
|
||||
std::string name;
|
||||
if (get() == ':')
|
||||
{
|
||||
next();
|
||||
name = getToSeparator();
|
||||
}
|
||||
else
|
||||
{
|
||||
std::swap(prefix, name);
|
||||
}
|
||||
return std::make_pair(prefix, name);
|
||||
}
|
||||
|
||||
|
||||
const std::pair<const std::string, const std::string> XSingleSource::getPair()
|
||||
{
|
||||
const std::string name = get(' ', '=');
|
||||
const std::string value = getValue();
|
||||
return std::make_pair(name, value);
|
||||
}
|
||||
|
||||
|
||||
const std::pair<const std::pair<const std::string, const std::string>, const std::string> XSingleSource::getAttribute()
|
||||
{
|
||||
const std::pair<const std::string, const std::string> name = getName();
|
||||
const std::string value = getValue();
|
||||
return std::make_pair(name, value);
|
||||
}
|
||||
|
||||
|
||||
const bool XSingleSource::isSpace() const
|
||||
{
|
||||
if (*m_iterator == ' ' || *m_iterator == '\n' || *m_iterator == '\r' || *m_iterator == '\t')
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
const bool XSingleSource::isSeparator() const
|
||||
{
|
||||
if (*m_iterator == '<' || *m_iterator == '>' || *m_iterator == '=' || *m_iterator == '/')
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
const std::string XSingleSource::get(const char separator1, const char separator2)
|
||||
{
|
||||
skipSpace();
|
||||
std::string result;
|
||||
while (*m_iterator != separator1 && *m_iterator != separator2)
|
||||
result += *m_iterator++;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
const std::string XSingleSource::getToSeparator()
|
||||
{
|
||||
skipSpace();
|
||||
std::string result;
|
||||
while (!isSeparator() && !isSpace())
|
||||
result += *m_iterator++;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
const std::string XSingleSource::getToSeparator(const char separator)
|
||||
{
|
||||
skipSpace();
|
||||
std::string result;
|
||||
while (!isSeparator() && !isSpace() && *m_iterator != separator)
|
||||
result += *m_iterator++;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
const std::string XSingleSource::getValue()
|
||||
{
|
||||
find('"', '\'');
|
||||
char EndChar = *m_iterator;
|
||||
next();
|
||||
const std::string value = getString(EndChar);
|
||||
next();
|
||||
return value;
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace XML
|
||||
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef XML_PRIVATE_XSINGLE_SOURCE_INCLUDE_H_
|
||||
#define XML_PRIVATE_XSINGLE_SOURCE_INCLUDE_H_
|
||||
|
||||
#include <iterator>
|
||||
#include <string>
|
||||
|
||||
namespace XML
|
||||
{
|
||||
namespace Private
|
||||
{
|
||||
class XSingleSource
|
||||
{
|
||||
public:
|
||||
virtual ~XSingleSource();
|
||||
|
||||
public:
|
||||
virtual void next();
|
||||
virtual void skipSpace();
|
||||
virtual void find(const char value);
|
||||
virtual void find(const char value1, const char value2);
|
||||
virtual void findAndSkip(const char value);
|
||||
virtual const char get() const;
|
||||
virtual const std::string getString(const char separator);
|
||||
virtual const std::string getString(const char separator1, const char separator2);
|
||||
|
||||
public:
|
||||
virtual const std::pair<const std::string, const std::string> getName();
|
||||
virtual const std::pair<const std::string, const std::string> getPair();
|
||||
virtual const std::pair<const std::pair<const std::string, const std::string>, const std::string> getAttribute();
|
||||
|
||||
private:
|
||||
const bool isSpace() const;
|
||||
const bool isSeparator() const;
|
||||
|
||||
const std::string get(const char separator1, const char separator2);
|
||||
const std::string getToSeparator();
|
||||
const std::string getToSeparator(const char separator);
|
||||
const std::string getValue();
|
||||
|
||||
protected:
|
||||
std::istreambuf_iterator<char> m_iterator;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // XML_PRIVATE_XSINGLE_SOURCE_INCLUDE_H_
|
||||
87
ActiveX/Common/ASCDocxFormat/Source/XML/Private/XSpace.cpp
Normal file
87
ActiveX/Common/ASCDocxFormat/Source/XML/Private/XSpace.cpp
Normal file
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled_xml.h"
|
||||
|
||||
|
||||
#include "XSpace.h"
|
||||
|
||||
|
||||
namespace XML
|
||||
{
|
||||
namespace Private
|
||||
{
|
||||
|
||||
XSpace::XSpace()
|
||||
: m_space(false)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
XSpace::XSpace(const bool space)
|
||||
: m_space(space)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
const XSpace& XSpace::operator =(const bool rhs)
|
||||
{
|
||||
m_space = rhs;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
void XSpace::setDefault()
|
||||
{
|
||||
m_space = false;
|
||||
}
|
||||
|
||||
|
||||
void XSpace::setPreserve()
|
||||
{
|
||||
m_space = true;
|
||||
}
|
||||
|
||||
|
||||
const bool XSpace::isDefault() const
|
||||
{
|
||||
return m_space == false;
|
||||
}
|
||||
|
||||
|
||||
const bool XSpace::isPreserve() const
|
||||
{
|
||||
return m_space == true;
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace XML
|
||||
63
ActiveX/Common/ASCDocxFormat/Source/XML/Private/XSpace.h
Normal file
63
ActiveX/Common/ASCDocxFormat/Source/XML/Private/XSpace.h
Normal file
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef XML_PRIVATE_XSPACE_INCLUDE_H_
|
||||
#define XML_PRIVATE_XSPACE_INCLUDE_H_
|
||||
|
||||
namespace XML
|
||||
{
|
||||
namespace Private
|
||||
{
|
||||
class XSpace
|
||||
{
|
||||
public:
|
||||
XSpace();
|
||||
XSpace(const bool space);
|
||||
|
||||
public:
|
||||
const XSpace& operator =(const bool rhs);
|
||||
|
||||
public:
|
||||
void setDefault();
|
||||
void setPreserve();
|
||||
|
||||
public:
|
||||
const bool isDefault() const;
|
||||
const bool isPreserve() const;
|
||||
|
||||
private:
|
||||
bool m_space;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // XML_PRIVATE_XSPACE_INCLUDE_H_
|
||||
198
ActiveX/Common/ASCDocxFormat/Source/XML/Private/XString.cpp
Normal file
198
ActiveX/Common/ASCDocxFormat/Source/XML/Private/XString.cpp
Normal file
@@ -0,0 +1,198 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled_xml.h"
|
||||
|
||||
|
||||
#include "XString.h"
|
||||
#include "Encoding.h"
|
||||
|
||||
namespace XML
|
||||
{
|
||||
namespace Private
|
||||
{
|
||||
|
||||
XString::XString()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
XString::XString(const char* value)
|
||||
: m_value(value)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
XString::XString(const std::string& value)
|
||||
: m_value(value)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
const bool XString::operator ==(const XString& rhs) const
|
||||
{
|
||||
return m_value == rhs.m_value;
|
||||
}
|
||||
|
||||
|
||||
const bool XString::operator !=(const XString& rhs) const
|
||||
{
|
||||
return m_value != rhs.m_value;
|
||||
}
|
||||
|
||||
|
||||
const bool XString::operator ==(const std::string& rhs) const
|
||||
{
|
||||
return m_value.get_value_or("") == rhs;
|
||||
}
|
||||
|
||||
|
||||
const bool XString::operator !=(const std::string& rhs) const
|
||||
{
|
||||
return m_value.get_value_or("") != rhs;
|
||||
}
|
||||
|
||||
|
||||
const bool XString::operator ==(const char* rhs) const
|
||||
{
|
||||
return m_value.get_value_or("") == rhs;
|
||||
}
|
||||
|
||||
|
||||
const bool XString::operator !=(const char* rhs) const
|
||||
{
|
||||
return m_value.get_value_or("") != rhs;
|
||||
}
|
||||
|
||||
|
||||
const bool XString::ToBool() const
|
||||
{
|
||||
if (!m_value.is_init())
|
||||
return false;
|
||||
if (m_value == "true" || m_value == "t" || m_value == "1")
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
const int XString::ToInt() const
|
||||
{
|
||||
try
|
||||
{
|
||||
std::string str = m_value.get_value_or("0");
|
||||
return atoi(str.c_str());
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
const size_t XString::ToSizet() const
|
||||
{
|
||||
try
|
||||
{
|
||||
std::string str = m_value.get_value_or("0");
|
||||
return (size_t)atoi(str.c_str());
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
const double XString::ToDouble() const
|
||||
{
|
||||
std::string str = m_value.get_value_or("0");
|
||||
double d = 0;
|
||||
try
|
||||
{
|
||||
sscanf(str.c_str(), "%lf", &d);
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
d = 0;
|
||||
}
|
||||
return d;
|
||||
}
|
||||
|
||||
|
||||
const std::string XString::ToString() const
|
||||
{
|
||||
return m_value.get_value_or_default();
|
||||
}
|
||||
|
||||
|
||||
const std::wstring XString::ToWString() const
|
||||
{
|
||||
return Encoding::utf82unicode(m_value.get_value_or_default());
|
||||
}
|
||||
|
||||
XString::operator const bool() const
|
||||
{
|
||||
return ToBool();
|
||||
}
|
||||
|
||||
|
||||
XString::operator const int() const
|
||||
{
|
||||
return ToInt();
|
||||
}
|
||||
|
||||
|
||||
XString::operator const size_t() const
|
||||
{
|
||||
return ToSizet();
|
||||
}
|
||||
|
||||
|
||||
XString::operator const double() const
|
||||
{
|
||||
return ToDouble();
|
||||
}
|
||||
|
||||
|
||||
XString::operator const std::string() const
|
||||
{
|
||||
return ToString();
|
||||
}
|
||||
|
||||
|
||||
XString::operator const std::wstring() const
|
||||
{
|
||||
return ToWString();
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace XML
|
||||
240
ActiveX/Common/ASCDocxFormat/Source/XML/Private/XString.h
Normal file
240
ActiveX/Common/ASCDocxFormat/Source/XML/Private/XString.h
Normal file
@@ -0,0 +1,240 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef XML_PRIVATE_XSTRING_INCLUDE_H_
|
||||
#define XML_PRIVATE_XSTRING_INCLUDE_H_
|
||||
|
||||
#include <string>
|
||||
#include "nullable.h"
|
||||
#include "property.h"
|
||||
#include "nullable_property.h"
|
||||
#include "Parse.h"
|
||||
|
||||
#include "../../../../../Common/DocxFormat/Source/SystemUtility/SystemUtility.h"
|
||||
|
||||
namespace XML
|
||||
{
|
||||
namespace Private
|
||||
{
|
||||
class XString
|
||||
{
|
||||
public:
|
||||
XString();
|
||||
XString(const char* value);
|
||||
XString(const std::string& value);
|
||||
|
||||
public:
|
||||
const bool operator ==(const XString& rhs) const;
|
||||
const bool operator !=(const XString& rhs) const;
|
||||
const bool operator ==(const std::string& rhs) const;
|
||||
const bool operator !=(const std::string& rhs) const;
|
||||
const bool operator ==(const char* rhs) const;
|
||||
const bool operator !=(const char* rhs) const;
|
||||
|
||||
public:
|
||||
const bool ToBool() const;
|
||||
const int ToInt() const;
|
||||
const size_t ToSizet() const;
|
||||
const double ToDouble() const;
|
||||
const std::string ToString() const;
|
||||
const std::wstring ToWString() const;
|
||||
|
||||
operator const bool() const;
|
||||
operator const int() const;
|
||||
operator const size_t() const;
|
||||
operator const double() const;
|
||||
operator const std::string() const;
|
||||
operator const std::wstring() const;
|
||||
|
||||
template<typename T>
|
||||
operator const nullable__<T>() const
|
||||
{
|
||||
if (m_value.is_init())
|
||||
return Parse<T>(m_value);
|
||||
return nullable__<T>();
|
||||
}
|
||||
|
||||
template<typename T, class S, class G>
|
||||
operator const nullable_property<T, S, G>() const
|
||||
{
|
||||
if (m_value.is_init())
|
||||
return Parse<T>(m_value);
|
||||
return nullable_property<T, S, G>();
|
||||
}
|
||||
|
||||
public:
|
||||
template<typename T> const bool operator ==(const T value) const
|
||||
{
|
||||
return static_cast<T>(*this) == value;
|
||||
}
|
||||
|
||||
template<typename T> const bool operator !=(const T value) const
|
||||
{
|
||||
return static_cast<T>(*this) != value;
|
||||
}
|
||||
|
||||
template<typename T> const bool operator > (const T value) const
|
||||
{
|
||||
return static_cast<T>(*this) > value;
|
||||
}
|
||||
|
||||
template<typename T> const bool operator < (const T value) const
|
||||
{
|
||||
return static_cast<T>(*this) < value;
|
||||
}
|
||||
|
||||
template<typename T> const bool operator >=(const T value) const
|
||||
{
|
||||
return static_cast<T>(*this) >= value;
|
||||
}
|
||||
|
||||
template<typename T> const bool operator <=(const T value) const
|
||||
{
|
||||
return static_cast<T>(*this) <= value;
|
||||
}
|
||||
|
||||
template<typename T, class S, class G> const bool operator ==(const property<T, S, G> value) const
|
||||
{
|
||||
return static_cast<T>(*this) == *value;
|
||||
}
|
||||
|
||||
template<typename T, class S, class G> const bool operator !=(const property<T, S, G> value) const
|
||||
{
|
||||
return static_cast<T>(*this) != *vlaue;
|
||||
}
|
||||
|
||||
template<typename T, class S, class G> const bool operator > (const property<T, S, G> value) const
|
||||
{
|
||||
return static_cast<T>(*this) > *value;
|
||||
}
|
||||
|
||||
template<typename T, class S, class G> const bool operator < (const property<T, S, G> value) const
|
||||
{
|
||||
return static_cast<T>(*this) < *value;
|
||||
}
|
||||
|
||||
template<typename T, class S, class G> const bool operator >=(const property<T, S, G> value) const
|
||||
{
|
||||
return static_cast<T>(*this) >= *value;
|
||||
}
|
||||
|
||||
template<typename T, class S, class G> const bool operator <=(const property<T, S, G> value) const
|
||||
{
|
||||
return static_cast<T>(*this) <= *value;
|
||||
}
|
||||
|
||||
template<typename T> const bool operator ==(const nullable__<T> value) const
|
||||
{
|
||||
return static_cast<T>(*this) == *value;
|
||||
}
|
||||
|
||||
template<typename T> const bool operator !=(const nullable__<T> value) const
|
||||
{
|
||||
return static_cast<T>(*this) != *value;
|
||||
}
|
||||
|
||||
template<typename T> const bool operator > (const nullable__<T> value) const
|
||||
{
|
||||
return static_cast<T>(*this) > *value;
|
||||
}
|
||||
|
||||
template<typename T> const bool operator < (const nullable__<T> value) const
|
||||
{
|
||||
return static_cast<T>(*this) < *value;
|
||||
}
|
||||
|
||||
template<typename T> const bool operator >=(const nullable__<T> value) const
|
||||
{
|
||||
return static_cast<T>(*this) >= *value;
|
||||
}
|
||||
|
||||
template<typename T> const bool operator <=(const nullable__<T> value) const
|
||||
{
|
||||
return static_cast<T>(*this) <= *value;
|
||||
}
|
||||
|
||||
template<typename T, class S, class G> const bool operator ==(const nullable_property<T, S, G> value) const
|
||||
{
|
||||
return static_cast<T>(*this) == *value;
|
||||
}
|
||||
|
||||
template<typename T, class S, class G> const bool operator !=(const nullable_property<T, S, G> value) const
|
||||
{
|
||||
return static_cast<T>(*this) != *vlaue;
|
||||
}
|
||||
|
||||
template<typename T, class S, class G> const bool operator > (const nullable_property<T, S, G> value) const
|
||||
{
|
||||
return static_cast<T>(*this) > *value;
|
||||
}
|
||||
|
||||
template<typename T, class S, class G> const bool operator < (const nullable_property<T, S, G> value) const
|
||||
{
|
||||
return static_cast<T>(*this) < *value;
|
||||
}
|
||||
|
||||
template<typename T, class S, class G> const bool operator >=(const nullable_property<T, S, G> value) const
|
||||
{
|
||||
return static_cast<T>(*this) >= *value;
|
||||
}
|
||||
|
||||
template<typename T, class S, class G> const bool operator <=(const nullable_property<T, S, G> value) const
|
||||
{
|
||||
return static_cast<T>(*this) <= *value;
|
||||
}
|
||||
|
||||
private:
|
||||
nullable__<std::string> m_value;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<typename T>
|
||||
const nullable__<T>& nullable_setter(nullable__<T>& lhs, const XML::Private::XString& rhs)
|
||||
{
|
||||
return ::nullable_setter(lhs, nullable__<T>(rhs));
|
||||
}
|
||||
|
||||
template<typename T, class S, class G>
|
||||
const property<T, S, G>& property_setter(property<T, S, G>& lhs, const XML::Private::XString& rhs)
|
||||
{
|
||||
return ::property_setter(lhs, T(rhs));
|
||||
}
|
||||
|
||||
template<typename T, class S, class G>
|
||||
const nullable_property<T, S, G>& nullable_property_setter(nullable_property<T, S, G>& lhs, const XML::Private::XString& rhs)
|
||||
{
|
||||
return ::nullable_property_setter(lhs, nullable_property<T, S, G>(rhs));
|
||||
}
|
||||
|
||||
#endif // XML_PRIVATE_XSTRING_INCLUDE_H_
|
||||
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled_xml.h"
|
||||
|
||||
|
||||
#include "XStringSource.h"
|
||||
#include "Exception\not_implement.h"
|
||||
|
||||
|
||||
namespace XML
|
||||
{
|
||||
namespace Private
|
||||
{
|
||||
|
||||
XStringSource::XStringSource(const std::string& source)
|
||||
: m_stream(source)
|
||||
{
|
||||
setBegin();
|
||||
}
|
||||
|
||||
|
||||
XStringSource::~XStringSource()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void XStringSource::setBegin()
|
||||
{
|
||||
m_iterator = m_stream;
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace XML
|
||||
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef XML_PRIVATE_XSTRING_SOURCE_INCLUDE_H_
|
||||
#define XML_PRIVATE_XSTRING_SOURCE_INCLUDE_H_
|
||||
|
||||
#include "XSingleSource.h"
|
||||
#include <sstream>
|
||||
#include <iterator>
|
||||
|
||||
|
||||
namespace XML
|
||||
{
|
||||
namespace Private
|
||||
{
|
||||
class XStringSource : public XSingleSource
|
||||
{
|
||||
public:
|
||||
XStringSource(const std::string& source);
|
||||
virtual ~XStringSource();
|
||||
|
||||
private:
|
||||
void setBegin();
|
||||
|
||||
private:
|
||||
std::istringstream m_stream;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // XML_PRIVATE_XSTRING_SOURCE_INCLUDE_H_
|
||||
@@ -0,0 +1,105 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled_xml.h"
|
||||
|
||||
|
||||
#include "XTextContainer.h"
|
||||
#include "XNodeContainer.h"
|
||||
#include "./../XText.h"
|
||||
|
||||
namespace XML
|
||||
{
|
||||
namespace Private
|
||||
{
|
||||
XTextContainer::XTextContainer(const XNodeContainer& nodes) : m_container(nodes.container())
|
||||
{
|
||||
}
|
||||
|
||||
const bool XTextContainer::empty() const
|
||||
{
|
||||
return size() == 0;
|
||||
}
|
||||
|
||||
const size_t XTextContainer::size() const
|
||||
{
|
||||
size_t size = 0;
|
||||
for (const_iterator i = begin(); i != end(); ++i)
|
||||
++size;
|
||||
return size;
|
||||
}
|
||||
|
||||
void XTextContainer::push_back(const XText& text)
|
||||
{
|
||||
if (text.is_init())
|
||||
{
|
||||
m_container->push_back(text);
|
||||
}
|
||||
}
|
||||
|
||||
void XTextContainer::Add(const XML::XText& text)
|
||||
{
|
||||
push_back(text);
|
||||
}
|
||||
|
||||
const XString XTextContainer::text() const
|
||||
{
|
||||
std::string text;
|
||||
for (const_iterator i = begin(); i != end(); ++i)
|
||||
{
|
||||
text += XText(*i)->Value;
|
||||
}
|
||||
return text.empty() ? XString() : text;
|
||||
}
|
||||
|
||||
XTextContainer::iterator XTextContainer:: begin()
|
||||
{
|
||||
return m_container->begin();
|
||||
}
|
||||
|
||||
XTextContainer::iterator XTextContainer::end()
|
||||
{
|
||||
return m_container->end();
|
||||
}
|
||||
|
||||
XTextContainer::const_iterator XTextContainer::begin() const
|
||||
{
|
||||
return m_container->begin();
|
||||
}
|
||||
|
||||
XTextContainer::const_iterator XTextContainer::end() const
|
||||
{
|
||||
return m_container->end();
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace XML
|
||||
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef XML_PRIVATE_XTEXT_CONTAINER_INCLUDE_H_
|
||||
#define XML_PRIVATE_XTEXT_CONTAINER_INCLUDE_H_
|
||||
|
||||
#include <vector>
|
||||
#include <list>
|
||||
|
||||
#include "Filter/Text.h"
|
||||
#include "XString.h"
|
||||
|
||||
#include "../../../../../Common/DocxFormat/Source/Base/SmartPtr.h"
|
||||
|
||||
namespace XML
|
||||
{
|
||||
namespace Private
|
||||
{
|
||||
class XNodeContainer;
|
||||
|
||||
class XTextContainer
|
||||
{
|
||||
public:
|
||||
XTextContainer(const XNodeContainer& nodes);
|
||||
|
||||
public:
|
||||
const bool empty() const;
|
||||
const size_t size() const;
|
||||
void push_back(const XText& text);
|
||||
void Add(const XText& text);
|
||||
|
||||
const XString text() const;
|
||||
|
||||
public:
|
||||
|
||||
typedef std::list<XNode>::iterator iterator;
|
||||
typedef std::list<XNode>::const_iterator const_iterator;
|
||||
|
||||
public:
|
||||
XTextContainer const* const operator->() const {return this;}
|
||||
XTextContainer* operator->() {return this;}
|
||||
|
||||
public:
|
||||
iterator begin();
|
||||
iterator end();
|
||||
const_iterator begin() const;
|
||||
const_iterator end() const;
|
||||
|
||||
private:
|
||||
NSCommon::smart_ptr<std::list<XNode> > m_container;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif // XML_PRIVATE_XTEXT_CONTAINER_INCLUDE_H_
|
||||
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled_xml.h"
|
||||
|
||||
|
||||
#include "XWFileSource.h"
|
||||
#include "Exception\not_implement.h"
|
||||
|
||||
|
||||
namespace XML
|
||||
{
|
||||
namespace Private
|
||||
{
|
||||
XWFileSource::XWFileSource(const OOX::CPath& path, XWideSource::eSourceType type)
|
||||
: m_stream(path.GetPath())
|
||||
, XWideSource(type)
|
||||
{
|
||||
setBegin();
|
||||
}
|
||||
|
||||
|
||||
XWFileSource::~XWFileSource()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void XWFileSource::setBegin()
|
||||
{
|
||||
m_iterator = m_stream;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
} // namespace XML
|
||||
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef XML_PRIVATE_XWFILE_SOURCE_INCLUDE_H_
|
||||
#define XML_PRIVATE_XWFILE_SOURCE_INCLUDE_H_
|
||||
|
||||
#include "XWideSource.h"
|
||||
#include <fstream>
|
||||
#include <iterator>
|
||||
|
||||
#include "../../../../../Common/DocxFormat/Source/SystemUtility/SystemUtility.h"
|
||||
|
||||
namespace XML
|
||||
{
|
||||
namespace Private
|
||||
{
|
||||
class XWFileSource : public XWideSource
|
||||
{
|
||||
public:
|
||||
XWFileSource(const OOX::CPath& path, XWideSource::eSourceType type);
|
||||
virtual ~XWFileSource();
|
||||
|
||||
private:
|
||||
void setBegin();
|
||||
|
||||
private:
|
||||
std::wifstream m_stream;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // XML_PRIVATE_XWFILE_SOURCE_INCLUDE_H_
|
||||
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled_xml.h"
|
||||
|
||||
|
||||
#include "XWStringSource.h"
|
||||
#include "Exception\not_implement.h"
|
||||
|
||||
|
||||
namespace XML
|
||||
{
|
||||
namespace Private
|
||||
{
|
||||
|
||||
XWStringSource::XWStringSource(const std::wstring& source)
|
||||
: m_stream(source)
|
||||
, XWideSource(XWideSource::estStringSource)
|
||||
{
|
||||
setBegin();
|
||||
}
|
||||
|
||||
|
||||
XWStringSource::~XWStringSource()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void XWStringSource::setBegin()
|
||||
{
|
||||
m_iterator = m_stream;
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace XML
|
||||
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef XML_PRIVATE_XWSTRING_SOURCE_INCLUDE_H_
|
||||
#define XML_PRIVATE_XWSTRING_SOURCE_INCLUDE_H_
|
||||
|
||||
#include "XWideSource.h"
|
||||
#include <sstream>
|
||||
#include <iterator>
|
||||
|
||||
|
||||
namespace XML
|
||||
{
|
||||
namespace Private
|
||||
{
|
||||
class XWStringSource : public XWideSource
|
||||
{
|
||||
public:
|
||||
XWStringSource(const std::wstring& source);
|
||||
virtual ~XWStringSource();
|
||||
|
||||
private:
|
||||
void setBegin();
|
||||
|
||||
private:
|
||||
std::wistringstream m_stream;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // XML_PRIVATE_XWSTRING_SOURCE_INCLUDE_H_
|
||||
241
ActiveX/Common/ASCDocxFormat/Source/XML/Private/XWideSource.cpp
Normal file
241
ActiveX/Common/ASCDocxFormat/Source/XML/Private/XWideSource.cpp
Normal file
@@ -0,0 +1,241 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled_xml.h"
|
||||
|
||||
|
||||
#include "XWideSource.h"
|
||||
#include "Lexigraph.h"
|
||||
#include "Encoding.h"
|
||||
#include "Exception\not_implement.h"
|
||||
|
||||
|
||||
namespace XML
|
||||
{
|
||||
namespace Private
|
||||
{
|
||||
XWideSource::XWideSource(eSourceType type)
|
||||
: m_SourceType(type)
|
||||
, m_current(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
XWideSource::~XWideSource()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void XWideSource::next()
|
||||
{
|
||||
if(m_SourceType == estLittleEndian)
|
||||
{
|
||||
m_current = *m_iterator;
|
||||
++m_iterator;
|
||||
m_current = ((*m_iterator)<<8) + m_current;
|
||||
++m_iterator;
|
||||
}
|
||||
else if(m_SourceType == estBigEndian)
|
||||
{
|
||||
m_current = *m_iterator;
|
||||
++m_iterator;
|
||||
m_current = (m_current << 8) + (*m_iterator);
|
||||
++m_iterator;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_current = *m_iterator;
|
||||
++m_iterator;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void XWideSource::skipSpace()
|
||||
{
|
||||
for (; isSpace() ; next());
|
||||
}
|
||||
|
||||
|
||||
void XWideSource::find(const wchar_t value)
|
||||
{
|
||||
for (; m_current != value; next());
|
||||
}
|
||||
|
||||
|
||||
void XWideSource::find(const wchar_t value1, const wchar_t value2)
|
||||
{
|
||||
for (; ((m_current != value1) && (m_current != value2)); next());
|
||||
}
|
||||
|
||||
|
||||
void XWideSource::findAndSkip(const wchar_t value)
|
||||
{
|
||||
find(value);
|
||||
next();
|
||||
}
|
||||
|
||||
|
||||
const std::pair<const std::wstring, const std::wstring> XWideSource::getName()
|
||||
{
|
||||
std::wstring prefix = getToSeparator(L':');
|
||||
std::wstring name;
|
||||
if (get() == L':')
|
||||
{
|
||||
next();
|
||||
name = getToSeparator();
|
||||
}
|
||||
else
|
||||
{
|
||||
std::swap(prefix, name);
|
||||
}
|
||||
return std::make_pair(prefix, name);
|
||||
}
|
||||
|
||||
|
||||
const std::pair<const std::wstring, const std::wstring> XWideSource::getPair()
|
||||
{
|
||||
const std::wstring name = get(L' ', L'=');
|
||||
const std::wstring value = getValue();
|
||||
return std::make_pair(name, value);
|
||||
}
|
||||
|
||||
|
||||
const std::pair<const std::pair<const std::wstring, const std::wstring>, const std::wstring> XWideSource::getAttribute()
|
||||
{
|
||||
const std::pair<const std::wstring, const std::wstring> name = getName();
|
||||
const std::wstring value = getValue();
|
||||
return std::make_pair(name, value);
|
||||
}
|
||||
|
||||
|
||||
const wchar_t XWideSource::get() const
|
||||
{
|
||||
return m_current;
|
||||
}
|
||||
|
||||
|
||||
const std::wstring XWideSource::getString(const wchar_t separator)
|
||||
{
|
||||
std::wstring result;
|
||||
while (m_current != separator)
|
||||
|
||||
{
|
||||
result += m_current;
|
||||
next();
|
||||
}
|
||||
return Lexigraph::fromSource(result);
|
||||
}
|
||||
|
||||
|
||||
const std::wstring XWideSource::getString(const wchar_t separator1, const wchar_t separator2)
|
||||
{
|
||||
std::wstring result;
|
||||
while ((m_current != separator1) && (m_current != separator2))
|
||||
|
||||
{
|
||||
result += m_current;
|
||||
next();
|
||||
}
|
||||
return Lexigraph::fromSource(result);
|
||||
}
|
||||
|
||||
|
||||
const bool XWideSource::isSpace() const
|
||||
{
|
||||
if (m_current == L' ' || m_current == L'\n' || m_current == L'\r' || m_current == L'\t')
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
const bool XWideSource::isSeparator() const
|
||||
{
|
||||
if (m_current == L'<' || m_current == L'>' || m_current == L'=' || m_current == L'/')
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
const std::wstring XWideSource::get(const wchar_t separator1, const wchar_t separator2)
|
||||
{
|
||||
skipSpace();
|
||||
std::wstring result;
|
||||
while (m_current != separator1 && m_current != separator2)
|
||||
|
||||
{
|
||||
result += m_current;
|
||||
next();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
const std::wstring XWideSource::getToSeparator()
|
||||
{
|
||||
skipSpace();
|
||||
std::wstring result;
|
||||
while (!isSeparator() && !isSpace())
|
||||
{
|
||||
result += m_current;
|
||||
next();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
const std::wstring XWideSource::getToSeparator(const wchar_t separator)
|
||||
{
|
||||
skipSpace();
|
||||
std::wstring result;
|
||||
while (!isSeparator() && !isSpace() && m_current != separator)
|
||||
{
|
||||
result += m_current;
|
||||
next();
|
||||
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
const std::wstring XWideSource::getValue()
|
||||
{
|
||||
find(L'"', L'\'');
|
||||
wchar_t EndChar = get();
|
||||
next();
|
||||
const std::wstring value = getString(EndChar);
|
||||
next();
|
||||
return value;
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace XML
|
||||
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef XML_PRIVATE_XWIDE_SOURCE_INCLUDE_H_
|
||||
#define XML_PRIVATE_XWIDE_SOURCE_INCLUDE_H_
|
||||
|
||||
#include <iterator>
|
||||
#include <string>
|
||||
|
||||
namespace XML
|
||||
{
|
||||
namespace Private
|
||||
{
|
||||
class XWideSource
|
||||
{
|
||||
public:
|
||||
enum eSourceType {estLittleEndian, estBigEndian, estStringSource};
|
||||
public:
|
||||
XWideSource(eSourceType type);
|
||||
~XWideSource();
|
||||
|
||||
public:
|
||||
virtual void next();
|
||||
virtual void skipSpace();
|
||||
virtual void find(const wchar_t value);
|
||||
virtual void find(const wchar_t value1, const wchar_t value2);
|
||||
virtual void findAndSkip(const wchar_t value);
|
||||
|
||||
public:
|
||||
virtual const std::pair<const std::wstring, const std::wstring> getName();
|
||||
virtual const std::pair<const std::wstring, const std::wstring> getPair();
|
||||
virtual const std::pair<const std::pair<const std::wstring, const std::wstring>, const std::wstring> getAttribute();
|
||||
|
||||
public:
|
||||
virtual const wchar_t get() const;
|
||||
virtual const std::wstring getString(const wchar_t separator);
|
||||
virtual const std::wstring getString(const wchar_t separator1, const wchar_t separator2);
|
||||
|
||||
private:
|
||||
const bool isSpace() const;
|
||||
const bool isSeparator() const;
|
||||
|
||||
const std::wstring get(const wchar_t separator1, const wchar_t separator2);
|
||||
const std::wstring getToSeparator();
|
||||
const std::wstring getToSeparator(const wchar_t separator);
|
||||
const std::wstring getValue();
|
||||
|
||||
protected:
|
||||
std::istreambuf_iterator<wchar_t> m_iterator;
|
||||
wchar_t m_current;
|
||||
eSourceType m_SourceType;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // XML_PRIVATE_XWIDE_SOURCE_INCLUDE_H_
|
||||
87
ActiveX/Common/ASCDocxFormat/Source/XML/XAttribute.cpp
Normal file
87
ActiveX/Common/ASCDocxFormat/Source/XML/XAttribute.cpp
Normal file
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled_xml.h"
|
||||
|
||||
|
||||
#include "XAttribute.h"
|
||||
#include "Private/NullAttribute.h"
|
||||
#include "Private/NullXAttribute.h"
|
||||
|
||||
|
||||
namespace XML
|
||||
{
|
||||
|
||||
XAttribute::XAttribute()
|
||||
: base(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
XAttribute::XAttribute(Private::NullAttribute)
|
||||
: base(new Private::NullAttribute)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
const bool XAttribute::exist() const
|
||||
{
|
||||
return m_ptr->exist();
|
||||
}
|
||||
|
||||
|
||||
const Private::XString XAttribute::value() const
|
||||
{
|
||||
return m_ptr->value();
|
||||
}
|
||||
|
||||
|
||||
const Private::XString XAttribute::get_value_or(const std::string& def)const
|
||||
{
|
||||
if(exist())
|
||||
return value();
|
||||
return Private::XString(def);
|
||||
}
|
||||
|
||||
|
||||
const bool XAttribute::operator ==(const XAttribute& rhs) const
|
||||
{
|
||||
return ((*m_ptr) == (*rhs.m_ptr));
|
||||
}
|
||||
|
||||
|
||||
const bool XAttribute::operator <(const XAttribute& rhs) const
|
||||
{
|
||||
return ((*m_ptr) < (*rhs.m_ptr));
|
||||
}
|
||||
|
||||
} // namespace XML
|
||||
83
ActiveX/Common/ASCDocxFormat/Source/XML/XAttribute.h
Normal file
83
ActiveX/Common/ASCDocxFormat/Source/XML/XAttribute.h
Normal file
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef XML_XATTRIBUTE_INCLUDE_H_
|
||||
#define XML_XATTRIBUTE_INNLUDE_H_
|
||||
|
||||
#include "Private/XPointer.h"
|
||||
#include "Private/Attribute.h"
|
||||
#include "Private/XString.h"
|
||||
|
||||
namespace XML
|
||||
{
|
||||
namespace Private
|
||||
{
|
||||
class NullAttribute;
|
||||
}
|
||||
|
||||
class XAttribute : public Private::XPointer<Private::Attribute>
|
||||
{
|
||||
public:
|
||||
XAttribute();
|
||||
|
||||
template<typename Type>
|
||||
XAttribute(const XName& name, const Type& value)
|
||||
: base(new Private::Attribute(name, ToString(value)))
|
||||
{
|
||||
}
|
||||
|
||||
template<typename Type>
|
||||
XAttribute(const XName& name, const nullable__<Type>& value)
|
||||
: base(value.is_init() ? new Private::Attribute(name, ToString(value)) : 0)
|
||||
{
|
||||
}
|
||||
|
||||
template<typename Type, class S, class G>
|
||||
XAttribute(const XName& name, const nullable_property<Type, S, G>& value)
|
||||
: base(value.is_init() ? new Private::Attribute(name, ToString(value)) : 0)
|
||||
{
|
||||
}
|
||||
|
||||
protected:
|
||||
XAttribute(Private::NullAttribute);
|
||||
|
||||
public:
|
||||
virtual const bool exist() const;
|
||||
virtual const Private::XString value() const;
|
||||
virtual const Private::XString get_value_or(const std::string& def)const;
|
||||
const bool operator ==(const XAttribute& rhs) const;
|
||||
const bool operator <(const XAttribute& rhs) const;
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
#endif // XML_XATTRIBUTE_INCLUDE_H_
|
||||
47
ActiveX/Common/ASCDocxFormat/Source/XML/XComment.cpp
Normal file
47
ActiveX/Common/ASCDocxFormat/Source/XML/XComment.cpp
Normal file
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled_xml.h"
|
||||
|
||||
|
||||
#include "XComment.h"
|
||||
#include "XNode.h"
|
||||
|
||||
namespace XML
|
||||
{
|
||||
XComment::XComment(const XNode& xnode)
|
||||
: base(xnode.get_ptr().smart_dynamic_cast<Private::Comment>()),
|
||||
Value(m_ptr->Value)
|
||||
{
|
||||
}
|
||||
|
||||
} // namespace XML
|
||||
66
ActiveX/Common/ASCDocxFormat/Source/XML/XComment.h
Normal file
66
ActiveX/Common/ASCDocxFormat/Source/XML/XComment.h
Normal file
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef XML_XCOMMENT_INCLUDE_H_
|
||||
#define XML_XCOMMENT_INCLUDE_H_
|
||||
|
||||
#include "Private/XPointer.h"
|
||||
#include "Private/Comment.h"
|
||||
#include "nullable.h"
|
||||
#include "property.h"
|
||||
#include "nullable_property.h"
|
||||
#include "Private/XString.h"
|
||||
#include "Private/Lexigraph.h"
|
||||
|
||||
|
||||
namespace XML
|
||||
{
|
||||
class XNode;
|
||||
|
||||
class XComment : public Private::XPointer<Private::Comment>
|
||||
{
|
||||
public:
|
||||
template<typename T>
|
||||
explicit XComment(const T& value)
|
||||
: base(new Private::Comment(ToString(value))),
|
||||
Value(m_ptr->Value)
|
||||
{
|
||||
}
|
||||
|
||||
XComment(const XNode& xnode);
|
||||
|
||||
public:
|
||||
Private::XString& Value;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // XML_XCOMMENT_INCLUDE_H_
|
||||
89
ActiveX/Common/ASCDocxFormat/Source/XML/XContainer.cpp
Normal file
89
ActiveX/Common/ASCDocxFormat/Source/XML/XContainer.cpp
Normal file
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled_xml.h"
|
||||
|
||||
|
||||
#include "XContainer.h"
|
||||
#include "XNode.h"
|
||||
#include "XElement.h"
|
||||
#include "XText.h"
|
||||
#include "Private/XList.h"
|
||||
|
||||
namespace XML
|
||||
{
|
||||
XContainer::XContainer()
|
||||
: base(new Private::NodeContainer())
|
||||
{
|
||||
}
|
||||
|
||||
XContainer::XContainer(const XNode& xnode)
|
||||
: base(xnode.get_ptr().smart_dynamic_cast<Private::NodeContainer>())
|
||||
{
|
||||
}
|
||||
|
||||
XContainer::XContainer(const XElement& element)
|
||||
: base(new Private::NodeContainer(element))
|
||||
{
|
||||
}
|
||||
|
||||
XContainer::XContainer(const XText& text)
|
||||
: base(new Private::NodeContainer(text))
|
||||
{
|
||||
}
|
||||
|
||||
XContainer::XContainer(const Private::XList& list)
|
||||
: base(new Private::NodeContainer(list))
|
||||
{
|
||||
}
|
||||
|
||||
void XContainer::Add(const XNode& node)
|
||||
{
|
||||
m_ptr->Add(node);
|
||||
}
|
||||
|
||||
void XContainer::Add(const XElement& element)
|
||||
{
|
||||
m_ptr->Add(element);
|
||||
}
|
||||
|
||||
void XContainer::Add(const XText& text)
|
||||
{
|
||||
m_ptr->Add(text);
|
||||
}
|
||||
|
||||
void XContainer::Add(const Private::XList& list)
|
||||
{
|
||||
m_ptr->Add(list);
|
||||
}
|
||||
|
||||
} // namespace XML
|
||||
84
ActiveX/Common/ASCDocxFormat/Source/XML/XContainer.h
Normal file
84
ActiveX/Common/ASCDocxFormat/Source/XML/XContainer.h
Normal file
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef XML_XCONTAINER_INCLUDE_H_
|
||||
#define XML_XCONTAINER_INCLUDE_H_
|
||||
|
||||
#include "property.h"
|
||||
#include "Private/XPointer.h"
|
||||
#include "Private/NodeContainer.h"
|
||||
|
||||
|
||||
namespace XML
|
||||
{
|
||||
class XNode;
|
||||
class XElement;
|
||||
class XText;
|
||||
|
||||
namespace Private
|
||||
{
|
||||
class XList;
|
||||
}
|
||||
|
||||
class XContainer : public Private::XPointer<Private::NodeContainer>
|
||||
{
|
||||
public:
|
||||
XContainer();
|
||||
XContainer(const XNode& node);
|
||||
|
||||
public:
|
||||
explicit XContainer(const XElement& element);
|
||||
explicit XContainer(const XText& text);
|
||||
explicit XContainer(const Private::XList& list);
|
||||
|
||||
public:
|
||||
template<template<typename T, typename A> class C, class S, class G, class T, class A>
|
||||
explicit XContainer(const property<C<T, A>, S, G>& container)
|
||||
: base(new Private::NodeContainer(*container))
|
||||
{
|
||||
}
|
||||
|
||||
template<template<typename T, typename A> class C, typename T, typename A>
|
||||
explicit XContainer(const C<T, A>& container)
|
||||
: base(new Private::NodeContainer(container))
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
void Add(const XNode& node);
|
||||
void Add(const XElement& element);
|
||||
void Add(const XText& text);
|
||||
void Add(const Private::XList& list);
|
||||
};
|
||||
}
|
||||
|
||||
#endif // XML_XCONTAINER_INCLUDE_H_
|
||||
209
ActiveX/Common/ASCDocxFormat/Source/XML/XDocument.cpp
Normal file
209
ActiveX/Common/ASCDocxFormat/Source/XML/XDocument.cpp
Normal file
@@ -0,0 +1,209 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled_xml.h"
|
||||
|
||||
|
||||
#include "XDocument.h"
|
||||
#include "Private/XSpace.h"
|
||||
#include "Exception/not_implement.h"
|
||||
#include "Private/XFileSource.h"
|
||||
#include "Private/XWFileSource.h"
|
||||
#include "Private/XStringSource.h"
|
||||
#include "Private/XWStringSource.h"
|
||||
#include <list>
|
||||
#include "Utility.h"
|
||||
|
||||
namespace XML
|
||||
{
|
||||
|
||||
XDocument::XDocument(const XElement& element)
|
||||
: Root(element)
|
||||
{
|
||||
}
|
||||
|
||||
XDocument::XDocument(const wchar_t* source, const bool space)
|
||||
{
|
||||
OOX::CPath path(source);
|
||||
TxtFile text(path);
|
||||
if(text.isUnicode())
|
||||
{
|
||||
NSCommon::smart_ptr<Private::XWideSource> xsource(new Private::XWFileSource(path, Private::XWideSource::estLittleEndian));
|
||||
Load(xsource, space);
|
||||
}
|
||||
else if((text.isBigEndian()) || (text.isUnicodeWithOutBOM()))
|
||||
{
|
||||
NSCommon::smart_ptr<Private::XWideSource> xsource(new Private::XWFileSource(path, Private::XWideSource::estBigEndian));
|
||||
Load(xsource, space);
|
||||
}
|
||||
else
|
||||
{
|
||||
NSCommon::smart_ptr<Private::XSingleSource> xsource(new Private::XFileSource(path));
|
||||
Load(xsource, space);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
XDocument::XDocument(const std::string& source, const bool space)
|
||||
{
|
||||
NSCommon::smart_ptr<Private::XSingleSource> xsource(new Private::XStringSource(source));
|
||||
Load(xsource, space);
|
||||
}
|
||||
|
||||
|
||||
XDocument::XDocument(const std::wstring& source, const bool space)
|
||||
{
|
||||
NSCommon::smart_ptr<Private::XWideSource> xsource(new Private::XWStringSource(source));
|
||||
Load(xsource, space);
|
||||
}
|
||||
|
||||
XDocument::XDocument(const OOX::CPath& source, const bool space)
|
||||
{
|
||||
TxtFile text(source);
|
||||
if(text.isUnicode())
|
||||
{
|
||||
NSCommon::smart_ptr<Private::XWideSource> xsource(new Private::XWFileSource(source, Private::XWideSource::estLittleEndian));
|
||||
Load(xsource, space);
|
||||
}
|
||||
else if((text.isBigEndian()) || (text.isUnicodeWithOutBOM()))
|
||||
{
|
||||
NSCommon::smart_ptr<Private::XWideSource> xsource(new Private::XWFileSource(source, Private::XWideSource::estBigEndian));
|
||||
Load(xsource, space);
|
||||
}
|
||||
else
|
||||
{
|
||||
NSCommon::smart_ptr<Private::XSingleSource> xsource(new Private::XFileSource(source));
|
||||
Load(xsource, space);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const std::string XDocument::ToString()
|
||||
{
|
||||
Root->Namespaces.merge(Root->usedNamespace());
|
||||
|
||||
std::list<std::string> strList;
|
||||
strList.push_back(Declaration->ToString());
|
||||
Root->SaveToStringList(strList);
|
||||
|
||||
std::string result = "";
|
||||
size_t length = 0;
|
||||
for(std::list<std::string>::const_iterator iter = strList.begin(); iter != strList.end(); iter++)
|
||||
{
|
||||
length += iter->length();
|
||||
}
|
||||
result.reserve(length);
|
||||
for(std::list<std::string>::const_iterator iter = strList.begin(); iter != strList.end(); iter++)
|
||||
{
|
||||
result += *iter;
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
|
||||
const std::wstring XDocument::ToWString()
|
||||
{
|
||||
Root->Namespaces.merge(Root->usedNamespace());
|
||||
|
||||
std::list<std::wstring> strList;
|
||||
strList.push_back(Declaration->ToWString());
|
||||
Root->SaveToWStringList(strList);
|
||||
|
||||
std::wstring result = L"";
|
||||
size_t length = 0;
|
||||
for(std::list<std::wstring>::const_iterator iter = strList.begin(); iter != strList.end(); iter++)
|
||||
{
|
||||
length += iter->length();
|
||||
}
|
||||
result.reserve(length);
|
||||
for(std::list<std::wstring>::const_iterator iter = strList.begin(); iter != strList.end(); iter++)
|
||||
{
|
||||
result += *iter;
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
|
||||
void XDocument::Load(NSCommon::smart_ptr<Private::XSingleSource> source, const bool space)
|
||||
{
|
||||
source->findAndSkip('<');
|
||||
if (source->get() == '?')
|
||||
{
|
||||
Declaration->fromSource(source);
|
||||
source->findAndSkip('<');
|
||||
}
|
||||
source->skipSpace();
|
||||
Root->fromSource(source, Root->Namespaces, space);
|
||||
}
|
||||
|
||||
|
||||
void XDocument::Load(NSCommon::smart_ptr<Private::XWideSource> source, const bool space)
|
||||
{
|
||||
source->findAndSkip(L'<');
|
||||
if (source->get() == L'?')
|
||||
{
|
||||
Declaration->fromSource(source);
|
||||
source->findAndSkip(L'<');
|
||||
}
|
||||
source->skipSpace();
|
||||
Root->fromSource(source, Root->Namespaces, space);
|
||||
}
|
||||
|
||||
void XDocument::Save(const OOX::CPath& path)
|
||||
{
|
||||
std::ofstream file(path.GetPath());
|
||||
if (!file.bad())
|
||||
{
|
||||
file << ToString();
|
||||
file.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void XDocument::Save(std::string& source)
|
||||
{
|
||||
source.clear();
|
||||
source = ToString();
|
||||
}
|
||||
|
||||
|
||||
void XDocument::Save(std::wstring& source)
|
||||
{
|
||||
source.clear();
|
||||
source = ToWString();
|
||||
}
|
||||
|
||||
} // namespace XML
|
||||
79
ActiveX/Common/ASCDocxFormat/Source/XML/XDocument.h
Normal file
79
ActiveX/Common/ASCDocxFormat/Source/XML/XDocument.h
Normal file
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef XML_XDOCUMENT_INCLUDE_H_
|
||||
#define XML_XDOCUMNET_INCLUDE_H_
|
||||
|
||||
#include "property.h"
|
||||
#include "XElement.h"
|
||||
#include "Private/XDeclaration.h"
|
||||
#include "Private/XSingleSource.h"
|
||||
#include "Private/XWideSource.h"
|
||||
|
||||
#include "../../../../Common/DocxFormat/Source/SystemUtility/SystemUtility.h"
|
||||
#include "../../../../Common/DocxFormat/Source/Base/SmartPtr.h"
|
||||
|
||||
namespace XML
|
||||
{
|
||||
class XDocument
|
||||
{
|
||||
public:
|
||||
explicit XDocument(const XElement& element);
|
||||
explicit XDocument(const wchar_t* source, const bool space = false);
|
||||
explicit XDocument(const std::string& source, const bool space = false);
|
||||
explicit XDocument(const std::wstring& source, const bool space = false);
|
||||
explicit XDocument(const OOX::CPath& source, const bool space = false);
|
||||
|
||||
public:
|
||||
XDocument const* const operator->() const {return this;}
|
||||
XDocument* operator->() {return this;}
|
||||
|
||||
public:
|
||||
const std::string ToString();
|
||||
const std::wstring ToWString();
|
||||
|
||||
public:
|
||||
void Save(const OOX::CPath& path);
|
||||
void Save(std::string& source);
|
||||
void Save(std::wstring& source);
|
||||
|
||||
public:
|
||||
property<Private::XDeclaration> Declaration;
|
||||
XElement Root;
|
||||
|
||||
private:
|
||||
void Load(NSCommon::smart_ptr<Private::XSingleSource> source, const bool space = false);
|
||||
void Load(NSCommon::smart_ptr<Private::XWideSource> source, const bool space = false);
|
||||
};
|
||||
}
|
||||
|
||||
#endif // XML_XDOCUMENT_INCLUDE_H_
|
||||
267
ActiveX/Common/ASCDocxFormat/Source/XML/XElement.cpp
Normal file
267
ActiveX/Common/ASCDocxFormat/Source/XML/XElement.cpp
Normal file
@@ -0,0 +1,267 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled_xml.h"
|
||||
|
||||
|
||||
#include "XElement.h"
|
||||
#include "XName.h"
|
||||
#include "Private/XList.h"
|
||||
#include "XDocument.h"
|
||||
#include "Private/XNamespaceContainer.h"
|
||||
#include "Private/XAttributeContainer.h"
|
||||
#include "Private/XNodeContainer.h"
|
||||
#include "Private/XElementContainer.h"
|
||||
#include "XNode.h"
|
||||
#include "XText.h"
|
||||
#include "Private/NullXElement.h"
|
||||
#include "Private/NullElement.h"
|
||||
#include "XAttribute.h"
|
||||
#include "Exception/not_implement.h"
|
||||
|
||||
namespace XML
|
||||
{
|
||||
XElement::XElement()
|
||||
: base(new Private::Element()),
|
||||
XName(m_ptr->XName),
|
||||
Namespaces(m_ptr->Namespaces),
|
||||
Attributes(m_ptr->Attributes),
|
||||
Nodes(m_ptr->Nodes),
|
||||
Elements(m_ptr->Elements),
|
||||
Texts(m_ptr->Texts),
|
||||
Space(m_ptr->Space)
|
||||
{
|
||||
}
|
||||
|
||||
XElement::XElement(const Private::NullXElement&)
|
||||
: base(new Private::NullElement()),
|
||||
XName(m_ptr->XName),
|
||||
Namespaces(m_ptr->Namespaces),
|
||||
Attributes(m_ptr->Attributes),
|
||||
Nodes(m_ptr->Nodes),
|
||||
Elements(m_ptr->Elements),
|
||||
Texts(m_ptr->Texts),
|
||||
Space(m_ptr->Space)
|
||||
{
|
||||
}
|
||||
|
||||
XElement::XElement(const XML::XName& xname)
|
||||
: base(new Private::Element(xname)),
|
||||
XName(m_ptr->XName),
|
||||
Namespaces(m_ptr->Namespaces),
|
||||
Attributes(m_ptr->Attributes),
|
||||
Nodes(m_ptr->Nodes),
|
||||
Elements(m_ptr->Elements),
|
||||
Texts(m_ptr->Texts),
|
||||
Space(m_ptr->Space)
|
||||
{
|
||||
}
|
||||
|
||||
XElement::XElement(const XML::XName& xname, const Private::XList& list)
|
||||
: base(new Private::Element(xname, list)),
|
||||
XName(m_ptr->XName),
|
||||
Namespaces(m_ptr->Namespaces),
|
||||
Attributes(m_ptr->Attributes),
|
||||
Nodes(m_ptr->Nodes),
|
||||
Elements(m_ptr->Elements),
|
||||
Texts(m_ptr->Texts),
|
||||
Space(m_ptr->Space)
|
||||
{
|
||||
}
|
||||
|
||||
XElement::XElement(NSCommon::smart_ptr<Private::XSingleSource> source, const Private::XNamespaceContainer& ns, const Private::XSpace& space)
|
||||
: base(new Private::Element(source, ns, space)),
|
||||
XName(m_ptr->XName),
|
||||
Namespaces(m_ptr->Namespaces),
|
||||
Attributes(m_ptr->Attributes),
|
||||
Nodes(m_ptr->Nodes),
|
||||
Elements(m_ptr->Elements),
|
||||
Texts(m_ptr->Texts),
|
||||
Space(m_ptr->Space)
|
||||
{
|
||||
}
|
||||
|
||||
XElement::XElement(NSCommon::smart_ptr<Private::XWideSource> source, const Private::XNamespaceContainer& ns, const Private::XSpace& space)
|
||||
: base(new Private::Element(source, ns, space)),
|
||||
XName(m_ptr->XName),
|
||||
Namespaces(m_ptr->Namespaces),
|
||||
Attributes(m_ptr->Attributes),
|
||||
Nodes(m_ptr->Nodes),
|
||||
Elements(m_ptr->Elements),
|
||||
Texts(m_ptr->Texts),
|
||||
Space(m_ptr->Space)
|
||||
{
|
||||
}
|
||||
|
||||
const XElement& XElement::operator =(const XElement& rhs)
|
||||
{
|
||||
m_ptr = rhs.m_ptr;
|
||||
XName = rhs.XName;
|
||||
Namespaces = rhs.Namespaces;
|
||||
Attributes = rhs.Attributes;
|
||||
Nodes = rhs.Nodes;
|
||||
Elements = rhs.Elements;
|
||||
Texts = rhs.Texts;
|
||||
Space = rhs.Space;
|
||||
return *this;
|
||||
}
|
||||
|
||||
XElement::XElement(const XNode& xnode)
|
||||
: base(xnode.get_ptr().smart_dynamic_cast<Private::Element>()),
|
||||
XName(m_ptr->XName),
|
||||
Namespaces(m_ptr->Namespaces),
|
||||
Attributes(m_ptr->Attributes),
|
||||
Nodes(m_ptr->Nodes),
|
||||
Elements(m_ptr->Elements),
|
||||
Texts(m_ptr->Texts),
|
||||
Space(m_ptr->Space)
|
||||
{
|
||||
int c = 0;
|
||||
}
|
||||
|
||||
void XElement::Save(const OOX::CPath& path) const
|
||||
{
|
||||
XDocument(*this).Save(path);
|
||||
}
|
||||
|
||||
void XElement::fromSource(NSCommon::smart_ptr<Private::XSingleSource> source, const Private::XNamespaceContainer& ns, const Private::XSpace& space)
|
||||
{
|
||||
m_ptr->fromSource(source, ns, space);
|
||||
}
|
||||
|
||||
void XElement::fromSource(NSCommon::smart_ptr<Private::XWideSource> source, const Private::XNamespaceContainer& ns, const Private::XSpace& space)
|
||||
{
|
||||
m_ptr->fromSource(source, ns, space);
|
||||
}
|
||||
|
||||
const std::string XElement::ToString() const
|
||||
{
|
||||
return m_ptr->ToString();
|
||||
}
|
||||
|
||||
const std::wstring XElement::ToWString() const
|
||||
{
|
||||
return m_ptr->ToWString();
|
||||
}
|
||||
|
||||
void XElement::SaveToStringList(std::list<std::string>& strList)const
|
||||
{
|
||||
m_ptr->SaveToStringList(strList);
|
||||
}
|
||||
|
||||
void XElement::SaveToWStringList(std::list<std::wstring>& strList)const
|
||||
{
|
||||
m_ptr->SaveToWStringList(strList);
|
||||
}
|
||||
|
||||
const bool XElement::exist() const
|
||||
{
|
||||
return m_ptr->exist();
|
||||
}
|
||||
|
||||
const Private::XNamespaceContainer XElement::usedNamespace() const
|
||||
{
|
||||
return m_ptr->usedNamespace();
|
||||
}
|
||||
|
||||
const Private::XString XElement::text() const
|
||||
{
|
||||
return m_ptr->text();
|
||||
}
|
||||
|
||||
void XElement::Add(const XAttribute& attribute)
|
||||
{
|
||||
m_ptr->Add(attribute);
|
||||
}
|
||||
|
||||
void XElement::Add(const XNamespace& ns)
|
||||
{
|
||||
m_ptr->Add(ns);
|
||||
}
|
||||
|
||||
void XElement::Add(const XNode& node)
|
||||
{
|
||||
m_ptr->Add(node);
|
||||
}
|
||||
|
||||
void XElement::Add(const XElement& element)
|
||||
{
|
||||
m_ptr->Add(element);
|
||||
}
|
||||
|
||||
void XElement::Add(const XText& text)
|
||||
{
|
||||
m_ptr->Add(text);
|
||||
}
|
||||
|
||||
void XElement::Add(const XContainer& container)
|
||||
{
|
||||
m_ptr->Add(container);
|
||||
}
|
||||
|
||||
void XElement::Add(const Private::XList& list)
|
||||
{
|
||||
m_ptr->Add(list);
|
||||
}
|
||||
|
||||
XAttribute& XElement::attribute(const XML::XName& xname)
|
||||
{
|
||||
return m_ptr->attribute(xname);
|
||||
}
|
||||
|
||||
const XAttribute& XElement::attribute(const XML::XName& xname) const
|
||||
{
|
||||
return m_ptr->attribute(xname);
|
||||
}
|
||||
|
||||
|
||||
XElement XElement::element(const XML::XName& xname)
|
||||
{
|
||||
return m_ptr->element(xname);
|
||||
}
|
||||
|
||||
const XElement XElement::element(const XML::XName& xname) const
|
||||
{
|
||||
return m_ptr->element(xname);
|
||||
}
|
||||
|
||||
XElement XElement::element(const XML::XName& xname, const std::string& value)
|
||||
{
|
||||
return m_ptr->element(xname, value);
|
||||
}
|
||||
|
||||
const XElement XElement::element(const XML::XName& xname, const std::string& value) const
|
||||
{
|
||||
return m_ptr->element(xname, value);
|
||||
}
|
||||
|
||||
} // namespace XML
|
||||
179
ActiveX/Common/ASCDocxFormat/Source/XML/XElement.h
Normal file
179
ActiveX/Common/ASCDocxFormat/Source/XML/XElement.h
Normal file
@@ -0,0 +1,179 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef XML_XELEMENT_INCLUDE_H_
|
||||
#define XML_XELEMENT_INCLUDE_H_
|
||||
|
||||
#include <string>
|
||||
#include <list>
|
||||
|
||||
#include "Private/XPointer.h"
|
||||
#include "Private/Element.h"
|
||||
#include "property.h"
|
||||
#include "setter.h"
|
||||
#include "getter.h"
|
||||
#include "Private/XString.h"
|
||||
#include "Private/XNamespaceContainer.h"
|
||||
#include "Private/XSpace.h"
|
||||
#include "Private/XSingleSource.h"
|
||||
#include "Private/XWideSource.h"
|
||||
|
||||
#include "../../../../Common/DocxFormat/Source/Base/SmartPtr.h"
|
||||
|
||||
namespace XML
|
||||
{
|
||||
class XAttribute;
|
||||
class XNamespace;
|
||||
class XName;
|
||||
class XNode;
|
||||
class XText;
|
||||
class XContainer;
|
||||
class XObject;
|
||||
|
||||
namespace Private
|
||||
{
|
||||
class XList;
|
||||
class XAttributeContainer;
|
||||
class XNodeContainer;
|
||||
class XElementContainer;
|
||||
class XTextContainer;
|
||||
class NullXElement;
|
||||
}
|
||||
|
||||
class XElement : public Private::XPointer<Private::Element>
|
||||
{
|
||||
public:
|
||||
XElement();
|
||||
XElement(const Private::NullXElement&);
|
||||
explicit XElement(const XName& xname);
|
||||
XElement(const XName& xname, const Private::XList& list);
|
||||
XElement(NSCommon::smart_ptr<Private::XSingleSource> source, const Private::XNamespaceContainer& ns, const Private::XSpace& space);
|
||||
XElement(NSCommon::smart_ptr<Private::XWideSource> source, const Private::XNamespaceContainer& ns, const Private::XSpace& space);
|
||||
const XElement& operator= (const XElement& rhs);
|
||||
XElement(const XNode& xnode);
|
||||
|
||||
public:
|
||||
template<class T>
|
||||
operator const nullable__<T>() const
|
||||
{
|
||||
if (exist())
|
||||
return T(*this);
|
||||
return nullable__<T>();
|
||||
}
|
||||
|
||||
template<class T, class S, class G>
|
||||
operator const property<T, S, G>() const
|
||||
{
|
||||
return T(*this);
|
||||
}
|
||||
|
||||
template<class T, class S, class G>
|
||||
operator const nullable_property<T, S, G>() const
|
||||
{
|
||||
if (exist())
|
||||
return T(*this);
|
||||
return nullable_property<T, S, G>();
|
||||
}
|
||||
|
||||
public:
|
||||
XElement const* const operator->() const {return this;}
|
||||
XElement* operator->() {return this;}
|
||||
|
||||
public:
|
||||
void Save(const OOX::CPath& path) const;
|
||||
|
||||
public:
|
||||
void fromSource(NSCommon::smart_ptr<Private::XSingleSource> source, const Private::XNamespaceContainer& ns, const Private::XSpace& space);
|
||||
void fromSource(NSCommon::smart_ptr<Private::XWideSource> source, const Private::XNamespaceContainer& ns, const Private::XSpace& space);
|
||||
const std::string ToString() const;
|
||||
const std::wstring ToWString() const;
|
||||
virtual void SaveToStringList(std::list<std::string>& strList)const;
|
||||
virtual void SaveToWStringList(std::list<std::wstring>& strList)const;
|
||||
|
||||
public:
|
||||
const bool exist() const;
|
||||
const Private::XString text() const;
|
||||
const Private::XNamespaceContainer usedNamespace() const;
|
||||
|
||||
public:
|
||||
void Add(const XAttribute& attribute);
|
||||
void Add(const XNamespace& ns);
|
||||
void Add(const XNode& node);
|
||||
void Add(const XElement& element);
|
||||
void Add(const XText& text);
|
||||
void Add(const XContainer& container);
|
||||
void Add(const Private::XList& list);
|
||||
|
||||
public:
|
||||
XAttribute& attribute(const XName& xname);
|
||||
const XAttribute& attribute(const XName& xname) const;
|
||||
|
||||
XElement element(const XName& xname);
|
||||
const XElement element(const XName& xname) const;
|
||||
|
||||
XElement element(const XName& xname, const std::string& value);
|
||||
const XElement element(const XName& xname, const std::string& value) const;
|
||||
|
||||
public:
|
||||
property<XName>& XName;
|
||||
Private::XNamespaceContainer& Namespaces;
|
||||
Private::XAttributeContainer& Attributes;
|
||||
Private::XNodeContainer& Nodes;
|
||||
Private::XElementContainer& Elements;
|
||||
Private::XTextContainer& Texts;
|
||||
property<Private::XSpace>& Space;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
template<typename T>
|
||||
const nullable__<T>& nullable_setter(nullable__<T>& lhs, const XML::XElement& rhs)
|
||||
{
|
||||
return ::nullable_setter(lhs, nullable__<T>(rhs));
|
||||
}
|
||||
|
||||
|
||||
template<typename T, class S, class G>
|
||||
const property<T, S, G>& property_setter(property<T, S, G>& lhs, const XML::XElement& rhs)
|
||||
{
|
||||
return ::property_setter(lhs, T(rhs));
|
||||
}
|
||||
|
||||
|
||||
template<typename T, class S, class G>
|
||||
const nullable_property<T, S, G>& nullable_property_setter(nullable_property<T, S, G>& lhs, const XML::XElement& rhs)
|
||||
{
|
||||
return ::nullable_property_setter(lhs, nullable_property<T, S, G>(rhs));
|
||||
}
|
||||
|
||||
|
||||
#endif // XML_XELEMENT_INCLUDE_H_
|
||||
63
ActiveX/Common/ASCDocxFormat/Source/XML/XML.h
Normal file
63
ActiveX/Common/ASCDocxFormat/Source/XML/XML.h
Normal file
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef XML_INCLUDE_H_
|
||||
#define XML_INCLUDE_H_
|
||||
|
||||
#include "XAttribute.h"
|
||||
#include "XNamespace.h"
|
||||
#include "XText.h"
|
||||
#include "XContainer.h"
|
||||
#include "XElement.h"
|
||||
#include "XNode.h"
|
||||
#include "XDocument.h"
|
||||
#include "Private/XList.h"
|
||||
#include "Extension/Fill.h"
|
||||
#include "XObject.h"
|
||||
#include "XComment.h"
|
||||
|
||||
|
||||
namespace XML
|
||||
{
|
||||
typedef XML::Private::XAttributeContainer::iterator attribute_iterator;
|
||||
typedef XML::Private::XAttributeContainer::const_iterator const_attribute_iterator;
|
||||
typedef XML::Private::XNamespaceContainer::iterator namespace_iterator;
|
||||
typedef XML::Private::XNamespaceContainer::const_iterator const_namespace_iterator;
|
||||
typedef XML::Private::XNodeContainer::iterator node_iterator;
|
||||
typedef XML::Private::XNodeContainer::const_iterator const_node_iterator;
|
||||
typedef XML::Private::XElementContainer::iterator element_iterator;
|
||||
typedef XML::Private::XElementContainer::const_iterator const_element_iterator;
|
||||
typedef XML::Private::XTextContainer::iterator text_iterator;
|
||||
typedef XML::Private::XTextContainer::const_iterator const_text_iterator;
|
||||
}
|
||||
|
||||
#endif // XML_INCLUDE_H_
|
||||
142
ActiveX/Common/ASCDocxFormat/Source/XML/XName.cpp
Normal file
142
ActiveX/Common/ASCDocxFormat/Source/XML/XName.cpp
Normal file
@@ -0,0 +1,142 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled_xml.h"
|
||||
|
||||
|
||||
#include "XName.h"
|
||||
#include <algorithm>
|
||||
#include "Encoding.h"
|
||||
#include "ToString.h"
|
||||
|
||||
|
||||
namespace XML
|
||||
{
|
||||
|
||||
XName::XName()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
XName::XName(const char* name)
|
||||
: Name(name)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
XName::XName(const std::string& name)
|
||||
: Name(name)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
XName::XName(const XNamespace& ns, const std::string& name)
|
||||
: Ns(ns),
|
||||
Name(name)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
const bool XName::Equal(const XName& rhs) const
|
||||
{
|
||||
if (rhs.Ns.is_init() && Ns.is_init())
|
||||
return ((rhs.Ns->GetPrefix() == Ns->GetPrefix()) &&
|
||||
(rhs.Name.ToString() == Name.ToString()));
|
||||
if (!rhs.Ns.is_init() && !Ns.is_init())
|
||||
return rhs.Name.ToString() == Name.ToString();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
const bool XName::operator ==(const XName& rhs) const
|
||||
{
|
||||
if (!rhs.Ns.is_init() || !Ns.is_init())
|
||||
return Name.ToString() == rhs.Name.ToString();
|
||||
return ((Ns->GetPrefix() == rhs.Ns->GetPrefix()) &&
|
||||
(Name.ToString() == rhs.Name.ToString()));
|
||||
}
|
||||
|
||||
|
||||
const std::string XName::ToString() const
|
||||
{
|
||||
if (!Ns.is_init())
|
||||
return Name;
|
||||
return Ns->GetPrefix() + ":" + Name.ToString();
|
||||
}
|
||||
|
||||
|
||||
const std::wstring XName::ToWString() const
|
||||
{
|
||||
if (!Ns.is_init())
|
||||
return Encoding::utf82unicode(Name.ToString());
|
||||
return Encoding::utf82unicode(Ns->GetPrefix()) + L":" + Encoding::utf82unicode(Name.ToString());
|
||||
}
|
||||
|
||||
|
||||
void XName::SaveToStringList(std::list<std::string>& strList)const
|
||||
{
|
||||
if (!Ns.is_init())
|
||||
{
|
||||
strList.push_back(*Name);
|
||||
return;
|
||||
}
|
||||
strList.push_back(Ns->GetPrefix());
|
||||
strList.push_back(":");
|
||||
strList.push_back(*Name);
|
||||
}
|
||||
|
||||
|
||||
void XName::SaveToWStringList(std::list<std::wstring>& strList)const
|
||||
{
|
||||
if (!Ns.is_init())
|
||||
{
|
||||
strList.push_back(Encoding::utf82unicode(*Name));
|
||||
return;
|
||||
}
|
||||
strList.push_back(Encoding::utf82unicode(Ns->GetPrefix()));
|
||||
strList.push_back(L":");
|
||||
strList.push_back(Encoding::utf82unicode(*Name));
|
||||
}
|
||||
|
||||
|
||||
const XName operator +(const XNamespace& ns, const std::string& name)
|
||||
{
|
||||
return XName(ns, name);
|
||||
}
|
||||
|
||||
|
||||
const XName operator +(const XNamespace& ns, const char* name)
|
||||
{
|
||||
return XName(ns, name);
|
||||
}
|
||||
|
||||
} // namespace XML
|
||||
73
ActiveX/Common/ASCDocxFormat/Source/XML/XName.h
Normal file
73
ActiveX/Common/ASCDocxFormat/Source/XML/XName.h
Normal file
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef XML_XNAME_INCLUDE_H_
|
||||
#define XML_XNAME_INCLUDE_H_
|
||||
|
||||
#include <string>
|
||||
#include "property.h"
|
||||
#include "nullable_property.h"
|
||||
#include "XNamespace.h"
|
||||
|
||||
namespace XML
|
||||
{
|
||||
class XName
|
||||
{
|
||||
public:
|
||||
XName();
|
||||
XName(const char* name);
|
||||
XName(const std::string& name);
|
||||
XName(const XNamespace& ns, const std::string& name);
|
||||
|
||||
public:
|
||||
const bool Equal(const XName& rhs) const;
|
||||
const bool operator ==(const XName& rhs) const;
|
||||
|
||||
XName const* const operator->() const {return this;}
|
||||
XName* operator->() {return this;}
|
||||
|
||||
public:
|
||||
const std::string ToString() const;
|
||||
const std::wstring ToWString() const;
|
||||
virtual void SaveToStringList(std::list<std::string>& strList)const;
|
||||
virtual void SaveToWStringList(std::list<std::wstring>& strList)const;
|
||||
|
||||
public:
|
||||
nullable_property<XNamespace> Ns;
|
||||
property<std::string> Name;
|
||||
};
|
||||
|
||||
const XName operator +(const XNamespace& ns, const std::string& name);
|
||||
const XName operator +(const XNamespace& ns, const char* name);
|
||||
}
|
||||
|
||||
#endif // XML_XNAME_INCLUDE_H_
|
||||
116
ActiveX/Common/ASCDocxFormat/Source/XML/XNamespace.cpp
Normal file
116
ActiveX/Common/ASCDocxFormat/Source/XML/XNamespace.cpp
Normal file
@@ -0,0 +1,116 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled_xml.h"
|
||||
|
||||
|
||||
#include "XNamespace.h"
|
||||
#include "Private/NullNamespace.h"
|
||||
|
||||
|
||||
namespace XML
|
||||
{
|
||||
|
||||
XNamespace::XNamespace()
|
||||
: base(new Private::NullNamespace())
|
||||
|
||||
|
||||
|
||||
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
XNamespace::XNamespace(const std::string& prefix, const std::string& name)
|
||||
: base(new Private::Namespace(prefix, name))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
XNamespace::XNamespace(const XNamespace& ns)
|
||||
: base(ns.m_ptr)
|
||||
|
||||
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
const XNamespace& XNamespace::operator =(const XNamespace& rhs)
|
||||
{
|
||||
if (this != &rhs)
|
||||
{
|
||||
m_ptr = rhs.m_ptr;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
const bool XNamespace::operator==(const XNamespace& rhs) const
|
||||
{
|
||||
return ((*m_ptr) == (*rhs.m_ptr));
|
||||
}
|
||||
|
||||
|
||||
const bool XNamespace::operator<(const XNamespace& rhs) const
|
||||
{
|
||||
return ((*m_ptr) < (*rhs.m_ptr));
|
||||
}
|
||||
|
||||
|
||||
const bool XNamespace::exist() const
|
||||
{
|
||||
return m_ptr->exist();
|
||||
}
|
||||
|
||||
|
||||
const std::string XNamespace::GetPrefix()const
|
||||
{
|
||||
return m_ptr->GetPrefix();
|
||||
}
|
||||
|
||||
|
||||
const std::string XNamespace::GetName()const
|
||||
{
|
||||
return m_ptr->GetName();
|
||||
}
|
||||
|
||||
} // namespace XML
|
||||
66
ActiveX/Common/ASCDocxFormat/Source/XML/XNamespace.h
Normal file
66
ActiveX/Common/ASCDocxFormat/Source/XML/XNamespace.h
Normal file
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef XML_XNAMESPACE_INCLUDE_H_
|
||||
#define XML_XNAMESPACE_INCLUDE_H_
|
||||
|
||||
#include "Private/XPointer.h"
|
||||
#include "Private/Namespace.h"
|
||||
|
||||
|
||||
namespace XML
|
||||
{
|
||||
class XNamespace : public Private::XPointer<Private::Namespace>
|
||||
{
|
||||
public:
|
||||
XNamespace(const std::string& prefix, const std::string& name);
|
||||
XNamespace(const XNamespace& ns);
|
||||
|
||||
public:
|
||||
const XNamespace& operator= (const XNamespace& rhs);
|
||||
const bool operator==(const XNamespace& rhs) const;
|
||||
const bool operator<(const XNamespace& rhs) const;
|
||||
|
||||
|
||||
public:
|
||||
virtual const bool exist() const;
|
||||
|
||||
public:
|
||||
const std::string GetPrefix()const;
|
||||
const std::string GetName()const;
|
||||
|
||||
protected:
|
||||
XNamespace();
|
||||
};
|
||||
}
|
||||
|
||||
#endif // XML_XNAMESPACE_INCLUDE_H_
|
||||
116
ActiveX/Common/ASCDocxFormat/Source/XML/XNode.cpp
Normal file
116
ActiveX/Common/ASCDocxFormat/Source/XML/XNode.cpp
Normal file
@@ -0,0 +1,116 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled_xml.h"
|
||||
|
||||
|
||||
#include "XNode.h"
|
||||
#include "XText.h"
|
||||
#include "XComment.h"
|
||||
#include "XElement.h"
|
||||
#include "XContainer.h"
|
||||
|
||||
|
||||
namespace XML
|
||||
{
|
||||
|
||||
XNode::XNode()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
XNode::XNode(const XText& text)
|
||||
: base(text)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
XNode::XNode(const XElement& element)
|
||||
: base(element)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
XNode::XNode(const XComment& comment)
|
||||
: base(comment)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
XNode::XNode(const XContainer& container)
|
||||
: base(container)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
const bool XNode::isElement() const
|
||||
{
|
||||
return m_ptr->isElement();
|
||||
}
|
||||
|
||||
|
||||
const bool XNode::isText() const
|
||||
{
|
||||
return m_ptr->isText();
|
||||
}
|
||||
|
||||
|
||||
const bool XNode::isComment() const
|
||||
{
|
||||
return m_ptr->isComment();
|
||||
}
|
||||
|
||||
|
||||
const std::string XNode::ToString() const
|
||||
{
|
||||
return m_ptr->ToString();
|
||||
}
|
||||
|
||||
|
||||
const std::wstring XNode::ToWString() const
|
||||
{
|
||||
return m_ptr->ToWString();
|
||||
}
|
||||
|
||||
|
||||
void XNode::SaveToStringList(std::list<std::string>& strList)const
|
||||
{
|
||||
m_ptr->SaveToStringList(strList);
|
||||
}
|
||||
|
||||
|
||||
void XNode::SaveToWStringList(std::list<std::wstring>& strList)const
|
||||
{
|
||||
m_ptr->SaveToWStringList(strList);
|
||||
}
|
||||
|
||||
} // namespace XML
|
||||
71
ActiveX/Common/ASCDocxFormat/Source/XML/XNode.h
Normal file
71
ActiveX/Common/ASCDocxFormat/Source/XML/XNode.h
Normal file
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef XML_XNODE_INCLUDE_H_
|
||||
#define XML_XNODE_INCLUDE_H_
|
||||
|
||||
#include "Private/XPointer.h"
|
||||
#include "Private/Node.h"
|
||||
#include <string>
|
||||
#include <list>
|
||||
|
||||
|
||||
namespace XML
|
||||
{
|
||||
class XText;
|
||||
class XElement;
|
||||
class XComment;
|
||||
class XContainer;
|
||||
|
||||
class XNode : public Private::XPointer<Private::Node>
|
||||
{
|
||||
public:
|
||||
XNode();
|
||||
XNode(const XText& text);
|
||||
XNode(const XElement& element);
|
||||
XNode(const XComment& comment);
|
||||
XNode(const XContainer& container);
|
||||
|
||||
public:
|
||||
const bool isElement() const;
|
||||
const bool isText() const;
|
||||
const bool isComment() const;
|
||||
|
||||
public:
|
||||
const std::string ToString() const;
|
||||
const std::wstring ToWString() const;
|
||||
virtual void SaveToStringList(std::list<std::string>& strList)const;
|
||||
virtual void SaveToWStringList(std::list<std::wstring>& strList)const;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // XML_XNODE_INCLUDE_H_
|
||||
51
ActiveX/Common/ASCDocxFormat/Source/XML/XObject.cpp
Normal file
51
ActiveX/Common/ASCDocxFormat/Source/XML/XObject.cpp
Normal file
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled_xml.h"
|
||||
|
||||
|
||||
#include "XObject.h"
|
||||
|
||||
|
||||
namespace XML
|
||||
{
|
||||
|
||||
XObject::XObject()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
XObject::~XObject()
|
||||
{
|
||||
}
|
||||
|
||||
} // namespace XML
|
||||
56
ActiveX/Common/ASCDocxFormat/Source/XML/XObject.h
Normal file
56
ActiveX/Common/ASCDocxFormat/Source/XML/XObject.h
Normal file
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef XML_XOBJECT_INCLUDE_H_
|
||||
#define XML_XOBJECT_INCLUDE_H_
|
||||
|
||||
#include "XNode.h"
|
||||
|
||||
|
||||
namespace XML
|
||||
{
|
||||
class XObject
|
||||
{
|
||||
public:
|
||||
XObject();
|
||||
virtual ~XObject();
|
||||
|
||||
public:
|
||||
virtual void fromXML(const XNode& node) = 0;
|
||||
virtual const XNode toXML() const = 0;
|
||||
|
||||
public:
|
||||
void this_is_not_xobject_class() const {};
|
||||
};
|
||||
}
|
||||
|
||||
#endif // XML_XOBJECT_INCLUDE_H_
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user