diff options
author | Armin Le Grand <alg@apache.org> | 2012-01-17 16:54:04 +0000 |
---|---|---|
committer | Armin Le Grand <alg@apache.org> | 2012-01-17 16:54:04 +0000 |
commit | 2a0cd925bebb0c7d3513db311b185a04f259b68d (patch) | |
tree | 8d1ed154b241a9823c54b76ed091ecb6b6935a9d /cui/source | |
parent | 63480c993d8e2fb0929d3c39f621aae9443faa04 (diff) |
linecap: Reintegrating finished LineCap feature, kudos to Regina Henschel for doing the basic implementation and offering it under apache license
Notes
merged as: 44cfc7cb6533d827fd2d6e586d92c61d7d7f7a70
Diffstat (limited to 'cui/source')
-rw-r--r-- | cui/source/inc/cuitabline.hxx | 7 | ||||
-rw-r--r-- | cui/source/tabpages/tabline.hrc | 6 | ||||
-rw-r--r-- | cui/source/tabpages/tabline.src | 25 | ||||
-rw-r--r-- | cui/source/tabpages/tpline.cxx | 117 |
4 files changed, 153 insertions, 2 deletions
diff --git a/cui/source/inc/cuitabline.hxx b/cui/source/inc/cuitabline.hxx index 08d29b1f3476..828dd7527196 100644 --- a/cui/source/inc/cuitabline.hxx +++ b/cui/source/inc/cuitabline.hxx @@ -127,6 +127,10 @@ private: FixedText maFTEdgeStyle; LineEndLB maLBEdgeStyle; + // LineCaps + FixedText maFTCapStyle; + LineEndLB maLBCapStyle; + //#58425# Symbole auf einer Linie (z.B. StarChart) -> SdrObjList* pSymbolList; //a list of symbols to be shown in menu. Symbol at position SID_ATTR_SYMBOLTYPE is to be shown in preview. The list position is to be used cyclic. bool bNewSize; @@ -197,6 +201,9 @@ private: // #116827# DECL_LINK( ChangeEdgeStyleHdl_Impl, void * ); + // LineCaps + DECL_LINK ( ChangeCapStyleHdl_Impl, void * ); + sal_Bool FillXLSet_Impl(); #endif diff --git a/cui/source/tabpages/tabline.hrc b/cui/source/tabpages/tabline.hrc index 30dd2cb1a125..8319873eece8 100644 --- a/cui/source/tabpages/tabline.hrc +++ b/cui/source/tabpages/tabline.hrc @@ -97,6 +97,12 @@ #define FT_EDGE_STYLE 13 #define LB_EDGE_STYLE 5 +// since LO3.6 +#define FT_CAP_STYLE 14 +#define LB_CAP_STYLE 6 +// not sure about IAccessibility2, add it nevertheless +#define STR_LB_CAP_STYLE 42 + //Symbole (fuer StarChart) #define FT_SYMBOL_WIDTH 20 #define FT_SYMBOL_HEIGHT 21 diff --git a/cui/source/tabpages/tabline.src b/cui/source/tabpages/tabline.src index eda4161bb138..4538b01c25ac 100644 --- a/cui/source/tabpages/tabline.src +++ b/cui/source/tabpages/tabline.src @@ -235,13 +235,13 @@ TabPage RID_SVXPAGE_LINE { Pos = MAP_APPFONT ( 124 , 3 + (16 * 6) - 4 ) ; Size = MAP_APPFONT ( 130 , 8 ) ; - Text [ en-US ] = "Corner style" ; + Text [ en-US ] = "Corner and cap styles" ; }; FixedText FT_EDGE_STYLE { Pos = MAP_APPFONT ( 130 , 14 + (16 * 6) - 4 ) ; Size = MAP_APPFONT ( 118 , 8 ) ; - Text [ en-US ] = "Sty~le" ; + Text [ en-US ] = "~Corner style" ; }; ListBox LB_EDGE_STYLE { @@ -259,6 +259,27 @@ TabPage RID_SVXPAGE_LINE < "Beveled" ; > ; }; }; + FixedText FT_CAP_STYLE + { + Pos = MAP_APPFONT ( 191 , 14 + (16 * 6) - 4 ) ; + Size = MAP_APPFONT ( 118 , 8 ) ; + Text [ en-US ] = "Ca~p style" ; + }; + ListBox LB_CAP_STYLE + { + HelpID = "cui:ListBox:RID_SVXPAGE_LINE:LB_CAP_STYLE"; + Border = TRUE ; + Pos = MAP_APPFONT ( 191 , 25 + (16 * 6) - 4 ) ; + Size = MAP_APPFONT ( 57 , 99 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + StringList [ en-US ] = + { + < "Flat" ; Default ; > ; // Same string as in Excel + < "Round" ; > ; + < "Square" ; > ; + }; + }; ////////////////////////////////////////////////////////////////////////////// diff --git a/cui/source/tabpages/tpline.cxx b/cui/source/tabpages/tpline.cxx index 2627a6687659..2a4d59374815 100644 --- a/cui/source/tabpages/tpline.cxx +++ b/cui/source/tabpages/tpline.cxx @@ -129,6 +129,10 @@ SvxLineTabPage::SvxLineTabPage maFTEdgeStyle ( this, CUI_RES( FT_EDGE_STYLE ) ), maLBEdgeStyle ( this, CUI_RES( LB_EDGE_STYLE ) ), + // LineCaps + maFTCapStyle ( this, CUI_RES( FT_CAP_STYLE ) ), + maLBCapStyle ( this, CUI_RES( LB_CAP_STYLE ) ), + pSymbolList(NULL), bNewSize(false), nNumMenuGalleryItems(0), @@ -234,6 +238,10 @@ SvxLineTabPage::SvxLineTabPage Link aEdgeStyle = LINK( this, SvxLineTabPage, ChangeEdgeStyleHdl_Impl ); maLBEdgeStyle.SetSelectHdl( aEdgeStyle ); + // LineCaps + Link aCapStyle = LINK( this, SvxLineTabPage, ChangeCapStyleHdl_Impl ); + maLBCapStyle.SetSelectHdl( aCapStyle ); + //#58425# Symbole auf einer Linie (z.B. StarChart) , MB-Handler setzen aSymbolMB.SetSelectHdl(LINK(this, SvxLineTabPage, GraphicHdl_Impl)); aSymbolMB.SetActivateHdl(LINK(this, SvxLineTabPage, MenuCreateHdl_Impl)); @@ -484,6 +492,10 @@ void SvxLineTabPage::ActivatePage( const SfxItemSet& rSet ) maFLEdgeStyle.Hide(); maFTEdgeStyle.Hide(); maLBEdgeStyle.Hide(); + + // LineCaps + maFTCapStyle.Hide(); + maLBCapStyle.Hide(); } } @@ -751,6 +763,45 @@ sal_Bool SvxLineTabPage::FillItemSet( SfxItemSet& rAttrs ) } } + // LineCaps + nPos = maLBCapStyle.GetSelectEntryPos(); + if( LISTBOX_ENTRY_NOTFOUND != nPos && nPos != maLBCapStyle.GetSavedValue() ) + { + XLineCapItem* pNew = 0L; + + switch(nPos) + { + case 0: // Butt (=Flat), default + { + pNew = new XLineCapItem(com::sun::star::drawing::LineCap_BUTT); + break; + } + case 1: // Round + { + pNew = new XLineCapItem(com::sun::star::drawing::LineCap_ROUND); + break; + } + case 2: // Square + { + pNew = new XLineCapItem(com::sun::star::drawing::LineCap_SQUARE); + break; + } + } + + if(pNew) + { + pOld = GetOldItem( rAttrs, XATTR_LINECAP ); + + if(!pOld || !(*(const XLineCapItem*)pOld == *pNew)) + { + rAttrs.Put( *pNew ); + bModified = sal_True; + } + + delete pNew; + } + } + if(nSymbolType!=SVX_SYMBOLTYPE_UNKNOWN || bNewSize) { //wurde also per Auswahl gesetzt oder Gr��e ist anders @@ -866,6 +917,30 @@ sal_Bool SvxLineTabPage::FillXLSet_Impl() } } + // LineCaps + nPos = maLBCapStyle.GetSelectEntryPos(); + if(LISTBOX_ENTRY_NOTFOUND != nPos) + { + switch(nPos) + { + case 0: // Butt (=Flat), default + { + rXLSet.Put(XLineCapItem(com::sun::star::drawing::LineCap_BUTT)); + break; + } + case 1: // Round + { + rXLSet.Put(XLineCapItem(com::sun::star::drawing::LineCap_ROUND)); + break; + } + case 2: // Square + { + rXLSet.Put(XLineCapItem(com::sun::star::drawing::LineCap_SQUARE)); + break; + } + } + } + rXLSet.Put( XLineStartWidthItem( GetCoreValue( aMtrStartWidth, ePoolUnit ) ) ); rXLSet.Put( XLineEndWidthItem( GetCoreValue( aMtrEndWidth, ePoolUnit ) ) ); @@ -1284,6 +1359,28 @@ void SvxLineTabPage::Reset( const SfxItemSet& rAttrs ) } */ + // fdo#43209 + if(bObjSelected && SFX_ITEM_DEFAULT == rAttrs.GetItemState(XATTR_LINECAP)) + { + maFTCapStyle.Disable(); + maLBCapStyle.Disable(); + } + else if(SFX_ITEM_DONTCARE != rAttrs.GetItemState(XATTR_LINECAP)) + { + const com::sun::star::drawing::LineCap eLineCap(((const XLineCapItem&)(rAttrs.Get(XATTR_LINECAP))).GetValue()); + + switch(eLineCap) + { + case com::sun::star::drawing::LineCap_ROUND: maLBCapStyle.SelectEntryPos(1); break; + case com::sun::star::drawing::LineCap_SQUARE : maLBCapStyle.SelectEntryPos(2); break; + default /*com::sun::star::drawing::LineCap_BUTT*/: maLBCapStyle.SelectEntryPos(0); break; + } + } + else + { + maLBCapStyle.SetNoSelection(); + } + // Werte sichern aLbLineStyle.SaveValue(); aMtrLineWidth.SaveValue(); @@ -1299,6 +1396,9 @@ void SvxLineTabPage::Reset( const SfxItemSet& rAttrs ) // #116827# maLBEdgeStyle.SaveValue(); + // LineCaps + maLBCapStyle.SaveValue(); + ClickInvisibleHdl_Impl( this ); //ClickMeasuringHdl_Impl( this ); //aCtlPosition.Reset(); @@ -1416,6 +1516,15 @@ IMPL_LINK( SvxLineTabPage, ChangeEdgeStyleHdl_Impl, void *, EMPTYARG ) } //------------------------------------------------------------------------ +// fdo#43209 + +IMPL_LINK( SvxLineTabPage, ChangeCapStyleHdl_Impl, void *, EMPTYARG ) +{ + ChangePreviewHdl_Impl( this ); + + return( 0L ); +} +//------------------------------------------------------------------------ IMPL_LINK( SvxLineTabPage, ClickInvisibleHdl_Impl, void *, EMPTYARG ) { @@ -1442,6 +1551,10 @@ IMPL_LINK( SvxLineTabPage, ClickInvisibleHdl_Impl, void *, EMPTYARG ) // #116827# maFTEdgeStyle.Disable(); maLBEdgeStyle.Disable(); + + // LineCaps + maFTCapStyle.Disable(); + maLBCapStyle.Disable(); } } else @@ -1466,6 +1579,10 @@ IMPL_LINK( SvxLineTabPage, ClickInvisibleHdl_Impl, void *, EMPTYARG ) // #116827# maFTEdgeStyle.Enable(); maLBEdgeStyle.Enable(); + + // LineCaps + maFTCapStyle.Enable(); + maLBCapStyle.Enable(); } } ChangePreviewHdl_Impl( NULL ); |