editeng/source/editeng/editdoc.cxx | 9 ++++++++- include/svl/itempool.hxx | 1 + svl/source/items/itempool.cxx | 15 +++++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-)
New commits: commit ec920ed0ecc9cb42b900138a299bf070dc86103c Author: Noel Grandin <noel.gran...@collabora.co.uk> Date: Fri Jan 5 11:10:36 2018 +0200 Revert "GetTrueSlotId is dead" This reverts commit 4f11182566b02f9f1c1821985a94b4b4de363fbb. Turns out I was wrong, there are tons of place defining slotid<->whichid mappings. Change-Id: I2a124ecba02c45f14ee917727adb993c39994881 Reviewed-on: https://gerrit.libreoffice.org/47454 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx index 0896b62af791..07a495d2bb1f 100644 --- a/editeng/source/editeng/editdoc.cxx +++ b/editeng/source/editeng/editdoc.cxx @@ -886,7 +886,14 @@ void ConvertAndPutItems( SfxItemSet& rDest, const SfxItemSet& rSource, const Map { // If possible go through SlotID ... - sal_uInt16 const nSourceWhich = nWhich; + sal_uInt16 nSourceWhich = nWhich; + sal_uInt16 nSlot = pDestPool->GetTrueSlotId( nWhich ); + if ( nSlot ) + { + sal_uInt16 nW = pSourcePool->GetTrueWhich( nSlot ); + if ( nW ) + nSourceWhich = nW; + } if ( rSource.GetItemState( nSourceWhich, false ) == SfxItemState::SET ) { diff --git a/include/svl/itempool.hxx b/include/svl/itempool.hxx index 5b1d8b9af27c..f4f5d86f3a08 100644 --- a/include/svl/itempool.hxx +++ b/include/svl/itempool.hxx @@ -186,6 +186,7 @@ public: sal_uInt16 GetWhich( sal_uInt16 nSlot, bool bDeep = true ) const; sal_uInt16 GetSlotId( sal_uInt16 nWhich ) const; sal_uInt16 GetTrueWhich( sal_uInt16 nSlot, bool bDeep = true ) const; + sal_uInt16 GetTrueSlotId( sal_uInt16 nWhich ) const; static bool IsWhich(sal_uInt16 nId) { return nId && nId <= SFX_WHICH_MAX; } diff --git a/svl/source/items/itempool.cxx b/svl/source/items/itempool.cxx index e82a5ea4a496..4357342dd499 100644 --- a/svl/source/items/itempool.cxx +++ b/svl/source/items/itempool.cxx @@ -939,6 +939,21 @@ sal_uInt16 SfxItemPool::GetTrueWhich( sal_uInt16 nSlotId, bool bDeep ) const } +sal_uInt16 SfxItemPool::GetTrueSlotId( sal_uInt16 nWhich ) const +{ + if ( !IsWhich(nWhich) ) + return 0; + + if ( !IsInRange( nWhich ) ) + { + if ( pImpl->mpSecondary ) + return pImpl->mpSecondary->GetTrueSlotId(nWhich); + assert(false && "unknown WhichId - cannot get slot-id"); + return 0; + } + return pItemInfos[nWhich - pImpl->mnStart]._nSID; +} + void SfxItemPool::dumpAsXml(xmlTextWriterPtr pWriter) const { xmlTextWriterStartElement(pWriter, BAD_CAST("SfxItemPool")); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits