Kaydet (Commit) a1111d73 authored tarafından Oliver-Rainer Wittmann's avatar Oliver-Rainer Wittmann

122182: TextPropertyPanel:

- add missing <break> in handling click to character attribute controls
- remove superfluous code and comments
- adapt code formatting
üst e952d140
......@@ -82,10 +82,8 @@ namespace svx { namespace sidebar {
#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
//
//end
PopupControl* TextPropertyPanel::CreateCharacterSpacingControl (PopupContainer* pParent)
PopupControl* TextPropertyPanel::CreateCharacterSpacingControl (PopupContainer* pParent)
{
return new TextCharacterSpacingControl(pParent, *this, mpBindings);
}
......@@ -404,7 +402,6 @@ void TextPropertyPanel::Initialize (void)
mbColorAvailable = true;
maBackColor = COL_AUTO;
mbBackColorAvailable = true;
meColorType = FONT_COLOR;
meEscape = SVX_ESCAPEMENT_OFF;
mbSuper = false;
mbSub = false;
......@@ -424,17 +421,12 @@ void TextPropertyPanel::Initialize (void)
//set handler
mpFontNameBox->SetBindings(mpBindings);
//add
Link aLink = LINK(this, TextPropertyPanel, FontSelHdl);
mpFontNameBox->SetSelectHdl(aLink);
//add end
aLink = LINK(this, TextPropertyPanel, FontSizeModifyHdl);
maFontSizeBox.SetModifyHdl(aLink);
//add
aLink = LINK(this, TextPropertyPanel, FontSizeSelHdl);
maFontSizeBox.SetSelectHdl(aLink);
//add end
aLink = LINK(this, TextPropertyPanel, FontSizeLoseFocus);
maFontSizeBox.SetLoseFocusHdl(aLink);
......@@ -572,7 +564,7 @@ IMPL_LINK( TextPropertyPanel, FontSelHdl, FontNameBox*, pBox )
}
return 0;
}
//add end
IMPL_LINK( TextPropertyPanel, FontSizeModifyHdl, FontSizeBox*, pSizeBox )
{
if (pSizeBox == &maFontSizeBox)
......@@ -589,7 +581,7 @@ IMPL_LINK( TextPropertyPanel, FontSizeModifyHdl, FontSizeBox*, pSizeBox )
}
return 0;
}
//add
IMPL_LINK( TextPropertyPanel, FontSizeSelHdl, FontSizeBox*, pSizeBox )
{
if ( !pSizeBox->IsTravelSelect() )
......@@ -605,7 +597,7 @@ IMPL_LINK( TextPropertyPanel, FontSizeSelHdl, FontSizeBox*, pSizeBox )
return 0;
}
//add end
IMPL_LINK(TextPropertyPanel, FontSizeLoseFocus, FontSizeBox*, pSizeBox)
{
if(pSizeBox == &maFontSizeBox)
......@@ -662,6 +654,7 @@ IMPL_LINK(TextPropertyPanel, ToolboxFontSelectHandler, ToolBox*, pToolBox)
mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_UNDERLINE, SFX_CALLMODE_RECORD, &aLineItem, 0L);
}
UpdateItem(SID_ATTR_CHAR_UNDERLINE);
break;
}
case TBI_STRIKEOUT:
{
......@@ -820,8 +813,6 @@ IMPL_LINK(TextPropertyPanel, ToolBoxFontColorDropHdl,ToolBox*, pToolBox)
const sal_uInt16 nId = pToolBox->GetCurItemId();
if(nId == TBI_FONTCOLOR)
{
meColorType = FONT_COLOR;
pToolBox->SetItemDown( nId, true );
maFontColorPopup.Show(*pToolBox);
......@@ -903,8 +894,6 @@ IMPL_LINK(TextPropertyPanel, ToolBoxHighlightDropHdl, ToolBox*, pToolBox)
const sal_uInt16 nId = pToolBox->GetCurItemId();
if(nId == TBI_HIGHLIGHT)
{
meColorType = BACK_COLOR;
pToolBox->SetItemDown( nId, true );
maBrushColorPopup.Show(*pToolBox);
maBrushColorPopup.SetCurrentColor(maBackColor, mbBackColorAvailable);
......@@ -932,14 +921,6 @@ IMPL_LINK(TextPropertyPanel, SpacingClickHdl, ToolBox*, pToolBox)
IMPL_LINK( TextPropertyPanel, ImplPopupModeEndHdl, FloatingWindow*, EMPTYARG )
{
return 0;
}
void TextPropertyPanel::NotifyItemUpdate (
const sal_uInt16 nSID,
const SfxItemState eState,
......
......@@ -32,7 +32,6 @@
#include <editeng/svxenum.hxx>
#include <editeng/fhgtitem.hxx>
//#include <com/sun/star/ui/XUIElement.hpp>
#include <com/sun/star/ui/XSidebar.hpp>
#include <boost/scoped_ptr.hpp>
......@@ -74,18 +73,10 @@ public:
void SetDefaultUnderline(FontUnderline eUnderline);
enum ColorType
{
FONT_COLOR = 1,
BACK_COLOR = 2
};
virtual void HandleContextChange (
const ::sfx2::sidebar::EnumContext aContext);
// ControllerItem::ItemUpdateReceiverInterface
virtual void NotifyItemUpdate(
const sal_uInt16 nSId,
const SfxItemState eState,
......@@ -133,7 +124,7 @@ private:
FontWeight meWeight;
FontItalic meItalic;
FontUnderline meUnderline;
Color meUnderlineColor; //
Color meUnderlineColor;
bool mbShadow;
FontStrikeout meStrike;
bool mbWeightAvailable;
......@@ -142,7 +133,6 @@ private:
bool mbColorAvailable;
Color maBackColor;
bool mbBackColorAvailable;
ColorType meColorType;
SvxEscapement meEscape; //for sw
bool mbSuper;
bool mbSub;
......@@ -194,7 +184,6 @@ private:
DECL_LINK(FontSizeLoseFocus, FontSizeBox *);
DECL_LINK(ToolboxFontSelectHandler, ToolBox *);
DECL_LINK(ToolboxIncDecSelectHdl, ToolBox *);
DECL_LINK(ImplPopupModeEndHdl, FloatingWindow* );
DECL_LINK(ToolBoxSwScriptSelectHdl, ToolBox *);
DECL_LINK(ToolBoxScriptSelectHdl, ToolBox *);
......
......@@ -85,14 +85,6 @@ TextUnderlineControl::TextUnderlineControl (
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 ));
......@@ -160,74 +152,66 @@ void TextUnderlineControl::Rearrange(FontUnderline eLine)
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.SelectItem(1);
maVSUnderline.GrabFocus();
break;
case UNDERLINE_DOUBLE:
maVSUnderline.SetItemImage(2, maIMGDoubleSel);
maVSUnderline.SelectItem(2); //add
maVSUnderline.SelectItem(2);
maVSUnderline.GrabFocus();
break;
case UNDERLINE_BOLD:
maVSUnderline.SetItemImage(3, maIMGBoldSel);
maVSUnderline.SelectItem(3); //add
maVSUnderline.SelectItem(3);
maVSUnderline.GrabFocus();
break;
case UNDERLINE_DOTTED:
maVSUnderline.SetItemImage(4, maIMGDotSel);
maVSUnderline.SelectItem(4); //add
maVSUnderline.SelectItem(4);
maVSUnderline.GrabFocus();
break;
case UNDERLINE_BOLDDOTTED:
maVSUnderline.SetItemImage(5, maIMGDotBoldSel);
maVSUnderline.SelectItem(5); //add
maVSUnderline.SelectItem(5);
maVSUnderline.GrabFocus();
break;
case UNDERLINE_DASH:
maVSUnderline.SetItemImage(6, maIMGDashSel);
maVSUnderline.SelectItem(6); //add
maVSUnderline.SelectItem(6);
maVSUnderline.GrabFocus();
break;
case UNDERLINE_LONGDASH:
maVSUnderline.SetItemImage(7, maIMGDashLongSel);
maVSUnderline.SelectItem(7); //add
maVSUnderline.SelectItem(7);
maVSUnderline.GrabFocus();
break;
case UNDERLINE_DASHDOT:
maVSUnderline.SetItemImage(8, maIMGDashDotSel);
maVSUnderline.SelectItem(8); //add
maVSUnderline.SelectItem(8);
maVSUnderline.GrabFocus();
break;
case UNDERLINE_DASHDOTDOT:
maVSUnderline.SetItemImage(9, maIMGDashDotDotSel);
maVSUnderline.SelectItem(9); //add
maVSUnderline.SelectItem(9);
maVSUnderline.GrabFocus();
break;
case UNDERLINE_WAVE:
maVSUnderline.SetItemImage(10, maIMGWaveSel);
maVSUnderline.SelectItem(10); //add
maVSUnderline.SelectItem(10);
maVSUnderline.GrabFocus();
break;
case UNDERLINE_NONE:
default:
maVSUnderline.SelectItem(1);
maVSUnderline.SetNoSelection();//add
maVSUnderline.SetNoSelection();
maPBOptions.GrabFocus();
}
maVSUnderline.StartSelection();
//removed
//if(mpPage->meContextType == PROPERTY_CONTEXT_SC_CELL)
// maPBOptions.Disable();
//else
// maPBOptions.Enable();
//removed end
}
ValueSet& TextUnderlineControl::GetValueSet()
{
......@@ -244,20 +228,12 @@ IMPL_LINK(TextUnderlineControl, VSSelectHdl, void *, pControl)
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();
}
......@@ -273,9 +249,7 @@ IMPL_LINK(TextUnderlineControl, PBClickHdl, PushButton *, pPBtn)
SfxDispatcher* pDisp = mpBindings->GetDispatcher();
pDisp->Execute( SID_CHAR_DLG_EFFECT, SFX_CALLMODE_ASYNCHRON );
}
//add
mrTextPropertyPanel.EndUnderlinePopupMode();
//add end
}
return 0;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment