Commit d7c7584b authored by ElenaSubbotina's avatar ElenaSubbotina

OdfFormatWriter - slides size, ...

parent 1346072a
<?xml version="1.0" encoding="windows-1251"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8,00"
Version="8.00"
Name="OdfFileWriterTest"
ProjectGUID="{FBA8446A-150F-4A10-B4DA-1022048D6473}"
RootNamespace="ASCOfficeOdfFileWTest"
......@@ -65,6 +65,7 @@
Name="VCLinkerTool"
AdditionalDependencies="&#x0D;&#x0A;Rpcrt4.lib"
LinkIncremental="2"
IgnoreDefaultLibraryNames="LIBCMTD.lib"
GenerateDebugInformation="true"
SubSystem="1"
TargetMachine="1"
......@@ -342,18 +343,6 @@
/>
</FileConfiguration>
</File>
<File
RelativePath=".\OdfFileWTest.cpp"
>
<FileConfiguration
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\Common\3dParty\pole\pole.cpp"
>
......@@ -463,6 +452,18 @@
</File>
</Filter>
</Filter>
<File
RelativePath=".\OdfFileWTest.cpp"
>
<FileConfiguration
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
/>
</FileConfiguration>
</File>
</Files>
<Globals>
</Globals>
......
......@@ -1554,7 +1554,7 @@ void odf_drawing_context::set_group_z_order(int Val)
group->common_draw_attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.draw_z_index_ = Val;
}
void odf_drawing_context::set_group_name(std::wstring name)
void odf_drawing_context::set_group_name(const std::wstring & name)
{
if ( impl_->group_list_.empty() )return;
......@@ -1563,7 +1563,6 @@ void odf_drawing_context::set_group_name(std::wstring name)
if ( !name.empty() )
group->common_draw_attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.draw_name_ = name;
}
void odf_drawing_context::set_group_flip_H(bool bVal)
{
if ( impl_->group_list_.empty() )return;
......
......@@ -106,7 +106,7 @@ public:
void set_group_flip_H (bool bVal);
void set_group_flip_V (bool bVal);
void set_group_z_order (int Val);
void set_group_name (std::wstring name);
void set_group_name (const std::wstring & name);
void set_group_rotate (int iVal);
void set_group_size (_CP_OPT(double) cx, _CP_OPT(double) cy, _CP_OPT(double) change_cx, _CP_OPT(double) change_cy);
......
......@@ -241,7 +241,10 @@ void OoxConverter::convert(PPTX::Logic::SmartArt *oox_smart_art)
odf_context()->drawing_context()->set_group_size (width, height, width, height);
odf_context()->drawing_context()->set_group_position (x, y, cx, cy);
convert(oox_smart_art->m_diag.GetPointer());
for (size_t i = 0; i < oox_smart_art->m_diag->SpTreeElems.size(); i++)
{
convert(&oox_smart_art->m_diag->SpTreeElems[i]);
}
odf_context()->drawing_context()->end_group();
oox_current_child_document = NULL;
......@@ -278,14 +281,90 @@ void OoxConverter::convert(PPTX::Logic::ChartRec *oox_chart)
}
}
}
void OoxConverter::convert(PPTX::Logic::CNvGrpSpPr *oox_cnvGrpSpPr)
{
if (!oox_cnvGrpSpPr) return;
}
void OoxConverter::convert(PPTX::Logic::NvGrpSpPr *oox_nvGrpSpPr)
{
if (!oox_nvGrpSpPr) return;
odf_context()->drawing_context()->set_group_name(oox_nvGrpSpPr->cNvPr.name);
odf_context()->drawing_context()->set_group_z_order(oox_nvGrpSpPr->cNvPr.id);
if (oox_nvGrpSpPr->cNvPr.descr.IsInit())
odf_context()->drawing_context()->set_description(oox_nvGrpSpPr->cNvPr.descr.get());
convert(&oox_nvGrpSpPr->cNvGrpSpPr);
convert(&oox_nvGrpSpPr->nvPr);
}
void OoxConverter::convert(PPTX::Logic::GrpSpPr *oox_grpSpPr)
{
if (!oox_grpSpPr) return;
if (oox_grpSpPr->xfrm.IsInit())
{
if (oox_grpSpPr->xfrm->flipH.IsInit())
odf_context()->drawing_context()->set_group_flip_H(oox_grpSpPr->xfrm->flipH.get());
if (oox_grpSpPr->xfrm->flipV.IsInit())
odf_context()->drawing_context()->set_group_flip_V(oox_grpSpPr->xfrm->flipV.get());
_CP_OPT(double) cx, cy, ch_cx, ch_cy;
if (oox_grpSpPr->xfrm->extX.IsInit())
cx = oox_grpSpPr->xfrm->extX.get() / 12700.;
if (oox_grpSpPr->xfrm->extY.IsInit())
cy = oox_grpSpPr->xfrm->extY.get() / 12700.;
if (oox_grpSpPr->xfrm->chExtX.IsInit())
ch_cx = oox_grpSpPr->xfrm->chExtX.get() / 12700.;
if (oox_grpSpPr->xfrm->chExtY.IsInit())
ch_cy = oox_grpSpPr->xfrm->chExtY.get() / 12700.;
odf_context()->drawing_context()->set_group_size( cx, cy, ch_cx, ch_cy );
_CP_OPT(double) x, y, ch_x, ch_y;
if (oox_grpSpPr->xfrm->offX.IsInit())
x = oox_grpSpPr->xfrm->offX.get() / 12700.;
if (oox_grpSpPr->xfrm->offY.IsInit())
y = oox_grpSpPr->xfrm->offY.get() / 12700.;
if (oox_grpSpPr->xfrm->chOffX.IsInit())
ch_x = oox_grpSpPr->xfrm->chOffX.get() / 12700.;
if (oox_grpSpPr->xfrm->chOffY.IsInit())
ch_y = oox_grpSpPr->xfrm->chOffY.get() / 12700.;
odf_context()->drawing_context()->set_group_position( x, y, ch_x, ch_y );
if (oox_grpSpPr->xfrm->rot.IsInit())
odf_context()->drawing_context()->set_group_rotate(oox_grpSpPr->xfrm->rot.get() / 60000.);
}
//UniFill Fill;
//EffectProperties EffectList;
//nullable<Scene3d> scene3d;
}
void OoxConverter::convert(PPTX::Logic::SpTree *oox_shape_tree)
{
if (oox_shape_tree == NULL) return;
odf_context()->drawing_context()->start_group();
convert(&oox_shape_tree->nvGrpSpPr);
convert(&oox_shape_tree->grpSpPr);
//odf_context()->drawing_context()->set_group_size (width, height, width, height);
//odf_context()->drawing_context()->set_group_position (x, y, cx, cy);
for (size_t i = 0; i < oox_shape_tree->SpTreeElems.size(); i++)
{
convert(oox_shape_tree->SpTreeElems[i].GetElem().operator->());
}
odf_context()->drawing_context()->end_group();
}
void OoxConverter::convert(PPTX::Logic::CxnSp *oox_connect)
{
......
......@@ -69,7 +69,7 @@ namespace Oox2Odf
return (Val * 360000 * 2.54) / 72;
}
Converter::Converter(const std::wstring & path, const std::wstring & type, const std::wstring & fontsPath, const ProgressCallback* CallBack)
{
{
impl_ = NULL;
if (type == _T("text")) impl_ = new DocxConverter(path, CallBack);
......
......@@ -273,6 +273,7 @@ namespace PPTX
class SmartArt;
class ChartRec;
class SpPr;
class GrpSpPr;
class Xfrm;
class ShapeStyle;
class PrstTxWarp;
......@@ -296,7 +297,9 @@ namespace PPTX
class CNvPr;
class CNvSpPr;
class CNvCxnSpPr;
class CNvGrpSpPr;
class NvCxnSpPr;
class NvGrpSpPr;
class NvPr;
class Paragraph;
class TxBody;
......@@ -368,6 +371,7 @@ public:
void convert(PPTX::Logic::Shape *oox_shape);
void convert(PPTX::Logic::CxnSp *oox_connect);
void convert(PPTX::Logic::Pic *oox_pic);
void convert(PPTX::Logic::GrpSpPr *oox_grpSpPr);
void convert(PPTX::Logic::SpPr *oox_spPr, PPTX::Logic::ShapeStyle* oox_sp_style = NULL);
void convert(PPTX::Logic::TextSpacing *oox_spacing, cpdoccore::odf_types::length_or_percent & length_or_percent);
void convert(PPTX::Logic::Xfrm *oox_xfrm);
......@@ -391,7 +395,9 @@ public:
void convert(PPTX::Logic::CNvPr *oox_cnvPr);
void convert(PPTX::Logic::CNvCxnSpPr *oox_cnvPr);
void convert(PPTX::Logic::CNvSpPr *oox_cnvSpPr);
void convert(PPTX::Logic::CNvGrpSpPr *oox_cnvGrpSpPr);
void convert(PPTX::Logic::NvCxnSpPr *oox_nvSpPr);
void convert(PPTX::Logic::NvGrpSpPr *oox_nvSpPr);
void convert(PPTX::Logic::NvPr *oox_nvPr);
void convert(PPTX::Logic::Paragraph *oox_para, PPTX::Logic::TextListStyle *oox_list_style = NULL);
void convert(PPTX::Logic::TextListStyle *oox_list_style, int level, cpdoccore::odf_writer::style_paragraph_properties * paragraph_properties);
......
......@@ -261,6 +261,26 @@ void PptxConverter::convert_styles()
void PptxConverter::convert_settings()
{
}
void PptxConverter::convert_common()
{
if (presentation->sldSz.IsInit())
{
_CP_OPT(odf_types::length) width = odf_types::length(presentation->sldSz->cx / 12700., odf_types::length::pt);
_CP_OPT(odf_types::length) height = odf_types::length(presentation->sldSz->cy / 12700., odf_types::length::pt);
odf_context()->page_layout_context()->set_page_size(width, height);
if (presentation->sldSz->type.IsInit())
{
switch(presentation->sldSz->type->GetBYTECode())
{
default:
break;
}
//odf_context()->page_layout_context()->set_page_orientation
}
}
}
void PptxConverter::convert_slides()
......@@ -298,6 +318,7 @@ void PptxConverter::convert_slides()
master_style_name += std::to_wstring(m_mapMasters.size());
odp_context->start_master_slide(master_style_name);
convert_common();
//if (slide->Layout->showMasterSp.IsInit() ? *slide->Layout->showMasterSp : true)
{
current_slide = slide->Master.operator->();
......
......@@ -136,10 +136,11 @@ private:
std::map<std::wstring, std::wstring> m_mapMasters;
std::map<std::wstring, std::wstring> m_mapLayouts;
void convert_slides ();
void convert_styles ();
void convert_settings ();
void convert_layouts ();
void convert_slides ();
void convert_styles ();
void convert_settings ();
void convert_layouts ();
void convert_common ();
//--------------------------------------------------------------------------------
......
......@@ -35,7 +35,7 @@
#include <iostream>
#include "../../Common/DocxFormat/Source/Base/Base.h"
#include "../../Common/DocxFormat/Source/SystemUtility/FileSystem/Directory.h"
#include "../../DesktopEditor/common/Directory.h"
#include "../source/XlsXlsxConverter/ConvertXls2Xlsx.h"
#include "../source/XlsXlsxConverter/progressCallback.h"
......@@ -52,8 +52,8 @@ int _tmain(int argc, _TCHAR* argv[])
std::wstring srcFileName = argv[1];
std::wstring dstPath = argc > 2 ? argv[2] : srcFileName + L"-my.xlsx";
std::wstring outputDir = FileSystem::Directory::GetFolderPath(dstPath);
std::wstring dstTempPath = FileSystem::Directory::CreateDirectoryWithUniqueName(outputDir);
std::wstring outputDir = NSDirectory::GetFolderPath(dstPath);
std::wstring dstTempPath = NSDirectory::CreateDirectoryWithUniqueName(outputDir);
hr = ConvertXls2Xlsx(srcFileName, dstTempPath, L"password", L"C:\\Windows\\Fonts", NULL);
......@@ -63,7 +63,7 @@ int _tmain(int argc, _TCHAR* argv[])
hr = oCOfficeUtils.CompressFileOrDirectory(dstTempPath.c_str(), dstPath.c_str(), -1);
}
FileSystem::Directory::DeleteDirectory(dstTempPath);
NSDirectory::DeleteDirectory(dstTempPath);
return hr;
}
<?xml version="1.0" encoding="windows-1251"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8,00"
Version="8.00"
Name="XlsFormatTest"
ProjectGUID="{C2882DDD-07E6-4314-AD4B-48F43F38D722}"
RootNamespace="ASCOfficeOdfFileTest"
......@@ -64,7 +64,7 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="kernel32.lib $(NoInherit)"
AdditionalDependencies="Rpcrt4.lib $(NOINHERIT)"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="1"
......
......@@ -356,42 +356,10 @@ bool DecryptCipher(_buf & key, _buf & iv, _buf & data_inp, _buf & data_out, CRY
}
else if (algorithm == CRYPT_METHOD::RC4)
{
//CryptoPP::ARC4 rc4(key.ptr, key.size);
//data_out.ptr = new unsigned char[data_inp.size];
//data_out.size = data_inp.size;
//rc4.ProcessData(data_out.ptr, data_inp.ptr, data_inp.size);
//CryptoPP::RC2::Decryption rc2Decryption(key.ptr, key.size);
//modeDecryption = new CryptoPP::ECB_Mode_ExternalCipher::Decryption(rc2Decryption, iv.ptr );
//CryptoPP::RC5::Decryption rc5Decryption(key.ptr, key.size);
//modeDecryption = new CryptoPPp::ECB_Mode_ExternalCipher::Decryption(rc5Decryption, iv.ptr );
//rsa aes
//CryptoPP::HexDecoder buffer;
//buffer.Put(key.ptr, key.size);
//
////CryptoPP::StringSource buffer(key.ptr, key.size, true);
//CryptoPP::RSA::PrivateKey priv;
//priv.Load(buffer);
//CryptoPP::AutoSeededRandomPool rng;
//if(!priv.Validate(rng, 3))
// throw std::runtime_error("Rsa private key validation failed");
//if(!priv.Validate(rng, 3))
// throw std::runtime_error("Dsa private key validation failed");
//CryptoPP::RSAES_PKCS1v15_Decryptor rsaDecryption(priv);
//std::string data((char*)data_inp.ptr, data_inp.size);
//std::string decrypted;
// CryptoPP::StringSource ss(data, true,
// new CryptoPP::PK_DecryptorFilter(rng, rsaDecryption,
// new CryptoPP::StringSink(decrypted)) );
// data_out = decrypted;
//return true;
return false;
CryptoPP::ARC4 rc4(key.ptr, key.size);
data_out.ptr = new unsigned char[data_inp.size];
data_out.size = data_inp.size;
rc4.ProcessData(data_out.ptr, data_inp.ptr, data_inp.size);
}
else //AES
{
......
......@@ -138,7 +138,6 @@ static std::wstring utf8_to_unicode(const char *src)
InputParams oInputParams;
oInputParams.m_sFileFrom = new std::wstring(sArg1);
oInputParams.m_sFileTo = new std::wstring(sArg2);
oInputParams.m_sPassword = new std::wstring(L"123");
// get conversion direction from 3rd argument
if (argc > 3)
......
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