Commit 95353e2b authored by Oleg.Korshul's avatar Oleg.Korshul Committed by Alexander Trofimov

возможность выставлять параметры из доктрендерера

saveas CROSSPLATFORM formats


git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@67487 954022d7-b5bf-4e40-9824-e11837661b57
parent 2cbf60ce
...@@ -10,6 +10,111 @@ ...@@ -10,6 +10,111 @@
#include <iostream> #include <iostream>
namespace NSDoctRenderer
{
class CExecuteParams
{
public:
DoctRendererFormat::FormatFile m_eSrcFormat;
DoctRendererFormat::FormatFile m_eDstFormat;
std::wstring m_strFontsDirectory;
std::wstring m_strImagesDirectory;
std::wstring m_strThemesDirectory;
std::wstring m_strSrcFilePath;
std::wstring m_strDstFilePath;
CArray<std::wstring> m_arChanges;
int m_nCountChangesItems;
std::wstring m_strMailMergeDatabasePath;
std::wstring m_strMailMergeField;
int m_nMailMergeIndexStart;
int m_nMailMergeIndexEnd;
bool m_bIsRetina;
public:
CExecuteParams() : m_arChanges()
{
m_eSrcFormat = DoctRendererFormat::INVALID;
m_eDstFormat = DoctRendererFormat::INVALID;
m_strFontsDirectory = L"";
m_strImagesDirectory = L"";
m_strThemesDirectory = L"";
m_strSrcFilePath = L"";
m_strDstFilePath = L"";
m_nCountChangesItems = -1;
m_strMailMergeDatabasePath = L"";
m_strMailMergeField = L"";
m_nMailMergeIndexStart = -1;
m_nMailMergeIndexEnd = -1;
m_bIsRetina = false;
}
~CExecuteParams()
{
m_arChanges.RemoveAll();
}
public:
bool FromXml(const std::wstring& strXml)
{
XmlUtils::CXmlNode oNode;
if (!oNode.FromXmlString(strXml))
return false;
m_strSrcFilePath = oNode.ReadValueString(L"SrcFilePath");
m_strDstFilePath = oNode.ReadValueString(L"DstFilePath");
m_eSrcFormat = (DoctRendererFormat::FormatFile)(oNode.ReadValueInt(L"SrcFileType"));
m_eDstFormat = (DoctRendererFormat::FormatFile)(oNode.ReadValueInt(L"DstFileType"));
m_strFontsDirectory = oNode.ReadValueString(L"FontsDirectory");
m_strImagesDirectory = oNode.ReadValueString(L"ImagesDirectory");
m_strThemesDirectory = oNode.ReadValueString(L"ThemesDirectory");
XmlUtils::CXmlNode oNodeChanges;
if (oNode.GetNode(L"Changes", oNodeChanges))
{
m_nCountChangesItems = oNodeChanges.ReadAttributeInt(L"TopItem", -1);
XmlUtils::CXmlNodes oNodes;
oNodeChanges.GetNodes(L"Change", oNodes);
int nCount = oNodes.GetCount();
for (int i = 0; i < nCount; ++i)
{
XmlUtils::CXmlNode _node;
oNodes.GetAt(i, _node);
m_arChanges.Add(_node.GetText());
}
}
XmlUtils::CXmlNode oNodeMailMerge;
if (oNode.GetNode(L"MailMergeData", oNodeMailMerge))
{
m_strMailMergeDatabasePath = oNodeMailMerge.ReadAttribute(L"DatabasePath");
m_nMailMergeIndexStart = oNodeMailMerge.ReadAttributeInt(L"Start", -1);
m_nMailMergeIndexEnd = oNodeMailMerge.ReadAttributeInt(L"End", -1);
m_strMailMergeField = oNodeMailMerge.ReadAttribute(L"Field");
}
int nParams = oNode.ReadValueInt(L"DoctParams", 0);
if (nParams & 0x01)
m_bIsRetina = true;
return true;
}
};
}
void CreateNativeObject(const v8::FunctionCallbackInfo<v8::Value>& args) void CreateNativeObject(const v8::FunctionCallbackInfo<v8::Value>& args)
{ {
v8::Isolate* isolate = v8::Isolate::GetCurrent(); v8::Isolate* isolate = v8::Isolate::GetCurrent();
...@@ -47,77 +152,7 @@ namespace NSDoctRenderer ...@@ -47,77 +152,7 @@ namespace NSDoctRenderer
start_pos += to.length(); start_pos += to.length();
} }
return str; return str;
} }
CExecuteParams::CExecuteParams() : m_arChanges()
{
m_eSrcFormat = DoctRendererFormat::INVALID;
m_eDstFormat = DoctRendererFormat::INVALID;
m_strFontsDirectory = L"";
m_strImagesDirectory = L"";
m_strThemesDirectory = L"";
m_strSrcFilePath = L"";
m_strDstFilePath = L"";
m_nCountChangesItems = -1;
m_strMailMergeDatabasePath = L"";
m_strMailMergeField = L"";
m_nMailMergeIndexStart = -1;
m_nMailMergeIndexEnd = -1;
}
CExecuteParams::~CExecuteParams()
{
m_arChanges.RemoveAll();
}
bool CExecuteParams::FromXml(const std::wstring& strXml)
{
XmlUtils::CXmlNode oNode;
if (!oNode.FromXmlString(strXml))
return FALSE;
m_strSrcFilePath = oNode.ReadValueString(L"SrcFilePath");
m_strDstFilePath = oNode.ReadValueString(L"DstFilePath");
m_eSrcFormat = (DoctRendererFormat::FormatFile)(oNode.ReadValueInt(L"SrcFileType"));
m_eDstFormat = (DoctRendererFormat::FormatFile)(oNode.ReadValueInt(L"DstFileType"));
m_strFontsDirectory = oNode.ReadValueString(L"FontsDirectory");
m_strImagesDirectory = oNode.ReadValueString(L"ImagesDirectory");
m_strThemesDirectory = oNode.ReadValueString(L"ThemesDirectory");
XmlUtils::CXmlNode oNodeChanges;
if (oNode.GetNode(L"Changes", oNodeChanges))
{
m_nCountChangesItems = oNodeChanges.ReadAttributeInt(L"TopItem", -1);
XmlUtils::CXmlNodes oNodes;
oNodeChanges.GetNodes(L"Change", oNodes);
int nCount = oNodes.GetCount();
for (int i = 0; i < nCount; ++i)
{
XmlUtils::CXmlNode _node;
oNodes.GetAt(i, _node);
m_arChanges.Add(_node.GetText());
}
}
XmlUtils::CXmlNode oNodeMailMerge;
if (oNode.GetNode(L"MailMergeData", oNodeMailMerge))
{
m_strMailMergeDatabasePath = oNodeMailMerge.ReadAttribute(L"DatabasePath");
m_nMailMergeIndexStart = oNodeMailMerge.ReadAttributeInt(L"Start", -1);
m_nMailMergeIndexEnd = oNodeMailMerge.ReadAttributeInt(L"End", -1);
m_strMailMergeField = oNodeMailMerge.ReadAttribute(L"Field");
}
return true;
}
} }
namespace NSDoctRenderer namespace NSDoctRenderer
...@@ -524,6 +559,14 @@ namespace NSDoctRenderer ...@@ -524,6 +559,14 @@ namespace NSDoctRenderer
} }
} }
if (!bIsBreak && m_oParams.m_bIsRetina)
{
v8::Local<v8::String> sourceParams = v8::String::NewFromUtf8(isolate,
"(function(){ if (window && window.SetDoctRendererParams) {window.SetDoctRendererParams({retina:true});} })();");
v8::Local<v8::Script> scriptParams = v8::Script::Compile(sourceParams);
scriptParams->Run();
}
//--------------------------------------------------------------- //---------------------------------------------------------------
v8::Local<v8::Object> global_js = context->Global(); v8::Local<v8::Object> global_js = context->Global();
v8::Handle<v8::Value> args[1]; v8::Handle<v8::Value> args[1];
......
...@@ -22,35 +22,6 @@ namespace NSDoctRenderer ...@@ -22,35 +22,6 @@ namespace NSDoctRenderer
INVALID = 255 INVALID = 255
}; };
} }
class Q_DECL_EXPORT CExecuteParams
{
public:
DoctRendererFormat::FormatFile m_eSrcFormat;
DoctRendererFormat::FormatFile m_eDstFormat;
std::wstring m_strFontsDirectory;
std::wstring m_strImagesDirectory;
std::wstring m_strThemesDirectory;
std::wstring m_strSrcFilePath;
std::wstring m_strDstFilePath;
CArray<std::wstring> m_arChanges;
int m_nCountChangesItems;
std::wstring m_strMailMergeDatabasePath;
std::wstring m_strMailMergeField;
int m_nMailMergeIndexStart;
int m_nMailMergeIndexEnd;
public:
CExecuteParams();
~CExecuteParams();
public:
bool FromXml(const std::wstring& sXml);
};
} }
namespace NSDoctRenderer namespace NSDoctRenderer
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment