From 1e2682235cded9a7cd90e55f0bfc60a1285e9a46 Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Thu, 18 Apr 2019 19:25:06 +0200 Subject: WIP: Further preparations for deeper Item changes (1) Migrated all still existing binary load/save stuff in SfxPoolItem to legacy files. Isolated from Item implementations. Adapted all usages. No more methods Create/Store needed, also GetVersion removed (2) Removed operator= for SfxPoolItem. Adapted all usages. Goal ist to handle Items more as Objects ('Object-Oriented') in the sense to move/handle instances, not to copy one instance over another one (which is more and more problematic with hard to copy content as UNO API stuff or similar). This lead to much more usages of std::shared_ptr which correlates well with future plans fr Items (see dev branch). Next logic step will be to also remove copy constructor Linux build and corrections done Fixed Writer test and removed unused defines Fixed another unused m,acro Started to unify the AutoFormat stuff Changes to OUString constructor usages, tests completely No idea why, but SfxStringItem constructor which takes a OUString& now insists of not getting ::OUString's handed in - changed all 'SfxStringItem.*OUString.*".*"' accordingly Change-Id: Ibed7358b18fb019994a7490332b9d797a6694c29 Reviewed-on: https://gerrit.libreoffice.org/71075 Tested-by: Jenkins Reviewed-by: Armin Le Grand --- sw/source/uibase/docvw/romenu.cxx | 20 ++++++++++---------- sw/source/uibase/docvw/romenu.hxx | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) (limited to 'sw/source/uibase/docvw') diff --git a/sw/source/uibase/docvw/romenu.cxx b/sw/source/uibase/docvw/romenu.cxx index 1b8c671ba411..185ff672d42f 100644 --- a/sw/source/uibase/docvw/romenu.cxx +++ b/sw/source/uibase/docvw/romenu.cxx @@ -106,7 +106,7 @@ SwReadOnlyPopup::SwReadOnlyPopup(const Point &rDPos, SwView &rV) , m_nReadonlyFullscreen(m_xMenu->GetItemId("fullscreen")) , m_nReadonlyCopy(m_xMenu->GetItemId("copy")) , m_rView(rV) - , m_aBrushItem(RES_BACKGROUND) + , m_aBrushItem(std::make_shared(RES_BACKGROUND)) { m_bGrfToGalleryAsLnk = SW_MOD()->GetModuleConfig()->IsGrfToGalleryAsLnk(); SwWrtShell &rSh = m_rView.GetWrtShell(); @@ -159,10 +159,10 @@ SwReadOnlyPopup::SwReadOnlyPopup(const Point &rDPos, SwView &rV) bool bEnableBackGallery = false, bEnableBack = false; - if ( GPOS_NONE != m_aBrushItem.GetGraphicPos() ) + if ( m_aBrushItem && GPOS_NONE != m_aBrushItem->GetGraphicPos() ) { bEnableBack = true; - if ( !m_aBrushItem.GetGraphicLink().isEmpty() ) + if ( !m_aBrushItem->GetGraphicLink().isEmpty() ) { if ( m_aThemeList.empty() ) GalleryExplorer::FillThemeList( m_aThemeList ); @@ -240,11 +240,11 @@ void SwReadOnlyPopup::Execute( vcl::Window* pWin, sal_uInt16 nId ) { OUString sTmp; sal_uInt16 nSaveId; - if (nId >= MN_READONLY_BACKGROUNDTOGALLERY) + if (m_aBrushItem && nId >= MN_READONLY_BACKGROUNDTOGALLERY) { nId -= MN_READONLY_BACKGROUNDTOGALLERY; nSaveId = m_nReadonlySaveBackground; - sTmp = m_aBrushItem.GetGraphicLink(); + sTmp = m_aBrushItem->GetGraphicLink(); } else { @@ -331,14 +331,14 @@ OUString SwReadOnlyPopup::SaveGraphic(sal_uInt16 nId) // fish out the graphic's name if (nId == m_nReadonlySaveBackground) { - if ( !m_aBrushItem.GetGraphicLink().isEmpty() ) - m_sGrfName = m_aBrushItem.GetGraphicLink(); - const Graphic *pGrf = m_aBrushItem.GetGraphic(); + if ( m_aBrushItem && !m_aBrushItem->GetGraphicLink().isEmpty() ) + m_sGrfName = m_aBrushItem->GetGraphicLink(); + const Graphic *pGrf = m_aBrushItem ? m_aBrushItem->GetGraphic() : nullptr; if ( pGrf ) { m_aGraphic = *pGrf; - if ( !m_aBrushItem.GetGraphicLink().isEmpty() ) - m_sGrfName = m_aBrushItem.GetGraphicLink(); + if ( !m_aBrushItem->GetGraphicLink().isEmpty() ) + m_sGrfName = m_aBrushItem->GetGraphicLink(); } else return OUString(); diff --git a/sw/source/uibase/docvw/romenu.hxx b/sw/source/uibase/docvw/romenu.hxx index 18a9bccd0f35..54df7fb8bb57 100644 --- a/sw/source/uibase/docvw/romenu.hxx +++ b/sw/source/uibase/docvw/romenu.hxx @@ -58,7 +58,7 @@ class SwReadOnlyPopup sal_uInt16 const m_nReadonlyCopy; SwView &m_rView; - SvxBrushItem m_aBrushItem; + std::shared_ptr m_aBrushItem; Graphic m_aGraphic; OUString m_sURL, m_sTargetFrameName; -- cgit