You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by st...@apache.org on 2013/05/18 12:12:56 UTC

svn commit: r1484083 [16/17] - in /openoffice/branches/ia2: ./ ext_libraries/apr/prj/ ext_libraries/coinmp/prj/ ext_libraries/ratscan/prj/ ext_libraries/serf/prj/ main/ main/avmedia/source/quicktime/ main/bridges/prj/ main/bridges/source/cpp_uno/cxx_ma...

Modified: openoffice/branches/ia2/main/svx/source/xoutdev/xtabcolr.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ia2/main/svx/source/xoutdev/xtabcolr.cxx?rev=1484083&r1=1484082&r2=1484083&view=diff
==============================================================================
--- openoffice/branches/ia2/main/svx/source/xoutdev/xtabcolr.cxx (original)
+++ openoffice/branches/ia2/main/svx/source/xoutdev/xtabcolr.cxx Sat May 18 10:12:43 2013
@@ -19,24 +19,15 @@
  * 
  *************************************************************/
 
-
-
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_svx.hxx"
 
-#ifndef SVX_LIGHT
-
 #include <com/sun/star/container/XNameContainer.hpp>
 #include "svx/XPropertyTable.hxx"
 #include <unotools/ucbstreamhelper.hxx>
-
 #include <unotools/pathoptions.hxx>
-
 #include "xmlxtexp.hxx"
 #include "xmlxtimp.hxx"
-
-#endif
-
 #include <sfx2/docfile.hxx>
 #include <tools/urlobj.hxx>
 #include <svx/dialogs.hrc>
@@ -47,7 +38,6 @@
 #define GLOBALOVERFLOW
 
 using namespace com::sun::star;
-using namespace rtl;
 
 sal_Unicode const pszExtColor[]	 = {'s','o','c'};
 
@@ -61,10 +51,10 @@ static char const aChckXML[]    = { '<',
 |*
 *************************************************************************/
 
-static XColorList* pStaticGlobalColorList = 0;
+static XColorListSharedPtr aStaticGlobalColorList;
 
-XColorList::XColorList( const String& rPath, XOutdevItemPool* pInPool ) :
-				XPropertyList( rPath, pInPool )
+XColorList::XColorList( const String& rPath ) :
+				XPropertyList( rPath )
 {
 }
 
@@ -85,19 +75,19 @@ XColorEntry* XColorList::Replace(XColorE
 
 XColorEntry* XColorList::Remove(long nIndex)
 {
-	return (XColorEntry*) XPropertyList::Remove(nIndex, 0);
+	return (XColorEntry*) XPropertyList::Remove(nIndex);
 }
 
 /************************************************************************/
 
 XColorEntry* XColorList::GetColor(long nIndex) const
 {
-	return (XColorEntry*) XPropertyList::Get(nIndex, 0);
+	return (XColorEntry*) XPropertyList::Get(nIndex);
 }
 
 /************************************************************************/
 
-sal_Bool XColorList::Load()
+bool XColorList::Load()
 {
 	if( mbListDirty )
 	{
@@ -107,8 +97,8 @@ sal_Bool XColorList::Load()
 
 		if( INET_PROT_NOT_VALID == aURL.GetProtocol() )
 		{
-			DBG_ASSERT( !maPath.Len(), "invalid URL" );
-			return sal_False;
+			OSL_ENSURE( !maPath.Len(), "invalid URL" );
+			return false;
 		}
 
 		aURL.Append( maName );
@@ -119,19 +109,20 @@ sal_Bool XColorList::Load()
 		uno::Reference< container::XNameContainer > xTable( SvxUnoXColorTable_createInstance( this ), uno::UNO_QUERY );
 		return SvxXMLXTableImport::load( aURL.GetMainURL( INetURLObject::NO_DECODE ), xTable );
 	}
-	return( sal_False );
+
+	return false;
 }
 
 /************************************************************************/
 
-sal_Bool XColorList::Save()
+bool XColorList::Save()
 {
 	INetURLObject aURL( maPath );
 
 	if( INET_PROT_NOT_VALID == aURL.GetProtocol() )
 	{
-		DBG_ASSERT( !maPath.Len(), "invalid URL" );
-		return sal_False;
+		OSL_ENSURE( !maPath.Len(), "invalid URL" );
+		return false;
 	}
 
 	aURL.Append( maName );
@@ -145,290 +136,141 @@ sal_Bool XColorList::Save()
 
 /************************************************************************/
 
-sal_Bool XColorList::Create()
+bool XColorList::Create()
 {
-	XubString aStr;
-	xub_StrLen nLen;
-	ResMgr& rRes = DIALOG_MGR();
+    sal_uInt32 a(0);
+    sal_uInt32 b(0);
 
-	static sal_uInt16 __READONLY_DATA aResId[] =
-	{
-		RID_SVXSTR_BLACK,
-		RID_SVXSTR_BLUE,
-		RID_SVXSTR_GREEN,
-		RID_SVXSTR_CYAN,
-		RID_SVXSTR_RED,
-		RID_SVXSTR_MAGENTA,
-		RID_SVXSTR_BROWN,
-		RID_SVXSTR_GREY,
-		RID_SVXSTR_LIGHTGREY,
-		RID_SVXSTR_LIGHTBLUE,
-		RID_SVXSTR_LIGHTGREEN,
-		RID_SVXSTR_LIGHTCYAN,
-		RID_SVXSTR_LIGHTRED,
-		RID_SVXSTR_LIGHTMAGENTA,
-		RID_SVXSTR_YELLOW,
-		RID_SVXSTR_WHITE
-	};
-
-	// MT: COL_XXX ist in VCL kein enum mehr!!!
-	// COL_WHITE ist seeeehr gross! ( => Zugriff ueber das obige Array hinweg )
-	// Mit der unteren Schleife gibt es keinen Absturtz, aber es ist
-	// alles schwarz, weil alles kleine Werte.
-	// Ausserdem ist die ganze Vorgehensweise laut MM sehr unperformant
-	// => lieber gleich Stringlisten laden.
-
-	// BM: ifndef VCL part removed (deprecated)
-
-	static ColorData __READONLY_DATA aColTab[] =
-	{
-		COL_BLACK,
-		COL_BLUE,
-		COL_GREEN,
-		COL_CYAN,
-		COL_RED,
-		COL_MAGENTA,
-		COL_BROWN,
-		COL_GRAY,
-		COL_LIGHTGRAY,
-		COL_LIGHTBLUE,
-		COL_LIGHTGREEN,
-		COL_LIGHTCYAN,
-		COL_LIGHTRED,
-		COL_LIGHTMAGENTA,
-		COL_YELLOW,
-		COL_WHITE
-	};
+    // <!-- Gray palette from white to black -->
+    XubString aStrGrey( SVX_RESSTR( RID_SVXSTR_COLOR_GREY ) );
 
-	for( sal_uInt16 n = 0; n < 16; ++n )
-	{
-		Insert( new XColorEntry( Color( aColTab[n] ), String( ResId( aResId[ n ], rRes )) ), n );
-	}
+    Insert( new XColorEntry( Color( 0xff, 0xff, 0xff ), SVX_RESSTR( RID_SVXSTR_COLOR_WHITE ) ) );
+    aStrGrey.AppendAscii(" 1"); Insert( new XColorEntry( Color( 0xee, 0xee, 0xee ), aStrGrey ) );
+    aStrGrey.SetChar(aStrGrey.Len() - 1, sal_Unicode('2')); Insert( new XColorEntry( Color( 0xdd, 0xdd, 0xdd ), aStrGrey ) );
+    aStrGrey.SetChar(aStrGrey.Len() - 1, sal_Unicode('3')); Insert( new XColorEntry( Color( 0xcc, 0xcc, 0xcc ), aStrGrey ) );
+    aStrGrey.SetChar(aStrGrey.Len() - 1, sal_Unicode('4')); Insert( new XColorEntry( Color( 0xb2, 0xb2, 0xb2 ), aStrGrey ) );
+    aStrGrey.SetChar(aStrGrey.Len() - 1, sal_Unicode('5')); Insert( new XColorEntry( Color( 0x99, 0x99, 0x99 ), aStrGrey ) );
+    aStrGrey.SetChar(aStrGrey.Len() - 1, sal_Unicode('6')); Insert( new XColorEntry( Color( 0x80, 0x80, 0x80 ), aStrGrey ) );
+    aStrGrey.SetChar(aStrGrey.Len() - 1, sal_Unicode('7')); Insert( new XColorEntry( Color( 0x66, 0x66, 0x66 ), aStrGrey ) );
+    aStrGrey.SetChar(aStrGrey.Len() - 1, sal_Unicode('8')); Insert( new XColorEntry( Color( 0x33, 0x33, 0x33 ), aStrGrey ) );
+    aStrGrey.SetChar(aStrGrey.Len() - 1, sal_Unicode('9')); Insert( new XColorEntry( Color( 0x1c, 0x1c, 0x1c  ), aStrGrey ) );
+    aStrGrey.SetChar(aStrGrey.Len() - 1, sal_Unicode('1')); aStrGrey.AppendAscii("0"); Insert( new XColorEntry( Color( 0x11, 0x11, 0x11 ), aStrGrey ) );
+    Insert( new XColorEntry( Color( 0x00, 0x00, 0x00 ), SVX_RESSTR( RID_SVXSTR_COLOR_BLACK ) ) );
+
+    // <!-- Base colors step 0 to 10 -->
+    const sal_uInt32 nNumColorsInGroup(12);
+    const sal_uInt32 nNumGroups(11);
+    XubString aStrCol[nNumColorsInGroup];
+    const sal_uInt32 aStdCol[nNumColorsInGroup * nNumGroups] = {
+        0xffff99, 0xff6600, 0xff3333, 0xff00cc, 0xff33ff, 0x9900ff, 0x6666ff, 0x00ccff, 0x66ffff, 0x33ff99, 0x99ff66, 0xccff00, 
+        0xffff66, 0xffcc00, 0xff9999, 0xff66cc, 0xff99ff, 0xcc66ff, 0x9999ff, 0x9999ff, 0x99ffff, 0x66ff99, 0x99ff99, 0xccff66,
+        0xffff00, 0xff9900, 0xff6666, 0xff3399, 0xff66ff, 0x9933ff, 0x3333ff, 0x3399ff, 0x00ffff, 0x00ff66, 0x66ff66, 0x99ff33, 
+        0xcc9900, 0xff3300, 0xff0000, 0xff0066, 0xff00ff, 0x6600ff, 0x0000ff, 0x0066ff, 0x00cccc, 0x00cc33, 0x00cc00, 0x66ff00,
+        0x996600, 0xcc3300, 0xcc0000, 0xcc0066, 0xcc00cc, 0x6600cc, 0x0000cc, 0x0066cc, 0x009999, 0x009933, 0x009900, 0x66cc00, 
+        0x663300, 0x801900, 0x990000, 0x990066, 0x990099, 0x330099, 0x000099, 0x006699, 0x006666, 0x007826, 0x006600, 0x669900,
+        0x333300, 0x461900, 0x330000, 0x330033, 0x660066, 0x000033, 0x000066, 0x000080, 0x003333, 0x00331a, 0x003300, 0x193300, 
+        0x666633, 0x661900, 0x663333, 0x660033, 0x663366, 0x330066, 0x333366, 0x003366, 0x336666, 0x006633, 0x336633, 0x336600,
+        0x999966, 0x996633, 0x996666, 0x993366, 0x996699, 0x663399, 0x666699, 0x336699, 0x669999, 0x339966, 0x669966, 0x669933, 
+        0xcccc99, 0xcc9966, 0xcc9999, 0xcc6699, 0xcc99cc, 0x9966cc, 0x9999cc, 0x6699cc, 0x99cccc, 0x66cc99, 0x99cc99, 0x99cc66,
+        0xffffcc, 0xffcc99, 0xffcccc, 0xff99cc, 0xffccff, 0xcc99ff, 0xccccff, 0x99ccff, 0xccffff, 0x99ffcc, 0xccffcc, 0xccff99 };
+
+    for(a = 0; a < nNumGroups; a++)
+    {
+        switch(a)
+        {
+            case 0:
+            {
+                aStrCol[0] = SVX_RESSTR(RID_SVXSTR_COLOR_YELLOW);
+                aStrCol[1] = SVX_RESSTR(RID_SVXSTR_COLOR_ORANGE);
+                aStrCol[2] = SVX_RESSTR(RID_SVXSTR_COLOR_RED);
+                aStrCol[3] = SVX_RESSTR(RID_SVXSTR_COLOR_PINK);
+                aStrCol[4] = SVX_RESSTR(RID_SVXSTR_COLOR_MAGENTA);
+                aStrCol[5] = SVX_RESSTR(RID_SVXSTR_COLOR_PURPLE);
+                aStrCol[6] = SVX_RESSTR(RID_SVXSTR_COLOR_BLUE);
+                aStrCol[7] = SVX_RESSTR(RID_SVXSTR_COLOR_SKYBLUE);
+                aStrCol[8] = SVX_RESSTR(RID_SVXSTR_COLOR_CYAN);
+                aStrCol[9] = SVX_RESSTR(RID_SVXSTR_COLOR_TURQUOISE);
+                aStrCol[10] = SVX_RESSTR(RID_SVXSTR_COLOR_GREEN);
+                aStrCol[11] = SVX_RESSTR(RID_SVXSTR_COLOR_YELLOWGREEN);
+                break;
+            }
+            case 1:
+            {
+                for(b = 0; b < nNumColorsInGroup; b++)
+                {
+                    aStrCol[b].AppendAscii(" 1");
+                }
+                break;
+            }
+            case 10:
+            {
+                for(b = 0; b < nNumColorsInGroup; b++)
+                {
+                    aStrCol[b].SetChar(aStrCol[b].Len() - 1, sal_Unicode('1'));
+                    aStrCol[b].AppendAscii("0");
+                }
+                break;
+            }
+            default: // 2 .. 9, 11
+            {
+                for(b = 0; b < nNumColorsInGroup; b++)
+                {
+                    aStrCol[b].SetChar(aStrCol[b].Len() - 1, sal_Unicode('0') + sal_Unicode(a % 10));
+                }
+                break;
+            }
+        }
+
+        const sal_uInt32 nOffset(a * nNumColorsInGroup);
+
+        for(b = 0; b < nNumColorsInGroup; b++)
+        {
+            Insert( new XColorEntry( aStdCol[nOffset + b], aStrCol[b] ) );
+        }
+    }
+
+    // <!-- use some 'nice' colors from original palette -->
+    Insert( new XColorEntry( Color( 0xe6, 0xe6, 0xff ), SVX_RESSTR( RID_SVXSTR_COLOR_BLUEGREY) ) );
+    Insert( new XColorEntry( Color( 0xCF, 0xE7, 0xF5  ), SVX_RESSTR( RID_SVXSTR_COLOR_BLUE_CLASSIC ) ) );
+
+    // <!-- add 'pale' colors from original palette -->
+    Insert( new XColorEntry( Color( 0x99, 0x99, 0xff ), SVX_RESSTR( RID_SVXSTR_COLOR_VIOLET ) ) );
+    Insert( new XColorEntry( Color( 0x99, 0x33, 0x66 ), SVX_RESSTR( RID_SVXSTR_COLOR_BORDEAUX ) ) );
+    Insert( new XColorEntry( Color( 0xff, 0xff, 0xcc ), SVX_RESSTR( RID_SVXSTR_COLOR_PALE_YELLOW ) ) );
+    Insert( new XColorEntry( Color( 0xcc, 0xff, 0xff ), SVX_RESSTR( RID_SVXSTR_COLOR_PALE_GREEN ) ) );
+    Insert( new XColorEntry( Color( 0x66, 0x00, 0x66 ), SVX_RESSTR( RID_SVXSTR_COLOR_DARKVIOLET ) ) );
+    Insert( new XColorEntry( Color( 0xff, 0x80, 0x80 ), SVX_RESSTR( RID_SVXSTR_COLOR_SALMON ) ) );
+    Insert( new XColorEntry( Color( 0x00, 0x66, 0xcc ), SVX_RESSTR( RID_SVXSTR_COLOR_SEABLUE ) ) );
+
+    // <!-- add Chart colors from original palette (also 12, coincidence?) -->
+    XubString aStrChart( SVX_RESSTR( RID_SVXSTR_COLOR_CHART ) );
+    aStrChart.AppendAscii(" 1");
+    Insert( new XColorEntry( Color( 0x00, 0x45, 0x86 ), aStrChart ) );
+    aStrChart.SetChar(aStrChart.Len() - 1, sal_Unicode('2'));
+    Insert( new XColorEntry( Color( 0xff, 0x42, 0x0e ), aStrChart ) );
+    aStrChart.SetChar(aStrChart.Len() - 1, sal_Unicode('3'));
+    Insert( new XColorEntry( Color( 0xff, 0xd3, 0x20 ), aStrChart ) );
+    aStrChart.SetChar(aStrChart.Len() - 1, sal_Unicode('4'));
+    Insert( new XColorEntry( Color( 0x57, 0x9d, 0x1c ), aStrChart ) );
+    aStrChart.SetChar(aStrChart.Len() - 1, sal_Unicode('5'));
+    Insert( new XColorEntry( Color( 0x7e, 0x00, 0x21 ), aStrChart ) );
+    aStrChart.SetChar(aStrChart.Len() - 1, sal_Unicode('6'));
+    Insert( new XColorEntry( Color( 0x83, 0xca, 0xff ), aStrChart ) );
+    aStrChart.SetChar(aStrChart.Len() - 1, sal_Unicode('7'));
+    Insert( new XColorEntry( Color( 0x31, 0x40, 0x04 ), aStrChart ) );
+    aStrChart.SetChar(aStrChart.Len() - 1, sal_Unicode('8'));
+    Insert( new XColorEntry( Color( 0xae, 0xcf, 0x00 ), aStrChart ) );
+    aStrChart.SetChar(aStrChart.Len() - 1, sal_Unicode('9'));
+    Insert( new XColorEntry( Color( 0x4b, 0x1f, 0x6f ), aStrChart ) );
+    aStrChart.SetChar(aStrChart.Len() - 1, sal_Unicode('1'));
+    aStrChart.AppendAscii("0");
+    Insert( new XColorEntry( Color( 0xff, 0x95, 0x0e ), aStrChart ) );
+    aStrChart.SetChar(aStrChart.Len() - 1, sal_Unicode('1'));
+    Insert( new XColorEntry( Color( 0xc5, 0x00, 0x0b ), aStrChart ) );
+    aStrChart.SetChar(aStrChart.Len() - 1, sal_Unicode('2'));
+    Insert( new XColorEntry( Color( 0x00, 0x84, 0xd1 ), aStrChart ) );
 
-	aStr = SVX_RESSTR( RID_SVXSTR_GREY );
-	aStr.AppendAscii(" 80%");
-	nLen = aStr.Len() - 3;
-	Insert( new XColorEntry( Color( 51, 51, 51 ), aStr ) , 16);
-	aStr.SetChar(nLen, sal_Unicode('7'));
-	Insert( new XColorEntry( Color( 76, 76, 76 ), aStr ) , 17);
-	aStr.SetChar(nLen, sal_Unicode('6'));
-	Insert( new XColorEntry( Color(102,102,102 ), aStr ) , 18);
-	aStr.SetChar(nLen, sal_Unicode('4'));
-	Insert( new XColorEntry( Color(153,153,153 ), aStr ) , 19);
-	aStr.SetChar(nLen, sal_Unicode('3'));
-	Insert( new XColorEntry( Color(179,179,179 ), aStr ) , 20);
-	aStr.SetChar(nLen, sal_Unicode('2'));
-	Insert( new XColorEntry( Color(204,204,204 ), aStr ) , 21);
-	// BM: new 15%
-	aStr.SetChar(nLen, sal_Unicode('1'));
-	aStr.SetChar(nLen + 1, sal_Unicode('5'));
-	Insert( new XColorEntry( Color(217,217,217 ), aStr ) , 22);
-	aStr.SetChar(nLen + 1, sal_Unicode('0'));
-	Insert( new XColorEntry( Color(230,230,230 ), aStr ) , 23);
-	Insert( new XColorEntry( Color(230,230,255 ), SVX_RESSTR( RID_SVXSTR_BLUEGREY ) ) , 24);
-
-	aStr = SVX_RESSTR( RID_SVXSTR_RED );
-	aStr.AppendAscii(" 1");
-	nLen = aStr.Len() - 1;
-	Insert( new XColorEntry( Color(255, 51,102 ), aStr ) , 25);
-	aStr.SetChar(nLen, sal_Unicode('2'));
-	Insert( new XColorEntry( Color(220, 35,  0 ), aStr ) , 26);
-	aStr.SetChar(nLen, sal_Unicode('3'));
-	Insert( new XColorEntry( Color(184, 71,  0 ), aStr ) , 27);
-	aStr.SetChar(nLen, sal_Unicode('4'));
-	Insert( new XColorEntry( Color(255, 51, 51 ), aStr ) , 28);
-	aStr.SetChar(nLen, sal_Unicode('5'));
-	Insert( new XColorEntry( Color(235, 97, 61 ), aStr ) , 29);
-	aStr.SetChar(nLen, sal_Unicode('6'));
-	Insert( new XColorEntry( Color(184, 71, 71 ), aStr ) , 30);
-	aStr.SetChar(nLen, sal_Unicode('7'));
-	Insert( new XColorEntry( Color(184,  0, 71 ), aStr ) , 31);
-	aStr.SetChar(nLen, sal_Unicode('8'));
-	Insert( new XColorEntry( Color(153, 40, 76 ), aStr ) , 32);
-
-	aStr = SVX_RESSTR( RID_SVXSTR_MAGENTA );
-	aStr.AppendAscii(" 1");
-	nLen = aStr.Len() - 1;
-	Insert( new XColorEntry( Color(148,  0,107 ), aStr ) , 33);
-	aStr.SetChar(nLen, sal_Unicode('2'));
-	Insert( new XColorEntry( Color(148, 71,107 ), aStr ) , 34);
-	aStr.SetChar(nLen, sal_Unicode('3'));
-	Insert( new XColorEntry( Color(148, 71,148 ), aStr ) , 35);
-	aStr.SetChar(nLen, sal_Unicode('4'));
-	Insert( new XColorEntry( Color(153,102,204 ), aStr ) , 36);
-	aStr.SetChar(nLen, sal_Unicode('5'));
-	Insert( new XColorEntry( Color(107, 71,148 ), aStr ) , 37);
-	aStr.SetChar(nLen, sal_Unicode('6'));
-	Insert( new XColorEntry( Color(107, 35,148 ), aStr ) , 38);
-	aStr.SetChar(nLen, sal_Unicode('7'));
-	Insert( new XColorEntry( Color(107,  0,148 ), aStr ) , 39);
-	aStr.SetChar(nLen, sal_Unicode('8'));
-	Insert( new XColorEntry( Color( 94, 17,166 ), aStr ) , 40);
-
-	aStr = SVX_RESSTR( RID_SVXSTR_BLUE );
-	aStr.AppendAscii(" 1");
-	nLen = aStr.Len() - 1;
-	Insert( new XColorEntry( Color( 40,  0,153 ), aStr ) , 41);
-	aStr.SetChar(nLen, sal_Unicode('2'));
-	Insert( new XColorEntry( Color( 71,  0,184 ), aStr ) , 42);
-	aStr.SetChar(nLen, sal_Unicode('3'));
-	Insert( new XColorEntry( Color( 35,  0,220 ), aStr ) , 43);
-	aStr.SetChar(nLen, sal_Unicode('4'));
-	Insert( new XColorEntry( Color( 35, 35,220 ), aStr ) , 44);
-	aStr.SetChar(nLen, sal_Unicode('5'));
-	Insert( new XColorEntry( Color(  0, 71,255 ), aStr ) , 45);
-	aStr.SetChar(nLen, sal_Unicode('6'));
-	Insert( new XColorEntry( Color(  0,153,255 ), aStr ) , 46);
-	aStr.SetChar(nLen, sal_Unicode('7'));
-	Insert( new XColorEntry( Color(  0,184,255 ), aStr ) , 47);
-	aStr.SetChar(nLen, sal_Unicode('8'));
-	Insert( new XColorEntry( Color(153,204,255 ), aStr ) , 48);
-	//Insert(48, new XColorEntry( Color( 46,215,255 ), aStr ) );
-
-	aStr = SVX_RESSTR( RID_SVXSTR_CYAN );
-	aStr.AppendAscii(" 1");
-	nLen = aStr.Len() - 1;
-	Insert( new XColorEntry( Color(  0,220,255 ), aStr ) , 49);
-	aStr.SetChar(nLen, sal_Unicode('2'));
-	Insert( new XColorEntry( Color(  0,204,204 ), aStr ) , 50);
-	aStr.SetChar(nLen, sal_Unicode('3'));
-	Insert( new XColorEntry( Color( 35,184,220 ), aStr ) , 51);
-	aStr.SetChar(nLen, sal_Unicode('4'));
-	Insert( new XColorEntry( Color( 71,184,184 ), aStr ) , 52);
-	aStr.SetChar(nLen, sal_Unicode('5'));
-	Insert( new XColorEntry( Color( 51,163,163 ), aStr ) , 53);
-	aStr.SetChar(nLen, sal_Unicode('6'));
-	Insert( new XColorEntry( Color( 25,138,138 ), aStr ) , 54);
-	aStr.SetChar(nLen, sal_Unicode('7'));
-	Insert( new XColorEntry( Color(  0,107,107 ), aStr ) , 55);
-	aStr.SetChar(nLen, sal_Unicode('8'));
-	Insert( new XColorEntry( Color(  0, 74, 74 ), aStr ) , 56);
-
-	aStr = SVX_RESSTR( RID_SVXSTR_GREEN );
-	aStr.AppendAscii(" 1");
-	nLen = aStr.Len() - 1;
-	Insert( new XColorEntry( Color( 53, 94,  0 ), aStr ) , 57);
-	aStr.SetChar(nLen, sal_Unicode('2'));
-	Insert( new XColorEntry( Color( 92,133, 38 ), aStr ) , 58);
-	aStr.SetChar(nLen, sal_Unicode('3'));
-	Insert( new XColorEntry( Color(125,166, 71 ), aStr ) , 59);
-	aStr.SetChar(nLen, sal_Unicode('4'));
-	Insert( new XColorEntry( Color(148,189, 94 ), aStr ) , 60);
-	aStr.SetChar(nLen, sal_Unicode('5'));
-	Insert( new XColorEntry( Color(  0,174,  0 ), aStr ) , 61);
-	aStr.SetChar(nLen, sal_Unicode('6'));
-	Insert( new XColorEntry( Color( 51,204,102 ), aStr ) , 62);
-	aStr.SetChar(nLen, sal_Unicode('7'));
-	Insert( new XColorEntry( Color( 61,235, 61 ), aStr ) , 63);
-	aStr.SetChar(nLen, sal_Unicode('8'));
-	Insert( new XColorEntry( Color( 35,255, 35 ), aStr ) , 64);
-
-	aStr = SVX_RESSTR( RID_SVXSTR_YELLOW );
-	aStr.AppendAscii(" 1");
-	nLen = aStr.Len() - 1;
-	Insert( new XColorEntry( Color(230,255,  0 ), aStr ) , 65);
-	aStr.SetChar(nLen, sal_Unicode('2'));
-	Insert( new XColorEntry( Color(255,255,153 ), aStr ) , 66);
-	aStr.SetChar(nLen, sal_Unicode('3'));
-	Insert( new XColorEntry( Color(255,255,102 ), aStr ) , 67);
-	aStr.SetChar(nLen, sal_Unicode('4'));
-	Insert( new XColorEntry( Color(230,230, 76 ), aStr ) , 68);
-	aStr.SetChar(nLen, sal_Unicode('5'));
-	Insert( new XColorEntry( Color(204,204,  0 ), aStr ) , 69);
-	aStr.SetChar(nLen, sal_Unicode('6'));
-	Insert( new XColorEntry( Color(179,179,  0 ), aStr ) , 70);
-	aStr.SetChar(nLen, sal_Unicode('7'));
-	Insert( new XColorEntry( Color(128,128, 25 ), aStr ) , 71);
-	aStr.SetChar(nLen, sal_Unicode('8'));
-	Insert( new XColorEntry( Color(102,102,  0 ), aStr ) , 72);
-
-	aStr = SVX_RESSTR( RID_SVXSTR_BROWN );
-	aStr.AppendAscii(" 1");
-	nLen = aStr.Len() - 1;
-	Insert( new XColorEntry( Color( 76, 25,  0 ), aStr ) , 73);
-	aStr.SetChar(nLen, sal_Unicode('2'));
-	Insert( new XColorEntry( Color(102, 51,  0 ), aStr ) , 74);
-	aStr.SetChar(nLen, sal_Unicode('3'));
-	Insert( new XColorEntry( Color(128, 76, 25 ), aStr ) , 75);
-	aStr.SetChar(nLen, sal_Unicode('4'));
-	Insert( new XColorEntry( Color(153,102, 51 ), aStr ) , 76);
-
-	aStr = SVX_RESSTR( RID_SVXSTR_ORANGE );
-	aStr.AppendAscii(" 1");
-	nLen = aStr.Len() - 1;
-	Insert( new XColorEntry( Color(204,102, 51 ), aStr ) , 77);
-	aStr.SetChar(nLen, sal_Unicode('2'));
-	Insert( new XColorEntry( Color(255,102, 51 ), aStr ) , 78);
-	aStr.SetChar(nLen, sal_Unicode('3'));
-	Insert( new XColorEntry( Color(255,153,102 ), aStr ) , 79);
-	aStr.SetChar(nLen, sal_Unicode('4'));
-	Insert( new XColorEntry( Color(255,204,153 ), aStr ) , 80);
-
-	// new chart colors
-	aStr = SVX_RESSTR( RID_SVXSTR_VIOLET );
-	Insert( new XColorEntry( Color( 0x99, 0x99, 0xff ), aStr ) , 81);
-
-	aStr = SVX_RESSTR( RID_SVXSTR_BORDEAUX );
-	Insert( new XColorEntry( Color( 0x99, 0x33, 0x66 ), aStr ) , 82);
-
-	aStr = SVX_RESSTR( RID_SVXSTR_PALE_YELLOW );
-	Insert( new XColorEntry( Color( 0xff, 0xff, 0xcc ), aStr ) , 83);
-
-	aStr = SVX_RESSTR( RID_SVXSTR_PALE_GREEN );
-	Insert( new XColorEntry( Color( 0xcc, 0xff, 0xff ), aStr ) , 84);
-
-	aStr = SVX_RESSTR( RID_SVXSTR_DKVIOLET );
-	Insert( new XColorEntry( Color( 0x66, 0x00, 0x66 ), aStr ) , 85);
-
-	aStr = SVX_RESSTR( RID_SVXSTR_SALMON );
-	Insert( new XColorEntry( Color( 0xff, 0x80, 0x80 ), aStr ) , 86);
-
-	aStr = SVX_RESSTR( RID_SVXSTR_SEABLUE );
-	Insert( new XColorEntry( Color( 0x00, 0x66, 0xcc ), aStr ) , 87);
-
-	// Sun colors
-	aStr = SVX_RESSTR( RID_SVXSTR_COLOR_SUN );
-	aStr.AppendAscii(" 1");
-	nLen = aStr.Len() - 1;
-	Insert( new XColorEntry( Color( 0x33, 0x33, 0x66 ), aStr ) , 88);
-	aStr.SetChar(nLen, sal_Unicode('2'));
-	Insert( new XColorEntry( Color( 0x66, 0x66, 0x99 ), aStr ) , 89);
-	aStr.SetChar(nLen, sal_Unicode('3'));
-	Insert( new XColorEntry( Color( 0x99, 0x99, 0xcc ), aStr ) , 90);
-	aStr.SetChar(nLen, sal_Unicode('4'));
-	Insert( new XColorEntry( Color( 0xcc, 0xcc, 0xff ), aStr ) , 91);
-
-    // Chart default colors
-    aStr = SVX_RESSTR( RID_SVXSTR_COLOR_CHART );
-    aStr.AppendAscii(" 1");
-    nLen = aStr.Len() - 1;
-    Insert( new XColorEntry( Color( 0x00, 0x45, 0x86 ), aStr ) , 92);
-    aStr.SetChar(nLen, sal_Unicode('2'));
-    Insert( new XColorEntry( Color( 0xff, 0x42, 0x0e ), aStr ) , 93);
-    aStr.SetChar(nLen, sal_Unicode('3'));
-    Insert( new XColorEntry( Color( 0xff, 0xd3, 0x20 ), aStr ) , 94);
-    aStr.SetChar(nLen, sal_Unicode('4'));
-    Insert( new XColorEntry( Color( 0x57, 0x9d, 0x1c ), aStr ) , 95);
-    aStr.SetChar(nLen, sal_Unicode('5'));
-    Insert( new XColorEntry( Color( 0x7e, 0x00, 0x21 ), aStr ) , 96);
-    aStr.SetChar(nLen, sal_Unicode('6'));
-    Insert( new XColorEntry( Color( 0x83, 0xca, 0xff ), aStr ) , 97);
-    aStr.SetChar(nLen, sal_Unicode('7'));
-    Insert( new XColorEntry( Color( 0x31, 0x40, 0x04 ), aStr ) , 98);
-    aStr.SetChar(nLen, sal_Unicode('8'));
-    Insert( new XColorEntry( Color( 0xae, 0xcf, 0x00 ), aStr ) , 99);
-    aStr.SetChar(nLen, sal_Unicode('9'));
-    Insert( new XColorEntry( Color( 0x4b, 0x1f, 0x6f ), aStr ) , 100);
-    aStr.SetChar(nLen, sal_Unicode('1'));
-    aStr.AppendAscii("0");
-    nLen = aStr.Len() - 1;
-    Insert( new XColorEntry( Color( 0xff, 0x95, 0x0e ), aStr ) , 101);
-    aStr.SetChar(nLen, sal_Unicode('1'));
-    Insert( new XColorEntry( Color( 0xc5, 0x00, 0x0b ), aStr ) , 102);
-    aStr.SetChar(nLen, sal_Unicode('2'));
-    Insert( new XColorEntry( Color( 0x00, 0x84, 0xd1 ), aStr ) , 103);
-
-	return( Count() == 104 );
+    return(165 == Count());
 }
 
 /************************************************************************/
@@ -440,11 +282,14 @@ Bitmap XColorList::CreateBitmapForUI( lo
 
 /************************************************************************/
 
-XColorList* XColorList::GetStdColorList()
+XColorListSharedPtr XColorList::GetStdColorList()
 {
-	if ( !pStaticGlobalColorList )
-		pStaticGlobalColorList = new XColorList( SvtPathOptions().GetPalettePath() );
-	return pStaticGlobalColorList;
+    if ( !aStaticGlobalColorList.get() )
+    {
+        aStaticGlobalColorList = XPropertyListFactory::CreateSharedXColorList(SvtPathOptions().GetPalettePath());
+    }
+
+    return aStaticGlobalColorList;
 }
 
 // eof

Modified: openoffice/branches/ia2/main/svx/source/xoutdev/xtabdash.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ia2/main/svx/source/xoutdev/xtabdash.cxx?rev=1484083&r1=1484082&r2=1484083&view=diff
==============================================================================
--- openoffice/branches/ia2/main/svx/source/xoutdev/xtabdash.cxx (original)
+++ openoffice/branches/ia2/main/svx/source/xoutdev/xtabdash.cxx Sat May 18 10:12:43 2013
@@ -19,46 +19,25 @@
  * 
  *************************************************************/
 
-
-
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_svx.hxx"
 
 // include ---------------------------------------------------------------
-
-#ifndef SVX_LIGHT
-
 #include <com/sun/star/container/XNameContainer.hpp>
 #include "svx/XPropertyTable.hxx"
 #include <unotools/ucbstreamhelper.hxx>
-
 #include "xmlxtexp.hxx"
 #include "xmlxtimp.hxx"
-
-#endif
 #include <vcl/svapp.hxx>
-
 #include <tools/urlobj.hxx>
 #include <vcl/virdev.hxx>
-#include <vcl/window.hxx>
-#include <svl/itemset.hxx>
-#include <sfx2/docfile.hxx>
 #include <svx/dialogs.hrc>
 #include <svx/dialmgr.hxx>
 #include <svx/xtable.hxx>
-#include <svx/xpool.hxx>
-#include <svx/xlineit0.hxx>
-#include <svx/xlnclit.hxx>
-#include <svx/xlnwtit.hxx>
-#include <svx/xlndsit.hxx>
-#include <svx/xflclit.hxx>
-
-#include <svx/svdorect.hxx>
-#include <svx/svdopath.hxx>
-#include <svx/svdmodel.hxx>
-#include <svx/sdr/contact/objectcontactofobjlistpainter.hxx>
-#include <svx/sdr/contact/displayinfo.hxx>
-#include <basegfx/polygon/b2dpolygon.hxx>
+#include <drawinglayer/attribute/lineattribute.hxx>
+#include <drawinglayer/attribute/strokeattribute.hxx>
+#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
+#include <drawinglayer/processor2d/processor2dtools.hxx>
 
 using namespace com::sun::star;
 using namespace rtl;
@@ -66,109 +45,16 @@ using namespace rtl;
 #define GLOBALOVERFLOW
 
 sal_Unicode const pszExtDash[] 	= {'s','o','d'};
-char const aChckDash[]  = { 0x04, 0x00, 'S','O','D','L'};	// < 5.2
-char const aChckDash0[] = { 0x04, 0x00, 'S','O','D','0'};	// = 5.2
-char const aChckXML[]   = { '<', '?', 'x', 'm', 'l' };		// = 6.0
+//char const aChckDash[]  = { 0x04, 0x00, 'S','O','D','L'};	// < 5.2
+//char const aChckDash0[] = { 0x04, 0x00, 'S','O','D','0'};	// = 5.2
+//char const aChckXML[]   = { '<', '?', 'x', 'm', 'l' };		// = 6.0
 
 // ----------------
 // class XDashList
 // ----------------
 
-class impXDashList
-{
-private:
-	VirtualDevice*          mpVirtualDevice;
-	SdrModel*				mpSdrModel;
-	SdrObject*			    mpBackgroundObject;
-	SdrObject*			    mpLineObject;
-
-public:
-    impXDashList(VirtualDevice* pV, SdrModel* pM, SdrObject* pB, SdrObject* pL)
-    :   mpVirtualDevice(pV),
-        mpSdrModel(pM),
-        mpBackgroundObject(pB),
-        mpLineObject(pL)
-    {}
-
-    ~impXDashList()
-    {
-        delete mpVirtualDevice;
-        SdrObject::Free(mpBackgroundObject);
-        SdrObject::Free(mpLineObject);
-        delete mpSdrModel;
-    }
-
-    VirtualDevice* getVirtualDevice() const { return mpVirtualDevice; }
-    SdrObject* getBackgroundObject() const { return mpBackgroundObject; }
-    SdrObject* getLineObject() const { return mpLineObject; }
-};
-
-// to avoid rendering trouble (e.g. vcl renderer) and to get better AAed quality,
-// use double prerender size
-static bool bUseDoubleSize = true;
-
-void XDashList::impCreate()
-{
-    if(!mpData)
-    {
-    	const Point aZero(0, 0);
-		const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
-
-        VirtualDevice* pVirDev = new VirtualDevice;
-		OSL_ENSURE(0 != pVirDev, "XDashList: no VirtualDevice created!" );
-		pVirDev->SetMapMode(MAP_100TH_MM);
-        const Size& rSize = rStyleSettings.GetListBoxPreviewDefaultPixelSize();
-		const Size aSize(pVirDev->PixelToLogic(Size(
-            bUseDoubleSize ? rSize.Width() * 5 : rSize.Width() * 5 / 2, 
-            bUseDoubleSize ? rSize.Height() * 2 : rSize.Height())));
-		pVirDev->SetOutputSize(aSize);
-        pVirDev->SetDrawMode(rStyleSettings.GetHighContrastMode()
-            ? DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT
-            : DRAWMODE_DEFAULT);
-        pVirDev->SetBackground(rStyleSettings.GetFieldColor());
-
-        SdrModel* pSdrModel = new SdrModel();
-		OSL_ENSURE(0 != pSdrModel, "XDashList: no SdrModel created!" );
-	    pSdrModel->GetItemPool().FreezeIdRanges();
-
-        const Rectangle aBackgroundSize(aZero, aSize);
-        SdrObject* pBackgroundObject = new SdrRectObj(aBackgroundSize);
-		OSL_ENSURE(0 != pBackgroundObject, "XDashList: no BackgroundObject created!" );
-    	pBackgroundObject->SetModel(pSdrModel);
-        pBackgroundObject->SetMergedItem(XFillStyleItem(XFILL_SOLID));
-        pBackgroundObject->SetMergedItem(XLineStyleItem(XLINE_NONE));
-        pBackgroundObject->SetMergedItem(XFillColorItem(String(), rStyleSettings.GetFieldColor()));
-
-        const sal_uInt32 nHalfHeight(aSize.Height() / 2);
-        const basegfx::B2DPoint aStart(0, nHalfHeight);
-        const basegfx::B2DPoint aEnd(aSize.Width(), nHalfHeight);
-	    basegfx::B2DPolygon aPolygon;
-	    aPolygon.append(aStart);
-	    aPolygon.append(aEnd);
-	    SdrObject* pLineObject = new SdrPathObj(OBJ_LINE, basegfx::B2DPolyPolygon(aPolygon));
-		OSL_ENSURE(0 != pLineObject, "XDashList: no LineObject created!" );
-    	pLineObject->SetModel(pSdrModel);
-        pLineObject->SetMergedItem(XLineStyleItem(XLINE_DASH));
-        pLineObject->SetMergedItem(XLineColorItem(String(), rStyleSettings.GetFieldTextColor()));
-		const Size aLineWidth(pVirDev->PixelToLogic(Size(rStyleSettings.GetListBoxPreviewDefaultLineWidth(), 0)));
-        pLineObject->SetMergedItem(XLineWidthItem(bUseDoubleSize ? aLineWidth.getWidth() * 2 : aLineWidth.getWidth()));
-        mpData = new impXDashList(pVirDev, pSdrModel, pBackgroundObject, pLineObject);
-		OSL_ENSURE(0 != mpData, "XDashList: data creation went wrong!" );
-    }
-}
-
-void XDashList::impDestroy()
-{
-    if(mpData)
-    {
-        delete mpData;
-        mpData = 0;
-    }
-}
-
-XDashList::XDashList(const String& rPath, XOutdevItemPool* pInPool )
-:   XPropertyList(rPath, pInPool ),
-    mpData(0),
+XDashList::XDashList(const String& rPath )
+:   XPropertyList(rPath),
     maBitmapSolidLine(),
     maStringSolidLine(),
     maStringNoLine()
@@ -177,7 +63,6 @@ XDashList::XDashList(const String& rPath
 
 XDashList::~XDashList()
 {
-    impDestroy();
 }
 
 XDashEntry* XDashList::Replace(XDashEntry* pEntry, long nIndex )
@@ -187,15 +72,15 @@ XDashEntry* XDashList::Replace(XDashEntr
 
 XDashEntry* XDashList::Remove(long nIndex)
 {
-	return (XDashEntry*) XPropertyList::Remove(nIndex, 0);
+	return (XDashEntry*) XPropertyList::Remove(nIndex);
 }
 
 XDashEntry* XDashList::GetDash(long nIndex) const
 {
-	return (XDashEntry*) XPropertyList::Get(nIndex, 0);
+	return (XDashEntry*) XPropertyList::Get(nIndex);
 }
 
-sal_Bool XDashList::Load()
+bool XDashList::Load()
 {
 	if( mbListDirty )
 	{
@@ -205,8 +90,8 @@ sal_Bool XDashList::Load()
 
 		if( INET_PROT_NOT_VALID == aURL.GetProtocol() )
 		{
-			DBG_ASSERT( !maPath.Len(), "invalid URL" );
-			return sal_False;
+			OSL_ENSURE( !maPath.Len(), "invalid URL" );
+			return false;
 		}
 
 		aURL.Append( maName );
@@ -217,17 +102,18 @@ sal_Bool XDashList::Load()
 		uno::Reference< container::XNameContainer > xTable( SvxUnoXDashTable_createInstance( this ), uno::UNO_QUERY );
 		return SvxXMLXTableImport::load( aURL.GetMainURL( INetURLObject::NO_DECODE ), xTable );
 	}
-	return( sal_False );
+
+    return false;
 }
 
-sal_Bool XDashList::Save()
+bool XDashList::Save()
 {
 	INetURLObject aURL( maPath );
 
 	if( INET_PROT_NOT_VALID == aURL.GetProtocol() )
 	{
-		DBG_ASSERT( !maPath.Len(), "invalid URL" );
-		return sal_False;
+		OSL_ENSURE( !maPath.Len(), "invalid URL" );
+		return false;
 	}
 
 	aURL.Append( maName );
@@ -239,7 +125,7 @@ sal_Bool XDashList::Save()
 	return SvxXMLXTableExportComponent::save( aURL.GetMainURL( INetURLObject::NO_DECODE ), xTable );
 }
 
-sal_Bool XDashList::Create()
+bool XDashList::Create()
 {
 	XubString aStr( SVX_RES( RID_SVXSTR_LINESTYLE ) );
 	xub_StrLen nLen;
@@ -252,52 +138,125 @@ sal_Bool XDashList::Create()
 	aStr.SetChar(nLen, sal_Unicode('3'));
 	Insert(new XDashEntry(XDash(XDASH_RECT,2, 50,3,250,120),aStr));
 
-	return( sal_True );
+	return true;
 }
 
 Bitmap XDashList::ImpCreateBitmapForXDash(const XDash* pDash)
 {
-    impCreate();
-    VirtualDevice* pVD = mpData->getVirtualDevice();
-    SdrObject* pLine = mpData->getLineObject();
+    const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
+    const Size& rSize = rStyleSettings.GetListBoxPreviewDefaultPixelSize();
+    const sal_uInt32 nFactor(2);
+    const Size aSize((rSize.Width() * 5 * 2) / 2, rSize.Height() * nFactor);
+
+    // prepare polygon geometry for line
+    basegfx::B2DPolygon aLine;
+
+    aLine.append(basegfx::B2DPoint(0.0, aSize.Height() / 2.0));
+    aLine.append(basegfx::B2DPoint(aSize.Width(), aSize.Height() / 2.0));
+
+    // prepare LineAttribute
+    const basegfx::BColor aLineColor(rStyleSettings.GetFieldTextColor().getBColor());
+    const double fLineWidth(rStyleSettings.GetListBoxPreviewDefaultLineWidth() * (nFactor * 1.1));
+    const drawinglayer::attribute::LineAttribute aLineAttribute(
+        aLineColor,
+        fLineWidth);
+
+    // prepare StrokeAttribute
+    ::std::vector< double > aDotDashArray;
+    double fFullDotDashLen(0.0);
+
+    if(pDash && (pDash->GetDots() || pDash->GetDashes()))
+    {
+        const basegfx::B2DHomMatrix aScaleMatrix(OutputDevice::LogicToLogic(MAP_100TH_MM, MAP_PIXEL));
+        const basegfx::B2DVector aScaleVector(aScaleMatrix * basegfx::B2DVector(1.0, 0.0));
+        const double fScaleValue(aScaleVector.getLength() * (nFactor * (1.4 / 2.0)));
+        const double fLineWidthInUnits(fLineWidth / fScaleValue);
+
+        fFullDotDashLen = pDash->CreateDotDashArray(aDotDashArray, fLineWidthInUnits);
+
+        if(!aDotDashArray.empty())
+        {
+            for(sal_uInt32 a(0); a < aDotDashArray.size(); a++)
+            {
+                aDotDashArray[a] *= fScaleValue;
+            }
+
+            fFullDotDashLen *= fScaleValue;
+        }
+    }
+
+    const drawinglayer::attribute::StrokeAttribute aStrokeAttribute(
+        aDotDashArray,
+        fFullDotDashLen);
+
+    // cerate LinePrimitive
+    const drawinglayer::primitive2d::Primitive2DReference aLinePrimitive(
+        new drawinglayer::primitive2d::PolygonStrokePrimitive2D(
+            aLine,
+            aLineAttribute,
+            aStrokeAttribute));
+
+    // prepare VirtualDevice
+    VirtualDevice aVirtualDevice;
+    const drawinglayer::geometry::ViewInformation2D aNewViewInformation2D;
+
+    aVirtualDevice.SetOutputSizePixel(aSize);
+    aVirtualDevice.SetDrawMode(rStyleSettings.GetHighContrastMode()
+        ? DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT
+        : DRAWMODE_DEFAULT);
 
-    if(pDash)
+    if(rStyleSettings.GetPreviewUsesCheckeredBackground())
     {
-        pLine->SetMergedItem(XLineStyleItem(XLINE_DASH));
-        pLine->SetMergedItem(XLineDashItem(String(), *pDash));
+        const Point aNull(0, 0);
+        static const sal_uInt32 nLen(8 * nFactor);
+        static const Color aW(COL_WHITE);
+        static const Color aG(0xef, 0xef, 0xef);
+
+        aVirtualDevice.DrawCheckered(aNull, aSize, nLen, aW, aG);
     }
     else
     {
-        pLine->SetMergedItem(XLineStyleItem(XLINE_SOLID));
+        aVirtualDevice.SetBackground(rStyleSettings.GetFieldColor());
+        aVirtualDevice.Erase();
     }
 
-    sdr::contact::SdrObjectVector aObjectVector;
-	aObjectVector.push_back(mpData->getBackgroundObject());
-	aObjectVector.push_back(pLine);
-	sdr::contact::ObjectContactOfObjListPainter aPainter(*pVD, aObjectVector, 0);
-	sdr::contact::DisplayInfo aDisplayInfo;
-
-    pVD->Erase();
-	aPainter.ProcessDisplay(aDisplayInfo);
-
-    const Point aZero(0, 0);
-    Bitmap aResult(pVD->GetBitmap(aZero, pVD->GetOutputSize()));
-    
-    if(bUseDoubleSize)
+    // create processor and draw primitives
+    drawinglayer::processor2d::BaseProcessor2D* pProcessor2D = drawinglayer::processor2d::createPixelProcessor2DFromOutputDevice(
+        aVirtualDevice, 
+        aNewViewInformation2D);
+
+    if(pProcessor2D)
     {
-        const Size aCurrentSize(aResult.GetSizePixel());
+        const drawinglayer::primitive2d::Primitive2DSequence aSequence(&aLinePrimitive, 1);
+
+        pProcessor2D->process(aSequence);
+        delete pProcessor2D;
+    }
+
+    // get result bitmap and scale
+    Bitmap aRetval(aVirtualDevice.GetBitmap(Point(0, 0), aVirtualDevice.GetOutputSizePixel()));
 
-        aResult.Scale(Size(aCurrentSize.Width() / 2, aCurrentSize.Height() / 2), BMP_SCALE_FASTESTINTERPOLATE);
+    if(1 != nFactor)
+    {
+        aRetval.Scale(Size((rSize.Width() * 5) / 2, rSize.Height()), BMP_SCALE_FASTESTINTERPOLATE);
     }
 
-    return aResult;
+    return aRetval;
 }
 
 Bitmap XDashList::CreateBitmapForUI( long nIndex )
 {
-    const XDash& rDash = GetDash(nIndex)->GetDash();
+    Bitmap aRetval;
+    OSL_ENSURE(nIndex < Count(), "OOps, global values missing (!)");
+
+    if(nIndex < Count())
+    {
+        const XDash& rDash = GetDash(nIndex)->GetDash();
+
+        aRetval = ImpCreateBitmapForXDash(&rDash);
+    }
 
-    return ImpCreateBitmapForXDash(&rDash);
+    return aRetval;
 }
 
 Bitmap XDashList::GetBitmapForUISolidLine() const

Modified: openoffice/branches/ia2/main/svx/source/xoutdev/xtabgrdt.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ia2/main/svx/source/xoutdev/xtabgrdt.cxx?rev=1484083&r1=1484082&r2=1484083&view=diff
==============================================================================
--- openoffice/branches/ia2/main/svx/source/xoutdev/xtabgrdt.cxx (original)
+++ openoffice/branches/ia2/main/svx/source/xoutdev/xtabgrdt.cxx Sat May 18 10:12:43 2013
@@ -19,42 +19,26 @@
  * 
  *************************************************************/
 
-
-
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_svx.hxx"
 
 // include ---------------------------------------------------------------
-
-#ifndef SVX_LIGHT
-
 #include <com/sun/star/container/XNameContainer.hpp>
 #include "svx/XPropertyTable.hxx"
 #include <unotools/ucbstreamhelper.hxx>
-
 #include "xmlxtexp.hxx"
 #include "xmlxtimp.hxx"
-
-#endif
-
 #include <tools/urlobj.hxx>
 #include <vcl/virdev.hxx>
-#include <svl/itemset.hxx>
-#include <sfx2/docfile.hxx>
 #include <svx/dialogs.hrc>
 #include <svx/dialmgr.hxx>
 #include <svx/xtable.hxx>
-#include <svx/xpool.hxx>
-#include <svx/xfillit0.hxx>
-#include <svx/xflgrit.hxx>
-
-#include <svx/svdorect.hxx>
-#include <svx/svdmodel.hxx>
-#include <svx/sdr/contact/objectcontactofobjlistpainter.hxx>
-#include <svx/sdr/contact/displayinfo.hxx>
 #include <vcl/svapp.hxx>
-#include <svx/xlnclit.hxx>
-#include <svx/xgrscit.hxx>
+#include <drawinglayer/attribute/fillgradientattribute.hxx>
+#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
+#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
+#include <drawinglayer/processor2d/processor2dtools.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
 
 #define GLOBALOVERFLOW
 
@@ -62,99 +46,21 @@ using namespace com::sun::star;
 using namespace rtl;
 
 sal_Unicode const pszExtGradient[]	= {'s','o','g'};
-
-char const aChckGradient[]  = { 0x04, 0x00, 'S','O','G','L'};	// < 5.2
-char const aChckGradient0[] = { 0x04, 0x00, 'S','O','G','0'};	// = 5.2
-char const aChckXML[]       = { '<', '?', 'x', 'm', 'l' };		// = 6.0
+//char const aChckGradient[]  = { 0x04, 0x00, 'S','O','G','L'};	// < 5.2
+//char const aChckGradient0[] = { 0x04, 0x00, 'S','O','G','0'};	// = 5.2
+//char const aChckXML[]       = { '<', '?', 'x', 'm', 'l' };		// = 6.0
 
 // --------------------
 // class XGradientList
 // --------------------
 
-class impXGradientList
-{
-private:
-	VirtualDevice*          mpVirtualDevice;
-	SdrModel*				mpSdrModel;
-	SdrObject*			    mpBackgroundObject;
-
-public:
-    impXGradientList(VirtualDevice* pV, SdrModel* pM, SdrObject* pB)
-    :   mpVirtualDevice(pV),
-        mpSdrModel(pM),
-        mpBackgroundObject(pB)
-    {}
-
-    ~impXGradientList()
-    {
-        delete mpVirtualDevice;
-        SdrObject::Free(mpBackgroundObject);
-        delete mpSdrModel;
-    }
-
-    VirtualDevice* getVirtualDevice() const { return mpVirtualDevice; }
-    SdrObject* getBackgroundObject() const { return mpBackgroundObject; }
-};
-
-void XGradientList::impCreate()
-{
-    if(!mpData)
-    {
-    	const Point aZero(0, 0);
-		const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
-
-        VirtualDevice* pVirDev = new VirtualDevice;
-		OSL_ENSURE(0 != pVirDev, "XGradientList: no VirtualDevice created!" );
-		pVirDev->SetMapMode(MAP_100TH_MM);
-        const Size& rSize = rStyleSettings.GetListBoxPreviewDefaultPixelSize();
-		const Size aSize(pVirDev->PixelToLogic(rSize));
-		pVirDev->SetOutputSize(aSize);
-        pVirDev->SetDrawMode(rStyleSettings.GetHighContrastMode()
-            ? DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT
-            : DRAWMODE_DEFAULT);
-        pVirDev->SetBackground(rStyleSettings.GetFieldColor());
-
-	    SdrModel* pSdrModel = new SdrModel();
-		OSL_ENSURE(0 != pSdrModel, "XGradientList: no SdrModel created!" );
-	    pSdrModel->GetItemPool().FreezeIdRanges();
-
-        const Size aSinglePixel(pVirDev->PixelToLogic(Size(1, 1)));
-        const Rectangle aBackgroundSize(aZero, Size(aSize.getWidth() - aSinglePixel.getWidth(), aSize.getHeight() - aSinglePixel.getHeight()));
-        SdrObject* pBackgroundObject = new SdrRectObj(aBackgroundSize);
-		OSL_ENSURE(0 != pBackgroundObject, "XGradientList: no BackgroundObject created!" );
-    	pBackgroundObject->SetModel(pSdrModel);
-        pBackgroundObject->SetMergedItem(XFillStyleItem(XFILL_GRADIENT));
-        pBackgroundObject->SetMergedItem(XLineStyleItem(XLINE_SOLID));
-        pBackgroundObject->SetMergedItem(XLineColorItem(String(), Color(COL_BLACK)));
-        pBackgroundObject->SetMergedItem(XGradientStepCountItem(sal_uInt16((rSize.Width() + rSize.Height()) / 3)));
-
-        mpData = new impXGradientList(pVirDev, pSdrModel, pBackgroundObject);
-		OSL_ENSURE(0 != mpData, "XGradientList: data creation went wrong!" );
-    }
-}
-
-void XGradientList::impDestroy()
-{
-    if(mpData)
-    {
-        delete mpData;
-        mpData = 0;
-    }
-}
-
-XGradientList::XGradientList( const String& rPath, XOutdevItemPool* pInPool )
-:   XPropertyList(rPath, pInPool ),
-    mpData(0)
+XGradientList::XGradientList( const String& rPath )
+:   XPropertyList(rPath )
 {
 }
 
 XGradientList::~XGradientList()
 {
-    if(mpData)
-    {
-        delete mpData;
-        mpData = 0;
-    }
 }
 
 XGradientEntry* XGradientList::Replace(XGradientEntry* pEntry, long nIndex )
@@ -164,15 +70,15 @@ XGradientEntry* XGradientList::Replace(X
 
 XGradientEntry* XGradientList::Remove(long nIndex)
 {
-	return( (XGradientEntry*) XPropertyList::Remove( nIndex, 0 ) );
+	return( (XGradientEntry*) XPropertyList::Remove( nIndex ) );
 }
 
 XGradientEntry* XGradientList::GetGradient(long nIndex) const
 {
-	return( (XGradientEntry*) XPropertyList::Get( nIndex, 0 ) );
+	return( (XGradientEntry*) XPropertyList::Get( nIndex ) );
 }
 
-sal_Bool XGradientList::Load()
+bool XGradientList::Load()
 {
 	if( mbListDirty )
 	{
@@ -183,7 +89,7 @@ sal_Bool XGradientList::Load()
 		if( INET_PROT_NOT_VALID == aURL.GetProtocol() )
 		{
 			DBG_ASSERT( !maPath.Len(), "invalid URL" );
-			return sal_False;
+			return false;
 		}
 
 		aURL.Append( maName );
@@ -195,17 +101,18 @@ sal_Bool XGradientList::Load()
 		return SvxXMLXTableImport::load( aURL.GetMainURL( INetURLObject::NO_DECODE ), xTable );
 
 	}
-	return( sal_False );
+
+    return false;
 }
 
-sal_Bool XGradientList::Save()
+bool XGradientList::Save()
 {
 	INetURLObject aURL( maPath );
 
 	if( INET_PROT_NOT_VALID == aURL.GetProtocol() )
 	{
 		DBG_ASSERT( !maPath.Len(), "invalid URL" );
-		return sal_False;
+		return false;
 	}
 
 	aURL.Append( maName );
@@ -217,7 +124,7 @@ sal_Bool XGradientList::Save()
 	return SvxXMLXTableExportComponent::save( aURL.GetMainURL( INetURLObject::NO_DECODE ), xTable );
 }
 
-sal_Bool XGradientList::Create()
+bool XGradientList::Create()
 {
 	XubString aStr( SVX_RES( RID_SVXSTR_GRADIENT ) );
 	xub_StrLen nLen;
@@ -236,29 +143,131 @@ sal_Bool XGradientList::Create()
 	aStr.SetChar(nLen, sal_Unicode('6'));
 	Insert(new XGradientEntry(XGradient(RGB_Color(COL_MAGENTA),RGB_Color(COL_YELLOW ),XGRAD_RECT	  , 1900,60,60,50,100,100),aStr));
 
-	return( sal_True );
+	return true;
 }
 
-Bitmap XGradientList::CreateBitmapForUI( long nIndex )
+Bitmap XGradientList::CreateBitmapForUI(long nIndex)
 {
-    impCreate();
-    VirtualDevice* pVD = mpData->getVirtualDevice();
-    SdrObject* pBackgroundObject = mpData->getBackgroundObject();
+    Bitmap aRetval;
+    OSL_ENSURE(nIndex < Count(), "OOps, access out of range (!)");
+
+    if(nIndex < Count()) 
+    {
+        const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
+        const Size& rSize = rStyleSettings.GetListBoxPreviewDefaultPixelSize();
 
-	const SfxItemSet& rItemSet = pBackgroundObject->GetMergedItemSet();
-    pBackgroundObject->SetMergedItem(XFillStyleItem(XFILL_GRADIENT));
-    pBackgroundObject->SetMergedItem(XFillGradientItem(rItemSet.GetPool(), GetGradient(nIndex)->GetGradient()));
+        // prepare polygon geometry for rectangle
+        const basegfx::B2DPolygon aRectangle(
+            basegfx::tools::createPolygonFromRect(
+                basegfx::B2DRange(0.0, 0.0, rSize.Width(), rSize.Height())));
+
+        const XGradient& rGradient = GetGradient(nIndex)->GetGradient();
+        const sal_uInt16 nStartIntens(rGradient.GetStartIntens());
+        basegfx::BColor aStart(rGradient.GetStartColor().getBColor());
+
+        if(nStartIntens != 100)
+        {
+            const basegfx::BColor aBlack;
+            aStart = interpolate(aBlack, aStart, (double)nStartIntens * 0.01);
+        }
+
+        const sal_uInt16 nEndIntens(rGradient.GetEndIntens());
+        basegfx::BColor aEnd(rGradient.GetEndColor().getBColor());
+
+        if(nEndIntens != 100)
+        {
+            const basegfx::BColor aBlack;
+            aEnd = interpolate(aBlack, aEnd, (double)nEndIntens * 0.01);
+        }
+
+        drawinglayer::attribute::GradientStyle aGradientStyle(drawinglayer::attribute::GRADIENTSTYLE_RECT);
+
+        switch(rGradient.GetGradientStyle())
+        {
+            case XGRAD_LINEAR : 
+            {
+                aGradientStyle = drawinglayer::attribute::GRADIENTSTYLE_LINEAR;
+                break;
+            }
+            case XGRAD_AXIAL : 
+            {
+                aGradientStyle = drawinglayer::attribute::GRADIENTSTYLE_AXIAL;
+                break;
+            }
+            case XGRAD_RADIAL : 
+            {
+                aGradientStyle = drawinglayer::attribute::GRADIENTSTYLE_RADIAL;
+                break;
+            }
+            case XGRAD_ELLIPTICAL : 
+            {
+                aGradientStyle = drawinglayer::attribute::GRADIENTSTYLE_ELLIPTICAL;
+                break;
+            }
+            case XGRAD_SQUARE : 
+            {
+                aGradientStyle = drawinglayer::attribute::GRADIENTSTYLE_SQUARE; 
+                break;
+            }
+            default : 
+            {
+                aGradientStyle = drawinglayer::attribute::GRADIENTSTYLE_RECT; // XGRAD_RECT
+                break;
+            }
+        }
+
+        const sal_uInt16 nSteps((rSize.Width() + rSize.Height()) / 3);
+        const drawinglayer::attribute::FillGradientAttribute aFillGradient(
+            aGradientStyle,
+            (double)rGradient.GetBorder() * 0.01,
+            (double)rGradient.GetXOffset() * 0.01,
+            (double)rGradient.GetYOffset() * 0.01,
+            (double)rGradient.GetAngle() * F_PI1800,
+            aStart,
+            aEnd,
+            nSteps);
+
+        const drawinglayer::primitive2d::Primitive2DReference aGradientPrimitive(
+            new drawinglayer::primitive2d::PolyPolygonGradientPrimitive2D(
+                basegfx::B2DPolyPolygon(aRectangle),
+                aFillGradient));
+
+        const basegfx::BColor aBlack(0.0, 0.0, 0.0);
+        const drawinglayer::primitive2d::Primitive2DReference aBlackRectanglePrimitive(
+            new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(
+                aRectangle,
+                aBlack));
+
+        // prepare VirtualDevice
+        VirtualDevice aVirtualDevice;
+        const drawinglayer::geometry::ViewInformation2D aNewViewInformation2D;
 
-    sdr::contact::SdrObjectVector aObjectVector;
-	aObjectVector.push_back(pBackgroundObject);
-	sdr::contact::ObjectContactOfObjListPainter aPainter(*pVD, aObjectVector, 0);
-	sdr::contact::DisplayInfo aDisplayInfo;
+        aVirtualDevice.SetOutputSizePixel(rSize);
+        aVirtualDevice.SetDrawMode(rStyleSettings.GetHighContrastMode()
+            ? DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT
+            : DRAWMODE_DEFAULT);
 
-    pVD->Erase();
-	aPainter.ProcessDisplay(aDisplayInfo);
+        // create processor and draw primitives
+        drawinglayer::processor2d::BaseProcessor2D* pProcessor2D = drawinglayer::processor2d::createPixelProcessor2DFromOutputDevice(
+            aVirtualDevice, 
+            aNewViewInformation2D);
+
+        if(pProcessor2D)
+        {
+            drawinglayer::primitive2d::Primitive2DSequence aSequence(2);
+
+            aSequence[0] = aGradientPrimitive;
+            aSequence[1] = aBlackRectanglePrimitive;
+
+            pProcessor2D->process(aSequence);
+            delete pProcessor2D;
+        }
+
+        // get result bitmap and scale
+        aRetval = aVirtualDevice.GetBitmap(Point(0, 0), aVirtualDevice.GetOutputSizePixel());
+    }
 
-    const Point aZero(0, 0);
-	return pVD->GetBitmap(aZero, pVD->GetOutputSize());
+    return aRetval;
 }
 
 //////////////////////////////////////////////////////////////////////////////

Modified: openoffice/branches/ia2/main/svx/source/xoutdev/xtabhtch.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ia2/main/svx/source/xoutdev/xtabhtch.cxx?rev=1484083&r1=1484082&r2=1484083&view=diff
==============================================================================
--- openoffice/branches/ia2/main/svx/source/xoutdev/xtabhtch.cxx (original)
+++ openoffice/branches/ia2/main/svx/source/xoutdev/xtabhtch.cxx Sat May 18 10:12:43 2013
@@ -19,150 +19,46 @@
  * 
  *************************************************************/
 
-
-
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_svx.hxx"
 
 // include ---------------------------------------------------------------
-
-#ifndef SVX_LIGHT
-
 #include <com/sun/star/container/XNameContainer.hpp>
 #include "svx/XPropertyTable.hxx"
 #include <unotools/ucbstreamhelper.hxx>
 #include <vcl/svapp.hxx>
-
 #include "xmlxtexp.hxx"
 #include "xmlxtimp.hxx"
-
-#endif
-
 #include <tools/urlobj.hxx>
 #include <vcl/virdev.hxx>
-#include <svl/itemset.hxx>
-#include <sfx2/docfile.hxx>
 #include <svx/dialogs.hrc>
 #include <svx/dialmgr.hxx>
 #include <svx/xtable.hxx>
-#include <svx/xpool.hxx>
-#include "svx/dlgutil.hxx"
-#include <svx/xflhtit.hxx>
-#include <svx/xflclit.hxx>
-#include <svx/xfillit0.hxx>
-
-#include <svx/svdorect.hxx>
-#include <svx/svdmodel.hxx>
-#include <svx/sdr/contact/objectcontactofobjlistpainter.hxx>
-#include <svx/sdr/contact/displayinfo.hxx>
-#include <svx/xlnclit.hxx>
+#include <drawinglayer/attribute/fillhatchattribute.hxx>
+#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
+#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
+#include <drawinglayer/processor2d/processor2dtools.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
 
 using namespace ::com::sun::star;
 using namespace ::rtl;
 
 sal_Unicode const pszExtHatch[]	 = {'s','o','h'};
-
-char const aChckHatch[]  = { 0x04, 0x00, 'S','O','H','L'};	// < 5.2
-char const aChckHatch0[] = { 0x04, 0x00, 'S','O','H','0'};	// = 5.2
-char const aChckXML[]    = { '<', '?', 'x', 'm', 'l' };		// = 6.0
+//char const aChckHatch[]  = { 0x04, 0x00, 'S','O','H','L'};	// < 5.2
+//char const aChckHatch0[] = { 0x04, 0x00, 'S','O','H','0'};	// = 5.2
+//char const aChckXML[]    = { '<', '?', 'x', 'm', 'l' };		// = 6.0
 
 // -----------------
 // class XHatchList
 // -----------------
 
-class impXHatchList
-{
-private:
-	VirtualDevice*          mpVirtualDevice;
-	SdrModel*				mpSdrModel;
-	SdrObject*			    mpBackgroundObject;
-	SdrObject*			    mpHatchObject;
-
-public:
-    impXHatchList(VirtualDevice* pV, SdrModel* pM, SdrObject* pB, SdrObject* pH)
-    :   mpVirtualDevice(pV),
-        mpSdrModel(pM),
-        mpBackgroundObject(pB),
-        mpHatchObject(pH)
-    {}
-
-    ~impXHatchList()
-    {
-        delete mpVirtualDevice;
-        SdrObject::Free(mpBackgroundObject);
-        SdrObject::Free(mpHatchObject);
-        delete mpSdrModel;
-    }
-
-    VirtualDevice* getVirtualDevice() const { return mpVirtualDevice; }
-    SdrObject* getBackgroundObject() const { return mpBackgroundObject; }
-    SdrObject* getHatchObject() const { return mpHatchObject; }
-};
-
-void XHatchList::impCreate()
-{
-    if(!mpData)
-    {
-    	const Point aZero(0, 0);
-		const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
-
-        VirtualDevice* pVirDev = new VirtualDevice;
-		OSL_ENSURE(0 != pVirDev, "XDashList: no VirtualDevice created!" );
-		pVirDev->SetMapMode(MAP_100TH_MM);
-		const Size aSize(pVirDev->PixelToLogic(rStyleSettings.GetListBoxPreviewDefaultPixelSize()));
-		pVirDev->SetOutputSize(aSize);
-        pVirDev->SetDrawMode(rStyleSettings.GetHighContrastMode()
-            ? DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT
-            : DRAWMODE_DEFAULT);
-        pVirDev->SetBackground(rStyleSettings.GetFieldColor());
-
-        SdrModel* pSdrModel = new SdrModel();
-		OSL_ENSURE(0 != pSdrModel, "XDashList: no SdrModel created!" );
-	    pSdrModel->GetItemPool().FreezeIdRanges();
-
-        const Size aSinglePixel(pVirDev->PixelToLogic(Size(1, 1)));
-        const Rectangle aBackgroundSize(aZero, Size(aSize.getWidth() - aSinglePixel.getWidth(), aSize.getHeight() - aSinglePixel.getHeight()));
-        SdrObject* pBackgroundObject = new SdrRectObj(aBackgroundSize);
-		OSL_ENSURE(0 != pBackgroundObject, "XDashList: no BackgroundObject created!" );
-    	pBackgroundObject->SetModel(pSdrModel);
-        pBackgroundObject->SetMergedItem(XFillStyleItem(XFILL_SOLID));
-        pBackgroundObject->SetMergedItem(XFillColorItem(String(), rStyleSettings.GetFieldColor()));
-        pBackgroundObject->SetMergedItem(XLineStyleItem(XLINE_SOLID));
-        pBackgroundObject->SetMergedItem(XLineColorItem(String(), Color(COL_BLACK)));
-
-        SdrObject* pHatchObject = new SdrRectObj(aBackgroundSize);
-		OSL_ENSURE(0 != pHatchObject, "XDashList: no HatchObject created!" );
-    	pHatchObject->SetModel(pSdrModel);
-        pHatchObject->SetMergedItem(XFillStyleItem(XFILL_HATCH));
-        pHatchObject->SetMergedItem(XLineStyleItem(XLINE_NONE));
-
-        mpData = new impXHatchList(pVirDev, pSdrModel, pBackgroundObject, pHatchObject);
-		OSL_ENSURE(0 != mpData, "XDashList: data creation went wrong!" );
-    }
-}
-
-void XHatchList::impDestroy()
-{
-    if(mpData)
-    {
-        delete mpData;
-        mpData = 0;
-    }
-}
-
-XHatchList::XHatchList(const String& rPath, XOutdevItemPool* pInPool)
-:   XPropertyList(rPath, pInPool),
-    mpData(0)
+XHatchList::XHatchList(const String& rPath )
+:   XPropertyList(rPath)
 {
 }
 
 XHatchList::~XHatchList()
 {
-    if(mpData)
-    {
-        delete mpData;
-        mpData = 0;
-    }
 }
 
 XHatchEntry* XHatchList::Replace(XHatchEntry* pEntry, long nIndex )
@@ -172,15 +68,15 @@ XHatchEntry* XHatchList::Replace(XHatchE
 
 XHatchEntry* XHatchList::Remove(long nIndex)
 {
-	return (XHatchEntry*) XPropertyList::Remove(nIndex, 0);
+	return (XHatchEntry*) XPropertyList::Remove(nIndex);
 }
 
 XHatchEntry* XHatchList::GetHatch(long nIndex) const
 {
-	return (XHatchEntry*) XPropertyList::Get(nIndex, 0);
+	return (XHatchEntry*) XPropertyList::Get(nIndex);
 }
 
-sal_Bool XHatchList::Load()
+bool XHatchList::Load()
 {
 	if( mbListDirty )
 	{
@@ -190,8 +86,8 @@ sal_Bool XHatchList::Load()
 
 		if( INET_PROT_NOT_VALID == aURL.GetProtocol() )
 		{
-			DBG_ASSERT( !maPath.Len(), "invalid URL" );
-			return sal_False;
+			OSL_ENSURE( !maPath.Len(), "invalid URL" );
+			return false;
 		}
 
 		aURL.Append( maName );
@@ -202,17 +98,18 @@ sal_Bool XHatchList::Load()
 		uno::Reference< container::XNameContainer > xTable( SvxUnoXHatchTable_createInstance( this ), uno::UNO_QUERY );
 		return SvxXMLXTableImport::load( aURL.GetMainURL( INetURLObject::NO_DECODE ), xTable );
 	}
-	return( sal_False );
+
+    return false;
 }
 
-sal_Bool XHatchList::Save()
+bool XHatchList::Save()
 {
 	INetURLObject aURL( maPath );
 
 	if( INET_PROT_NOT_VALID == aURL.GetProtocol() )
 	{
-		DBG_ASSERT( !maPath.Len(), "invalid URL" );
-		return sal_False;
+		OSL_ENSURE( !maPath.Len(), "invalid URL" );
+		return false;
 	}
 
 	aURL.Append( maName );
@@ -224,7 +121,7 @@ sal_Bool XHatchList::Save()
 	return SvxXMLXTableExportComponent::save( aURL.GetMainURL( INetURLObject::NO_DECODE ), xTable );
 }
 
-sal_Bool XHatchList::Create()
+bool XHatchList::Create()
 {
 	XubString aStr( SVX_RES( RID_SVXSTR_HATCH ) );
 	xub_StrLen nLen;
@@ -237,29 +134,115 @@ sal_Bool XHatchList::Create()
 	aStr.SetChar(nLen, sal_Unicode('3'));
 	Insert(new XHatchEntry(XHatch(RGB_Color(COL_BLUE ),XHATCH_TRIPLE,120,  0),aStr));
 
-	return( sal_True );
+	return true;
 }
 
 Bitmap XHatchList::CreateBitmapForUI( long nIndex )
 {
-    impCreate();
-    VirtualDevice* pVD = mpData->getVirtualDevice();
-    SdrObject* pHatchObject = mpData->getHatchObject();
-
-    pHatchObject->SetMergedItem(XFillStyleItem(XFILL_HATCH));
-    pHatchObject->SetMergedItem(XFillHatchItem(String(), GetHatch(nIndex)->GetHatch()));
-
-    sdr::contact::SdrObjectVector aObjectVector;
-	aObjectVector.push_back(mpData->getBackgroundObject());
-	aObjectVector.push_back(pHatchObject);
-	sdr::contact::ObjectContactOfObjListPainter aPainter(*pVD, aObjectVector, 0);
-	sdr::contact::DisplayInfo aDisplayInfo;
+    Bitmap aRetval;
+    OSL_ENSURE(nIndex < Count(), "OOps, access out of range (!)");
+
+    if(nIndex < Count())
+    {
+        const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
+        const Size& rSize = rStyleSettings.GetListBoxPreviewDefaultPixelSize();
+
+        // prepare polygon geometry for rectangle
+        const basegfx::B2DPolygon aRectangle(
+            basegfx::tools::createPolygonFromRect(
+                basegfx::B2DRange(0.0, 0.0, rSize.Width(), rSize.Height())));
+
+        const XHatch& rHatch = GetHatch(nIndex)->GetHatch();
+        drawinglayer::attribute::HatchStyle aHatchStyle(drawinglayer::attribute::HATCHSTYLE_TRIPLE);
+
+        switch(rHatch.GetHatchStyle())
+        {
+            case XHATCH_SINGLE : 
+            {
+                aHatchStyle = drawinglayer::attribute::HATCHSTYLE_SINGLE; 
+                break;
+            }
+            case XHATCH_DOUBLE : 
+            {
+                aHatchStyle = drawinglayer::attribute::HATCHSTYLE_DOUBLE; 
+                break;
+            }
+            default : 
+            {
+                aHatchStyle = drawinglayer::attribute::HATCHSTYLE_TRIPLE; // XHATCH_TRIPLE
+                break;
+            }
+        }
+
+        const basegfx::B2DHomMatrix aScaleMatrix(OutputDevice::LogicToLogic(MAP_100TH_MM, MAP_PIXEL));
+        const basegfx::B2DVector aScaleVector(aScaleMatrix * basegfx::B2DVector(1.0, 0.0));
+        const double fScaleValue(aScaleVector.getLength());
+
+        const drawinglayer::attribute::FillHatchAttribute aFillHatch(
+            aHatchStyle,
+            (double)rHatch.GetDistance() * fScaleValue,
+            (double)rHatch.GetAngle() * F_PI1800,
+            rHatch.GetColor().getBColor(),
+            3, // same default as VCL, a minimum of three discrete units (pixels) offset
+            false);
+
+        const basegfx::BColor aBlack(0.0, 0.0, 0.0);
+        const drawinglayer::primitive2d::Primitive2DReference aHatchPrimitive(
+            new drawinglayer::primitive2d::PolyPolygonHatchPrimitive2D(
+                basegfx::B2DPolyPolygon(aRectangle),
+                aBlack,
+                aFillHatch));
+
+        const drawinglayer::primitive2d::Primitive2DReference aBlackRectanglePrimitive(
+            new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(
+                aRectangle,
+                aBlack));
+
+        // prepare VirtualDevice
+        VirtualDevice aVirtualDevice;
+        const drawinglayer::geometry::ViewInformation2D aNewViewInformation2D;
 
-    pVD->Erase();
-	aPainter.ProcessDisplay(aDisplayInfo);
+        aVirtualDevice.SetOutputSizePixel(rSize);
+        aVirtualDevice.SetDrawMode(rStyleSettings.GetHighContrastMode()
+            ? DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT
+            : DRAWMODE_DEFAULT);
+
+        if(rStyleSettings.GetPreviewUsesCheckeredBackground())
+        {
+            const Point aNull(0, 0);
+            static const sal_uInt32 nLen(8);
+            static const Color aW(COL_WHITE);
+            static const Color aG(0xef, 0xef, 0xef);
+
+            aVirtualDevice.DrawCheckered(aNull, rSize, nLen, aW, aG);
+        }
+        else
+        {
+            aVirtualDevice.SetBackground(rStyleSettings.GetFieldColor());
+            aVirtualDevice.Erase();
+        }
+
+        // create processor and draw primitives
+        drawinglayer::processor2d::BaseProcessor2D* pProcessor2D = drawinglayer::processor2d::createPixelProcessor2DFromOutputDevice(
+            aVirtualDevice, 
+            aNewViewInformation2D);
+
+        if(pProcessor2D)
+        {
+            drawinglayer::primitive2d::Primitive2DSequence aSequence(2);
+
+            aSequence[0] = aHatchPrimitive;
+            aSequence[1] = aBlackRectanglePrimitive;
+
+            pProcessor2D->process(aSequence);
+            delete pProcessor2D;
+        }
+
+        // get result bitmap and scale
+        aRetval = aVirtualDevice.GetBitmap(Point(0, 0), aVirtualDevice.GetOutputSizePixel());
+    }
 
-    const Point aZero(0, 0);
-	return pVD->GetBitmap(aZero, pVD->GetOutputSize());
+    return aRetval;
 }
 
 //////////////////////////////////////////////////////////////////////////////

Modified: openoffice/branches/ia2/main/svx/source/xoutdev/xtable.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ia2/main/svx/source/xoutdev/xtable.cxx?rev=1484083&r1=1484082&r2=1484083&view=diff
==============================================================================
--- openoffice/branches/ia2/main/svx/source/xoutdev/xtable.cxx (original)
+++ openoffice/branches/ia2/main/svx/source/xoutdev/xtable.cxx Sat May 18 10:12:43 2013
@@ -19,14 +19,11 @@
  * 
  *************************************************************/
 
-
-
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_svx.hxx"
 
 #include <svx/xtable.hxx>
 #include <svx/xpool.hxx>
-#include <svx/svdobj.hxx>
 #include <svx/svdpool.hxx>
 
 #define GLOBALOVERFLOW
@@ -43,115 +40,188 @@ Color RGB_Color( ColorData nColorName )
 	return aRGBColor;
 }
 
-// --------------------
+//////////////////////////////////////////////////////////////////////////////
+// class XColorEntry
+
+XColorEntry::XColorEntry(const Color& rColor, const String& rName)
+:   XPropertyEntry(rName), 
+    aColor(rColor) 
+{
+}
+
+XColorEntry::XColorEntry(const XColorEntry& rOther)
+:   XPropertyEntry(rOther), 
+aColor(rOther.aColor) 
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// class XLineEndEntry
+
+XLineEndEntry::XLineEndEntry(const basegfx::B2DPolyPolygon& rB2DPolyPolygon, const String& rName)
+:   XPropertyEntry(rName),
+    aB2DPolyPolygon(rB2DPolyPolygon)
+{
+}
+
+XLineEndEntry::XLineEndEntry(const XLineEndEntry& rOther)
+:   XPropertyEntry(rOther), 
+    aB2DPolyPolygon(rOther.aB2DPolyPolygon)
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// class XDashEntry
+
+XDashEntry::XDashEntry(const XDash& rDash, const String& rName)
+:   XPropertyEntry(rName), 
+    aDash(rDash) 
+{
+}
+
+XDashEntry::XDashEntry(const XDashEntry& rOther)
+:   XPropertyEntry(rOther), 
+aDash(rOther.aDash) 
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// class XHatchEntry
+
+XHatchEntry::XHatchEntry(const XHatch& rHatch, const String& rName)
+:   XPropertyEntry(rName), 
+    aHatch(rHatch) 
+{
+}
+
+XHatchEntry::XHatchEntry(const XHatchEntry& rOther)
+:   XPropertyEntry(rOther), 
+    aHatch(rOther.aHatch) 
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// class XGradientEntry
+
+XGradientEntry::XGradientEntry(const XGradient& rGradient, const String& rName)
+:   XPropertyEntry(rName), 
+    aGradient(rGradient) 
+{
+}
+
+XGradientEntry::XGradientEntry(const XGradientEntry& rOther)
+:   XPropertyEntry(rOther), 
+    aGradient(rOther.aGradient) 
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// class XBitmapEntry
+
+XBitmapEntry::XBitmapEntry(const GraphicObject& rGraphicObject, const String& rName)
+:   XPropertyEntry(rName), 
+    maGraphicObject(rGraphicObject) 
+{
+}
+
+XBitmapEntry::XBitmapEntry(const XBitmapEntry& rOther) 
+:   XPropertyEntry(rOther), 
+    maGraphicObject(rOther.maGraphicObject) 
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
 // class XPropertyList
-// --------------------
 
-XPropertyList::XPropertyList( const String& rPath, XOutdevItemPool* pInPool ) :
+XPropertyList::XPropertyList( const String& rPath ) :
 			maName			( pszStandard, 8 ),
 			maPath			( rPath ),
-			mpXPool			( pInPool ),
-			maList			( 16, 16 ),
+			maContent(),
 			mbListDirty		(true)
 {
-	if( !mpXPool )
-	{
-		mpXPool = static_cast< XOutdevItemPool* >(&SdrObject::GetGlobalDrawObjectItemPool());
-	}
 }
 
-/*************************************************************************
-|*
-|* XPropertyList::~XPropertyList()
-|*
-*************************************************************************/
-
 XPropertyList::~XPropertyList()
 {
-	XPropertyEntry* pEntry = (XPropertyEntry*)maList.First();
-	for( sal_uIntPtr nIndex = 0; nIndex < maList.Count(); nIndex++ )
-	{
-		delete pEntry;
-		pEntry = (XPropertyEntry*)maList.Next();
-	}
+    while(!maContent.empty())
+    {
+        delete maContent.back();
+        maContent.pop_back();
+    }
 }
 
-/*************************************************************************
-|*
-|* XPropertyList::Clear()
-|*
-*************************************************************************/
-
 void XPropertyList::Clear()
 {
-	maList.Clear();
+    while(!maContent.empty())
+    {
+        delete maContent.back();
+        maContent.pop_back();
+    }
 }
 
-/************************************************************************/
-
 long XPropertyList::Count() const
 {
-	if( mbListDirty )
-	{
-		// ( (XPropertyList*) this )->bListDirty = sal_False; <- im Load()
-		if( !( (XPropertyList*) this )->Load() )
-			( (XPropertyList*) this )->Create();
-	}
-	return( maList.Count() );
-}
+    if( mbListDirty )
+    {
+        if(!const_cast< XPropertyList* >(this)->Load())
+        {
+            const_cast< XPropertyList* >(this)->Create();
+        }
+    }
 
-/*************************************************************************
-|*
-|* XPropertyEntry* XPropertyList::Get()
-|*
-*************************************************************************/
+    return maContent.size();
+}
 
-XPropertyEntry* XPropertyList::Get( long nIndex, sal_uInt16 /*nDummy*/) const
+XPropertyEntry* XPropertyList::Get( long nIndex ) const
 {
-	if( mbListDirty )
-	{
-		// ( (XPropertyList*) this )->bListDirty = sal_False; <- im Load()
-		if( !( (XPropertyList*) this )->Load() )
-			( (XPropertyList*) this )->Create();
-	}
-	return (XPropertyEntry*) maList.GetObject( (sal_uIntPtr) nIndex );
-}
+    if( mbListDirty )
+    {
+        if(!const_cast< XPropertyList* >(this)->Load())
+        {
+            const_cast< XPropertyList* >(this)->Create();
+        }
+    }
 
-/*************************************************************************
-|*
-|* XPropertyList::Get()
-|*
-*************************************************************************/
+    const long nObjectCount(maContent.size());
 
-long XPropertyList::Get(const XubString& rName)
-{
-	if( mbListDirty )
-	{
-		//bListDirty = sal_False;
-		if( !Load() )
-			Create();
-	}
-	long nPos = 0;
-	XPropertyEntry* pEntry = (XPropertyEntry*)maList.First();
-	while (pEntry && pEntry->GetName() != rName)
-	{
-		nPos++;
-		pEntry = (XPropertyEntry*)maList.Next();
-	}
-	if (!pEntry) nPos = -1;
-	return nPos;
+    if(nIndex >= nObjectCount)
+    {
+        return 0;
+    }
+
+    return maContent[nIndex];
 }
 
-/*************************************************************************
-|*
-|* Bitmap* XPropertyList::GetBitmap()
-|*
-*************************************************************************/
+long XPropertyList::GetIndex(const XubString& rName) const
+{
+    if( mbListDirty )
+    {
+        if(!const_cast< XPropertyList* >(this)->Load())
+        {
+            const_cast< XPropertyList* >(this)->Create();
+        }
+    }
+
+    ::std::vector< XPropertyEntry* >::const_iterator aStart(maContent.begin());
+    const ::std::vector< XPropertyEntry* >::const_iterator aEnd(maContent.end());
+
+    for(long a(0); aStart != aEnd; a++, aStart++)
+    {
+        const XPropertyEntry* pEntry = *aStart;
+
+        if(pEntry && pEntry->GetName() == rName)
+        {
+            return a;
+        }
+    }
+
+    return -1;
+}
 
 Bitmap XPropertyList::GetUiBitmap( long nIndex ) const
 {
     Bitmap aRetval;
-    XPropertyEntry* pEntry = (XPropertyEntry*)maList.GetObject((sal_uIntPtr)nIndex);
+    XPropertyEntry* pEntry = Get(nIndex);
 
     if(pEntry)
     {
@@ -164,43 +234,65 @@ Bitmap XPropertyList::GetUiBitmap( long 
         }
     }
 
-	return aRetval;
+    return aRetval;
 }
 
-/*************************************************************************
-|*
-|* void XPropertyList::Insert()
-|*
-*************************************************************************/
-
 void XPropertyList::Insert( XPropertyEntry* pEntry, long nIndex )
 {
-	maList.Insert( pEntry, (sal_uIntPtr) nIndex );
-}
+    if(pEntry)
+    {
+        const long nObjectCount(maContent.size());
 
-/*************************************************************************
-|*
-|* void XPropertyList::Replace()
-|*
-*************************************************************************/
+        if(static_cast< long >(LIST_APPEND) == nIndex || nIndex >= nObjectCount)
+        {
+            maContent.push_back(pEntry);
+        }
+        else
+        {
+            maContent.insert(maContent.begin() + nIndex, pEntry);
+        }
+    }
+}
 
 XPropertyEntry* XPropertyList::Replace( XPropertyEntry* pEntry, long nIndex )
 {
-	return  (XPropertyEntry*) maList.Replace( pEntry, (sal_uIntPtr) nIndex );
-}
+    XPropertyEntry* pRetval = 0;
 
-/*************************************************************************
-|*
-|* void XPropertyList::Remove()
-|*
-*************************************************************************/
+    if(pEntry)
+    {
+        const long nObjectCount(maContent.size());
 
-XPropertyEntry* XPropertyList::Remove( long nIndex, sal_uInt16 /*nDummy*/)
-{
-	return (XPropertyEntry*) maList.Remove( (sal_uIntPtr) nIndex );
+        if(nIndex < nObjectCount)
+        {
+            pRetval = maContent[nIndex];
+            maContent[nIndex] = pEntry;
+        }
+    }
+
+    return pRetval;
 }
 
-/************************************************************************/
+XPropertyEntry* XPropertyList::Remove( long nIndex )
+{
+    XPropertyEntry* pRetval = 0;
+    const long nObjectCount(maContent.size());
+
+    if(nIndex < nObjectCount)
+    {
+        if(nIndex + 1 == nObjectCount)
+        {
+            pRetval = maContent.back();
+            maContent.pop_back();
+        }
+        else
+        {
+            pRetval = maContent[nIndex];
+            maContent.erase(maContent.begin() + nIndex);
+        }
+    }
+
+    return pRetval;
+}
 
 void XPropertyList::SetName( const String& rString )
 {
@@ -210,4 +302,37 @@ void XPropertyList::SetName( const Strin
 	}
 }
 
+//////////////////////////////////////////////////////////////////////////////
+
+XColorListSharedPtr XPropertyListFactory::CreateSharedXColorList( const String& rPath )
+{
+    return XColorListSharedPtr(new XColorList(rPath));
+}
+
+XLineEndListSharedPtr XPropertyListFactory::CreateSharedXLineEndList( const String& rPath )
+{
+    return XLineEndListSharedPtr(new XLineEndList(rPath));
+}
+
+XDashListSharedPtr XPropertyListFactory::CreateSharedXDashList( const String& rPath )
+{
+    return XDashListSharedPtr(new XDashList(rPath));
+}
+
+XHatchListSharedPtr XPropertyListFactory::CreateSharedXHatchList( const String& rPath )
+{
+    return XHatchListSharedPtr(new XHatchList(rPath));
+}
+
+XGradientListSharedPtr XPropertyListFactory::CreateSharedXGradientList( const String& rPath )
+{
+    return XGradientListSharedPtr(new XGradientList(rPath));
+}
+
+XBitmapListSharedPtr XPropertyListFactory::CreateSharedXBitmapList( const String& rPath )
+{
+    return XBitmapListSharedPtr(new XBitmapList(rPath));
+}
+
+//////////////////////////////////////////////////////////////////////////////
 // eof

Modified: openoffice/branches/ia2/main/svx/source/xoutdev/xtablend.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ia2/main/svx/source/xoutdev/xtablend.cxx?rev=1484083&r1=1484082&r2=1484083&view=diff
==============================================================================
--- openoffice/branches/ia2/main/svx/source/xoutdev/xtablend.cxx (original)
+++ openoffice/branches/ia2/main/svx/source/xoutdev/xtablend.cxx Sat May 18 10:12:43 2013
@@ -19,56 +19,26 @@
  * 
  *************************************************************/
 
-
-
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_svx.hxx"
 
 // include ---------------------------------------------------------------
-
-#ifndef SVX_LIGHT
-
 #include <com/sun/star/container/XNameContainer.hpp>
 #include "svx/XPropertyTable.hxx"
 #include <unotools/ucbstreamhelper.hxx>
-
 #include "xmlxtexp.hxx"
 #include "xmlxtimp.hxx"
-
-#endif
 #include <tools/urlobj.hxx>
 #include <vcl/virdev.hxx>
-
-#ifndef _SV_APP_HXX
 #include <vcl/svapp.hxx>
-#endif
-#include <svl/itemset.hxx>
-#include <sfx2/docfile.hxx>
-
 #include <svx/dialogs.hrc>
 #include <svx/dialmgr.hxx>
-
 #include <svx/xtable.hxx>
-#include <svx/xpool.hxx>
-#include <svx/xfillit0.hxx>
-#include <svx/xflclit.hxx>
-#include <svx/xlnstwit.hxx>
-#include <svx/xlnedwit.hxx>
-#include <svx/xlnclit.hxx>
-#include <svx/xlineit0.hxx>
-#include <svx/xlnstit.hxx>
-#include <svx/xlnedit.hxx>
-#include <basegfx/point/b2dpoint.hxx>
-#include <basegfx/polygon/b2dpolygon.hxx>
+#include <drawinglayer/attribute/linestartendattribute.hxx>
+#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
+#include <drawinglayer/processor2d/processor2dtools.hxx>
 #include <basegfx/polygon/b2dpolygontools.hxx>
 
-#include <svx/svdorect.hxx>
-#include <svx/svdopath.hxx>
-#include <svx/svdmodel.hxx>
-#include <svx/sdr/contact/objectcontactofobjlistpainter.hxx>
-#include <svx/sdr/contact/displayinfo.hxx>
-#include <svx/xlnwtit.hxx>
-
 #define GLOBALOVERFLOW
 
 using namespace com::sun::star;
@@ -83,103 +53,13 @@ sal_Unicode const pszExtLineEnd[]	= {'s'
 // class XLineEndList
 // --------------------
 
-class impXLineEndList
-{
-private:
-	VirtualDevice*          mpVirtualDevice;
-	SdrModel*				mpSdrModel;
-	SdrObject*			    mpBackgroundObject;
-	SdrObject*			    mpLineObject;
-
-public:
-    impXLineEndList(VirtualDevice* pV, SdrModel* pM, SdrObject* pB, SdrObject* pL)
-    :   mpVirtualDevice(pV),
-        mpSdrModel(pM),
-        mpBackgroundObject(pB),
-        mpLineObject(pL)
-    {}
-
-    ~impXLineEndList()
-    {
-        delete mpVirtualDevice;
-        SdrObject::Free(mpBackgroundObject);
-        SdrObject::Free(mpLineObject);
-        delete mpSdrModel;
-    }
-
-    VirtualDevice* getVirtualDevice() const { return mpVirtualDevice; }
-    SdrObject* getBackgroundObject() const { return mpBackgroundObject; }
-    SdrObject* getLineObject() const { return mpLineObject; }
-};
-
-void XLineEndList::impCreate()
-{
-    if(!mpData)
-    {
-    	const Point aZero(0, 0);
-		const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
-
-        VirtualDevice* pVirDev = new VirtualDevice;
-		OSL_ENSURE(0 != pVirDev, "XLineEndList: no VirtualDevice created!" );
-		pVirDev->SetMapMode(MAP_100TH_MM);
-        const Size& rSize = rStyleSettings.GetListBoxPreviewDefaultPixelSize();
-		const Size aSize(pVirDev->PixelToLogic(Size(rSize.Width() * 2, rSize.Height())));
-		pVirDev->SetOutputSize(aSize);
-        pVirDev->SetDrawMode(rStyleSettings.GetHighContrastMode()
-            ? DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT
-            : DRAWMODE_DEFAULT);
-        pVirDev->SetBackground(rStyleSettings.GetFieldColor());
-
-	    SdrModel* pSdrModel = new SdrModel();
-		OSL_ENSURE(0 != pSdrModel, "XLineEndList: no SdrModel created!" );
-	    pSdrModel->GetItemPool().FreezeIdRanges();
-
-        const Rectangle aBackgroundSize(aZero, aSize);
-        SdrObject* pBackgroundObject = new SdrRectObj(aBackgroundSize);
-		OSL_ENSURE(0 != pBackgroundObject, "XLineEndList: no BackgroundObject created!" );
-    	pBackgroundObject->SetModel(pSdrModel);
-        pBackgroundObject->SetMergedItem(XFillStyleItem(XFILL_SOLID));
-        pBackgroundObject->SetMergedItem(XLineStyleItem(XLINE_NONE));
-        pBackgroundObject->SetMergedItem(XFillColorItem(String(), rStyleSettings.GetFieldColor()));
-
-        const basegfx::B2DPoint aStart(0, aSize.Height() / 2);
-        const basegfx::B2DPoint aEnd(aSize.Width(), aSize.Height() / 2);
-	    basegfx::B2DPolygon aPolygon;
-	    aPolygon.append(aStart);
-	    aPolygon.append(aEnd);
-	    SdrObject* pLineObject = new SdrPathObj(OBJ_LINE, basegfx::B2DPolyPolygon(aPolygon));
-		OSL_ENSURE(0 != pLineObject, "XLineEndList: no LineObject created!" );
-    	pLineObject->SetModel(pSdrModel);
-		const Size aLineWidth(pVirDev->PixelToLogic(Size(rStyleSettings.GetListBoxPreviewDefaultLineWidth(), 0)));
-        pLineObject->SetMergedItem(XLineWidthItem(aLineWidth.getWidth()));
-        const sal_uInt32 nArrowHeight((aSize.Height() * 8) / 10);
-        pLineObject->SetMergedItem(XLineStartWidthItem(nArrowHeight));
-        pLineObject->SetMergedItem(XLineEndWidthItem(nArrowHeight));
-        pLineObject->SetMergedItem(XLineColorItem(String(), rStyleSettings.GetFieldTextColor()));
-
-        mpData = new impXLineEndList(pVirDev, pSdrModel, pBackgroundObject, pLineObject);
-		OSL_ENSURE(0 != mpData, "XLineEndList: data creation went wrong!" );
-    }
-}
-
-void XLineEndList::impDestroy()
-{
-    if(mpData)
-    {
-        delete mpData;
-        mpData = 0;
-    }
-}
-
-XLineEndList::XLineEndList(const String& rPath, XOutdevItemPool* _pXPool)
-:	XPropertyList(rPath, _pXPool),
-	mpData(0)
+XLineEndList::XLineEndList(const String& rPath)
+:	XPropertyList(rPath)
 {
 }
 
 XLineEndList::~XLineEndList()
 {
-    impDestroy();
 }
 
 XLineEndEntry* XLineEndList::Replace(XLineEndEntry* pEntry, long nIndex )
@@ -189,15 +69,15 @@ XLineEndEntry* XLineEndList::Replace(XLi
 
 XLineEndEntry* XLineEndList::Remove(long nIndex)
 {
-	return (XLineEndEntry*) XPropertyList::Remove(nIndex, 0);
+	return (XLineEndEntry*) XPropertyList::Remove(nIndex);
 }
 
 XLineEndEntry* XLineEndList::GetLineEnd(long nIndex) const
 {
-	return (XLineEndEntry*) XPropertyList::Get(nIndex, 0);
+	return (XLineEndEntry*) XPropertyList::Get(nIndex);
 }
 
-sal_Bool XLineEndList::Load()
+bool XLineEndList::Load()
 {
 	if( mbListDirty )
 	{
@@ -207,8 +87,8 @@ sal_Bool XLineEndList::Load()
 
 		if( INET_PROT_NOT_VALID == aURL.GetProtocol() )
 		{
-			DBG_ASSERT( !maPath.Len(), "invalid URL" );
-			return sal_False;
+			OSL_ENSURE( !maPath.Len(), "invalid URL" );
+			return false;
 		}
 
 		aURL.Append( maName );
@@ -219,17 +99,18 @@ sal_Bool XLineEndList::Load()
 		uno::Reference< container::XNameContainer > xTable( SvxUnoXLineEndTable_createInstance( this ), uno::UNO_QUERY );
 		return SvxXMLXTableImport::load( aURL.GetMainURL( INetURLObject::NO_DECODE ), xTable );
 	}
-	return( sal_False );
+
+    return false;
 }
 
-sal_Bool XLineEndList::Save()
+bool XLineEndList::Save()
 {
 	INetURLObject aURL( maPath );
 
 	if( INET_PROT_NOT_VALID == aURL.GetProtocol() )
 	{
-		DBG_ASSERT( !maPath.Len(), "invalid URL" );
-		return sal_False;
+		OSL_ENSURE( !maPath.Len(), "invalid URL" );
+		return false;
 	}
 
 	aURL.Append( maName );
@@ -241,7 +122,7 @@ sal_Bool XLineEndList::Save()
 	return SvxXMLXTableExportComponent::save( aURL.GetMainURL( INetURLObject::NO_DECODE ), xTable );
 }
 
-sal_Bool XLineEndList::Create()
+bool XLineEndList::Create()
 {
 	basegfx::B2DPolygon aTriangle;
 	aTriangle.append(basegfx::B2DPoint(10.0, 0.0));
@@ -261,30 +142,91 @@ sal_Bool XLineEndList::Create()
 	basegfx::B2DPolygon aCircle(basegfx::tools::createPolygonFromCircle(basegfx::B2DPoint(0.0, 0.0), 100.0));
 	Insert( new XLineEndEntry( basegfx::B2DPolyPolygon(aCircle), SVX_RESSTR( RID_SVXSTR_CIRCLE ) ) );
 
-	return( sal_True );
+	return true;
 }
 
 Bitmap XLineEndList::CreateBitmapForUI( long nIndex )
 {
-    impCreate();
-    VirtualDevice* pVD = mpData->getVirtualDevice();
-    SdrObject* pLine = mpData->getLineObject();
-
-    pLine->SetMergedItem(XLineStyleItem(XLINE_SOLID));
-    pLine->SetMergedItem(XLineStartItem(String(), GetLineEnd(nIndex)->GetLineEnd()));
-    pLine->SetMergedItem(XLineEndItem(String(), GetLineEnd(nIndex)->GetLineEnd()));
-
-    sdr::contact::SdrObjectVector aObjectVector;
-	aObjectVector.push_back(mpData->getBackgroundObject());
-	aObjectVector.push_back(pLine);
-	sdr::contact::ObjectContactOfObjListPainter aPainter(*pVD, aObjectVector, 0);
-	sdr::contact::DisplayInfo aDisplayInfo;
+    Bitmap aRetval;
+    OSL_ENSURE(nIndex < Count(), "OOps, access out of range (!)");
+
+    if(nIndex < Count())
+    {
+        const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
+        const Size& rSize = rStyleSettings.GetListBoxPreviewDefaultPixelSize();
+        const Size aSize(rSize.Width() * 2, rSize.Height());
+
+        // prepare line geometry
+        basegfx::B2DPolygon aLine;
+        const double fBorderDistance(aSize.Height() * 0.1);
+
+        aLine.append(basegfx::B2DPoint(fBorderDistance, aSize.Height() / 2));
+        aLine.append(basegfx::B2DPoint(aSize.Width() - fBorderDistance, aSize.Height() / 2));
+
+        // prepare LineAttribute
+        const basegfx::BColor aLineColor(rStyleSettings.GetFieldTextColor().getBColor());
+        const double fLineWidth(rStyleSettings.GetListBoxPreviewDefaultLineWidth() * 1.1);
+        const drawinglayer::attribute::LineAttribute aLineAttribute(
+            aLineColor,
+            fLineWidth);
+
+        const basegfx::B2DPolyPolygon aLineEnd(GetLineEnd(nIndex)->GetLineEnd());
+        const double fArrowHeight(aSize.Height() - (2.0 * fBorderDistance));
+        const drawinglayer::attribute::LineStartEndAttribute aLineStartEndAttribute(
+            fArrowHeight,
+            aLineEnd,
+            false);
+
+        // prepare line primitive
+        const drawinglayer::primitive2d::Primitive2DReference aLineStartEndPrimitive(
+            new drawinglayer::primitive2d::PolygonStrokeArrowPrimitive2D(
+                aLine,
+                aLineAttribute,
+                aLineStartEndAttribute,
+                aLineStartEndAttribute));
+
+        // prepare VirtualDevice
+        VirtualDevice aVirtualDevice;
+        const drawinglayer::geometry::ViewInformation2D aNewViewInformation2D;
 
-    pVD->Erase();
-	aPainter.ProcessDisplay(aDisplayInfo);
+        aVirtualDevice.SetOutputSizePixel(aSize);
+        aVirtualDevice.SetDrawMode(rStyleSettings.GetHighContrastMode()
+            ? DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT
+            : DRAWMODE_DEFAULT);
+
+        if(rStyleSettings.GetPreviewUsesCheckeredBackground())
+        {
+            const Point aNull(0, 0);
+            static const sal_uInt32 nLen(8);
+            static const Color aW(COL_WHITE);
+            static const Color aG(0xef, 0xef, 0xef);
+
+            aVirtualDevice.DrawCheckered(aNull, aSize, nLen, aW, aG);
+        }
+        else
+        {
+            aVirtualDevice.SetBackground(rStyleSettings.GetFieldColor());
+            aVirtualDevice.Erase();
+        }
+
+        // create processor and draw primitives
+        drawinglayer::processor2d::BaseProcessor2D* pProcessor2D = drawinglayer::processor2d::createPixelProcessor2DFromOutputDevice(
+            aVirtualDevice, 
+            aNewViewInformation2D);
+
+        if(pProcessor2D)
+        {
+            const drawinglayer::primitive2d::Primitive2DSequence aSequence(&aLineStartEndPrimitive, 1);
+
+            pProcessor2D->process(aSequence);
+            delete pProcessor2D;
+        }
+
+        // get result bitmap and scale
+        aRetval = aVirtualDevice.GetBitmap(Point(0, 0), aVirtualDevice.GetOutputSizePixel());
+    }
 
-    const Point aZero(0, 0);
-	return pVD->GetBitmap(aZero, pVD->GetOutputSize());
+    return aRetval;
 }
 
 //////////////////////////////////////////////////////////////////////////////

Modified: openoffice/branches/ia2/main/sw/source/core/draw/drawdoc.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ia2/main/sw/source/core/draw/drawdoc.cxx?rev=1484083&r1=1484082&r2=1484083&view=diff
==============================================================================
--- openoffice/branches/ia2/main/sw/source/core/draw/drawdoc.cxx (original)
+++ openoffice/branches/ia2/main/sw/source/core/draw/drawdoc.cxx Sat May 18 10:12:43 2013
@@ -63,8 +63,7 @@ const String GetPalettePath()
 }
 
 SwDrawDocument::SwDrawDocument( SwDoc* pD ) :
-	FmFormModel( ::GetPalettePath(), &pD->GetAttrPool(),
-				 pD->GetDocShell(), sal_True ),
+	FmFormModel( ::GetPalettePath(), &pD->GetAttrPool(), pD->GetDocShell() ),
 	pDoc( pD )
 {
 	SetScaleUnit( MAP_TWIP );
@@ -76,23 +75,24 @@ SwDrawDocument::SwDrawDocument( SwDoc* p
 		SetObjectShell( pDocSh );
 		SvxColorTableItem* pColItem = ( SvxColorTableItem* )
                                 ( pDocSh->GetItem( SID_COLOR_TABLE ) );
-		XColorList *pXCol = pColItem ? pColItem->GetColorTable() :
-										XColorList::GetStdColorList();
-		SetColorTable( pXCol );
+		XColorListSharedPtr aXCol = pColItem ? 
+            pColItem->GetColorTable() :
+			XColorList::GetStdColorList();
+		SetColorTableAtSdrModel( aXCol );
 
 		if ( !pColItem )
-            pDocSh->PutItem( SvxColorTableItem( pXCol, SID_COLOR_TABLE ) );
+            pDocSh->PutItem( SvxColorTableItem( aXCol, SID_COLOR_TABLE ) );
 
-        pDocSh->PutItem( SvxGradientListItem( GetGradientList(), SID_GRADIENT_LIST ));
-        pDocSh->PutItem( SvxHatchListItem( GetHatchList(), SID_HATCH_LIST ) );
-        pDocSh->PutItem( SvxBitmapListItem( GetBitmapList(), SID_BITMAP_LIST ) );
-        pDocSh->PutItem( SvxDashListItem( GetDashList(), SID_DASH_LIST ) );
-        pDocSh->PutItem( SvxLineEndListItem( GetLineEndList(), SID_LINEEND_LIST ) );
+        pDocSh->PutItem( SvxGradientListItem( GetGradientListFromSdrModel(), SID_GRADIENT_LIST ));
+        pDocSh->PutItem( SvxHatchListItem( GetHatchListFromSdrModel(), SID_HATCH_LIST ) );
+        pDocSh->PutItem( SvxBitmapListItem( GetBitmapListFromSdrModel(), SID_BITMAP_LIST ) );
+        pDocSh->PutItem( SvxDashListItem( GetDashListFromSdrModel(), SID_DASH_LIST ) );
+        pDocSh->PutItem( SvxLineEndListItem( GetLineEndListFromSdrModel(), SID_LINEEND_LIST ) );
 		pDocSh->PutItem( SfxUInt16Item(SID_ATTR_LINEEND_WIDTH_DEFAULT, 111) );
 		SetObjectShell( pDocSh );
 	}
 	else
-		SetColorTable( XColorList::GetStdColorList() );
+		SetColorTableAtSdrModel( XColorList::GetStdColorList() );
 
 	// copy all the default values to the SdrModel
 	SfxItemPool* pSdrPool = pD->GetAttrPool().GetSecondaryPool();

Modified: openoffice/branches/ia2/main/sw/source/core/edit/eddel.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ia2/main/sw/source/core/edit/eddel.cxx?rev=1484083&r1=1484082&r2=1484083&view=diff
==============================================================================
--- openoffice/branches/ia2/main/sw/source/core/edit/eddel.cxx (original)
+++ openoffice/branches/ia2/main/sw/source/core/edit/eddel.cxx Sat May 18 10:12:43 2013
@@ -92,8 +92,11 @@ void SwEditShell::DeleteSel( SwPaM& rPam
 				aDelPam.Move( fnMoveBackward, fnGoCntnt );
 			}
 				// geschuetze Boxen ueberspringen !
+			//For i117395, in some situation, the node would be hidden or invisible, which makes the frame of it unavailable
+			//So verify it before use it.
+			SwCntntFrm* pFrm = NULL;
 			if( !pNd->IsCntntNode() ||
-				!((SwCntntNode*)pNd)->getLayoutFrm( GetLayout() )->IsProtected() )
+				!((pFrm=((SwCntntNode*)pNd)->getLayoutFrm( GetLayout() ))!=NULL && pFrm->IsProtected()) )
 			{
 				// alles loeschen
 				GetDoc()->DeleteAndJoin( aDelPam );