diff options
author | Cédric Bosdonnat <cedricbosdo@openoffice.org> | 2011-03-17 17:40:11 +0100 |
---|---|---|
committer | Cédric Bosdonnat <cedricbosdo@openoffice.org> | 2011-03-19 15:33:13 +0100 |
commit | 157c996a329d8c8989ea43284ba0cca727cf0dde (patch) | |
tree | d37553af466fc47c212a720e76ce8ebc8884bfda | |
parent | 481e04cd43701e6f760715e1c22000707f63ce32 (diff) |
i#12441: Fixed line style in footnote format GUI and saved it to ODF
-rw-r--r-- | sw/inc/pagedesc.hxx | 18 | ||||
-rw-r--r-- | sw/inc/unomid.h | 1 | ||||
-rw-r--r-- | sw/inc/unoprnms.hxx | 3 | ||||
-rw-r--r-- | sw/source/core/layout/pagedesc.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/layout/paintfrm.cxx | 3 | ||||
-rw-r--r-- | sw/source/core/unocore/unomap.cxx | 1 | ||||
-rw-r--r-- | sw/source/core/unocore/unoprnms.cxx | 1 | ||||
-rw-r--r-- | sw/source/ui/inc/pgfnote.hxx | 3 | ||||
-rw-r--r-- | sw/source/ui/misc/pgfnote.cxx | 83 | ||||
-rw-r--r-- | sw/source/ui/misc/pgfnote.hrc | 7 | ||||
-rw-r--r-- | sw/source/ui/misc/pgfnote.src | 36 | ||||
-rw-r--r-- | sw/source/ui/utlui/uiitems.cxx | 26 |
12 files changed, 126 insertions, 60 deletions
diff --git a/sw/inc/pagedesc.hxx b/sw/inc/pagedesc.hxx index 0690a3d1b7ed..156d5b2e1fc2 100644 --- a/sw/inc/pagedesc.hxx +++ b/sw/inc/pagedesc.hxx @@ -35,6 +35,7 @@ #include <swtypes.hxx> // For SwTwips. #include <frmfmt.hxx> #include <editeng/numitem.hxx> +#include <editeng/borderline.hxx> class SfxPoolItem; class SwTxtFmtColl; @@ -51,18 +52,20 @@ enum SwFtnAdj // Footnote information. class SW_DLLPUBLIC SwPageFtnInfo { - SwTwips nMaxHeight; // Maximum height of the footnote area. - sal_uLong nLineWidth; // Width of separator line. - Color aLineColor; // Color of the separator line. - Fraction aWidth; // Percentage width of the separator line. - SwFtnAdj eAdj; // Line adjustment. - SwTwips nTopDist; // Distance between body and separator. - SwTwips nBottomDist; // Distance between separator and first footnote. + SwTwips nMaxHeight; //maximum height of the footnote area. + sal_uLong nLineWidth; //width of separator line + SvxBorderStyle eLineStyle; // Style of the separator line + Color aLineColor; //color of the separator line + Fraction aWidth; //percentage width of the separator line. + SwFtnAdj eAdj; //line adjustment. + SwTwips nTopDist; //distance between body and separator. + SwTwips nBottomDist; //distance between separator and first footnote public: SwTwips GetHeight() const { return nMaxHeight; } sal_uLong GetLineWidth() const { return nLineWidth; } const Color& GetLineColor() const { return aLineColor;} + SvxBorderStyle GetLineStyle() const { return eLineStyle; } const Fraction& GetWidth() const { return aWidth; } SwFtnAdj GetAdj() const { return eAdj; } SwTwips GetTopDist()const { return nTopDist; } @@ -70,6 +73,7 @@ public: void SetHeight( SwTwips nNew ) { nMaxHeight = nNew; } void SetLineWidth(sal_uLong nSet ) { nLineWidth = nSet; } + void SetLineStyle( SvxBorderStyle eSet ) { eLineStyle = eSet; } void SetLineColor(const Color& rCol ) { aLineColor = rCol;} void SetWidth( const Fraction &rNew){ aWidth = rNew; } void SetAdj ( SwFtnAdj eNew ) { eAdj = eNew; } diff --git a/sw/inc/unomid.h b/sw/inc/unomid.h index d32ab9d329b7..92b132e480ab 100644 --- a/sw/inc/unomid.h +++ b/sw/inc/unomid.h @@ -118,6 +118,7 @@ #define MID_LINE_ADJUST 4 #define MID_LINE_TEXT_DIST 5 #define MID_LINE_FOOTNOTE_DIST 6 +#define MID_FTN_LINE_STYLE 7 //SwFmtRuby #define MID_RUBY_TEXT 0 diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx index 3462d6c1e182..7c7c7f30f9f8 100644 --- a/sw/inc/unoprnms.hxx +++ b/sw/inc/unoprnms.hxx @@ -808,7 +808,8 @@ enum SwPropNameIds /* 0740 */ UNO_NAME_VBA_DOCOBJ, /* 0741 */ UNO_NAME_NESTED_TEXT_CONTENT, /* 0742 */ UNO_NAME_SEPARATOR_LINE_STYLE, -/* 0743 */ SW_PROPNAME_END +/* 0743 */ UNO_NAME_FOOTNOTE_LINE_STYLE, +/* 0744 */ SW_PROPNAME_END }; struct SwPropNameLen diff --git a/sw/source/core/layout/pagedesc.cxx b/sw/source/core/layout/pagedesc.cxx index aeebee1294db..0ba954b226ca 100644 --- a/sw/source/core/layout/pagedesc.cxx +++ b/sw/source/core/layout/pagedesc.cxx @@ -367,6 +367,7 @@ SwPageFtnInfo::SwPageFtnInfo() : nMaxHeight( 0 ), // aPen( PEN_SOLID ), nLineWidth(10), + eLineStyle( SOLID ), aWidth( 25, 100 ), nTopDist( 57 ), //1mm nBottomDist( 57 ) @@ -382,6 +383,7 @@ SwPageFtnInfo::SwPageFtnInfo() : SwPageFtnInfo::SwPageFtnInfo( const SwPageFtnInfo &rCpy ) : nMaxHeight( rCpy.GetHeight() ), nLineWidth(rCpy.nLineWidth), + eLineStyle(rCpy.eLineStyle), aLineColor(rCpy.aLineColor), aWidth( rCpy.GetWidth() ), eAdj( rCpy.GetAdj() ), @@ -402,6 +404,7 @@ SwPageFtnInfo &SwPageFtnInfo::operator=( const SwPageFtnInfo& rCpy ) { nMaxHeight = rCpy.GetHeight(); nLineWidth = rCpy.nLineWidth; + eLineStyle = rCpy.eLineStyle; aLineColor = rCpy.aLineColor; aWidth = rCpy.GetWidth(); eAdj = rCpy.GetAdj(); @@ -421,6 +424,7 @@ sal_Bool SwPageFtnInfo::operator==( const SwPageFtnInfo& rCmp ) const { return ( nMaxHeight == rCmp.GetHeight() && nLineWidth == rCmp.nLineWidth && + eLineStyle == rCmp.eLineStyle && aLineColor == rCmp.aLineColor && aWidth == rCmp.GetWidth() && eAdj == rCmp.GetAdj() && diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index 0846887a5ba9..37c3dfcddd1f 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -4806,7 +4806,8 @@ void SwFtnContFrm::PaintLine( const SwRect& rRect, : SwRect( Point( nX, Frm().Pos().Y() + rInf.GetTopDist() ), Size( nWidth, rInf.GetLineWidth())); if ( aLineRect.HasArea() ) - PaintBorderLine( rRect, aLineRect , pPage, &rInf.GetLineColor() ); + PaintBorderLine( rRect, aLineRect , pPage, &rInf.GetLineColor(), + rInf.GetLineStyle() ); } /************************************************************************* diff --git a/sw/source/core/unocore/unomap.cxx b/sw/source/core/unocore/unomap.cxx index e7a54869b0b6..439396eef41d 100644 --- a/sw/source/core/unocore/unomap.cxx +++ b/sw/source/core/unocore/unomap.cxx @@ -838,6 +838,7 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s { SW_PROP_NMID(UNO_NAME_FOOTNOTE_HEIGHT), FN_PARAM_FTN_INFO, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE , MID_FTN_HEIGHT|CONVERT_TWIPS}, { SW_PROP_NMID(UNO_NAME_FOOTNOTE_LINE_WEIGHT), FN_PARAM_FTN_INFO, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE , MID_LINE_WEIGHT|CONVERT_TWIPS}, { SW_PROP_NMID(UNO_NAME_FOOTNOTE_LINE_COLOR), FN_PARAM_FTN_INFO, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE , MID_LINE_COLOR}, + { SW_PROP_NMID(UNO_NAME_FOOTNOTE_LINE_STYLE), FN_PARAM_FTN_INFO, CPPU_E2T(CPPUTYPE_INT8), PROPERTY_NONE , MID_FTN_LINE_STYLE}, { SW_PROP_NMID(UNO_NAME_FOOTNOTE_LINE_RELATIVE_WIDTH), FN_PARAM_FTN_INFO, CPPU_E2T(CPPUTYPE_INT8), PROPERTY_NONE , MID_LINE_RELWIDTH }, { SW_PROP_NMID(UNO_NAME_FOOTNOTE_LINE_ADJUST), FN_PARAM_FTN_INFO, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE , MID_LINE_ADJUST }, { SW_PROP_NMID(UNO_NAME_FOOTNOTE_LINE_TEXT_DISTANCE), FN_PARAM_FTN_INFO, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE , MID_LINE_TEXT_DIST |CONVERT_TWIPS }, diff --git a/sw/source/core/unocore/unoprnms.cxx b/sw/source/core/unocore/unoprnms.cxx index dbe03057b66f..d8cd403b8b97 100644 --- a/sw/source/core/unocore/unoprnms.cxx +++ b/sw/source/core/unocore/unoprnms.cxx @@ -786,6 +786,7 @@ const SwPropNameTab aPropNameTab = { /* 0741 UNO_NAME_NESTED_TEXT_CONTENT */ {MAP_CHAR_LEN("NestedTextContent")}, /* 0742 UNO_NAME_SEPARATOR_LINE_STYLE */ {MAP_CHAR_LEN("SeparatorLineStyle")}, +/* 0743 UNO_NAME_FOOTNOTE_LINE_STYLE */ {MAP_CHAR_LEN("FootnoteLineStyle")}, }; const SwPropNameLen& SwGetPropName( sal_uInt16 nId ) diff --git a/sw/source/ui/inc/pgfnote.hxx b/sw/source/ui/inc/pgfnote.hxx index a69d7b121aba..c63fadbf45d1 100644 --- a/sw/source/ui/inc/pgfnote.hxx +++ b/sw/source/ui/inc/pgfnote.hxx @@ -67,12 +67,15 @@ private: LineListBox aLineTypeBox; FixedText aLineWidthLbl; MetricField aLineWidthEdit; + FixedText aLineLengthLbl; + MetricField aLineLengthEdit; FixedText aLineDistLbl; MetricField aLineDistEdit; DECL_LINK( HeightPage, Button * ); DECL_LINK( HeightMetric, Button * ); DECL_LINK( HeightModify, MetricField * ); + DECL_LINK( LineWidthChanged_Impl, void * ); long lMaxHeight; diff --git a/sw/source/ui/misc/pgfnote.cxx b/sw/source/ui/misc/pgfnote.cxx index d0309d632e4d..32d321da7dfa 100644 --- a/sw/source/ui/misc/pgfnote.cxx +++ b/sw/source/ui/misc/pgfnote.cxx @@ -44,6 +44,7 @@ #include <vcl/svapp.hxx> #include <unotools/localedatawrapper.hxx> #include <unotools/syslocale.hxx> +#include <editeng/borderline.hxx> #include <editeng/sizeitem.hxx> #include <svx/pageitem.hxx> #include <svl/eitem.hxx> @@ -57,41 +58,12 @@ #include <misc.hrc> #include <pgfnote.hrc> -#define TWIP_TO_LBOX 5 - -/*-----------------------------------------------------#--------------- - Beschreibung: vordefinierte Linien in Point - --------------------------------------------------------------------*/ -static const sal_uInt16 nLines[] = { - 0, - 50, - 100, - 150, - 200, - 500 -}; - -static const sal_uInt16 nLineCount = SAL_N_ELEMENTS(nLines); - static sal_uInt16 aPageRg[] = { FN_PARAM_FTN_INFO, FN_PARAM_FTN_INFO, 0 }; /*------------------------------------------------------------------------ - Beschreibung: liefert zurueck, ob die Linienbreite nWidth bereits - in der Listbox enthalten ist. -------------------------------------------------------------------------*/ -sal_Bool lcl_HasLineWidth(sal_uInt16 nWidth) -{ - for(sal_uInt16 i = 0; i < nLineCount; ++i) { - if(nLines[i] == nWidth) - return sal_True; - } - return sal_False; -} - -/*------------------------------------------------------------------------ Beschreibung: Handler fuer umschalten zwischen den unterschiedlichen Arten, wie die Hoehe des Fussnotenbereiches angegeben werden kann. @@ -136,6 +108,17 @@ IMPL_LINK( SwFootNotePage, HeightModify, MetricField *, EMPTYARG ) return 0; } +IMPL_LINK( SwFootNotePage, LineWidthChanged_Impl, void *, EMPTYARG ) +{ + sal_Int64 nVal = MetricField::ConvertDoubleValue( + aLineWidthEdit.GetValue( ), + aLineWidthEdit.GetDecimalDigits( ), + aLineWidthEdit.GetUnit(), MAP_TWIP ); + aLineTypeBox.SetWidth( nVal ); + + return 0; +} + // CTOR / DTOR ----------------------------------------------------------- SwFootNotePage::SwFootNotePage(Window *pParent, const SfxItemSet &rSet) : @@ -155,6 +138,8 @@ SwFootNotePage::SwFootNotePage(Window *pParent, const SfxItemSet &rSet) : aLineTypeBox(this, SW_RES(DLB_LINETYPE)), aLineWidthLbl(this, SW_RES(FT_LINEWIDTH)), aLineWidthEdit(this, SW_RES(ED_LINEWIDTH)), + aLineLengthLbl(this, SW_RES(FT_LINELENGTH)), + aLineLengthEdit(this, SW_RES(ED_LINELENGTH)), aLineDistLbl(this, SW_RES(FT_LINEDIST)), aLineDistEdit(this, SW_RES(ED_LINEDIST)) { @@ -217,14 +202,23 @@ void SwFootNotePage::Reset(const SfxItemSet &rSet) aDistEdit.SetLoseFocusHdl( aLk ); aLineDistEdit.SetLoseFocusHdl( aLk ); - // Trennlinie - for(sal_uInt16 i = 0; i < nLineCount; ++i) - aLineTypeBox.InsertEntry(nLines[i]); + // Separator width + aLineWidthEdit.SetModifyHdl( LINK( this, SwFootNotePage, LineWidthChanged_Impl ) ); + + sal_Int64 nWidthPt = MetricField::ConvertDoubleValue( + sal_Int64( pFtnInfo->GetLineWidth() ), aLineWidthEdit.GetDecimalDigits(), + MAP_TWIP, aLineWidthEdit.GetUnit( ) ); + aLineWidthEdit.SetValue( nWidthPt ); - const sal_uInt16 nWidth = (sal_uInt16)pFtnInfo->GetLineWidth() * TWIP_TO_LBOX; - if ( !lcl_HasLineWidth(nWidth) ) - aLineTypeBox.InsertEntry(nWidth); - aLineTypeBox.SelectEntry(nWidth); + // Separator style + aLineTypeBox.SetSourceUnit( FUNIT_TWIP ); + + aLineTypeBox.SetNone( String( SW_RES( STR_NONE ) ) ); + aLineTypeBox.InsertEntry( SvxBorderLine::getWidthImpl( SOLID ), SOLID ); + aLineTypeBox.InsertEntry( SvxBorderLine::getWidthImpl( DOTTED ), DOTTED ); + aLineTypeBox.InsertEntry( SvxBorderLine::getWidthImpl( DASHED ), DASHED ); + aLineTypeBox.SetWidth( pFtnInfo->GetLineWidth( ) ); + aLineTypeBox.SelectEntry( pFtnInfo->GetLineStyle() ); // Position aLinePosBox.SelectEntryPos( static_cast< sal_uInt16 >(pFtnInfo->GetAdj()) ); @@ -232,7 +226,7 @@ void SwFootNotePage::Reset(const SfxItemSet &rSet) // Breite Fraction aTmp( 100, 1 ); aTmp *= pFtnInfo->GetWidth(); - aLineWidthEdit.SetValue( static_cast<long>(aTmp) ); + aLineLengthEdit.SetValue( static_cast<long>(aTmp) ); // Abstand Fussnotenbereich aDistEdit.SetValue(aDistEdit.Normalize(pFtnInfo->GetTopDist()),FUNIT_TWIP); @@ -265,16 +259,21 @@ sal_Bool SwFootNotePage::FillItemSet(SfxItemSet &rSet) rFtnInfo.SetBottomDist( static_cast< SwTwips >( aLineDistEdit.Denormalize(aLineDistEdit.GetValue(FUNIT_TWIP)))); - // Trennlinie - const sal_uInt16 nPos = aLineTypeBox.GetSelectEntryPos(); - if( LISTBOX_ENTRY_NOTFOUND != nPos ) - rFtnInfo.SetLineWidth(nLines[nPos] / TWIP_TO_LBOX); + // Separator style + rFtnInfo.SetLineStyle( SvxBorderStyle( aLineTypeBox.GetSelectEntryStyle() ) ); + + // Separator width + long nWidth = MetricField::ConvertDoubleValue( + aLineWidthEdit.GetValue( ), + aLineWidthEdit.GetDecimalDigits( ), + aLineWidthEdit.GetUnit(), MAP_TWIP ); + rFtnInfo.SetLineWidth( nWidth ); // Position rFtnInfo.SetAdj((SwFtnAdj)aLinePosBox.GetSelectEntryPos()); // Breite - rFtnInfo.SetWidth(Fraction( static_cast< long >(aLineWidthEdit.GetValue()), 100)); + rFtnInfo.SetWidth(Fraction( static_cast< long >(aLineLengthEdit.GetValue()), 100)); const SfxPoolItem* pOldItem; if(0 == (pOldItem = GetOldItem( rSet, FN_PARAM_FTN_INFO )) || diff --git a/sw/source/ui/misc/pgfnote.hrc b/sw/source/ui/misc/pgfnote.hrc index fe94849c6d66..c361525c5095 100644 --- a/sw/source/ui/misc/pgfnote.hrc +++ b/sw/source/ui/misc/pgfnote.hrc @@ -36,9 +36,10 @@ #define DLB_LINETYPE 21 #define FT_LINEPOS 22 #define DLB_LINEPOS 23 -#define FT_LINEWIDTH 24 -#define ED_LINEWIDTH 25 +#define FT_LINELENGTH 24 +#define ED_LINELENGTH 25 #define FT_LINEDIST 26 #define ED_LINEDIST 27 #define FL_LINE 30 - +#define FT_LINEWIDTH 31 +#define ED_LINEWIDTH 32 diff --git a/sw/source/ui/misc/pgfnote.src b/sw/source/ui/misc/pgfnote.src index 7d74eeb567f3..4f5525c53cfd 100644 --- a/sw/source/ui/misc/pgfnote.src +++ b/sw/source/ui/misc/pgfnote.src @@ -129,7 +129,7 @@ TabPage TP_FOOTNOTE_PAGE Size = MAP_APPFONT ( 132 , 8 ) ; Group = TRUE ; Left = TRUE ; - Text [ en-US ] = "~Weight" ; + Text [ en-US ] = "~Style" ; }; ListBox DLB_LINETYPE { @@ -139,15 +139,14 @@ TabPage TP_FOOTNOTE_PAGE TabStop = TRUE ; Group = TRUE ; DropDown = TRUE ; - CurPos = 0 ; }; - FixedText FT_LINEWIDTH { Pos = MAP_APPFONT ( 12 , 105 ) ; Size = MAP_APPFONT ( 132 , 8 ) ; + Group = TRUE ; Left = TRUE ; - Text [ en-US ] = "~Length" ; + Text [ en-US ] = "~Thickness" ; }; MetricField ED_LINEWIDTH { @@ -155,6 +154,31 @@ TabPage TP_FOOTNOTE_PAGE Border = TRUE ; Pos = MAP_APPFONT ( 148 , 103 ) ; Size = MAP_APPFONT ( 42 , 12 ) ; + Spin = TRUE ; + Repeat = TRUE ; + SpinSize = 25 ; + First = 25 ; + Last = 900 ; + Maximum = 900 ; + Minimum = 25 ; + DecimalDigits = 2 ; + Unit = FUNIT_POINT ; + TabStop = TRUE ; + Left = TRUE ; + }; + + FixedText FT_LINELENGTH + { + Pos = MAP_APPFONT ( 12 , 121 ) ; + Size = MAP_APPFONT ( 132 , 8 ) ; + Left = TRUE ; + Text [ en-US ] = "~Length" ; + }; + MetricField ED_LINELENGTH + { + Border = TRUE ; + Pos = MAP_APPFONT ( 148 , 119 ) ; + Size = MAP_APPFONT ( 42 , 12 ) ; TabStop = TRUE ; Left = TRUE ; Repeat = TRUE ; @@ -168,7 +192,7 @@ TabPage TP_FOOTNOTE_PAGE }; FixedText FT_LINEDIST { - Pos = MAP_APPFONT ( 12 , 121 ) ; + Pos = MAP_APPFONT ( 12 , 137 ) ; Size = MAP_APPFONT ( 132 , 8 ) ; Text [ en-US ] = "~Spacing to footnote contents" ; Left = TRUE ; @@ -177,7 +201,7 @@ TabPage TP_FOOTNOTE_PAGE { HelpID = "sw:MetricField:TP_FOOTNOTE_PAGE:ED_LINEDIST"; Border = TRUE ; - Pos = MAP_APPFONT ( 148 , 119 ) ; + Pos = MAP_APPFONT ( 148 , 135 ) ; Size = MAP_APPFONT ( 42 , 12 ) ; TabStop = TRUE ; Left = TRUE ; diff --git a/sw/source/ui/utlui/uiitems.cxx b/sw/source/ui/utlui/uiitems.cxx index 8241f85f1624..3daa370dd147 100644 --- a/sw/source/ui/utlui/uiitems.cxx +++ b/sw/source/ui/utlui/uiitems.cxx @@ -140,6 +140,18 @@ bool SwPageFtnInfoItem::QueryValue( Any& rVal, sal_uInt8 nMemberId ) const case MID_LINE_ADJUST : rVal <<= (sal_Int16)aFtnInfo.GetAdj();break;//text::HorizontalAdjust case MID_LINE_TEXT_DIST : rVal <<= (sal_Int32)TWIP_TO_MM100(aFtnInfo.GetTopDist());break; case MID_LINE_FOOTNOTE_DIST: rVal <<= (sal_Int32)TWIP_TO_MM100(aFtnInfo.GetBottomDist());break; + case MID_FTN_LINE_STYLE : + { + switch ( aFtnInfo.GetLineStyle( ) ) + { + default: + case NO_STYLE: rVal <<= sal_Int8( 0 ); break; + case SOLID: rVal <<= sal_Int8( 1 ); break; + case DOTTED: rVal <<= sal_Int8( 2 ); break; + case DASHED: rVal <<= sal_Int8( 3 ); break; + } + break; + } default: bRet = false; } @@ -202,6 +214,20 @@ bool SwPageFtnInfoItem::PutValue(const Any& rVal, sal_uInt8 nMemberId) else bRet = false; } + case MID_FTN_LINE_STYLE: + { + SvxBorderStyle eStyle = NO_STYLE; + sal_Int8 nSet = 0; + rVal >>= nSet; + switch ( nSet ) + { + case 1: eStyle = SOLID; break; + case 2: eStyle = DOTTED; break; + case 3: eStyle = DASHED; break; + default: break; + } + aFtnInfo.SetLineStyle( eStyle ); + } break; default: bRet = false; |