Commit 29167713 authored by ElenaSubbotina's avatar ElenaSubbotina

fix bugs

parent 9ff6c010
...@@ -136,6 +136,7 @@ namespace XMLTools ...@@ -136,6 +136,7 @@ namespace XMLTools
std::basic_string<T> m_Name; std::basic_string<T> m_Name;
std::basic_string<T> m_ElementText; std::basic_string<T> m_ElementText;
std::map<std::basic_string<T>, std::basic_string<T>> m_AttributeMap; std::map<std::basic_string<T>, std::basic_string<T>> m_AttributeMap;
std::map<std::basic_string<T>, int> m_ChildMap; //for uniq
std::list<XMLElement<T>> m_Elements; std::list<XMLElement<T>> m_Elements;
typedef typename std::list<XMLElement<T>>::iterator ElementsIterator; typedef typename std::list<XMLElement<T>>::iterator ElementsIterator;
...@@ -206,8 +207,16 @@ namespace XMLTools ...@@ -206,8 +207,16 @@ namespace XMLTools
/*========================================================================================================*/ /*========================================================================================================*/
void AppendChild( const XMLElement<T>& element ) void AppendChild( const XMLElement<T>& element, bool uniq = false)
{ {
if (m_ChildMap.find(element.GetName()) != m_ChildMap.end())
{
if (uniq) return;
}
else
{
m_ChildMap.insert(m_ChildMap.end(), std::pair<std::basic_string<T>, int>(element.GetName(), 0));
}
m_Elements.push_back( element ); m_Elements.push_back( element );
} }
......
...@@ -70,9 +70,7 @@ namespace DocFileFormat ...@@ -70,9 +70,7 @@ namespace DocFileFormat
//type //type
if ( ole->bLinked ) if ( ole->bLinked )
{ {
int relID = -1; int relID = m_context->_docx->RegisterExternalOLEObject(_caller, ole->ClipboardFormat, ole->Link);
m_context->_docx->RegisterExternalOLEObject(_caller, ole->ClipboardFormat, ole->Link);
m_pXmlWriter->WriteAttribute( _T( "r:id" ), ( std::wstring( _T( "rId" ) ) + FormatUtils::IntToWideString( relID ) ).c_str() ); m_pXmlWriter->WriteAttribute( _T( "r:id" ), ( std::wstring( _T( "rId" ) ) + FormatUtils::IntToWideString( relID ) ).c_str() );
m_pXmlWriter->WriteAttribute( _T( "Type" ), _T( "Link" ) ); m_pXmlWriter->WriteAttribute( _T( "Type" ), _T( "Link" ) );
......
...@@ -209,7 +209,7 @@ namespace DocFileFormat ...@@ -209,7 +209,7 @@ namespace DocFileFormat
SectionPropertyExceptions* sepxBackup = documentMapping->_lastValidSepx; SectionPropertyExceptions* sepxBackup = documentMapping->_lastValidSepx;
//start w:tr //start w:tr
documentMapping->GetXMLWriter()->WriteNodeBegin( _T( "w:tr" ) ); documentMapping->GetXMLWriter()->WriteNodeBegin( L"w:tr" );
//convert the properties //convert the properties
int fcRowEnd = documentMapping->findRowEndFc(cp, depth); int fcRowEnd = documentMapping->findRowEndFc(cp, depth);
...@@ -224,13 +224,22 @@ namespace DocFileFormat ...@@ -224,13 +224,22 @@ namespace DocFileFormat
documentMapping->_lastValidPapx = papxBackup; documentMapping->_lastValidPapx = papxBackup;
documentMapping->_lastValidSepx = sepxBackup; documentMapping->_lastValidSepx = sepxBackup;
for ( std::list<TableCell>::iterator iter = cells.begin(); iter != cells.end(); iter++ ) if (cells.empty())
{ {
iter->Convert( mapping, &tapx, grid, gridIndex, nCellIndex++ ); documentMapping->GetXMLWriter()->WriteNodeBegin(L"w:tc");
documentMapping->GetXMLWriter()->WriteNode(L"w:p", L"");
documentMapping->GetXMLWriter()->WriteNodeEnd(L"w:tc");
}
else
{
for ( std::list<TableCell>::iterator iter = cells.begin(); iter != cells.end(); iter++ )
{
iter->Convert( mapping, &tapx, grid, gridIndex, nCellIndex++ );
}
} }
//end w:tr //end w:tr
documentMapping->GetXMLWriter()->WriteNodeEnd( _T( "w:tr" ) ); documentMapping->GetXMLWriter()->WriteNodeEnd( L"w:tr" );
RELEASEOBJECT( chpxs ); RELEASEOBJECT( chpxs );
} }
......
...@@ -95,7 +95,7 @@ namespace DocFileFormat ...@@ -95,7 +95,7 @@ namespace DocFileFormat
XMLTools::XMLAttribute<wchar_t> wAfterType( _T( "w:type" ), _T( "dxa" ) ); XMLTools::XMLAttribute<wchar_t> wAfterType( _T( "w:type" ), _T( "dxa" ) );
wAfter.AppendAttribute( wAfterType ); wAfter.AppendAttribute( wAfterType );
_trPr->AppendChild( wAfter ); _trPr->AppendChild( wAfter, true );
} }
break; break;
...@@ -111,7 +111,7 @@ namespace DocFileFormat ...@@ -111,7 +111,7 @@ namespace DocFileFormat
XMLTools::XMLAttribute<wchar_t> wBeforeType( _T( "w:type" ), _T( "dxa" ) ); XMLTools::XMLAttribute<wchar_t> wBeforeType( _T( "w:type" ), _T( "dxa" ) );
wBefore.AppendAttribute( wBeforeType ); wBefore.AppendAttribute( wBeforeType );
_trPr->AppendChild( wBefore ); _trPr->AppendChild( wBefore, true );
} }
} }
break; break;
......
...@@ -1051,6 +1051,12 @@ void odf_drawing_context::set_no_fill() ...@@ -1051,6 +1051,12 @@ void odf_drawing_context::set_no_fill()
break; break;
} }
} }
void odf_drawing_context::set_type_fill(int type)
{
if (!impl_->current_graphic_properties)return;
impl_->current_graphic_properties->content().common_draw_fill_attlist_.draw_fill_ = (draw_fill::type)type;
}
void odf_drawing_context::set_solid_fill(std::wstring hexColor) void odf_drawing_context::set_solid_fill(std::wstring hexColor)
{ {
if (!impl_->current_graphic_properties)return; if (!impl_->current_graphic_properties)return;
......
...@@ -158,6 +158,7 @@ public: ...@@ -158,6 +158,7 @@ public:
void set_rotate(double iVal); void set_rotate(double iVal);
void set_no_fill(); void set_no_fill();
void set_type_fill(int type);//for area - temp for objects
void set_solid_fill(std::wstring hexColor); void set_solid_fill(std::wstring hexColor);
void set_opacity(double percent); void set_opacity(double percent);
////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////
......
...@@ -2075,7 +2075,10 @@ void DocxConverter::convert(OOX::Logic::CObject* oox_obj) ...@@ -2075,7 +2075,10 @@ void DocxConverter::convert(OOX::Logic::CObject* oox_obj)
bool bSet = false; bool bSet = false;
if (oox_obj->m_oShape.IsInit()) if (oox_obj->m_oShape.IsInit())
{ {
OOX::Vml::SptType sptType = oox_obj->m_oShapeType->m_oSpt.IsInit() ? static_cast<OOX::Vml::SptType>(oox_obj->m_oShapeType->m_oSpt->GetValue()) : OOX::Vml::sptNotPrimitive; OOX::Vml::SptType sptType = OOX::Vml::SptType::sptNotPrimitive;
if ((oox_obj->m_oShapeType.IsInit()) && (oox_obj->m_oShapeType->m_oSpt.IsInit()))
sptType = static_cast<OOX::Vml::SptType>(oox_obj->m_oShapeType->m_oSpt->GetValue());
if (sptType != OOX::Vml::SptType::sptNotPrimitive) if (sptType != OOX::Vml::SptType::sptNotPrimitive)
{ {
...@@ -2103,9 +2106,11 @@ void DocxConverter::convert(OOX::Logic::CObject* oox_obj) ...@@ -2103,9 +2106,11 @@ void DocxConverter::convert(OOX::Logic::CObject* oox_obj)
odf_context()->drawing_context()->set_name(L"Rect"); odf_context()->drawing_context()->set_name(L"Rect");
odf_context()->drawing_context()->start_shape(SimpleTypes::shapetypeRect); odf_context()->drawing_context()->start_shape(SimpleTypes::shapetypeRect);
} }
OoxConverter::convert(oox_obj->m_oShape.GetPointer()); OoxConverter::convert(oox_obj->m_oShape.GetPointer());
odf_context()->drawing_context()->end_shape();
odf_context()->drawing_context()->set_type_fill(2); //temp ... image
odf_context()->drawing_context()->end_shape();
odf_context()->drawing_context()->end_drawing(); odf_context()->drawing_context()->end_drawing();
odt_context->end_drawings(); odt_context->end_drawings();
......
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