[Libreoffice-commits] core.git: editeng/source include/editeng sw/source
editeng/source/misc/svxacorr.cxx | 12 include/editeng/svxacorr.hxx |2 +- sw/source/core/edit/edws.cxx |4 3 files changed, 13 insertions(+), 5 deletions(-) New commits: commit 971c9945825db02a4809538d26fff3ae77d16866 Author: Mike Kaganski AuthorDate: Thu May 18 20:06:21 2023 +0300 Commit: Mike Kaganski CommitDate: Fri May 19 07:08:46 2023 +0200 Fix "AddressSanitizer: heap-use-after-free" https://github.com/CollaboraOnline/online/issues/6380 Commit 7481e8b5500e86626be5f8eae1e7f48b7f51e21a (sw_redlinehide_4a: SwEditShell::AutoCorrect() etc., 2018-11-28) explicitly relied upon the reference to the node text being updated on editing operations. Commit 14f6700fefa945c4cf995c09af9326c2a022f886 (use more string_view in editeng, 2022-04-14) converted the argument of FnChgToEnEmDash to a string view, which means that any change in the underlying OUString frees the memory referenced by the view. But in this method, we really don't want to have the text updated; so use a local OUString copy for later reference. Partially revert commit 14f6700fefa945c4cf995c09af9326c2a022f886. And copy mst's commit 7481e8b5500e86626be5f8eae1e7f48b7f51e21a message to document the assumptions in SwEditShell::AutoCorrect. Change-Id: I0ff02958c8de9566d774f366d905aa9bb603055c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151970 Tested-by: Mike Kaganski Reviewed-by: Mike Kaganski diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx index 6b759415b52b..dfb1e6c0d726 100644 --- a/editeng/source/misc/svxacorr.cxx +++ b/editeng/source/misc/svxacorr.cxx @@ -545,7 +545,7 @@ bool SvxAutoCorrect::FnChgOrdinalNumber( // Replace dashes bool SvxAutoCorrect::FnChgToEnEmDash( -SvxAutoCorrDoc& rDoc, std::u16string_view rTxt, +SvxAutoCorrDoc& rDoc, const OUString& rTxt, sal_Int32 nSttPos, sal_Int32 nEndPos, LanguageType eLang ) { @@ -555,6 +555,10 @@ bool SvxAutoCorrect::FnChgToEnEmDash( eLang = GetAppLang().getLanguageType(); bool bAlwaysUseEmDash = (eLang == LANGUAGE_RUSSIAN || eLang == LANGUAGE_UKRAINIAN); +// rTxt may refer to the frame text that will change in the calls to rDoc.Delete / rDoc.Insert; +// keep a local copy for later use +OUString aOrigTxt = rTxt; + // replace " - " or " --" with "enDash" if( 1 < nSttPos && 1 <= nEndPos - nSttPos ) { @@ -631,14 +635,14 @@ bool SvxAutoCorrect::FnChgToEnEmDash( bool bEnDash = (eLang == LANGUAGE_HUNGARIAN || eLang == LANGUAGE_FINNISH); if( 4 <= nEndPos - nSttPos ) { -OUString sTmp( rTxt.substr( nSttPos, nEndPos - nSttPos ) ); +OUString sTmp( aOrigTxt.subView( nSttPos, nEndPos - nSttPos ) ); sal_Int32 nFndPos = sTmp.indexOf("--"); if( nFndPos != -1 && nFndPos && nFndPos + 2 < sTmp.getLength() && ( rCC.isLetterNumeric( sTmp, nFndPos - 1 ) || - lcl_IsInAsciiArr( sImplEndSkipChars, rTxt[ nFndPos - 1 ] )) && + lcl_IsInAsciiArr( sImplEndSkipChars, aOrigTxt[ nFndPos - 1 ] )) && ( rCC.isLetterNumeric( sTmp, nFndPos + 2 ) || -lcl_IsInAsciiArr( sImplSttSkipChars, rTxt[ nFndPos + 2 ] ))) +lcl_IsInAsciiArr( sImplSttSkipChars, aOrigTxt[ nFndPos + 2 ] ))) { nSttPos = nSttPos + nFndPos; rDoc.Delete( nSttPos, nSttPos + 2 ); diff --git a/include/editeng/svxacorr.hxx b/include/editeng/svxacorr.hxx index fcb5f97aca2b..a5e43032a78f 100644 --- a/include/editeng/svxacorr.hxx +++ b/include/editeng/svxacorr.hxx @@ -408,7 +408,7 @@ public: bool FnChgOrdinalNumber( SvxAutoCorrDoc&, const OUString&, sal_Int32 nSttPos, sal_Int32 nEndPos, LanguageType eLang ); -bool FnChgToEnEmDash( SvxAutoCorrDoc&, std::u16string_view, +bool FnChgToEnEmDash( SvxAutoCorrDoc&, const OUString&, sal_Int32 nSttPos, sal_Int32 nEndPos, LanguageType eLang ); bool FnAddNonBrkSpace( SvxAutoCorrDoc&, std::u16string_view, diff --git a/sw/source/core/edit/edws.cxx b/sw/source/core/edit/edws.cxx index abbb920afdc5..4e46ae2daf5a 100644 --- a/sw/source/core/edit/edws.cxx +++ b/sw/source/core/edit/edws.cxx @@ -272,6 +272,10 @@ void SwEditShell::AutoCorrect( SvxAutoCorrect& rACorr, bool bInsert, // something - so first normalize cursor point to end of redline so that // point will then be moved forward when something is inserted. *pCursor->GetPoint() = pFrame->MapViewToModelPos(nPos); +// The hope is that the AutoCorrect never deletes nodes, hence never +// deletes SwTextFrames, hence we can pass in the SwTextFrame::GetText() +// result and it will be
[Libreoffice-commits] core.git: editeng/source include/editeng sw/source
editeng/source/items/textitem.cxx | 25 + include/editeng/colritem.hxx| 26 ++ sw/source/uibase/sidebar/ThemePanel.cxx |2 +- 3 files changed, 28 insertions(+), 25 deletions(-) New commits: commit 6fb682487e355933d79a8ef74560ecf318b4f705 Author: Tomaž Vajngerl AuthorDate: Mon Dec 5 13:59:22 2022 +0900 Commit: Tomaž Vajngerl CommitDate: Sun Dec 25 13:25:25 2022 + editeng: move "tint or shade" variable into SvxThemeColor Change-Id: Ia2094854a8275082cf7444307e17fe5449c43b3a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143698 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/editeng/source/items/textitem.cxx b/editeng/source/items/textitem.cxx index 147fa301d548..30b780f1b855 100644 --- a/editeng/source/items/textitem.cxx +++ b/editeng/source/items/textitem.cxx @@ -1354,9 +1354,10 @@ bool SvxContourItem::GetPresentation } SvxThemeColor::SvxThemeColor() -: maThemeIndex(-1), -mnLumMod(1), -mnLumOff(0) +: maThemeIndex(-1) +, mnLumMod(1) +, mnLumOff(0) +, mnTintOrShade(0) { } @@ -1364,7 +1365,8 @@ bool SvxThemeColor::operator==(const SvxThemeColor& rThemeColor) const { return maThemeIndex == rThemeColor.maThemeIndex && mnLumMod == rThemeColor.mnLumMod && -mnLumOff == rThemeColor.mnLumOff; +mnLumOff == rThemeColor.mnLumOff && +mnTintOrShade == rThemeColor.mnTintOrShade; } void SvxThemeColor::dumpAsXml(xmlTextWriterPtr pWriter) const @@ -1377,6 +1379,8 @@ void SvxThemeColor::dumpAsXml(xmlTextWriterPtr pWriter) const BAD_CAST(OString::number(mnLumMod).getStr())); (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("lum-off"), BAD_CAST(OString::number(mnLumOff).getStr())); +(void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("tint-or-shade"), + BAD_CAST(OString::number(mnTintOrShade).getStr())); (void)xmlTextWriterEndElement(pWriter); } @@ -1384,15 +1388,13 @@ void SvxThemeColor::dumpAsXml(xmlTextWriterPtr pWriter) const // class SvxColorItem SvxColorItem::SvxColorItem( const sal_uInt16 nId ) : SfxPoolItem(nId), -mColor( COL_BLACK ), -maTintShade(0) +mColor( COL_BLACK ) { } SvxColorItem::SvxColorItem( const Color& rCol, const sal_uInt16 nId ) : SfxPoolItem( nId ), -mColor( rCol ), -maTintShade(0) +mColor( rCol ) { } @@ -1406,8 +1408,7 @@ bool SvxColorItem::operator==( const SfxPoolItem& rAttr ) const const SvxColorItem& rColorItem = static_cast(rAttr); return mColor == rColorItem.mColor && - maThemeColor == rColorItem.maThemeColor && - maTintShade == rColorItem.maTintShade; + maThemeColor == rColorItem.maThemeColor; } bool SvxColorItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const @@ -1433,7 +1434,7 @@ bool SvxColorItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const } case MID_COLOR_TINT_OR_SHADE: { -rVal <<= maTintShade; +rVal <<= maThemeColor.GetTintOrShade(); break; } case MID_COLOR_LUM_MOD: @@ -1489,7 +1490,7 @@ bool SvxColorItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) sal_Int16 nTintShade = -1; if (!(rVal >>= nTintShade)) return false; -maTintShade = nTintShade; +maThemeColor.SetTintOrShade(nTintShade); } break; case MID_COLOR_LUM_MOD: diff --git a/include/editeng/colritem.hxx b/include/editeng/colritem.hxx index cbd52844b059..05a7183c8582 100644 --- a/include/editeng/colritem.hxx +++ b/include/editeng/colritem.hxx @@ -34,6 +34,8 @@ class EDITENG_DLLPUBLIC SvxThemeColor /// Luminance Offset: 100th percentage, defaults to 0%. sal_Int16 mnLumOff; +sal_Int16 mnTintOrShade; + public: explicit SvxThemeColor(); bool operator==(const SvxThemeColor& rThemeColor) const; @@ -46,8 +48,8 @@ public: void SetThemeIndex(sal_Int16 nIndex) { maThemeIndex = nIndex; -} +} void SetLumMod(sal_Int16 nLumMod) { mnLumMod = nLumMod; } sal_Int16 GetLumMod() const { return mnLumMod; } @@ -56,6 +58,16 @@ public: sal_Int16 GetLumOff() const { return mnLumOff; } +sal_Int16 GetTintOrShade() const +{ +return mnTintOrShade; +} + +void SetTintOrShade(sal_Int16 nTintOrShade) +{ +mnTintOrShade = nTintOrShade; +} + void dumpAsXml(xmlTextWriterPtr pWriter) const; }; @@ -66,7 +78,7 @@ class EDITENG_DLLPUBLIC SvxColorItem final : public SfxPoolItem private: Color mColor; SvxThemeColor maThemeColor; -sal_Int16 maTintShade; + public: static SfxPoolItem* CreateDefault(); @@ -93,16 +105,6 @@ public:
[Libreoffice-commits] core.git: editeng/source include/editeng sw/source
editeng/source/misc/svxacorr.cxx |2 +- include/editeng/svxacorr.hxx |2 +- sw/source/core/edit/acorrect.cxx |2 +- 3 files changed, 3 insertions(+), 3 deletions(-) New commits: commit d5811039430e5a76643491c68fed75691969afbd Author: Caolán McNamara AuthorDate: Tue Nov 16 14:54:07 2021 + Commit: Caolán McNamara CommitDate: Tue Nov 16 22:14:33 2021 +0100 WrtStt->WrdStt for consistency with the other word start abbrevs Change-Id: I4ec773b5867d804d9c293c4c89cb9be4acb017b8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125315 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx index 6dfe778f2631..16d443dce4b5 100644 --- a/editeng/source/misc/svxacorr.cxx +++ b/editeng/source/misc/svxacorr.cxx @@ -1680,7 +1680,7 @@ bool SvxAutoCorrect::AddCplSttException( const OUString& rNew, } // Adds a single word. The list will immediately be written to the file! -bool SvxAutoCorrect::AddWrtSttException( const OUString& rNew, +bool SvxAutoCorrect::AddWrdSttException( const OUString& rNew, LanguageType eLang ) { SvxAutoCorrectLanguageLists* pLists = nullptr; diff --git a/include/editeng/svxacorr.hxx b/include/editeng/svxacorr.hxx index 4d21049a9d3c..a0d85002d01a 100644 --- a/include/editeng/svxacorr.hxx +++ b/include/editeng/svxacorr.hxx @@ -392,7 +392,7 @@ public: const SvStringsISortDtor* GetWrdSttExceptList( LanguageType eLang ) { return GetLanguageList_( eLang ).GetWrdSttExceptList(); } // Adds a single word. The list will be immediately written to the file! -bool AddWrtSttException( const OUString& rNew, LanguageType eLang); +bool AddWrdSttException( const OUString& rNew, LanguageType eLang); // Search through the Languages for the entry bool FindInWrdSttExceptList( LanguageType eLang, const OUString& sWord ); diff --git a/sw/source/core/edit/acorrect.cxx b/sw/source/core/edit/acorrect.cxx index 1ad211fa4354..d937bf6b1798 100644 --- a/sw/source/core/edit/acorrect.cxx +++ b/sw/source/core/edit/acorrect.cxx @@ -624,7 +624,7 @@ void SwAutoCorrExceptWord::CheckChar( const SwPosition& rPos, sal_Unicode cChr ) // then add to the list: if (ACFlags::CapitalStartWord & m_nFlags) -pACorr->AddWrtSttException(m_sWord, m_eLanguage); +pACorr->AddWrdSttException(m_sWord, m_eLanguage); else if (ACFlags::CapitalStartSentence & m_nFlags) pACorr->AddCplSttException(m_sWord, m_eLanguage); }
[Libreoffice-commits] core.git: editeng/source include/editeng sw/source xmloff/qa
editeng/source/items/textitem.cxx | 48 ++ include/editeng/fontitem.hxx |1 sw/source/filter/xml/xmlfonte.cxx | 18 xmloff/qa/unit/style.cxx | 53 +- 4 files changed, 108 insertions(+), 12 deletions(-) New commits: commit 7a8bb65e1b8dc7fdd7f89c8c546e71e4208da574 Author: Miklos Vajna AuthorDate: Thu Sep 9 13:04:01 2021 +0200 Commit: Miklos Vajna CommitDate: Thu Sep 9 14:27:52 2021 +0200 ODT export: order elements inside This builds on top of commit 92471550b8c43d8ff0cef8b414884d697edf9e63 (ODF export: sort elements based on the style:name attribute, 2021-03-11), the additional problem was that the style:name attribute already has number suffixes to have unique names for fonts where the style name would match. This means that even if we sort the container right before writing the elements, which font gets the number suffix depends on the insert order. Fix this by additionally sorting the font items before insertion, given that a single call-site does all the insertion, at least for Writer documents. This is required as SfxItemPool::GetItemSurrogates() exposes a container which is based on SfxPoolItemArray_Impl, which uses an o3tl::sorted_vector<> of pointers, so effectively unsorted, the order depends on the pointer address of the font items. Change-Id: I46569b40796243f7f95b92870504c2023b2ce943 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121823 Reviewed-by: Miklos Vajna Tested-by: Jenkins diff --git a/editeng/source/items/textitem.cxx b/editeng/source/items/textitem.cxx index 64236dd542f1..22c86e4cabd1 100644 --- a/editeng/source/items/textitem.cxx +++ b/editeng/source/items/textitem.cxx @@ -153,6 +153,24 @@ bool SvxFontListItem::GetPresentation // class SvxFontItem - +namespace +{ +sal_Int32 CompareTo(sal_Int32 nA, sal_Int32 nB) +{ +if (nA < nB) +{ +return -1; +} + +if (nA > nB) +{ +return 1; +} + +return 0; +} +} + SvxFontItem::SvxFontItem( const sal_uInt16 nId ) : SfxPoolItem( nId ) { @@ -290,6 +308,36 @@ bool SvxFontItem::operator==( const SfxPoolItem& rAttr ) const return bRet; } +bool SvxFontItem::operator<(const SfxPoolItem& rCmp) const +{ +const auto& rOther = static_cast(rCmp); +sal_Int32 nRet = GetFamilyName().compareTo(rOther.GetFamilyName()); +if (nRet != 0) +{ +return nRet < 0; +} + +nRet = GetStyleName().compareTo(rOther.GetStyleName()); +if (nRet != 0) +{ +return nRet < 0; +} + +nRet = CompareTo(GetFamily(), rOther.GetFamily()); +if (nRet != 0) +{ +return nRet < 0; +} + +nRet = CompareTo(GetPitch(), rOther.GetPitch()); +if (nRet != 0) +{ +return nRet < 0; +} + +return GetCharSet() < rOther.GetCharSet(); +} + SvxFontItem* SvxFontItem::Clone( SfxItemPool * ) const { return new SvxFontItem( *this ); diff --git a/include/editeng/fontitem.hxx b/include/editeng/fontitem.hxx index 9a73a051f79e..2ccaade20121 100644 --- a/include/editeng/fontitem.hxx +++ b/include/editeng/fontitem.hxx @@ -46,6 +46,7 @@ public: // "pure virtual Methods" from SfxPoolItem virtual bool operator==(const SfxPoolItem& rItem) const override; +bool operator<(const SfxPoolItem& rCmp) const override; virtual SvxFontItem* Clone(SfxItemPool *pPool = nullptr) const override; virtual bool QueryValue(css::uno::Any& rVal, sal_uInt8 nMemberId = 0) const override; virtual bool PutValue(const css::uno::Any& rVal, sal_uInt8 nMemberId) override; diff --git a/sw/source/filter/xml/xmlfonte.cxx b/sw/source/filter/xml/xmlfonte.cxx index ce415aeb41e5..b8c0f7730d57 100644 --- a/sw/source/filter/xml/xmlfonte.cxx +++ b/sw/source/filter/xml/xmlfonte.cxx @@ -46,21 +46,27 @@ SwXMLFontAutoStylePool_Impl::SwXMLFontAutoStylePool_Impl(SwXMLExport& _rExport, RES_CHRATR_CTL_FONT }; const SfxItemPool& rPool = _rExport.getDoc()->GetAttrPool(); +std::vector aFonts; for(sal_uInt16 nWhichId : aWhichIds) { const SvxFontItem& rFont = static_cast(rPool.GetDefaultItem( nWhichId )); -Add( rFont.GetFamilyName(), rFont.GetStyleName(), - rFont.GetFamily(), rFont.GetPitch(), - rFont.GetCharSet() ); +aFonts.push_back(); for (const SfxPoolItem* pItem : rPool.GetItemSurrogates(nWhichId)) { auto pFont = static_cast(pItem); -Add( pFont->GetFamilyName(), pFont->GetStyleName(), - pFont->GetFamily(), pFont->GetPitch(), - pFont->GetCharSet() ); +aFonts.push_back(pFont); } } + +std::sort(aFonts.begin(), aFonts.end(), + [](const SvxFontItem* pA, const SvxFontItem*
[Libreoffice-commits] core.git: editeng/source include/editeng sw/source
editeng/source/editeng/editview.cxx |5 + editeng/source/outliner/outlvw.cxx|5 + include/editeng/editview.hxx |1 + include/editeng/outliner.hxx |1 + sw/source/uibase/docvw/AnnotationWin2.cxx | 12 ++-- 5 files changed, 18 insertions(+), 6 deletions(-) New commits: commit aadfeaff158316af1a868c66fa2fd78fb473c802 Author: Henry Castro AuthorDate: Fri Jan 15 10:14:50 2021 -0400 Commit: Henry Castro CommitDate: Thu Jan 21 12:49:35 2021 +0100 lok: fix incorrect invalidate cursor position When the comment is created and it's shown in the "Writer" application, it creates an initial output area: mpOutlinerView->SetOutputArea( PixelToLogic( tools::Rectangle(0,0,1,1) ) ); Unfortunately, it causes that send to client side cursor position and scroll to the beginning of the document. Change-Id: I13e21c71328b7f05781e7cdeed082d6cc2b9d679 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109371 Tested-by: Jenkins CollaboraOffice Reviewed-by: Jan Holesovsky (cherry picked from commit 4618849a1cbba4e249ee13c3b6412337160a2816) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109732 Tested-by: Jenkins Reviewed-by: Henry Castro diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx index f044671e1c17..901e29e756c6 100644 --- a/editeng/source/editeng/editview.cxx +++ b/editeng/source/editeng/editview.cxx @@ -701,6 +701,11 @@ void EditView::RegisterViewShell(OutlinerViewShell* pViewShell) pImpEditView->RegisterViewShell(pViewShell); } +const OutlinerViewShell* EditView::GetViewShell() +{ +return pImpEditView->GetViewShell(); +} + void EditView::RegisterOtherShell(OutlinerViewShell* pOtherShell) { pImpEditView->RegisterOtherShell(pOtherShell); diff --git a/editeng/source/outliner/outlvw.cxx b/editeng/source/outliner/outlvw.cxx index 8ba3a28c87f0..487431995636 100644 --- a/editeng/source/outliner/outlvw.cxx +++ b/editeng/source/outliner/outlvw.cxx @@ -1382,6 +1382,11 @@ void OutlinerView::RegisterViewShell(OutlinerViewShell* pViewShell) pEditView->RegisterViewShell(pViewShell); } +const OutlinerViewShell* OutlinerView::GetViewShell() +{ +return pEditView->GetViewShell(); +} + Color const & OutlinerView::GetBackgroundColor() const { return pEditView->GetBackgroundColor(); diff --git a/include/editeng/editview.hxx b/include/editeng/editview.hxx index debc7b6efe71..bcf031559bed 100644 --- a/include/editeng/editview.hxx +++ b/include/editeng/editview.hxx @@ -258,6 +258,7 @@ public: /// Informs this edit view about which view shell contains it. void RegisterViewShell(OutlinerViewShell* pViewShell); +const OutlinerViewShell* GetViewShell(); /// Informs this edit view about which other shell listens to it. void RegisterOtherShell(OutlinerViewShell* pOtherShell); diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx index 0ffa5721c203..cfcfe85191d6 100644 --- a/include/editeng/outliner.hxx +++ b/include/editeng/outliner.hxx @@ -258,6 +258,7 @@ public: /// Informs this edit view about which view shell contains it. void RegisterViewShell(OutlinerViewShell* pViewShell); +const OutlinerViewShell* GetViewShell(); SfxItemSet GetAttribs(); diff --git a/sw/source/uibase/docvw/AnnotationWin2.cxx b/sw/source/uibase/docvw/AnnotationWin2.cxx index 3fe30564cc44..9a067038d773 100644 --- a/sw/source/uibase/docvw/AnnotationWin2.cxx +++ b/sw/source/uibase/docvw/AnnotationWin2.cxx @@ -530,12 +530,6 @@ void SwAnnotationWin::InitControls() mpOutlinerView->SetAttribs(DefaultItem()); -if (comphelper::LibreOfficeKit::isActive()) -{ -// If there is a callback already registered, inform the new outliner view about it. -mpOutlinerView->RegisterViewShell(); -} - //create Scrollbars mpVScrollbar = VclPtr::Create(*this, WB_3DLOOK |WB_VSCROLL|WB_DRAG, mrView); mpVScrollbar->EnableNativeWidget(false); @@ -931,6 +925,12 @@ void SwAnnotationWin::DoResize() } mpOutliner->SetPaperSize( PixelToLogic( Size(aWidth,aHeight) ) ) ; + +if (comphelper::LibreOfficeKit::isActive() && !mpOutlinerView->GetViewShell()) +{ +mpOutlinerView->RegisterViewShell(); +} + if (!mpVScrollbar->IsVisible()) { // if we do not have a scrollbar anymore, we want to see the complete text mpOutlinerView->SetVisArea( PixelToLogic( tools::Rectangle(0,0,aWidth,aHeight) ) ); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: editeng/source include/editeng sw/source
editeng/source/editeng/impedit3.cxx |2 +- editeng/source/misc/txtrange.cxx| 28 ++-- include/editeng/txtrange.hxx| 24 +++- sw/source/core/text/txtfly.cxx |2 +- 4 files changed, 27 insertions(+), 29 deletions(-) New commits: commit f6a1859704bf7f29d6cb55e37ac82affba9da1e5 Author: Noel Grandin AuthorDate: Sun Apr 12 13:22:20 2020 +0200 Commit: Noel Grandin CommitDate: Sun Apr 12 14:55:42 2020 +0200 small cleanups in TextRanger - no need for mpPolyPolygon to be allocated out of line. - expand out LongDqPtr typedef, not much longer and makes the code easier to read - allocate mpBound inline using std::optional - rename RangeCache to RangeCacheItem Change-Id: I55032a31eaefa844059edb5f0ee599f1b813ac80 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92079 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index 05ab3ccf6823..b9a33ceec64d 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -809,7 +809,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) long nTmpWidth = 0; long nXWidth = nMaxLineWidth; -LongDqPtr pTextRanges = nullptr; +std::deque* pTextRanges = nullptr; long nTextExtraYOffset = 0; long nTextXOffset = 0; long nTextLineHeight = 0; diff --git a/editeng/source/misc/txtrange.cxx b/editeng/source/misc/txtrange.cxx index cc4417498721..42d674c42780 100644 --- a/editeng/source/misc/txtrange.cxx +++ b/editeng/source/misc/txtrange.cxx @@ -31,6 +31,7 @@ TextRanger::TextRanger( const basegfx::B2DPolyPolygon& rPolyPolygon, const basegfx::B2DPolyPolygon* pLinePolyPolygon, sal_uInt16 nCacheSz, sal_uInt16 nLft, sal_uInt16 nRght, bool bSimpl, bool bInnr, bool bVert ) : +maPolyPolygon( rPolyPolygon.count() ), nCacheSize( nCacheSz ), nRight( nRght ), nLeft( nLft ), @@ -42,13 +43,12 @@ TextRanger::TextRanger( const basegfx::B2DPolyPolygon& rPolyPolygon, bVertical( bVert ) { sal_uInt32 nCount(rPolyPolygon.count()); -mpPolyPolygon.reset( new tools::PolyPolygon( static_cast(nCount) ) ); for(sal_uInt32 i(0); i < nCount; i++) { const basegfx::B2DPolygon aCandidate(rPolyPolygon.getB2DPolygon(i).getDefaultAdaptiveSubdivision()); nPointCount += aCandidate.count(); -mpPolyPolygon->Insert( tools::Polygon(aCandidate), static_cast(i) ); +maPolyPolygon.Insert( tools::Polygon(aCandidate), static_cast(i) ); } if( pLinePolyPolygon ) @@ -93,7 +93,7 @@ namespace { class SvxBoundArgs { std::vector aBoolArr; -LongDqPtr pLongArr; +std::deque* pLongArr; TextRanger *pTextRanger; long nMin; long nMax; @@ -126,7 +126,7 @@ class SvxBoundArgs long A( const Point& rP ) const { return bRotate ? rP.Y() : rP.X(); } long B( const Point& rP ) const { return bRotate ? rP.X() : rP.Y(); } public: -SvxBoundArgs( TextRanger* pRanger, LongDqPtr pLong, const Range& rRange ); +SvxBoundArgs( TextRanger* pRanger, std::deque* pLong, const Range& rRange ); void NotePoint( const long nA ) { NoteMargin( nA - nStart, nA + nEnd ); } void NoteMargin( const long nL, const long nR ) { if( nMin > nL ) nMin = nL; if( nMax < nR ) nMax = nR; } @@ -142,7 +142,7 @@ public: } -SvxBoundArgs::SvxBoundArgs( TextRanger* pRanger, LongDqPtr pLong, +SvxBoundArgs::SvxBoundArgs( TextRanger* pRanger, std::deque* pLong, const Range& rRange ) : pLongArr(pLong) , pTextRanger(pRanger) @@ -489,7 +489,7 @@ void SvxBoundArgs::Concat( const tools::PolyPolygon* pPoly ) { SetConcat( true ); DBG_ASSERT( pPoly, "Nothing to do?" ); -LongDqPtr pOld = pLongArr; +std::deque* pOld = pLongArr; pLongArr = new std::deque; aBoolArr.clear(); bInner = false; @@ -631,7 +631,7 @@ void SvxBoundArgs::NoteUpLow( long nA, const sal_uInt8 nArea ) } } -LongDqPtr TextRanger::GetTextRanges( const Range& rRange ) +std::deque* TextRanger::GetTextRanges( const Range& rRange ) { DBG_ASSERT( rRange.Min() || rRange.Max(), "Zero-Range not allowed, Bye Bye" ); //Can we find the result we need in the cache? @@ -641,23 +641,23 @@ LongDqPtr TextRanger::GetTextRanges( const Range& rRange ) return &(elem.results); } //Calculate a new result -RangeCache rngCache(rRange); +RangeCacheItem rngCache(rRange); SvxBoundArgs aArg( this, &(rngCache.results), rRange ); -aArg.Calc( *mpPolyPolygon ); +aArg.Calc( maPolyPolygon ); if( mpLinePolyPolygon ) aArg.Concat( mpLinePolyPolygon.get() ); //Add new result to the cache -mRangeCache.push_back(rngCache); +mRangeCache.push_back(std::move(rngCache)); if
[Libreoffice-commits] core.git: editeng/source include/editeng sw/source
editeng/source/items/numitem.cxx |7 +++ include/editeng/numitem.hxx |5 + sw/source/core/doc/number.cxx| 11 +++ 3 files changed, 23 insertions(+) New commits: commit f807c8bbbc041a7896838fc213d30f2f30768b4a Author: Miklos Vajna AuthorDate: Mon Mar 2 11:45:37 2020 +0100 Commit: Miklos Vajna CommitDate: Tue Mar 3 07:57:40 2020 +0100 sw doc model xml dump: show numbering type Change-Id: I6d2145469b8153c86294c40e1b3dfcc9d65ced60 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89819 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/editeng/source/items/numitem.cxx b/editeng/source/items/numitem.cxx index 67b4dcadafd9..00af4303064a 100644 --- a/editeng/source/items/numitem.cxx +++ b/editeng/source/items/numitem.cxx @@ -152,6 +152,13 @@ OUString SvxNumberType::GetNumStr( sal_Int32 nNo, const css::lang::Locale& rLoca return OUString(); } +void SvxNumberType::dumpAsXml( xmlTextWriterPtr pWriter ) const +{ +xmlTextWriterStartElement(pWriter, BAD_CAST("SvxNumberType")); +xmlTextWriterWriteAttribute(pWriter, BAD_CAST("NumType"), BAD_CAST(OString::number(nNumType).getStr())); +xmlTextWriterEndElement(pWriter); +} + SvxNumberFormat::SvxNumberFormat( SvxNumType eType ) : SvxNumberType(eType), eNumAdjust(SvxAdjust::Left), diff --git a/include/editeng/numitem.hxx b/include/editeng/numitem.hxx index 399250c9c13a..e70281c7b0a1 100644 --- a/include/editeng/numitem.hxx +++ b/include/editeng/numitem.hxx @@ -52,6 +52,9 @@ namespace com::sun::star::lang { struct Locale; } #define LINK_TOKEN 0x80 //indicate linked bitmaps - for use in dialog only + +typedef struct _xmlTextWriter* xmlTextWriterPtr; + class EDITENG_DLLPUBLIC SvxNumberType { static sal_Int32 nRefCount; @@ -81,6 +84,8 @@ public: css::style::NumberingType::CHAR_SPECIAL != nNumType && css::style::NumberingType::BITMAP != nNumType; } + +void dumpAsXml(xmlTextWriterPtr w) const; }; class EDITENG_DLLPUBLIC SvxNumberFormat : public SvxNumberType diff --git a/sw/source/core/doc/number.cxx b/sw/source/core/doc/number.cxx index 0db3e7820bc3..26540353ddba 100644 --- a/sw/source/core/doc/number.cxx +++ b/sw/source/core/doc/number.cxx @@ -1029,6 +1029,17 @@ void SwNumRule::dumpAsXml(xmlTextWriterPtr pWriter) const xmlTextWriterWriteAttribute(pWriter, BAD_CAST("msName"), BAD_CAST(msName.toUtf8().getStr())); xmlTextWriterWriteAttribute(pWriter, BAD_CAST("mnPoolFormatId"), BAD_CAST(OString::number(mnPoolFormatId).getStr())); xmlTextWriterWriteAttribute(pWriter, BAD_CAST("mbAutoRuleFlag"), BAD_CAST(OString::boolean(mbAutoRuleFlag).getStr())); + +for (const auto& pFormat : maFormats) +{ +if (!pFormat) +{ +continue; +} + +pFormat->dumpAsXml(pWriter); +} + xmlTextWriterEndElement(pWriter); } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: editeng/source include/editeng sw/source
editeng/source/outliner/outlvw.cxx | 12 editeng/source/uno/unoviwou.cxx |2 +- include/editeng/outliner.hxx|2 +- sw/source/uibase/shells/annotsh.cxx |2 +- 4 files changed, 11 insertions(+), 7 deletions(-) New commits: commit a201c5c8c3e7ea14001b5634f330dbce2b1f4314 Author: Maxim Monastirsky AuthorDate: Sun Sep 2 14:00:50 2018 +0300 Commit: Maxim Monastirsky CommitDate: Sun Sep 2 15:34:17 2018 +0200 tdf#112935 Paste as Unformatted doesn't work in shapes and comments The shapes and comments code in sw and sc assumes that OutlinerView::Paste does paste as unformatted text, and OutlinerView::PasteSpecial does paste as formatted, similar to the corresponding methods of EditView, which it's supposed to call internally. But the reality is that OutlinerView::Paste just calls PasteSpecial, with a comment "HACK(SD does not call PasteSpecial)". All this situation goes back to "initial import" commits. This commit changes OutlinerView::Paste to paste as unformatted (by default). Call sites that were using it, but apparently wanted formatted output, were changed to an explicit PasteSpecial call. Change-Id: I1d7472039fb9fe09810260a199e216ec95765b10 Reviewed-on: https://gerrit.libreoffice.org/59904 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/editeng/source/outliner/outlvw.cxx b/editeng/source/outliner/outlvw.cxx index b51cfb40..f86f707c4c35 100644 --- a/editeng/source/outliner/outlvw.cxx +++ b/editeng/source/outliner/outlvw.cxx @@ -669,12 +669,12 @@ void OutlinerView::Cut() } } -void OutlinerView::Paste() +void OutlinerView::PasteSpecial() { -PasteSpecial(); // HACK(SD does not call PasteSpecial) +Paste( true ); } -void OutlinerView::PasteSpecial() +void OutlinerView::Paste( bool bUseSpecial ) { if ( !ImpCalcSelectedPages( false ) || pOwner->ImpCanDeleteSelectedPages( this ) ) { @@ -682,7 +682,11 @@ void OutlinerView::PasteSpecial() pOwner->pEditEngine->SetUpdateMode( false ); pOwner->bPasting = true; -pEditView->PasteSpecial(); + +if ( bUseSpecial ) +pEditView->PasteSpecial(); +else +pEditView->Paste(); if ( pOwner->ImplGetOutlinerMode() == OutlinerMode::OutlineObject ) { diff --git a/editeng/source/uno/unoviwou.cxx b/editeng/source/uno/unoviwou.cxx index ca404db7b0b1..4da65606f8fe 100644 --- a/editeng/source/uno/unoviwou.cxx +++ b/editeng/source/uno/unoviwou.cxx @@ -150,7 +150,7 @@ bool SvxDrawOutlinerViewForwarder::Cut() bool SvxDrawOutlinerViewForwarder::Paste() { -mrOutlinerView.Paste(); +mrOutlinerView.PasteSpecial(); return true; } diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx index e4258582af2a..b6308599cfe3 100644 --- a/include/editeng/outliner.hxx +++ b/include/editeng/outliner.hxx @@ -274,7 +274,7 @@ public: voidCut(); voidCopy(); -voidPaste(); +voidPaste( bool bUseSpecial = false ); voidPasteSpecial(); const SfxStyleSheet* GetStyleSheet() const; diff --git a/sw/source/uibase/shells/annotsh.cxx b/sw/source/uibase/shells/annotsh.cxx index 021d23f62971..19a513387e3f 100644 --- a/sw/source/uibase/shells/annotsh.cxx +++ b/sw/source/uibase/shells/annotsh.cxx @@ -904,7 +904,7 @@ void SwAnnotationShell::ExecClpbrd(SfxRequest const ) break; case SID_PASTE: if (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()!=SwPostItHelper::DELETED) -pOLV->Paste(); +pOLV->PasteSpecial(); break; case SID_PASTE_SPECIAL: { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: editeng/source include/editeng sw/source
editeng/source/items/itemtype.cxx |5 - include/editeng/itemtype.hxx|1 - sw/source/uibase/utlui/attrdesc.cxx |9 + sw/source/uibase/utlui/uiitems.cxx |4 +++- 4 files changed, 8 insertions(+), 11 deletions(-) New commits: commit ef7f8c263fcb2bac596aa0247f1e54ff375c3146 Author: Gabor KelemenDate: Thu Apr 19 00:12:33 2018 +0200 Drop GetSvxString l10n wrapper from editeng This was a wrapper above the usual EditResId call without any added value. Change-Id: I685788e23ca24eca8f023d796f181178d3a6273b Reviewed-on: https://gerrit.libreoffice.org/53133 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/editeng/source/items/itemtype.cxx b/editeng/source/items/itemtype.cxx index 1fd3d600933b..78b31841869a 100644 --- a/editeng/source/items/itemtype.cxx +++ b/editeng/source/items/itemtype.cxx @@ -134,11 +134,6 @@ OUString GetMetricText( long nVal, MapUnit eSrcUnit, MapUnit eDestUnit, const In return sRet.makeStringAndClear(); } -OUString GetSvxString(const char* pId) -{ -return EditResId(pId); -} - OUString GetColorString( const Color& rCol ) { if (rCol == COL_AUTO) diff --git a/include/editeng/itemtype.hxx b/include/editeng/itemtype.hxx index 586e29a6361c..25525490ca69 100644 --- a/include/editeng/itemtype.hxx +++ b/include/editeng/itemtype.hxx @@ -31,7 +31,6 @@ class IntlWrapper; static const sal_Unicode cpDelim[] = { ',' , ' ', '\0' }; -EDITENG_DLLPUBLIC OUString GetSvxString(const char* pId); EDITENG_DLLPUBLIC OUString GetMetricText( long nVal, MapUnit eSrcUnit, MapUnit eDestUnit, const IntlWrapper * pIntl ); OUString GetColorString( const Color& rCol ); EDITENG_DLLPUBLIC const char* GetMetricId(MapUnit eUnit); diff --git a/sw/source/uibase/utlui/attrdesc.cxx b/sw/source/uibase/utlui/attrdesc.cxx index a329e5a280fd..2295146d2db2 100644 --- a/sw/source/uibase/utlui/attrdesc.cxx +++ b/sw/source/uibase/utlui/attrdesc.cxx @@ -24,6 +24,7 @@ #include #include +#include #include #include #include @@ -236,7 +237,7 @@ bool SwFormatFrameSize::GetPresentation else { rText = rText + ::GetMetricText( GetWidth(), eCoreUnit, ePresUnit, ) + -" " + ::GetSvxString( ::GetMetricId( ePresUnit ) ); +" " + ::EditResId( ::GetMetricId( ePresUnit ) ); } if ( ATT_VAR_SIZE != GetHeightSizeType() ) { @@ -251,7 +252,7 @@ bool SwFormatFrameSize::GetPresentation else { rText = ::GetMetricText( GetHeight(), eCoreUnit, ePresUnit, ) + -" " + ::GetSvxString( ::GetMetricId( ePresUnit ) ); +" " + EditResId( ::GetMetricId( ePresUnit ) ); } } return true; @@ -351,7 +352,7 @@ bool SwFormatVertOrient::GetPresentation { rText = rText + SwResId( STR_POS_Y ) + " " + ::GetMetricText( GetPos(), eCoreUnit, ePresUnit, ) + -" " + ::GetSvxString( ::GetMetricId( ePresUnit ) ); +" " + EditResId( ::GetMetricId( ePresUnit ) ); } break; case text::VertOrientation::TOP: @@ -397,7 +398,7 @@ bool SwFormatHoriOrient::GetPresentation { rText = rText + SwResId( STR_POS_X ) + " " + ::GetMetricText( GetPos(), eCoreUnit, ePresUnit, ) + -" " + ::GetSvxString( ::GetMetricId( ePresUnit ) ); +" " + EditResId( ::GetMetricId( ePresUnit ) ); } break; case text::HoriOrientation::RIGHT: diff --git a/sw/source/uibase/utlui/uiitems.cxx b/sw/source/uibase/utlui/uiitems.cxx index 1e370d9d26be..8c7c515796af 100644 --- a/sw/source/uibase/utlui/uiitems.cxx +++ b/sw/source/uibase/utlui/uiitems.cxx @@ -28,6 +28,8 @@ #include #include +#include + using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -66,7 +68,7 @@ bool SwPageFootnoteInfoItem::GetPresentation { rText = SwResId( STR_MAX_FTN_HEIGHT ) + " " + ::GetMetricText( nHght, eCoreUnit, ePresUnit, ) + " " + -::GetSvxString( ::GetMetricId( ePresUnit ) ); +EditResId( ::GetMetricId( ePresUnit ) ); } return true; } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: editeng/source include/editeng sw/source
editeng/source/items/frmitems.cxx | 20 ++-- include/editeng/brushitem.hxx |2 -- sw/source/core/layout/paintfrm.cxx |7 --- 3 files changed, 6 insertions(+), 23 deletions(-) New commits: commit bc09385ce297219f1976a9ca41a0b30902b9326d Author: Caolán McNamaraDate: Fri Nov 11 11:23:17 2016 + the pStream member makes no sense at all maybe the PurgeMedia call in sw was meant to be a PurgeGraphic call originally (PurgeGraphic since removed by... commit a22ac2c218870033822120bf0b0d6cfde6ce799f Author: Caolán McNamara Date: Thu Jul 14 22:06:29 2011 +0100 callcatcher: remove unused methods) PurgeMedia releasing the stream makes no difference to the only place its used which is SvxBrushItem::GetGraphicObject which makes a new one every time anyway. the SvxBrushItem assignment operator doesn't change the stream member of the pImpl which looks utterly nuts, so its a good thing the stream is not reused Change-Id: Ie0dee22a6640a6916908fcddbc3541ba85034217 diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx index a6618ea..c71b754 100644 --- a/editeng/source/items/frmitems.cxx +++ b/editeng/source/items/frmitems.cxx @@ -3267,8 +3267,6 @@ public: std::unique_ptr xGraphicObject; sal_Int8nGraphicTransparency; //contains a percentage value which is //copied to the GraphicObject when necessary -std::unique_ptr xStream; - explicit SvxBrushItem_Impl(GraphicObject* p) : xGraphicObject(p) , nGraphicTransparency(0) @@ -3838,11 +3836,6 @@ SvStream& SvxBrushItem::Store( SvStream& rStream , sal_uInt16 /*nItemVersion*/ ) return rStream; } -void SvxBrushItem::PurgeMedium() const -{ -pImpl->xStream.reset(); -} - const GraphicObject* SvxBrushItem::GetGraphicObject(OUString const & referer) const { if (bLoadAgain && !maStrLink.isEmpty() && !pImpl->xGraphicObject) @@ -3857,12 +3850,11 @@ const GraphicObject* SvxBrushItem::GetGraphicObject(OUString const & referer) co bool bGraphicLoaded = false; // try to create stream directly from given URL -pImpl->xStream.reset(utl::UcbStreamHelper::CreateStream(maStrLink, StreamMode::STD_READ)); - +std::unique_ptr xStream(utl::UcbStreamHelper::CreateStream(maStrLink, StreamMode::STD_READ)); // tdf#94088 if we have a stream, try to load it directly as graphic -if (pImpl->xStream && !pImpl->xStream->GetError()) +if (xStream && !xStream->GetError()) { -if (GRFILTER_OK == GraphicFilter::GetGraphicFilter().ImportGraphic(aGraphic, maStrLink, *pImpl->xStream, +if (GRFILTER_OK == GraphicFilter::GetGraphicFilter().ImportGraphic(aGraphic, maStrLink, *xStream, GRFILTER_FORMAT_DONTKNOW, nullptr, GraphicFilterImportFlags::DontSetLogsizeForJpeg)) { bGraphicLoaded = true; @@ -3877,10 +3869,10 @@ const GraphicObject* SvxBrushItem::GetGraphicObject(OUString const & referer) co if( INetProtocol::Data == aGraphicURL.GetProtocol() ) { -std::unique_ptr const xStream(aGraphicURL.getData()); -if (xStream) +std::unique_ptr const xMemStream(aGraphicURL.getData()); +if (xMemStream) { -if (GRFILTER_OK == GraphicFilter::GetGraphicFilter().ImportGraphic(aGraphic, "", *xStream)) +if (GRFILTER_OK == GraphicFilter::GetGraphicFilter().ImportGraphic(aGraphic, "", *xMemStream)) { bGraphicLoaded = true; diff --git a/include/editeng/brushitem.hxx b/include/editeng/brushitem.hxx index cbdb89c..1535909 100644 --- a/include/editeng/brushitem.hxx +++ b/include/editeng/brushitem.hxx @@ -97,8 +97,6 @@ public: SvxGraphicPosition GetGraphicPos() const { return eGraphicPos; } -voidPurgeMedium() const; - sal_Int32 GetShadingValue() const { return nShadingValue; } const Graphic* GetGraphic(OUString const & referer = OUString()/*TODO*/) const; const GraphicObject*GetGraphicObject(OUString const & referer = OUString()/*TODO*/) const; diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index ea91cec..ba8fdc9 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -1980,13 +1980,6 @@ void DrawGraphic( { if( rSh.GetViewOptions()->IsGraphic() ) { -// load graphic directly in PDF import -// #i68953# - also during print load graphic directly. -if ( (rSh).GetViewOptions()->IsPDFExport() || - rSh.GetOut()->GetOutDevType() == OUTDEV_PRINTER ) -{ -
[Libreoffice-commits] core.git: editeng/source include/editeng sw/source
editeng/source/items/frmitems.cxx | 27 +++ include/editeng/boxitem.hxx |1 + sw/source/filter/ww8/ww8graf.cxx | 24 sw/source/filter/ww8/ww8par2.cxx | 12 +--- 4 files changed, 33 insertions(+), 31 deletions(-) New commits: commit a5f8c5f9338e140c8ec3198228917a8a1a54dc35 Author: Justin LuthDate: Sat Nov 5 15:40:29 2016 +0300 make a useful function - SvxBoxItem::CalcLineWidth It saves lots of extra code: no separately checking if a line exists, and then getting the width. Closely matches the existing CalcLineSpace. sc/source/ui/view/printfun.cxx is another place that could use this heavily to replace their lcl_LineTotal function. Perhaps something good for an easyHack. (Wait until LO5.4, since much of the logic should use CalcLineSpace(,true) instead, and that function probably will have the default bEvenIfNoLine changed to true. Compiler doesn't like providing "true" when the default value is also "true".) Change-Id: I298d057b2bf04959434736f6ab2666d2de4222f9 Reviewed-on: https://gerrit.libreoffice.org/30589 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx index ffd0caf..7de28e3 100644 --- a/editeng/source/items/frmitems.cxx +++ b/editeng/source/items/frmitems.cxx @@ -2420,6 +2420,33 @@ void SvxBoxItem::SetDistance( sal_uInt16 nNew, SvxBoxItemLine nLine ) } } +sal_uInt16 SvxBoxItem::CalcLineWidth( SvxBoxItemLine nLine ) const +{ +SvxBorderLine* pTmp = nullptr; +sal_uInt16 nWidth = 0; +switch ( nLine ) +{ +case SvxBoxItemLine::TOP: +pTmp = pTop; +break; +case SvxBoxItemLine::BOTTOM: +pTmp = pBottom; +break; +case SvxBoxItemLine::LEFT: +pTmp = pLeft; +break; +case SvxBoxItemLine::RIGHT: +pTmp = pRight; +break; +default: +OSL_FAIL( "wrong line" ); +} + +if( pTmp ) +nWidth = pTmp->GetScaledWidth(); + +return nWidth; +} sal_uInt16 SvxBoxItem::CalcLineSpace( SvxBoxItemLine nLine, bool bEvenIfNoLine ) const { diff --git a/include/editeng/boxitem.hxx b/include/editeng/boxitem.hxx index 00227a4..a63d4a1 100644 --- a/include/editeng/boxitem.hxx +++ b/include/editeng/boxitem.hxx @@ -110,6 +110,7 @@ public: // Line width plus Space plus inward distance // bEvenIfNoLine = TRUE -> Also return distance, when no Line is set +sal_uInt16 CalcLineWidth( SvxBoxItemLine nLine ) const; sal_uInt16 CalcLineSpace( SvxBoxItemLine nLine, bool bEvenIfNoLine = false ) const; bool HasBorder( bool bTreatPaddingAsBorder = false ) const; static css::table::BorderLine2 SvxLineToLine( const editeng::SvxBorderLine* pLine, bool bConvert ); diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx index b20d5e2..35059e4 100644 --- a/sw/source/filter/ww8/ww8graf.cxx +++ b/sw/source/filter/ww8/ww8graf.cxx @@ -1678,26 +1678,10 @@ void SwWW8ImplReader::MatchSdrItemsIntoFlySet( SdrObject* pSdrObj, rInnerDist.Right()+=nLineThick; rInnerDist.Bottom()+=nLineThick; -const SvxBorderLine *pLine; -if (nullptr != (pLine = aBox.GetLine(SvxBoxItemLine::LEFT))) -{ -rInnerDist.Left() -= (pLine->GetScaledWidth()); -} - -if (nullptr != (pLine = aBox.GetLine(SvxBoxItemLine::TOP))) -{ -rInnerDist.Top() -= (pLine->GetScaledWidth()); -} - -if (nullptr != (pLine = aBox.GetLine(SvxBoxItemLine::RIGHT))) -{ -rInnerDist.Right() -= (pLine->GetScaledWidth()); -} - -if (nullptr != (pLine = aBox.GetLine(SvxBoxItemLine::BOTTOM))) -{ -rInnerDist.Bottom() -= (pLine->GetScaledWidth()); -} +rInnerDist.Left() -= aBox.CalcLineWidth( SvxBoxItemLine::LEFT ); +rInnerDist.Top()-= aBox.CalcLineWidth( SvxBoxItemLine::TOP ); +rInnerDist.Right() -= aBox.CalcLineWidth( SvxBoxItemLine::RIGHT ); +rInnerDist.Bottom() -= aBox.CalcLineWidth( SvxBoxItemLine::BOTTOM ); // set distances from box's border to text contained within the box if( 0 < rInnerDist.Left() ) diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx index 0f9f245..d737553 100644 --- a/sw/source/filter/ww8/ww8par2.cxx +++ b/sw/source/filter/ww8/ww8par2.cxx @@ -3231,21 +3231,11 @@ void WW8TabDesc::AdjustNewBand() // we have to mimic this in the filter by picking the larger of the // sides and using that one on one side of the line (right) SvxBoxItem aCurrentBox(sw::util::ItemGet(*(pBox->GetFrameFormat()), RES_BOX)); -const ::editeng::SvxBorderLine *pLeftLine = aCurrentBox.GetLine(SvxBoxItemLine::LEFT); -int nCurrentRightLineWidth = 0; -if(pLeftLine) -nCurrentRightLineWidth = pLeftLine->GetScaledWidth(); - if (i != 0)
[Libreoffice-commits] core.git: editeng/source include/editeng sw/source
editeng/source/items/frmitems.cxx | 12 ++-- include/editeng/boxitem.hxx |5 +++-- sw/source/core/doc/notxtfrm.cxx | 16 ++-- 3 files changed, 27 insertions(+), 6 deletions(-) New commits: commit d034f273cb24ebe4fde20ad9089ac11cccf316d0 Author: Justin LuthDate: Sat Nov 5 11:11:29 2016 +0300 tdf#90070 don't clip flys with borders regression from commit e598ab04476a32a08f18e8f0662fafa5f78f1a4a very aggressively forced a new frame size via compat setting CLIPPED_PICTURES on any fly - not just images. This only affects MS-format documents, EXCEPT that it is a document property, so if the file every spent any part of it's life in MS-format, it will always retain that compatibility setting. That explains why the problem was intermittent for me - and was hard to reproduce in a clean document, even though I'd seen it in .ODTs. bIgnoreLine (ignore the fact that there is no visible line) was a confusing word choice for "if there is no line, then return a spacing size of zero". bEvenIfNoLine=false is better. Change-Id: I50a3bdef3a67339ae517ee6319920651bc56f9be Reviewed-on: https://gerrit.libreoffice.org/30585 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx index 7a51ddc..ffd0caf 100644 --- a/editeng/source/items/frmitems.cxx +++ b/editeng/source/items/frmitems.cxx @@ -2421,7 +2421,7 @@ void SvxBoxItem::SetDistance( sal_uInt16 nNew, SvxBoxItemLine nLine ) } -sal_uInt16 SvxBoxItem::CalcLineSpace( SvxBoxItemLine nLine, bool bIgnoreLine ) const +sal_uInt16 SvxBoxItem::CalcLineSpace( SvxBoxItemLine nLine, bool bEvenIfNoLine ) const { SvxBorderLine* pTmp = nullptr; sal_uInt16 nDist = 0; @@ -2451,11 +2451,19 @@ sal_uInt16 SvxBoxItem::CalcLineSpace( SvxBoxItemLine nLine, bool bIgnoreLine ) c { nDist = nDist + pTmp->GetScaledWidth(); } -else if( !bIgnoreLine ) +else if( !bEvenIfNoLine ) nDist = 0; return nDist; } +bool SvxBoxItem::HasBorder( bool bTreatPaddingAsBorder ) const +{ +return CalcLineSpace( SvxBoxItemLine::BOTTOM, bTreatPaddingAsBorder ) +|| CalcLineSpace( SvxBoxItemLine::RIGHT, bTreatPaddingAsBorder ) +|| CalcLineSpace( SvxBoxItemLine::TOP, bTreatPaddingAsBorder ) +|| CalcLineSpace( SvxBoxItemLine::LEFT, bTreatPaddingAsBorder ); +} + // class SvxBoxInfoItem -- SvxBoxInfoItem::SvxBoxInfoItem( const sal_uInt16 nId ) : diff --git a/include/editeng/boxitem.hxx b/include/editeng/boxitem.hxx index 11d055f..00227a4 100644 --- a/include/editeng/boxitem.hxx +++ b/include/editeng/boxitem.hxx @@ -109,8 +109,9 @@ public: void SetRemoveAdjacentCellBorder( bool bSet ) { bRemoveAdjCellBorder = bSet; } // Line width plus Space plus inward distance -// bIgnoreLine = TRUE -> Also return distance, when no Line is set -sal_uInt16 CalcLineSpace( SvxBoxItemLine nLine, bool bIgnoreLine = false ) const; +// bEvenIfNoLine = TRUE -> Also return distance, when no Line is set +sal_uInt16 CalcLineSpace( SvxBoxItemLine nLine, bool bEvenIfNoLine = false ) const; +bool HasBorder( bool bTreatPaddingAsBorder = false ) const; static css::table::BorderLine2 SvxLineToLine( const editeng::SvxBorderLine* pLine, bool bConvert ); static bool LineToSvxLine(const css::table::BorderLine& rLine, editeng::SvxBorderLine& rSvxLine, bool bConvert); static bool LineToSvxLine(const css::table::BorderLine2& rLine, editeng::SvxBorderLine& rSvxLine, bool bConvert); diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx index 27beaa0..5ac99b8 100644 --- a/sw/source/core/doc/notxtfrm.cxx +++ b/sw/source/core/doc/notxtfrm.cxx @@ -270,11 +270,23 @@ void SwNoTextFrame::Paint(vcl::RenderContext& rRenderContext, SwRect const& rRec // In case the picture fly frm was clipped, render it with the origin // size instead of scaling it -if ( rNoTNd.getIDocumentSettingAccess()->get( DocumentSettingId::CLIPPED_PICTURES ) ) +if ( pGrfNd && rNoTNd.getIDocumentSettingAccess()->get( DocumentSettingId::CLIPPED_PICTURES ) ) { const SwFlyFreeFrame *pFly = dynamic_cast< const SwFlyFreeFrame* >( FindFlyFrame() ); if( pFly ) -aGrfArea = SwRect( Frame().Pos( ), pFly->GetUnclippedFrame( ).SSize( ) ); +{ +bool bGetUnclippedFrame=true; +const SfxPoolItem* pItem; +if( pFly->GetFormat() && SfxItemState::SET == pFly->GetFormat()->GetItemState(RES_BOX, false, ) ) +{ +const SvxBoxItem& rBox = *static_cast(pItem); +if( rBox.HasBorder( /*bTreatPaddingAsBorder*/true) ) +bGetUnclippedFrame = false; +} + +if(
[Libreoffice-commits] core.git: editeng/source include/editeng sw/source
editeng/source/editeng/edtspell.cxx |6 +++--- editeng/source/editeng/textconv.cxx | 14 +++--- editeng/source/misc/splwrap.cxx | 14 +++--- include/editeng/svxenum.hxx | 10 +- sw/source/uibase/lingu/hhcwrp.cxx| 12 ++-- sw/source/uibase/lingu/hyp.cxx |2 +- sw/source/uibase/uiview/viewling.cxx | 16 7 files changed, 37 insertions(+), 37 deletions(-) New commits: commit 6f6024610b6f5392a96ed07ce9abe5aab606519d Author: Noel GrandinDate: Mon Aug 15 13:53:33 2016 +0200 convert SvxSpellArea to scoped enum Change-Id: I91d3caabb667e7d4ff23e603026e072074058712 diff --git a/editeng/source/editeng/edtspell.cxx b/editeng/source/editeng/edtspell.cxx index 627ead7..4077ae5 100644 --- a/editeng/source/editeng/edtspell.cxx +++ b/editeng/source/editeng/edtspell.cxx @@ -57,7 +57,7 @@ void EditSpellWrapper::SpellStart( SvxSpellArea eArea ) ImpEditEngine* pImpEE = pEditView->GetImpEditEngine(); SpellInfo* pSpellInfo = pImpEE->GetSpellInfo(); -if ( eArea == SVX_SPELL_BODY_START ) +if ( eArea == SvxSpellArea::BodyStart ) { // Is called when // a) Spell-Forward has arrived at the end and should restart at the top @@ -76,7 +76,7 @@ void EditSpellWrapper::SpellStart( SvxSpellArea eArea ) pEE->GetEditDoc().GetStartPaM() ); } } -else if ( eArea == SVX_SPELL_BODY_END ) +else if ( eArea == SvxSpellArea::BodyEnd ) { // Is called when // a) Spell-Forward is launched @@ -95,7 +95,7 @@ void EditSpellWrapper::SpellStart( SvxSpellArea eArea ) pEE->GetEditDoc().GetEndPaM() ); } } -else if ( eArea == SVX_SPELL_BODY ) +else if ( eArea == SvxSpellArea::Body ) { ; // Is handled by the App through SpellNextDocument } diff --git a/editeng/source/editeng/textconv.cxx b/editeng/source/editeng/textconv.cxx index fd73733..7a8d6db 100644 --- a/editeng/source/editeng/textconv.cxx +++ b/editeng/source/editeng/textconv.cxx @@ -87,7 +87,7 @@ bool TextConvWrapper::ConvNext_impl() { m_bStartDone = true; m_bEndDone = false; -ConvStart_impl( SVX_SPELL_BODY ); +ConvStart_impl( SvxSpellArea::Body ); return true; } return false; @@ -100,14 +100,14 @@ bool TextConvWrapper::ConvNext_impl() { m_bStartDone = true; m_bEndDone = false; -ConvStart_impl( SVX_SPELL_BODY ); +ConvStart_impl( SvxSpellArea::Body ); return true; } } else if (!m_aConvSel.HasRange()) { m_bStartChk = !m_bStartDone; -ConvStart_impl( m_bStartChk ? SVX_SPELL_BODY_START : SVX_SPELL_BODY_END ); +ConvStart_impl( m_bStartChk ? SvxSpellArea::BodyStart : SvxSpellArea::BodyEnd ); return true; } @@ -160,7 +160,7 @@ void TextConvWrapper::ConvStart_impl( SvxSpellArea eArea ) ImpEditEngine* pImpEE = m_pEditView->GetImpEditEngine(); ConvInfo* pConvInfo = pImpEE->GetConvInfo(); -if ( eArea == SVX_SPELL_BODY_START ) +if ( eArea == SvxSpellArea::BodyStart ) { // Is called when Spell-forward has reached the end, and to start over if ( m_bEndDone ) @@ -178,7 +178,7 @@ void TextConvWrapper::ConvStart_impl( SvxSpellArea eArea ) pEE->GetEditDoc().GetStartPaM() ); } } -else if ( eArea == SVX_SPELL_BODY_END ) +else if ( eArea == SvxSpellArea::BodyEnd ) { // Is called when Spell-forward starts pConvInfo->bConvToEnd = true; @@ -196,7 +196,7 @@ void TextConvWrapper::ConvStart_impl( SvxSpellArea eArea ) pEE->GetEditDoc().GetEndPaM() ); } } -else if ( eArea == SVX_SPELL_BODY ) +else if ( eArea == SvxSpellArea::Body ) { // called by ConvNext_impl... pConvInfo->aConvContinue = pConvInfo->aConvStart; @@ -542,7 +542,7 @@ void TextConvWrapper::ChangeText_impl( const OUString , bool bKeepAttri void TextConvWrapper::Convert() { m_bStartChk = false; -ConvStart_impl( SVX_SPELL_BODY_END ); +ConvStart_impl( SvxSpellArea::BodyEnd ); ConvertDocument(); } diff --git a/editeng/source/misc/splwrap.cxx b/editeng/source/misc/splwrap.cxx index c8f0769..35c68be 100644 --- a/editeng/source/misc/splwrap.cxx +++ b/editeng/source/misc/splwrap.cxx @@ -275,12 +275,12 @@ void SvxSpellWrapper::SpellDocument( ) if ( bOtherCntnt ) { bReverse = false; -SpellStart( SVX_SPELL_OTHER ); +SpellStart( SvxSpellArea::Other ); } else { bStartChk = bReverse; -SpellStart( bReverse ? SVX_SPELL_BODY_START : SVX_SPELL_BODY_END ); +SpellStart( bReverse ? SvxSpellArea::BodyStart : SvxSpellArea::BodyEnd ); } if ( FindSpellError() ) @@ -340,7 +340,7 @@ bool
[Libreoffice-commits] core.git: editeng/source include/editeng sw/source
editeng/source/items/frmitems.cxx | 11 +++ include/editeng/shaditem.hxx|1 + sw/source/core/docnode/nodedump.cxx |6 +++--- 3 files changed, 15 insertions(+), 3 deletions(-) New commits: commit 71edf281f38a3ee839a99393cb06316c7231f3d2 Author: Miklos Vajna vmik...@collabora.co.uk Date: Tue Jan 20 09:10:35 2015 +0100 Factor out SvxShadowItem::dumpAsXml() from sw Change-Id: Id25a050a9840d83cff4b390faec7478f17336524 diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx index 8b68df0..2c0adcc 100644 --- a/editeng/source/items/frmitems.cxx +++ b/editeng/source/items/frmitems.cxx @@ -1589,6 +1589,17 @@ void SvxShadowItem::SetEnumValue( sal_uInt16 nVal ) SetLocation( (const SvxShadowLocation)nVal ); } +void SvxShadowItem::dumpAsXml(xmlTextWriterPtr pWriter) const +{ +xmlTextWriterStartElement(pWriter, BAD_CAST(svxShadowItem)); +xmlTextWriterWriteAttribute(pWriter, BAD_CAST(whichId), BAD_CAST(OString::number(Which()).getStr())); +xmlTextWriterWriteAttribute(pWriter, BAD_CAST(aShadowColor), BAD_CAST(aShadowColor.AsRGBHexString().toUtf8().getStr())); +xmlTextWriterWriteAttribute(pWriter, BAD_CAST(nWidth), BAD_CAST(OString::number(nWidth).getStr())); +xmlTextWriterWriteAttribute(pWriter, BAD_CAST(eLocation), BAD_CAST(OString::number(eLocation).getStr())); +xmlTextWriterWriteAttribute(pWriter, BAD_CAST(presentation), BAD_CAST(EE_RESSTR(RID_SVXITEMS_SHADOW_BEGIN + eLocation).toUtf8().getStr())); +xmlTextWriterEndElement(pWriter); +} + // class SvxBoxItem -- SvxBoxItem::SvxBoxItem( const SvxBoxItem rCpy ) : diff --git a/include/editeng/shaditem.hxx b/include/editeng/shaditem.hxx index 43ec3bc..c7761fca 100644 --- a/include/editeng/shaditem.hxx +++ b/include/editeng/shaditem.hxx @@ -83,6 +83,7 @@ public: virtual OUString GetValueTextByPos( sal_uInt16 nPos ) const SAL_OVERRIDE; virtual sal_uInt16 GetEnumValue() const SAL_OVERRIDE; virtual voidSetEnumValue( sal_uInt16 nNewVal ) SAL_OVERRIDE; +void dumpAsXml(struct _xmlTextWriter* pWriter) const; }; inline SvxShadowItem SvxShadowItem::operator=( const SvxShadowItem rFmtShadow ) diff --git a/sw/source/core/docnode/nodedump.cxx b/sw/source/core/docnode/nodedump.cxx index 5822f89..b05809a 100644 --- a/sw/source/core/docnode/nodedump.cxx +++ b/sw/source/core/docnode/nodedump.cxx @@ -496,6 +496,9 @@ void lcl_dumpSfxItemSet(WriterHelper writer, const SfxItemSet* pSet) case RES_UL_SPACE: static_castconst SvxULSpaceItem*(pItem)-dumpAsXml(writer); break; +case RES_SHADOW: +static_castconst SvxShadowItem*(pItem)-dumpAsXml(writer); +break; default: bDone = false; break; } if (bDone) @@ -510,9 +513,6 @@ void lcl_dumpSfxItemSet(WriterHelper writer, const SfxItemSet* pSet) boost::optionalOString oValue; switch (pItem-Which()) { -case RES_SHADOW: -pWhich = shadow; -break; case RES_PAGEDESC: { pWhich = page description; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: editeng/source include/editeng sw/source
editeng/source/items/frmitems.cxx | 17 + include/editeng/lrspitem.hxx|1 + sw/source/core/docnode/nodedump.cxx |6 +++--- 3 files changed, 21 insertions(+), 3 deletions(-) New commits: commit 0ffb225d374cfda29275db3c22a9866eb5fe5ad2 Author: Miklos Vajna vmik...@collabora.co.uk Date: Fri Jan 16 09:26:09 2015 +0100 Factor out SvxLRSpaceItem::dumpAsXml() from sw Change-Id: Id28c3e1617f2e73c36f13b506488d401a22b00a8 diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx index 66f0ba3..216b30e 100644 --- a/editeng/source/items/frmitems.cxx +++ b/editeng/source/items/frmitems.cxx @@ -808,6 +808,23 @@ bool SvxLRSpaceItem::HasMetrics() const return true; } +void SvxLRSpaceItem::dumpAsXml(xmlTextWriterPtr pWriter) const +{ +xmlTextWriterStartElement(pWriter, BAD_CAST(svxLRSpaceItem)); +xmlTextWriterWriteAttribute(pWriter, BAD_CAST(whichId), BAD_CAST(OString::number(Which()).getStr())); +xmlTextWriterWriteAttribute(pWriter, BAD_CAST(nFirstLineOfst), BAD_CAST(OString::number(nFirstLineOfst).getStr())); +xmlTextWriterWriteAttribute(pWriter, BAD_CAST(nTxtLeft), BAD_CAST(OString::number(nTxtLeft).getStr())); +xmlTextWriterWriteAttribute(pWriter, BAD_CAST(nLeftMargin), BAD_CAST(OString::number(nLeftMargin).getStr())); +xmlTextWriterWriteAttribute(pWriter, BAD_CAST(nRightMargin), BAD_CAST(OString::number(nRightMargin).getStr())); +xmlTextWriterWriteAttribute(pWriter, BAD_CAST(nPropFirstLineOfst), BAD_CAST(OString::number(nPropFirstLineOfst).getStr())); +xmlTextWriterWriteAttribute(pWriter, BAD_CAST(nPropLeftMargin), BAD_CAST(OString::number(nPropLeftMargin).getStr())); +xmlTextWriterWriteAttribute(pWriter, BAD_CAST(nPropRightMargin), BAD_CAST(OString::number(nPropRightMargin).getStr())); +xmlTextWriterWriteAttribute(pWriter, BAD_CAST(bAutoFirst), BAD_CAST(OString::number(bAutoFirst).getStr())); +xmlTextWriterWriteAttribute(pWriter, BAD_CAST(bExplicitZeroMarginValRight), BAD_CAST(OString::number(bExplicitZeroMarginValRight).getStr())); +xmlTextWriterWriteAttribute(pWriter, BAD_CAST(bExplicitZeroMarginValLeft), BAD_CAST(OString::number(bExplicitZeroMarginValLeft).getStr())); +xmlTextWriterEndElement(pWriter); +} + // class SvxULSpaceItem -- SvxULSpaceItem::SvxULSpaceItem( const sal_uInt16 nId ) diff --git a/include/editeng/lrspitem.hxx b/include/editeng/lrspitem.hxx index c5eb6ec..ef5d737 100644 --- a/include/editeng/lrspitem.hxx +++ b/include/editeng/lrspitem.hxx @@ -126,6 +126,7 @@ public: { return nPropFirstLineOfst; } inline void SetTxtFirstLineOfstValue( const short nValue ) { nFirstLineOfst = nValue; } +void dumpAsXml(struct _xmlTextWriter* pWriter) const; }; inline SvxLRSpaceItem SvxLRSpaceItem::operator=( const SvxLRSpaceItem rCpy ) diff --git a/sw/source/core/docnode/nodedump.cxx b/sw/source/core/docnode/nodedump.cxx index 55490ee..d63b82a 100644 --- a/sw/source/core/docnode/nodedump.cxx +++ b/sw/source/core/docnode/nodedump.cxx @@ -490,6 +490,9 @@ void lcl_dumpSfxItemSet(WriterHelper writer, const SfxItemSet* pSet) case RES_COLUMNBALANCE: static_castconst SwFmtNoBalancedColumns*(pItem)-dumpAsXml(writer); break; +case RES_LR_SPACE: +static_castconst SvxLRSpaceItem*(pItem)-dumpAsXml(writer); +break; default: bDone = false; break; } if (bDone) @@ -504,9 +507,6 @@ void lcl_dumpSfxItemSet(WriterHelper writer, const SfxItemSet* pSet) boost::optionalOString oValue; switch (pItem-Which()) { -case RES_LR_SPACE: -pWhich = left-right space; -break; case RES_UL_SPACE: pWhich = upper-lower space; break; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: editeng/source include/editeng sw/source
editeng/source/items/frmitems.cxx | 10 ++ include/editeng/protitem.hxx|1 + sw/source/core/docnode/nodedump.cxx |6 +++--- 3 files changed, 14 insertions(+), 3 deletions(-) New commits: commit 0042de4cf8ca02dd0fe9063266b69943d97b645b Author: Miklos Vajna vmik...@collabora.co.uk Date: Mon Jan 12 09:09:15 2015 +0100 Factor out SvxProtectItem::dumpAsXml() from sw Change-Id: I780afa7c5faa0f594257200c5c2c132cc49388b6 diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx index 7244b1d..f7902b2 100644 --- a/editeng/source/items/frmitems.cxx +++ b/editeng/source/items/frmitems.cxx @@ -1256,6 +1256,16 @@ SfxPoolItem* SvxProtectItem::Create( SvStream rStrm, sal_uInt16 ) const return pAttr; } +void SvxProtectItem::dumpAsXml(xmlTextWriterPtr pWriter) const +{ +xmlTextWriterStartElement(pWriter, BAD_CAST(svxProtectItem)); +xmlTextWriterWriteAttribute(pWriter, BAD_CAST(whichId), BAD_CAST(OString::number(Which()).getStr())); +xmlTextWriterWriteAttribute(pWriter, BAD_CAST(content), BAD_CAST(OString::boolean(bCntnt).getStr())); +xmlTextWriterWriteAttribute(pWriter, BAD_CAST(size), BAD_CAST(OString::boolean(bSize).getStr())); +xmlTextWriterWriteAttribute(pWriter, BAD_CAST(position), BAD_CAST(OString::boolean(bPos).getStr())); +xmlTextWriterEndElement(pWriter); +} + // class SvxShadowItem --- SvxShadowItem::SvxShadowItem( const sal_uInt16 nId, diff --git a/include/editeng/protitem.hxx b/include/editeng/protitem.hxx index 9c05284..a21bb6b 100644 --- a/include/editeng/protitem.hxx +++ b/include/editeng/protitem.hxx @@ -66,6 +66,7 @@ public: virtual boolQueryValue( com::sun::star::uno::Any rVal, sal_uInt8 nMemberId = 0 ) const SAL_OVERRIDE; virtual boolPutValue( const com::sun::star::uno::Any rVal, sal_uInt8 nMemberId = 0 ) SAL_OVERRIDE; +void dumpAsXml(struct _xmlTextWriter* pWriter) const; }; inline SvxProtectItem::SvxProtectItem( const sal_uInt16 nId ) diff --git a/sw/source/core/docnode/nodedump.cxx b/sw/source/core/docnode/nodedump.cxx index 092bf48..4f0e834 100644 --- a/sw/source/core/docnode/nodedump.cxx +++ b/sw/source/core/docnode/nodedump.cxx @@ -479,6 +479,9 @@ void lcl_dumpSfxItemSet(WriterHelper writer, const SfxItemSet* pSet) case XATTR_FILLBMP_STRETCH: static_castconst XFillBmpStretchItem*(pItem)-dumpAsXml(writer); break; +case RES_PROTECT: +static_castconst SvxProtectItem*(pItem)-dumpAsXml(writer); +break; default: bDone = false; break; } if (bDone) @@ -493,9 +496,6 @@ void lcl_dumpSfxItemSet(WriterHelper writer, const SfxItemSet* pSet) boost::optionalOString oValue; switch (pItem-Which()) { -case RES_PROTECT: -pWhich = protect; -break; case RES_EDIT_IN_READONLY: pWhich = edit in read-only; break; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: editeng/source include/editeng sw/source
editeng/source/items/textitem.cxx | 10 ++ include/editeng/fhgtitem.hxx|2 ++ sw/source/core/docnode/nodedump.cxx | 12 3 files changed, 16 insertions(+), 8 deletions(-) New commits: commit 2a6dc39ba96648a296fcad29a7a0a44f7e749e2a Author: Miklos Vajna vmik...@collabora.co.uk Date: Thu Dec 18 10:49:35 2014 +0100 Factor out SvxFontHeightItem::dumpAsXml() from sw Change-Id: I8dc3a0ed7bfce62b0d20c6bff143d77c0f26963f diff --git a/editeng/source/items/textitem.cxx b/editeng/source/items/textitem.cxx index 3ea6bb7..16870d9 100644 --- a/editeng/source/items/textitem.cxx +++ b/editeng/source/items/textitem.cxx @@ -1128,6 +1128,16 @@ void SvxFontHeightItem::SetHeight( sal_uInt32 nNewHeight, sal_uInt16 nNewProp, ePropUnit = eMetric; } +void SvxFontHeightItem::dumpAsXml(xmlTextWriterPtr pWriter) const +{ +xmlTextWriterStartElement(pWriter, BAD_CAST(svxFontHeightItem)); +xmlTextWriterWriteAttribute(pWriter, BAD_CAST(whichId), BAD_CAST(OString::number(Which()).getStr())); +xmlTextWriterWriteAttribute(pWriter, BAD_CAST(height), BAD_CAST(OString::number(nHeight).getStr())); +xmlTextWriterWriteAttribute(pWriter, BAD_CAST(prop), BAD_CAST(OString::number(nProp).getStr())); +xmlTextWriterWriteAttribute(pWriter, BAD_CAST(propUnit), BAD_CAST(OString::number(ePropUnit).getStr())); +xmlTextWriterEndElement(pWriter); +} + // class SvxFontWidthItem --- SvxFontWidthItem::SvxFontWidthItem( const sal_uInt16 nSz, const sal_uInt16 nPrp, const sal_uInt16 nId ) : diff --git a/include/editeng/fhgtitem.hxx b/include/editeng/fhgtitem.hxx index e069f1b..7034dcf 100644 --- a/include/editeng/fhgtitem.hxx +++ b/include/editeng/fhgtitem.hxx @@ -91,6 +91,8 @@ public: sal_uInt16 GetProp() const { return nProp; } SfxMapUnit GetPropUnit() const { return ePropUnit; } // Percent, Twip, ... + +void dumpAsXml(struct _xmlTextWriter* pWriter) const; }; #endif diff --git a/sw/source/core/docnode/nodedump.cxx b/sw/source/core/docnode/nodedump.cxx index a83799b..f6cd7f8 100644 --- a/sw/source/core/docnode/nodedump.cxx +++ b/sw/source/core/docnode/nodedump.cxx @@ -414,11 +414,15 @@ void lcl_dumpSfxItemSet(WriterHelper writer, const SfxItemSet* pSet) static_castconst SwNumRuleItem*(pItem)-dumpAsXml(writer); break; case RES_CHRATR_FONT: +case RES_CHRATR_CTL_FONT: static_castconst SvxFontItem*(pItem)-dumpAsXml(writer); break; case RES_CHRATR_BACKGROUND: static_castconst SvxBrushItem*(pItem)-dumpAsXml(writer); break; +case RES_CHRATR_FONTSIZE: +static_castconst SvxFontHeightItem*(pItem)-dumpAsXml(writer); +break; default: bDone = false; break; } if (bDone) @@ -433,14 +437,6 @@ void lcl_dumpSfxItemSet(WriterHelper writer, const SfxItemSet* pSet) boost::optionalOString oValue; switch (pItem-Which()) { -case RES_CHRATR_CTL_FONT: pWhich = character ctl font; break; -case RES_CHRATR_FONTSIZE: -{ -pWhich = character font size; -const SvxFontHeightItem* pFontHeightItem = static_castconst SvxFontHeightItem*(pItem); -oValue = nHeight: + OString::number(pFontHeightItem-GetHeight()) + , nProp: + OString::number(pFontHeightItem-GetProp()); -break; -} case RES_CNTNT: { pWhich = content; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: editeng/source include/editeng sw/source
editeng/source/items/frmitems.cxx | 14 ++ include/editeng/brushitem.hxx |2 ++ sw/source/core/docnode/nodedump.cxx |4 +++- 3 files changed, 19 insertions(+), 1 deletion(-) New commits: commit 53421edf6c821d9a74c32c2fd8d5eb15fb5e5fd3 Author: Miklos Vajna vmik...@collabora.co.uk Date: Wed Dec 17 09:07:10 2014 +0100 Factor out SvxBrushItem::dumpAsXml() from sw Change-Id: I5421cf5a7d1a2ff4db81d028f44a490c234b9ccf diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx index e4b6e0c..784326d 100644 --- a/editeng/source/items/frmitems.cxx +++ b/editeng/source/items/frmitems.cxx @@ -81,6 +81,7 @@ #include editeng/unoprnms.hxx #include editeng/memberids.hrc #include editeng/editerr.hxx +#include libxml/xmlwriter.h using namespace ::editeng; using namespace ::com::sun::star; @@ -4102,6 +4103,19 @@ void SvxBrushItem::ApplyGraphicTransparency_Impl() } } +void SvxBrushItem::dumpAsXml(xmlTextWriterPtr pWriter) const +{ +xmlTextWriterStartElement(pWriter, BAD_CAST(svxBrushItem)); +xmlTextWriterWriteAttribute(pWriter, BAD_CAST(whichId), BAD_CAST(OString::number(Which()).getStr())); +xmlTextWriterWriteAttribute(pWriter, BAD_CAST(color), BAD_CAST(aColor.AsRGBHexString().toUtf8().getStr())); +xmlTextWriterWriteAttribute(pWriter, BAD_CAST(shadingValue), BAD_CAST(OString::number(nShadingValue).getStr())); +xmlTextWriterWriteAttribute(pWriter, BAD_CAST(link), BAD_CAST(maStrLink.toUtf8().getStr())); +xmlTextWriterWriteAttribute(pWriter, BAD_CAST(filter), BAD_CAST(maStrFilter.toUtf8().getStr())); +xmlTextWriterWriteAttribute(pWriter, BAD_CAST(graphicPos), BAD_CAST(OString::number(eGraphicPos).getStr())); +xmlTextWriterWriteAttribute(pWriter, BAD_CAST(loadAgain), BAD_CAST(OString::boolean(bLoadAgain).getStr())); +xmlTextWriterEndElement(pWriter); +} + // class SvxFrameDirectionItem -- SvxFrameDirectionItem::SvxFrameDirectionItem( SvxFrameDirection nValue , diff --git a/include/editeng/brushitem.hxx b/include/editeng/brushitem.hxx index ae4cb9a..16dc38d 100644 --- a/include/editeng/brushitem.hxx +++ b/include/editeng/brushitem.hxx @@ -127,6 +127,8 @@ public: static SvxGraphicPosition WallpaperStyle2GraphicPos( WallpaperStyle eStyle ); static WallpaperStyle GraphicPos2WallpaperStyle( SvxGraphicPosition ePos ); static sal_Int8 TransparencyToPercent(sal_Int32 nTrans); + +void dumpAsXml(struct _xmlTextWriter* pWriter) const; }; #endif // INCLUDED_EDITENG_BRUSHITEM_HXX diff --git a/sw/source/core/docnode/nodedump.cxx b/sw/source/core/docnode/nodedump.cxx index 17540bc..a83799b 100644 --- a/sw/source/core/docnode/nodedump.cxx +++ b/sw/source/core/docnode/nodedump.cxx @@ -416,6 +416,9 @@ void lcl_dumpSfxItemSet(WriterHelper writer, const SfxItemSet* pSet) case RES_CHRATR_FONT: static_castconst SvxFontItem*(pItem)-dumpAsXml(writer); break; +case RES_CHRATR_BACKGROUND: +static_castconst SvxBrushItem*(pItem)-dumpAsXml(writer); +break; default: bDone = false; break; } if (bDone) @@ -430,7 +433,6 @@ void lcl_dumpSfxItemSet(WriterHelper writer, const SfxItemSet* pSet) boost::optionalOString oValue; switch (pItem-Which()) { -case RES_CHRATR_BACKGROUND: pWhich = character background; break; case RES_CHRATR_CTL_FONT: pWhich = character ctl font; break; case RES_CHRATR_FONTSIZE: { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: editeng/source include/editeng sw/source
editeng/source/items/textitem.cxx | 12 include/editeng/fontitem.hxx|1 + sw/source/core/docnode/nodedump.cxx |4 +++- 3 files changed, 16 insertions(+), 1 deletion(-) New commits: commit d54e21eaa2d4baf85484063476d0aa1769b50583 Author: Miklos Vajna vmik...@collabora.co.uk Date: Tue Dec 16 09:06:05 2014 +0100 Factor out SvxFontItem::dumpAsXml() from sw Change-Id: I8283ddd868639e6535e27798d91a7273d77f048c diff --git a/editeng/source/items/textitem.cxx b/editeng/source/items/textitem.cxx index 4d75b47..3ea6bb7 100644 --- a/editeng/source/items/textitem.cxx +++ b/editeng/source/items/textitem.cxx @@ -457,6 +457,18 @@ void SvxFontItem::EnableStoreUnicodeNames( bool bEnable ) bEnableStoreUnicodeNames = bEnable; } +void SvxFontItem::dumpAsXml(xmlTextWriterPtr pWriter) const +{ +xmlTextWriterStartElement(pWriter, BAD_CAST(svxFontItem)); +xmlTextWriterWriteAttribute(pWriter, BAD_CAST(whichId), BAD_CAST(OString::number(Which()).getStr())); +xmlTextWriterWriteAttribute(pWriter, BAD_CAST(familyName), BAD_CAST(aFamilyName.toUtf8().getStr())); +xmlTextWriterWriteAttribute(pWriter, BAD_CAST(styleName), BAD_CAST(aStyleName.toUtf8().getStr())); +xmlTextWriterWriteAttribute(pWriter, BAD_CAST(family), BAD_CAST(OString::number(eFamily).getStr())); +xmlTextWriterWriteAttribute(pWriter, BAD_CAST(pitch), BAD_CAST(OString::number(ePitch).getStr())); +xmlTextWriterWriteAttribute(pWriter, BAD_CAST(textEncoding), BAD_CAST(OString::number(eTextEncoding).getStr())); +xmlTextWriterEndElement(pWriter); +} + // class SvxPostureItem -- SvxPostureItem::SvxPostureItem( const FontItalic ePosture, const sal_uInt16 nId ) : diff --git a/include/editeng/fontitem.hxx b/include/editeng/fontitem.hxx index 3b9fbb2..6a2cb8a 100644 --- a/include/editeng/fontitem.hxx +++ b/include/editeng/fontitem.hxx @@ -87,6 +87,7 @@ public: static void EnableStoreUnicodeNames( bool bEnable ); +void dumpAsXml(struct _xmlTextWriter* pWriter) const; }; EDITENG_DLLPUBLIC void GetDefaultFonts( SvxFontItem rLatin, SvxFontItem rAsian, diff --git a/sw/source/core/docnode/nodedump.cxx b/sw/source/core/docnode/nodedump.cxx index 877a41f..17540bc 100644 --- a/sw/source/core/docnode/nodedump.cxx +++ b/sw/source/core/docnode/nodedump.cxx @@ -413,6 +413,9 @@ void lcl_dumpSfxItemSet(WriterHelper writer, const SfxItemSet* pSet) case RES_PARATR_NUMRULE: static_castconst SwNumRuleItem*(pItem)-dumpAsXml(writer); break; +case RES_CHRATR_FONT: +static_castconst SvxFontItem*(pItem)-dumpAsXml(writer); +break; default: bDone = false; break; } if (bDone) @@ -427,7 +430,6 @@ void lcl_dumpSfxItemSet(WriterHelper writer, const SfxItemSet* pSet) boost::optionalOString oValue; switch (pItem-Which()) { -case RES_CHRATR_FONT: pWhich = character font; oValue = OUStringToOString(static_castconst SvxFontItem*(pItem)-GetFamilyName(), RTL_TEXTENCODING_UTF8); break; case RES_CHRATR_BACKGROUND: pWhich = character background; break; case RES_CHRATR_CTL_FONT: pWhich = character ctl font; break; case RES_CHRATR_FONTSIZE: ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: editeng/source include/editeng sw/source
editeng/source/items/textitem.cxx |8 include/editeng/charrotateitem.hxx |2 ++ sw/source/core/docnode/nodedump.cxx |4 +++- 3 files changed, 13 insertions(+), 1 deletion(-) New commits: commit 3dee6c74c37d1667c1d56767896e9578e2836e29 Author: Miklos Vajna vmik...@collabora.co.uk Date: Thu Dec 11 08:52:06 2014 +0100 Factor out SvxCharRotateItem::dumpAsXml() from sw Change-Id: I52bca77e8ff0d4fccf8423f01dac9b6a7498f8d1 diff --git a/editeng/source/items/textitem.cxx b/editeng/source/items/textitem.cxx index 7b4ed20..4d75b47 100644 --- a/editeng/source/items/textitem.cxx +++ b/editeng/source/items/textitem.cxx @@ -3084,6 +3084,14 @@ bool SvxCharRotateItem::operator==( const SfxPoolItem rItem ) const IsFitToLine() == static_castconst SvxCharRotateItem(rItem).IsFitToLine(); } +void SvxCharRotateItem::dumpAsXml(xmlTextWriterPtr pWriter) const +{ +xmlTextWriterStartElement(pWriter, BAD_CAST(svxCharRotateItem)); +xmlTextWriterWriteAttribute(pWriter, BAD_CAST(whichId), BAD_CAST(OString::number(Which()).getStr())); +xmlTextWriterWriteAttribute(pWriter, BAD_CAST(value), BAD_CAST(OString::number(GetValue()).getStr())); +xmlTextWriterWriteAttribute(pWriter, BAD_CAST(fitToLine), BAD_CAST(OString::boolean(IsFitToLine()).getStr())); +xmlTextWriterEndElement(pWriter); +} /* |*class SvxCharScaleItem diff --git a/include/editeng/charrotateitem.hxx b/include/editeng/charrotateitem.hxx index 574d2fc..c78cfc6 100644 --- a/include/editeng/charrotateitem.hxx +++ b/include/editeng/charrotateitem.hxx @@ -74,6 +74,8 @@ public: bool IsFitToLine() const{ return bFitToLine; } void SetFitToLine( bool b ) { bFitToLine = b; } + +void dumpAsXml(struct _xmlTextWriter* pWriter) const; }; #endif diff --git a/sw/source/core/docnode/nodedump.cxx b/sw/source/core/docnode/nodedump.cxx index d97bdcf..b2053cd 100644 --- a/sw/source/core/docnode/nodedump.cxx +++ b/sw/source/core/docnode/nodedump.cxx @@ -404,6 +404,9 @@ void lcl_dumpSfxItemSet(WriterHelper writer, const SfxItemSet* pSet) case RES_CHRATR_RSID: static_castconst SvxRsidItem*(pItem)-dumpAsXml(writer); break; +case RES_CHRATR_ROTATE: +static_castconst SvxCharRotateItem*(pItem)-dumpAsXml(writer); +break; default: bDone = false; break; } if (bDone) @@ -418,7 +421,6 @@ void lcl_dumpSfxItemSet(WriterHelper writer, const SfxItemSet* pSet) boost::optionalOString oValue; switch (pItem-Which()) { -case RES_CHRATR_ROTATE: pWhich = character rotation; oValue = OString::number(static_castconst SvxCharRotateItem*(pItem)-GetValue()); break; case RES_PARATR_OUTLINELEVEL: pWhich = paragraph outline level; oValue = OString::number(static_castconst SfxUInt16Item*(pItem)-GetValue()); break; case RES_PARATR_NUMRULE: pWhich = paragraph numbering rule; oValue = OUStringToOString(static_castconst SwNumRuleItem*(pItem)-GetValue(), RTL_TEXTENCODING_UTF8); break; case RES_CHRATR_FONT: pWhich = character font; oValue = OUStringToOString(static_castconst SvxFontItem*(pItem)-GetFamilyName(), RTL_TEXTENCODING_UTF8); break; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: editeng/source include/editeng sw/source
editeng/source/items/textitem.cxx |9 + include/editeng/postitem.hxx|2 ++ sw/source/core/docnode/nodedump.cxx | 20 +--- 3 files changed, 28 insertions(+), 3 deletions(-) New commits: commit 3434327a5f2559a6d24146b35236042fe8741038 Author: Miklos Vajna vmik...@collabora.co.uk Date: Fri Dec 5 09:07:36 2014 +0100 Factor out SvxPostureItem::dumpAsXml() from sw Again, the motivation is that dumper for something in editeng should be in that module as well, before home-grown dumpers are invented and duplicated e.g. in all sw/sc/sd. Change-Id: Icfeed9549efbd80226ff04e9070766188cc8646e diff --git a/editeng/source/items/textitem.cxx b/editeng/source/items/textitem.cxx index b4f5303..aa0e57c 100644 --- a/editeng/source/items/textitem.cxx +++ b/editeng/source/items/textitem.cxx @@ -93,6 +93,7 @@ #include editeng/charreliefitem.hxx #include editeng/itemtype.hxx #include editeng/eerdll.hxx +#include libxml/xmlwriter.h #define STORE_UNICODE_MAGIC_MARKER 0xFE331188 @@ -588,6 +589,14 @@ void SvxPostureItem::SetBoolValue( bool bVal ) SetValue( (sal_uInt16)(bVal ? ITALIC_NORMAL : ITALIC_NONE) ); } +void SvxPostureItem::dumpAsXml(xmlTextWriterPtr pWriter) const +{ +xmlTextWriterStartElement(pWriter, BAD_CAST(svxPostureItem)); +xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST(whichId), % SAL_PRIuUINT32, Which()); +xmlTextWriterWriteAttribute(pWriter, BAD_CAST(presentation), BAD_CAST(GetValueTextByPos(GetValue()).toUtf8().getStr())); +xmlTextWriterEndElement(pWriter); +} + // class SvxWeightItem --- SvxWeightItem::SvxWeightItem( const FontWeight eWght, const sal_uInt16 nId ) : diff --git a/include/editeng/postitem.hxx b/include/editeng/postitem.hxx index 00cbbf4..2651415 100644 --- a/include/editeng/postitem.hxx +++ b/include/editeng/postitem.hxx @@ -69,6 +69,8 @@ public: { return (FontItalic)GetValue(); } voidSetPosture( FontItalic eNew ) { SetValue( (sal_uInt16)eNew ); } + +void dumpAsXml(struct _xmlTextWriter* pWriter) const; }; #endif // INCLUDED_EDITENG_POSTITEM_HXX diff --git a/sw/source/core/docnode/nodedump.cxx b/sw/source/core/docnode/nodedump.cxx index 190f753..705e34a 100644 --- a/sw/source/core/docnode/nodedump.cxx +++ b/sw/source/core/docnode/nodedump.cxx @@ -45,6 +45,7 @@ #include editeng/fhgtitem.hxx #include editeng/editobj.hxx #include editeng/outlobj.hxx +#include editeng/postitem.hxx #include svx/xdef.hxx #include svx/svdpage.hxx #include svx/svdmodel.hxx @@ -386,17 +387,30 @@ void lcl_dumpSfxItemSet(WriterHelper writer, const SfxItemSet* pSet) const SfxPoolItem* pItem = aIter.FirstItem(); while (pItem) { +bool bDone = true; +switch (pItem-Which()) +{ +case RES_CHRATR_POSTURE: +case RES_CHRATR_CJK_POSTURE: +case RES_CHRATR_CTL_POSTURE: +static_castconst SvxPostureItem*(pItem)-dumpAsXml(writer); +break; +default: bDone = false; break; +} +if (bDone) +{ +pItem = aIter.NextItem(); +continue; +} + writer.startElement(item); writer.writeFormatAttribute(whichId, TMP_FORMAT, pItem-Which()); const char* pWhich = 0; boost::optionalOString oValue; switch (pItem-Which()) { -case RES_CHRATR_POSTURE: pWhich = character posture; break; case RES_CHRATR_WEIGHT: pWhich = character weight; break; -case RES_CHRATR_CJK_POSTURE: pWhich = character cjk posture; break; case RES_CHRATR_CJK_WEIGHT: pWhich = character cjk weight; break; -case RES_CHRATR_CTL_POSTURE: pWhich = character ctl posture; break; case RES_CHRATR_CTL_WEIGHT: pWhich = character ctl weight; break; case RES_CHRATR_RSID: { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: editeng/source include/editeng sw/source
editeng/source/outliner/outlobj.cxx |9 + include/editeng/outlobj.hxx |2 ++ sw/source/core/docnode/nodedump.cxx |8 ++-- 3 files changed, 13 insertions(+), 6 deletions(-) New commits: commit 855c94a46a8810780dacce178b533ab6ceb4d19b Author: Miklos Vajna vmik...@collabora.co.uk Date: Thu Nov 27 08:04:28 2014 +0100 Factor out OutlinerParaObject::dumpAsXml() from SwDoc::dumpAsXml() Change-Id: I5e805aa98f643b5a034cdeadb4718af528af022c diff --git a/editeng/source/outliner/outlobj.cxx b/editeng/source/outliner/outlobj.cxx index a4dcc67..02094ae 100644 --- a/editeng/source/outliner/outlobj.cxx +++ b/editeng/source/outliner/outlobj.cxx @@ -33,6 +33,7 @@ #include tools/stream.hxx #include boost/intrusive_ptr.hpp +#include libxml/xmlwriter.h /** * This is the guts of OutlinerParaObject, refcounted and shared among @@ -278,4 +279,12 @@ void OutlinerParaObject::SetStyleSheets(sal_uInt16 nLevel, const OUString rNewN } } +void OutlinerParaObject::dumpAsXml(xmlTextWriterPtr pWriter) const +{ +xmlTextWriterStartElement(pWriter, BAD_CAST(outlinerParaObject)); +xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST(ptr), %p, this); +GetTextObject().dumpAsXml(pWriter); +xmlTextWriterEndElement(pWriter); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/outlobj.hxx b/include/editeng/outlobj.hxx index c57397e..39c2b3e 100644 --- a/include/editeng/outlobj.hxx +++ b/include/editeng/outlobj.hxx @@ -76,6 +76,8 @@ public: const OUString rNewName); void SetStyleSheets(sal_uInt16 nLevel, const OUString rNewName, const SfxStyleFamily rNewFamily); + +void dumpAsXml(struct _xmlTextWriter* pWriter) const; }; #endif diff --git a/sw/source/core/docnode/nodedump.cxx b/sw/source/core/docnode/nodedump.cxx index 9268d7f..87a2ae4 100644 --- a/sw/source/core/docnode/nodedump.cxx +++ b/sw/source/core/docnode/nodedump.cxx @@ -158,12 +158,8 @@ void lcl_dumpSdrModel(WriterHelper writer, const SdrModel* pModel) writer.writeFormatAttribute(description, %s, BAD_CAST(OUStringToOString(pObject-GetDescription(), RTL_TEXTENCODING_UTF8).getStr())); writer.writeFormatAttribute(nOrdNum, TMP_FORMAT, pObject-GetOrdNumDirect()); -const OutlinerParaObject* pOutliner = pObject-GetOutlinerParaObject(); -writer.startElement(outliner); -writer.writeFormatAttribute(ptr, %p, pOutliner); -if (pOutliner) -pOutliner-GetTextObject().dumpAsXml(writer); -writer.endElement(); +if (const OutlinerParaObject* pOutliner = pObject-GetOutlinerParaObject()) +pOutliner-dumpAsXml(writer); } writer.endElement(); } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: editeng/source include/editeng sw/source
editeng/source/items/frmitems.cxx|4 ++-- include/editeng/brushitem.hxx|1 + sw/source/filter/ww8/docxattributeoutput.cxx |3 +-- 3 files changed, 4 insertions(+), 4 deletions(-) New commits: commit 9487b7130609c85ccd9c6ece331bb31e3be68a51 Author: Miklos Vajna vmik...@suse.cz Date: Wed Jul 10 09:41:23 2013 +0200 SvxBrushItem::TransparencyToPercent: add this to avoid copypaste Change-Id: I9b77c0a48b7de39eadae118c24c70ac415898293 diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx index 8dedafd..987c888 100644 --- a/editeng/source/items/frmitems.cxx +++ b/editeng/source/items/frmitems.cxx @@ -3567,7 +3567,7 @@ static inline sal_Int8 lcl_PercentToTransparency(long nPercent) //0xff must not be returned! return sal_Int8(nPercent ? (50 + 0xfe * nPercent) / 100 : 0); } -static inline sal_Int8 lcl_TransparencyToPercent(sal_Int32 nTrans) +sal_Int8 SvxBrushItem::TransparencyToPercent(sal_Int32 nTrans) { return (sal_Int8)((nTrans * 100 + 127) / 254); } @@ -3584,7 +3584,7 @@ bool SvxBrushItem::QueryValue( uno::Any rVal, sal_uInt8 nMemberId ) const rVal = (sal_Int32)( aColor.GetRGBColor() ); break; case MID_BACK_COLOR_TRANSPARENCY: -rVal = lcl_TransparencyToPercent(aColor.GetTransparency()); +rVal = SvxBrushItem::TransparencyToPercent(aColor.GetTransparency()); break; case MID_GRAPHIC_POSITION: rVal = (style::GraphicLocation)(sal_Int16)eGraphicPos; diff --git a/include/editeng/brushitem.hxx b/include/editeng/brushitem.hxx index d18882a..d05ee3b 100644 --- a/include/editeng/brushitem.hxx +++ b/include/editeng/brushitem.hxx @@ -122,6 +122,7 @@ public: static SvxGraphicPosition WallpaperStyle2GraphicPos( WallpaperStyle eStyle ); static WallpaperStyle GraphicPos2WallpaperStyle( SvxGraphicPosition ePos ); +static sal_Int8 TransparencyToPercent(sal_Int32 nTrans); }; #endif // #ifndef _SVX_BRSHITEM_HXX diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 5a0f8a0..69c3888 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -4864,8 +4864,7 @@ void DocxAttributeOutput::FormatBackground( const SvxBrushItem rBrush ) if (nTransparency) { // Convert transparency to percent -// Consider editeng/source/items/frmitems.cxx : lcl_TransparencyToPercent() function. -sal_Int8 nTransparencyPercent = (sal_Int8)((nTransparency * 100 + 127) / 254); +sal_Int8 nTransparencyPercent = SvxBrushItem::TransparencyToPercent(nTransparency); // Calculate alpha value // Consider oox/source/drawingml/color.cxx : getTransparency() function. ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits