diff options
Diffstat (limited to 'cui/source/tabpages/tpline.cxx')
-rw-r--r-- | cui/source/tabpages/tpline.cxx | 113 |
1 files changed, 57 insertions, 56 deletions
diff --git a/cui/source/tabpages/tpline.cxx b/cui/source/tabpages/tpline.cxx index e93b7bfa6310..1c1635293823 100644 --- a/cui/source/tabpages/tpline.cxx +++ b/cui/source/tabpages/tpline.cxx @@ -242,7 +242,7 @@ void SvxLineTabPage::FillListboxes() void SvxLineTabPage::ActivatePage( const SfxItemSet& rSet ) { - const CntUInt16Item* pPageTypeItem = rSet.GetItem<CntUInt16Item>(SID_PAGE_TYPE, false); + const SfxUInt16Item* pPageTypeItem = rSet.GetItem<SfxUInt16Item>(SID_PAGE_TYPE, false); if (pPageTypeItem) SetPageType(static_cast<PageType>(pPageTypeItem->GetValue())); if( m_nDlgType == 0 && m_pDashList.is() ) @@ -413,7 +413,7 @@ bool SvxLineTabPage::FillItemSet( SfxItemSet* rAttrs ) pOld = GetOldItem( *rAttrs, XATTR_LINESTYLE ); if ( !pOld || !( *static_cast<const XLineStyleItem*>(pOld) == *pStyleItem ) ) { - rAttrs->Put( *pStyleItem ); + rAttrs->Put( std::move(pStyleItem) ); bModified = true; } } @@ -456,8 +456,10 @@ bool SvxLineTabPage::FillItemSet( SfxItemSet* rAttrs ) // Line color if (m_xLbColor->IsValueChangedFromSaved()) { - NamedColor aColor = m_xLbColor->GetSelectedEntry(); - XLineColorItem aItem(aColor.second, aColor.first); + NamedColor aNamedColor = m_xLbColor->GetSelectedEntry(); + XLineColorItem aItem(aNamedColor.m_aName, aNamedColor.m_aColor); + aItem.setComplexColor(aNamedColor.getComplexColor()); + pOld = GetOldItem( *rAttrs, XATTR_LINECOLOR ); if ( !pOld || !( *static_cast<const XLineColorItem*>(pOld) == aItem ) ) { @@ -480,7 +482,7 @@ bool SvxLineTabPage::FillItemSet( SfxItemSet* rAttrs ) pOld = GetOldItem( *rAttrs, XATTR_LINESTART ); if( pItem && ( !pOld || *pOld != *pItem ) ) { - rAttrs->Put( *pItem ); + rAttrs->Put( std::move(pItem) ); bModified = true; } } @@ -497,7 +499,7 @@ bool SvxLineTabPage::FillItemSet( SfxItemSet* rAttrs ) if( pItem && ( !pOld || !( *static_cast<const XLineEndItem*>(pOld) == *pItem ) ) ) { - rAttrs->Put( *pItem ); + rAttrs->Put( std::move(pItem) ); bModified = true; } } @@ -575,7 +577,7 @@ bool SvxLineTabPage::FillItemSet( SfxItemSet* rAttrs ) if(!pOld || !(*static_cast<const XLineJointItem*>(pOld) == *pNew)) { - rAttrs->Put( *pNew ); + rAttrs->Put( std::move(pNew) ); bModified = true; } } @@ -612,7 +614,7 @@ bool SvxLineTabPage::FillItemSet( SfxItemSet* rAttrs ) if(!pOld || !(*static_cast<const XLineCapItem*>(pOld) == *pNew)) { - rAttrs->Put( *pNew ); + rAttrs->Put( std::move(pNew) ); bModified = true; } } @@ -621,8 +623,8 @@ bool SvxLineTabPage::FillItemSet( SfxItemSet* rAttrs ) if(m_nSymbolType!=SVX_SYMBOLTYPE_UNKNOWN || m_bNewSize) { // Was set by selection or the size is different - SvxSizeItem aSItem(rAttrs->GetPool()->GetWhich(SID_ATTR_SYMBOLSIZE),m_aSymbolSize); - const SfxPoolItem* pSOld = GetOldItem( *rAttrs, rAttrs->GetPool()->GetWhich(SID_ATTR_SYMBOLSIZE) ); + SvxSizeItem aSItem(rAttrs->GetPool()->GetWhichIDFromSlotID(SID_ATTR_SYMBOLSIZE),m_aSymbolSize); + const SfxPoolItem* pSOld = GetOldItem( *rAttrs, rAttrs->GetPool()->GetWhichIDFromSlotID(SID_ATTR_SYMBOLSIZE) ); m_bNewSize = pSOld ? *static_cast<const SvxSizeItem *>(pSOld) != aSItem : m_bNewSize ; if(m_bNewSize) { @@ -630,8 +632,8 @@ bool SvxLineTabPage::FillItemSet( SfxItemSet* rAttrs ) bModified=true; } - SfxInt32Item aTItem(rAttrs->GetPool()->GetWhich(SID_ATTR_SYMBOLTYPE),m_nSymbolType); - const SfxPoolItem* pTOld = GetOldItem( *rAttrs, rAttrs->GetPool()->GetWhich(SID_ATTR_SYMBOLTYPE) ); + SfxInt32Item aTItem(rAttrs->GetPool()->GetWhichIDFromSlotID(SID_ATTR_SYMBOLTYPE),m_nSymbolType); + const SfxPoolItem* pTOld = GetOldItem( *rAttrs, rAttrs->GetPool()->GetWhichIDFromSlotID(SID_ATTR_SYMBOLTYPE) ); bool bNewType = pTOld == nullptr || *static_cast<const SfxInt32Item*>(pTOld) != aTItem; if(bNewType && m_nSymbolType==SVX_SYMBOLTYPE_UNKNOWN) bNewType=false; // a small fix, type wasn't set -> don't create a type item after all! @@ -643,8 +645,8 @@ bool SvxLineTabPage::FillItemSet( SfxItemSet* rAttrs ) if(m_nSymbolType!=SVX_SYMBOLTYPE_NONE) { - SvxBrushItem aBItem(m_aSymbolGraphic,GPOS_MM,rAttrs->GetPool()->GetWhich(SID_ATTR_BRUSH)); - const SfxPoolItem* pBOld = GetOldItem( *rAttrs, rAttrs->GetPool()->GetWhich(SID_ATTR_BRUSH) ); + SvxBrushItem aBItem(m_aSymbolGraphic,GPOS_MM,rAttrs->GetPool()->GetWhichIDFromSlotID(SID_ATTR_BRUSH)); + const SfxPoolItem* pBOld = GetOldItem( *rAttrs, rAttrs->GetPool()->GetWhichIDFromSlotID(SID_ATTR_BRUSH) ); bool bNewBrush = pBOld == nullptr || *static_cast<const SvxBrushItem*>(pBOld) != aBItem; if(bNewBrush) @@ -758,8 +760,10 @@ void SvxLineTabPage::FillXLSet_Impl() m_rXLSet.Put( XLineEndWidthItem( GetCoreValue( *m_xMtrEndWidth, m_ePoolUnit ) ) ); m_rXLSet.Put( XLineWidthItem( GetCoreValue( *m_xMtrLineWidth, m_ePoolUnit ) ) ); - NamedColor aColor = m_xLbColor->GetSelectedEntry(); - m_rXLSet.Put(XLineColorItem(aColor.second, aColor.first)); + NamedColor aNamedColor = m_xLbColor->GetSelectedEntry(); + XLineColorItem aLineColor(aNamedColor.m_aName, aNamedColor.m_aColor); + aLineColor.setComplexColor(aNamedColor.getComplexColor()); + m_rXLSet.Put(aLineColor); // Centered line end if( m_xTsbCenterStart->get_state() == TRISTATE_TRUE ) @@ -785,15 +789,14 @@ void SvxLineTabPage::Reset( const SfxItemSet* rAttrs ) drawing::LineStyle eXLS; // drawing::LineStyle_NONE, drawing::LineStyle_SOLID, drawing::LineStyle_DASH // Line style - const SfxPoolItem *pPoolItem; tools::Long nSymType=SVX_SYMBOLTYPE_UNKNOWN; bool bPrevSym=false; bool bEnable=true; bool bIgnoreGraphic=false; bool bIgnoreSize=false; - if(rAttrs->GetItemState(rAttrs->GetPool()->GetWhich(SID_ATTR_SYMBOLTYPE),true,&pPoolItem) == SfxItemState::SET) + if(const SfxInt32Item* pSymbolTypeItem = rAttrs->GetItemIfSet(rAttrs->GetPool()->GetWhichIDFromSlotID(SID_ATTR_SYMBOLTYPE))) { - nSymType=static_cast<const SfxInt32Item *>(pPoolItem)->GetValue(); + nSymType = pSymbolTypeItem->GetValue(); } if(nSymType == SVX_SYMBOLTYPE_AUTO) @@ -815,7 +818,6 @@ void SvxLineTabPage::Reset( const SfxItemSet* rAttrs ) std::unique_ptr<SdrModel> pModel( new SdrModel(nullptr, nullptr, true)); - pModel->GetItemPool().FreezeIdRanges(); rtl::Reference<SdrPage> pPage = new SdrPage( *pModel, false ); pPage->SetSize(Size(1000,1000)); pModel->InsertPage( pPage.get(), 0 ); @@ -829,7 +831,7 @@ void SvxLineTabPage::Reset( const SfxItemSet* rAttrs ) if(m_pSymbolList->GetObjCount()) { nSymTmp %= m_pSymbolList->GetObjCount(); // Treat list as cyclic! - SdrObject *pObj=m_pSymbolList->GetObj(nSymTmp); + rtl::Reference<SdrObject> pObj=m_pSymbolList->GetObj(nSymTmp); if(pObj) { // directly clone to target SdrModel @@ -844,16 +846,16 @@ void SvxLineTabPage::Reset( const SfxItemSet* rAttrs ) pObj->SetMergedItemSet(m_rOutAttrs); } - pPage->NbcInsertObject(pObj); + pPage->NbcInsertObject(pObj.get()); // Generate invisible square to give all symbol types a // bitmap size, which is independent from specific glyph - SdrObject* pInvisibleSquare(m_pSymbolList->GetObj(0)); + rtl::Reference<SdrObject> pInvisibleSquare(m_pSymbolList->GetObj(0)); // directly clone to target SdrModel pInvisibleSquare = pInvisibleSquare->CloneSdrObject(*pModel); - pPage->NbcInsertObject(pInvisibleSquare); + pPage->NbcInsertObject(pInvisibleSquare.get()); pInvisibleSquare->SetMergedItem(XFillTransparenceItem(100)); pInvisibleSquare->SetMergedItem(XLineTransparenceItem(100)); @@ -869,18 +871,18 @@ void SvxLineTabPage::Reset( const SfxItemSet* rAttrs ) bIgnoreGraphic=true; aView.UnmarkAll(); - pInvisibleSquare=pPage->RemoveObject(1); - SdrObject::Free( pInvisibleSquare); - pObj=pPage->RemoveObject(0); - SdrObject::Free( pObj ); + pPage->RemoveObject(1); + pInvisibleSquare.clear(); + pPage->RemoveObject(0); + pObj.clear(); } } } } } - if(rAttrs->GetItemState(rAttrs->GetPool()->GetWhich(SID_ATTR_BRUSH),true,&pPoolItem) == SfxItemState::SET) + if(const SvxBrushItem* pBrushItem = rAttrs->GetItemIfSet(rAttrs->GetPool()->GetWhichIDFromSlotID(SID_ATTR_BRUSH))) { - const Graphic* pGraphic = static_cast<const SvxBrushItem *>(pPoolItem)->GetGraphic(); + const Graphic* pGraphic = pBrushItem->GetGraphic(); if( pGraphic ) { if(!bIgnoreGraphic) @@ -897,9 +899,9 @@ void SvxLineTabPage::Reset( const SfxItemSet* rAttrs ) } } - if(rAttrs->GetItemState(rAttrs->GetPool()->GetWhich(SID_ATTR_SYMBOLSIZE),true,&pPoolItem) == SfxItemState::SET) + if(const SvxSizeItem* pSymbolSizeItem = rAttrs->GetItemIfSet(rAttrs->GetPool()->GetWhichIDFromSlotID(SID_ATTR_SYMBOLSIZE))) { - m_aSymbolSize = static_cast<const SvxSizeItem *>(pPoolItem)->GetSize(); + m_aSymbolSize = pSymbolSizeItem->GetSize(); } m_xGridIconSize->set_sensitive(bEnable); @@ -912,7 +914,7 @@ void SvxLineTabPage::Reset( const SfxItemSet* rAttrs ) m_aSymbolLastSize=m_aSymbolSize; } - if( rAttrs->GetItemState( XATTR_LINESTYLE ) != SfxItemState::DONTCARE ) + if( rAttrs->GetItemState( XATTR_LINESTYLE ) != SfxItemState::INVALID ) { eXLS = rAttrs->Get( XATTR_LINESTYLE ).GetValue(); @@ -940,7 +942,7 @@ void SvxLineTabPage::Reset( const SfxItemSet* rAttrs ) } // Line strength - if( rAttrs->GetItemState( XATTR_LINEWIDTH ) != SfxItemState::DONTCARE ) + if( rAttrs->GetItemState( XATTR_LINEWIDTH ) != SfxItemState::INVALID ) { SetMetricValue( *m_xMtrLineWidth, rAttrs->Get( XATTR_LINEWIDTH ).GetValue(), m_ePoolUnit ); } @@ -950,7 +952,7 @@ void SvxLineTabPage::Reset( const SfxItemSet* rAttrs ) // Line color m_xLbColor->SetNoSelection(); - if ( rAttrs->GetItemState( XATTR_LINECOLOR ) != SfxItemState::DONTCARE ) + if ( rAttrs->GetItemState( XATTR_LINECOLOR ) != SfxItemState::INVALID ) { Color aCol = rAttrs->Get( XATTR_LINECOLOR ).GetColorValue(); m_xLbColor->SelectEntry( aCol ); @@ -961,7 +963,7 @@ void SvxLineTabPage::Reset( const SfxItemSet* rAttrs ) { m_xLbStartStyle->set_sensitive(false); } - else if( rAttrs->GetItemState( XATTR_LINESTART ) != SfxItemState::DONTCARE ) + else if( rAttrs->GetItemState( XATTR_LINESTART ) != SfxItemState::INVALID ) { // #86265# select entry using list and polygon, not string bool bSelected(false); @@ -993,7 +995,7 @@ void SvxLineTabPage::Reset( const SfxItemSet* rAttrs ) { m_xLbEndStyle->set_sensitive(false); } - else if( rAttrs->GetItemState( XATTR_LINEEND ) != SfxItemState::DONTCARE ) + else if( rAttrs->GetItemState( XATTR_LINEEND ) != SfxItemState::INVALID ) { // #86265# select entry using list and polygon, not string bool bSelected(false); @@ -1025,7 +1027,7 @@ void SvxLineTabPage::Reset( const SfxItemSet* rAttrs ) { m_xMtrStartWidth->set_sensitive(false); } - else if( rAttrs->GetItemState( XATTR_LINESTARTWIDTH ) != SfxItemState::DONTCARE ) + else if( rAttrs->GetItemState( XATTR_LINESTARTWIDTH ) != SfxItemState::INVALID ) { SetMetricValue( *m_xMtrStartWidth, rAttrs->Get( XATTR_LINESTARTWIDTH ).GetValue(), @@ -1039,7 +1041,7 @@ void SvxLineTabPage::Reset( const SfxItemSet* rAttrs ) { m_xMtrEndWidth->set_sensitive(false); } - else if( rAttrs->GetItemState( XATTR_LINEENDWIDTH ) != SfxItemState::DONTCARE ) + else if( rAttrs->GetItemState( XATTR_LINEENDWIDTH ) != SfxItemState::INVALID ) { SetMetricValue( *m_xMtrEndWidth, rAttrs->Get( XATTR_LINEENDWIDTH ).GetValue(), @@ -1053,7 +1055,7 @@ void SvxLineTabPage::Reset( const SfxItemSet* rAttrs ) { m_xTsbCenterStart->set_sensitive(false); } - else if( rAttrs->GetItemState( XATTR_LINESTARTCENTER ) != SfxItemState::DONTCARE ) + else if( rAttrs->GetItemState( XATTR_LINESTARTCENTER ) != SfxItemState::INVALID ) { if( rAttrs->Get( XATTR_LINESTARTCENTER ).GetValue() ) m_xTsbCenterStart->set_state(TRISTATE_TRUE); @@ -1070,7 +1072,7 @@ void SvxLineTabPage::Reset( const SfxItemSet* rAttrs ) { m_xTsbCenterEnd->set_sensitive(false); } - else if( rAttrs->GetItemState( XATTR_LINEENDCENTER ) != SfxItemState::DONTCARE ) + else if( rAttrs->GetItemState( XATTR_LINEENDCENTER ) != SfxItemState::INVALID ) { if( rAttrs->Get( XATTR_LINEENDCENTER ).GetValue() ) m_xTsbCenterEnd->set_state(TRISTATE_TRUE); @@ -1083,7 +1085,7 @@ void SvxLineTabPage::Reset( const SfxItemSet* rAttrs ) } // Transparency - if( rAttrs->GetItemState( XATTR_LINETRANSPARENCE ) != SfxItemState::DONTCARE ) + if( rAttrs->GetItemState( XATTR_LINETRANSPARENCE ) != SfxItemState::INVALID ) { sal_uInt16 nTransp = rAttrs->Get( XATTR_LINETRANSPARENCE ).GetValue(); m_xMtrTransparent->set_value(nTransp, FieldUnit::PERCENT); @@ -1113,7 +1115,7 @@ void SvxLineTabPage::Reset( const SfxItemSet* rAttrs ) // maFTEdgeStyle.set_sensitive(false); m_xLBEdgeStyle->set_sensitive(false); } - else if(SfxItemState::DONTCARE != rAttrs->GetItemState(XATTR_LINEJOINT)) + else if(SfxItemState::INVALID != rAttrs->GetItemState(XATTR_LINEJOINT)) { const css::drawing::LineJoint eLineJoint = rAttrs->Get(XATTR_LINEJOINT).GetValue(); @@ -1137,7 +1139,7 @@ void SvxLineTabPage::Reset( const SfxItemSet* rAttrs ) { m_xLBCapStyle->set_sensitive(false); } - else if(SfxItemState::DONTCARE != rAttrs->GetItemState(XATTR_LINECAP)) + else if(SfxItemState::INVALID != rAttrs->GetItemState(XATTR_LINECAP)) { const css::drawing::LineCap eLineCap(rAttrs->Get(XATTR_LINECAP).GetValue()); @@ -1443,7 +1445,6 @@ IMPL_LINK_NOARG(SvxLineTabPage, MenuCreateHdl_Impl, weld::Toggleable&, void) pVDev->SetMapMode(MapMode(MapUnit::Map100thMM)); std::unique_ptr<SdrModel> pModel( new SdrModel(nullptr, nullptr, true)); - pModel->GetItemPool().FreezeIdRanges(); // Page rtl::Reference<SdrPage> pPage = new SdrPage( *pModel, false ); pPage->SetSize(Size(1000,1000)); @@ -1456,25 +1457,25 @@ IMPL_LINK_NOARG(SvxLineTabPage, MenuCreateHdl_Impl, weld::Toggleable&, void) // Generate invisible square to give all symbols a // bitmap size, which is independent from specific glyph - SdrObject *pInvisibleSquare=m_pSymbolList->GetObj(0); + rtl::Reference<SdrObject> pInvisibleSquare=m_pSymbolList->GetObj(0); // directly clone to target SdrModel pInvisibleSquare = pInvisibleSquare->CloneSdrObject(*pModel); - pPage->NbcInsertObject(pInvisibleSquare); + pPage->NbcInsertObject(pInvisibleSquare.get()); pInvisibleSquare->SetMergedItem(XFillTransparenceItem(100)); pInvisibleSquare->SetMergedItem(XLineTransparenceItem(100)); for(size_t i=0; i < m_pSymbolList->GetObjCount(); ++i) { - SdrObject *pObj=m_pSymbolList->GetObj(i); + rtl::Reference<SdrObject> pObj=m_pSymbolList->GetObj(i); assert(pObj); // directly clone to target SdrModel pObj = pObj->CloneSdrObject(*pModel); m_aGrfNames.emplace_back(""); - pPage->NbcInsertObject(pObj); + pPage->NbcInsertObject(pObj.get()); if(m_xSymbolAttr) { pObj->SetMergedItemSet(*m_xSymbolAttr); @@ -1487,8 +1488,8 @@ IMPL_LINK_NOARG(SvxLineTabPage, MenuCreateHdl_Impl, weld::Toggleable&, void) BitmapEx aBitmapEx(aView.GetMarkedObjBitmapEx()); GDIMetaFile aMeta(aView.GetMarkedObjMetaFile()); aView.UnmarkAll(); - pObj=pPage->RemoveObject(1); - SdrObject::Free(pObj); + pPage->RemoveObject(1); + pObj.clear(); SvxBmpItemInfo* pInfo = new SvxBmpItemInfo; pInfo->pBrushItem.reset(new SvxBrushItem(Graphic(aMeta), GPOS_AREA, SID_ATTR_BRUSH)); @@ -1508,8 +1509,8 @@ IMPL_LINK_NOARG(SvxLineTabPage, MenuCreateHdl_Impl, weld::Toggleable&, void) pVD->DrawBitmapEx(Point(), aBitmapEx); m_xSymbolsMenu->append(pInfo->sItemId, "", *pVD); } - pInvisibleSquare=pPage->RemoveObject(0); - SdrObject::Free(pInvisibleSquare); + pPage->RemoveObject(0); + pInvisibleSquare.clear(); if (m_aGrfNames.empty()) m_xSymbolMB->set_item_sensitive("symbols", false); @@ -1518,7 +1519,7 @@ IMPL_LINK_NOARG(SvxLineTabPage, MenuCreateHdl_Impl, weld::Toggleable&, void) // #58425# Symbols on a list (e.g. StarChart) // Handler for menu button -IMPL_LINK(SvxLineTabPage, GraphicHdl_Impl, const OString&, rIdent, void) +IMPL_LINK(SvxLineTabPage, GraphicHdl_Impl, const OUString&, rIdent, void) { const Graphic* pGraphic = nullptr; Graphic aGraphic; @@ -1526,7 +1527,7 @@ IMPL_LINK(SvxLineTabPage, GraphicHdl_Impl, const OString&, rIdent, void) bool bEnable = true; tools::Long nPreviousSymbolType = m_nSymbolType; - OString sNumber; + OUString sNumber; if (rIdent.startsWith("gallery", &sNumber)) { SvxBmpItemInfo* pInfo = m_aGalleryBrushItems[sNumber.toUInt32()].get(); @@ -1553,7 +1554,7 @@ IMPL_LINK(SvxLineTabPage, GraphicHdl_Impl, const OString&, rIdent, void) } else if (rIdent == "file") { - SvxOpenGraphicDialog aGrfDlg(CuiResId(RID_SVXSTR_EDIT_GRAPHIC), GetFrameWeld()); + SvxOpenGraphicDialog aGrfDlg(CuiResId(RID_CUISTR_EDIT_GRAPHIC), GetFrameWeld()); aGrfDlg.EnableLink(false); aGrfDlg.AsLink(false); if( !aGrfDlg.Execute() ) |