diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-09-30 17:42:47 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-10-01 18:46:21 +0200 |
commit | 0d1df8d5ea2ee25903044d7cb72d00a721a1b902 (patch) | |
tree | b80e43a012428ba0c67129bfe9e74d211bf1fa51 /cui/source/tabpages/tpline.cxx | |
parent | 38bef03742c94376a974f84693ff2e48693e6839 (diff) |
weld SvxLineTabPage
Change-Id: I91d7ec8a51ce935db40c57feeeed7b160cf4dad8
Reviewed-on: https://gerrit.libreoffice.org/61172
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'cui/source/tabpages/tpline.cxx')
-rw-r--r-- | cui/source/tabpages/tpline.cxx | 1246 |
1 files changed, 574 insertions, 672 deletions
diff --git a/cui/source/tabpages/tpline.cxx b/cui/source/tabpages/tpline.cxx index d7d6d12de777..053389519570 100644 --- a/cui/source/tabpages/tpline.cxx +++ b/cui/source/tabpages/tpline.cxx @@ -57,12 +57,6 @@ #define MAX_BMP_WIDTH 16 #define MAX_BMP_HEIGHT 16 -#define MN_GALLERY 4 -#define MN_SYMBOLS 5 -#define MN_SYMBOLS_NONE 1 -#define MN_SYMBOLS_AUTO 2 -#define MN_GALLERY_ENTRY 100 - using namespace com::sun::star; // static ---------------------------------------------------------------- @@ -76,75 +70,58 @@ const sal_uInt16 SvxLineTabPage::pLineRanges[] = 0 }; -SvxLineTabPage::SvxLineTabPage -( - vcl::Window* pParent, - const SfxItemSet& rInAttrs -) : - SfxTabPage ( pParent - ,"LineTabPage" - ,"cui/ui/linetabpage.ui" - , &rInAttrs ), - - m_pSymbolList(nullptr), - m_bNewSize(false), - m_nNumMenuGalleryItems(0), - m_nSymbolType(SVX_SYMBOLTYPE_UNKNOWN), // unknown respectively unchanged - m_pSymbolAttr(nullptr), - - m_bLastWidthModified(false), - m_aSymbolLastSize(Size(0,0)), - m_bSymbols(false), - - m_rOutAttrs ( rInAttrs ), - m_bObjSelected( false ), - - m_aXLineAttr ( rInAttrs.GetPool() ), - m_rXLSet ( m_aXLineAttr.GetItemSet() ), - m_pnLineEndListState( nullptr ), - m_pnDashListState( nullptr ), - m_pnColorListState( nullptr ), - m_nPageType( PageType::Area ), - - m_nDlgType(0), - m_pPosDashLb(nullptr), - m_pPosLineEndLb(nullptr) +SvxLineTabPage::SvxLineTabPage(TabPageParent pParent, const SfxItemSet& rInAttrs) + : SfxTabPage(pParent, "cui/ui/linetabpage.ui", "SvxLineTabPage", &rInAttrs) + , m_pSymbolList(nullptr) + , m_bNewSize(false) + , m_nNumMenuGalleryItems(0) + , m_nSymbolType(SVX_SYMBOLTYPE_UNKNOWN) // unknown respectively unchanged + , m_pSymbolAttr(nullptr) + , m_bLastWidthModified(false) + , m_aSymbolLastSize(Size(0,0)) + , m_bSymbols(false) + , m_rOutAttrs(rInAttrs) + , m_bObjSelected(false) + , m_aXLineAttr(rInAttrs.GetPool()) + , m_rXLSet(m_aXLineAttr.GetItemSet()) + , m_pnLineEndListState(nullptr) + , m_pnDashListState(nullptr) + , m_pnColorListState(nullptr) + , m_nPageType(PageType::Area) + , m_nDlgType(0) + , m_pPosDashLb(nullptr) + , m_pPosLineEndLb(nullptr) + , m_xBoxColor(m_xBuilder->weld_widget("boxCOLOR")) + , m_xLbLineStyle(new SvxLineLB(m_xBuilder->weld_combo_box("LB_LINE_STYLE"))) + , m_xLbColor(new ColorListBox(m_xBuilder->weld_menu_button("LB_COLOR"), pParent.GetFrameWeld())) + , m_xBoxWidth(m_xBuilder->weld_widget("boxWIDTH")) + , m_xMtrLineWidth(m_xBuilder->weld_metric_spin_button("MTR_FLD_LINE_WIDTH", FUNIT_CM)) + , m_xBoxTransparency(m_xBuilder->weld_widget("boxTRANSPARENCY")) + , m_xMtrTransparent(m_xBuilder->weld_metric_spin_button("MTR_LINE_TRANSPARENT", FUNIT_PERCENT)) + , m_xFlLineEnds(m_xBuilder->weld_widget("FL_LINE_ENDS")) + , m_xBoxArrowStyles(m_xBuilder->weld_widget("boxARROW_STYLES")) + , m_xLbStartStyle(new SvxLineEndLB(m_xBuilder->weld_combo_box("LB_START_STYLE"))) + , m_xBoxStart(m_xBuilder->weld_widget("boxSTART")) + , m_xMtrStartWidth(m_xBuilder->weld_metric_spin_button("MTR_FLD_START_WIDTH", FUNIT_CM)) + , m_xTsbCenterStart(m_xBuilder->weld_check_button("TSB_CENTER_START")) + , m_xBoxEnd(m_xBuilder->weld_widget("boxEND")) + , m_xLbEndStyle(new SvxLineEndLB(m_xBuilder->weld_combo_box("LB_END_STYLE"))) + , m_xMtrEndWidth(m_xBuilder->weld_metric_spin_button("MTR_FLD_END_WIDTH", FUNIT_CM)) + , m_xTsbCenterEnd(m_xBuilder->weld_check_button("TSB_CENTER_END")) + , m_xCbxSynchronize(m_xBuilder->weld_check_button("CBX_SYNCHRONIZE")) + , m_xMenu(m_xBuilder->weld_menu("menuSELECT")) + , m_xCtlPreview(new weld::CustomWeld(*m_xBuilder, "CTL_PREVIEW", m_aCtlPreview)) + , m_xFLEdgeStyle(m_xBuilder->weld_widget("FL_EDGE_STYLE")) + , m_xGridEdgeCaps(m_xBuilder->weld_widget("gridEDGE_CAPS")) + , m_xLBEdgeStyle(m_xBuilder->weld_combo_box("LB_EDGE_STYLE")) + , m_xLBCapStyle(m_xBuilder->weld_combo_box("LB_CAP_STYLE")) // LineCaps + , m_xFlSymbol(m_xBuilder->weld_widget("FL_SYMBOL_FORMAT")) //#58425# Symbols on a line (e.g. StarChart) + , m_xGridIconSize(m_xBuilder->weld_widget("gridICON_SIZE")) + , m_xSymbolMB(m_xBuilder->weld_menu_button("MB_SYMBOL_BITMAP")) + , m_xSymbolWidthMF(m_xBuilder->weld_metric_spin_button("MF_SYMBOL_WIDTH", FUNIT_CM)) + , m_xSymbolHeightMF(m_xBuilder->weld_metric_spin_button("MF_SYMBOL_HEIGHT", FUNIT_CM)) + , m_xSymbolRatioCB(m_xBuilder->weld_check_button("CB_SYMBOL_RATIO")) { - get(m_pLbLineStyle,"LB_LINE_STYLE"); - get(m_pBoxColor,"boxCOLOR"); - get(m_pLbColor,"LB_COLOR"); - get(m_pBoxWidth,"boxWIDTH"); - get(m_pMtrLineWidth,"MTR_FLD_LINE_WIDTH"); - get(m_pBoxTransparency,"boxTRANSPARENCY"); - get(m_pMtrTransparent,"MTR_LINE_TRANSPARENT"); - - get(m_pFlLineEnds,"FL_LINE_ENDS"); - get(m_pBoxArrowStyles,"boxARROW_STYLES"); - get(m_pLbStartStyle,"LB_START_STYLE"); - get(m_pBoxStart,"boxSTART"); - get(m_pMtrStartWidth,"MTR_FLD_START_WIDTH"); - get(m_pTsbCenterStart,"TSB_CENTER_START"); - get(m_pBoxEnd,"boxEND"); - get(m_pLbEndStyle,"LB_END_STYLE"); - get(m_pMtrEndWidth,"MTR_FLD_END_WIDTH"); - get(m_pTsbCenterEnd,"TSB_CENTER_END"); - get(m_pCbxSynchronize,"CBX_SYNCHRONIZE"); - get(m_pCtlPreview,"CTL_PREVIEW"); - - get(m_pGridEdgeCaps,"gridEDGE_CAPS"); - get(m_pFLEdgeStyle,"FL_EDGE_STYLE"); - get(m_pLBEdgeStyle,"LB_EDGE_STYLE"); - // LineCaps - get(m_pLBCapStyle,"LB_CAP_STYLE"); - - //#58425# Symbols on a line (e.g. StarChart) - get(m_pFlSymbol,"FL_SYMBOL_FORMAT"); - get(m_pGridIconSize,"gridICON_SIZE"); - get(m_pSymbolMB,"MB_SYMBOL_BITMAP"); - get(m_pSymbolWidthMF,"MF_SYMBOL_WIDTH"); - get(m_pSymbolHeightMF,"MF_SYMBOL_HEIGHT"); - get(m_pSymbolRatioCB,"CB_SYMBOL_RATIO"); - // This Page requires ExchangeSupport SetExchangeSupport(); @@ -158,54 +135,53 @@ SvxLineTabPage::SvxLineTabPage eFUnit = FUNIT_MM; SAL_FALLTHROUGH; // we now have mm case FUNIT_MM: - m_pMtrLineWidth->SetSpinSize( 50 ); - m_pMtrStartWidth->SetSpinSize( 50 ); - m_pMtrEndWidth->SetSpinSize( 50 ); + m_xMtrLineWidth->set_increments(50, 500, FUNIT_NONE); + m_xMtrStartWidth->set_increments(50, 500, FUNIT_NONE); + m_xMtrEndWidth->set_increments(50, 500, FUNIT_NONE); break; case FUNIT_INCH: - m_pMtrLineWidth->SetSpinSize( 2 ); - m_pMtrStartWidth->SetSpinSize( 2 ); - m_pMtrEndWidth->SetSpinSize( 2 ); + m_xMtrLineWidth->set_increments(2, 20, FUNIT_NONE); + m_xMtrStartWidth->set_increments(2, 20, FUNIT_NONE); + m_xMtrEndWidth->set_increments(2, 20, FUNIT_NONE); break; default: ;// prevent warning } - SetFieldUnit( *m_pMtrLineWidth, eFUnit ); - SetFieldUnit( *m_pMtrStartWidth, eFUnit ); - SetFieldUnit( *m_pMtrEndWidth, eFUnit ); + SetFieldUnit( *m_xMtrLineWidth, eFUnit ); + SetFieldUnit( *m_xMtrStartWidth, eFUnit ); + SetFieldUnit( *m_xMtrEndWidth, eFUnit ); // determine PoolUnit SfxItemPool* pPool = m_rOutAttrs.GetPool(); DBG_ASSERT( pPool, "Where is the pool?" ); m_ePoolUnit = pPool->GetMetric( SID_ATTR_LINE_WIDTH ); - m_pLbLineStyle->SetSelectHdl( LINK( this, SvxLineTabPage, ClickInvisibleHdl_Impl ) ); - m_pLbColor->SetSelectHdl( LINK( this, SvxLineTabPage, ChangePreviewListBoxHdl_Impl ) ); - m_pMtrLineWidth->SetModifyHdl( LINK( this, SvxLineTabPage, ChangePreviewModifyHdl_Impl ) ); - m_pMtrTransparent->SetModifyHdl( LINK( this, SvxLineTabPage, ChangeTransparentHdl_Impl ) ); + m_xLbLineStyle->connect_changed(LINK(this, SvxLineTabPage, ClickInvisibleHdl_Impl)); + m_xLbColor->SetSelectHdl( LINK( this, SvxLineTabPage, ChangePreviewListBoxHdl_Impl ) ); + m_xMtrLineWidth->connect_value_changed(LINK(this, SvxLineTabPage, ChangePreviewModifyHdl_Impl)); + m_xMtrTransparent->connect_value_changed(LINK( this, SvxLineTabPage, ChangeTransparentHdl_Impl)); - m_pLbStartStyle->SetSelectHdl( LINK( this, SvxLineTabPage, ChangeStartListBoxHdl_Impl ) ); - m_pLbEndStyle->SetSelectHdl( LINK( this, SvxLineTabPage, ChangeEndListBoxHdl_Impl ) ); - m_pMtrStartWidth->SetModifyHdl( LINK( this, SvxLineTabPage, ChangeStartModifyHdl_Impl ) ); - m_pMtrEndWidth->SetModifyHdl( LINK( this, SvxLineTabPage, ChangeEndModifyHdl_Impl ) ); - m_pTsbCenterStart->SetClickHdl( LINK( this, SvxLineTabPage, ChangeStartClickHdl_Impl ) ); - m_pTsbCenterEnd->SetClickHdl( LINK( this, SvxLineTabPage, ChangeEndClickHdl_Impl ) ); + m_xLbStartStyle->connect_changed(LINK(this, SvxLineTabPage, ChangeStartListBoxHdl_Impl)); + m_xLbEndStyle->connect_changed(LINK(this, SvxLineTabPage, ChangeEndListBoxHdl_Impl)); + m_xMtrStartWidth->connect_value_changed(LINK(this, SvxLineTabPage, ChangeStartModifyHdl_Impl)); + m_xMtrEndWidth->connect_value_changed(LINK( this, SvxLineTabPage, ChangeEndModifyHdl_Impl)); + m_xTsbCenterStart->connect_clicked(LINK(this, SvxLineTabPage, ChangeStartClickHdl_Impl)); + m_xTsbCenterEnd->connect_clicked(LINK(this, SvxLineTabPage, ChangeEndClickHdl_Impl)); - Link<ListBox&,void> aEdgeStyle = LINK( this, SvxLineTabPage, ChangeEdgeStyleHdl_Impl ); - m_pLBEdgeStyle->SetSelectHdl( aEdgeStyle ); + Link<weld::ComboBox&,void> aEdgeStyle = LINK(this, SvxLineTabPage, ChangeEdgeStyleHdl_Impl); + m_xLBEdgeStyle->connect_changed(aEdgeStyle); // LineCaps - Link<ListBox&,void> aCapStyle = LINK( this, SvxLineTabPage, ChangeCapStyleHdl_Impl ); - m_pLBCapStyle->SetSelectHdl( aCapStyle ); + Link<weld::ComboBox&,void> aCapStyle = LINK(this, SvxLineTabPage, ChangeCapStyleHdl_Impl); + m_xLBCapStyle->connect_changed(aCapStyle); // Symbols on a line (eg star charts), MB-handler set - m_pSymbolMB->SetSelectHdl(LINK(this, SvxLineTabPage, GraphicHdl_Impl)); - m_pSymbolMB->SetActivateHdl(LINK(this, SvxLineTabPage, MenuCreateHdl_Impl)); - m_pSymbolWidthMF->SetModifyHdl(LINK(this, SvxLineTabPage, SizeHdl_Impl)); - m_pSymbolHeightMF->SetModifyHdl(LINK(this, SvxLineTabPage, SizeHdl_Impl)); - m_pSymbolRatioCB->SetClickHdl(LINK(this, SvxLineTabPage, RatioHdl_Impl)); + m_xSymbolMB->connect_selected(LINK(this, SvxLineTabPage, GraphicHdl_Impl)); + m_xSymbolWidthMF->connect_value_changed(LINK(this, SvxLineTabPage, SizeHdl_Impl)); + m_xSymbolHeightMF->connect_value_changed(LINK(this, SvxLineTabPage, SizeHdl_Impl)); + m_xSymbolRatioCB->connect_toggled(LINK(this, SvxLineTabPage, RatioHdl_Impl)); - m_pSymbolRatioCB->Check(); + m_xSymbolRatioCB->set_active(true); ShowSymbolControls(false); m_nActLineWidth = -1; @@ -216,8 +192,10 @@ void SvxLineTabPage::ShowSymbolControls(bool bOn) // Symbols on a line (e.g. StarCharts), symbol-enable controls m_bSymbols=bOn; - m_pFlSymbol->Show(bOn); - m_pCtlPreview->ShowSymbol(bOn); + m_xFlSymbol->show(bOn); + if (bOn) + MenuCreate(); + m_aCtlPreview.ShowSymbol(bOn); } SvxLineTabPage::~SvxLineTabPage() @@ -227,37 +205,14 @@ SvxLineTabPage::~SvxLineTabPage() void SvxLineTabPage::dispose() { - m_aGrfBrushItems.clear(); - - m_pBoxColor.clear(); - m_pLbLineStyle.clear(); - m_pLbColor.clear(); - m_pBoxWidth.clear(); - m_pMtrLineWidth.clear(); - m_pBoxTransparency.clear(); - m_pMtrTransparent.clear(); - m_pFlLineEnds.clear(); - m_pBoxArrowStyles.clear(); - m_pLbStartStyle.clear(); - m_pBoxStart.clear(); - m_pMtrStartWidth.clear(); - m_pTsbCenterStart.clear(); - m_pBoxEnd.clear(); - m_pLbEndStyle.clear(); - m_pMtrEndWidth.clear(); - m_pTsbCenterEnd.clear(); - m_pCbxSynchronize.clear(); - m_pCtlPreview.clear(); - m_pFLEdgeStyle.clear(); - m_pGridEdgeCaps.clear(); - m_pLBEdgeStyle.clear(); - m_pLBCapStyle.clear(); - m_pFlSymbol.clear(); - m_pGridIconSize.clear(); - m_pSymbolMB.clear(); - m_pSymbolWidthMF.clear(); - m_pSymbolHeightMF.clear(); - m_pSymbolRatioCB.clear(); + m_xCtlPreview.reset(); + m_xLbEndStyle.reset(); + m_xLbStartStyle.reset(); + m_xLbColor.reset(); + m_xLbLineStyle.reset(); + m_aGalleryBrushItems.clear(); + m_aSymbolBrushItems.clear(); + SfxTabPage::dispose(); } @@ -266,277 +221,28 @@ void SvxLineTabPage::Construct() FillListboxes(); } -void SvxLineTabPage::InitSymbols(MenuButton const * pButton) -{ - // Initialize popup - if(!pButton->GetPopupMenu()->GetPopupMenu( MN_GALLERY )) - { - // Get gallery entries - GalleryExplorer::FillObjList(GALLERY_THEME_BULLETS, m_aGrfNames); - - VclPtrInstance<PopupMenu> pPopup; - sal_uInt32 i = 0; - m_nNumMenuGalleryItems = m_aGrfNames.size(); - for (auto const& grfName : m_aGrfNames) - { - const OUString *pUIName = &grfName; - - // Convert URL encodings to UI characters (e.g. %20 for spaces) - OUString aPhysicalName; - if (osl::FileBase::getSystemPathFromFileURL(grfName, aPhysicalName) - == osl::FileBase::E_None) - { - pUIName = &aPhysicalName; - } - - SvxBmpItemInfo* pInfo = new SvxBmpItemInfo; - pInfo->pBrushItem.reset(new SvxBrushItem(grfName, "", GPOS_AREA, SID_ATTR_BRUSH)); - pInfo->nItemId = static_cast<sal_uInt16>(MN_GALLERY_ENTRY + i); - if ( i < m_aGrfBrushItems.size() ) - { - m_aGrfBrushItems.insert( m_aGrfBrushItems.begin() + i, std::unique_ptr<SvxBmpItemInfo>(pInfo) ); - } else - { - m_aGrfBrushItems.emplace_back( pInfo ); - } - const Graphic* pGraphic = pInfo->pBrushItem->GetGraphic(); - - if(pGraphic) - { - BitmapEx aBitmap(pGraphic->GetBitmapEx()); - Size aSize(aBitmap.GetSizePixel()); - if(aSize.Width() > MAX_BMP_WIDTH || aSize.Height() > MAX_BMP_HEIGHT) - { - bool bWidth = aSize.Width() > aSize.Height(); - double nScale = bWidth ? - double(MAX_BMP_WIDTH) / static_cast<double>(aSize.Width()): - double(MAX_BMP_HEIGHT) / static_cast<double>(aSize.Height()); - aBitmap.Scale(nScale, nScale); - - } - Image aImage(aBitmap); - pPopup->InsertItem(pInfo->nItemId, *pUIName, aImage ); - } - else - { - Image aImage; - pPopup->InsertItem(pInfo->nItemId, *pUIName, aImage ); - } - ++i; - } - m_pSymbolMB->GetPopupMenu()->SetPopupMenu( MN_GALLERY, pPopup ); - - if(m_aGrfNames.empty()) - m_pSymbolMB->GetPopupMenu()->EnableItem(MN_GALLERY, false); - } - - if(!pButton->GetPopupMenu()->GetPopupMenu( MN_SYMBOLS ) && m_pSymbolList) - { - ScopedVclPtrInstance< VirtualDevice > pVDev; - pVDev->SetMapMode(MapMode(MapUnit::Map100thMM)); - std::unique_ptr<SdrModel> pModel( - new SdrModel(nullptr, nullptr, true)); - pModel->GetItemPool().FreezeIdRanges(); - // Page - SdrPage* pPage = new SdrPage( *pModel, false ); - pPage->SetSize(Size(1000,1000)); - pModel->InsertPage( pPage, 0 ); - { - // 3D View - std::unique_ptr<SdrView> pView(new SdrView( *pModel, pVDev )); - pView->hideMarkHandles(); - pView->ShowSdrPage(pPage); - - VclPtrInstance<PopupMenu> pPopup; - - // Generate invisible square to give all symbols a - // bitmap size, which is independent from specific glyph - SdrObject *pInvisibleSquare=m_pSymbolList->GetObj(0); - - // directly clone to target SdrModel - pInvisibleSquare = pInvisibleSquare->CloneSdrObject(*pModel); - - pPage->NbcInsertObject(pInvisibleSquare); - pInvisibleSquare->SetMergedItem(XFillTransparenceItem(100)); - pInvisibleSquare->SetMergedItem(XLineTransparenceItem(100)); - - for(size_t i=0;; ++i) - { - SdrObject *pObj=m_pSymbolList->GetObj(i); - if(pObj==nullptr) - break; - - // directly clone to target SdrModel - pObj = pObj->CloneSdrObject(*pModel); - - m_aGrfNames.emplace_back(""); - pPage->NbcInsertObject(pObj); - if(m_pSymbolAttr) - { - pObj->SetMergedItemSet(*m_pSymbolAttr); - } - else - { - pObj->SetMergedItemSet(m_rOutAttrs); - } - pView->MarkAll(); - BitmapEx aBitmapEx(pView->GetMarkedObjBitmapEx()); - GDIMetaFile aMeta(pView->GetMarkedObjMetaFile()); - pView->UnmarkAll(); - pObj=pPage->RemoveObject(1); - SdrObject::Free(pObj); - - SvxBmpItemInfo* pInfo = new SvxBmpItemInfo; - pInfo->pBrushItem.reset(new SvxBrushItem(Graphic(aMeta), GPOS_AREA, SID_ATTR_BRUSH)); - pInfo->nItemId = static_cast<sal_uInt16>(MN_GALLERY_ENTRY + i + m_nNumMenuGalleryItems); - if ( static_cast<size_t>(m_nNumMenuGalleryItems + i) < m_aGrfBrushItems.size() ) { - m_aGrfBrushItems.insert( m_aGrfBrushItems.begin() + m_nNumMenuGalleryItems + i, std::unique_ptr<SvxBmpItemInfo>(pInfo) ); - } else { - m_aGrfBrushItems.emplace_back( pInfo ); - } - - Size aSize(aBitmapEx.GetSizePixel()); - if(aSize.Width() > MAX_BMP_WIDTH || aSize.Height() > MAX_BMP_HEIGHT) - { - bool bWidth = aSize.Width() > aSize.Height(); - double nScale = bWidth ? - double(MAX_BMP_WIDTH) / static_cast<double>(aSize.Width()): - double(MAX_BMP_HEIGHT) / static_cast<double>(aSize.Height()); - aBitmapEx.Scale(nScale, nScale); - } - Image aImage(aBitmapEx); - pPopup->InsertItem(pInfo->nItemId,"",aImage); - } - pInvisibleSquare=pPage->RemoveObject(0); - SdrObject::Free(pInvisibleSquare); - - m_pSymbolMB->GetPopupMenu()->SetPopupMenu( MN_SYMBOLS, pPopup ); - - if(m_aGrfNames.empty()) - m_pSymbolMB->GetPopupMenu()->EnableItem(MN_SYMBOLS, false); - - } - } -} - -void SvxLineTabPage::SymbolSelected(MenuButton const * pButton) -{ - sal_uInt16 nItemId = pButton->GetCurItemId(); - const Graphic* pGraphic = nullptr; - Graphic aGraphic; - bool bResetSize = false; - bool bEnable = true; - long nPreviousSymbolType = m_nSymbolType; - - if(nItemId >= MN_GALLERY_ENTRY) - { - if( (nItemId-MN_GALLERY_ENTRY) >= m_nNumMenuGalleryItems) - { - m_nSymbolType=nItemId-MN_GALLERY_ENTRY-m_nNumMenuGalleryItems; // List's index - } - else - { - m_nSymbolType=SVX_SYMBOLTYPE_BRUSHITEM; - bResetSize = true; - } - SvxBmpItemInfo* pInfo = m_aGrfBrushItems[ nItemId - MN_GALLERY_ENTRY ].get(); - pGraphic = pInfo->pBrushItem->GetGraphic(); - } - else switch(nItemId) - { - case MN_SYMBOLS_AUTO: - { - pGraphic=&m_aAutoSymbolGraphic; - m_aAutoSymbolGraphic.SetPrefSize( Size(253,253) ); - m_nSymbolType=SVX_SYMBOLTYPE_AUTO; - } - break; - - case MN_SYMBOLS_NONE: - { - m_nSymbolType=SVX_SYMBOLTYPE_NONE; - pGraphic=nullptr; - bEnable = false; - } - break; - default: - { - SvxOpenGraphicDialog aGrfDlg(CuiResId(RID_SVXSTR_EDIT_GRAPHIC), GetFrameWeld()); - aGrfDlg.EnableLink(false); - aGrfDlg.AsLink(false); - if( !aGrfDlg.Execute() ) - { - // Remember selected filters - if( !aGrfDlg.GetGraphic(aGraphic) ) - { - m_nSymbolType=SVX_SYMBOLTYPE_BRUSHITEM; - pGraphic = &aGraphic; - bResetSize = true; - } - } - if( !pGraphic ) - return; - } - break; - } - - if(pGraphic) - { - Size aSize = SvxNumberFormat::GetGraphicSizeMM100(pGraphic); - aSize = OutputDevice::LogicToLogic(aSize, MapMode(MapUnit::Map100thMM), MapMode(m_ePoolUnit)); - m_aSymbolGraphic=*pGraphic; - if( bResetSize ) - { - m_aSymbolSize=aSize; - } - else if( nPreviousSymbolType == SVX_SYMBOLTYPE_BRUSHITEM ) - { //#i31097# Data Point Symbol size changes when a different symbol is chosen(maoyg) - if( m_aSymbolSize.Width() != m_aSymbolSize.Height() ) - { - aSize.setWidth( static_cast<long>( m_aSymbolSize.Width() + m_aSymbolSize.Height() )/2 ); - aSize.setHeight( static_cast<long>( m_aSymbolSize.Width() + m_aSymbolSize.Height() )/2 ); - m_aSymbolSize = aSize; - } - } - m_pCtlPreview->SetSymbol(&m_aSymbolGraphic,m_aSymbolSize); - } - else - { - m_aSymbolGraphic=Graphic(); - m_pCtlPreview->SetSymbol(nullptr,m_aSymbolSize); - bEnable = false; - } - m_aSymbolLastSize=m_aSymbolSize; - SetMetricValue(*m_pSymbolWidthMF, m_aSymbolSize.Width(), m_ePoolUnit); - SetMetricValue(*m_pSymbolHeightMF, m_aSymbolSize.Height(), m_ePoolUnit); - - m_pGridIconSize->Enable(bEnable); - m_pCtlPreview->Invalidate(); -} - void SvxLineTabPage::FillListboxes() { // Line styles - sal_Int32 nOldSelect = m_pLbLineStyle->GetSelectedEntryPos(); + auto nOldSelect = m_xLbLineStyle->get_active(); // aLbLineStyle.FillStyles(); - m_pLbLineStyle->Fill( m_pDashList ); - m_pLbLineStyle->SelectEntryPos( nOldSelect ); + m_xLbLineStyle->Fill( m_pDashList ); + m_xLbLineStyle->set_active( nOldSelect ); // Line end style OUString sNone( SvxResId( RID_SVXSTR_NONE ) ); - nOldSelect = m_pLbStartStyle->GetSelectedEntryPos(); - m_pLbStartStyle->Clear(); - m_pLbStartStyle->InsertEntry( sNone ); - m_pLbStartStyle->Fill( m_pLineEndList ); - m_pLbStartStyle->SelectEntryPos( nOldSelect ); - nOldSelect = m_pLbEndStyle->GetSelectedEntryPos(); - m_pLbEndStyle->Clear(); - m_pLbEndStyle->InsertEntry( sNone ); - m_pLbEndStyle->Fill( m_pLineEndList, false ); - m_pLbEndStyle->SelectEntryPos( nOldSelect ); + nOldSelect = m_xLbStartStyle->get_active(); + m_xLbStartStyle->clear(); + m_xLbStartStyle->append_text(sNone); + m_xLbStartStyle->Fill(m_pLineEndList); + m_xLbStartStyle->set_active(nOldSelect); + nOldSelect = m_xLbEndStyle->get_active(); + m_xLbEndStyle->clear(); + m_xLbEndStyle->append_text(sNone); + m_xLbEndStyle->Fill(m_pLineEndList, false); + m_xLbEndStyle->set_active(nOldSelect); } - void SvxLineTabPage::ActivatePage( const SfxItemSet& rSet ) { const CntUInt16Item* pPageTypeItem = rSet.GetItem<CntUInt16Item>(SID_PAGE_TYPE, false); @@ -557,21 +263,20 @@ void SvxLineTabPage::ActivatePage( const SfxItemSet& rSet ) *m_pnDashListState = ChangeType::NONE; // Style list - nPos = m_pLbLineStyle->GetSelectedEntryPos(); + nPos = m_xLbLineStyle->get_active(); - m_pLbLineStyle->Clear(); - m_pLbLineStyle->InsertEntry( SvxResId( RID_SVXSTR_INVISIBLE ) ); - m_pLbLineStyle->InsertEntry( SvxResId( RID_SVXSTR_SOLID ) ); - m_pLbLineStyle->Fill( m_pDashList ); - nCount = m_pLbLineStyle->GetEntryCount(); + m_xLbLineStyle->clear(); + m_xLbLineStyle->append_text(SvxResId(RID_SVXSTR_INVISIBLE)); + m_xLbLineStyle->append_text(SvxResId(RID_SVXSTR_SOLID)); + m_xLbLineStyle->Fill(m_pDashList); + nCount = m_xLbLineStyle->get_count(); if ( nCount == 0 ) ; // This case should never occur else if( nCount <= nPos ) - m_pLbLineStyle->SelectEntryPos( 0 ); + m_xLbLineStyle->set_active(0); else - m_pLbLineStyle->SelectEntryPos( nPos ); - // SelectStyleHdl_Impl( this ); + m_xLbLineStyle->set_active(nPos); } INetURLObject aDashURL( m_pDashList->GetPath() ); @@ -586,49 +291,49 @@ void SvxLineTabPage::ActivatePage( const SfxItemSet& rSet ) *m_pnLineEndListState = ChangeType::NONE; - nPos = m_pLbLineStyle->GetSelectedEntryPos(); - OUString sNone( SvxResId( RID_SVXSTR_NONE ) ); - m_pLbStartStyle->Clear(); - m_pLbStartStyle->InsertEntry( sNone ); + nPos = m_xLbLineStyle->get_active(); + OUString sNone(SvxResId(RID_SVXSTR_NONE)); + m_xLbStartStyle->clear(); + m_xLbStartStyle->append_text(sNone); - m_pLbStartStyle->Fill( m_pLineEndList ); - nCount = m_pLbStartStyle->GetEntryCount(); + m_xLbStartStyle->Fill( m_pLineEndList ); + nCount = m_xLbStartStyle->get_count(); if( nCount == 0 ) ; // This case should never occur else if( nCount <= nPos ) - m_pLbStartStyle->SelectEntryPos( 0 ); + m_xLbStartStyle->set_active(0); else - m_pLbStartStyle->SelectEntryPos( nPos ); + m_xLbStartStyle->set_active(nPos); - m_pLbEndStyle->Clear(); - m_pLbEndStyle->InsertEntry( sNone ); + m_xLbEndStyle->clear(); + m_xLbEndStyle->append_text(sNone); - m_pLbEndStyle->Fill( m_pLineEndList, false ); - nCount = m_pLbEndStyle->GetEntryCount(); + m_xLbEndStyle->Fill( m_pLineEndList, false ); + nCount = m_xLbEndStyle->get_count(); if( nCount == 0 ) ; // This case should never occur else if( nCount <= nPos ) - m_pLbEndStyle->SelectEntryPos( 0 ); + m_xLbEndStyle->set_active(0); else - m_pLbEndStyle->SelectEntryPos( nPos ); + m_xLbEndStyle->set_active(nPos); } INetURLObject aLineURL( m_pLineEndList->GetPath() ); aLineURL.Append( m_pLineEndList->GetName() ); DBG_ASSERT( aLineURL.GetProtocol() != INetProtocol::NotValid, "invalid URL" ); // Evaluate if another TabPage set another fill type - if( m_pLbLineStyle->GetSelectedEntryPos() != 0 ) + if( m_xLbLineStyle->get_active() != 0 ) { if( m_nPageType == PageType::Hatch ) // 1 { - m_pLbLineStyle->SelectEntryPos( *m_pPosDashLb + 2 ); // +2 due to SOLID and INVISIBLE + m_xLbLineStyle->set_active(*m_pPosDashLb + 2); // +2 due to SOLID and INVISIBLE ChangePreviewHdl_Impl( nullptr ); } if( m_nPageType == PageType::Bitmap ) { - m_pLbStartStyle->SelectEntryPos( *m_pPosLineEndLb + 1 );// +1 due to SOLID - m_pLbEndStyle->SelectEntryPos( *m_pPosLineEndLb + 1 );// +1 due to SOLID + m_xLbStartStyle->set_active(*m_pPosLineEndLb + 1);// +1 due to SOLID + m_xLbEndStyle->set_active(*m_pPosLineEndLb + 1);// +1 due to SOLID ChangePreviewHdl_Impl( nullptr ); } } @@ -648,8 +353,8 @@ void SvxLineTabPage::ActivatePage( const SfxItemSet& rSet ) else if (m_nDlgType == 1101) // nNoArrowNoShadowDlg from chart2/source/controller/dialogs/dlg_ObjectProperties.cxx { - m_pFlLineEnds->Hide(); - m_pFLEdgeStyle->Hide(); + m_xFlLineEnds->hide(); + m_xFLEdgeStyle->hide(); } } @@ -659,9 +364,9 @@ DeactivateRC SvxLineTabPage::DeactivatePage( SfxItemSet* _pSet ) if( m_nDlgType == 0 ) // Line dialog { m_nPageType = PageType::Gradient; // possibly for extensions - *m_pPosDashLb = m_pLbLineStyle->GetSelectedEntryPos() - 2;// First entry SOLID!!! - sal_Int32 nPos = m_pLbStartStyle->GetSelectedEntryPos(); - if( nPos != LISTBOX_ENTRY_NOTFOUND ) + *m_pPosDashLb = m_xLbLineStyle->get_active() - 2;// First entry SOLID!!! + sal_Int32 nPos = m_xLbStartStyle->get_active(); + if (nPos != -1) nPos--; *m_pPosLineEndLb = nPos; } @@ -682,9 +387,9 @@ bool SvxLineTabPage::FillItemSet( SfxItemSet* rAttrs ) // To prevent modifications to the list, we do not set other page's items. if( m_nDlgType != 0 || m_nPageType != PageType::Hatch ) { - nPos = m_pLbLineStyle->GetSelectedEntryPos(); - if( nPos != LISTBOX_ENTRY_NOTFOUND && - m_pLbLineStyle->IsValueChangedFromSaved() ) + nPos = m_xLbLineStyle->get_active(); + if( nPos != -1 && + m_xLbLineStyle->get_value_changed_from_saved() ) { std::unique_ptr<XLineStyleItem> pStyleItem; @@ -699,7 +404,7 @@ bool SvxLineTabPage::FillItemSet( SfxItemSet* rAttrs ) // For added security if( m_pDashList->Count() > static_cast<long>( nPos - 2 ) ) { - XLineDashItem aDashItem( m_pLbLineStyle->GetSelectedEntry(), + XLineDashItem aDashItem( m_xLbLineStyle->get_active_text(), m_pDashList->GetDash( nPos - 2 )->GetDash() ); pOld = GetOldItem( *rAttrs, XATTR_LINEDASH ); if ( !pOld || !( *static_cast<const XLineDashItem*>(pOld) == aDashItem ) ) @@ -719,9 +424,9 @@ bool SvxLineTabPage::FillItemSet( SfxItemSet* rAttrs ) } // Line width // GetSavedValue() returns OUString! - if( m_pMtrLineWidth->IsValueChangedFromSaved() ) + if( m_xMtrLineWidth->get_value_changed_from_saved() ) { - XLineWidthItem aItem( GetCoreValue( *m_pMtrLineWidth, m_ePoolUnit ) ); + XLineWidthItem aItem( GetCoreValue( *m_xMtrLineWidth, m_ePoolUnit ) ); pOld = GetOldItem( *rAttrs, XATTR_LINEWIDTH ); if ( !pOld || !( *static_cast<const XLineWidthItem*>(pOld) == aItem ) ) { @@ -730,9 +435,9 @@ bool SvxLineTabPage::FillItemSet( SfxItemSet* rAttrs ) } } // Width line start - if( m_pMtrStartWidth->IsValueChangedFromSaved() ) + if( m_xMtrStartWidth->get_value_changed_from_saved() ) { - XLineStartWidthItem aItem( GetCoreValue( *m_pMtrStartWidth, m_ePoolUnit ) ); + XLineStartWidthItem aItem( GetCoreValue( *m_xMtrStartWidth, m_ePoolUnit ) ); pOld = GetOldItem( *rAttrs, XATTR_LINESTARTWIDTH ); if ( !pOld || !( *static_cast<const XLineStartWidthItem*>(pOld) == aItem ) ) { @@ -741,9 +446,9 @@ bool SvxLineTabPage::FillItemSet( SfxItemSet* rAttrs ) } } // Width line end - if( m_pMtrEndWidth->IsValueChangedFromSaved() ) + if( m_xMtrEndWidth->get_value_changed_from_saved() ) { - XLineEndWidthItem aItem( GetCoreValue( *m_pMtrEndWidth, m_ePoolUnit ) ); + XLineEndWidthItem aItem( GetCoreValue( *m_xMtrEndWidth, m_ePoolUnit ) ); pOld = GetOldItem( *rAttrs, XATTR_LINEENDWIDTH ); if ( !pOld || !( *static_cast<const XLineEndWidthItem*>(pOld) == aItem ) ) { @@ -754,7 +459,7 @@ bool SvxLineTabPage::FillItemSet( SfxItemSet* rAttrs ) // Line color { - NamedColor aColor = m_pLbColor->GetSelectedEntry(); + NamedColor aColor = m_xLbColor->GetSelectedEntry(); XLineColorItem aItem(aColor.second, aColor.first); pOld = GetOldItem( *rAttrs, XATTR_LINECOLOR ); if ( !pOld || !( *static_cast<const XLineColorItem*>(pOld) == aItem ) ) @@ -767,14 +472,14 @@ bool SvxLineTabPage::FillItemSet( SfxItemSet* rAttrs ) if( m_nDlgType != 0 || m_nPageType != PageType::Bitmap ) { // Line start - nPos = m_pLbStartStyle->GetSelectedEntryPos(); - if( nPos != LISTBOX_ENTRY_NOTFOUND && m_pLbStartStyle->IsValueChangedFromSaved() ) + nPos = m_xLbStartStyle->get_active(); + if( nPos != -1 && m_xLbStartStyle->get_value_changed_from_saved() ) { std::unique_ptr<XLineStartItem> pItem; if( nPos == 0 ) pItem.reset(new XLineStartItem()); else if( m_pLineEndList->Count() > static_cast<long>( nPos - 1 ) ) - pItem.reset(new XLineStartItem( m_pLbStartStyle->GetSelectedEntry(), m_pLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() )); + pItem.reset(new XLineStartItem( m_xLbStartStyle->get_active_text(), m_pLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() )); pOld = GetOldItem( *rAttrs, XATTR_LINESTART ); if( pItem && ( !pOld || !( *static_cast<const XLineEndItem*>(pOld) == *pItem ) ) ) { @@ -783,14 +488,14 @@ bool SvxLineTabPage::FillItemSet( SfxItemSet* rAttrs ) } } // Line end - nPos = m_pLbEndStyle->GetSelectedEntryPos(); - if( nPos != LISTBOX_ENTRY_NOTFOUND && m_pLbEndStyle->IsValueChangedFromSaved() ) + nPos = m_xLbEndStyle->get_active(); + if( nPos != -1 && m_xLbEndStyle->get_value_changed_from_saved() ) { std::unique_ptr<XLineEndItem> pItem; if( nPos == 0 ) pItem.reset(new XLineEndItem()); else if( m_pLineEndList->Count() > static_cast<long>( nPos - 1 ) ) - pItem.reset(new XLineEndItem( m_pLbEndStyle->GetSelectedEntry(), m_pLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() )); + pItem.reset(new XLineEndItem( m_xLbEndStyle->get_active_text(), m_pLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() )); pOld = GetOldItem( *rAttrs, XATTR_LINEEND ); if( pItem && ( !pOld || !( *static_cast<const XLineEndItem*>(pOld) == *pItem ) ) ) @@ -802,8 +507,8 @@ bool SvxLineTabPage::FillItemSet( SfxItemSet* rAttrs ) } // Centered line end - TriState eState = m_pTsbCenterStart->GetState(); - if( m_pTsbCenterStart->IsValueChangedFromSaved() ) + TriState eState = m_xTsbCenterStart->get_state(); + if( m_xTsbCenterStart->get_state_changed_from_saved() ) { XLineStartCenterItem aItem( eState != TRISTATE_FALSE ); pOld = GetOldItem( *rAttrs, XATTR_LINESTARTCENTER ); @@ -813,8 +518,8 @@ bool SvxLineTabPage::FillItemSet( SfxItemSet* rAttrs ) bModified = true; } } - eState = m_pTsbCenterEnd->GetState(); - if( m_pTsbCenterEnd->IsValueChangedFromSaved() ) + eState = m_xTsbCenterEnd->get_state(); + if( m_xTsbCenterEnd->get_state_changed_from_saved() ) { XLineEndCenterItem aItem( eState != TRISTATE_FALSE ); pOld = GetOldItem( *rAttrs, XATTR_LINEENDCENTER ); @@ -826,8 +531,8 @@ bool SvxLineTabPage::FillItemSet( SfxItemSet* rAttrs ) } // Transparency - sal_uInt16 nVal = static_cast<sal_uInt16>(m_pMtrTransparent->GetValue()); - if( m_pMtrTransparent->IsValueChangedFromSaved() ) + sal_uInt16 nVal = m_xMtrTransparent->get_value(FUNIT_PERCENT); + if( m_xMtrTransparent->get_value_changed_from_saved() ) { XLineTransparenceItem aItem( nVal ); pOld = GetOldItem( *rAttrs, XATTR_LINETRANSPARENCE ); @@ -838,8 +543,8 @@ bool SvxLineTabPage::FillItemSet( SfxItemSet* rAttrs ) } } - nPos = m_pLBEdgeStyle->GetSelectedEntryPos(); - if( LISTBOX_ENTRY_NOTFOUND != nPos && m_pLBEdgeStyle->IsValueChangedFromSaved() ) + nPos = m_xLBEdgeStyle->get_active(); + if (nPos != -1 && m_xLBEdgeStyle->get_value_changed_from_saved()) { std::unique_ptr<XLineJointItem> pNew; @@ -880,8 +585,8 @@ bool SvxLineTabPage::FillItemSet( SfxItemSet* rAttrs ) } // LineCaps - nPos = m_pLBCapStyle->GetSelectedEntryPos(); - if( LISTBOX_ENTRY_NOTFOUND != nPos && m_pLBCapStyle->IsValueChangedFromSaved() ) + nPos = m_xLBCapStyle->get_active(); + if (nPos != -1 && m_xLBCapStyle->get_value_changed_from_saved()) { std::unique_ptr<XLineCapItem> pNew; @@ -961,47 +666,47 @@ void SvxLineTabPage::FillXLSet_Impl() { sal_Int32 nPos; - if( m_pLbLineStyle->GetSelectedEntryPos() == LISTBOX_ENTRY_NOTFOUND ) + if (m_xLbLineStyle->get_active() == -1) { m_rXLSet.Put( XLineStyleItem( drawing::LineStyle_NONE ) ); } - else if( m_pLbLineStyle->IsEntryPosSelected( 0 ) ) + else if (m_xLbLineStyle->get_active() == 0) m_rXLSet.Put( XLineStyleItem( drawing::LineStyle_NONE ) ); - else if( m_pLbLineStyle->IsEntryPosSelected( 1 ) ) + else if (m_xLbLineStyle->get_active() == 1) m_rXLSet.Put( XLineStyleItem( drawing::LineStyle_SOLID ) ); else { m_rXLSet.Put( XLineStyleItem( drawing::LineStyle_DASH ) ); - nPos = m_pLbLineStyle->GetSelectedEntryPos(); - if( nPos != LISTBOX_ENTRY_NOTFOUND ) + nPos = m_xLbLineStyle->get_active(); + if (nPos != -1) { - m_rXLSet.Put( XLineDashItem( m_pLbLineStyle->GetSelectedEntry(), + m_rXLSet.Put( XLineDashItem( m_xLbLineStyle->get_active_text(), m_pDashList->GetDash( nPos - 2 )->GetDash() ) ); } } - nPos = m_pLbStartStyle->GetSelectedEntryPos(); - if( nPos != LISTBOX_ENTRY_NOTFOUND ) + nPos = m_xLbStartStyle->get_active(); + if (nPos != -1) { if( nPos == 0 ) m_rXLSet.Put( XLineStartItem() ); else - m_rXLSet.Put( XLineStartItem( m_pLbStartStyle->GetSelectedEntry(), + m_rXLSet.Put( XLineStartItem( m_xLbStartStyle->get_active_text(), m_pLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() ) ); } - nPos = m_pLbEndStyle->GetSelectedEntryPos(); - if( nPos != LISTBOX_ENTRY_NOTFOUND ) + nPos = m_xLbEndStyle->get_active(); + if (nPos != -1) { if( nPos == 0 ) m_rXLSet.Put( XLineEndItem() ); else - m_rXLSet.Put( XLineEndItem( m_pLbEndStyle->GetSelectedEntry(), + m_rXLSet.Put( XLineEndItem( m_xLbEndStyle->get_active_text(), m_pLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() ) ); } - nPos = m_pLBEdgeStyle->GetSelectedEntryPos(); - if(LISTBOX_ENTRY_NOTFOUND != nPos) + nPos = m_xLBEdgeStyle->get_active(); + if (nPos != -1) { switch(nPos) { @@ -1029,8 +734,8 @@ void SvxLineTabPage::FillXLSet_Impl() } // LineCaps - nPos = m_pLBCapStyle->GetSelectedEntryPos(); - if(LISTBOX_ENTRY_NOTFOUND != nPos) + nPos = m_xLBCapStyle->get_active(); + if (nPos != -1) { switch(nPos) { @@ -1052,29 +757,29 @@ void SvxLineTabPage::FillXLSet_Impl() } } - m_rXLSet.Put( XLineStartWidthItem( GetCoreValue( *m_pMtrStartWidth, m_ePoolUnit ) ) ); - m_rXLSet.Put( XLineEndWidthItem( GetCoreValue( *m_pMtrEndWidth, m_ePoolUnit ) ) ); + m_rXLSet.Put( XLineStartWidthItem( GetCoreValue( *m_xMtrStartWidth, m_ePoolUnit ) ) ); + m_rXLSet.Put( XLineEndWidthItem( GetCoreValue( *m_xMtrEndWidth, m_ePoolUnit ) ) ); - m_rXLSet.Put( XLineWidthItem( GetCoreValue( *m_pMtrLineWidth, m_ePoolUnit ) ) ); - NamedColor aColor = m_pLbColor->GetSelectedEntry(); + m_rXLSet.Put( XLineWidthItem( GetCoreValue( *m_xMtrLineWidth, m_ePoolUnit ) ) ); + NamedColor aColor = m_xLbColor->GetSelectedEntry(); m_rXLSet.Put(XLineColorItem(aColor.second, aColor.first)); // Centered line end - if( m_pTsbCenterStart->GetState() == TRISTATE_TRUE ) + if( m_xTsbCenterStart->get_state() == TRISTATE_TRUE ) m_rXLSet.Put( XLineStartCenterItem( true ) ); - else if( m_pTsbCenterStart->GetState() == TRISTATE_FALSE ) + else if( m_xTsbCenterStart->get_state() == TRISTATE_FALSE ) m_rXLSet.Put( XLineStartCenterItem( false ) ); - if( m_pTsbCenterEnd->GetState() == TRISTATE_TRUE ) + if( m_xTsbCenterEnd->get_state() == TRISTATE_TRUE ) m_rXLSet.Put( XLineEndCenterItem( true ) ); - else if( m_pTsbCenterEnd->GetState() == TRISTATE_FALSE ) + else if( m_xTsbCenterEnd->get_state() == TRISTATE_FALSE ) m_rXLSet.Put( XLineEndCenterItem( false ) ); // Transparency - sal_uInt16 nVal = static_cast<sal_uInt16>(m_pMtrTransparent->GetValue()); + sal_uInt16 nVal = m_xMtrTransparent->get_value(FUNIT_PERCENT); m_rXLSet.Put( XLineTransparenceItem( nVal ) ); - m_pCtlPreview->SetLineAttributes(m_aXLineAttr.GetItemSet()); + m_aCtlPreview.SetLineAttributes(m_aXLineAttr.GetItemSet()); } @@ -1201,13 +906,13 @@ void SvxLineTabPage::Reset( const SfxItemSet* rAttrs ) m_aSymbolSize = static_cast<const SvxSizeItem *>(pPoolItem)->GetSize(); } - m_pGridIconSize->Enable(bEnable); + m_xGridIconSize->set_sensitive(bEnable); if(bPrevSym) { - SetMetricValue(*m_pSymbolWidthMF, m_aSymbolSize.Width(), m_ePoolUnit); - SetMetricValue(*m_pSymbolHeightMF, m_aSymbolSize.Height(),m_ePoolUnit); - m_pCtlPreview->SetSymbol(&m_aSymbolGraphic,m_aSymbolSize); + SetMetricValue(*m_xSymbolWidthMF, m_aSymbolSize.Width(), m_ePoolUnit); + SetMetricValue(*m_xSymbolHeightMF, m_aSymbolSize.Height(),m_ePoolUnit); + m_aCtlPreview.SetSymbol(&m_aSymbolGraphic,m_aSymbolSize); m_aSymbolLastSize=m_aSymbolSize; } @@ -1218,15 +923,15 @@ void SvxLineTabPage::Reset( const SfxItemSet* rAttrs ) switch( eXLS ) { case drawing::LineStyle_NONE: - m_pLbLineStyle->SelectEntryPos( 0 ); + m_xLbLineStyle->set_active(0); break; case drawing::LineStyle_SOLID: - m_pLbLineStyle->SelectEntryPos( 1 ); + m_xLbLineStyle->set_active(1); break; case drawing::LineStyle_DASH: - m_pLbLineStyle->SetNoSelection(); - m_pLbLineStyle->SelectEntry( rAttrs->Get( XATTR_LINEDASH ).GetName() ); + m_xLbLineStyle->set_active(-1); + m_xLbLineStyle->set_active_text(rAttrs->Get( XATTR_LINEDASH ).GetName()); break; default: @@ -1235,30 +940,30 @@ void SvxLineTabPage::Reset( const SfxItemSet* rAttrs ) } else { - m_pLbLineStyle->SetNoSelection(); + m_xLbLineStyle->set_active(-1); } // Line strength if( rAttrs->GetItemState( XATTR_LINEWIDTH ) != SfxItemState::DONTCARE ) { - SetMetricValue( *m_pMtrLineWidth, rAttrs->Get( XATTR_LINEWIDTH ).GetValue(), m_ePoolUnit ); + SetMetricValue( *m_xMtrLineWidth, rAttrs->Get( XATTR_LINEWIDTH ).GetValue(), m_ePoolUnit ); } else - m_pMtrLineWidth->SetText( "" ); + m_xMtrLineWidth->set_text(""); // Line color - m_pLbColor->SetNoSelection(); + m_xLbColor->SetNoSelection(); if ( rAttrs->GetItemState( XATTR_LINECOLOR ) != SfxItemState::DONTCARE ) { Color aCol = rAttrs->Get( XATTR_LINECOLOR ).GetColorValue(); - m_pLbColor->SelectEntry( aCol ); + m_xLbColor->SelectEntry( aCol ); } // Line start if( m_bObjSelected && rAttrs->GetItemState( XATTR_LINESTART ) == SfxItemState::DEFAULT ) { - m_pLbStartStyle->Disable(); + m_xLbStartStyle->set_sensitive(false); } else if( rAttrs->GetItemState( XATTR_LINESTART ) != SfxItemState::DONTCARE ) { @@ -1274,23 +979,23 @@ void SvxLineTabPage::Reset( const SfxItemSet* rAttrs ) if(rItemPolygon == rEntryPolygon) { // select this entry - m_pLbStartStyle->SelectEntryPos(a + 1); + m_xLbStartStyle->set_active(a + 1); bSelected = true; } } if(!bSelected) - m_pLbStartStyle->SelectEntryPos( 0 ); + m_xLbStartStyle->set_active(0); } else { - m_pLbStartStyle->SetNoSelection(); + m_xLbStartStyle->set_active(-1); } // Line end if( m_bObjSelected && rAttrs->GetItemState( XATTR_LINEEND ) == SfxItemState::DEFAULT ) { - m_pLbEndStyle->Disable(); + m_xLbEndStyle->set_sensitive(false); } else if( rAttrs->GetItemState( XATTR_LINEEND ) != SfxItemState::DONTCARE ) { @@ -1306,115 +1011,111 @@ void SvxLineTabPage::Reset( const SfxItemSet* rAttrs ) if(rItemPolygon == rEntryPolygon) { // select this entry - m_pLbEndStyle->SelectEntryPos(a + 1); + m_xLbEndStyle->set_active(a + 1); bSelected = true; } } if(!bSelected) - m_pLbEndStyle->SelectEntryPos( 0 ); + m_xLbEndStyle->set_active(0); } else { - m_pLbEndStyle->SetNoSelection(); + m_xLbEndStyle->set_active(-1); } // Line start strength if( m_bObjSelected && rAttrs->GetItemState( XATTR_LINESTARTWIDTH ) == SfxItemState::DEFAULT ) { - m_pMtrStartWidth->Disable(); + m_xMtrStartWidth->set_sensitive(false); } else if( rAttrs->GetItemState( XATTR_LINESTARTWIDTH ) != SfxItemState::DONTCARE ) { - SetMetricValue( *m_pMtrStartWidth, + SetMetricValue( *m_xMtrStartWidth, rAttrs->Get( XATTR_LINESTARTWIDTH ).GetValue(), m_ePoolUnit ); } else - m_pMtrStartWidth->SetText( "" ); + m_xMtrStartWidth->set_text( "" ); // Line end strength if( m_bObjSelected && rAttrs->GetItemState( XATTR_LINEENDWIDTH ) == SfxItemState::DEFAULT ) { - m_pMtrEndWidth->Disable(); + m_xMtrEndWidth->set_sensitive(false); } else if( rAttrs->GetItemState( XATTR_LINEENDWIDTH ) != SfxItemState::DONTCARE ) { - SetMetricValue( *m_pMtrEndWidth, + SetMetricValue( *m_xMtrEndWidth, rAttrs->Get( XATTR_LINEENDWIDTH ).GetValue(), m_ePoolUnit ); } else - m_pMtrEndWidth->SetText( "" ); + m_xMtrEndWidth->set_text(""); // Centered line end (start) if( m_bObjSelected && rAttrs->GetItemState( XATTR_LINESTARTCENTER ) == SfxItemState::DEFAULT ) { - m_pTsbCenterStart->Disable(); + m_xTsbCenterStart->set_sensitive(false); } else if( rAttrs->GetItemState( XATTR_LINESTARTCENTER ) != SfxItemState::DONTCARE ) { - m_pTsbCenterStart->EnableTriState( false ); - if( rAttrs->Get( XATTR_LINESTARTCENTER ).GetValue() ) - m_pTsbCenterStart->SetState( TRISTATE_TRUE ); + m_xTsbCenterStart->set_state(TRISTATE_TRUE); else - m_pTsbCenterStart->SetState( TRISTATE_FALSE ); + m_xTsbCenterStart->set_state(TRISTATE_FALSE); } else { - m_pTsbCenterStart->SetState( TRISTATE_INDET ); + m_xTsbCenterStart->set_state(TRISTATE_INDET); } // Centered line end (end) if( m_bObjSelected && rAttrs->GetItemState( XATTR_LINEENDCENTER ) == SfxItemState::DEFAULT ) { - m_pTsbCenterEnd->Disable(); + m_xTsbCenterEnd->set_sensitive(false); } else if( rAttrs->GetItemState( XATTR_LINEENDCENTER ) != SfxItemState::DONTCARE ) { - m_pTsbCenterEnd->EnableTriState( false ); - if( rAttrs->Get( XATTR_LINEENDCENTER ).GetValue() ) - m_pTsbCenterEnd->SetState( TRISTATE_TRUE ); + m_xTsbCenterEnd->set_state(TRISTATE_TRUE); else - m_pTsbCenterEnd->SetState( TRISTATE_FALSE ); + m_xTsbCenterEnd->set_state(TRISTATE_FALSE); } else { - m_pTsbCenterEnd->SetState( TRISTATE_INDET ); + m_xTsbCenterEnd->set_state(TRISTATE_INDET); } // Transparency if( rAttrs->GetItemState( XATTR_LINETRANSPARENCE ) != SfxItemState::DONTCARE ) { sal_uInt16 nTransp = rAttrs->Get( XATTR_LINETRANSPARENCE ).GetValue(); - m_pMtrTransparent->SetValue( nTransp ); - ChangeTransparentHdl_Impl( *m_pMtrTransparent ); + m_xMtrTransparent->set_value(nTransp, FUNIT_PERCENT); + ChangeTransparentHdl_Impl(*m_xMtrTransparent); } else - m_pMtrTransparent->SetText( "" ); + m_xMtrTransparent->set_text( "" ); - if( !m_pLbStartStyle->IsEnabled() && - !m_pLbEndStyle->IsEnabled() && - !m_pMtrStartWidth->IsEnabled() && - !m_pMtrEndWidth->IsEnabled() && - !m_pTsbCenterStart->IsEnabled()&& - !m_pTsbCenterEnd->IsEnabled() ) + if( !m_xLbStartStyle->get_sensitive() && + !m_xLbEndStyle->get_sensitive() && + !m_xMtrStartWidth->get_sensitive() && + !m_xMtrEndWidth->get_sensitive() && + !m_xTsbCenterStart->get_sensitive()&& + !m_xTsbCenterEnd->get_sensitive() ) { - m_pCbxSynchronize->Disable(); - m_pFlLineEnds->Disable(); + m_xCbxSynchronize->set_sensitive(false); + m_xFlLineEnds->set_sensitive(false); } // Synchronize // We get the value from the INI file now OUString aStr = GetUserData(); - m_pCbxSynchronize->Check( aStr.toInt32() != 0 ); + m_xCbxSynchronize->set_active(aStr.toInt32() != 0); if(m_bObjSelected && SfxItemState::DEFAULT == rAttrs->GetItemState(XATTR_LINEJOINT)) { -// maFTEdgeStyle.Disable(); - m_pLBEdgeStyle->Disable(); +// maFTEdgeStyle.set_sensitive(false); + m_xLBEdgeStyle->set_sensitive(false); } else if(SfxItemState::DONTCARE != rAttrs->GetItemState(XATTR_LINEJOINT)) { @@ -1423,23 +1124,22 @@ void SvxLineTabPage::Reset( const SfxItemSet* rAttrs ) switch(eLineJoint) { case css::drawing::LineJoint::LineJoint_MAKE_FIXED_SIZE: // fallback to round, unused value - case css::drawing::LineJoint_ROUND : m_pLBEdgeStyle->SelectEntryPos(0); break; - case css::drawing::LineJoint_NONE : m_pLBEdgeStyle->SelectEntryPos(1); break; + case css::drawing::LineJoint_ROUND : m_xLBEdgeStyle->set_active(0); break; + case css::drawing::LineJoint_NONE : m_xLBEdgeStyle->set_active(1); break; case css::drawing::LineJoint_MIDDLE : // fallback to mitre, unused value - case css::drawing::LineJoint_MITER : m_pLBEdgeStyle->SelectEntryPos(2); break; - case css::drawing::LineJoint_BEVEL : m_pLBEdgeStyle->SelectEntryPos(3); break; + case css::drawing::LineJoint_MITER : m_xLBEdgeStyle->set_active(2); break; + case css::drawing::LineJoint_BEVEL : m_xLBEdgeStyle->set_active(3); break; } } else { - m_pLBEdgeStyle->SetNoSelection(); + m_xLBEdgeStyle->set_active(-1); } // fdo#43209 if(m_bObjSelected && SfxItemState::DEFAULT == rAttrs->GetItemState(XATTR_LINECAP)) { -// maFTCapStyle.Disable(); - m_pLBCapStyle->Disable(); + m_xLBCapStyle->set_sensitive(false); } else if(SfxItemState::DONTCARE != rAttrs->GetItemState(XATTR_LINECAP)) { @@ -1447,60 +1147,60 @@ void SvxLineTabPage::Reset( const SfxItemSet* rAttrs ) switch(eLineCap) { - case css::drawing::LineCap_ROUND: m_pLBCapStyle->SelectEntryPos(1); break; - case css::drawing::LineCap_SQUARE : m_pLBCapStyle->SelectEntryPos(2); break; - default /*css::drawing::LineCap_BUTT*/: m_pLBCapStyle->SelectEntryPos(0); break; + case css::drawing::LineCap_ROUND: m_xLBCapStyle->set_active(1); break; + case css::drawing::LineCap_SQUARE : m_xLBCapStyle->set_active(2); break; + default /*css::drawing::LineCap_BUTT*/: m_xLBCapStyle->set_active(0); break; } } else { - m_pLBCapStyle->SetNoSelection(); + m_xLBCapStyle->set_active(-1); } // Save values - m_pLbLineStyle->SaveValue(); - m_pMtrLineWidth->SaveValue(); - m_pLbColor->SaveValue(); - m_pLbStartStyle->SaveValue(); - m_pLbEndStyle->SaveValue(); - m_pMtrStartWidth->SaveValue(); - m_pMtrEndWidth->SaveValue(); - m_pTsbCenterStart->SaveValue(); - m_pTsbCenterEnd->SaveValue(); - m_pMtrTransparent->SaveValue(); - - m_pLBEdgeStyle->SaveValue(); + m_xLbLineStyle->save_value(); + m_xMtrLineWidth->save_value(); + m_xLbColor->SaveValue(); + m_xLbStartStyle->save_value(); + m_xLbEndStyle->save_value(); + m_xMtrStartWidth->save_value(); + m_xMtrEndWidth->save_value(); + m_xTsbCenterStart->save_state(); + m_xTsbCenterEnd->save_state(); + m_xMtrTransparent->save_value(); + + m_xLBEdgeStyle->save_value(); // LineCaps - m_pLBCapStyle->SaveValue(); + m_xLBCapStyle->save_value(); - ClickInvisibleHdl_Impl( *m_pLbLineStyle ); + ClickInvisibleHdl_Impl(); ChangePreviewHdl_Impl( nullptr ); } - -VclPtr<SfxTabPage> SvxLineTabPage::Create( TabPageParent pWindow, - const SfxItemSet* rAttrs ) +VclPtr<SfxTabPage> SvxLineTabPage::Create(TabPageParent pParent, + const SfxItemSet* rAttrs) { - return VclPtr<SvxLineTabPage>::Create( pWindow.pParent, *rAttrs ); + return VclPtr<SvxLineTabPage>::Create(pParent, *rAttrs); } -IMPL_LINK( SvxLineTabPage, ChangePreviewListBoxHdl_Impl, SvxColorListBox&, rListBox, void ) +IMPL_LINK_NOARG(SvxLineTabPage, ChangePreviewListBoxHdl_Impl, ColorListBox&, void) { - ChangePreviewHdl_Impl(&rListBox); + ChangePreviewHdl_Impl(nullptr); } -IMPL_LINK( SvxLineTabPage, ChangePreviewModifyHdl_Impl, Edit&, rEdit, void ) +IMPL_LINK(SvxLineTabPage, ChangePreviewModifyHdl_Impl, weld::MetricSpinButton&, rEdit, void) { ChangePreviewHdl_Impl(&rEdit); } -void SvxLineTabPage::ChangePreviewHdl_Impl(void const * pCntrl ) + +void SvxLineTabPage::ChangePreviewHdl_Impl(const weld::MetricSpinButton* pCntrl) { - if(pCntrl == m_pMtrLineWidth) + if (pCntrl == m_xMtrLineWidth.get()) { // Line width and start end width - sal_Int32 nNewLineWidth = GetCoreValue( *m_pMtrLineWidth, m_ePoolUnit ); + sal_Int32 nNewLineWidth = GetCoreValue( *m_xMtrLineWidth, m_ePoolUnit ); if(m_nActLineWidth == -1) { // Don't initialize yet, get the start value @@ -1514,17 +1214,17 @@ void SvxLineTabPage::ChangePreviewHdl_Impl(void const * pCntrl ) if(m_nActLineWidth != nNewLineWidth) { // Adapt start/end width - sal_Int32 nValAct = GetCoreValue( *m_pMtrStartWidth, m_ePoolUnit ); + sal_Int32 nValAct = GetCoreValue( *m_xMtrStartWidth, m_ePoolUnit ); sal_Int32 nValNew = nValAct + (((nNewLineWidth - m_nActLineWidth) * 15) / 10); if(nValNew < 0) nValNew = 0; - SetMetricValue( *m_pMtrStartWidth, nValNew, m_ePoolUnit ); + SetMetricValue( *m_xMtrStartWidth, nValNew, m_ePoolUnit ); - nValAct = GetCoreValue( *m_pMtrEndWidth, m_ePoolUnit ); + nValAct = GetCoreValue( *m_xMtrEndWidth, m_ePoolUnit ); nValNew = nValAct + (((nNewLineWidth - m_nActLineWidth) * 15) / 10); if(nValNew < 0) nValNew = 0; - SetMetricValue( *m_pMtrEndWidth, nValNew, m_ePoolUnit ); + SetMetricValue( *m_xMtrEndWidth, nValNew, m_ePoolUnit ); } // Remember current value @@ -1532,175 +1232,377 @@ void SvxLineTabPage::ChangePreviewHdl_Impl(void const * pCntrl ) } FillXLSet_Impl(); - m_pCtlPreview->Invalidate(); + m_aCtlPreview.Invalidate(); // Make transparency accessible accordingly - if( m_pLbLineStyle->GetSelectedEntryPos() == 0 ) // invisible + if( m_xLbLineStyle->get_active() == 0 ) // invisible { - m_pBoxTransparency->Disable(); + m_xBoxTransparency->set_sensitive(false); } else { - m_pBoxTransparency->Enable(); + m_xBoxTransparency->set_sensitive(true); } - const bool bHasLineStyle = m_pLbLineStyle->GetSelectedEntryPos() !=0; - const bool bHasLineStart = m_pLbStartStyle->GetSelectedEntryPos() != 0; + const bool bHasLineStyle = m_xLbLineStyle->get_active() !=0; + const bool bHasLineStart = m_xLbStartStyle->get_active() != 0; - m_pBoxStart->Enable(bHasLineStart && bHasLineStyle); + m_xBoxStart->set_sensitive(bHasLineStart && bHasLineStyle); - const bool bHasLineEnd = m_pLbEndStyle->GetSelectedEntryPos() != 0; + const bool bHasLineEnd = m_xLbEndStyle->get_active() != 0; - m_pBoxEnd->Enable(bHasLineEnd && bHasLineStyle); + m_xBoxEnd->set_sensitive(bHasLineEnd && bHasLineStyle); } - -IMPL_LINK( SvxLineTabPage, ChangeStartClickHdl_Impl, Button*, p, void ) +IMPL_LINK_NOARG(SvxLineTabPage, ChangeStartClickHdl_Impl, weld::Button&, void) { - ChangeStartHdl_Impl(p); + if (m_xCbxSynchronize->get_active()) + m_xTsbCenterEnd->set_state(m_xTsbCenterStart->get_state()); + ChangePreviewHdl_Impl(nullptr); } -IMPL_LINK( SvxLineTabPage, ChangeStartListBoxHdl_Impl, ListBox&, rListBox, void ) -{ - ChangeStartHdl_Impl(&rListBox); -} -IMPL_LINK( SvxLineTabPage, ChangeStartModifyHdl_Impl, Edit&, rEdit, void ) + +IMPL_LINK_NOARG(SvxLineTabPage, ChangeStartListBoxHdl_Impl, weld::ComboBox&, void) { - ChangeStartHdl_Impl(&rEdit); + if (m_xCbxSynchronize->get_active()) + m_xLbEndStyle->set_active(m_xLbStartStyle->get_active()); + + ChangePreviewHdl_Impl(nullptr); } -void SvxLineTabPage::ChangeStartHdl_Impl( void const * p ) + +IMPL_LINK_NOARG(SvxLineTabPage, ChangeStartModifyHdl_Impl, weld::MetricSpinButton&, void) { - if( m_pCbxSynchronize->IsChecked() ) - { - if( p == m_pMtrStartWidth ) - m_pMtrEndWidth->SetValue( m_pMtrStartWidth->GetValue() ); - if( p == m_pLbStartStyle ) - m_pLbEndStyle->SelectEntryPos( m_pLbStartStyle->GetSelectedEntryPos() ); - if( p == m_pTsbCenterStart ) - m_pTsbCenterEnd->SetState( m_pTsbCenterStart->GetState() ); - } + if (m_xCbxSynchronize->get_active()) + m_xMtrEndWidth->set_value(m_xMtrStartWidth->get_value(FUNIT_NONE), FUNIT_NONE); - ChangePreviewHdl_Impl( nullptr ); + ChangePreviewHdl_Impl(nullptr); } - -IMPL_LINK_NOARG(SvxLineTabPage, ChangeEdgeStyleHdl_Impl, ListBox&, void) +IMPL_LINK_NOARG(SvxLineTabPage, ChangeEdgeStyleHdl_Impl, weld::ComboBox&, void) { ChangePreviewHdl_Impl( nullptr ); } - // fdo#43209 - -IMPL_LINK_NOARG( SvxLineTabPage, ChangeCapStyleHdl_Impl, ListBox&, void ) +IMPL_LINK_NOARG(SvxLineTabPage, ChangeCapStyleHdl_Impl, weld::ComboBox&, void) { ChangePreviewHdl_Impl( nullptr ); } +IMPL_LINK_NOARG(SvxLineTabPage, ClickInvisibleHdl_Impl, weld::ComboBox&, void) +{ + ClickInvisibleHdl_Impl(); +} -IMPL_LINK_NOARG(SvxLineTabPage, ClickInvisibleHdl_Impl, ListBox&, void) +void SvxLineTabPage::ClickInvisibleHdl_Impl() { - if( m_pLbLineStyle->GetSelectedEntryPos() == 0 ) // invisible + if( m_xLbLineStyle->get_active() == 0 ) // invisible { if(!m_bSymbols) - m_pBoxColor->Disable(); + m_xBoxColor->set_sensitive(false); - m_pBoxWidth->Disable(); + m_xBoxWidth->set_sensitive(false); - if( m_pFlLineEnds->IsEnabled() ) + if( m_xFlLineEnds->get_sensitive() ) { - m_pBoxStart->Disable(); - m_pBoxArrowStyles->Disable(); - - - m_pGridEdgeCaps->Disable(); + m_xBoxStart->set_sensitive(false); + m_xBoxArrowStyles->set_sensitive(false); + m_xGridEdgeCaps->set_sensitive(false); } } else { - m_pBoxColor->Enable(); - m_pBoxWidth->Enable(); + m_xBoxColor->set_sensitive(true); + m_xBoxWidth->set_sensitive(true); - if( m_pFlLineEnds->IsEnabled() ) + if (m_xFlLineEnds->get_sensitive()) { - m_pBoxArrowStyles->Enable(); - m_pGridEdgeCaps->Enable(); + m_xBoxArrowStyles->set_sensitive(true); + m_xGridEdgeCaps->set_sensitive(true); } } ChangePreviewHdl_Impl( nullptr ); } - -IMPL_LINK( SvxLineTabPage, ChangeEndClickHdl_Impl, Button*, p, void ) -{ - ChangeEndHdl_Impl(p); -} -IMPL_LINK( SvxLineTabPage, ChangeEndListBoxHdl_Impl, ListBox&, rListBox, void ) +IMPL_LINK_NOARG(SvxLineTabPage, ChangeEndClickHdl_Impl, weld::Button&, void) { - ChangeEndHdl_Impl(&rListBox); + if (m_xCbxSynchronize->get_active()) + m_xTsbCenterStart->set_state(m_xTsbCenterEnd->get_state()); + + ChangePreviewHdl_Impl(nullptr); } -IMPL_LINK( SvxLineTabPage, ChangeEndModifyHdl_Impl, Edit&, rEdit, void ) + +IMPL_LINK_NOARG(SvxLineTabPage, ChangeEndListBoxHdl_Impl, weld::ComboBox&, void) { - ChangeEndHdl_Impl(&rEdit); + if (m_xCbxSynchronize->get_active()) + m_xLbStartStyle->set_active(m_xLbEndStyle->get_active()); + + ChangePreviewHdl_Impl(nullptr); } -void SvxLineTabPage::ChangeEndHdl_Impl( void const * p ) + +IMPL_LINK_NOARG(SvxLineTabPage, ChangeEndModifyHdl_Impl, weld::MetricSpinButton&, void) { - if( m_pCbxSynchronize->IsChecked() ) - { - if( p == m_pMtrEndWidth ) - m_pMtrStartWidth->SetValue( m_pMtrEndWidth->GetValue() ); - if( p == m_pLbEndStyle ) - m_pLbStartStyle->SelectEntryPos( m_pLbEndStyle->GetSelectedEntryPos() ); - if( p == m_pTsbCenterEnd ) - m_pTsbCenterStart->SetState( m_pTsbCenterEnd->GetState() ); - } + if (m_xCbxSynchronize->get_active()) + m_xMtrStartWidth->set_value(m_xMtrEndWidth->get_value(FUNIT_NONE), FUNIT_NONE); - ChangePreviewHdl_Impl( nullptr ); + ChangePreviewHdl_Impl(nullptr); } - -IMPL_LINK_NOARG(SvxLineTabPage, ChangeTransparentHdl_Impl, Edit&, void) +IMPL_LINK_NOARG(SvxLineTabPage, ChangeTransparentHdl_Impl, weld::MetricSpinButton&, void) { - sal_uInt16 nVal = static_cast<sal_uInt16>(m_pMtrTransparent->GetValue()); + sal_uInt16 nVal = m_xMtrTransparent->get_value(FUNIT_PERCENT); - m_rXLSet.Put( XLineTransparenceItem( nVal ) ); + m_rXLSet.Put(XLineTransparenceItem(nVal)); FillXLSet_Impl(); - m_pCtlPreview->Invalidate(); + m_aCtlPreview.Invalidate(); } void SvxLineTabPage::FillUserData() { // Write the synched value to the INI file -// OUString aStrUserData = OUString::valueOf( (sal_Int32) m_pCbxSynchronize->IsChecked() ); - OUString aStrUserData = OUString::boolean(m_pCbxSynchronize->IsChecked()); + OUString aStrUserData = OUString::boolean(m_xCbxSynchronize->get_active()); SetUserData( aStrUserData ); } - // #58425# Symbols on a list (e.g. StarChart) // Handler for the symbol selection's popup menu (NumMenueButton) // The following link originates from SvxNumOptionsTabPage -IMPL_LINK( SvxLineTabPage, MenuCreateHdl_Impl, MenuButton *, pButton, void ) +void SvxLineTabPage::MenuCreate() { - InitSymbols(pButton); + ScopedVclPtrInstance< VirtualDevice > pVD; + + // Initialize popup + if (!m_xGalleryMenu) + { + m_xGalleryMenu = m_xBuilder->weld_menu("gallerysubmenu"); + // Get gallery entries + GalleryExplorer::FillObjList(GALLERY_THEME_BULLETS, m_aGrfNames); + + sal_uInt32 i = 0; + m_nNumMenuGalleryItems = m_aGrfNames.size(); + for (auto const& grfName : m_aGrfNames) + { + const OUString *pUIName = &grfName; + + // Convert URL encodings to UI characters (e.g. %20 for spaces) + OUString aPhysicalName; + if (osl::FileBase::getSystemPathFromFileURL(grfName, aPhysicalName) + == osl::FileBase::E_None) + { + pUIName = &aPhysicalName; + } + + SvxBmpItemInfo* pInfo = new SvxBmpItemInfo; + pInfo->pBrushItem.reset(new SvxBrushItem(grfName, "", GPOS_AREA, SID_ATTR_BRUSH)); + pInfo->sItemId = "gallery" + OUString::number(i); + m_aGalleryBrushItems.emplace_back(pInfo); + const Graphic* pGraphic = pInfo->pBrushItem->GetGraphic(); + + if(pGraphic) + { + BitmapEx aBitmap(pGraphic->GetBitmapEx()); + Size aSize(aBitmap.GetSizePixel()); + if(aSize.Width() > MAX_BMP_WIDTH || aSize.Height() > MAX_BMP_HEIGHT) + { + bool bWidth = aSize.Width() > aSize.Height(); + double nScale = bWidth ? + double(MAX_BMP_WIDTH) / static_cast<double>(aSize.Width()): + double(MAX_BMP_HEIGHT) / static_cast<double>(aSize.Height()); + aBitmap.Scale(nScale, nScale); + + } + pVD->SetOutputSizePixel(aBitmap.GetSizePixel(), false); + pVD->DrawBitmapEx(Point(), aBitmap); + m_xGalleryMenu->append(pInfo->sItemId, *pUIName, *pVD); + } + else + { + m_xGalleryMenu->append(pInfo->sItemId, *pUIName); + } + ++i; + } + + if (m_aGrfNames.empty()) + m_xMenu->set_sensitive("gallery", false); + } + + if (!m_xSymbolsMenu && m_pSymbolList) + { + m_xSymbolsMenu = m_xBuilder->weld_menu("symbolssubmenu"); + ScopedVclPtrInstance< VirtualDevice > pVDev; + pVDev->SetMapMode(MapMode(MapUnit::Map100thMM)); + std::unique_ptr<SdrModel> pModel( + new SdrModel(nullptr, nullptr, true)); + pModel->GetItemPool().FreezeIdRanges(); + // Page + SdrPage* pPage = new SdrPage( *pModel, false ); + pPage->SetSize(Size(1000,1000)); + pModel->InsertPage( pPage, 0 ); + { + // 3D View + std::unique_ptr<SdrView> pView(new SdrView( *pModel, pVDev )); + pView->hideMarkHandles(); + pView->ShowSdrPage(pPage); + + // Generate invisible square to give all symbols a + // bitmap size, which is independent from specific glyph + SdrObject *pInvisibleSquare=m_pSymbolList->GetObj(0); + + // directly clone to target SdrModel + pInvisibleSquare = pInvisibleSquare->CloneSdrObject(*pModel); + + pPage->NbcInsertObject(pInvisibleSquare); + pInvisibleSquare->SetMergedItem(XFillTransparenceItem(100)); + pInvisibleSquare->SetMergedItem(XLineTransparenceItem(100)); + + for(size_t i=0;; ++i) + { + SdrObject *pObj=m_pSymbolList->GetObj(i); + if(pObj==nullptr) + break; + + // directly clone to target SdrModel + pObj = pObj->CloneSdrObject(*pModel); + + m_aGrfNames.emplace_back(""); + pPage->NbcInsertObject(pObj); + if(m_pSymbolAttr) + { + pObj->SetMergedItemSet(*m_pSymbolAttr); + } + else + { + pObj->SetMergedItemSet(m_rOutAttrs); + } + pView->MarkAll(); + BitmapEx aBitmapEx(pView->GetMarkedObjBitmapEx()); + GDIMetaFile aMeta(pView->GetMarkedObjMetaFile()); + pView->UnmarkAll(); + pObj=pPage->RemoveObject(1); + SdrObject::Free(pObj); + + SvxBmpItemInfo* pInfo = new SvxBmpItemInfo; + pInfo->pBrushItem.reset(new SvxBrushItem(Graphic(aMeta), GPOS_AREA, SID_ATTR_BRUSH)); + pInfo->sItemId = "symbol" + OUString::number(i); + m_aSymbolBrushItems.emplace_back(pInfo); + + Size aSize(aBitmapEx.GetSizePixel()); + if(aSize.Width() > MAX_BMP_WIDTH || aSize.Height() > MAX_BMP_HEIGHT) + { + bool bWidth = aSize.Width() > aSize.Height(); + double nScale = bWidth ? + double(MAX_BMP_WIDTH) / static_cast<double>(aSize.Width()): + double(MAX_BMP_HEIGHT) / static_cast<double>(aSize.Height()); + aBitmapEx.Scale(nScale, nScale); + } + pVD->SetOutputSizePixel(aBitmapEx.GetSizePixel(), false); + pVD->DrawBitmapEx(Point(), aBitmapEx); + m_xSymbolsMenu->append(pInfo->sItemId, "foo", *pVD); + } + pInvisibleSquare=pPage->RemoveObject(0); + SdrObject::Free(pInvisibleSquare); + + if (m_aGrfNames.empty()) + m_xMenu->set_sensitive("symbols", false); + } + } } // #58425# Symbols on a list (e.g. StarChart) // Handler for menu button -IMPL_LINK( SvxLineTabPage, GraphicHdl_Impl, MenuButton *, pButton, void ) +IMPL_LINK(SvxLineTabPage, GraphicHdl_Impl, const OString&, rIdent, void) { - SymbolSelected(pButton); + const Graphic* pGraphic = nullptr; + Graphic aGraphic; + bool bResetSize = false; + bool bEnable = true; + long nPreviousSymbolType = m_nSymbolType; + + OString sNumber; + if (rIdent.startsWith("gallery", &sNumber)) + { + SvxBmpItemInfo* pInfo = m_aGalleryBrushItems[sNumber.toUInt32()].get(); + pGraphic = pInfo->pBrushItem->GetGraphic(); + } + else if (rIdent.startsWith("symbol", &sNumber)) + { + SvxBmpItemInfo* pInfo = m_aSymbolBrushItems[sNumber.toUInt32()].get(); + pGraphic = pInfo->pBrushItem->GetGraphic(); + } + else if (rIdent == "automatic") + { + pGraphic=&m_aAutoSymbolGraphic; + m_aAutoSymbolGraphic.SetPrefSize( Size(253,253) ); + m_nSymbolType=SVX_SYMBOLTYPE_AUTO; + } + else if (rIdent == "none") + { + m_nSymbolType=SVX_SYMBOLTYPE_NONE; + pGraphic=nullptr; + bEnable = false; + } + else if (rIdent == "file") + { + SvxOpenGraphicDialog aGrfDlg(CuiResId(RID_SVXSTR_EDIT_GRAPHIC), GetDialogFrameWeld()); + aGrfDlg.EnableLink(false); + aGrfDlg.AsLink(false); + if( !aGrfDlg.Execute() ) + { + // Remember selected filters + if( !aGrfDlg.GetGraphic(aGraphic) ) + { + m_nSymbolType=SVX_SYMBOLTYPE_BRUSHITEM; + pGraphic = &aGraphic; + bResetSize = true; + } + } + if( !pGraphic ) + return; + } + + if(pGraphic) + { + Size aSize = SvxNumberFormat::GetGraphicSizeMM100(pGraphic); + aSize = OutputDevice::LogicToLogic(aSize, MapMode(MapUnit::Map100thMM), MapMode(m_ePoolUnit)); + m_aSymbolGraphic=*pGraphic; + if( bResetSize ) + { + m_aSymbolSize=aSize; + } + else if( nPreviousSymbolType == SVX_SYMBOLTYPE_BRUSHITEM ) + { //#i31097# Data Point Symbol size changes when a different symbol is chosen(maoyg) + if( m_aSymbolSize.Width() != m_aSymbolSize.Height() ) + { + aSize.setWidth( static_cast<long>( m_aSymbolSize.Width() + m_aSymbolSize.Height() )/2 ); + aSize.setHeight( static_cast<long>( m_aSymbolSize.Width() + m_aSymbolSize.Height() )/2 ); + m_aSymbolSize = aSize; + } + } + m_aCtlPreview.SetSymbol(&m_aSymbolGraphic,m_aSymbolSize); + } + else + { + m_aSymbolGraphic=Graphic(); + m_aCtlPreview.SetSymbol(nullptr,m_aSymbolSize); + bEnable = false; + } + m_aSymbolLastSize=m_aSymbolSize; + SetMetricValue(*m_xSymbolWidthMF, m_aSymbolSize.Width(), m_ePoolUnit); + SetMetricValue(*m_xSymbolHeightMF, m_aSymbolSize.Height(), m_ePoolUnit); + + m_xGridIconSize->set_sensitive(bEnable); + m_aCtlPreview.Invalidate(); } -IMPL_LINK( SvxLineTabPage, SizeHdl_Impl, Edit&, rField, void) +IMPL_LINK( SvxLineTabPage, SizeHdl_Impl, weld::MetricSpinButton&, rField, void) { m_bNewSize = true; - bool bWidth = &rField == m_pSymbolWidthMF; + bool bWidth = &rField == m_xSymbolWidthMF.get(); m_bLastWidthModified = bWidth; - bool bRatio = m_pSymbolRatioCB->IsChecked(); - long nWidthVal = static_cast<long>(m_pSymbolWidthMF->Denormalize(m_pSymbolWidthMF->GetValue(FUNIT_100TH_MM))); - long nHeightVal= static_cast<long>(m_pSymbolHeightMF->Denormalize(m_pSymbolHeightMF->GetValue(FUNIT_100TH_MM))); + bool bRatio = m_xSymbolRatioCB->get_active(); + long nWidthVal = static_cast<long>(m_xSymbolWidthMF->denormalize(m_xSymbolWidthMF->get_value(FUNIT_100TH_MM))); + long nHeightVal= static_cast<long>(m_xSymbolHeightMF->denormalize(m_xSymbolHeightMF->get_value(FUNIT_100TH_MM))); nWidthVal = OutputDevice::LogicToLogic(nWidthVal,MapUnit::Map100thMM, m_ePoolUnit ); nHeightVal = OutputDevice::LogicToLogic(nHeightVal,MapUnit::Map100thMM, m_ePoolUnit); m_aSymbolSize = Size(nWidthVal,nHeightVal); @@ -1712,9 +1614,7 @@ IMPL_LINK( SvxLineTabPage, SizeHdl_Impl, Edit&, rField, void) fSizeRatio = static_cast<double>(m_aSymbolLastSize.Width()) / m_aSymbolLastSize.Height(); } - //Size aSymbolSize(aSymbolLastSize); - - if(bWidth) + if (bWidth) { long nDelta = nWidthVal - m_aSymbolLastSize.Width(); m_aSymbolSize.setWidth( nWidthVal ); @@ -1722,7 +1622,8 @@ IMPL_LINK( SvxLineTabPage, SizeHdl_Impl, Edit&, rField, void) { m_aSymbolSize.setHeight( m_aSymbolLastSize.Height() + static_cast<long>(static_cast<double>(nDelta) / fSizeRatio) ); m_aSymbolSize.setHeight( OutputDevice::LogicToLogic( m_aSymbolSize.Height(), m_ePoolUnit, MapUnit::Map100thMM ) ); - m_pSymbolHeightMF->SetUserValue(m_pSymbolHeightMF->Normalize(m_aSymbolSize.Height()), FUNIT_100TH_MM); +//TODO m_xSymbolHeightMF->SetUserValue(m_xSymbolHeightMF->normalize(m_aSymbolSize.Height()), FUNIT_100TH_MM); + m_xSymbolHeightMF->set_value(m_xSymbolHeightMF->normalize(m_aSymbolSize.Height()), FUNIT_100TH_MM); } } else @@ -1733,24 +1634,25 @@ IMPL_LINK( SvxLineTabPage, SizeHdl_Impl, Edit&, rField, void) { m_aSymbolSize.setWidth( m_aSymbolLastSize.Width() + static_cast<long>(static_cast<double>(nDelta) * fSizeRatio) ); m_aSymbolSize.setWidth( OutputDevice::LogicToLogic( m_aSymbolSize.Width(), m_ePoolUnit, MapUnit::Map100thMM ) ); - m_pSymbolWidthMF->SetUserValue(m_pSymbolWidthMF->Normalize(m_aSymbolSize.Width()), FUNIT_100TH_MM); +//TODO m_xSymbolWidthMF->SetUserValue(m_xSymbolWidthMF->normalize(m_aSymbolSize.Width()), FUNIT_100TH_MM); + m_xSymbolWidthMF->set_value(m_xSymbolWidthMF->normalize(m_aSymbolSize.Width()), FUNIT_100TH_MM); } } - m_pCtlPreview->ResizeSymbol(m_aSymbolSize); + m_aCtlPreview.ResizeSymbol(m_aSymbolSize); m_aSymbolLastSize=m_aSymbolSize; } -IMPL_LINK( SvxLineTabPage, RatioHdl_Impl, Button*, pBox, void ) + +IMPL_LINK(SvxLineTabPage, RatioHdl_Impl, weld::ToggleButton&, rBox, void) { - if (static_cast<CheckBox*>(pBox)->IsChecked()) + if (rBox.get_active()) { if (m_bLastWidthModified) - SizeHdl_Impl(*m_pSymbolWidthMF); + SizeHdl_Impl(*m_xSymbolWidthMF); else - SizeHdl_Impl(*m_pSymbolHeightMF); + SizeHdl_Impl(*m_xSymbolHeightMF); } } - void SvxLineTabPage::DataChanged( const DataChangedEvent& rDCEvt ) { SfxTabPage::DataChanged( rDCEvt ); |