diff options
author | Caolán McNamara <caolanm@redhat.com> | 2019-12-20 17:02:25 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2019-12-21 15:38:34 +0100 |
commit | 12c72066c2a0b4cf0ab6c936c4b1bda81a0a1b6a (patch) | |
tree | 4445d0443d0f477a75dc35ceeab1a1f2829e86c1 | |
parent | 76e7360c1982d041ff99ead9fcf3cbd01d43c473 (diff) |
weld SlideTransitionPane
Change-Id: I92fdc6b75f6c1c10ea47dd95f73db2bff04a4ba3
Reviewed-on: https://gerrit.libreoffice.org/85651
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | include/svtools/valueset.hxx | 10 | ||||
-rw-r--r-- | sd/source/ui/animations/SlideTransitionPane.cxx | 386 | ||||
-rw-r--r-- | sd/source/ui/inc/BulletAndPositionDlg.hxx | 1 | ||||
-rw-r--r-- | sd/source/ui/inc/SlideTransitionPane.hxx | 59 | ||||
-rw-r--r-- | sd/uiconfig/simpress/ui/slidetransitionspanel.ui | 63 | ||||
-rw-r--r-- | solenv/sanitizers/ui/modules/simpress.suppr | 1 | ||||
-rw-r--r-- | svtools/source/control/valueset.cxx | 57 |
7 files changed, 325 insertions, 252 deletions
diff --git a/include/svtools/valueset.hxx b/include/svtools/valueset.hxx index 72d6fc0a38c7..8f3b73fda65e 100644 --- a/include/svtools/valueset.hxx +++ b/include/svtools/valueset.hxx @@ -404,7 +404,6 @@ public: class SVT_DLLPUBLIC SvtValueSet : public weld::CustomWidgetController { private: - ScopedVclPtr<VirtualDevice> maVirDev; css::uno::Reference<css::accessibility::XAccessible> mxAccessible; SvtValueItemList mItemList; @@ -442,6 +441,7 @@ private: bool mbBlackSel : 1; bool mbDoubleSel : 1; bool mbScroll : 1; + bool mbFullMode : 1; bool mbEdgeBlending : 1; bool mbHasVisibleItems : 1; @@ -473,6 +473,7 @@ private: protected: virtual css::uno::Reference<css::accessibility::XAccessible> CreateAccessible() override; + weld::ScrolledWindow* GetScrollBar() const { return mxScrolledWindow.get(); } public: SvtValueSet(std::unique_ptr<weld::ScrolledWindow> pScrolledWindow); @@ -502,9 +503,9 @@ public: /// Insert @rImage item. void InsertItem(sal_uInt16 nItemId, const Image& rImage); - /// Insert @rImage item with @rStr as a tooltip + /// Insert @rImage item with @rStr as either a legend or tooltip depending on @bShowLegend. void InsertItem(sal_uInt16 nItemId, const Image& rImage, - const OUString& rStr, size_t nPos = VALUESET_APPEND); + const OUString& rStr, size_t nPos = VALUESET_APPEND, bool bShowLegend = false); /// Insert an @rColor item with @rStr tooltip. void InsertItem(sal_uInt16 nItemId, const Color& rColor, const OUString& rStr); @@ -521,6 +522,7 @@ public: sal_uInt16 GetItemId( size_t nPos ) const; sal_uInt16 GetItemId( const Point& rPos ) const; tools::Rectangle GetItemRect( sal_uInt16 nItemId ) const; + void EnableFullItemMode( bool bFullMode ); void SetColCount( sal_uInt16 nNewCols = 1 ); void SetLineCount( sal_uInt16 nNewLines = 0 ); @@ -546,6 +548,8 @@ public: return mbNoSelection; } + void RecalculateItemSizes(); + void SetItemImage( sal_uInt16 nItemId, const Image& rImage ); Image GetItemImage( sal_uInt16 nItemId ) const; Color GetItemColor( sal_uInt16 nItemId ) const; diff --git a/sd/source/ui/animations/SlideTransitionPane.cxx b/sd/source/ui/animations/SlideTransitionPane.cxx index babab59d9b11..18da6d42a124 100644 --- a/sd/source/ui/animations/SlideTransitionPane.cxx +++ b/sd/source/ui/animations/SlideTransitionPane.cxx @@ -37,7 +37,6 @@ #include <sal/log.hxx> #include <tools/debug.hxx> #include <svx/gallery.hxx> -#include <vcl/layout.hxx> #include <vcl/stdtext.hxx> #include <vcl/svapp.hxx> #include <vcl/weld.hxx> @@ -298,20 +297,17 @@ bool lcl_findSoundInList( const ::std::vector< OUString > & rSoundList, OUString lcl_getSoundFileURL( const ::std::vector< OUString > & rSoundList, - const ListBox* rListBox ) + const weld::ComboBox& rListBox ) { - if( rListBox->GetSelectedEntryCount() > 0 ) + sal_Int32 nPos = rListBox.get_active(); + // the first three entries are no actual sounds + if( nPos >= 3 ) { - sal_Int32 nPos = rListBox->GetSelectedEntryPos(); - // the first three entries are no actual sounds - if( nPos >= 3 ) - { - DBG_ASSERT( static_cast<sal_uInt32>(rListBox->GetEntryCount() - 3) == rSoundList.size(), - "Sound list-box is not synchronized to sound list" ); - nPos -= 3; - if( rSoundList.size() > static_cast<size_t>(nPos) ) - return rSoundList[ nPos ]; - } + DBG_ASSERT( static_cast<sal_uInt32>(rListBox.get_count() - 3) == rSoundList.size(), + "Sound list-box is not synchronized to sound list" ); + nPos -= 3; + if( rSoundList.size() > static_cast<size_t>(nPos) ) + return rSoundList[ nPos ]; } return OUString(); @@ -319,29 +315,29 @@ OUString lcl_getSoundFileURL( struct lcl_AppendSoundToListBox { - explicit lcl_AppendSoundToListBox( ListBox* rListBox ) : - mrListBox( rListBox ) + explicit lcl_AppendSoundToListBox(weld::ComboBox& rListBox) + : mrListBox( rListBox ) {} void operator() ( const OUString & rString ) const { INetURLObject aURL( rString ); - mrListBox->InsertEntry( aURL.GetBase() ); + mrListBox.append_text( aURL.GetBase() ); } private: - VclPtr<ListBox> mrListBox; + weld::ComboBox& mrListBox; }; void lcl_FillSoundListBox( const ::std::vector< OUString > & rSoundList, - ListBox* rOutListBox ) + weld::ComboBox& rOutListBox ) { - sal_Int32 nCount = rOutListBox->GetEntryCount(); + sal_Int32 nCount = rOutListBox.get_count(); // keep first three entries for( sal_Int32 i=nCount - 1; i>=3; --i ) - rOutListBox->RemoveEntry( i ); + rOutListBox.remove( i ); ::std::for_each( rSoundList.begin(), rSoundList.end(), lcl_AppendSoundToListBox( rOutListBox )); @@ -369,29 +365,32 @@ size_t getPresetOffset( const sd::impl::TransitionEffect &rEffect ) namespace sd { -namespace { - -class TransitionPane : public ValueSet +class TransitionPane : public SvtValueSet { public: - explicit TransitionPane( vcl::Window *pParent ) - : ValueSet( pParent, WB_TABSTOP | WB_3DLOOK | WB_BORDER | - WB_ITEMBORDER | WB_FLATVALUESET | WB_VSCROLL ) + explicit TransitionPane(std::unique_ptr<weld::ScrolledWindow> pScrolledWindow) + : SvtValueSet(std::move(pScrolledWindow)) { - EnableFullItemMode( false ); - set_hexpand( true ); - set_vexpand( true ); - SetColCount(3); } - virtual ~TransitionPane() override { disposeOnce(); } - virtual Size GetOptimalSize() const override + void Recalculate() { - return LogicToPixel(Size(70, 88), MapMode(MapUnit::MapAppFont)); + GetScrollBar()->set_vpolicy(VclPolicyType::AUTOMATIC); + RecalculateItemSizes(); } -}; -} + virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override + { + Size aSize = pDrawingArea->get_ref_device().LogicToPixel(Size(70, 88), MapMode(MapUnit::MapAppFont)); + pDrawingArea->set_size_request(aSize.Width(), aSize.Height()); + SvtValueSet::SetDrawingArea(pDrawingArea); + SetOutputSizePixel(aSize); + + SetStyle(GetStyle() | WB_ITEMBORDER | WB_FLATVALUESET | WB_VSCROLL); + EnableFullItemMode( false ); + SetColCount(3); + } +}; // SlideTransitionPane SlideTransitionPane::SlideTransitionPane( @@ -399,7 +398,7 @@ SlideTransitionPane::SlideTransitionPane( ViewShellBase & rBase, SdDrawDocument* pDoc, const css::uno::Reference<css::frame::XFrame>& rxFrame ) : - PanelLayout( pParent, "SlideTransitionsPanel", "modules/simpress/ui/slidetransitionspanel.ui", rxFrame ), + PanelLayout( pParent, "SlideTransitionsPanel", "modules/simpress/ui/slidetransitionspanel.ui", rxFrame, true ), mrBase( rBase ), mpDrawDoc( pDoc ), @@ -418,7 +417,7 @@ SlideTransitionPane::SlideTransitionPane( SdDrawDocument* pDoc, const css::uno::Reference<css::frame::XFrame>& rxFrame, bool /*bHorizontalLayout*/ ) : - PanelLayout( pParent, "SlideTransitionsPanel", "modules/simpress/ui/slidetransitionspanelhorizontal.ui", rxFrame ), + PanelLayout( pParent, "SlideTransitionsPanel", "modules/simpress/ui/slidetransitionspanelhorizontal.ui", rxFrame, true ), mrBase( rBase ), mpDrawDoc( pDoc ), @@ -433,32 +432,30 @@ SlideTransitionPane::SlideTransitionPane( void SlideTransitionPane::Initialize(SdDrawDocument* pDoc) { - get(mpFT_VARIANT, "variant_label"); - get(mpLB_VARIANT, "variant_list"); - get(mpFT_duration, "duration_label"); - get(mpCBX_duration, "transition_duration"); - get(mpFT_SOUND, "sound_label"); - get(mpLB_SOUND, "sound_list"); - get(mpCB_LOOP_SOUND, "loop_sound" ); - get(mpRB_ADVANCE_ON_MOUSE, "rb_mouse_click"); - get(mpRB_ADVANCE_AUTO, "rb_auto_after"); - get(mpMF_ADVANCE_AUTO_AFTER, "auto_after_value"); - auto nMax = mpMF_ADVANCE_AUTO_AFTER->GetMax(); - mpMF_ADVANCE_AUTO_AFTER->SetMax(1000); - Size aOptimalSize(mpMF_ADVANCE_AUTO_AFTER->CalcMinimumSize()); - mpMF_ADVANCE_AUTO_AFTER->set_width_request(aOptimalSize.Width()); - mpMF_ADVANCE_AUTO_AFTER->SetMax(nMax); - get(mpPB_APPLY_TO_ALL, "apply_to_all"); - get(mpPB_PLAY, "play"); - get(mpCB_AUTO_PREVIEW, "auto_preview"); - - VclPtr<VclAlignment> xAlign; - get(xAlign, "transitions_icons"); - - mpVS_TRANSITION_ICONS = VclPtr<TransitionPane>::Create(xAlign); - mpVS_TRANSITION_ICONS->Show(); - - mpLB_VARIANT->SetDropDownLineCount(4); + mxFT_VARIANT = m_xBuilder->weld_label("variant_label"); + mxLB_VARIANT = m_xBuilder->weld_combo_box("variant_list"); + mxFT_duration = m_xBuilder->weld_label("duration_label"); + mxCBX_duration = m_xBuilder->weld_metric_spin_button("transition_duration", FieldUnit::SECOND); + mxFT_SOUND = m_xBuilder->weld_label("sound_label"); + mxLB_SOUND = m_xBuilder->weld_combo_box("sound_list"); + mxCB_LOOP_SOUND = m_xBuilder->weld_check_button("loop_sound"); + mxRB_ADVANCE_ON_MOUSE = m_xBuilder->weld_radio_button("rb_mouse_click"); + mxRB_ADVANCE_AUTO = m_xBuilder->weld_radio_button("rb_auto_after"); + mxMF_ADVANCE_AUTO_AFTER = m_xBuilder->weld_metric_spin_button("auto_after_value", FieldUnit::SECOND); + mxPB_APPLY_TO_ALL = m_xBuilder->weld_button("apply_to_all"); + mxPB_PLAY = m_xBuilder->weld_button("play"); + mxCB_AUTO_PREVIEW = m_xBuilder->weld_check_button("auto_preview"); + + weld::SpinButton& rSpinButton = mxMF_ADVANCE_AUTO_AFTER->get_widget(); + auto nMax = rSpinButton.get_max(); + rSpinButton.set_max(1000); + Size aOptimalSize(rSpinButton.get_preferred_size()); + rSpinButton.set_size_request(aOptimalSize.Width(), -1); + mxCBX_duration->get_widget().set_size_request(aOptimalSize.Width(), -1); + rSpinButton.set_max(nMax); + + mxVS_TRANSITION_ICONS.reset(new TransitionPane(m_xBuilder->weld_scrolled_window("transitions_iconswin"))); + mxVS_TRANSITION_ICONSWin.reset(new weld::CustomWeld(*m_xBuilder, "transitions_icons", *mxVS_TRANSITION_ICONS)); if( pDoc ) mxModel.set( pDoc->getUnoModel(), uno::UNO_QUERY ); @@ -467,39 +464,34 @@ void SlideTransitionPane::Initialize(SdDrawDocument* pDoc) mxView.set( mxModel->getCurrentController(), uno::UNO_QUERY ); // dummy list box of slide transitions for startup. - mpVS_TRANSITION_ICONS->InsertItem( + mxVS_TRANSITION_ICONS->InsertItem( 0, Image( StockImage::Yes, "sd/cmd/transition-none.png" ), SdResId( STR_SLIDETRANSITION_NONE ), VALUESET_APPEND, /* show legend */ true ); - mpVS_TRANSITION_ICONS->RecalculateItemSizes(); - - mpCBX_duration->InsertValue(100, FieldUnit::CUSTOM); - mpCBX_duration->InsertValue(200, FieldUnit::CUSTOM); - mpCBX_duration->InsertValue(300, FieldUnit::CUSTOM); - mpCBX_duration->AdaptDropDownLineCountToMaximum(); + mxVS_TRANSITION_ICONS->Recalculate(); // set defaults - mpCB_AUTO_PREVIEW->Check(); // automatic preview on + mxCB_AUTO_PREVIEW->set_active(true); // automatic preview on // update control states before adding handlers updateControls(); // set handlers - mpPB_APPLY_TO_ALL->SetClickHdl( LINK( this, SlideTransitionPane, ApplyToAllButtonClicked )); - mpPB_PLAY->SetClickHdl( LINK( this, SlideTransitionPane, PlayButtonClicked )); + mxPB_APPLY_TO_ALL->connect_clicked( LINK( this, SlideTransitionPane, ApplyToAllButtonClicked )); + mxPB_PLAY->connect_clicked( LINK( this, SlideTransitionPane, PlayButtonClicked )); - mpVS_TRANSITION_ICONS->SetSelectHdl( LINK( this, SlideTransitionPane, TransitionSelected )); + mxVS_TRANSITION_ICONS->SetSelectHdl( LINK( this, SlideTransitionPane, TransitionSelected )); - mpLB_VARIANT->SetSelectHdl( LINK( this, SlideTransitionPane, VariantListBoxSelected )); - mpCBX_duration->SetModifyHdl(LINK( this, SlideTransitionPane, DurationModifiedHdl)); - mpCBX_duration->SetLoseFocusHdl(LINK( this, SlideTransitionPane, DurationLoseFocusHdl)); - mpLB_SOUND->SetSelectHdl( LINK( this, SlideTransitionPane, SoundListBoxSelected )); - mpCB_LOOP_SOUND->SetClickHdl( LINK( this, SlideTransitionPane, LoopSoundBoxChecked )); + mxLB_VARIANT->connect_changed( LINK( this, SlideTransitionPane, VariantListBoxSelected )); + mxCBX_duration->connect_value_changed(LINK( this, SlideTransitionPane, DurationModifiedHdl)); + mxCBX_duration->connect_focus_out(LINK( this, SlideTransitionPane, DurationLoseFocusHdl)); + mxLB_SOUND->connect_changed( LINK( this, SlideTransitionPane, SoundListBoxSelected )); + mxCB_LOOP_SOUND->connect_toggled( LINK( this, SlideTransitionPane, LoopSoundBoxChecked )); - mpRB_ADVANCE_ON_MOUSE->SetToggleHdl( LINK( this, SlideTransitionPane, AdvanceSlideRadioButtonToggled )); - mpRB_ADVANCE_AUTO->SetToggleHdl( LINK( this, SlideTransitionPane, AdvanceSlideRadioButtonToggled )); - mpMF_ADVANCE_AUTO_AFTER->SetModifyHdl( LINK( this, SlideTransitionPane, AdvanceTimeModified )); - mpCB_AUTO_PREVIEW->SetClickHdl( LINK( this, SlideTransitionPane, AutoPreviewClicked )); + mxRB_ADVANCE_ON_MOUSE->connect_toggled( LINK( this, SlideTransitionPane, AdvanceSlideRadioButtonToggled )); + mxRB_ADVANCE_AUTO->connect_toggled( LINK( this, SlideTransitionPane, AdvanceSlideRadioButtonToggled )); + mxMF_ADVANCE_AUTO_AFTER->connect_value_changed( LINK( this, SlideTransitionPane, AdvanceTimeModified )); + mxCB_AUTO_PREVIEW->connect_toggled( LINK( this, SlideTransitionPane, AutoPreviewClicked )); addListener(); maLateInitTimer.SetTimeout(200); @@ -518,20 +510,21 @@ void SlideTransitionPane::dispose() { maLateInitTimer.Stop(); removeListener(); - mpVS_TRANSITION_ICONS.disposeAndClear(); - mpFT_VARIANT.clear(); - mpLB_VARIANT.clear(); - mpFT_duration.clear(); - mpCBX_duration.clear(); - mpFT_SOUND.clear(); - mpLB_SOUND.clear(); - mpCB_LOOP_SOUND.clear(); - mpRB_ADVANCE_ON_MOUSE.clear(); - mpRB_ADVANCE_AUTO.clear(); - mpMF_ADVANCE_AUTO_AFTER.clear(); - mpPB_APPLY_TO_ALL.clear(); - mpPB_PLAY.clear(); - mpCB_AUTO_PREVIEW.clear(); + mxVS_TRANSITION_ICONSWin.reset(); + mxVS_TRANSITION_ICONS.reset(); + mxFT_VARIANT.reset(); + mxLB_VARIANT.reset(); + mxFT_duration.reset(); + mxCBX_duration.reset(); + mxFT_SOUND.reset(); + mxLB_SOUND.reset(); + mxCB_LOOP_SOUND.reset(); + mxRB_ADVANCE_ON_MOUSE.reset(); + mxRB_ADVANCE_AUTO.reset(); + mxMF_ADVANCE_AUTO_AFTER.reset(); + mxPB_APPLY_TO_ALL.reset(); + mxPB_PLAY.reset(); + mxCB_AUTO_PREVIEW.reset(); PanelLayout::dispose(); } @@ -543,15 +536,9 @@ void SlideTransitionPane::DataChanged (const DataChangedEvent&) void SlideTransitionPane::UpdateLook() { if( mbHorizontalLayout ) - { SetBackground(Wallpaper()); - } else - { SetBackground(::sfx2::sidebar::Theme::GetWallpaper(::sfx2::sidebar::Theme::Paint_PanelBackground)); - mpFT_duration->SetBackground(Wallpaper()); - mpFT_SOUND->SetBackground(Wallpaper()); - } } void SlideTransitionPane::onSelectionChanged() @@ -620,31 +607,31 @@ void SlideTransitionPane::updateControls() if( aEffect.mbEffectAmbiguous ) { SAL_WARN( "sd.transitions", "Unusual, ambiguous transition effect" ); - mpVS_TRANSITION_ICONS->SetNoSelection(); + mxVS_TRANSITION_ICONS->SetNoSelection(); } else { // ToDo: That 0 is "no transition" is documented nowhere except in the // CTOR of sdpage if( aEffect.mnType == 0 ) - mpVS_TRANSITION_ICONS->SetNoSelection(); + mxVS_TRANSITION_ICONS->SetNoSelection(); else updateVariants( getPresetOffset( aEffect ) ); } if( aEffect.mbDurationAmbiguous ) { - mpCBX_duration->SetText(""); - mpCBX_duration->SetNoSelection(); + mxCBX_duration->set_text(""); +//TODO mxCBX_duration->SetNoSelection(); } else { - mpCBX_duration->SetValue( (aEffect.mfDuration)*100.0 ); + mxCBX_duration->set_value( (aEffect.mfDuration)*100.0, FieldUnit::SECOND ); } if( aEffect.mbSoundAmbiguous ) { - mpLB_SOUND->SetNoSelection(); + mxLB_SOUND->set_active(-1); maCurrentSoundFile.clear(); } else @@ -652,54 +639,54 @@ void SlideTransitionPane::updateControls() maCurrentSoundFile.clear(); if( aEffect.mbStopSound ) { - mpLB_SOUND->SelectEntryPos( 1 ); + mxLB_SOUND->set_active( 1 ); } else if( aEffect.mbSoundOn && !aEffect.maSound.isEmpty() ) { std::vector<OUString>::size_type nPos = 0; if( lcl_findSoundInList( maSoundList, aEffect.maSound, nPos )) { - mpLB_SOUND->SelectEntryPos( nPos + 3 ); + mxLB_SOUND->set_active( nPos + 3 ); maCurrentSoundFile = aEffect.maSound; } } else { - mpLB_SOUND->SelectEntryPos( 0 ); + mxLB_SOUND->set_active( 0 ); } } if( aEffect.mbLoopSoundAmbiguous ) { - mpCB_LOOP_SOUND->SetState( TRISTATE_INDET ); + mxCB_LOOP_SOUND->set_state(TRISTATE_INDET); } else { - mpCB_LOOP_SOUND->Check( aEffect.mbLoopSound ); + mxCB_LOOP_SOUND->set_active(aEffect.mbLoopSound); } if( aEffect.mbPresChangeAmbiguous ) { - mpRB_ADVANCE_ON_MOUSE->Check( false ); - mpRB_ADVANCE_AUTO->Check( false ); + mxRB_ADVANCE_ON_MOUSE->set_active( false ); + mxRB_ADVANCE_AUTO->set_active( false ); } else { - mpRB_ADVANCE_ON_MOUSE->Check( aEffect.mePresChange == PRESCHANGE_MANUAL ); - mpRB_ADVANCE_AUTO->Check( aEffect.mePresChange == PRESCHANGE_AUTO ); - mpMF_ADVANCE_AUTO_AFTER->SetValue( aEffect.mfTime * 100.0); + mxRB_ADVANCE_ON_MOUSE->set_active( aEffect.mePresChange == PRESCHANGE_MANUAL ); + mxRB_ADVANCE_AUTO->set_active( aEffect.mePresChange == PRESCHANGE_AUTO ); + mxMF_ADVANCE_AUTO_AFTER->set_value(aEffect.mfTime * 100.0, FieldUnit::SECOND); } if (comphelper::LibreOfficeKit::isActive()) { - mpPB_PLAY->Hide(); - mpCB_AUTO_PREVIEW->Check(false); - mpCB_AUTO_PREVIEW->Hide(); + mxPB_PLAY->hide(); + mxCB_AUTO_PREVIEW->set_active(false); + mxCB_AUTO_PREVIEW->hide(); } else { SdOptions* pOptions = SD_MOD()->GetSdOptions(DocumentType::Impress); - mpCB_AUTO_PREVIEW->Check( pOptions->IsPreviewTransitions() ); + mxCB_AUTO_PREVIEW->set_active( pOptions->IsPreviewTransitions() ); } mbUpdatingControls = false; @@ -709,18 +696,18 @@ void SlideTransitionPane::updateControls() void SlideTransitionPane::updateControlState() { - mpVS_TRANSITION_ICONS->Enable( mbHasSelection ); - mpLB_VARIANT->Enable( mbHasSelection && mpLB_VARIANT->GetEntryCount() > 0 ); - mpCBX_duration->Enable( mbHasSelection ); - mpLB_SOUND->Enable( mbHasSelection ); - mpCB_LOOP_SOUND->Enable( mbHasSelection && (mpLB_SOUND->GetSelectedEntryPos() > 2)); - mpRB_ADVANCE_ON_MOUSE->Enable( mbHasSelection ); - mpRB_ADVANCE_AUTO->Enable( mbHasSelection ); - mpMF_ADVANCE_AUTO_AFTER->Enable( mbHasSelection && mpRB_ADVANCE_AUTO->IsChecked()); - - mpPB_APPLY_TO_ALL->Enable( mbHasSelection ); - mpPB_PLAY->Enable( mbHasSelection ); - mpCB_AUTO_PREVIEW->Enable( mbHasSelection ); + mxVS_TRANSITION_ICONSWin->set_sensitive( mbHasSelection ); + mxLB_VARIANT->set_sensitive( mbHasSelection && mxLB_VARIANT->get_count() > 0 ); + mxCBX_duration->set_sensitive( mbHasSelection ); + mxLB_SOUND->set_sensitive( mbHasSelection ); + mxCB_LOOP_SOUND->set_sensitive( mbHasSelection && (mxLB_SOUND->get_active() > 2)); + mxRB_ADVANCE_ON_MOUSE->set_sensitive( mbHasSelection ); + mxRB_ADVANCE_AUTO->set_sensitive( mbHasSelection ); + mxMF_ADVANCE_AUTO_AFTER->set_sensitive( mbHasSelection && mxRB_ADVANCE_AUTO->get_active()); + + mxPB_APPLY_TO_ALL->set_sensitive( mbHasSelection ); + mxPB_PLAY->set_sensitive( mbHasSelection ); + mxCB_AUTO_PREVIEW->set_sensitive( mbHasSelection ); } void SlideTransitionPane::updateSoundList() @@ -730,17 +717,17 @@ void SlideTransitionPane::updateSoundList() GalleryExplorer::FillObjList( GALLERY_THEME_SOUNDS, maSoundList ); GalleryExplorer::FillObjList( GALLERY_THEME_USERSOUNDS, maSoundList ); - lcl_FillSoundListBox( maSoundList, mpLB_SOUND ); + lcl_FillSoundListBox( maSoundList, *mxLB_SOUND ); } void SlideTransitionPane::openSoundFileDialog() { - if( ! mpLB_SOUND->IsEnabled()) + if( ! mxLB_SOUND->get_sensitive()) return; SdOpenSoundFileDialog aFileDialog(GetFrameWeld()); - DBG_ASSERT( mpLB_SOUND->GetSelectedEntryPos() == 2, + DBG_ASSERT( mxLB_SOUND->get_active() == 2, "Dialog should only open when \"Other sound\" is selected" ); bool bValidSoundFile( false ); @@ -785,7 +772,7 @@ void SlideTransitionPane::openSoundFileDialog() if( bValidSoundFile ) // skip first three entries in list - mpLB_SOUND->SelectEntryPos( nPos + 3 ); + mxLB_SOUND->set_active( nPos + 3 ); } if( bValidSoundFile ) @@ -795,12 +782,12 @@ void SlideTransitionPane::openSoundFileDialog() { std::vector<OUString>::size_type nPos = 0; if( lcl_findSoundInList( maSoundList, maCurrentSoundFile, nPos )) - mpLB_SOUND->SelectEntryPos( nPos + 3 ); + mxLB_SOUND->set_active( nPos + 3 ); else - mpLB_SOUND->SelectEntryPos( 0 ); // NONE + mxLB_SOUND->set_active( 0 ); // NONE } else - mpLB_SOUND->SelectEntryPos( 0 ); // NONE + mxLB_SOUND->set_active( 0 ); // NONE } impl::TransitionEffect SlideTransitionPane::getTransitionEffectFromControls() const @@ -809,15 +796,15 @@ impl::TransitionEffect SlideTransitionPane::getTransitionEffectFromControls() co aResult.setAllAmbiguous(); // check first (aResult might be overwritten) - if( mpVS_TRANSITION_ICONS->IsEnabled() && - !mpVS_TRANSITION_ICONS->IsNoSelection() && - mpVS_TRANSITION_ICONS->GetSelectedItemId() > 0 ) + if( mxVS_TRANSITION_ICONSWin->get_sensitive() && + !mxVS_TRANSITION_ICONS->IsNoSelection() && + mxVS_TRANSITION_ICONS->GetSelectedItemId() > 0 ) { const sd::TransitionPresetList& rPresetList = sd::TransitionPreset::getTransitionPresetList(); auto aSelected = rPresetList.begin(); - std::advance( aSelected, mpVS_TRANSITION_ICONS->GetSelectedItemId() - 1); + std::advance( aSelected, mxVS_TRANSITION_ICONS->GetSelectedItemId() - 1); - if( mpLB_VARIANT->GetSelectedEntryPos() == LISTBOX_ENTRY_NOTFOUND ) + if (mxLB_VARIANT->get_active() == -1) { // Transition with just one effect. aResult = impl::TransitionEffect( **aSelected ); @@ -831,7 +818,7 @@ impl::TransitionEffect SlideTransitionPane::getTransitionEffectFromControls() co { if( aIter->getSetId() == (*aSelected)->getSetId() ) { - if( mpLB_VARIANT->GetSelectedEntryPos() == nVariant) + if( mxLB_VARIANT->get_active() == nVariant) { aResult = impl::TransitionEffect( *aIter ); aResult.setAllAmbiguous(); @@ -851,31 +838,31 @@ impl::TransitionEffect SlideTransitionPane::getTransitionEffectFromControls() co } aResult.mbEffectAmbiguous = false; } - else if (mpVS_TRANSITION_ICONS->IsNoSelection()) + else if (mxVS_TRANSITION_ICONS->IsNoSelection()) { aResult.mbEffectAmbiguous = false; } //duration - if( mpCBX_duration->IsEnabled() && (!(mpCBX_duration->GetText()).isEmpty()) ) + if( mxCBX_duration->get_sensitive() && (!(mxCBX_duration->get_text()).isEmpty()) ) { - aResult.mfDuration = static_cast<double>(mpCBX_duration->GetValue())/100.0; + aResult.mfDuration = static_cast<double>(mxCBX_duration->get_value(FieldUnit::SECOND))/100.0; aResult.mbDurationAmbiguous = false; } // slide-advance mode - if( mpRB_ADVANCE_ON_MOUSE->IsEnabled() && mpRB_ADVANCE_AUTO->IsEnabled() && - (mpRB_ADVANCE_ON_MOUSE->IsChecked() || mpRB_ADVANCE_AUTO->IsChecked())) + if( mxRB_ADVANCE_ON_MOUSE->get_sensitive() && mxRB_ADVANCE_AUTO->get_sensitive() && + (mxRB_ADVANCE_ON_MOUSE->get_active() || mxRB_ADVANCE_AUTO->get_active())) { - if( mpRB_ADVANCE_ON_MOUSE->IsChecked()) + if( mxRB_ADVANCE_ON_MOUSE->get_active()) aResult.mePresChange = PRESCHANGE_MANUAL; else { aResult.mePresChange = PRESCHANGE_AUTO; - if( mpMF_ADVANCE_AUTO_AFTER->IsEnabled()) + if( mxMF_ADVANCE_AUTO_AFTER->get_sensitive()) { - aResult.mfTime = static_cast<double>(mpMF_ADVANCE_AUTO_AFTER->GetValue() ) / 100.0 ; + aResult.mfTime = static_cast<double>(mxMF_ADVANCE_AUTO_AFTER->get_value(FieldUnit::SECOND) ) / 100.0 ; aResult.mbTimeAmbiguous = false; } } @@ -884,12 +871,12 @@ impl::TransitionEffect SlideTransitionPane::getTransitionEffectFromControls() co } // sound - if( mpLB_SOUND->IsEnabled()) + if( mxLB_SOUND->get_sensitive()) { maCurrentSoundFile.clear(); - if( mpLB_SOUND->GetSelectedEntryCount() > 0 ) + sal_Int32 nPos = mxLB_SOUND->get_active(); + if (nPos != -1) { - sal_Int32 nPos = mpLB_SOUND->GetSelectedEntryPos(); aResult.mbStopSound = nPos == 1; aResult.mbSoundOn = nPos > 1; if( aResult.mbStopSound ) @@ -899,7 +886,7 @@ impl::TransitionEffect SlideTransitionPane::getTransitionEffectFromControls() co } else { - aResult.maSound = lcl_getSoundFileURL( maSoundList, mpLB_SOUND ); + aResult.maSound = lcl_getSoundFileURL(maSoundList, *mxLB_SOUND); aResult.mbSoundAmbiguous = false; maCurrentSoundFile = aResult.maSound; } @@ -907,9 +894,9 @@ impl::TransitionEffect SlideTransitionPane::getTransitionEffectFromControls() co } // sound loop - if( mpCB_LOOP_SOUND->IsEnabled() ) + if( mxCB_LOOP_SOUND->get_sensitive() ) { - aResult.mbLoopSound = mpCB_LOOP_SOUND->IsChecked(); + aResult.mbLoopSound = mxCB_LOOP_SOUND->get_active(); aResult.mbLoopSoundAmbiguous = false; } @@ -931,8 +918,8 @@ void SlideTransitionPane::applyToSelectedPages(bool bPreview = true) lcl_ApplyToPages( pSelectedPages, aEffect ); mrBase.GetDocShell()->SetModified(); } - if( mpCB_AUTO_PREVIEW->IsEnabled() && - mpCB_AUTO_PREVIEW->IsChecked() && bPreview) + if( mxCB_AUTO_PREVIEW->get_sensitive() && + mxCB_AUTO_PREVIEW->get_active() && bPreview) { if (aEffect.mnType) // mnType = 0 denotes no transition playCurrentEffect(); @@ -1017,7 +1004,7 @@ IMPL_LINK(SlideTransitionPane,EventMultiplexerListener, } } -IMPL_LINK_NOARG(SlideTransitionPane, ApplyToAllButtonClicked, Button*, void) +IMPL_LINK_NOARG(SlideTransitionPane, ApplyToAllButtonClicked, weld::Button&, void) { DBG_ASSERT( mpDrawDoc, "Invalid Draw Document!" ); if( !mpDrawDoc ) @@ -1042,14 +1029,14 @@ IMPL_LINK_NOARG(SlideTransitionPane, ApplyToAllButtonClicked, Button*, void) } } -IMPL_LINK_NOARG(SlideTransitionPane, PlayButtonClicked, Button*, void) +IMPL_LINK_NOARG(SlideTransitionPane, PlayButtonClicked, weld::Button&, void) { playCurrentEffect(); } -IMPL_LINK_NOARG(SlideTransitionPane, TransitionSelected, ValueSet *, void) +IMPL_LINK_NOARG(SlideTransitionPane, TransitionSelected, SvtValueSet*, void) { - updateVariants( mpVS_TRANSITION_ICONS->GetSelectedItemId() - 1 ); + updateVariants( mxVS_TRANSITION_ICONS->GetSelectedItemId() - 1 ); applyToSelectedPages(); } @@ -1057,12 +1044,12 @@ IMPL_LINK_NOARG(SlideTransitionPane, TransitionSelected, ValueSet *, void) void SlideTransitionPane::updateVariants( size_t nPresetOffset ) { const sd::TransitionPresetList& rPresetList = sd::TransitionPreset::getTransitionPresetList(); - mpLB_VARIANT->Clear(); - mpVS_TRANSITION_ICONS->SetNoSelection(); + mxLB_VARIANT->clear(); + mxVS_TRANSITION_ICONS->SetNoSelection(); if( nPresetOffset >= rPresetList.size() ) { - mpLB_VARIANT->Enable( false ); + mxLB_VARIANT->set_sensitive( false ); } else { @@ -1079,80 +1066,77 @@ void SlideTransitionPane::updateVariants( size_t nPresetOffset ) nFirstItem = nItem; if( !aIt->getVariantLabel().isEmpty() ) { - mpLB_VARIANT->InsertEntry( aIt->getVariantLabel() ); + mxLB_VARIANT->append_text( aIt->getVariantLabel() ); if( *pFound == aIt ) - mpLB_VARIANT->SelectEntryPos( mpLB_VARIANT->GetEntryCount()-1 ); + mxLB_VARIANT->set_active( mxLB_VARIANT->get_count()-1 ); } } nItem++; } - if( mpLB_VARIANT->GetEntryCount() == 0 ) - mpLB_VARIANT->Enable( false ); + if( mxLB_VARIANT->get_count() == 0 ) + mxLB_VARIANT->set_sensitive( false ); else - mpLB_VARIANT->Enable(); + mxLB_VARIANT->set_sensitive(true); // item has the id of the first transition from this set. - mpVS_TRANSITION_ICONS->SelectItem( nFirstItem ); + mxVS_TRANSITION_ICONS->SelectItem( nFirstItem ); } } -IMPL_LINK_NOARG(SlideTransitionPane, AdvanceSlideRadioButtonToggled, RadioButton&, void) +IMPL_LINK_NOARG(SlideTransitionPane, AdvanceSlideRadioButtonToggled, weld::ToggleButton&, void) { updateControlState(); applyToSelectedPages(false); } -IMPL_LINK_NOARG(SlideTransitionPane, AdvanceTimeModified, Edit&, void) +IMPL_LINK_NOARG(SlideTransitionPane, AdvanceTimeModified, weld::MetricSpinButton&, void) { applyToSelectedPages(false); } -IMPL_LINK_NOARG(SlideTransitionPane, VariantListBoxSelected, ListBox&, void) +IMPL_LINK_NOARG(SlideTransitionPane, VariantListBoxSelected, weld::ComboBox&, void) { applyToSelectedPages(); } -IMPL_LINK_NOARG(SlideTransitionPane, DurationModifiedHdl, Edit&, void) +IMPL_LINK_NOARG(SlideTransitionPane, DurationModifiedHdl, weld::MetricSpinButton&, void) { - double duration_value = static_cast<double>(mpCBX_duration->GetValue()); - if(duration_value <= 0.0) - mpCBX_duration->SetValue(0); + double duration_value = static_cast<double>(mxCBX_duration->get_value(FieldUnit::SECOND)); + if (duration_value <= 0.0) + mxCBX_duration->set_value(0, FieldUnit::SECOND); else - mpCBX_duration->SetValue(duration_value); + mxCBX_duration->set_value(duration_value, FieldUnit::SECOND); applyToSelectedPages(); } -IMPL_LINK_NOARG(SlideTransitionPane, DurationLoseFocusHdl, Control&, void) +IMPL_LINK_NOARG(SlideTransitionPane, DurationLoseFocusHdl, weld::Widget&, void) { applyToSelectedPages(); } -IMPL_LINK_NOARG(SlideTransitionPane, SoundListBoxSelected, ListBox&, void) +IMPL_LINK_NOARG(SlideTransitionPane, SoundListBoxSelected, weld::ComboBox&, void) { - if( mpLB_SOUND->GetSelectedEntryCount() ) + sal_Int32 nPos = mxLB_SOUND->get_active(); + if( nPos == 2 ) { - sal_Int32 nPos = mpLB_SOUND->GetSelectedEntryPos(); - if( nPos == 2 ) - { - // other sound... - openSoundFileDialog(); - } + // other sound... + openSoundFileDialog(); } updateControlState(); applyToSelectedPages(); } -IMPL_LINK_NOARG(SlideTransitionPane, LoopSoundBoxChecked, Button*, void) +IMPL_LINK_NOARG(SlideTransitionPane, LoopSoundBoxChecked, weld::ToggleButton&, void) { applyToSelectedPages(); } -IMPL_LINK_NOARG(SlideTransitionPane, AutoPreviewClicked, Button*, void) +IMPL_LINK_NOARG(SlideTransitionPane, AutoPreviewClicked, weld::ToggleButton&, void) { SdOptions* pOptions = SD_MOD()->GetSdOptions(DocumentType::Impress); - pOptions->SetPreviewTransitions( mpCB_AUTO_PREVIEW->IsChecked() ); + pOptions->SetPreviewTransitions( mxCB_AUTO_PREVIEW->get_active() ); } IMPL_LINK_NOARG(SlideTransitionPane, LateInitCallback, Timer *, void) @@ -1172,7 +1156,7 @@ IMPL_LINK_NOARG(SlideTransitionPane, LateInitCallback, Timer *, void) if ( aIcon.IsEmpty() ) // need a fallback sImageName = "sd/cmd/transition-none.png"; - mpVS_TRANSITION_ICONS->InsertItem( + mxVS_TRANSITION_ICONS->InsertItem( nPresetOffset + 1, Image(StockImage::Yes, sImageName), sLabel, VALUESET_APPEND, /* show legend */ true ); @@ -1185,11 +1169,11 @@ IMPL_LINK_NOARG(SlideTransitionPane, LateInitCallback, Timer *, void) } nPresetOffset++; } - mpVS_TRANSITION_ICONS->RecalculateItemSizes(); + mxVS_TRANSITION_ICONS->Recalculate(); SAL_INFO( "sd.transitions", "Item transition offsets in ValueSet:"); - for( size_t i = 0; i < mpVS_TRANSITION_ICONS->GetItemCount(); ++i ) - SAL_INFO( "sd.transitions", i << ":" << mpVS_TRANSITION_ICONS->GetItemId( i ) ); + for( size_t i = 0; i < mxVS_TRANSITION_ICONS->GetItemCount(); ++i ) + SAL_INFO( "sd.transitions", i << ":" << mxVS_TRANSITION_ICONS->GetItemId( i ) ); nPresetOffset = 0; SAL_INFO( "sd.transitions", "Transition presets by offsets:"); diff --git a/sd/source/ui/inc/BulletAndPositionDlg.hxx b/sd/source/ui/inc/BulletAndPositionDlg.hxx index 0c46ab786251..b2c5ce1fa54b 100644 --- a/sd/source/ui/inc/BulletAndPositionDlg.hxx +++ b/sd/source/ui/inc/BulletAndPositionDlg.hxx @@ -36,7 +36,6 @@ class NumValueSet; class SvxNumRule; class SvxBmpNumValueSet; class SvxBrushItem; -class ValueSet; class SdDrawDocument; namespace sd diff --git a/sd/source/ui/inc/SlideTransitionPane.hxx b/sd/source/ui/inc/SlideTransitionPane.hxx index 3bdb16ddee55..7b0d52a9cff3 100644 --- a/sd/source/ui/inc/SlideTransitionPane.hxx +++ b/sd/source/ui/inc/SlideTransitionPane.hxx @@ -21,12 +21,9 @@ #include "SlideSorterViewShell.hxx" -#include <vcl/lstbox.hxx> -#include <vcl/fixed.hxx> -#include <vcl/button.hxx> -#include <vcl/field.hxx> #include <svtools/valueset.hxx> #include <svx/sidebar/PanelLayout.hxx> +#include <vcl/weld.hxx> #include <vector> #include <map> @@ -40,6 +37,7 @@ namespace sd { namespace tools { class EventMultiplexerEvent; } } namespace sd { +class TransitionPane; class ViewShellBase; namespace impl @@ -92,38 +90,39 @@ private: void Initialize(SdDrawDocument* pDoc); - DECL_LINK( ApplyToAllButtonClicked, Button*, void ); - DECL_LINK( PlayButtonClicked, Button*, void ); - DECL_LINK( AutoPreviewClicked, Button*, void ); - - DECL_LINK( TransitionSelected, ValueSet *, void ); - DECL_LINK( AdvanceSlideRadioButtonToggled, RadioButton&, void ); - DECL_LINK( AdvanceTimeModified, Edit&, void ); - DECL_LINK( VariantListBoxSelected, ListBox&, void ); - DECL_LINK( DurationModifiedHdl, Edit&, void ); - DECL_LINK( DurationLoseFocusHdl, Control&, void ); - DECL_LINK( SoundListBoxSelected, ListBox&, void ); - DECL_LINK( LoopSoundBoxChecked, Button*, void ); + DECL_LINK( ApplyToAllButtonClicked, weld::Button&, void ); + DECL_LINK( PlayButtonClicked, weld::Button&, void ); + DECL_LINK( AutoPreviewClicked, weld::ToggleButton&, void ); + + DECL_LINK( TransitionSelected, SvtValueSet*, void ); + DECL_LINK( AdvanceSlideRadioButtonToggled, weld::ToggleButton&, void ); + DECL_LINK( AdvanceTimeModified, weld::MetricSpinButton&, void ); + DECL_LINK( VariantListBoxSelected, weld::ComboBox&, void ); + DECL_LINK( DurationModifiedHdl, weld::MetricSpinButton&, void ); + DECL_LINK( DurationLoseFocusHdl, weld::Widget&, void ); + DECL_LINK( SoundListBoxSelected, weld::ComboBox&, void ); + DECL_LINK( LoopSoundBoxChecked, weld::ToggleButton&, void ); DECL_LINK( EventMultiplexerListener, tools::EventMultiplexerEvent&, void ); DECL_LINK(LateInitCallback, Timer *, void); ViewShellBase & mrBase; SdDrawDocument * const mpDrawDoc; - VclPtr<ValueSet> mpVS_TRANSITION_ICONS; - VclPtr<FixedText> mpFT_VARIANT; - VclPtr<ListBox> mpLB_VARIANT; - VclPtr<FixedText> mpFT_duration; - VclPtr<MetricBox> mpCBX_duration; - VclPtr<FixedText> mpFT_SOUND; - VclPtr<ListBox> mpLB_SOUND; - VclPtr<CheckBox> mpCB_LOOP_SOUND; - VclPtr<RadioButton> mpRB_ADVANCE_ON_MOUSE; - VclPtr<RadioButton> mpRB_ADVANCE_AUTO; - VclPtr<MetricField> mpMF_ADVANCE_AUTO_AFTER; - VclPtr<PushButton> mpPB_APPLY_TO_ALL; - VclPtr<PushButton> mpPB_PLAY; - VclPtr<CheckBox> mpCB_AUTO_PREVIEW; + std::unique_ptr<TransitionPane> mxVS_TRANSITION_ICONS; + std::unique_ptr<weld::CustomWeld> mxVS_TRANSITION_ICONSWin; + std::unique_ptr<weld::Label> mxFT_VARIANT; + std::unique_ptr<weld::ComboBox> mxLB_VARIANT; + std::unique_ptr<weld::Label> mxFT_duration; + std::unique_ptr<weld::MetricSpinButton> mxCBX_duration; + std::unique_ptr<weld::Label> mxFT_SOUND; + std::unique_ptr<weld::ComboBox> mxLB_SOUND; + std::unique_ptr<weld::CheckButton> mxCB_LOOP_SOUND; + std::unique_ptr<weld::RadioButton> mxRB_ADVANCE_ON_MOUSE; + std::unique_ptr<weld::RadioButton> mxRB_ADVANCE_AUTO; + std::unique_ptr<weld::MetricSpinButton> mxMF_ADVANCE_AUTO_AFTER; + std::unique_ptr<weld::Button> mxPB_APPLY_TO_ALL; + std::unique_ptr<weld::Button> mxPB_PLAY; + std::unique_ptr<weld::CheckButton> mxCB_AUTO_PREVIEW; css::uno::Reference< css::drawing::XDrawView > mxView; css::uno::Reference< css::frame::XModel > mxModel; diff --git a/sd/uiconfig/simpress/ui/slidetransitionspanel.ui b/sd/uiconfig/simpress/ui/slidetransitionspanel.ui index 3d1f291d718c..3bc5eec9ebde 100644 --- a/sd/uiconfig/simpress/ui/slidetransitionspanel.ui +++ b/sd/uiconfig/simpress/ui/slidetransitionspanel.ui @@ -1,15 +1,26 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> +<!-- Generated with glade 3.22.1 --> <interface domain="sd"> <requires lib="gtk+" version="3.18"/> + <object class="GtkAdjustment" id="adjustment1"> + <property name="upper">1000</property> + <property name="step_increment">0.01</property> + <property name="page_increment">1</property> + </object> + <object class="GtkAdjustment" id="adjustment2"> + <property name="upper">1000</property> + <property name="step_increment">0.01</property> + <property name="page_increment">1</property> + </object> <object class="GtkImage" id="image1"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="pixbuf">sd/res/playblue_16.png</property> + <property name="icon_name">sd/res/playblue_16.png</property> </object> <object class="GtkBox" id="SlideTransitionsPanel"> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="vexpand">True</property> <property name="border_width">6</property> <property name="orientation">vertical</property> <child> @@ -25,7 +36,7 @@ <property name="can_focus">False</property> <property name="vexpand">True</property> <child> - <object class="GtkAlignment" id="transitions_icons"> + <object class="GtkAlignment"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="hexpand">True</property> @@ -34,7 +45,29 @@ <property name="left_padding">6</property> <property name="right_padding">6</property> <child> - <placeholder/> + <object class="GtkScrolledWindow" id="transitions_iconswin"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="hscrollbar_policy">never</property> + <property name="shadow_type">in</property> + <child> + <object class="GtkViewport"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child> + <object class="GtkDrawingArea" id="transitions_icons"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="events">GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_STRUCTURE_MASK</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + </object> + </child> + </object> + </child> + </object> </child> </object> <packing> @@ -75,7 +108,7 @@ <property name="halign">end</property> <property name="label" translatable="yes" context="slidetransitionspanel|duration_label">Duration:</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">transition_duration:0.00sec</property> + <property name="mnemonic_widget">transition_duration</property> <property name="xalign">0</property> </object> <packing> @@ -84,12 +117,14 @@ </packing> </child> <child> - <object class="VclComboBoxNumeric" id="transition_duration:0.00sec"> + <object class="GtkSpinButton" id="transition_duration"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can_focus">True</property> <property name="has_tooltip">True</property> <property name="tooltip_text" translatable="yes" context="slidetransitionspanel|transition_duration|tooltip_text">Select the speed of Slide Transition.</property> <property name="hexpand">True</property> + <property name="adjustment">adjustment2</property> + <property name="digits">2</property> </object> <packing> <property name="left_attach">1</property> @@ -156,7 +191,7 @@ </packing> </child> <child> - <object class="GtkComboBox" id="variant_list"> + <object class="GtkComboBoxText" id="variant_list"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -215,8 +250,8 @@ <property name="receives_default">False</property> <property name="use_underline">True</property> <property name="xalign">0</property> + <property name="active">True</property> <property name="draw_indicator">True</property> - <property name="group">rb_mouse_click</property> </object> <packing> <property name="left_attach">0</property> @@ -234,6 +269,9 @@ <property name="xalign">0</property> <property name="draw_indicator">True</property> <property name="group">rb_mouse_click</property> + <accessibility> + <relation type="label-for" target="auto_after_value"/> + </accessibility> </object> <packing> <property name="left_attach">0</property> @@ -241,10 +279,14 @@ </packing> </child> <child> - <object class="GtkSpinButton" id="auto_after_value:0sec"> + <object class="GtkSpinButton" id="auto_after_value"> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="adjustment">adjustment1</property> <property name="digits">2</property> + <accessibility> + <relation type="labelled-by" target="rb_auto_after"/> + </accessibility> </object> <packing> <property name="left_attach">1</property> @@ -277,6 +319,7 @@ <property name="visible">True</property> <property name="can_focus">False</property> <property name="orientation">vertical</property> + <property name="spacing">6</property> <child> <object class="GtkButtonBox" id="buttonbox1"> <property name="visible">True</property> diff --git a/solenv/sanitizers/ui/modules/simpress.suppr b/solenv/sanitizers/ui/modules/simpress.suppr index e47dea17ed70..22b2c753ffc2 100644 --- a/solenv/sanitizers/ui/modules/simpress.suppr +++ b/solenv/sanitizers/ui/modules/simpress.suppr @@ -36,7 +36,6 @@ sd/uiconfig/simpress/ui/sidebarslidebackground.ui://GtkLabel[@id='masterlabel'] sd/uiconfig/simpress/ui/sidebarslidebackground.ui://svxlo-SvxFillAttrBox[@id='fillattr1'] no-labelled-by sd/uiconfig/simpress/ui/sidebarslidebackground.ui://svxcorelo-SvxColorListBox[@id='fillattr2'] no-labelled-by sd/uiconfig/simpress/ui/sidebarslidebackground.ui://GtkLabel[@id='customlabel'] orphan-label -sd/uiconfig/simpress/ui/slidetransitionspanel.ui://GtkSpinButton[@id='auto_after_value:0sec'] no-labelled-by sd/uiconfig/simpress/ui/slidetransitionspanelhorizontal.ui://GtkLabel[@id='duration_label'] orphan-label sd/uiconfig/simpress/ui/slidetransitionspanelhorizontal.ui://GtkLabel[@id='variant_label'] orphan-label sd/uiconfig/simpress/ui/slidetransitionspanelhorizontal.ui://GtkComboBox[@id='variant_list'] no-labelled-by diff --git a/svtools/source/control/valueset.cxx b/svtools/source/control/valueset.cxx index 8df48ebf6a9a..e190593f7914 100644 --- a/svtools/source/control/valueset.cxx +++ b/svtools/source/control/valueset.cxx @@ -2270,6 +2270,7 @@ SvtValueSet::SvtValueSet(std::unique_ptr<weld::ScrolledWindow> pScrolledWindow) mbBlackSel = false; mbDoubleSel = false; mbScroll = false; + mbFullMode = true; mbEdgeBlending = false; mbHasVisibleItems = false; @@ -2826,6 +2827,27 @@ void SvtValueSet::ImplDraw(vcl::RenderContext& rRenderContext) ImplDrawSelect(rRenderContext); } +/** + * An inelegant method; sets the item width & height such that + * all of the included items and their labels fit; if we can + * calculate that. + */ +void SvtValueSet::RecalculateItemSizes() +{ + Size aLargestItem = GetLargestItemSize(); + + if ( mnUserItemWidth != aLargestItem.Width() || + mnUserItemHeight != aLargestItem.Height() ) + { + mnUserItemWidth = aLargestItem.Width(); + mnUserItemHeight = aLargestItem.Height(); + mbFormat = true; + queue_resize(); + if ( IsReallyVisible() && IsUpdateMode() ) + Invalidate(); + } +} + void SvtValueSet::SelectItem( sal_uInt16 nItemId ) { size_t nItemPos = 0; @@ -3146,10 +3168,18 @@ void SvtValueSet::Format(vcl::RenderContext const & rRenderContext) // calculate offsets long nStartX; long nStartY; - long nAllItemWidth = (mnItemWidth * mnCols) + nColSpace; - long nAllItemHeight = (mnItemHeight * mnVisLines) + nNoneHeight + nLineSpace; - nStartX = (aWinSize.Width() - nAllItemWidth) / 2; - nStartY = (aWinSize.Height() - nAllItemHeight) / 2; + if (mbFullMode) + { + long nAllItemWidth = (mnItemWidth * mnCols) + nColSpace; + long nAllItemHeight = (mnItemHeight * mnVisLines) + nNoneHeight + nLineSpace; + nStartX = (aWinSize.Width() - nAllItemWidth) / 2; + nStartY = (aWinSize.Height() - nAllItemHeight) / 2; + } + else + { + nStartX = 0; + nStartY = 0; + } // calculate and draw items maVirDev->SetLineColor(); @@ -3184,6 +3214,15 @@ void SvtValueSet::Format(vcl::RenderContext const & rRenderContext) maItemListRect.SetRight( x + mnCols * (mnItemWidth + mnSpacing) - mnSpacing - 1 ); maItemListRect.SetBottom( y + mnVisLines * (mnItemHeight + mnSpacing) - mnSpacing - 1 ); + if (!mbFullMode) + { + // If want also draw parts of items in the last line, + // then we add one more line if parts of these line are + // visible + if (y + (mnVisLines * (mnItemHeight + mnSpacing)) < aWinSize.Height()) + nLastItem += mnCols; + maItemListRect.SetBottom( aWinSize.Height() - y ); + } for (size_t i = 0; i < nItemCount; i++) { SvtValueSetItem* pItem = mItemList[i].get(); @@ -3553,6 +3592,11 @@ void SvtValueSet::StyleUpdated() CustomWidgetController::StyleUpdated(); } +void SvtValueSet::EnableFullItemMode( bool bFullMode ) +{ + mbFullMode = bFullMode; +} + void SvtValueSet::SetColCount( sal_uInt16 nNewCols ) { if ( mnUserCols != nNewCols ) @@ -3676,11 +3720,12 @@ void SvtValueSet::InsertItem( sal_uInt16 nItemId, const Image& rImage ) } void SvtValueSet::InsertItem( sal_uInt16 nItemId, const Image& rImage, - const OUString& rText, size_t nPos ) + const OUString& rText, size_t nPos, + bool bShowLegend ) { std::unique_ptr<SvtValueSetItem> pItem(new SvtValueSetItem( *this )); pItem->mnId = nItemId; - pItem->meType = VALUESETITEM_IMAGE; + pItem->meType = bShowLegend ? VALUESETITEM_IMAGE_AND_TEXT : VALUESETITEM_IMAGE; pItem->maImage = rImage; pItem->maText = rText; ImplInsertItem( std::move(pItem), nPos ); |