Compare commits

...

36 Commits

Author SHA1 Message Date
59d75ed148 XlsFormat - fix pivots 2017-07-06 19:09:06 +03:00
ccc4d751d0 Merge remote-tracking branch 'origin/hotfix/v4.4.2' into develop 2017-07-06 15:40:57 +03:00
a020d3dbf9 PptxFormat - fix audio wav files, fix old standart ole
XlsFormat - fix custom shape with connectors
2017-07-06 15:40:10 +03:00
7852b7fbe8 . 2017-07-06 15:35:14 +03:00
a64fd8792d Fixed build error 2017-07-06 12:19:50 +03:00
32448298a3 Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop
* 'develop' of https://github.com/ONLYOFFICE/core:
  .
  OdfFormatReader - fix spreadsheets margins PptFormatReader - fix previous users picture, fix read picture stream version up
  XlsFormat - convert pivot tables
  debug
  .
  .
2017-07-05 15:35:54 +03:00
b3384f1466 chart-settings seralize 2017-07-05 15:35:46 +03:00
93274395a9 . 2017-07-05 13:55:37 +03:00
2726e14445 Merge remote-tracking branch 'origin/hotfix/v4.4.2' into develop 2017-07-05 13:46:05 +03:00
75e32a1562 OdfFormatReader - fix spreadsheets margins
PptFormatReader - fix previous users picture, fix read picture stream
version up
2017-07-05 13:44:50 +03:00
8c2637b89c Merge tag 'v4.4.1' into develop
v4.4.1
2017-07-05 11:48:04 +03:00
ef389872df Merge branch 'release/v4.4.1' 2017-07-05 11:47:48 +03:00
6fc611fdfc XlsFormat - convert pivot tables 2017-07-04 18:50:39 +03:00
0cabb63336 debug 2017-07-04 13:54:52 +03:00
f501bf7930 remove curl for ios 2017-07-04 11:52:23 +03:00
7b617dc9e9 fix curl path 2017-07-04 10:40:26 +03:00
245f989ae3 XlsFormat... 2017-07-03 19:27:46 +03:00
429729b979 remade build.bat 2017-07-03 18:17:49 +03:00
d709652992 debug 2017-07-03 17:01:02 +03:00
776d799fd2 Debug 2017-07-03 16:50:49 +03:00
a975cb8261 Merge pull request #32 from ONLYOFFICE/feature/lenas-fixes
Feature/lenas fixies
2017-07-03 16:36:04 +03:00
c932b5af26 Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop
* 'develop' of https://github.com/ONLYOFFICE/core:
  XlsFormat - convert pivot tables view
  Added scripts for fetching and building curl
  Removed curl sources
  refactoring
  refactoring
  XlsFormat ...
  XlsFormat ...
  .
  .
  .
  .
  min command length
  XlsFormat - convert piot cache
  x2t - return error code by PptConvert
  memset before readlink.
2017-07-03 16:06:14 +03:00
423e8dda86 chart-settings seralize 2017-07-03 16:06:02 +03:00
afcf6b079e . 2017-07-03 15:56:21 +03:00
3ed2224f93 . 2017-07-03 15:56:08 +03:00
5307855120 XlsFormat - convert pivot tables view 2017-07-03 15:10:00 +03:00
3c9a91af45 Added scripts for fetching and building curl 2017-07-03 14:46:56 +03:00
9f06f94c93 Removed curl sources 2017-07-03 12:45:30 +03:00
4954ef2934 refactoring 2017-07-03 10:27:49 +03:00
721e8800f1 refactoring 2017-07-03 10:27:23 +03:00
ef8e5cab6d XlsFormat ... 2017-07-02 17:49:41 +03:00
028e58ad51 XlsFormat ... 2017-07-02 13:18:56 +03:00
424e0e34cc . 2017-07-01 17:56:12 +03:00
d8988cd101 . 2017-07-01 16:33:36 +03:00
440a884c0a . 2017-07-01 14:38:46 +03:00
449bab1a70 . 2017-06-30 19:42:25 +03:00
2892 changed files with 1964 additions and 531055 deletions

View File

@ -49,8 +49,8 @@
6967917D1D9E8AEE002CA4BA /* BinReaderWriterDefines.h in Headers */ = {isa = PBXBuildFile; fileRef = 696791791D9E8AEE002CA4BA /* BinReaderWriterDefines.h */; };
6967917E1D9E8AEE002CA4BA /* BinWriters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6967917A1D9E8AEE002CA4BA /* BinWriters.cpp */; };
6967917F1D9E8AEE002CA4BA /* BinWriters.h in Headers */ = {isa = PBXBuildFile; fileRef = 6967917B1D9E8AEE002CA4BA /* BinWriters.h */; };
69BBDF251F0B8AAC00EB1BF7 /* FileDownloader_mac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 69BBDF241F0B8AAC00EB1BF7 /* FileDownloader_mac.mm */; };
69F181AF1C77274E00B2952B /* FileDownloader.h in Headers */ = {isa = PBXBuildFile; fileRef = 69F181AD1C77274E00B2952B /* FileDownloader.h */; };
69F181B51C77276D00B2952B /* FileDownloader_curl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 69F181B31C77276D00B2952B /* FileDownloader_curl.cpp */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
@ -97,8 +97,8 @@
696791791D9E8AEE002CA4BA /* BinReaderWriterDefines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BinReaderWriterDefines.h; path = ../../BinWriter/BinReaderWriterDefines.h; sourceTree = "<group>"; };
6967917A1D9E8AEE002CA4BA /* BinWriters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = BinWriters.cpp; path = ../../BinWriter/BinWriters.cpp; sourceTree = "<group>"; };
6967917B1D9E8AEE002CA4BA /* BinWriters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BinWriters.h; path = ../../BinWriter/BinWriters.h; sourceTree = "<group>"; };
69BBDF241F0B8AAC00EB1BF7 /* FileDownloader_mac.mm */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp.preprocessed; fileEncoding = 4; name = FileDownloader_mac.mm; path = ../../../Common/FileDownloader/FileDownloader_mac.mm; sourceTree = "<group>"; };
69F181AD1C77274E00B2952B /* FileDownloader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FileDownloader.h; path = ../../../Common/FileDownloader/FileDownloader.h; sourceTree = "<group>"; };
69F181B31C77276D00B2952B /* FileDownloader_curl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FileDownloader_curl.cpp; path = ../../../Common/FileDownloader/FileDownloader_curl.cpp; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@ -230,7 +230,7 @@
isa = PBXGroup;
children = (
69F181AD1C77274E00B2952B /* FileDownloader.h */,
69F181B31C77276D00B2952B /* FileDownloader_curl.cpp */,
69BBDF241F0B8AAC00EB1BF7 /* FileDownloader_mac.mm */,
);
name = Common;
sourceTree = "<group>";
@ -339,7 +339,6 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
69F181B51C77276D00B2952B /* FileDownloader_curl.cpp in Sources */,
17C1FE961ACC42C4006B99B3 /* Common.cpp in Sources */,
17C1FE971ACC42C4006B99B3 /* ChartFromToBinary.cpp in Sources */,
17C1FE981ACC42C4006B99B3 /* CSVReader.cpp in Sources */,
@ -348,6 +347,7 @@
17C1FE9B1ACC42C4006B99B3 /* CSVWriter.cpp in Sources */,
69414A301CB51666003E771B /* ChartWriter.cpp in Sources */,
6967917E1D9E8AEE002CA4BA /* BinWriters.cpp in Sources */,
69BBDF251F0B8AAC00EB1BF7 /* FileDownloader_mac.mm in Sources */,
17C1FE9C1ACC42C4006B99B3 /* XlsxSerializer.cpp in Sources */,
690FE0851E9BBD68004B26D0 /* Readers.cpp in Sources */,
17C1FE9D1ACC42C4006B99B3 /* FontProcessor.cpp in Sources */,
@ -379,6 +379,7 @@
unix,
_IOS,
DONT_WRITE_EMBEDDED_FONTS,
_XCODE,
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
HEADER_SEARCH_PATHS = (
@ -416,6 +417,7 @@
unix,
_IOS,
DONT_WRITE_EMBEDDED_FONTS,
_XCODE,
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
HEADER_SEARCH_PATHS = (

View File

@ -189,14 +189,14 @@ void xlsx_xml_worksheet::write_to(std::wostream & strm)
CP_XML_STREAM() << impl_->hyperlinks_.str();
}
}
CP_XML_STREAM() << impl_->drawing_.str();
if (!impl_->page_props_.str().empty())
{
CP_XML_STREAM() << impl_->page_props_.str();
}//props выше legacyDrawing !!
CP_XML_STREAM() << impl_->drawing_.str();
if (impl_->commentsId_.length()>0)
{
CP_XML_NODE(L"legacyDrawing")

View File

@ -687,6 +687,7 @@ void common_shape_draw_attlist::add_attributes( const xml::attributes_wc_ptr & A
CP_APPLY_ATTR(L"draw:transform", draw_transform_);
CP_APPLY_ATTR(L"draw:name", draw_name_);
CP_APPLY_ATTR(L"draw:text-style-name", draw_text_style_name_);
CP_APPLY_ATTR(L"drawooo:display", drawooo_display_);
}
void common_shape_draw_attlist::apply_from(const common_shape_draw_attlist & Other)
{
@ -698,6 +699,7 @@ void common_shape_draw_attlist::apply_from(const common_shape_draw_attlist & Oth
_CP_APPLY_PROP2(draw_transform_);
_CP_APPLY_PROP2(draw_name_);
_CP_APPLY_PROP2(draw_text_style_name_);
_CP_APPLY_PROP2(drawooo_display_);
}
void common_shape_draw_attlist::serialize(CP_ATTR_NODE)
@ -710,6 +712,7 @@ void common_shape_draw_attlist::serialize(CP_ATTR_NODE)
CP_XML_ATTR_OPT(L"draw:transform", draw_transform_);
CP_XML_ATTR_OPT(L"draw:name", draw_name_);
CP_XML_ATTR_OPT(L"draw:text-style-name", draw_text_style_name_);
CP_XML_ATTR_OPT(L"drawooo:display", drawooo_display_);
}
void common_draw_shape_with_text_and_styles_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
{

View File

@ -501,6 +501,7 @@ public:
_CP_OPT(std::wstring) draw_layer_;
_CP_OPT(std::wstring) draw_transform_;
_CP_OPT(int) draw_z_index_;
_CP_OPT(std::wstring) drawooo_display_;
};
class common_draw_position_attlist

View File

@ -384,9 +384,11 @@ void odf_drawing_context::start_group()
group->common_draw_attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.draw_name_ = impl_->current_drawing_state_.name_;
if (impl_->current_drawing_state_.z_order_ >= 0)
group->common_draw_attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.draw_z_index_ = impl_->current_drawing_state_.z_order_;
if (!impl_->current_drawing_state_.name_.empty())
group->common_draw_attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.draw_name_ = impl_->current_drawing_state_.name_;
//if (!impl_->current_drawing_state_.description_.empty())
// group->common_draw_attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.draw_name_ = impl_->current_drawing_state_.description_;
if (impl_->current_drawing_state_.hidden_)
group->common_draw_attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.drawooo_display_ = L"printer";
impl_->current_drawing_state_.name_ = L"";
impl_->current_drawing_state_.z_order_ = -1;
@ -519,10 +521,12 @@ void odf_drawing_context::end_drawing()
draw->common_draw_attlists_.shape_with_text_and_styles_.common_presentation_attlist_.presentation_class_ = impl_->current_drawing_state_.presentation_class_;
draw->common_draw_attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.draw_layer_ = draw_layer;
}
if (impl_->current_drawing_state_.name_.length() > 0)
if (!impl_->current_drawing_state_.name_.empty())
draw->common_draw_attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.draw_name_ = impl_->current_drawing_state_.name_;
if (impl_->current_drawing_state_.z_order_ >= 0)
draw->common_draw_attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.draw_z_index_ = impl_->current_drawing_state_.z_order_;
if (impl_->current_drawing_state_.hidden_)
draw->common_draw_attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.drawooo_display_ = L"printer";
std::wstring strTransform;
@ -2125,6 +2129,13 @@ void odf_drawing_context::set_textarea_wrap(bool Val)
impl_->current_graphic_properties->fo_wrap_option_ = wrap_option(wrap_option::NoWrap);
}
void odf_drawing_context::set_textarea_fit_to_size(bool val)
{
if (!impl_->current_graphic_properties)return;
impl_->current_graphic_properties->draw_fit_to_size_ = val;
}
void odf_drawing_context::set_textarea_font(std::wstring & latin, std::wstring & cs, std::wstring & ea)
{

View File

@ -228,6 +228,7 @@ public:
void set_textarea_wrap (bool val);
void set_textarea_fontcolor (std::wstring hexColor);
void set_textarea_font (std::wstring & latin, std::wstring & cs, std::wstring & ea);
void set_textarea_fit_to_size (bool val);
void set_placeholder_id (std::wstring val);
void set_placeholder_type (int val);

View File

@ -1137,12 +1137,24 @@ void OoxConverter::convert(PPTX::Logic::BodyPr *oox_bodyPr)
//+ style section
//+element text:section в котором параграфы
}
if (oox_bodyPr->Fit.type == PPTX::Logic::TextFit::FitSpAuto)
{
//изменяемы размеры
odf_context()->drawing_context()->set_text_box_min_size(true);//уже выставленые в min
switch(oox_bodyPr->Fit.type)
{
case PPTX::Logic::TextFit::FitSpAuto:
{//изменяемы размеры
odf_context()->drawing_context()->set_text_box_min_size(true);//уже выставленые в min
}break;
case PPTX::Logic::TextFit::FitNo:
{
}break;
case PPTX::Logic::TextFit::FitNormAuto:
{
}break;
default:
{
}
}
if (oox_bodyPr->fromWordArt.IsInit() && oox_bodyPr->prstTxWarp.IsInit())
{
for (size_t i = 0; i < oox_bodyPr->prstTxWarp->avLst.size(); i++)

View File

@ -1436,6 +1436,8 @@ void PptxConverter::convert_layout(PPTX::Logic::CSld *oox_slide)
if (pShape.IsInit() && pShape->nvSpPr.nvPr.ph.is_init())
{
pShape->FillLevelUp();
int type = 0;
if (pShape->nvSpPr.nvPr.ph->type.IsInit())
type = pShape->nvSpPr.nvPr.ph->type->GetBYTECode();

View File

@ -92,13 +92,16 @@ public:
bool bResult = pInfo->ReadFromStream(&oUserAtom, pStream);
offsetToEdit = pInfo->m_oUser.m_nOffsetLastEdit;
m_oCurrentUser.m_bIsEncrypt = pInfo->m_bEncrypt;
if (bResult == false)
{
delete pInfo;
if (pInfo->m_bEncrypt) return false;
else continue;
if (pInfo->m_bEncrypt)
return false;
else
continue;
}
m_arUsers.push_back(pInfo);

View File

@ -601,12 +601,14 @@ void CPPTUserInfo::LoadNotes(DWORD dwNoteID, CSlide* pNotes)
CSlideInfo* pNotesWrapper = &m_arNotesWrapper.back();
int indexUser = pRecordSlide->m_IndexUser;
int indexUser = pRecordSlide->m_IndexUser;
if (m_pDocumentInfo->m_arUsers[indexUser]->m_arOffsetPictures.empty())
pNotesWrapper->m_parEmptyPictures = &m_pDocumentInfo->m_arUsers[0]->m_arOffsetPictures;
else
pNotesWrapper->m_parEmptyPictures = &m_pDocumentInfo->m_arUsers[indexUser]->m_arOffsetPictures;
pNotesWrapper->m_parEmptyPictures = &m_pDocumentInfo->m_arUsers[indexUser]->m_arOffsetPictures;
pNotesWrapper->m_mapFilePictures = &m_pDocumentInfo->m_mapStoreImageFile;
//грузим placeholder
pNotesWrapper->m_arTextPlaceHolders = pRecordSlide->m_oPersist.m_arTextAttrs;
std::vector<CRecordNotesAtom*> oArrayNotesAtoms;
@ -627,6 +629,9 @@ void CPPTUserInfo::LoadNotes(DWORD dwNoteID, CSlide* pNotes)
//????? у заметок нет слайда !!!
}
//-----------------------------------------------------
size_t index = pPairSlide->second->m_Index;
if (index >= m_arSlides.size())
return;
CSlide* pSlide = m_arSlides[pPairSlide->second->m_Index];
pNotes->m_lSlideID = pPairSlide->second->m_Index;
@ -796,12 +801,14 @@ void CPPTUserInfo::LoadSlide(DWORD dwSlideID, CSlide* pSlide)
CSlideInfo* pSlideWrapper = &m_arSlideWrapper.back();
int indexUser = pRecordSlide->m_IndexUser;
int indexUser = pRecordSlide->m_IndexUser;
pSlideWrapper->m_parEmptyPictures = &m_pDocumentInfo->m_arUsers[indexUser]->m_arOffsetPictures;
if (m_pDocumentInfo->m_arUsers[indexUser]->m_arOffsetPictures.empty())
pSlideWrapper->m_parEmptyPictures = &m_pDocumentInfo->m_arUsers[0]->m_arOffsetPictures;
else
pSlideWrapper->m_parEmptyPictures = &m_pDocumentInfo->m_arUsers[indexUser]->m_arOffsetPictures;
pSlideWrapper->m_mapFilePictures = &m_pDocumentInfo->m_mapStoreImageFile;
// вот, грузим placeholder
pSlideWrapper->m_arTextPlaceHolders = pRecordSlide->m_oPersist.m_arTextAttrs;
// записываем шрифты
@ -1402,7 +1409,11 @@ void CPPTUserInfo::LoadMainMaster(DWORD dwMasterID, const LONG& lOriginWidth, co
indexUser = pPairMaster1->second->m_IndexUser;
pMasterWrapper->m_arTextPlaceHolders = pPairMaster1->second->m_oPersist.m_arTextAttrs;
}
pMasterWrapper->m_parEmptyPictures = &m_pDocumentInfo->m_arUsers[indexUser]->m_arOffsetPictures;
if (m_pDocumentInfo->m_arUsers[indexUser]->m_arOffsetPictures.empty() == false)
pMasterWrapper->m_parEmptyPictures = &m_pDocumentInfo->m_arUsers[indexUser]->m_arOffsetPictures;
else
pMasterWrapper->m_parEmptyPictures = &m_pDocumentInfo->m_arUsers[0]->m_arOffsetPictures;
pMasterWrapper->m_mapFilePictures = &m_pDocumentInfo->m_mapStoreImageFile;
// читаем настройки текстовых стилей -----------------------------------------------
@ -1784,11 +1795,13 @@ void CPPTUserInfo::LoadNoMainMaster(DWORD dwMasterID, const LONG& lOriginWidth,
CSlideInfo* pMasterWrapper = &m_arMasterWrapper[m_arMasterWrapper.size() - 1];
// вот, грузим placeholder
pMasterWrapper->m_arTextPlaceHolders = pCurMaster->m_oPersist.m_arTextAttrs;
pMasterWrapper->m_parEmptyPictures = &m_pDocumentInfo->m_arUsers[pCurMaster->m_IndexUser]->m_arOffsetPictures;
pMasterWrapper->m_arTextPlaceHolders = pCurMaster->m_oPersist.m_arTextAttrs;
pMasterWrapper->m_mapFilePictures = &m_pDocumentInfo->m_mapStoreImageFile;
if (m_pDocumentInfo->m_arUsers[pCurMaster->m_IndexUser]->m_arOffsetPictures.empty() == false)
pMasterWrapper->m_parEmptyPictures = &m_pDocumentInfo->m_arUsers[pCurMaster->m_IndexUser]->m_arOffsetPictures;
else
pMasterWrapper->m_parEmptyPictures = &m_pDocumentInfo->m_arUsers[0]->m_arOffsetPictures;
std::map<DWORD, LONG>::iterator pPairTheme = m_mapMasterToTheme.find(dwID);

View File

@ -116,7 +116,7 @@ bool CPPTFileReader::ReadPersists()
CFStreamPtr pStream = GetDocumentStream();
if (!pStream) return false;
if (m_oDocumentInfo.ReadFromStream(&m_oCurrentUser, pStream->stream_) == false) return false;
return m_oDocumentInfo.ReadFromStream(&m_oCurrentUser, pStream->stream_);
}
void CPPTFileReader::ReadDocument()
{
@ -232,10 +232,12 @@ void CPPTFileReader::ReadPictures()
while (true)
{
if (pStream->isEOF())
break;
//if (pStream->isEOF()) случаются неверно записанные стримы
// break;
int pos = pStream->getStreamPointer();
if (pos >= pStream->getStreamSize())
break;
SRecordHeader oHeader;
if (pDecryptor)
@ -256,6 +258,9 @@ void CPPTFileReader::ReadPictures()
else
oHeader.ReadFromStream(pStream->stream_);
if (oHeader.RecType == 0 && oHeader.RecLen == 0 )
break;// окончание стрима забито нулями (выравнивание)
CRecordOfficeArtBlip art_blip;
art_blip.m_strTmpDirectory = m_strTmpDirectory;
art_blip.m_oDocumentInfo = &m_oDocumentInfo;

View File

@ -60,7 +60,7 @@ int _tmain(int argc, _TCHAR* argv[])
pptFile.put_TempDirectory(tempPath);
HRESULT hRes = pptFile.LoadFromFile(sSrcPpt, dstTempPath, L"password");
HRESULT hRes = pptFile.LoadFromFile(sSrcPpt, dstTempPath, L"");
if (hRes == S_OK)
{

View File

@ -250,12 +250,26 @@ namespace PPTX
}
else if (L"oleObj" == strName)
{
olePic = oNode.ReadNode(L"p:pic");
olePic = oNode.ReadNode(L"p:pic"); //нормальный вариант объекта
if (olePic.IsInit())
{
olePic->fromXMLOle(oNode);
result = true;
}
else
{
olePic.Init(); //старый вариант описания объекта через spid в VmlDrawing
olePic->spPr.xfrm;
Logic::PrstGeom* geom = new Logic::PrstGeom();
geom->prst = L"rect";
olePic->spPr.Geometry.m_geometry.reset(geom);
olePic->fromXMLOle(oNode);
result = true;
}
if (olePic->spPr.xfrm.IsInit() == false)
olePic->spPr.xfrm = xfrm;
}
else if (L"AlternateContent" == strName)
{

View File

@ -619,6 +619,45 @@ namespace PPTX
if(oleObject.IsInit())
{
pWriter->StartRecord(SPTREE_TYPE_OLE);
if (oleObject->m_sShapeId.IsInit() && (!blipFill.blip->embed.IsInit() && blipFill.blip->oleFilepathImage.empty()) &&
parentFileIs<PPTX::Slide>() && parentFileAs<PPTX::Slide>().Vml.IsInit())
{
OOX::CVmlDrawing *pVml = parentFileAs<PPTX::Slide>().Vml.operator->();
std::map<std::wstring, OOX::CVmlDrawing::_vml_shape>::iterator pPair = pVml->m_mapShapes.find(*oleObject->m_sShapeId);
if (pVml->m_mapShapes.end() != pPair)
{
pPair->second.bUsed = true;
OOX::Vml::CShape* pShape = dynamic_cast<OOX::Vml::CShape*>(pPair->second.pElement);
for(size_t j = 0; (pShape) && (j < pShape->m_arrItems.size()); ++j)
{
OOX::WritingElement* pChildElemShape = pShape->m_arrItems[j];
if(OOX::et_v_imagedata == pChildElemShape->getType())
{
OOX::Vml::CImageData* pImageData = static_cast<OOX::Vml::CImageData*>(pChildElemShape);
std::wstring sIdImageFileCache;
if (pImageData->m_oRelId.IsInit()) sIdImageFileCache = pImageData->m_oRelId->GetValue();
else if (pImageData->m_rId.IsInit()) sIdImageFileCache = pImageData->m_rId->GetValue();
if (!sIdImageFileCache.empty())
{
//ищем физический файл ( rId относительно vml_drawing)
smart_ptr<OOX::File> pFile = pVml->Find(sIdImageFileCache);
if (pFile.IsInit() && ( OOX::FileTypes::Image == pFile->type()))
{
OOX::Image* pImageFileCache = static_cast<OOX::Image*>(pFile.operator->());
blipFill.blip->oleFilepathImage = pImageFileCache->filename().GetPath();
}
}
}
}
}
}
}
else if (nvPicPr.nvPr.media.is_init())
{
@ -630,10 +669,17 @@ namespace PPTX
blipFill.blip->mediaFilepath = mediaFile->filename().GetPath();
}
if (nvPicPr.nvPr.media.as<MediaFile>().name == L"audioFile")
if (nvPicPr.nvPr.media.is<MediaFile>())
{
if (nvPicPr.nvPr.media.as<MediaFile>().name == L"audioFile")
pWriter->StartRecord(SPTREE_TYPE_AUDIO);
else if (nvPicPr.nvPr.media.as<MediaFile>().name == L"videoFile")
pWriter->StartRecord(SPTREE_TYPE_VIDEO);
}
else if (nvPicPr.nvPr.media.is<WavAudioFile>() || nvPicPr.nvPr.media.is<AudioCD>())
{
pWriter->StartRecord(SPTREE_TYPE_AUDIO);
else if (nvPicPr.nvPr.media.as<MediaFile>().name == L"videoFile")
pWriter->StartRecord(SPTREE_TYPE_VIDEO);
}
else
pWriter->StartRecord(SPTREE_TYPE_PIC);
}
@ -1338,6 +1384,7 @@ namespace PPTX
blipFill.blip.Init();
blipFill.blip->oleRid = oleObject->m_oId->get();
}
node.ReadAttributeBase(L"spid", oleObject->m_sShapeId);
}
} // namespace Logic
} // namespace PPTX

View File

@ -259,7 +259,7 @@ namespace PPTX
void toXmlWriterVML(NSBinPptxRW::CXmlWriter* pWriter, smart_ptr<PPTX::Theme>& oTheme, smart_ptr<PPTX::Logic::ClrMap>& oClrMap, bool in_group = false);
//----------------------------------------------------------------------
NvPicPr nvPicPr;
BlipFill blipFill;
mutable BlipFill blipFill;
SpPr spPr;
nullable<ShapeStyle> style;
//internal

View File

@ -128,27 +128,32 @@ namespace PPTX
{
if (!pShape) return;
if(pShape->nvSpPr.nvPr.ph.is_init())
if (pShape->nvSpPr.nvPr.ph.is_init())
{
std::wstring idx = pShape->nvSpPr.nvPr.ph->idx.get_value_or(_T("0"));
std::wstring type = pShape->nvSpPr.nvPr.ph->type.get_value_or(_T("body"));
std::wstring idx = pShape->nvSpPr.nvPr.ph->idx.get_value_or(L"");
std::wstring type = pShape->nvSpPr.nvPr.ph->type.get_value_or(L"body");
if(type == L"ctrTitle") type = L"title";
if (type == L"ctrTitle") type = L"title";
for(size_t i = 0; i < cSld.spTree.SpTreeElems.size(); ++i)
for (size_t i = 0; i < cSld.spTree.SpTreeElems.size(); ++i)
{
smart_ptr<Logic::Shape> pLayoutShape = cSld.spTree.SpTreeElems[i].GetElem().smart_dynamic_cast<Logic::Shape>();
if(pLayoutShape.IsInit())
if (pLayoutShape.IsInit())
{
if(pLayoutShape->nvSpPr.nvPr.ph.is_init())
if (pLayoutShape->nvSpPr.nvPr.ph.is_init())
{
std::wstring lIdx = pLayoutShape->nvSpPr.nvPr.ph->idx.get_value_or(_T("0"));
std::wstring lIdx = pLayoutShape->nvSpPr.nvPr.ph->idx.get_value_or(_T(""));
std::wstring lType = pLayoutShape->nvSpPr.nvPr.ph->type.get_value_or(_T("body"));
if(lType == _T("ctrTitle")) lType = _T("title");
if (lType == L"ctrTitle") lType = L"title";
if((type == lType) && (idx == lIdx))
if ((type == lType) && (idx == lIdx) && !idx.empty())
{
pShape->SetLevelUpElement(pLayoutShape.operator->());
return;
}
else if ((type == lType) && idx.empty() && lIdx.empty())
{
pShape->SetLevelUpElement(pLayoutShape.operator->());
return;

View File

@ -66,7 +66,7 @@ CFRecordPtr CFStreamCacheReader::getNextRecord(const CFRecordType::TypeId desira
{
CFRecordType::TypeString rec_name = records_cache.front()->getTypeString();
Log::warning(rec_name);
//Log::warning(rec_name);
if (desirable_type == rt_MsoDrawingGroup) // объединяем rt_MsoDrawingGroup + rt_Continue в один блок
{

View File

@ -36,8 +36,6 @@
namespace XLS
{
// Logical representation of BkHim record in BIFF8
class BkHim: public BiffRecordContinued
{
BIFF_RECORD_DEFINE_TYPE_INFO(BkHim)
@ -48,10 +46,9 @@ public:
BaseObjectPtr clone();
void readFields(CFRecord& record);
static const ElementType type = typeBkHim;
static const ElementType type = typeBkHim;
_UINT16 cf;
_UINT32 lcb;

View File

@ -52,8 +52,13 @@ BaseObjectPtr SXDBB::clone()
void SXDBB::readFields(CFRecord& record)
{
int skip = record.getDataSize() - record.getRdPtr();
record.skipNunBytes(skip);
size = record.getDataSize() - record.getRdPtr();
blob = boost::shared_array<unsigned char>(new unsigned char[size]);
memcpy(blob.get(), record.getCurData<unsigned char>(), size);
record.skipNunBytes(size);
}
} // namespace XLS

View File

@ -31,12 +31,12 @@
*/
#pragma once
#include "BiffRecord.h"
#include "BiffRecordContinued.h"
namespace XLS
{
class SXDBB: public BiffRecord
class SXDBB: public BiffRecordContinued
{
BIFF_RECORD_DEFINE_TYPE_INFO(SXDBB)
BASE_OBJECT_DEFINE_CLASS_NAME(SXDBB)
@ -50,6 +50,8 @@ public:
static const ElementType type = typeSXDBB;
boost::shared_array<unsigned char> blob;
unsigned int size;
};
} // namespace XLS

View File

@ -39,12 +39,10 @@ SXDI::SXDI()
{
}
SXDI::~SXDI()
{
}
BaseObjectPtr SXDI::clone()
{
return BaseObjectPtr(new SXDI(*this));
@ -61,5 +59,22 @@ void SXDI::readFields(CFRecord& record)
}
}
int SXDI::serialize(std::wostream & strm)
{
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"dataField")
{
if (stName.value().empty() == false)
CP_XML_ATTR(L"name", stName.value());
CP_XML_ATTR(L"fld", isxvdData);
CP_XML_ATTR(L"baseField", df);
CP_XML_ATTR(L"baseItem", isxvi);
CP_XML_ATTR(L"numFmtId", ifmt);
}
}
return 0;
}
} // namespace XLS

View File

@ -49,6 +49,8 @@ public:
void readFields(CFRecord& record);
int serialize(std::wostream & strm);
static const ElementType type = typeSXDI;
short isxvdData;

View File

@ -51,6 +51,30 @@ BaseObjectPtr SXDtr::clone()
void SXDtr::readFields(CFRecord& record)
{
record >> yr >> mon >> dom >> hr >> min >> sec;
}
std::wstring SXDtr::get_string_date()
{
std::wstringstream s;
s << yr << L"-" << (mon < 10 ? L"0" : L"") << mon << L"-" << (dom < 10 ? L"0" : L"") << dom << L"T"
<< (hr < 10 ? L"0" : L"") << hr << L":" << (min < 10 ? L"0" : L"") << min << L":" << (sec < 10 ? L"0" : L"") << sec;
return s.str();
}
int SXDtr::serialize(std::wostream & strm)
{
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"d")
{
CP_XML_ATTR(L"v", get_string_date());
}
}
return 0;
}
} // namespace XLS

View File

@ -32,7 +32,6 @@
#pragma once
#include "BiffRecord.h"
//#include "../Biff_structures/CellRangeRef.h"
namespace XLS
{
@ -49,8 +48,18 @@ public:
void readFields(CFRecord& record);
int serialize(std::wostream & strm);
static const ElementType type = typeSXDtr;
unsigned short yr;
unsigned short mon;
unsigned char dom;
unsigned char hr;
unsigned char min;
unsigned char sec;
std::wstring get_string_date();
};

View File

@ -69,6 +69,12 @@ void SXFDB::readFields(CFRecord& record)
fServerBased = GETBIT(flags, 13);
fCantGetUniqueItems = GETBIT(flags, 14);
fCalculatedField = GETBIT(flags, 15);
if (fAllAtoms)
{
GlobalWorkbookInfoPtr global_info = record.getGlobalWorkbookInfo();
global_info->arCacheFieldShortSize.push_back(fShortIitms);
}
}
} // namespace XLS

View File

@ -51,6 +51,7 @@ BaseObjectPtr SXFDBType::clone()
void SXFDBType::readFields(CFRecord& record)
{
record >> wTypeSql;
}
} // namespace XLS

View File

@ -50,7 +50,7 @@ public:
static const ElementType type = typeSXFDBType;
short wTypeSql; //ODBCType enum
};
} // namespace XLS

View File

@ -51,6 +51,9 @@ BaseObjectPtr SXFormula::clone()
void SXFormula::readFields(CFRecord& record)
{
unsigned short reserved;
record >> reserved >> ifdb;
}
} // namespace XLS

View File

@ -50,7 +50,7 @@ public:
static const ElementType type = typeSXFormula;
short ifdb;
};
} // namespace XLS

View File

@ -51,6 +51,7 @@ BaseObjectPtr SXInt::clone()
void SXInt::readFields(CFRecord& record)
{
record >> num;
}
} // namespace XLS

View File

@ -32,7 +32,6 @@
#pragma once
#include "BiffRecord.h"
//#include "../Biff_structures/CellRangeRef.h"
namespace XLS
{
@ -51,7 +50,7 @@ public:
static const ElementType type = typeSXInt;
short num;
};
} // namespace XLS

View File

@ -50,17 +50,15 @@ BaseObjectPtr SXLI::clone()
}
void SXLI::readFields(CFRecord& record)
{// 0 or 2 records SXLIItem
int size_item = (record.getDataSize() - record.getRdPtr()) / 2;
if (size_item < 8)
{
while(true)
{
//??
return;
}
int size_item = record.getDataSize() - record.getRdPtr();
for (int k = 0; k < 2; k++)
{
if (size_item < 8)
{
break;
}
SXLIItem item;
unsigned short flags;
@ -74,13 +72,21 @@ void SXLI::readFields(CFRecord& record)
item.fGrand = GETBIT(flags, 11);
item.fMultiDataOnAxis = GETBIT(flags, 12);
int count = (size_item - 8) / 2;
if (item.fGrand)
item.isxviMac = 1;
for (int i = 0; i < count; i++)
if (item.cSic > item.isxviMac)
item.cSic = item.isxviMac;
if (item.fSbt && item.itmType < 0x000D)
item.isxviMac++;
for (short i = 0; i < item.isxviMac; i++)
{
short val; record >> val;
item.rgisxvi.push_back(val);
}
m_arItems.push_back(item);
}
}

View File

@ -39,7 +39,6 @@ SXNum::SXNum()
{
}
SXNum::~SXNum()
{
}
@ -51,7 +50,20 @@ BaseObjectPtr SXNum::clone()
void SXNum::readFields(CFRecord& record)
{
record >> num;
}
int SXNum::serialize(std::wostream & strm)
{
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"n")
{
CP_XML_ATTR(L"v", num.data.value);
}
}
return 0;
}
} // namespace XLS

View File

@ -32,7 +32,7 @@
#pragma once
#include "BiffRecord.h"
//#include "../Biff_structures/CellRangeRef.h"
#include "../Biff_structures/Xnum.h"
namespace XLS
{
@ -49,9 +49,11 @@ public:
void readFields(CFRecord& record);
int serialize(std::wostream & strm);
static const ElementType type = typeSXNum;
Xnum num;
};
} // namespace XLS

View File

@ -51,6 +51,13 @@ BaseObjectPtr SXPair::clone()
void SXPair::readFields(CFRecord& record)
{
unsigned short reserved1, flags;
record >> isxvd >> iCache >> reserved1 >> flags;
fFormula = GETBIT(flags, 0);
fPhysical = GETBIT(flags, 3);
fRelative = GETBIT(flags, 4);
}
} // namespace XLS

View File

@ -51,7 +51,12 @@ public:
static const ElementType type = typeSXPair;
unsigned short isxvd;
short iCache;
bool fFormula;
bool fPhysical;
bool fRelative;
};
} // namespace XLS

View File

@ -51,6 +51,13 @@ BaseObjectPtr SXRng::clone()
void SXRng::readFields(CFRecord& record)
{
unsigned short flags;
record >> flags;
fAutoStart = GETBIT(flags, 0);
fAutoEnd = GETBIT(flags, 1);
iByType = GETBITS(flags, 2, 4);
}
} // namespace XLS

View File

@ -51,7 +51,9 @@ public:
static const ElementType type = typeSXRng;
bool fAutoStart;
bool fAutoEnd;
unsigned char iByType;
};
} // namespace XLS

View File

@ -61,6 +61,17 @@ void SXString::readFields(CFRecord& record)
record >> segment;
}
}
int SXString::serialize(std::wostream & strm)
{
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"s")
{
CP_XML_ATTR(L"v", segment.value());
}
}
return 0;
}
} // namespace XLS

View File

@ -49,6 +49,8 @@ public:
void readFields(CFRecord& record);
int serialize(std::wostream & strm);
static const ElementType type = typeSXString;
unsigned short cch;

View File

@ -57,8 +57,8 @@ void SXVI::readFields(CFRecord& record)
fHidden = GETBIT(flags, 0);
fHideDetail = GETBIT(flags, 1);
fFormula = GETBIT(flags, 4);
fMissing = GETBIT(flags, 5);
fFormula = GETBIT(flags, 3);
fMissing = GETBIT(flags, 4);
if (cchName > 0 && cchName < 0xFFFF)
{
@ -67,6 +67,43 @@ void SXVI::readFields(CFRecord& record)
}
}
int SXVI::serialize(std::wostream & strm)
{
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"item")
{
if (fMissing)
CP_XML_ATTR(L"m", 1);
if (fHidden)
CP_XML_ATTR(L"h", 1);
if (fHideDetail)
CP_XML_ATTR(L"h", 1);
if (fFormula)
CP_XML_ATTR(L"f", 1);
if (itmType == 0)
{
CP_XML_ATTR(L"x", iCache);
}
switch(itmType)
{
case 0x0001: CP_XML_ATTR(L"t", L"default"); break;
case 0x0002: CP_XML_ATTR(L"t", L"sum"); break;
case 0x0003: CP_XML_ATTR(L"t", L"countA"); break;
case 0x0004: CP_XML_ATTR(L"t", L"avg"); break;
case 0x0005: CP_XML_ATTR(L"t", L"max"); break;
case 0x0006: CP_XML_ATTR(L"t", L"min"); break;
case 0x0007: CP_XML_ATTR(L"t", L"product"); break;
case 0x0008: CP_XML_ATTR(L"t", L"count"); break;
case 0x0009: CP_XML_ATTR(L"t", L"stdDev"); break;
case 0x000a: CP_XML_ATTR(L"t", L"stdDevP"); break;
case 0x000b: CP_XML_ATTR(L"t", L"var"); break;
case 0x000c: CP_XML_ATTR(L"t", L"varP"); break;
}
}
}
return 0;
}
} // namespace XLS

View File

@ -48,6 +48,8 @@ public:
void readFields(CFRecord& record);
int serialize(std::wostream & strm);
static const ElementType type = typeSXVI;
unsigned short itmType; //enum

View File

@ -51,6 +51,10 @@ BaseObjectPtr SxBool::clone()
void SxBool::readFields(CFRecord& record)
{
unsigned short flags;
record >> flags;
val = (flags != 0);
}
} // namespace XLS

View File

@ -32,7 +32,6 @@
#pragma once
#include "BiffRecord.h"
//#include "../Biff_structures/CellRangeRef.h"
namespace XLS
{
@ -51,7 +50,7 @@ public:
static const ElementType type = typeSxBool;
bool val;
};
} // namespace XLS

View File

@ -54,7 +54,6 @@ public:
DXFN dxfn;
XFExtNoFRT xfext;
};
} // namespace XLS

View File

@ -51,6 +51,7 @@ BaseObjectPtr SxErr::clone()
void SxErr::readFields(CFRecord& record)
{
record >> wbe;
}
} // namespace XLS

View File

@ -51,7 +51,7 @@ public:
static const ElementType type = typeSxErr;
unsigned short wbe;
};
} // namespace XLS

View File

@ -52,57 +52,7 @@ BaseObjectPtr SxFmla::clone()
void SxFmla::readFields(CFRecord& record)
{
//record >> csxformat >> cchErrorString >> cchNullString >> cchTag >> csxselect;
//_UINT32 flags;
//record >> crwPage >> ccolPage >> flags;
//fAcrossPageLay = GETBIT(flags, 0);
//cWrapPage = GETBITS(flags, 1, 9);
//fEnableWizard = GETBIT(flags, 16);
//fEnableDrilldown = GETBIT(flags, 17);
//fEnableFieldDialog = GETBIT(flags, 18);
//fPreserveFormatting = GETBIT(flags, 19);
//fMergeLabels = GETBIT(flags, 20);
//fDisplayErrorString = GETBIT(flags, 21);
//fDisplayNullString = GETBIT(flags, 22);
//fSubtotalHiddenPageItems = GETBIT(flags, 23);
//record >> cchPageFieldStyle >> cchTableStyle >> cchVacateStyle;
//if (cchErrorString > 0 && cchErrorString != 0xffff)
//{
// stError.setSize(cchErrorString);
// record >> stError;
//}
//if (cchNullString > 0 && cchNullString != 0xffff)
//{
// stDisplayNull.setSize(cchNullString);
// record >> stDisplayNull;
//}
//if (cchTag > 0 && cchTag != 0xffff)
//{
// stTag.setSize(cchTag);
// record >> stTag;
//}
//if (cchPageFieldStyle > 0 && cchPageFieldStyle != 0xffff)
//{
// stPageFieldStyle.setSize(cchPageFieldStyle);
// record >> stPageFieldStyle;
//}
//if (cchTableStyle > 0 && cchTableStyle != 0xffff)
//{
// stTableStyle.setSize(cchTableStyle);
// record >> cchTableStyle;
//}
//if (cchVacateStyle > 0 && cchVacateStyle != 0xffff)
//{
// stVacateStyle.setSize(cchVacateStyle);
// record >> cchVacateStyle;
//}
//int skip = record.getDataSize() - record.getRdPtr();
//record.skipNunBytes(skip);
fmla.load(record);
}
} // namespace XLS

View File

@ -32,8 +32,9 @@
#pragma once
#include "BiffRecord.h"
//#include "../Biff_structures/BiffString.h"
//#include "../Biff_structures/CellRangeRef.h"
#include "../Biff_structures/PivotParsedFormula.h"
namespace XLS
{
@ -52,36 +53,7 @@ public:
static const ElementType type = typeSxFmla;
//unsigned short csxformat;
//unsigned short cchErrorString;
//unsigned short cchNullString;
//unsigned short cchTag;
//unsigned short csxselect;
//DRw crwPage;
//ColU ccolPage;
//bool fAcrossPageLay;
//unsigned char cWrapPage;
//bool fEnableWizard;
//bool fEnableDrilldown;
//bool fEnableFieldDialog;
//bool fPreserveFormatting;
//bool fMergeLabels;
//bool fDisplayErrorString;
//bool fDisplayNullString;
//bool fSubtotalHiddenPageItems;
//unsigned short cchPageFieldStyle;
//unsigned short cchTableStyle;
//unsigned short cchVacateStyle;
//XLUnicodeStringNoCch stError;
//XLUnicodeStringNoCch stDisplayNull;
//XLUnicodeStringNoCch stTag;
//XLUnicodeStringNoCch stPageFieldStyle;
//XLUnicodeStringNoCch stTableStyle;
//XLUnicodeStringNoCch stVacateStyle;
PivotParsedFormula fmla;
};
} // namespace XLS

View File

@ -51,7 +51,6 @@ public:
static const ElementType type = typeSxIvd;
std::vector<short> rgSxivd;
};
} // namespace XLS

View File

@ -51,6 +51,10 @@ BaseObjectPtr SxName::clone()
void SxName::readFields(CFRecord& record)
{
unsigned short flags;
record >> flags >> ifdb >> ifn >> csxpair;
fErrName = GETBIT(flags, 0);
}
} // namespace XLS

View File

@ -32,7 +32,6 @@
#pragma once
#include "BiffRecord.h"
//#include "../Biff_structures/CellRangeRef.h"
namespace XLS
{
@ -51,7 +50,10 @@ public:
static const ElementType type = typeSxName;
bool fErrName;
short ifdb;
short ifn;
unsigned short csxpair;
};
} // namespace XLS

View File

@ -39,7 +39,6 @@ SxNil::SxNil()
{
}
SxNil::~SxNil()
{
}
@ -53,5 +52,14 @@ void SxNil::readFields(CFRecord& record)
{
}
int SxNil::serialize(std::wostream & strm)
{
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"m");
}
return 0;
}
} // namespace XLS

View File

@ -32,7 +32,6 @@
#pragma once
#include "BiffRecord.h"
//#include "../Biff_structures/CellRangeRef.h"
namespace XLS
{
@ -49,9 +48,9 @@ public:
void readFields(CFRecord& record);
int serialize(std::wostream & strm);
static const ElementType type = typeSxNil;
};
} // namespace XLS

View File

@ -45,7 +45,6 @@ Sxvd::~Sxvd()
{
}
BaseObjectPtr Sxvd::clone()
{
return BaseObjectPtr(new Sxvd(*this));

View File

@ -45,8 +45,6 @@ public:
BiffStructurePtr clone();
void load(CFRecord& record);
std::vector<CellRangeRef> cell_ranges;

View File

@ -750,7 +750,7 @@ class pConnectionSitesDir : public OfficeArtFOPTE
virtual void ReadComplexData(XLS::CFRecord& record);
IMsoArray<ODRAW::FixedPoint> complex;
IMsoArray<OSHARED::FixedPoint> complex;
};
class pInscribe : public OfficeArtFOPTE

View File

@ -0,0 +1,58 @@
/*
* (c) Copyright Ascensio System SIA 2010-2017
*
* 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 Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* 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
*
*/
#include "PivotParsedFormula.h"
#include <Binary/CFRecord.h>
namespace XLS
{
PivotParsedFormula::PivotParsedFormula()
: ParsedFormula(CellRef())
{
}
BiffStructurePtr PivotParsedFormula::clone()
{
return BiffStructurePtr(new PivotParsedFormula(*this));
}
void PivotParsedFormula::load(CFRecord& record)
{
unsigned short cce;
record >> cce >> cSxName;
rgce.load(record, cce);
}
} // namespace XLS

View File

@ -0,0 +1,52 @@
/*
* (c) Copyright Ascensio System SIA 2010-2017
*
* 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 Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* 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
*
*/
#pragma once
#include "ParsedFormula.h"
namespace XLS
{
class PivotParsedFormula: public ParsedFormula
{
BASE_STRUCTURE_DEFINE_CLASS_NAME(PivotParsedFormula)
public:
PivotParsedFormula();
BiffStructurePtr clone();
void load(CFRecord& record);
unsigned short cSxName;
};
} // namespace XLS

View File

@ -57,7 +57,7 @@ public:
unsigned char Byte4;
unsigned short type;
unsigned short fExprO;
};
}bytes;
double value;
} data;
};

View File

@ -38,11 +38,15 @@
namespace XLS
{
DBB::DBB()
{
}
bString = false;
bDate = false;
bNumber = false;
bEmpty = false;
fShortIitms = false;
}
DBB::~DBB()
{
@ -53,7 +57,6 @@ BaseObjectPtr DBB::clone()
return BaseObjectPtr(new DBB(*this));
}
// DBB = [SXDBB] *SXOPER
const bool DBB::loadContent(BinProcessor& proc)
{
@ -66,6 +69,12 @@ const bool DBB::loadContent(BinProcessor& proc)
while(count--)
{
m_arSXOPER.push_back(elements_.front()); elements_.pop_front();
SXOPER* operatr = dynamic_cast<SXOPER*>(m_arSXOPER.back().get());
bString |= operatr->bString;
bDate |= operatr->bDate;
bNumber |= operatr->bNumber;
bEmpty |= operatr->bEmpty;
}
if (!m_SXDBB && m_arSXOPER.empty())
@ -73,6 +82,50 @@ const bool DBB::loadContent(BinProcessor& proc)
return true;
}
int DBB::serialize(std::wostream & strm)
{
SXDBB* dbb = dynamic_cast<SXDBB*>(m_SXDBB.get());
if (!dbb && m_arSXOPER.empty()) return 0;
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"r")
{
if (m_arSXOPER.empty() == false)
{
for (size_t i = 0; i < m_arSXOPER.size(); i++)
{
m_arSXOPER[i]->serialize(CP_XML_STREAM());
}
}
else
{
if (fShortIitms == false)
{
for (size_t i = 0; i < dbb->size; i++)
{
CP_XML_NODE(L"x")
{
CP_XML_ATTR(L"v", dbb->blob[i]);
}
}
}
else
{
unsigned short * values = (unsigned short *)dbb->blob.get();
for (size_t i = 0; i < dbb->size / 2; i++)
{
CP_XML_NODE(L"x")
{
CP_XML_ATTR(L"v", values[i]);
}
}
}
}
}
}
return 0;
}
} // namespace XLS

View File

@ -47,10 +47,20 @@ public:
virtual const bool loadContent(BinProcessor& proc);
int serialize(std::wostream & strm);
static const ElementType type = typeDBB;
BaseObjectPtr m_SXDBB;
std::vector<BaseObjectPtr> m_arSXOPER;
//---------------------------------------------------
bool fShortIitms;
bool bString;
bool bDate;
bool bNumber;
bool bEmpty;
};
} // namespace XLS

View File

@ -43,18 +43,15 @@ DREF::DREF()
{
}
DREF::~DREF()
{
}
BaseObjectPtr DREF::clone()
{
return BaseObjectPtr(new DREF(*this));
}
// DREF = DConName / DConBin / DConRef
const bool DREF::loadContent(BinProcessor& proc)
{
@ -68,8 +65,84 @@ const bool DREF::loadContent(BinProcessor& proc)
}
}
}
m_DCon = elements_.back();
elements_.pop_back();
return true;
}
int DREF::serialize(std::wostream & strm)
{
if (!m_DCon)return 0;
DConName* name = dynamic_cast<DConName*>(m_DCon.get());
DConBin* bin = dynamic_cast<DConBin*>(m_DCon.get());
DConRef* ref = dynamic_cast<DConRef*>(m_DCon.get());
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"cacheSource")
{
if (name)
{
CP_XML_ATTR(L"type", L"worksheet");
CP_XML_NODE(L"worksheetSource")
{
CP_XML_ATTR(L"name", name->stName.value());
}
}
else if(bin)
{
switch(bin->nBuiltin)
{
case 0x0004:/*Database*/
case 0x000d:/*_FilterDatabase*/
{
CP_XML_ATTR(L"type", L"external");
//connectionId in connections(root)
}break;
case 0x0000:/*Consolidate_Area*/
//{
// CP_XML_ATTR(L"type", L"consolidation");
// CP_XML_NODE(L"consolidation")
// {
// CP_XML_ATTR(L"name", bin->stFile.value());
// }
//}break;
case 0x0001:/*Auto_Open*/
case 0x0002:/*Auto_Close*/
case 0x0003:/*Extract*/
case 0x0005:/*Criteria*/
case 0x0006:/*Print_Area*/
case 0x0007:/*Print_Titles*/
case 0x0008:/*Recorder*/
case 0x0009:/*Data_Form*/
case 0x000a:/*Auto_Activate*/
case 0x000b:/*Auto_Deactivate*/
case 0x000c:/*Sheet_Title*/
{
CP_XML_ATTR(L"type", L"scenario");
CP_XML_NODE(L"worksheetSource")
{
CP_XML_ATTR(L"name", bin->stFile.value());
}
}break;
}
}
else if(ref)
{
CP_XML_ATTR(L"type", L"worksheet");
CP_XML_NODE(L"worksheetSource")
{
CP_XML_ATTR(L"ref", ref->ref.toString());
CP_XML_ATTR(L"sheet", ref->stFile);
}
}
}
}
return 0;
}
} // namespace XLS

View File

@ -36,8 +36,6 @@
namespace XLS
{
// Logical representation of DREF union of records
class DREF: public CompositeObject
{
BASE_OBJECT_DEFINE_CLASS_NAME(DREF)
@ -49,7 +47,11 @@ public:
virtual const bool loadContent(BinProcessor& proc);
static const ElementType type = typeDREF;
int serialize(std::wostream & stream);
static const ElementType type = typeDREF;
BaseObjectPtr m_DCon;
};
} // namespace XLS

View File

@ -47,6 +47,10 @@ class Parenthesis_FDB: public ABNFParenthesis
{
BASE_OBJECT_DEFINE_CLASS_NAME(Parenthesis_FDB)
public:
Parenthesis_FDB(int count = 0)
{
m_count = count;
}
BaseObjectPtr clone()
{
return BaseObjectPtr(new Parenthesis_FDB(*this));
@ -54,7 +58,9 @@ public:
const bool loadContent(BinProcessor& proc)
{
int count = proc.repeated<SXOPER>(0, 0);
if (m_count < 1) return false;
int count = proc.repeated<SXOPER>(0, m_count);
if (!proc.optional<SXRANGE>())
{
@ -62,18 +68,23 @@ public:
}
return true;
};
private:
int m_count;
};
FDB::FDB()
{
bString = false;
bDate = false;
bNumber = false;
bEmpty = false;
bInteger = false;
}
FDB::~FDB()
{
}
BaseObjectPtr FDB::clone()
{
return BaseObjectPtr(new FDB(*this));
@ -91,6 +102,8 @@ const bool FDB::loadContent(BinProcessor& proc)
}
m_SXFDB = elements_.back();
elements_.pop_back();
SXFDB* fdb = dynamic_cast<SXFDB*>(m_SXFDB.get());
if(proc.mandatory<SXFDBType>())
{
@ -103,31 +116,41 @@ const bool FDB::loadContent(BinProcessor& proc)
m_SXFMLA = elements_.back();
elements_.pop_back();
}
else if(proc.optional<Parenthesis_FDB>())
else
{
int count = elements_.size();
while(count > 0)
Parenthesis_FDB parenthesis_FDB(fdb->csxoper);
if (proc.optional(parenthesis_FDB))
{
SXOPER * oper = dynamic_cast<SXOPER*> (elements_.front().get());
if (oper)
int count = elements_.size();
while(count > 0)
{
m_arGRPSXOPER.push_back(elements_.front());
}
else
{
SXRANGE *range = dynamic_cast<SXRANGE*> (elements_.front().get());
if (range)
m_SXRANGE = elements_.front();
SXOPER * operatr = dynamic_cast<SXOPER*> (elements_.front().get());
if (operatr)
{
m_arGRPSXOPER.push_back(elements_.front());
//bString |= operatr->bString;
//bDate |= operatr->bDate;
//bNumber |= operatr->bNumber;
//bEmpty |= operatr->bEmpty;
}
else
{
SxIsxoper * isOper = dynamic_cast<SxIsxoper*> (elements_.front().get());
if (isOper)
m_arSxIsxoper.push_back(elements_.front());
SXRANGE *range = dynamic_cast<SXRANGE*> (elements_.front().get());
if (range)
m_SXRANGE = elements_.front();
else
{
SxIsxoper * isOper = dynamic_cast<SxIsxoper*> (elements_.front().get());
if (isOper)
m_arSxIsxoper.push_back(elements_.front());
}
}
elements_.pop_front();
count--;
}
elements_.pop_front();
count--;
}
}
@ -135,10 +158,153 @@ const bool FDB::loadContent(BinProcessor& proc)
while(count--)
{
m_arSRCSXOPER.push_back(elements_.front()); elements_.pop_front();
SXOPER* operatr = dynamic_cast<SXOPER*> (m_arSRCSXOPER.back().get());
bString |= operatr->bString;
bDate |= operatr->bDate;
bNumber |= operatr->bNumber;
bEmpty |= operatr->bEmpty;
bInteger|= operatr->bInteger;
}
return true;
}
int FDB::serialize(std::wostream & strm)
{
SXFDB* fdb = dynamic_cast<SXFDB*>(m_SXFDB.get());
SXFDBType* fdb_type = dynamic_cast<SXFDBType*>(m_SXFDBType.get());
if (!fdb || !fdb_type) return 0;
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"cacheField")
{
CP_XML_ATTR(L"name", fdb->stFieldName.value());
if (fdb_type->wTypeSql > 0)
{
CP_XML_ATTR(L"numFmtId", fdb_type->wTypeSql);
}
if (m_arSRCSXOPER.empty() && m_arGRPSXOPER.empty() == false)
{
CP_XML_ATTR(L"databaseField", 0);
}
switch(fdb_type->wTypeSql)//format code
{
case 0x0000:
case 0x0001:
case 0x0003:
case 0x0004:
case 0x0005:
case 0x0006:
case 0x0007:
case 0x0008:
case 0x000B:
case 0x000C:
case 0xFFF9:
case 0xFFFE:
break;
}
if(m_SXFMLA)
{
//{formula
}
if (m_arSRCSXOPER.empty() == false)
{
CP_XML_NODE(L"sharedItems")
{
//использовать поля присутствия из xls низя - они частенько записаны неверно!!
//if (!fdb->fNonDates) CP_XML_ATTR(L"containsNonDate", fdb->fNonDates);
//if (fdb->fDateInField) CP_XML_ATTR(L"containsDate", fdb->fDateInField);
//if (fdb->fNumField) CP_XML_ATTR(L"containsNumber", fdb->fNumField);
////CP_XML_ATTR(L"containsBlank", fdb->fTextEtcField);
//if (m_arSRCSXOPER.empty())
//{
// if (!fdb->fTextEtcField)
// {
// CP_XML_ATTR(L"containsString", 0);
// }
// else if (fdb->fNumField || fdb->fDateInField)
// {
// CP_XML_ATTR(L"containsBlank", 1);
// CP_XML_ATTR(L"containsString", 0);
// }
//}
if (bInteger)
{
if (bNumber) bInteger = false;
else bNumber = true;
}
if ((bDate & bNumber) || (bNumber & bString))
{
CP_XML_ATTR(L"containsSemiMixedTypes", 1);
}
else if ( bDate & bString)
{
CP_XML_ATTR(L"containsMixedTypes", 1);
}
else if (!bEmpty && !bString)
{
CP_XML_ATTR(L"containsSemiMixedTypes", 0);
}
if (bNumber) CP_XML_ATTR(L"containsNumber", 1);
if (bDate) CP_XML_ATTR(L"containsDate", 1);
if (!bString) CP_XML_ATTR(L"containsString", 0);
if (bEmpty) CP_XML_ATTR(L"containsBlank", 1);
if (bInteger) CP_XML_ATTR(L"containsInteger", 1);
if (fdb->fnumMinMaxValid)
{
//if (fdb->fDateInField)
//{
// CP_XML_ATTR(L"minDate", 0); // "2007-11-18T00:00:00"
// CP_XML_ATTR(L"maxDate", 0); // "2007-12-25T00:00:00"
//}
//else if (fdb->fNumField)
//{
// CP_XML_ATTR(L"minValue", 0);
// CP_XML_ATTR(L"maxValue", 0);
//}
}
CP_XML_ATTR(L"count", m_arSRCSXOPER.size());
for (size_t i = 0; i < m_arSRCSXOPER.size(); i++)
{
m_arSRCSXOPER[i]->serialize(CP_XML_STREAM());
}
}
}
if (m_arGRPSXOPER.empty() == false)
{
CP_XML_NODE(L"fieldGroup")
{
if (fdb->ifdbParent > 0)
CP_XML_ATTR(L"par", fdb->ifdbParent);
if (m_SXRANGE)
m_SXRANGE->serialize(CP_XML_STREAM());
CP_XML_NODE(L"groupItems")
{
CP_XML_ATTR(L"count", m_arGRPSXOPER.size());
for (size_t i = 0; i < m_arGRPSXOPER.size(); i++)
{
m_arGRPSXOPER[i]->serialize(CP_XML_STREAM());
}
}
}
}
}
}
return 0;
}
} // namespace XLS

View File

@ -47,6 +47,8 @@ public:
virtual const bool loadContent(BinProcessor& proc);
int serialize(std::wostream & strm);
static const ElementType type = typeFDB;
BaseObjectPtr m_SXFDB;
@ -57,6 +59,13 @@ public:
std::vector<BaseObjectPtr> m_arGRPSXOPER;
BaseObjectPtr m_SXRANGE;
std::vector<BaseObjectPtr> m_arSxIsxoper;
bool bString;
bool bDate;
bool bNumber;
bool bEmpty;
bool bInteger;
};
} // namespace XLS

View File

@ -36,8 +36,6 @@
namespace XLS
{
// Logical representation of GLOBALS union of records
class GLOBALS: public CompositeObject
{
BASE_OBJECT_DEFINE_CLASS_NAME(GLOBALS)
@ -49,7 +47,7 @@ public:
virtual const bool loadContent (BinProcessor& proc);
static const ElementType type = typeGLOBALS;
static const ElementType type = typeGLOBALS;
int serialize(std::wostream & stream);

View File

@ -47,7 +47,6 @@ PIVOTCACHE::PIVOTCACHE()
{
}
PIVOTCACHE::~PIVOTCACHE()
{
}
@ -61,6 +60,8 @@ BaseObjectPtr PIVOTCACHE::clone()
// PIVOTCACHE = SXDB SXDBEx *SXFORMULA *FDB *DBB EOF
const bool PIVOTCACHE::loadContent(BinProcessor& proc)
{
GlobalWorkbookInfoPtr global_info = proc.getGlobalWorkbookInfo();
if(!proc.mandatory<SXDB>())
{
return false;
@ -91,6 +92,17 @@ const bool PIVOTCACHE::loadContent(BinProcessor& proc)
while(count--)
{
m_arDBB.push_back(elements_.front()); elements_.pop_front();
DBB* dbb = dynamic_cast<DBB*>(m_arDBB.back().get());
if (global_info->arCacheFieldShortSize.size() >= m_arDBB.size())
{
dbb->fShortIitms = global_info->arCacheFieldShortSize[m_arDBB.size() - 1];
}
else
{
//???? группы??
}
}
if (proc.optional<EOF_T>())
{

View File

@ -31,10 +31,14 @@
*/
#include "PIVOTCACHEDEFINITION.h"
#include <Logic/Biff_records/SXStreamID.h>
#include <Logic/Biff_records/SXVS.h>
#include <Logic/Biff_unions/SXSRC.h>
#include <Logic/Biff_unions/SXADDLCACHE.h>
#include "PIVOTCACHE.h"
#include "SXSRC.h"
#include "SXADDLCACHE.h"
#include "../Biff_records/SXStreamID.h"
#include "../Biff_records/SXVS.h"
#include "../Biff_records/SXDB.h"
#include "../Biff_records/SXDBEx.h"
namespace XLS
{
@ -59,6 +63,8 @@ BaseObjectPtr PIVOTCACHEDEFINITION::clone()
// PIVOTCACHEDEFINITION = SXStreamID SXVS [SXSRC] [SXADDLCACHE]
const bool PIVOTCACHEDEFINITION::loadContent(BinProcessor& proc)
{
global_info_ = proc.getGlobalWorkbookInfo();
if(!proc.mandatory<SXStreamID>())
{
return false;
@ -83,6 +89,94 @@ const bool PIVOTCACHEDEFINITION::loadContent(BinProcessor& proc)
}
return true;
}
int PIVOTCACHEDEFINITION::serialize_definitions(std::wostream & strm)
{
SXStreamID* streamId = dynamic_cast<SXStreamID*>(m_SXStreamID.get());
if (!streamId) return 0;
std::map<int, BaseObjectPtr>::iterator pFind = global_info_->mapPivotCache.find(streamId->idStm);
if (pFind == global_info_->mapPivotCache.end()) return 0;
PIVOTCACHE* pivot_cache = dynamic_cast<PIVOTCACHE*>(pFind->second.get());
if (!pivot_cache) return 0;
SXDB* db = dynamic_cast<SXDB*>(pivot_cache->m_SXDB.get());
SXDBEx* db_ex = dynamic_cast<SXDBEx*>(pivot_cache->m_SXDBEx.get());
if (!db || !db_ex)return 0;
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"pivotCacheDefinition")
{
CP_XML_ATTR(L"xmlns", L"http://schemas.openxmlformats.org/spreadsheetml/2006/main");
CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
if (pivot_cache->m_arDBB.empty() == false)
{
CP_XML_ATTR(L"r:id", L"rId1" );
}
CP_XML_ATTR(L"enableRefresh", 1);
CP_XML_ATTR(L"refreshedBy", db->rgb.value());
CP_XML_ATTR(L"refreshedDate", db_ex->numDate.data.value);
CP_XML_ATTR(L"recordCount", db->crdbUsed);
//createdVersion="1"
//refreshedVersion="2"
//upgradeOnRefresh="1">
SXSRC* src = dynamic_cast<SXSRC*>(m_SXSRC.get());
if (src)
src->serialize(CP_XML_STREAM());
if (pivot_cache->m_arFDB.empty() == false)
{
CP_XML_NODE(L"cacheFields")
{
CP_XML_ATTR(L"count", pivot_cache->m_arFDB.size());
for (size_t i = 0; i < pivot_cache->m_arFDB.size(); i++)
{
pivot_cache->m_arFDB[i]->serialize(CP_XML_STREAM());
}
}
}
}
}
return 0;
}
int PIVOTCACHEDEFINITION::serialize_records(std::wostream & strm)
{
SXStreamID* streamId = dynamic_cast<SXStreamID*>(m_SXStreamID.get());
if (!streamId) return 0;
std::map<int, BaseObjectPtr>::iterator pFind = global_info_->mapPivotCache.find(streamId->idStm);
if (pFind == global_info_->mapPivotCache.end()) return 0;
PIVOTCACHE* pivot_cache = dynamic_cast<PIVOTCACHE*>(pFind->second.get());
if (!pivot_cache) return 0;
if (pivot_cache->m_arDBB.empty()) return 0;
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"pivotCacheRecords")
{
CP_XML_ATTR(L"xmlns", L"http://schemas.openxmlformats.org/spreadsheetml/2006/main");
CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
CP_XML_ATTR(L"count", pivot_cache->m_arDBB.size());
for (size_t i = 0; i < pivot_cache->m_arDBB.size(); i++)
{
pivot_cache->m_arDBB[i]->serialize(CP_XML_STREAM());
}
}
}
return 0;
}
} // namespace XLS

View File

@ -48,6 +48,9 @@ public:
BaseObjectPtr clone();
virtual const bool loadContent(BinProcessor& proc);
int serialize_definitions(std::wostream & stream);
int serialize_records(std::wostream & stream);
static const ElementType type = typePIVOTCACHEDEFINITION;
@ -55,6 +58,8 @@ public:
BaseObjectPtr m_SXVS;
BaseObjectPtr m_SXSRC;
BaseObjectPtr m_SXADDLCACHE;
GlobalWorkbookInfoPtr global_info_;
};
} // namespace XLS

View File

@ -31,34 +31,31 @@
*/
#include "PIVOTCORE.h"
#include <Logic/Biff_records/SxView.h>
#include <Logic/Biff_unions/PIVOTVD.h>
#include <Logic/Biff_unions/PIVOTIVD.h>
#include <Logic/Biff_unions/PIVOTPI.h>
#include <Logic/Biff_records/SXDI.h>
#include <Logic/Biff_unions/PIVOTLI.h>
#include <Logic/Biff_unions/PIVOTEX.h>
#include "PIVOTVD.h"
#include "PIVOTIVD.h"
#include "PIVOTPI.h"
#include "PIVOTLI.h"
#include "PIVOTEX.h"
#include "../Biff_records/SXDI.h"
#include "../Biff_records/SxView.h"
namespace XLS
{
PIVOTCORE::PIVOTCORE()
{
}
PIVOTCORE::~PIVOTCORE()
{
}
BaseObjectPtr PIVOTCORE::clone()
{
return BaseObjectPtr(new PIVOTCORE(*this));
}
// PIVOTCORE = SxView *PIVOTVD *2PIVOTIVD [PIVOTPI] *SXDI *PIVOTLI PIVOTEX
const bool PIVOTCORE::loadContent(BinProcessor& proc)
{

View File

@ -55,7 +55,6 @@ BaseObjectPtr PIVOTFRT9::clone()
return BaseObjectPtr(new PIVOTFRT9(*this));
}
// PIVOTFRT9 = QsiSXTag [DBQUERYEXT] [PIVOTVIEWEX] SXViewEx9
const bool PIVOTFRT9::loadContent(BinProcessor& proc)
{

View File

@ -31,13 +31,12 @@
*/
#include "PIVOTIVD.h"
#include <Logic/Biff_records/SxIvd.h>
#include <Logic/Biff_records/Continue.h>
#include "../Biff_records/SxIvd.h"
#include "../Biff_records/Continue.h"
namespace XLS
{
PIVOTIVD::PIVOTIVD()
{
}
@ -53,7 +52,6 @@ BaseObjectPtr PIVOTIVD::clone()
return BaseObjectPtr(new PIVOTIVD(*this));
}
// PIVOTIVD = SxIvd *Continue
const bool PIVOTIVD::loadContent(BinProcessor& proc)
{
@ -68,6 +66,21 @@ const bool PIVOTIVD::loadContent(BinProcessor& proc)
return true;
}
int PIVOTIVD::serialize(std::wostream & strm)
{
SxIvd* vd = dynamic_cast<SxIvd*>(m_SxIvd.get());
CP_XML_WRITER(strm)
{
for (size_t i = 0; i < vd->rgSxivd.size(); i++)
{
CP_XML_NODE(L"field")
{
CP_XML_ATTR(L"x", vd->rgSxivd[i]);
}
}
}
return 0;
}
} // namespace XLS

View File

@ -47,6 +47,8 @@ public:
virtual const bool loadContent(BinProcessor& proc);
int serialize(std::wostream & strm);
static const ElementType type = typePIVOTIVD;
BaseObjectPtr m_SxIvd;

View File

@ -31,29 +31,26 @@
*/
#include "PIVOTLI.h"
#include <Logic/Biff_records/SXLI.h>
#include <Logic/Biff_records/Continue.h>
#include "../Biff_records/SXLI.h"
#include "../Biff_records/Continue.h"
namespace XLS
{
PIVOTLI::PIVOTLI()
{
}
PIVOTLI::~PIVOTLI()
{
}
BaseObjectPtr PIVOTLI::clone()
{
return BaseObjectPtr(new PIVOTLI(*this));
}
// PIVOTLI = SXLI *Continue
const bool PIVOTLI::loadContent(BinProcessor& proc)
{
@ -61,10 +58,58 @@ const bool PIVOTLI::loadContent(BinProcessor& proc)
{
return false;
}
m_SXLI = elements_.back();
elements_.pop_back();
proc.repeated<Continue>(0, 0);
return true;
}
int PIVOTLI::serialize(std::wostream & strm)
{
SXLI* line_items = dynamic_cast<SXLI*>(m_SXLI.get());
if (!line_items) return 0;
CP_XML_WRITER(strm)
{
for (size_t i = 0; i < line_items->m_arItems.size(); i++)
{
CP_XML_NODE(L"i")
{
switch(line_items->m_arItems[i].itmType)
{
case 0x0001: CP_XML_ATTR(L"t", L"default"); break;
case 0x0002: CP_XML_ATTR(L"t", L"sum"); break;
case 0x0003: CP_XML_ATTR(L"t", L"countA"); break;
case 0x0004: CP_XML_ATTR(L"t", L"count"); break;
case 0x0005: CP_XML_ATTR(L"t", L"avg"); break;
case 0x0006: CP_XML_ATTR(L"t", L"max"); break;
case 0x0007: CP_XML_ATTR(L"t", L"min"); break;
case 0x0008: CP_XML_ATTR(L"t", L"product"); break;
case 0x0009: CP_XML_ATTR(L"t", L"stdDev"); break;
case 0x000A: CP_XML_ATTR(L"t", L"stdDevP"); break;
case 0x000B: CP_XML_ATTR(L"t", L"var"); break;
case 0x000C: CP_XML_ATTR(L"t", L"varP"); break;
case 0x000D: CP_XML_ATTR(L"t", L"grand"); break;
case 0x000E: CP_XML_ATTR(L"t", L"blank"); break;
}
if (line_items->m_arItems[i].cSic > 0 && line_items->m_arItems[i].itmType == 0)//??
{
CP_XML_ATTR(L"r", line_items->m_arItems[i].cSic);
}
for (size_t j = line_items->m_arItems[i].cSic; j < line_items->m_arItems[i].rgisxvi.size(); j++)
{
CP_XML_NODE(L"x")
{
CP_XML_ATTR(L"v", line_items->m_arItems[i].rgisxvi[j]);
}
}
}
}
}
}
} // namespace XLS

View File

@ -36,8 +36,6 @@
namespace XLS
{
// Logical representation of PIVOTLI union of records
class PIVOTLI: public CompositeObject
{
BASE_OBJECT_DEFINE_CLASS_NAME(PIVOTLI)
@ -49,7 +47,11 @@ public:
virtual const bool loadContent(BinProcessor& proc);
static const ElementType type = typePIVOTLI;
int serialize(std::wostream & strm);
static const ElementType type = typePIVOTLI;
BaseObjectPtr m_SXLI;
};
} // namespace XLS

View File

@ -31,13 +31,12 @@
*/
#include "PIVOTPI.h"
#include <Logic/Biff_records/SXPI.h>
#include <Logic/Biff_records/Continue.h>
#include "../Biff_records/SXPI.h"
#include "../Biff_records/Continue.h"
namespace XLS
{
PIVOTPI::PIVOTPI()
{
}
@ -53,7 +52,6 @@ BaseObjectPtr PIVOTPI::clone()
return BaseObjectPtr(new PIVOTPI(*this));
}
// PIVOTPI = SXPI *Continue
const bool PIVOTPI::loadContent(BinProcessor& proc)
{
@ -69,5 +67,22 @@ const bool PIVOTPI::loadContent(BinProcessor& proc)
return true;
}
int PIVOTPI::serialize(std::wostream & strm)
{
SXPI* page_items = dynamic_cast<SXPI*>(m_SXPI.get());
if (!page_items) return 0;
CP_XML_WRITER(strm)
{
for (size_t i = 0; i < page_items->m_arItems.size(); i++)
{
CP_XML_NODE(L"pageField")
{
CP_XML_ATTR(L"fld", page_items->m_arItems[i].isxvd);
CP_XML_ATTR(L"hier",0);
}
}
}
}
} // namespace XLS

View File

@ -47,6 +47,8 @@ public:
virtual const bool loadContent(BinProcessor& proc);
int serialize(std::wostream & strm);
static const ElementType type = typePIVOTPI;
BaseObjectPtr m_SXPI;

View File

@ -31,30 +31,26 @@
*/
#include "PIVOTVD.h"
#include <Logic/Biff_records/Sxvd.h>
#include <Logic/Biff_records/SXVI.h>
#include <Logic/Biff_records/SXVDEx.h>
#include "../Biff_records/Sxvd.h"
#include "../Biff_records/SXVI.h"
#include "../Biff_records/SXVDEx.h"
namespace XLS
{
PIVOTVD::PIVOTVD()
{
}
PIVOTVD::~PIVOTVD()
{
}
BaseObjectPtr PIVOTVD::clone()
{
return BaseObjectPtr(new PIVOTVD(*this));
}
// PIVOTVD = Sxvd *SXVI SXVDEx
const bool PIVOTVD::loadContent(BinProcessor& proc)
{
@ -79,6 +75,92 @@ const bool PIVOTVD::loadContent(BinProcessor& proc)
return true;
}
int PIVOTVD::serialize(std::wostream & strm)
{
Sxvd* vd = dynamic_cast<Sxvd*>(m_Sxvd.get());
SXVDEx* vd_ex = dynamic_cast<SXVDEx*>(m_SXVDEx.get());
if (!vd || !vd_ex) return 0;
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"pivotField")
{
if (vd->sxaxis.bRw) CP_XML_ATTR(L"axis", L"axisRow");
else if (vd->sxaxis.bCol) CP_XML_ATTR(L"axis", L"axisCol");
else if (vd->sxaxis.bPage) CP_XML_ATTR(L"axis", L"axisPage");
else if (vd->sxaxis.bData)
{
CP_XML_ATTR(L"dataField", 1);
}
CP_XML_ATTR(L"compact", 0);
if (vd_ex->ifmt > 0)
{
CP_XML_ATTR(L"numFmtId", vd_ex->ifmt);
}
if (vd->stName.value().empty() == false)
CP_XML_ATTR(L"name", vd->stName.value());
if (vd->fCounta) CP_XML_ATTR(L"countASubtotal", 1);
if (vd->fCount) CP_XML_ATTR(L"countSubtotal", 1);
if (vd->fSum) CP_XML_ATTR(L"sumSubtotal", 1);
if (vd->fAverage) CP_XML_ATTR(L"avgSubtotal", 1);
if (vd->fMax) CP_XML_ATTR(L"maxSubtotal", 1);
if (vd->fMin) CP_XML_ATTR(L"minSubtotal", 1);
if (vd->fProduct) CP_XML_ATTR(L"productSubtotal", 1);
if (vd->fStdev) CP_XML_ATTR(L"stdSubtotal", 1);
if (vd->fStdevp) CP_XML_ATTR(L"stdDevSubtotal", 1);
if (vd->fVariance) CP_XML_ATTR(L"varSubtotal", 1);
if (vd->fVariancep) CP_XML_ATTR(L"varPSubtotal", 1);
CP_XML_ATTR(L"outline", vd_ex->fOutline);
CP_XML_ATTR(L"subtotalTop", vd_ex->fSubtotalAtTop);
CP_XML_ATTR(L"showAll", vd_ex->fShowAllItems);
if (vd_ex->fNotDragToData) CP_XML_ATTR(L"dragToData", 0);
if (!vd_ex->fDragToRow) CP_XML_ATTR(L"dragToRow", 0);
if (!vd_ex->fDragToColumn) CP_XML_ATTR(L"dragToCol", 0);
if (!vd_ex->fDragToPage) CP_XML_ATTR(L"dragToPage", 0);
if (vd_ex->fHideNewItems) CP_XML_ATTR(L"hideNewItems", 1);
if (vd_ex->fInsertBlankRow) CP_XML_ATTR(L"insertBlankRow", 1);
if (vd_ex->fPageBreaksBetweenItems) CP_XML_ATTR(L"insertPageBreak", 1);
if (!vd_ex->fTopAutoShow) CP_XML_ATTR(L"topAutoShow", 0);
//if (!vd_ex->fDragToHide) CP_XML_ATTR(L"dragOff", 0); //??
if (vd_ex->fServerBased) CP_XML_ATTR(L"serverField", 1);
//CP_XML_ATTR(L"", vd_ex->fCalculatedField);
CP_XML_ATTR(L"includeNewItemsInFilter", 1);
//CP_XML_ATTR(L"nonAutoSortDefault", !vd_ex->fAutoSort);
if (vd_ex->fAutoSort)
{
// vd_ex->isxdiAutoSort
if (vd_ex->fAscendSort) CP_XML_ATTR(L"sortType", L"ascending");
}
if (vd_ex->isxdiAutoShow >= 0)
{
CP_XML_ATTR(L"rankBy", vd_ex->isxdiAutoShow);
}
if (!vd->fDefault) CP_XML_ATTR(L"defaultSubtotal", 0);
if (!m_arSXVI.empty())
{
CP_XML_NODE(L"items")
{
CP_XML_ATTR(L"count", m_arSXVI.size());
for (size_t i = 0; i < m_arSXVI.size(); i++)
{
m_arSXVI[i]->serialize(CP_XML_STREAM());
}
}
}
}
}
return 0;
}
} // namespace XLS

View File

@ -49,6 +49,8 @@ public:
static const ElementType type = typePIVOTVD;
int serialize(std::wostream & strm);
BaseObjectPtr m_Sxvd;
std::vector<BaseObjectPtr> m_arSXVI;
BaseObjectPtr m_SXVDEx;

View File

@ -31,29 +31,34 @@
*/
#include "PIVOTVIEW.h"
#include <Logic/Biff_unions/PIVOTCORE.h>
#include <Logic/Biff_unions/PIVOTFRT.h>
#include "PIVOTCORE.h"
#include "PIVOTFRT.h"
#include "PIVOTVD.h"
#include "PIVOTIVD.h"
#include "PIVOTPI.h"
#include "PIVOTLI.h"
#include "PIVOTEX.h"
#include "../Biff_records/SXDI.h"
#include "../Biff_records/SxView.h"
namespace XLS
{
PIVOTVIEW::PIVOTVIEW()
{
indexCache = -1;
}
PIVOTVIEW::~PIVOTVIEW()
{
}
BaseObjectPtr PIVOTVIEW::clone()
{
return BaseObjectPtr(new PIVOTVIEW(*this));
}
// PIVOTVIEW = PIVOTCORE [PIVOTFRT]
const bool PIVOTVIEW::loadContent(BinProcessor& proc)
{
@ -73,5 +78,135 @@ const bool PIVOTVIEW::loadContent(BinProcessor& proc)
return true;
}
int PIVOTVIEW::serialize(std::wostream & strm)
{
PIVOTCORE* core = dynamic_cast<PIVOTCORE*>(m_PIVOTCORE.get());
if (!core) return 0;
SxView* view = dynamic_cast<SxView*>(core->m_SxView.get());
if (!view) return 0;
PIVOTFRT* frt = dynamic_cast<PIVOTFRT*>(m_PIVOTFRT.get());
indexCache = view->iCache;
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"pivotTableDefinition")
{
CP_XML_ATTR(L"xmlns", L"http://schemas.openxmlformats.org/spreadsheetml/2006/main");
CP_XML_ATTR(L"name", view->stTable.value());
CP_XML_ATTR(L"cacheId", view->iCache);
CP_XML_ATTR(L"useAutoFormatting", view->fAutoFormat);
CP_XML_ATTR(L"dataOnRows", view->sxaxis4Data.bRw);
CP_XML_ATTR(L"autoFormatId", view->itblAutoFmt);
CP_XML_ATTR(L"applyNumberFormats", view->fAtrNum);
CP_XML_ATTR(L"applyBorderFormats", view->fAtrBdr);
CP_XML_ATTR(L"applyFontFormats", view->fAtrFnt);
CP_XML_ATTR(L"applyPatternFormats", view->fAtrPat);
CP_XML_ATTR(L"applyAlignmentFormats", view->fAtrAlc);
CP_XML_ATTR(L"applyWidthHeightFormats", view->fAtrProc);
if (!view->stData.value().empty())
{
CP_XML_ATTR(L"dataCaption", view->stData.value());
}
//updatedVersion="2"
//asteriskTotals="1"
//showMemberPropertyTips="0"
//itemPrintTitles="1"
//createdVersion="1"
//indent="0"
//compact="0"
//compactData="0"
//gridDropZones="1"
CP_XML_NODE(L"location")
{
CP_XML_ATTR(L"ref", view->ref.toString());
CP_XML_ATTR(L"firstHeaderRow", view->rwFirstHead - view->ref.rowFirst );
CP_XML_ATTR(L"firstDataRow", view->rwFirstData - view->ref.rowFirst);
CP_XML_ATTR(L"firstDataCol", view->colFirstData - view->ref.columnFirst);
CP_XML_ATTR(L"rowPageCount", 1);
CP_XML_ATTR(L"colPageCount", 1);
}
CP_XML_NODE(L"pivotFields")
{
CP_XML_ATTR(L"count", view->cDim);//Sxvd
for (size_t i = 0; i < core->m_arPIVOTVD.size(); i++)
{
core->m_arPIVOTVD[i]->serialize(CP_XML_STREAM());
}
}
if (core->m_arPIVOTIVD.size() >= 1)
{
CP_XML_NODE(L"rowFields")
{
CP_XML_ATTR(L"count", view->cDimRw);
PIVOTIVD* ivd = dynamic_cast<PIVOTIVD*>(core->m_arPIVOTIVD[0].get());
ivd->serialize(CP_XML_STREAM());
}
}
if (core->m_arPIVOTLI.size() >= 1)//0 or 2
{
CP_XML_NODE(L"rowItems")
{
CP_XML_ATTR(L"count", view->cRw);
PIVOTLI* line = dynamic_cast<PIVOTLI*>(core->m_arPIVOTLI[0].get());
line->serialize(CP_XML_STREAM());
}
}
if (core->m_arPIVOTIVD.size() == 2)//0 or 2
{
CP_XML_NODE(L"colFields")
{
CP_XML_ATTR(L"count", view->cDimCol);
PIVOTIVD* ivd = dynamic_cast<PIVOTIVD*>(core->m_arPIVOTIVD[1].get());
ivd->serialize(CP_XML_STREAM());
}
}
if (core->m_arPIVOTLI.size() == 2)//0 or 2
{
CP_XML_NODE(L"colItems")
{
CP_XML_ATTR(L"count", view->cCol);
PIVOTLI* line = dynamic_cast<PIVOTLI*>(core->m_arPIVOTLI[1].get());
line->serialize(CP_XML_STREAM());
}
}
if (core->m_PIVOTPI)
{
CP_XML_NODE(L"pageFields")
{
CP_XML_ATTR(L"count", view->cDimPg);
core->m_PIVOTPI->serialize(CP_XML_STREAM());
}
}
CP_XML_NODE(L"dataFields")
{
CP_XML_ATTR(L"count", view->cDimData);
for (size_t i = 0; i < core->m_arSXDI.size(); i++)
{
core->m_arSXDI[i]->serialize(CP_XML_STREAM());
}
}
//CP_XML_NODE(L"pivotTableStyleInfo")
//{
// CP_XML_ATTR(L"showRowHeaders", 1);
// CP_XML_ATTR(L"showColHeaders", 1);
// CP_XML_ATTR(L"showRowStripes", 0);
// CP_XML_ATTR(L"showColStripes", 0);
// CP_XML_ATTR(L"showLastColumn", 1);
//}
}
}
return 0;
}
} // namespace XLS

View File

@ -47,10 +47,14 @@ public:
virtual const bool loadContent(BinProcessor& proc);
int serialize(std::wostream & strm);
static const ElementType type = typePIVOTVIEW;
BaseObjectPtr m_PIVOTCORE;
BaseObjectPtr m_PIVOTFRT;
//----------------------------------
int indexCache;
};
} // namespace XLS

View File

@ -39,23 +39,19 @@
namespace XLS
{
PIVOTVIEWEX::PIVOTVIEWEX()
{
}
PIVOTVIEWEX::~PIVOTVIEWEX()
{
}
BaseObjectPtr PIVOTVIEWEX::clone()
{
return BaseObjectPtr(new PIVOTVIEWEX(*this));
}
// PIVOTVIEWEX = SXViewEx *PIVOTTH *SXPIEx *PIVOTVDTEX
const bool PIVOTVIEWEX::loadContent(BinProcessor& proc)
{

View File

@ -43,9 +43,13 @@ namespace XLS
SXOPER::SXOPER()
{
bString = false;
bDate = false;
bNumber = false;
bEmpty = false;
bInteger= false;
}
SXOPER::~SXOPER()
{
}
@ -60,27 +64,51 @@ const bool SXOPER::loadContent(BinProcessor& proc)
{
if(proc.optional<SxNil>())
{
bEmpty = true;
}
else if(proc.optional<SXNum>())
{
SXNum *num = dynamic_cast<SXNum*>(elements_.back().get());
if (num)
{
bInteger = (num->num.data.bytes.Byte1==num->num.data.bytes.Byte2 &&
num->num.data.bytes.Byte2==num->num.data.bytes.Byte3 &&
num->num.data.bytes.Byte3==num->num.data.bytes.Byte4 &&
num->num.data.bytes.Byte4==0);
}
bNumber = !bInteger;
}
else if(proc.optional<SxBool>())
{
bNumber = true;
}
else if(proc.optional<SxErr>())
{
bNumber = true;
}
else if(proc.optional<SXString>())
{
bString = true;
}
else if(proc.optional<SXDtr>())
{
bDate =true;
}
else
return false;
m_element = elements_.back();
elements_.pop_back();
return true;
}
int SXOPER::serialize(std::wostream & strm)
{
if (!m_element) return 0;
m_element->serialize(strm);
return 0;
}
} // namespace XLS

View File

@ -47,9 +47,17 @@ public:
virtual const bool loadContent(BinProcessor& proc);
static const ElementType type = typeSXOPER;
int serialize(std::wostream & strm);
BaseObjectPtr m_SXOPER;
static const ElementType type = typeSXOPER;
BaseObjectPtr m_element;
bool bString;
bool bDate;
bool bNumber;
bool bEmpty;
bool bInteger;
};
} // namespace XLS

View File

@ -92,10 +92,65 @@ const bool SXRANGE::loadContent(BinProcessor& proc)
if(proc.optional<Parenthesis_SXRANGE>())
{
while(elements_.empty() == false)
{
SXNum* num = dynamic_cast<SXNum*>(elements_.front().get());
if (num)
{
m_arSXNum.push_back(elements_.front());
}
else
{
SXDtr* dtr = dynamic_cast<SXDtr*>(elements_.front().get());
if (dtr)
{
m_arSXDtr.push_back(elements_.front());
}
}
elements_.pop_front();
}
}
return true;
}
int SXRANGE::serialize(std::wostream & strm)
{
SXRng* rng = dynamic_cast<SXRng*>(m_SXRng.get());
if (!rng) return 0;
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"rangePr")
{
switch(rng->iByType)
{
case 0: CP_XML_ATTR(L"groupBy", L"range"); break;
case 1: CP_XML_ATTR(L"groupBy", L"seconds"); break;
case 2: CP_XML_ATTR(L"groupBy", L"minutes"); break;
case 3: CP_XML_ATTR(L"groupBy", L"hours"); break;
case 4: CP_XML_ATTR(L"groupBy", L"days"); break;
case 5: CP_XML_ATTR(L"groupBy", L"months"); break;
case 6: CP_XML_ATTR(L"groupBy", L"quarters"); break;
case 7: CP_XML_ATTR(L"groupBy", L"years"); break;
}
if (m_arSXDtr.size() == 2)
{
SXDtr* startDate = dynamic_cast<SXDtr*>(m_arSXDtr[0].get());
SXDtr* endDate = dynamic_cast<SXDtr*>(m_arSXDtr[1].get());
CP_XML_ATTR(L"startDate", startDate->get_string_date());
CP_XML_ATTR(L"endDate", endDate->get_string_date());
}
if (m_arSXNum.size() == 3)
{
}
}
}
return 0;
}
} // namespace XLS

View File

@ -47,9 +47,13 @@ public:
virtual const bool loadContent(BinProcessor& proc);
static const ElementType type = typeSXRANGE;
int serialize(std::wostream & strm);
BaseObjectPtr m_SXRng;
static const ElementType type = typeSXRANGE;
BaseObjectPtr m_SXRng;
std::vector<BaseObjectPtr> m_arSXNum;
std::vector<BaseObjectPtr> m_arSXDtr;
};
} // namespace XLS

View File

@ -73,5 +73,13 @@ const bool SXSRC::loadContent(BinProcessor& proc)
return true;
}
int SXSRC::serialize(std::wostream & stream)
{
if (m_source)
m_source->serialize(stream);
return 0;
}
} // namespace XLS

View File

@ -47,7 +47,9 @@ public:
virtual const bool loadContent(BinProcessor& proc);
static const ElementType type = typeSXSRC;
int serialize(std::wostream & stream);
static const ElementType type = typeSXSRC;
BaseObjectPtr m_source;
};

View File

@ -100,6 +100,8 @@ public:
const static unsigned int initial_AXES_id = 0x2000000;
std::map<int, BaseObjectPtr> mapPivotCache;
std::vector<bool> arCacheFieldShortSize;
std::map<std::wstring, std::vector<std::wstring>> mapDefineNames;
std::vector<std::wstring> arDefineNames;
std::vector<std::wstring> arExternalNames;

View File

@ -621,12 +621,12 @@ namespace NSCustomShapesConvert
ConvertSum(oHandle.PolarCentre.y, oHandle.PolarCentreType.y, m_lIndexDst-2, ptFormula, 0, ptValue, false, true, false, m_oGuidsRes);
m_arIndexDst.push_back(m_lIndexDst-1);
std::wstring strMem = boost::lexical_cast<std::wstring>(m_lIndexDst-2);
std::wstring strMem = std::to_wstring(m_lIndexDst - 2);
oHandle.Pos.x = GetHandlePos(strMem, _T("w"), m_lWidth);
oHandle.PosType.x = ptFormula;
strMem = boost::lexical_cast<std::wstring>(m_lIndexDst-2);
strMem = std::to_wstring(m_lIndexDst - 2);
oHandle.Pos.y = GetHandlePos(strMem, _T("h"), m_lHeight);
oHandle.PosType.y = ptFormula;
}
@ -800,20 +800,20 @@ namespace NSCustomShapesConvert
case ptFormula:
{
if (bExtShape)
strValue = boost::lexical_cast<std::wstring>(lParam);
strValue = std::to_wstring(lParam);
else
strValue = boost::lexical_cast<std::wstring>(m_arIndexDst[lParam]);
strValue = std::to_wstring(m_arIndexDst[lParam]);
strValue = _T("gd") + strValue;
break;
}
case ptAdjust:
{
strValue = _T("adj") + boost::lexical_cast<std::wstring>(lParam);
strValue = _T("adj") + std::to_wstring(lParam);
break;
}
case ptValue:
{
strValue = boost::lexical_cast<std::wstring>(lParam);
strValue = std::to_wstring(lParam);
break;
}
default:
@ -1080,7 +1080,7 @@ namespace NSCustomShapesConvert
std::wstring strSize;
std::wstring strIndex;
strSize = boost::lexical_cast<std::wstring>( lSize);
strSize = std::to_wstring( lSize);
if ('#' == strParam[0])
{
@ -1114,7 +1114,7 @@ namespace NSCustomShapesConvert
m_lIndexSrc++;
m_arIndexDst.push_back(m_lIndexDst);
strIndex = boost::lexical_cast<std::wstring>(m_lIndexDst);
strIndex = std::to_wstring(m_lIndexDst);
m_oGuidsRes.WriteString(_T("<a:gd name=\"gd"));
m_oGuidsRes.WriteString(strIndex);

View File

@ -347,7 +347,7 @@ void XlsConverter::convert(XLS::WorkbookStreamObject* woorkbook)
count_sheets++;
xls_global_info->current_sheet = count_sheets;
xlsx_context->start_table(xls_global_info->sheets_names.size() > i ? xls_global_info->sheets_names[i] : L"Sheet_" + boost::lexical_cast<std::wstring>(count_sheets));
xlsx_context->start_table(xls_global_info->sheets_names.size() > i ? xls_global_info->sheets_names[i] : L"Sheet_" + std::to_wstring(count_sheets));
xlsx_context->set_state(xls_global_info->sheets_state.size() > i ? xls_global_info->sheets_state[i] : L"visible");
convert(dynamic_cast<XLS::WorksheetSubstream*>(woorkbook->m_arWorksheetSubstream[i].get()));
@ -356,7 +356,7 @@ void XlsConverter::convert(XLS::WorkbookStreamObject* woorkbook)
{
count_chart_sheets++;
xls_global_info->current_sheet = -1;
xlsx_context->start_table(xls_global_info->sheets_names.size() > i ? xls_global_info->sheets_names[i] : L"ChartSheet_" + boost::lexical_cast<std::wstring>(count_chart_sheets));
xlsx_context->start_table(xls_global_info->sheets_names.size() > i ? xls_global_info->sheets_names[i] : L"ChartSheet_" + std::to_wstring(count_chart_sheets));
convert_chart_sheet(dynamic_cast<XLS::ChartSheetSubstream*>(woorkbook->m_arWorksheetSubstream[i].get()));
}
@ -639,7 +639,7 @@ std::wstring XlsConverter::WriteMediaFile(char *data, int size, std::wstring typ
xlsx_context->get_mediaitems().create_media_path(xlsx_path);
bool res = false;
std::wstring file_name = L"image" + boost::lexical_cast<std::wstring>(id);
std::wstring file_name = L"image" + std::to_wstring(id);
if (type_ext == L"dib_data")
@ -1916,22 +1916,28 @@ void XlsConverter::convert(XLS::PIVOTVIEW * pivot_view)
{
if (pivot_view == NULL) return;
std::wstringstream strm;
pivot_view->serialize(strm);
int index_view = xlsx_context->get_pivots_context().add_view(strm.str(), pivot_view->indexCache);
if (index_view > 0)
{
xlsx_context->current_sheet().sheet_rels().add(oox::relationship(L"pvId" + std::to_wstring(index_view),
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotTable",
L"../pivotTables/pivotTable" + std::to_wstring(index_view) + L".xml"));
}
}
void XlsConverter::convert(XLS::PIVOTCACHEDEFINITION * pivot_cached)
{
if (pivot_cached == NULL) return;
xlsx_context->start_pivot_cache();
pivot_cached->serialize(xlsx_context->current_pivot_cache().definitions());
//if (pivot_cached->is_records())//??
{
xlsx_context->current_pivot_cache().isRecordsPresent = true;
//pivot_cached->serialize_records(xlsx_context->current_pivot_cache().records());
}
std::wstringstream strmD, strmR;
xlsx_context->end_pivot_cache();
pivot_cached->serialize_definitions(strmD);
pivot_cached->serialize_records(strmR);
xlsx_context->get_pivots_context().add_cache(strmD.str(), strmR.str());
}

View File

@ -86,7 +86,7 @@ std::wstring static get_default_file_name(external_items::Type type)
// }
// //todooo проверить
//
// return get_default_file_name(type) + boost::lexical_cast<std::wstring>(Num) + sExt;
// return get_default_file_name(type) + std::to_wstring(Num) + sExt;
//}
@ -95,7 +95,7 @@ std::wstring external_items::add_image(const std::wstring & image, int bin_id)
{
const bool isMediaInternal = true;
std::wstring rId = std::wstring(L"picId") + boost::lexical_cast<std::wstring>(count_image+1);
std::wstring rId = std::wstring(L"picId") + std::to_wstring(count_image+1);
count_image++;
items_.push_back( item(image, typeImage, isMediaInternal, bin_id, rId) );
@ -108,8 +108,8 @@ std::wstring external_items::add_chart(std::wstring & oox_target)
count_charts++;
std::wstring rId = std::wstring(L"chartId") + boost::lexical_cast<std::wstring>(count_charts);
oox_target = std::wstring(L"charts/chart") + boost::lexical_cast<std::wstring>(count_charts) + L".xml";
std::wstring rId = std::wstring(L"chartId") + std::to_wstring(count_charts);
oox_target = std::wstring(L"charts/chart") + std::to_wstring(count_charts) + L".xml";
items_.push_back( item(oox_target, typeChart, isMediaInternal, -1, rId) );

View File

@ -114,14 +114,14 @@ public:
if (c.author_ == author_list_[i])
{
find = true;
c.author_ = boost::lexical_cast<std::wstring>(i);
c.author_ = std::to_wstring(i);
break;
}
}
if (!find)
{
author_list_.push_back(c.author_);
c.author_ = boost::lexical_cast<std::wstring>(author_list_.size()-1);
c.author_ = std::to_wstring(author_list_.size()-1);
}
xlsx_comment_.push_back(c);
}

View File

@ -52,13 +52,13 @@ public:
std::pair<std::wstring, std::wstring> add_comments_xml(std::wstring const & content, xlsx_comments_ptr comments)
{
const std::wstring file_comments_id = boost::lexical_cast<std::wstring>(next_comments_file_id_++);
const std::wstring file_comments_id = std::to_wstring(next_comments_file_id_++);
const std::wstring fileName = std::wstring(L"comments") + file_comments_id + L".xml";
comments_.push_back(comment_elm(fileName, content, comments));
const std::wstring id = boost::lexical_cast<std::wstring>(next_comments_id_++);
const std::wstring id = std::to_wstring(next_comments_id_++);
const std::wstring rId = std::wstring(L"comId") + id;
return std::pair<std::wstring, std::wstring>(fileName, rId);
}

View File

@ -84,17 +84,7 @@ xlsx_xml_worksheet & xlsx_conversion_context::current_sheet()
throw std::runtime_error("internal error");
}
}
xlsx_pivot_cache_context & xlsx_conversion_context::current_pivot_cache()
{
if (!pivot_caches_.empty())
{
return *pivot_caches_.back().get();
}
else
{
throw std::runtime_error("internal error");
}
}
oox_chart_context & xlsx_conversion_context::current_chart()
{
if (!charts_.empty())
@ -133,15 +123,6 @@ void xlsx_conversion_context::end_chart()
{
}
void xlsx_conversion_context::start_pivot_cache()
{
pivot_caches_.push_back(xlsx_pivot_cache_context::create());
}
void xlsx_conversion_context::end_pivot_cache()
{
}
void xlsx_conversion_context::end_table()
{
get_table_context().serialize_hyperlinks(current_sheet().hyperlinks());
@ -165,7 +146,7 @@ void xlsx_conversion_context::end_document()
{
xlsx_xml_worksheet_ptr & sheet = sheets_[i];
count++;
const std::wstring id = std::wstring(L"sId") + boost::lexical_cast<std::wstring>(count);
const std::wstring slideRId = std::wstring(L"sId") + std::to_wstring(count);
package::sheet_content_ptr content = package::sheet_content::create();
////////////////////////////////////////////////////////////////////////////////////////////
@ -219,7 +200,7 @@ void xlsx_conversion_context::end_document()
CP_XML_ATTR(L"name", sheet->name());
CP_XML_ATTR(L"sheetId", count);
CP_XML_ATTR(L"state", sheet->state() );
CP_XML_ATTR(L"r:id", id);
CP_XML_ATTR(L"r:id", slideRId);
}
}
@ -246,6 +227,7 @@ void xlsx_conversion_context::end_document()
{
CP_XML_ATTR(L"xmlns", L"http://schemas.openxmlformats.org/spreadsheetml/2006/main");
CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
CP_XML_ATTR(L"xmlns:mc", L"http://schemas.openxmlformats.org/markup-compatibility/2006");
CP_XML_NODE(L"bookViews")
{
@ -271,11 +253,12 @@ void xlsx_conversion_context::end_document()
CP_XML_STREAM() << str_;
}
}
if (!pivot_caches_.empty())
int pivot_cache_count = xlsx_pivots_context_.get_cache_count();
if (pivot_cache_count > 0)
{
CP_XML_NODE(L"pivotCaches")
{
for (size_t i = 0; i < pivot_caches_.size(); i++)
for (int i = 0; i < pivot_cache_count; i++)
{
std::wstring rId = L"pcId" + std::to_wstring(i+1);
static const std::wstring sType = L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheDefinition";
@ -287,22 +270,29 @@ void xlsx_conversion_context::end_document()
{
CP_XML_ATTR(L"cacheId", std::to_wstring(i));
CP_XML_ATTR(L"r:id", rId);
//workbook_content.add_rels(relationship(rId, sType, sName));
}
pivot_caches_[i]->dump_rels(content->get_rels());
pivot_caches_[i]->write_to(content->definitions());
xlsx_pivots_context_.dump_rels_cache(i, content->get_rels());
xlsx_pivots_context_.write_cache_definitions_to(i, content->definitions());
xlsx_pivots_context_.write_cache_records_to(i, content->records());
if (pivot_caches_[i]->isRecordsPresent)
{
pivot_caches_[i]->write_records_to(content->records());
}
output_document_->get_xl_files().add_pivot_cache(content);
}
}
}
int pivot_view_count = xlsx_pivots_context_.get_view_count();
if (pivot_view_count > 0)
{
for (int i = 0; i < pivot_view_count; i++)
{
package::pivot_table_content_ptr content = package::pivot_table_content::create();
xlsx_pivots_context_.dump_rels_view(i, content->get_rels());
xlsx_pivots_context_.write_table_view_to(i, content->content());
output_document_->get_xl_files().add_pivot_table(content);
}
}
}
output_document_->get_xl_files().set_workbook( package::simple_element::create(L"workbook.xml", strm_workbook.str()) );

View File

@ -41,7 +41,7 @@
#include "xlsx_drawing_context.h"
#include "xlsx_chart_context.h"
#include "xlsx_comments_context.h"
#include "xlsx_pivot_cache_context.h"
#include "xlsx_pivots_context.h"
#include "xlsx_output_xml.h"
@ -71,9 +71,6 @@ public:
void start_chart();
void end_chart();
void start_pivot_cache();
void end_pivot_cache();
std::wostream & shared_strings() { return xlsx_shared_strings_; }
std::wostream & defined_names() { return xlsx_defined_names_; }
std::wostream & workbook_views() { return xlsx_workbook_views_; }
@ -84,8 +81,8 @@ public:
xlsx_xml_worksheet & current_sheet();
oox_chart_context & current_chart();
xlsx_pivot_cache_context & current_pivot_cache();
xlsx_pivots_context & get_pivots_context() {return xlsx_pivots_context_;}
xlsx_drawing_context & get_drawing_context();
xlsx_drawing_context_handle & get_drawing_context_handle();
xlsx_comments_context & get_comments_context();
@ -102,7 +99,6 @@ private:
std::vector<xlsx_xml_worksheet_ptr> sheets_;
std::vector<oox_chart_context_ptr> charts_;
std::vector<xlsx_pivot_cache_context_ptr> pivot_caches_;
//std::wstringstream defaultOutput_;
//std::pair<float,float> maxDigitSize_;
@ -111,6 +107,7 @@ private:
size_t next_vml_file_id_; //используется для footer/header & comments
xlsx_pivots_context xlsx_pivots_context_;
xlsx_table_context xlsx_table_context_;
xlsx_text_context xlsx_text_context_;

View File

@ -86,7 +86,7 @@ public:
std::pair<std::wstring, std::wstring> add_drawing_xml(std::wstring const & content, xlsx_drawings_rels_ptr rels)
{//todooo отсчеты номеров файлов отдельно
const std::wstring id = boost::lexical_cast<std::wstring>(next_drawing_id_++);
const std::wstring id = std::to_wstring(next_drawing_id_++);
const std::wstring fileName = std::wstring(L"drawing") + id + L".xml";
drawings_.push_back(drawing_elm(fileName, content, rels));
@ -97,8 +97,8 @@ public:
std::pair<std::wstring, std::wstring> add_drawing_vml(std::wstring const & content, xlsx_drawings_rels_ptr rels)
{
const std::wstring drawing_id = boost::lexical_cast<std::wstring>(next_drawing_id_++);
const std::wstring file_vml_id = boost::lexical_cast<std::wstring>(next_vml_file_id_++);
const std::wstring drawing_id = std::to_wstring(next_drawing_id_++);
const std::wstring file_vml_id = std::to_wstring(next_vml_file_id_++);
const std::wstring fileName = std::wstring(L"vmlDrawing") + file_vml_id + L".vml";
drawings_vml_.push_back(drawing_elm(fileName, content, rels));
@ -587,7 +587,7 @@ void xlsx_drawing_context::serialize_group()
if (drawing_state->name.empty())
{
drawing_state->name = L"Group_" + boost::lexical_cast<std::wstring>(count_object);
drawing_state->name = L"Group_" + std::to_wstring(count_object);
}
CP_XML_ATTR(L"name", drawing_state->name);
@ -641,24 +641,24 @@ void xlsx_drawing_context::serialize_shape_comment(_drawing_state_ptr & drawing_
std::wstringstream strmStyle;
strmStyle << L"position:absolute;";
strmStyle << L"margin-left:" << boost::lexical_cast<std::wstring>(drawing_state->child_anchor.x / 12700.) << L"pt;"; //in pt (1 pt = 12700 emu)
strmStyle << L"margin-top:" << boost::lexical_cast<std::wstring>(drawing_state->child_anchor.y / 12700.) << L"pt;";
strmStyle << L"width:" << boost::lexical_cast<std::wstring>(drawing_state->child_anchor.cx / 12700.) << L"pt;";
strmStyle << L"height:" << boost::lexical_cast<std::wstring>(drawing_state->child_anchor.cy / 12700.) << L"pt;";
strmStyle << L"z-index:" << boost::lexical_cast<std::wstring>(drawing_state->id) << L";";
strmStyle << L"margin-left:" << std::to_wstring(drawing_state->child_anchor.x / 12700.) << L"pt;"; //in pt (1 pt = 12700 emu)
strmStyle << L"margin-top:" << std::to_wstring(drawing_state->child_anchor.y / 12700.) << L"pt;";
strmStyle << L"width:" << std::to_wstring(drawing_state->child_anchor.cx / 12700.) << L"pt;";
strmStyle << L"height:" << std::to_wstring(drawing_state->child_anchor.cy / 12700.) << L"pt;";
strmStyle << L"z-index:" << std::to_wstring(drawing_state->id) << L";";
if (drawing_state->object.visible == false)
strmStyle << L"visibility:hidden;";
CP_XML_NODE(L"v:shape")
{
//CP_XML_ATTR(L"id" , boost::lexical_cast<std::wstring>(drawing_state->object.id));
//CP_XML_ATTR(L"id" , std::to_wstring(drawing_state->object.id));
CP_XML_ATTR(L"type" , L"_x0000_t202");
CP_XML_ATTR(L"fillcolor" , L"#" + drawing_state->fill.color.sRGB);
if (drawing_state->line.width > 0)
{
CP_XML_ATTR(L"strokeweight", boost::lexical_cast<std::wstring>(drawing_state->line.width) +L"pt");
CP_XML_ATTR(L"strokeweight", std::to_wstring(drawing_state->line.width) +L"pt");
}
CP_XML_ATTR(L"style", strmStyle.str());
@ -770,9 +770,9 @@ void xlsx_drawing_context::serialize_vml_pic(_drawing_state_ptr & drawing_state,
std::wstring style = std::wstring(L"position:absolute;margin-left:0;margin-top:0;");
//todooo сделать "покороче" значения .. достаточно 2 знаков после запятой
style += std::wstring(L"width:") + boost::lexical_cast<std::wstring>(drawing_state->child_anchor.cx) + std::wstring(L"pt;");
style += std::wstring(L"height:") + boost::lexical_cast<std::wstring>(drawing_state->child_anchor.cy) + std::wstring(L"pt;");
style += std::wstring(L"z-index:") + boost::lexical_cast<std::wstring>(drawing_state->id) + std::wstring(L";");
style += std::wstring(L"width:") + std::to_wstring(drawing_state->child_anchor.cx) + std::wstring(L"pt;");
style += std::wstring(L"height:") + std::to_wstring(drawing_state->child_anchor.cy) + std::wstring(L"pt;");
style += std::wstring(L"z-index:") + std::to_wstring(drawing_state->id) + std::wstring(L";");
CP_XML_ATTR(L"style",style);
@ -865,7 +865,7 @@ void xlsx_drawing_context::serialize_chart(_drawing_state_ptr & drawing_state, s
CP_XML_ATTR(L"id", drawing_state->id);
if (drawing_state->name.empty())
drawing_state->name = L"Chart_" + boost::lexical_cast<std::wstring>(count_object);
drawing_state->name = L"Chart_" + std::to_wstring(count_object);
CP_XML_ATTR(L"name", drawing_state->name);
if (!drawing_state->description.empty())
@ -941,9 +941,9 @@ void xlsx_drawing_context::serialize_shape(_drawing_state_ptr & drawing_state)
if (drawing_state->name.empty())
{
if (drawing_state->wordart.is)
drawing_state->name = L"WordArt_" + boost::lexical_cast<std::wstring>(count_object);
drawing_state->name = L"WordArt_" + std::to_wstring(count_object);
else
drawing_state->name = L"Shape_" + boost::lexical_cast<std::wstring>(count_object);
drawing_state->name = L"Shape_" + std::to_wstring(count_object);
}
CP_XML_ATTR(L"name", drawing_state->name);
@ -2232,7 +2232,7 @@ void xlsx_drawing_context::set_hyperlink(const std::wstring & link, const std::w
if (current_drawing_states == NULL) return;
if (current_drawing_states->empty()) return;
std::wstring sId = std::wstring(L"hId") + boost::lexical_cast<std::wstring>(hlinks_.size()+1);
std::wstring sId = std::wstring(L"hId") + std::to_wstring(hlinks_.size()+1);
std::wstring link_correct = link;
if (!is_external) link_correct = std::wstring(L"#") + link_correct;
@ -2423,7 +2423,7 @@ void xlsx_drawing_context::set_custom_connection(std::vector<ODRAW::MSOPOINT>& p
current_drawing_states->back()->custom_connection = points;
}
void xlsx_drawing_context::set_custom_connectionDir(std::vector<ODRAW::FixedPoint>& points)
void xlsx_drawing_context::set_custom_connectionDir(std::vector<OSHARED::FixedPoint>& points)
{
if (current_drawing_states == NULL) return;
if (current_drawing_states->empty()) return;

View File

@ -182,7 +182,7 @@ public:
std::vector<ODRAW::MSOPOINT> custom_verticles;
std::vector<ODRAW::ADJH> custom_adjustHandles;
std::vector<ODRAW::MSOPOINT> custom_connection;
std::vector<ODRAW::FixedPoint> custom_connectionDir;
std::vector<OSHARED::FixedPoint>custom_connectionDir;
std::vector<ODRAW::MSORECT> custom_inscribe;
_rect custom_rect;
@ -413,7 +413,7 @@ public:
void set_custom_adjustValues(std::vector<_CP_OPT(int)> & values);
void set_custom_path (int type_path);
void set_custom_connection (std::vector<ODRAW::MSOPOINT> & points);
void set_custom_connectionDir(std::vector<ODRAW::FixedPoint>& points);
void set_custom_connectionDir(std::vector<OSHARED::FixedPoint>& points);
void set_custom_inscribe (std::vector<ODRAW::MSORECT> & rects);
void set_custom_x_limo (int val);
void set_custom_y_limo (int val);

View File

@ -80,7 +80,7 @@ public:
record r;
r.ref = ref;
r.display = display;
r.id = std::wstring(L"hId") + boost::lexical_cast<std::wstring>(records_.size()+1);
r.id = std::wstring(L"hId") + std::to_wstring(records_.size()+1);
r.location = target;
if (bExternal) r.type = L"External" ;

Some files were not shown because too many files have changed in this diff Show More