cui/source/dialogs/postdlg.cxx | 7 cui/source/options/optjava.cxx | 6 hwpfilter/qa/cppunit/data/fail/cslist-1.hwp |binary hwpfilter/source/hpara.cxx | 120 +-- hwpfilter/source/hpara.h | 9 hwpfilter/source/hwpfile.cxx | 103 --- hwpfilter/source/hwpfile.h | 17 hwpfilter/source/hwpreader.cxx | 684 ++++++++++------------ hwpfilter/source/hwpreader.hxx | 4 hwpfilter/source/solver.cxx | 53 - include/svl/zforlist.hxx | 6 include/svl/zformat.hxx | 34 + sc/qa/unit/ucalc.cxx | 156 +++++ sc/qa/unit/ucalc.hxx | 4 sc/source/core/data/documen4.cxx | 36 - sc/source/ui/condformat/condformatdlg.cxx | 5 sc/source/ui/view/tabvwshf.cxx | 4 svl/source/numbers/zforlist.cxx | 21 svl/source/numbers/zformat.cxx | 147 ++-- svx/source/dialog/crashreportdlg.cxx | 2 sw/qa/extras/ooxmlexport/data/tdf106690.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport9.cxx | 9 sw/qa/extras/rtfimport/data/hexcrlf.rtf | 6 sw/source/core/crsr/crstrvl.cxx | 4 sw/source/core/frmedt/fews.cxx | 7 sw/source/filter/ww8/ww8par6.cxx | 128 ++-- sw/source/uibase/uiview/view2.cxx | 25 vcl/source/window/dialog.cxx | 3 vcl/unx/gtk3/gtk3gtkframe.cxx | 8 vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx | 12 writerfilter/source/dmapper/DomainMapper.cxx | 7 writerfilter/source/dmapper/DomainMapper_Impl.cxx | 45 + writerfilter/source/dmapper/DomainMapper_Impl.hxx | 5 writerfilter/source/rtftok/rtfdocumentimpl.cxx | 6 34 files changed, 972 insertions(+), 711 deletions(-)
New commits: commit 4553bc1bfa72dce55566971e27b94f3a5bfcdc79 Author: Andras Timar <[email protected]> Date: Wed Apr 12 20:29:09 2017 +0200 fix previous commit Change-Id: I204f83aede085bbe4f5bd6937238b2117e51c86a diff --git a/svx/source/dialog/crashreportdlg.cxx b/svx/source/dialog/crashreportdlg.cxx index 7d94dc40f551..3a9ff75e33fb 100644 --- a/svx/source/dialog/crashreportdlg.cxx +++ b/svx/source/dialog/crashreportdlg.cxx @@ -95,7 +95,7 @@ IMPL_LINK(CrashReportDialog, BtnHdl, Button*, pBtn, void) mpEditPostUpload->SetText("Error!"); mpBtnClose->Show(); - mpBugReportMailto->SetURL(mpFtBugReport->GetURL().replaceAll("%CRASHID", aCrashID.replaceAll("Crash-ID=",""))); + mpBugReportMailto->SetURL(mpBugReportMailto->GetURL().replaceAll("%CRASHID", aCrashID.replaceAll("Crash-ID=",""))); mpBugReportMailto->Show(); mpEditPreUpload->Hide(); mpEditPostUpload->Show(); commit ca45d2f299634c65406de9920da1dd044b9a3666 Author: Caolán McNamara <[email protected]> Date: Sat Apr 8 21:04:45 2017 +0100 ofz#1062 ensure cshape lifecycle matches expectations Change-Id: I586e9b3546516a0f05d86b2f7dd93e7c292a6795 Reviewed-on: https://gerrit.libreoffice.org/36300 Tested-by: Jenkins <[email protected]> Reviewed-by: Michael Stahl <[email protected]> (cherry picked from commit 4e175b7aee7c00c6d0d8449a19b26ebf25446b9d) diff --git a/hwpfilter/source/hpara.cxx b/hwpfilter/source/hpara.cxx index 84294c59ed3c..3149d65acf0a 100644 --- a/hwpfilter/source/hpara.cxx +++ b/hwpfilter/source/hpara.cxx @@ -75,17 +75,16 @@ HWPPara::HWPPara() , etcflag(0) , ctrlflag(0) , pstyno(0) + , cshape(new CharShape) , linfo(nullptr) - , cshapep(nullptr) { - memset(&cshape, 0, sizeof(cshape)); + memset(cshape.get(), 0, sizeof(cshape)); memset(&pshape, 0, sizeof(pshape)); } HWPPara::~HWPPara() { delete[] linfo; - delete[] cshapep; } bool HWPPara::Read(HWPFile & hwpf, unsigned char flag) @@ -102,18 +101,17 @@ bool HWPPara::Read(HWPFile & hwpf, unsigned char flag) hwpf.Read4b(&ctrlflag, 1); hwpf.Read1b(&pstyno, 1); - /* Paragraph representative character */ - cshape.Read(hwpf); + cshape->Read(hwpf); if (nch > 0) - hwpf.AddCharShape(&cshape); + hwpf.AddCharShape(cshape); /* Paragraph paragraphs shape */ if (nch && !reuse_shape) { pshape.Read(hwpf); - pshape.cshape = &cshape; - pshape.pagebreak = etcflag; + pshape.cshape = cshape.get(); + pshape.pagebreak = etcflag; } linfo = ::comphelper::newArray_null<LineInfo>(nline); @@ -144,23 +142,19 @@ bool HWPPara::Read(HWPFile & hwpf, unsigned char flag) if (contain_cshape) { - cshapep = ::comphelper::newArray_null<CharShape>(nch); - if (!cshapep) - { - perror("Memory Allocation: cshape\n"); - return false; - } - memset(cshapep, 0, nch * sizeof(CharShape)); + cshapep.resize(nch); for (ii = 0; ii < nch; ii++) { + cshapep[ii].reset(new CharShape); + memset(cshapep[ii].get(), 0, sizeof(CharShape)); hwpf.Read1b(&same_cshape, 1); if (!same_cshape) { - cshapep[ii].Read(hwpf); + cshapep[ii]->Read(hwpf); if (nch > 1) - hwpf.AddCharShape(&cshapep[ii]); + hwpf.AddCharShape(cshapep[ii]); } else if (ii == 0) cshapep[ii] = cshape; @@ -185,15 +179,13 @@ bool HWPPara::Read(HWPFile & hwpf, unsigned char flag) return nch && !hwpf.State(); } - CharShape *HWPPara::GetCharShape(int pos) { if (contain_cshape == 0) - return &cshape; - return cshapep + pos; + return cshape.get(); + return cshapep[pos].get(); } - std::unique_ptr<HBox> HWPPara::readHBox(HWPFile & hwpf) { std::unique_ptr<HBox> hbox; diff --git a/hwpfilter/source/hpara.h b/hwpfilter/source/hpara.h index 6496eae80f70..b598c201b569 100644 --- a/hwpfilter/source/hpara.h +++ b/hwpfilter/source/hpara.h @@ -103,11 +103,11 @@ class DLLEXPORT HWPPara */ unsigned long ctrlflag; unsigned char pstyno; - CharShape cshape; /* When characters are all the same shape */ + std::shared_ptr<CharShape> cshape; /* When characters are all the same shape */ ParaShape pshape; /* if reuse flag is 0, */ LineInfo *linfo; - CharShape *cshapep; + std::vector<std::shared_ptr<CharShape>> cshapep; /** * Box object list */ diff --git a/hwpfilter/source/hwpfile.cxx b/hwpfilter/source/hwpfile.cxx index f0a9f4279c4f..929a783d0761 100644 --- a/hwpfilter/source/hwpfile.cxx +++ b/hwpfilter/source/hwpfile.cxx @@ -242,8 +242,8 @@ void HWPFile::ParaListRead() bool HWPFile::ReadParaList(std::list < HWPPara* > &aplist, unsigned char flag) { std::unique_ptr<HWPPara> spNode( new HWPPara ); - unsigned char tmp_etcflag; - unsigned char prev_etcflag = 0; + unsigned char tmp_etcflag; + unsigned char prev_etcflag = 0; while (spNode->Read(*this, flag)) { if( !(spNode->etcflag & 0x04) ){ @@ -467,7 +467,7 @@ CharShape *HWPFile::getCharShape(int index) { if (index < 0 || static_cast<unsigned int>(index) >= cslist.size()) return nullptr; - return cslist[index]; + return cslist[index].get(); } FBoxStyle *HWPFile::getFBoxStyle(int index) @@ -537,11 +537,10 @@ void HWPFile::AddParaShape(ParaShape * pshape) pshape->index = value; } - -void HWPFile::AddCharShape(CharShape * cshape) +void HWPFile::AddCharShape(std::shared_ptr<CharShape>& cshape) { - int value = compareCharShape(cshape); - if( value == 0 ) + int value = compareCharShape(cshape.get()); + if (value == 0) { cshape->index = ++ccount; cslist.push_back(cshape); diff --git a/hwpfilter/source/hwpfile.h b/hwpfilter/source/hwpfile.h index 1d8da3673169..7f3d29f80225 100644 --- a/hwpfilter/source/hwpfile.h +++ b/hwpfilter/source/hwpfile.h @@ -213,7 +213,7 @@ class DLLEXPORT HWPFile void AddColumnInfo(); void SetColumnDef(ColumnDef *coldef); void AddParaShape(ParaShape *); - void AddCharShape(CharShape *); + void AddCharShape(std::shared_ptr<CharShape>&); void AddFBoxStyle(FBoxStyle *); void AddDateFormat(DateCode *); void AddHeaderFooter(HeaderFooter *); @@ -284,7 +284,7 @@ class DLLEXPORT HWPFile std::list<HyperText*> hyperlist; int currenthyper; std::vector<ParaShape*> pslist; /* ì¤íì¤í¼ì¤ì 구조ì íì */ - std::vector<CharShape*> cslist; + std::vector<std::shared_ptr<CharShape>> cslist; std::vector<FBoxStyle*> fbslist; std::vector<DateCode*> datecodes; std::vector<HeaderFooter*> headerfooters; diff --git a/hwpfilter/source/hwpreader.cxx b/hwpfilter/source/hwpreader.cxx index c3d8766c4297..27c3b514417e 100644 --- a/hwpfilter/source/hwpreader.cxx +++ b/hwpfilter/source/hwpreader.cxx @@ -2737,7 +2737,7 @@ void HwpReader::make_text_p0(HWPPara * para, bool bParaStart) d->bInHeader = false; } padd("text:style-name", sXML_CDATA, - ascii(getTStyleName(para->cshape.index, buf))); + ascii(getTStyleName(para->cshape->index, buf))); rstartEl("text:span", mxList.get()); mxList->clear(); @@ -2781,8 +2781,8 @@ void HwpReader::make_text_p1(HWPPara * para,bool bParaStart) hchar_string str; int n; int res; - hchar dest[3]; - int curr = para->cshape.index; + hchar dest[3]; + int curr = para->cshape->index; unsigned char firstspace = 0; if( !bParaStart ) commit 186f0f57a08d204a3e7bdefd8cdccb8027bd0661 Author: Caolán McNamara <[email protected]> Date: Wed Apr 12 10:45:35 2017 +0100 infinite SetDefaultSize->SetPosSize->SetDefaultSize https://retrace.fedoraproject.org/faf/reports/1278627/ presumably the 'optimal' starting size hits the invalid size path causing another attempt usin the optimal size, so force a valid initial fallback size Change-Id: I6c38ee5e1b90ce41a4550c8a8370e791f5c351b0 (cherry picked from commit 4930acb18bbd145fd995084cd95e3e9d631424ed) Reviewed-on: https://gerrit.libreoffice.org/36453 Tested-by: Jenkins <[email protected]> Reviewed-by: Michael Stahl <[email protected]> (cherry picked from commit 3e4e13300db6a0c2c60dbe733d96ff5a7b0d32e5) diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx index eef4c5ab5018..bff1f27a9613 100644 --- a/vcl/source/window/dialog.cxx +++ b/vcl/source/window/dialog.cxx @@ -662,7 +662,8 @@ Size bestmaxFrameSizeForScreenSize(const Size &rScreenSize) else h -= 100; - return Size(w, h); + return Size(std::max<long>(w, 640 - 15), + std::max<long>(h, 480 - 50)); } void Dialog::StateChanged( StateChangedType nType ) commit e227b6fe086b2caf30ca489f4d74a9f9a725c635 Author: Miklos Vajna <[email protected]> Date: Tue Apr 4 09:12:34 2017 +0200 tdf#106690 DOCX import: fix automatic spacing before/after numbered para block The context is text nodes with automatic before/after spacing and numbering rules set, like: A * B * C * D E The correct behavior seems to be (though I haven't found this explicitly written in the OOXML spec) to drop spacing between B and C and C and D, but not before B and not after D. Originally no spacing was dropped, then commit c486e875de7c8e845594f5043a37ee8800865782 (tdf#95031 DOCX import: auto spacing inside numbering means no spacing, 2016-10-18) removed spacing around all B/C/D. Fix the problem by checking the numbering rules and automatic after spacing of the previous paragraph, so spacing before B and after D is not removed. Change-Id: Icbdb36e31057ab0e8ac033888cf5cc7c52dad5d0 Reviewed-on: https://gerrit.libreoffice.org/36062 Reviewed-by: Miklos Vajna <[email protected]> Tested-by: Jenkins <[email protected]> (cherry picked from commit 1bf7f6a1a50ee9f24a3687240fe6ae390b905a6b) Reviewed-on: https://gerrit.libreoffice.org/36142 Reviewed-by: Michael Stahl <[email protected]> (cherry picked from commit 776839b8bfc6eed905ce97c6fe32af8deb8d1451) diff --git a/sw/qa/extras/ooxmlexport/data/tdf106690.docx b/sw/qa/extras/ooxmlexport/data/tdf106690.docx new file mode 100644 index 000000000000..b233ef81c6cf Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf106690.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx index 786074a40849..e48f51824749 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx @@ -49,6 +49,15 @@ DECLARE_OOXMLEXPORT_TEST(testTdf95031, "tdf95031.docx") CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), getProperty<sal_Int32>(getParagraph(3), "ParaTopMargin")); } +DECLARE_OOXMLEXPORT_TEST(testTdf106690, "tdf106690.docx") +{ + // This was 0, numbering rules with automatic spacing meant 0 + // before/autospacing for all text nodes, even for ones at the start/end of + // a numbered text node block. + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(494), getProperty<sal_Int32>(getParagraph(2), "ParaBottomMargin")); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(494), getProperty<sal_Int32>(getParagraph(2), "ParaTopMargin")); +} + DECLARE_OOXMLEXPORT_TEST(testTdf89377, "tdf89377_tableWithBreakBeforeParaStyle.docx") { // the paragraph style should set table's text-flow break-before-page diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index 79a12523f999..f2dfd37e727c 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -620,9 +620,7 @@ void DomainMapper::lcl_attribute(Id nName, Value & val) } if (nIntValue) // If auto spacing is set, then only store set value in InteropGrabBag { - if (m_pImpl->GetTopContext()->isSet(PROP_NUMBERING_RULES)) - // Numbering is set -> auto space is 0. - default_spacing = 0; + m_pImpl->SetParaAutoBefore(true); m_pImpl->GetTopContext()->Insert( PROP_PARA_TOP_MARGIN, uno::makeAny( ConversionHelper::convertTwipToMM100(default_spacing) ) ); } else @@ -645,9 +643,6 @@ void DomainMapper::lcl_attribute(Id nName, Value & val) } if (nIntValue) // If auto spacing is set, then only store set value in InteropGrabBag { - if (m_pImpl->GetTopContext()->isSet(PROP_NUMBERING_RULES)) - // Numbering is set -> auto space is 0. - default_spacing = 0; m_pImpl->GetTopContext()->Insert( PROP_PARA_BOTTOM_MARGIN, uno::makeAny( ConversionHelper::convertTwipToMM100(default_spacing) ) ); } else diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index bebfaa7f8e02..236436cbd362 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -242,7 +242,8 @@ DomainMapper_Impl::DomainMapper_Impl( m_bFrameBtLr(false), m_bIsSplitPara(false), m_vTextFramesForChaining(), - m_bParaHadField(false) + m_bParaHadField(false), + m_bParaAutoBefore(false) { m_aBaseUrl = rMediaDesc.getUnpackedValueOrDefault( @@ -1169,7 +1170,48 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap ) appendTextPortion(sMarker, pEmpty); } + // Check if top / bottom margin has to be updated, now that we know the numbering status of both the previous and + // the current text node. + auto itNumberingRules = std::find_if(aProperties.begin(), aProperties.end(), [](const beans::PropertyValue& rValue) + { + return rValue.Name == "NumberingRules"; + }); + if (itNumberingRules != aProperties.end()) + { + // This textnode has numbering. + if (m_xPreviousParagraph.is() && m_xPreviousParagraph->getPropertyValue("NumberingRules").hasValue()) + { + // There was a previous textnode and it had numbering. + if (m_bParaAutoBefore) + { + // This before spacing is set to auto, set before space to 0. + auto itParaTopMargin = std::find_if(aProperties.begin(), aProperties.end(), [](const beans::PropertyValue& rValue) + { + return rValue.Name == "ParaTopMargin"; + }); + if (itParaTopMargin != aProperties.end()) + itParaTopMargin->Value <<= static_cast<sal_Int32>(0); + else + aProperties.push_back(comphelper::makePropertyValue("ParaTopMargin", static_cast<sal_Int32>(0))); + } + uno::Sequence<beans::PropertyValue> aPrevPropertiesSeq; + m_xPreviousParagraph->getPropertyValue("ParaInteropGrabBag") >>= aPrevPropertiesSeq; + auto aPrevProperties = comphelper::sequenceToContainer< std::vector<beans::PropertyValue> >(aPrevPropertiesSeq); + auto itPrevParaAutoAfter = std::find_if(aPrevProperties.begin(), aPrevProperties.end(), [](const beans::PropertyValue& rValue) + { + return rValue.Name == "ParaBottomMarginAfterAutoSpacing"; + }); + bool bPrevParaAutoAfter = itPrevParaAutoAfter != aPrevProperties.end(); + if (bPrevParaAutoAfter) + { + // Previous after spacing is set to auto, set previous after space to 0. + m_xPreviousParagraph->setPropertyValue("ParaBottomMargin", uno::makeAny(static_cast<sal_Int32>(0))); + } + } + } + xTextRange = xTextAppend->finishParagraph( comphelper::containerToSequence(aProperties) ); + m_xPreviousParagraph.set(xTextRange, uno::UNO_QUERY); if (xCursor.is()) { @@ -1225,6 +1267,7 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap ) SetIsOutsideAParagraph(true); m_bParaHadField = false; + m_bParaAutoBefore = false; #ifdef DEBUG_WRITERFILTER TagLogger::getInstance().endElement(); #endif diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx index 8540dd1943a0..7ec425151ee9 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx @@ -874,11 +874,16 @@ public: bool IsDiscardHeaderFooter(); + void SetParaAutoBefore(bool bParaAutoBefore) { m_bParaAutoBefore = bParaAutoBefore; } + private: void PushPageHeaderFooter(bool bHeader, SectionPropertyMap::PageType eType); std::vector<css::uno::Reference< css::drawing::XShape > > m_vTextFramesForChaining ; /// Current paragraph had at least one field in it. bool m_bParaHadField; + css::uno::Reference<css::beans::XPropertySet> m_xPreviousParagraph; + /// Current paragraph has automatic before spacing. + bool m_bParaAutoBefore; }; } //namespace dmapper commit 0cffb61df73abba1e5c810a5ba604d32476247e3 Author: Caolán McNamara <[email protected]> Date: Mon Apr 10 13:08:33 2017 +0100 Resolves: tdf#107031 writer depends on ACTION_DEFAULT to do its standard "honor the DragDropMode setting" on drag and drop of outline headings into a document Change-Id: Ie154fb237de57ae18fa22d6f50dbf890fb9ebc77 (cherry picked from commit 55e7f73640d754bf0004a0d8a989e0a20de00351) Reviewed-on: https://gerrit.libreoffice.org/36378 Tested-by: Jenkins <[email protected]> Reviewed-by: Michael Stahl <[email protected]> (cherry picked from commit 3247dce15d041d178fa2a855b53415a80df16a28) diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx index 550e76e8cbe4..93a3d0138c8d 100644 --- a/vcl/unx/gtk3/gtk3gtkframe.cxx +++ b/vcl/unx/gtk3/gtk3gtkframe.cxx @@ -3394,6 +3394,14 @@ gboolean GtkSalFrame::signalDragDrop(GtkWidget* pWidget, GdkDragContext* context aEvent.LocationX = x; aEvent.LocationY = y; aEvent.DropAction = GdkToVcl(gdk_drag_context_get_selected_action(context)); + // ACTION_DEFAULT is documented as... + // 'This means the user did not press any key during the Drag and Drop operation + // and the action that was combined with ACTION_DEFAULT is the system default action' + // in tdf#107031 writer won't insert a link when a heading is dragged from the + // navigator unless this is set. Its unclear really what ACTION_DEFAULT means, + // there is a deprecated 'GDK_ACTION_DEFAULT Means nothing, and should not be used' + // possible equivalent in gtk. + aEvent.DropAction |= css::datatransfer::dnd::DNDConstants::ACTION_DEFAULT; aEvent.SourceActions = GdkToVcl(gdk_drag_context_get_actions(context)); css::uno::Reference<css::datatransfer::XTransferable> xTransferable; // For LibreOffice internal D&D we provide the Transferable without Gtk commit fee019d85e2061d0a8d8a926ac6e45a38e1125c8 Author: Caolán McNamara <[email protected]> Date: Wed Apr 5 14:24:09 2017 +0100 ofz: treat short properties as run end Change-Id: I1250f74c9f4ed6679a89c7915fb704c8b8cd693f (cherry picked from commit 5252673d686913210dd65608b7d24b0e9d51cf00) Reviewed-on: https://gerrit.libreoffice.org/36147 Tested-by: Jenkins <[email protected]> Reviewed-by: Michael Stahl <[email protected]> (cherry picked from commit 38b8896a700ec626fbcf924b8909af9f3295341a) diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx index 1e5b5bf55305..5bb3eb8eb507 100644 --- a/sw/source/filter/ww8/ww8par6.cxx +++ b/sw/source/filter/ww8/ww8par6.cxx @@ -311,7 +311,7 @@ void SwWW8ImplReader::SetDocumentGrid(SwFrameFormat &rFormat, const wwSection &r void SwWW8ImplReader::Read_ParaBiDi(sal_uInt16, const sal_uInt8* pData, short nLen) { - if( nLen < 0 ) + if (nLen < 1) m_pCtrlStck->SetAttr(*m_pPaM->GetPoint(), RES_FRAMEDIR); else { @@ -2683,7 +2683,7 @@ const SfxPoolItem* SwWW8ImplReader::GetFormatAttr( sal_uInt16 nWhich ) // parameters according to the table in WWScan.cxx. void SwWW8ImplReader::Read_Special(sal_uInt16, const sal_uInt8* pData, short nLen) { - if( nLen < 0 ) + if (nLen < 1) { m_bSpec = false; return; @@ -2694,7 +2694,7 @@ void SwWW8ImplReader::Read_Special(sal_uInt16, const sal_uInt8* pData, short nLe // Read_Obj is used for fObj and for fOle2 ! void SwWW8ImplReader::Read_Obj(sal_uInt16 , const sal_uInt8* pData, short nLen) { - if( nLen < 0 ) + if (nLen < 1) m_bObj = false; else { @@ -2717,7 +2717,7 @@ void SwWW8ImplReader::Read_Obj(sal_uInt16 , const sal_uInt8* pData, short nLen) void SwWW8ImplReader::Read_PicLoc(sal_uInt16 , const sal_uInt8* pData, short nLen ) { - if( nLen < 0 ) + if (nLen < 4) { m_nPicLocFc = 0; m_bSpec = false; // Is this always correct? @@ -2746,7 +2746,7 @@ void SwWW8ImplReader::Read_POutLvl(sal_uInt16, const sal_uInt8* pData, short nLe if (pSI != nullptr) { pSI->mnWW8OutlineLevel = - static_cast< sal_uInt8 >( ( pData ? *pData : 0 ) ); + static_cast< sal_uInt8 >( ( (pData && nLen >= 1) ? *pData : 0 ) ); NewAttr( SfxUInt16Item( RES_PARATR_OUTLINELEVEL, SwWW8StyInf::WW8OutlineLevelToOutlinelevel( pSI->mnWW8OutlineLevel ) ) ); } } @@ -2754,7 +2754,7 @@ void SwWW8ImplReader::Read_POutLvl(sal_uInt16, const sal_uInt8* pData, short nLe { const sal_uInt8 nOutlineLevel = SwWW8StyInf::WW8OutlineLevelToOutlinelevel( - static_cast<sal_uInt8>((pData ? *pData : 0))); + static_cast<sal_uInt8>(((pData && nLen >= 1) ? *pData : 0))); NewAttr(SfxUInt16Item(RES_PARATR_OUTLINELEVEL, nOutlineLevel)); } } @@ -2763,7 +2763,7 @@ void SwWW8ImplReader::Read_Symbol(sal_uInt16, const sal_uInt8* pData, short nLen { if( !m_bIgnoreText ) { - if( nLen < 0 ) + if (nLen < (m_bVer67 ? 3 : 4)) { //otherwise disable after we print the char if (m_pPlcxMan && m_pPlcxMan->GetDoingDrawTextBox()) @@ -2848,7 +2848,7 @@ void SwWW8ImplReader::Read_BoldUsw( sal_uInt16 nId, const sal_uInt8* pData, shor sal_uInt16 nMask = 1 << nI; - if (nLen < 0) + if (nLen < 1) { if (nI < 2) { @@ -2914,7 +2914,7 @@ void SwWW8ImplReader::Read_BoldUsw( sal_uInt16 nId, const sal_uInt8* pData, shor void SwWW8ImplReader::Read_Bidi(sal_uInt16, const sal_uInt8* pData, short nLen) { - if( nLen < 0 ) //Property end + if (nLen < 1) //Property end { m_bBidi = false; m_pCtrlStck->SetAttr(*m_pPaM->GetPoint(),RES_CHRATR_BIDIRTL); @@ -3028,7 +3028,7 @@ void SwWW8ImplReader::Read_BoldBiDiUsw(sal_uInt16 nId, const sal_uInt8* pData, sal_uInt16 nMask = 1 << nI; - if( nLen < 0 ) + if (nLen < 1) { m_pCtrlStck->SetAttr(*m_pPaM->GetPoint(),nEndIds[nI]); m_pCtrlStck->SetToggleBiDiAttr(nI, false); @@ -3196,7 +3196,8 @@ void SwWW8ImplReader::ChkToggleBiDiAttr_( sal_uInt16 nOldStyle81Mask, void SwWW8ImplReader::Read_SubSuper( sal_uInt16, const sal_uInt8* pData, short nLen ) { - if( nLen < 0 ){ + if (nLen < 1) + { m_pCtrlStck->SetAttr( *m_pPaM->GetPoint(), RES_CHRATR_ESCAPEMENT ); return; } @@ -3288,15 +3289,15 @@ bool SwWW8ImplReader::ConvertSubToGraphicPlacement() void SwWW8ImplReader::Read_SubSuperProp( sal_uInt16, const sal_uInt8* pData, short nLen ) { - if( nLen < 0 ) + ww::WordVersion eVersion = m_pWwFib->GetFIBVersion(); + + if (nLen < (eVersion <= ww::eWW2 ? 1 : 2)) { if (!ConvertSubToGraphicPlacement()) m_pCtrlStck->SetAttr( *m_pPaM->GetPoint(), RES_CHRATR_ESCAPEMENT ); return; } - ww::WordVersion eVersion = m_pWwFib->GetFIBVersion(); - // font position in HalfPoints short nPos = eVersion <= ww::eWW2 ? static_cast< sal_Int8 >( *pData ) : SVBT16ToShort( pData ); sal_Int32 nPos2 = nPos * ( 10 * 100 ); // HalfPoints in 100 * tw @@ -3321,7 +3322,7 @@ void SwWW8ImplReader::Read_Underline( sal_uInt16, const sal_uInt8* pData, short { FontLineStyle eUnderline = LINESTYLE_NONE; bool bWordLine = false; - if( pData ) + if (pData && nLen) { // Parameter: 0 = none, 1 = single, 2 = by Word, // 3 = double, 4 = dotted, 5 = hidden @@ -3351,7 +3352,7 @@ void SwWW8ImplReader::Read_Underline( sal_uInt16, const sal_uInt8* pData, short } // if necessary, mix up stack and exit! - if( nLen < 0 ) + if (nLen < 1) { m_pCtrlStck->SetAttr( *m_pPaM->GetPoint(), RES_CHRATR_UNDERLINE ); m_pCtrlStck->SetAttr( *m_pPaM->GetPoint(), RES_CHRATR_WORDLINEMODE ); @@ -3375,7 +3376,7 @@ NoBracket 78 CA 06 - 02 00 00 02 34 52 void SwWW8ImplReader::Read_DoubleLine_Rotate( sal_uInt16, const sal_uInt8* pData, short nLen ) { - if( nLen < 0 ) // close the tag + if (nLen < 0) // close the tag { m_pCtrlStck->SetAttr( *m_pPaM->GetPoint(), RES_CHRATR_TWO_LINES ); m_pCtrlStck->SetAttr( *m_pPaM->GetPoint(), RES_CHRATR_ROTATE ); @@ -3414,7 +3415,7 @@ void SwWW8ImplReader::Read_TextColor( sal_uInt16, const sal_uInt8* pData, short if (!m_bVer67 && m_pPlcxMan && m_pPlcxMan->GetChpPLCF()->HasSprm(NS_sprm::LN_CCv)) return; - if( nLen < 0 ) + if (nLen < 1) m_pCtrlStck->SetAttr( *m_pPaM->GetPoint(), RES_CHRATR_COLOR ); else { @@ -3431,7 +3432,7 @@ void SwWW8ImplReader::Read_TextColor( sal_uInt16, const sal_uInt8* pData, short void SwWW8ImplReader::Read_TextForeColor(sal_uInt16, const sal_uInt8* pData, short nLen) { - if( nLen < 0 ) + if (nLen < 4) m_pCtrlStck->SetAttr( *m_pPaM->GetPoint(), RES_CHRATR_COLOR ); else { @@ -3444,7 +3445,7 @@ void SwWW8ImplReader::Read_TextForeColor(sal_uInt16, const sal_uInt8* pData, sho void SwWW8ImplReader::Read_UnderlineColor(sal_uInt16, const sal_uInt8* pData, short nLen) { - if( nLen < 0 ) + if (nLen < 0) { //because the UnderlineColor is not a standalone attribute in SW, it belongs to the underline attribute. //And, the .doc file stores attributes separately, this attribute ends here, the "underline" @@ -3461,7 +3462,8 @@ void SwWW8ImplReader::Read_UnderlineColor(sal_uInt16, const sal_uInt8* pData, sh const SwAttrSet& aSet = m_pAktColl->GetAttrSet(); SvxUnderlineItem *pUnderline = static_cast<SvxUnderlineItem *>(aSet.Get( RES_CHRATR_UNDERLINE, false ).Clone()); - if(pUnderline){ + if (pUnderline && nLen >= 4) + { pUnderline->SetColor( Color( msfilter::util::BGRToRGB(SVBT32ToUInt32(pData)) ) ); m_pAktColl->SetFormatAttr( *pUnderline ); delete pUnderline; @@ -3474,7 +3476,8 @@ void SwWW8ImplReader::Read_UnderlineColor(sal_uInt16, const sal_uInt8* pData, sh { SvxUnderlineItem *pUnderline = static_cast<SvxUnderlineItem *>(m_pAktItemSet->Get( RES_CHRATR_UNDERLINE, false ) .Clone()); - if(pUnderline){ + if (pUnderline && nLen >= 4) + { pUnderline->SetColor( Color( msfilter::util::BGRToRGB(SVBT32ToUInt32(pData)) ) ); m_pAktItemSet->Put( *pUnderline ); delete pUnderline; @@ -3484,7 +3487,7 @@ void SwWW8ImplReader::Read_UnderlineColor(sal_uInt16, const sal_uInt8* pData, sh else { SvxUnderlineItem* pUnderlineAttr = const_cast<SvxUnderlineItem*>(static_cast<const SvxUnderlineItem*>(m_pCtrlStck->GetOpenStackAttr( *m_pPaM->GetPoint(), RES_CHRATR_UNDERLINE ))); - if( pUnderlineAttr != nullptr ) + if (pUnderlineAttr && nLen >= 4) pUnderlineAttr->SetColor( Color( msfilter::util::BGRToRGB(SVBT32ToUInt32( pData )))); } } @@ -3707,7 +3710,7 @@ void SwWW8ImplReader::Read_FontCode( sal_uInt16 nId, const sal_uInt8* pData, sho ww::WordVersion eVersion = m_pWwFib->GetFIBVersion(); - if( nLen < 0 ) // end of attribute + if (nLen < 2) // end of attribute { if (eVersion <= ww::eWW6) { @@ -3749,7 +3752,7 @@ void SwWW8ImplReader::Read_FontSize( sal_uInt16 nId, const sal_uInt8* pData, sho ww::WordVersion eVersion = m_pWwFib->GetFIBVersion(); - if( nLen < 0 ) // end of attribute + if (nLen < (eVersion <= ww::eWW2 ? 1 : 2)) // end of attribute { m_pCtrlStck->SetAttr( *m_pPaM->GetPoint(), nId ); if (eVersion <= ww::eWW6) // reset additionally the CTL size @@ -3792,14 +3795,14 @@ void SwWW8ImplReader::Read_FontSize( sal_uInt16 nId, const sal_uInt8* pData, sho void SwWW8ImplReader::Read_CharSet(sal_uInt16 , const sal_uInt8* pData, short nLen) { - if( nLen < 0 ) + if (nLen < 1) { // end of attribute m_eHardCharSet = RTL_TEXTENCODING_DONTKNOW; return; } sal_uInt8 nfChsDiff = *pData; - if( nfChsDiff ) + if (nfChsDiff && nLen >= 2) m_eHardCharSet = rtl_getTextEncodingFromWindowsCharset( *(pData + 1) ); else m_eHardCharSet = RTL_TEXTENCODING_DONTKNOW; @@ -3841,7 +3844,8 @@ void SwWW8ImplReader::Read_Language( sal_uInt16 nId, const sal_uInt8* pData, sho */ void SwWW8ImplReader::Read_CColl( sal_uInt16, const sal_uInt8* pData, short nLen ) { - if( nLen < 0 ){ // end of attribute + if (nLen < 2) // end of attribute + { m_pCtrlStck->SetAttr( *m_pPaM->GetPoint(), RES_TXTATR_CHARFMT ); m_nCharFormat = -1; return; @@ -3870,7 +3874,8 @@ void SwWW8ImplReader::Read_CColl( sal_uInt16, const sal_uInt8* pData, short nLen */ void SwWW8ImplReader::Read_Kern( sal_uInt16, const sal_uInt8* pData, short nLen ) { - if( nLen < 0 ){ // end of attribute + if (nLen < 2) // end of attribute + { m_pCtrlStck->SetAttr( *m_pPaM->GetPoint(), RES_CHRATR_KERNING ); return; } @@ -3880,7 +3885,7 @@ void SwWW8ImplReader::Read_Kern( sal_uInt16, const sal_uInt8* pData, short nLen void SwWW8ImplReader::Read_FontKern( sal_uInt16, const sal_uInt8* , short nLen ) { - if( nLen < 0 ) // end of attribute + if (nLen < 0) // end of attribute m_pCtrlStck->SetAttr( *m_pPaM->GetPoint(), RES_CHRATR_AUTOKERN ); else NewAttr(SvxAutoKernItem(true, RES_CHRATR_AUTOKERN)); @@ -3892,7 +3897,7 @@ void SwWW8ImplReader::Read_CharShadow( sal_uInt16, const sal_uInt8* pData, shor if (!m_bVer67 && m_pPlcxMan && m_pPlcxMan->GetChpPLCF()->HasSprm(0xCA71)) return; - if( nLen <= 0 ) + if (nLen < 2) { m_pCtrlStck->SetAttr( *m_pPaM->GetPoint(), RES_CHRATR_BACKGROUND ); } @@ -3914,7 +3919,7 @@ void SwWW8ImplReader::Read_CharShadow( sal_uInt16, const sal_uInt8* pData, shor void SwWW8ImplReader::Read_TextBackColor(sal_uInt16, const sal_uInt8* pData, short nLen ) { - if( nLen <= 0 ) + if (nLen <= 0) { m_pCtrlStck->SetAttr( *m_pPaM->GetPoint(), RES_CHRATR_BACKGROUND ); } @@ -3936,7 +3941,7 @@ void SwWW8ImplReader::Read_TextBackColor(sal_uInt16, const sal_uInt8* pData, sho void SwWW8ImplReader::Read_CharHighlight(sal_uInt16, const sal_uInt8* pData, short nLen) { - if( nLen <= 0 ) + if (nLen < 1) { m_pCtrlStck->SetAttr( *m_pPaM->GetPoint(), RES_CHRATR_HIGHLIGHT ); } @@ -3954,7 +3959,7 @@ void SwWW8ImplReader::Read_CharHighlight(sal_uInt16, const sal_uInt8* pData, sho void SwWW8ImplReader::Read_NoLineNumb(sal_uInt16 , const sal_uInt8* pData, short nLen) { - if( nLen < 0 ) // end of attribute + if (nLen < 0) // end of attribute { m_pCtrlStck->SetAttr( *m_pPaM->GetPoint(), RES_LINENUMBER ); return; @@ -3966,7 +3971,7 @@ void SwWW8ImplReader::Read_NoLineNumb(sal_uInt16 , const sal_uInt8* pData, short aLN.SetStartValue( pLN->GetStartValue() ); } - aLN.SetCountLines( pData && (0 == *pData) ); + aLN.SetCountLines(pData && nLen >= 1 && (0 == *pData)); NewAttr( aLN ); } @@ -3982,10 +3987,11 @@ bool lcl_HasExplicitLeft(const WW8PLCFMan *pPlcxMan, bool bVer67) } return false; } + // Sprm 16, 17 void SwWW8ImplReader::Read_LR( sal_uInt16 nId, const sal_uInt8* pData, short nLen ) { - if (nLen < 0) // end of attribute + if (nLen < 2) // end of attribute { m_pCtrlStck->SetAttr(*m_pPaM->GetPoint(), RES_LR_SPACE); return; @@ -4136,7 +4142,10 @@ void SwWW8ImplReader::Read_LineSpace( sal_uInt16, const sal_uInt8* pData, short if (m_bStyNormal && m_bWWBugNormal) return; - if( nLen < 0 ){ + ww::WordVersion eVersion = m_pWwFib->GetFIBVersion(); + + if (nLen < (eVersion <= ww::eWW2 ? 3 : 4)) + { m_pCtrlStck->SetAttr( *m_pPaM->GetPoint(), RES_PARATR_LINESPACING ); if( !( m_nIniFlags & WW8FL_NO_IMPLPASP ) ) m_pCtrlStck->SetAttr( *m_pPaM->GetPoint(), RES_UL_SPACE ); @@ -4144,7 +4153,6 @@ void SwWW8ImplReader::Read_LineSpace( sal_uInt16, const sal_uInt8* pData, short } short nSpace = SVBT16ToShort( pData ); - ww::WordVersion eVersion = m_pWwFib->GetFIBVersion(); short nMulti = (eVersion <= ww::eWW2) ? 1 : SVBT16ToShort( pData + 2 ); SvxLineSpaceRule eLnSpc; @@ -4204,7 +4212,7 @@ sal_uInt16 SwWW8ImplReader::GetParagraphAutoSpace(bool fDontUseHTMLAutoSpacing) void SwWW8ImplReader::Read_ParaAutoBefore(sal_uInt16, const sal_uInt8 *pData, short nLen) { - if (nLen < 0) + if (nLen < 1) { m_pCtrlStck->SetAttr(*m_pPaM->GetPoint(), RES_UL_SPACE); return; @@ -4231,7 +4239,7 @@ void SwWW8ImplReader::Read_ParaAutoBefore(sal_uInt16, const sal_uInt8 *pData, sh void SwWW8ImplReader::Read_ParaAutoAfter(sal_uInt16, const sal_uInt8 *pData, short nLen) { - if (nLen < 0) + if (nLen < 1) { m_pCtrlStck->SetAttr(*m_pPaM->GetPoint(), RES_UL_SPACE); return; @@ -4270,7 +4278,7 @@ void SwWW8ImplReader::Read_UL( sal_uInt16 nId, const sal_uInt8* pData, short nLe // then please send this Document to SH."); // bWWBugNormal is not a sufficient criterion for this distance being wrong. - if( nLen < 0 ) + if (nLen < 2) { // end of attribute m_pCtrlStck->SetAttr( *m_pPaM->GetPoint(), RES_UL_SPACE ); @@ -4303,7 +4311,7 @@ void SwWW8ImplReader::Read_UL( sal_uInt16 nId, const sal_uInt8* pData, short nLe void SwWW8ImplReader::Read_ParaContextualSpacing( sal_uInt16, const sal_uInt8* pData, short nLen ) { - if( nLen < 0 ) + if (nLen < 1) { m_pCtrlStck->SetAttr( *m_pPaM->GetPoint(), RES_UL_SPACE ); return; @@ -4321,7 +4329,7 @@ void SwWW8ImplReader::Read_IdctHint( sal_uInt16, const sal_uInt8* pData, short n // when this value is 0, text properties bias towards non-far east properties. // when this value is 1, text properties bias towards far east properties. // when this value is 2, text properties bias towards complex properties. - if( nLen < 0 ) //Property end + if (nLen < 1) //Property end { m_pCtrlStck->SetAttr(*m_pPaM->GetPoint(),RES_CHRATR_IDCTHINT); } @@ -4333,7 +4341,7 @@ void SwWW8ImplReader::Read_IdctHint( sal_uInt16, const sal_uInt8* pData, short n void SwWW8ImplReader::Read_Justify( sal_uInt16, const sal_uInt8* pData, short nLen ) { - if( nLen < 0 ) + if (nLen < 1) { m_pCtrlStck->SetAttr( *m_pPaM->GetPoint(), RES_PARATR_ADJUST ); return; @@ -4386,7 +4394,7 @@ bool SwWW8ImplReader::IsRightToLeft() void SwWW8ImplReader::Read_RTLJustify( sal_uInt16, const sal_uInt8* pData, short nLen ) { - if( nLen < 0 ) + if (nLen < 1) { m_pCtrlStck->SetAttr( *m_pPaM->GetPoint(), RES_PARATR_ADJUST ); return; @@ -4445,7 +4453,7 @@ void SwWW8ImplReader::Read_BoolItem( sal_uInt16 nId, const sal_uInt8* pData, sho return ; } - if( nLen < 0 ) + if (nLen < 1) m_pCtrlStck->SetAttr( *m_pPaM->GetPoint(), nId ); else { @@ -4458,7 +4466,7 @@ void SwWW8ImplReader::Read_BoolItem( sal_uInt16 nId, const sal_uInt8* pData, sho void SwWW8ImplReader::Read_Emphasis( sal_uInt16, const sal_uInt8* pData, short nLen ) { - if( nLen < 0 ) + if (nLen < 1) m_pCtrlStck->SetAttr( *m_pPaM->GetPoint(), RES_CHRATR_EMPHASIS_MARK ); else { @@ -4515,7 +4523,7 @@ void SwWW8ImplReader::Read_Emphasis( sal_uInt16, const sal_uInt8* pData, short n void SwWW8ImplReader::Read_ScaleWidth( sal_uInt16, const sal_uInt8* pData, short nLen ) { - if( nLen < 0 ) + if (nLen < 2) m_pCtrlStck->SetAttr( *m_pPaM->GetPoint(), RES_CHRATR_SCALEW ); else { @@ -4529,7 +4537,7 @@ void SwWW8ImplReader::Read_ScaleWidth( sal_uInt16, const sal_uInt8* pData, short void SwWW8ImplReader::Read_Relief( sal_uInt16 nId, const sal_uInt8* pData, short nLen ) { - if( nLen < 0 ) + if (nLen < 1) m_pCtrlStck->SetAttr( *m_pPaM->GetPoint(), RES_CHRATR_RELIEF ); else { @@ -4556,7 +4564,7 @@ void SwWW8ImplReader::Read_Relief( sal_uInt16 nId, const sal_uInt8* pData, short void SwWW8ImplReader::Read_TextAnim(sal_uInt16 /*nId*/, const sal_uInt8* pData, short nLen) { - if (nLen < 0) + if (nLen < 1) m_pCtrlStck->SetAttr(*m_pPaM->GetPoint(), RES_CHRATR_BLINK); else { @@ -4718,7 +4726,7 @@ void SwWW8ImplReader::Read_Shade( sal_uInt16, const sal_uInt8* pData, short nLen if (!m_bVer67 && m_pPlcxMan && m_pPlcxMan->GetPapPLCF()->HasSprm(0xC64D)) return; - if (nLen <= 0) + if (nLen < 2) { // end of attribute m_pCtrlStck->SetAttr( *m_pPaM->GetPoint(), RES_BACKGROUND ); @@ -4794,7 +4802,7 @@ void SwWW8ImplReader::Read_TextVerticalAdjustment( sal_uInt16, const sal_uInt8* void SwWW8ImplReader::Read_Border(sal_uInt16 , const sal_uInt8*, short nLen) { - if( nLen < 0 ) + if (nLen < 0) { if( m_bHasBorder ) { @@ -4871,7 +4879,7 @@ void SwWW8ImplReader::Read_CharBorder(sal_uInt16 nId, const sal_uInt8* pData, sh //if (!bVer67 && pPlcxMan && pPlcxMan->GetChpPLCF()->HasSprm(0xCA72)) // return; - if( nLen < 0 ) + if (nLen < 0) { m_pCtrlStck->SetAttr( *m_pPaM->GetPoint(), RES_CHRATR_BOX ); m_pCtrlStck->SetAttr( *m_pPaM->GetPoint(), RES_CHRATR_SHADOW ); @@ -4911,7 +4919,7 @@ void SwWW8ImplReader::Read_CharBorder(sal_uInt16 nId, const sal_uInt8* pData, sh void SwWW8ImplReader::Read_Hyphenation( sal_uInt16, const sal_uInt8* pData, short nLen ) { // set Hyphenation flag - if( nLen <= 0 ) + if (nLen < 1) m_pCtrlStck->SetAttr( *m_pPaM->GetPoint(), RES_PARATR_HYPHENZONE ); else { @@ -4933,7 +4941,7 @@ void SwWW8ImplReader::Read_Hyphenation( sal_uInt16, const sal_uInt8* pData, shor void SwWW8ImplReader::Read_WidowControl( sal_uInt16, const sal_uInt8* pData, short nLen ) { - if( nLen <= 0 ) + if (nLen < 1) { m_pCtrlStck->SetAttr( *m_pPaM->GetPoint(), RES_PARATR_WIDOWS ); m_pCtrlStck->SetAttr( *m_pPaM->GetPoint(), RES_PARATR_ORPHANS ); @@ -4953,7 +4961,7 @@ void SwWW8ImplReader::Read_WidowControl( sal_uInt16, const sal_uInt8* pData, sho void SwWW8ImplReader::Read_UsePgsuSettings(sal_uInt16,const sal_uInt8* pData,short nLen) { - if( nLen <= 0 ) + if (nLen < 1) m_pCtrlStck->SetAttr( *m_pPaM->GetPoint(), RES_PARATR_SNAPTOGRID); else { @@ -4966,7 +4974,7 @@ void SwWW8ImplReader::Read_UsePgsuSettings(sal_uInt16,const sal_uInt8* pData,sho void SwWW8ImplReader::Read_AlignFont( sal_uInt16, const sal_uInt8* pData, short nLen ) { - if( nLen <= 0 ) + if (nLen < 2) m_pCtrlStck->SetAttr( *m_pPaM->GetPoint(), RES_PARATR_VERTALIGN); else { @@ -5000,7 +5008,7 @@ void SwWW8ImplReader::Read_AlignFont( sal_uInt16, const sal_uInt8* pData, short void SwWW8ImplReader::Read_KeepLines( sal_uInt16, const sal_uInt8* pData, short nLen ) { - if( nLen <= 0 ) + if (nLen < 1) m_pCtrlStck->SetAttr( *m_pPaM->GetPoint(), RES_PARATR_SPLIT ); else NewAttr( SvxFormatSplitItem( ( *pData & 1 ) == 0, RES_PARATR_SPLIT ) ); @@ -5008,7 +5016,7 @@ void SwWW8ImplReader::Read_KeepLines( sal_uInt16, const sal_uInt8* pData, short void SwWW8ImplReader::Read_KeepParas( sal_uInt16, const sal_uInt8* pData, short nLen ) { - if( nLen <= 0 ) + if (nLen < 1) m_pCtrlStck->SetAttr( *m_pPaM->GetPoint(), RES_KEEP ); else NewAttr( SvxFormatKeepItem( ( *pData & 1 ) != 0 , RES_KEEP) ); @@ -5016,7 +5024,7 @@ void SwWW8ImplReader::Read_KeepParas( sal_uInt16, const sal_uInt8* pData, short void SwWW8ImplReader::Read_BreakBefore( sal_uInt16, const sal_uInt8* pData, short nLen ) { - if( nLen <= 0 ) + if (nLen < 1) m_pCtrlStck->SetAttr( *m_pPaM->GetPoint(), RES_BREAK ); else NewAttr( SvxFormatBreakItem( commit 189442aab3b12dd866f6ae129a79f648847af919 Author: Markus Mohrhard <[email protected]> Date: Sun Apr 9 01:21:25 2017 +0200 don't replace content of formula field when selecting range, tdf#58635 Change-Id: I85953fdd7c2b7f193b2a815564526d985ae2bba4 Reviewed-on: https://gerrit.libreoffice.org/36309 Reviewed-by: Markus Mohrhard <[email protected]> Tested-by: Markus Mohrhard <[email protected]> (cherry picked from commit 42aece949ec96c775b31216bddd723aa5321e966) Reviewed-on: https://gerrit.libreoffice.org/36310 Tested-by: Jenkins <[email protected]> Reviewed-by: Katarina Behrens <[email protected]> (cherry picked from commit dcd9eef1727efb7a909f8009fde4f34f26139522) diff --git a/sc/source/ui/condformat/condformatdlg.cxx b/sc/source/ui/condformat/condformatdlg.cxx index b2c0a1c07dd8..9a416692a4fd 100644 --- a/sc/source/ui/condformat/condformatdlg.cxx +++ b/sc/source/ui/condformat/condformatdlg.cxx @@ -572,7 +572,10 @@ void ScCondFormatDlg::SetReference(const ScRange& rRef, ScDocument*) OUString aRefStr(rRef.Format(nFlags, mpViewData->GetDocument(), ScAddress::Details(mpViewData->GetDocument()->GetAddressConvention(), 0, 0))); - pEdit->SetRefString( aRefStr ); + if (pEdit != mpEdRange) + pEdit->ReplaceSelected(aRefStr); + else + pEdit->SetRefString( aRefStr ); updateTitle(); } } commit 5a19dc0254b7938a5967625e663a439d04f93eae Author: Eike Rathke <[email protected]> Date: Fri Apr 7 16:20:37 2017 +0200 out-of-bounds tab access when deleting second last sheet Which in a debug build lead to STL assert Error: attempt to subscript container with out-of-bounds index Change-Id: I09fddbc9e4b214b0313c193f85830ed458d20c0e (cherry picked from commit 0c55972d747511dbc711f3c9cbb4db5d8c5dc2ff) Reviewed-on: https://gerrit.libreoffice.org/36274 Reviewed-by: Markus Mohrhard <[email protected]> Tested-by: Jenkins <[email protected]> (cherry picked from commit 9826eb9b6bad6f21801dd8a0016bb770085a9072) diff --git a/sc/source/ui/view/tabvwshf.cxx b/sc/source/ui/view/tabvwshf.cxx index a62c76e2d6e3..35d89eb15acb 100644 --- a/sc/source/ui/view/tabvwshf.cxx +++ b/sc/source/ui/view/tabvwshf.cxx @@ -624,13 +624,13 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq ) { TheTabs.push_back(i); bTabFlag = true; - if (nNewTab == i) + if (nNewTab == i && i+1 < nTabCount) nNewTab++; } if (!bTabFlag) nFirstTab = i; } - if (nNewTab >= nTabCount) + if (nNewTab >= nTabCount - static_cast<SCTAB>(TheTabs.size())) nNewTab = nFirstTab; } commit d14544e9499c50c25a2c3f1a7f08b76ba0dafe69 Author: Caolán McNamara <[email protected]> Date: Fri Mar 3 11:25:32 2017 +0000 backport various fixes to aid future backporting ofz#725 fix hwp leak Change-Id: I09088981ca63b297781307590092725bc1cbed1b (cherry picked from commit 681b6361f23a8f20511ad97989c642b07f25c495) valgrind: uninitialized reads Change-Id: Ia1e821d1e323d85c65484c980be09f015af6517b (cherry picked from commit afabc7d2f2fcf8fcd39ff5002f09c32e8f03d4bb) partial loplugin:useuniqueptr extend to catch more localvar cases hwpfilter part of... commit aa09b0c27a6d925da428d6267daadc7338829869 Author: Noel Grandin <[email protected]> Date: Thu Apr 6 09:46:06 2017 +0200 loplugin:useuniqueptr extend to catch more localvar cases i.e. where the code looks like { foo * p = new foo; ... delete p; return ...; } Change-Id: Iad770d1904b2373b1bf8ce609f4c95882388eff8 ofz: epic slow use of std::list Change-Id: I790a3098272101fd33f83f21bdcef1bb061efd76 Reviewed-on: https://gerrit.libreoffice.org/34635 Tested-by: Jenkins <[email protected]> Reviewed-by: Caolán McNamara <[email protected]> Tested-by: Caolán McNamara <[email protected]> (cherry picked from commit 283e843be91ef4d727c0815d1b8a0420fd16a7fd) use rtl::Reference in HwpReader instead of storing both a raw pointer and an uno::Reference (cherry picked from commit 0bab51d8ad35a31685002118cdac20657b57137a) Change-Id: I02dd356d9693116f98ad2b96951570b3ba448b14 Reviewed-on: https://gerrit.libreoffice.org/36299 Tested-by: Jenkins <[email protected]> Reviewed-by: Miklos Vajna <[email protected]> (cherry picked from commit e48ec134dbe72f17b08ebdeaaa215b29243ee5c4) diff --git a/hwpfilter/qa/cppunit/data/fail/cslist-1.hwp b/hwpfilter/qa/cppunit/data/fail/cslist-1.hwp new file mode 100644 index 000000000000..d491f7b4c04d Binary files /dev/null and b/hwpfilter/qa/cppunit/data/fail/cslist-1.hwp differ diff --git a/hwpfilter/source/hpara.cxx b/hwpfilter/source/hpara.cxx index 96b2729c8698..84294c59ed3c 100644 --- a/hwpfilter/source/hpara.cxx +++ b/hwpfilter/source/hpara.cxx @@ -77,7 +77,6 @@ HWPPara::HWPPara() , pstyno(0) , linfo(nullptr) , cshapep(nullptr) - , hhstr(nullptr) { memset(&cshape, 0, sizeof(cshape)); memset(&pshape, 0, sizeof(pshape)); @@ -87,19 +86,8 @@ HWPPara::~HWPPara() { delete[] linfo; delete[] cshapep; - if (hhstr) - { -// virtual destructor -/* C++ì nullì ëí´ìë ëìíë¤. */ - for (int ii = 0; ii < nch; ++ii) - delete hhstr[ii]; - - delete[]hhstr; - } - } - bool HWPPara::Read(HWPFile & hwpf, unsigned char flag) { unsigned char same_cshape; @@ -162,6 +150,7 @@ bool HWPPara::Read(HWPFile & hwpf, unsigned char flag) perror("Memory Allocation: cshape\n"); return false; } + memset(cshapep, 0, nch * sizeof(CharShape)); for (ii = 0; ii < nch; ii++) { @@ -180,14 +169,12 @@ bool HWPPara::Read(HWPFile & hwpf, unsigned char flag) } } // read string - hhstr = ::comphelper::newArray_null<HBox *>(nch); - if (!hhstr) { return false; } - for (ii = 0; ii < nch; ii++) - hhstr[ii] = nullptr; + hhstr.resize(nch); ii = 0; while (ii < nch) { - if (nullptr == (hhstr[ii] = readHBox(hwpf))) + hhstr[ii] = readHBox(hwpf); + if (!hhstr[ii]) return false; if (hhstr[ii]->hh == CH_END_PARA) break; @@ -207,93 +194,93 @@ CharShape *HWPPara::GetCharShape(int pos) } -HBox *HWPPara::readHBox(HWPFile & hwpf) +std::unique_ptr<HBox> HWPPara::readHBox(HWPFile & hwpf) { + std::unique_ptr<HBox> hbox; + hchar hh; if (!hwpf.Read2b(hh)) - return nullptr; - - HBox *hbox = nullptr; + return hbox; if (hwpf.State() != HWP_NoError) - return nullptr; + return hbox; if (hh > 31 || hh == CH_END_PARA) - hbox = new HBox(hh); + hbox.reset(new HBox(hh)); else if (IS_SP_SKIP_BLOCK(hh)) - hbox = new SkipData(hh); + hbox.reset(new SkipData(hh)); else { switch (hh) { case CH_FIELD: // 5 - hbox = new FieldCode; + hbox.reset(new FieldCode); break; case CH_BOOKMARK: // 6 - hbox = new Bookmark; + hbox.reset(new Bookmark); break; case CH_DATE_FORM: // 7 - hbox = new DateFormat; + hbox.reset(new DateFormat); break; case CH_DATE_CODE: // 8 - hbox = new DateCode; + hbox.reset(new DateCode); break; case CH_TAB: // 9 - hbox = new Tab; + hbox.reset(new Tab); break; case CH_TEXT_BOX: // 10 - hbox = new TxtBox; + hbox.reset(new TxtBox); break; case CH_PICTURE: // 11 - hbox = new Picture; + hbox.reset(new Picture); break; case CH_LINE: // 14 - hbox = new Line; + hbox.reset(new Line); break; case CH_HIDDEN: // 15 - hbox = new Hidden; + hbox.reset(new Hidden); break; case CH_HEADER_FOOTER: // 16 - hbox = new HeaderFooter; + hbox.reset(new HeaderFooter); break; case CH_FOOTNOTE: // 17 - hbox = new Footnote; + hbox.reset(new Footnote); break; case CH_AUTO_NUM: // 18 - hbox = new AutoNum; + hbox.reset(new AutoNum); break; case CH_NEW_NUM: // 19 - hbox = new NewNum; + hbox.reset(new NewNum); break; case CH_SHOW_PAGE_NUM: // 20 - hbox = new ShowPageNum; + hbox.reset(new ShowPageNum); break; case CH_PAGE_NUM_CTRL: // 21 - hbox = new PageNumCtrl; + hbox.reset(new PageNumCtrl); break; case CH_MAIL_MERGE: // 22 - hbox = new MailMerge; + hbox.reset(new MailMerge); break; case CH_COMPOSE: // 23 - hbox = new Compose; + hbox.reset(new Compose); break; case CH_HYPHEN: // 24 - hbox = new Hyphen; + hbox.reset(new Hyphen); break; case CH_TOC_MARK: // 25 - hbox = new TocMark; + hbox.reset(new TocMark); break; case CH_INDEX_MARK: // 26 - hbox = new IndexMark; + hbox.reset(new IndexMark); break; case CH_OUTLINE: // 28 - hbox = new Outline; + hbox.reset(new Outline); break; case CH_KEEP_SPACE: // 30 - hbox = new KeepSpace; + hbox.reset(new KeepSpace); break; case CH_FIXED_SPACE: // 31 - hbox = new FixedSpace; + hbox.reset(new FixedSpace); break; default: break; @@ -301,13 +288,12 @@ HBox *HWPPara::readHBox(HWPFile & hwpf) } if (!hbox || !hbox->Read(hwpf)) { - delete hbox; - - return nullptr; + hbox.reset(); + return hbox; } if( hh == CH_TEXT_BOX || hh == CH_PICTURE || hh == CH_LINE ) { - FBox *fbox = static_cast<FBox *>(hbox); + FBox *fbox = static_cast<FBox *>(hbox.get()); if( ( fbox->style.anchor_type == 1) && ( fbox->pgy >= begin_ypos) ) { //strange construct to compile without warning diff --git a/hwpfilter/source/hpara.h b/hwpfilter/source/hpara.h index afb9f5a50b91..6496eae80f70 100644 --- a/hwpfilter/source/hpara.h +++ b/hwpfilter/source/hpara.h @@ -23,6 +23,7 @@ #include <hwplib.h> #include <hwpfile.h> #include <hinfo.h> +#include <memory> struct HBox; @@ -110,7 +111,7 @@ class DLLEXPORT HWPPara /** * Box object list */ - HBox **hhstr; + std::vector<std::unique_ptr<HBox>> hhstr; HWPPara(void); ~HWPPara(void); @@ -135,7 +136,7 @@ class DLLEXPORT HWPPara HWPPara *Next(void) { return _next;} private: - HBox *readHBox(HWPFile &); + std::unique_ptr<HBox> readHBox(HWPFile &); }; #endif // INCLUDED_HWPFILTER_SOURCE_HPARA_H diff --git a/hwpfilter/source/hwpfile.cxx b/hwpfilter/source/hwpfile.cxx index 3abfcac3086b..f0a9f4279c4f 100644 --- a/hwpfilter/source/hwpfile.cxx +++ b/hwpfilter/source/hwpfile.cxx @@ -70,7 +70,7 @@ HWPFile::~HWPFile() for (; it != plist.end(); ++it) delete *it; - std::list < Table* >::iterator tbl = tables.begin(); + std::vector< Table* >::iterator tbl = tables.begin(); for (; tbl != tables.end(); ++tbl) delete *tbl; @@ -241,7 +241,7 @@ void HWPFile::ParaListRead() bool HWPFile::ReadParaList(std::list < HWPPara* > &aplist, unsigned char flag) { - HWPPara *spNode = new HWPPara; + std::unique_ptr<HWPPara> spNode( new HWPPara ); unsigned char tmp_etcflag; unsigned char prev_etcflag = 0; while (spNode->Read(*this, flag)) @@ -266,11 +266,10 @@ bool HWPFile::ReadParaList(std::list < HWPPara* > &aplist, unsigned char flag) AddParaShape( &spNode->pshape ); if (!aplist.empty()) - aplist.back()->SetNext(spNode); - aplist.push_back(spNode); - spNode = new HWPPara; + aplist.back()->SetNext(spNode.get()); + aplist.push_back(spNode.release()); + spNode.reset( new HWPPara ); } - delete spNode; return true; } @@ -457,92 +456,53 @@ void HWPFile::AddBox(FBox * box) blist.push_back(box); } - ParaShape *HWPFile::getParaShape(int index) { - std::list<ParaShape*>::iterator it = pslist.begin(); - - for( int i = 0; it != pslist.end(); ++it, i++ ){ - if( i == index ) - break; - } - - return it != pslist.end() ? *it : nullptr; + if (index < 0 || static_cast<unsigned int>(index) >= pslist.size()) + return nullptr; + return pslist[index]; } - CharShape *HWPFile::getCharShape(int index) { - std::list<CharShape*>::iterator it = cslist.begin(); - - for( int i = 0; it != cslist.end(); ++it, i++ ){ - if( i == index ) - break; - } - - return it != cslist.end() ? *it : nullptr; + if (index < 0 || static_cast<unsigned int>(index) >= cslist.size()) + return nullptr; + return cslist[index]; } - FBoxStyle *HWPFile::getFBoxStyle(int index) { - std::list<FBoxStyle*>::iterator it = fbslist.begin(); - - for( int i = 0; it != fbslist.end(); ++it, i++ ){ - if( i == index ) - break; - } - - return it != fbslist.end() ? *it : nullptr; + if (index < 0 || static_cast<unsigned int>(index) >= fbslist.size()) + return nullptr; + return fbslist[index]; } DateCode *HWPFile::getDateCode(int index) { - std::list<DateCode*>::iterator it = datecodes.begin(); - - for( int i = 0; it != datecodes.end(); ++it, i++ ){ - if( i == index ) - break; - } - - return it != datecodes.end() ? *it : nullptr; + if (index < 0 || static_cast<unsigned int>(index) >= datecodes.size()) + return nullptr; + return datecodes[index]; } HeaderFooter *HWPFile::getHeaderFooter(int index) { - std::list<HeaderFooter*>::iterator it = headerfooters.begin(); - - for( int i = 0; it != headerfooters.end(); ++it, i++ ){ - if( i == index ) - break; - } - - return it != headerfooters.end() ? *it : nullptr; + if (index < 0 || static_cast<unsigned int>(index) >= headerfooters.size()) + return nullptr; + return headerfooters[index]; } ShowPageNum *HWPFile::getPageNumber(int index) { - std::list<ShowPageNum*>::iterator it = pagenumbers.begin(); - - for( int i = 0; it != pagenumbers.end(); ++it, i++ ){ - if( i == index ) - break; - } - - return it != pagenumbers.end() ? *it : nullptr; - + if (index < 0 || static_cast<unsigned int>(index) >= pagenumbers.size()) + return nullptr; + return pagenumbers[index]; } Table *HWPFile::getTable(int index) { - std::list<Table*>::iterator it = tables.begin(); - - for( int i = 0; it != tables.end(); ++it, i++ ){ - if( i == index ) - break; - } - - return it != tables.end() ? *it : nullptr; + if (index < 0 || static_cast<unsigned int>(index) >= tables.size()) + return nullptr; + return tables[index]; } void HWPFile::AddParaShape(ParaShape * pshape) diff --git a/hwpfilter/source/hwpfile.h b/hwpfilter/source/hwpfile.h index 793354e4c508..1d8da3673169 100644 --- a/hwpfilter/source/hwpfile.h +++ b/hwpfilter/source/hwpfile.h @@ -26,6 +26,7 @@ #define INCLUDED_HWPFILTER_SOURCE_HWPFILE_H #include <list> +#include <vector> #include <stdio.h> #include <string.h> #include <fcntl.h> @@ -282,13 +283,13 @@ class DLLEXPORT HWPFile std::list<EmPicture*> emblist; std::list<HyperText*> hyperlist; int currenthyper; - std::list<ParaShape*> pslist; /* ì¤íì¤í¼ì¤ì 구조ì íì */ - std::list<CharShape*> cslist; - std::list<FBoxStyle*> fbslist; - std::list<DateCode*> datecodes; - std::list<HeaderFooter*> headerfooters; - std::list<ShowPageNum*> pagenumbers; - std::list<Table*> tables; + std::vector<ParaShape*> pslist; /* ì¤íì¤í¼ì¤ì 구조ì íì */ + std::vector<CharShape*> cslist; + std::vector<FBoxStyle*> fbslist; + std::vector<DateCode*> datecodes; + std::vector<HeaderFooter*> headerfooters; + std::vector<ShowPageNum*> pagenumbers; + std::vector<Table*> tables; // for global document handling static HWPFile *cur_doc; diff --git a/hwpfilter/source/hwpreader.cxx b/hwpfilter/source/hwpreader.cxx index 02348731913b..c3d8766c4297 100644 --- a/hwpfilter/source/hwpreader.cxx +++ b/hwpfilter/source/hwpreader.cxx @@ -42,7 +42,7 @@ #define rstartEl(x,y) do { if (m_rxDocumentHandler.is()) m_rxDocumentHandler->startElement(x,y); } while(false) #define rendEl(x) do { if (m_rxDocumentHandler.is()) m_rxDocumentHandler->endElement(x); } while(false) #define rchars(x) do { if (m_rxDocumentHandler.is()) m_rxDocumentHandler->characters(x); } while(false) -#define padd(x,y,z) pList->addAttribute(x,y,z) +#define padd(x,y,z) mxList->addAttribute(x,y,z) #define Double2Str(x) OUString::number((double)(x)) #define WTI(x) ((double)(x) / 1800.) // unit => inch #define WTMM(x) ((double)(x) / 1800. * 25.4) // unit => mm @@ -54,14 +54,14 @@ #define sXML_CDATA "CDATA" #define STARTP padd( "text:style-name", "CDATA", ascii(getPStyleName(((ParaShape &)para->GetParaShape()).index,buf))); \ - rstartEl( "text:p",rList ); \ - pList->clear(); \ + rstartEl( "text:p",mxList.get() ); \ + mxList->clear(); \ pstart = true #define STARTT \ curr = para->GetCharShape(n > 0 ? n-1 : 0)->index; \ padd( "text:style-name", "CDATA" , ascii( getTStyleName(curr, buf) ) ); \ - rstartEl( "text:span",rList ); \ - pList->clear(); \ + rstartEl( "text:span",mxList.get() ); \ + mxList->clear(); \ tstart = true #define ENDP \ rendEl("text:p"); \ @@ -107,15 +107,13 @@ struct HwpReaderPrivate HwpReader::HwpReader() { - pList = new AttributeListImpl; - rList = static_cast<XAttributeList *>(pList); + mxList = new AttributeListImpl; d = new HwpReaderPrivate; } HwpReader::~HwpReader() { - rList = nullptr; delete d; } @@ -188,8 +186,8 @@ sal_Bool HwpReader::filter(const Sequence< PropertyValue >& rDescriptor) throw(R padd("xmlns:form", "CDATA", "http://openoffice.org/2000/form"); padd("xmlns:script", "CDATA", "http://openoffice.org/2000/script"); - rstartEl("office:document", rList); - pList->clear(); + rstartEl("office:document", mxList.get()); + mxList->clear(); makeMeta(); makeStyles(); @@ -210,7 +208,7 @@ sal_Bool HwpReader::filter(const Sequence< PropertyValue >& rDescriptor) throw(R */ void HwpReader::makeBody() { - rstartEl("office:body", rList); + rstartEl("office:body", mxList.get()); makeTextDecls(); HWPPara *hwppara = hwpfile.GetFirstPara(); d->bInBody = true; @@ -225,26 +223,26 @@ void HwpReader::makeBody() */ void HwpReader::makeTextDecls() { - rstartEl("text:sequence-decls", rList); + rstartEl("text:sequence-decls", mxList.get()); padd("text:display-outline-level", sXML_CDATA, "0"); padd("text:name", sXML_CDATA, "Illustration"); - rstartEl("text:sequence-decl", rList); - pList->clear(); + rstartEl("text:sequence-decl", mxList.get()); + mxList->clear(); rendEl("text:sequence-decl"); padd("text:display-outline-level", sXML_CDATA, "0"); padd("text:name", sXML_CDATA, "Table"); - rstartEl("text:sequence-decl", rList); - pList->clear(); + rstartEl("text:sequence-decl", mxList.get()); + mxList->clear(); rendEl("text:sequence-decl"); padd("text:display-outline-level", sXML_CDATA, "0"); padd("text:name", sXML_CDATA, "Text"); - rstartEl("text:sequence-decl", rList); - pList->clear(); + rstartEl("text:sequence-decl", mxList.get()); + mxList->clear(); rendEl("text:sequence-decl"); padd("text:display-outline-level", sXML_CDATA, "0"); padd("text:name", sXML_CDATA, "Drawing"); - rstartEl("text:sequence-decl", rList); - pList->clear(); + rstartEl("text:sequence-decl", mxList.get()); + mxList->clear(); rendEl("text:sequence-decl"); rendEl("text:sequence-decls"); } @@ -259,25 +257,25 @@ void HwpReader::makeMeta() { HWPInfo& hwpinfo = hwpfile.GetHWPInfo(); - rstartEl("office:meta", rList); + rstartEl("office:meta", mxList.get()); if (hwpinfo.summary.title[0]) { - rstartEl("dc:title", rList); + rstartEl("dc:title", mxList.get()); rchars(reinterpret_cast<sal_Unicode const *>(hconv(hwpinfo.summary.title))); rendEl("dc:title"); } if (hwpinfo.summary.subject[0]) { - rstartEl("dc:subject", rList); + rstartEl("dc:subject", mxList.get()); rchars(reinterpret_cast<sal_Unicode const *>(hconv(hwpinfo.summary.subject))); rendEl("dc:subject"); } if (hwpinfo.summary.author[0]) { - rstartEl("meta:initial-creator", rList); + rstartEl("meta:initial-creator", mxList.get()); rchars(reinterpret_cast<sal_Unicode const *>(hconv(hwpinfo.summary.author))); rendEl("meta:initial-creator"); } @@ -341,41 +339,41 @@ void HwpReader::makeMeta() } sprintf(buf,"%d-%02d-%02dT%02d:%02d:00",year,month,day,hour,minute); - rstartEl( "meta:creation-date", rList ); + rstartEl( "meta:creation-date", mxList.get() ); rchars( ascii(buf)); rendEl( "meta:creation-date" ); } if (hwpinfo.summary.keyword[0][0] || hwpinfo.summary.etc[0][0]) { - rstartEl("meta:keywords", rList); + rstartEl("meta:keywords", mxList.get()); if (hwpinfo.summary.keyword[0][0]) { - rstartEl("meta:keyword", rList); + rstartEl("meta:keyword", mxList.get()); rchars(reinterpret_cast<sal_Unicode const *>(hconv(hwpinfo.summary.keyword[0]))); rendEl("meta:keyword"); } if (hwpinfo.summary.keyword[1][0]) { - rstartEl("meta:keyword", rList); + rstartEl("meta:keyword", mxList.get()); rchars(reinterpret_cast<sal_Unicode const *>(hconv(hwpinfo.summary.keyword[1]))); rendEl("meta:keyword"); } if (hwpinfo.summary.etc[0][0]) { - rstartEl("meta:keyword", rList); + rstartEl("meta:keyword", mxList.get()); rchars(reinterpret_cast<sal_Unicode const *>(hconv(hwpinfo.summary.etc[0]))); rendEl("meta:keyword"); } if (hwpinfo.summary.etc[1][0]) { - rstartEl("meta:keyword", rList); + rstartEl("meta:keyword", mxList.get()); rchars(reinterpret_cast<sal_Unicode const *>(hconv(hwpinfo.summary.etc[1]))); rendEl("meta:keyword"); } if (hwpinfo.summary.etc[2][0]) { - rstartEl("meta:keyword", rList); + rstartEl("meta:keyword", mxList.get()); rchars(reinterpret_cast<sal_Unicode const *>(hconv(hwpinfo.summary.etc[2]))); rendEl("meta:keyword"); } @@ -450,8 +448,8 @@ void HwpReader::makeDrawMiscStyle( HWPDrawingObject *hdo ) padd( "draw:dots2-length", sXML_CDATA, Double2Str( LineStyle[prop->line_pstyle].dots2 * WTMM(prop->line_width)) + "cm"); } padd( "draw:distance", sXML_CDATA, Double2Str( LineStyle[prop->line_pstyle].distance * WTMM(prop->line_width)) + "cm"); - rstartEl( "draw:stroke-dash", rList); - pList->clear(); + rstartEl( "draw:stroke-dash", mxList.get()); + mxList->clear(); rendEl( "draw:stroke-dash" ); } @@ -478,8 +476,8 @@ void HwpReader::makeDrawMiscStyle( HWPDrawingObject *hdo ) padd("svg:viewBox", sXML_CDATA, "0 0 30 30"); padd("svg:d", sXML_CDATA, "m0 0h30v30h-30z"); } - rstartEl("draw:marker", rList); - pList->clear(); + rstartEl("draw:marker", mxList.get()); + mxList->clear(); rendEl("draw:marker"); } if( prop->line_hstyle && !ArrowShape[prop->line_hstyle].bMade) @@ -502,8 +500,8 @@ void HwpReader::makeDrawMiscStyle( HWPDrawingObject *hdo ) padd("svg:viewBox", sXML_CDATA, "0 0 20 20"); padd("svg:d", sXML_CDATA, "m0 0h20v20h-20z"); } - rstartEl("draw:marker", rList); - pList->clear(); + rstartEl("draw:marker", mxList.get()); + mxList->clear(); rendEl("draw:marker"); } } @@ -567,8 +565,8 @@ void HwpReader::makeDrawMiscStyle( HWPDrawingObject *hdo ) padd( "xlink:show", sXML_CDATA, "embed"); padd( "xlink:actuate", sXML_CDATA, "onLoad"); - rstartEl( "draw:fill-image", rList); - pList->clear(); + rstartEl( "draw:fill-image", mxList.get()); + mxList->clear(); rendEl( "draw:fill-image"); } /* If there is a gradient, when a bitmap file is present, this is the first. */ @@ -649,8 +647,8 @@ void HwpReader::makeDrawMiscStyle( HWPDrawingObject *hdo ) padd( "draw:angle", sXML_CDATA, ascii(Int2Str( angle, "%d", buf))); } - rstartEl( "draw:gradient", rList ); - pList->clear(); + rstartEl( "draw:gradient", mxList.get() ); + mxList->clear(); rendEl( "draw:gradient"); } /* hatch */ @@ -686,8 +684,8 @@ void HwpReader::makeDrawMiscStyle( HWPDrawingObject *hdo ) padd( "draw:rotation", sXML_CDATA, "450"); break; } - rstartEl( "draw:hatch", rList); - pList->clear(); + rstartEl( "draw:hatch", mxList.get()); + mxList->clear(); rendEl( "draw:hatch"); } } @@ -700,7 +698,7 @@ void HwpReader::makeStyles() { HWPStyle& hwpstyle = hwpfile.GetHWPStyle(); - rstartEl("office:styles", rList); + rstartEl("office:styles", mxList.get()); int i; for (i = 0; i < hwpfile.getFBoxStyleCount(); i++) @@ -714,21 +712,21 @@ void HwpReader::makeStyles() padd("style:name", sXML_CDATA, "Standard"); padd("style:family", sXML_CDATA, "paragraph"); padd("style:class", sXML_CDATA, "text"); - rstartEl("style:style", rList); - pList->clear(); + rstartEl("style:style", mxList.get()); + mxList->clear(); padd("fo:line-height", sXML_CDATA, "160%"); padd("fo:text-align", sXML_CDATA, "justify"); - rstartEl("style:properties", rList); - pList->clear(); - rstartEl("style:tab-stops", rList); + rstartEl("style:properties", mxList.get()); + mxList->clear(); + rstartEl("style:tab-stops", mxList.get()); for( i = 1 ; i < 40 ; i++) { padd("style:position", sXML_CDATA, Double2Str( WTI(1000 * i)) + "inch"); - rstartEl("style:tab-stop", rList); - pList->clear(); + rstartEl("style:tab-stop", mxList.get()); + mxList->clear(); rendEl("style:tab-stop"); } rendEl("style:tab-stops"); @@ -743,15 +741,15 @@ void HwpReader::makeStyles() padd("style:family", sXML_CDATA, "paragraph"); padd("style:parent-style-name", sXML_CDATA, "Standard"); - rstartEl("style:style", rList); + rstartEl("style:style", mxList.get()); - pList->clear(); + mxList->clear(); parseCharShape(hwpstyle.GetCharShape(ii)); parseParaShape(hwpstyle.GetParaShape(ii)); - rstartEl("style:properties", rList); - pList->clear(); + rstartEl("style:properties", mxList.get()); + mxList->clear(); rendEl("style:properties"); rendEl("style:style"); @@ -762,8 +760,8 @@ void HwpReader::makeStyles() padd( "style:family", sXML_CDATA, "paragraph"); padd( "style:parent-style-name", sXML_CDATA, "Standard"); padd( "style:class", sXML_CDATA, "extra"); - rstartEl("style:style", rList); - pList->clear(); + rstartEl("style:style", mxList.get()); + mxList->clear(); rendEl("style:style"); } @@ -772,8 +770,8 @@ void HwpReader::makeStyles() padd( "style:family", sXML_CDATA, "paragraph"); padd( "style:parent-style-name", sXML_CDATA, "Standard"); padd( "style:class", sXML_CDATA, "extra"); - rstartEl("style:style", rList); - pList->clear(); + rstartEl("style:style", mxList.get()); + mxList->clear(); rendEl("style:style"); } @@ -784,8 +782,8 @@ void HwpReader::makeStyles() padd( "style:family", sXML_CDATA, "paragraph"); padd( "style:parent-style-name", sXML_CDATA, "Standard"); padd( "style:class", sXML_CDATA, "html"); - rstartEl( "style:style", rList); - pList->clear(); + rstartEl( "style:style", mxList.get()); + mxList->clear(); padd( "fo:font-size", sXML_CDATA, "6pt"); padd( "fo:margin-top", sXML_CDATA, "0cm"); padd( "fo:margin-bottom", sXML_CDATA, "0cm"); @@ -795,8 +793,8 @@ void HwpReader::makeStyles() padd( "text:number-lines", sXML_CDATA, "false"); padd( "text:line-number", sXML_CDATA, "0"); padd("fo:line-height", sXML_CDATA, "100%"); - rstartEl( "style:properties", rList); - pList->clear(); + rstartEl( "style:properties", mxList.get()); + mxList->clear(); rendEl( "style:properties"); rendEl( "style:style"); } @@ -807,8 +805,8 @@ void HwpReader::makeStyles() padd("text:num-format", sXML_CDATA, "1"); if( hwpinfo.beginfnnum != 1) padd("text:offset", sXML_CDATA, ascii(Int2Str(hwpinfo.beginfnnum -1, "%d", buf))); - rstartEl("text:footnotes-configuration", rList); - pList->clear(); + rstartEl("text:footnotes-configuration", mxList.get()); + mxList->clear(); rendEl("text:footnotes-configuration"); rendEl("office:styles"); @@ -824,7 +822,7 @@ void HwpReader::makeAutoStyles() { int i; - rstartEl("office:automatic-styles", rList); + rstartEl("office:automatic-styles", mxList.get()); for (i = 0; i < hwpfile.getParaShapeCount(); i++) makePStyle(hwpfile.getParaShape(i)); @@ -878,23 +876,23 @@ void HwpReader::makeAutoStyles() ascii(Int2Str(i,"PNPara%d", buf))); padd("style:family", sXML_CDATA, "paragraph"); padd("style:parent-style-name", sXML_CDATA, "Standard"); - rstartEl("style:style", rList); - pList->clear(); + rstartEl("style:style", mxList.get()); + mxList->clear(); if( i == 1 ) padd("fo:text-align", sXML_CDATA, "start"); else if ( i == 2 ) padd("fo:text-align", sXML_CDATA, "center"); else if ( i == 3 ) padd("fo:text-align", sXML_CDATA, "end"); - rstartEl("style:properties", rList); - pList->clear(); + rstartEl("style:properties", mxList.get()); + mxList->clear(); rendEl( "style:properties"); rendEl( "style:style"); padd("style:name", sXML_CDATA, ascii(Int2Str(i,"PNBox%d",buf))); padd("style:family", sXML_CDATA, "graphics"); - rstartEl("style:style", rList); - pList->clear(); + rstartEl("style:style", mxList.get()); + mxList->clear(); padd("fo:margin-top", sXML_CDATA, "0cm"); padd("fo:margin-bottom", sXML_CDATA, "0cm"); @@ -911,8 +909,8 @@ void HwpReader::makeAutoStyles() padd("style:horizontal-rel", sXML_CDATA, "paragraph"); padd("fo:padding", sXML_CDATA, "0cm"); padd("stylefamily", sXML_CDATA, "graphics"); - rstartEl("style:properties", rList); - pList->clear(); + rstartEl("style:properties", mxList.get()); + mxList->clear(); rendEl("style:properties"); rendEl("style:style"); } @@ -951,7 +949,7 @@ struct PageSetting void HwpReader::makeMasterStyles() { - rstartEl("office:master-styles", rList); + rstartEl("office:master-styles", mxList.get()); int i; int nMax = hwpfile.getMaxSettedPage(); @@ -1044,8 +1042,8 @@ void HwpReader::makeMasterStyles() ascii(Int2Str(i+1, "p%d", buf))); padd("draw:style-name", sXML_CDATA, ascii(Int2Str(i, "master%d", buf))); - rstartEl("style:master-page", rList); - pList->clear(); + rstartEl("style:master-page", mxList.get()); + mxList->clear(); if( aSet[i].bIsSet ) /* If you've changed the current setting */ { @@ -1095,17 +1093,17 @@ void HwpReader::makeMasterStyles() } else /* If the previous settings doesn't exist, set to the default settings */ { - rstartEl("style:header", rList); + rstartEl("style:header", mxList.get()); padd("text:style-name", sXML_CDATA, "Standard"); - rstartEl("text:p", rList); - pList->clear(); + rstartEl("text:p", mxList.get()); + mxList->clear(); rendEl("text:p"); rendEl("style:header"); - rstartEl("style:footer", rList); + rstartEl("style:footer", mxList.get()); padd("text:style-name", sXML_CDATA, "Standard"); - rstartEl("text:p", rList); - pList->clear(); + rstartEl("text:p", mxList.get()); + mxList->clear(); rendEl("text:p"); rendEl("style:footer"); @@ -1116,7 +1114,7 @@ void HwpReader::makeMasterStyles() // header if( pPage->header ) { - rstartEl("style:header", rList); + rstartEl("style:header", mxList.get()); if( pPage->pagenumber && pPage->pagenumber->where < 4 ) { d->bInHeader = true; @@ -1129,7 +1127,7 @@ void HwpReader::makeMasterStyles() } if( pPage->header_even ) { - rstartEl("style:header", rList); + rstartEl("style:header", mxList.get()); if( pPage->pagenumber && ( pPage->pagenumber->where < 4 || pPage->pagenumber->where == 7 ) ) { @@ -1146,10 +1144,10 @@ void HwpReader::makeMasterStyles() /* Will be the default. */ else if( pPage->header_odd && !pPage->header_even ) { - rstartEl("style:header", rList); + rstartEl("style:header", mxList.get()); padd("text:style-name", sXML_CDATA, "Standard"); - rstartEl("text:p", rList); - pList->clear(); + rstartEl("text:p", mxList.get()); + mxList->clear(); if( pPage->pagenumber && ( pPage->pagenumber->where < 4 || pPage->pagenumber->where == 7 ) ) { @@ -1164,7 +1162,7 @@ void HwpReader::makeMasterStyles() } if( pPage->header_odd ) { - rstartEl("style:header-left", rList); + rstartEl("style:header-left", mxList.get()); if( pPage->pagenumber && ( pPage->pagenumber->where < 4 || pPage->pagenumber->where == 7 ) ) { @@ -1181,10 +1179,10 @@ void HwpReader::makeMasterStyles() /* Will be the default. */ else if( pPage->header_even && !pPage->header_odd ) { - rstartEl("style:header-left", rList); + rstartEl("style:header-left", mxList.get()); padd("text:style-name", sXML_CDATA, "Standard"); - rstartEl("text:p", rList); - pList->clear(); + rstartEl("text:p", mxList.get()); + mxList->clear(); if( pPage->pagenumber && ( pPage->pagenumber->where < 4 || pPage->pagenumber->where == 7 ) ) { @@ -1199,10 +1197,10 @@ void HwpReader::makeMasterStyles() } if( !pPage->header && !pPage->header_even && !pPage->header_odd ) { - rstartEl("style:header", rList); + rstartEl("style:header", mxList.get()); padd("text:style-name", sXML_CDATA, "Standard"); - rstartEl("text:p", rList); - pList->clear(); + rstartEl("text:p", mxList.get()); + mxList->clear(); if( pPage->pagenumber && (pPage->pagenumber->where < 4 || pPage->pagenumber->where == 7 ) ) { @@ -1216,7 +1214,7 @@ void HwpReader::makeMasterStyles() // footer if( pPage->footer ) { - rstartEl("style:footer", rList); + rstartEl("style:footer", mxList.get()); if( pPage->pagenumber && pPage->pagenumber->where >= 4 && pPage->pagenumber->where != 7 ) { @@ -1230,7 +1228,7 @@ void HwpReader::makeMasterStyles() } if( pPage->footer_even ) { - rstartEl("style:footer", rList); + rstartEl("style:footer", mxList.get()); if( pPage->pagenumber && pPage->pagenumber->where >= 4 && pPage->pagenumber->where != 7 ) { @@ -1247,10 +1245,10 @@ void HwpReader::makeMasterStyles() /* Will be the default. */ else if( pPage->footer_odd && !pPage->footer_even ) { - rstartEl("style:footer", rList); + rstartEl("style:footer", mxList.get()); padd("text:style-name", sXML_CDATA, "Standard"); - rstartEl("text:p", rList); - pList->clear(); + rstartEl("text:p", mxList.get()); + mxList->clear(); if( pPage->pagenumber && pPage->pagenumber->where >= 4 && pPage->pagenumber->where != 7 ) { @@ -1265,7 +1263,7 @@ void HwpReader::makeMasterStyles() } if( pPage->footer_odd ) { - rstartEl("style:footer-left", rList); + rstartEl("style:footer-left", mxList.get()); if( pPage->pagenumber && pPage->pagenumber->where >= 4 && pPage->pagenumber->where != 7 ) { @@ -1282,10 +1280,10 @@ void HwpReader::makeMasterStyles() /* Will be the default. */ else if( pPage->footer_even && !pPage->footer_odd ) { - rstartEl("style:footer-left", rList); + rstartEl("style:footer-left", mxList.get()); padd("text:style-name", sXML_CDATA, "Standard"); - rstartEl("text:p", rList); - pList->clear(); + rstartEl("text:p", mxList.get()); + mxList->clear(); if( pPage->pagenumber && pPage->pagenumber->where >= 4 && pPage->pagenumber->where != 7 ) { @@ -1300,10 +1298,10 @@ void HwpReader::makeMasterStyles() } if( !pPage->footer && !pPage->footer_even && !pPage->footer_odd ) { - rstartEl("style:footer", rList); + rstartEl("style:footer", mxList.get()); padd("text:style-name", sXML_CDATA, "Standard"); - rstartEl("text:p", rList); - pList->clear(); + rstartEl("text:p", mxList.get()); + mxList->clear(); if( pPage->pagenumber && pPage->pagenumber->where >= 4 && pPage->pagenumber->where != 7 ) { @@ -1476,17 +1474,17 @@ void HwpReader::makePStyle(ParaShape * pshape) padd("style:name", sXML_CDATA, ascii(Int2Str(pshape->index, "P%d", buf))); padd("style:family", sXML_CDATA, "paragraph"); - rstartEl("style:style", rList); - pList->clear(); + rstartEl("style:style", mxList.get()); + mxList->clear(); parseParaShape(pshape); parseCharShape(pshape->cshape); - rstartEl("style:properties", rList); - pList->clear(); + rstartEl("style:properties", mxList.get()); + mxList->clear(); if( nscount ) { unsigned char tf = 0; - rstartEl("style:tab-stops",rList); + rstartEl("style:tab-stops",mxList.get()); int tab_margin = pshape->left_margin + pshape->indent; if( tab_margin < 0 ) @@ -1521,8 +1519,8 @@ void HwpReader::makePStyle(ParaShape * pshape) tf = 1; padd("style:leader-char", sXML_CDATA, "."); } - rstartEl( "style:tab-stop", rList); - pList->clear(); + rstartEl( "style:tab-stop", mxList.get()); + mxList->clear(); rendEl( "style:tab-stop" ); if( (pshape->tabs[i].position != 1000 * i ) || tf ) @@ -1548,8 +1546,8 @@ void HwpReader::makePageStyle() for( int i = 0 ; i < pmCount ; i++ ){ padd("style:name", sXML_CDATA, ascii(Int2Str(i + 1, "pm%d", buf))); - rstartEl("style:page-master",rList); - pList->clear(); + rstartEl("style:page-master",mxList.get()); + mxList->clear(); switch( hwpinfo.paper.paper_kind ) @@ -1712,8 +1710,8 @@ void HwpReader::makePageStyle() } } - rstartEl("style:properties",rList); - pList->clear(); + rstartEl("style:properties",mxList.get()); + mxList->clear(); /* background image */ if( hwpinfo.back_info.isset && hwpinfo.back_info.type > 0 ) @@ -1735,11 +1733,11 @@ void HwpReader::makePageStyle() padd("style:repeat", sXML_CDATA, "no-repeat"); padd("style:position", sXML_CDATA, "center"); } - rstartEl("style:background-image",rList); + rstartEl("style:background-image",mxList.get()); if( hwpinfo.back_info.type == 2 ){ - rstartEl("office:binary-data", rList); - pList->clear(); + rstartEl("office:binary-data", mxList.get()); + mxList->clear(); std::shared_ptr<char> pStr(base64_encode_string(reinterpret_cast<unsigned char *>(hwpinfo.back_info.data), hwpinfo.back_info.size ), Free<char>()); rchars(ascii(pStr.get())); rendEl("office:binary-data"); @@ -1752,35 +1750,35 @@ void HwpReader::makePageStyle() rendEl("style:properties"); /* header style */ - rstartEl("style:header-style", rList); + rstartEl("style:header-style", mxList.get()); padd("svg:height", sXML_CDATA, Double2Str(WTI(hwpinfo.paper.header_length)) + "inch"); padd("fo:margin-bottom", sXML_CDATA, "0mm"); - rstartEl("style:properties",rList); - pList->clear(); + rstartEl("style:properties",mxList.get()); + mxList->clear(); rendEl("style:properties"); rendEl("style:header-style"); /* footer style */ - rstartEl("style:footer-style", rList); + rstartEl("style:footer-style", mxList.get()); padd("svg:height", sXML_CDATA, Double2Str(WTI(hwpinfo.paper.footer_length)) + "inch"); padd("fo:margin-top", sXML_CDATA, "0mm"); - rstartEl("style:properties",rList); - pList->clear(); + rstartEl("style:properties",mxList.get()); + mxList->clear(); rendEl("style:properties"); rendEl("style:footer-style"); /* Footnote style, but it fell in the dtd, the specification has been defined. REALKING */ - rstartEl("style:footnote-layout", rList); + rstartEl("style:footnote-layout", mxList.get()); padd("style:distance-before-sep", sXML_CDATA, Double2Str(WTI(hwpinfo.splinetext)) + "inch"); padd("style:distance-after-sep", sXML_CDATA, Double2Str(WTI(hwpinfo.splinefn)) + "inch"); - rstartEl("style:properties",rList); - pList->clear(); + rstartEl("style:properties",mxList.get()); + mxList->clear(); rendEl("style:properties"); if ( hwpinfo.fnlinetype == 2 ) padd("style:width", sXML_CDATA, "15cm"); @@ -1791,8 +1789,8 @@ void HwpReader::makePageStyle() else padd("style:width", sXML_CDATA, "5cm"); - rstartEl("style:footnote-sep",rList); - pList->clear(); + rstartEl("style:footnote-sep",mxList.get()); + mxList->clear(); rendEl("style:footnote-sep"); rendEl("style:footnote-layout"); @@ -1805,8 +1803,8 @@ void HwpReader::makeColumns(ColumnDef *coldef) { if( !coldef ) return; padd("fo:column-count", sXML_CDATA, ascii(Int2Str(coldef->ncols, "%d", buf))); - rstartEl("style:columns",rList); - pList->clear(); + rstartEl("style:columns",mxList.get()); + mxList->clear(); if( coldef->separator != 0 ) { switch( coldef->separator ) @@ -1827,8 +1825,8 @@ void HwpReader::makeColumns(ColumnDef *coldef) padd("style:style", sXML_CDATA, "none"); break; } - rstartEl("style:column-sep",rList); - pList->clear(); + rstartEl("style:column-sep",mxList.get()); + mxList->clear(); rendEl("style:column-sep"); } double spacing = WTI(coldef->spacing)/ 2. ; @@ -1844,8 +1842,8 @@ void HwpReader::makeColumns(ColumnDef *coldef) else padd("fo:margin-right", sXML_CDATA, Double2Str( spacing) + "inch"); - rstartEl("style:column",rList); - pList->clear(); + rstartEl("style:column",mxList.get()); + mxList->clear(); rendEl("style:column"); } rendEl("style:columns"); @@ -1856,11 +1854,11 @@ void HwpReader::makeTStyle(CharShape * cshape) padd("style:name", sXML_CDATA, ascii(Int2Str(cshape->index, "T%d", buf))); padd("style:family", sXML_CDATA, "text"); - rstartEl("style:style", rList); - pList->clear(); + rstartEl("style:style", mxList.get()); + mxList->clear(); parseCharShape(cshape); - rstartEl("style:properties", rList); - pList->clear(); + rstartEl("style:properties", mxList.get()); + mxList->clear(); rendEl("style:properties"); rendEl("style:style"); } @@ -1874,14 +1872,14 @@ void HwpReader::makeTableStyle(Table *tbl) padd("style:name", sXML_CDATA, ascii(Int2Str(hbox->style.boxnum, "Table%d", buf))); padd("style:family", sXML_CDATA,"table"); - rstartEl("style:style", rList); - pList->clear(); + rstartEl("style:style", mxList.get()); + mxList->clear(); padd("style:width", sXML_CDATA, Double2Str(WTMM(hbox->box_xs)) + "mm"); padd("table:align", sXML_CDATA,"left"); padd("fo:keep-with-next", sXML_CDATA,"false"); - rstartEl("style:properties", rList); - pList->clear(); + rstartEl("style:properties", mxList.get()); + mxList->clear(); rendEl("style:properties"); rendEl("style:style"); @@ -1891,12 +1889,12 @@ void HwpReader::makeTableStyle(Table *tbl) sprintf(buf,"Table%d.%c",hbox->style.boxnum, static_cast<char>('A'+i)); padd("style:name", sXML_CDATA, ascii( buf )); padd("style:family", sXML_CDATA,"table-column"); - rstartEl("style:style", rList); - pList->clear(); + rstartEl("style:style", mxList.get()); + mxList->clear(); padd("style:column-width", sXML_CDATA, Double2Str(WTMM(tbl->columns.data[i+1] - tbl->columns.data[i])) + "mm"); - rstartEl("style:properties", rList); - pList->clear(); + rstartEl("style:properties", mxList.get()); + mxList->clear(); rendEl("style:properties"); rendEl("style:style"); } @@ -1907,12 +1905,12 @@ void HwpReader::makeTableStyle(Table *tbl) sprintf(buf,"Table%d.row%" SAL_PRI_SIZET "u",hbox->style.boxnum, i + 1); padd("style:name", sXML_CDATA, ascii( buf )); padd("style:family", sXML_CDATA,"table-row"); - rstartEl("style:style", rList); - pList->clear(); + rstartEl("style:style", mxList.get()); + mxList->clear(); padd("style:row-height", sXML_CDATA, Double2Str(WTMM(tbl->rows.data[i+1] - tbl->rows.data[i])) + "mm"); - rstartEl("style:properties", rList); - pList->clear(); + rstartEl("style:properties", mxList.get()); + mxList->clear(); rendEl("style:properties"); rendEl("style:style"); } @@ -1924,8 +1922,8 @@ void HwpReader::makeTableStyle(Table *tbl) sprintf(buf,"Table%d.%c%d",hbox->style.boxnum, 'A'+ tcell->nColumnIndex, tcell->nRowIndex +1); padd("style:name", sXML_CDATA, ascii( buf )); padd("style:family", sXML_CDATA,"table-cell"); - rstartEl("style:style", rList); - pList->clear(); + rstartEl("style:style", mxList.get()); + mxList->clear(); Cell *cl = tcell->pCell; if( cl->ver_align == 1 ) padd("fo:vertical-align", sXML_CDATA,"middle"); @@ -2012,8 +2010,8 @@ void HwpReader::makeTableStyle(Table *tbl) ascii(hcolor2str(sal::static_int_cast<uchar>(cl->color), sal::static_int_cast<uchar>(cl->shade), buf))); - rstartEl("style:properties", rList); - pList->clear(); + rstartEl("style:properties", mxList.get()); + mxList->clear(); rendEl("style:properties"); rendEl("style:style"); @@ -2029,8 +2027,8 @@ void HwpReader::makeDrawStyle( HWPDrawingObject * hdo, FBoxStyle * fstyle) ascii(Int2Str(hdo->index, "Draw%d", buf))); padd("style:family", sXML_CDATA, "graphics"); - rstartEl("style:style", rList); - pList->clear(); + rstartEl("style:style", mxList.get()); + mxList->clear(); switch (fstyle->txtflow) { @@ -2196,8 +2194,8 @@ void HwpReader::makeDrawStyle( HWPDrawingObject * hdo, FBoxStyle * fstyle) padd("style:vertical-rel", sXML_CDATA, "baseline"); } - rstartEl("style:properties", rList); - pList->clear(); + rstartEl("style:properties", mxList.get()); + mxList->clear(); rendEl("style:properties"); rendEl("style:style"); @@ -2215,8 +2213,8 @@ void HwpReader::makeCaptionStyle(FBoxStyle * fstyle) padd("style:name", sXML_CDATA, ascii(Int2Str(fstyle->boxnum, "CapBox%d", buf))); padd("style:family", sXML_CDATA, "graphics"); - rstartEl("style:style", rList); - pList->clear(); + rstartEl("style:style", mxList.get()); + mxList->clear(); padd("fo:margin-left", sXML_CDATA, "0cm"); padd("fo:margin-right", sXML_CDATA, "0cm"); padd("fo:margin-top", sXML_CDATA, "0cm"); @@ -2283,8 +2281,8 @@ void HwpReader::makeCaptionStyle(FBoxStyle * fstyle) padd("style:horizontal-rel", sXML_CDATA, "page-content"); } } - rstartEl("style:properties", rList); - pList->clear(); + rstartEl("style:properties", mxList.get()); + mxList->clear(); rendEl("style:properties"); rendEl("style:style"); if( fstyle->boxtype == 'G' ) @@ -2299,8 +2297,8 @@ void HwpReader::makeCaptionStyle(FBoxStyle * fstyle) } padd("style:family", sXML_CDATA, "graphics"); - rstartEl("style:style", rList); - pList->clear(); + rstartEl("style:style", mxList.get()); + mxList->clear(); padd("fo:margin-left", sXML_CDATA, "0cm"); padd("fo:margin-right", sXML_CDATA, "0cm"); @@ -2415,8 +2413,8 @@ void HwpReader::makeCaptionStyle(FBoxStyle * fstyle) sal::static_int_cast<uchar>(cell->color), sal::static_int_cast<uchar>(cell->shade), buf))); } - rstartEl("style:properties", rList); - pList->clear(); + rstartEl("style:properties", mxList.get()); + mxList->clear(); rendEl("style:properties"); rendEl("style:style"); } @@ -2456,8 +2454,8 @@ void HwpReader::makeFStyle(FBoxStyle * fstyle) break; } - rstartEl("style:style", rList); - pList->clear(); + rstartEl("style:style", mxList.get()); + mxList->clear(); if ( fstyle->boxtype == 'T') { @@ -2676,8 +2674,8 @@ void HwpReader::makeFStyle(FBoxStyle * fstyle) padd("draw:color-mode", sXML_CDATA, "mono"); } - rstartEl("style:properties", rList); - pList->clear(); + rstartEl("style:properties", mxList.get()); + mxList->clear(); rendEl("style:properties"); rendEl("style:style"); } @@ -2716,8 +2714,8 @@ void HwpReader::make_text_p0(HWPPara * para, bool bParaStart) { padd("text:style-name", sXML_CDATA, ascii(getPStyleName(para->GetParaShape().index, buf))); - rstartEl("text:p", rList); - pList->clear(); + rstartEl("text:p", mxList.get()); + mxList->clear(); } if( d->bFirstPara && d->bInBody ) { @@ -2728,8 +2726,8 @@ void HwpReader::make_text_p0(HWPPara * para, bool bParaStart) // U+C758 HANGUL SYLLABLE YI, U+CC98 HANGUL SYLLABLE CEO, // U+C74C HANGUL SYLLABLE EUM: "Begin of Document" padd("text:name", sXML_CDATA, OUString(buf, strlen(buf), RTL_TEXTENCODING_UTF8)); - rstartEl("text:bookmark", rList); - pList->clear(); + rstartEl("text:bookmark", mxList.get()); + mxList->clear(); rendEl("text:bookmark"); d->bFirstPara = false; } @@ -2740,8 +2738,8 @@ void HwpReader::make_text_p0(HWPPara * para, bool bParaStart) } padd("text:style-name", sXML_CDATA, ascii(getTStyleName(para->cshape.index, buf))); - rstartEl("text:span", rList); - pList->clear(); + rstartEl("text:span", mxList.get()); + mxList->clear(); for (n = 0; n < para->nch && para->hhstr[n]->hh; n += para->hhstr[n]->WSize()) @@ -2749,7 +2747,7 @@ void HwpReader::make_text_p0(HWPPara * para, bool bParaStart) if (para->hhstr[n]->hh == CH_SPACE && !firstspace) { makeChars(str); - rstartEl("text:s", rList); + rstartEl("text:s", mxList.get()); rendEl("text:s"); } else if (para->hhstr[n]->hh == CH_END_PARA) @@ -2791,8 +2789,8 @@ void HwpReader::make_text_p1(HWPPara * para,bool bParaStart) { padd("text:style-name", sXML_CDATA, ascii(getPStyleName(para->GetParaShape().index, buf))); - rstartEl("text:p", rList); - pList->clear(); + rstartEl("text:p", mxList.get()); + mxList->clear(); } if( d->bFirstPara && d->bInBody ) { @@ -2804,8 +2802,8 @@ void HwpReader::make_text_p1(HWPPara * para,bool bParaStart) // U+C758 HANGUL SYLLABLE YI, U+CC98 HANGUL SYLLABLE CEO, // U+C74C HANGUL SYLLABLE EUM: "Begin of Document" padd("text:name", sXML_CDATA, OUString(buf, strlen(buf), RTL_TEXTENCODING_UTF8)); - rstartEl("text:bookmark", rList); - pList->clear(); + rstartEl("text:bookmark", mxList.get()); + mxList->clear(); rendEl("text:bookmark"); d->bFirstPara = false; } @@ -2816,8 +2814,8 @@ void HwpReader::make_text_p1(HWPPara * para,bool bParaStart) } padd("text:style-name", sXML_CDATA, ascii(getTStyleName(curr, buf))); - rstartEl("text:span", rList); - pList->clear(); + rstartEl("text:span", mxList.get()); + mxList->clear(); for (n = 0; n < para->nch && para->hhstr[n]->hh; n += para->hhstr[n]->WSize()) ... etc. - the rest is truncated
_______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
