diff options
author | Rishabh Kumar <kris.kr296@gmail.com> | 2016-07-04 16:44:31 +0530 |
---|---|---|
committer | Katarina Behrens <Katarina.Behrens@cib.de> | 2016-07-06 09:39:34 +0000 |
commit | 50ba4a079ec6dbf00277bcfbbf15dc2f10d8cdcf (patch) | |
tree | ebf21c4ac58e2a6c67dccf88c4655aa5646abf56 /cui | |
parent | f3ca52306a604d6702cd31d58c5c1902340090ab (diff) |
Redesign of Hatch tab
1. New Hatch Listbox for presets.
2. Context menu for rename and delete.
3. Rearrangement of controls.
4. Remove Save and Load Buttons.
Change-Id: Iad2479bc418f7a257a410df7f11c23ed8dd7734c
Reviewed-on: https://gerrit.libreoffice.org/26869
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
Diffstat (limited to 'cui')
-rw-r--r-- | cui/source/inc/cuitabarea.hxx | 14 | ||||
-rw-r--r-- | cui/source/tabpages/tphatch.cxx | 372 | ||||
-rw-r--r-- | cui/uiconfig/ui/hatchpage.ui | 550 |
3 files changed, 331 insertions, 605 deletions
diff --git a/cui/source/inc/cuitabarea.hxx b/cui/source/inc/cuitabarea.hxx index e3b8c9eaa7b6..fb8625f49b7e 100644 --- a/cui/source/inc/cuitabarea.hxx +++ b/cui/source/inc/cuitabarea.hxx @@ -30,6 +30,7 @@ #include <svx/tabarea.hxx> #include <svx/hexcolorcontrol.hxx> #include <svx/SvxColorValueSet.hxx> +#include <svx/SvxPresetListBox.hxx> class SdrModel; class SdrView; @@ -478,13 +479,10 @@ private: VclPtr<ListBox> m_pLbLineType; VclPtr<ColorLB> m_pLbLineColor; VclPtr<ColorLB> m_pLbBackgroundColor; - VclPtr<HatchingLB> m_pLbHatchings; + VclPtr<SvxPresetListBox> m_pHatchLB; 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; @@ -505,7 +503,8 @@ private: SfxMapUnit m_ePoolUnit; - DECL_LINK_TYPED( ChangeHatchHdl_Impl, ListBox&, void ); + DECL_LINK_TYPED( ChangeHatchHdl, ValueSet*, void ); + void ChangeHatchHdl_Impl(); DECL_LINK_TYPED( ModifiedEditHdl_Impl, Edit&, void ); DECL_LINK_TYPED( ModifiedListBoxHdl_Impl, ListBox&, void ); DECL_LINK_TYPED( ModifiedBackgroundHdl_Impl, ListBox&, void ); @@ -513,9 +512,8 @@ private: void ModifiedHdl_Impl(void*); DECL_LINK_TYPED( ClickAddHdl_Impl, Button*, void ); DECL_LINK_TYPED( ClickModifyHdl_Impl, Button*, void ); - DECL_LINK_TYPED( ClickDeleteHdl_Impl, Button*, void ); - DECL_LINK_TYPED( ClickLoadHdl_Impl, Button*, void ); - DECL_LINK_TYPED( ClickSaveHdl_Impl, Button*, void ); + DECL_LINK_TYPED( ClickRenameHdl_Impl, SvxPresetListBox*, void ); + DECL_LINK_TYPED( ClickDeleteHdl_Impl, SvxPresetListBox*, void ); long CheckChanges_Impl(); sal_Int32 SearchHatchList(const OUString& rHatchName); diff --git a/cui/source/tabpages/tphatch.cxx b/cui/source/tabpages/tphatch.cxx index 489ab7833c76..b806722cd1f3 100644 --- a/cui/source/tabpages/tphatch.cxx +++ b/cui/source/tabpages/tphatch.cxx @@ -43,6 +43,7 @@ #include "paragrph.hrc" #include <svx/dialogs.hrc> + using namespace com::sun::star; SvxHatchTabPage::SvxHatchTabPage @@ -73,19 +74,14 @@ SvxHatchTabPage::SvxHatchTabPage get(m_pLbLineType, "linetypelb"); get(m_pLbLineColor, "linecolorlb"); get(m_pLbBackgroundColor, "backgroundcolorlb"); - get(m_pLbHatchings, "hatchingslb"); + get(m_pHatchLB , "hatchpresetlist"); Size aSize = getDrawListBoxOptimalSize(this); - m_pLbHatchings->set_width_request(aSize.Width()); - m_pLbHatchings->set_height_request(aSize.Height()); get(m_pCtlPreview, "previewctl"); 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"); // this page needs ExchangeSupport SetExchangeSupport(); @@ -108,15 +104,13 @@ SvxHatchTabPage::SvxHatchTabPage assert( pPool && "Where is the pool?" ); m_ePoolUnit = pPool->GetMetric( SID_ATTR_FILL_HATCH ); - // setting the slider range - m_pSliderAngle->SetRange(Range(0,359)); - // setting the output device m_rXFSet.Put( m_aXFStyleItem ); m_rXFSet.Put( m_aXHatchItem ); m_pCtlPreview->SetAttributes( m_aXFillAttr.GetItemSet() ); - - m_pLbHatchings->SetSelectHdl( LINK( this, SvxHatchTabPage, ChangeHatchHdl_Impl ) ); + m_pHatchLB->SetSelectHdl( LINK( this, SvxHatchTabPage, ChangeHatchHdl ) ); + m_pHatchLB->SetRenameHdl( LINK( this, SvxHatchTabPage, ClickRenameHdl_Impl ) ); + m_pHatchLB->SetDeleteHdl( LINK( this, SvxHatchTabPage, ClickDeleteHdl_Impl ) ); Link<Edit&,void> aLink = LINK( this, SvxHatchTabPage, ModifiedEditHdl_Impl ); Link<ListBox&,void> aLink2 = LINK( this, SvxHatchTabPage, ModifiedListBoxHdl_Impl ); @@ -128,16 +122,10 @@ SvxHatchTabPage::SvxHatchTabPage m_pLbBackgroundColor->SetSelectHdl( LINK( this, SvxHatchTabPage, ModifiedBackgroundHdl_Impl ) ); m_pBtnAdd->SetClickHdl( LINK( this, SvxHatchTabPage, ClickAddHdl_Impl ) ); - m_pBtnModify->SetClickHdl( - LINK( this, SvxHatchTabPage, ClickModifyHdl_Impl ) ); - m_pBtnDelete->SetClickHdl( - LINK( this, SvxHatchTabPage, ClickDeleteHdl_Impl ) ); - m_pBtnLoad->SetClickHdl( LINK( this, SvxHatchTabPage, ClickLoadHdl_Impl ) ); - m_pBtnSave->SetClickHdl( LINK( this, SvxHatchTabPage, ClickSaveHdl_Impl ) ); + m_pBtnModify->SetClickHdl( LINK( this, SvxHatchTabPage, ClickModifyHdl_Impl ) ); m_pCtlPreview->SetDrawMode( GetSettings().GetStyleSettings().GetHighContrastMode() ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR ); - setPreviewsToSamePlace(pParent, this); } SvxHatchTabPage::~SvxHatchTabPage() @@ -153,13 +141,10 @@ void SvxHatchTabPage::dispose() m_pLbLineType.clear(); m_pLbLineColor.clear(); m_pLbBackgroundColor.clear(); - m_pLbHatchings.clear(); + m_pHatchLB.clear(); m_pCtlPreview.clear(); m_pBtnAdd.clear(); m_pBtnModify.clear(); - m_pBtnDelete.clear(); - m_pBtnLoad.clear(); - m_pBtnSave.clear(); SvxTabPage::dispose(); } @@ -168,7 +153,7 @@ void SvxHatchTabPage::Construct() { m_pLbLineColor->Fill( m_pColorList ); m_pLbBackgroundColor->Fill( m_pColorList ); - m_pLbHatchings->Fill( m_pHatchingList ); + m_pHatchLB->FillPresetListBox(*m_pHatchingList); } @@ -224,10 +209,10 @@ void SvxHatchTabPage::ActivatePage( const SfxItemSet& rSet ) if( *m_pPageType == PT_HATCH && *m_pPos != LISTBOX_ENTRY_NOTFOUND ) { - m_pLbHatchings->SelectEntryPos( *m_pPos ); + m_pHatchLB->SelectItem( *m_pPos ); } // colors could have been deleted - ChangeHatchHdl_Impl( *m_pLbHatchings ); + ChangeHatchHdl_Impl(); *m_pPageType = PT_HATCH; *m_pPos = LISTBOX_ENTRY_NOTFOUND; @@ -272,7 +257,7 @@ long SvxHatchTabPage::CheckChanges_Impl() m_pMtrAngle->IsValueChangedFromSaved() || m_pLbLineType->IsValueChangedFromSaved() || m_pLbLineColor->IsValueChangedFromSaved() || - m_pLbHatchings->IsValueChangedFromSaved() ) + m_pHatchLB->IsValueChangedFromSaved() ) { ResMgr& rMgr = CUI_MGR(); Image aWarningBoxImage = WarningBox::GetStandardImage(); @@ -307,9 +292,9 @@ long SvxHatchTabPage::CheckChanges_Impl() } } - sal_Int32 nPos = m_pLbHatchings->GetSelectEntryPos(); - if( nPos != LISTBOX_ENTRY_NOTFOUND ) - *m_pPos = nPos; + sal_Int32 nPos = m_pHatchLB->GetSelectItemId(); + if( nPos != 0 ) + *m_pPos = nPos - 1; return 0L; } @@ -340,11 +325,11 @@ bool SvxHatchTabPage::FillItemSet( SfxItemSet* rSet ) std::unique_ptr<XHatch> pXHatch; OUString aString; - sal_Int32 nPos = m_pLbHatchings->GetSelectEntryPos(); - if( nPos != LISTBOX_ENTRY_NOTFOUND ) + sal_Int32 nPos = m_pHatchLB->GetSelectItemId(); + if( nPos != 0 ) { - pXHatch.reset(new XHatch( m_pHatchingList->GetHatch( nPos )->GetHatch() )); - aString = m_pLbHatchings->GetSelectEntry(); + pXHatch.reset(new XHatch( m_pHatchingList->GetHatch( nPos - 1 )->GetHatch() )); + aString = m_pHatchLB->GetItemText( m_pHatchLB->GetSelectItemId() ); } // gradient has been (unidentifiedly) passed else @@ -379,21 +364,7 @@ bool SvxHatchTabPage::FillItemSet( SfxItemSet* rSet ) void SvxHatchTabPage::Reset( const SfxItemSet* rSet ) { - ChangeHatchHdl_Impl( *m_pLbHatchings ); - - // determine button state - if( m_pHatchingList->Count() ) - { - m_pBtnModify->Enable(); - m_pBtnDelete->Enable(); - m_pBtnSave->Enable(); - } - else - { - m_pBtnModify->Disable(); - m_pBtnDelete->Disable(); - m_pBtnSave->Disable(); - } + ChangeHatchHdl_Impl(); m_rXFSet.Put( static_cast<const XFillColorItem&>( rSet->Get(XATTR_FILLCOLOR)) ); m_rXFSet.Put( static_cast<const XFillBackgroundItem&>(rSet->Get(XATTR_FILLBACKGROUND)) ); @@ -450,13 +421,18 @@ void SvxHatchTabPage::ModifiedHdl_Impl( void* p ) m_pCtlPreview->Invalidate(); } -IMPL_LINK_NOARG_TYPED(SvxHatchTabPage, ChangeHatchHdl_Impl, ListBox&, void) +IMPL_LINK_NOARG_TYPED(SvxHatchTabPage, ChangeHatchHdl, ValueSet*, void) +{ + ChangeHatchHdl_Impl(); +} + +void SvxHatchTabPage::ChangeHatchHdl_Impl() { std::unique_ptr<XHatch> pHatch; - int nPos = m_pLbHatchings->GetSelectEntryPos(); + int nPos = m_pHatchLB->GetSelectItemId(); - if( nPos != LISTBOX_ENTRY_NOTFOUND ) - pHatch.reset(new XHatch( m_pHatchingList->GetHatch( nPos )->GetHatch() )); + if( nPos != 0 ) + pHatch.reset(new XHatch( m_pHatchingList->GetHatch( nPos - 1 )->GetHatch() )); else { const SfxPoolItem* pPoolItem = nullptr; @@ -470,10 +446,10 @@ IMPL_LINK_NOARG_TYPED(SvxHatchTabPage, ChangeHatchHdl_Impl, ListBox&, void) } if( !pHatch ) { - m_pLbHatchings->SelectEntryPos( 0 ); - nPos = m_pLbHatchings->GetSelectEntryPos(); - if( nPos != LISTBOX_ENTRY_NOTFOUND ) - pHatch.reset(new XHatch( m_pHatchingList->GetHatch( nPos )->GetHatch() )); + m_pHatchLB->SelectItem( 1 ); + nPos = m_pHatchLB->GetSelectItemId(); + if( nPos != 0 ) + pHatch.reset(new XHatch( m_pHatchingList->GetHatch( nPos - 1 )->GetHatch() )); } } if( pHatch ) @@ -506,7 +482,7 @@ IMPL_LINK_NOARG_TYPED(SvxHatchTabPage, ChangeHatchHdl_Impl, ListBox&, void) m_pLbLineType->SaveValue(); m_pLbLineColor->SaveValue(); m_pLbBackgroundColor->SaveValue(); - m_pLbHatchings->SaveValue(); + m_pHatchLB->SaveValue(); } IMPL_LINK_NOARG_TYPED(SvxHatchTabPage, ClickAddHdl_Impl, Button*, void) @@ -566,281 +542,115 @@ IMPL_LINK_NOARG_TYPED(SvxHatchTabPage, ClickAddHdl_Impl, Button*, void) m_pHatchingList->Insert( pEntry, nCount ); - m_pLbHatchings->Append( *pEntry, m_pHatchingList->GetUiBitmap( nCount ) ); - - m_pLbHatchings->SelectEntryPos( m_pLbHatchings->GetEntryCount() - 1 ); - -#ifdef _WIN32 - // hack: #31355# W.P. - Rectangle aRect( m_pLbHatchings->GetPosPixel(), m_pLbHatchings->GetSizePixel() ); - if( sal_True ) { // ??? overlapped with pDlg - // and srolling - Invalidate( aRect ); - } -#endif + m_pHatchLB->Clear(); + m_pHatchLB->FillPresetListBox( *m_pHatchingList ); + m_pHatchLB->SelectItem( nCount + 1 ); *m_pnHatchingListState |= ChangeType::MODIFIED; - ChangeHatchHdl_Impl( *m_pLbHatchings ); - } - - // determine button state - if( m_pHatchingList->Count() ) - { - m_pBtnModify->Enable(); - m_pBtnDelete->Enable(); - m_pBtnSave->Enable(); + ChangeHatchHdl_Impl(); } } - IMPL_LINK_NOARG_TYPED(SvxHatchTabPage, ClickModifyHdl_Impl, Button*, void) { - sal_Int32 nPos = m_pLbHatchings->GetSelectEntryPos(); + sal_Int32 nPos = m_pHatchLB->GetSelectItemId(); - if ( nPos != LISTBOX_ENTRY_NOTFOUND ) + if( nPos != 0 ) { - OUString aDesc( CUI_RES( RID_SVXSTR_DESC_HATCH ) ); - OUString aName( m_pHatchingList->GetHatch( 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 nHatchPos = SearchHatchList( aName ); - bool bValidHatchName = (nHatchPos == nPos) || (nHatchPos == LISTBOX_ENTRY_NOTFOUND); - - if( bValidHatchName ) - { - bLoop = false; - XHatch aXHatch( m_pLbLineColor->GetSelectEntryColor(), - (css::drawing::HatchStyle) m_pLbLineType->GetSelectEntryPos(), - GetCoreValue( *m_pMtrDistance, m_ePoolUnit ), - static_cast<long>(m_pMtrAngle->GetValue() * 10) ); + OUString aName( m_pHatchingList->GetHatch( nPos - 1 )->GetName() ); - XHatchEntry* pEntry = new XHatchEntry( aXHatch, aName ); + XHatch aXHatch( m_pLbLineColor->GetSelectEntryColor(), + (css::drawing::HatchStyle) m_pLbLineType->GetSelectEntryPos(), + GetCoreValue( *m_pMtrDistance, m_ePoolUnit ), + static_cast<long>(m_pMtrAngle->GetValue() * 10) ); - delete m_pHatchingList->Replace( pEntry, nPos ); + XHatchEntry* pEntry = new XHatchEntry( aXHatch, aName ); - m_pLbHatchings->Modify( *pEntry, nPos, m_pHatchingList->GetUiBitmap( nPos ) ); + delete m_pHatchingList->Replace( pEntry, nPos - 1 ); - m_pLbHatchings->SelectEntryPos( nPos ); + m_pHatchLB->Clear(); + m_pHatchLB->FillPresetListBox( *m_pHatchingList ); + m_pHatchLB->SelectItem( nPos ); - // save values for changes recognition (-> method) - m_pMtrDistance->SaveValue(); - m_pMtrAngle->SaveValue(); - m_pLbLineType->SaveValue(); - m_pLbLineColor->SaveValue(); - m_pLbBackgroundColor->SaveValue(); - m_pLbHatchings->SaveValue(); + // save values for changes recognition (-> method) + m_pMtrDistance->SaveValue(); + m_pMtrAngle->SaveValue(); + m_pLbLineType->SaveValue(); + m_pLbLineColor->SaveValue(); + m_pLbBackgroundColor->SaveValue(); - *m_pnHatchingListState |= ChangeType::MODIFIED; - } - else - { - ScopedVclPtrInstance<MessageDialog> aBox( GetParentDialog() - ,"DuplicateNameDialog" - ,"cui/ui/queryduplicatedialog.ui" ); - aBox->Execute(); - } - } + *m_pnHatchingListState |= ChangeType::MODIFIED; } } - -IMPL_LINK_NOARG_TYPED(SvxHatchTabPage, ClickDeleteHdl_Impl, Button*, void) +IMPL_LINK_NOARG_TYPED(SvxHatchTabPage, ClickDeleteHdl_Impl, SvxPresetListBox*, void) { - sal_Int32 nPos = m_pLbHatchings->GetSelectEntryPos(); + sal_Int32 nPos = m_pHatchLB->GetSelectItemId(); - if( nPos != LISTBOX_ENTRY_NOTFOUND ) + if( nPos != 0 ) { ScopedVclPtrInstance< MessageDialog > aQueryBox( GetParentDialog(),"AskDelHatchDialog","cui/ui/querydeletehatchdialog.ui"); if( aQueryBox->Execute() == RET_YES ) { - delete m_pHatchingList->Remove( nPos ); - m_pLbHatchings->RemoveEntry( nPos ); - m_pLbHatchings->SelectEntryPos( 0 ); + m_pHatchingList->Remove( nPos - 1 ); + m_pHatchLB->RemoveItem( nPos ); + m_pHatchLB->SelectItem( 1 ); m_pCtlPreview->Invalidate(); - ChangeHatchHdl_Impl( *m_pLbHatchings ); + ChangeHatchHdl_Impl(); *m_pnHatchingListState |= ChangeType::MODIFIED; } } - // determine button state - if( !m_pHatchingList->Count() ) - { - m_pBtnModify->Disable(); - m_pBtnDelete->Disable(); - m_pBtnSave->Disable(); - } } - -IMPL_LINK_NOARG_TYPED(SvxHatchTabPage, ClickLoadHdl_Impl, Button*, void) +IMPL_LINK_NOARG_TYPED(SvxHatchTabPage, ClickRenameHdl_Impl, SvxPresetListBox*, void ) { - ResMgr& rMgr = CUI_MGR(); - sal_uInt16 nReturn = RET_YES; - - if ( *m_pnHatchingListState & ChangeType::MODIFIED ) - { - nReturn = ScopedVclPtrInstance<MessageDialog>::Create( GetParentDialog() - ,"AskSaveList" - ,"cui/ui/querysavelistdialog.ui")->Execute(); - - if ( nReturn == RET_YES ) - m_pHatchingList->Save(); - } + sal_Int32 nPos = m_pHatchLB->GetSelectItemId(); - if ( nReturn != RET_CANCEL ) + if( nPos != 0 ) { - ::sfx2::FileDialogHelper aDlg( css::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE ); - OUString aStrFilterType( "*.soh" ); - 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_HATCH ) ); + OUString aName( m_pHatchingList->GetHatch( nPos - 1 )->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 ) { - INetURLObject aURL( aDlg.GetPath() ); - INetURLObject aPathURL( aURL ); - - aPathURL.removeSegment(); - aPathURL.removeFinalSlash(); + pDlg->GetName( aName ); + sal_Int32 nHatchPos = SearchHatchList( aName ); + bool bValidHatchName = (nHatchPos == nPos - 1) || (nHatchPos == LISTBOX_ENTRY_NOTFOUND); - XHatchListRef pHatchList = XPropertyList::AsHatchList( - XPropertyList::CreatePropertyList( - XHATCH_LIST, aPathURL.GetMainURL( INetURLObject::NO_DECODE ), "" )); - pHatchList->SetName( aURL.getName() ); - if( pHatchList->Load() ) + if(bValidHatchName) { - m_pHatchingList = pHatchList; - static_cast<SvxAreaTabDialog*>( GetParentDialog() )->SetNewHatchingList( m_pHatchingList ); - - m_pLbHatchings->Clear(); - m_pLbHatchings->Fill( m_pHatchingList ); - Reset( &m_rOutAttrs ); - - m_pHatchingList->SetName( aURL.getName() ); - - // determining (and possibly cutting) the name - // and displaying it in the GroupBox - OUString aString( ResId( RID_SVXSTR_TABLE, rMgr ) ); - aString += ": "; + bLoop = false; + XHatchEntry* pEntry = m_pHatchingList->GetHatch( nPos - 1 ); + pEntry->SetName( aName ); - if ( aURL.getBase().getLength() > 18 ) - { - aString += aURL.getBase().copy( 0, 15 ); - aString += "..."; - } - else - aString += aURL.getBase(); + delete m_pHatchingList->Replace( pEntry, nPos - 1 ); + m_pHatchLB->Clear(); + m_pHatchLB->FillPresetListBox(*m_pHatchingList); + m_pHatchLB->SelectItem( nPos ); - *m_pnHatchingListState |= ChangeType::CHANGED; - *m_pnHatchingListState &= ~ChangeType::MODIFIED; + *m_pnHatchingListState |= ChangeType::MODIFIED; } else - ScopedVclPtrInstance<MessageDialog>::Create( GetParentDialog() - ,"NoLoadedFileDialog" - ,"cui/ui/querynoloadedfiledialog.ui")->Execute(); - } - } - - // determine button state - if ( m_pHatchingList->Count() ) - { - m_pBtnModify->Enable(); - m_pBtnDelete->Enable(); - m_pBtnSave->Enable(); - } - else - { - m_pBtnModify->Disable(); - m_pBtnDelete->Disable(); - m_pBtnSave->Disable(); - } -} - - -IMPL_LINK_NOARG_TYPED(SvxHatchTabPage, ClickSaveHdl_Impl, Button*, void) -{ - ::sfx2::FileDialogHelper aDlg( css::ui::dialogs::TemplateDescription::FILESAVE_SIMPLE ); - OUString aStrFilterType( "*.soh" ); - 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_pHatchingList->GetName().isEmpty() ) - { - aFile.Append( m_pHatchingList->GetName() ); - - if( aFile.getExtension().isEmpty() ) - aFile.SetExtension( "soh" ); - } - - aDlg.SetDisplayDirectory( aFile.GetMainURL( INetURLObject::NO_DECODE ) ); - if ( aDlg.Execute() == ERRCODE_NONE ) - { - INetURLObject aURL( aDlg.GetPath() ); - INetURLObject aPathURL( aURL ); - - aPathURL.removeSegment(); - aPathURL.removeFinalSlash(); - - m_pHatchingList->SetName( aURL.getName() ); - m_pHatchingList->SetPath( aPathURL.GetMainURL( INetURLObject::NO_DECODE ) ); - - if( m_pHatchingList->Save() ) - { - // determining (and 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 += "..."; + ScopedVclPtrInstance<MessageDialog> aBox( GetParentDialog() + ,"DuplicateNameDialog" + ,"cui/ui/queryduplicatedialog.ui" ); + aBox->Execute(); } - else - aString += aURL.getBase(); - - *m_pnHatchingListState |= ChangeType::SAVED; - *m_pnHatchingListState &= ~ChangeType::MODIFIED; - } - else - { - ScopedVclPtrInstance<MessageDialog>::Create( GetParentDialog() - ,"NoSaveFileDialog" - ,"cui/ui/querynosavefiledialog.ui")->Execute(); } } + } void SvxHatchTabPage::PointChanged( vcl::Window*, RECT_POINT ) diff --git a/cui/uiconfig/ui/hatchpage.ui b/cui/uiconfig/ui/hatchpage.ui index 2156b258ed9e..cd1dc259d1af 100644 --- a/cui/uiconfig/ui/hatchpage.ui +++ b/cui/uiconfig/ui/hatchpage.ui @@ -13,27 +13,111 @@ <property name="step_increment">1</property> </object> <object class="GtkAdjustment" id="distanceadjustment"> - <property name="lower">0.3</property> + <property name="lower">0.29999999999999999</property> <property name="upper">99</property> <property name="step_increment">100</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="GtkBox" id="HatchPage"> <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="frame3"> + <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="alignment3"> + <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="box5"> + <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="hatchpresetlist"> + <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">1</property> + </packing> + </child> + </object> + </child> + </object> + </child> + <child type="label"> + <object class="GtkLabel" id="label2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Hatch</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> @@ -58,404 +142,176 @@ <property name="vexpand">True</property> <property name="spacing">12</property> <child> - <object class="GtkGrid" id="maingrid"> + <object class="GtkBox" id="box3"> <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="GtkBox" id="box3"> + <object class="GtkLabel" id="distanceft"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="orientation">vertical</property> - <property name="spacing">6</property> - <child> - <object class="GtkLabel" id="distanceft"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">_Spacing:</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="GtkSpinButton" id="distancemtr:0mm"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="invisible_char">●</property> - <property name="adjustment">distanceadjustment</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> + <property name="xalign">0</property> + <property name="label" translatable="yes">_Spacing:</property> + <property name="use_underline">True</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> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> </packing> </child> <child> - <object class="GtkBox" id="box6"> + <object class="GtkSpinButton" id="distancemtr:0mm"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="orientation">vertical</property> - <property name="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="label" translatable="yes">A_ngle:</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="GtkBox" id="box1"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="spacing">6</property> - <child> - <object class="GtkScale" id="angleslider"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="hexpand">True</property> - <property name="adjustment">adjustment1</property> - <property name="round_digits">1</property> - <property name="draw_value">False</property> - </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">0</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="expand">False</property> - <property name="fill">False</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> + <property name="can_focus">True</property> + <property name="invisible_char">●</property> + <property name="adjustment">distanceadjustment</property> </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> <child> - <object class="GtkBox" id="box7"> + <object class="GtkLabel" id="angleft"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="orientation">vertical</property> - <property name="spacing">6</property> - <child> - <object class="GtkLabel" id="linetypeft"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">_Line 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="linetypelb"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <items> - <item translatable="yes">Single</item> - <item translatable="yes">Crossed</item> - <item translatable="yes">Triple</item> - </items> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> + <property name="xalign">0</property> + <property name="label" translatable="yes">A_ngle:</property> + <property name="use_underline">True</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">2</property> - <property name="width">1</property> - <property name="height">1</property> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> </packing> </child> <child> - <object class="GtkBox" id="box8"> + <object class="GtkBox" id="box1"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="orientation">vertical</property> <property name="spacing">6</property> <child> - <object class="GtkLabel" id="linecolorft"> + <object class="GtkScale" id="angleslider"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Line _color:</property> - <property name="use_underline">True</property> + <property name="can_focus">True</property> + <property name="hexpand">True</property> + <property name="adjustment">adjustment1</property> + <property name="round_digits">1</property> + <property name="draw_value">False</property> </object> <packing> - <property name="expand">False</property> + <property name="expand">True</property> <property name="fill">True</property> <property name="position">0</property> </packing> </child> <child> - <object class="svxlo-ColorLB" id="linecolorlb"> - <property name="visible">True</property> - <property name="can_focus">False</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">3</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="GtkBox" id="box9"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="orientation">vertical</property> - <property name="spacing">6</property> - <child> - <object class="GtkLabel" id="backgroundcolorft"> + <object class="GtkSpinButton" id="anglemtr:0degrees"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Background color:</property> + <property name="can_focus">True</property> + <property name="invisible_char">●</property> + <property name="adjustment">angleadjustment</property> </object> <packing> <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="svxlo-ColorLB" id="backgroundcolorlb"> - <property name="visible">True</property> - <property name="can_focus">False</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> + <property name="fill">False</property> <property name="position">1</property> </packing> </child> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">4</property> - <property name="width">1</property> - <property name="height">1</property> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">3</property> </packing> </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-HatchingLB" id="hatchingslb:border"> + <object class="GtkLabel" id="linetypeft"> <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">_Line type:</property> + <property name="use_underline">True</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> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">4</property> </packing> </child> <child> - <object class="svxlo-SvxXRectPreview" id="previewctl"> + <object class="GtkComboBoxText" id="linetypelb"> <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> + <items> + <item translatable="yes">Single</item> + <item translatable="yes">Crossed</item> + <item translatable="yes">Triple</item> + </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">5</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="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> + <object class="GtkLabel" id="linecolorft"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="use_stock">True</property> + <property name="can_focus">False</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">Line _color:</property> + <property name="use_underline">True</property> </object> <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">0</property> + <property name="position">6</property> </packing> </child> <child> - <object class="GtkButton" id="modify"> - <property name="label" translatable="yes">_Modify</property> + <object class="svxlo-ColorLB" id="linecolorlb"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="use_underline">True</property> + <property name="can_focus">False</property> </object> <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">1</property> + <property name="position">7</property> </packing> </child> <child> - <object class="GtkButton" id="delete"> - <property name="label">gtk-delete</property> + <object class="GtkLabel" id="backgroundcolorft"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="use_stock">True</property> + <property name="can_focus">False</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">Background color:</property> </object> <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">3</property> + <property name="position">8</property> </packing> </child> <child> - <object class="GtkGrid" id="grid4"> + <object class="svxlo-ColorLB" id="backgroundcolorlb"> <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 Hatching List</property> - <property name="tooltip_text" translatable="yes">Load Hatching List</property> - <property name="halign">center</property> - <property name="hexpand">True</property> - <property name="image">image1</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 Hatching List</property> - <property name="tooltip_text" translatable="yes">Save Hatching 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> + <property name="position">9</property> </packing> </child> </object> <packing> <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">2</property> + <property name="fill">True</property> + <property name="position">0</property> </packing> </child> </object> @@ -466,7 +322,7 @@ <object class="GtkLabel" id="propfl"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label" translatable="yes">Properties</property> + <property name="label" translatable="yes">Options</property> <attributes> <attribute name="weight" value="bold"/> </attributes> @@ -476,7 +332,69 @@ <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">0</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkFrame" id="frame2"> + <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="alignment2"> + <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="box4"> + <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="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="expand">False</property> + <property name="fill">False</property> + <property name="position">0</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">Preview</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">2</property> </packing> </child> </object> |