Kaydet (Commit) 862395f6 authored tarafından Oliver-Rainer Wittmann's avatar Oliver-Rainer Wittmann Kaydeden (comit) Michael Meeks

Resolves: #i122182# TextPropertyPanel

- add missing <break> in handling click to character attribute controls
- remove superfluous code and comments
- adapt code formatting
(cherry picked from commit a1111d73)

Conflicts:
	svx/source/sidebar/text/TextUnderlineControl.cxx

Change-Id: I1aea184523f74dda78218a631a64ea192765e9d5
üst 672dc0cc
...@@ -70,10 +70,8 @@ namespace svx { namespace sidebar { ...@@ -70,10 +70,8 @@ namespace svx { namespace sidebar {
#define TEXT_SECTIONPAGE_HEIGHT SECTIONPAGE_MARGIN_VERTICAL_TOP + CBOX_HEIGHT + ( TOOLBOX_ITEM_HEIGHT + 2 ) * 2 + CONTROL_SPACING_VERTICAL * 2 + 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); return new TextCharacterSpacingControl(pParent, *this, mpBindings);
} }
...@@ -395,7 +393,6 @@ void TextPropertyPanel::Initialize (void) ...@@ -395,7 +393,6 @@ void TextPropertyPanel::Initialize (void)
mbColorAvailable = true; mbColorAvailable = true;
maBackColor = COL_AUTO; maBackColor = COL_AUTO;
mbBackColorAvailable = true; mbBackColorAvailable = true;
meColorType = FONT_COLOR;
meEscape = SVX_ESCAPEMENT_OFF; meEscape = SVX_ESCAPEMENT_OFF;
mbSuper = false; mbSuper = false;
mbSub = false; mbSub = false;
...@@ -415,17 +412,12 @@ void TextPropertyPanel::Initialize (void) ...@@ -415,17 +412,12 @@ void TextPropertyPanel::Initialize (void)
//set handler //set handler
mpFontNameBox->SetBindings(mpBindings); mpFontNameBox->SetBindings(mpBindings);
//add
Link aLink = LINK(this, TextPropertyPanel, FontSelHdl); Link aLink = LINK(this, TextPropertyPanel, FontSelHdl);
mpFontNameBox->SetSelectHdl(aLink); mpFontNameBox->SetSelectHdl(aLink);
//add end
aLink = LINK(this, TextPropertyPanel, FontSizeModifyHdl); aLink = LINK(this, TextPropertyPanel, FontSizeModifyHdl);
maFontSizeBox.SetModifyHdl(aLink); maFontSizeBox.SetModifyHdl(aLink);
//add
aLink = LINK(this, TextPropertyPanel, FontSizeSelHdl); aLink = LINK(this, TextPropertyPanel, FontSizeSelHdl);
maFontSizeBox.SetSelectHdl(aLink); maFontSizeBox.SetSelectHdl(aLink);
//add end
aLink = LINK(this, TextPropertyPanel, FontSizeLoseFocus); aLink = LINK(this, TextPropertyPanel, FontSizeLoseFocus);
maFontSizeBox.SetLoseFocusHdl(aLink); maFontSizeBox.SetLoseFocusHdl(aLink);
...@@ -563,7 +555,7 @@ IMPL_LINK( TextPropertyPanel, FontSelHdl, FontNameBox*, pBox ) ...@@ -563,7 +555,7 @@ IMPL_LINK( TextPropertyPanel, FontSelHdl, FontNameBox*, pBox )
} }
return 0; return 0;
} }
//add end
IMPL_LINK( TextPropertyPanel, FontSizeModifyHdl, FontSizeBox*, pSizeBox ) IMPL_LINK( TextPropertyPanel, FontSizeModifyHdl, FontSizeBox*, pSizeBox )
{ {
if (pSizeBox == &maFontSizeBox) if (pSizeBox == &maFontSizeBox)
...@@ -580,7 +572,7 @@ IMPL_LINK( TextPropertyPanel, FontSizeModifyHdl, FontSizeBox*, pSizeBox ) ...@@ -580,7 +572,7 @@ IMPL_LINK( TextPropertyPanel, FontSizeModifyHdl, FontSizeBox*, pSizeBox )
} }
return 0; return 0;
} }
//add
IMPL_LINK( TextPropertyPanel, FontSizeSelHdl, FontSizeBox*, pSizeBox ) IMPL_LINK( TextPropertyPanel, FontSizeSelHdl, FontSizeBox*, pSizeBox )
{ {
if ( !pSizeBox->IsTravelSelect() ) if ( !pSizeBox->IsTravelSelect() )
...@@ -596,7 +588,7 @@ IMPL_LINK( TextPropertyPanel, FontSizeSelHdl, FontSizeBox*, pSizeBox ) ...@@ -596,7 +588,7 @@ IMPL_LINK( TextPropertyPanel, FontSizeSelHdl, FontSizeBox*, pSizeBox )
return 0; return 0;
} }
//add end
IMPL_LINK(TextPropertyPanel, FontSizeLoseFocus, FontSizeBox*, pSizeBox) IMPL_LINK(TextPropertyPanel, FontSizeLoseFocus, FontSizeBox*, pSizeBox)
{ {
if(pSizeBox == &maFontSizeBox) if(pSizeBox == &maFontSizeBox)
...@@ -653,6 +645,7 @@ IMPL_LINK(TextPropertyPanel, ToolboxFontSelectHandler, ToolBox*, pToolBox) ...@@ -653,6 +645,7 @@ IMPL_LINK(TextPropertyPanel, ToolboxFontSelectHandler, ToolBox*, pToolBox)
mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_UNDERLINE, SFX_CALLMODE_RECORD, &aLineItem, 0L); mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_UNDERLINE, SFX_CALLMODE_RECORD, &aLineItem, 0L);
} }
UpdateItem(SID_ATTR_CHAR_UNDERLINE); UpdateItem(SID_ATTR_CHAR_UNDERLINE);
break;
} }
case TBI_STRIKEOUT: case TBI_STRIKEOUT:
{ {
...@@ -811,8 +804,6 @@ IMPL_LINK(TextPropertyPanel, ToolBoxFontColorDropHdl,ToolBox*, pToolBox) ...@@ -811,8 +804,6 @@ IMPL_LINK(TextPropertyPanel, ToolBoxFontColorDropHdl,ToolBox*, pToolBox)
const sal_uInt16 nId = pToolBox->GetCurItemId(); const sal_uInt16 nId = pToolBox->GetCurItemId();
if(nId == TBI_FONTCOLOR) if(nId == TBI_FONTCOLOR)
{ {
meColorType = FONT_COLOR;
pToolBox->SetItemDown( nId, true ); pToolBox->SetItemDown( nId, true );
maFontColorPopup.Show(*pToolBox); maFontColorPopup.Show(*pToolBox);
...@@ -894,8 +885,6 @@ IMPL_LINK(TextPropertyPanel, ToolBoxHighlightDropHdl, ToolBox*, pToolBox) ...@@ -894,8 +885,6 @@ IMPL_LINK(TextPropertyPanel, ToolBoxHighlightDropHdl, ToolBox*, pToolBox)
const sal_uInt16 nId = pToolBox->GetCurItemId(); const sal_uInt16 nId = pToolBox->GetCurItemId();
if(nId == TBI_HIGHLIGHT) if(nId == TBI_HIGHLIGHT)
{ {
meColorType = BACK_COLOR;
pToolBox->SetItemDown( nId, true ); pToolBox->SetItemDown( nId, true );
maBrushColorPopup.Show(*pToolBox); maBrushColorPopup.Show(*pToolBox);
maBrushColorPopup.SetCurrentColor(maBackColor, mbBackColorAvailable); maBrushColorPopup.SetCurrentColor(maBackColor, mbBackColorAvailable);
...@@ -923,14 +912,6 @@ IMPL_LINK(TextPropertyPanel, SpacingClickHdl, ToolBox*, pToolBox) ...@@ -923,14 +912,6 @@ IMPL_LINK(TextPropertyPanel, SpacingClickHdl, ToolBox*, pToolBox)
IMPL_LINK( TextPropertyPanel, ImplPopupModeEndHdl, FloatingWindow*, EMPTYARG )
{
return 0;
}
void TextPropertyPanel::NotifyItemUpdate ( void TextPropertyPanel::NotifyItemUpdate (
const sal_uInt16 nSID, const sal_uInt16 nSID,
const SfxItemState eState, const SfxItemState eState,
......
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
#include <editeng/svxenum.hxx> #include <editeng/svxenum.hxx>
#include <editeng/fhgtitem.hxx> #include <editeng/fhgtitem.hxx>
//#include <com/sun/star/ui/XUIElement.hpp>
#include <com/sun/star/ui/XSidebar.hpp> #include <com/sun/star/ui/XSidebar.hpp>
#include <boost/scoped_ptr.hpp> #include <boost/scoped_ptr.hpp>
...@@ -70,18 +69,10 @@ public: ...@@ -70,18 +69,10 @@ public:
void SetDefaultUnderline(FontUnderline eUnderline); void SetDefaultUnderline(FontUnderline eUnderline);
enum ColorType
{
FONT_COLOR = 1,
BACK_COLOR = 2
};
virtual void HandleContextChange ( virtual void HandleContextChange (
const ::sfx2::sidebar::EnumContext aContext); const ::sfx2::sidebar::EnumContext aContext);
// ControllerItem::ItemUpdateReceiverInterface
virtual void NotifyItemUpdate( virtual void NotifyItemUpdate(
const sal_uInt16 nSId, const sal_uInt16 nSId,
const SfxItemState eState, const SfxItemState eState,
...@@ -129,7 +120,7 @@ private: ...@@ -129,7 +120,7 @@ private:
FontWeight meWeight; FontWeight meWeight;
FontItalic meItalic; FontItalic meItalic;
FontUnderline meUnderline; FontUnderline meUnderline;
Color meUnderlineColor; // Color meUnderlineColor;
bool mbShadow; bool mbShadow;
FontStrikeout meStrike; FontStrikeout meStrike;
bool mbWeightAvailable; bool mbWeightAvailable;
...@@ -138,7 +129,6 @@ private: ...@@ -138,7 +129,6 @@ private:
bool mbColorAvailable; bool mbColorAvailable;
Color maBackColor; Color maBackColor;
bool mbBackColorAvailable; bool mbBackColorAvailable;
ColorType meColorType;
SvxEscapement meEscape; //for sw SvxEscapement meEscape; //for sw
bool mbSuper; bool mbSuper;
bool mbSub; bool mbSub;
...@@ -190,7 +180,6 @@ private: ...@@ -190,7 +180,6 @@ private:
DECL_LINK(FontSizeLoseFocus, FontSizeBox *); DECL_LINK(FontSizeLoseFocus, FontSizeBox *);
DECL_LINK(ToolboxFontSelectHandler, ToolBox *); DECL_LINK(ToolboxFontSelectHandler, ToolBox *);
DECL_LINK(ToolboxIncDecSelectHdl, ToolBox *); DECL_LINK(ToolboxIncDecSelectHdl, ToolBox *);
DECL_LINK(ImplPopupModeEndHdl, FloatingWindow* );
DECL_LINK(ToolBoxSwScriptSelectHdl, ToolBox *); DECL_LINK(ToolBoxSwScriptSelectHdl, ToolBox *);
DECL_LINK(ToolBoxScriptSelectHdl, ToolBox *); DECL_LINK(ToolBoxScriptSelectHdl, ToolBox *);
......
...@@ -68,14 +68,6 @@ TextUnderlineControl::TextUnderlineControl ( ...@@ -68,14 +68,6 @@ TextUnderlineControl::TextUnderlineControl (
void TextUnderlineControl::initial() 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 contrast
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()? maVSUnderline.SetColor(GetSettings().GetStyleSettings().GetHighContrastMode()?
GetSettings().GetStyleSettings().GetMenuColor(): GetSettings().GetStyleSettings().GetMenuColor():
sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground )); sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground ));
...@@ -132,7 +124,6 @@ void TextUnderlineControl::GetFocus() ...@@ -132,7 +124,6 @@ void TextUnderlineControl::GetFocus()
} }
void TextUnderlineControl::Rearrange(FontUnderline eLine) void TextUnderlineControl::Rearrange(FontUnderline eLine)
{ {
// high contrast
maVSUnderline.SetItemImage(1, maIMGSingle); maVSUnderline.SetItemImage(1, maIMGSingle);
maVSUnderline.SetItemImage(2, maIMGDouble ); maVSUnderline.SetItemImage(2, maIMGDouble );
maVSUnderline.SetItemImage(3, maIMGBold); maVSUnderline.SetItemImage(3, maIMGBold);
...@@ -143,74 +134,66 @@ void TextUnderlineControl::Rearrange(FontUnderline eLine) ...@@ -143,74 +134,66 @@ void TextUnderlineControl::Rearrange(FontUnderline eLine)
maVSUnderline.SetItemImage(8, maIMGDashDot); maVSUnderline.SetItemImage(8, maIMGDashDot);
maVSUnderline.SetItemImage(9, maIMGDashDotDot); maVSUnderline.SetItemImage(9, maIMGDashDotDot);
maVSUnderline.SetItemImage(10, maIMGWave); maVSUnderline.SetItemImage(10, maIMGWave);
// maVSUnderline.SelectItem(0); //delete
// maVSUnderline.SetNoSelection();
switch(eLine) switch(eLine)
{ {
case UNDERLINE_SINGLE: case UNDERLINE_SINGLE:
maVSUnderline.SetItemImage(1, maIMGSingleSel); maVSUnderline.SetItemImage(1, maIMGSingleSel);
maVSUnderline.SelectItem(1); //add maVSUnderline.SelectItem(1);
maVSUnderline.GrabFocus(); maVSUnderline.GrabFocus();
break; break;
case UNDERLINE_DOUBLE: case UNDERLINE_DOUBLE:
maVSUnderline.SetItemImage(2, maIMGDoubleSel); maVSUnderline.SetItemImage(2, maIMGDoubleSel);
maVSUnderline.SelectItem(2); //add maVSUnderline.SelectItem(2);
maVSUnderline.GrabFocus(); maVSUnderline.GrabFocus();
break; break;
case UNDERLINE_BOLD: case UNDERLINE_BOLD:
maVSUnderline.SetItemImage(3, maIMGBoldSel); maVSUnderline.SetItemImage(3, maIMGBoldSel);
maVSUnderline.SelectItem(3); //add maVSUnderline.SelectItem(3);
maVSUnderline.GrabFocus(); maVSUnderline.GrabFocus();
break; break;
case UNDERLINE_DOTTED: case UNDERLINE_DOTTED:
maVSUnderline.SetItemImage(4, maIMGDotSel); maVSUnderline.SetItemImage(4, maIMGDotSel);
maVSUnderline.SelectItem(4); //add maVSUnderline.SelectItem(4);
maVSUnderline.GrabFocus(); maVSUnderline.GrabFocus();
break; break;
case UNDERLINE_BOLDDOTTED: case UNDERLINE_BOLDDOTTED:
maVSUnderline.SetItemImage(5, maIMGDotBoldSel); maVSUnderline.SetItemImage(5, maIMGDotBoldSel);
maVSUnderline.SelectItem(5); //add maVSUnderline.SelectItem(5);
maVSUnderline.GrabFocus(); maVSUnderline.GrabFocus();
break; break;
case UNDERLINE_DASH: case UNDERLINE_DASH:
maVSUnderline.SetItemImage(6, maIMGDashSel); maVSUnderline.SetItemImage(6, maIMGDashSel);
maVSUnderline.SelectItem(6); //add maVSUnderline.SelectItem(6);
maVSUnderline.GrabFocus(); maVSUnderline.GrabFocus();
break; break;
case UNDERLINE_LONGDASH: case UNDERLINE_LONGDASH:
maVSUnderline.SetItemImage(7, maIMGDashLongSel); maVSUnderline.SetItemImage(7, maIMGDashLongSel);
maVSUnderline.SelectItem(7); //add maVSUnderline.SelectItem(7);
maVSUnderline.GrabFocus(); maVSUnderline.GrabFocus();
break; break;
case UNDERLINE_DASHDOT: case UNDERLINE_DASHDOT:
maVSUnderline.SetItemImage(8, maIMGDashDotSel); maVSUnderline.SetItemImage(8, maIMGDashDotSel);
maVSUnderline.SelectItem(8); //add maVSUnderline.SelectItem(8);
maVSUnderline.GrabFocus(); maVSUnderline.GrabFocus();
break; break;
case UNDERLINE_DASHDOTDOT: case UNDERLINE_DASHDOTDOT:
maVSUnderline.SetItemImage(9, maIMGDashDotDotSel); maVSUnderline.SetItemImage(9, maIMGDashDotDotSel);
maVSUnderline.SelectItem(9); //add maVSUnderline.SelectItem(9);
maVSUnderline.GrabFocus(); maVSUnderline.GrabFocus();
break; break;
case UNDERLINE_WAVE: case UNDERLINE_WAVE:
maVSUnderline.SetItemImage(10, maIMGWaveSel); maVSUnderline.SetItemImage(10, maIMGWaveSel);
maVSUnderline.SelectItem(10); //add maVSUnderline.SelectItem(10);
maVSUnderline.GrabFocus(); maVSUnderline.GrabFocus();
break; break;
case UNDERLINE_NONE: case UNDERLINE_NONE:
default: default:
maVSUnderline.SelectItem(1); maVSUnderline.SelectItem(1);
maVSUnderline.SetNoSelection();//add maVSUnderline.SetNoSelection();
maPBOptions.GrabFocus(); maPBOptions.GrabFocus();
} }
maVSUnderline.StartSelection(); maVSUnderline.StartSelection();
//removed
//if(mpPage->meContextType == PROPERTY_CONTEXT_SC_CELL)
// maPBOptions.Disable();
//else
// maPBOptions.Enable();
//removed end
} }
ValueSet& TextUnderlineControl::GetValueSet() ValueSet& TextUnderlineControl::GetValueSet()
{ {
...@@ -227,20 +210,12 @@ IMPL_LINK(TextUnderlineControl, VSSelectHdl, void *, pControl) ...@@ -227,20 +210,12 @@ IMPL_LINK(TextUnderlineControl, VSSelectHdl, void *, pControl)
sal_uInt16 iPos = maVSUnderline.GetSelectItemId(); sal_uInt16 iPos = maVSUnderline.GetSelectItemId();
FontUnderline eUnderline = (FontUnderline)(sal_uInt64)maVSUnderline.GetItemData( iPos ); FontUnderline eUnderline = (FontUnderline)(sal_uInt64)maVSUnderline.GetItemData( iPos );
//<<modified
//SvxTextLineItem aLineItem(eUnderline, SID_ATTR_CHAR_UNDERLINE);
SvxUnderlineItem 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()); aLineItem.SetColor(mrTextPropertyPanel.GetUnderlineColor());
//add end>>
mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_UNDERLINE, SFX_CALLMODE_RECORD, &aLineItem, 0L); mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_UNDERLINE, SFX_CALLMODE_RECORD, &aLineItem, 0L);
//add , for the popup page not update immediately
mrTextPropertyPanel.SetUnderline(eUnderline); mrTextPropertyPanel.SetUnderline(eUnderline);
//add end
//mrTextPropertyPanel.SetDefaultUnderline(eUnderline);
mrTextPropertyPanel.EndUnderlinePopupMode(); mrTextPropertyPanel.EndUnderlinePopupMode();
} }
...@@ -256,9 +231,7 @@ IMPL_LINK(TextUnderlineControl, PBClickHdl, PushButton *, pPBtn) ...@@ -256,9 +231,7 @@ IMPL_LINK(TextUnderlineControl, PBClickHdl, PushButton *, pPBtn)
SfxDispatcher* pDisp = mpBindings->GetDispatcher(); SfxDispatcher* pDisp = mpBindings->GetDispatcher();
pDisp->Execute( SID_CHAR_DLG_EFFECT, SFX_CALLMODE_ASYNCHRON ); pDisp->Execute( SID_CHAR_DLG_EFFECT, SFX_CALLMODE_ASYNCHRON );
} }
//add
mrTextPropertyPanel.EndUnderlinePopupMode(); mrTextPropertyPanel.EndUnderlinePopupMode();
//add end
} }
return 0; 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