diff options
author | Rishabh Kumar <kris.kr296@gmail.com> | 2016-07-05 18:39:36 +0530 |
---|---|---|
committer | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2016-07-19 18:21:50 +0000 |
commit | da4c58551ce1bdad3467b8f9bc1da5df78757b61 (patch) | |
tree | 54eb33308bb5977a41ffbb7bc395607914d0a5a0 /cui | |
parent | bd894e5a7b9a9d6a3d3e4ea668bfea050ef39bae (diff) |
[GSoC] Redesign of Gradient tab
1. New Gradient Listbox for presets.
2. Context menu for rename and delete.
3. Rearrangement of controls.
4. Remove Save and Load buttons.
Change-Id: Id6aa0daa7c9304bb6a383ce0db95a4a7a060695e
Reviewed-on: https://gerrit.libreoffice.org/26954
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'cui')
-rw-r--r-- | cui/source/inc/cuitabarea.hxx | 12 | ||||
-rw-r--r-- | cui/source/tabpages/tpgradnt.cxx | 376 | ||||
-rw-r--r-- | cui/uiconfig/ui/gradientpage.ui | 553 |
3 files changed, 395 insertions, 546 deletions
diff --git a/cui/source/inc/cuitabarea.hxx b/cui/source/inc/cuitabarea.hxx index 5d6083dbe01f..38b85eb4722c 100644 --- a/cui/source/inc/cuitabarea.hxx +++ b/cui/source/inc/cuitabarea.hxx @@ -399,14 +399,12 @@ private: VclPtr<ColorLB> m_pLbColorTo; VclPtr<MetricField> m_pMtrColorTo; VclPtr<GradientLB> m_pLbGradients; + VclPtr<SvxPresetListBox> m_pGradientLB; VclPtr<NumericField> m_pMtrIncrement; VclPtr<Slider> m_pSliderIncrement; VclPtr<SvxXRectPreview> m_pCtlPreview; VclPtr<PushButton> m_pBtnAdd; VclPtr<PushButton> m_pBtnModify; - VclPtr<PushButton> m_pBtnDelete; - VclPtr<PushButton> m_pBtnLoad; - VclPtr<PushButton> m_pBtnSave; const SfxItemSet& m_rOutAttrs; XColorListRef m_pColorList; @@ -426,13 +424,13 @@ private: DECL_LINK_TYPED( ClickAddHdl_Impl, Button*, void ); DECL_LINK_TYPED( ClickModifyHdl_Impl, Button*, void ); - DECL_LINK_TYPED( ClickDeleteHdl_Impl, Button*, void ); - DECL_LINK_TYPED( ChangeGradientHdl_Impl, ListBox&, void ); + DECL_LINK_TYPED( ChangeGradientHdl, ValueSet*, void ); + void ChangeGradientHdl_Impl(); + DECL_LINK_TYPED( ClickRenameHdl_Impl, SvxPresetListBox*, void ); + DECL_LINK_TYPED( ClickDeleteHdl_Impl, SvxPresetListBox*, void ); DECL_LINK_TYPED( ModifiedEditHdl_Impl, Edit&, void ); DECL_LINK_TYPED( ModifiedListBoxHdl_Impl, ListBox&, void ); DECL_LINK_TYPED( ModifiedSliderHdl_Impl, Slider*, void ); - DECL_LINK_TYPED( ClickLoadHdl_Impl, Button*, void ); - DECL_LINK_TYPED( ClickSaveHdl_Impl, Button*, void ); void ModifiedHdl_Impl(void*); long CheckChanges_Impl(); diff --git a/cui/source/tabpages/tpgradnt.cxx b/cui/source/tabpages/tpgradnt.cxx index a5aad0a0adba..71c71b53662f 100644 --- a/cui/source/tabpages/tpgradnt.cxx +++ b/cui/source/tabpages/tpgradnt.cxx @@ -80,23 +80,13 @@ SvxGradientTabPage::SvxGradientTabPage get(m_pMtrColorFrom, "colorfrommtr"); get(m_pLbColorTo, "colortolb"); get(m_pMtrColorTo, "colortomtr"); - get(m_pLbGradients, "gradientslb"); - Size aSize = getDrawListBoxOptimalSize(this); - m_pLbGradients->set_width_request(aSize.Width()); - m_pLbGradients->set_height_request(aSize.Height()); + get(m_pGradientLB, "gradientpresetlist"); get(m_pCtlPreview, "previewctl"); - aSize = getDrawPreviewOptimalSize(this); + Size aSize = getDrawPreviewOptimalSize(this); m_pCtlPreview->set_width_request(aSize.Width()); m_pCtlPreview->set_height_request(aSize.Height()); get(m_pBtnAdd, "add"); get(m_pBtnModify, "modify"); - get(m_pBtnDelete, "delete"); - get(m_pBtnLoad, "load"); - get(m_pBtnSave, "save"); - - m_pLbGradients->SetAccessibleName(GetText()); - - // this page needs ExchangeSupport SetExchangeSupport(); @@ -113,13 +103,12 @@ SvxGradientTabPage::SvxGradientTabPage m_pCtlPreview->SetAttributes( m_aXFillAttr.GetItemSet() ); // set handler - m_pLbGradients->SetSelectHdl( - LINK( this, SvxGradientTabPage, ChangeGradientHdl_Impl ) ); + m_pGradientLB->SetSelectHdl( LINK( this, SvxGradientTabPage, ChangeGradientHdl ) ); + m_pGradientLB->SetRenameHdl( LINK( this, SvxGradientTabPage, ClickRenameHdl_Impl ) ); + m_pGradientLB->SetDeleteHdl( LINK( this, SvxGradientTabPage, ClickDeleteHdl_Impl ) ); m_pBtnAdd->SetClickHdl( LINK( this, SvxGradientTabPage, ClickAddHdl_Impl ) ); m_pBtnModify->SetClickHdl( LINK( this, SvxGradientTabPage, ClickModifyHdl_Impl ) ); - m_pBtnDelete->SetClickHdl( - LINK( this, SvxGradientTabPage, ClickDeleteHdl_Impl ) ); Link<Edit&,void> aLink = LINK( this, SvxGradientTabPage, ModifiedEditHdl_Impl ); Link<ListBox&,void> aLink2 = LINK( this, SvxGradientTabPage, ModifiedListBoxHdl_Impl ); @@ -136,11 +125,6 @@ SvxGradientTabPage::SvxGradientTabPage m_pMtrColorTo->SetModifyHdl( aLink ); m_pLbColorTo->SetSelectHdl( aLink2 ); - m_pBtnLoad->SetClickHdl( - LINK( this, SvxGradientTabPage, ClickLoadHdl_Impl ) ); - m_pBtnSave->SetClickHdl( - LINK( this, SvxGradientTabPage, ClickSaveHdl_Impl ) ); - // #i76307# always paint the preview in LTR, because this is what the document does m_pCtlPreview->EnableRTL( false ); @@ -168,13 +152,10 @@ void SvxGradientTabPage::dispose() m_pMtrColorFrom.clear(); m_pLbColorTo.clear(); m_pMtrColorTo.clear(); - m_pLbGradients.clear(); + m_pGradientLB.clear(); m_pCtlPreview.clear(); m_pBtnAdd.clear(); m_pBtnModify.clear(); - m_pBtnDelete.clear(); - m_pBtnLoad.clear(); - m_pBtnSave.clear(); SfxTabPage::dispose(); } @@ -184,7 +165,7 @@ void SvxGradientTabPage::Construct() m_pLbColorFrom->Fill( m_pColorList ); m_pLbColorTo->CopyEntries( *m_pLbColorFrom ); - m_pLbGradients->Fill( m_pGradientList ); + m_pGradientLB->FillPresetListBox( *m_pGradientList ); } @@ -252,10 +233,11 @@ void SvxGradientTabPage::ActivatePage( const SfxItemSet& ) if ( *m_pPageType == PT_GRADIENT && *m_pPos != LISTBOX_ENTRY_NOTFOUND ) { - m_pLbGradients->SelectEntryPos( *m_pPos ); + sal_uInt16 nId = m_pGradientLB->GetItemId( static_cast<size_t>( *m_pPos ) ); + m_pGradientLB->SelectItem( nId ); } // colors could have been deleted - ChangeGradientHdl_Impl( *m_pLbGradients ); + ChangeGradientHdl_Impl(); *m_pPageType = PT_GRADIENT; *m_pPos = LISTBOX_ENTRY_NOTFOUND; @@ -289,10 +271,10 @@ long SvxGradientTabPage::CheckChanges_Impl() (sal_uInt16) m_pMtrColorFrom->GetValue(), (sal_uInt16) m_pMtrColorTo->GetValue() ); - sal_Int32 nPos = m_pLbGradients->GetSelectEntryPos(); - if( nPos != LISTBOX_ENTRY_NOTFOUND ) + size_t nPos = m_pGradientLB->GetSelectItemPos(); + if( nPos != VALUESET_ITEM_NOTFOUND ) { - XGradient aGradient = m_pGradientList->GetGradient( nPos )->GetGradient(); + XGradient aGradient = m_pGradientList->GetGradient( static_cast<sal_uInt16>(nPos) )->GetGradient(); if( !( aTmpGradient == aGradient ) ) { @@ -315,15 +297,12 @@ long SvxGradientTabPage::CheckChanges_Impl() case RET_BTN_1: { ClickModifyHdl_Impl( nullptr ); - aGradient = m_pGradientList->GetGradient( nPos )->GetGradient(); } break; case RET_BTN_2: { ClickAddHdl_Impl( nullptr ); - nPos = m_pLbGradients->GetSelectEntryPos(); - aGradient = m_pGradientList->GetGradient( nPos )->GetGradient(); } break; @@ -332,10 +311,10 @@ long SvxGradientTabPage::CheckChanges_Impl() } } } - nPos = m_pLbGradients->GetSelectEntryPos(); - if( nPos != LISTBOX_ENTRY_NOTFOUND ) + nPos = m_pGradientLB->GetSelectItemPos(); + if( nPos != VALUESET_ITEM_NOTFOUND ) { - *m_pPos = nPos; + *m_pPos = static_cast<sal_Int32>(nPos); } return 0L; } @@ -349,13 +328,12 @@ bool SvxGradientTabPage::FillItemSet( SfxItemSet* rSet ) std::unique_ptr<XGradient> pXGradient; OUString aString; - sal_Int32 nPos = m_pLbGradients->GetSelectEntryPos(); + size_t nPos = m_pGradientLB->GetSelectItemPos(); sal_uInt16 nValue = m_pMtrIncrement->GetValue(); - if( nPos != LISTBOX_ENTRY_NOTFOUND ) + if( nPos != VALUESET_ITEM_NOTFOUND ) { - pXGradient.reset(new XGradient( m_pGradientList->GetGradient( nPos )->GetGradient() )); - aString = m_pLbGradients->GetSelectEntry(); - + pXGradient.reset(new XGradient( m_pGradientList->GetGradient( static_cast<sal_uInt16>(nPos) )->GetGradient() )); + aString = m_pGradientLB->GetItemText( m_pGradientLB->GetSelectItemId() ); } else // gradient was passed (unidentified) @@ -381,22 +359,13 @@ bool SvxGradientTabPage::FillItemSet( SfxItemSet* rSet ) void SvxGradientTabPage::Reset( const SfxItemSet* ) { - // m_pLbGradients->SelectEntryPos( 0 ); - ChangeGradientHdl_Impl( *m_pLbGradients ); + ChangeGradientHdl_Impl(); // determine state of the buttons if( m_pGradientList->Count() ) - { m_pBtnModify->Enable(); - m_pBtnDelete->Enable(); - m_pBtnSave->Enable(); - } else - { m_pBtnModify->Disable(); - m_pBtnDelete->Disable(); - m_pBtnSave->Disable(); - } } @@ -518,301 +487,138 @@ IMPL_LINK_NOARG_TYPED(SvxGradientTabPage, ClickAddHdl_Impl, Button*, void) m_pGradientList->Insert( pEntry, nCount ); - m_pLbGradients->Append( *pEntry, m_pGradientList->GetUiBitmap( nCount ) ); - - m_pLbGradients->SelectEntryPos( m_pLbGradients->GetEntryCount() - 1 ); - -#ifdef _WIN32 - // hack: #31355# W.P. - Rectangle aRect( m_pLbGradients->GetPosPixel(), m_pLbGradients->GetSizePixel() ); - if( sal_True ) { // ??? overlapped with pDlg - // and srolling - Invalidate( aRect ); - } -#endif + sal_Int32 nId = m_pGradientLB->GetItemId(nCount - 1); //calculate the last ID + Bitmap aBitmap = m_pGradientList->GetBitmapForPreview( nCount, m_pGradientLB->GetIconSize() ); + m_pGradientLB->InsertItem( nId + 1, Image(aBitmap), aName ); + m_pGradientLB->SelectItem( nId + 1 ); *m_pnGradientListState |= ChangeType::MODIFIED; - ChangeGradientHdl_Impl( *m_pLbGradients ); + ChangeGradientHdl_Impl(); } // determine button state if( m_pGradientList->Count() ) - { m_pBtnModify->Enable(); - m_pBtnDelete->Enable(); - m_pBtnSave->Enable(); - } } IMPL_LINK_NOARG_TYPED(SvxGradientTabPage, ClickModifyHdl_Impl, Button*, void) { - sal_Int32 nPos = m_pLbGradients->GetSelectEntryPos(); + sal_uInt16 nId = m_pGradientLB->GetSelectItemId(); + size_t nPos = m_pGradientLB->GetSelectItemPos(); - if ( nPos != LISTBOX_ENTRY_NOTFOUND ) + if ( nPos != VALUESET_ITEM_NOTFOUND ) { - OUString aDesc( CUI_RES( RID_SVXSTR_DESC_GRADIENT ) ); - OUString aName( m_pGradientList->GetGradient( nPos )->GetName() ); - - SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - assert(pFact && "Dialog creation failed!"); - std::unique_ptr<AbstractSvxNameDialog> pDlg(pFact->CreateSvxNameDialog( GetParentDialog(), aName, aDesc )); - assert(pDlg && "Dialog creation failed!"); - - bool bLoop = true; - - while( bLoop && pDlg->Execute() == RET_OK ) - { - pDlg->GetName( aName ); - sal_Int32 nGradientPos = SearchGradientList(aName); - bool bValidGradientName = (nGradientPos == nPos) || (nGradientPos == LISTBOX_ENTRY_NOTFOUND); - - if( bValidGradientName ) - { - bLoop = false; - XGradient aXGradient( m_pLbColorFrom->GetSelectEntryColor(), - m_pLbColorTo->GetSelectEntryColor(), - (css::awt::GradientStyle) m_pLbGradientType->GetSelectEntryPos(), - static_cast<long>(m_pMtrAngle->GetValue() * 10), // should be changed in resource - (sal_uInt16) m_pMtrCenterX->GetValue(), - (sal_uInt16) m_pMtrCenterY->GetValue(), - (sal_uInt16) m_pMtrBorder->GetValue(), - (sal_uInt16) m_pMtrColorFrom->GetValue(), - (sal_uInt16) m_pMtrColorTo->GetValue() ); - - XGradientEntry* pEntry = new XGradientEntry( aXGradient, aName ); + OUString aName( m_pGradientList->GetGradient( static_cast<sal_uInt16>(nPos) )->GetName() ); - delete m_pGradientList->Replace( pEntry, nPos ); + XGradient aXGradient( m_pLbColorFrom->GetSelectEntryColor(), + m_pLbColorTo->GetSelectEntryColor(), + (css::awt::GradientStyle) m_pLbGradientType->GetSelectEntryPos(), + static_cast<long>(m_pMtrAngle->GetValue() * 10), // should be changed in resource + (sal_uInt16) m_pMtrCenterX->GetValue(), + (sal_uInt16) m_pMtrCenterY->GetValue(), + (sal_uInt16) m_pMtrBorder->GetValue(), + (sal_uInt16) m_pMtrColorFrom->GetValue(), + (sal_uInt16) m_pMtrColorTo->GetValue() ); - m_pLbGradients->Modify( *pEntry, nPos, m_pGradientList->GetUiBitmap( nPos ) ); + XGradientEntry* pEntry = new XGradientEntry( aXGradient, aName ); - m_pLbGradients->SelectEntryPos( nPos ); + delete m_pGradientList->Replace( pEntry, static_cast<sal_uInt16>(nPos) ); - *m_pnGradientListState |= ChangeType::MODIFIED; - } - else - { - ScopedVclPtrInstance<MessageDialog> aBox( GetParentDialog() - ,"DuplicateNameDialog" - ,"cui/ui/queryduplicatedialog.ui" ); - aBox->Execute(); - } + Bitmap aBitmap = m_pGradientList->GetBitmapForPreview( static_cast<sal_uInt16>(nPos), m_pGradientLB->GetIconSize() ); + m_pGradientLB->RemoveItem( nId ); + m_pGradientLB->InsertItem( nId, Image(aBitmap), aName, static_cast<sal_uInt16>(nPos) ); + m_pGradientLB->SelectItem( nId ); - } + *m_pnGradientListState |= ChangeType::MODIFIED; } } - -IMPL_LINK_NOARG_TYPED(SvxGradientTabPage, ClickDeleteHdl_Impl, Button*, void) +IMPL_LINK_NOARG_TYPED(SvxGradientTabPage, ClickDeleteHdl_Impl, SvxPresetListBox*, void) { - sal_Int32 nPos = m_pLbGradients->GetSelectEntryPos(); + sal_uInt16 nId = m_pGradientLB->GetSelectItemId(); + size_t nPos = m_pGradientLB->GetSelectItemPos(); - if( nPos != LISTBOX_ENTRY_NOTFOUND ) + if( nPos != VALUESET_ITEM_NOTFOUND ) { ScopedVclPtrInstance< MessageDialog > aQueryBox( GetParentDialog(),"AskDelGradientDialog","cui/ui/querydeletegradientdialog.ui"); if ( aQueryBox->Execute() == RET_YES ) { - delete m_pGradientList->Remove( nPos ); - m_pLbGradients->RemoveEntry( nPos ); - m_pLbGradients->SelectEntryPos( 0 ); + delete m_pGradientList->Remove( static_cast<sal_uInt16>(nPos) ); + m_pGradientLB->RemoveItem( nId ); + nId = m_pGradientLB->GetItemId( 0 ); + m_pGradientLB->SelectItem( nId ); m_pCtlPreview->Invalidate(); - ChangeGradientHdl_Impl( *m_pLbGradients ); + ChangeGradientHdl_Impl(); *m_pnGradientListState |= ChangeType::MODIFIED; } } // determine button state if( !m_pGradientList->Count() ) - { m_pBtnModify->Disable(); - m_pBtnDelete->Disable(); - m_pBtnSave->Disable(); - } } - -IMPL_LINK_NOARG_TYPED(SvxGradientTabPage, ClickLoadHdl_Impl, Button*, void) +IMPL_LINK_NOARG_TYPED(SvxGradientTabPage, ClickRenameHdl_Impl, SvxPresetListBox*, void) { - ResMgr& rMgr = CUI_MGR(); - sal_uInt16 nReturn = RET_YES; - - if ( *m_pnGradientListState & ChangeType::MODIFIED ) - { - nReturn = ScopedVclPtrInstance<MessageDialog>::Create( GetParentDialog() - ,"AskSaveList" - ,"cui/ui/querysavelistdialog.ui")->Execute(); - - if ( nReturn == RET_YES ) - m_pGradientList->Save(); - } + sal_uInt16 nId = m_pGradientLB->GetSelectItemId(); + size_t nPos = m_pGradientLB->GetSelectItemPos(); - if ( nReturn != RET_CANCEL ) + if ( nPos != VALUESET_ITEM_NOTFOUND ) { - ::sfx2::FileDialogHelper aDlg( css::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE ); - OUString aStrFilterType( "*.sog" ); - aDlg.AddFilter( aStrFilterType, aStrFilterType ); - OUString aPalettePath(SvtPathOptions().GetPalettePath()); - OUString aLastDir; - sal_Int32 nIndex = 0; - do - { - aLastDir = aPalettePath.getToken(0, ';', nIndex); - } - while (nIndex >= 0); + OUString aDesc( CUI_RES( RID_SVXSTR_DESC_GRADIENT ) ); + OUString aName( m_pGradientList->GetGradient( nPos )->GetName() ); - INetURLObject aFile(aLastDir); - aDlg.SetDisplayDirectory( aFile.GetMainURL( INetURLObject::NO_DECODE ) ); + SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); + assert(pFact && "Dialog creation failed!"); + std::unique_ptr<AbstractSvxNameDialog> pDlg(pFact->CreateSvxNameDialog( GetParentDialog(), aName, aDesc )); + assert(pDlg && "Dialog creation failed!"); - if( aDlg.Execute() == ERRCODE_NONE ) + bool bLoop = true; + while( bLoop && pDlg->Execute() == RET_OK ) { - EnterWait(); - - INetURLObject aURL( aDlg.GetPath() ); - INetURLObject aPathURL( aURL ); - - aPathURL.removeSegment(); - aPathURL.removeFinalSlash(); - - // save list - XGradientListRef pGrdList = XPropertyList::AsGradientList( - XPropertyList::CreatePropertyList( - XGRADIENT_LIST, - aPathURL.GetMainURL(INetURLObject::NO_DECODE), "")); - pGrdList->SetName( aURL.getName() ); + pDlg->GetName( aName ); + sal_Int32 nGradientPos = SearchGradientList(aName); + bool bValidGradientName = (nGradientPos == static_cast<sal_Int32>(nPos) ) || (nGradientPos == LISTBOX_ENTRY_NOTFOUND); - if ( pGrdList->Load() ) + if( bValidGradientName ) { - m_pGradientList = pGrdList; - static_cast<SvxAreaTabDialog*>( GetParentDialog() )-> - SetNewGradientList( m_pGradientList ); - - m_pLbGradients->Clear(); - m_pLbGradients->Fill( m_pGradientList ); - Reset( &m_rOutAttrs ); - - m_pGradientList->SetName( aURL.getName() ); - - // determining (possibly cutting) the name - // and displaying it in the GroupBox - OUString aString( ResId( RID_SVXSTR_TABLE, rMgr ) ); - aString += ": "; + bLoop = false; + XGradientEntry* pEntry = m_pGradientList->GetGradient( static_cast<sal_uInt16>(nPos) ); + pEntry->SetName( aName ); - if ( aURL.getBase().getLength() > 18 ) - { - aString += aURL.getBase().copy( 0, 15 ); - aString += "..."; - } - else - aString += aURL.getBase(); + m_pGradientLB->SetItemText( nId, aName ); + m_pGradientLB->SelectItem( nId ); - *m_pnGradientListState |= ChangeType::CHANGED; - *m_pnGradientListState &= ~ChangeType::MODIFIED; - LeaveWait(); + *m_pnGradientListState |= ChangeType::MODIFIED; } else { - LeaveWait(); - ScopedVclPtrInstance<MessageDialog>::Create( GetParentDialog() - ,"NoLoadedFileDialog" - ,"cui/ui/querynoloadedfiledialog.ui")->Execute(); + ScopedVclPtrInstance<MessageDialog> aBox( GetParentDialog() + ,"DuplicateNameDialog" + ,"cui/ui/queryduplicatedialog.ui" ); + aBox->Execute(); } } } - - // determine button state - if( m_pGradientList->Count() ) - { - m_pBtnModify->Enable(); - m_pBtnDelete->Enable(); - m_pBtnSave->Enable(); - } - else - { - m_pBtnModify->Disable(); - m_pBtnDelete->Disable(); - m_pBtnSave->Disable(); - } } - -IMPL_LINK_NOARG_TYPED(SvxGradientTabPage, ClickSaveHdl_Impl, Button*, void) +IMPL_LINK_NOARG_TYPED(SvxGradientTabPage, ChangeGradientHdl, ValueSet*, void) { - ::sfx2::FileDialogHelper aDlg( - css::ui::dialogs::TemplateDescription::FILESAVE_SIMPLE ); - OUString aStrFilterType( "*.sog" ); - aDlg.AddFilter( aStrFilterType, aStrFilterType ); - - OUString aPalettePath(SvtPathOptions().GetPalettePath()); - OUString aLastDir; - sal_Int32 nIndex = 0; - do - { - aLastDir = aPalettePath.getToken(0, ';', nIndex); - } - while (nIndex >= 0); - - INetURLObject aFile(aLastDir); - SAL_WARN_IF( aFile.GetProtocol() == INetProtocol::NotValid, "cui.tabpages", "invalid URL" ); - - if( !m_pGradientList->GetName().isEmpty() ) - { - aFile.Append( m_pGradientList->GetName() ); - - if( aFile.getExtension().isEmpty() ) - aFile.SetExtension( "sog" ); - } - - aDlg.SetDisplayDirectory( aFile.GetMainURL( INetURLObject::NO_DECODE ) ); - if ( aDlg.Execute() == ERRCODE_NONE ) - { - INetURLObject aURL( aDlg.GetPath() ); - INetURLObject aPathURL( aURL ); - - aPathURL.removeSegment(); - aPathURL.removeFinalSlash(); - - m_pGradientList->SetName( aURL.getName() ); - m_pGradientList->SetPath( aPathURL.GetMainURL( INetURLObject::NO_DECODE ) ); - - if( m_pGradientList->Save() ) - { - // determining (possibly cutting) the name - // and displaying it in the GroupBox - OUString aString( CUI_RES( RID_SVXSTR_TABLE ) ); - aString += ": "; - - if ( aURL.getBase().getLength() > 18 ) - { - aString += aURL.getBase().copy( 0, 15 ); - aString += "..."; - } - else - aString += aURL.getBase(); - - *m_pnGradientListState |= ChangeType::SAVED; - *m_pnGradientListState &= ~ChangeType::MODIFIED; - } - else - { - ScopedVclPtrInstance<MessageDialog>::Create( GetParentDialog() - ,"NoSaveFileDialog" - ,"cui/ui/querynosavefiledialog.ui")->Execute(); - } - } + ChangeGradientHdl_Impl(); } - -IMPL_LINK_NOARG_TYPED(SvxGradientTabPage, ChangeGradientHdl_Impl, ListBox&, void) +void SvxGradientTabPage::ChangeGradientHdl_Impl() { std::unique_ptr<XGradient> pGradient; - int nPos = m_pLbGradients->GetSelectEntryPos(); + size_t nPos = m_pGradientLB->GetSelectItemPos(); - if( nPos != LISTBOX_ENTRY_NOTFOUND ) - pGradient.reset(new XGradient( m_pGradientList->GetGradient( nPos )->GetGradient() )); + if( nPos != VALUESET_ITEM_NOTFOUND ) + pGradient.reset(new XGradient( m_pGradientList->GetGradient( static_cast<sal_uInt16>( nPos ) )->GetGradient() )); else { const SfxPoolItem* pPoolItem = nullptr; @@ -826,10 +632,10 @@ IMPL_LINK_NOARG_TYPED(SvxGradientTabPage, ChangeGradientHdl_Impl, ListBox&, void } if( !pGradient ) { - m_pLbGradients->SelectEntryPos( 0 ); - nPos = m_pLbGradients->GetSelectEntryPos(); - if( nPos != LISTBOX_ENTRY_NOTFOUND ) - pGradient.reset(new XGradient( m_pGradientList->GetGradient( nPos )->GetGradient() )); + sal_uInt16 nPosition = m_pGradientLB->GetItemId(0); + m_pGradientLB->SelectItem( nPosition ); + if( nPosition != 0 ) + pGradient.reset(new XGradient( m_pGradientList->GetGradient( 0 )->GetGradient() )); } } diff --git a/cui/uiconfig/ui/gradientpage.ui b/cui/uiconfig/ui/gradientpage.ui index 69eedbdf80a4..c1f225c1a89f 100644 --- a/cui/uiconfig/ui/gradientpage.ui +++ b/cui/uiconfig/ui/gradientpage.ui @@ -13,16 +13,6 @@ <property name="upper">359</property> <property name="step_increment">15</property> </object> - <object class="GtkImage" id="image1"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="pixbuf">res/sc05501.png</property> - </object> - <object class="GtkImage" id="image2"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="pixbuf">res/sc05502.png</property> - </object> <object class="GtkAdjustment" id="percentadjustment"> <property name="upper">100</property> <property name="step_increment">5</property> @@ -30,40 +20,140 @@ <object class="GtkBox" id="GradientPage"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="hexpand">True</property> - <property name="vexpand">True</property> <property name="border_width">6</property> - <property name="orientation">vertical</property> + <property name="spacing">12</property> + <child> + <object class="GtkFrame" id="frame2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label_xalign">0</property> + <property name="shadow_type">none</property> + <child> + <object class="GtkAlignment" id="alignment2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="top_padding">6</property> + <property name="left_padding">12</property> + <child> + <object class="GtkBox" id="box4"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <property name="spacing">6</property> + <child> + <object class="svxcorelo-SvxPresetListBox" id="gradientpresetlist"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkButtonBox" id="buttonbox1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="halign">center</property> + <property name="spacing">6</property> + <property name="layout_style">start</property> + <child> + <object class="GtkButton" id="add"> + <property name="label">gtk-add</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_stock">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkButton" id="modify"> + <property name="label" translatable="yes">_Modify</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_underline">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">2</property> + </packing> + </child> + </object> + </child> + </object> + </child> + <child type="label"> + <object class="GtkLabel" id="label1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Gradient</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> <child> <object class="GtkFrame" id="frame1"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="hexpand">True</property> - <property name="vexpand">True</property> <property name="label_xalign">0</property> <property name="shadow_type">none</property> <child> <object class="GtkAlignment" id="alignment1"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="hexpand">True</property> - <property name="vexpand">True</property> <property name="top_padding">6</property> <property name="left_padding">12</property> <child> <object class="GtkBox" id="box2"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="hexpand">True</property> - <property name="vexpand">True</property> + <property name="orientation">vertical</property> <property name="spacing">12</property> <child> - <object class="GtkGrid" id="maingrid"> + <object class="GtkBox" id="box6"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="vexpand">True</property> - <property name="row_spacing">6</property> - <property name="column_spacing">12</property> + <property name="orientation">vertical</property> + <property name="spacing">6</property> + <child> + <object class="GtkLabel" id="typeft"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">_Type:</property> + <property name="use_underline">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> <child> <object class="GtkComboBoxText" id="gradienttypelb"> <property name="visible">True</property> @@ -78,19 +168,31 @@ </items> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> </packing> </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkGrid" id="grid6"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="row_spacing">6</property> + <property name="column_spacing">6</property> <child> - <object class="GtkLabel" id="typeft"> + <object class="GtkLabel" id="incrementft"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="xalign">0</property> - <property name="label" translatable="yes">_Type:</property> - <property name="use_underline">True</property> + <property name="yalign">0.43999999761581421</property> + <property name="label" translatable="yes">Increment:</property> </object> <packing> <property name="left_attach">0</property> @@ -100,43 +202,76 @@ </packing> </child> <child> - <object class="GtkLabel" id="incrementft"> + <object class="GtkScale" id="incrementslider"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="xalign">0</property> - <property name="yalign">0.43999999761581421</property> - <property name="label" translatable="yes">Increment:</property> + <property name="can_focus">True</property> + <property name="hexpand">True</property> + <property name="round_digits">1</property> + <property name="draw_value">False</property> </object> <packing> <property name="left_attach">0</property> - <property name="top_attach">2</property> + <property name="top_attach">1</property> <property name="width">1</property> <property name="height">1</property> </packing> </child> <child> - <object class="GtkScale" id="incrementslider"> + <object class="GtkSpinButton" id="incrementmtr"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="round_digits">1</property> - <property name="draw_value">False</property> + <property name="halign">end</property> + <property name="adjustment">adjustment1</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">3</property> + <property name="left_attach">1</property> + <property name="top_attach">1</property> <property name="width">1</property> <property name="height">1</property> </packing> </child> <child> - <object class="GtkSpinButton" id="incrementmtr"> + <placeholder/> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + <child> + <object class="GtkGrid" id="grid5"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="row_spacing">6</property> + <property name="column_spacing">6</property> + <child> + <object class="GtkLabel" id="angleft"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">0</property> + <property name="yalign">0.43999999761581421</property> + <property name="label" translatable="yes">A_ngle:</property> + <property name="use_underline">True</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkSpinButton" id="anglemtr:0degrees"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="adjustment">adjustment1</property> + <property name="invisible_char">●</property> + <property name="adjustment">angleadjustment</property> </object> <packing> <property name="left_attach">1</property> - <property name="top_attach">3</property> + <property name="top_attach">1</property> <property name="width">1</property> <property name="height">1</property> </packing> @@ -152,20 +287,22 @@ </object> <packing> <property name="left_attach">0</property> - <property name="top_attach">4</property> + <property name="top_attach">0</property> <property name="width">1</property> <property name="height">1</property> </packing> </child> <child> - <object class="GtkBox" id="box1"> + <object class="GtkBox" id="box9"> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="hexpand">True</property> <property name="spacing">6</property> <child> <object class="GtkSpinButton" id="centerxmtr:%"> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="hexpand">True</property> <property name="invisible_char">●</property> <property name="adjustment">percentadjustment</property> </object> @@ -179,6 +316,7 @@ <object class="GtkSpinButton" id="centerymtr:%"> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="hexpand">True</property> <property name="invisible_char">●</property> <property name="adjustment">percentadjustment</property> </object> @@ -191,41 +329,24 @@ </object> <packing> <property name="left_attach">0</property> - <property name="top_attach">5</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="angleft"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="xalign">0</property> - <property name="yalign">0.43999999761581421</property> - <property name="label" translatable="yes">A_ngle:</property> - <property name="use_underline">True</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">4</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="GtkSpinButton" id="anglemtr:0degrees"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="invisible_char">●</property> - <property name="adjustment">angleadjustment</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">5</property> + <property name="top_attach">1</property> <property name="width">1</property> <property name="height">1</property> </packing> </child> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">3</property> + </packing> + </child> + <child> + <object class="GtkGrid" id="grid3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="row_spacing">6</property> + <property name="column_spacing">6</property> <child> <object class="GtkLabel" id="borderft"> <property name="visible">True</property> @@ -237,7 +358,7 @@ </object> <packing> <property name="left_attach">0</property> - <property name="top_attach">6</property> + <property name="top_attach">0</property> <property name="width">1</property> <property name="height">1</property> </packing> @@ -246,12 +367,13 @@ <object class="GtkScale" id="borderslider"> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="hexpand">True</property> <property name="round_digits">1</property> <property name="draw_value">False</property> </object> <packing> <property name="left_attach">0</property> - <property name="top_attach">7</property> + <property name="top_attach">1</property> <property name="width">1</property> <property name="height">1</property> </packing> @@ -260,17 +382,34 @@ <object class="GtkSpinButton" id="bordermtr:%"> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="halign">end</property> <property name="invisible_char">●</property> <property name="adjustment">percentadjustment</property> </object> <packing> <property name="left_attach">1</property> - <property name="top_attach">7</property> + <property name="top_attach">1</property> <property name="width">1</property> <property name="height">1</property> </packing> </child> <child> + <placeholder/> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">4</property> + </packing> + </child> + <child> + <object class="GtkGrid" id="grid2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="row_spacing">6</property> + <property name="column_spacing">6</property> + <child> <object class="GtkLabel" id="colorfromft"> <property name="visible">True</property> <property name="can_focus">False</property> @@ -280,7 +419,7 @@ </object> <packing> <property name="left_attach">0</property> - <property name="top_attach">8</property> + <property name="top_attach">0</property> <property name="width">1</property> <property name="height">1</property> </packing> @@ -294,7 +433,7 @@ </object> <packing> <property name="left_attach">0</property> - <property name="top_attach">9</property> + <property name="top_attach">1</property> <property name="width">1</property> <property name="height">1</property> </packing> @@ -308,26 +447,27 @@ </object> <packing> <property name="left_attach">1</property> - <property name="top_attach">9</property> + <property name="top_attach">1</property> <property name="width">1</property> <property name="height">1</property> </packing> </child> <child> - <object class="GtkLabel" id="colortoft"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">_To:</property> - <property name="use_underline">True</property> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">10</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> + <placeholder/> </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">5</property> + </packing> + </child> + <child> + <object class="GtkGrid" id="grid1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="row_spacing">6</property> + <property name="column_spacing">6</property> <child> <object class="svxlo-ColorLB" id="colortolb"> <property name="visible">True</property> @@ -337,7 +477,7 @@ </object> <packing> <property name="left_attach">0</property> - <property name="top_attach">11</property> + <property name="top_attach">1</property> <property name="width">1</property> <property name="height">1</property> </packing> @@ -351,51 +491,18 @@ </object> <packing> <property name="left_attach">1</property> - <property name="top_attach">11</property> + <property name="top_attach">1</property> <property name="width">1</property> <property name="height">1</property> </packing> </child> <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkGrid" id="grid1"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="halign">center</property> - <property name="valign">start</property> - <property name="hexpand">True</property> - <property name="row_spacing">6</property> - <property name="column_spacing">6</property> - <child> - <object class="svxlo-GradientLB" id="gradientslb:border"> + <object class="GtkLabel" id="colortoft"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="entry_text_column">0</property> - <property name="id_column">1</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">_To:</property> + <property name="use_underline">True</property> </object> <packing> <property name="left_attach">0</property> @@ -405,137 +512,75 @@ </packing> </child> <child> - <object class="svxlo-SvxXRectPreview" id="previewctl"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="hexpand">True</property> - <property name="vexpand">True</property> - <child internal-child="accessible"> - <object class="AtkObject" id="previewctl-atkobject"> - <property name="AtkObject::accessible-name" translatable="yes">Example</property> - </object> - </child> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> + <placeholder/> </child> </object> <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">1</property> + <property name="position">6</property> </packing> </child> + </object> + </child> + </object> + </child> + <child type="label"> + <object class="GtkLabel" id="propfl"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Options</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + </child> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkFrame" id="frame3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="halign">start</property> + <property name="valign">start</property> + <property name="label_xalign">0</property> + <property name="shadow_type">none</property> + <child> + <object class="GtkAlignment" id="alignment3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="halign">start</property> + <property name="valign">start</property> + <property name="top_padding">6</property> + <property name="left_padding">12</property> + <child> + <object class="GtkBox" id="box3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="halign">start</property> + <property name="valign">start</property> + <property name="orientation">vertical</property> <child> - <object class="GtkButtonBox" id="buttonbox1"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="orientation">vertical</property> - <property name="spacing">6</property> - <property name="layout_style">start</property> - <child> - <object class="GtkButton" id="add"> - <property name="label">gtk-add</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="use_stock">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkButton" id="modify"> - <property name="label" translatable="yes">_Modify</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="use_underline">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkButton" id="delete"> - <property name="label">gtk-delete</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="use_stock">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">3</property> - </packing> - </child> - <child> - <object class="GtkGrid" id="grid4"> + <object class="svxlo-SvxXRectPreview" id="previewctl"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="row_spacing">6</property> - <property name="column_spacing">6</property> - <child> - <object class="GtkButton" id="load"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="has_tooltip">True</property> - <property name="tooltip_markup" translatable="yes">Load Gradient List</property> - <property name="tooltip_text" translatable="yes">Load Gradient List</property> - <property name="halign">center</property> - <property name="hexpand">True</property> - <property name="image">image1</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <child internal-child="accessible"> + <object class="AtkObject" id="previewctl-atkobject"> + <property name="AtkObject::accessible-name" translatable="yes">Example</property> </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="GtkButton" id="save"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="has_tooltip">True</property> - <property name="tooltip_markup" translatable="yes">Save Gradient List</property> - <property name="tooltip_text" translatable="yes">Save Gradient List</property> - <property name="halign">center</property> - <property name="hexpand">True</property> - <property name="image">image2</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> </child> </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">5</property> - <property name="secondary">True</property> - </packing> - </child> - </object> <packing> <property name="expand">False</property> <property name="fill">False</property> - <property name="position">2</property> + <property name="position">0</property> </packing> </child> </object> @@ -543,10 +588,10 @@ </object> </child> <child type="label"> - <object class="GtkLabel" id="propfl"> + <object class="GtkLabel" id="label2"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label" translatable="yes">Properties</property> + <property name="label" translatable="yes">Preview</property> <attributes> <attribute name="weight" value="bold"/> </attributes> @@ -555,8 +600,8 @@ </object> <packing> <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> + <property name="fill">False</property> + <property name="position">2</property> </packing> </child> </object> |