Compare commits

..

15 Commits

33 changed files with 452 additions and 286 deletions

View File

@ -0,0 +1,60 @@
/*
* (c) Copyright Ascensio System SIA 2010-2023
*
* 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 20A-6 Ernesta Birznieka-Upish
* street, Riga, Latvia, EU, LV-1050.
*
* 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 DOC_BUILDER_ADDON_PRIVATE
#define DOC_BUILDER_ADDON_PRIVATE
#include <string>
namespace NSDoctRenderer
{
class CDocBuilderAddon
{
private:
std::wstring m_sWorkDirectory;
public:
CDocBuilderAddon(const std::wstring& sWorkDir)
{
m_sWorkDirectory = sWorkDir;
}
public:
std::wstring GetX2tSaveAddon()
{
return L"";
}
int GetX2tPreSaveError()
{
return 0;
}
};
}
#endif // DOC_BUILDER_ADDON_PRIVATE

View File

@ -63,6 +63,8 @@
#include "../common/ProcessEnv.h"
#include "docbuilder_addon.h"
#ifdef CreateFile
#undef CreateFile
#endif
@ -980,6 +982,12 @@ namespace NSDoctRenderer
{
Init();
CDocBuilderAddon oSaveAddon(m_sX2tPath);
int nPreSaveError = oSaveAddon.GetX2tPreSaveError();
if (0 != nPreSaveError)
return nPreSaveError;
if (-1 == m_nFileType)
{
CV8RealTimeWorker::_LOGGING_ERROR_(L"error (save)", L"file not opened!");
@ -1063,6 +1071,8 @@ namespace NSDoctRenderer
if (!sOptions.empty())
oBuilder.WriteString(UTF8_TO_U(sOptions));
oBuilder.WriteString(oSaveAddon.GetX2tSaveAddon());
oBuilder.WriteString(L"</TaskQueueDataConvert>");
std::wstring sXmlConvert = oBuilder.GetData();

View File

@ -0,0 +1,130 @@
QT -= core
QT -= gui
VERSION = 1.0.0.3
TARGET = doctrenderer
TEMPLATE = lib
CONFIG += shared
CONFIG += plugin
CORE_ROOT_DIR = $$PWD/../..
PWD_ROOT_DIR = $$PWD
PWD_CUR = $$PWD
include($$PWD_CUR/../../Common/base.pri)
DEFINES += DOCTRENDERER_USE_DYNAMIC_LIBRARY_BUILDING
DEFINES += JSBASE_USE_DYNAMIC_LIBRARY_BUILDING
ADD_DEPENDENCY(graphics, kernel, UnicodeConverter, kernel_network)
#CONFIG += build_xp
#CONFIG += v8_version_60
core_android:DEFINES += DISABLE_MEMORY_LIMITATION
HEADERS += \
$$PWD_CUR/config.h \
$$PWD_CUR/editors.h \
$$PWD_CUR/doctrenderer.h \
$$PWD_CUR/docbuilder.h
SOURCES += \
$$PWD_CUR/editors.cpp \
$$PWD_CUR/nativecontrol.cpp \
$$PWD_CUR/doctrenderer.cpp \
$$PWD_CUR/docbuilder.cpp \
$$PWD_CUR/docbuilder_p.cpp \
$$PWD_CUR/graphics.cpp \
$$PWD_CUR/hash.cpp
SOURCES += \
$$PWD_CUR/../../Common/OfficeFileFormatChecker2.cpp \
$$PWD_CUR/../../Common/3dParty/pole/pole.cpp \
$$PWD_CUR/../../OOXML/Base/unicode_util.cpp
HEADERS += \
$$PWD_CUR/docbuilder_p.h \
$$PWD_CUR/nativecontrol.h \
$$PWD_CUR/graphics.h \
$$PWD_CUR/hash.h \
$$PWD_CUR/server.h
HEADERS += \
$$PWD_CUR/embed/PointerEmbed.h \
$$PWD_CUR/embed/ZipEmbed.h \
$$PWD_CUR/embed/GraphicsEmbed.h \
$$PWD_CUR/embed/MemoryStreamEmbed.h \
$$PWD_CUR/embed/NativeControlEmbed.h \
$$PWD_CUR/embed/NativeBuilderEmbed.h \
$$PWD_CUR/embed/NativeBuilderDocumentEmbed.h \
$$PWD_CUR/embed/TextMeasurerEmbed.h \
$$PWD_CUR/embed/HashEmbed.h \
$$PWD_CUR/embed/Default.h \
$$PWD_CUR/js_internal/js_base.h
SOURCES += \
$$PWD_CUR/embed/PointerEmbed.cpp \
$$PWD_CUR/embed/ZipEmbed.cpp \
$$PWD_CUR/embed/GraphicsEmbed.cpp \
$$PWD_CUR/embed/MemoryStreamEmbed.cpp \
$$PWD_CUR/embed/NativeControlEmbed.cpp \
$$PWD_CUR/embed/NativeBuilderEmbed.cpp \
$$PWD_CUR/embed/NativeBuilderDocumentEmbed.cpp \
$$PWD_CUR/embed/TextMeasurerEmbed.cpp \
$$PWD_CUR/embed/HashEmbed.cpp \
$$PWD_CUR/embed/Default.cpp
# Serialize objects to JS
HEADERS += \
$$PWD_CUR/json/json.h \
$$PWD_CUR/json/json_p.h \
$$PWD_CUR/json/json_values.h \
$$PWD_CUR/json/serialization.h
SOURCES += \
$$PWD_CUR/json/json.cpp \
$$PWD_CUR/json/json_values.cpp
include($$PWD_CUR/js_internal/js_base.pri)
!use_javascript_core {
build_xp:DESTDIR=$$DESTDIR/xp
}
use_javascript_core {
OBJECTIVE_SOURCES += $$PWD_CUR/../common/Mac/NSString+StringUtils.mm
}
# files for embedded classes
ADD_FILES_FOR_EMBEDDED_CLASS_HEADER($$PWD_CUR/embed/GraphicsEmbed.h)
ADD_FILES_FOR_EMBEDDED_CLASS_HEADER($$PWD_CUR/embed/HashEmbed.h)
ADD_FILES_FOR_EMBEDDED_CLASS_HEADER($$PWD_CUR/embed/MemoryStreamEmbed.h)
ADD_FILES_FOR_EMBEDDED_CLASS_HEADER($$PWD_CUR/embed/NativeBuilderEmbed.h)
ADD_FILES_FOR_EMBEDDED_CLASS_HEADER($$PWD_CUR/embed/NativeBuilderDocumentEmbed.h)
ADD_FILES_FOR_EMBEDDED_CLASS_HEADER($$PWD_CUR/embed/NativeControlEmbed.h)
ADD_FILES_FOR_EMBEDDED_CLASS_HEADER($$PWD_CUR/embed/PointerEmbed.h)
ADD_FILES_FOR_EMBEDDED_CLASS_HEADER($$PWD_CUR/embed/TextMeasurerEmbed.h)
ADD_FILES_FOR_EMBEDDED_CLASS_HEADER($$PWD_CUR/embed/ZipEmbed.h)
include($$PWD_CUR/../graphics/pro/textshaper.pri)
include($$PWD_CUR/../../Common/3dParty/openssl/openssl.pri)
# downloader
DEFINES += BUIDLER_OPEN_DOWNLOAD_ENABLED
DEFINES += BUIDLER_OPEN_BASE64_ENABLED
CONFIG += drawingfile_support
drawingfile_support {
DEFINES += WASM_SERIALIZER_USE_ALLOCATOR
ADD_DEPENDENCY(PdfFile, XpsFile, DjVuFile, DocxRenderer)
HEADERS += \
$$PWD_CUR/drawingfile.h \
$$PWD_CUR/embed/DrawingFileEmbed.h
SOURCES += \
$$PWD_CUR/../graphics/pro/js/wasm/src/HTMLRendererText.cpp \
$$PWD_CUR/embed/DrawingFileEmbed.cpp
ADD_FILES_FOR_EMBEDDED_CLASS_HEADER($$PWD_CUR/embed/DrawingFileEmbed.h)
}

View File

@ -1,128 +1,3 @@
QT -= core
QT -= gui
INCLUDEPATH += $$PWD/addon
VERSION = 1.0.0.3
TARGET = doctrenderer
TEMPLATE = lib
CONFIG += shared
CONFIG += plugin
CORE_ROOT_DIR = $$PWD/../..
PWD_ROOT_DIR = $$PWD
include(../../Common/base.pri)
DEFINES += DOCTRENDERER_USE_DYNAMIC_LIBRARY_BUILDING
DEFINES += JSBASE_USE_DYNAMIC_LIBRARY_BUILDING
ADD_DEPENDENCY(graphics, kernel, UnicodeConverter, kernel_network)
#CONFIG += build_xp
#CONFIG += v8_version_60
core_android:DEFINES += DISABLE_MEMORY_LIMITATION
HEADERS += \
config.h \
editors.h \
doctrenderer.h \
docbuilder.h
SOURCES += \
editors.cpp \
nativecontrol.cpp \
doctrenderer.cpp \
docbuilder.cpp \
docbuilder_p.cpp \
graphics.cpp \
hash.cpp
SOURCES += \
../../Common/OfficeFileFormatChecker2.cpp \
../../Common/3dParty/pole/pole.cpp \
../../OOXML/Base/unicode_util.cpp
HEADERS += \
docbuilder_p.h \
nativecontrol.h \
graphics.h \
hash.h \
server.h
HEADERS += \
embed/PointerEmbed.h \
embed/ZipEmbed.h \
embed/GraphicsEmbed.h \
embed/MemoryStreamEmbed.h \
embed/NativeControlEmbed.h \
embed/NativeBuilderEmbed.h \
embed/NativeBuilderDocumentEmbed.h \
embed/TextMeasurerEmbed.h \
embed/HashEmbed.h \
embed/Default.h \
js_internal/js_base.h
SOURCES += \
embed/PointerEmbed.cpp \
embed/ZipEmbed.cpp \
embed/GraphicsEmbed.cpp \
embed/MemoryStreamEmbed.cpp \
embed/NativeControlEmbed.cpp \
embed/NativeBuilderEmbed.cpp \
embed/NativeBuilderDocumentEmbed.cpp \
embed/TextMeasurerEmbed.cpp \
embed/HashEmbed.cpp \
embed/Default.cpp
# Serialize objects to JS
HEADERS += \
json/json.h \
json/json_p.h \
json/json_values.h \
json/serialization.h
SOURCES += \
json/json.cpp \
json/json_values.cpp
include($$PWD/js_internal/js_base.pri)
!use_javascript_core {
build_xp:DESTDIR=$$DESTDIR/xp
}
use_javascript_core {
OBJECTIVE_SOURCES += ../common/Mac/NSString+StringUtils.mm
}
# files for embedded classes
ADD_FILES_FOR_EMBEDDED_CLASS_HEADER(embed/GraphicsEmbed.h)
ADD_FILES_FOR_EMBEDDED_CLASS_HEADER(embed/HashEmbed.h)
ADD_FILES_FOR_EMBEDDED_CLASS_HEADER(embed/MemoryStreamEmbed.h)
ADD_FILES_FOR_EMBEDDED_CLASS_HEADER(embed/NativeBuilderEmbed.h)
ADD_FILES_FOR_EMBEDDED_CLASS_HEADER(embed/NativeBuilderDocumentEmbed.h)
ADD_FILES_FOR_EMBEDDED_CLASS_HEADER(embed/NativeControlEmbed.h)
ADD_FILES_FOR_EMBEDDED_CLASS_HEADER(embed/PointerEmbed.h)
ADD_FILES_FOR_EMBEDDED_CLASS_HEADER(embed/TextMeasurerEmbed.h)
ADD_FILES_FOR_EMBEDDED_CLASS_HEADER(embed/ZipEmbed.h)
include(../graphics/pro/textshaper.pri)
include(../../Common/3dParty/openssl/openssl.pri)
# downloader
DEFINES += BUIDLER_OPEN_DOWNLOAD_ENABLED
DEFINES += BUIDLER_OPEN_BASE64_ENABLED
CONFIG += drawingfile_support
drawingfile_support {
DEFINES += WASM_SERIALIZER_USE_ALLOCATOR
ADD_DEPENDENCY(PdfFile, XpsFile, DjVuFile, DocxRenderer)
HEADERS += \
drawingfile.h \
embed/DrawingFileEmbed.h
SOURCES += \
../graphics/pro/js/wasm/src/HTMLRendererText.cpp \
embed/DrawingFileEmbed.cpp
ADD_FILES_FOR_EMBEDDED_CLASS_HEADER(embed/DrawingFileEmbed.h)
}
include(doctrenderer.pri)

View File

@ -160,30 +160,16 @@ void CGraphicsEmbed::SetAppImage(CGraphicsAppImage* appImage)
JSSmart<CJSValue> CGraphicsEmbed::create(JSSmart<CJSValue> Native, JSSmart<CJSValue> width_px, JSSmart<CJSValue> height_px, JSSmart<CJSValue> width_mm, JSSmart<CJSValue> height_mm)
{
NSNativeControl::CNativeControl* pControl = NULL;
if (!Native->isNull())
{
JSSmart<CJSObject> pNativeObject = Native->toObject();
CJSEmbedObject* pNativeEmbedObject = pNativeObject->getNative();
pControl = (NSNativeControl::CNativeControl*)Native->toObject()->getNative()->getObject();
if (m_pInternal->m_pAppImage)
delete m_pInternal->m_pAppImage;
m_pInternal->m_pAppImage = new CGraphicsAppImage();
if (pNativeEmbedObject)
{
NSNativeControl::CNativeControl* pControl = (NSNativeControl::CNativeControl*)pNativeEmbedObject->getObject();
m_pInternal->m_pAppImage->SetFontsDirectory(pControl->m_strFontsDirectory);
m_pInternal->m_pAppImage->SetImagesDirectory(pControl->m_strImagesDirectory);
}
else
{
JSSmart<CJSValue> checkResources = pNativeObject->get("isResourcesObject");
if (checkResources->isBool() && true == checkResources->toBool())
{
m_pInternal->m_pAppImage->SetFontsDirectory(pNativeObject->get("fontsDirectory")->toStringW());
m_pInternal->m_pAppImage->SetImagesDirectory(pNativeObject->get("imagesDirectory")->toStringW());
}
}
m_pInternal->m_pAppImage->SetFontsDirectory(pControl->m_strFontsDirectory);
m_pInternal->m_pAppImage->SetImagesDirectory(pControl->m_strImagesDirectory);
}
m_pInternal->init(width_px->toDouble(), height_px->toDouble(), width_mm->toDouble(), height_mm->toDouble());

View File

@ -374,7 +374,7 @@ namespace NSJSBase
JSSmart<CJSContext> CJSContext::GetCurrent()
{
CJSContext* ret = new CJSContext(false);
CJSContext* ret = new CJSContext();
ret->m_internal->context = NSJSBase::CJSContextPrivate::GetCurrentContext();
return ret;
}

View File

@ -730,14 +730,14 @@ bool Location::IsTouching() noexcept
PointD pt;
bool straight = C.IsStraight() && Inters->C.IsStraight();
return !straight || !intersect(C.Segment1.P.X,
C.Segment1.P.Y,
C.Segment2.P.X,
C.Segment2.P.Y,
Inters->C.Segment1.P.X,
Inters->C.Segment1.P.Y,
Inters->C.Segment2.P.X,
Inters->C.Segment2.P.Y, pt);
return !straight || !intersect({C.Segment1.P.X,
C.Segment1.P.Y,
C.Segment2.P.X,
C.Segment2.P.Y,
Inters->C.Segment1.P.X,
Inters->C.Segment1.P.Y,
Inters->C.Segment2.P.X,
Inters->C.Segment2.P.Y}, pt);
}
CBooleanOperations::CBooleanOperations(const CGraphicsPath& path1,
@ -943,7 +943,7 @@ void CBooleanOperations::TraceAllOverlap()
{
int touchCount = 0;
for (const auto& c : OriginCurves2)
count1 += CheckInters(s, c, touchCount);
count1 += CheckInters(MIN_POINT, s, c, touchCount);
break;
}
}
@ -954,7 +954,7 @@ void CBooleanOperations::TraceAllOverlap()
{
int touchCount = 0;
for (const auto& c : OriginCurves1)
count2 += CheckInters(s, c, touchCount);
count2 += CheckInters(MIN_POINT, s, c, touchCount);
break;
}
}
@ -1255,26 +1255,20 @@ void CBooleanOperations::SetVisited(const Segment& segment)
std::vector<std::vector<int>> CBooleanOperations::FindBoundsCollisions()
{
int length1 = static_cast<int>(Curves1.size()),
length2 = static_cast<int>(Curves2.size());
std::vector<std::vector<double>> allBounds, bounds2;
allBounds.reserve(length1 + length2);
bounds2.reserve(length2);
for (const auto& c : Curves1)
allBounds.emplace_back(c.GetBound());
allBounds.push_back(c.GetBound());
for (const auto& c : Curves2)
bounds2.emplace_back(c.GetBound());
bounds2.push_back(c.GetBound());
bool self = allBounds == bounds2;
if (!self)
{
allBounds.resize(length1 + length2);
for (size_t i = 0; i < length2; i++)
allBounds[i + length1] = std::move(bounds2[i]);
}
for (auto it = bounds2.begin(); it != bounds2.end(); ++it)
allBounds.push_back(*it);
int allLength = static_cast<int>(allBounds.size());
int allLength = static_cast<int>(allBounds.size()),
length1 = static_cast<int>(Curves1.size());
std::vector<int> allIdicesByPri1(allLength);
for (int i = 0; i < allLength; i++)
@ -1508,8 +1502,8 @@ void CBooleanOperations::LinkIntersection(std::shared_ptr<Location> from,
void CBooleanOperations::AddLineIntersection(const Curve& curve1, const Curve& curve2)
{
PointD pt;
if (intersect(curve1.Segment1.P.X, curve1.Segment1.P.Y, curve1.Segment2.P.X, curve1.Segment2.P.Y,
curve2.Segment1.P.X, curve2.Segment1.P.Y, curve2.Segment2.P.X, curve2.Segment2.P.Y, pt))
if (intersect({curve1.Segment1.P.X, curve1.Segment1.P.Y, curve1.Segment2.P.X, curve1.Segment2.P.Y,
curve2.Segment1.P.X, curve2.Segment1.P.Y, curve2.Segment2.P.X, curve2.Segment2.P.Y}, pt))
AddLocation(curve1, curve2, curve1.GetTimeOf(pt), curve2.GetTimeOf(pt));
}
@ -1632,10 +1626,10 @@ int CBooleanOperations::AddCurveIntersection(const Curve& curve1, const Curve& c
return calls;
}
int CBooleanOperations::CheckInters(const Segment& segment, const Curve& curve, int& touchCount) const
int CBooleanOperations::CheckInters(const PointD& point, const Segment& segment, const Curve& curve, int& touchCount) const
{
PointD pt{};
if (intersect(MIN_POINT.X, MIN_POINT.Y, segment.P.X, segment.P.Y, curve.Segment1.P.X, curve.Segment1.P.Y, curve.Segment2.P.X, curve.Segment2.P.Y, pt))
if (intersect({point.X, point.Y, segment.P.X, segment.P.Y, curve.Segment1.P.X, curve.Segment1.P.Y, curve.Segment2.P.X, curve.Segment2.P.Y}, pt))
{
if (getDistance(segment.P, pt) <= GEOMETRIC_EPSILON) return (touchCount + 1) % 2;
if (getDistance(curve.Segment1.P, pt) <= GEOMETRIC_EPSILON || getDistance(curve.Segment2.P, pt) <= GEOMETRIC_EPSILON)
@ -1648,8 +1642,8 @@ int CBooleanOperations::CheckInters(const Segment& segment, const Curve& curve,
}
if (!curve.IsStraight())
{
std::vector<double> roots = curve.GetCurveLineIntersection(segment.P.X,segment.P.Y, MIN_POINT.X - segment.P.X, MIN_POINT.Y - segment.P.Y);
Curve line(segment, Segment(MIN_POINT));
std::vector<double> roots = curve.GetCurveLineIntersection(segment.P.X,segment.P.Y, point.X - segment.P.X, point.Y - segment.P.Y);
Curve line(segment, Segment(point));
int count = 0;
for (const auto& r : roots)
@ -1678,7 +1672,7 @@ void CBooleanOperations::SetWinding()
int count = 0,
touchCount = 0;
for (const auto& c : OriginCurves2)
count += CheckInters(s1, c, touchCount);
count += CheckInters(MIN_POINT, s1, c, touchCount);
for (auto& s : Segments1)
s.Winding = count % 2;
@ -1686,7 +1680,7 @@ void CBooleanOperations::SetWinding()
count = 0;
touchCount = 0;
for (const auto& c : OriginCurves1)
count += CheckInters(s2, c, touchCount);
count += CheckInters(MIN_POINT, s2, c, touchCount);
for (auto& s : Segments2)
s.Winding = count % 2;
@ -1704,7 +1698,7 @@ void CBooleanOperations::SetWinding()
int count = 0,
touchCount = 0;
for (const auto& c : (s.Id == 1 ? OriginCurves2 : OriginCurves1))
count += CheckInters(s, c, touchCount);
count += CheckInters(MIN_POINT, s, c, touchCount);
do
{

View File

@ -140,7 +140,7 @@ namespace Aggplus
void AddCurveLineIntersection(const Curve& curve1, const Curve& curve2, bool flip);
int AddCurveIntersection(const Curve& curve1, const Curve& curve2, const Curve& startCurve1, const Curve& startCurve2, bool flip,
int recursion = 0, int calls = 0, double tMin = 0.0, double tMax = 1.0, double uMin = 0.0, double uMax = 1.0);
int CheckInters(const Segment& segment, const Curve& curve, int& touchCount) const;
int CheckInters(const PointD& point, const Segment& segment, const Curve& curve, int& touchCount) const;
void SetWinding();
// Location

View File

@ -837,13 +837,12 @@ namespace Aggplus
{
std::vector<PointD> points;
unsigned length = m_internal->m_agg_ps.total_vertices();
points.resize(count);
for (unsigned i = 0; i < count; i++)
{
double x,y;
if (idx + i > length) break;
this->m_internal->m_agg_ps.vertex(idx + i, &x, &y);
points[i] = PointD(x, y);
points.push_back(PointD(x, y));
}
return points;
@ -886,37 +885,37 @@ namespace Aggplus
{
std::vector<CGraphicsPath> result;
CGraphicsPath subPath;
bool close = true;
CGraphicsPath sub_path;
for (unsigned i = 0; i < m_internal->m_agg_ps.total_vertices(); i++)
{
if (IsMovePoint(i))
{
if (!close)
{
PointD firstPoint = sub_path.GetPoints(0, 1)[0];
PointD firstPoint = subPath.GetPoints(0, 1)[0];
double x, y;
sub_path.GetLastPoint(x, y);
subPath.GetLastPoint(x, y);
if ((abs(firstPoint.X - x) <= 1e-2 && abs(firstPoint.Y - y) <= 1e-2) ||
sub_path.GetPointCount() == 1)
subPath.GetPointCount() == 1)
{
if (!firstPoint.Equals(PointD(x, y)) || sub_path.GetPointCount() == 1)
sub_path.LineTo(firstPoint.X, firstPoint.Y);
sub_path.CloseFigure();
if (!firstPoint.Equals(PointD(x, y)) || subPath.GetPointCount() == 1)
subPath.LineTo(firstPoint.X, firstPoint.Y);
subPath.CloseFigure();
}
result.push_back(sub_path);
sub_path.Reset();
result.push_back(subPath);
subPath.Reset();
}
sub_path.StartFigure();
subPath.StartFigure();
PointD point = GetPoints(i, 1)[0];
sub_path.MoveTo(point.X, point.Y);
subPath.MoveTo(point.X, point.Y);
close = false;
}
else if (IsCurvePoint(i))
{
std::vector<PointD> points = GetPoints(i, 3);
sub_path.CurveTo(points[0].X, points[0].Y,
subPath.CurveTo(points[0].X, points[0].Y,
points[1].X, points[1].Y,
points[2].X, points[2].Y);
i += 2;
@ -924,40 +923,40 @@ namespace Aggplus
else if (IsLinePoint(i))
{
PointD point = GetPoints(i, 1)[0];
sub_path.LineTo(point.X, point.Y);
subPath.LineTo(point.X, point.Y);
}
else if (IsClosePoint(i))
{
PointD firstPoint = sub_path.GetPoints(0, 1)[0];
PointD firstPoint = subPath.GetPoints(0, 1)[0];
double x, y;
sub_path.GetLastPoint(x, y);
subPath.GetLastPoint(x, y);
if (!firstPoint.Equals(PointD(x, y)) || sub_path.GetPointCount() == 1)
sub_path.LineTo(firstPoint.X, firstPoint.Y);
if (!firstPoint.Equals(PointD(x, y)) || subPath.GetPointCount() == 1)
subPath.LineTo(firstPoint.X, firstPoint.Y);
sub_path.CloseFigure();
result.push_back(sub_path);
sub_path.Reset();
subPath.CloseFigure();
result.push_back(subPath);
subPath.Reset();
close = true;
}
}
if (!close)
{
PointD firstPoint = sub_path.GetPoints(0, 1)[0];
PointD firstPoint = subPath.GetPoints(0, 1)[0];
double x, y;
sub_path.GetLastPoint(x, y);
subPath.GetLastPoint(x, y);
if ((abs(firstPoint.X - x) <= 1e-2 && abs(firstPoint.Y - y) <= 1e-2) ||
sub_path.GetPointCount() == 1)
subPath.GetPointCount() == 1)
{
if (!firstPoint.Equals(PointD(x, y)) ||
sub_path.GetPointCount() == 1)
sub_path.LineTo(firstPoint.X, firstPoint.Y);
sub_path.CloseFigure();
subPath.GetPointCount() == 1)
subPath.LineTo(firstPoint.X, firstPoint.Y);
subPath.CloseFigure();
}
result.push_back(sub_path);
result.push_back(subPath);
}
return result;

View File

@ -151,28 +151,27 @@ inline double integrate(const double& ax, const double& bx, const double& cx, co
return A * sum;
}
inline bool intersect(double v0, double v1, double v2, double v3, double v4,
double v5, double v6, double v7, Aggplus::PointD& res)
inline bool intersect(std::vector<double> v, Aggplus::PointD& res)
{
v2 -= v0;
v3 -= v1;
v6 -= v4;
v7 -= v5;
v[2] -= v[0];
v[3] -= v[1];
v[6] -= v[4];
v[7] -= v[5];
double cross = v2 * v7 - v3 * v6;
double cross = v[2] * v[7] - v[3] * v[6];
if (!isMachineZero(cross))
{
double dx = v0 - v4,
dy = v1 - v5,
u1 = (v6 * dy - v7 * dx) / cross,
u2 = (v2 * dy - v3 * dx) / cross,
double dx = v[0] - v[4],
dy = v[1] - v[5],
u1 = (v[6] * dy - v[7] * dx) / cross,
u2 = (v[2] * dy - v[3] * dx) / cross,
uMin = -EPSILON,
uMax = 1 + EPSILON;
if (uMin < u1 && u1 < uMax && uMin < u2 && u2 < uMax)
{
u1 = u1 <= 0 ? 0 : u1 >= 1 ? 1 : u1;
res = Aggplus::PointD(v0 + u1 * v2, v1 + u1 * v3);
res = Aggplus::PointD(v[0] + u1 * v[2], v[1] + u1 * v[3]);
return true;
}

View File

@ -9720,6 +9720,16 @@ int Binary_DocumentTableReader::ReadSdtPr(BYTE type, long length, void* poResult
pSdtPr->m_oComplexFormPr.Init();
READ1_DEF(length, res, this->ReadSdtComplexFormPr, pSdtPr->m_oComplexFormPr.GetPointer());
}
else if (c_oSerSdt::Border == type)
{
pSdtPr->m_oBorder.Init();
READ2_DEF(length, res, oBinary_pPrReader.ReadBorder, pSdtPr->m_oBorder.GetPointer());
}
else if (c_oSerSdt::Shd == type)
{
pSdtPr->m_oShd.Init();
READ2_DEF(length, res, oBinary_CommonReader2.ReadShdComplexType, pSdtPr->m_oShd.GetPointer());
}
else
res = c_oSerConstants::ReadUnknown;
return res;

View File

@ -1305,7 +1305,9 @@ extern int g_nCurFormatVersion;
StoreItemChecksum = 85,
ComplexFormPr = 90,
ComplexFormPrType = 91,
OformMaster = 92
OformMaster = 92,
Border = 93,
Shd = 94
};}
namespace c_oSerFFData{enum c_oSerFFData
{

View File

@ -8075,6 +8075,18 @@ void BinaryDocumentTableWriter::WriteSdtPr(const OOX::Logic::CSdtPr& oStdPr)
WriteSdtComplexFormPr(oStdPr.m_oComplexFormPr.get());
m_oBcw.WriteItemEnd(nCurPos);
}
if (oStdPr.m_oBorder.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::Border);
m_oBcw.WriteBorder(oStdPr.m_oBorder.get());
m_oBcw.WriteItemEnd(nCurPos);
}
if (oStdPr.m_oShd.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::Shd);
m_oBcw.WriteShd(oStdPr.m_oShd.get());
m_oBcw.WriteItemEnd(nCurPos);
}
}
void BinaryDocumentTableWriter::WriteSdtPicture(const OOX::Logic::CSdtPicture& oSdtPicture)
{

View File

@ -1318,6 +1318,10 @@ namespace OOX
}
if (oNode.GetNode(L"w15:color", oChild))
m_oColor = oChild;
if (oNode.GetNode(L"w:border", oChild))
m_oBorder = oChild;
if (oNode.GetNode(L"w:shd", oChild))
m_oShd = oChild;
if (oNode.GetNode(L"w:dataBinding", oChild))
m_oDataBinding = oChild;
@ -1434,6 +1438,10 @@ namespace OOX
}
else if (L"color" == sName)
m_oColor = oReader;
else if (L"border" == sName)
m_oBorder = oReader;
else if (L"shd" == sName)
m_oShd = oReader;
else if (L"dataBinding" == sName)
m_oDataBinding = oReader;
else if (sdttypeUnknown == m_eType && L"date" == sName)
@ -1627,6 +1635,8 @@ namespace OOX
WritingElement_WriteNode_2(m_oFormPr);
WritingElement_WriteNode_2(m_oTextFormPr);
WritingElement_WriteNode_2(m_oComplexFormPr);
WritingElement_WriteNode_1(L"<w:border ", m_oBorder);
WritingElement_WriteNode_1(L"<w:shd ", m_oShd);
return sResult;
}

View File

@ -583,6 +583,8 @@ namespace OOX
nullable<CTextFormPr> m_oTextFormPr; //Not from specification
nullable<CSdtPicture> m_oPicture; //Not from specification
nullable<CComplexFormPr> m_oComplexFormPr; // Not from specification
nullable<ComplexTypes::Word::CBorder> m_oBorder; // Not from specification
nullable<ComplexTypes::Word::CShading> m_oShd; // Not from specification
};
//--------------------------------------------------------------------------------

View File

@ -230,14 +230,12 @@ namespace OOX
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader);
public:
// Attributes
nullable<std::wstring > m_sAuthor;
nullable<SimpleTypes::CDateTime > m_oDate;
nullable<SimpleTypes::CDecimalNumber > m_oId;
nullable<std::wstring > m_sUserId;
nullable<std::wstring> m_sAuthor;
nullable<SimpleTypes::CDateTime> m_oDate;
nullable<SimpleTypes::CDecimalNumber> m_oId;
nullable<std::wstring> m_sUserId;
// Childs
nullable<CTblPrEx > m_pTblPrEx;
nullable<CTblPrEx> m_pTblPrEx;
};
//--------------------------------------------------------------------------------
@ -275,7 +273,7 @@ namespace OOX
fromXML( (XmlUtils::CXmlLiteReader&)oReader );
return *this;
}
virtual void fromXML(XmlUtils::CXmlNode& oNode)
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
XmlUtils::CXmlNode oChild;
@ -293,7 +291,7 @@ namespace OOX
WritingElement_ReadNode( oNode, oChild, L"w:tblW", m_oTblW );
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
if ( oReader.IsEmptyNode() )
return;
@ -315,23 +313,23 @@ namespace OOX
else if ( L"w:tblW" == sName ) m_oTblW = oReader;
}
}
virtual std::wstring toXML() const
virtual std::wstring toXML() const
{
std::wstring sResult = L"<w:tblPrEx>";
WritingElement_WriteNode_1( L"<w:jc ", m_oJc );
WritingElement_WriteNode_1( L"<w:shd ", m_oShd );
WritingElement_WriteNode_1( L"<w:jc ", m_oJc );
WritingElement_WriteNode_1( L"<w:shd ", m_oShd );
WritingElement_WriteNode_2( m_oTblBorders );
WritingElement_WriteNode_2( m_oTblCellMar );
WritingElement_WriteNode_1( L"<w:tblCellSpacing ", m_oTblCellSpacing );
WritingElement_WriteNode_1( L"<w:tblInd ", m_oTblInd );
WritingElement_WriteNode_1( L"<w:tblLayout ", m_oTblLayout );
WritingElement_WriteNode_1( L"<w:tblLook ", m_oTblLook );
WritingElement_WriteNode_1( L"<w:tblInd ", m_oTblInd );
WritingElement_WriteNode_1( L"<w:tblLayout ", m_oTblLayout );
WritingElement_WriteNode_1( L"<w:tblLook ", m_oTblLook );
if ( !m_bTblPrExChange && m_oTblPrExChange.IsInit() )
sResult += m_oTblPrExChange->toXML();
WritingElement_WriteNode_1( L"<w:tblW ", m_oTblW );
WritingElement_WriteNode_1( L"<w:tblW ", m_oTblW );
sResult += L"</w:tblPrEx>";
@ -342,20 +340,18 @@ namespace OOX
return et_w_tblPrEx;
}
bool m_bTblPrExChange;
bool m_bTblPrExChange;
// Childs
nullable<ComplexTypes::Word::CJcTable > m_oJc;
nullable<ComplexTypes::Word::CShading > m_oShd;
nullable<OOX::Logic::CTblBorders > m_oTblBorders;
nullable<OOX::Logic::CTblCellMar > m_oTblCellMar;
nullable<ComplexTypes::Word::CTblWidth > m_oTblCellSpacing;
nullable<ComplexTypes::Word::CTblWidth > m_oTblInd;
nullable<ComplexTypes::Word::CTblLayoutType > m_oTblLayout;
nullable<ComplexTypes::Word::CTblLook > m_oTblLook;
nullable<OOX::Logic::CTblPrExChange > m_oTblPrExChange;
nullable<ComplexTypes::Word::CTblWidth > m_oTblW;
nullable<ComplexTypes::Word::CJcTable> m_oJc;
nullable<ComplexTypes::Word::CShading> m_oShd;
nullable<OOX::Logic::CTblBorders> m_oTblBorders;
nullable<OOX::Logic::CTblCellMar> m_oTblCellMar;
nullable<ComplexTypes::Word::CTblWidth> m_oTblCellSpacing;
nullable<ComplexTypes::Word::CTblWidth> m_oTblInd;
nullable<ComplexTypes::Word::CTblLayoutType> m_oTblLayout;
nullable<ComplexTypes::Word::CTblLook> m_oTblLook;
nullable<OOX::Logic::CTblPrExChange> m_oTblPrExChange;
nullable<ComplexTypes::Word::CTblWidth> m_oTblW;
};
//--------------------------------------------------------------------------------
@ -379,10 +375,10 @@ namespace OOX
void CreateElements(XmlUtils::CXmlLiteReader &oReader, int Depth);
int m_nCountRow;
int m_nCountRow;
nullable<OOX::Logic::CTblGrid> m_oTblGrid;
OOX::Logic::CTableProperty* m_oTableProperties; //todooo - выкинуть из m_arrItems, переделать на nullable<>
nullable<OOX::Logic::CTblGrid> m_oTblGrid;
OOX::Logic::CTableProperty* m_oTableProperties; //todooo - выкинуть из m_arrItems, переделать на nullable<>
};
//--------------------------------------------------------------------------------
@ -409,15 +405,14 @@ namespace OOX
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader);
public:
int m_nCountCell;
int m_nCountCell;
nullable<SimpleTypes::CLongHexNumber> m_oRsidDel;
nullable<SimpleTypes::CLongHexNumber> m_oRsidR;
nullable<SimpleTypes::CLongHexNumber> m_oRsidRPr;
nullable<SimpleTypes::CLongHexNumber> m_oRsidTr;
// Childs
OOX::Logic::CTableRowProperties* m_pTableRowProperties; //todooo - выкинуть из m_arrItems, переделать на nullable<>
OOX::Logic::CTableRowProperties* m_pTableRowProperties; //todooo - выкинуть из m_arrItems, переделать на nullable<>
};
//--------------------------------------------------------------------------------
@ -444,9 +439,9 @@ namespace OOX
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader);
public:
int m_nNumCol; // Номер колонки
nullable<std::wstring > m_sId;
OOX::Logic::CTableCellProperties* m_pTableCellProperties; //todooo - выкинуть из m_arrItems, переделать на nullable<>
int m_nNumCol; // Номер колонки
nullable<std::wstring> m_sId;
OOX::Logic::CTableCellProperties* m_pTableCellProperties; //todooo - выкинуть из m_arrItems, переделать на nullable<>
};
} // namespace Logic

View File

@ -795,6 +795,11 @@ namespace StarMath
stTempPr->m_enStyle = SimpleTypes::EStyle::styleItalic;
bRpr = true;
}
else if(pRPr->m_oU.GetPointer() != nullptr && pRPr->m_oU->m_oVal.GetPointer() != nullptr)
{
stTempPr->m_enUnderLine = pRPr->m_oU->m_oVal->GetValue();
bRpr = true;
}
if(bRpr == true)
return stTempPr;
else
@ -1417,8 +1422,13 @@ namespace StarMath
void COOXml2Odf::StyleClosing(const StStyleMenClose &stStyle, XmlUtils::CXmlWriter *pXmlWrite)
{
if(stStyle.m_bMenClose)
{
pXmlWrite->WriteNodeEnd(L"menclose",false,false);
if(stStyle.m_bUnderlineClose)
{
pXmlWrite->WriteNodeBegin(L"mo",false);
pXmlWrite->WriteString(L"\u0332");
pXmlWrite->WriteNodeEnd(L"mo",false,false);
pXmlWrite->WriteNodeEnd(L"munder",false,false);
}
if(stStyle.m_iStyle != 0)
{
@ -1733,6 +1743,14 @@ namespace StarMath
wsAnnotation += L"overstrike ";
stStyle.m_bMenClose = true;
}
if(pAttribute->m_enUnderLine == SimpleTypes::EUnderline::underlineSingle)
{
pXmlWrite->WriteNodeBegin(L"munder",true);
pXmlWrite->WriteAttribute(L"accentunder",L"true");
pXmlWrite->WriteNodeEnd(L"w",true,false);
wsAnnotation += L"underline ";
stStyle.m_bUnderlineClose = true;
}
if(!bDelimiter)
pAttribute->Release();
}

View File

@ -18,7 +18,7 @@ namespace StarMath
{
struct StValuePr
{
StValuePr():m_wsTypeName(L""),m_wsBegBracket(L""),m_wsEndBracket(L""),m_wsChr(L""),m_wsColor(L""),m_bSupHide(false),m_bSubHide(false),m_enStyle(SimpleTypes::EStyle::stylePlain),m_iSize(0),m_enPos(SimpleTypes::ETopBot::tbBot),m_enVert(SimpleTypes::ETopBot::tbBot),m_enFont(StarMath::TypeFont::empty),m_iCount(0),m_bStrike(false)
StValuePr():m_wsTypeName(L""),m_wsChr(L""),m_wsBegBracket(L""),m_wsEndBracket(L""),m_wsColor(L""),m_bSupHide(false),m_bSubHide(false),m_enStyle(SimpleTypes::EStyle::stylePlain),m_iSize(0),m_enPos(SimpleTypes::ETopBot::tbBot),m_enVert(SimpleTypes::ETopBot::tbBot),m_enFont(StarMath::TypeFont::empty),m_iCount(0),m_bStrike(false),m_enUnderLine(SimpleTypes::EUnderline::underlineNone)
{
AddRef();
}
@ -32,6 +32,7 @@ namespace StarMath
StarMath::TypeFont m_enFont;
int m_iCount;
bool m_bStrike;
SimpleTypes::EUnderline m_enUnderLine;
void AddRef()
{
m_iCount++;
@ -45,10 +46,11 @@ namespace StarMath
};
struct StStyleMenClose
{
StStyleMenClose():m_iStyle(0),m_bMenClose(false)
StStyleMenClose():m_iStyle(0),m_bMenClose(false),m_bUnderlineClose(false)
{}
unsigned int m_iStyle;
bool m_bMenClose;
bool m_bUnderlineClose;
};
class COneElement;
class COOXml2Odf

View File

@ -916,7 +916,11 @@ void OoxConverter::convert(PPTX::Logic::Shape *oox_shape)
odf_context()->start_text_context();
//docx_converter->convert(oox_shape->oTextBoxShape.GetPointer());
convert(oox_shape->oTextBoxBodyPr.GetPointer());
if (oox_shape->style.IsInit())
convert(&oox_shape->style->fontRef);
for (size_t i = 0; i < oox_shape->oTextBoxShape->m_arrItems.size(); i++)
{
docx_converter->convert(oox_shape->oTextBoxShape->m_arrItems[i]);

View File

@ -484,6 +484,8 @@ public:
bool encrypt_document (const std::wstring &password, const std::wstring & srcPath, const std::wstring & dstPath);
bool encrypt_file (const std::wstring &password, const std::wstring & srcPath, const std::wstring & dstPath, std::wstring &encrypt_info, int &size);
std::vector<double> current_font_size;
//.......................................................................................................................
virtual OOX::IFileContainer *current_document() = 0;

View File

@ -87,8 +87,6 @@
using namespace cpdoccore;
std::vector<double> current_font_size;
namespace Oox2Odf
{

View File

@ -44,6 +44,7 @@
#include "../Format/math_layout_elements.h"
#include "../Format/math_limit_elements.h"
#include "../Format/math_token_elements.h"
#include "../Format/style_text_properties.h"
#include <set>
#include <vector>
@ -173,7 +174,20 @@ namespace Oox2Odf
brackets().resize(1);
bool bStart = odf_context()->start_math();
int base_font_size = current_font_size.empty() ? 12 : current_font_size.back();
std::wstring base_font_color;
if (odf_context()->is_child_text_context())
{
if (odf_context()->drawing_context()->get_text_properties())
{
if (odf_context()->drawing_context()->get_text_properties()->fo_color_)
{
base_font_color = odf_context()->drawing_context()->get_text_properties()->fo_color_->get_hex_value();
}
}
}
bool bStart = odf_context()->start_math(base_font_size, base_font_color);
for (size_t i = 0; i < oox_math->m_arrItems.size(); ++i)
{
@ -236,7 +250,21 @@ namespace Oox2Odf
{
if (!oox_math_para) return;
bool bStart = odf_context()->start_math();
int base_font_size = current_font_size.empty() ? 12 : current_font_size.back();
std::wstring base_font_color;
if (odf_context()->is_child_text_context())
{
if (odf_context()->drawing_context()->get_text_properties())
{
if (odf_context()->drawing_context()->get_text_properties()->fo_color_)
{
base_font_color = odf_context()->drawing_context()->get_text_properties()->fo_color_->get_hex_value();
}
}
}
bool bStart = odf_context()->start_math(base_font_size, base_font_color);
for (size_t i = 0; i < oox_math_para->m_arrItems.size(); ++i)
{
@ -1260,16 +1288,18 @@ namespace Oox2Odf
odf_context()->settings_context()->start_view();
if (oox_r_pr->m_oSz.IsInit() && oox_r_pr->m_oSz->m_oVal.IsInit())
{
odf_context()->math_context()->size = oox_r_pr->m_oSz->m_oVal->GetValue();
odf_context()->math_context()->font_size = oox_r_pr->m_oSz->m_oVal->GetValue();
}
else
odf_context()->settings_context()->add_config_content_item(L"BaseFontHeight", L"short", std::to_wstring((int)odf_context()->math_context()->font_size));
if (!odf_context()->math_context()->font_color.empty())
{
odf_context()->math_context()->size = 12;
odf_context()->settings_context()->add_config_content_item(L"BaseFontColor", L"string", L"#" + odf_context()->math_context()->font_color);
}
odf_context()->settings_context()->add_config_content_item(L"BaseFontHeight", L"short", std::to_wstring(odf_context()->math_context()->size));
if (oox_r_pr->m_oRFonts.IsInit() && oox_r_pr->m_oRFonts->m_sAscii.IsInit())
{
odf_context()->math_context()->font = *oox_r_pr->m_oRFonts->m_sAscii;
odf_context()->math_context()->font_name = *oox_r_pr->m_oRFonts->m_sAscii;
odf_context()->settings_context()->add_config_content_item(L"FontNameFunctions", L"string", *oox_r_pr->m_oRFonts->m_sAscii);
odf_context()->settings_context()->add_config_content_item(L"FontNameNumbers", L"string", *oox_r_pr->m_oRFonts->m_sAscii);

View File

@ -383,7 +383,7 @@ void odf_conversion_context::end_drawing_context()
drawing_context_.pop_back();
}
bool odf_conversion_context::start_math()
bool odf_conversion_context::start_math(int base_font_size, const std::wstring& base_font_color)
{
if (false == math_context_.isEmpty()) return false;
@ -401,6 +401,8 @@ bool odf_conversion_context::start_math()
math_context_.set_styles_context(odf_conversion_context::styles_context());
math_context_.start_math(get_current_object_element());
math_context_.font_size = base_font_size;
math_context_.font_color = base_font_color;
return true;
}
void odf_conversion_context::end_math()
@ -409,7 +411,7 @@ void odf_conversion_context::end_math()
end_object();
calculate_font_metrix(math_context_.font, math_context_.size, false, false, true); // смотреть по формуле - перевычислять только если есть изменения это шрифт и кегль
calculate_font_metrix(math_context_.font_name, math_context_.font_size, false, false, true); // смотреть по формуле - перевычислять только если есть изменения это шрифт и кегль
double h = math_context_.lvl_max - math_context_.lvl_min;
if (math_context_.lvl_min < 0) h += 1;

View File

@ -121,6 +121,8 @@ public:
virtual odf_text_context * text_context() = 0;
virtual odf_controls_context * controls_context() = 0;
virtual bool is_child_text_context() = 0;
std::wstring add_image (const std::wstring & image_file_name, bool bExternal = false);
std::wstring add_media (const std::wstring & file_name, bool bExternal = false);
std::wstring add_oleobject (const std::wstring & ole_file_name, bool bExternal = false);
@ -144,7 +146,7 @@ public:
void start_chart();
void end_chart();
virtual bool start_math();
virtual bool start_math(int base_font_size, const std::wstring & base_font_color);
virtual void end_math();
void start_spreadsheet();

View File

@ -2652,10 +2652,14 @@ graphic_format_properties* odf_drawing_context::get_graphic_properties()
{
return impl_->current_graphic_properties;
}
text_format_properties* odf_drawing_context::get_text_properties()
{
return impl_->current_text_properties;
}
void odf_drawing_context::set_textarea_vertical_align(int align)
{
if (!impl_->current_graphic_properties)return;
if (!impl_->current_graphic_properties) return;
switch(align)
{
case 0://SimpleTypes::textanchoringtypeB:

View File

@ -156,6 +156,7 @@ public:
bool placeholder_replacing();
graphic_format_properties* get_graphic_properties();
text_format_properties* get_text_properties();
void set_graphic_properties (style_graphic_properties *graphic_properties);
void set_graphic_properties (graphic_format_properties* graphic_properties);

View File

@ -124,8 +124,11 @@ namespace cpdoccore {
double lvl_down_counter = 0;
double lvl_max = 0;
double lvl_min = 0;
std::wstring font;
double size = 0;
std::wstring font_name;
double font_size = 0;
std::wstring font_color;
std::set<wchar_t> mo;
std::map<std::wstring, std::wstring> diak_symbols;

View File

@ -58,6 +58,11 @@ odp_conversion_context::odp_conversion_context(package::odf_document * outputDoc
: odf_conversion_context (PresentationDocument, outputDocument), root_presentation_(NULL), slide_context_(*this), rId_(1)
{
}
bool odp_conversion_context::is_child_text_context()
{
return (false == text_context_.empty());
}
odf_text_context* odp_conversion_context::text_context()
{
if (false == text_context_.empty())

View File

@ -73,6 +73,7 @@ public:
odp_page_state & current_slide() { return slide_context_.state();}
/////////////////////////////////////////////////////
virtual bool is_child_text_context();
virtual odf_drawing_context * drawing_context();
virtual odf_controls_context * controls_context();

View File

@ -693,6 +693,10 @@ odf_text_context* ods_conversion_context::text_context()
return NULL;
}
}
bool ods_conversion_context::is_child_text_context()
{
return (false == text_context_.empty());
}
void ods_conversion_context::add_text(const std::wstring &text)
{
office_element_ptr paragr_elm;

View File

@ -101,6 +101,7 @@ public:
//-----------------------------------------------------------------------
ods_table_state_ptr & current_table() { return table_context_.state();}
//-----------------------------------------------------------------------
virtual bool is_child_text_context();
virtual odf_drawing_context * drawing_context();
virtual odf_text_context * text_context();

View File

@ -210,16 +210,19 @@ odf_notes_context* odt_conversion_context::notes_context()
odf_text_context* odt_conversion_context::text_context()
{
if (text_context_.size() > 0)
{
return text_context_.back().get();
}
else
if (text_context_.empty())
{
return main_text_context_;
}
else
{
return text_context_.back().get();
}
}
bool odt_conversion_context::is_child_text_context()
{
return (false == text_context_.empty());
}
void odt_conversion_context::add_text_content(const std::wstring & text)
{
if (drop_cap_state_.enabled)
@ -260,12 +263,12 @@ void odt_conversion_context::start_drawing_context()
drawing_context()->set_footer_state(is_footer_);
drawing_context()->set_header_state(is_header_);
}
bool odt_conversion_context::start_math()
bool odt_conversion_context::start_math(int base_font_size, const std::wstring& base_font_color)
{
if (false == math_context()->isEmpty()) return false;
start_drawing_context();
return odf_conversion_context::start_math();
return odf_conversion_context::start_math(base_font_size, base_font_color);
}
void odt_conversion_context::end_math()
{

View File

@ -65,6 +65,8 @@ public:
virtual void start_document();
virtual void end_document();
virtual bool is_child_text_context();
virtual odf_drawing_context * drawing_context();
virtual odf_text_context * text_context();
virtual odf_controls_context * controls_context();
@ -79,7 +81,7 @@ public:
virtual void start_drawing_context();
virtual void end_drawing_context();
virtual bool start_math();
virtual bool start_math(int base_font_size, const std::wstring& base_font_color);
virtual void end_math();
void add_text_content (const std::wstring & text);