Commit 234e19d6 authored by ElenaSubbotina's avatar ElenaSubbotina

Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop

parents 8bcc6d15 62145b72
......@@ -136,13 +136,17 @@ namespace DocFileFormat
}
return btWin32;
}
bool ParseEmbeddedEquation( const std::string & xmlString, std::wstring & newXmlString)
bool VMLPictureMapping::ParseEmbeddedEquation( const std::string & xmlString, std::wstring & newXmlString)
{
newXmlString.clear();
std::wstring sTempXmlFile = NSDirectory::CreateTempFileWithUniqueName(
NSDirectory::GetTempPath(), L"emb");
sTempXmlFile += L".xml";
std::wstring sTempFolder = m_ctx->_doc->m_sTempFolder;
if (sTempFolder.empty())
{
sTempFolder = NSFile::CFileBinary::GetTempPath();
}
std::wstring sTempXmlFile = NSDirectory::CreateTempFileWithUniqueName(sTempFolder, L"emb");
NSFile::CFileBinary file;
file.CreateFileW(sTempXmlFile);
......@@ -186,6 +190,7 @@ namespace DocFileFormat
if (res) break;
}
}
NSFile::CFileBinary::Remove(sTempXmlFile);
return res;
}
//---------------------------------------------------------------
......@@ -299,6 +304,11 @@ namespace DocFileFormat
//встроенная неведомая хуйня
m_isEmbedded = true;
m_embeddedData = std::string((char*)iter->opComplex, iter->op);
//if (ParseEmbeddedBlob( m_embeddedData, m_blobXml)) // todoooo
//{
// m_isEmbedded = false;
//}
}break;
//BORDERS
case borderBottomColor:
......
......@@ -46,7 +46,6 @@ namespace DocFileFormat
{
class OleObject;
bool ParseEmbeddedEquation( const std::string & xmlString, std::wstring & newXmlString );
class VMLPictureMapping: public PropertiesMapping, public IMapping
{
......@@ -58,6 +57,7 @@ namespace DocFileFormat
/// Writes a border element
void writePictureBorder (const std::wstring & name, const BorderCode* brc);
void appendStyleProperty( std::wstring* b, const std::wstring& propName, const std::wstring& propValue ) const;
bool ParseEmbeddedEquation( const std::string & xmlString, std::wstring & newXmlString );
protected:
/// Copies the picture from the binary stream to the zip archive
/// and creates the relationships for the image.
......
......@@ -86,6 +86,7 @@ namespace DocFileFormat
friend class Table;
friend class TableRow;
friend class VMLShapeMapping;
friend class VMLPictureMapping;
friend class OpenXmlPackage;
friend class TextboxMapping;
......
......@@ -336,6 +336,7 @@ void odf_drawing_context::set_background_state(bool Val)
impl_->is_background_ = Val;
impl_->current_graphic_properties = new graphic_format_properties();
start_area_properties();
}
void odf_drawing_context::check_anchor()
......@@ -473,6 +474,7 @@ void odf_drawing_context::start_drawing()
}
void odf_drawing_context::end_drawing_background(odf_types::common_draw_fill_attlist & common_draw_attlist)
{
end_area_properties();
if (impl_->current_drawing_state_.elements_.empty() == false) return;
if (!impl_->is_background_ || !impl_->current_graphic_properties) return;
......@@ -491,15 +493,13 @@ void odf_drawing_context::end_drawing()
draw_base* draw = dynamic_cast<draw_base*>(impl_->current_drawing_state_.elements_[0].elm.get());
if (draw)
{
if (impl_->is_presentation_)
if (impl_->current_drawing_state_.presentation_class_ || impl_->current_drawing_state_.presentation_placeholder_)
{
_CP_OPT(std::wstring) draw_layer;
if (impl_->is_presentation_.get() == true)
{//master
draw_layer = L"backgroundobjects";
//if (impl_->current_drawing_state_.presentation_class_)
// draw_layer = L"backgroundobjects";
//else draw_layer = L"layout";
if (!impl_->current_drawing_state_.presentation_class_)
impl_->current_drawing_state_.presentation_class_ = presentation_class::outline;
......@@ -1186,10 +1186,14 @@ void odf_drawing_context::set_shadow(int type, std::wstring hexColor, _CP_OPT(do
void odf_drawing_context::set_placeholder_id (std::wstring val)
{
if (!impl_->is_presentation_) return;
impl_->current_drawing_state_.presentation_placeholder_ = val;
}
void odf_drawing_context::set_placeholder_type (int val)
{
if (!impl_->is_presentation_) return;
switch(val)
{
case 0: impl_->current_drawing_state_.presentation_class_ = presentation_class::outline; break;
......
......@@ -433,6 +433,8 @@ void OoxConverter::convert(PPTX::Logic::Shape *oox_shape)
{
if (oox_shape == NULL) return;
_CP_OPT(bool) bMasterPresentation = odf_context()->drawing_context()->get_presentation();
odf_context()->drawing_context()->start_drawing();
int type = 1000; //custom
......@@ -448,7 +450,8 @@ void OoxConverter::convert(PPTX::Logic::Shape *oox_shape)
type = preset.GetValue();
}
if (type == SimpleTypes::shapetypeRect && oox_shape->txBody.IsInit()) type = 2000;
if (type == SimpleTypes::shapetypeRect && oox_shape->txBody.IsInit())
type = 2000;
if (type == 2000 && oox_shape->txBody->bodyPr.IsInit()
&& oox_shape->txBody->bodyPr->fromWordArt.get_value_or(false))
......
......@@ -130,6 +130,8 @@ bool OoxConverter::UpdateProgress(long nComplete)
void OoxConverter::set_fonts_directory(const std::wstring &fontsPath)
{
if (odf_context() == NULL) return;
odf_context()->set_fonts_directory(fontsPath);
}
......
......@@ -60,6 +60,17 @@ namespace Oox2Odf
{
PptxConverter::PptxConverter(const std::wstring & path, const ProgressCallback* CallBack)
{
current_clrMap = NULL;
current_slide = NULL;
current_theme = NULL;
current_tableStyles = NULL;
presentation = NULL;
output_document = NULL;
odp_context = NULL;
pCallBack = CallBack;
const OOX::CPath oox_path(std::wstring(path.c_str()));
pptx_document = new PPTX::Folder();
......@@ -82,13 +93,6 @@ PptxConverter::PptxConverter(const std::wstring & path, const ProgressCallback*
output_document = new odf_writer::package::odf_document(L"presentation");
odp_context = new odf_writer::odp_conversion_context(output_document);
current_clrMap = NULL;
current_slide = NULL;
current_theme = NULL;
current_tableStyles = NULL;
pCallBack = CallBack;
if (UpdateProgress(290000))return;
}
PptxConverter::~PptxConverter()
......@@ -339,7 +343,7 @@ void PptxConverter::convert_slides()
current_slide = slide->Master.operator->();
if (bShowLayoutMasterSp && bShowMasterSp)
convert_slide(&slide->Master->cSld, current_txStyles, false);
convert_slide(&slide->Master->cSld, current_txStyles, false, true);
else
convert(slide->Master->cSld.bg.GetPointer());
......@@ -347,7 +351,7 @@ void PptxConverter::convert_slides()
current_clrMap = slide->Layout->clrMapOvr->overrideClrMapping.GetPointer();
current_slide = slide->Layout.operator->();
convert_slide(&slide->Layout->cSld, current_txStyles, true);
convert_slide(&slide->Layout->cSld, current_txStyles, true, bShowLayoutMasterSp);
//add note master
odp_context->end_master_slide();
......@@ -387,7 +391,7 @@ void PptxConverter::convert_slides()
odp_context->current_slide().set_master_page (master_style_name);
odp_context->current_slide().set_layout_page (layout_style_name);
convert_slide (slide->cSld.GetPointer(), current_txStyles);
convert_slide (slide->cSld.GetPointer(), current_txStyles, true, bShowMasterSp);
convert (slide->comments.operator->());
convert (slide->Note.operator->());
......@@ -943,7 +947,7 @@ void PptxConverter::convert(PPTX::Logic::Bg *oox_background)
odp_context->end_drawings();
}
void PptxConverter::convert_slide(PPTX::Logic::CSld *oox_slide, PPTX::Logic::TxStyles* txStyles, bool bPlaceholders)
void PptxConverter::convert_slide(PPTX::Logic::CSld *oox_slide, PPTX::Logic::TxStyles* txStyles, bool bPlaceholders, bool bFillUp)
{
if (oox_slide == NULL) return;
......@@ -966,14 +970,15 @@ void PptxConverter::convert_slide(PPTX::Logic::CSld *oox_slide, PPTX::Logic::TxS
{
if (pShape->nvSpPr.nvPr.ph.is_init())
{
if (bFillUp)
pShape->FillLevelUp();
if (pShape->nvSpPr.nvPr.ph->type.IsInit())
{
int ph_type = pShape->nvSpPr.nvPr.ph->type->GetBYTECode();
if (!bMaster && (ph_type == 5 || ph_type == 6 || ph_type == 7 || ph_type == 12))
continue;
//if (!bMaster && (ph_type == 5 || ph_type == 6 || ph_type == 7 || ph_type == 12))
// continue;
odf_context()->drawing_context()->set_placeholder_type(ph_type);
}
......
......@@ -106,7 +106,7 @@ namespace Oox2Odf
void convert(OOX::WritingElement *oox_unknown);
void convert_slide (PPTX::Logic::CSld *oox_slide, PPTX::Logic::TxStyles* txStyles, bool bPlaceholders = true);
void convert_slide (PPTX::Logic::CSld *oox_slide, PPTX::Logic::TxStyles* txStyles, bool bPlaceholders, bool bFillUp);
void convert_layout (PPTX::Logic::CSld *oox_slide);
void convert (PPTX::Comments *oox_comments);
void convert (PPTX::NotesSlide *oox_note);
......
......@@ -120,21 +120,29 @@ namespace PPTX
oAttr.Write(_T("noResize"), noResize);
oAttr.Write(_T("noSelect"), noSelect);
return XmlUtils::CreateNode(m_namespace + L":cNvGraphicFramePr", oAttr.m_strValue.empty() ? L"" : XmlUtils::CreateNode(L"a:graphicFrameLocks", oAttr));
std::wstring namespaceLocks = L"a";
if (m_namespace == L"wp") namespaceLocks = L"wp";
return XmlUtils::CreateNode(m_namespace + L":cNvGraphicFramePr", oAttr.m_strValue.empty() ? L"" : XmlUtils::CreateNode(namespaceLocks + L":graphicFrameLocks", oAttr));
}
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{
std::wstring namespace_ = m_namespace;
std::wstring namespaceLock_ = L"a";
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX) namespace_ = L"xdr";
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_DOCX) namespace_ = L"wp";
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_DOCX)
{
namespaceLock_ = L"wp";
namespace_ = L"wp";
}
pWriter->StartNode(namespace_ + L":cNvGraphicFramePr");
pWriter->EndAttributes();
pWriter->StartNode(_T("a:graphicFrameLocks"));
pWriter->StartNode(namespaceLock_ + L"graphicFrameLocks");
pWriter->StartAttributes();
......@@ -147,7 +155,7 @@ namespace PPTX
pWriter->EndAttributes();
pWriter->EndNode(_T("a:graphicFrameLocks"));
pWriter->EndNode(namespaceLock_ + L":graphicFrameLocks");
pWriter->EndNode(namespace_ + L":cNvGraphicFramePr");
}
......
......@@ -122,8 +122,8 @@ namespace PPTX
if (L"xfrm" == strName && strNamespace != L"xdr")
xfrm = oReader;
else if (L"nvGraphicFramePr" == strName)
nvGraphicFramePr.fromXML( oReader );
else if (L"cNvGraphicFramePr" == strName)
nvGraphicFramePr.cNvGraphicFramePr.fromXML( oReader );
else if (L"graphic" == strName)
{
......
......@@ -156,6 +156,16 @@ namespace PPTX
}
}
}
if (pShape->nvSpPr.nvPr.ph->idx.IsInit())
{
//not found in layout !! 100818_건강보험과_보건의료_김용익_최종.pptx
bool bShapeMaster = showMasterSp.get_value_or(true);
if (Master.IsInit() && bShapeMaster)
{
Master->GetLevelUp(pShape);
}
}
}
}
virtual std::wstring GetMediaFullPathNameFromRId(const OOX::RId& rid)const
......
......@@ -45,7 +45,8 @@
#include <windows.h>
#endif
#define U_TO_UTF8(val) NSFile::CUtf8Converter::GetUtf8StringFromUnicode2(val.c_str(), val.length())
#define U_TO_UTF8(val) NSFile::CUtf8Converter::GetUtf8StringFromUnicode2(val.c_str(), (LONG)val.length())
#define UTF8_TO_U(val) NSFile::CUtf8Converter::GetUnicodeStringFromUTF8((BYTE*)val.c_str(), (LONG)val.length())
#if defined(__linux__) || defined(_MAC) && !defined(_IOS)
#include <unistd.h>
......
......@@ -75,23 +75,23 @@ namespace codegen
}
public void merge(GenMemberPivot val)
{
if (!string.IsNullOrEmpty(val.sName))
if (string.IsNullOrEmpty(this.sName))
sName = val.sName;
if (!string.IsNullOrEmpty(val.sNamespace))
if (string.IsNullOrEmpty(this.sNamespace))
sNamespace = val.sNamespace;
if (!string.IsNullOrEmpty(val.sType))
if (string.IsNullOrEmpty(this.sType))
sType = val.sType;
if (null != val.oSystemType)
if (null == this.oSystemType)
oSystemType = val.oSystemType;
if (val.bIsAttribute.HasValue)
if (!this.bIsAttribute.HasValue)
bIsAttribute = val.bIsAttribute;
if (!string.IsNullOrEmpty(val.sDefAttribute))
if (string.IsNullOrEmpty(this.sDefAttribute))
sDefAttribute = val.sDefAttribute;
if (val.bQualified.HasValue)
if (!this.bQualified.HasValue)
bQualified = val.bQualified;
if (val.nArrayRank.HasValue)
if (!this.nArrayRank.HasValue)
nArrayRank = val.nArrayRank;
if (val.bIsArrayTypesHidden.HasValue)
if (!this.bIsArrayTypesHidden.HasValue)
bIsArrayTypesHidden = val.bIsArrayTypesHidden;
}
public void completeDefaults()
......@@ -105,7 +105,7 @@ namespace codegen
//[System.Xml.Serialization.XmlElementAttribute("c")]
//public CT_CalcCell[] c {
//bIsArray=true;aArrayTypes=[CT_CalcCell]
//nArrayRank=0;aArrayTypes=[CT_CalcCell];bIsArrayTypesHidden=true
//[System.Xml.Serialization.XmlElementAttribute("b", typeof(CT_Boolean))]
//[System.Xml.Serialization.XmlElementAttribute("d", typeof(CT_DateTime))]
......@@ -114,9 +114,18 @@ namespace codegen
//[System.Xml.Serialization.XmlElementAttribute("n", typeof(CT_Number))]
//[System.Xml.Serialization.XmlElementAttribute("s", typeof(CT_String))]
//public object[] Items {
//nArrayRank=0;aArrayTypes=[CT_Boolean, CT_DateTime, CT_Error, CT_Missing, CT_Number, CT_String];bIsArrayTypesHidden=true
//[System.Xml.Serialization.XmlElementAttribute("consolidation", typeof(CT_Consolidation))]
//[System.Xml.Serialization.XmlElementAttribute("extLst", typeof(CT_ExtensionList))]
//[System.Xml.Serialization.XmlElementAttribute("worksheetSource", typeof(CT_WorksheetSource))]
//public object Item
//{
//nArrayRank=null;aArrayTypes=[CT_Consolidation, CT_ExtensionList, CT_WorksheetSource];bIsArrayTypesHidden=true
//[System.Xml.Serialization.XmlArrayItemAttribute("author", IsNullable=false)]
//public string[] authors {
//nArrayRank=0;aArrayTypes=[string];bIsArrayTypesHidden=false
//[System.Xml.Serialization.XmlArrayItemAttribute("b", typeof(CT_Boolean), IsNullable=false)]
//[System.Xml.Serialization.XmlArrayItemAttribute("d", typeof(CT_DateTime), IsNullable=false)]
......@@ -126,12 +135,7 @@ namespace codegen
//[System.Xml.Serialization.XmlArrayItemAttribute("s", typeof(CT_String), IsNullable=false)]
//[System.Xml.Serialization.XmlArrayItemAttribute("x", typeof(CT_Index), IsNullable=false)]
//public object[][] r {
//[System.Xml.Serialization.XmlElementAttribute("consolidation", typeof(CT_Consolidation))]
//[System.Xml.Serialization.XmlElementAttribute("extLst", typeof(CT_ExtensionList))]
//[System.Xml.Serialization.XmlElementAttribute("worksheetSource", typeof(CT_WorksheetSource))]
//public object Item
//{
//nArrayRank=1;aArrayTypes=[CT_Boolean, CT_DateTime, CT_Error, CT_Missing, CT_Number, CT_String, CT_Index];bIsArrayTypesHidden=false
public class GenClassPivot
{
......@@ -222,6 +226,9 @@ namespace codegen
Queue<GenClassPivot> aTemp = new Queue<GenClassPivot>();
List<GenClassPivot> aRes = new List<GenClassPivot>();
string[] aTargetTypes = new string[] { "CT_PivotCacheDefinition", "CT_PivotCacheRecords", "CT_pivotTableDefinition" };
//string[] aTargetTypes = new string[] { "CT_Workbook" };
//string[] aTargetTypes = new string[] { "CT_Comments" };
Dictionary<string, bool> mapTargetSubTypes = new Dictionary<string, bool>();
Dictionary<string, bool> namspaces = new Dictionary<string, bool>();
......@@ -419,16 +426,19 @@ namespace codegen
{
if (1 == aTempMemebers.Count)
{
oGenMember.merge(aTempMemebers[0]);
GenMemberPivot TempMember = aTempMemebers[0];
TempMember.merge(oGenMember);
TempMember.nArrayRank = null;
}
else
{
oGenMember.aArrayTypes = aTempMemebers;
if (bXmlElementAttribute)
oGenMember.bIsArrayTypesHidden = true;
else
oGenMember.bIsArrayTypesHidden = false;
}
else
{
oGenMember.nArrayRank = null;
}
oGenMember.completeDefaults();
return oGenMember;
......
......@@ -568,7 +568,7 @@
<xsd:attribute name="optimizeMemory" type="xsd:boolean" use="optional" default="false"/>
<xsd:attribute name="enableRefresh" type="xsd:boolean" use="optional" default="true"/>
<xsd:attribute name="refreshedBy" type="s:ST_Xstring" use="optional"/>
<xsd:attribute name="refreshedDateIso" type="xsd:dateTime" use="optional"/>
<xsd:attribute name="refreshedDate" type="xsd:double" use="optional"/>
<xsd:attribute name="backgroundQuery" type="xsd:boolean" default="false"/>
<xsd:attribute name="missingItemsLimit" type="xsd:unsignedInt" use="optional"/>
<xsd:attribute name="createdVersion" type="xsd:unsignedByte" use="optional" default="0"/>
......
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