diff options
author | Olivier Hallot <olivier.hallot@edx.srv.br> | 2013-07-25 22:53:02 -0300 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-07-26 16:11:14 +0000 |
commit | 6d21d95f2d24a4f1fd0be5e754953f6cf718e56a (patch) | |
tree | 6f4ef3987607a0677b79c786b6be529e0e774f36 | |
parent | 055edb382a400a90a12bac36c4009372fb96888e (diff) |
Convert shadow tab page to widget UI
Change-Id: I8828100136f73e4f80cb11c2b5003fa7de6b575f
Reviewed-on: https://gerrit.libreoffice.org/5116
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | cui/UIConfig_cui.mk | 1 | ||||
-rw-r--r-- | cui/source/inc/cuitabarea.hxx | 18 | ||||
-rw-r--r-- | cui/source/inc/helpid.hrc | 1 | ||||
-rw-r--r-- | cui/source/tabpages/tabarea.hrc | 10 | ||||
-rw-r--r-- | cui/source/tabpages/tabarea.src | 106 | ||||
-rw-r--r-- | cui/source/tabpages/tpshadow.cxx | 181 | ||||
-rw-r--r-- | cui/uiconfig/ui/shadowtabpage.ui | 288 | ||||
-rw-r--r-- | extras/source/glade/libreoffice-catalog.xml.in | 3 | ||||
-rw-r--r-- | include/svx/dlgctrl.hxx | 9 | ||||
-rw-r--r-- | svx/source/dialog/dlgctrl.cxx | 27 |
10 files changed, 402 insertions, 242 deletions
diff --git a/cui/UIConfig_cui.mk b/cui/UIConfig_cui.mk index 9ac79ba532d3..0db14ff8ef00 100644 --- a/cui/UIConfig_cui.mk +++ b/cui/UIConfig_cui.mk @@ -81,6 +81,7 @@ $(eval $(call gb_UIConfig_add_uifiles,cui,\ cui/uiconfig/ui/scriptorganizer \ cui/uiconfig/ui/securityoptionsdialog \ cui/uiconfig/ui/select_persona_dialog \ + cui/uiconfig/ui/shadowtabpage \ cui/uiconfig/ui/specialcharacters \ cui/uiconfig/ui/spellingdialog \ cui/uiconfig/ui/splitcellsdialog \ diff --git a/cui/source/inc/cuitabarea.hxx b/cui/source/inc/cuitabarea.hxx index 9fa007d0ca1e..402ddb051d87 100644 --- a/cui/source/inc/cuitabarea.hxx +++ b/cui/source/inc/cuitabarea.hxx @@ -303,17 +303,13 @@ class SvxShadowTabPage : public SvxTabPage using TabPage::DeactivatePage; private: - FixedLine aFlProp; - TriStateBox aTsbShowShadow; - FixedText aFtPosition; - SvxRectCtl aCtlPosition; - FixedText aFtDistance; - MetricField aMtrDistance; - FixedText aFtShadowColor; - ColorLB aLbShadowColor; - FixedText aFtTransparent; - MetricField aMtrTransparent; - SvxXShadowPreview aCtlXRectPreview; + TriStateBox* m_pTsbShowShadow; + VclGrid* m_pGridShadow; + SvxRectCtl* m_pCtlPosition; + MetricField* m_pMtrDistance; + ColorLB* m_pLbShadowColor; + MetricField* m_pMtrTransparent; + SvxXShadowPreview* m_pCtlXRectPreview; const SfxItemSet& rOutAttrs; RECT_POINT eRP; diff --git a/cui/source/inc/helpid.hrc b/cui/source/inc/helpid.hrc index eebecc8f7a3b..e6e3b5a8745a 100644 --- a/cui/source/inc/helpid.hrc +++ b/cui/source/inc/helpid.hrc @@ -246,7 +246,6 @@ #define HID_MEASURE_CTL_PREVIEW "CUI_HID_MEASURE_CTL_PREVIEW" #define HID_SVXPAGE_SWPOSSIZE "CUI_HID_SVXPAGE_SWPOSSIZE" -#define HID_AREA_SHADOW "CUI_HID_AREA_SHADOW" #define HID_AREA_BITMAP "CUI_HID_AREA_BITMAP" #define HID_TPSHADOW_CTRL "CUI_HID_TPSHADOW_CTRL" #define HID_LINE_ENDDEF "CUI_HID_LINE_ENDDEF" diff --git a/cui/source/tabpages/tabarea.hrc b/cui/source/tabpages/tabarea.hrc index 79b816dd4898..f508b0fade2e 100644 --- a/cui/source/tabpages/tabarea.hrc +++ b/cui/source/tabpages/tabarea.hrc @@ -22,11 +22,8 @@ #define BTN_EMBED 7 #define CTL_PREVIEW 1 #define CTL_POSITION 2 -#define CTL_COLOR_PREVIEW 5 #define CTL_BITMAP_PREVIEW 6 -#define MTR_FLD_DISTANCE 1 #define TSB_INVISIBLE 1 -#define TSB_SHOW_SHADOW 2 #define LB_COLOR 1 #define LB_GRADIENT 2 @@ -41,16 +38,12 @@ #define BTN_DELETE 4 #define FT_COLOR 1 #define FT_BACKGROUND_COLOR 2 -#define FT_POSITION 2 -#define FT_DISTANCE 1 #define MTR_FLD_ANGLE 3 #define CTL_ANGLE 2 #define NUM_FLD_STEPCOUNT 1 #define FT_PIXEL_EDIT 4 #define CTL_PIXEL 2 #define FT_TYPE 7 -#define FT_SHADOW_COLOR 10 -#define LB_SHADOW_COLOR 10 #define FL_PROP 2 #define FL_SIZE 3 @@ -71,9 +64,6 @@ #define MTR_FLD_4 4 #define FT_TABLE_NAME 7 -#define FT_TRANSPARENT 9 #define FT_BITMAPS_HIDDEN 12 -#define MTR_SHADOW_TRANSPARENT 11 - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/tabpages/tabarea.src b/cui/source/tabpages/tabarea.src index 3728d989bb11..f789b47d7d69 100644 --- a/cui/source/tabpages/tabarea.src +++ b/cui/source/tabpages/tabarea.src @@ -29,112 +29,6 @@ #define TRANS_GRAD_OFFSET_Y 64 // ------------------------------------------------------ -TabPage RID_SVXPAGE_SHADOW -{ - HelpID = HID_AREA_SHADOW ; - Hide = TRUE ; - Size = MAP_APPFONT ( TP_WIDTH , TP_HEIGHT ) ; - Text [ en-US ] = "Shadow" ; - FixedLine FL_PROP - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 248, 8 ) ; - Text [ en-US ] = "Properties"; - }; - TriStateBox TSB_SHOW_SHADOW - { - HelpID = "cui:TriStateBox:RID_SVXPAGE_SHADOW:TSB_SHOW_SHADOW"; - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 110 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Use shadow"; - }; - FixedText FT_POSITION - { - Pos = MAP_APPFONT ( 12 , 33 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - Text [ en-US ] = "~Position"; - }; - Control CTL_POSITION - { - HelpId = HID_TPSHADOW_CTRL ; - Pos = MAP_APPFONT ( 65 , 31 ) ; - Size = MAP_APPFONT ( 57 , 29 ) ; - Border = TRUE ; - TabStop = TRUE ; - }; - FixedText FT_DISTANCE - { - Pos = MAP_APPFONT ( 12 , 69 ) ; - Size = MAP_APPFONT ( 50 , 8 ) ; - Text [ en-US ] = "~Distance"; - }; - MetricField MTR_FLD_DISTANCE - { - HelpID = "cui:MetricField:RID_SVXPAGE_SHADOW:MTR_FLD_DISTANCE"; - Pos = MAP_APPFONT ( 65 , 67 ) ; - Size = MAP_APPFONT ( 47 , 12 ) ; - Border = TRUE ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 99999 ; - Minimum = 0 ; // #i33700# - StrictFormat = TRUE ; - DecimalDigits = 2 ; - Unit = FUNIT_MM ; - Last = 99999 ; - /*SpinSize = 100 ; */ - SpinSize = 1 ; - }; - ListBox LB_SHADOW_COLOR - { - HelpID = "cui:ListBox:RID_SVXPAGE_SHADOW:LB_SHADOW_COLOR"; - Pos = MAP_APPFONT ( 65 , 86 ) ; - Size = MAP_APPFONT ( 57 , 100 ) ; - DropDown = TRUE ; - DDExtraWidth = TRUE ; - Border = TRUE ; - TabStop = TRUE ; - }; - FixedText FT_SHADOW_COLOR - { - Pos = MAP_APPFONT ( 12 , 88 ) ; - Size = MAP_APPFONT ( 50 , 8 ) ; - Text [ en-US ] = "~Color" ; - }; - FixedText FT_TRANSPARENT - { - Pos = MAP_APPFONT ( 12 , 107 ) ; - Size = MAP_APPFONT ( 50 , 8 ) ; - Text [ en-US ] = "~Transparency"; - }; - MetricField MTR_SHADOW_TRANSPARENT - { - HelpID = "cui:MetricField:RID_SVXPAGE_SHADOW:MTR_SHADOW_TRANSPARENT"; - Border = TRUE ; - Pos = MAP_APPFONT ( 65 , 105 ) ; - Size = MAP_APPFONT ( 47 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 100 ; - StrictFormat = TRUE ; - Unit = FUNIT_CUSTOM ; - CustomUnitText = "%" ; - Last = 100 ; - SpinSize = 5 ; - }; - Control CTL_COLOR_PREVIEW - { - Border = TRUE; - Pos = MAP_APPFONT ( 138 , 14 ) ; - Size = MAP_APPFONT ( 110 , 42 ) ; - TabStop = FALSE ; - }; -}; - -// ------------------------------------------------------ TabPage RID_SVXPAGE_BITMAP { HelpID = HID_AREA_BITMAP ; diff --git a/cui/source/tabpages/tpshadow.cxx b/cui/source/tabpages/tpshadow.cxx index 824bb8a76220..64269c210e68 100644 --- a/cui/source/tabpages/tpshadow.cxx +++ b/cui/source/tabpages/tpshadow.cxx @@ -47,19 +47,10 @@ static sal_uInt16 pShadowRanges[] = SvxShadowTabPage::SvxShadowTabPage( Window* pParent, const SfxItemSet& rInAttrs ) : - SvxTabPage ( pParent, CUI_RES( RID_SVXPAGE_SHADOW ), rInAttrs ), - - aFlProp ( this, CUI_RES( FL_PROP ) ), - aTsbShowShadow ( this, CUI_RES( TSB_SHOW_SHADOW ) ), - aFtPosition ( this, CUI_RES( FT_POSITION ) ), - aCtlPosition ( this, CUI_RES( CTL_POSITION ) ), - aFtDistance ( this, CUI_RES( FT_DISTANCE ) ), - aMtrDistance ( this, CUI_RES( MTR_FLD_DISTANCE ) ), - aFtShadowColor ( this, CUI_RES( FT_SHADOW_COLOR ) ), - aLbShadowColor ( this, CUI_RES( LB_SHADOW_COLOR ) ), - aFtTransparent ( this, CUI_RES( FT_TRANSPARENT ) ), - aMtrTransparent ( this, CUI_RES( MTR_SHADOW_TRANSPARENT ) ), - aCtlXRectPreview ( this, CUI_RES( CTL_COLOR_PREVIEW ) ), + SvxTabPage ( pParent, + "ShadowTabPage", + "cui/ui/shadowtabpage.ui", + rInAttrs ), rOutAttrs ( rInAttrs ), eRP ( RP_LT ), nPageType ( 0 ), @@ -70,7 +61,13 @@ SvxShadowTabPage::SvxShadowTabPage( Window* pParent, const SfxItemSet& rInAttrs aXFillAttr ( pXPool ), rXFSet ( aXFillAttr.GetItemSet() ) { - FreeResource(); + get(m_pTsbShowShadow,"TSB_SHOW_SHADOW"); + get(m_pGridShadow,"gridSHADOW"); + get(m_pCtlPosition,"CTL_POSITION"); + get(m_pMtrDistance,"MTR_FLD_DISTANCE"); + get(m_pLbShadowColor,"LB_SHADOW_COLOR"); + get(m_pMtrTransparent,"MTR_SHADOW_TRANSPARENT"); + get(m_pCtlXRectPreview,"CTL_COLOR_PREVIEW"); // this page needs ExchangeSupport SetExchangeSupport(); @@ -86,7 +83,7 @@ SvxShadowTabPage::SvxShadowTabPage( Window* pParent, const SfxItemSet& rInAttrs break; default: ;//prevent warning } - SetFieldUnit( aMtrDistance, eFUnit ); + SetFieldUnit( *m_pMtrDistance, eFUnit ); // determine PoolUnit SfxItemPool* pPool = rOutAttrs.GetPool(); @@ -158,36 +155,27 @@ SvxShadowTabPage::SvxShadowTabPage( Window* pParent, const SfxItemSet& rInAttrs } rXFSet.Put( XFillStyleItem( eXFS ) ); - aCtlXRectPreview.SetRectangleAttributes(aXFillAttr.GetItemSet()); + m_pCtlXRectPreview->SetRectangleAttributes(aXFillAttr.GetItemSet()); //aCtlXRectPreview.SetFillAttr( aXFillAttr ); - aTsbShowShadow.SetClickHdl( LINK( this, SvxShadowTabPage, ClickShadowHdl_Impl ) ); + m_pTsbShowShadow->SetClickHdl( LINK( this, SvxShadowTabPage, ClickShadowHdl_Impl ) ); Link aLink = LINK( this, SvxShadowTabPage, ModifyShadowHdl_Impl ); - aLbShadowColor.SetSelectHdl( aLink ); - aMtrTransparent.SetModifyHdl( aLink ); - aMtrDistance.SetModifyHdl( aLink ); + m_pLbShadowColor->SetSelectHdl( aLink ); + m_pMtrTransparent->SetModifyHdl( aLink ); + m_pMtrDistance->SetModifyHdl( aLink ); - aCtlXRectPreview.SetAccessibleName(String(CUI_RES(STR_EXAMPLE))); - aCtlPosition.SetAccessibleRelationMemberOf( &aFlProp ); } // ----------------------------------------------------------------------- void SvxShadowTabPage::Construct() { - aLbShadowColor.Fill( pColorList ); + m_pLbShadowColor->Fill( pColorList ); if( bDisable ) { - aTsbShowShadow.Disable(); - aFtPosition.Disable(); - aCtlPosition.Disable(); - aFtDistance.Disable(); - aMtrDistance.Disable(); - aFtShadowColor.Disable(); - aLbShadowColor.Disable(); - aFtTransparent.Disable(); - aMtrTransparent.Disable(); + m_pTsbShowShadow->Disable(); + m_pGridShadow->Disable(); } } @@ -225,18 +213,18 @@ void SvxShadowTabPage::ActivatePage( const SfxItemSet& rSet ) } } - aCtlXRectPreview.SetRectangleAttributes(rSet); + m_pCtlXRectPreview->SetRectangleAttributes(rSet); // aLbShadowColor - nPos = aLbShadowColor.GetSelectEntryPos(); - aLbShadowColor.Clear(); - aLbShadowColor.Fill( pColorList ); - nCount = aLbShadowColor.GetEntryCount(); + nPos = m_pLbShadowColor->GetSelectEntryPos(); + m_pLbShadowColor->Clear(); + m_pLbShadowColor->Fill( pColorList ); + nCount = m_pLbShadowColor->GetEntryCount(); if( nCount == 0 ) ; // this case should not occur else if( nCount <= nPos ) - aLbShadowColor.SelectEntryPos( 0 ); + m_pLbShadowColor->SelectEntryPos( 0 ); else - aLbShadowColor.SelectEntryPos( nPos ); + m_pLbShadowColor->SelectEntryPos( nPos ); ModifyShadowHdl_Impl( this ); } @@ -264,8 +252,8 @@ sal_Bool SvxShadowTabPage::FillItemSet( SfxItemSet& rAttrs ) if( !bDisable ) { - TriState eState = aTsbShowShadow.GetState(); - if( eState != aTsbShowShadow.GetSavedValue() ) + TriState eState = m_pTsbShowShadow->GetState(); + if( eState != m_pTsbShowShadow->GetSavedValue() ) { SdrShadowItem aItem( sal::static_int_cast< sal_Bool >( eState ) ); pOld = GetOldItem( rAttrs, SDRATTR_SHADOW ); @@ -280,9 +268,9 @@ sal_Bool SvxShadowTabPage::FillItemSet( SfxItemSet& rAttrs ) // a bit intricate inquiry whether there was something changed, // as the items can't be displayed directly on controls sal_Int32 nX = 0L, nY = 0L; - sal_Int32 nXY = GetCoreValue( aMtrDistance, ePoolUnit ); + sal_Int32 nXY = GetCoreValue( *m_pMtrDistance, ePoolUnit ); - switch( aCtlPosition.GetActualRP() ) + switch( m_pCtlPosition->GetActualRP() ) { case RP_LT: nX = nY = -nXY; break; case RP_MT: nY = -nXY; break; @@ -299,7 +287,7 @@ sal_Bool SvxShadowTabPage::FillItemSet( SfxItemSet& rAttrs ) // string in the respective MetricField=="", then the comparison of the old // and the new distance values would return a wrong result because in such a // case the new distance values would matche the default values of the MetricField !!!! - if ( !aMtrDistance.IsEmptyFieldValue() || + if ( !m_pMtrDistance->IsEmptyFieldValue() || rOutAttrs.GetItemState( SDRATTR_SHADOWXDIST ) != SFX_ITEM_DONTCARE || rOutAttrs.GetItemState( SDRATTR_SHADOWYDIST ) != SFX_ITEM_DONTCARE ) { @@ -332,11 +320,11 @@ sal_Bool SvxShadowTabPage::FillItemSet( SfxItemSet& rAttrs ) } // ShadowColor - sal_uInt16 nPos = aLbShadowColor.GetSelectEntryPos(); + sal_uInt16 nPos = m_pLbShadowColor->GetSelectEntryPos(); if( nPos != LISTBOX_ENTRY_NOTFOUND && - nPos != aLbShadowColor.GetSavedValue() ) + nPos != m_pLbShadowColor->GetSavedValue() ) { - SdrShadowColorItem aItem(aLbShadowColor.GetSelectEntryColor()); + SdrShadowColorItem aItem(m_pLbShadowColor->GetSelectEntryColor()); pOld = GetOldItem( rAttrs, SDRATTR_SHADOWCOLOR ); if ( !pOld || !( *(const SdrShadowColorItem*)pOld == aItem ) ) { @@ -346,8 +334,8 @@ sal_Bool SvxShadowTabPage::FillItemSet( SfxItemSet& rAttrs ) } // transparency - sal_uInt16 nVal = (sal_uInt16)aMtrTransparent.GetValue(); - if( nVal != (sal_uInt16)aMtrTransparent.GetSavedValue().toInt32() ) + sal_uInt16 nVal = (sal_uInt16)m_pMtrTransparent->GetValue(); + if( nVal != (sal_uInt16)m_pMtrTransparent->GetSavedValue().toInt32() ) { SdrShadowTransparenceItem aItem( nVal ); pOld = GetOldItem( rAttrs, SDRATTR_SHADOWTRANSPARENCE ); @@ -376,17 +364,17 @@ void SvxShadowTabPage::Reset( const SfxItemSet& rAttrs ) // has a shadow been set? if( rAttrs.GetItemState( SDRATTR_SHADOW ) != SFX_ITEM_DONTCARE ) { - aTsbShowShadow.EnableTriState( sal_False ); + m_pTsbShowShadow->EnableTriState( sal_False ); if( ( ( const SdrShadowItem& ) rAttrs.Get( SDRATTR_SHADOW ) ).GetValue() ) - aTsbShowShadow.SetState( STATE_CHECK ); + m_pTsbShowShadow->SetState( STATE_CHECK ); else { - aTsbShowShadow.SetState( STATE_NOCHECK ); + m_pTsbShowShadow->SetState( STATE_NOCHECK ); } } else - aTsbShowShadow.SetState( STATE_DONTKNOW ); + m_pTsbShowShadow->SetState( STATE_DONTKNOW ); // distance (only 8 possible positions), // so there is only one item evaluated @@ -398,21 +386,21 @@ void SvxShadowTabPage::Reset( const SfxItemSet& rAttrs ) sal_Int32 nY = ( ( const SdrShadowYDistItem& ) rAttrs.Get( SDRATTR_SHADOWYDIST ) ).GetValue(); if( nX != 0 ) - SetMetricValue( aMtrDistance, nX < 0L ? -nX : nX, ePoolUnit ); + SetMetricValue( *m_pMtrDistance, nX < 0L ? -nX : nX, ePoolUnit ); else - SetMetricValue( aMtrDistance, nY < 0L ? -nY : nY, ePoolUnit ); + SetMetricValue( *m_pMtrDistance, nY < 0L ? -nY : nY, ePoolUnit ); // setting the shadow control - if ( nX < 0L && nY < 0L ) aCtlPosition.SetActualRP( RP_LT ); - else if( nX == 0L && nY < 0L ) aCtlPosition.SetActualRP( RP_MT ); - else if( nX > 0L && nY < 0L ) aCtlPosition.SetActualRP( RP_RT ); - else if( nX < 0L && nY == 0L ) aCtlPosition.SetActualRP( RP_LM ); + if ( nX < 0L && nY < 0L ) m_pCtlPosition->SetActualRP( RP_LT ); + else if( nX == 0L && nY < 0L ) m_pCtlPosition->SetActualRP( RP_MT ); + else if( nX > 0L && nY < 0L ) m_pCtlPosition->SetActualRP( RP_RT ); + else if( nX < 0L && nY == 0L ) m_pCtlPosition->SetActualRP( RP_LM ); // there's no center point anymore - else if( nX == 0L && nY == 0L ) aCtlPosition.SetActualRP( RP_RB ); - else if( nX > 0L && nY == 0L ) aCtlPosition.SetActualRP( RP_RM ); - else if( nX < 0L && nY > 0L ) aCtlPosition.SetActualRP( RP_LB ); - else if( nX == 0L && nY > 0L ) aCtlPosition.SetActualRP( RP_MB ); - else if( nX > 0L && nY > 0L ) aCtlPosition.SetActualRP( RP_RB ); + else if( nX == 0L && nY == 0L ) m_pCtlPosition->SetActualRP( RP_RB ); + else if( nX > 0L && nY == 0L ) m_pCtlPosition->SetActualRP( RP_RM ); + else if( nX < 0L && nY > 0L ) m_pCtlPosition->SetActualRP( RP_LB ); + else if( nX == 0L && nY > 0L ) m_pCtlPosition->SetActualRP( RP_MB ); + else if( nX > 0L && nY > 0L ) m_pCtlPosition->SetActualRP( RP_RB ); } else { @@ -425,42 +413,42 @@ void SvxShadowTabPage::Reset( const SfxItemSet& rAttrs ) sal_Int32 nX = pXDistItem->GetValue(); sal_Int32 nY = pYDistItem->GetValue(); if( nX != 0 ) - SetMetricValue( aMtrDistance, nX < 0L ? -nX : nX, ePoolUnit ); + SetMetricValue( *m_pMtrDistance, nX < 0L ? -nX : nX, ePoolUnit ); else - SetMetricValue( aMtrDistance, nY < 0L ? -nY : nY, ePoolUnit ); + SetMetricValue( *m_pMtrDistance, nY < 0L ? -nY : nY, ePoolUnit ); } // Tristate, e. g. multiple objects have been marked of which some have a shadow and some don't. // The text (which shall be displayed) of the MetricFields is set to "" and serves as an // identification in the method FillItemSet for the fact that the distance value was NOT changed !!!! - aMtrDistance.SetText( String() ); - aCtlPosition.SetActualRP( RP_MM ); + m_pMtrDistance->SetText( "" ); + m_pCtlPosition->SetActualRP( RP_MM ); } if( rAttrs.GetItemState( SDRATTR_SHADOWCOLOR ) != SFX_ITEM_DONTCARE ) { - aLbShadowColor.SelectEntry( ( ( const SdrShadowColorItem& ) rAttrs.Get( SDRATTR_SHADOWCOLOR ) ).GetColorValue() ); + m_pLbShadowColor->SelectEntry( ( ( const SdrShadowColorItem& ) rAttrs.Get( SDRATTR_SHADOWCOLOR ) ).GetColorValue() ); } else - aLbShadowColor.SetNoSelection(); + m_pLbShadowColor->SetNoSelection(); if( rAttrs.GetItemState( SDRATTR_SHADOWTRANSPARENCE ) != SFX_ITEM_DONTCARE ) { sal_uInt16 nTransp = ( ( const SdrShadowTransparenceItem& ) rAttrs.Get( SDRATTR_SHADOWTRANSPARENCE ) ).GetValue(); - aMtrTransparent.SetValue( nTransp ); + m_pMtrTransparent->SetValue( nTransp ); } else - aMtrTransparent.SetText( String() ); + m_pMtrTransparent->SetText( "" ); //aCtlPosition - aMtrDistance.SaveValue(); - aLbShadowColor.SaveValue(); - aTsbShowShadow.SaveValue(); + m_pMtrDistance->SaveValue(); + m_pLbShadowColor->SaveValue(); + m_pTsbShowShadow->SaveValue(); // #66832# This field was not saved, but used to determine changes. // Why? Seems to be the error. // It IS the error. - aMtrTransparent.SaveValue(); + m_pMtrTransparent->SaveValue(); ClickShadowHdl_Impl( NULL ); ModifyShadowHdl_Impl( NULL ); @@ -486,29 +474,15 @@ sal_uInt16* SvxShadowTabPage::GetRanges() IMPL_LINK_NOARG(SvxShadowTabPage, ClickShadowHdl_Impl) { - if( aTsbShowShadow.GetState() == STATE_NOCHECK ) + if( m_pTsbShowShadow->GetState() == STATE_NOCHECK ) { - aFtPosition.Disable(); - aCtlPosition.Disable(); - aFtDistance.Disable(); - aMtrDistance.Disable(); - aFtShadowColor.Disable(); - aLbShadowColor.Disable(); - aFtTransparent.Disable(); - aMtrTransparent.Disable(); + m_pGridShadow->Disable(); } else { - aFtPosition.Enable(); - aCtlPosition.Enable(); - aFtDistance.Enable(); - aMtrDistance.Enable(); - aFtShadowColor.Enable(); - aLbShadowColor.Enable(); - aFtTransparent.Enable(); - aMtrTransparent.Enable(); + m_pGridShadow->Enable(); } - aCtlPosition.Invalidate(); + m_pCtlPosition->Invalidate(); ModifyShadowHdl_Impl( NULL ); @@ -519,25 +493,24 @@ IMPL_LINK_NOARG(SvxShadowTabPage, ClickShadowHdl_Impl) IMPL_LINK_NOARG(SvxShadowTabPage, ModifyShadowHdl_Impl) { - if( aTsbShowShadow.GetState() == STATE_CHECK ) + if( m_pTsbShowShadow->GetState() == STATE_CHECK ) rXFSet.Put( XFillStyleItem( XFILL_SOLID ) ); else rXFSet.Put( XFillStyleItem( XFILL_NONE ) ); - sal_uInt16 nPos = aLbShadowColor.GetSelectEntryPos(); + sal_uInt16 nPos = m_pLbShadowColor->GetSelectEntryPos(); if( nPos != LISTBOX_ENTRY_NOTFOUND ) { - rXFSet.Put( XFillColorItem( String(), - aLbShadowColor.GetSelectEntryColor() ) ); + rXFSet.Put( XFillColorItem( String(), m_pLbShadowColor->GetSelectEntryColor() ) ); } - sal_uInt16 nVal = (sal_uInt16)aMtrTransparent.GetValue(); + sal_uInt16 nVal = (sal_uInt16)m_pMtrTransparent->GetValue(); XFillTransparenceItem aItem( nVal ); rXFSet.Put( XFillTransparenceItem( aItem ) ); // shadow removal sal_Int32 nX = 0L, nY = 0L; - sal_Int32 nXY = GetCoreValue( aMtrDistance, ePoolUnit ); - switch( aCtlPosition.GetActualRP() ) + sal_Int32 nXY = GetCoreValue( *m_pMtrDistance, ePoolUnit ); + switch( m_pCtlPosition->GetActualRP() ) { case RP_LT: nX = nY = -nXY; break; case RP_MT: nY = -nXY; break; @@ -550,11 +523,11 @@ IMPL_LINK_NOARG(SvxShadowTabPage, ModifyShadowHdl_Impl) case RP_MM: break; } - aCtlXRectPreview.SetShadowPosition(Point(nX, nY)); + m_pCtlXRectPreview->SetShadowPosition(Point(nX, nY)); - aCtlXRectPreview.SetShadowAttributes(aXFillAttr.GetItemSet()); + m_pCtlXRectPreview->SetShadowAttributes(aXFillAttr.GetItemSet()); //aCtlXRectPreview.SetFillAttr( aXFillAttr ); - aCtlXRectPreview.Invalidate(); + m_pCtlXRectPreview->Invalidate(); return( 0L ); } diff --git a/cui/uiconfig/ui/shadowtabpage.ui b/cui/uiconfig/ui/shadowtabpage.ui new file mode 100644 index 000000000000..421e4fb6cb5e --- /dev/null +++ b/cui/uiconfig/ui/shadowtabpage.ui @@ -0,0 +1,288 @@ +<?xml version="1.0" encoding="UTF-8"?> +<interface> + <!-- interface-requires gtk+ 3.0 --> + <!-- interface-requires LibreOffice 1.0 --> + <object class="GtkAdjustment" id="adjustmentDistance"> + <property name="upper">999</property> + <property name="step_increment">1</property> + <property name="page_increment">10</property> + </object> + <object class="GtkAdjustment" id="adjustmentPercent"> + <property name="upper">100</property> + <property name="step_increment">5</property> + <property name="page_increment">10</property> + </object> + <object class="GtkFrame" id="ShadowTabPage"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="border_width">6</property> + <property name="label_xalign">0</property> + <property name="shadow_type">none</property> + <child> + <object class="GtkAlignment" id="alignment1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="margin_left">12</property> + <property name="margin_top">6</property> + <property name="hexpand">True</property> + <child> + <object class="GtkBox" id="box1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="spacing">12</property> + <property name="homogeneous">True</property> + <child> + <object class="GtkBox" id="box2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <property name="spacing">6</property> + <child> + <object class="GtkCheckButton" id="TSB_SHOW_SHADOW"> + <property name="label" translatable="yes">_Use shadow</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="receives_default">False</property> + <property name="use_underline">True</property> + <property name="xalign">0</property> + <property name="inconsistent">True</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkGrid" id="gridSHADOW"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="row_spacing">6</property> + <property name="column_spacing">12</property> + <child> + <object class="GtkSpinButton" id="MTR_SHADOW_TRANSPARENT:0%"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="invisible_char">•</property> + <property name="adjustment">adjustmentPercent</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">3</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkSpinButton" id="MTR_FLD_DISTANCE:0cm"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="invisible_char">•</property> + <property name="adjustment">adjustmentDistance</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">1</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="svxlo-SvxRectCtl" id="CTL_POSITION"> + <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="left_attach">1</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="svxlo-ColorLB" id="LB_SHADOW_COLOR"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="halign">start</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">2</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkAlignment" id="alignment2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="halign">start</property> + <property name="xalign">0</property> + <property name="left_padding">12</property> + <child> + <object class="GtkLabel" id="FT_DISTANCE"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">_Distance</property> + <property name="use_underline">True</property> + </object> + </child> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">1</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkAlignment" id="alignment3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="halign">start</property> + <property name="left_padding">12</property> + <child> + <object class="GtkLabel" id="FT_POSITION"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">_Position</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">CTL_POSITION</property> + </object> + </child> + </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="GtkAlignment" id="alignment4"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="halign">start</property> + <property name="margin_left">12</property> + <child> + <object class="GtkLabel" id="FT_TRANSPARENT"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">_Transparency</property> + <property name="use_underline">True</property> + </object> + </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="GtkAlignment" id="alignment5"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="halign">start</property> + <property name="margin_left">12</property> + <child> + <object class="GtkLabel" id="FT_SHADOW_COLOR"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">_Color</property> + <property name="use_underline">True</property> + </object> + </child> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">2</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">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkBox" id="box3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="valign">start</property> + <property name="margin_right">12</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="orientation">vertical</property> + <property name="spacing">6</property> + <property name="homogeneous">True</property> + <child> + <object class="svxlo-SvxXShadowPreview" id="CTL_COLOR_PREVIEW"> + <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="CTL_COLOR_PREVIEW-atkobject"> + <property name="AtkObject::accessible-name" translatable="yes">Example</property> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + </child> + </object> + </child> + <child type="label"> + <object class="GtkLabel" id="label"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Properties</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + </child> + </object> + <object class="GtkSizeGroup" id="sizegroup1"> + <widgets> + <widget name="MTR_SHADOW_TRANSPARENT:0%"/> + <widget name="MTR_FLD_DISTANCE:0cm"/> + <widget name="LB_SHADOW_COLOR"/> + </widgets> + </object> + <object class="GtkSizeGroup" id="sizegroup2"> + <property name="mode">both</property> + <widgets> + <widget name="gridSHADOW"/> + <widget name="box3"/> + </widgets> + </object> +</interface> diff --git a/extras/source/glade/libreoffice-catalog.xml.in b/extras/source/glade/libreoffice-catalog.xml.in index 48650545cb91..3066768edcec 100644 --- a/extras/source/glade/libreoffice-catalog.xml.in +++ b/extras/source/glade/libreoffice-catalog.xml.in @@ -218,6 +218,9 @@ <glade-widget-class title="Rectangle Preview" name="svxlo-SvxXRectPreview" generic-name="Rectangle Preview Window" parent="GtkDrawingArea" icon-name="widget-gtk-drawingarea"/> + <glade-widget-class title="Shadow Preview" name="svxlo-SvxXShadowPreview" + generic-name="Shadow Preview Window" parent="GtkDrawingArea" + icon-name="widget-gtk-drawingarea"/> <glade-widget-class title="Frame Selector" name="svxlo-SvxFrameSelector" generic-name="Frame Border Preview Window" parent="GtkDrawingArea" icon-name="widget-gtk-drawingarea"/> diff --git a/include/svx/dlgctrl.hxx b/include/svx/dlgctrl.hxx index 922574ab9517..76f9d2c697c5 100644 --- a/include/svx/dlgctrl.hxx +++ b/include/svx/dlgctrl.hxx @@ -428,11 +428,14 @@ public: class SVX_DLLPUBLIC SvxXShadowPreview : public SvxPreviewBase { private: - SdrObject* mpRectangleObject; - SdrObject* mpRectangleShadow; + Point maShadowOffset; + + SdrObject* mpRectangleObject; + SdrObject* mpRectangleShadow; public: - SvxXShadowPreview( Window* pParent, const ResId& rResId ); + SvxXShadowPreview(Window *pParent); + virtual ~SvxXShadowPreview(); void SetRectangleAttributes(const SfxItemSet& rItemSet); diff --git a/svx/source/dialog/dlgctrl.cxx b/svx/source/dialog/dlgctrl.cxx index 29e25f7bf65d..cc88c154356f 100644 --- a/svx/source/dialog/dlgctrl.cxx +++ b/svx/source/dialog/dlgctrl.cxx @@ -1949,10 +1949,10 @@ void SvxXRectPreview::Paint( const Rectangle& ) LocalPostPaint(); } -SvxXShadowPreview::SvxXShadowPreview( Window* pParent, const ResId& rResId ) -: SvxPreviewBase( pParent, rResId ), - mpRectangleObject(0), - mpRectangleShadow(0) +SvxXShadowPreview::SvxXShadowPreview( Window* pParent ) + : SvxPreviewBase(pParent) + , mpRectangleObject(0) + , mpRectangleShadow(0) { InitSettings(true, true); @@ -1972,6 +1972,11 @@ SvxXShadowPreview::SvxXShadowPreview( Window* pParent, const ResId& rResId ) mpRectangleShadow->SetModel(&getModel()); } +extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeSvxXShadowPreview (Window *pParent, VclBuilder::stringmap &) +{ + return new SvxXShadowPreview(pParent); +} + SvxXShadowPreview::~SvxXShadowPreview() { SdrObject::Free(mpRectangleObject); @@ -1992,15 +1997,23 @@ void SvxXShadowPreview::SetShadowAttributes(const SfxItemSet& rItemSet) void SvxXShadowPreview::SetShadowPosition(const Point& rPos) { - Rectangle aObjectPosition(mpRectangleObject->GetSnapRect()); - aObjectPosition.Move(rPos.X(), rPos.Y()); - mpRectangleShadow->SetSnapRect(aObjectPosition); + maShadowOffset = rPos; } void SvxXShadowPreview::Paint( const Rectangle& ) { LocalPrePaint(); + // prepare size + Size aSize = GetOutputSize(); + aSize.Width() = aSize.Width() / 3; + aSize.Height() = aSize.Height() / 3; + + Rectangle aObjectRect(Point(aSize.Width(), aSize.Height()), aSize); + mpRectangleObject->SetSnapRect(aObjectRect); + aObjectRect.Move(maShadowOffset.X(), maShadowOffset.Y()); + mpRectangleShadow->SetSnapRect(aObjectRect); + sdr::contact::SdrObjectVector aObjectVector; aObjectVector.push_back(mpRectangleShadow); |