Compare commits

..

36 Commits

Author SHA1 Message Date
bd0b0e7830 Fixed bug #38896 2021-06-22 13:01:05 +03:00
be7b3c1bbc Merge pull request #644 from ONLYOFFICE/fix/v6.4.0-fix-bugs
fix bug #50881
2021-06-18 17:03:13 +03:00
5a6d6c9057 fix bug #50881 2021-06-18 17:01:34 +03:00
e4896d7893 Update standardtester.pro 2021-06-18 10:58:57 +03:00
fac71f7b4a Fix merge from hotfix 2021-06-17 22:31:34 +03:00
942d39598e Merge pull request #643 from ONLYOFFICE/fix/v6.4.0-fix-bugs
fix bug #50842
2021-06-17 14:43:35 +03:00
be6ade46dd fix bug #50842 2021-06-17 14:42:27 +03:00
047de070cb Merge pull request #642 from ONLYOFFICE/fix/v6.4.0-fix-bugs
fix bug #50880
2021-06-17 12:25:33 +03:00
4b2439b7d8 fix bug #50880 2021-06-17 12:24:19 +03:00
f687d21149 Merge pull request #641 from ONLYOFFICE/fix/v6.4.0-fix-bugs
Fix/v6.4.0 fix bugs
2021-06-16 15:52:09 +03:00
b416c5e85a fix bug #50827 2021-06-16 15:50:34 +03:00
7a92cca760 fix bug #46986 2021-06-16 15:49:54 +03:00
c71b649621 Merge pull request #640 from ONLYOFFICE/android_kts
[android] build.gradle to kts
2021-06-16 13:59:34 +03:00
1f18cd62a5 [android] build.gradle to kts 2021-06-16 13:25:42 +03:00
a3fb1eccd1 Merge remote-tracking branch 'origin/hotfix/v6.3.1' into release/v6.4.0 2021-06-16 11:05:22 +03:00
3472edc763 Fix build on linux/macos (#636) 2021-06-09 09:45:16 +03:00
686be7c5f0 Aes gcm mode (#634) 2021-06-08 11:32:54 +03:00
a977cfd2b9 Merge pull request #633 from ONLYOFFICE/fix/bug50706
Fix bug 50706
2021-06-03 11:39:36 +03:00
09c2d38b5c Fix bug 50706 2021-06-03 11:35:54 +03:00
2d97939946 Merge pull request #632 from ONLYOFFICE/fix/build
Fix build
2021-06-01 16:50:24 +03:00
9114aa1f90 Fix build 2021-06-01 16:49:12 +03:00
79a9292fe8 Merge pull request #631 from ONLYOFFICE/fix/build
Fix build
2021-06-01 14:44:39 +03:00
ed98692fa8 Fix build 2021-06-01 14:43:48 +03:00
4b8c111981 Merge pull request #630 from ONLYOFFICE/fix/build
Fix build
2021-06-01 12:14:39 +03:00
073d7b4d8b Fix build 2021-06-01 12:12:47 +03:00
c7c15ea254 Merge pull request #629 from ONLYOFFICE/fix/build
Fix build
2021-06-01 11:36:58 +03:00
4de3ced875 Fix build 2021-06-01 11:35:27 +03:00
2ddc8e68d3 Merge pull request #628 from ONLYOFFICE/fix/desktop6.3.0
Fix/desktop6.3.0
2021-05-31 18:11:20 +03:00
7840995442 Merge pull request #625 from ONLYOFFICE/fix/bug50608
Fix bug 50608
2021-05-28 21:17:25 +03:00
76925c03e0 Fix bug 50608 2021-05-28 21:16:26 +03:00
87e66482f2 Merge pull request #624 from ONLYOFFICE/fix/standartTesterSpreadsheets
Add all sheets to generations
2021-05-28 11:56:57 +03:00
9f6e34b975 Add all sheets to generations 2021-05-28 11:55:38 +03:00
5d2ed89d4f Merge pull request #619 from ONLYOFFICE/fix/buildAndroidOnMac
Fix android build on macOS
2021-05-24 14:36:09 +03:00
595a95be24 Fix android build on macOS 2021-05-24 14:38:45 +03:00
a7aa7add19 Refactoring 2021-05-22 17:55:01 +03:00
d1094c0c0b Fix for desktop 6.3.0 2021-05-21 10:13:32 +03:00
44 changed files with 1995 additions and 2145 deletions

View File

@ -187,37 +187,37 @@ namespace DocWrapper {
else
*oFontSelectFormat.bFixedWidth = 0;
}
ULONG ulRange1 = 0;
ULONG ulRange2 = 0;
ULONG ulRange3 = 0;
ULONG ulRange4 = 0;
ULONG ulCodeRange1 = 0;
ULONG ulCodeRange2 = 0;
UINT ulRange1 = 0;
UINT ulRange2 = 0;
UINT ulRange3 = 0;
UINT ulRange4 = 0;
UINT ulCodeRange1 = 0;
UINT ulCodeRange2 = 0;
if (font.m_oUsb0.IsInit())
ulRange1 = font.m_oUsb0->GetValue();
ulRange1 = (UINT)font.m_oUsb0->GetValue();
if (font.m_oUsb1.IsInit())
ulRange2 = font.m_oUsb1->GetValue();
ulRange2 = (UINT)font.m_oUsb1->GetValue();
if (font.m_oUsb2.IsInit())
ulRange3 = font.m_oUsb2->GetValue();
ulRange3 = (UINT)font.m_oUsb2->GetValue();
if (font.m_oUsb3.IsInit())
ulRange4 = font.m_oUsb3->GetValue();
ulRange4 = (UINT)font.m_oUsb3->GetValue();
if (font.m_oCsb0.IsInit())
ulCodeRange1 = font.m_oCsb0->GetValue();
ulCodeRange1 = (UINT)font.m_oCsb0->GetValue();
if (font.m_oCsb1.IsInit())
ulCodeRange2 = font.m_oCsb1->GetValue();
ulCodeRange2 = (UINT)font.m_oCsb1->GetValue();
if ( !(0 == ulRange1 && 0 == ulRange2 && 0 == ulRange3 && 0 == ulRange4 && 0 == ulCodeRange1 && 0 == ulCodeRange2) )
{
oFontSelectFormat.ulRange1 = new ULONG;
oFontSelectFormat.ulRange1 = new UINT;
*oFontSelectFormat.ulRange1 = ulRange1;
oFontSelectFormat.ulRange2 = new ULONG;
oFontSelectFormat.ulRange2 = new UINT;
*oFontSelectFormat.ulRange2 = ulRange2;
oFontSelectFormat.ulRange3 = new ULONG;
oFontSelectFormat.ulRange3 = new UINT;
*oFontSelectFormat.ulRange3 = ulRange3;
oFontSelectFormat.ulRange4 = new ULONG;
oFontSelectFormat.ulRange4 = new UINT;
*oFontSelectFormat.ulRange4 = ulRange4;
oFontSelectFormat.ulCodeRange1 = new ULONG;
oFontSelectFormat.ulCodeRange1 = new UINT;
*oFontSelectFormat.ulCodeRange1 = ulCodeRange1;
oFontSelectFormat.ulCodeRange2 = new ULONG;
oFontSelectFormat.ulCodeRange2 = new UINT;
*oFontSelectFormat.ulCodeRange2 = ulCodeRange2;
}

View File

@ -266,7 +266,6 @@
<ClInclude Include="..\PPTXWriter\Animation.h" />
<ClInclude Include="..\PPTXWriter\Converter.h" />
<ClInclude Include="..\PPTXWriter\ImageManager.h" />
<ClInclude Include="..\PPTXWriter\ridmanager.h" />
<ClInclude Include="..\PPTXWriter\ShapeWriter.h" />
<ClInclude Include="..\PPTXWriter\StylesWriter.h" />
<ClInclude Include="..\Reader\ClassesAtom.h" />
@ -476,7 +475,6 @@
<ClCompile Include="..\PPTFormatLib.cpp" />
<ClCompile Include="..\PPTXWriter\Animation.cpp" />
<ClCompile Include="..\PPTXWriter\Converter.cpp" />
<ClCompile Include="..\PPTXWriter\ridmanager.cpp" />
<ClCompile Include="..\PPTXWriter\ShapeWriter.cpp" />
<ClCompile Include="..\Reader\PPTDocumentInfoOneUser.cpp">
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">/bigobj %(AdditionalOptions)</AdditionalOptions>

View File

@ -742,9 +742,6 @@
<ClInclude Include="..\PPTXWriter\Animation.h">
<Filter>OOXWriter</Filter>
</ClInclude>
<ClInclude Include="..\PPTXWriter\ridmanager.h">
<Filter>OOXWriter</Filter>
</ClInclude>
<ClInclude Include="..\Structures\ColorIndex.h">
<Filter>OOXElements</Filter>
</ClInclude>
@ -790,8 +787,5 @@
<ClCompile Include="..\PPTXWriter\Animation.cpp">
<Filter>OOXWriter</Filter>
</ClCompile>
<ClCompile Include="..\PPTXWriter\ridmanager.cpp">
<Filter>OOXWriter</Filter>
</ClCompile>
</ItemGroup>
</Project>

View File

@ -74,6 +74,8 @@ CBaseShapePtr CPPTShape::CreateByType(PPTShapes::ShapeType type)
case sptPictureFrame: { pShape = new CRectangleType(); pShape->m_eType = type; break; }
CREATE_BY_SPT(0x00000064, CArcType)
CREATE_BY_SPT(sptAccentBorderCallout90, CAccentBorderCallout90Type)
CREATE_BY_SPT(sptAccentBorderCallout1, CAccentBorderCallout1Type)
CREATE_BY_SPT(sptAccentBorderCallout2, CAccentBorderCallout2Type)

View File

@ -31,9 +31,9 @@
*/
#include "FileContainer.h"
#include "FileTypes.h"
#include "Folder.h"
#include "FileTypes.h"
#include "FileFactory.h"
#include "WrapperFile.h"
@ -327,6 +327,17 @@ namespace PPTX
if ( NSFile::CFileBinary::Exists(filename.GetPath()) == true ) return filename;
//tf22977542_win32.potx
PPTX::Document *pPptxDocument = dynamic_cast<PPTX::Document *>(m_pMainDocument);
if (m_pMainDocument)
{
OOX::CPath main_path(m_pMainDocument->m_sDocumentPath);
filename = main_path / relation->Target();
if (NSFile::CFileBinary::Exists(filename.GetPath()) == true) return filename;
}
//file_1_ (1).pptx
std::wstring strDefDirectory;
for (int i = 0; i < 9; i++)
@ -338,7 +349,16 @@ namespace PPTX
}
}
if (strDefDirectory.empty()) return OOX::CPath();
if (strDefDirectory.empty())
{
if (std::wstring::npos != relation->Type().find(L"image") ||
std::wstring::npos != relation->Type().find(L"audio") ||
std::wstring::npos != relation->Type().find(L"media"))
{
strDefDirectory = L"media";
}
else return OOX::CPath();
}
OOX::CPath new_filename = strDefDirectory + FILE_SEPARATOR_STR + relation->Filename().GetFilename();

View File

@ -63,6 +63,9 @@ namespace PPTX
long files = CountFiles(path);
if(files == 0)
return;
m_sDocumentPath = path.GetPath();
m_lPercent = (long)floor(1000000. / files);
FileContainer::read(rels, path, map, Event);

View File

@ -30,8 +30,6 @@
*
*/
#pragma once
#ifndef PPTX_FOLDER_INCLUDE_H_
#define PPTX_FOLDER_INCLUDE_H_
#include "FileContainer.h"
#include "../../Common/DocxFormat/Source/DocxFormat/RId.h"
@ -56,5 +54,3 @@ namespace PPTX
long CountFiles(const OOX::CPath& path);
};
} // namespace PPTX
#endif //PPTX_FOLDER_INCLUDE_H_

View File

@ -116,22 +116,24 @@ namespace PPTX
spcBef = oReader;
else if ( _T("a:tabLst") == sName )
{
int nParentDepth1 = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nParentDepth1 ) )
if (false == oReader.IsEmptyNode())
{
std::wstring sName1 = oReader.GetName();
if ( _T("a:tab") == sName1 )
int nParentDepth1 = oReader.GetDepth();
while (oReader.ReadNextSiblingNode(nParentDepth1))
{
Tab tab(oReader);
tabLst.push_back(tab);
std::wstring sName1 = oReader.GetName();
if (_T("a:tab") == sName1)
{
Tab tab(oReader);
tabLst.push_back(tab);
}
}
}
}
//else if ( _T("a:extLst") == sName )
// extLst = oReader;
else if ( _T("a:buBlip") == sName || _T("a:buChar") == sName || _T("a:buAutoNum") == sName || sName == _T("buNone"))
else if ( _T("a:buBlip") == sName || _T("a:buChar") == sName || _T("a:buAutoNum") == sName || sName == _T("a:buNone"))
ParagraphBullet.fromXML(oReader);
else if ( _T("a:buClr") == sName || sName == _T("a:buClrTx"))
buColor.fromXML(oReader);

View File

@ -388,8 +388,12 @@ bool RtfNormalReader::ExecuteCommand( RtfDocument& oDocument, RtfReader& oReader
{
if ("rtf" == sCommand) //open-rtf-document-image-error.rtf
{
RtfNormalReader oRtfReader(oDocument, oReader);
return StartSubReader(oRtfReader, oDocument, oReader);
if (oDocument.m_bStartRead)
{
RtfNormalReader oRtfReader(oDocument, oReader);
return StartSubReader(oRtfReader, oDocument, oReader);
}
oDocument.m_bStartRead = true;
}
else if ( "colortbl" == sCommand )
{
@ -469,19 +473,6 @@ bool RtfNormalReader::ExecuteCommand( RtfDocument& oDocument, RtfReader& oReader
}
}
//else if ("qqq" == sCommand)//test
//{
// oDocument.m_oMathProp.m_bHeader = false;
//}
//else if ( "defchp" == sCommand )
//{
// RtfDefCharPropReader oDefCharPropReader( oDocument.m_oDefaultCharProp );
// return StartSubReader( oDefCharPropReader, oDocument, oReader ); }
//else if ( "defpap" == sCommand )
//{
// RtfDefParPropReader oDefParPropReader;
// return StartSubReader( oDefParPropReader, oDocument, oReader );
//}
else if ( "mmathPr" == sCommand )
{
RtfMathReader oMathPropReader(oDocument.m_oMathProp);

View File

@ -2485,34 +2485,6 @@ public:
}
};
class RtfParagraphReader : public RtfAbstractReader
{
private:
std::string m_sHeader;
public:
RtfParagraphPropDestination m_oParPropDest;
RtfParagraphReader( std::string sHeader, RtfReader& oReader ): m_sHeader(sHeader)
{
if( PROP_DEF != oReader.m_oState->m_oParagraphProp.m_nItap )
m_oParPropDest.nTargetItap = oReader.m_oState->m_oParagraphProp.m_nItap;
}
bool ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader, std::string sCommand, bool hasParameter, int parameter)
{
if( m_sHeader == sCommand )
return true;
else
return m_oParPropDest.ExecuteCommand( oDocument, oReader, (*this), sCommand, hasParameter, parameter );
}
void ExecuteText( RtfDocument& oDocument, RtfReader& oReader, std::wstring sText )
{
m_oParPropDest.ExecuteText( oDocument, oReader, sText );
}
void ExitReader( RtfDocument& oDocument, RtfReader& oReader )
{
m_oParPropDest.Finalize( oReader );
}
};
class RtfDocumentCommand
{
@ -2631,6 +2603,44 @@ private:
}
};
class RtfParagraphReader : public RtfAbstractReader
{
private:
std::string m_sHeader;
public:
RtfParagraphPropDestination m_oParPropDest;
RtfParagraphReader(std::string sHeader, RtfReader& oReader) : m_sHeader(sHeader)
{
if (PROP_DEF != oReader.m_oState->m_oParagraphProp.m_nItap)
m_oParPropDest.nTargetItap = oReader.m_oState->m_oParagraphProp.m_nItap;
}
bool ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader, std::string sCommand, bool hasParameter, int parameter)
{
if (m_sHeader == sCommand)
return true;
else if ("rtf" == sCommand)
{
RtfNormalReader oRtfReader(oDocument, oReader);
oDocument.m_bStartRead = false;
oRtfReader.oParagraphReaderDestination = m_oParPropDest;
StartSubReader(oRtfReader, oDocument, oReader);
m_oParPropDest = oRtfReader.oParagraphReaderDestination;
return true;
}
else
return m_oParPropDest.ExecuteCommand(oDocument, oReader, (*this), sCommand, hasParameter, parameter);
}
void ExecuteText(RtfDocument& oDocument, RtfReader& oReader, std::wstring sText)
{
m_oParPropDest.ExecuteText(oDocument, oReader, sText);
}
void ExitReader(RtfDocument& oDocument, RtfReader& oReader)
{
m_oParPropDest.Finalize(oReader);
}
};
class RtfFieldInstReader : public RtfAbstractReader, public RtfParagraphPropDestination
{

View File

@ -41,6 +41,7 @@
RtfDocument::RtfDocument() : m_pAppFonts(NULL)
{
m_bStartRead = false;
m_nUserLCID = -1;
_section section;
section.props = RtfSectionPtr(new RtfSection());

View File

@ -84,11 +84,11 @@ public:
NSFonts::IApplicationFonts* m_pAppFonts;
int m_nUserLCID;
bool m_bStartRead;
private:
std::vector<int> m_aShapeId;
int m_nZIndexLast;
public:
int GetZIndex()
{

View File

@ -900,54 +900,56 @@ std::wstring RtfShape::RenderToOOXBegin(RenderParameter oRenderParameter)
sResult += L" title=\"" + m_sName + L"\"";
}
if( PROP_DEF != m_nShapeType && 0 != m_nShapeType)
if (!m_bIsGroup)
{
sResult += L" type=\"#_x0000_t" + std::to_wstring(m_nShapeType) + L"\"";
sResult += L" o:spt=\"" + std::to_wstring(m_nShapeType) + L"\"";
}
if (PROP_DEF != m_nShapeType && 0 != m_nShapeType)
{
sResult += L" type=\"#_x0000_t" + std::to_wstring(m_nShapeType) + L"\"";
sResult += L" o:spt=\"" + std::to_wstring(m_nShapeType) + L"\"";
}
if( 0 == m_bFilled || ( m_nFillColor == PROP_DEF && m_nFillColor2 == PROP_DEF && m_nFillType == PROP_DEF))
sResult += L" filled=\"f\""; //сф_850000158725_R7_M194_МО_Q194.rtf
else
sResult += L" filled=\"t\"";
if (0 == m_bFilled || (m_nFillColor == PROP_DEF && m_nFillColor2 == PROP_DEF && m_nFillType == PROP_DEF))
sResult += L" filled=\"f\""; //сф_850000158725_R7_M194_МО_Q194.rtf
else
sResult += L" filled=\"t\"";
if( PROP_DEF == m_bLine)
{
m_bLine = (m_nShapeType == SimpleTypes::Vml::sptPictureFrame || m_nShapeType == SimpleTypes::Vml::sptTextBox) ? 0 : 1;
}
if (PROP_DEF == m_bLine)
{
m_bLine = (m_nShapeType == SimpleTypes::Vml::sptPictureFrame || m_nShapeType == SimpleTypes::Vml::sptTextBox) ? 0 : 1;
}
if ( 0 == m_bLine) sResult += L" stroked=\"f\"";
else sResult += L" stroked=\"t\"";
if (0 == m_bLine) sResult += L" stroked=\"f\"";
else sResult += L" stroked=\"t\"";
if( PROP_DEF != m_nFillColor)
{
RtfColor color(m_nFillColor);
sResult += L" fillcolor=\"#" + color.ToHexColor(true) + L"\"";
}
if( PROP_DEF != m_nLineColor)
{
RtfColor color(m_nLineColor);
sResult += L" strokecolor=\"#" + color.ToHexColor(true) + L"\"";
}
if(PROP_DEF != m_nLineWidth)
sResult += L" strokeweight=\"" + XmlUtils::DoubleToString(RtfUtility::Emu2Pt(m_nLineWidth), L"%.2f") + L"pt\"";
//path
switch( m_nConnectionType )
{
if (PROP_DEF != m_nFillColor)
{
RtfColor color(m_nFillColor);
sResult += L" fillcolor=\"#" + color.ToHexColor(true) + L"\"";
}
if (PROP_DEF != m_nLineColor)
{
RtfColor color(m_nLineColor);
sResult += L" strokecolor=\"#" + color.ToHexColor(true) + L"\"";
}
if (PROP_DEF != m_nLineWidth)
sResult += L" strokeweight=\"" + XmlUtils::DoubleToString(RtfUtility::Emu2Pt(m_nLineWidth), L"%.2f") + L"pt\"";
//path
switch (m_nConnectionType)
{
case 0: sResult += L" o:connecttype=\"custom\""; break;
case 1: sResult += L" o:connecttype=\"none\""; break;
case 2: sResult += L" o:connecttype=\"rect\""; break;
case 3: sResult += L" o:connecttype=\"segments\""; break;
}
//Connectors
switch( m_nConnectorStyle )
{
case 0: sResult += L" o:connectortype=\"straight\"";break;
}
//Connectors
switch (m_nConnectorStyle)
{
case 0: sResult += L" o:connectortype=\"straight\""; break;
case 1: sResult += L" o:connectortype=\"elbow\""; break;
case 2: sResult += L" o:connectortype=\"curved\""; break;
case 3: sResult += L" o:connectortype=\"none\""; break;
}
}
//-----------------------------------------------------------------------------------------------------------------
std::wstring sStyle ;
if( PROP_DEF != m_nLeft && PROP_DEF != m_nRight && PROP_DEF != m_nTop && PROP_DEF != m_nBottom )
@ -1043,7 +1045,7 @@ std::wstring RtfShape::RenderToOOXBegin(RenderParameter oRenderParameter)
case 4: sStyle += L"mso-position-horizontal:inside;"; break;
case 5: sStyle += L"mso-position-horizontal:outside;"; break;
}
if( PROP_DEF != m_nPositionHPct )//todo
if( PROP_DEF != m_nPositionHPct && m_nPositionHPct > 0)//todo
{
sStyle += L"mso-left-percent:" + std::to_wstring(m_nPositionHPct) + L";";
}
@ -1083,7 +1085,7 @@ std::wstring RtfShape::RenderToOOXBegin(RenderParameter oRenderParameter)
case 4: sStyle += L"mso-position-vertical:inside;"; break;
case 5: sStyle += L"mso-position-vertical:outside;"; break;
}
if( PROP_DEF != m_nPositionVPct )
if( PROP_DEF != m_nPositionVPct && m_nPositionVPct > 0)
sStyle += L"mso-top-percent:" + std::to_wstring(m_nPositionVPct) + L";";
if( PROP_DEF != m_nPositionV && PROP_DEF == m_nPositionVRelative )
@ -1111,7 +1113,7 @@ std::wstring RtfShape::RenderToOOXBegin(RenderParameter oRenderParameter)
//case ay_Para: sStyle += L"mso-position-vertical-relative:text;"; break;
}
}
if( PROP_DEF != m_nPctWidth )
if( PROP_DEF != m_nPctWidth && m_nPctWidth > 0)
sStyle += L"mso-width-percent:" + std::to_wstring(m_nPctWidth) + L";";
switch( m_nPctWidthRelative )
{
@ -1123,7 +1125,7 @@ std::wstring RtfShape::RenderToOOXBegin(RenderParameter oRenderParameter)
case 5: sStyle += L"mso-width-relative:outer-margin-area;"; break;
}
if( PROP_DEF != m_nPctHeight )
if( PROP_DEF != m_nPctHeight && m_nPctHeight > 0)
sStyle += L"mso-height-percent:" + std::to_wstring(m_nPctHeight) + L";";
switch( m_nPctHeightRelative )
@ -1217,45 +1219,48 @@ std::wstring RtfShape::RenderToOOXBegin(RenderParameter oRenderParameter)
}
}
//Geometry
if( PROP_DEF != m_nAdjustValue[0] )
if (!m_bIsGroup)
{
std::wstring sAdjust;
sAdjust += L" " + std::to_wstring(m_nAdjustValue[0]) + L"";
for (size_t i = 1 ; i < 10; i++)
if (PROP_DEF != m_nAdjustValue[0])
{
if (PROP_DEF != m_nAdjustValue[i])
sAdjust += L"," + std::to_wstring(m_nAdjustValue[i]) + L"";
else
sAdjust += L",";
}
sResult +=L" adj=\"" + sAdjust + L"\"";
}
//Custom
if (!m_aPVerticles.empty() || !m_aPSegmentInfo.empty())
{
CBaseShapePtr base_shape = CPPTShape::CreateByType((PPTShapes::ShapeType)m_nShapeType);
CPPTShape *custom_shape = dynamic_cast<CPPTShape*>(base_shape.get());
if (custom_shape)
{
custom_shape->m_bCustomShape = true;
custom_shape->m_oPath.SetCoordsize(m_nGeoRight - m_nGeoLeft, m_nGeoBottom - m_nGeoTop);
for (size_t i = 0 ; i < 10; i++)
std::wstring sAdjust;
sAdjust += L" " + std::to_wstring(m_nAdjustValue[0]) + L"";
for (size_t i = 1; i < 10; i++)
{
if (PROP_DEF != m_nAdjustValue[i])
custom_shape->m_oCustomVML.LoadAdjusts((long)i + 1, m_nAdjustValue[i]);
sAdjust += L"," + std::to_wstring(m_nAdjustValue[i]) + L"";
else
sAdjust += L",";
}
if (PROP_DEF != m_nShapePath)
custom_shape->m_oCustomVML.SetPath((ODRAW::RulesType)m_nShapePath);
custom_shape->m_oCustomVML.LoadVertices(m_aPVerticles);
custom_shape->m_oCustomVML.LoadSegments(m_aPSegmentInfo);
sResult += L" adj=\"" + sAdjust + L"\"";
}
//Custom
if (!m_aPVerticles.empty() || !m_aPSegmentInfo.empty())
{
CBaseShapePtr base_shape = CPPTShape::CreateByType((PPTShapes::ShapeType)m_nShapeType);
CPPTShape *custom_shape = dynamic_cast<CPPTShape*>(base_shape.get());
if (custom_shape)
{
custom_shape->m_bCustomShape = true;
custom_shape->m_oCustomVML.ToCustomShape(custom_shape, custom_shape->m_oManager);
sResult +=L" path=\"" + custom_shape->m_strPath + L"\"";
custom_shape->m_oPath.SetCoordsize(m_nGeoRight - m_nGeoLeft, m_nGeoBottom - m_nGeoTop);
for (size_t i = 0; i < 10; i++)
{
if (PROP_DEF != m_nAdjustValue[i])
custom_shape->m_oCustomVML.LoadAdjusts((long)i + 1, m_nAdjustValue[i]);
}
if (PROP_DEF != m_nShapePath)
custom_shape->m_oCustomVML.SetPath((ODRAW::RulesType)m_nShapePath);
custom_shape->m_oCustomVML.LoadVertices(m_aPVerticles);
custom_shape->m_oCustomVML.LoadSegments(m_aPSegmentInfo);
custom_shape->m_oCustomVML.ToCustomShape(custom_shape, custom_shape->m_oManager);
sResult += L" path=\"" + custom_shape->m_strPath + L"\"";
}
}
}
//Wrap Geometry
@ -1297,7 +1302,7 @@ std::wstring RtfShape::RenderToOOXBegin(RenderParameter oRenderParameter)
}
//Line
if( 0 != m_bLine)
if( 0 != m_bLine && !m_bIsGroup)
{
std::wstring sStroke;
switch( m_nLineDashing )
@ -1366,7 +1371,7 @@ std::wstring RtfShape::RenderToOOXBegin(RenderParameter oRenderParameter)
}
}
if( 0 != m_aTextItems && !m_bIsOle)
if( 0 != m_aTextItems && !m_bIsOle && !m_bIsGroup)
{
RenderParameter oNewParam = oRenderParameter;
oNewParam.nType = RENDER_TO_OOX_PARAM_UNKNOWN;
@ -1389,7 +1394,7 @@ std::wstring RtfShape::RenderToOOXBegin(RenderParameter oRenderParameter)
}
std::wstring sPicture;
if( m_oPicture )
if( m_oPicture && !m_bIsGroup)
{
sPicture = m_oPicture->RenderToOOX(oRenderParameter);
@ -1438,7 +1443,7 @@ std::wstring RtfShape::RenderToOOXBegin(RenderParameter oRenderParameter)
}
}
//-----------------------------------------------------------------------------------------------
if( 0 != m_bFilled)
if( 0 != m_bFilled && !m_bIsGroup)
{
sResult += L"<v:fill";
@ -1499,7 +1504,7 @@ std::wstring RtfShape::RenderToOOXBegin(RenderParameter oRenderParameter)
sResult += L"/>";
}
//---------------------------------------------------------------------------------------------------------------------------
if( false == m_sGtextUNICODE.empty())
if( false == m_sGtextUNICODE.empty() && !m_bIsGroup)
{
sResult += L"<v:textpath";

View File

@ -378,7 +378,7 @@ int Font::serialize_properties(std::wostream & stream, bool isRPr)
{
CP_XML_NODE(L"sz")
{
CP_XML_ATTR(L"val", dyHeight/20);
CP_XML_ATTR(L"val", dyHeight/20.f);
}
}

View File

@ -261,7 +261,7 @@ int FontInfo::serialize(std::wostream & stream)
{
CP_XML_NODE(L"sz")
{
CP_XML_ATTR(L"val", dyHeight/20);
CP_XML_ATTR(L"val", dyHeight/20.f);
}
}

View File

@ -83,7 +83,7 @@ int DXFFntD::serialize(std::wostream & stream)
{
CP_XML_NODE(L"sz")
{
CP_XML_ATTR(L"val", stxp.twpHeight/20);
CP_XML_ATTR(L"val", stxp.twpHeight/20.f);
}
}
if (icvFore < 0x7fff)

View File

@ -37,6 +37,7 @@
#include <openssl/pem.h>
#include <openssl/err.h>
#include <openssl/aes.h>
#include <openssl/rand.h>
namespace NSOpenSSL
{
@ -483,4 +484,176 @@ namespace NSOpenSSL
}
return "";
}
// AES GCM for private rooms
#define GCM_IV_LENGTH 12
#define GCM_TAG_LENGHT 16
// для того, чтобы мы могли менять алгоритмы, в зависимости от версии
// на шифровке - дописываем хедер. сделано на этом уровне, чтобы лишний раз не выделять/копировать память
std::string g_aes_header = "VER2;";
unsigned char* PBKDF2_desktop_GCM(const std::string& pass, const std::string& salt)
{
unsigned char* key = NULL;
if (salt.empty())
{
unsigned int pass_salt_len = 0;
unsigned char* pass_salt = NSOpenSSL::GetHash((unsigned char*)pass.c_str(), (unsigned int)pass.length(), OPENSSL_HASH_ALG_SHA512, pass_salt_len);
key = PBKDF2(pass.c_str(), (int)pass.length(), pass_salt, pass_salt_len, OPENSSL_HASH_ALG_SHA256, 32);
openssl_free(pass_salt);
}
else
{
key = PBKDF2(pass.c_str(), (int)pass.length(), (const unsigned char*)salt.c_str(), (unsigned int)salt.length(), OPENSSL_HASH_ALG_SHA256, 32);
}
return key;
}
bool AES_Decrypt_desktop_GCM(const unsigned char* key, const std::string& input, std::string& output, const int header_offset)
{
unsigned char* input_ptr = NULL;
int input_ptr_len = 0;
bool bBase64 = NSFile::CBase64Converter::Decode(input.c_str() + header_offset, (int)input.length() - header_offset, input_ptr, input_ptr_len);
if (!bBase64)
return false;
unsigned char* iv_ptr = input_ptr;
unsigned char* tag_ptr = input_ptr + GCM_IV_LENGTH;
unsigned char* ciphertext_ptr = tag_ptr + GCM_TAG_LENGHT;
int ciphertext_len = input_ptr_len - (GCM_IV_LENGTH + GCM_TAG_LENGHT);
unsigned char* output_ptr = NULL;
int output_len = 0;
int final_len = 0;
bool bResult = false;
EVP_CIPHER_CTX* ctx = EVP_CIPHER_CTX_new();
if (!ctx)
goto end;
if (!EVP_DecryptInit_ex(ctx, EVP_aes_256_gcm(), NULL, NULL, NULL))
goto end;
if (!EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GCM_SET_IVLEN, GCM_IV_LENGTH, NULL))
goto end;
if (!EVP_DecryptInit_ex(ctx, NULL, NULL, key, iv_ptr))
goto end;
output_ptr = openssl_alloc(ciphertext_len);
if (!EVP_DecryptUpdate(ctx, output_ptr, &output_len, ciphertext_ptr, ciphertext_len))
goto end;
if (!EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GCM_SET_TAG, GCM_TAG_LENGHT, tag_ptr))
goto end;
if (EVP_DecryptFinal_ex(ctx, output_ptr + output_len, &final_len))
{
output_len += final_len;
bResult = true;
}
end:
RELEASEARRAYOBJECTS(input_ptr);
if (ctx)
EVP_CIPHER_CTX_free(ctx);
if (bResult)
{
output = std::string((char*)output_ptr, output_len);
}
if (output_ptr)
openssl_free(output_ptr);
return bResult;
}
bool AES_Encrypt_desktop_GCM(const unsigned char* key, const std::string& input, std::string& output)
{
const unsigned char* input_ptr = (const unsigned char*)input.c_str();
int input_len = (int)input.length();
int output_buffer_all_offset = GCM_IV_LENGTH + GCM_TAG_LENGHT;
int output_buffer_len = input_len + output_buffer_all_offset;
unsigned char* output_ptr = NULL;
unsigned char* iv_ptr = NULL;
unsigned char* tag_ptr = NULL;
unsigned char* ciphertext_ptr = NULL;
int ciphertext_len = 0;
int final_len = 0;
bool bResult = false;
EVP_CIPHER_CTX* ctx = EVP_CIPHER_CTX_new();
if (!ctx)
goto end;
if (1 != EVP_EncryptInit_ex(ctx, EVP_aes_256_gcm(), NULL, NULL, NULL))
goto end;
if (1 != EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GCM_SET_IVLEN, GCM_IV_LENGTH, NULL))
goto end;
output_ptr = openssl_alloc(output_buffer_len);
iv_ptr = output_ptr;
tag_ptr = iv_ptr + GCM_IV_LENGTH;
ciphertext_ptr = tag_ptr + GCM_TAG_LENGHT;
if (1 != RAND_bytes(iv_ptr, GCM_IV_LENGTH))
goto end;
if (1 != EVP_EncryptInit_ex(ctx, NULL, NULL, key, iv_ptr))
goto end;
if (1 != EVP_EncryptUpdate(ctx, ciphertext_ptr, &ciphertext_len, input_ptr, input_len))
goto end;
if (1 != EVP_EncryptFinal_ex(ctx, ciphertext_ptr + ciphertext_len, &final_len))
goto end;
ciphertext_len += final_len;
if (1 != EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GCM_GET_TAG, GCM_TAG_LENGHT, tag_ptr))
goto end;
bResult = true;
end:
if (ctx)
EVP_CIPHER_CTX_free(ctx);
if (bResult)
{
// header + base64
char* pDataDst = NULL;
int nDataDst = 0;
NSFile::CBase64Converter::Encode(output_ptr, ciphertext_len + output_buffer_all_offset, pDataDst, nDataDst, NSBase64::B64_BASE64_FLAG_NOCRLF);
output = "";
output.reserve(g_aes_header.length() + (size_t)nDataDst + 1);
output.append(g_aes_header);
output.append((char*)pDataDst, nDataDst);
RELEASEARRAYOBJECTS(pDataDst);
}
if (output_ptr)
openssl_free(output_ptr);
return bResult;
}
bool AES_Encrypt_desktop_GCM(const std::string& pass, const std::string& input, std::string& output, const std::string& salt)
{
unsigned char* key = PBKDF2_desktop_GCM(pass, salt);
bool bRes = AES_Encrypt_desktop_GCM(key, input, output);
openssl_free(key);
return bRes;
}
bool AES_Decrypt_desktop_GCM(const std::string& pass, const std::string& input, std::string& output, const std::string& salt, const int header_offset)
{
unsigned char* key = PBKDF2_desktop_GCM(pass, salt);
bool bRes = AES_Decrypt_desktop_GCM(key, input, output, header_offset);
openssl_free(key);
return bRes;
}
}

View File

@ -89,6 +89,13 @@ namespace NSOpenSSL
// serialize
OPENSSL_DECL std::string Serialize(const unsigned char* data, const unsigned int& size, const int& alg);
// GCM
OPENSSL_DECL unsigned char* PBKDF2_desktop_GCM(const std::string& pass, const std::string& salt = "");
OPENSSL_DECL bool AES_Decrypt_desktop_GCM(const unsigned char* key, const std::string& input, std::string& output, const int header_offset = 0);
OPENSSL_DECL bool AES_Decrypt_desktop_GCM(const std::string& pass, const std::string& input, std::string& output, const std::string& salt = "", const int header_offset = 0);
OPENSSL_DECL bool AES_Encrypt_desktop_GCM(const unsigned char* key, const std::string& input, std::string& output);
OPENSSL_DECL bool AES_Encrypt_desktop_GCM(const std::string& pass, const std::string& input, std::string& output, const std::string& salt = "");
}
#endif // COMMON_OPENSSL_H

View File

@ -10,6 +10,6 @@ for image in $(docker images --format "{{.ID}}"); do
done
docker rm v8docker
docker build . -t v8_docker --build-arg CACHEBUST=1
docker build . -t v8_docker --build-arg CACHEBUST=0 --no-cache=true
docker run -d --name v8docker v8_docker:latest
docker cp v8docker:/home/docker/v8/build.zip .

View File

@ -57,6 +57,8 @@ namespace OOX {
bool CDocx::Read(const CPath& oFilePath)
{
m_sDocumentPath = oFilePath.GetPath();
// Ищем "/_rels/.rels" и читаем все файлы по рельсам
OOX::CRels oRels( oFilePath / FILE_SEPARATOR_STR );
IFileContainer::Read( oRels, oFilePath, oFilePath );

View File

@ -1414,6 +1414,8 @@ namespace OOX
public:
Document() {}
virtual ~Document() {}
std::wstring m_sDocumentPath;
};
class WritingElement

View File

@ -67,6 +67,8 @@ OOX::Spreadsheet::CXlsx::~CXlsx()
bool OOX::Spreadsheet::CXlsx::Read(const CPath& oFilePath)
{
m_sDocumentPath = oFilePath.GetPath();
OOX::CRels oRels( oFilePath / FILE_SEPARATOR_STR );
IFileContainer::Read( oRels, oFilePath, oFilePath );

View File

@ -960,6 +960,7 @@ namespace NSEditorApi
js_wrapper<bool> m_bCanFill;
js_wrapper<bool> m_bFromChart;
js_wrapper<bool> m_bFromGroup;
js_wrapper<int> m_nInsertPageNum;
@ -968,6 +969,7 @@ namespace NSEditorApi
{
m_bCanFill = true;
m_bFromChart = false;
m_bFromGroup = false;
}
virtual ~CAscShapeProp()
{
@ -976,6 +978,7 @@ namespace NSEditorApi
LINK_PROPERTY_STRING_JS(Type)
LINK_PROPERTY_BOOL_JS(CanFill)
LINK_PROPERTY_BOOL_JS(FromChart)
LINK_PROPERTY_BOOL_JS(FromGroup)
LINK_PROPERTY_OBJECT_JS(CAscFill, Fill)
LINK_PROPERTY_OBJECT_JS(CAscStroke, Stroke)

View File

@ -118,7 +118,7 @@ std::string CV8RealTimeWorker::GetGlobalVariable()
std::wstring CV8RealTimeWorker::GetJSVariable(std::wstring sParam)
{
std::string sParamA = U_TO_UTF8(sParam);
NSCommon::string_replaceA(sParamA, "\\\"", "\"");
NSStringUtils::string_replaceA(sParamA, "\\\"", "\"");
std::string commandA = "(function(){ return (" + sParamA + "); })()";
JSSmart<CJSContextScope> context_scope = m_context->CreateContextScope();
@ -152,8 +152,8 @@ bool CV8RealTimeWorker::OpenFile(const std::wstring& sBasePath, const std::wstri
std::string sArg = m_sUtf8ArgumentJSON;
if (sArg.empty())
sArg = "{}";
NSCommon::string_replaceA(sArg, "\\", "\\\\");
NSCommon::string_replaceA(sArg, "\"", "\\\"");
NSStringUtils::string_replaceA(sArg, "\\", "\\\\");
NSStringUtils::string_replaceA(sArg, "\"", "\\\"");
std::string sArgument = "var Argument = JSON.parse(\"" + sArg + "\");";
m_context->runScript(sArgument, try_catch);
@ -166,8 +166,8 @@ bool CV8RealTimeWorker::OpenFile(const std::wstring& sBasePath, const std::wstri
std::string sArg = m_sGlobalVariable;
if (sArg.empty())
sArg = "{}";
NSCommon::string_replaceA(sArg, "\\", "\\\\");
NSCommon::string_replaceA(sArg, "\"", "\\\"");
NSStringUtils::string_replaceA(sArg, "\\", "\\\\");
NSStringUtils::string_replaceA(sArg, "\"", "\\\"");
std::string sScriptVar = "var GlobalVariable = JSON.parse(\"" + sArg + "\");";
@ -231,7 +231,7 @@ bool CV8RealTimeWorker::OpenFile(const std::wstring& sBasePath, const std::wstri
JSSmart<CJSValue> args_open[3];
args_open[0] = oWorkerLoader.GetDataFull()->toObject()->toValue();
args_open[1] = CJSContext::createInt(nVersion);
std::wstring sXlsx = NSCommon::GetDirectoryName(pNative->GetFilePath()) + L"/Editor.xlsx";
std::wstring sXlsx = NSFile::GetDirectoryName(pNative->GetFilePath()) + L"/Editor.xlsx";
args_open[2] = NSFile::CFileBinary::Exists(sXlsx) ? CJSContext::createString(sXlsx) : CJSContext::createUndefined();
global_js->call_func("NativeOpenFileData", 3, args_open);

View File

@ -312,7 +312,7 @@ namespace NSDoctRenderer
void CheckFonts(bool bIsCheckFonts)
{
std::wstring sDirectory = NSCommon::GetDirectoryName(m_strAllFonts);
std::wstring sDirectory = NSFile::GetDirectoryName(m_strAllFonts);
std::wstring strFontsSelectionBin = sDirectory + L"/font_selection.bin";
if (!bIsCheckFonts && NSFile::CFileBinary::Exists(strFontsSelectionBin))
@ -334,7 +334,7 @@ namespace NSDoctRenderer
if (NSFile::CFileBinary::Exists(m_sFileDir))
NSFile::CFileBinary::Remove(m_sFileDir);
NSCommon::string_replace(m_sFileDir, L"\\", L"/");
NSStringUtils::string_replace(m_sFileDir, L"\\", L"/");
std::wstring::size_type nPosPoint = m_sFileDir.rfind('.');
if (nPosPoint != std::wstring::npos && nPosPoint > m_sTmpFolder.length())
@ -472,7 +472,7 @@ namespace NSDoctRenderer
else
{
oBuilder.WriteString(L"<m_sFontDir>");
oBuilder.WriteEncodeXmlString(NSCommon::GetDirectoryName(m_strAllFonts));
oBuilder.WriteEncodeXmlString(NSFile::GetDirectoryName(m_strAllFonts));
oBuilder.WriteString(L"</m_sFontDir>");
oBuilder.WriteString(L"<m_sAllFontsPath>");
@ -604,7 +604,7 @@ namespace NSDoctRenderer
std::wstring GetFileCopyExt(const std::wstring& path)
{
std::wstring sExtCopy = NSCommon::GetFileExtention(path);
std::wstring sExtCopy = NSFile::GetFileExtention(path);
if (true)
{
@ -702,10 +702,10 @@ namespace NSDoctRenderer
wchar_t last = m_sFolderForSaveOnlyUseNames.c_str()[m_sFolderForSaveOnlyUseNames.length() - 1];
if (last != '/' && last != '\\')
_path += L"/";
_path += NSCommon::GetFileName(path);
_path += NSFile::GetFileName(path);
}
std::wstring sDstFileDir = NSCommon::GetDirectoryName(_path);
std::wstring sDstFileDir = NSFile::GetDirectoryName(_path);
if ((sDstFileDir != _path) && !NSDirectory::Exists(sDstFileDir))
NSDirectory::CreateDirectories(sDstFileDir);
@ -782,7 +782,7 @@ namespace NSDoctRenderer
else
{
oBuilder.WriteString(L"<m_sFontDir>");
oBuilder.WriteEncodeXmlString(NSCommon::GetDirectoryName(m_strAllFonts));
oBuilder.WriteEncodeXmlString(NSFile::GetDirectoryName(m_strAllFonts));
oBuilder.WriteString(L"</m_sFontDir>");
oBuilder.WriteString(L"<m_sAllFontsPath>");
@ -1030,7 +1030,7 @@ namespace NSDoctRenderer
if (0 < arSdkFiles->size())
{
return NSCommon::GetDirectoryName(*arSdkFiles->begin()) + L"/sdk-all.cache";
return NSFile::GetDirectoryName(*arSdkFiles->begin()) + L"/sdk-all.cache";
}
return L"";
}
@ -1066,7 +1066,7 @@ namespace NSDoctRenderer
{
std::wstring sValue(value);
std::string sValueA = U_TO_UTF8(sValue);
NSCommon::string_replaceA(sValueA, "%", "%%");
NSStringUtils::string_replaceA(sValueA, "%", "%%");
std::wstring _sFile(path);
std::wstring sFile = GetSaveFilePath(_sFile);

View File

@ -724,7 +724,7 @@ namespace NSDoctRenderer
JSSmart<CJSValue> args_open[4];
args_open[0] = oWorkerLoader.GetDataFull()->toValue();
args_open[1] = CJSContext::createInt(nVersion);
std::wstring sXlsx = NSCommon::GetDirectoryName(pNative->GetFilePath()) + L"/Editor.xlsx";
std::wstring sXlsx = NSFile::GetDirectoryName(pNative->GetFilePath()) + L"/Editor.xlsx";
args_open[2] = NSFile::CFileBinary::Exists(sXlsx) ? CJSContext::createString(sXlsx) : CJSContext::createUndefined();
JSSmart<CJSObject> globalParams = CJSContext::createObject();
if (0 < m_oParams.m_nLcid)

View File

@ -2,7 +2,6 @@
#include "./../docbuilder_p.h"
#include "../../common/Directory.h"
#include "../../fontengine/application_generate_fonts_common.h"
JSSmart<CJSValue> CBuilderEmbed::builder_OpenFile(JSSmart<CJSValue> sPath, JSSmart<CJSValue> sParams)
{
@ -66,7 +65,7 @@ JSSmart<CJSValue> CBuilderDocumentEmbed::builder_doc_GetImageMap()
for (std::vector<std::wstring>::iterator i = files.begin(); i != files.end(); i++)
{
std::wstring sFile = *i;
NSCommon::string_replace(sFile, L"\\", L"/");
NSStringUtils::string_replace(sFile, L"\\", L"/");
std::wstring sName = L"media/" + NSFile::GetFileName(sFile);
obj->set(U_TO_UTF8(sName).c_str(), CJSContext::createString(sFile));
@ -85,7 +84,7 @@ void CBuilderDocumentEmbed::OpenFile(const std::wstring& sFile, const std::wstri
if (NSFile::CFileBinary::Exists(m_sFolder))
NSFile::CFileBinary::Remove(m_sFolder);
NSCommon::string_replace(m_sFolder, L"\\", L"/");
NSStringUtils::string_replace(m_sFolder, L"\\", L"/");
std::wstring::size_type nPosPoint = m_sFolder.rfind('.');
if (nPosPoint != std::wstring::npos && nPosPoint > sTmpDir.length())

View File

@ -151,15 +151,15 @@ FUNCTION_WRAPPER_JS_2(_m, _m)
FUNCTION_WRAPPER_JS_2(_l, _l)
FUNCTION_WRAPPER_JS_6(_c, _c)
FUNCTION_WRAPPER_JS_4(_c2, _c2)
FUNCTION_WRAPPER_JS(_ds, ds)
FUNCTION_WRAPPER_JS(_df, df)
FUNCTION_WRAPPER_JS(ds, ds)
FUNCTION_WRAPPER_JS(df, df)
// canvas state
FUNCTION_WRAPPER_JS(_save, save)
FUNCTION_WRAPPER_JS(_restore, restore)
FUNCTION_WRAPPER_JS(_clip, clip)
FUNCTION_WRAPPER_JS(_reset, reset)
FUNCTION_WRAPPER_JS(_FreeFont, FreeFont)
FUNCTION_WRAPPER_JS(_ClearLastFont, ClearLastFont)
FUNCTION_WRAPPER_JS(save, save)
FUNCTION_WRAPPER_JS(restore, restore)
FUNCTION_WRAPPER_JS(clip, clip)
FUNCTION_WRAPPER_JS(reset, reset)
FUNCTION_WRAPPER_JS(FreeFont, FreeFont)
FUNCTION_WRAPPER_JS(ClearLastFont, ClearLastFont)
// images
FUNCTION_WRAPPER_JS_7(drawImage2, drawImage2)
FUNCTION_WRAPPER_JS_8(drawImage, drawImage)
@ -240,7 +240,7 @@ FUNCTION_WRAPPER_JS(get_LineJoin, get_LineJoin)
FUNCTION_WRAPPER_JS_4(put_TextureBounds, put_TextureBounds)
FUNCTION_WRAPPER_JS(GetlineWidth, GetlineWidth)
FUNCTION_WRAPPER_JS_1(DrawPath, DrawPath)
FUNCTION_WRAPPER_JS_2(_oordTransformOffset, CoordTransformOffset)
FUNCTION_WRAPPER_JS_2(CoordTransformOffset, CoordTransformOffset)
FUNCTION_WRAPPER_JS(GetTransform, GetTransform)
@end

View File

@ -59,7 +59,7 @@ std::wstring CImagesWorker::GetImage(const std::wstring& sUrl)
if (sUrlFile.find(L"localhost") == 0)
sUrlFile = sUrlFile.substr(9);
NSCommon::string_replace(sUrlFile, L"%20", L" ");
NSStringUtils::string_replace(sUrlFile, L"%20", L" ");
if (!NSFile::CFileBinary::Exists(sUrlFile))
sUrlFile = sUrlFile.substr(1);

View File

@ -39,10 +39,10 @@
#include "../graphics/Timer.h"
#include "../common/Directory.h"
#include "../common/Array.h"
#include "../common/StringBuilder.h"
#include "../../OfficeUtils/src/OfficeUtils.h"
#include "js_internal/js_base.h"
#include "../fontengine/application_generate_fonts_common.h"
#if defined(CreateDirectory)
#undef CreateDirectory
@ -182,7 +182,7 @@ private:
void url_correct2(std::wstring& url)
{
NSCommon::string_replace(url, L"/./", L"/");
NSStringUtils::string_replace(url, L"/./", L"/");
size_t posn = 0;
while (std::wstring::npos != (posn = url.find(L"/../")))
@ -195,9 +195,9 @@ private:
}
}
NSCommon::string_replace(url, L"\\\\", L"\\");
NSCommon::string_replace(url, L"//", L"/");
NSCommon::string_replace(url, L"\\", L"/");
NSStringUtils::string_replace(url, L"\\\\", L"\\");
NSStringUtils::string_replace(url, L"//", L"/");
NSStringUtils::string_replace(url, L"\\", L"/");
}
};
@ -346,7 +346,7 @@ public:
{
m_strFilePath = strPath;
m_oZipWorker.m_sWorkerFolder = NSCommon::GetDirectoryName(strPath);
m_oZipWorker.m_sWorkerFolder = NSFile::GetDirectoryName(strPath);
}
std::wstring GetFilePath()
{

View File

@ -266,12 +266,12 @@ namespace NSFonts
memcpy( (void *)pBuffer, (const void *)pInfo->m_aPanose, lLen );
pBuffer += lLen;
NSBinarySerialize::Write<UINT>(pBuffer, (UINT)pInfo->m_ulUnicodeRange1);
NSBinarySerialize::Write<UINT>(pBuffer, (UINT)pInfo->m_ulUnicodeRange2);
NSBinarySerialize::Write<UINT>(pBuffer, (UINT)pInfo->m_ulUnicodeRange3);
NSBinarySerialize::Write<UINT>(pBuffer, (UINT)pInfo->m_ulUnicodeRange4);
NSBinarySerialize::Write<UINT>(pBuffer, (UINT)pInfo->m_ulCodePageRange1);
NSBinarySerialize::Write<UINT>(pBuffer, (UINT)pInfo->m_ulCodePageRange2);
NSBinarySerialize::Write<UINT>(pBuffer, pInfo->m_ulUnicodeRange1);
NSBinarySerialize::Write<UINT>(pBuffer, pInfo->m_ulUnicodeRange2);
NSBinarySerialize::Write<UINT>(pBuffer, pInfo->m_ulUnicodeRange3);
NSBinarySerialize::Write<UINT>(pBuffer, pInfo->m_ulUnicodeRange4);
NSBinarySerialize::Write<UINT>(pBuffer, pInfo->m_ulCodePageRange1);
NSBinarySerialize::Write<UINT>(pBuffer, pInfo->m_ulCodePageRange2);
NSBinarySerialize::Write<USHORT>(pBuffer, pInfo->m_usWeigth);
NSBinarySerialize::Write<USHORT>(pBuffer, pInfo->m_usWidth);
@ -445,7 +445,7 @@ namespace NSCharsets
return 0;
}
static void GetCodePageByCharset(unsigned char unCharset, unsigned long *pulBit, unsigned int *punLongIndex)
static void GetCodePageByCharset(unsigned char unCharset, unsigned int *pulBit, unsigned int *punLongIndex)
{
// Данная функция возвращает параметры, которые нужно посылать на вход
// функции AVSFontManager::IsUnicodeRangeAvailable
@ -561,19 +561,19 @@ std::wstring CFontList::GetFontBySymbol(int symbol)
}
///////////////////////////////////////////////////////////////////////////////////
int CFontList::GetCharsetPenalty(ULONG ulCandRanges[6], unsigned char unReqCharset)
int CFontList::GetCharsetPenalty(UINT ulCandRanges[6], unsigned char unReqCharset)
{
// Penalty = 65000 (это самый весомый параметр)
if ( UNKNOWN_CHARSET == unReqCharset )
return 0;
unsigned long ulBit = 0;
unsigned int ulBit = 0;
unsigned int unLongIndex = 0;
NSCharsets::GetCodePageByCharset( unReqCharset, &ulBit, &unLongIndex );
int nMult = 1;
for ( int nIndex = 0; nIndex < (int)ulBit; nIndex++ )
unsigned int nMult = 1;
for ( unsigned int nIndex = 0; nIndex < ulBit; nIndex++ )
nMult <<= 1;
if ( !(ulCandRanges[unLongIndex] & nMult) )
@ -581,56 +581,41 @@ int CFontList::GetCharsetPenalty(ULONG ulCandRanges[6], unsigned char unReqChars
return 0;
}
int CFontList::GetSigPenalty(ULONG ulCandRanges[6], ULONG ulReqRanges[6], double dRangeWeight, double dRangeWeightSuferflouous)
int CFontList::GetSigPenalty(UINT ulCandRanges[6], UINT ulReqRanges[6], double dRangeWeight, double dRangeWeightSuferflouous)
{
double dPenalty = 0;
// Для начала просматриваем сколько вообще различных пространств надо.
// Исходя из их общего количества, находим вес 1 пропущеного пространства.
unsigned char arrCandidate[192], arrRequest[192];
memset( arrCandidate, 0x00, 192 );
memset( arrRequest, 0x00, 192 );
bool isSuferflouous = (dRangeWeightSuferflouous < 1) ? false : true;
int nRangesCount = 0;
for ( int nIndex = 0; nIndex < 6; nIndex++ )
{
UINT nBit = 1;
UINT first = ulReqRanges[nIndex];
UINT second = ulReqRanges[nIndex];
for ( int bit = 0; bit < 32; ++bit, nBit <<= 1 )
{
if (first & nBit)
{
++nRangesCount;
if (!(second & nBit))
dPenalty += dRangeWeight;
}
int nRangesCount = 0; // Количество необходимых пространств
int nAddCount = 0; // количество дополнительных(ненужных) пространств у кандидата
if (isSuferflouous)
{
if (!(first & nBit) && (second & nBit))
dPenalty += dRangeWeightSuferflouous;
}
}
}
for ( int nIndex = 0; nIndex < 6; nIndex++ )
{
for ( unsigned long nBitCount = 0, nBit = 1; nBitCount < 32; nBitCount++, nBit *= 2 )
{
INT bReqAdd = FALSE;
if (!nRangesCount)
return 0;
if ( ulReqRanges[nIndex] & nBit )
{
arrRequest[ nIndex * 32 + nBitCount ] = 1;
nRangesCount++;
bReqAdd = TRUE;
}
if ( ulCandRanges[nIndex] & nBit )
{
arrCandidate[ nIndex * 32 + nBitCount ] = 1;
if ( !bReqAdd )
nAddCount++;
}
}
}
if ( 0 == nRangesCount )
return 0;
//double dRangeWeight = 1;//1000.0 / nRangesCount;
for ( int nIndex = 0; nIndex < 192; nIndex++ )
{
if ( 1 == arrRequest[nIndex] && 0 == arrCandidate[nIndex] )
dPenalty += dRangeWeight;
else if ( dRangeWeightSuferflouous != 0 && 0 == arrRequest[nIndex] && 1 == arrCandidate[nIndex] )
dPenalty += dRangeWeightSuferflouous;
}
return (int)dPenalty;
return (int)dPenalty;
}
int CFontList::GetFixedPitchPenalty(INT bCandFixed, INT bReqFixed)
{
@ -658,10 +643,11 @@ int CFontList::GetFaceNamePenalty(const std::wstring& sCandName, const std::wstr
if ( sReqName == sCandName )
return 0;
if (CFontListNamePicker::IsEqualsFontsAdvanced(sCandName, sReqName))
bool bIsOneInAnother = false;
if (CFontListNamePicker::IsEqualsFontsAdvanced(sCandName, sReqName, &bIsOneInAnother))
return 100;
if ( std::wstring::npos != sReqName.find( sCandName ) || std::wstring::npos != sCandName.find( sReqName ) )
if (bIsOneInAnother)
{
if (m_oPicker.IsLikeFonts(sCandName, sReqName))
return 700;
@ -1019,7 +1005,7 @@ NSFonts::CFontInfo* CFontList::GetByParams(NSFonts::CFontSelectFormat& oSelect,
nCurPenalty += GetPanosePenalty( pInfo->m_aPanose, oSelect.pPanose );
}
ULONG arrCandRanges[6] = { pInfo->m_ulUnicodeRange1, pInfo->m_ulUnicodeRange2, pInfo->m_ulUnicodeRange3, pInfo->m_ulUnicodeRange4, pInfo->m_ulCodePageRange1, pInfo->m_ulCodePageRange2 };
UINT arrCandRanges[6] = { pInfo->m_ulUnicodeRange1, pInfo->m_ulUnicodeRange2, pInfo->m_ulUnicodeRange3, pInfo->m_ulUnicodeRange4, pInfo->m_ulCodePageRange1, pInfo->m_ulCodePageRange2 };
if (true)
{
@ -1030,7 +1016,7 @@ NSFonts::CFontInfo* CFontList::GetByParams(NSFonts::CFontSelectFormat& oSelect,
NULL != oSelect.ulCodeRange1 &&
NULL != oSelect.ulCodeRange2)
{
ULONG arrReqRanges[6] = { *oSelect.ulRange1, *oSelect.ulRange2, *oSelect.ulRange3, *oSelect.ulRange4, *oSelect.ulCodeRange1, *oSelect.ulCodeRange2 };
UINT arrReqRanges[6] = { *oSelect.ulRange1, *oSelect.ulRange2, *oSelect.ulRange3, *oSelect.ulRange4, *oSelect.ulCodeRange1, *oSelect.ulCodeRange2 };
nCurPenalty += GetSigPenalty( arrCandRanges, arrReqRanges, nCurPenalty >= 1000 ? 50 : 10, 10 );
}
}

View File

@ -155,32 +155,24 @@ public:
int lenName = (int)name.length();
int lenReq = (int)req.length();
const wchar_t* pName = name.c_str();
const wchar_t* pReq = req.c_str();
if (lenName == lenReq)
{
const wchar_t* name_str = name.c_str();
const wchar_t* req_str = req.c_str();
int i = 0;
wchar_t nameChar = 0;
wchar_t reqChar = 0;
while (i < lenName)
{
wchar_t mem1 = *pName++;
wchar_t mem2 = *pReq++;
if (mem1 == mem2)
{
++i;
continue;
}
if (mem1 >= 'A' && mem1 <= 'Z' && (mem1 + 'a' - 'A') == mem2)
{
++i;
continue;
}
if (mem2 >= 'A' && mem2 <= 'Z' && (mem2 + 'a' - 'A') == mem1)
{
++i;
continue;
}
break;
nameChar = *name_str++;
reqChar = *req_str++;
if (nameChar >= 'A' && nameChar <= 'Z')
nameChar += ('a' - 'A');
if (reqChar >= 'A' && reqChar <= 'Z')
reqChar += ('a' - 'A');
if (nameChar != reqChar)
break;
}
if (i == lenName)
return 1500;
@ -189,61 +181,56 @@ public:
return IsEqualsFontsAdvanced(name, req) ? 3000 : 10000;
}
static bool IsEqualsFontsAdvanced(const std::wstring& name, const std::wstring& req)
// не учитываем регистр (латиница) и знаки /-/ /,/
static bool IsEqualsFontsAdvanced(const std::wstring& name, const std::wstring& req, bool* bIsOneInAnother = NULL)
{
int lenName = (int)name.length();
int lenReq = (int)req.length();
const wchar_t* pName = name.c_str();
const wchar_t* pReq = req.c_str();
const wchar_t* name_str = name.c_str();
const wchar_t* req_str = req.c_str();
pName = name.c_str();
pReq = req.c_str();
int curName = 0;
int curReq = 0;
wchar_t* pNameD = new wchar_t[lenName]; int nLenName = 0;
wchar_t* pReqD = new wchar_t[lenReq]; int nLenReq = 0;
for (int i = 0; i < lenName; ++i)
wchar_t curNameChar = 0;
wchar_t curReqChar = 0;
while (true)
{
wchar_t mem = *pName++;
if (mem == '-' || mem == ' ' || mem == ',')
continue;
if (mem >= 'A' && mem <= 'Z')
mem += ('a' - 'A');
pNameD[nLenName++] = mem;
}
for (int i = 0; i < lenReq; ++i)
{
wchar_t mem = *pReq++;
if (mem == '-' || mem == ' ' || mem == ',')
continue;
if (mem >= 'A' && mem <= 'Z')
mem += ('a' - 'A');
pReqD[nLenReq++] = mem;
}
wchar_t* pNameDCur = pNameD;
wchar_t* pReqDCur = pReqD;
bool bIsEq = false;
if (nLenName == nLenReq)
{
int i = 0;
while (i < nLenName)
while (curName < lenName)
{
if (*pNameDCur++ != *pReqDCur++)
break;
++i;
curNameChar = *name_str++;
if (curNameChar == '-' || curNameChar == ' ' || curNameChar == ',')
++curName;
if (curNameChar >= 'A' && curNameChar <= 'Z')
curNameChar += ('a' - 'A');
break;
}
if (curName == lenName)
curNameChar = 0;
if (i == nLenName)
bIsEq = true;
while (curReq < lenReq)
{
curReqChar = *req_str++;
if (curReqChar == '-' || curReqChar == ' ' || curReqChar == ',')
++curReq;
if (curReqChar >= 'A' && curReqChar <= 'Z')
curReqChar += ('a' - 'A');
break;
}
if (curReq == lenReq)
curReqChar = 0;
if (curNameChar != curReqChar)
{
if (bIsOneInAnother)
*bIsOneInAnother = (0 == curNameChar || 0 == curReqChar) ? true : false;
return false;
}
}
delete [] pNameD;
delete [] pReqD;
return bIsEq;
return true;
}
};
@ -281,8 +268,8 @@ public:
virtual std::vector<NSFonts::CFontInfo*>* GetFonts() { return &m_pList; }
private:
int GetCharsetPenalty(ULONG ulCandRanges[6], unsigned char unReqCharset);
int GetSigPenalty(ULONG ulCandRanges[6], ULONG ulReqRanges[6], double dRangeWeight = 1, double dRangeWeightSuferflouous = 0);
int GetCharsetPenalty(UINT ulCandRanges[6], unsigned char unReqCharset);
int GetSigPenalty(UINT ulCandRanges[6], UINT ulReqRanges[6], double dRangeWeight = 1, double dRangeWeightSuferflouous = 0);
int GetFixedPitchPenalty(INT bCandFixed, INT bReqFixed);
int GetFaceNamePenalty(const std::wstring& sCandName, const std::wstring& sReqName, bool bIsUseNamePicker = false);
int GetFaceNamePenalty2(NSFonts::CFontInfo* pInfo, const std::wstring& sReqName, bool bIsUseNamePicker = false);

File diff suppressed because it is too large Load Diff

View File

@ -36,21 +36,49 @@
#include <vector>
#include "../graphics/pro/Fonts.h"
class CApplicationFontsWorkerBreaker
{
public:
virtual bool IsFontsWorkerRunned() { return true; }
};
class CApplicationFontsWorker_private;
class GRAPHICS_DECL CApplicationFontsWorker
{
public:
// использовать ли системные шрифты
bool m_bIsUseSystemFonts;
// дополнительные папки с шрифтами
std::vector<std::wstring> m_arAdditionalFolders;
// рабоча директория (сюда скидываем все артефакты)
std::wstring m_sDirectory;
bool m_bIsNeedThumbnails;
// поддерживать ли opentype шрифты
bool m_bIsUseOpenType;
// поддерживать ли все версии AllFonts.js
bool m_bIsUseAllVersions;
// нужны ли табнейлы
bool m_bIsNeedThumbnails;
// генерим табнейлы отдельно
bool m_bSeparateThumbnails;
// какие масштабы нудны для табнейлов
std::vector<double> m_arThumbnailsScales;
private:
CApplicationFontsWorker_private* m_pInternal;
public:
CApplicationFontsWorker();
~CApplicationFontsWorker();
NSFonts::IApplicationFonts* Check();
void CheckThumbnails();
void SetBreaker(CApplicationFontsWorkerBreaker* pChecker);
std::string GetAllFonts();
static std::vector<std::wstring> GetFontNames(NSFonts::IApplicationFonts* pFonts);

File diff suppressed because it is too large Load Diff

View File

@ -1,194 +0,0 @@
/*
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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-12 Ernesta Birznieka-Upisha
* 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 APPLICATION_GENERATE_FONTS_COMMON_H
#define APPLICATION_GENERATE_FONTS_COMMON_H
#include "../common/File.h"
#include "../common/Directory.h"
#include "../common/StringBuilder.h"
namespace NSCommon
{
static void string_replace(std::wstring& text, const std::wstring& replaceFrom, const std::wstring& replaceTo)
{
size_t posn = 0;
while (std::wstring::npos != (posn = text.find(replaceFrom, posn)))
{
text.replace(posn, replaceFrom.length(), replaceTo);
posn += replaceTo.length();
}
}
static void string_replaceA(std::string& text, const std::string& replaceFrom, const std::string& replaceTo)
{
size_t posn = 0;
while (std::string::npos != (posn = text.find(replaceFrom, posn)))
{
text.replace(posn, replaceFrom.length(), replaceTo);
posn += replaceTo.length();
}
}
static void url_correct(std::wstring& url)
{
string_replace(url, L"/./", L"/");
size_t posn = 0;
while (std::wstring::npos != (posn = url.find(L"/../")))
{
std::wstring::size_type pos2 = url.rfind(L"/", posn - 1);
if (std::wstring::npos != pos2)
{
url.erase(pos2, posn - pos2 + 3);
}
}
// MAC
if (0 == url.find(L"file:/") && 0 != url.find(L"file://"))
{
url.replace(0, 6, L"file:///");
}
}
static void makeUpper(std::string& url)
{
int nLen = (int)url.length();
char* pStr = (char*)url.c_str();
for (int i = 0; i < nLen; ++i)
{
if (pStr[i] >= 'a' && pStr[i] <= 'z')
pStr[i] = pStr[i] + 'A' - 'a';
}
}
static void makeUpperW(std::wstring& url)
{
int nLen = (int)url.length();
wchar_t* pStr = (wchar_t*)url.c_str();
for (int i = 0; i < nLen; ++i)
{
if (pStr[i] >= 'a' && pStr[i] <= 'z')
pStr[i] = pStr[i] + 'A' - 'a';
}
}
static void makeLower(std::string& url)
{
int nLen = (int)url.length();
char* pStr = (char*)url.c_str();
for (int i = 0; i < nLen; ++i)
{
if (pStr[i] >= 'A' && pStr[i] <= 'Z')
pStr[i] = pStr[i] + 'a' - 'A';
}
}
static void makeLowerW(std::wstring& url)
{
int nLen = (int)url.length();
wchar_t* pStr = (wchar_t*)url.c_str();
for (int i = 0; i < nLen; ++i)
{
if (pStr[i] >= 'A' && pStr[i] <= 'Z')
pStr[i] = pStr[i] + 'a' - 'A';
}
}
static void WriteLog(const std::string& sLogFile, const std::wstring& sData)
{
FILE* f = fopen(sLogFile.c_str(), "a+");
std::string sDataA = U_TO_UTF8(sData);
fprintf(f, sDataA.c_str());
fprintf(f, "\n");
fclose(f);
}
}
namespace NSCommon
{
static std::wstring GetFileExtention(const std::wstring& sPath)
{
std::wstring::size_type nPos = sPath.rfind('.');
if (nPos != std::wstring::npos)
return sPath.substr(nPos + 1);
return sPath;
}
static std::wstring GetFileName(const std::wstring& sPath)
{
#ifdef _WIN32
std::wstring::size_type nPos1 = sPath.rfind('\\');
#else
std::wstring::size_type nPos1 = std::wstring::npos;
#endif
std::wstring::size_type nPos2 = sPath.rfind('/');
std::wstring::size_type nPos = std::wstring::npos;
if (nPos1 != std::wstring::npos)
{
nPos = nPos1;
if (nPos2 != std::wstring::npos && nPos2 > nPos)
nPos = nPos2;
}
else
nPos = nPos2;
if (nPos == std::wstring::npos)
return sPath;
return sPath.substr(nPos + 1);
}
static std::wstring GetDirectoryName(const std::wstring& sPath)
{
#ifdef _WIN32
std::wstring::size_type nPos1 = sPath.rfind('\\');
#else
std::wstring::size_type nPos1 = std::wstring::npos;
#endif
std::wstring::size_type nPos2 = sPath.rfind('/');
std::wstring::size_type nPos = std::wstring::npos;
if (nPos1 != std::wstring::npos)
{
nPos = nPos1;
if (nPos2 != std::wstring::npos && nPos2 > nPos)
nPos = nPos2;
}
else
nPos = nPos2;
if (nPos == std::wstring::npos)
return sPath;
return sPath.substr(0, nPos);
}
}
#endif // APPLICATION_GENERATE_FONTS_COMMON_H

View File

@ -281,12 +281,12 @@ namespace NSFontDictionary
memcpy(oFormat.pPanose, pFont->m_aPanose, 10);
// ranges
oFormat.ulRange1 = new ULONG(pFont->m_ulUnicodeRange1);
oFormat.ulRange2 = new ULONG(pFont->m_ulUnicodeRange2);
oFormat.ulRange3 = new ULONG(pFont->m_ulUnicodeRange3);
oFormat.ulRange4 = new ULONG(pFont->m_ulUnicodeRange4);
oFormat.ulCodeRange1 = new ULONG(pFont->m_ulCodePageRange1);
oFormat.ulCodeRange2 = new ULONG(pFont->m_ulCodePageRange2);
oFormat.ulRange1 = new UINT(pFont->m_ulUnicodeRange1);
oFormat.ulRange2 = new UINT(pFont->m_ulUnicodeRange2);
oFormat.ulRange3 = new UINT(pFont->m_ulUnicodeRange3);
oFormat.ulRange4 = new UINT(pFont->m_ulUnicodeRange4);
oFormat.ulCodeRange1 = new UINT(pFont->m_ulCodePageRange1);
oFormat.ulCodeRange2 = new UINT(pFont->m_ulCodePageRange2);
oFormat.usWeight = new USHORT(pFont->m_usWeigth);
oFormat.usWidth = new USHORT(pFont->m_usWidth);

View File

@ -99,12 +99,12 @@ namespace NSFonts
BYTE* pPanose;
ULONG* ulRange1;
ULONG* ulRange2;
ULONG* ulRange3;
ULONG* ulRange4;
ULONG* ulCodeRange1;
ULONG* ulCodeRange2;
UINT* ulRange1;
UINT* ulRange2;
UINT* ulRange3;
UINT* ulRange4;
UINT* ulCodeRange1;
UINT* ulCodeRange2;
USHORT* usWeight;
USHORT* usWidth;
@ -190,17 +190,17 @@ namespace NSFonts
}
if (NULL != ulRange1)
oFormat.ulRange1 = new ULONG(*ulRange1);
oFormat.ulRange1 = new UINT(*ulRange1);
if (NULL != ulRange2)
oFormat.ulRange2 = new ULONG(*ulRange2);
oFormat.ulRange2 = new UINT(*ulRange2);
if (NULL != ulRange3)
oFormat.ulRange3 = new ULONG(*ulRange3);
oFormat.ulRange3 = new UINT(*ulRange3);
if (NULL != ulRange4)
oFormat.ulRange4 = new ULONG(*ulRange4);
oFormat.ulRange4 = new UINT(*ulRange4);
if (NULL != ulCodeRange1)
oFormat.ulCodeRange1 = new ULONG(*ulCodeRange1);
oFormat.ulCodeRange1 = new UINT(*ulCodeRange1);
if (NULL != ulCodeRange2)
oFormat.ulCodeRange2 = new ULONG(*ulCodeRange2);
oFormat.ulCodeRange2 = new UINT(*ulCodeRange2);
if (NULL != usWeight)
oFormat.usWeight = new USHORT(*usWeight);
@ -277,12 +277,12 @@ namespace NSFonts
INT bItalic,
INT bFixedWidth,
BYTE *pPanose,
ULONG ulRange1,
ULONG ulRange2,
ULONG ulRange3,
ULONG ulRange4,
ULONG ulCodeRange1,
ULONG ulCodeRange2,
UINT ulRange1,
UINT ulRange2,
UINT ulRange3,
UINT ulRange4,
UINT ulCodeRange1,
UINT ulCodeRange2,
USHORT usWeigth,
USHORT usWidth,
SHORT sFamilyClass,
@ -353,14 +353,14 @@ namespace NSFonts
INT m_bItalic; // Italic text
INT m_bIsFixed; // Моноширинный шрифт?
BYTE m_aPanose[10];
ULONG m_ulUnicodeRange1; // Bits 0-31
ULONG m_ulUnicodeRange2; // Bits 32-63
ULONG m_ulUnicodeRange3; // Bits 64-95
ULONG m_ulUnicodeRange4; // Bits 96-127
BYTE m_aPanose[10];
UINT m_ulUnicodeRange1; // Bits 0-31
UINT m_ulUnicodeRange2; // Bits 32-63
UINT m_ulUnicodeRange3; // Bits 64-95
UINT m_ulUnicodeRange4; // Bits 96-127
ULONG m_ulCodePageRange1; // Bits 0-31
ULONG m_ulCodePageRange2; // Bits 32-63
UINT m_ulCodePageRange1; // Bits 0-31
UINT m_ulCodePageRange2; // Bits 32-63
USHORT m_usWeigth;
USHORT m_usWidth;

View File

@ -53,7 +53,7 @@ namespace NSHtmlRenderer
std::wstring m_strFamilyName;
BYTE m_strPANOSE[10];
LONG m_lStyle;
std::vector<DWORD> m_arSignature;
std::vector<UINT> m_arSignature;
bool m_bIsFixedWidth;
LONG m_lAvgWidth;
@ -456,7 +456,7 @@ namespace NSHtmlRenderer
for ( unsigned int i = 0; i < 6; i++ )
{
DWORD value = 0;
UINT value = 0;
for ( unsigned long bit = 0; bit < 32; bit++ )
{
@ -476,7 +476,7 @@ namespace NSHtmlRenderer
std::wstring sExt;
std::wstring sEncodingPath;
int nFindExt = m_oFont.m_oFont.Path.find_last_of((wchar_t)'.');
std::wstring::size_type nFindExt = m_oFont.m_oFont.Path.find_last_of((wchar_t)'.');
if (nFindExt == std::wstring::npos)
{
sEncodingPath = m_oFont.m_oFont.Path + L".enc";
@ -1435,7 +1435,7 @@ namespace NSHtmlRenderer
}
}
}
inline void CheckRanges(DWORD& lRange1, DWORD& lRange2, DWORD& lRange3, DWORD& lRange4, BYTE& lRangeNum, BYTE& lRange)
inline void CheckRanges(UINT& lRange1, UINT& lRange2, UINT& lRange3, UINT& lRange4, BYTE& lRangeNum, BYTE& lRange)
{
if (0 == lRangeNum)
lRange1 |= 1 << lRange;
@ -1524,16 +1524,16 @@ namespace NSHtmlRenderer
oPick.m_lPickStyle = m_oFont.m_oProperties.m_lStyle;
LONG lCountSigs = (LONG)m_oFont.m_oProperties.m_arSignature.size();
DWORD dwR1 = 0;
UINT dwR1 = 0;
if (0 < lCountSigs)
dwR1 = m_oFont.m_oProperties.m_arSignature[0];
DWORD dwR2 = 0;
UINT dwR2 = 0;
if (1 < lCountSigs)
dwR2 = m_oFont.m_oProperties.m_arSignature[1];
DWORD dwR3 = 0;
UINT dwR3 = 0;
if (2 < lCountSigs)
dwR3 = m_oFont.m_oProperties.m_arSignature[2];
DWORD dwR4 = 0;
UINT dwR4 = 0;
if (3 < lCountSigs)
dwR4 = m_oFont.m_oProperties.m_arSignature[3];
@ -1566,17 +1566,17 @@ namespace NSHtmlRenderer
oFormat.bFixedWidth = new INT(m_oFont.m_oProperties.m_bIsFixedWidth ? 1 : 0);
if (0 != dwR1)
oFormat.ulRange1 = new ULONG(dwR1);
oFormat.ulRange1 = new UINT(dwR1);
if (0 != dwR2)
oFormat.ulRange2 = new ULONG(dwR2);
oFormat.ulRange2 = new UINT(dwR2);
if (0 != dwR3)
oFormat.ulRange3 = new ULONG(dwR3);
oFormat.ulRange3 = new UINT(dwR3);
if (0 != dwR4)
oFormat.ulRange4 = new ULONG(dwR4);
oFormat.ulRange4 = new UINT(dwR4);
if (0 != dwCodePage1)
oFormat.ulCodeRange1 = new ULONG(dwCodePage1);
oFormat.ulCodeRange1 = new UINT(dwCodePage1);
if (0 != dwCodePage2)
oFormat.ulCodeRange2 = new ULONG(dwCodePage2);
oFormat.ulCodeRange2 = new UINT(dwCodePage2);
NSFonts::CFontInfo* pInfo = m_pManager->GetFontInfoByParams(oFormat);
oPick.m_strPickFont = pInfo->m_wsFontName;

View File

@ -861,8 +861,10 @@ void ECMAWriteProtect::Generate()
RandomPool prng;
SecByteBlock seed_salt(16);
OS_GenerateRandomBlock(false, seed_salt, seed_salt.size());
prng.IncorporateEntropy(seed_salt, seed_salt.size());
if (prng.CanIncorporateEntropy())
{
prng.IncorporateEntropy(seed_salt, seed_salt.size());
}
_buf pPassword (password);
_buf empty (NULL, 0, false);
_buf pSalt (seed_salt.data(), seed_salt.size());
@ -933,21 +935,30 @@ void ECMAEncryptor::SetPassword(std::wstring _password)
//сгенерить соль
SecByteBlock seed_salt(cryptData.saltSize);
OS_GenerateRandomBlock(false, seed_salt, seed_salt.size());
prng.IncorporateEntropy(seed_salt, seed_salt.size());
if (prng.CanIncorporateEntropy())
{
prng.IncorporateEntropy(seed_salt, seed_salt.size());
}
SecByteBlock seed_datasalt(cryptData.saltSize);
OS_GenerateRandomBlock(false, seed_datasalt, seed_datasalt.size());
prng.IncorporateEntropy(seed_datasalt, seed_datasalt.size());
if (prng.CanIncorporateEntropy())
{
prng.IncorporateEntropy(seed_datasalt, seed_datasalt.size());
}
//сгенерить ключ
SecByteBlock seed_key(cryptData.keySize);
OS_GenerateRandomBlock(false, seed_key, seed_key.size());
prng.IncorporateEntropy(seed_key, seed_key.size());
if (prng.CanIncorporateEntropy())
{
prng.IncorporateEntropy(seed_key, seed_key.size());
}
//сгенерить проверочный
SecByteBlock seed_verify(cryptData.saltSize);
OS_GenerateRandomBlock(false, seed_verify, seed_verify.size());
prng.IncorporateEntropy(seed_verify, seed_verify.size());
if (prng.CanIncorporateEntropy())
{
prng.IncorporateEntropy(seed_verify, seed_verify.size());
}
//---------
_buf pPassword (password);
_buf empty (NULL, 0, false);
@ -1344,8 +1355,10 @@ void ODFEncryptor::SetCryptData(_odfCryptData &data)
{
SecByteBlock seed_salt(16);
OS_GenerateRandomBlock(false, seed_salt, seed_salt.size());
prng.IncorporateEntropy(seed_salt, seed_salt.size());
if (prng.CanIncorporateEntropy())
{
prng.IncorporateEntropy(seed_salt, seed_salt.size());
}
cryptData.saltValue = std::string((char*)seed_salt.data(), seed_salt.size());
}
@ -1353,8 +1366,10 @@ void ODFEncryptor::SetCryptData(_odfCryptData &data)
{
SecByteBlock start_vector(16);
OS_GenerateRandomBlock(false, start_vector, start_vector.size());
prng.IncorporateEntropy(start_vector, start_vector.size());
if (prng.CanIncorporateEntropy())
{
prng.IncorporateEntropy(start_vector, start_vector.size());
}
cryptData.initializationVector = std::string((char*)start_vector.data(), start_vector.size());
}
}

View File

@ -8,17 +8,19 @@
#include "../../../DesktopEditor/common/File.h"
#include "../../../DesktopEditor/common/Directory.h"
#include "../../../DesktopEditor/common/StringBuilder.h"
#include "../../../DesktopEditor/raster/BgraFrame.h"
#include "../../../DesktopEditor/fontengine/ApplicationFontsWorker.h"
#include "../../../OfficeUtils/src/OfficeUtils.h"
#include "../../../DesktopEditor/fontengine/application_generate_fonts.h"
#ifdef LINUX
#include <unistd.h>
#include <sys/wait.h>
#include <stdio.h>
#endif
#include <map>
class CConverter;
class CInternalWorker
{
@ -111,7 +113,7 @@ namespace NSX2T
std::wstring sConverterExe = sConverterPath;
#ifdef WIN32
NSCommon::string_replace(sConverterExe, L"/", L"\\");
NSStringUtils::string_replace(sConverterExe, L"/", L"\\");
sConverterExe += L".exe";
std::wstring sApp = L"x2t ";
@ -289,14 +291,14 @@ public:
std::wstring sProcess = NSFile::GetProcessDirectory();
NSCommon::string_replace(sProcess, L"\\", L"/");
NSCommon::string_replace(m_file, L"\\", L"/");
NSStringUtils::string_replace(sProcess, L"\\", L"/");
NSStringUtils::string_replace(m_file, L"\\", L"/");
std::wstring sDirectoryDst = m_folder_dst;
NSCommon::string_replace(sDirectoryDst, L"\\", L"/");
NSStringUtils::string_replace(sDirectoryDst, L"\\", L"/");
#ifdef WIN32
NSCommon::string_replace(m_file, L"//", L"\\\\");
NSStringUtils::string_replace(m_file, L"//", L"\\\\");
#endif
NSDirectory::CreateDirectory(sDirectoryDst);
@ -321,6 +323,7 @@ public:
oBuilder.WriteString(L"</m_sFontDir>");
oBuilder.WriteString(L"<m_oThumbnail><format>4</format><aspect>2</aspect><first>false</first><width>1000</width><height>1000</height></m_oThumbnail>");
oBuilder.WriteString(L"<m_sJsonParams>{&quot;spreadsheetLayout&quot;:{&quot;gridLines&quot;:true,&quot;headings&quot;:true,&quot;fitToHeight&quot;:1,&quot;fitToWidth&quot;:1,&quot;orientation&quot;:&quot;landscape&quot;}}</m_sJsonParams>");
oBuilder.WriteString(L"</TaskQueueDataConvert>");
@ -644,133 +647,22 @@ void CInternalWorker::Cancel()
m_nCount = m_nCurrent;
}
#define ONLYOFFICE_FONTS_VERSION_ 1
void CheckFonts(const bool& bIsUseSystemFonts, std::vector<std::wstring>& arDirs)
{
std::vector<std::string> strFonts;
std::wstring strDirectory = NSFile::GetProcessDirectory() + L"/fonts";
CApplicationFontsWorker oWorker;
oWorker.m_sDirectory = NSFile::GetProcessDirectory() + L"/fonts";
if (!NSDirectory::Exists(oWorker.m_sDirectory))
NSDirectory::CreateDirectory(oWorker.m_sDirectory);
if (!NSDirectory::Exists(strDirectory))
NSDirectory::CreateDirectory(strDirectory);
std::wstring strAllFontsJSPath = strDirectory + L"/AllFonts.js";
std::wstring strThumbnailsFolder = strDirectory;
std::wstring strFontsSelectionBin = strDirectory + L"/font_selection.bin";
if (true)
{
NSFile::CFileBinary oFile;
if (oFile.OpenFile(strDirectory + L"/fonts.log"))
{
int nSize = oFile.GetFileSize();
char* pBuffer = new char[nSize];
DWORD dwReaden = 0;
oFile.ReadFile((BYTE*)pBuffer, nSize, dwReaden);
oFile.CloseFile();
int nStart = 0;
int nCur = nStart;
for (; nCur < nSize; ++nCur)
{
if (pBuffer[nCur] == '\n')
{
int nEnd = nCur - 1;
if (nEnd > nStart)
{
std::string s(pBuffer + nStart, nEnd - nStart + 1);
strFonts.push_back(s);
}
nStart = nCur + 1;
}
}
delete[] pBuffer;
}
if (0 != strFonts.size())
{
// check version!!!
std::string sOO_Version = strFonts[0];
if (0 != sOO_Version.find("ONLYOFFICE_FONTS_VERSION_"))
{
strFonts.clear();
}
else
{
std::string sVersion = sOO_Version.substr(25);
int nVersion = std::stoi(sVersion);
if (nVersion != ONLYOFFICE_FONTS_VERSION_)
strFonts.clear();
else
strFonts.erase(strFonts.begin());
}
}
}
NSFonts::IApplicationFonts* oApplicationF = NSFonts::NSApplication::Create();
std::vector<std::wstring> strFontsW_Cur;
if (bIsUseSystemFonts)
strFontsW_Cur = oApplicationF->GetSetupFontFiles();
oWorker.m_bIsUseSystemFonts = bIsUseSystemFonts;
for (std::vector<std::wstring>::iterator i = arDirs.begin(); i != arDirs.end(); i++)
{
NSDirectory::GetFiles2(*i, strFontsW_Cur, true);
}
oWorker.m_arAdditionalFolders.push_back(*i);
bool bIsEqual = true;
if (strFonts.size() != strFontsW_Cur.size())
bIsEqual = false;
if (bIsEqual)
{
int nCount = (int)strFonts.size();
for (int i = 0; i < nCount; ++i)
{
if (strFonts[i] != NSFile::CUtf8Converter::GetUtf8StringFromUnicode2(strFontsW_Cur[i].c_str(), strFontsW_Cur[i].length()))
{
bIsEqual = false;
break;
}
}
}
if (bIsEqual)
{
if (!NSFile::CFileBinary::Exists(strFontsSelectionBin))
bIsEqual = false;
}
if (!bIsEqual)
{
if (NSFile::CFileBinary::Exists(strAllFontsJSPath))
NSFile::CFileBinary::Remove(strAllFontsJSPath);
if (NSFile::CFileBinary::Exists(strFontsSelectionBin))
NSFile::CFileBinary::Remove(strFontsSelectionBin);
if (strFonts.size() != 0)
NSFile::CFileBinary::Remove(strDirectory + L"/fonts.log");
NSFile::CFileBinary oFile;
oFile.CreateFileW(strDirectory + L"/fonts.log");
oFile.WriteStringUTF8(L"ONLYOFFICE_FONTS_VERSION_");
oFile.WriteStringUTF8(std::to_wstring(ONLYOFFICE_FONTS_VERSION_));
oFile.WriteFile((BYTE*)"\n", 1);
int nCount = (int)strFontsW_Cur.size();
for (int i = 0; i < nCount; ++i)
{
oFile.WriteStringUTF8(strFontsW_Cur[i]);
oFile.WriteFile((BYTE*)"\n", 1);
}
oFile.CloseFile();
int nFlag = 3;
oApplicationF->InitializeFromArrayFiles(strFontsW_Cur, nFlag);
NSCommon::SaveAllFontsJS(oApplicationF, strAllFontsJSPath, strThumbnailsFolder, strFontsSelectionBin);
}
oApplicationF->Release();
oWorker.m_bIsNeedThumbnails = false;
NSFonts::IApplicationFonts* pFonts = oWorker.Check();
if (pFonts)
pFonts->Release();
}
std::wstring CorrectDir(const std::wstring& sDir)

View File

@ -1,157 +0,0 @@
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
android {
buildToolsVersion '30.0.3'
compileSdkVersion 30
ndkVersion = NDK_VERSION
defaultConfig {
minSdkVersion 23
targetSdkVersion 30
versionCode 1
versionName '1.0'
buildConfigField "String", "LIB_X2T", "\"$NAME_LIB\""
externalNativeBuild {
cmake {
arguments "-DANDROID_TOOLCHAIN=clang",
"-DANDROID_STL=c++_static",
"-DANDROID_ARM_NEON=TRUE",
"-DARG_PATH_LIB_BUILD_TOOLS=${getProjectPath(PATH_LIB_BUILD_TOOLS)}",
"-DARG_PATH_LIB_DST=${getProjectPath(PATH_LIB_DST, true)}",
"-DARG_PATH_SRC_CORE=${getProjectPath(PATH_SRC_CORE)}",
"-DARG_NAME_LIB=$NAME_LIB"
}
}
ndk {
abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
debuggable true
jniDebuggable true
}
}
sourceSets {
main {
java.srcDirs = [
"src/main/java"
]
jni.srcDirs = [
"src/main/cpp"
]
jniLibs.srcDirs = [
PATH_LIB_DST,
PATH_LIB_BUILD_TOOLS
]
}
}
externalNativeBuild {
cmake {
path "src/main/cpp/CMakeLists.txt"
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
packagingOptions {
['armeabi-v7a', 'x86' ,'arm64-v8a', 'x86_64' ].each { abi ->
def dh = file("$PATH_LIB_BUILD_TOOLS/$abi")
dh.eachFile {
if(it.getName().contains(".so"))
pickFirst "lib/$abi/${it.getName()}"
}
pickFirst "lib/$abi/lib${NAME_LIB}.so"
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "androidx.appcompat:appcompat:1.2.0"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
}
/*
* Check the path for existence,
* otherwise get the path relative to the current project,
* otherwise the error is in the path
* */
def getProjectPath(String path, Boolean isRelativeCreate = false) {
def absolutePath = file(path)
def relativePath = file("${file('.').absolutePath}/$path")
//def relativePath = file("${rootProject.projectDir}/path")
if (absolutePath.exists() && absolutePath.isDirectory()) {
return absolutePath.toString().replaceAll("\\\\", "/")
} else if ((relativePath.exists() && relativePath.isDirectory()) || (isRelativeCreate && relativePath.mkdirs())) {
return relativePath.toString().replaceAll("\\\\", "/")
}
throw new GradleException("getProjectPath($path) - path doesn't exist...")
}
task copyIcuDatFiles {
doLast {
println ""
println "------------------------- ICUDATFILES (task copyIcuDatFiles()) -------------------------"
def pathAssets = "${file('.').absolutePath}/src/main/assets/icu"
if (file(pathAssets).exists()) {
println "IcuDatFiles already exist."
println "Delete ${pathAssets} folder for update icuDatFiles."
return
}
if (!project.hasProperty('PATH_SRC_ICU_DAT_FILE')) {
throw new GradleException("Property PATH_SRC_ICU_DAT_FILE with core repository path doesn't exist...")
}
if (!project.hasProperty('PATH_SRC_ICU_V8_DAT_FILE')) {
throw new GradleException("Property PATH_SRC_ICU_V8_DAT_FILE with core repository path doesn't exist...")
}
def pathIcuDatFiles = PATH_SRC_ICU_DAT_FILE
def pathIcuV8DatFiles = PATH_SRC_ICU_V8_DAT_FILE
if (!file(pathIcuDatFiles).exists()) {
throw new GradleException("Path with core repository doesn't exist...")
}
if (!file(pathIcuV8DatFiles).exists()) {
throw new GradleException("Path with core repository doesn't exist...")
}
copy {
println "\nCopy dat files..."
eachFile { println it.file }
from pathIcuDatFiles, pathIcuV8DatFiles
into pathAssets
}
}
}
preBuild.dependsOn copyIcuDatFiles

View File

@ -0,0 +1,156 @@
import com.android.build.gradle.internal.tasks.factory.dependsOn
plugins {
id("com.android.library")
kotlin("android")
}
android {
buildToolsVersion("30.0.3")
compileSdkVersion(30)
ndkVersion = rootProject.extra.get("NDK_VERSION").toString()
defaultConfig {
minSdkVersion(23)
targetSdkVersion(30)
versionCode = 1
versionName = "1.0"
buildConfigField("String", "LIB_X2T", "\"${extra.get("NAME_LIB")}\"")
externalNativeBuild {
cmake {
arguments(
"-DANDROID_TOOLCHAIN=clang",
"-DANDROID_STL=c++_static",
"-DANDROID_ARM_NEON=TRUE",
"-DARG_PATH_LIB_BUILD_TOOLS=${getProjectPath(extra.get("PATH_LIB_BUILD_TOOLS") as String)}",
"-DARG_PATH_LIB_DST=${getProjectPath(extra.get("PATH_LIB_DST") as String, true)}",
"-DARG_PATH_SRC_CORE=${getProjectPath(extra.get("PATH_SRC_CORE") as String)}",
"-DARG_NAME_LIB=${extra.get("NAME_LIB")}"
)
}
}
ndk {
abiFilters.addAll(arrayOf("armeabi-v7a", "arm64-v8a", "x86", "x86_64"))
}
}
buildTypes {
getByName(AppDependency.BuildType.RELEASE) {
minifyEnabled(false)
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
}
getByName(AppDependency.BuildType.DEBUG) {
debuggable(true)
jniDebuggable(true)
}
}
sourceSets {
getByName("main") {
java.srcDir("src/main/java")
jni.srcDir("src/main/cpp")
jniLibs.srcDirs(
arrayOf(
extra.get("PATH_LIB_DST") as String,
extra.get("PATH_LIB_BUILD_TOOLS") as String
)
)
}
}
externalNativeBuild {
cmake {
path("src/main/cpp/CMakeLists.txt")
}
}
compileOptions {
sourceCompatibility(JavaVersion.VERSION_1_8)
targetCompatibility(JavaVersion.VERSION_1_8)
}
packagingOptions {
arrayOf("armeabi-v7a", "x86", "arm64-v8a", "x86_64").forEach { abi ->
val dh = file("${extra.get("PATH_LIB_BUILD_TOOLS")}/$abi")
dh.listFiles().forEach {
if (it.name.contains(".so"))
pickFirst("lib/$abi/${it.name}")
}
pickFirst("lib/$abi/lib${extra.get("NAME_LIB")}.so")
}
}
}
dependencies {
implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar"))))
implementation("androidx.appcompat:appcompat:1.3.0")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:${rootProject.extra.get("kotlin_version")}")
}
/*
* Check the path for existence,
* otherwise get the path relative to the current project,
* otherwise the error is in the path
* */
fun getProjectPath(path: String, isRelativeCreate: Boolean = true): String {
val absolutePath = file(path)
val relativePath = file("${file(".").absolutePath}/$path")
//def relativePath = file("${rootProject.projectDir}/path")
if (absolutePath.exists() && absolutePath.isDirectory) {
return absolutePath.toString().replace("\\\\", "/")
} else if ((relativePath.exists() && relativePath.isDirectory) || (isRelativeCreate && relativePath.mkdirs())) {
return relativePath.toString().replace("\\\\", "/")
}
throw GradleException("getProjectPath($path) - path doesn't exist...")
}
tasks.create("copyIcuDatFiles") {
doLast {
println()
println("------------------------- ICUDATFILES (task copyIcuDatFiles()) -------------------------")
val pathAssets = "${file(".").absolutePath}/src/main/assets/icu"
if (file(pathAssets).exists()) {
println("IcuDatFiles already exist.")
println("Delete $pathAssets folder for update icuDatFiles.")
}
if (!project.hasProperty("PATH_SRC_ICU_DAT_FILE")) {
throw GradleException("Property PATH_SRC_ICU_DAT_FILE with core repository path doesn't exist...")
}
if (!project.hasProperty("PATH_SRC_ICU_V8_DAT_FILE")) {
throw GradleException("Property PATH_SRC_ICU_V8_DAT_FILE with core repository path doesn't exist...")
}
val pathIcuDatFiles = project.extra.get("PATH_SRC_ICU_DAT_FILE") as String
val pathIcuV8DatFiles = project.extra.get("PATH_SRC_ICU_V8_DAT_FILE") as String
if (!file(pathIcuDatFiles).exists()) {
throw GradleException("Path with build_tools repository doesn't exist...")
}
if (!file(pathIcuV8DatFiles).exists()) {
throw GradleException("Path with core repository doesn't exist...")
}
copy {
println("\nCopy dat files...")
from(pathIcuDatFiles, pathIcuV8DatFiles)
into(pathAssets)
}
}
}
tasks.preBuild.dependsOn("copyIcuDatFiles")

View File

@ -12635,9 +12635,12 @@ namespace BinXlsxRW
WriteCT_StyleEntry(*oVal.m_oChartStyle.m_arStyleEntries[i]);
m_oBcw.WriteItemEnd(nCurPos);
}
int nCurPos = m_oBcw.WriteItemStart(c_oserct_chartstyleMARKERLAYOUT);
WriteCT_MarkerLayout(*oVal.m_oChartStyle.m_dataPointMarkerLayout);
m_oBcw.WriteItemEnd(nCurPos);
if (oVal.m_oChartStyle.m_dataPointMarkerLayout.IsInit())
{
int nCurPos = m_oBcw.WriteItemStart(c_oserct_chartstyleMARKERLAYOUT);
WriteCT_MarkerLayout(*oVal.m_oChartStyle.m_dataPointMarkerLayout);
m_oBcw.WriteItemEnd(nCurPos);
}
}
void BinaryChartWriter::WriteCT_StyleEntry(OOX::Spreadsheet::ChartEx::CStyleEntry & oVal)
{