include/sfx2/sidebar/ControllerItem.hxx | 2 sfx2/source/sidebar/ControllerItem.cxx | 10 ++-- svx/source/sidebar/text/TextPropertyPanel.cxx | 63 ++++++++++++++++++-------- svx/source/sidebar/text/TextPropertyPanel.hxx | 1 svx/source/sidebar/text/TextPropertyPanel.src | 16 ++++++ 5 files changed, 68 insertions(+), 24 deletions(-)
New commits: commit 63bb2c7e910c59258074eb42b0c80f3fe93d8f8d Author: Andre Fischer <a...@apache.org> Date: Fri May 10 08:51:15 2013 +0000 Related: #i122082# Disable controls of text property sidebar... panel for disabled document parts (cherry picked from commit ffcc8c326640dfbc6b765cd25875adf9e0ab66ad) Conflicts: sfx2/inc/sfx2/sidebar/ControllerItem.hxx svx/source/sidebar/text/TextPropertyPanel.cxx Change-Id: I9f38c71c6415f3d255b5607a67a110bca47358b0 Related: #i122082# Remove temporary change (cherry picked from commit f213ea43fac43326a643f30ff13abd9d77f6aed7) Change-Id: I157542fd5dbbda17b63900be9a41782ee581309c diff --git a/include/sfx2/sidebar/ControllerItem.hxx b/include/sfx2/sidebar/ControllerItem.hxx index 0797e41..f8cb1fe 100644 --- a/include/sfx2/sidebar/ControllerItem.hxx +++ b/include/sfx2/sidebar/ControllerItem.hxx @@ -88,7 +88,7 @@ public: Changes of this state are notified via the ItemUpdateReceiverInterface::NotifyContextChang() method. */ - bool IsEnabled (void) const; + bool IsEnabled (const SfxItemState eState) const; /** Force the controller item to call its NotifyItemUpdate callback with up-to-date data. diff --git a/sfx2/source/sidebar/ControllerItem.cxx b/sfx2/source/sidebar/ControllerItem.cxx index 521a295..5abc109 100644 --- a/sfx2/source/sidebar/ControllerItem.cxx +++ b/sfx2/source/sidebar/ControllerItem.cxx @@ -133,15 +133,17 @@ void ControllerItem::StateChanged ( SfxItemState eState, const SfxPoolItem* pState) { - mrItemUpdateReceiver.NotifyItemUpdate(nSID, eState, pState, IsEnabled()); + mrItemUpdateReceiver.NotifyItemUpdate(nSID, eState, pState, IsEnabled(eState)); } -bool ControllerItem::IsEnabled (void) const +bool ControllerItem::IsEnabled (SfxItemState eState) const { - if ( ! SvtCommandOptions().HasEntries(SvtCommandOptions::CMDOPTION_DISABLED)) + if (eState == SFX_ITEM_DISABLED) + return false; + else if ( ! SvtCommandOptions().HasEntries(SvtCommandOptions::CMDOPTION_DISABLED)) { // There are no disabled commands. return true; @@ -168,7 +170,7 @@ void ControllerItem::RequestUpdate (void) { SfxPoolItem* pState = NULL; const SfxItemState eState (GetBindings().QueryState(GetId(), pState)); - mrItemUpdateReceiver.NotifyItemUpdate(GetId(), eState, pState, IsEnabled()); + mrItemUpdateReceiver.NotifyItemUpdate(GetId(), eState, pState, IsEnabled(eState)); } diff --git a/svx/source/sidebar/text/TextPropertyPanel.cxx b/svx/source/sidebar/text/TextPropertyPanel.cxx index 3a9d605..3a67193 100644 --- a/svx/source/sidebar/text/TextPropertyPanel.cxx +++ b/svx/source/sidebar/text/TextPropertyPanel.cxx @@ -68,10 +68,7 @@ namespace svx { namespace sidebar { #undef HAS_IA2 -#define TEXT_SECTIONPAGE_HEIGHT SECTIONPAGE_MARGIN_VERTICAL_TOP + CBOX_HEIGHT + ( TOOLBOX_ITEM_HEIGHT + 2 ) * 2 + CONTROL_SPACING_VERTICAL * 2 + SECTIONPAGE_MARGIN_VERTICAL_BOT - - - PopupControl* TextPropertyPanel::CreateCharacterSpacingControl (PopupContainer* pParent) +PopupControl* TextPropertyPanel::CreateCharacterSpacingControl (PopupContainer* pParent) { return new TextCharacterSpacingControl(pParent, *this, mpBindings); } @@ -335,6 +332,7 @@ void TextPropertyPanel::DataChanged (const DataChangedEvent& rEvent) + void TextPropertyPanel::Initialize (void) { //<<modify fill font list @@ -420,11 +418,6 @@ void TextPropertyPanel::Initialize (void) maFontSizeBox.SetSelectHdl(aLink); aLink = LINK(this, TextPropertyPanel, FontSizeLoseFocus); maFontSizeBox.SetLoseFocusHdl(aLink); - - Size aSize(PROPERTYPAGE_WIDTH, TEXT_SECTIONPAGE_HEIGHT); - aSize = LogicToPixel( aSize, MapMode(MAP_APPFONT) ); - aSize.setWidth(GetOutputSizePixel().Width()); - SetSizePixel(aSize); } void TextPropertyPanel::EndSpacingPopupMode (void) @@ -944,16 +937,38 @@ void TextPropertyPanel::NotifyItemUpdate ( { mpHeightItem = (SvxFontHeightItem*)pState;//const SvxFontHeightItem* SfxMapUnit eUnit = maFontSizeControl.GetCoreMetric(); - long iValue = (long)CalcToPoint( mpHeightItem->GetHeight(), eUnit, 10 ); + const sal_Int64 nValue (CalcToPoint(mpHeightItem->GetHeight(), eUnit, 10 )); mpToolBoxIncDec->Enable(); mpToolBoxIncDec->SetItemState(TBI_INCREASE, STATE_NOCHECK); mpToolBoxIncDec->SetItemState(TBI_DECREASE, STATE_NOCHECK); + // For Writer we have to update the states of the + // increase and decrease buttons here, because we have + // no access to the slots used by Writer. + switch(maContext.GetCombinedContext_DI()) + { + case CombinedEnumContext(Application_DrawImpress, Context_DrawText): + case CombinedEnumContext(Application_DrawImpress, Context_Text): + case CombinedEnumContext(Application_DrawImpress, Context_Table): + case CombinedEnumContext(Application_DrawImpress, Context_OutlineText): + case CombinedEnumContext(Application_DrawImpress, Context_Draw): + case CombinedEnumContext(Application_DrawImpress, Context_TextObject): + case CombinedEnumContext(Application_DrawImpress, Context_Graphic): + break; + + default: + { + mpToolBoxIncDec->EnableItem(TBI_INCREASE, bIsEnabled && nValue<960); + mpToolBoxIncDec->EnableItem(TBI_DECREASE, bIsEnabled && nValue>60); + break; + } + } + if( mbFocusOnFontSizeCtrl ) return; - maFontSizeBox.SetValue( iValue ); + maFontSizeBox.SetValue(nValue); maFontSizeBox.LoseFocus(); UpdateItem(SID_SHRINK_FONT_SIZE); @@ -1147,8 +1162,8 @@ void TextPropertyPanel::NotifyItemUpdate ( { meEscape = SVX_ESCAPEMENT_OFF; } - mpToolBoxScriptSw->EnableItem(TBI_SUPER, bIsItemEnabled && bIsEnabled); - mpToolBoxScriptSw->EnableItem(TBI_SUB, bIsItemEnabled && bIsEnabled); + mpToolBoxScriptSw->EnableItem(TBI_SUPER_SW, bIsItemEnabled && bIsEnabled); + mpToolBoxScriptSw->EnableItem(TBI_SUB_SW, bIsItemEnabled && bIsEnabled); break; } @@ -1224,17 +1239,27 @@ void TextPropertyPanel::NotifyItemUpdate ( case CombinedEnumContext(Application_DrawImpress, Context_Draw): case CombinedEnumContext(Application_DrawImpress, Context_TextObject): case CombinedEnumContext(Application_DrawImpress, Context_Graphic): + { if(eState == SFX_ITEM_DISABLED) mpToolBoxIncDec->Disable(); else mpToolBoxIncDec->Enable(); - break; + const sal_Int64 nSize (maFontSizeBox.GetValue()); + switch(nSID) + { + case SID_GROW_FONT_SIZE: + mpToolBoxIncDec->EnableItem(TBI_INCREASE, bIsEnabled && nSize<960); + break; + + case SID_SHRINK_FONT_SIZE: + mpToolBoxIncDec->EnableItem(TBI_DECREASE, bIsEnabled && nSize>60); + break; + + default: + break; + } + } } - const sal_Int32 nSize (maFontSizeBox.GetValue()); - if (nSID == SID_GROW_FONT_SIZE) - mpToolBoxIncDec->EnableItem(TBI_INCREASE, bIsEnabled && nSize<960); - else - mpToolBoxIncDec->EnableItem(TBI_DECREASE, bIsEnabled && nSize>60); break; } } diff --git a/svx/source/sidebar/text/TextPropertyPanel.hxx b/svx/source/sidebar/text/TextPropertyPanel.hxx index cb097d6..e2f4dac 100644 --- a/svx/source/sidebar/text/TextPropertyPanel.hxx +++ b/svx/source/sidebar/text/TextPropertyPanel.hxx @@ -57,6 +57,7 @@ public: SfxBindings* pBindings); virtual void DataChanged (const DataChangedEvent& rEvent); + ::sfx2::sidebar::ControllerItem& GetSpaceController(); long GetSelFontSize(); void SetSpacing(long nKern); diff --git a/svx/source/sidebar/text/TextPropertyPanel.src b/svx/source/sidebar/text/TextPropertyPanel.src index d1ca9c3..f4038fe 100644 --- a/svx/source/sidebar/text/TextPropertyPanel.src +++ b/svx/source/sidebar/text/TextPropertyPanel.src @@ -60,6 +60,7 @@ Control RID_SIDEBAR_TEXT_PANEL DropDown = TRUE; HelpID = HID_COMBO_FONT_NAME ; QuickHelpText [ en-US ] = "Font"; +// Command = ".uno:CharFontName"; }; MetricBox MB_SBFONT_FONTSIZE { @@ -70,6 +71,7 @@ Control RID_SIDEBAR_TEXT_PANEL DropDown = TRUE; HelpID = HID_METRIC_FONT_SIZE; QuickHelpText [ en-US ] = "Font Size"; +// Command = ".uno:FontHeight"; }; ToolBox TB_INCREASE_DECREASE @@ -86,11 +88,13 @@ Control RID_SIDEBAR_TEXT_PANEL { Identifier = TBI_INCREASE; HelpID = HID_PPROPERTYPANEL_TEXT_TBI_INCREASE; + Command = ".uno:Grow"; }; ToolBoxItem { Identifier = TBI_DECREASE; HelpID = HID_PPROPERTYPANEL_TEXT_TBI_DECREASE; + Command = ".uno:Shrink"; }; }; }; @@ -108,27 +112,32 @@ Control RID_SIDEBAR_TEXT_PANEL { Identifier = TBI_BOLD; HelpID = HID_PPROPERTYPANEL_TEXT_TBI_BOLD; + Command = ".uno:Bold"; }; ToolBoxItem { Identifier = TBI_ITALIC; HelpID = HID_PPROPERTYPANEL_TEXT_TBI_ITALIC; + Command = ".uno:Italic"; }; ToolBoxItem { Identifier = TBI_UNDERLINE; DropDown = TRUE ; HelpID = HID_PPROPERTYPANEL_TEXT_TBI_UNDERLINE; + Command = ".uno:Underline"; }; ToolBoxItem { Identifier = TBI_STRIKEOUT; HelpID = HID_PPROPERTYPANEL_TEXT_TBI_STRIKEOUT; + Command = ".uno:Strikeout"; }; ToolBoxItem { Identifier = TBI_SHADOWED; HelpID = HID_PPROPERTYPANEL_TEXT_TBI_SHADOWED; + Command = ".uno:Shadowed"; }; }; }; @@ -148,6 +157,7 @@ Control RID_SIDEBAR_TEXT_PANEL Identifier = TBI_FONTCOLOR ; HelpID = HID_PPROPERTYPANEL_TEXT_TBI_FONT_COLOR; DropDown = TRUE ; + Command = ".uno:Color"; }; }; }; @@ -167,6 +177,7 @@ Control RID_SIDEBAR_TEXT_PANEL Identifier = TBI_HIGHLIGHT ; HelpID = HID_PPROPERTYPANEL_TEXT_TBI_HIGHLIGHT_COLOR; DropDown = TRUE ; + Command = ".uno:CharacterBackgroundPattern"; }; }; }; @@ -185,11 +196,13 @@ Control RID_SIDEBAR_TEXT_PANEL { Identifier = TBI_SUPER_SW; HelpID = HID_PPROPERTYPANEL_TEXT_TBI_SUPER_SW; + Command = ".uno:SuperScript"; }; ToolBoxItem { Identifier = TBI_SUB_SW; HelpID = HID_PPROPERTYPANEL_TEXT_TBI_SUB_SW; + Command = ".uno:SubScript"; }; }; }; @@ -207,11 +220,13 @@ Control RID_SIDEBAR_TEXT_PANEL { Identifier = TBI_SUPER; HelpID = HID_PPROPERTYPANEL_TEXT_TBI_SUPER; + Command = ".uno:SuperScript"; }; ToolBoxItem { Identifier = TBI_SUB; HelpID = HID_PPROPERTYPANEL_TEXT_TBI_SUB; + Command = ".uno:SubScript"; }; }; }; @@ -231,6 +246,7 @@ Control RID_SIDEBAR_TEXT_PANEL Identifier = TBI_SPACING; DropDown = TRUE ; HelpID = HID_TBI_SPACING; + Command = ".uno:Spacing"; }; }; }; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits