summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorCédric Bosdonnat <cedricbosdo@openoffice.org>2011-03-25 15:51:50 +0100
committerCédric Bosdonnat <cedricbosdo@openoffice.org>2011-03-28 11:20:08 +0200
commit56dd271c5930c2c7e3d280266c27607e67ccfa16 (patch)
tree5ee3cec11b9b252c85e47ee59f4daa5ad626a329 /editeng
parent20edf4549bd16539490ebdb68795c29aa30c9b9a (diff)
Moved SvxBorder* into editeng namespace to avoid duplicate DOUBLE on windows
Diffstat (limited to 'editeng')
-rwxr-xr-xediteng/inc/editeng/bolnitem.hxx12
-rwxr-xr-xediteng/inc/editeng/borderline.hxx250
-rwxr-xr-xediteng/inc/editeng/boxitem.hxx36
-rw-r--r--editeng/qa/items/borderline_test.cxx2
-rw-r--r--editeng/source/items/borderline.cxx46
-rw-r--r--editeng/source/items/frmitems.cxx1
-rw-r--r--editeng/source/rtf/rtfitem.cxx1
7 files changed, 183 insertions, 165 deletions
diff --git a/editeng/inc/editeng/bolnitem.hxx b/editeng/inc/editeng/bolnitem.hxx
index 8222c5dbdc..ee15661587 100755
--- a/editeng/inc/editeng/bolnitem.hxx
+++ b/editeng/inc/editeng/bolnitem.hxx
@@ -42,10 +42,12 @@
/*
[Description]
-This Item transports a SvxBorderLine.
+This Item transports a editeng::SvxBorderLine.
*/
-class SvxBorderLine;
+namespace editeng {
+ class SvxBorderLine;
+}
class EDITENG_DLLPUBLIC SvxLineItem : public SfxPoolItem
{
@@ -71,11 +73,11 @@ public:
virtual bool ScaleMetrics( long nMult, long nDiv );
virtual bool HasMetrics() const;
- const SvxBorderLine* GetLine () const { return pLine; }
- void SetLine ( const SvxBorderLine *pNew );
+ const editeng::SvxBorderLine* GetLine () const { return pLine; }
+ void SetLine ( const editeng::SvxBorderLine *pNew );
private:
- SvxBorderLine* pLine;
+ editeng::SvxBorderLine* pLine;
};
diff --git a/editeng/inc/editeng/borderline.hxx b/editeng/inc/editeng/borderline.hxx
index 485aa5fabe..17e137a53c 100755
--- a/editeng/inc/editeng/borderline.hxx
+++ b/editeng/inc/editeng/borderline.hxx
@@ -45,132 +45,136 @@
// ============================================================================
-enum SvxBorderStyle
-{
- SOLID,
- DOTTED,
- DASHED,
- DOUBLE,
- THINTHICK_SMALLGAP,
- THINTHICK_MEDIUMGAP,
- THINTHICK_LARGEGAP,
- THICKTHIN_SMALLGAP,
- THICKTHIN_MEDIUMGAP,
- THICKTHIN_LARGEGAP,
- EMBOSSED,
- ENGRAVED,
- OUTSET,
- INSET,
- NO_STYLE = -1
-};
-
-class EDITENG_DLLPUBLIC SvxBorderLine
-{
-protected:
- Color aColor;
-
- long m_nWidth;
- bool m_bMirrorWidths;
- BorderWidthImpl m_aWidthImpl;
- long m_nMult;
- long m_nDiv;
-
- SvxBorderStyle m_nStyle;
- sal_uInt16 nOutWidth;
- sal_uInt16 nInWidth;
- sal_uInt16 nDistance;
-
- bool m_bUseLeftTop;
- Color (*m_pColorOutFn)( Color );
- Color (*m_pColorInFn)( Color );
- Color (*m_pColorGapFn)( Color );
-
-public:
- SvxBorderLine( const Color *pCol = 0,
- long nWidth = 0, SvxBorderStyle nStyle = SOLID,
- bool bUseLeftTop = false,
- Color (*pColorOutFn)( Color ) = &darkColor,
- Color (*pColorInFn)( Color ) = &darkColor,
- Color (*pColorGapFn)( Color ) = NULL );
- SvxBorderLine( const SvxBorderLine& r );
-
- SvxBorderLine& operator=( const SvxBorderLine& r );
-
- const Color& GetColor() const { return aColor; }
- Color GetColorOut( bool bLeftOrTop = true ) const;
- Color GetColorIn( bool bLeftOrTop = true ) const;
- bool HasGapColor() const { return m_pColorGapFn != NULL; }
- Color GetColorGap() const;
-
- void SetWidth( long nWidth = 0 ) { m_nWidth = nWidth; }
- /** Guess the style and width from the three lines widths values.
-
- When the value of nStyle is SvxBorderLine::DOUBLE, the style set will be guessed
- using the three values to match the best possible style among the following:
- - SvxBorderLine::DOUBLE
- - SvxBorderLine::THINTHICK_SMALLGAP
- - SvxBorderLine::THINTHICK_MEDIUMGAP
- - SvxBorderLine::THINTHICK_LARGEGAP
- - SvxBorderLine::THICKTHIN_SMALLGAP
- - SvxBorderLine::THICKTHIN_MEDIUMGAP
- - SvxBorderLine::THICKTHIN_LARGEGAP
-
- If no styles matches the width, then the width is set to 0.
-
- There is one known case that could fit several styles: \a nIn = \a nDist = 0.75 pt,
- \a nOut = 1.5 pt. This case fits SvxBorderLine::THINTHICK_SMALLGAP and
- SvxBorderLine::THINTHICK_MEDIUMGAP with a 1.5 pt width and
- SvxBorderLine::THINTHICK_LARGEGAP with a 0.75 pt width. The same case happens
- also for thick-thin styles.
-
- \param nStyle the border style used to guess the width.
- \param nIn the width of the inner line in 1th pt
- \param nOut the width of the outer line in 1th pt
- \param nDist the width of the gap between the lines in 1th pt
- */
- void GuessLinesWidths( SvxBorderStyle nStyle, sal_uInt16 nOut, sal_uInt16 nIn = 0, sal_uInt16 nDist = 0 );
-
- // TODO Hacky method to mirror lines in only a few cases
- void SetMirrorWidths( bool bMirror = true ) { m_bMirrorWidths = bMirror; }
- long GetWidth( ) const { return m_nWidth; }
- sal_uInt16 GetOutWidth() const;
- sal_uInt16 GetInWidth() const;
- sal_uInt16 GetDistance() const;
-
- SvxBorderStyle GetStyle() const { return m_nStyle; }
-
- void SetColor( const Color &rColor ) { aColor = rColor; }
- void SetColorOutFn( Color (*pColorOutFn)( Color ) ) { m_pColorOutFn = pColorOutFn; }
- void SetColorInFn( Color (*pColorInFn)( Color ) ) { m_pColorInFn = pColorInFn; }
- void SetColorGapFn( Color (*pColorGapFn)( Color ) ) { m_pColorGapFn = pColorGapFn; }
- void SetUseLeftTop( bool bUseLeftTop ) { m_bUseLeftTop = bUseLeftTop; }
- void SetStyle( SvxBorderStyle nNew );
- void ScaleMetrics( long nMult, long nDiv );
-
- sal_Bool operator==( const SvxBorderLine &rCmp ) const;
-
- String GetValueString( SfxMapUnit eSrcUnit, SfxMapUnit eDestUnit,
- const IntlWrapper* pIntl,
- sal_Bool bMetricStr = sal_False ) const;
-
- bool HasPriority( const SvxBorderLine& rOtherLine ) const;
-
- bool isEmpty() const { return m_aWidthImpl.IsEmpty( ) || m_nStyle == NO_STYLE || m_nWidth == 0; }
- bool isDouble() const { return m_aWidthImpl.IsDouble(); }
- sal_uInt16 GetScaledWidth() const { return GetOutWidth() + GetInWidth() + GetDistance(); }
-
- static Color darkColor( Color aMain );
- static Color lightColor( Color aMain );
-
- static Color threeDLightColor( Color aMain );
- static Color threeDMediumColor( Color aMain );
- static Color threeDDarkColor( Color aMain );
-
- static BorderWidthImpl getWidthImpl( SvxBorderStyle nStyle );
-};
+namespace editeng {
+
+ enum SvxBorderStyle
+ {
+ SOLID,
+ DOTTED,
+ DASHED,
+ DOUBLE,
+ THINTHICK_SMALLGAP,
+ THINTHICK_MEDIUMGAP,
+ THINTHICK_LARGEGAP,
+ THICKTHIN_SMALLGAP,
+ THICKTHIN_MEDIUMGAP,
+ THICKTHIN_LARGEGAP,
+ EMBOSSED,
+ ENGRAVED,
+ OUTSET,
+ INSET,
+ NO_STYLE = -1
+ };
+
+ class EDITENG_DLLPUBLIC SvxBorderLine
+ {
+ protected:
+ Color aColor;
+
+ long m_nWidth;
+ bool m_bMirrorWidths;
+ BorderWidthImpl m_aWidthImpl;
+ long m_nMult;
+ long m_nDiv;
+
+ SvxBorderStyle m_nStyle;
+ sal_uInt16 nOutWidth;
+ sal_uInt16 nInWidth;
+ sal_uInt16 nDistance;
+
+ bool m_bUseLeftTop;
+ Color (*m_pColorOutFn)( Color );
+ Color (*m_pColorInFn)( Color );
+ Color (*m_pColorGapFn)( Color );
+
+ public:
+ SvxBorderLine( const Color *pCol = 0,
+ long nWidth = 0, SvxBorderStyle nStyle = SOLID,
+ bool bUseLeftTop = false,
+ Color (*pColorOutFn)( Color ) = &darkColor,
+ Color (*pColorInFn)( Color ) = &darkColor,
+ Color (*pColorGapFn)( Color ) = NULL );
+ SvxBorderLine( const SvxBorderLine& r );
+
+ SvxBorderLine& operator=( const SvxBorderLine& r );
+
+ const Color& GetColor() const { return aColor; }
+ Color GetColorOut( bool bLeftOrTop = true ) const;
+ Color GetColorIn( bool bLeftOrTop = true ) const;
+ bool HasGapColor() const { return m_pColorGapFn != NULL; }
+ Color GetColorGap() const;
+
+ void SetWidth( long nWidth = 0 ) { m_nWidth = nWidth; }
+ /** Guess the style and width from the three lines widths values.
+
+ When the value of nStyle is SvxBorderLine::DOUBLE, the style set will be guessed
+ using the three values to match the best possible style among the following:
+ - SvxBorderLine::DOUBLE
+ - SvxBorderLine::THINTHICK_SMALLGAP
+ - SvxBorderLine::THINTHICK_MEDIUMGAP
+ - SvxBorderLine::THINTHICK_LARGEGAP
+ - SvxBorderLine::THICKTHIN_SMALLGAP
+ - SvxBorderLine::THICKTHIN_MEDIUMGAP
+ - SvxBorderLine::THICKTHIN_LARGEGAP
+
+ If no styles matches the width, then the width is set to 0.
+
+ There is one known case that could fit several styles: \a nIn = \a nDist = 0.75 pt,
+ \a nOut = 1.5 pt. This case fits SvxBorderLine::THINTHICK_SMALLGAP and
+ SvxBorderLine::THINTHICK_MEDIUMGAP with a 1.5 pt width and
+ SvxBorderLine::THINTHICK_LARGEGAP with a 0.75 pt width. The same case happens
+ also for thick-thin styles.
+
+ \param nStyle the border style used to guess the width.
+ \param nIn the width of the inner line in 1th pt
+ \param nOut the width of the outer line in 1th pt
+ \param nDist the width of the gap between the lines in 1th pt
+ */
+ void GuessLinesWidths( SvxBorderStyle nStyle, sal_uInt16 nOut, sal_uInt16 nIn = 0, sal_uInt16 nDist = 0 );
+
+ // TODO Hacky method to mirror lines in only a few cases
+ void SetMirrorWidths( bool bMirror = true ) { m_bMirrorWidths = bMirror; }
+ long GetWidth( ) const { return m_nWidth; }
+ sal_uInt16 GetOutWidth() const;
+ sal_uInt16 GetInWidth() const;
+ sal_uInt16 GetDistance() const;
+
+ SvxBorderStyle GetStyle() const { return m_nStyle; }
+
+ void SetColor( const Color &rColor ) { aColor = rColor; }
+ void SetColorOutFn( Color (*pColorOutFn)( Color ) ) { m_pColorOutFn = pColorOutFn; }
+ void SetColorInFn( Color (*pColorInFn)( Color ) ) { m_pColorInFn = pColorInFn; }
+ void SetColorGapFn( Color (*pColorGapFn)( Color ) ) { m_pColorGapFn = pColorGapFn; }
+ void SetUseLeftTop( bool bUseLeftTop ) { m_bUseLeftTop = bUseLeftTop; }
+ void SetStyle( SvxBorderStyle nNew );
+ void ScaleMetrics( long nMult, long nDiv );
+
+ sal_Bool operator==( const SvxBorderLine &rCmp ) const;
+
+ String GetValueString( SfxMapUnit eSrcUnit, SfxMapUnit eDestUnit,
+ const IntlWrapper* pIntl,
+ sal_Bool bMetricStr = sal_False ) const;
+
+ bool HasPriority( const SvxBorderLine& rOtherLine ) const;
+
+ bool isEmpty() const { return m_aWidthImpl.IsEmpty( ) || m_nStyle == NO_STYLE || m_nWidth == 0; }
+ bool isDouble() const { return m_aWidthImpl.IsDouble(); }
+ sal_uInt16 GetScaledWidth() const { return GetOutWidth() + GetInWidth() + GetDistance(); }
+
+ static Color darkColor( Color aMain );
+ static Color lightColor( Color aMain );
+
+ static Color threeDLightColor( Color aMain );
+ static Color threeDMediumColor( Color aMain );
+ static Color threeDDarkColor( Color aMain );
+
+ static BorderWidthImpl getWidthImpl( SvxBorderStyle nStyle );
+ };
// ============================================================================
+} // namespace editeng
+
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/inc/editeng/boxitem.hxx b/editeng/inc/editeng/boxitem.hxx
index 8f17d14ee5..4fc84213d5 100755
--- a/editeng/inc/editeng/boxitem.hxx
+++ b/editeng/inc/editeng/boxitem.hxx
@@ -52,10 +52,10 @@ namespace rtl { class OUString; }
class EDITENG_DLLPUBLIC SvxBoxItem : public SfxPoolItem
{
- SvxBorderLine *pTop,
- *pBottom,
- *pLeft,
- *pRight;
+ editeng::SvxBorderLine *pTop,
+ *pBottom,
+ *pLeft,
+ *pRight;
sal_uInt16 nTopDist,
nBottomDist,
nLeftDist,
@@ -87,15 +87,15 @@ public:
virtual bool ScaleMetrics( long nMult, long nDiv );
virtual bool HasMetrics() const;
- const SvxBorderLine* GetTop() const { return pTop; }
- const SvxBorderLine* GetBottom() const { return pBottom; }
- const SvxBorderLine* GetLeft() const { return pLeft; }
- const SvxBorderLine* GetRight() const { return pRight; }
+ const editeng::SvxBorderLine* GetTop() const { return pTop; }
+ const editeng::SvxBorderLine* GetBottom() const { return pBottom; }
+ const editeng::SvxBorderLine* GetLeft() const { return pLeft; }
+ const editeng::SvxBorderLine* GetRight() const { return pRight; }
- const SvxBorderLine* GetLine( sal_uInt16 nLine ) const;
+ const editeng::SvxBorderLine* GetLine( sal_uInt16 nLine ) const;
//The Pointers are being copied!
- void SetLine( const SvxBorderLine* pNew, sal_uInt16 nLine );
+ void SetLine( const editeng::SvxBorderLine* pNew, sal_uInt16 nLine );
sal_uInt16 GetDistance( sal_uInt16 nLine ) const;
sal_uInt16 GetDistance() const;
@@ -106,9 +106,9 @@ public:
// Line width plus Space plus inward distance
//bIgnoreLine = TRUE -> Also return distance, when no Line is set
sal_uInt16 CalcLineSpace( sal_uInt16 nLine, sal_Bool bIgnoreLine = sal_False ) const;
- static com::sun::star::table::BorderLine2 SvxLineToLine( const SvxBorderLine* pLine, sal_Bool bConvert );
- static sal_Bool LineToSvxLine(const ::com::sun::star::table::BorderLine& rLine, SvxBorderLine& rSvxLine, sal_Bool bConvert);
- static sal_Bool LineToSvxLine(const ::com::sun::star::table::BorderLine2& rLine, SvxBorderLine& rSvxLine, sal_Bool bConvert);
+ static com::sun::star::table::BorderLine2 SvxLineToLine( const editeng::SvxBorderLine* pLine, sal_Bool bConvert );
+ static sal_Bool LineToSvxLine(const ::com::sun::star::table::BorderLine& rLine, editeng::SvxBorderLine& rSvxLine, sal_Bool bConvert);
+ static sal_Bool LineToSvxLine(const ::com::sun::star::table::BorderLine2& rLine, editeng::SvxBorderLine& rSvxLine, sal_Bool bConvert);
};
inline void SvxBoxItem::SetDistance( sal_uInt16 nNew )
@@ -140,8 +140,8 @@ inline void SvxBoxItem::SetDistance( sal_uInt16 nNew )
class EDITENG_DLLPUBLIC SvxBoxInfoItem : public SfxPoolItem
{
- SvxBorderLine* pHori; //inner horizontal Line
- SvxBorderLine* pVert; //inner vertical Line
+ editeng::SvxBorderLine* pHori; //inner horizontal Line
+ editeng::SvxBorderLine* pVert; //inner vertical Line
bool mbEnableHor; /// true = Enable inner horizontal line.
bool mbEnableVer; /// true = Enable inner vertical line.
@@ -194,11 +194,11 @@ public:
virtual bool ScaleMetrics( long nMult, long nDiv );
virtual bool HasMetrics() const;
- const SvxBorderLine* GetHori() const { return pHori; }
- const SvxBorderLine* GetVert() const { return pVert; }
+ const editeng::SvxBorderLine* GetHori() const { return pHori; }
+ const editeng::SvxBorderLine* GetVert() const { return pVert; }
//The Pointers are being copied!
- void SetLine( const SvxBorderLine* pNew, sal_uInt16 nLine );
+ void SetLine( const editeng::SvxBorderLine* pNew, sal_uInt16 nLine );
sal_Bool IsTable() const { return mbEnableHor && mbEnableVer; }
void SetTable( sal_Bool bNew ) { mbEnableHor = mbEnableVer = bNew; }
diff --git a/editeng/qa/items/borderline_test.cxx b/editeng/qa/items/borderline_test.cxx
index 995ccef56d..5d67b62f82 100644
--- a/editeng/qa/items/borderline_test.cxx
+++ b/editeng/qa/items/borderline_test.cxx
@@ -44,6 +44,8 @@
#define THINTHICKLG_OUT_WIDTH long( 30 )
#define THINTHICKLG_DIST_WIDTH long( 40 )
+using namespace editeng;
+
namespace {
class BorderLineTest : public CppUnit::TestFixture
diff --git a/editeng/source/items/borderline.cxx b/editeng/source/items/borderline.cxx
index da0ece104f..de24284b92 100644
--- a/editeng/source/items/borderline.cxx
+++ b/editeng/source/items/borderline.cxx
@@ -39,6 +39,31 @@
// class SvxBorderLine --------------------------------------------------
+namespace {
+
+ Color lcl_compute3DColor( Color aMain, int nLight, int nMedium, int nDark )
+ {
+ basegfx::BColor color = aMain.getBColor( );
+ basegfx::BColor hsl = basegfx::tools::rgb2hsl( color );
+
+ int nCoef = 0;
+ if ( hsl.getZ( ) >= 0.5 )
+ nCoef = nLight;
+ else if ( 0.5 > hsl.getZ() && hsl.getZ() >= 0.25 )
+ nCoef = nMedium;
+ else
+ nCoef = nDark;
+
+ double L = hsl.getZ() * 255.0 + nCoef;
+ hsl.setZ( L / 255.0 );
+ color = basegfx::tools::hsl2rgb( hsl );
+
+ return Color( color );
+ }
+} // Anonymous namespace
+
+namespace editeng {
+
Color SvxBorderLine::darkColor( Color aMain )
{
return aMain;
@@ -56,25 +81,6 @@ Color SvxBorderLine::lightColor( Color aMain )
return Color( color );
}
-Color lcl_compute3DColor( Color aMain, int nLight, int nMedium, int nDark )
-{
- basegfx::BColor color = aMain.getBColor( );
- basegfx::BColor hsl = basegfx::tools::rgb2hsl( color );
-
- int nCoef = 0;
- if ( hsl.getZ( ) >= 0.5 )
- nCoef = nLight;
- else if ( 0.5 > hsl.getZ() && hsl.getZ() >= 0.25 )
- nCoef = nMedium;
- else
- nCoef = nDark;
-
- double L = hsl.getZ() * 255.0 + nCoef;
- hsl.setZ( L / 255.0 );
- color = basegfx::tools::hsl2rgb( hsl );
-
- return Color( color );
-}
Color SvxBorderLine::threeDLightColor( Color aMain )
{
@@ -484,4 +490,6 @@ bool SvxBorderLine::HasPriority( const SvxBorderLine& rOtherLine ) const
}
}
+} // namespace editeng
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx
index b21f8816ec..bda2be744f 100644
--- a/editeng/source/items/frmitems.cxx
+++ b/editeng/source/items/frmitems.cxx
@@ -94,6 +94,7 @@
#include <editeng/memberids.hrc>
#include <editeng/editerr.hxx>
+using namespace ::editeng;
using namespace ::rtl;
using namespace ::com::sun::star;
diff --git a/editeng/source/rtf/rtfitem.cxx b/editeng/source/rtf/rtfitem.cxx
index 5fcfd0981c..f482e560f8 100644
--- a/editeng/source/rtf/rtfitem.cxx
+++ b/editeng/source/rtf/rtfitem.cxx
@@ -95,6 +95,7 @@
#define BRACELEFT '{'
#define BRACERIGHT '}'
+using namespace editeng;
// Some helper functions
// char