Kaydet (Commit) 9bd78655 authored tarafından Cédric Bosdonnat's avatar Cédric Bosdonnat

Fixed units mess in SvxBorderLine and BorderLineImpl

üst 302b7b09
...@@ -108,7 +108,7 @@ enum SvxBorderStyle ...@@ -108,7 +108,7 @@ enum SvxBorderStyle
ENGRAVED, ENGRAVED,
OUTSET, OUTSET,
INSET, INSET,
NONE = -1 NO_STYLE = -1
}; };
class EDITENG_DLLPUBLIC SvxBorderLine class EDITENG_DLLPUBLIC SvxBorderLine
......
...@@ -33,15 +33,15 @@ ...@@ -33,15 +33,15 @@
#include <editeng/borderline.hxx> #include <editeng/borderline.hxx>
#define TEST_WIDTH long( 200 ) #define TEST_WIDTH long( 40 )
#define THINTHICKSG_IN_WIDTH long( 200 ) #define THINTHICKSG_IN_WIDTH long( 15 )
#define THINTHICKSG_OUT_WIDTH long( 75 ) #define THINTHICKSG_OUT_WIDTH long( 40 )
#define THINTHICKSG_DIST_WIDTH long( 75 ) #define THINTHICKSG_DIST_WIDTH long( 15 )
#define THINTHICKLG_IN_WIDTH long( 75 ) #define THINTHICKLG_IN_WIDTH long( 15 )
#define THINTHICKLG_OUT_WIDTH long( 150 ) #define THINTHICKLG_OUT_WIDTH long( 30 )
#define THINTHICKLG_DIST_WIDTH long( 200 ) #define THINTHICKLG_DIST_WIDTH long( 40 )
namespace { namespace {
......
...@@ -51,16 +51,6 @@ SHL1TARGET = borderline_test ...@@ -51,16 +51,6 @@ SHL1TARGET = borderline_test
SHL1OBJS = \ SHL1OBJS = \
$(SLO)$/borderline_test.obj $(SLO)$/borderline_test.obj
SHL1LIBS= \
$(SLB)$/items.lib \
$(SLB)$/misc.lib \
$(SLB)$/rtf.lib \
$(SLB)$/uno.lib \
$(SLB)$/accessibility.lib \
$(SLB)$/editeng.lib \
$(SLB)$/outliner.lib \
$(SLB)$/xml.lib
SHL1STDLIBS= \ SHL1STDLIBS= \
$(CPPUNITLIB) \ $(CPPUNITLIB) \
$(XMLOFFLIB) \ $(XMLOFFLIB) \
...@@ -81,7 +71,8 @@ SHL1STDLIBS= \ ...@@ -81,7 +71,8 @@ SHL1STDLIBS= \
$(CPPULIB) \ $(CPPULIB) \
$(SALLIB) \ $(SALLIB) \
$(SALHELPERLIB) \ $(SALHELPERLIB) \
$(ICUUCLIB) $(ICUUCLIB) \
$(EDITENGLIB)
SHL1VERSIONMAP = version.map SHL1VERSIONMAP = version.map
SHL1IMPLIB = i$(SHL1TARGET) SHL1IMPLIB = i$(SHL1TARGET)
......
...@@ -112,6 +112,10 @@ SvxBorderLine::SvxBorderLine( const Color *pCol, long nWidth, ...@@ -112,6 +112,10 @@ SvxBorderLine::SvxBorderLine( const Color *pCol, long nWidth,
aColor = *pCol; aColor = *pCol;
} }
/** Get the BorderWithImpl object corresponding to the given #nStyle, all the
units handled by the resulting object are Twips and the
BorderWidthImpl::GetLine1() corresponds to the Outer Line.
*/
BorderWidthImpl SvxBorderLine::getWidthImpl( SvxBorderStyle nStyle ) BorderWidthImpl SvxBorderLine::getWidthImpl( SvxBorderStyle nStyle )
{ {
BorderWidthImpl aImpl; BorderWidthImpl aImpl;
...@@ -119,8 +123,8 @@ BorderWidthImpl SvxBorderLine::getWidthImpl( SvxBorderStyle nStyle ) ...@@ -119,8 +123,8 @@ BorderWidthImpl SvxBorderLine::getWidthImpl( SvxBorderStyle nStyle )
switch ( nStyle ) switch ( nStyle )
{ {
// No line: no width // No line: no width
case NONE: case NO_STYLE:
aImpl = BorderWidthImpl( CHANGE_LINE1, 0.0 ); aImpl = BorderWidthImpl( 0, 0.0 );
break; break;
// Single lines // Single lines
...@@ -139,7 +143,7 @@ BorderWidthImpl SvxBorderLine::getWidthImpl( SvxBorderStyle nStyle ) ...@@ -139,7 +143,7 @@ BorderWidthImpl SvxBorderLine::getWidthImpl( SvxBorderStyle nStyle )
break; break;
case THINTHICK_SMALLGAP: case THINTHICK_SMALLGAP:
aImpl = BorderWidthImpl( CHANGE_LINE1, 1.0, 75.0, 75.0 ); aImpl = BorderWidthImpl( CHANGE_LINE1, 1.0, 15.0, 15.0 );
break; break;
case THINTHICK_MEDIUMGAP: case THINTHICK_MEDIUMGAP:
...@@ -149,11 +153,11 @@ BorderWidthImpl SvxBorderLine::getWidthImpl( SvxBorderStyle nStyle ) ...@@ -149,11 +153,11 @@ BorderWidthImpl SvxBorderLine::getWidthImpl( SvxBorderStyle nStyle )
break; break;
case THINTHICK_LARGEGAP: case THINTHICK_LARGEGAP:
aImpl = BorderWidthImpl( CHANGE_DIST, 75.0, 150.0, 1.0 ); aImpl = BorderWidthImpl( CHANGE_DIST, 30.0, 15.0, 1.0 );
break; break;
case THICKTHIN_SMALLGAP: case THICKTHIN_SMALLGAP:
aImpl = BorderWidthImpl( CHANGE_DIST, 75.0, 1.0, 75.0 ); aImpl = BorderWidthImpl( CHANGE_LINE2, 15.0, 1.0, 15.0 );
break; break;
case THICKTHIN_MEDIUMGAP: case THICKTHIN_MEDIUMGAP:
...@@ -163,7 +167,7 @@ BorderWidthImpl SvxBorderLine::getWidthImpl( SvxBorderStyle nStyle ) ...@@ -163,7 +167,7 @@ BorderWidthImpl SvxBorderLine::getWidthImpl( SvxBorderStyle nStyle )
break; break;
case THICKTHIN_LARGEGAP: case THICKTHIN_LARGEGAP:
aImpl = BorderWidthImpl( CHANGE_DIST, 150.0, 75.0, 1.0 ); aImpl = BorderWidthImpl( CHANGE_DIST, 15.0, 30.0, 1.0 );
break; break;
// Engraved / Embossed // Engraved / Embossed
...@@ -187,13 +191,13 @@ BorderWidthImpl SvxBorderLine::getWidthImpl( SvxBorderStyle nStyle ) ...@@ -187,13 +191,13 @@ BorderWidthImpl SvxBorderLine::getWidthImpl( SvxBorderStyle nStyle )
case OUTSET: case OUTSET:
aImpl = BorderWidthImpl( aImpl = BorderWidthImpl(
CHANGE_LINE2 | CHANGE_DIST, CHANGE_LINE2 | CHANGE_DIST,
75.0, 1.0, 1.0 ); 15.0, 1.0, 1.0 );
break; break;
case INSET: case INSET:
aImpl = BorderWidthImpl( aImpl = BorderWidthImpl(
CHANGE_LINE1 | CHANGE_DIST, CHANGE_LINE1 | CHANGE_DIST,
1.0, 75.0, 1.0 ); 1.0, 15.0, 1.0 );
break; break;
} }
...@@ -252,7 +256,7 @@ void SvxBorderLine::SetLinesWidths( SvxBorderStyle nStyle, sal_uInt16 nIn, sal_u ...@@ -252,7 +256,7 @@ void SvxBorderLine::SetLinesWidths( SvxBorderStyle nStyle, sal_uInt16 nIn, sal_u
{ {
nTestStyle = aDoubleStyles[i]; nTestStyle = aDoubleStyles[i];
BorderWidthImpl aWidthImpl = getWidthImpl( nTestStyle ); BorderWidthImpl aWidthImpl = getWidthImpl( nTestStyle );
nWidth = aWidthImpl.GuessWidth( nIn, nOut, nDist ); nWidth = aWidthImpl.GuessWidth( nOut, nIn, nDist );
i++; i++;
} }
...@@ -266,7 +270,7 @@ void SvxBorderLine::SetLinesWidths( SvxBorderStyle nStyle, sal_uInt16 nIn, sal_u ...@@ -266,7 +270,7 @@ void SvxBorderLine::SetLinesWidths( SvxBorderStyle nStyle, sal_uInt16 nIn, sal_u
else else
{ {
SetStyle( nStyle ); SetStyle( nStyle );
m_nWidth = m_aWidthImpl.GuessWidth( nIn, nOut, nDist ); m_nWidth = m_aWidthImpl.GuessWidth( nOut, nIn, nDist );
} }
} }
......
...@@ -129,9 +129,8 @@ public: ...@@ -129,9 +129,8 @@ public:
/** Returns true, if all visible frame borders have equal widths. /** Returns true, if all visible frame borders have equal widths.
@descr Ignores hidden and "don't care" frame borders. On success, @descr Ignores hidden and "don't care" frame borders. On success,
returns the widths in the passed parameters. */ returns the width in the passed parameter. */
bool GetVisibleWidth( sal_uInt16& rnPrim, sal_uInt16& rnDist, sal_uInt16& rnSec, bool GetVisibleWidth( long& rnWidth, SvxBorderStyle& rnStyle ) const;
SvxBorderStyle& rnStyle ) const;
/** Returns true, if all visible frame borders have equal color. /** Returns true, if all visible frame borders have equal color.
@descr Ignores hidden and "don't care" frame borders. On success, @descr Ignores hidden and "don't care" frame borders. On success,
returns the color in the passed parameter. */ returns the color in the passed parameter. */
......
...@@ -887,8 +887,7 @@ void FrameSelector::HideAllBorders() ...@@ -887,8 +887,7 @@ void FrameSelector::HideAllBorders()
mxImpl->SetBorderState( **aIt, FRAMESTATE_HIDE ); mxImpl->SetBorderState( **aIt, FRAMESTATE_HIDE );
} }
bool FrameSelector::GetVisibleWidth( sal_uInt16& rnPrim, sal_uInt16& rnDist, sal_uInt16& rnSecn, bool FrameSelector::GetVisibleWidth( long& rnWidth, SvxBorderStyle& rnStyle ) const
SvxBorderStyle& rnStyle ) const
{ {
VisFrameBorderCIter aIt( mxImpl->maEnabBorders ); VisFrameBorderCIter aIt( mxImpl->maEnabBorders );
if( !aIt.Is() ) if( !aIt.Is() )
...@@ -898,16 +897,12 @@ bool FrameSelector::GetVisibleWidth( sal_uInt16& rnPrim, sal_uInt16& rnDist, sal ...@@ -898,16 +897,12 @@ bool FrameSelector::GetVisibleWidth( sal_uInt16& rnPrim, sal_uInt16& rnDist, sal
bool bFound = true; bool bFound = true;
for( ++aIt; bFound && aIt.Is(); ++aIt ) for( ++aIt; bFound && aIt.Is(); ++aIt )
bFound = bFound =
(rStyle.GetOutWidth() == (*aIt)->GetCoreStyle().GetOutWidth()) && (rStyle.GetWidth() == (*aIt)->GetCoreStyle().GetWidth()) &&
(rStyle.GetDistance() == (*aIt)->GetCoreStyle().GetDistance()) &&
(rStyle.GetInWidth() == (*aIt)->GetCoreStyle().GetInWidth()) &&
(rStyle.GetStyle() == (*aIt)->GetCoreStyle().GetStyle()); (rStyle.GetStyle() == (*aIt)->GetCoreStyle().GetStyle());
if( bFound ) if( bFound )
{ {
rnPrim = rStyle.GetOutWidth(); rnWidth = rStyle.GetWidth();
rnDist = rStyle.GetDistance();
rnSecn = rStyle.GetInWidth();
rnStyle = rStyle.GetStyle(); rnStyle = rStyle.GetStyle();
} }
return bFound; return bFound;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment