openoffice-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zheng...@apache.org
Subject svn commit: r1460970 - in /openoffice/branches/sidebar/main/svx: ./ inc/svx/ sdi/ source/sidebar/text/
Date Tue, 26 Mar 2013 04:15:41 GMT
Author: zhengfan
Date: Tue Mar 26 04:15:41 2013
New Revision: 1460970

URL: http://svn.apache.org/r1460970
Log:
i121798: For implementation of Text Properties Panel, in AOO Sidebar branch.

Added:
    openoffice/branches/sidebar/main/svx/source/sidebar/text/TextCharacterSpacingControl.cxx
    openoffice/branches/sidebar/main/svx/source/sidebar/text/TextCharacterSpacingControl.hxx
    openoffice/branches/sidebar/main/svx/source/sidebar/text/TextCharacterSpacingPopup.cxx
    openoffice/branches/sidebar/main/svx/source/sidebar/text/TextCharacterSpacingPopup.hxx
    openoffice/branches/sidebar/main/svx/source/sidebar/text/TextUnderlineControl.cxx
    openoffice/branches/sidebar/main/svx/source/sidebar/text/TextUnderlineControl.hxx
    openoffice/branches/sidebar/main/svx/source/sidebar/text/TextUnderlinePopup.cxx
    openoffice/branches/sidebar/main/svx/source/sidebar/text/TextUnderlinePopup.hxx
Removed:
    openoffice/branches/sidebar/main/svx/source/sidebar/text/SvxTextFontColorPage.cxx
    openoffice/branches/sidebar/main/svx/source/sidebar/text/SvxTextSpacingPage.cxx
    openoffice/branches/sidebar/main/svx/source/sidebar/text/SvxTextUnderlinePage.cxx
Modified:
    openoffice/branches/sidebar/main/svx/Library_svx.mk
    openoffice/branches/sidebar/main/svx/inc/svx/svxids.hrc
    openoffice/branches/sidebar/main/svx/sdi/svx.sdi
    openoffice/branches/sidebar/main/svx/source/sidebar/text/TextPropertyPanel.cxx
    openoffice/branches/sidebar/main/svx/source/sidebar/text/TextPropertyPanel.hrc
    openoffice/branches/sidebar/main/svx/source/sidebar/text/TextPropertyPanel.hxx
    openoffice/branches/sidebar/main/svx/source/sidebar/text/TextPropertyPanel.src

Modified: openoffice/branches/sidebar/main/svx/Library_svx.mk
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/svx/Library_svx.mk?rev=1460970&r1=1460969&r2=1460970&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/svx/Library_svx.mk (original)
+++ openoffice/branches/sidebar/main/svx/Library_svx.mk Tue Mar 26 04:15:41 2013
@@ -178,6 +178,10 @@ $(eval $(call gb_Library_add_exception_o
     svx/source/sidebar/debug/ContextPanel \
     svx/source/sidebar/debug/NotYetImplementedPanel \
     svx/source/sidebar/text/SvxSBFontNameBox \
+    svx/source/sidebar/text/TextCharacterSpacingControl \
+    svx/source/sidebar/text/TextCharacterSpacingPopup \
+    svx/source/sidebar/text/TextUnderlineControl \
+    svx/source/sidebar/text/TextUnderlinePopup \
     svx/source/sidebar/text/TextPropertyPanel \
     svx/source/sidebar/area/AreaPropertyPanel \
     svx/source/sidebar/area/AreaTransparencyGradientControl \

Modified: openoffice/branches/sidebar/main/svx/inc/svx/svxids.hrc
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/svx/inc/svx/svxids.hrc?rev=1460970&r1=1460969&r2=1460970&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/svx/inc/svx/svxids.hrc (original)
+++ openoffice/branches/sidebar/main/svx/inc/svx/svxids.hrc Tue Mar 26 04:15:41 2013
@@ -1270,6 +1270,7 @@
 #define SID_ATTR_LINE_CAP                               (SID_SVX_START+1111)
 #define SID_ATTR_TRANSFORM_MATRIX                       (SID_SVX_START+1112)
 
+#define SID_CHAR_DLG_EFFECT					(SID_SVX_START+1113) 
 //#define SID_SVX_AREA_TRANS_TYPE                         (SID_SVX_START+1105)
 //#define SID_SVX_AREA_TRANSPARENCY                       (SID_SVX_START+1106)
 //#define SID_SVX_AREA_TRANSP_GRADIENT                    (SID_SVX_START+1107)
@@ -1280,7 +1281,7 @@
 //#define SID_FLIP_VERTICAL                               (SID_SVX_START+1110)
 
 // IMPORTANT NOTE: adjust SID_SVX_FIRSTFREE, when adding new slot id
-#define SID_SVX_FIRSTFREE                               (SID_ATTR_TRANSFORM_MATRIX + 1)
+#define SID_SVX_FIRSTFREE                               (SID_CHAR_DLG_EFFECT + 1)
 
 // --------------------------------------------------------------------------
 // Overflow check for slot IDs

Modified: openoffice/branches/sidebar/main/svx/sdi/svx.sdi
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/svx/sdi/svx.sdi?rev=1460970&r1=1460969&r2=1460970&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/svx/sdi/svx.sdi (original)
+++ openoffice/branches/sidebar/main/svx/sdi/svx.sdi Tue Mar 26 04:15:41 2013
@@ -3883,6 +3883,30 @@ SfxVoidItem FontDialog SID_CHAR_DLG
 	GroupId = GID_FORMAT;
 ]
 
+SfxVoidItem FontDialogEff SID_CHAR_DLG_EFFECT
+()
+[
+	/* flags: */
+	AutoUpdate = FALSE,
+	Cachable = Cachable,
+	FastCall = FALSE,
+	HasCoreId = FALSE,
+	HasDialog = TRUE,
+	ReadOnlyDoc = FALSE,
+	Toggle = FALSE,
+	Container = FALSE,
+	RecordAbsolute = FALSE,
+	RecordPerItem;
+	Asynchron;
+
+	/* config: */
+	AccelConfig = TRUE,
+	MenuConfig = TRUE,
+	StatusBarConfig = FALSE,
+	ToolBoxConfig = TRUE,
+	GroupId = GID_FORMAT;
+]
+
 //--------------------------------------------------------------------------
 SvxFontHeightItem  FontHeight SID_ATTR_CHAR_FONTHEIGHT
 

Added: openoffice/branches/sidebar/main/svx/source/sidebar/text/TextCharacterSpacingControl.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/svx/source/sidebar/text/TextCharacterSpacingControl.cxx?rev=1460970&view=auto
==============================================================================
--- openoffice/branches/sidebar/main/svx/source/sidebar/text/TextCharacterSpacingControl.cxx (added)
+++ openoffice/branches/sidebar/main/svx/source/sidebar/text/TextCharacterSpacingControl.cxx Tue Mar 26 04:15:41 2013
@@ -0,0 +1,505 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/
+
+#include "precompiled_svx.hxx"
+#include "TextCharacterSpacingControl.hxx"
+#include "TextPropertyPanel.hrc"
+#include <sfx2/sidebar/propertypanel.hrc>
+#include <svx/dialogs.hrc>
+#include <svx/dialmgr.hxx>
+#include <unotools/viewoptions.hxx>
+#include <editeng/kernitem.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/sidebar/Theme.hxx>
+
+namespace svx { namespace sidebar {
+TextCharacterSpacingControl::TextCharacterSpacingControl(Window* pParent, svx::sidebar::TextPropertyPanel& rPanel)
+:	PopupControl( pParent,SVX_RES(RID_POPUPPANEL_TEXTPAGE_SPACING))
+,	mrTextPropertyPanel(rPanel)
+,	mpBindings(NULL)
+,	maVSSpacing		(ValueSetWithTextControl::IMAGE_TEXT,this, SVX_RES(VS_SPACING))
+,	maLastCus		(this, SVX_RES(FT_LASTCUSTOM))
+//,	maBorder		(this, SVX_RES(CT_BORDER))
+,	maFTSpacing		(this, SVX_RES(FT_SPACING))
+,	maLBKerning		(this, SVX_RES(LB_KERNING))
+,	maFTBy			(this, SVX_RES(FT_BY))
+,	maEditKerning	(this, SVX_RES(ED_KERNING))
+
+,	mpImg			(NULL)
+,	mpImgSel		(NULL)
+,	mpStr			(NULL)
+,	mpStrTip		(NULL)
+		
+,	maImgCus		(SVX_RES(IMG_CUSTOM))
+,	maImgCusGrey	(SVX_RES(IMG_CUSTOM_GRAY))
+,	maStrCus		(SVX_RES(STR_CUSTOM))
+,	maStrCusE		(SVX_RES(STR_CUSTOM_E_TIP))	//add 
+,	maStrCusC		(SVX_RES(STR_CUSTOM_C_TIP))	//add 
+,	maStrCusN		(SVX_RES(STR_NORMAL_TIP))	//add 
+,	maStrUnit		(SVX_RES(STR_PT))			//add 
+
+,	mnCustomKern(0)
+,	mnLastCus ( SPACING_NOCUSTOM )
+,	mbCusEnable(false)
+,	mbVS(true)
+{
+	initial();
+	FreeResource();
+	mpBindings = mrTextPropertyPanel.GetBindings();
+	Link aLink = LINK(this, TextCharacterSpacingControl, KerningSelectHdl);
+	maLBKerning.SetSelectHdl(aLink);
+	aLink =LINK(this, TextCharacterSpacingControl, KerningModifyHdl);
+	maEditKerning.SetModifyHdl(aLink);
+
+}
+TextCharacterSpacingControl::~TextCharacterSpacingControl()
+{
+	delete[] mpImg;
+	delete[] mpImgSel;
+	delete[] mpStr;
+	delete[] mpStrTip;
+}
+/*void TextCharacterSpacingControl::Paint(const Rectangle& rect)
+{
+	svx::sidebar::PopupControl::Paint(rect);
+	Color aOldLineColor = GetLineColor();
+	Color aOldFillColor = GetFillColor();
+
+	//Point aPos = maBorder.GetPosPixel();	
+	//Size aSize = maBorder.GetSizePixel();
+	Point aPos( LogicToPixel( Point( CUSTOM_X, CUSTOM_Y), MAP_APPFONT ));
+	Size aSize( LogicToPixel( Size(  CUSTOM_WIDTH, CUSTOM_HEIGHT ), MAP_APPFONT ));
+	Rectangle aRect( aPos, aSize );
+	aRect.Left() -= 1;
+	aRect.Top() -= 1;
+	aRect.Right() += 1;
+	aRect.Bottom() += 1;
+
+
+	Color aLineColor(189,201,219);
+	if(!GetSettings().GetStyleSettings().GetHighContrastMode())
+		SetLineColor(aLineColor);
+	else
+		SetLineColor(GetSettings().GetStyleSettings().GetShadowColor());
+	SetFillColor(COL_TRANSPARENT);
+	//add  for high contract
+	//if(GetSettings().GetStyleSettings().GetHighContrastMode())
+	//{
+	//	maBorder.SetBackground(GetSettings().GetStyleSettings().GetMenuColor());
+	//	maFTSpacing.SetBackground(GetSettings().GetStyleSettings().GetMenuColor());
+	//	maFTBy.SetBackground(GetSettings().GetStyleSettings().GetMenuColor());
+	//}
+	DrawRect(aRect);
+
+
+	SetLineColor(aOldLineColor);
+	SetFillColor(aOldFillColor);
+}*/
+void TextCharacterSpacingControl::initial()
+{
+	maVSSpacing.SetStyle( maVSSpacing.GetStyle()| WB_3DLOOK |  WB_NO_DIRECTSELECT  );
+	//for high contract
+	//if(GetSettings().GetStyleSettings().GetHighContrastMode())
+	{
+		maVSSpacing.SetControlBackground(GetSettings().GetStyleSettings().GetHighContrastMode()?
+		GetSettings().GetStyleSettings().GetMenuColor():
+		sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground ));
+		maVSSpacing.SetColor(GetSettings().GetStyleSettings().GetHighContrastMode()?
+		GetSettings().GetStyleSettings().GetMenuColor():
+		sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground ));
+		maVSSpacing.SetBackground(GetSettings().GetStyleSettings().GetHighContrastMode()?
+		GetSettings().GetStyleSettings().GetMenuColor():
+		sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground ));
+		maFTSpacing.SetBackground(GetSettings().GetStyleSettings().GetHighContrastMode()?
+		GetSettings().GetStyleSettings().GetMenuColor():
+		sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground ));
+		maFTBy.SetBackground(GetSettings().GetStyleSettings().GetHighContrastMode()?
+		GetSettings().GetStyleSettings().GetMenuColor():
+		sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground ));
+	}
+	mpImg = new Image[5];
+	mpImg[0] = Image(SVX_RES(IMG_VERY_TIGHT));
+	mpImg[1] = Image(SVX_RES(IMG_TIGHT));
+	mpImg[2] = Image(SVX_RES(IMG_NORMAL));
+	mpImg[3] = Image(SVX_RES(IMG_LOOSE));
+	mpImg[4] = Image(SVX_RES(IMG_VERY_LOOSE));
+
+	mpImgSel = new Image[5];
+	mpImgSel[0] = Image(SVX_RES(IMG_VERY_TIGHT_S));
+	mpImgSel[1] = Image(SVX_RES(IMG_TIGHT_S));
+	mpImgSel[2] = Image(SVX_RES(IMG_NORMAL_S));
+	mpImgSel[3] = Image(SVX_RES(IMG_LOOSE_S));
+	mpImgSel[4] = Image(SVX_RES(IMG_VERY_LOOSE_S));
+
+	mpStr = new XubString[5];
+	mpStr[0] = XubString(SVX_RES(STR_VERY_TIGHT));
+	mpStr[1] = XubString(SVX_RES(STR_TIGHT));
+	mpStr[2] = XubString(SVX_RES(STR_NORMAL));
+	mpStr[3] = XubString(SVX_RES(STR_LOOSE));
+	mpStr[4] = XubString(SVX_RES(STR_VERY_LOOSE));
+	
+
+	mpStrTip = new XubString[5];
+	mpStrTip[0] = XubString(SVX_RES(STR_VERY_TIGHT_TIP));
+	mpStrTip[1] = XubString(SVX_RES(STR_TIGHT_TIP));
+	mpStrTip[2] = XubString(SVX_RES(STR_NORMAL_TIP));
+	mpStrTip[3] = XubString(SVX_RES(STR_LOOSE_TIP));
+	mpStrTip[4] = XubString(SVX_RES(STR_VERY_LOOSE_TIP));
+	//maVSSpacing.SetDefaultTip(mpStr);	//modify
+	//maVSSpacing.SetDefaultTip(mpStrTip, TRUE); //Add
+
+	for (int i=0;i<5;i++)
+		maVSSpacing.AddItem(mpImg[i], &mpImgSel[i],mpStr[i],&mpStrTip[i]);
+
+	maVSSpacing.InsertCustom(maImgCus, maImgCusGrey, maStrCus);
+	maVSSpacing.SetCustomTip(maStrCus); //Add
+
+	maVSSpacing.SetSelItem(0);			
+	Link aLink = LINK(this, TextCharacterSpacingControl,VSSelHdl );
+	maVSSpacing.SetSelectHdl(aLink);
+	maVSSpacing.StartSelection();
+	maVSSpacing.Show();
+}
+void TextCharacterSpacingControl::ToGetFocus()
+{
+	if(!mbVS)
+		maLBKerning.GrabFocus();
+	else
+		maVSSpacing.GrabFocus();
+}
+
+void TextCharacterSpacingControl::Rearrange(bool bLBAvailable,bool bAvailable, long nKerning)
+{
+	mbVS = true;
+	maVSSpacing.SetSelItem(0);
+	SvtViewOptions aWinOpt( E_WINDOW, SIDEBAR_SPACING_GLOBAL_VALUE );
+    if ( aWinOpt.Exists() )
+	{
+		::com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue > aSeq = aWinOpt.GetUserData();
+		::rtl::OUString aTmp;
+		if ( aSeq.getLength())
+			aSeq[0].Value >>= aTmp;
+
+		String aWinData( aTmp );
+		mnCustomKern = aWinData.ToInt32();
+		mnLastCus = SPACING_CLOSE_BY_CUS_EDIT;
+		mbCusEnable = true;
+	}
+	else
+	{
+		mnLastCus = SPACING_NOCUSTOM;
+		mbCusEnable = false;
+	}
+
+	if( !mnLastCus ) 
+	{
+		maVSSpacing.SetCusEnable(false);
+		maVSSpacing.SetCustomTip(maStrCus,true);  //LAST CUSTOM no tip defect //add 
+	}
+	else
+	{
+		//set custom tips
+		maVSSpacing.SetCusEnable(true);
+		if(mnCustomKern > 0)
+		{	
+			String aStrTip( maStrCusE);   //LAST CUSTOM no tip defect //add 
+			aStrTip.Append( String::CreateFromDouble( (double)mnCustomKern / 10));
+			aStrTip.Append(String("pt", 2, RTL_TEXTENCODING_ASCII_US));
+			aStrTip.Append(maStrUnit);		// modify 
+			maVSSpacing.SetCustomTip(aStrTip,true);
+		}
+		else if(mnCustomKern < 0)
+		{	
+			String aStrTip(maStrCusC) ;		//LAST CUSTOM no tip defect //add 
+			aStrTip.Append( String::CreateFromDouble( (double)-mnCustomKern / 10));
+			aStrTip.Append(String("pt", 2, RTL_TEXTENCODING_ASCII_US));
+			aStrTip.Append(maStrUnit);		// modify 
+			maVSSpacing.SetCustomTip(aStrTip,true);
+		}	
+		else
+		{	
+			String aStrTip(maStrCusN) ;		//LAST CUSTOM no tip defect //add 
+			maVSSpacing.SetCustomTip(aStrTip,true);
+		}
+		
+	}
+
+	if(bLBAvailable && bAvailable)
+	{
+		maLBKerning.Enable();
+		maFTSpacing.Enable();
+		
+		SfxMapUnit eUnit = mrTextPropertyPanel.GetSpaceController().GetCoreMetric();
+        MapUnit eOrgUnit = (MapUnit)eUnit;
+        MapUnit ePntUnit( MAP_POINT );			
+        long nBig = maEditKerning.Normalize(nKerning);
+        nKerning = LogicToLogic( nBig, eOrgUnit, ePntUnit );
+
+		if ( nKerning > 0 )
+        {
+			maFTBy.Enable();
+            maEditKerning.Enable();
+            maEditKerning.SetMax( 9999 );
+            maEditKerning.SetLast( 9999 );
+            maEditKerning.SetValue( nKerning );
+            maLBKerning.SelectEntryPos( SIDEBAR_SPACE_EXPAND );
+			if(nKerning == 30)
+			{
+				maVSSpacing.SetSelItem(4);
+			}
+			else if(nKerning == 60)
+			{
+				maVSSpacing.SetSelItem(5);
+			}
+			else
+			{
+				maVSSpacing.SetSelItem(0);
+				mbVS = false;
+			}
+        }
+        else if ( nKerning < 0 )
+        {
+			maFTBy.Enable();
+            maEditKerning.Enable();
+            maEditKerning.SetValue( -nKerning );
+            maLBKerning.SelectEntryPos( SIDEBAR_SPACE_CONDENSED );
+            long nMax = mrTextPropertyPanel.GetSelFontSize()/6;
+            maEditKerning.SetMax( maEditKerning.Normalize( nMax ), FUNIT_POINT );
+            maEditKerning.SetLast( maEditKerning.GetMax( maEditKerning.GetUnit() ) );
+			if( nKerning == -30 )
+			{
+				maVSSpacing.SetSelItem(1);
+			}
+			else if( nKerning == -15 )
+			{
+				maVSSpacing.SetSelItem(2);
+			}
+			else
+			{
+				maVSSpacing.SetSelItem(0);
+				mbVS = false;
+			}
+        }
+        else
+        {
+			maVSSpacing.SetSelItem(3);
+			maLBKerning.SelectEntryPos( SIDEBAR_SPACE_NORMAL );
+			maFTBy.Disable();
+            maEditKerning.Disable();
+            maEditKerning.SetValue( 0 );
+            maEditKerning.SetMax( 9999 );
+            maEditKerning.SetLast( 9999 );
+        }
+	}
+	else if(bLBAvailable && !bAvailable)
+	{	
+		//modified 
+		maVSSpacing.SetSelItem(0);
+		mbVS = false;
+		maLBKerning.Enable();
+		maFTSpacing.Enable();
+		maLBKerning.SetNoSelection();
+		maEditKerning.SetText(String());
+		maEditKerning.Disable();
+		maFTBy.Disable();
+	}
+	else
+	{
+		maVSSpacing.SetSelItem(0);
+		mbVS = false;
+		maEditKerning.SetText(String());
+        maLBKerning.SetNoSelection();
+		maLBKerning.Disable();
+		maFTSpacing.Disable();
+        maEditKerning.Disable();
+		maFTBy.Disable();
+	}
+	GetFocus();
+	maVSSpacing.Format();
+	maVSSpacing.StartSelection();
+}
+IMPL_LINK(TextCharacterSpacingControl, VSSelHdl, void *, pControl)
+{
+	mnLastCus = SPACING_CLOSE_BY_CLICK_ICON;
+
+	if(pControl == &maVSSpacing)  
+	{		
+		sal_uInt16 iPos = maVSSpacing.GetSelectItemId();
+		short nKern = 0;
+		SfxMapUnit eUnit = mrTextPropertyPanel.GetSpaceController().GetCoreMetric();
+		long nVal = 0;
+		if(iPos == 1)
+		{
+			nVal = LogicToLogic(30, MAP_POINT, (MapUnit)eUnit);
+			nKern = (short)maEditKerning.Denormalize(nVal);
+			SvxKerningItem aKernItem(-nKern, SID_ATTR_CHAR_KERNING);
+			mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_KERNING, SFX_CALLMODE_RECORD, &aKernItem, 0L);
+			mrTextPropertyPanel.SetSpacing(-nKern);
+			mnLastCus = SPACING_CLOSE_BY_CLICK_ICON;
+		}
+		else if(iPos == 2)
+		{
+			nVal = LogicToLogic(15, MAP_POINT, (MapUnit)eUnit);
+			nKern = (short)maEditKerning.Denormalize(nVal);
+			SvxKerningItem aKernItem(-nKern, SID_ATTR_CHAR_KERNING);
+			mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_KERNING, SFX_CALLMODE_RECORD, &aKernItem, 0L);
+			mrTextPropertyPanel.SetSpacing(-nKern);
+			mnLastCus = SPACING_CLOSE_BY_CLICK_ICON;
+		}
+		else if(iPos == 3)
+		{
+			SvxKerningItem aKernItem(0, SID_ATTR_CHAR_KERNING);
+			mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_KERNING, SFX_CALLMODE_RECORD, &aKernItem, 0L);
+			mrTextPropertyPanel.SetSpacing(0);
+			mnLastCus = SPACING_CLOSE_BY_CLICK_ICON;
+		}
+		else if(iPos == 4)
+		{
+			nVal = LogicToLogic(30, MAP_POINT, (MapUnit)eUnit);
+			nKern = (short)maEditKerning.Denormalize(nVal);
+			SvxKerningItem aKernItem(nKern, SID_ATTR_CHAR_KERNING);
+			mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_KERNING, SFX_CALLMODE_RECORD, &aKernItem, 0L);
+			mrTextPropertyPanel.SetSpacing(nKern);
+			mnLastCus = SPACING_CLOSE_BY_CLICK_ICON;
+		}
+		else if(iPos == 5)
+		{
+			nVal = LogicToLogic(60, MAP_POINT, (MapUnit)eUnit);
+			nKern = (short)maEditKerning.Denormalize(nVal);
+			SvxKerningItem aKernItem(nKern, SID_ATTR_CHAR_KERNING);
+			mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_KERNING, SFX_CALLMODE_RECORD, &aKernItem, 0L);
+			mrTextPropertyPanel.SetSpacing(nKern);
+			mnLastCus = SPACING_CLOSE_BY_CLICK_ICON;
+		}
+		else if(iPos == 6)
+		{
+			//modified 
+			if(mbCusEnable)
+			{
+				nVal = LogicToLogic(mnCustomKern, MAP_POINT, (MapUnit)eUnit);
+				nKern = (short)maEditKerning.Denormalize(nVal);
+				SvxKerningItem aKernItem(nKern , SID_ATTR_CHAR_KERNING);
+				mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_KERNING, SFX_CALLMODE_RECORD, &aKernItem, 0L);
+				mrTextPropertyPanel.SetSpacing(nKern);
+				mnLastCus = SPACING_CLOSE_BY_CLICK_ICON;
+			}
+			else
+			{
+				maVSSpacing.SetNoSelection();		//add , set no selection and keep the last select item 
+				maVSSpacing.Format();
+				Invalidate();
+				maVSSpacing.StartSelection();
+			}
+			//modify end
+		}
+		
+		if(iPos < 6 || (iPos == 6 && mbCusEnable)) //add 
+			mrTextPropertyPanel.EndSpacingPopupMode();
+	}
+
+
+		
+	return 0;
+}
+
+IMPL_LINK(TextCharacterSpacingControl, KerningSelectHdl, ListBox*, EMPTYARG)
+{
+	if ( maLBKerning.GetSelectEntryPos() > 0 )
+	{
+		maFTBy.Enable();
+		maEditKerning.Enable();
+	}
+	else
+	{
+		maEditKerning.SetValue( 0 );
+		maFTBy.Disable();
+		maEditKerning.Disable();
+	}
+
+	if(maVSSpacing.GetSelItem())
+	{
+		maVSSpacing.SetSelItem(0);	//modify 
+		maVSSpacing.Format();
+		Invalidate();
+		maVSSpacing.StartSelection();
+	}
+	KerningModifyHdl( NULL );
+	return 0;
+}
+IMPL_LINK(TextCharacterSpacingControl, KerningModifyHdl, MetricField*, EMPTYARG)
+{
+	if(maVSSpacing.GetSelItem())
+	{
+		maVSSpacing.SetSelItem(0);	//modify 
+		maVSSpacing.Format();
+		Invalidate();
+		maVSSpacing.StartSelection();
+	}
+	sal_uInt16 nPos = maLBKerning.GetSelectEntryPos();
+    short nKern = 0;
+    SfxMapUnit eUnit = mrTextPropertyPanel.GetSpaceController().GetCoreMetric();
+	mnLastCus = SPACING_CLOSE_BY_CUS_EDIT; 
+	if ( nPos == SIDEBAR_SPACE_EXPAND || nPos == SIDEBAR_SPACE_CONDENSED )
+    {
+        long nTmp = static_cast<long>(maEditKerning.GetValue());
+        if ( nPos == SIDEBAR_SPACE_CONDENSED )
+		{
+			long nMax =  mrTextPropertyPanel.GetSelFontSize()/6;
+			maEditKerning.SetMax( maEditKerning.Normalize( nMax ), FUNIT_TWIP );
+			maEditKerning.SetLast( maEditKerning.GetMax( maEditKerning.GetUnit() ) );
+			if(nTmp > maEditKerning.GetMax())
+				nTmp = maEditKerning.GetMax();
+			mnCustomKern = -nTmp;
+			long nVal = LogicToLogic( nTmp, MAP_POINT, (MapUnit)eUnit );
+			nKern = (short)maEditKerning.Denormalize( nVal );
+            nKern *= - 1;		
+		}
+		else
+		{
+			maEditKerning.SetMax( 9999 );
+			maEditKerning.SetLast( 9999 );
+			if(nTmp > maEditKerning.GetMax(FUNIT_TWIP))
+				nTmp = maEditKerning.GetMax(FUNIT_TWIP);
+			mnCustomKern = nTmp;
+			long nVal = LogicToLogic( nTmp, MAP_POINT, (MapUnit)eUnit );
+			nKern = (short)maEditKerning.Denormalize( nVal );	
+		}
+    }
+	else
+	{
+		mnCustomKern = 0;
+	}
+	SvxKerningItem aKernItem(nKern, SID_ATTR_CHAR_KERNING);
+	mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_KERNING, SFX_CALLMODE_RECORD, &aKernItem, 0L);
+	mrTextPropertyPanel.SetSpacing(nKern);
+	return 0;
+}
+short  TextCharacterSpacingControl::GetLastCustomState()
+{
+	return mnLastCus;
+}
+long  TextCharacterSpacingControl::GetLastCustomValue()
+{
+	return mnCustomKern;
+}
+
+}} // end of namespace sidebar

Added: openoffice/branches/sidebar/main/svx/source/sidebar/text/TextCharacterSpacingControl.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/svx/source/sidebar/text/TextCharacterSpacingControl.hxx?rev=1460970&view=auto
==============================================================================
--- openoffice/branches/sidebar/main/svx/source/sidebar/text/TextCharacterSpacingControl.hxx (added)
+++ openoffice/branches/sidebar/main/svx/source/sidebar/text/TextCharacterSpacingControl.hxx Tue Mar 26 04:15:41 2013
@@ -0,0 +1,96 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/
+#ifndef _SVX_SIDEBAR_CHARACTER_SPACING_CONTROL_HXX_
+#define _SVX_SIDEBAR_CHARACTER_SPACING_CONTROL_HXX_
+ 
+#include "svx/sidebar/PopupControl.hxx"
+#include "svx/sidebar/ValueSetWithTextControl.hxx"
+#include <sfx2/bindings.hxx>
+#include <svtools/ctrlbox.hxx>
+#include <svtools/ctrltool.hxx>
+#include "TextPropertyPanel.hxx"
+#include <vcl/fixed.hxx>
+
+
+namespace svx { namespace sidebar {
+#define SPACING_NOCUSTOM				0
+#define SPACING_CLOSE_BY_CLICK_ICON		-1
+#define SPACING_CLOSE_BY_CUS_EDIT		1
+
+#define SIDEBAR_SPACING_GLOBAL_VALUE	String("PopupPanal_Spacing", 18, RTL_TEXTENCODING_ASCII_US)
+
+#define SIDEBAR_SPACE_NORMAL	0
+#define SIDEBAR_SPACE_EXPAND	1
+#define SIDEBAR_SPACE_CONDENSED	2
+class TextCharacterSpacingControl:public svx::sidebar::PopupControl
+{
+public:
+	TextCharacterSpacingControl(Window* pParent, svx::sidebar::TextPropertyPanel& rPanel);
+	~TextCharacterSpacingControl();
+	void ToGetFocus();
+	void Rearrange(bool bLBAvailable,bool bAvailable, long nKerning);
+	//virtual void Paint(const Rectangle& rect);
+	
+	//add 
+	short GetLastCustomState();
+	long  GetLastCustomValue();
+	//add end
+
+private:	
+	svx::sidebar::TextPropertyPanel&     mrTextPropertyPanel;
+	SfxBindings*		mpBindings;
+
+	ValueSetWithTextControl	maVSSpacing;
+
+	FixedText			maLastCus;
+//	Control				maBorder;
+
+	FixedText			maFTSpacing;
+	ListBox				maLBKerning;
+	FixedText			maFTBy;
+	MetricField			maEditKerning;
+
+	Image*				mpImg;
+	Image*				mpImgSel;
+	XubString*			mpStr;
+	XubString*			mpStrTip;
+
+	Image				maImgCus;
+	Image				maImgCusGrey;
+	XubString			maStrCus;
+	XubString			maStrCusE;		//add 
+	XubString			maStrCusC;		//add 
+	XubString			maStrCusN;		//add 
+	XubString			maStrUnit;		//add 
+
+	long				mnCustomKern;
+	short				mnLastCus;		
+	bool				mbCusEnable;
+	bool				mbVS;
+
+	void initial();
+	DECL_LINK(VSSelHdl, void*);
+	DECL_LINK(KerningSelectHdl, ListBox*);
+	DECL_LINK(KerningModifyHdl,  MetricField*);
+};
+}}
+
+#endif

Added: openoffice/branches/sidebar/main/svx/source/sidebar/text/TextCharacterSpacingPopup.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/svx/source/sidebar/text/TextCharacterSpacingPopup.cxx?rev=1460970&view=auto
==============================================================================
--- openoffice/branches/sidebar/main/svx/source/sidebar/text/TextCharacterSpacingPopup.cxx (added)
+++ openoffice/branches/sidebar/main/svx/source/sidebar/text/TextCharacterSpacingPopup.cxx Tue Mar 26 04:15:41 2013
@@ -0,0 +1,79 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/
+
+#include "TextCharacterSpacingPopup.hxx"
+#include "TextCharacterSpacingControl.hxx"
+#include <boost/bind.hpp>
+#include <unotools/viewoptions.hxx>
+
+namespace svx { namespace sidebar {
+
+TextCharacterSpacingPopup::TextCharacterSpacingPopup (
+    Window* pParent,
+    const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator)
+    : Popup(
+        pParent,
+        rControlCreator, 
+        ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Character Spacing")))
+{
+	SetPopupModeEndHandler(::boost::bind(&TextCharacterSpacingPopup::PopupModeEndCallback, this));
+}
+
+
+
+
+TextCharacterSpacingPopup::~TextCharacterSpacingPopup (void)
+{
+}
+
+
+
+
+void TextCharacterSpacingPopup::Rearrange (bool bLBAvailable,bool bAvailable, long nKerning)
+{
+    ProvideContainerAndControl();
+
+    TextCharacterSpacingControl* pControl = dynamic_cast<TextCharacterSpacingControl*>(mpControl.get());
+    if (pControl != NULL)
+        pControl->Rearrange(bLBAvailable,bAvailable,nKerning);	
+}
+
+void TextCharacterSpacingPopup::PopupModeEndCallback (void)
+{
+	ProvideContainerAndControl();
+	TextCharacterSpacingControl* pControl = dynamic_cast<TextCharacterSpacingControl*>(mpControl.get());
+	if (pControl == NULL)
+		return;
+	
+	if( pControl->GetLastCustomState() == SPACING_CLOSE_BY_CUS_EDIT)
+	{
+		SvtViewOptions aWinOpt( E_WINDOW, SIDEBAR_SPACING_GLOBAL_VALUE );
+		::com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue > aSeq(1);
+		aSeq[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Spacing") ); 
+		aSeq[0].Value <<= ::rtl::OUString( String::CreateFromInt32( pControl->GetLastCustomValue() ));
+		aWinOpt.SetUserData( aSeq );
+
+	}
+}
+
+
+} } // end of namespace svx::sidebar
+

Added: openoffice/branches/sidebar/main/svx/source/sidebar/text/TextCharacterSpacingPopup.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/svx/source/sidebar/text/TextCharacterSpacingPopup.hxx?rev=1460970&view=auto
==============================================================================
--- openoffice/branches/sidebar/main/svx/source/sidebar/text/TextCharacterSpacingPopup.hxx (added)
+++ openoffice/branches/sidebar/main/svx/source/sidebar/text/TextCharacterSpacingPopup.hxx Tue Mar 26 04:15:41 2013
@@ -0,0 +1,48 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/
+
+#ifndef _SVX_SIDEBAR_CHARACTER_SPACING_POPUP_HXX_
+#define _SVX_SIDEBAR_CHARACTER_SPACING_POPUP_HXX_
+
+#include "svx/sidebar/Popup.hxx"
+
+#include <boost/function.hpp>
+
+namespace svx { namespace sidebar {
+
+class TextCharacterSpacingPopup
+    : public Popup
+{
+public :
+    TextCharacterSpacingPopup (
+        Window* pParent,
+        const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator);
+    ~TextCharacterSpacingPopup (void);
+
+    void Rearrange (bool bLBAvailable,bool bAvailable, long nKerning);
+private:
+    void PopupModeEndCallback (void);
+};
+
+} } // end of namespace svx::sidebar
+
+#endif
+

Modified: openoffice/branches/sidebar/main/svx/source/sidebar/text/TextPropertyPanel.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/svx/source/sidebar/text/TextPropertyPanel.cxx?rev=1460970&r1=1460969&r2=1460970&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/svx/source/sidebar/text/TextPropertyPanel.cxx (original)
+++ openoffice/branches/sidebar/main/svx/source/sidebar/text/TextPropertyPanel.cxx Tue Mar 26 04:15:41 2013
@@ -52,6 +52,15 @@
 #include <vcl/gradient.hxx>
 #include <vcl/svapp.hxx>
 #include <vcl/toolbox.hxx>
+#include "TextCharacterSpacingControl.hxx"
+#include "TextCharacterSpacingPopup.hxx"
+#include "TextUnderlineControl.hxx"
+#include "TextUnderlinePopup.hxx"
+#include "sidebar/ColorControl.hxx"
+#include "svx/sidebar/PopupContainer.hxx"
+
+
+#include <boost/bind.hpp>
 
 using namespace css;
 using namespace cssu;
@@ -69,21 +78,58 @@ namespace svx { namespace sidebar {
 #define SIZE_CONTROL_WIDTH 		80
 #define CONTROL_COMBOX_HEIGHT	20
 #define CONTROL_HEIGHT_5X  		120
-#define SIDEBAR_SPACE_NORMAL	0
-#define SIDEBAR_SPACE_EXPAND	1
-#define SIDEBAR_SPACE_CONDENSED	2
-#define SIDEBAR_SPACING_GLOBAL_VALUE	String("PopupPanal_Spacing", 18, RTL_TEXTENCODING_ASCII_US)
+
+
 #define TEXT_SECTIONPAGE_HEIGHT_S   SECTIONPAGE_MARGIN_VERTICAL_TOP + CBOX_HEIGHT  + ( TOOLBOX_ITEM_HEIGHT + 2 ) + CONTROL_SPACING_VERTICAL * 1 + SECTIONPAGE_MARGIN_VERTICAL_BOT
 #define TEXT_SECTIONPAGE_HEIGHT		SECTIONPAGE_MARGIN_VERTICAL_TOP + CBOX_HEIGHT  + ( TOOLBOX_ITEM_HEIGHT + 2 ) * 2 + CONTROL_SPACING_VERTICAL * 2 + SECTIONPAGE_MARGIN_VERTICAL_BOT
 
 //
-#define SPACING_NOCUSTOM				0
-#define SPACING_CLOSE_BY_CLICK_ICON		-1
-#define SPACING_CLOSE_BY_CUS_EDIT		1
+
 //end
+PopupControl* TextPropertyPanel::CreateCharacterSpacingControl (PopupContainer* pParent)
+{
+    return new TextCharacterSpacingControl(pParent, *this);
+}
 
+PopupControl* TextPropertyPanel::CreateUnderlinePopupControl (PopupContainer* pParent)
+{
+	return new TextUnderlineControl(pParent, *this);
+}
 
+PopupControl* TextPropertyPanel::CreateFontColorPopupControl (PopupContainer* pParent)
+{
+    return new ColorControl(
+        pParent,
+        mpBindings,
+        SVX_RES(RID_POPUPPANEL_TEXTPAGE_FONT_COLOR),
+        SVX_RES(VS_FONT_COLOR),
+        ::boost::bind(&TextPropertyPanel::GetFontColor, this),
+        ::boost::bind(&TextPropertyPanel::SetFontColor, this, _1,_2),
+        pParent,
+        0);
+}
+
+PopupControl* TextPropertyPanel::CreateBrushColorPopupControl (PopupContainer* pParent)
+{
+    return new ColorControl(
+        pParent,
+        mpBindings,
+        SVX_RES(RID_POPUPPANEL_TEXTPAGE_FONT_COLOR),
+        SVX_RES(VS_FONT_COLOR),
+        ::boost::bind(&TextPropertyPanel::GetBrushColor, this),
+        ::boost::bind(&TextPropertyPanel::SetBrushColor, this, _1,_2),
+        pParent,
+        0);
+}
 
+long TextPropertyPanel::GetSelFontSize()
+{
+    long nH = 240;
+    SfxMapUnit eUnit = maSpacingControl.GetCoreMetric();
+    if (mpHeightItem)
+        nH = LogicToLogic(  mpHeightItem->GetHeight(), (MapUnit)eUnit, MAP_TWIP );
+    return nH;
+} 
 
 
 TextPropertyPanel* TextPropertyPanel::Create (
@@ -105,7 +151,10 @@ TextPropertyPanel* TextPropertyPanel::Cr
 }
 
 
-
+::sfx2::sidebar::ControllerItem& TextPropertyPanel::GetSpaceController()
+{
+	return maSpacingControl;
+}
 
 TextPropertyPanel::TextPropertyPanel (
     Window* pParent,
@@ -142,6 +191,10 @@ TextPropertyPanel::TextPropertyPanel (
         mpToolBoxHighlight(ControlFactory::CreateToolBox(
                 mpToolBoxHighlightBackground.get(),
                 SVX_RES(TB_HIGHLIGHT))),
+	maCharSpacePopup(this, ::boost::bind(&TextPropertyPanel::CreateCharacterSpacingControl, this, _1)),
+	maFontColorPopup(this, ::boost::bind(&TextPropertyPanel::CreateFontColorPopupControl, this, _1)),
+	maBrushColorPopup(this, ::boost::bind(&TextPropertyPanel::CreateBrushColorPopupControl, this, _1)),
+	maUnderlinePopup(this, ::boost::bind(&TextPropertyPanel::CreateUnderlinePopupControl, this, _1)),
         mpFontColorUpdater(),
         mpHighlightUpdater(),
 
@@ -190,14 +243,6 @@ TextPropertyPanel::TextPropertyPanel (
         mpFontList			(NULL),
         mbMustDelete		(false),
         mbFocusOnFontSizeCtrl(false),
-        /*AF
-        mpFloatWinUnderline(NULL),
-        mpPageUnderline(NULL),
-        mpFloatWinFontColor(NULL),
-        mpPageFontColor(NULL),
-        mpFloatWinSpacing(NULL),
-        mpPageSpacing(NULL)
-        */
         mxFrame(rxFrame),
         maContext(),
         mpBindings(pBindings)
@@ -256,6 +301,10 @@ Image TextPropertyPanel::GetIcon (const 
 }
 
 
+void TextPropertyPanel::SetSpacing(long nKern)
+{
+	mlKerning = nKern;
+}
 
 
 void TextPropertyPanel::HandleContextChange (
@@ -349,7 +398,10 @@ void TextPropertyPanel::HandleContextCha
     }
 }
 
-
+SfxBindings* TextPropertyPanel::GetBindings() 
+{ 
+    return mpBindings; 
+}
 
 
 void TextPropertyPanel::DataChanged (const DataChangedEvent& rEvent)
@@ -392,17 +444,17 @@ void TextPropertyPanel::Initialize (void
     InitToolBoxHighlight();
 
 #ifdef HAS_IA2
-    mpFontNameBox->SetAccRelationLabeledBy(&maFontNameBox);
-    mpFontNameBox->SetMpSubEditAccLableBy(&maFontNameBox);
+    mpFontNameBox->SetAccRelationLabeledBy(&mpFontNameBox);
+    mpFontNameBox->SetMpSubEditAccLableBy(&mpFontNameBox);
     maFontSizeBox.SetAccRelationLabeledBy(&maFontSizeBox);
     maFontSizeBox.SetMpSubEditAccLableBy(&maFontSizeBox);
-    maToolBoxFont.SetAccRelationLabeledBy(&maToolBoxFont);
-    maToolBoxIncDec.SetAccRelationLabeledBy(&maToolBoxIncDec);
-    maToolBoxFontColor.SetAccRelationLabeledBy(&maToolBoxFontColor);
-    maToolBoxScript.SetAccRelationLabeledBy(&maToolBoxScript);
-    maToolBoxScriptSw.SetAccRelationLabeledBy(&maToolBoxScriptSw);
-    maToolBoxSpacing.SetAccRelationLabeledBy(&maToolBoxSpacing);
-    maToolBoxHighlight.SetAccRelationLabeledBy(&maToolBoxHighlight);
+    mpToolBoxFont.SetAccRelationLabeledBy(&mpToolBoxFont);
+    mpToolBoxIncDec.SetAccRelationLabeledBy(&mpToolBoxIncDec);
+    mpToolBoxFontColor.SetAccRelationLabeledBy(&mpToolBoxFontColor);
+    mpToolBoxScript.SetAccRelationLabeledBy(&mpToolBoxScript);
+    mpToolBoxScriptSw.SetAccRelationLabeledBy(&mpToolBoxScriptSw);
+    mpToolBoxSpacing.SetAccRelationLabeledBy(&mpToolBoxSpacing);
+    mpToolBoxHighlight.SetAccRelationLabeledBy(&mpToolBoxHighlight);
 #endif
 
     //init state
@@ -464,7 +516,15 @@ void TextPropertyPanel::Initialize (void
     //end
 }
 
+void TextPropertyPanel::EndSpacingPopupMode (void)
+{
+    maCharSpacePopup.Hide();
+}
 
+void TextPropertyPanel::EndUnderlinePopupMode (void)
+{
+	maUnderlinePopup.Hide();
+}
 
 
 void TextPropertyPanel::InitToolBoxFont()
@@ -881,30 +941,18 @@ IMPL_LINK(TextPropertyPanel, ToolboxIncD
 
 
 
-
 IMPL_LINK(TextPropertyPanel, ToolBoxUnderlineClickHdl, ToolBox*, pToolBox)
 {
 	const sal_uInt16 nId = pToolBox->GetCurItemId();
+	OSL_ASSERT(nId == TBI_UNDERLINE);
 	if(nId == TBI_UNDERLINE)
 	{
 		pToolBox->SetItemDown( nId, true );
+		maUnderlinePopup.Rearrange(meUnderline);
+		maUnderlinePopup.Show(*pToolBox);
 
-        /**AF
-		SvxTextUnderlinePage* pUnderlinePage = GetUnderlinePage();
-		Size aFloatSz = pUnderlinePage->GetOutputSizePixel();
-		GetUnderlineFloatWin()->SetSizePixel( aFloatSz );
-
-		Point aPos = mpToolBoxFont->GetPosPixel();
-		aPos = OutputToScreenPixel( aPos );
-		Size aSize = mpToolBoxFont->GetSizePixel();
-		Rectangle aRect( aPos, aSize );
-
-		GetUnderlineFloatWin()->StartPopupMode( aRect, FLOATWIN_POPUPMODE_NOFOCUSCLOSE|FLOATWIN_POPUPMODE_DOWN );
-		GetUnderlineFloatWin()->SetPopupModeFlags(GetUnderlineFloatWin()->GetPopupModeFlags() | FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE );
-		pUnderlinePage->SetUnderlineSelect(meUnderline);
-        */
 	}
-	return 0;
+	return 0L;
 }
 
 
@@ -919,23 +967,8 @@ IMPL_LINK(TextPropertyPanel, ToolBoxFont
 
 		pToolBox->SetItemDown( nId, true );
 
-        /*AF
-		SvxTextFontColorPage* pFontColorPage = GetFontColorPage();
-	
-		Size aFloatSz = pFontColorPage->GetOutputSizePixel();
-		GetFontColorFloatWin()->SetSizePixel( aFloatSz );
-
-		Point aPos = mpToolBoxFontColor->GetPosPixel();
-		aPos = OutputToScreenPixel( aPos );
-		Size aSize = mpToolBoxFontColor->GetSizePixel();
-		Rectangle aRect( aPos, aSize );
-
-		GetFontColorFloatWin()->StartPopupMode( aRect, FLOATWIN_POPUPMODE_NOFOCUSCLOSE|FLOATWIN_POPUPMODE_DOWN );
-		GetFontColorFloatWin()->SetPopupModeFlags(GetFontColorFloatWin()->GetPopupModeFlags() | FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE );
-
-		pFontColorPage->GetFocus();
-		pFontColorPage->SetCurColorSelect(maColor, mbColorAvailable);
-        */
+		maFontColorPopup.Show(*pToolBox);
+		maFontColorPopup.SetCurrentColor(maColor, mbColorAvailable);
 	}
 	return 0;
 }
@@ -1015,57 +1048,27 @@ IMPL_LINK(TextPropertyPanel, ToolBoxHigh
 		meColorType = BACK_COLOR;
 
 		pToolBox->SetItemDown( nId, true );
+		maBrushColorPopup.Show(*pToolBox);
+		maBrushColorPopup.SetCurrentColor(maBackColor, mbBackColorAvailable);
 
-        /*AF
-		SvxTextFontColorPage* pFontColorPage = GetFontColorPage();
-
-		Size aFloatSz = pFontColorPage->GetOutputSizePixel();
-		GetFontColorFloatWin()->SetSizePixel( aFloatSz );
-
-		Point aPos = mpToolBoxHighlight->GetPosPixel();
-		aPos = OutputToScreenPixel( aPos );
-		Size aSize = mpToolBoxHighlight->GetSizePixel();
-		Rectangle aRect( aPos, aSize );
-
-		GetFontColorFloatWin()->StartPopupMode( aRect, FLOATWIN_POPUPMODE_NOFOCUSCLOSE|FLOATWIN_POPUPMODE_DOWN );
-		GetFontColorFloatWin()->SetPopupModeFlags(GetFontColorFloatWin()->GetPopupModeFlags() | FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE );
-
-		pFontColorPage->GetFocus();
-		pFontColorPage->SetCurColorSelect(maBackColor,
-		mbBackColorAvailable);
-        */
 	}
 	return 0;
 }
 
 
 
-
 IMPL_LINK(TextPropertyPanel, SpacingClickHdl, ToolBox*, pToolBox)
 {
 	const sal_uInt16 nId = pToolBox->GetCurItemId();
+	OSL_ASSERT(nId == TBI_SPACING);
 	if(nId == TBI_SPACING)
 	{
 		pToolBox->SetItemDown( nId, true );
+		maCharSpacePopup.Rearrange(mbKernLBAvailable,mbKernAvailable,mlKerning);
+		maCharSpacePopup.Show(*pToolBox);
 
-        /*AF
-		SvxTextSpacingPage* pSpacingPage = GetSpacingPage();
-		pSpacingPage->SetControlState(mbKernLBAvailable,mbKernAvailable,mlKerning);
-
-		Size aFloatSz = pSpacingPage->GetOutputSizePixel();
-		GetSpacingFloatWin()->SetSizePixel( aFloatSz );
-
-		Point aPos = mpToolBoxSpacing->GetPosPixel();
-		aPos = OutputToScreenPixel( aPos );
-		Size aSize = mpToolBoxSpacing->GetSizePixel();
-		Rectangle aRect( aPos, aSize );
-
-		GetSpacingFloatWin()->StartPopupMode( aRect, FLOATWIN_POPUPMODE_NOFOCUSCLOSE|FLOATWIN_POPUPMODE_DOWN );
-		GetSpacingFloatWin()->SetPopupModeFlags(GetSpacingFloatWin()->GetPopupModeFlags() | FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE );
-		pSpacingPage->GetFocus();
-        */
 	}
-	return 0;
+	return 0L;
 }
 
 
@@ -1079,24 +1082,6 @@ IMPL_LINK( TextPropertyPanel, ImplPopupM
 
 
 
-IMPL_LINK( TextPropertyPanel, ImplSpacingPopupModeEndHdl, FloatingWindow*, EMPTYARG )
-{
-    /*AF
-	if(mpPageSpacing)
-	{
-		if( mpPageSpacing->GetLastCustomState() == SPACING_CLOSE_BY_CUS_EDIT)
-		{
-			SvtViewOptions aWinOpt( E_WINDOW, SIDEBAR_SPACING_GLOBAL_VALUE );
-			::com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue > aSeq(1);
-			aSeq[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Spacing") ); 
-			aSeq[0].Value <<= ::rtl::OUString( String::CreateFromInt32( mpPageSpacing->GetLastCustomValue() ));
-			aWinOpt.SetUserData( aSeq );
-
-		}
-	}
-    */
-	return 0;
-}
 
 
 
@@ -1300,8 +1285,8 @@ void TextPropertyPanel::NotifyItemUpdate
         case SID_ATTR_CHAR_COLOR:
             if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxColorItem))
             {
-                const SvxBrushItem* pItem =  (const SvxBrushItem*)pState;
-                maColor = pItem->GetColor();
+                const SvxColorItem* pItem =  (const SvxColorItem*)pState;
+                maColor = pItem->GetValue();
                 mbColorAvailable = true;
 				if (mpFontColorUpdater)
 	                mpFontColorUpdater->Update(maColor);
@@ -1574,45 +1559,42 @@ void  TextPropertyPanel::UpdateFontScrip
 	}
 }
 
-/*
-USHORT TextPropertyPanel::GetCurrColorType()
+Color TextPropertyPanel::GetFontColor (void) const
 {
-	return meColorType;
+    return maColor;
 }
-long TextPropertyPanel::GetSelFontSize()
-{
-    long nH = 240;
-    SfxMapUnit eUnit = maSpacingControl.GetCoreMetric();
-    if (mpHeightItem)
-        nH = LogicToLogic(  mpHeightItem->GetHeight(), (MapUnit)eUnit, MAP_TWIP );
-    return nH;
-} 
-SfxPropertyPageController TextPropertyPanel::GetSpaceController()
+
+void TextPropertyPanel::SetFontColor (
+    const String& rsColorName,
+    const Color aColor)
 {
-	return maSpacingControl;
+	SvxColorItem aColorItem(aColor, SID_ATTR_CHAR_COLOR);
+	mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_COLOR, SFX_CALLMODE_RECORD, &aColorItem, 0L);
+	maColor = aColor;
 }
 
-//add 
-Color& TextPropertyPanel::GetUnderlineColor() 
+Color TextPropertyPanel::GetBrushColor (void) const
 {
-	return meUnderlineColor;
+    return maBackColor;
 }
-//add end
-void TextPropertyPanel::SetBackColor(Color aCol)
+
+void TextPropertyPanel::SetBrushColor (
+    const String& rsColorName,
+    const Color aColor)
 {
-	maBackColor = aCol;
+	SvxBrushItem aBrushItem(aColor, SID_ATTR_BRUSH_CHAR);
+	mpBindings->GetDispatcher()->Execute(SID_ATTR_BRUSH_CHAR, SFX_CALLMODE_RECORD, &aBrushItem, 0L);
+	maBackColor = aColor;
 }
-void TextPropertyPanel::SetColor(Color aCol)
+
+Color& TextPropertyPanel::GetUnderlineColor() 
 {
-	maColor = aCol;
+	return meUnderlineColor;
 }
+
 void TextPropertyPanel::SetUnderline(FontUnderline	eUnderline)
 {
 	meUnderline = eUnderline;
 }
-void TextPropertyPanel::SetSpacing(long nKern)
-{
-	mlKerning = nKern;
-}
-*/
+
 } } // end of namespace svx::sidebar

Modified: openoffice/branches/sidebar/main/svx/source/sidebar/text/TextPropertyPanel.hrc
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/svx/source/sidebar/text/TextPropertyPanel.hrc?rev=1460970&r1=1460969&r2=1460970&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/svx/source/sidebar/text/TextPropertyPanel.hrc (original)
+++ openoffice/branches/sidebar/main/svx/source/sidebar/text/TextPropertyPanel.hrc Tue Mar 26 04:15:41 2013
@@ -26,7 +26,8 @@
 #define CUSTOM_WIDTH			VS_SPACING_WIDTH - 8
 #define CUSTOM_X				POPUPPANEL_MARGIN_LARGE + OFFSET_X + 1
 #define CUSTOM_Y				OFFSET_Y + POPUPPANEL_MARGIN_SMALL * 3 + 15 * 6 + TEXT_HEIGHT
-
+#define VS_UNDERLINE_WIDTH	57
+#define VS_UNDERLINE_HEIGHT	 12 * 10
 //#define FT_TEST					1
 #define CB_SBFONT_FONT			2
 #define MB_SBFONT_FONTSIZE		3
@@ -81,15 +82,11 @@
 
 #define IMG_SPACING_D				71
 
-#define STR_QH_BOLD				72
-#define STR_QH_ITALIC			73
-#define STR_QH_UNDERLINE		74
-
 //popup window underline
 #define	VS_UNDERLINE			1
 #define PB_OPTIONS				2
-// #define BMP_UNDERLINE_MORE		3
-// #define BMP_UNDERLINE_MORE_H	4	
+#define BMP_UNDERLINE_MORE		3
+#define BMP_UNDERLINE_MORE_H	4	
 
 #define IMG_SINGLE				10
 #define IMG_DOUBLE				11
@@ -180,6 +177,9 @@
 #define STR_CUSTOM_C_TIP			72
 #define STR_CUSTOM_E_TIP			73
 #define STR_PT						74
+#define STR_QH_BOLD				75
+#define STR_QH_ITALIC			76
+#define STR_QH_UNDERLINE		77
 
 //help ids
 #define	HID_COMBO_FONT_NAME				"SVX_HID_COMBO_FONT_NAME"

Modified: openoffice/branches/sidebar/main/svx/source/sidebar/text/TextPropertyPanel.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/svx/source/sidebar/text/TextPropertyPanel.hxx?rev=1460970&r1=1460969&r2=1460970&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/svx/source/sidebar/text/TextPropertyPanel.hxx (original)
+++ openoffice/branches/sidebar/main/svx/source/sidebar/text/TextPropertyPanel.hxx Tue Mar 26 04:15:41 2013
@@ -35,7 +35,10 @@
 #include <com/sun/star/ui/XUIElement.hpp>
 
 #include <boost/scoped_ptr.hpp>
-
+#include "TextCharacterSpacingPopup.hxx"
+#include "TextUnderlinePopup.hxx"
+#include "sidebar/ColorPopup.hxx"
+#include <vcl/vclenum.hxx>
 
 class FloatingWindow;
 class ToolBox;
@@ -43,10 +46,12 @@ class ToolBox;
 namespace svx { namespace sidebar {
 
 class SvxSBFontNameBox;
+class PopupControl;
+class PopupContainer;
 
 class TextPropertyPanel
     : public Control,
-      public ::sfx2::sidebar::IContextChangeReceiver,
+       public ::sfx2::sidebar::IContextChangeReceiver,
       public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
 {
 public:
@@ -56,30 +61,20 @@ public:
         SfxBindings* pBindings);
 
     virtual void DataChanged (const DataChangedEvent& rEvent);
+    SfxBindings* GetBindings();
+    ::sfx2::sidebar::ControllerItem& GetSpaceController();
+    long GetSelFontSize();
+    void SetSpacing(long nKern);
+    void EndSpacingPopupMode (void);
+    void EndUnderlinePopupMode (void);
+	Color GetFontColor (void) const;
+	void SetFontColor (const String& rsColorName,const Color aColor);
+	Color GetBrushColor (void) const;
+	void SetBrushColor (const String& rsColorName,const Color aColor);
+	void SetUnderline(FontUnderline	eUnderline);
+	Color& GetUnderlineColor(); 
+	void SetDefaultUnderline(FontUnderline eUnderline);
 
-    //	void SetDefaultUnderline(FontUnderline eUnderline);
-    //	USHORT GetCurrColorType();
-
-    //	void SetBackColor(Color aCol);
-    //	void SetColor(Color aCol);
-    //	void SetUnderline(FontUnderline	eUnderline);
-    //	void SetSpacing(long nKern);
-
-    /*
-	SvxTextUnderlinePage* GetUnderlinePage();
-	SfxPopupPanelWin* GetUnderlineFloatWin();
-
-	SvxTextFontColorPage* GetFontColorPage();
-	SfxPopupPanelWin* GetFontColorFloatWin();
-
-	SvxTextSpacingPage* GetSpacingPage();
-	SfxPopupPanelWin* GetSpacingFloatWin();
-    */
-    //	long GetSelFontSize();
-    //	SfxPropertyPageController GetSpaceController();
-//	ToolBox* GetSpacingTB();		//removed
-    //	Color& GetUnderlineColor();  //
-//	void FontListChanged();
 
     enum ColorType
     {
@@ -185,6 +180,10 @@ private:
 	const FontList* mpFontList;
 	bool mbMustDelete;
 	bool mbFocusOnFontSizeCtrl;
+	TextCharacterSpacingPopup maCharSpacePopup;
+	TextUnderlinePopup maUnderlinePopup;
+	ColorPopup maFontColorPopup; 
+	ColorPopup maBrushColorPopup; 
 
     cssu::Reference<css::frame::XFrame> mxFrame;
     ::sfx2::sidebar::EnumContext maContext;
@@ -194,7 +193,17 @@ private:
         Window* pParent,
         const cssu::Reference<css::frame::XFrame>& rxFrame,
         SfxBindings* pBindings);
-    virtual ~TextPropertyPanel (void);
+	virtual ~TextPropertyPanel (void);
+
+	
+	PopupControl* CreateCharacterSpacingControl (PopupContainer* pParent);
+	PopupControl* CreateFontColorPopupControl (PopupContainer* pParent);
+	PopupControl* CreateBrushColorPopupControl (PopupContainer* pParent);
+	PopupControl* CreateUnderlinePopupControl (PopupContainer* pParent);
+	DECL_LINK(SpacingClickHdl, ToolBox*);
+	DECL_LINK(ToolBoxFontColorDropHdl, ToolBox *); //for new color picker 
+	DECL_LINK(ToolBoxHighlightDropHdl, ToolBox *);
+	DECL_LINK(ToolBoxUnderlineClickHdl, ToolBox* );
 
 	void Initialize (void);
     void SetupIcons (void);
@@ -212,33 +221,17 @@ private:
 	void UpdateFontShadowed();
 	void UpdateFontScript();
 
-    /*
-	SfxPopupPanelWin*		mpFloatWinUnderline;
-	class SvxTextUnderlinePage;
-	SvxTextUnderlinePage*	mpPageUnderline; 
-
-	SfxPopupPanelWin*		mpFloatWinFontColor;
-	class SvxTextFontColorPage;
-	SvxTextFontColorPage*	mpPageFontColor; 
-
-	SfxPopupPanelWin*		mpFloatWinSpacing;
-	class SvxTextSpacingPage;
-	SvxTextSpacingPage*		mpPageSpacing;
-    */
 	DECL_LINK(FontSelHdl, FontNameBox *);
 	DECL_LINK(FontSizeModifyHdl, FontSizeBox *);
 	DECL_LINK(FontSizeSelHdl, FontSizeBox *);
 	DECL_LINK(FontSizeLoseFocus, FontSizeBox *);
 	DECL_LINK(ToolboxFontSelectHandler, ToolBox *);
 	DECL_LINK(ToolboxIncDecSelectHdl, ToolBox *);
-	DECL_LINK(ToolBoxUnderlineClickHdl, ToolBox* );
 	DECL_LINK(ImplPopupModeEndHdl, FloatingWindow* );
-	DECL_LINK(ImplSpacingPopupModeEndHdl, FloatingWindow* );  //
-	DECL_LINK(ToolBoxFontColorDropHdl, ToolBox *);
 	DECL_LINK(ToolBoxSwScriptSelectHdl, ToolBox *);
 	DECL_LINK(ToolBoxScriptSelectHdl, ToolBox *);
-	DECL_LINK(SpacingClickHdl, ToolBox*);
-	DECL_LINK(ToolBoxHighlightDropHdl, ToolBox *);
+	
+	
 
 	void TextStyleChanged();
 

Modified: openoffice/branches/sidebar/main/svx/source/sidebar/text/TextPropertyPanel.src
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/svx/source/sidebar/text/TextPropertyPanel.src?rev=1460970&r1=1460969&r2=1460970&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/svx/source/sidebar/text/TextPropertyPanel.src (original)
+++ openoffice/branches/sidebar/main/svx/source/sidebar/text/TextPropertyPanel.src Tue Mar 26 04:15:41 2013
@@ -388,14 +388,14 @@ Control RID_POPUPPANEL_TEXTPAGE_UNDERLIN
 	DialogControl = TRUE;
 	Border = FALSE;
 	
-	Size = MAP_APPFONT(  POPUPPANEL_MARGIN_SMALL * 2 + POPUP_BORDER_WIDTH ,  13 + POPUP_BORDER_HEIGHT + POPUPPANEL_MARGIN_SMALL * 2 + POPUPPANEL_MARGIN_LARGE);
+	Size = MAP_APPFONT(  POPUPPANEL_MARGIN_SMALL * 2 + POPUP_BORDER_WIDTH + VS_UNDERLINE_WIDTH,  13+ VS_UNDERLINE_HEIGHT + POPUP_BORDER_HEIGHT + POPUPPANEL_MARGIN_SMALL * 2 + POPUPPANEL_MARGIN_LARGE);
 	Control VS_UNDERLINE
 	{
 //		HelpID = HID_UNDERLINE_VS ;
 		HelpID = HID_PPROPERTYPANEL_TEXT_UNDERLINE_VS;
         Hide = TRUE ;
         Pos = MAP_APPFONT(  POPUPPANEL_MARGIN_SMALL + OFFSET_X , POPUPPANEL_MARGIN_SMALL + OFFSET_Y ); 
-        Size = MAP_APPFONT ( 97  , 12 * 10);
+        Size = MAP_APPFONT ( VS_UNDERLINE_WIDTH  ,VS_UNDERLINE_HEIGHT);
 		TabStop = TRUE ;
 		Text = "Underline";
 	};
@@ -403,8 +403,8 @@ Control RID_POPUPPANEL_TEXTPAGE_UNDERLIN
 	PushButton PB_OPTIONS
 	{
 		HelpID = HID_UNDERLINE_BTN;
-		Pos = MAP_APPFONT (  POPUPPANEL_MARGIN_LARGE  , POPUPPANEL_MARGIN_SMALL * 2 + OFFSET_Y  ); 
-		Size = MAP_APPFONT ( POPUPPANEL_MARGIN_HORIZONTAL * 2 , 13 );
+		Pos = MAP_APPFONT (  POPUPPANEL_MARGIN_SMALL + OFFSET_X  , POPUPPANEL_MARGIN_SMALL * 2 + OFFSET_Y + VS_UNDERLINE_HEIGHT ); 
+		Size = MAP_APPFONT ( VS_UNDERLINE_WIDTH, 13 );
 		TabStop = TRUE;
 		Text [ en-US ] = "~More Options...";
 	};

Added: openoffice/branches/sidebar/main/svx/source/sidebar/text/TextUnderlineControl.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/svx/source/sidebar/text/TextUnderlineControl.cxx?rev=1460970&view=auto
==============================================================================
--- openoffice/branches/sidebar/main/svx/source/sidebar/text/TextUnderlineControl.cxx (added)
+++ openoffice/branches/sidebar/main/svx/source/sidebar/text/TextUnderlineControl.cxx Tue Mar 26 04:15:41 2013
@@ -0,0 +1,281 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/
+
+#include "precompiled_svx.hxx"
+#include "TextUnderlineControl.hxx"
+#include "TextPropertyPanel.hrc"
+#include <sfx2/sidebar/propertypanel.hrc>
+#include <svx/dialogs.hrc>
+#include <svx/dialmgr.hxx>
+#include <unotools/viewoptions.hxx>
+#include <editeng/kernitem.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/sidebar/Theme.hxx>
+#include <editeng/udlnitem.hxx>
+
+namespace svx { namespace sidebar {
+
+TextUnderlineControl::TextUnderlineControl(Window* pParent, svx::sidebar::TextPropertyPanel& rPanel)
+:	svx::sidebar::PopupControl( pParent,SVX_RES(RID_POPUPPANEL_TEXTPAGE_UNDERLINE))
+,	mrTextPropertyPanel(rPanel)
+,	mpBindings(NULL)
+,	maVSUnderline( this, SVX_RES(VS_UNDERLINE))
+,	maPBOptions	(this, SVX_RES(PB_OPTIONS) )
+
+,	maIMGSingle		(SVX_RES(IMG_SINGLE))
+,	maIMGDouble		(SVX_RES(IMG_DOUBLE))
+,	maIMGBold		(SVX_RES(IMG_BOLD2))
+,	maIMGDot		(SVX_RES(IMG_DOT))
+,	maIMGDotBold	(SVX_RES(IMG_DOT_BOLD))
+,	maIMGDash		(SVX_RES(IMG_DASH))
+,	maIMGDashLong	(SVX_RES(IMG_DASH_LONG))
+,	maIMGDashDot	(SVX_RES(IMG_DASH_DOT))
+,	maIMGDashDotDot	(SVX_RES(IMG_DASH_DOT_DOT))
+,	maIMGWave		(SVX_RES(IMG_WAVE))
+
+// high contrast
+,	maIMGSingleH	(SVX_RES(IMG_SINGLE_H))
+,	maIMGDoubleH	(SVX_RES(IMG_DOUBLE_H))
+,	maIMGBoldH		(SVX_RES(IMG_BOLD2_H))
+,	maIMGDotH		(SVX_RES(IMG_DOT_H))
+,	maIMGDotBoldH	(SVX_RES(IMG_DOT_BOLD_H))
+,	maIMGDashH		(SVX_RES(IMG_DASH_H))
+,	maIMGDashLongH	(SVX_RES(IMG_DASH_LONG_H))
+,	maIMGDashDotH	(SVX_RES(IMG_DASH_DOT_H))
+,	maIMGDashDotDotH(SVX_RES(IMG_DASH_DOT_DOT_H))
+,	maIMGWaveH		(SVX_RES(IMG_WAVE_H))
+
+,	maIMGSingleSel		(SVX_RES(IMG_SINGLE_SEL))
+,	maIMGDoubleSel		(SVX_RES(IMG_DOUBLE_SEL))
+,	maIMGBoldSel		(SVX_RES(IMG_BOLD2_SEL))
+,	maIMGDotSel			(SVX_RES(IMG_DOT_SEL))
+,	maIMGDotBoldSel		(SVX_RES(IMG_DOT_BOLD_SEL))
+,	maIMGDashSel		(SVX_RES(IMG_DASH_SEL))
+,	maIMGDashLongSel	(SVX_RES(IMG_DASH_LONG_SEL))
+,	maIMGDashDotSel		(SVX_RES(IMG_DASH_DOT_SEL))
+,	maIMGDashDotDotSel	(SVX_RES(IMG_DASH_DOT_DOT_SEL))
+,	maIMGWaveSel		(SVX_RES(IMG_WAVE_SEL))
+
+{
+	initial();
+	FreeResource();
+	mpBindings = mrTextPropertyPanel.GetBindings();
+}
+
+void TextUnderlineControl::initial()
+{
+	/*maPBOptions.SetDefBkColor(GetSettings().GetStyleSettings().GetHighContrastMode()?
+		GetSettings().GetStyleSettings().GetMenuColor():
+		sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_DropDownBackground ));//Color(244,245,249)//for high contract
+	maPBOptions.SetHoverBkColor(GetSettings().GetStyleSettings().GetHighContrastMode()?
+		GetSettings().GetStyleSettings().GetMenuColor():
+		sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground ) );//Color( 93, 120, 163 )
+	maPBOptions.SetHoverTxtColor( sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Color_PanelTitleFont ) );//Color( 255, 255, 255 )
+	maPBOptions.SetIcoPosX( 2);*/
+	maVSUnderline.SetColor(GetSettings().GetStyleSettings().GetHighContrastMode()?
+		GetSettings().GetStyleSettings().GetMenuColor():
+		sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground ));
+	maVSUnderline.SetBackground(GetSettings().GetStyleSettings().GetHighContrastMode()?
+		GetSettings().GetStyleSettings().GetMenuColor():
+		sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground ));
+
+	Link aLink = LINK( this, TextUnderlineControl, PBClickHdl ) ;
+	maPBOptions.SetClickHdl(aLink);
+
+	maVSUnderline.SetStyle( maVSUnderline.GetStyle()| WB_3DLOOK |  WB_NO_DIRECTSELECT  );// WB_NAMEFIELD | WB_ITEMBORDER |WB_DOUBLEBORDER | WB_NONEFIELD |
+
+	maVSUnderline.InsertItem(1, maIMGSingle ,String(SVX_RES(STR_SINGLE)));
+	maVSUnderline.SetItemData(1, (void*)(sal_uInt64)UNDERLINE_SINGLE);
+
+	maVSUnderline.InsertItem(2, maIMGDouble ,String(SVX_RES(STR_DOUBLE)));
+	maVSUnderline.SetItemData(2, (void*)(sal_uInt64)UNDERLINE_DOUBLE);
+
+	maVSUnderline.InsertItem(3, maIMGBold, String(SVX_RES(STR_BOLD)));
+	maVSUnderline.SetItemData(3,(void*)(sal_uInt64)UNDERLINE_BOLD);
+
+	maVSUnderline.InsertItem(4, maIMGDot, String(SVX_RES(STR_DOT)));
+	maVSUnderline.SetItemData(4,(void*)(sal_uInt64)UNDERLINE_DOTTED);
+
+	maVSUnderline.InsertItem(5, maIMGDotBold, String(SVX_RES(STR_DOT_BOLD)));
+	maVSUnderline.SetItemData(5,(void*)(sal_uInt64)UNDERLINE_BOLDDOTTED);
+
+	maVSUnderline.InsertItem(6, maIMGDash, String(SVX_RES(STR_DASH)));
+	maVSUnderline.SetItemData(6,(void*)(sal_uInt64)UNDERLINE_DASH);
+
+	maVSUnderline.InsertItem(7, maIMGDashLong,String(SVX_RES(STR_DASH_LONG)));
+	maVSUnderline.SetItemData(7,(void*)(sal_uInt64)UNDERLINE_LONGDASH);
+
+	maVSUnderline.InsertItem(8, maIMGDashDot, String(SVX_RES(STR_DASH_DOT)));
+	maVSUnderline.SetItemData(8,(void*)(sal_uInt64)UNDERLINE_DASHDOT);
+
+	maVSUnderline.InsertItem(9, maIMGDashDotDot, String(SVX_RES(STR_DASH_DOT_DOT)));
+	maVSUnderline.SetItemData(9,(void*)(sal_uInt64)UNDERLINE_DASHDOTDOT);
+
+	maVSUnderline.InsertItem(10, maIMGWave, String(SVX_RES(STR_WAVE)));
+	maVSUnderline.SetItemData(10,(void*)(sal_uInt64)UNDERLINE_WAVE);
+
+	maVSUnderline.SetColCount( 1 );
+	aLink =  LINK( this, TextUnderlineControl, VSSelectHdl ) ;
+    maVSUnderline.SetSelectHdl(aLink);
+
+	maVSUnderline.StartSelection();
+	maVSUnderline.Show();
+}
+
+void TextUnderlineControl::GetFocus()
+{
+	maVSUnderline.GrabFocus();
+}
+void TextUnderlineControl::Rearrange(FontUnderline eLine)
+{
+	// high contrast
+	maVSUnderline.SetItemImage(1,  GetDisplayBackground().GetColor().IsDark()? maIMGSingleH :maIMGSingle);
+	maVSUnderline.SetItemImage(2,  GetDisplayBackground().GetColor().IsDark()? maIMGDoubleH : maIMGDouble );
+	maVSUnderline.SetItemImage(3, GetDisplayBackground().GetColor().IsDark()? maIMGBoldH : maIMGBold);
+	maVSUnderline.SetItemImage(4, GetDisplayBackground().GetColor().IsDark()? maIMGDotH : maIMGDot);
+	maVSUnderline.SetItemImage(5, GetDisplayBackground().GetColor().IsDark()? maIMGDotBoldH :maIMGDotBold);
+	maVSUnderline.SetItemImage(6,  GetDisplayBackground().GetColor().IsDark()? maIMGDashH :maIMGDash);
+	maVSUnderline.SetItemImage(7, GetDisplayBackground().GetColor().IsDark()? maIMGDashLongH : maIMGDashLong);
+	maVSUnderline.SetItemImage(8, GetDisplayBackground().GetColor().IsDark()? maIMGDashDotH : maIMGDashDot); 
+	maVSUnderline.SetItemImage(9, GetDisplayBackground().GetColor().IsDark()? maIMGDashDotDotH : maIMGDashDotDot);
+	maVSUnderline.SetItemImage(10, GetDisplayBackground().GetColor().IsDark()? maIMGWaveH : maIMGWave);
+//	maVSUnderline.SelectItem(0);		//delete 
+//	maVSUnderline.SetNoSelection();
+
+	switch(eLine)
+	{
+	case UNDERLINE_SINGLE:
+		maVSUnderline.SetItemImage(1, maIMGSingleSel);
+		maVSUnderline.SelectItem(1);	//add 
+		maVSUnderline.GrabFocus();
+		break;
+	case UNDERLINE_DOUBLE:
+		maVSUnderline.SetItemImage(2, maIMGDoubleSel);
+		maVSUnderline.SelectItem(2);	//add 
+		maVSUnderline.GrabFocus();
+		break;
+	case UNDERLINE_BOLD:
+		maVSUnderline.SetItemImage(3, maIMGBoldSel);
+		maVSUnderline.SelectItem(3);	//add 
+		maVSUnderline.GrabFocus();
+		break;	
+	case UNDERLINE_DOTTED:
+		maVSUnderline.SetItemImage(4, maIMGDotSel);
+		maVSUnderline.SelectItem(4);	//add 
+		maVSUnderline.GrabFocus();
+		break;
+	case UNDERLINE_BOLDDOTTED:
+		maVSUnderline.SetItemImage(5, maIMGDotBoldSel);
+		maVSUnderline.SelectItem(5);	//add 
+		maVSUnderline.GrabFocus();
+		break;
+	case UNDERLINE_DASH:
+		maVSUnderline.SetItemImage(6, maIMGDashSel);
+		maVSUnderline.SelectItem(6);	//add 
+		maVSUnderline.GrabFocus();
+		break;
+	case UNDERLINE_LONGDASH:
+		maVSUnderline.SetItemImage(7, maIMGDashLongSel);
+		maVSUnderline.SelectItem(7);	//add 
+		maVSUnderline.GrabFocus();
+		break;
+	case UNDERLINE_DASHDOT:
+		maVSUnderline.SetItemImage(8, maIMGDashDotSel);
+		maVSUnderline.SelectItem(8);	//add 
+		maVSUnderline.GrabFocus();
+		break;
+	case UNDERLINE_DASHDOTDOT:
+		maVSUnderline.SetItemImage(9, maIMGDashDotDotSel);
+		maVSUnderline.SelectItem(9);	//add 
+		maVSUnderline.GrabFocus();
+		break;
+	case UNDERLINE_WAVE:
+		maVSUnderline.SetItemImage(10, maIMGWaveSel);
+		maVSUnderline.SelectItem(10);	//add 
+		maVSUnderline.GrabFocus();
+		break;
+	case UNDERLINE_NONE:
+	default:
+		maVSUnderline.SelectItem(1);
+		maVSUnderline.SetNoSelection();//add 
+		maPBOptions.GrabFocus();
+	}
+	maVSUnderline.StartSelection();
+	//removed 
+	//if(mpPage->meContextType == PROPERTY_CONTEXT_SC_CELL)
+	//	maPBOptions.Disable();
+	//else
+	//	maPBOptions.Enable();
+	//removed end
+}
+ValueSet& TextUnderlineControl::GetValueSet()
+{
+	return maVSUnderline;
+}
+Control& TextUnderlineControl::GetPB()
+{
+	return maPBOptions;
+}
+IMPL_LINK(TextUnderlineControl, VSSelectHdl, void *, pControl)
+{
+	if(pControl == &maVSUnderline)  
+	{
+		sal_uInt16 iPos = maVSUnderline.GetSelectItemId();
+		FontUnderline eUnderline = (FontUnderline)(sal_uInt64)maVSUnderline.GetItemData( iPos );
+
+		//<<modified 
+		//SvxTextLineItem aLineItem(eUnderline, SID_ATTR_CHAR_UNDERLINE);
+		SvxUnderlineItem aLineItem(eUnderline, SID_ATTR_CHAR_UNDERLINE);
+		//modify end>>
+
+		//<<add , this line of code will keep the new underline use pre-color
+		aLineItem.SetColor(mrTextPropertyPanel.GetUnderlineColor());   
+		//add end>>
+		mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_UNDERLINE, SFX_CALLMODE_RECORD, &aLineItem, 0L);
+
+		//add , for the popup page not update immediately
+		mrTextPropertyPanel.SetUnderline(eUnderline);
+		//add end
+		//mrTextPropertyPanel.SetDefaultUnderline(eUnderline);
+
+		mrTextPropertyPanel.EndUnderlinePopupMode();
+	}
+	return( 0L );
+}
+
+IMPL_LINK(TextUnderlineControl, PBClickHdl, PushButton *, pPBtn)
+{
+	if(pPBtn == &maPBOptions)  
+	{
+		if (mpBindings)
+		{
+			SfxDispatcher* pDisp = mpBindings->GetDispatcher();
+			pDisp->Execute( SID_CHAR_DLG_EFFECT, SFX_CALLMODE_ASYNCHRON );
+		}
+		//add 
+		mrTextPropertyPanel.EndUnderlinePopupMode();
+		//add end
+	}
+	return 0;
+}
+
+}}

Added: openoffice/branches/sidebar/main/svx/source/sidebar/text/TextUnderlineControl.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/svx/source/sidebar/text/TextUnderlineControl.hxx?rev=1460970&view=auto
==============================================================================
--- openoffice/branches/sidebar/main/svx/source/sidebar/text/TextUnderlineControl.hxx (added)
+++ openoffice/branches/sidebar/main/svx/source/sidebar/text/TextUnderlineControl.hxx Tue Mar 26 04:15:41 2013
@@ -0,0 +1,94 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/
+#ifndef _SVX_SIDEBAR_UNDERLINE_CONTROL_HXX_
+#define _SVX_SIDEBAR_UNDERLINE_CONTROL_HXX_
+ 
+#include "svx/sidebar/PopupControl.hxx"
+#include <sfx2/bindings.hxx>
+#include <svtools/ctrlbox.hxx>
+#include <svtools/ctrltool.hxx>
+#include "TextPropertyPanel.hxx"
+#include <vcl/fixed.hxx>
+#include <vcl/button.hxx>
+
+#include <vcl/vclenum.hxx>
+#include <svtools/valueset.hxx>
+
+namespace svx{ namespace sidebar {
+
+class TextUnderlineControl:public svx::sidebar::PopupControl
+{
+public:
+	TextUnderlineControl(Window* pParent, svx::sidebar::TextPropertyPanel& rPanel);
+	void GetFocus();
+	void Rearrange(FontUnderline eLine);
+	ValueSet& GetValueSet();
+	Control& GetPB();
+private:	
+	svx::sidebar::TextPropertyPanel&     mrTextPropertyPanel;
+	SfxBindings*		mpBindings;
+	ValueSet			maVSUnderline;
+	PushButton			maPBOptions;
+
+	Image				maIMGSingle;
+	Image				maIMGDouble;
+	Image				maIMGBold;
+	Image				maIMGDot;
+	Image				maIMGDotBold;
+	Image				maIMGDash;
+	Image				maIMGDashLong;
+	Image				maIMGDashDot;
+	Image				maIMGDashDotDot;
+	Image				maIMGWave;
+
+	//add  for high contract
+	Image				maIMGSingleH;
+	Image				maIMGDoubleH;
+	Image				maIMGBoldH;
+	Image				maIMGDotH;
+	Image				maIMGDotBoldH;
+	Image				maIMGDashH;
+	Image				maIMGDashLongH;
+	Image				maIMGDashDotH;
+	Image				maIMGDashDotDotH;
+	Image				maIMGWaveH;
+
+	Image				maIMGSingleSel;
+	Image				maIMGDoubleSel;
+	Image				maIMGBoldSel;
+	Image				maIMGDotSel;
+	Image				maIMGDotBoldSel;
+	Image				maIMGDashSel;
+	Image				maIMGDashLongSel;
+	Image				maIMGDashDotSel;
+	Image				maIMGDashDotDotSel;
+	Image				maIMGWaveSel;
+
+	void initial();
+
+	DECL_LINK( PBClickHdl, PushButton *);
+	DECL_LINK(VSSelectHdl, void *);
+};
+}}
+
+
+#endif
+

Added: openoffice/branches/sidebar/main/svx/source/sidebar/text/TextUnderlinePopup.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/svx/source/sidebar/text/TextUnderlinePopup.cxx?rev=1460970&view=auto
==============================================================================
--- openoffice/branches/sidebar/main/svx/source/sidebar/text/TextUnderlinePopup.cxx (added)
+++ openoffice/branches/sidebar/main/svx/source/sidebar/text/TextUnderlinePopup.cxx Tue Mar 26 04:15:41 2013
@@ -0,0 +1,60 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/
+
+#include "TextUnderlinePopup.hxx"
+#include "TextUnderlineControl.hxx"
+
+
+namespace svx { namespace sidebar {
+
+TextUnderlinePopup::TextUnderlinePopup (
+    Window* pParent,
+    const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator)
+    : Popup(
+        pParent,
+        rControlCreator, 
+        ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Character Spacing")))
+{
+}
+
+
+
+
+TextUnderlinePopup::~TextUnderlinePopup (void)
+{
+}
+
+
+
+
+void TextUnderlinePopup::Rearrange (FontUnderline eLine)
+{
+    ProvideContainerAndControl();
+
+    TextUnderlineControl* pControl = dynamic_cast<TextUnderlineControl*>(mpControl.get());
+    if (pControl != NULL)
+        pControl->Rearrange(eLine);	
+}
+
+
+} } // end of namespace svx::sidebar
+
+

Added: openoffice/branches/sidebar/main/svx/source/sidebar/text/TextUnderlinePopup.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/svx/source/sidebar/text/TextUnderlinePopup.hxx?rev=1460970&view=auto
==============================================================================
--- openoffice/branches/sidebar/main/svx/source/sidebar/text/TextUnderlinePopup.hxx (added)
+++ openoffice/branches/sidebar/main/svx/source/sidebar/text/TextUnderlinePopup.hxx Tue Mar 26 04:15:41 2013
@@ -0,0 +1,47 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/
+
+#ifndef _SVX_SIDEBAR_UNDERLINE_POPUP_HXX_
+#define _SVX_SIDEBAR_UNDERLINE_POPUP_HXX_
+
+#include "svx/sidebar/Popup.hxx"
+
+#include <boost/function.hpp>
+#include <vcl/vclenum.hxx>
+namespace svx { namespace sidebar {
+
+class TextUnderlinePopup
+    : public Popup
+{
+public :
+    TextUnderlinePopup (
+        Window* pParent,
+        const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator);
+    ~TextUnderlinePopup (void);
+
+    void Rearrange (FontUnderline eLine);
+};
+
+} } // end of namespace svx::sidebar
+
+#endif
+
+



Mime
View raw message