diff options
author | Maxim Monastirsky <momonasmon@gmail.com> | 2016-10-05 12:29:35 +0300 |
---|---|---|
committer | Maxim Monastirsky <momonasmon@gmail.com> | 2016-10-05 15:35:40 +0300 |
commit | 944f81c544ff5b9e47d5e0764814d19df71b1764 (patch) | |
tree | 0a8bf161f2825c8e895869dca43605d8b4b57655 /svx/source | |
parent | c26afa7812d5b9f8e25f64ebab8515f5b59238c1 (diff) |
SvxFrameWindow_Impl: Try to fix size calculation
Change-Id: I7119f46a483615636cef57432a2c536af8ecd4c5
Diffstat (limited to 'svx/source')
-rw-r--r-- | svx/source/tbxctrls/tbcontrl.cxx | 65 |
1 files changed, 32 insertions, 33 deletions
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx index bc264424ab7a..d54237008521 100644 --- a/svx/source/tbxctrls/tbcontrl.cxx +++ b/svx/source/tbxctrls/tbcontrl.cxx @@ -105,8 +105,6 @@ // don't make more than 15 entries visible at once #define MAX_STYLES_ENTRIES 15 -static void lcl_CalcSizeValueSet( vcl::Window &rWin, ValueSet &rValueSet, const Size &aItemSize ); - // namespaces using namespace ::editeng; using namespace ::com::sun::star; @@ -256,10 +254,11 @@ private: ImageList aImgList; bool bParagraphMode; + void InitImageList(); + void CalcSizeValueSet(); DECL_LINK( SelectHdl, ValueSet*, void ); protected: - virtual void Resize() override; virtual void GetFocus() override; public: @@ -1603,18 +1602,7 @@ SvxFrameWindow_Impl::SvxFrameWindow_Impl (const Reference< XFrame >& rFrame, vcl bParagraphMode(false) { AddStatusListener(".uno:BorderReducedMode"); - aImgList = ImageList( SVX_RES( RID_SVXIL_FRAME ) ); - - if( pParentWindow->GetDPIScaleFactor() > 1 ) - { - for (short i = 0; i < aImgList.GetImageCount(); i++) - { - OUString rImageName = aImgList.GetImageName(i); - BitmapEx b = aImgList.GetImage(rImageName).GetBitmapEx(); - b.Scale(pParentWindow->GetDPIScaleFactor(), pParentWindow->GetDPIScaleFactor()); - aImgList.ReplaceImage(rImageName, Image(b)); - } - } + InitImageList(); /* * 1 2 3 4 @@ -1637,8 +1625,7 @@ SvxFrameWindow_Impl::SvxFrameWindow_Impl (const Reference< XFrame >& rFrame, vcl aFrameSet->SetColCount( 4 ); aFrameSet->SetSelectHdl( LINK( this, SvxFrameWindow_Impl, SelectHdl ) ); - - lcl_CalcSizeValueSet( *this, *aFrameSet.get(), Size( 20 * pParentWindow->GetDPIScaleFactor(), 20 * pParentWindow->GetDPIScaleFactor() )); + CalcSizeValueSet(); SetHelpId( HID_POPUP_FRAME ); SetText( SVX_RESSTR(RID_SVXSTR_FRAME) ); @@ -1673,7 +1660,7 @@ void SvxFrameWindow_Impl::DataChanged( const DataChangedEvent& rDCEvt ) if( ( rDCEvt.GetType() == DataChangedEventType::SETTINGS ) && ( rDCEvt.GetFlags() & AllSettingsFlags::STYLE ) ) { - aImgList = ImageList( SVX_RES( RID_SVXIL_FRAME ) ); + InitImageList(); sal_uInt16 nNumOfItems = aFrameSet->GetItemCount(); @@ -1808,12 +1795,6 @@ IMPL_LINK_NOARG(SvxFrameWindow_Impl, SelectHdl, ValueSet*, void) mpController->dispatchCommand( ".uno:SetBorderStyle", aArgs ); } -void SvxFrameWindow_Impl::Resize() -{ - const Size aSize(this->GetOutputSizePixel()); - aFrameSet->SetPosSizePixel(Point(2,2), Size(aSize.Width() - 4, aSize.Height() - 4)); -} - void SvxFrameWindow_Impl::statusChanged( const css::frame::FeatureStateEvent& rEvent ) throw ( css::uno::RuntimeException ) { @@ -1844,13 +1825,39 @@ void SvxFrameWindow_Impl::statusChanged( const css::frame::FeatureStateEvent& rE if ( bResize ) { - lcl_CalcSizeValueSet( *this, *aFrameSet.get(), Size( 20, 20 )); + CalcSizeValueSet(); } } } } } +void SvxFrameWindow_Impl::CalcSizeValueSet() +{ + Size aItemSize( 20 * GetParent()->GetDPIScaleFactor(), 20 * GetParent()->GetDPIScaleFactor() ); + Size aSize = aFrameSet->CalcWindowSizePixel( aItemSize ); + aFrameSet->SetPosSizePixel( Point( 2, 2 ), aSize ); + aSize.Width() += 4; + aSize.Height() += 4; + SetOutputSizePixel( aSize ); +} + +void SvxFrameWindow_Impl::InitImageList() +{ + aImgList = ImageList( SVX_RES( RID_SVXIL_FRAME ) ); + + if( GetParent()->GetDPIScaleFactor() > 1 ) + { + for (short i = 0; i < aImgList.GetImageCount(); i++) + { + OUString rImageName = aImgList.GetImageName(i); + BitmapEx b = aImgList.GetImage(rImageName).GetBitmapEx(); + b.Scale(GetParent()->GetDPIScaleFactor(), GetParent()->GetDPIScaleFactor()); + aImgList.ReplaceImage(rImageName, Image(b)); + } + } +} + static Color lcl_mediumColor( Color aMain, Color /*aDefault*/ ) { return SvxBorderLine::threeDMediumColor( aMain ); @@ -3076,14 +3083,6 @@ void SvxCurrencyToolBoxControl::Select( sal_uInt16 nSelectModifier ) SfxToolBoxControl::Select( nSelectModifier ); } -static void lcl_CalcSizeValueSet( vcl::Window &rWin, ValueSet &rValueSet, const Size &aItemSize ) -{ - Size aSize = rValueSet.CalcWindowSizePixel( aItemSize ); - aSize.Width() += 4; - aSize.Height() += 4; - rWin.SetOutputSizePixel( aSize ); -} - Reference< css::accessibility::XAccessible > SvxFontNameBox_Impl::CreateAccessible() { FillList(); |