Commit 033feeaf authored by ElenaSubbotina's avatar ElenaSubbotina

fix bug #18178

parent de336e5f
......@@ -36,8 +36,6 @@
namespace XLS
{
// Logical representation of ObjProtect record in BIFF8
class ObjProtect: public BiffRecord
{
BIFF_RECORD_DEFINE_TYPE_INFO(ObjProtect)
......@@ -51,7 +49,7 @@ public:
void readFields(CFRecord& record);
static const ElementType type = typeObjProtect;
static const ElementType type = typeObjProtect;
//-----------------------------
Boolean<unsigned short> fLockObj;
......
......@@ -36,8 +36,6 @@
namespace XLS
{
// Logical representation of Protect record in BIFF8
class Protect: public BiffRecord
{
BIFF_RECORD_DEFINE_TYPE_INFO(Protect)
......
......@@ -44,7 +44,6 @@ ScenarioProtect::~ScenarioProtect()
{
}
BaseObjectPtr ScenarioProtect::clone()
{
return BaseObjectPtr(new ScenarioProtect(*this));
......
......@@ -36,8 +36,6 @@
namespace XLS
{
// Logical representation of ScenarioProtect record in BIFF8
class ScenarioProtect: public BiffRecord
{
BIFF_RECORD_DEFINE_TYPE_INFO(ScenarioProtect)
......@@ -48,14 +46,12 @@ public:
BaseObjectPtr clone();
void readFields(CFRecord& record);
static const ElementType type = typeScenarioProtect;
//-----------------------------
Boolean<unsigned short> fScenProtect;
};
} // namespace XLS
......
......@@ -83,10 +83,28 @@ const bool PROTECTION_COMMON::loadContent(BinProcessor& proc)
int PROTECTION_COMMON::serialize (std::wostream & _stream)
{
Protect *protect = dynamic_cast<Protect*> (m_Protect.get());
Password *password = dynamic_cast<Password*> (m_Password.get());
ScenarioProtect *scenario = dynamic_cast<ScenarioProtect*>(m_ScenarioProtect.get());
ObjProtect *object = dynamic_cast<ObjProtect*> (m_ObjProtect.get());
CP_XML_WRITER(_stream)
{
CP_XML_NODE(L"sheetProtection")
{
if (protect)
{
CP_XML_ATTR(L"sheet", protect->fLock);
}
if (object)
{
CP_XML_ATTR(L"objects", object->fLockObj);
}
if (scenario)
{
CP_XML_ATTR(L"scenarios", scenario->fScenProtect);
}
CP_XML_ATTR(L"selectLockedCells", 1);
}
}
......
......@@ -493,7 +493,7 @@ void XlsConverter::convert_common (XLS::CommonSubstream* sheet)
if (sheet->m_PROTECTION)
{
//sheet->m_PROTECTION->serialize(xlsx_context->current_sheet().protection());
sheet->m_PROTECTION->serialize(xlsx_context->current_sheet().protection());
}
if (sheet->m_COLUMNS)
{
......@@ -512,11 +512,6 @@ void XlsConverter::convert_common (XLS::CommonSubstream* sheet)
sheet->m_PAGESETUP->serialize(xlsx_context->current_sheet().pageProperties());
}
for (size_t i = 0 ; i < sheet->m_arHFPictureDrawing.size(); i++)
{
//convert(dynamic_cast<XLS::Note*>(sheet->sheet->m_arHFPictureDrawing[i].get(),
}
if (sheet->m_arCUSTOMVIEW.size() > 0)
{
CP_XML_WRITER(xlsx_context->current_sheet().customViews())
......
......@@ -63,6 +63,7 @@ public:
std::wstringstream conditionalFormatting_;
std::wstringstream picture_background_;
std::wstringstream dataValidations_;
std::wstringstream protection_;
rels rels_;
......@@ -166,6 +167,11 @@ std::wostream & xlsx_xml_worksheet::dataValidations()
{
return impl_->dataValidations_;
}
std::wostream & xlsx_xml_worksheet::protection()
{
return impl_->protection_;
}
//-----------------------------------------------------------------
rels & xlsx_xml_worksheet::sheet_rels()
{
......@@ -209,6 +215,9 @@ void xlsx_xml_worksheet::write_to(std::wostream & strm)
{
CP_XML_STREAM() << impl_->sheetData_.str();
}
CP_XML_STREAM() << impl_->protection_.str();
//оказывается порядок нахождения элементов важен !!! (для office 2010)
//объединенные ячейки раньше чем гиперлинки !!!
......
......@@ -71,7 +71,8 @@ public:
std::wostream & conditionalFormatting();
std::wostream & picture_background();
std::wostream & dataValidations();
std::wostream & protection();
rels & sheet_rels();//hyperlink, background image, external, media ...
void write_to(std::wostream & strm);
......
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