[Libreoffice-commits] .: 4 commits - sw/inc sw/source
Michael Meeks
mmeeks at kemper.freedesktop.org
Tue Mar 8 04:01:17 PST 2011
sw/inc/viewopt.hxx | 4 +++
sw/source/core/inc/pagefrm.hrc | 8 ++-----
sw/source/core/layout/pagefrm.src | 22 +++++---------------
sw/source/core/layout/paintfrm.cxx | 40 ++++++++++++++++++++++++++++++++-----
sw/source/ui/config/viewopt.cxx | 12 +++++++++++
5 files changed, 60 insertions(+), 26 deletions(-)
New commits:
commit 1b63b7c2cb9ea29579c5982cce2aa0ac69093c24
Author: Sébastien Le Ray <sebastien-libreoffice at orniz.org>
Date: Tue Mar 8 08:43:28 2011 +0100
Handle shadow option in frame painting.
diff --git a/sw/inc/viewopt.hxx b/sw/inc/viewopt.hxx
index c71bfb1..2c4d2e7 100644
--- a/sw/inc/viewopt.hxx
+++ b/sw/inc/viewopt.hxx
@@ -110,6 +110,7 @@ namespace svtools{ class ColorConfig;}
#define VIEWOPT_VISITED_LINKS 0x0020
#define VIEWOPT_FIELD_SHADINGS 0x0040
#define VIEWOPT_SECTION_BOUNDARIES 0x0080
+#define VIEWOPT_SHADOW 0x0100
// Implementierung in core/text/txtpaint.cxx
extern void SyncVout( const OutputDevice *pOut );
@@ -133,6 +134,7 @@ class SwViewOption
static Color aSectionBoundColor;
static Color aPageBreakColor;
static Color aScriptIndicatorColor;
+ static Color aShadowColor;
static sal_Int32 nAppearanceFlags; //
protected:
@@ -557,6 +559,7 @@ public:
static Color& GetTextGridColor();
static Color& GetSpellColor();
static Color& GetSmarttagColor();
+ static Color& GetShadowColor();
SW_DLLPUBLIC static Color& GetFontColor();
static Color& GetFieldShadingsColor();
static Color& GetSectionBoundColor();
@@ -572,6 +575,7 @@ public:
static BOOL IsVisitedLinks() {return IsAppearanceFlag(VIEWOPT_VISITED_LINKS );}
static BOOL IsFieldShadings() {return IsAppearanceFlag(VIEWOPT_FIELD_SHADINGS);}
static BOOL IsSectionBoundaries() {return IsAppearanceFlag(VIEWOPT_SECTION_BOUNDARIES);}
+ static BOOL IsShadow() {return IsAppearanceFlag(VIEWOPT_SHADOW );}
static void SetAppearanceFlag(sal_Int32 nFlag, BOOL bSet, BOOL bSaveInConfig = FALSE);
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index 13b51d3..da5e5db 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -5299,20 +5299,23 @@ const sal_Int8 SwPageFrm::mnShadowPxWidth = 10;
bool bFullBottomShadow,
bool bRightSidebar )
{
+ // No shadow in prefs
+ if( !SwViewOption::IsShadow() ) return;
+
// --> FME 2004-06-24 #i16816# tagged pdf support
SwTaggedPDFHelper aTaggedPDFHelper( 0, 0, 0, *_pViewShell->GetOut() );
// <--
- static bool initialized = false;
static BitmapEx aPageTopRightShadow;
static BitmapEx aPageBottomRightShadow;
static BitmapEx aPageBottomLeftShadow;
static BitmapEx aPageBottomShadowBase;
static BitmapEx aPageRightShadowBase;
- static Color aShadowColor( COL_BLACK );
+ static Color aShadowColor;
- if(!initialized) {
+ if(aShadowColor != SwViewOption::GetShadowColor() ) {
+ aShadowColor = SwViewOption::GetShadowColor();
AlphaMask aMask( SW_RES( BMP_PAGE_BOTTOM_RIGHT_SHADOW_MASK ) );
Bitmap aFilledSquare( Size( mnShadowPxWidth, mnShadowPxWidth ), 24 );
aFilledSquare.Erase( aShadowColor );
@@ -5332,8 +5335,6 @@ const sal_Int8 SwPageFrm::mnShadowPxWidth = 10;
aFilledSquare.Erase( aShadowColor );
aMask = Bitmap( SW_RES( BMP_PAGE_RIGHT_SHADOW_MASK ) );
aPageRightShadowBase = BitmapEx( aFilledSquare, aMask );
-
- initialized = true;
}
SwRect aPaintRect;
diff --git a/sw/source/ui/config/viewopt.cxx b/sw/source/ui/config/viewopt.cxx
index 18a1a23..a0db43d 100644
--- a/sw/source/ui/config/viewopt.cxx
+++ b/sw/source/ui/config/viewopt.cxx
@@ -72,6 +72,7 @@ Color SwViewOption::aFieldShadingsColor(COL_LIGHTGRAY);
Color SwViewOption::aSectionBoundColor(COL_LIGHTGRAY);
Color SwViewOption::aPageBreakColor(COL_BLUE);
Color SwViewOption::aScriptIndicatorColor(COL_GREEN);
+Color SwViewOption::aShadowColor(COL_GRAY);
sal_Int32 SwViewOption::nAppearanceFlags = VIEWOPT_DOC_BOUNDARIES|VIEWOPT_OBJECT_BOUNDARIES;
USHORT SwViewOption::nPixelTwips = 0; // one pixel on the screen
@@ -418,6 +419,11 @@ Color& SwViewOption::GetSmarttagColor()
return aSmarttagColor;
}
+Color& SwViewOption::GetShadowColor()
+{
+ return aShadowColor;
+}
+
Color& SwViewOption::GetFontColor()
{
return aFontColor;
@@ -475,6 +481,11 @@ void SwViewOption::ApplyColorConfigValues(const svtools::ColorConfig& rConfig )
if(aValue.bIsVisible)
nAppearanceFlags |= VIEWOPT_VISITED_LINKS;
+ aValue = rConfig.GetColorValue(svtools::SHADOWCOLOR);
+ aShadowColor.SetColor(aValue.nColor);
+ if(aValue.bIsVisible)
+ nAppearanceFlags |= VIEWOPT_SHADOW;
+
aDirectCursorColor.SetColor(rConfig.GetColorValue(svtools::WRITERDIRECTCURSOR).nColor);
aTextGridColor.SetColor(rConfig.GetColorValue(svtools::WRITERTEXTGRID).nColor);
@@ -526,6 +537,7 @@ void SwViewOption::SetAppearanceFlag(sal_Int32 nFlag, BOOL bSet, BOOL bSaveInCon
{ VIEWOPT_VISITED_LINKS , svtools::LINKSVISITED },
{ VIEWOPT_FIELD_SHADINGS , svtools::WRITERFIELDSHADINGS },
{ VIEWOPT_SECTION_BOUNDARIES , svtools::WRITERSECTIONBOUNDARIES },
+ { VIEWOPT_SHADOW , svtools::SHADOWCOLOR },
{ 0 , svtools::ColorConfigEntryCount }
};
sal_uInt16 nPos = 0;
commit 4e7e90f575657ba6096bc8ed11c6ee4d6f309fe8
Author: Sébastien Le Ray <sebastien-libreoffice at orniz.org>
Date: Sun Mar 6 16:39:25 2011 +0100
Renamed shadow images to *-mask.
diff --git a/sw/source/core/inc/pagefrm.hrc b/sw/source/core/inc/pagefrm.hrc
index 20a0512..302ba9a 100644
--- a/sw/source/core/inc/pagefrm.hrc
+++ b/sw/source/core/inc/pagefrm.hrc
@@ -31,9 +31,9 @@
#include "rcid.hrc"
// Bitmaps for page shadow
-#define BMP_PAGE_RIGHT_SHADOW RC_PAGEFRM_BEGIN + 0
-#define BMP_PAGE_BOTTOM_RIGHT_SHADOW RC_PAGEFRM_BEGIN + 1
-#define BMP_PAGE_BOTTOM_SHADOW RC_PAGEFRM_BEGIN + 2
+#define BMP_PAGE_RIGHT_SHADOW_MASK RC_PAGEFRM_BEGIN + 0
+#define BMP_PAGE_BOTTOM_RIGHT_SHADOW_MASK RC_PAGEFRM_BEGIN + 1
+#define BMP_PAGE_BOTTOM_SHADOW_MASK RC_PAGEFRM_BEGIN + 2
// If you add resources, don't forget to update this
diff --git a/sw/source/core/layout/pagefrm.src b/sw/source/core/layout/pagefrm.src
index dd77467..83b80e4 100644
--- a/sw/source/core/layout/pagefrm.src
+++ b/sw/source/core/layout/pagefrm.src
@@ -1,17 +1,17 @@
#include "pagefrm.hrc"
-Bitmap BMP_PAGE_RIGHT_SHADOW
+Bitmap BMP_PAGE_RIGHT_SHADOW_MASK
{
- File = "page-right-shadow.png";
+ File = "page-right-shadow-mask.png";
};
-Bitmap BMP_PAGE_BOTTOM_RIGHT_SHADOW
+Bitmap BMP_PAGE_BOTTOM_RIGHT_SHADOW_MASK
{
- File = "page-bottomright-shadow.png";
+ File = "page-bottomright-shadow-mask.png";
};
-Bitmap BMP_PAGE_BOTTOM_SHADOW
+Bitmap BMP_PAGE_BOTTOM_SHADOW_MASK
{
- File = "page-bottom-shadow.png";
+ File = "page-bottom-shadow-mask.png";
};
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index 82ab24b..13b51d3 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -5313,7 +5313,7 @@ const sal_Int8 SwPageFrm::mnShadowPxWidth = 10;
if(!initialized) {
- AlphaMask aMask( SW_RES( BMP_PAGE_BOTTOM_RIGHT_SHADOW ) );
+ AlphaMask aMask( SW_RES( BMP_PAGE_BOTTOM_RIGHT_SHADOW_MASK ) );
Bitmap aFilledSquare( Size( mnShadowPxWidth, mnShadowPxWidth ), 24 );
aFilledSquare.Erase( aShadowColor );
@@ -5325,12 +5325,12 @@ const sal_Int8 SwPageFrm::mnShadowPxWidth = 10;
aFilledSquare = Bitmap( Size( 1, mnShadowPxWidth ), 24 );
aFilledSquare.Erase( aShadowColor );
- aMask = Bitmap( SW_RES( BMP_PAGE_BOTTOM_SHADOW ) );
+ aMask = Bitmap( SW_RES( BMP_PAGE_BOTTOM_SHADOW_MASK ) );
aPageBottomShadowBase = BitmapEx( aFilledSquare, aMask );
aFilledSquare = Bitmap( Size( mnShadowPxWidth, 1 ), 24 );
aFilledSquare.Erase( aShadowColor );
- aMask = Bitmap( SW_RES( BMP_PAGE_RIGHT_SHADOW ) );
+ aMask = Bitmap( SW_RES( BMP_PAGE_RIGHT_SHADOW_MASK ) );
aPageRightShadowBase = BitmapEx( aFilledSquare, aMask );
initialized = true;
commit 63a4ba9aad0fa6d621e67fd27986508cdf5c00d4
Author: Sébastien Le Ray <sebastien-libreoffice at orniz.org>
Date: Sun Mar 6 16:31:58 2011 +0100
Removed no more used shadow images.
diff --git a/sw/source/core/inc/pagefrm.hrc b/sw/source/core/inc/pagefrm.hrc
index c72c212..20a0512 100644
--- a/sw/source/core/inc/pagefrm.hrc
+++ b/sw/source/core/inc/pagefrm.hrc
@@ -31,11 +31,9 @@
#include "rcid.hrc"
// Bitmaps for page shadow
-#define BMP_PAGE_TOP_RIGHT_SHADOW RC_PAGEFRM_BEGIN
-#define BMP_PAGE_RIGHT_SHADOW RC_PAGEFRM_BEGIN + 1
-#define BMP_PAGE_BOTTOM_RIGHT_SHADOW RC_PAGEFRM_BEGIN + 2
-#define BMP_PAGE_BOTTOM_SHADOW RC_PAGEFRM_BEGIN + 3
-#define BMP_PAGE_BOTTOM_LEFT_SHADOW RC_PAGEFRM_BEGIN + 4
+#define BMP_PAGE_RIGHT_SHADOW RC_PAGEFRM_BEGIN + 0
+#define BMP_PAGE_BOTTOM_RIGHT_SHADOW RC_PAGEFRM_BEGIN + 1
+#define BMP_PAGE_BOTTOM_SHADOW RC_PAGEFRM_BEGIN + 2
// If you add resources, don't forget to update this
diff --git a/sw/source/core/layout/pagefrm.src b/sw/source/core/layout/pagefrm.src
index dfa9b2b..dd77467 100644
--- a/sw/source/core/layout/pagefrm.src
+++ b/sw/source/core/layout/pagefrm.src
@@ -1,10 +1,5 @@
#include "pagefrm.hrc"
-Bitmap BMP_PAGE_TOP_RIGHT_SHADOW
-{
- File = "page-topright-shadow.png";
-};
-
Bitmap BMP_PAGE_RIGHT_SHADOW
{
File = "page-right-shadow.png";
@@ -20,8 +15,3 @@ Bitmap BMP_PAGE_BOTTOM_SHADOW
File = "page-bottom-shadow.png";
};
-Bitmap BMP_PAGE_BOTTOM_LEFT_SHADOW
-{
- File = "page-bottomleft-shadow.png";
-};
-
commit 0cd7fd649ef974af32681f48fc86051c447bb5cb
Author: Sébastien Le Ray <sebastien-libreoffice at orniz.org>
Date: Sun Mar 6 16:19:48 2011 +0100
Using alpha mask for page shadow drawing.
Alpha masks will allow us to have configurable shadow colors.
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index ec6a5d6..82ab24b 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -5303,7 +5303,38 @@ const sal_Int8 SwPageFrm::mnShadowPxWidth = 10;
SwTaggedPDFHelper aTaggedPDFHelper( 0, 0, 0, *_pViewShell->GetOut() );
// <--
- BitmapEx aPageBottomShadow( SW_RES( BMP_PAGE_BOTTOM_SHADOW ) );
+ static bool initialized = false;
+ static BitmapEx aPageTopRightShadow;
+ static BitmapEx aPageBottomRightShadow;
+ static BitmapEx aPageBottomLeftShadow;
+ static BitmapEx aPageBottomShadowBase;
+ static BitmapEx aPageRightShadowBase;
+ static Color aShadowColor( COL_BLACK );
+
+
+ if(!initialized) {
+ AlphaMask aMask( SW_RES( BMP_PAGE_BOTTOM_RIGHT_SHADOW ) );
+ Bitmap aFilledSquare( Size( mnShadowPxWidth, mnShadowPxWidth ), 24 );
+ aFilledSquare.Erase( aShadowColor );
+
+ aPageBottomRightShadow = BitmapEx( aFilledSquare, aMask );
+ aMask.Rotate( 900, 255 );
+ aPageTopRightShadow = BitmapEx( aFilledSquare, aMask );
+ aMask.Rotate( 1800, 255);
+ aPageBottomLeftShadow = BitmapEx( aFilledSquare, aMask );
+
+ aFilledSquare = Bitmap( Size( 1, mnShadowPxWidth ), 24 );
+ aFilledSquare.Erase( aShadowColor );
+ aMask = Bitmap( SW_RES( BMP_PAGE_BOTTOM_SHADOW ) );
+ aPageBottomShadowBase = BitmapEx( aFilledSquare, aMask );
+
+ aFilledSquare = Bitmap( Size( mnShadowPxWidth, 1 ), 24 );
+ aFilledSquare.Erase( aShadowColor );
+ aMask = Bitmap( SW_RES( BMP_PAGE_RIGHT_SHADOW ) );
+ aPageRightShadowBase = BitmapEx( aFilledSquare, aMask );
+
+ initialized = true;
+ }
SwRect aPaintRect;
OutputDevice *pOut = _pViewShell->GetOut();
@@ -5311,10 +5342,8 @@ const sal_Int8 SwPageFrm::mnShadowPxWidth = 10;
// paint right shadow
if ( bPaintRightShadow )
{
- BitmapEx aPageRightShadow( SW_RES( BMP_PAGE_RIGHT_SHADOW ) );
- BitmapEx aPageTopRightShadow( SW_RES( BMP_PAGE_TOP_RIGHT_SHADOW ) );
- BitmapEx aPageBottomRightShadow( SW_RES( BMP_PAGE_BOTTOM_RIGHT_SHADOW ) );
SwPageFrm::GetRightShadowRect( _rPageRect, _pViewShell, aPaintRect, bRightSidebar );
+ BitmapEx aPageRightShadow = aPageRightShadowBase;
aPageRightShadow.Scale( 1, aPaintRect.Height() );
pOut->DrawBitmapEx( pOut->PixelToLogic( aPaintRect.Pos() ), aPageRightShadow );
pOut->DrawBitmapEx( pOut->PixelToLogic( Point( aPaintRect.Left(), aPaintRect.Top() - mnShadowPxWidth ) ), aPageTopRightShadow );
@@ -5325,9 +5354,9 @@ const sal_Int8 SwPageFrm::mnShadowPxWidth = 10;
SwPageFrm::GetBottomShadowRect( _rPageRect, _pViewShell, aPaintRect, bFullBottomShadow, bRightSidebar );
if(!bFullBottomShadow)
{
- BitmapEx aPageBottomLeftShadow( SW_RES( BMP_PAGE_BOTTOM_LEFT_SHADOW ) );
pOut->DrawBitmapEx( pOut->PixelToLogic( Point( aPaintRect.Left() - mnShadowPxWidth, aPaintRect.Top() ) ), aPageBottomLeftShadow );
}
+ BitmapEx aPageBottomShadow = aPageBottomShadowBase;
aPageBottomShadow.Scale( aPaintRect.Width(), 1 );
pOut->DrawBitmapEx( pOut->PixelToLogic( aPaintRect.Pos() ), aPageBottomShadow);
}
More information about the Libreoffice-commits
mailing list