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/01/21 11:29:05 UTC
svn commit: r1436260 [4/5] - in /openoffice/branches/sidebar/main:
framework/inc/services/ framework/source/services/ offapi/com/sun/star/ui/
officecfg/registry/data/org/openoffice/Office/UI/ postprocess/rebase/
sd/source/ui/func/ sd/source/ui/presente...
Added: 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=1436260&view=auto
==============================================================================
--- openoffice/branches/sidebar/main/svx/source/sidebar/text/TextPropertyPanel.cxx (added)
+++ openoffice/branches/sidebar/main/svx/source/sidebar/text/TextPropertyPanel.cxx Mon Jan 21 10:29:03 2013
@@ -0,0 +1,1672 @@
+/**************************************************************
+ *
+ * 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 "TextPropertyPanel.hrc"
+#include "TextPropertyPanel.hxx"
+#include "SvxSBFontNameBox.hxx"
+
+#include "svx/dialmgr.hxx"
+
+#include <editeng/brshitem.hxx>
+#include <editeng/colritem.hxx>
+#include <editeng/crsditem.hxx>
+#include <editeng/escpitem.hxx>
+#include <editeng/flstitem.hxx>
+#include <editeng/fontitem.hxx>
+#include <editeng/kernitem.hxx>
+#include <editeng/postitem.hxx>
+#include <editeng/shdditem.hxx>
+#include <editeng/udlnitem.hxx>
+#include <editeng/wghtitem.hxx>
+#include <rtl/ref.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/objsh.hxx>
+#include <sfx2/viewsh.hxx>
+#include <sfx2/sidebar/propertypanel.hrc>
+#include <sfx2/sidebar/ControlFactory.hxx>
+#include <sfx2/sidebar/Theme.hxx>
+#include <svtools/ctrltool.hxx>
+#include <svtools/unitconv.hxx>
+
+#include <vcl/gradient.hxx>
+#include <vcl/svapp.hxx>
+
+
+using namespace css;
+using namespace cssu;
+using ::sfx2::sidebar::Theme;
+
+#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString)))
+
+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 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
+
+
+
+
+
+Reference<ui::XUIElement> TextPropertyPanel::Create (
+ const ::rtl::OUString& rsResourceURL,
+ Window* pParent,
+ const cssu::Reference<css::frame::XFrame>& rxFrame,
+ SfxBindings* pBindings)
+{
+ if (pParent == NULL)
+ throw lang::IllegalArgumentException(A2S("no parent Window given to TextPropertyPanel::Create"), NULL, 0);
+ if ( ! rxFrame.is())
+ throw lang::IllegalArgumentException(A2S("no XFrame given to TextPropertyPanel::Create"), NULL, 1);
+ if (pBindings == NULL)
+ throw lang::IllegalArgumentException(A2S("no SfxBindings given to TextPropertyPanel::Create"), NULL, 2);
+
+ ::rtl::Reference<TextPropertyPanel> pPanel (
+ new TextPropertyPanel(
+ rsResourceURL,
+ pParent,
+ rxFrame,
+ pBindings));
+ return Reference<ui::XUIElement>(static_cast<XWeak*>(pPanel.get()), UNO_QUERY);
+}
+
+
+
+
+TextPropertyPanel::TextPropertyPanel (
+ const ::rtl::OUString& rsResourceURL,
+ Window* pParent,
+ const cssu::Reference<css::frame::XFrame>& rxFrame,
+ SfxBindings* pBindings)
+ : ::sfx2::sidebar::SidebarPanelBase(rsResourceURL, pParent, rxFrame, SVX_RES(RID_SIDEBAR_TEXT_PANEL)),
+ mpFontNameBox (new SvxSBFontNameBox(this, SVX_RES(CB_SBFONT_FONT))),
+ maFontSizeBox (this, SVX_RES(MB_SBFONT_FONTSIZE)),
+ mpToolBoxIncDec(sfx2::sidebar::ControlFactory::CreateToolBox(this, SVX_RES(TB_INCREASE_DECREASE))),
+ mpToolBoxFont(sfx2::sidebar::ControlFactory::CreateToolBox(this, SVX_RES(TB_FONT))),
+ mpToolBoxFontColor(sfx2::sidebar::ControlFactory::CreateToolBox(this, SVX_RES(TB_FONTCOLOR))),
+ mpToolBoxScript(sfx2::sidebar::ControlFactory::CreateToolBox(this, SVX_RES(TB_SCRIPT))),
+ mpToolBoxScriptSw(sfx2::sidebar::ControlFactory::CreateToolBox(this, SVX_RES(TB_SCRIPT_SW))),
+ mpToolBoxSpacing(sfx2::sidebar::ControlFactory::CreateToolBox(this, SVX_RES(TB_SPACING))),
+ mpToolBoxHighlight(sfx2::sidebar::ControlFactory::CreateToolBox(this, SVX_RES(TB_HIGHLIGHT))),
+ mpFontColorUpdater(),
+ mpHighlightUpdater(),
+
+ maFontNameControl (SID_ATTR_CHAR_FONT, *pBindings, *this),
+ maFontSizeControl (SID_ATTR_CHAR_FONTHEIGHT, *pBindings, *this),
+ maWeightControl (SID_ATTR_CHAR_WEIGHT, *pBindings, *this),
+ maItalicControl (SID_ATTR_CHAR_POSTURE, *pBindings, *this),
+ maUnderlineControl (SID_ATTR_CHAR_UNDERLINE, *pBindings, *this),
+ maStrikeControl (SID_ATTR_CHAR_STRIKEOUT, *pBindings, *this),
+ maShadowControl (SID_ATTR_CHAR_SHADOWED, *pBindings, *this),
+ maFontColorControl (SID_ATTR_CHAR_COLOR, *pBindings, *this),
+ maScriptControlSw (SID_ATTR_CHAR_ESCAPEMENT, *pBindings, *this), //for sw
+ maSuperScriptControl (SID_SET_SUPER_SCRIPT, *pBindings, *this),
+ maSubScriptControl (SID_SET_SUB_SCRIPT, *pBindings, *this),
+ maSpacingControl (SID_ATTR_CHAR_KERNING, *pBindings, *this),
+ maHighlightControl (SID_ATTR_BRUSH_CHAR, *pBindings, *this),
+ maSDFontGrow (SID_GROW_FONT_SIZE, *pBindings, *this),
+ maSDFontShrink (SID_SHRINK_FONT_SIZE, *pBindings, *this),
+
+ maImgIncrease (SVX_RES( IMG_INCREASE)),
+ maImgDecrease (SVX_RES( IMG_DECREASE)),
+ maImgBold (SVX_RES( IMG_BOLD )),
+ maImgItalic (SVX_RES( IMG_ITALIC )),
+ maImgUnderline (SVX_RES( IMG_UNDERLINE )),
+ maImgStrike (SVX_RES( IMG_STRIKEOUT )),
+ maImgShadow (SVX_RES( IMG_SHADOWED )),
+ maImgFontColor (SVX_RES( IMG_FONTCOLOR)),
+ maImgSupScript (SVX_RES( IMG_SUPSCRIPT)),
+ maImgSubScript (SVX_RES( IMG_SUBSCRIPT)),
+ maImgHighlight (SVX_RES( IMG_HIGHLIGHT)),
+
+ maImgNormalIcon (SVX_RES(IMG_SPACING_D)),
+
+ maImgIncreaseHigh (SVX_RES( IMG_INCREASE_H )),
+ maImgDecreaseHigh (SVX_RES( IMG_DECREASE_H )),
+ maImgBoldHigh (SVX_RES( IMG_BOLD_H )),
+ maImgItalicHigh (SVX_RES( IMG_ITALIC_H )),
+ maImgUnderlineHigh (SVX_RES( IMG_UNDERLINE_H )),
+ maImgStrikeHigh (SVX_RES( IMG_STRIKEOUT_H )),
+ maImgShadowHigh (SVX_RES( IMG_SHADOWED_H )),
+ maImgFontColorHigh (SVX_RES( IMG_FONTCOLOR_H)),
+ maImgSupScriptHigh (SVX_RES( IMG_SUPSCRIPT_H)),
+ maImgSubScriptHigh (SVX_RES( IMG_SUBSCRIPT_H)),
+ maImgHighlightHigh (SVX_RES( IMG_HIGHLIGHT_H)),
+
+ mpFontList (NULL),
+ mbMustDelete (false),
+ mbFocusOnFontSizeCtrl(false),
+ /*AF
+ mpFloatWinUnderline(NULL),
+ mpPageUnderline(NULL),
+ mpFloatWinFontColor(NULL),
+ mpPageFontColor(NULL),
+ mpFloatWinSpacing(NULL),
+ mpPageSpacing(NULL)
+ */
+ maContext(),
+ mpBindings(pBindings)
+{
+ Initialize();
+ FreeResource();
+}
+
+
+
+
+TextPropertyPanel::~TextPropertyPanel (void)
+{
+ if(mbMustDelete)
+ delete mpFontList;
+
+ /*AF
+ delete mpPageUnderline;
+ delete mpFloatWinUnderline;
+
+ delete mpPageFontColor;
+ delete mpFloatWinFontColor;
+
+ delete mpPageSpacing;
+ delete mpFloatWinSpacing;
+ */
+}
+
+
+
+
+void TextPropertyPanel::HandleContextChange (
+ const ::sfx2::sidebar::EnumContext aContext)
+{
+ if (maContext == aContext)
+ {
+ // Nothing to do.
+ return;
+ }
+
+ maContext = aContext;
+ switch (maContext.GetCombinedContext())
+ {
+ case CombinedEnumContext(Application_Calc, Context_Cell):
+ case CombinedEnumContext(Application_Calc, Context_Pivot):
+ {
+ mpToolBoxScript->Hide();
+ mpToolBoxScriptSw->Hide();
+ mpToolBoxSpacing->Hide();
+ mpToolBoxHighlight->Hide();
+
+ Size aSize(PROPERTYPAGE_WIDTH,TEXT_SECTIONPAGE_HEIGHT_S);
+ aSize = LogicToPixel( aSize, MapMode(MAP_APPFONT) );
+ aSize.setWidth(GetOutputSizePixel().Width());
+ SetSizePixel(aSize);
+ break;
+ }
+
+ case CombinedEnumContext(Application_Writer, Context_Text):
+ case CombinedEnumContext(Application_Writer, Context_Table):
+ {
+ mpToolBoxScriptSw->Show();
+ mpToolBoxScript->Hide();
+ mpToolBoxHighlight->Show();
+ mpToolBoxSpacing->Show();
+
+ Size aSize(PROPERTYPAGE_WIDTH, TEXT_SECTIONPAGE_HEIGHT);
+ aSize = LogicToPixel( aSize, MapMode(MAP_APPFONT) );
+ aSize.setWidth(GetOutputSizePixel().Width());
+ SetSizePixel(aSize);
+ break;
+ }
+
+ case CombinedEnumContext(Application_Writer, Context_DrawText):
+ case CombinedEnumContext(Application_Writer, Context_Annotation):
+ {
+ mpToolBoxScriptSw->Show();
+ mpToolBoxScript->Hide();
+ mpToolBoxSpacing->Show();
+ mpToolBoxHighlight->Hide();
+
+ Size aSize(PROPERTYPAGE_WIDTH,TEXT_SECTIONPAGE_HEIGHT);
+ aSize = LogicToPixel( aSize, MapMode(MAP_APPFONT) );
+ aSize.setWidth(GetOutputSizePixel().Width());
+ SetSizePixel(aSize);
+ break;
+ }
+
+ case CombinedEnumContext(Application_Calc, Context_EditCell):
+ case CombinedEnumContext(Application_Calc, Context_DrawText):
+ case CombinedEnumContext(Application_Draw, Context_DrawText):
+ case CombinedEnumContext(Application_Draw, Context_Text):
+ case CombinedEnumContext(Application_Draw, Context_Table):
+ case CombinedEnumContext(Application_Draw, Context_OutlineText):
+ case CombinedEnumContext(Application_Draw, Context_Draw):
+ case CombinedEnumContext(Application_Draw, Context_TextObject):
+ case CombinedEnumContext(Application_Draw, Context_Graphic):
+ case CombinedEnumContext(Application_Impress, Context_DrawText):
+ case CombinedEnumContext(Application_Impress, Context_Text):
+ case CombinedEnumContext(Application_Impress, Context_Table):
+ case CombinedEnumContext(Application_Impress, Context_OutlineText):
+ case CombinedEnumContext(Application_Impress, Context_Draw):
+ case CombinedEnumContext(Application_Impress, Context_TextObject):
+ case CombinedEnumContext(Application_Impress, Context_Graphic):
+ {
+ mpToolBoxScriptSw->Hide();
+ mpToolBoxScript->Show();
+ mpToolBoxSpacing->Show();
+ mpToolBoxHighlight->Hide();
+
+ Size aSize(PROPERTYPAGE_WIDTH,TEXT_SECTIONPAGE_HEIGHT);
+ aSize = LogicToPixel( aSize,MapMode(MAP_APPFONT) );
+ aSize.setWidth(GetOutputSizePixel().Width());
+ SetSizePixel(aSize);
+ break;
+ }
+
+ default:
+ break;
+ }
+}
+
+
+
+
+void TextPropertyPanel::PaintRect(const ToolBox &rTB)
+{
+ Point aPos = rTB.GetPosPixel();
+ Size aSize = rTB.GetSizePixel();
+ Rectangle aRect( aPos, aSize );
+ aRect.Left() -= 2;
+ aRect.Top() -= 1;
+ aRect.Right() += 2;
+ aRect.Bottom() += 1;
+ Color aOldLineColor = GetLineColor();
+ Color aOldFillColor = GetFillColor();
+ Color aLineColor(200,209,225);
+// Color aLineColor = GetSettings().GetStyleSettings().GetPropertySectionTBxBorderColor();
+ if(!GetSettings().GetStyleSettings().GetHighContrastMode())
+ SetLineColor(aLineColor);
+ else
+ SetLineColor(GetSettings().GetStyleSettings().GetShadowColor());
+ SetFillColor(COL_TRANSPARENT);
+ DrawRect(aRect);
+
+ aRect.Left() += 1 ;
+ aRect.Top() += 1;
+ aRect.Right() -= 1;
+ aRect.Bottom() -= 1;
+ Color aStartColor(220,228,238);
+ Color aEndColor(245,245,247);
+ Gradient aBKGrad(GRADIENT_LINEAR, aStartColor, aEndColor);
+ if(!GetSettings().GetStyleSettings().GetHighContrastMode())
+// DrawGradient(aRect, GetSettings().GetStyleSettings().GetPropertySectionTBxBKGGradient());
+ DrawGradient(aRect, aBKGrad);
+ //else
+ //{
+ // SetFillColor(GetSettings().GetStyleSettings().GetMenuColor());
+ // DrawRect(aRect);
+ //}
+
+ SetLineColor(aOldLineColor);
+ SetFillColor(aOldFillColor);
+}
+
+
+
+
+void TextPropertyPanel::Paint(const Rectangle &rRect)
+{
+ SidebarPanelBase::Paint(rRect);
+
+ if(mpFontColorUpdater == NULL && mpHighlightUpdater == NULL)
+ return;
+
+ //size increase & decrease
+ //AF PaintRect(*mpToolBoxIncDec);
+
+ //Font Toolbox
+ PaintRect(*mpToolBoxFont);
+
+ //font color toolbox
+ PaintRect(*mpToolBoxFontColor);
+
+ //script for sw
+ switch (maContext.GetCombinedContext())
+ {
+ case CombinedEnumContext(Application_Writer, Context_Text):
+ case CombinedEnumContext(Application_Writer, Context_Table):
+ PaintRect(*mpToolBoxHighlight);
+ // fall through
+ case CombinedEnumContext(Application_Writer, Context_DrawText):
+ case CombinedEnumContext(Application_Writer, Context_Annotation):
+ PaintRect(*mpToolBoxScriptSw);
+ break;
+
+ case CombinedEnumContext(Application_Calc, Context_EditCell):
+ case CombinedEnumContext(Application_Calc, Context_DrawText):
+ case CombinedEnumContext(Application_Draw, Context_DrawText):
+ case CombinedEnumContext(Application_Draw, Context_Text):
+ case CombinedEnumContext(Application_Draw, Context_Table):
+ case CombinedEnumContext(Application_Draw, Context_OutlineText):
+ case CombinedEnumContext(Application_Draw, Context_Draw):
+ case CombinedEnumContext(Application_Draw, Context_TextObject):
+ case CombinedEnumContext(Application_Draw, Context_Graphic):
+ case CombinedEnumContext(Application_Impress, Context_DrawText):
+ case CombinedEnumContext(Application_Impress, Context_Text):
+ case CombinedEnumContext(Application_Impress, Context_Table):
+ case CombinedEnumContext(Application_Impress, Context_OutlineText):
+ case CombinedEnumContext(Application_Impress, Context_Draw):
+ case CombinedEnumContext(Application_Impress, Context_TextObject):
+ case CombinedEnumContext(Application_Impress, Context_Graphic):
+ PaintRect(*mpToolBoxScript);
+ break;
+ }
+
+ if (maContext.GetCombinedContext() != CombinedEnumContext(Application_Calc, Context_Cell))
+ {
+ PaintRect(*mpToolBoxSpacing);
+ }
+}
+
+
+
+
+void TextPropertyPanel::DataChanged (const DataChangedEvent& rEvent)
+{
+ SetupIcons();
+}
+
+
+
+void TextPropertyPanel::Initialize (void)
+{
+ //<<modify fill font list
+ SfxObjectShell* pDocSh = SfxObjectShell::Current();
+ const SfxPoolItem* pItem = NULL;
+
+ if (pDocSh != NULL)
+ pItem = pDocSh->GetItem( SID_ATTR_CHAR_FONTLIST );
+ if (pItem != NULL)
+ mpFontList = ( (SvxFontListItem*)pItem )->GetFontList();
+ else
+ {
+ mpFontList = new FontList( Application::GetDefaultDevice() );
+ mbMustDelete = 1;
+ }
+
+ mpFontNameBox->SetAccessibleName(mpFontNameBox->GetQuickHelpText());
+ maFontSizeBox.Fill( &mpFontList->Get( String::CreateFromAscii( "" ), String::CreateFromAscii( "" )),mpFontList );
+ maFontSizeBox.SetAccessibleName(maFontSizeBox.GetQuickHelpText());
+
+ //toolbox
+ SetupIcons();
+ InitToolBoxIncDec();
+ InitToolBoxFont();
+ InitToolBoxFontColor();
+ InitToolBoxScript();
+ InitToolBoxSpacing();
+ InitToolBoxHighlight();
+
+#ifdef HAS_IA2
+ mpFontNameBox->SetAccRelationLabeledBy(&maFontNameBox);
+ mpFontNameBox->SetMpSubEditAccLableBy(&maFontNameBox);
+ 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);
+#endif
+
+ //init state
+ mpHeightItem = NULL;
+ meWeight = WEIGHT_NORMAL;
+ meItalic = ITALIC_NONE;
+ mbShadow = false;
+ meStrike = STRIKEOUT_NONE;
+ mbPostureAvailable = true;
+ mbWeightAvailable = true;
+ meUnderline = UNDERLINE_NONE;
+ meUnderlineColor = COL_AUTO; //
+ maColor = COL_BLACK;
+ mbColorAvailable = true;
+ maBackColor = COL_AUTO;
+ mbBackColorAvailable = true;
+ meColorType = FONT_COLOR;
+ meEscape = SVX_ESCAPEMENT_OFF;
+ mbSuper = false;
+ mbSub = false;
+ mbKernAvailable = true;
+ mbKernLBAvailable = true;
+ mlKerning = 0;
+ mpFontColorUpdater.reset(new ToolboxButtonColorUpdater(
+ SID_ATTR_CHAR_COLOR,
+ TBI_FONTCOLOR,
+ mpToolBoxFontColor.get(),
+ TBX_UPDATER_MODE_CHAR_COLOR_NEW));
+ mpHighlightUpdater.reset(new ToolboxButtonColorUpdater(
+ SID_ATTR_BRUSH_CHAR,
+ TBI_HIGHLIGHT,
+ mpToolBoxHighlight.get(),
+ TBX_UPDATER_MODE_CHAR_COLOR_NEW));
+
+ //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);
+
+// add
+ long aSizeBoxHeight = maFontSizeBox.GetSizePixel().getHeight();;
+ Point aPosFontSize = maFontSizeBox.GetPosPixel();
+ long aPosY = aPosFontSize.getY();
+ Point pTBIncDec = mpToolBoxIncDec->GetPosPixel();
+ long aIncDecHeight = mpToolBoxIncDec->GetSizePixel().getHeight();
+ pTBIncDec.setY(aPosY+aSizeBoxHeight/2-aIncDecHeight/2);
+ mpToolBoxIncDec->SetPosPixel(pTBIncDec);
+ //end
+}
+
+
+
+
+void TextPropertyPanel::InitToolBoxFont()
+{
+ mpToolBoxFont->SetQuickHelpText(TBI_BOLD,String(SVX_RES(STR_QH_BOLD))); //Add
+ mpToolBoxFont->SetQuickHelpText(TBI_ITALIC,String(SVX_RES(STR_QH_ITALIC))); //Add
+ mpToolBoxFont->SetQuickHelpText(TBI_UNDERLINE,String(SVX_RES(STR_QH_UNDERLINE))); //Add
+ mpToolBoxFont->SetBackground(Wallpaper());
+ mpToolBoxFont->SetPaintTransparent(true);
+
+ Size aTbxSize( mpToolBoxFont->CalcWindowSizePixel() );
+ mpToolBoxFont->SetOutputSizePixel( aTbxSize );
+
+ Link aLink = LINK(this, TextPropertyPanel, ToolboxFontSelectHandler);
+ mpToolBoxFont->SetSelectHdl ( aLink );
+ aLink = LINK(this, TextPropertyPanel, ToolBoxUnderlineClickHdl);
+ mpToolBoxFont->SetDropdownClickHdl(aLink);
+}
+
+
+
+
+void TextPropertyPanel::InitToolBoxIncDec()
+{
+ Size aTbxSize( mpToolBoxIncDec->CalcWindowSizePixel() );
+ mpToolBoxIncDec->SetOutputSizePixel( aTbxSize );
+
+ Link aLink = LINK(this, TextPropertyPanel, ToolboxIncDecSelectHdl);
+ mpToolBoxIncDec->SetSelectHdl ( aLink );
+}
+
+
+
+
+void TextPropertyPanel::InitToolBoxFontColor()
+{
+ Size aTbxSize( mpToolBoxFontColor->CalcWindowSizePixel() );
+ mpToolBoxFontColor->SetOutputSizePixel( aTbxSize );
+ mpToolBoxFontColor->SetItemBits( TBI_FONTCOLOR, mpToolBoxFontColor->GetItemBits( TBI_FONTCOLOR ) | TIB_DROPDOWNONLY );
+ mpToolBoxFontColor->SetBackground(Wallpaper());
+ mpToolBoxFontColor->SetPaintTransparent(true);
+
+ Link aLink = LINK(this, TextPropertyPanel, ToolBoxFontColorDropHdl);
+ mpToolBoxFontColor->SetDropdownClickHdl ( aLink );
+ mpToolBoxFontColor->SetSelectHdl ( aLink );
+
+}
+void TextPropertyPanel::InitToolBoxScript()
+{
+ Size aTbxSize( mpToolBoxScriptSw->CalcWindowSizePixel() );
+ mpToolBoxScriptSw->SetOutputSizePixel( aTbxSize );
+ mpToolBoxScriptSw->SetBackground(Wallpaper());
+ mpToolBoxScriptSw->SetPaintTransparent(true);
+
+ Link aLink = LINK(this, TextPropertyPanel, ToolBoxSwScriptSelectHdl);
+ mpToolBoxScriptSw->SetSelectHdl ( aLink );
+
+ aTbxSize = mpToolBoxScript->CalcWindowSizePixel() ;
+ mpToolBoxScript->SetOutputSizePixel( aTbxSize );
+ mpToolBoxScript->SetBackground(Wallpaper());
+ mpToolBoxScript->SetPaintTransparent(true);
+
+ aLink = LINK(this, TextPropertyPanel, ToolBoxScriptSelectHdl);
+ mpToolBoxScript->SetSelectHdl ( aLink );
+}
+void TextPropertyPanel::InitToolBoxSpacing()
+{
+ Size aTbxSize( mpToolBoxSpacing->CalcWindowSizePixel() );
+ mpToolBoxSpacing->SetOutputSizePixel( aTbxSize );
+ mpToolBoxSpacing->SetItemBits( TBI_SPACING, mpToolBoxSpacing->GetItemBits( TBI_SPACING ) | TIB_DROPDOWNONLY );
+ mpToolBoxSpacing->SetBackground(Wallpaper());
+ mpToolBoxSpacing->SetPaintTransparent(true);
+
+ Link aLink = LINK(this, TextPropertyPanel, SpacingClickHdl);
+ mpToolBoxSpacing->SetDropdownClickHdl ( aLink );
+ mpToolBoxSpacing->SetSelectHdl( aLink );
+}
+void TextPropertyPanel::InitToolBoxHighlight()
+{
+ Size aTbxSize( mpToolBoxHighlight->CalcWindowSizePixel() );
+ mpToolBoxHighlight->SetOutputSizePixel( aTbxSize );
+ mpToolBoxHighlight->SetItemBits( TBI_HIGHLIGHT, mpToolBoxHighlight->GetItemBits( TBI_HIGHLIGHT ) | TIB_DROPDOWNONLY );
+ mpToolBoxHighlight->SetBackground(Wallpaper());
+ mpToolBoxHighlight->SetPaintTransparent(true);
+
+ Link aLink = LINK(this, TextPropertyPanel, ToolBoxHighlightDropHdl);
+ mpToolBoxHighlight->SetDropdownClickHdl ( aLink );
+ mpToolBoxHighlight->SetSelectHdl( aLink );
+}
+
+
+
+
+void TextPropertyPanel::SetupIcons (void)
+{
+ if (Theme::GetBoolean(Theme::Bool_UseSymphonyIcons))
+ {
+ mpToolBoxIncDec->SetItemImage(TBI_INCREASE, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgIncreaseHigh : maImgIncrease);
+ mpToolBoxIncDec->SetItemImage(TBI_DECREASE, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgDecreaseHigh : maImgDecrease);
+ mpToolBoxFont->SetItemImage(TBI_BOLD, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgBoldHigh : maImgBold);
+ mpToolBoxFont->SetItemImage(TBI_ITALIC, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgItalicHigh : maImgItalic);
+ mpToolBoxFont->SetItemImage(TBI_UNDERLINE, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgUnderlineHigh : maImgUnderline);
+ mpToolBoxFont->SetItemImage(TBI_STRIKEOUT, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgStrikeHigh : maImgStrike);
+ mpToolBoxFont->SetItemImage(TBI_SHADOWED, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgShadowHigh : maImgShadow);
+
+ mpToolBoxFontColor->SetItemImage(TBI_FONTCOLOR, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgFontColorHigh : maImgFontColor);
+ //for sw
+ mpToolBoxScriptSw->SetItemImage(TBI_SUPER_SW, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgSupScriptHigh : maImgSupScript);
+ mpToolBoxScriptSw->SetItemImage(TBI_SUB_SW, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgSubScriptHigh : maImgSubScript);
+ //for sc and sd
+ mpToolBoxScript->SetItemImage(TBI_SUPER, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgSupScriptHigh : maImgSupScript);
+ mpToolBoxScript->SetItemImage(TBI_SUB, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgSubScriptHigh : maImgSubScript);
+ mpToolBoxSpacing->SetItemImage(TBI_SPACING, maImgNormalIcon);
+ mpToolBoxHighlight->SetItemImage(TBI_HIGHLIGHT, Application::GetSettings().GetStyleSettings().GetHighContrastMode()? maImgHighlightHigh : maImgHighlight);
+ }
+ else
+ {
+ mpToolBoxIncDec->SetItemImage(TBI_INCREASE, GetIcon(A2S(".uno:Grow")));
+ mpToolBoxIncDec->SetItemImage(TBI_DECREASE, GetIcon(A2S(".uno:Shrink")));
+ mpToolBoxFont->SetItemImage(TBI_BOLD, GetIcon(A2S(".uno:Bold")));
+ mpToolBoxFont->SetItemImage(TBI_ITALIC, GetIcon(A2S(".uno:Italic")));
+ mpToolBoxFont->SetItemImage(TBI_UNDERLINE, GetIcon(A2S(".uno:Underline")));
+ mpToolBoxFont->SetItemImage(TBI_STRIKEOUT, GetIcon(A2S(".uno:Strikeout")));
+ mpToolBoxFont->SetItemImage(TBI_SHADOWED, GetIcon(A2S(".uno:Shadowed")));
+
+ mpToolBoxFontColor->SetItemImage(TBI_FONTCOLOR, GetIcon(A2S(".uno:FontColor")));
+ //for sw
+ mpToolBoxScriptSw->SetItemImage(TBI_SUPER_SW, GetIcon(A2S(".uno:SuperScript")));
+ mpToolBoxScriptSw->SetItemImage(TBI_SUB_SW, GetIcon(A2S(".uno:SubScript")));
+ //for sc and sd
+ mpToolBoxScript->SetItemImage(TBI_SUPER, GetIcon(A2S(".uno:SuperScript")));
+ mpToolBoxScript->SetItemImage(TBI_SUB, GetIcon(A2S(".uno:SubScript")));
+ mpToolBoxSpacing->SetItemImage(TBI_SPACING, GetIcon(A2S(".uno:FontworkCharacterSpacingFloater")));
+ mpToolBoxHighlight->SetItemImage(TBI_HIGHLIGHT, GetIcon(A2S(".uno:BackColor")));
+ }
+}
+
+
+
+
+IMPL_LINK( TextPropertyPanel, FontSelHdl, FontNameBox*, pBox )
+{
+ if ( !pBox->IsTravelSelect() )
+ {
+ if( SfxViewShell::Current() )
+ {
+ Window* pShellWnd = SfxViewShell::Current()->GetWindow();
+
+ if ( pShellWnd )
+ pShellWnd->GrabFocus();
+ }
+ }
+ return 0;
+}
+//add end
+IMPL_LINK( TextPropertyPanel, FontSizeModifyHdl, FontSizeBox*, pSizeBox )
+{
+ if (pSizeBox == &maFontSizeBox)
+ {
+ long nSize = pSizeBox->GetValue();
+ mbFocusOnFontSizeCtrl = true;
+
+ float fSize = (float)nSize / 10;
+ SfxMapUnit eUnit = maFontSizeControl.GetCoreMetric();
+ SvxFontHeightItem aItem( CalcToUnit( fSize, eUnit ), 100, SID_ATTR_CHAR_FONTHEIGHT ) ;
+
+ mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_FONTHEIGHT, SFX_CALLMODE_RECORD, &aItem, 0L );
+ mpBindings->Invalidate(SID_ATTR_CHAR_FONTHEIGHT,true,false);
+ }
+ return 0;
+}
+//add
+IMPL_LINK( TextPropertyPanel, FontSizeSelHdl, FontSizeBox*, pSizeBox )
+{
+ if ( !pSizeBox->IsTravelSelect() )
+ {
+ if( SfxViewShell::Current() )
+ {
+ Window* pShellWnd = SfxViewShell::Current()->GetWindow();
+
+ if ( pShellWnd )
+ pShellWnd->GrabFocus();
+ }
+ }
+
+ return 0;
+}
+//add end
+IMPL_LINK(TextPropertyPanel, FontSizeLoseFocus, FontSizeBox*, pSizeBox)
+{
+ if(pSizeBox == &maFontSizeBox)
+ {
+ mbFocusOnFontSizeCtrl = false;
+ }
+ return 0;
+}
+
+IMPL_LINK(TextPropertyPanel, ToolboxFontSelectHandler, ToolBox*, pToolBox)
+{
+ const sal_uInt16 nId = pToolBox->GetCurItemId();
+
+ //Bold
+ if(nId == TBI_BOLD)
+ {
+ EndTracking();
+ if(meWeight != WEIGHT_BOLD)
+ meWeight = WEIGHT_BOLD;
+ else
+ meWeight = WEIGHT_NORMAL;
+ SvxWeightItem aWeightItem(meWeight, SID_ATTR_CHAR_WEIGHT);
+ mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_WEIGHT, SFX_CALLMODE_RECORD, &aWeightItem, 0L);
+ UpdateFontBold();
+ }
+ //Italic
+ else if(nId == TBI_ITALIC)
+ {
+ EndTracking();
+ if(meItalic != ITALIC_NORMAL)
+ meItalic = ITALIC_NORMAL;
+ else
+ meItalic = ITALIC_NONE;
+ SvxPostureItem aPostureItem(meItalic, SID_ATTR_CHAR_POSTURE);
+ mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_POSTURE, SFX_CALLMODE_RECORD, &aPostureItem, 0L);
+ UpdateFontItalic();
+ }
+ //underline
+ else if(nId == TBI_UNDERLINE)
+ {
+ EndTracking();
+ //add , keep underline's color
+ if(meUnderline == UNDERLINE_NONE)
+ {
+ meUnderline = GetDefaultUnderline();
+ //<<modify
+ //SvxTextLineItem aLineItem(meUnderline, SID_ATTR_CHAR_UNDERLINE);
+ SvxUnderlineItem aLineItem(meUnderline, SID_ATTR_CHAR_UNDERLINE);
+ //modify end>>
+ aLineItem.SetColor(meUnderlineColor);
+ mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_UNDERLINE, SFX_CALLMODE_RECORD, &aLineItem, 0L);
+ }
+ else
+ {
+ meUnderline = UNDERLINE_NONE;
+ //<<modify
+ //SvxTextLineItem aLineItem(meUnderline, SID_ATTR_CHAR_UNDERLINE);
+ SvxUnderlineItem aLineItem(meUnderline, SID_ATTR_CHAR_UNDERLINE);
+ //modify end>>
+ mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_UNDERLINE, SFX_CALLMODE_RECORD, &aLineItem, 0L);
+ }
+ UpdateFontUnderline();
+ //add end
+ }
+ //strike out
+ else if(nId == TBI_STRIKEOUT)
+ {
+ EndTracking();
+ if(meStrike != STRIKEOUT_NONE && meStrike != STRIKEOUT_DONTKNOW)
+ meStrike = STRIKEOUT_NONE;
+ else
+ meStrike = STRIKEOUT_SINGLE;
+ SvxCrossedOutItem aStrikeItem(meStrike,SID_ATTR_CHAR_STRIKEOUT);
+ mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_STRIKEOUT, SFX_CALLMODE_RECORD, &aStrikeItem, 0L);
+ UpdateFontStrikeOut();
+ }
+ //shadowed
+ else if(nId == TBI_SHADOWED)
+ {
+ EndTracking();
+ mbShadow = !mbShadow;
+ SvxShadowedItem aShadowItem(mbShadow, SID_ATTR_CHAR_SHADOWED);
+ mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_SHADOWED, SFX_CALLMODE_RECORD, &aShadowItem, 0L);
+ UpdateFontShadowed();
+ }
+ return 0;
+}
+
+
+
+
+IMPL_LINK(TextPropertyPanel, ToolboxIncDecSelectHdl, ToolBox*, pToolBox)
+{
+ const sal_uInt16 nId = pToolBox->GetCurItemId();
+
+ // font size +/- enhancement in sd
+ switch (maContext.GetCombinedContext())
+ {
+ case CombinedEnumContext(Application_Draw, Context_DrawText):
+ case CombinedEnumContext(Application_Draw, Context_Text):
+ case CombinedEnumContext(Application_Draw, Context_Table):
+ case CombinedEnumContext(Application_Draw, Context_OutlineText):
+ case CombinedEnumContext(Application_Draw, Context_Draw):
+ case CombinedEnumContext(Application_Draw, Context_TextObject):
+ case CombinedEnumContext(Application_Draw, Context_Graphic):
+ case CombinedEnumContext(Application_Impress, Context_DrawText):
+ case CombinedEnumContext(Application_Impress, Context_Text):
+ case CombinedEnumContext(Application_Impress, Context_Table):
+ case CombinedEnumContext(Application_Impress, Context_OutlineText):
+ case CombinedEnumContext(Application_Impress, Context_Draw):
+ case CombinedEnumContext(Application_Impress, Context_TextObject):
+ case CombinedEnumContext(Application_Impress, Context_Graphic):
+ if(nId == TBI_INCREASE)
+ {
+ EndTracking();
+ SfxVoidItem aItem(SID_GROW_FONT_SIZE);
+ mpBindings->GetDispatcher()->Execute( SID_GROW_FONT_SIZE, SFX_CALLMODE_RECORD, &aItem, 0L );
+ }
+ else if(nId == TBI_DECREASE)
+ {
+ EndTracking();
+ SfxVoidItem aItem(SID_SHRINK_FONT_SIZE);
+ mpBindings->GetDispatcher()->Execute( SID_SHRINK_FONT_SIZE, SFX_CALLMODE_RECORD, &aItem, 0L );
+ }
+ break;
+
+ default:
+ if(nId == TBI_INCREASE)
+ {
+ EndTracking();
+ mbFocusOnFontSizeCtrl = false;
+ sal_Int64 iValue = maFontSizeBox.GetValue();
+ int iPos = maFontSizeBox.GetValuePos(iValue, FUNIT_NONE);
+ long nSize = iValue;
+ if(iPos != LISTBOX_ENTRY_NOTFOUND)
+ nSize = maFontSizeBox.GetValue(iPos+1 , FUNIT_NONE);
+ else if(iValue >= 100 && iValue < 105)
+ nSize = 105;
+ else if(iValue >= 105 && iValue < 110)
+ nSize = 110;
+ else if(iValue < 960)
+ {
+ nSize = (nSize / 10) * 10 + 10;
+ while(maFontSizeBox.GetValuePos(nSize, FUNIT_NONE) == LISTBOX_ENTRY_NOTFOUND)
+ nSize += 10;
+ }
+ else
+ {
+ nSize = iValue;
+ }
+
+ float fSize = (float)nSize / 10;
+
+ SfxMapUnit eUnit = maFontSizeControl.GetCoreMetric();
+ SvxFontHeightItem aItem( CalcToUnit( fSize, eUnit ), 100, SID_ATTR_CHAR_FONTHEIGHT ) ;
+
+ mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_FONTHEIGHT, SFX_CALLMODE_RECORD, &aItem, 0L );
+ mpBindings->Invalidate(SID_ATTR_CHAR_FONTHEIGHT,true,false);
+ //add , update ASAP
+ maFontSizeBox.SetValue( nSize );
+ if(nSize >= 960)
+ {
+ mpToolBoxIncDec->EnableItem(TBI_INCREASE,false);
+ mpToolBoxIncDec->EnableItem(TBI_DECREASE,true);
+ }
+ else if(nSize <= 60)
+ {
+ mpToolBoxIncDec->EnableItem(TBI_INCREASE,true);
+ mpToolBoxIncDec->EnableItem(TBI_DECREASE,false);
+ }
+ else
+ {
+ mpToolBoxIncDec->EnableItem(TBI_INCREASE,true);
+ mpToolBoxIncDec->EnableItem(TBI_DECREASE,true);
+ }
+ //add end
+ }
+ else if(nId == TBI_DECREASE)
+ {
+ EndTracking();
+ mbFocusOnFontSizeCtrl = false;
+ sal_Int64 iValue = maFontSizeBox.GetValue();
+ int iPos = maFontSizeBox.GetValuePos(iValue, FUNIT_NONE);
+ long nSize = iValue;
+ if(iPos != LISTBOX_ENTRY_NOTFOUND)
+ nSize = maFontSizeBox.GetValue(iPos-1 , FUNIT_NONE);
+ else if(iValue > 100 && iValue <= 105)
+ nSize = 100;
+ else if(iValue > 105 && iValue <= 110)
+ nSize = 105;
+ else if(iValue > 960)
+ {
+ nSize = 960;
+ }
+ else if(iValue > 60)
+ {
+ nSize = (nSize / 10) * 10 ;
+ while(maFontSizeBox.GetValuePos(nSize, FUNIT_NONE) == LISTBOX_ENTRY_NOTFOUND)
+ nSize -= 10;
+ }
+ else
+ {
+ nSize = iValue;
+ }
+
+ float fSize = (float)nSize / 10;
+
+ SfxMapUnit eUnit = maFontSizeControl.GetCoreMetric();
+ SvxFontHeightItem aItem( CalcToUnit( fSize, eUnit ), 100, SID_ATTR_CHAR_FONTHEIGHT ) ;
+
+ mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_FONTHEIGHT, SFX_CALLMODE_RECORD, &aItem, 0L );
+ mpBindings->Invalidate(SID_ATTR_CHAR_FONTHEIGHT,true,false);
+ //add
+ maFontSizeBox.SetValue( nSize );
+ if(nSize >= 960)
+ {
+ mpToolBoxIncDec->EnableItem(TBI_INCREASE,false);
+ mpToolBoxIncDec->EnableItem(TBI_DECREASE,true);
+ }
+ else if(nSize <= 60)
+ {
+ mpToolBoxIncDec->EnableItem(TBI_INCREASE,true);
+ mpToolBoxIncDec->EnableItem(TBI_DECREASE,false);
+ }
+ else
+ {
+ mpToolBoxIncDec->EnableItem(TBI_INCREASE,true);
+ mpToolBoxIncDec->EnableItem(TBI_DECREASE,true);
+ }
+ //add end
+ }
+ }
+ return 0;
+}
+
+
+
+
+IMPL_LINK(TextPropertyPanel, ToolBoxUnderlineClickHdl, ToolBox*, pToolBox)
+{
+ const sal_uInt16 nId = pToolBox->GetCurItemId();
+ if(nId == TBI_UNDERLINE)
+ {
+ pToolBox->SetItemDown( nId, true );
+
+ /**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;
+}
+
+
+
+
+IMPL_LINK(TextPropertyPanel, ToolBoxFontColorDropHdl,ToolBox*, pToolBox)
+{
+ const sal_uInt16 nId = pToolBox->GetCurItemId();
+ if(nId == TBI_FONTCOLOR)
+ {
+ meColorType = FONT_COLOR;
+
+ 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);
+ */
+ }
+ return 0;
+}
+
+
+
+
+IMPL_LINK(TextPropertyPanel, ToolBoxSwScriptSelectHdl, ToolBox*, pToolBox)
+{
+ const sal_uInt16 nId = pToolBox->GetCurItemId();
+ if( nId == TBI_SUPER_SW )
+ {
+ if(meEscape != SVX_ESCAPEMENT_SUPERSCRIPT)
+ {
+ meEscape = SVX_ESCAPEMENT_SUPERSCRIPT;
+ SvxEscapementItem aSupItem(DFLT_ESC_SUPER, DFLT_ESC_PROP, SID_ATTR_CHAR_ESCAPEMENT);
+ mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_ESCAPEMENT, SFX_CALLMODE_RECORD, &aSupItem, 0L );
+ }
+ else
+ {
+ meEscape = SVX_ESCAPEMENT_OFF;
+ SvxEscapementItem aNoneItem(0, 100, SID_ATTR_CHAR_ESCAPEMENT);
+ mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_ESCAPEMENT, SFX_CALLMODE_RECORD, &aNoneItem, 0L );
+ }
+ }
+ else if(TBI_SUB_SW == nId)
+ {
+ if(meEscape != SVX_ESCAPEMENT_SUBSCRIPT)
+ {
+ meEscape = (SvxEscapement)SVX_ESCAPEMENT_SUBSCRIPT;
+ SvxEscapementItem aSubItem(DFLT_ESC_SUB, DFLT_ESC_PROP, SID_ATTR_CHAR_ESCAPEMENT);
+ mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_ESCAPEMENT, SFX_CALLMODE_RECORD, &aSubItem, 0L );
+ }
+ else
+ {
+ meEscape = SVX_ESCAPEMENT_OFF;
+ SvxEscapementItem aNoneItem(0, 100, SID_ATTR_CHAR_ESCAPEMENT);
+ mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_ESCAPEMENT, SFX_CALLMODE_RECORD, &aNoneItem, 0L );
+ }
+ }
+ UpdateFontScript();
+
+ return 0;
+}
+
+
+
+
+IMPL_LINK(TextPropertyPanel, ToolBoxScriptSelectHdl, ToolBox*, pToolBox)
+{
+ const sal_uInt16 nId = pToolBox->GetCurItemId();
+ if( nId == TBI_SUPER )
+ {
+ mbSuper = !mbSuper;
+ SfxBoolItem aSupItem(SID_SET_SUPER_SCRIPT, mbSuper);
+ mpBindings->GetDispatcher()->Execute( SID_SET_SUPER_SCRIPT, SFX_CALLMODE_RECORD, &aSupItem, 0L );
+ }
+ else if(TBI_SUB == nId)
+ {
+
+ mbSub = !mbSub;
+ SfxBoolItem aSubItem(SID_SET_SUB_SCRIPT, mbSub );
+ mpBindings->GetDispatcher()->Execute( SID_SET_SUB_SCRIPT, SFX_CALLMODE_RECORD, &aSubItem, 0L );
+ }
+ UpdateFontScript();
+ return 0;
+}
+
+
+
+
+IMPL_LINK(TextPropertyPanel, ToolBoxHighlightDropHdl, ToolBox*, pToolBox)
+{
+ const sal_uInt16 nId = pToolBox->GetCurItemId();
+ if(nId == TBI_HIGHLIGHT)
+ {
+ meColorType = BACK_COLOR;
+
+ pToolBox->SetItemDown( nId, true );
+
+ /*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();
+ if(nId == TBI_SPACING)
+ {
+ pToolBox->SetItemDown( nId, true );
+
+ /*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;
+}
+
+
+
+
+IMPL_LINK( TextPropertyPanel, ImplPopupModeEndHdl, FloatingWindow*, EMPTYARG )
+{
+ return 0;
+}
+
+
+
+
+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;
+}
+
+
+
+
+void TextPropertyPanel::NotifyItemUpdate (
+ const sal_uInt16 nSID,
+ const SfxItemState eState,
+ const SfxPoolItem* pState)
+{
+ switch(nSID)
+ {
+ case SID_ATTR_CHAR_FONT:
+ if ( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxFontItem) )
+ {
+ mpFontNameBox->Enable();
+ const SvxFontItem* pFontItem = (const SvxFontItem*)pState;
+ mpFontNameBox->SetText( pFontItem->GetFamilyName() );
+ }
+ else
+ {
+ mpFontNameBox->SetText( String() );
+ if (SFX_ITEM_DISABLED == eState)
+ {
+ mpFontNameBox->Disable();
+ }
+ }
+ break;
+ case SID_ATTR_CHAR_FONTHEIGHT:
+ if ( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxFontHeightItem) )
+ {
+ mpHeightItem = (SvxFontHeightItem*)pState;//const SvxFontHeightItem*
+ SfxMapUnit eUnit = maFontSizeControl.GetCoreMetric();
+ long iValue = (long)CalcToPoint( mpHeightItem->GetHeight(), eUnit, 10 );
+ mpToolBoxIncDec->Enable();
+
+ // font size +/- enhancement in sd
+ switch(maContext.GetCombinedContext())
+ {
+ case CombinedEnumContext(Application_Draw, Context_DrawText):
+ case CombinedEnumContext(Application_Draw, Context_Text):
+ case CombinedEnumContext(Application_Draw, Context_Table):
+ case CombinedEnumContext(Application_Draw, Context_OutlineText):
+ case CombinedEnumContext(Application_Draw, Context_Draw):
+ case CombinedEnumContext(Application_Draw, Context_TextObject):
+ case CombinedEnumContext(Application_Draw, Context_Graphic):
+ case CombinedEnumContext(Application_Impress, Context_DrawText):
+ case CombinedEnumContext(Application_Impress, Context_Text):
+ case CombinedEnumContext(Application_Impress, Context_Table):
+ case CombinedEnumContext(Application_Impress, Context_OutlineText):
+ case CombinedEnumContext(Application_Impress, Context_Draw):
+ case CombinedEnumContext(Application_Impress, Context_TextObject):
+ case CombinedEnumContext(Application_Impress, Context_Graphic):
+ break;
+
+ default:
+ if(iValue > 60 && iValue < 960 )
+ {
+ mpToolBoxIncDec->EnableItem(TBI_INCREASE,true);
+ mpToolBoxIncDec->EnableItem(TBI_DECREASE,true);
+ }
+ else if (iValue <= 60)
+ {
+ mpToolBoxIncDec->EnableItem(TBI_INCREASE,true);
+ mpToolBoxIncDec->EnableItem(TBI_DECREASE,false);
+ }
+ else if (iValue >= 960)
+ {
+ mpToolBoxIncDec->EnableItem(TBI_INCREASE,false);
+ mpToolBoxIncDec->EnableItem(TBI_DECREASE,true);
+ }
+ }
+ mpToolBoxIncDec->SetItemState(TBI_INCREASE, STATE_NOCHECK);
+ mpToolBoxIncDec->SetItemState(TBI_DECREASE, STATE_NOCHECK);
+
+ if( mbFocusOnFontSizeCtrl )
+ return;
+
+ maFontSizeBox.Enable( );
+ maFontSizeBox.SetValue( iValue );
+ maFontSizeBox.LoseFocus();
+ }
+ else
+ {
+ mpHeightItem = NULL;
+ maFontSizeBox.SetText( String() );
+ //increase decrease diabled when multi-seletion have different font size
+
+ // font size +/- enhancement in sd
+ switch(maContext.GetCombinedContext())
+ {
+ case CombinedEnumContext(Application_Draw, Context_DrawText):
+ case CombinedEnumContext(Application_Draw, Context_Text):
+ case CombinedEnumContext(Application_Draw, Context_Table):
+ case CombinedEnumContext(Application_Draw, Context_OutlineText):
+ case CombinedEnumContext(Application_Draw, Context_Draw):
+ case CombinedEnumContext(Application_Draw, Context_TextObject):
+ case CombinedEnumContext(Application_Draw, Context_Graphic):
+ case CombinedEnumContext(Application_Impress, Context_DrawText):
+ case CombinedEnumContext(Application_Impress, Context_Text):
+ case CombinedEnumContext(Application_Impress, Context_Table):
+ case CombinedEnumContext(Application_Impress, Context_OutlineText):
+ case CombinedEnumContext(Application_Impress, Context_Draw):
+ case CombinedEnumContext(Application_Impress, Context_TextObject):
+ case CombinedEnumContext(Application_Impress, Context_Graphic):
+ break;
+
+ default:
+ mpToolBoxIncDec->Disable();
+ }
+ if ( eState <= SFX_ITEM_READONLY )
+ {
+ maFontSizeBox.Disable( );
+ }
+ }
+ break;
+ case SID_ATTR_CHAR_WEIGHT:
+ mbWeightAvailable = (eState >= SFX_ITEM_DONTCARE);
+ if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxWeightItem))
+ {
+ const SvxWeightItem* pItem = (const SvxWeightItem*)pState;
+ meWeight = (FontWeight)pItem->GetValue();
+ TextStyleChanged();
+ }
+ else
+ {
+ meWeight = WEIGHT_NORMAL;
+ TextStyleChanged();
+ }
+ break;
+ case SID_ATTR_CHAR_POSTURE:
+ mbPostureAvailable = (eState >= SFX_ITEM_DONTCARE);
+ if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxPostureItem))
+ {
+ const SvxPostureItem* pItem = (const SvxPostureItem*)pState;
+ meItalic = (FontItalic)pItem->GetValue();
+ TextStyleChanged();
+ }
+ else
+ {
+ meItalic = ITALIC_NONE;
+ TextStyleChanged();
+ }
+ break;
+ case SID_ATTR_CHAR_UNDERLINE:
+ if( eState >= SFX_ITEM_DEFAULT) //SvxUnderlineItem
+ {
+ //<<delete
+ //if(pState->ISA(SvxTextLineItem))
+ //{
+ // const SvxTextLineItem* pItem = (const SvxTextLineItem*)pState;
+ // meUnderline = (FontUnderline)pItem->GetValue();
+ // //add , need to record the underline's color, if not the color will turn to auto
+ // meUnderlineColor = pItem->GetColor();
+ // //add end
+ //}
+ //else
+ //delete end>>
+ if(pState->ISA(SvxUnderlineItem))
+ {
+ const SvxUnderlineItem* pItem = (const SvxUnderlineItem*)pState;
+ meUnderline = (FontUnderline)pItem->GetValue();
+ //add
+ meUnderlineColor = pItem->GetColor();
+ //add end
+ }
+ TextStyleChanged();
+ }
+ else
+ {
+ meUnderline = UNDERLINE_NONE;
+ TextStyleChanged();
+ }
+ break;
+ case SID_ATTR_CHAR_SHADOWED:
+ if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxShadowedItem))
+ {
+ const SvxShadowedItem* pItem = (const SvxShadowedItem*)pState;
+ mbShadow = pItem->GetValue();
+ TextStyleChanged();
+ }
+ else
+ {
+ mbShadow = false;
+ TextStyleChanged();
+ }
+ break;
+ case SID_ATTR_CHAR_STRIKEOUT:
+ if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxCrossedOutItem))
+ {
+ const SvxCrossedOutItem* pItem = (const SvxCrossedOutItem*)pState;
+ meStrike = (FontStrikeout)pItem->GetValue();
+
+ TextStyleChanged();
+ }
+ else
+ {
+ meStrike = STRIKEOUT_NONE;
+ TextStyleChanged();
+ }
+ break;
+ case SID_ATTR_CHAR_COLOR:
+ if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxColorItem))
+ {
+ const SvxBrushItem* pItem = (const SvxBrushItem*)pState;
+ maColor = pItem->GetColor();
+ mbColorAvailable = true;
+ mpFontColorUpdater->Update(maColor);
+ }
+ else
+ {
+ mbColorAvailable = false;
+ maColor.SetColor(COL_AUTO);
+ mpFontColorUpdater->Update(maColor);
+ }
+ break;
+ case SID_ATTR_BRUSH_CHAR:
+ if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxBrushItem))
+ {
+ const SvxBrushItem* pItem = (const SvxBrushItem*)pState;
+ maBackColor = pItem->GetColor();
+ mbBackColorAvailable = true;
+ mpHighlightUpdater->Update(maBackColor);
+ }
+ else
+ {
+ mbBackColorAvailable = false;
+ maBackColor.SetColor(COL_AUTO);
+ mpHighlightUpdater->Update(maBackColor);
+ }
+ break;
+ case SID_ATTR_CHAR_ESCAPEMENT:
+ if( eState == SFX_ITEM_AVAILABLE)
+ {
+ if( pState->ISA(SvxEscapementItem))
+ {
+ const SvxEscapementItem* pItem = (const SvxEscapementItem *)pState;
+ short nEsc = pItem->GetEsc();
+ if(nEsc == 0)
+ meEscape = SVX_ESCAPEMENT_OFF;
+ else if(nEsc > 0)
+ meEscape = SVX_ESCAPEMENT_SUPERSCRIPT;
+ else
+ meEscape = SVX_ESCAPEMENT_SUBSCRIPT;
+ }
+ else
+ {
+ meEscape = SVX_ESCAPEMENT_OFF;
+ }
+ TextStyleChanged();
+ }
+ else if(eState == SFX_ITEM_DISABLED)
+ {
+ mpToolBoxScriptSw->EnableItem(TBI_SUPER,false);
+ mpToolBoxScriptSw->EnableItem(TBI_SUB,false);
+ }
+ else
+ {
+ meEscape = SVX_ESCAPEMENT_OFF;
+ TextStyleChanged();
+ }
+ break;
+ case SID_SET_SUB_SCRIPT:
+ if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SfxBoolItem))
+ {
+ const SfxBoolItem* pItem = (const SfxBoolItem*)pState;
+ mbSub = pItem->GetValue();
+ TextStyleChanged();
+ }
+ else
+ {
+ mbSub = false;
+ TextStyleChanged();
+ }
+ break;
+ case SID_SET_SUPER_SCRIPT:
+ if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SfxBoolItem))
+ {
+ const SfxBoolItem* pItem = (const SfxBoolItem*)pState;
+ mbSuper = pItem->GetValue();
+ TextStyleChanged();
+ }
+ else
+ {
+ mbSuper = false;
+ TextStyleChanged();
+ }
+ break;
+ case SID_ATTR_CHAR_KERNING:
+ if ( SFX_ITEM_AVAILABLE == eState )
+ {
+ mbKernLBAvailable = true;
+
+ if(pState->ISA(SvxKerningItem))
+ {
+ const SvxKerningItem* pKerningItem = (const SvxKerningItem*)pState;
+ mlKerning = (long)pKerningItem->GetValue();
+ mbKernAvailable = true;
+ }
+ else
+ {
+ mlKerning = 0;
+ mbKernAvailable =false;
+ }
+ }
+ else if (SFX_ITEM_DISABLED == eState)
+ {
+ mbKernLBAvailable = false;
+ mbKernAvailable = false;
+ mlKerning = 0;
+ }
+ else
+ {
+ mbKernLBAvailable = true;
+ mbKernAvailable = false;
+ mlKerning = 0;
+ }
+ break;
+
+ // font size +/- enhancement in sd
+ case SID_SHRINK_FONT_SIZE:
+ case SID_GROW_FONT_SIZE:
+ switch(maContext.GetCombinedContext())
+ {
+ case CombinedEnumContext(Application_Draw, Context_DrawText):
+ case CombinedEnumContext(Application_Draw, Context_Text):
+ case CombinedEnumContext(Application_Draw, Context_Table):
+ case CombinedEnumContext(Application_Draw, Context_OutlineText):
+ case CombinedEnumContext(Application_Draw, Context_Draw):
+ case CombinedEnumContext(Application_Draw, Context_TextObject):
+ case CombinedEnumContext(Application_Draw, Context_Graphic):
+ case CombinedEnumContext(Application_Impress, Context_DrawText):
+ case CombinedEnumContext(Application_Impress, Context_Text):
+ case CombinedEnumContext(Application_Impress, Context_Table):
+ case CombinedEnumContext(Application_Impress, Context_OutlineText):
+ case CombinedEnumContext(Application_Impress, Context_Draw):
+ case CombinedEnumContext(Application_Impress, Context_TextObject):
+ case CombinedEnumContext(Application_Impress, Context_Graphic):
+ if(eState == SFX_ITEM_DISABLED)
+ {
+ mpToolBoxIncDec->Disable();
+ }
+ else
+ {
+ mpToolBoxIncDec->Enable();
+ }
+ break;
+ }
+ break;
+ }
+}
+
+
+
+
+void TextPropertyPanel::TextStyleChanged()
+{
+ if( !mbWeightAvailable )
+ mpToolBoxFont->EnableItem(TBI_BOLD,false);
+ else
+ mpToolBoxFont->EnableItem(TBI_BOLD,true);
+
+ if(!mbPostureAvailable )
+ mpToolBoxFont->EnableItem(TBI_ITALIC,false);
+ else
+ mpToolBoxFont->EnableItem(TBI_ITALIC,true);
+
+ UpdateFontBold();
+ UpdateFontItalic();
+ UpdateFontUnderline();
+ UpdateFontStrikeOut();
+ UpdateFontShadowed();
+ UpdateFontScript();
+}
+
+
+
+
+void TextPropertyPanel::UpdateFontBold()
+{
+ if( meWeight == WEIGHT_BOLD )
+ {
+ mpToolBoxFont->SetItemState(TBI_BOLD, STATE_CHECK);
+ }
+ else
+ {
+ mpToolBoxFont->SetItemState(TBI_BOLD, STATE_NOCHECK);
+ }
+}
+void TextPropertyPanel::UpdateFontItalic()
+{
+ if(meItalic == ITALIC_NORMAL)
+ {
+ mpToolBoxFont->SetItemState(TBI_ITALIC, STATE_CHECK);
+ }
+ else
+ {
+ mpToolBoxFont->SetItemState(TBI_ITALIC, STATE_NOCHECK);
+ }
+}
+void TextPropertyPanel::UpdateFontUnderline()
+{
+ if(meUnderline == UNDERLINE_NONE)
+ {
+ mpToolBoxFont->SetItemState(TBI_UNDERLINE, STATE_NOCHECK);
+ }
+ else
+ {
+ mpToolBoxFont->SetItemState(TBI_UNDERLINE, STATE_CHECK);
+ }
+}
+void TextPropertyPanel::UpdateFontStrikeOut()
+{
+ if(meStrike != STRIKEOUT_NONE && meStrike != STRIKEOUT_DONTKNOW)
+ {
+ mpToolBoxFont->SetItemState(TBI_STRIKEOUT, STATE_CHECK);
+ }
+ else
+ {
+ mpToolBoxFont->SetItemState(TBI_STRIKEOUT, STATE_NOCHECK);
+ }
+}
+void TextPropertyPanel::UpdateFontShadowed()
+{
+ if(mbShadow)
+ {
+ mpToolBoxFont->SetItemState(TBI_SHADOWED, STATE_CHECK);
+ }
+ else
+ {
+ mpToolBoxFont->SetItemState(TBI_SHADOWED, STATE_NOCHECK);
+ }
+}
+void TextPropertyPanel::UpdateFontScript()
+{
+ //script for sw
+ mpToolBoxScriptSw->EnableItem(TBI_SUPER,true);
+ mpToolBoxScriptSw->EnableItem(TBI_SUB,true);
+ if(meEscape == SVX_ESCAPEMENT_SUPERSCRIPT)
+ {
+ mpToolBoxScriptSw->SetItemState(TBI_SUPER_SW, STATE_CHECK);
+ mpToolBoxScriptSw->SetItemState(TBI_SUB_SW, STATE_NOCHECK);
+ }
+ else if(meEscape == SVX_ESCAPEMENT_SUBSCRIPT)
+ {
+ mpToolBoxScriptSw->SetItemState(TBI_SUPER_SW, STATE_NOCHECK);
+ mpToolBoxScriptSw->SetItemState(TBI_SUB_SW, STATE_CHECK);
+ }
+ else
+ {
+ mpToolBoxScriptSw->SetItemState(TBI_SUPER_SW, STATE_NOCHECK);
+ mpToolBoxScriptSw->SetItemState(TBI_SUB_SW, STATE_NOCHECK);
+ }
+
+ //script for sc sd
+ mpToolBoxScript->EnableItem(TBI_SUPER,true);
+ mpToolBoxScript->EnableItem(TBI_SUB,true);
+ if(mbSuper)
+ {
+ mpToolBoxScript->SetItemState(TBI_SUPER, STATE_CHECK);
+ mpToolBoxScript->SetItemState(TBI_SUB, STATE_NOCHECK);
+ }
+ else if(mbSub)
+ {
+ mpToolBoxScript->SetItemState(TBI_SUPER, STATE_NOCHECK);
+ mpToolBoxScript->SetItemState(TBI_SUB, STATE_CHECK);
+ }
+ else
+ {
+ mpToolBoxScript->SetItemState(TBI_SUPER, STATE_NOCHECK);
+ mpToolBoxScript->SetItemState(TBI_SUB, STATE_NOCHECK);
+ }
+}
+
+/*
+USHORT TextPropertyPanel::GetCurrColorType()
+{
+ return meColorType;
+}
+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()
+{
+ return maSpacingControl;
+}
+
+//add
+Color& TextPropertyPanel::GetUnderlineColor()
+{
+ return meUnderlineColor;
+}
+//add end
+void TextPropertyPanel::SetBackColor(Color aCol)
+{
+ maBackColor = aCol;
+}
+void TextPropertyPanel::SetColor(Color aCol)
+{
+ maColor = aCol;
+}
+void TextPropertyPanel::SetUnderline(FontUnderline eUnderline)
+{
+ meUnderline = eUnderline;
+}
+void TextPropertyPanel::SetSpacing(long nKern)
+{
+ mlKerning = nKern;
+}
+*/
+} } // end of namespace svx::sidebar
Added: 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=1436260&view=auto
==============================================================================
--- openoffice/branches/sidebar/main/svx/source/sidebar/text/TextPropertyPanel.hrc (added)
+++ openoffice/branches/sidebar/main/svx/source/sidebar/text/TextPropertyPanel.hrc Mon Jan 21 10:29:03 2013
@@ -0,0 +1,227 @@
+/**************************************************************
+ *
+ * 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 "svx/dialogs.hrc"
+
+#define VS_SPACING_WIDTH 80
+#define CUSTOM_HEIGHT CBOX_HEIGHT + MBOX_HEIGHT + POPUPPANEL_MARGIN_LARGE * 3 + POPUPPANEL_MARGIN_SMALL * 2 + TEXT_HEIGHT * 2
+#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 FT_TEST 1
+#define CB_SBFONT_FONT 2
+#define MB_SBFONT_FONTSIZE 3
+#define TB_FONT 4
+#define TB_INCREASE_DECREASE 5
+#define TB_FONTCOLOR 6
+#define TB_SCRIPT_SW 7
+#define TB_HIGHLIGHT 8
+#define TB_SPACING 9
+#define TB_SCRIPT 10
+
+
+#define IMG_INCREASE 11
+#define IMG_INCREASE_H 12
+#define IMG_DECREASE 13
+#define IMG_DECREASE_H 14
+#define IMG_BOLD 15
+#define IMG_BOLD_H 16
+#define IMG_ITALIC 17
+#define IMG_ITALIC_H 18
+#define IMG_UNDERLINE 19
+#define IMG_UNDERLINE_H 20
+#define IMG_STRIKEOUT 21
+#define IMG_STRIKEOUT_H 22
+#define IMG_SHADOWED 23
+#define IMG_SHADOWED_H 24
+#define IMG_FONTCOLOR 25
+#define IMG_FONTCOLOR_H 26
+#define IMG_SUPSCRIPT 27
+#define IMG_SUPSCRIPT_H 28
+#define IMG_SUBSCRIPT 29
+#define IMG_SUBSCRIPT_H 30
+//#define IMG_SPACING 31
+//#define IMG_SPACING_H 32
+#define IMG_HIGHLIGHT 33
+#define IMG_HIGHLIGHT_H 34
+
+#define TBI_FONTCOLOR 50
+#define TBI_BOLD 51
+#define TBI_ITALIC 52
+#define TBI_UNDERLINE 53
+#define TBI_STRIKEOUT 54
+#define TBI_SHADOWED 55
+#define TBI_INCREASE 56
+#define TBI_DECREASE 57
+#define TBI_HIGHLIGHT 58
+#define TBI_SUPER 59
+#define TBI_SUB 60
+#define TBI_SUPER_SW 61
+#define TBI_SUB_SW 62
+#define TBI_SPACING 63
+
+#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 IMG_SINGLE 10
+#define IMG_DOUBLE 11
+#define IMG_BOLD2 12
+#define IMG_DOT 13
+#define IMG_DOT_BOLD 14
+#define IMG_DASH 15
+#define IMG_DASH_LONG 16
+#define IMG_DASH_DOT 17
+#define IMG_DASH_DOT_DOT 18
+#define IMG_WAVE 19
+
+#define STR_SINGLE 20
+#define STR_DOUBLE 21
+#define STR_BOLD 22
+#define STR_DOT 23
+#define STR_DOT_BOLD 24
+#define STR_DASH 25
+#define STR_DASH_LONG 26
+#define STR_DASH_DOT 27
+#define STR_DASH_DOT_DOT 28
+#define STR_WAVE 29
+
+#define IMG_SINGLE_H 30
+#define IMG_DOUBLE_H 31
+#define IMG_BOLD2_H 32
+#define IMG_DOT_H 33
+#define IMG_DOT_BOLD_H 34
+#define IMG_DASH_H 35
+#define IMG_DASH_LONG_H 36
+#define IMG_DASH_DOT_H 37
+#define IMG_DASH_DOT_DOT_H 38
+#define IMG_WAVE_H 39
+
+#define IMG_SINGLE_SEL 40
+#define IMG_DOUBLE_SEL 41
+#define IMG_BOLD2_SEL 42
+#define IMG_DOT_SEL 43
+#define IMG_DOT_BOLD_SEL 44
+#define IMG_DASH_SEL 45
+#define IMG_DASH_LONG_SEL 46
+#define IMG_DASH_DOT_SEL 47
+#define IMG_DASH_DOT_DOT_SEL 48
+#define IMG_WAVE_SEL 49
+
+//popup window font color
+#define VS_FONT_COLOR 1
+#define STR_AUTOMATICE 2
+
+//POPUP WINDOW OF SPACING
+#define VS_SPACING 1
+
+#define CT_BORDER 7
+#define LB_KERNING 8
+#define ED_KERNING 9
+
+#define FT_SPACING 18
+#define FT_BY 19
+#define FT_LASTCUSTOM 20
+
+#define IMG_NORMAL 31
+#define IMG_VERY_TIGHT 32
+#define IMG_TIGHT 33
+#define IMG_LOOSE 34
+#define IMG_VERY_LOOSE 35
+#define IMG_CUSTOM 36
+#define IMG_CUSTOM_GRAY 37
+
+#define IMG_NORMAL_S 51
+#define IMG_VERY_TIGHT_S 52
+#define IMG_TIGHT_S 53
+#define IMG_LOOSE_S 54
+#define IMG_VERY_LOOSE_S 55
+
+#define STR_VERY_TIGHT 61
+#define STR_TIGHT 62
+#define STR_NORMAL 63
+#define STR_LOOSE 64
+#define STR_VERY_LOOSE 65
+#define STR_CUSTOM 66
+
+#define STR_VERY_TIGHT_TIP 67
+#define STR_TIGHT_TIP 68
+#define STR_NORMAL_TIP 69
+#define STR_LOOSE_TIP 70
+#define STR_VERY_LOOSE_TIP 71
+
+#define STR_CUSTOM_C_TIP 72
+#define STR_CUSTOM_E_TIP 73
+#define STR_PT 74
+
+//help ids
+#define HID_COMBO_FONT_NAME "SVX_HID_COMBO_FONT_NAME"
+#define HID_METRIC_FONT_SIZE "SVX_HID_METRIC_FONT_SIZE"
+#define HID_TB_INCREASE_DECREASE "SVX_HID_TB_INCREASE_DECREASE"
+#define HID_TBI_INCREASE "SVX_HID_TBI_INCREASE"
+#define HID_TBI_DECREASE "SVX_HID_TBI_DECREASE"
+#define HID_TB_FONT "SVX_HID_TB_FONT"
+#define HID_TBI_FONT_BOLD "SVX_HID_TBI_FONT_BOLD"
+#define HID_TBI_FONT_ITALIC "SVX_HID_TBI_FONT_ITALIC"
+#define HID_TBI_FONT_UNDERLINE "SVX_HID_TBI_FONT_UNDERLINE"
+#define HID_TBI_FONT_STRIKEOUT "SVX_HID_TBI_FONT_STRIKEOUT"
+#define HID_TBI_FONT_SHADOWED "SVX_HID_TBI_FONT_SHADOWED"
+#define HID_TB_COLOR "SVX_HID_TB_COLOR"
+#define HID_TBI_COLOR "SVX_HID_TBI_COLOR"
+#define HID_TB_SCRIPT "SVX_HID_TB_SCRIPT"
+#define HID_TBI_SCRIPT_SUPER "SVX_HID_TBI_SCRIPT_SUPER"
+#define HID_TBI_SCRIPT_SUB "SVX_HID_TBI_SCRIPT_SUB"
+#define HID_TB_SCRIPT_SW "SVX_HID_TB_SCRIPT_SW"
+#define HID_TBI_SCRIPT_SW_SUPER "SVX_HID_TBI_SCRIPT_SW_SUPER"
+#define HID_TBI_SCRIPT_SW_SUB "SVX_HID_TBI_SCRIPT_SW_SUB"
+#define HID_TB_SPACING "SVX_HID_TB_SPACING"
+#define HID_TBI_SPACING "SVX_HID_TBI_SPACING"
+#define HID_TB_HIGHLIGHT "SVX_HID_TB_HIGHLIGHT"
+#define HID_TBI_HIGHLIGHT "SVX_HID_TBI_HIGHLIGHT"
+
+#define HID_UNDERLINE_VS "SVX_HID_UNDERLINE_VS"
+#define HID_UNDERLINE_BTN "SVX_HID_UNDERLINE_BTN"
+
+#define HID_COLOR_VS "SVX_HID_COLOR_VS"
+
+#define HID_SPACING_TB_VERY_LOOSE "SVX_HID_SPACING_TB_VERY_LOOSE"
+#define HID_SPACING_TBI_VERY_LOOSE "SVX_HID_SPACING_TBI_VERY_LOOSE"
+#define HID_SPACING_TB_LOOSE "SVX_HID_SPACING_TB_LOOSE"
+#define HID_SPACING_TBI_LOOSE "SVX_HID_SPACING_TBI_LOOSE"
+#define HID_SPACING_TB_NORMAL "SVX_HID_SPACING_TB_NORMAL"
+#define HID_SPACING_TBI_NORMAL "SVX_HID_SPACING_TBI_NORMAL"
+#define HID_SPACING_TB_TIGHT "SVX_HID_SPACING_TB_TIGHT"
+#define HID_SPACING_TBI_TIGHT "SVX_HID_SPACING_TBI_TIGHT"
+#define HID_SPACING_TB_VERY_TIGHT "SVX_HID_SPACING_TB_VERY_TIGHT"
+#define HID_SPACING_TBI_VERY_TIGHT "SVX_HID_SPACING_TBI_VERY_TIGHT"
+#define HID_SPACING_TB_CUSTOM "SVX_HID_SPACING_TB_CUSTOM"
+#define HID_SPACING_TBI_CUSTOM "SVX_HID_SPACING_TBI_CUSTOM"
+#define HID_SPACING_CB_KERN "SVX_HID_SPACING_CB_KERN"
+#define HID_SPACING_MB_KERN "SVX_HID_SPACING_MB_KERN"
Added: 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=1436260&view=auto
==============================================================================
--- openoffice/branches/sidebar/main/svx/source/sidebar/text/TextPropertyPanel.hxx (added)
+++ openoffice/branches/sidebar/main/svx/source/sidebar/text/TextPropertyPanel.hxx Mon Jan 21 10:29:03 2013
@@ -0,0 +1,242 @@
+/**************************************************************
+ *
+ * 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_TEXT_PROPERTY_PAGE_HXX
+#define SVX_SIDEBAR_TEXT_PROPERTY_PAGE_HXX
+
+#include <sfx2/sidebar/SidebarPanelBase.hxx>
+#include <sfx2/sidebar/ControllerItem.hxx>
+
+#include <svtools/ctrlbox.hxx>
+#include <vcl/toolbox.hxx>
+#include <svx/tbxcolorupdate.hxx>
+#include <editeng/svxenum.hxx>
+#include <editeng/fhgtitem.hxx>
+
+#include <com/sun/star/ui/XUIElement.hpp>
+
+#include <boost/scoped_ptr.hpp>
+
+
+namespace svx { namespace sidebar {
+
+class SvxSBFontNameBox;
+
+class TextPropertyPanel
+ : public ::sfx2::sidebar::SidebarPanelBase,
+ public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
+{
+public:
+ static cssu::Reference<css::ui::XUIElement> Create (
+ const ::rtl::OUString& rsResourceURL,
+ Window* pParent,
+ const cssu::Reference<css::frame::XFrame>& rxFrame,
+ SfxBindings* pBindings);
+
+ // SVX_DLLPUBLIC static SfxSectionPage* createSectionPage(Window* pParent, SfxPropertyPanel* pPanel, PropertySectionType nPageId);
+
+ virtual void Paint (const Rectangle &rRect);
+ virtual void DataChanged (const DataChangedEvent& rEvent);
+
+ // 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
+ {
+ FONT_COLOR = 1,
+ BACK_COLOR = 2
+ };
+
+protected:
+ virtual void HandleContextChange (
+ const ::sfx2::sidebar::EnumContext aContext);
+
+ virtual void NotifyItemUpdate(
+ const sal_uInt16 nSId,
+ const SfxItemState eState,
+ const SfxPoolItem* pState);
+
+private:
+ //ui controls
+ ::boost::scoped_ptr<SvxSBFontNameBox> mpFontNameBox;
+ FontSizeBox maFontSizeBox;
+ ::boost::scoped_ptr<ToolBox> mpToolBoxIncDec;
+ ::boost::scoped_ptr<ToolBox> mpToolBoxFont;
+ ::boost::scoped_ptr<ToolBox> mpToolBoxFontColor;
+ ::boost::scoped_ptr<ToolBox> mpToolBoxScript;
+ ::boost::scoped_ptr<ToolBox> mpToolBoxScriptSw;
+ ::boost::scoped_ptr<ToolBox> mpToolBoxSpacing;
+ ::boost::scoped_ptr<ToolBox> mpToolBoxHighlight;
+ ::boost::scoped_ptr<ToolboxButtonColorUpdater> mpFontColorUpdater;
+ ::boost::scoped_ptr<ToolboxButtonColorUpdater> mpHighlightUpdater;
+
+ //control items
+ ::sfx2::sidebar::ControllerItem maFontNameControl;
+ ::sfx2::sidebar::ControllerItem maFontSizeControl;
+ ::sfx2::sidebar::ControllerItem maWeightControl;
+ ::sfx2::sidebar::ControllerItem maItalicControl;
+ ::sfx2::sidebar::ControllerItem maUnderlineControl;
+ ::sfx2::sidebar::ControllerItem maStrikeControl;
+ ::sfx2::sidebar::ControllerItem maShadowControl;
+ ::sfx2::sidebar::ControllerItem maFontColorControl;
+ ::sfx2::sidebar::ControllerItem maScriptControlSw;
+ ::sfx2::sidebar::ControllerItem maSuperScriptControl;
+ ::sfx2::sidebar::ControllerItem maSubScriptControl;
+ ::sfx2::sidebar::ControllerItem maSpacingControl;
+ ::sfx2::sidebar::ControllerItem maHighlightControl;
+ ::sfx2::sidebar::ControllerItem maSDFontGrow;
+ ::sfx2::sidebar::ControllerItem maSDFontShrink;
+
+ //Images
+ Image maImgIncrease;
+ Image maImgDecrease;
+ Image maImgBold;
+ Image maImgItalic;
+ Image maImgUnderline;
+ Image maImgStrike;
+ Image maImgShadow;
+ Image maImgFontColor;
+ Image maImgSupScript;
+ Image maImgSubScript;
+ Image maImgHighlight;
+
+ Image maImgNormalIcon;
+
+ Image maImgIncreaseHigh;
+ Image maImgDecreaseHigh;
+ Image maImgBoldHigh;
+ Image maImgItalicHigh;
+ Image maImgUnderlineHigh;
+ Image maImgStrikeHigh;
+ Image maImgShadowHigh;
+ Image maImgFontColorHigh;
+ Image maImgSupScriptHigh;
+ Image maImgSubScriptHigh;
+// Image maImgSpacingHigh; //
+ Image maImgHighlightHigh;
+
+ FontWeight meWeight;
+ FontItalic meItalic;
+ FontUnderline meUnderline;
+ Color meUnderlineColor; //
+ bool mbShadow;
+ FontStrikeout meStrike;
+ bool mbWeightAvailable;
+ bool mbPostureAvailable;
+ Color maColor;
+ bool mbColorAvailable;
+ Color maBackColor;
+ bool mbBackColorAvailable;
+ ColorType meColorType;
+ SvxEscapement meEscape; //for sw
+ bool mbSuper;
+ bool mbSub;
+ bool mbKernAvailable;
+ bool mbKernLBAvailable;
+ long mlKerning;
+ SvxFontHeightItem* mpHeightItem;
+
+ const FontList* mpFontList;
+ bool mbMustDelete;
+ bool mbFocusOnFontSizeCtrl;
+
+ ::sfx2::sidebar::EnumContext maContext;
+ SfxBindings* mpBindings;
+
+ TextPropertyPanel (
+ const ::rtl::OUString& rsResourceURL,
+ Window* pParent,
+ const cssu::Reference<css::frame::XFrame>& rxFrame,
+ SfxBindings* pBindings);
+ virtual ~TextPropertyPanel (void);
+
+ void PaintRect(const ToolBox &rTB);
+ void Initialize (void);
+ void SetupIcons (void);
+ void InitToolBoxFont();
+ void InitToolBoxIncDec();
+ void InitToolBoxFontColor();
+ void InitToolBoxScript();
+ void InitToolBoxHighlight();
+ void InitToolBoxSpacing();
+
+ void UpdateFontBold();
+ void UpdateFontItalic();
+ void UpdateFontUnderline();
+ void UpdateFontStrikeOut();
+ 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();
+};
+
+} } // end of namespace ::svx::sidebar
+
+#endif