You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by af...@apache.org on 2013/05/10 10:51:18 UTC
svn commit: r1480937 - in /openoffice/trunk/main: sfx2/inc/sfx2/sidebar/
sfx2/source/sidebar/ svx/source/sidebar/text/
Author: af
Date: Fri May 10 08:51:15 2013
New Revision: 1480937
URL: http://svn.apache.org/r1480937
Log:
122082: Disable controls of text property sidebar panel for disabled document parts.
Modified:
openoffice/trunk/main/sfx2/inc/sfx2/sidebar/ControllerItem.hxx
openoffice/trunk/main/sfx2/source/sidebar/ControllerItem.cxx
openoffice/trunk/main/svx/source/sidebar/text/TextPropertyPanel.cxx
openoffice/trunk/main/svx/source/sidebar/text/TextPropertyPanel.hxx
openoffice/trunk/main/svx/source/sidebar/text/TextPropertyPanel.src
Modified: openoffice/trunk/main/sfx2/inc/sfx2/sidebar/ControllerItem.hxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sfx2/inc/sfx2/sidebar/ControllerItem.hxx?rev=1480937&r1=1480936&r2=1480937&view=diff
==============================================================================
--- openoffice/trunk/main/sfx2/inc/sfx2/sidebar/ControllerItem.hxx (original)
+++ openoffice/trunk/main/sfx2/inc/sfx2/sidebar/ControllerItem.hxx Fri May 10 08:51:15 2013
@@ -91,7 +91,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.
Modified: openoffice/trunk/main/sfx2/source/sidebar/ControllerItem.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sfx2/source/sidebar/ControllerItem.cxx?rev=1480937&r1=1480936&r2=1480937&view=diff
==============================================================================
--- openoffice/trunk/main/sfx2/source/sidebar/ControllerItem.cxx (original)
+++ openoffice/trunk/main/sfx2/source/sidebar/ControllerItem.cxx Fri May 10 08:51:15 2013
@@ -139,15 +139,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;
@@ -174,7 +176,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));
}
Modified: openoffice/trunk/main/svx/source/sidebar/text/TextPropertyPanel.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svx/source/sidebar/text/TextPropertyPanel.cxx?rev=1480937&r1=1480936&r2=1480937&view=diff
==============================================================================
--- openoffice/trunk/main/svx/source/sidebar/text/TextPropertyPanel.cxx (original)
+++ openoffice/trunk/main/svx/source/sidebar/text/TextPropertyPanel.cxx Fri May 10 08:51:15 2013
@@ -45,6 +45,7 @@
#include <sfx2/sidebar/ResourceDefinitions.hrc>
#include <sfx2/sidebar/ControlFactory.hxx>
#include <sfx2/sidebar/Theme.hxx>
+#include <sfx2/sidebar/PanelLayouter.hxx>
#include "sfx2/imagemgr.hxx"
#include <svtools/ctrltool.hxx>
#include <svtools/unitconv.hxx>
@@ -73,17 +74,8 @@ namespace svx { namespace sidebar {
#undef HAS_IA2
-#define FONT_CONTROL_WIDTH 160
-#define SIZE_CONTROL_WIDTH 80
-#define CONTROL_COMBOX_HEIGHT 20
-#define CONTROL_HEIGHT_5X 120
-
-#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
-
-
- PopupControl* TextPropertyPanel::CreateCharacterSpacingControl (PopupContainer* pParent)
+PopupControl* TextPropertyPanel::CreateCharacterSpacingControl (PopupContainer* pParent)
{
return new TextCharacterSpacingControl(pParent, *this, mpBindings);
}
@@ -344,6 +336,7 @@ void TextPropertyPanel::DataChanged (con
+
void TextPropertyPanel::Initialize (void)
{
//<<modify fill font list
@@ -429,11 +422,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)
@@ -953,16 +941,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);
@@ -1132,7 +1142,7 @@ void TextPropertyPanel::NotifyItemUpdate
{
meEscape = SVX_ESCAPEMENT_SUPERSCRIPT;
mpToolBoxScriptSw->SetItemState(TBI_SUPER_SW, STATE_CHECK);
- mpToolBoxScriptSw->SetItemState(TBI_SUB_SW, STATE_NOCHECK);
+ mpToolBoxScriptSw->SetItemState(TBI_SUB_SW, STATE_NOCHECK);
}
else
{
@@ -1156,8 +1166,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;
}
@@ -1233,17 +1243,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;
}
}
Modified: openoffice/trunk/main/svx/source/sidebar/text/TextPropertyPanel.hxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svx/source/sidebar/text/TextPropertyPanel.hxx?rev=1480937&r1=1480936&r2=1480937&view=diff
==============================================================================
--- openoffice/trunk/main/svx/source/sidebar/text/TextPropertyPanel.hxx (original)
+++ openoffice/trunk/main/svx/source/sidebar/text/TextPropertyPanel.hxx Fri May 10 08:51:15 2013
@@ -61,6 +61,8 @@ public:
SfxBindings* pBindings);
virtual void DataChanged (const DataChangedEvent& rEvent);
+ virtual void Resize (void);
+
::sfx2::sidebar::ControllerItem& GetSpaceController();
long GetSelFontSize();
void SetSpacing(long nKern);
Modified: openoffice/trunk/main/svx/source/sidebar/text/TextPropertyPanel.src
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svx/source/sidebar/text/TextPropertyPanel.src?rev=1480937&r1=1480936&r2=1480937&view=diff
==============================================================================
--- openoffice/trunk/main/svx/source/sidebar/text/TextPropertyPanel.src (original)
+++ openoffice/trunk/main/svx/source/sidebar/text/TextPropertyPanel.src Fri May 10 08:51:15 2013
@@ -64,6 +64,7 @@ Control RID_SIDEBAR_TEXT_PANEL
DropDown = TRUE;
HelpID = HID_COMBO_FONT_NAME ;
QuickHelpText [ en-US ] = "Font";
+// Command = ".uno:CharFontName";
};
MetricBox MB_SBFONT_FONTSIZE
{
@@ -74,6 +75,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
@@ -90,11 +92,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";
};
};
};
@@ -112,27 +116,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";
};
};
};
@@ -152,6 +161,7 @@ Control RID_SIDEBAR_TEXT_PANEL
Identifier = TBI_FONTCOLOR ;
HelpID = HID_PPROPERTYPANEL_TEXT_TBI_FONT_COLOR;
DropDown = TRUE ;
+ Command = ".uno:Color";
};
};
};
@@ -171,6 +181,7 @@ Control RID_SIDEBAR_TEXT_PANEL
Identifier = TBI_HIGHLIGHT ;
HelpID = HID_PPROPERTYPANEL_TEXT_TBI_HIGHLIGHT_COLOR;
DropDown = TRUE ;
+ Command = ".uno:CharacterBackgroundPattern";
};
};
};
@@ -189,11 +200,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";
};
};
};
@@ -211,11 +224,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";
};
};
};
@@ -235,6 +250,7 @@ Control RID_SIDEBAR_TEXT_PANEL
Identifier = TBI_SPACING;
DropDown = TRUE ;
HelpID = HID_TBI_SPACING;
+ Command = ".uno:Spacing";
};
};
};