diff options
author | Oliver-Rainer Wittmann <orw@apache.org> | 2013-04-10 08:20:16 +0000 |
---|---|---|
committer | Oliver-Rainer Wittmann <orw@apache.org> | 2013-04-10 08:20:16 +0000 |
commit | 0a0a9b32aa5bf1ce2554ad37cbba3c7a105db2b5 (patch) | |
tree | f5c258d25d3719c8f719a944043b5220377e9f9c /svx/source/sidebar/text | |
parent | bcfee75544246db6788715d98efd6d33c12f933d (diff) |
121420: merge sidebar feature from branch into trunk
Notes
merged as: d50ce284c9674c45acd40d017cc44c260da722a2
Diffstat (limited to 'svx/source/sidebar/text')
-rw-r--r-- | svx/source/sidebar/text/SvxSBFontNameBox.cxx | 178 | ||||
-rw-r--r-- | svx/source/sidebar/text/SvxSBFontNameBox.hxx | 80 | ||||
-rw-r--r-- | svx/source/sidebar/text/TextCharacterSpacingControl.cxx | 468 | ||||
-rw-r--r-- | svx/source/sidebar/text/TextCharacterSpacingControl.hxx | 96 | ||||
-rw-r--r-- | svx/source/sidebar/text/TextCharacterSpacingPopup.cxx | 79 | ||||
-rw-r--r-- | svx/source/sidebar/text/TextCharacterSpacingPopup.hxx | 48 | ||||
-rw-r--r-- | svx/source/sidebar/text/TextPropertyPanel.cxx | 1591 | ||||
-rw-r--r-- | svx/source/sidebar/text/TextPropertyPanel.hrc | 227 | ||||
-rw-r--r-- | svx/source/sidebar/text/TextPropertyPanel.hxx | 246 | ||||
-rw-r--r-- | svx/source/sidebar/text/TextPropertyPanel.src | 801 | ||||
-rw-r--r-- | svx/source/sidebar/text/TextUnderlineControl.cxx | 281 | ||||
-rw-r--r-- | svx/source/sidebar/text/TextUnderlineControl.hxx | 94 | ||||
-rw-r--r-- | svx/source/sidebar/text/TextUnderlinePopup.cxx | 60 | ||||
-rw-r--r-- | svx/source/sidebar/text/TextUnderlinePopup.hxx | 47 |
14 files changed, 4296 insertions, 0 deletions
diff --git a/svx/source/sidebar/text/SvxSBFontNameBox.cxx b/svx/source/sidebar/text/SvxSBFontNameBox.cxx new file mode 100644 index 000000000000..92fcb41997c6 --- /dev/null +++ b/svx/source/sidebar/text/SvxSBFontNameBox.cxx @@ -0,0 +1,178 @@ +/************************************************************** + * + * 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 "SvxSBFontNameBox.hxx" + +#include <unotools/fontoptions.hxx> +#include <sfx2/objsh.hxx> +#include <sfx2/dispatch.hxx> +#include <editeng/flstitem.hxx> +#include <editeng/editids.hrc> +#include <editeng/fontitem.hxx> + + +const static sal_uInt16 MAX_MRU_FONTNAME_ENTRIES = 5; + + +namespace svx { namespace sidebar { + +namespace { + bool GetDocFontList_Impl( const FontList** ppFontList, SvxSBFontNameBox* pBox ) + { + bool bChanged = false; + const SfxObjectShell* pDocSh = SfxObjectShell::Current(); + SvxFontListItem* pFontListItem = NULL; + + if ( pDocSh ) + pFontListItem = + (SvxFontListItem*)pDocSh->GetItem( SID_ATTR_CHAR_FONTLIST ); + + if ( pFontListItem ) + { + const FontList* pNewFontList = pFontListItem->GetFontList(); + DBG_ASSERT( pNewFontList, "Doc-FontList not available!" ); + + if ( !*ppFontList ) + { + *ppFontList = pNewFontList; + bChanged = true; + } + else + { + bChanged = ( *ppFontList != pNewFontList ); + if( !bChanged && pBox!=NULL ) + bChanged = ( pBox->GetListCount() != pNewFontList->GetFontNameCount() ); + HACK(vergleich ist unvollstaendig) + + if ( bChanged ) + *ppFontList = pNewFontList; + } + + if ( pBox ) + pBox->Enable(); + } + else if ( pBox ) + pBox->Disable(); + + // in die FontBox ggf. auch die neue Liste f"ullen + if ( pBox && bChanged ) + { + if ( *ppFontList ) + pBox->Fill( *ppFontList ); + else + pBox->Clear(); + } + return bChanged; + } +} + + + + +SvxSBFontNameBox::SvxSBFontNameBox( Window* pParent, const ResId& rResId ) : + FontNameBox ( pParent, rResId ) +, pFontList ( NULL ) +, nFtCount ( 0 ) +, bInput(false) +, pBindings(NULL) +{ + EnableControls_Impl(); +// StartListening( *SFX_APP() ); +} + +void SvxSBFontNameBox::EnableControls_Impl() +{ + SvtFontOptions aFontOpt; + bool bEnable = aFontOpt.IsFontHistoryEnabled(); + sal_uInt16 nEntries = bEnable ? MAX_MRU_FONTNAME_ENTRIES : 0; + if ( GetMaxMRUCount() != nEntries ) + { + // refill in the next GetFocus-Handler + pFontList = NULL; + Clear(); + SetMaxMRUCount( nEntries ); + } + + bEnable = aFontOpt.IsFontWYSIWYGEnabled(); + EnableWYSIWYG( bEnable ); + EnableSymbols( bEnable ); +} + +void SvxSBFontNameBox::FillList() +{ + Selection aOldSel = GetSelection(); + GetDocFontList_Impl( &pFontList, this ); + aCurText = GetText(); + SetSelection( aOldSel ); +} + +long SvxSBFontNameBox::PreNotify( NotifyEvent& rNEvt ) +{ + const sal_uInt16 nType (rNEvt.GetType()); + + if ( EVENT_MOUSEBUTTONDOWN == nType || EVENT_GETFOCUS == nType ) + FillList(); + return FontNameBox::PreNotify( rNEvt ); +} +//<<modify +long SvxSBFontNameBox::Notify( NotifyEvent& rNEvt) //SfxBroadcaster& rBC, const SfxHint& rHint +{ + //SfxItemSetHint* pHint = PTR_CAST(SfxItemSetHint, &rHint); + //if ( pHint ) + // EnableControls_Impl(); + bool bHandle = 0; + if ( rNEvt.GetType() == EVENT_KEYINPUT ) + { + const sal_uInt16 nCode (rNEvt.GetKeyEvent()->GetKeyCode().GetCode()); + + if( nCode == KEY_RETURN) + { + bHandle = 1; + Select(); + } + } + + return bHandle ? bHandle : FontNameBox::Notify( rNEvt ); +} +void SvxSBFontNameBox::Select() +{ + FontNameBox::Select(); + + if ( !IsTravelSelect() ) + { + FillList(); + FontInfo aInfo( pFontList->Get( GetText(),WEIGHT_NORMAL, ITALIC_NORMAL ) );//meWeight, meItalic + + SvxFontItem aFontItem( aInfo.GetFamily(), aInfo.GetName(), aInfo.GetStyleName(), + aInfo.GetPitch(), aInfo.GetCharSet(), SID_ATTR_CHAR_FONT ); + + pBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_FONT, SFX_CALLMODE_RECORD, &aFontItem, 0L ); + pBindings->Invalidate(SID_ATTR_CHAR_FONT,true,false); + } +} +void SvxSBFontNameBox::SetBindings(SfxBindings* pB) +{ + pBindings = pB; +} + +} } // end of namespace svx::sidebar diff --git a/svx/source/sidebar/text/SvxSBFontNameBox.hxx b/svx/source/sidebar/text/SvxSBFontNameBox.hxx new file mode 100644 index 000000000000..ac06cbcbe50f --- /dev/null +++ b/svx/source/sidebar/text/SvxSBFontNameBox.hxx @@ -0,0 +1,80 @@ +/************************************************************** + * + * 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_SB_FONT_NAME_BOX_HXX +#define SVX_SIDEBAR_SB_FONT_NAME_BOX_HXX + +#include <sfx2/bindings.hxx> +#include <svtools/ctrlbox.hxx> +#include <svtools/ctrltool.hxx> + +/* +#include <sfx2/sectionpage.hxx> +#include <svx/svxdllapi.h> +#include <vcl/fixed.hxx> + +#include <vcl/button.hxx> +#include <svl/lstner.hxx> +#include <vcl/toolbox.hxx> + +#include <svx/tbxcolorupdate.hxx> +#include <svx/svxenum.hxx> +#include <svx/fhgtitem.hxx> + +#define FONT_COLOR 1 +#define BACK_COLOR 2 +*/ +namespace svx +{ + class ToolboxButtonColorUpdater; +} + +namespace svx { namespace sidebar { + +class SvxSBFontNameBox : public FontNameBox//, public SfxListener +{ +private: + const FontList* pFontList; + Font aCurFont; + String aCurText; + sal_uInt16 nFtCount; + bool bInput; + void EnableControls_Impl(); + SfxBindings* pBindings;// +protected: + virtual void Select(); + +public: + SvxSBFontNameBox( Window* pParent, const ResId& rResId ); + void FillList(); + sal_uInt16 GetListCount() { return nFtCount; } + void Clear() { FontNameBox::Clear(); nFtCount = 0; } + void Fill( const FontList* pList ) + { FontNameBox::Fill( pList ); + nFtCount = pList->GetFontNameCount(); } + void SetBindings(SfxBindings* pBinding);// + virtual long PreNotify( NotifyEvent& rNEvt ); + virtual long Notify( NotifyEvent& rNEvt );// +}; + +} } // end of namespace svx::sidebar + +#endif diff --git a/svx/source/sidebar/text/TextCharacterSpacingControl.cxx b/svx/source/sidebar/text/TextCharacterSpacingControl.cxx new file mode 100644 index 000000000000..a99ffdb78d91 --- /dev/null +++ b/svx/source/sidebar/text/TextCharacterSpacingControl.cxx @@ -0,0 +1,468 @@ +/************************************************************** + * + * 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 "TextCharacterSpacingControl.hxx" +#include "TextPropertyPanel.hrc" +#include <sfx2/sidebar/propertypanel.hrc> +#include <svx/dialogs.hrc> +#include <svx/dialmgr.hxx> +#include <unotools/viewoptions.hxx> +#include <editeng/kernitem.hxx> +#include <sfx2/bindings.hxx> +#include <sfx2/dispatch.hxx> +#include <sfx2/sidebar/Theme.hxx> + +namespace svx { namespace sidebar { +TextCharacterSpacingControl::TextCharacterSpacingControl(Window* pParent, svx::sidebar::TextPropertyPanel& rPanel) +: PopupControl( pParent,SVX_RES(RID_POPUPPANEL_TEXTPAGE_SPACING)) +, mrTextPropertyPanel(rPanel) +, mpBindings(NULL) +, maVSSpacing (ValueSetWithTextControl::IMAGE_TEXT,this, SVX_RES(VS_SPACING)) +, maLastCus (this, SVX_RES(FT_LASTCUSTOM)) +//, maBorder (this, SVX_RES(CT_BORDER)) +, maFTSpacing (this, SVX_RES(FT_SPACING)) +, maLBKerning (this, SVX_RES(LB_KERNING)) +, maFTBy (this, SVX_RES(FT_BY)) +, maEditKerning (this, SVX_RES(ED_KERNING)) + +, mpImg (NULL) +, mpImgSel (NULL) +, mpStr (NULL) +, mpStrTip (NULL) + +, maImgCus (SVX_RES(IMG_CUSTOM)) +, maImgCusGrey (SVX_RES(IMG_CUSTOM_GRAY)) +, maStrCus (SVX_RES(STR_CUSTOM)) +, maStrCusE (SVX_RES(STR_CUSTOM_E_TIP)) //add +, maStrCusC (SVX_RES(STR_CUSTOM_C_TIP)) //add +, maStrCusN (SVX_RES(STR_NORMAL_TIP)) //add +, maStrUnit (SVX_RES(STR_PT)) //add + +, mnCustomKern(0) +, mnLastCus ( SPACING_NOCUSTOM ) +, mbCusEnable(false) +, mbVS(true) +{ + initial(); + FreeResource(); + mpBindings = mrTextPropertyPanel.GetBindings(); + Link aLink = LINK(this, TextCharacterSpacingControl, KerningSelectHdl); + maLBKerning.SetSelectHdl(aLink); + aLink =LINK(this, TextCharacterSpacingControl, KerningModifyHdl); + maEditKerning.SetModifyHdl(aLink); + +} +TextCharacterSpacingControl::~TextCharacterSpacingControl() +{ + delete[] mpImg; + delete[] mpImgSel; + delete[] mpStr; + delete[] mpStrTip; +} + +void TextCharacterSpacingControl::initial() +{ + maVSSpacing.SetStyle( maVSSpacing.GetStyle()| WB_3DLOOK | WB_NO_DIRECTSELECT ); + { + maVSSpacing.SetControlBackground(GetSettings().GetStyleSettings().GetHighContrastMode()? + GetSettings().GetStyleSettings().GetMenuColor(): + sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground )); + maVSSpacing.SetColor(GetSettings().GetStyleSettings().GetHighContrastMode()? + GetSettings().GetStyleSettings().GetMenuColor(): + sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground )); + maVSSpacing.SetBackground(GetSettings().GetStyleSettings().GetHighContrastMode()? + GetSettings().GetStyleSettings().GetMenuColor(): + sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground )); + maFTSpacing.SetBackground(GetSettings().GetStyleSettings().GetHighContrastMode()? + GetSettings().GetStyleSettings().GetMenuColor(): + sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground )); + maFTBy.SetBackground(GetSettings().GetStyleSettings().GetHighContrastMode()? + GetSettings().GetStyleSettings().GetMenuColor(): + sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground )); + } + mpImg = new Image[5]; + mpImg[0] = Image(SVX_RES(IMG_VERY_TIGHT)); + mpImg[1] = Image(SVX_RES(IMG_TIGHT)); + mpImg[2] = Image(SVX_RES(IMG_NORMAL)); + mpImg[3] = Image(SVX_RES(IMG_LOOSE)); + mpImg[4] = Image(SVX_RES(IMG_VERY_LOOSE)); + + mpImgSel = new Image[5]; + mpImgSel[0] = Image(SVX_RES(IMG_VERY_TIGHT_S)); + mpImgSel[1] = Image(SVX_RES(IMG_TIGHT_S)); + mpImgSel[2] = Image(SVX_RES(IMG_NORMAL_S)); + mpImgSel[3] = Image(SVX_RES(IMG_LOOSE_S)); + mpImgSel[4] = Image(SVX_RES(IMG_VERY_LOOSE_S)); + + mpStr = new XubString[5]; + mpStr[0] = XubString(SVX_RES(STR_VERY_TIGHT)); + mpStr[1] = XubString(SVX_RES(STR_TIGHT)); + mpStr[2] = XubString(SVX_RES(STR_NORMAL)); + mpStr[3] = XubString(SVX_RES(STR_LOOSE)); + mpStr[4] = XubString(SVX_RES(STR_VERY_LOOSE)); + + + mpStrTip = new XubString[5]; + mpStrTip[0] = XubString(SVX_RES(STR_VERY_TIGHT_TIP)); + mpStrTip[1] = XubString(SVX_RES(STR_TIGHT_TIP)); + mpStrTip[2] = XubString(SVX_RES(STR_NORMAL_TIP)); + mpStrTip[3] = XubString(SVX_RES(STR_LOOSE_TIP)); + mpStrTip[4] = XubString(SVX_RES(STR_VERY_LOOSE_TIP)); + + for (int i=0;i<5;i++) + maVSSpacing.AddItem(mpImg[i], &mpImgSel[i],mpStr[i],&mpStrTip[i]); + + maVSSpacing.AddItem( maImgCus, 0, maStrCus, 0 ); + + maVSSpacing.SetNoSelection(); + Link aLink = LINK(this, TextCharacterSpacingControl,VSSelHdl ); + maVSSpacing.SetSelectHdl(aLink); + maVSSpacing.StartSelection(); + maVSSpacing.Show(); +} +void TextCharacterSpacingControl::ToGetFocus() +{ + if(!mbVS) + maLBKerning.GrabFocus(); + else + maVSSpacing.GrabFocus(); +} + +void TextCharacterSpacingControl::Rearrange(bool bLBAvailable,bool bAvailable, long nKerning) +{ + mbVS = true; + maVSSpacing.SetNoSelection(); + SvtViewOptions aWinOpt( E_WINDOW, SIDEBAR_SPACING_GLOBAL_VALUE ); + if ( aWinOpt.Exists() ) + { + ::com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue > aSeq = aWinOpt.GetUserData(); + ::rtl::OUString aTmp; + if ( aSeq.getLength()) + aSeq[0].Value >>= aTmp; + + String aWinData( aTmp ); + mnCustomKern = aWinData.ToInt32(); + mnLastCus = SPACING_CLOSE_BY_CUS_EDIT; + mbCusEnable = true; + } + else + { + mnLastCus = SPACING_NOCUSTOM; + mbCusEnable = false; + } + + if( !mnLastCus ) + { + maVSSpacing.ReplaceItemImages(6, maImgCusGrey,0); + } + else + { + //set custom tips + maVSSpacing.ReplaceItemImages(6, maImgCus,0); + if(mnCustomKern > 0) + { + String aStrTip( maStrCusE); //LAST CUSTOM no tip defect //add + aStrTip.Append( String::CreateFromDouble( (double)mnCustomKern / 10)); + aStrTip.Append(maStrUnit); // modify + maVSSpacing.SetItemText(6,aStrTip); + } + else if(mnCustomKern < 0) + { + String aStrTip(maStrCusC) ; //LAST CUSTOM no tip defect //add + aStrTip.Append( String::CreateFromDouble( (double)-mnCustomKern / 10)); + aStrTip.Append(maStrUnit); // modify + maVSSpacing.SetItemText( 6, aStrTip ); + } + else + { + String aStrTip(maStrCusN) ; //LAST CUSTOM no tip defect //add + maVSSpacing.SetItemText( 6, aStrTip ); + } + + } + + if(bLBAvailable && bAvailable) + { + maLBKerning.Enable(); + maFTSpacing.Enable(); + + SfxMapUnit eUnit = mrTextPropertyPanel.GetSpaceController().GetCoreMetric(); + MapUnit eOrgUnit = (MapUnit)eUnit; + MapUnit ePntUnit( MAP_POINT ); + long nBig = maEditKerning.Normalize(nKerning); + nKerning = LogicToLogic( nBig, eOrgUnit, ePntUnit ); + + if ( nKerning > 0 ) + { + maFTBy.Enable(); + maEditKerning.Enable(); + maEditKerning.SetMax( 9999 ); + maEditKerning.SetLast( 9999 ); + maEditKerning.SetValue( nKerning ); + maLBKerning.SelectEntryPos( SIDEBAR_SPACE_EXPAND ); + if(nKerning == 30) + { + maVSSpacing.SelectItem(4); + } + else if(nKerning == 60) + { + maVSSpacing.SelectItem(5); + } + else + { + maVSSpacing.SetNoSelection(); + maVSSpacing.SelectItem(0); + mbVS = false; + } + } + else if ( nKerning < 0 ) + { + maFTBy.Enable(); + maEditKerning.Enable(); + maEditKerning.SetValue( -nKerning ); + maLBKerning.SelectEntryPos( SIDEBAR_SPACE_CONDENSED ); + long nMax = mrTextPropertyPanel.GetSelFontSize()/6; + maEditKerning.SetMax( maEditKerning.Normalize( nMax ), FUNIT_POINT ); + maEditKerning.SetLast( maEditKerning.GetMax( maEditKerning.GetUnit() ) ); + if( nKerning == -30 ) + { + maVSSpacing.SelectItem(1); + } + else if( nKerning == -15 ) + { + maVSSpacing.SelectItem(2); + } + else + { + maVSSpacing.SetNoSelection(); + maVSSpacing.SelectItem(0); + mbVS = false; + } + } + else + { + maVSSpacing.SelectItem(3); + maLBKerning.SelectEntryPos( SIDEBAR_SPACE_NORMAL ); + maFTBy.Disable(); + maEditKerning.Disable(); + maEditKerning.SetValue( 0 ); + maEditKerning.SetMax( 9999 ); + maEditKerning.SetLast( 9999 ); + } + } + else if(bLBAvailable && !bAvailable) + { + //modified + maVSSpacing.SetNoSelection(); + maVSSpacing.SelectItem(0); + mbVS = false; + maLBKerning.Enable(); + maFTSpacing.Enable(); + maLBKerning.SetNoSelection(); + maEditKerning.SetText(String()); + maEditKerning.Disable(); + maFTBy.Disable(); + } + else + { + maVSSpacing.SetNoSelection(); + maVSSpacing.SelectItem(0); + mbVS = false; + maEditKerning.SetText(String()); + maLBKerning.SetNoSelection(); + maLBKerning.Disable(); + maFTSpacing.Disable(); + maEditKerning.Disable(); + maFTBy.Disable(); + } + GetFocus(); + maVSSpacing.Format(); + maVSSpacing.StartSelection(); +} +IMPL_LINK(TextCharacterSpacingControl, VSSelHdl, void *, pControl) +{ + mnLastCus = SPACING_CLOSE_BY_CLICK_ICON; + + if(pControl == &maVSSpacing) + { + sal_uInt16 iPos = maVSSpacing.GetSelectItemId(); + short nKern = 0; + SfxMapUnit eUnit = mrTextPropertyPanel.GetSpaceController().GetCoreMetric(); + long nVal = 0; + if(iPos == 1) + { + nVal = LogicToLogic(30, MAP_POINT, (MapUnit)eUnit); + nKern = (short)maEditKerning.Denormalize(nVal); + SvxKerningItem aKernItem(-nKern, SID_ATTR_CHAR_KERNING); + mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_KERNING, SFX_CALLMODE_RECORD, &aKernItem, 0L); + mrTextPropertyPanel.SetSpacing(-nKern); + mnLastCus = SPACING_CLOSE_BY_CLICK_ICON; + } + else if(iPos == 2) + { + nVal = LogicToLogic(15, MAP_POINT, (MapUnit)eUnit); + nKern = (short)maEditKerning.Denormalize(nVal); + SvxKerningItem aKernItem(-nKern, SID_ATTR_CHAR_KERNING); + mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_KERNING, SFX_CALLMODE_RECORD, &aKernItem, 0L); + mrTextPropertyPanel.SetSpacing(-nKern); + mnLastCus = SPACING_CLOSE_BY_CLICK_ICON; + } + else if(iPos == 3) + { + SvxKerningItem aKernItem(0, SID_ATTR_CHAR_KERNING); + mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_KERNING, SFX_CALLMODE_RECORD, &aKernItem, 0L); + mrTextPropertyPanel.SetSpacing(0); + mnLastCus = SPACING_CLOSE_BY_CLICK_ICON; + } + else if(iPos == 4) + { + nVal = LogicToLogic(30, MAP_POINT, (MapUnit)eUnit); + nKern = (short)maEditKerning.Denormalize(nVal); + SvxKerningItem aKernItem(nKern, SID_ATTR_CHAR_KERNING); + mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_KERNING, SFX_CALLMODE_RECORD, &aKernItem, 0L); + mrTextPropertyPanel.SetSpacing(nKern); + mnLastCus = SPACING_CLOSE_BY_CLICK_ICON; + } + else if(iPos == 5) + { + nVal = LogicToLogic(60, MAP_POINT, (MapUnit)eUnit); + nKern = (short)maEditKerning.Denormalize(nVal); + SvxKerningItem aKernItem(nKern, SID_ATTR_CHAR_KERNING); + mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_KERNING, SFX_CALLMODE_RECORD, &aKernItem, 0L); + mrTextPropertyPanel.SetSpacing(nKern); + mnLastCus = SPACING_CLOSE_BY_CLICK_ICON; + } + else if(iPos == 6) + { + //modified + if(mbCusEnable) + { + nVal = LogicToLogic(mnCustomKern, MAP_POINT, (MapUnit)eUnit); + nKern = (short)maEditKerning.Denormalize(nVal); + SvxKerningItem aKernItem(nKern , SID_ATTR_CHAR_KERNING); + mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_KERNING, SFX_CALLMODE_RECORD, &aKernItem, 0L); + mrTextPropertyPanel.SetSpacing(nKern); + mnLastCus = SPACING_CLOSE_BY_CLICK_ICON; + } + else + { + maVSSpacing.SetNoSelection(); //add , set no selection and keep the last select item + maVSSpacing.Format(); + Invalidate(); + maVSSpacing.StartSelection(); + } + //modify end + } + + if(iPos < 6 || (iPos == 6 && mbCusEnable)) //add + mrTextPropertyPanel.EndSpacingPopupMode(); + } + + + + return 0; +} + +IMPL_LINK(TextCharacterSpacingControl, KerningSelectHdl, ListBox*, EMPTYARG) +{ + if ( maLBKerning.GetSelectEntryPos() > 0 ) + { + maFTBy.Enable(); + maEditKerning.Enable(); + } + else + { + maEditKerning.SetValue( 0 ); + maFTBy.Disable(); + maEditKerning.Disable(); + } + + if ( maVSSpacing.GetSelectItemId() > 0 ) + { + maVSSpacing.SetNoSelection(); + maVSSpacing.SelectItem(0); + maVSSpacing.Format(); + Invalidate(); + maVSSpacing.StartSelection(); + } + KerningModifyHdl( NULL ); + return 0; +} +IMPL_LINK(TextCharacterSpacingControl, KerningModifyHdl, MetricField*, EMPTYARG) +{ + if ( maVSSpacing.GetSelectItemId() > 0 ) + { + maVSSpacing.SetNoSelection(); + maVSSpacing.SelectItem(0); + maVSSpacing.Format(); + Invalidate(); + maVSSpacing.StartSelection(); + } + sal_uInt16 nPos = maLBKerning.GetSelectEntryPos(); + short nKern = 0; + SfxMapUnit eUnit = mrTextPropertyPanel.GetSpaceController().GetCoreMetric(); + mnLastCus = SPACING_CLOSE_BY_CUS_EDIT; + if ( nPos == SIDEBAR_SPACE_EXPAND || nPos == SIDEBAR_SPACE_CONDENSED ) + { + long nTmp = static_cast<long>(maEditKerning.GetValue()); + if ( nPos == SIDEBAR_SPACE_CONDENSED ) + { + long nMax = mrTextPropertyPanel.GetSelFontSize()/6; + maEditKerning.SetMax( maEditKerning.Normalize( nMax ), FUNIT_TWIP ); + maEditKerning.SetLast( maEditKerning.GetMax( maEditKerning.GetUnit() ) ); + if(nTmp > maEditKerning.GetMax()) + nTmp = maEditKerning.GetMax(); + mnCustomKern = -nTmp; + long nVal = LogicToLogic( nTmp, MAP_POINT, (MapUnit)eUnit ); + nKern = (short)maEditKerning.Denormalize( nVal ); + nKern *= - 1; + } + else + { + maEditKerning.SetMax( 9999 ); + maEditKerning.SetLast( 9999 ); + if(nTmp > maEditKerning.GetMax(FUNIT_TWIP)) + nTmp = maEditKerning.GetMax(FUNIT_TWIP); + mnCustomKern = nTmp; + long nVal = LogicToLogic( nTmp, MAP_POINT, (MapUnit)eUnit ); + nKern = (short)maEditKerning.Denormalize( nVal ); + } + } + else + { + mnCustomKern = 0; + } + SvxKerningItem aKernItem(nKern, SID_ATTR_CHAR_KERNING); + mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_KERNING, SFX_CALLMODE_RECORD, &aKernItem, 0L); + mrTextPropertyPanel.SetSpacing(nKern); + return 0; +} +short TextCharacterSpacingControl::GetLastCustomState() +{ + return mnLastCus; +} +long TextCharacterSpacingControl::GetLastCustomValue() +{ + return mnCustomKern; +} + +}} // end of namespace sidebar diff --git a/svx/source/sidebar/text/TextCharacterSpacingControl.hxx b/svx/source/sidebar/text/TextCharacterSpacingControl.hxx new file mode 100644 index 000000000000..df2f9eb7ced4 --- /dev/null +++ b/svx/source/sidebar/text/TextCharacterSpacingControl.hxx @@ -0,0 +1,96 @@ +/************************************************************** + * + * 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_CHARACTER_SPACING_CONTROL_HXX_ +#define _SVX_SIDEBAR_CHARACTER_SPACING_CONTROL_HXX_ + +#include "svx/sidebar/PopupControl.hxx" +#include "svx/sidebar/ValueSetWithTextControl.hxx" +#include <sfx2/bindings.hxx> +#include <svtools/ctrlbox.hxx> +#include <svtools/ctrltool.hxx> +#include "TextPropertyPanel.hxx" +#include <vcl/fixed.hxx> + + +namespace svx { namespace sidebar { +#define SPACING_NOCUSTOM 0 +#define SPACING_CLOSE_BY_CLICK_ICON -1 +#define SPACING_CLOSE_BY_CUS_EDIT 1 + +#define SIDEBAR_SPACING_GLOBAL_VALUE String("PopupPanal_Spacing", 18, RTL_TEXTENCODING_ASCII_US) + +#define SIDEBAR_SPACE_NORMAL 0 +#define SIDEBAR_SPACE_EXPAND 1 +#define SIDEBAR_SPACE_CONDENSED 2 +class TextCharacterSpacingControl:public svx::sidebar::PopupControl +{ +public: + TextCharacterSpacingControl(Window* pParent, svx::sidebar::TextPropertyPanel& rPanel); + ~TextCharacterSpacingControl(); + void ToGetFocus(); + void Rearrange(bool bLBAvailable,bool bAvailable, long nKerning); + //virtual void Paint(const Rectangle& rect); + + //add + short GetLastCustomState(); + long GetLastCustomValue(); + //add end + +private: + svx::sidebar::TextPropertyPanel& mrTextPropertyPanel; + SfxBindings* mpBindings; + + ValueSetWithTextControl maVSSpacing; + + FixedText maLastCus; +// Control maBorder; + + FixedText maFTSpacing; + ListBox maLBKerning; + FixedText maFTBy; + MetricField maEditKerning; + + Image* mpImg; + Image* mpImgSel; + XubString* mpStr; + XubString* mpStrTip; + + Image maImgCus; + Image maImgCusGrey; + XubString maStrCus; + XubString maStrCusE; //add + XubString maStrCusC; //add + XubString maStrCusN; //add + XubString maStrUnit; //add + + long mnCustomKern; + short mnLastCus; + bool mbCusEnable; + bool mbVS; + + void initial(); + DECL_LINK(VSSelHdl, void*); + DECL_LINK(KerningSelectHdl, ListBox*); + DECL_LINK(KerningModifyHdl, MetricField*); +}; +}} + +#endif diff --git a/svx/source/sidebar/text/TextCharacterSpacingPopup.cxx b/svx/source/sidebar/text/TextCharacterSpacingPopup.cxx new file mode 100644 index 000000000000..4d44757b3749 --- /dev/null +++ b/svx/source/sidebar/text/TextCharacterSpacingPopup.cxx @@ -0,0 +1,79 @@ +/************************************************************** + * + * 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 "TextCharacterSpacingPopup.hxx" +#include "TextCharacterSpacingControl.hxx" +#include <boost/bind.hpp> +#include <unotools/viewoptions.hxx> + +namespace svx { namespace sidebar { + +TextCharacterSpacingPopup::TextCharacterSpacingPopup ( + Window* pParent, + const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator) + : Popup( + pParent, + rControlCreator, + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Character Spacing"))) +{ + SetPopupModeEndHandler(::boost::bind(&TextCharacterSpacingPopup::PopupModeEndCallback, this)); +} + + + + +TextCharacterSpacingPopup::~TextCharacterSpacingPopup (void) +{ +} + + + + +void TextCharacterSpacingPopup::Rearrange (bool bLBAvailable,bool bAvailable, long nKerning) +{ + ProvideContainerAndControl(); + + TextCharacterSpacingControl* pControl = dynamic_cast<TextCharacterSpacingControl*>(mpControl.get()); + if (pControl != NULL) + pControl->Rearrange(bLBAvailable,bAvailable,nKerning); +} + +void TextCharacterSpacingPopup::PopupModeEndCallback (void) +{ + ProvideContainerAndControl(); + TextCharacterSpacingControl* pControl = dynamic_cast<TextCharacterSpacingControl*>(mpControl.get()); + if (pControl == NULL) + return; + + if( pControl->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( pControl->GetLastCustomValue() )); + aWinOpt.SetUserData( aSeq ); + + } +} + + +} } // end of namespace svx::sidebar + diff --git a/svx/source/sidebar/text/TextCharacterSpacingPopup.hxx b/svx/source/sidebar/text/TextCharacterSpacingPopup.hxx new file mode 100644 index 000000000000..7d02dab3d500 --- /dev/null +++ b/svx/source/sidebar/text/TextCharacterSpacingPopup.hxx @@ -0,0 +1,48 @@ +/************************************************************** + * + * 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_CHARACTER_SPACING_POPUP_HXX_ +#define _SVX_SIDEBAR_CHARACTER_SPACING_POPUP_HXX_ + +#include "svx/sidebar/Popup.hxx" + +#include <boost/function.hpp> + +namespace svx { namespace sidebar { + +class TextCharacterSpacingPopup + : public Popup +{ +public : + TextCharacterSpacingPopup ( + Window* pParent, + const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator); + ~TextCharacterSpacingPopup (void); + + void Rearrange (bool bLBAvailable,bool bAvailable, long nKerning); +private: + void PopupModeEndCallback (void); +}; + +} } // end of namespace svx::sidebar + +#endif + diff --git a/svx/source/sidebar/text/TextPropertyPanel.cxx b/svx/source/sidebar/text/TextPropertyPanel.cxx new file mode 100644 index 000000000000..cf776324d26e --- /dev/null +++ b/svx/source/sidebar/text/TextPropertyPanel.cxx @@ -0,0 +1,1591 @@ +/************************************************************** + * + * 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 "sfx2/imagemgr.hxx" +#include <svtools/ctrltool.hxx> +#include <svtools/unitconv.hxx> + +#include <vcl/gradient.hxx> +#include <vcl/svapp.hxx> +#include <vcl/toolbox.hxx> +#include "TextCharacterSpacingControl.hxx" +#include "TextCharacterSpacingPopup.hxx" +#include "TextUnderlineControl.hxx" +#include "TextUnderlinePopup.hxx" +#include <svx/sidebar/ColorControl.hxx> +#include <svx/sidebar/PopupContainer.hxx> + + +#include <boost/bind.hpp> + +using namespace css; +using namespace cssu; +using ::sfx2::sidebar::Theme; +using ::sfx2::sidebar::ControlFactory; + +#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 TEXT_SECTIONPAGE_HEIGHT_S SECTIONPAGE_MARGIN_VERTICAL_TOP + CBOX_HEIGHT + ( TOOLBOX_ITEM_HEIGHT + 2 ) + CONTROL_SPACING_VERTICAL * 1 + SECTIONPAGE_MARGIN_VERTICAL_BOT +#define TEXT_SECTIONPAGE_HEIGHT SECTIONPAGE_MARGIN_VERTICAL_TOP + CBOX_HEIGHT + ( TOOLBOX_ITEM_HEIGHT + 2 ) * 2 + CONTROL_SPACING_VERTICAL * 2 + SECTIONPAGE_MARGIN_VERTICAL_BOT + +// + +//end +PopupControl* TextPropertyPanel::CreateCharacterSpacingControl (PopupContainer* pParent) +{ + return new TextCharacterSpacingControl(pParent, *this); +} + +PopupControl* TextPropertyPanel::CreateUnderlinePopupControl (PopupContainer* pParent) +{ + return new TextUnderlineControl(pParent, *this); +} + +PopupControl* TextPropertyPanel::CreateFontColorPopupControl (PopupContainer* pParent) +{ + return new ColorControl( + pParent, + mpBindings, + SVX_RES(RID_POPUPPANEL_TEXTPAGE_FONT_COLOR), + SVX_RES(VS_FONT_COLOR), + ::boost::bind(&TextPropertyPanel::GetFontColor, this), + ::boost::bind(&TextPropertyPanel::SetFontColor, this, _1,_2), + pParent, + 0); +} + +PopupControl* TextPropertyPanel::CreateBrushColorPopupControl (PopupContainer* pParent) +{ + return new ColorControl( + pParent, + mpBindings, + SVX_RES(RID_POPUPPANEL_TEXTPAGE_FONT_COLOR), + SVX_RES(VS_FONT_COLOR), + ::boost::bind(&TextPropertyPanel::GetBrushColor, this), + ::boost::bind(&TextPropertyPanel::SetBrushColor, this, _1,_2), + pParent, + 0); +} + +long TextPropertyPanel::GetSelFontSize() +{ + long nH = 240; + SfxMapUnit eUnit = maSpacingControl.GetCoreMetric(); + if (mpHeightItem) + nH = LogicToLogic( mpHeightItem->GetHeight(), (MapUnit)eUnit, MAP_TWIP ); + return nH; +} + + +TextPropertyPanel* TextPropertyPanel::Create ( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings, + const cssu::Reference<css::ui::XSidebar>& rxSidebar) +{ + 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); + + return new TextPropertyPanel( + pParent, + rxFrame, + pBindings, + rxSidebar); +} + + +::sfx2::sidebar::ControllerItem& TextPropertyPanel::GetSpaceController() +{ + return maSpacingControl; +} + +TextPropertyPanel::TextPropertyPanel ( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings, + const cssu::Reference<css::ui::XSidebar>& rxSidebar) + : Control(pParent, SVX_RES(RID_SIDEBAR_TEXT_PANEL)), + mpFontNameBox (new SvxSBFontNameBox(this, SVX_RES(CB_SBFONT_FONT))), + maFontSizeBox (this, SVX_RES(MB_SBFONT_FONTSIZE)), + mpToolBoxIncDecBackground(ControlFactory::CreateToolBoxBackground(this)), + mpToolBoxIncDec(ControlFactory::CreateToolBox( + mpToolBoxIncDecBackground.get(), + SVX_RES(TB_INCREASE_DECREASE))), + mpToolBoxFontBackground(ControlFactory::CreateToolBoxBackground(this)), + mpToolBoxFont(ControlFactory::CreateToolBox( + mpToolBoxFontBackground.get(), + SVX_RES(TB_FONT))), + mpToolBoxFontColorBackground(ControlFactory::CreateToolBoxBackground(this)), + mpToolBoxFontColor(ControlFactory::CreateToolBox( + mpToolBoxFontColorBackground.get(), + SVX_RES(TB_FONTCOLOR))), + mpToolBoxScriptBackground(ControlFactory::CreateToolBoxBackground(this)), + mpToolBoxScript(ControlFactory::CreateToolBox( + mpToolBoxScriptBackground.get(), + SVX_RES(TB_SCRIPT))), + mpToolBoxScriptSwBackground(ControlFactory::CreateToolBoxBackground(this)), + mpToolBoxScriptSw(ControlFactory::CreateToolBox( + mpToolBoxScriptSwBackground.get(), + SVX_RES(TB_SCRIPT_SW))), + mpToolBoxSpacingBackground(ControlFactory::CreateToolBoxBackground(this)), + mpToolBoxSpacing(ControlFactory::CreateToolBox( + mpToolBoxSpacingBackground.get(), + SVX_RES(TB_SPACING))), + mpToolBoxHighlightBackground(ControlFactory::CreateToolBoxBackground(this)), + mpToolBoxHighlight(ControlFactory::CreateToolBox( + mpToolBoxHighlightBackground.get(), + SVX_RES(TB_HIGHLIGHT))), + maCharSpacePopup(this, ::boost::bind(&TextPropertyPanel::CreateCharacterSpacingControl, this, _1)), + maFontColorPopup(this, ::boost::bind(&TextPropertyPanel::CreateFontColorPopupControl, this, _1)), + maBrushColorPopup(this, ::boost::bind(&TextPropertyPanel::CreateBrushColorPopupControl, this, _1)), + maUnderlinePopup(this, ::boost::bind(&TextPropertyPanel::CreateUnderlinePopupControl, this, _1)), + 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), + mxFrame(rxFrame), + maContext(), + mpBindings(pBindings), + mxSidebar(rxSidebar) +{ + Initialize(); + FreeResource(); +} + + + + +TextPropertyPanel::~TextPropertyPanel (void) +{ + if(mbMustDelete) + delete mpFontList; + + // Destroy the toolbox windows. + mpToolBoxIncDec.reset(); + mpToolBoxFont.reset(); + mpToolBoxFontColor.reset(); + mpToolBoxScript.reset(); + mpToolBoxScriptSw.reset(); + mpToolBoxSpacing.reset(); + mpToolBoxHighlight.reset(); + + // Destroy the background windows of the toolboxes. + mpToolBoxIncDecBackground.reset(); + mpToolBoxFontBackground.reset(); + mpToolBoxFontColorBackground.reset(); + mpToolBoxScriptBackground.reset(); + mpToolBoxScriptSwBackground.reset(); + mpToolBoxSpacingBackground.reset(); + mpToolBoxHighlightBackground.reset(); +} + + + + +Image TextPropertyPanel::GetIcon (const ::rtl::OUString& rsURL) +{ + return GetImage(mxFrame, rsURL, sal_False, Theme::IsHighContrastMode()); +} + + +void TextPropertyPanel::SetSpacing(long nKern) +{ + mlKerning = nKern; +} + + +void TextPropertyPanel::HandleContextChange ( + const ::sfx2::sidebar::EnumContext aContext) +{ + if (maContext == aContext) + { + // Nothing to do. + return; + } + + maContext = aContext; + switch (maContext.GetCombinedContext_DI()) + { + 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); + if (mxSidebar.is()) + mxSidebar->requestLayout(); + break; + } + + case CombinedEnumContext(Application_WriterAndWeb, Context_Text): + case CombinedEnumContext(Application_WriterAndWeb, 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); + if (mxSidebar.is()) + mxSidebar->requestLayout(); + 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); + if (mxSidebar.is()) + mxSidebar->requestLayout(); + break; + } + + case CombinedEnumContext(Application_Calc, Context_EditCell): + case CombinedEnumContext(Application_Calc, Context_DrawText): + 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): + { + 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); + if (mxSidebar.is()) + mxSidebar->requestLayout(); + break; + } + + default: + break; + } +} + +SfxBindings* TextPropertyPanel::GetBindings() +{ + return mpBindings; +} + + +void TextPropertyPanel::DataChanged (const DataChangedEvent& rEvent) +{ + (void)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()); + const FontInfo aFontInfo (mpFontList->Get( String::CreateFromAscii( "" ), String::CreateFromAscii( "" ))); + maFontSizeBox.Fill(&aFontInfo,mpFontList); + maFontSizeBox.SetAccessibleName(maFontSizeBox.GetQuickHelpText()); + + //toolbox + SetupIcons(); + InitToolBoxIncDec(); + InitToolBoxFont(); + InitToolBoxFontColor(); + InitToolBoxScript(); + InitToolBoxSpacing(); + InitToolBoxHighlight(); + +#ifdef HAS_IA2 + mpFontNameBox->SetAccRelationLabeledBy(&mpFontNameBox); + mpFontNameBox->SetMpSubEditAccLableBy(&mpFontNameBox); + maFontSizeBox.SetAccRelationLabeledBy(&maFontSizeBox); + maFontSizeBox.SetMpSubEditAccLableBy(&maFontSizeBox); + mpToolBoxFont.SetAccRelationLabeledBy(&mpToolBoxFont); + mpToolBoxIncDec.SetAccRelationLabeledBy(&mpToolBoxIncDec); + mpToolBoxFontColor.SetAccRelationLabeledBy(&mpToolBoxFontColor); + mpToolBoxScript.SetAccRelationLabeledBy(&mpToolBoxScript); + mpToolBoxScriptSw.SetAccRelationLabeledBy(&mpToolBoxScriptSw); + mpToolBoxSpacing.SetAccRelationLabeledBy(&mpToolBoxSpacing); + mpToolBoxHighlight.SetAccRelationLabeledBy(&mpToolBoxHighlight); +#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::EndSpacingPopupMode (void) +{ + maCharSpacePopup.Hide(); +} + +void TextPropertyPanel::EndUnderlinePopupMode (void) +{ + maUnderlinePopup.Hide(); +} + + +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 ); + + Link aLink = LINK(this, TextPropertyPanel, ToolBoxFontColorDropHdl); + mpToolBoxFontColor->SetDropdownClickHdl ( aLink ); + mpToolBoxFontColor->SetSelectHdl ( aLink ); + +} +void TextPropertyPanel::InitToolBoxScript() +{ + Size aTbxSize( mpToolBoxScriptSw->CalcWindowSizePixel() ); + mpToolBoxScriptSw->SetOutputSizePixel( aTbxSize ); + + Link aLink = LINK(this, TextPropertyPanel, ToolBoxSwScriptSelectHdl); + mpToolBoxScriptSw->SetSelectHdl ( aLink ); + + aTbxSize = mpToolBoxScript->CalcWindowSizePixel() ; + mpToolBoxScript->SetOutputSizePixel( aTbxSize ); + + 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 ); + + 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 ); + + 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) + { + //AF: meUnderline = GetDefaultUnderline(); + meUnderline = UNDERLINE_SINGLE; + //<<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(); + OSL_ASSERT(nId == TBI_UNDERLINE); + if(nId == TBI_UNDERLINE) + { + pToolBox->SetItemDown( nId, true ); + maUnderlinePopup.Rearrange(meUnderline); + maUnderlinePopup.Show(*pToolBox); + + } + return 0L; +} + + + + +IMPL_LINK(TextPropertyPanel, ToolBoxFontColorDropHdl,ToolBox*, pToolBox) +{ + const sal_uInt16 nId = pToolBox->GetCurItemId(); + if(nId == TBI_FONTCOLOR) + { + meColorType = FONT_COLOR; + + pToolBox->SetItemDown( nId, true ); + + maFontColorPopup.Show(*pToolBox); + maFontColorPopup.SetCurrentColor(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 ); + maBrushColorPopup.Show(*pToolBox); + maBrushColorPopup.SetCurrentColor(maBackColor, mbBackColorAvailable); + + } + return 0; +} + + + +IMPL_LINK(TextPropertyPanel, SpacingClickHdl, ToolBox*, pToolBox) +{ + const sal_uInt16 nId = pToolBox->GetCurItemId(); + OSL_ASSERT(nId == TBI_SPACING); + if(nId == TBI_SPACING) + { + pToolBox->SetItemDown( nId, true ); + maCharSpacePopup.Rearrange(mbKernLBAvailable,mbKernAvailable,mlKerning); + maCharSpacePopup.Show(*pToolBox); + + } + return 0L; +} + + + + +IMPL_LINK( TextPropertyPanel, ImplPopupModeEndHdl, FloatingWindow*, EMPTYARG ) +{ + 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 SvxColorItem* pItem = (const SvxColorItem*)pState; + maColor = pItem->GetValue(); + mbColorAvailable = true; + if (mpFontColorUpdater) + mpFontColorUpdater->Update(maColor); + } + else + { + mbColorAvailable = false; + maColor.SetColor(COL_AUTO); + if (mpFontColorUpdater) + 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; + if (mpHighlightUpdater) + mpHighlightUpdater->Update(maBackColor); + } + else + { + mbBackColorAvailable = false; + maBackColor.SetColor(COL_AUTO); + if (mpHighlightUpdater) + 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); + } +} + +Color TextPropertyPanel::GetFontColor (void) const +{ + return maColor; +} + +void TextPropertyPanel::SetFontColor ( + const String& rsColorName, + const Color aColor) +{ + SvxColorItem aColorItem(aColor, SID_ATTR_CHAR_COLOR); + mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_COLOR, SFX_CALLMODE_RECORD, &aColorItem, 0L); + maColor = aColor; +} + +Color TextPropertyPanel::GetBrushColor (void) const +{ + return maBackColor; +} + +void TextPropertyPanel::SetBrushColor ( + const String& rsColorName, + const Color aColor) +{ + SvxBrushItem aBrushItem(aColor, SID_ATTR_BRUSH_CHAR); + mpBindings->GetDispatcher()->Execute(SID_ATTR_BRUSH_CHAR, SFX_CALLMODE_RECORD, &aBrushItem, 0L); + maBackColor = aColor; +} + +Color& TextPropertyPanel::GetUnderlineColor() +{ + return meUnderlineColor; +} + +void TextPropertyPanel::SetUnderline(FontUnderline eUnderline) +{ + meUnderline = eUnderline; +} + +} } // end of namespace svx::sidebar diff --git a/svx/source/sidebar/text/TextPropertyPanel.hrc b/svx/source/sidebar/text/TextPropertyPanel.hrc new file mode 100644 index 000000000000..4d1ea4715df5 --- /dev/null +++ b/svx/source/sidebar/text/TextPropertyPanel.hrc @@ -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 VS_UNDERLINE_WIDTH 57 +#define VS_UNDERLINE_HEIGHT 12 * 10 +//#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 + +//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 +#define STR_QH_BOLD 75 +#define STR_QH_ITALIC 76 +#define STR_QH_UNDERLINE 77 + +//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" diff --git a/svx/source/sidebar/text/TextPropertyPanel.hxx b/svx/source/sidebar/text/TextPropertyPanel.hxx new file mode 100644 index 000000000000..05a9c8889f6e --- /dev/null +++ b/svx/source/sidebar/text/TextPropertyPanel.hxx @@ -0,0 +1,246 @@ +/************************************************************** + * + * 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 <vcl/ctrl.hxx> +#include <sfx2/sidebar/SidebarPanelBase.hxx> +#include <sfx2/sidebar/ControllerItem.hxx> +#include <sfx2/sidebar/IContextChangeReceiver.hxx> + +#include <svtools/ctrlbox.hxx> +#include <svx/tbxcolorupdate.hxx> +#include <editeng/svxenum.hxx> +#include <editeng/fhgtitem.hxx> + +//#include <com/sun/star/ui/XUIElement.hpp> +#include <com/sun/star/ui/XSidebar.hpp> + +#include <boost/scoped_ptr.hpp> +#include "TextCharacterSpacingPopup.hxx" +#include "TextUnderlinePopup.hxx" +#include <svx/sidebar/ColorPopup.hxx> +#include <vcl/vclenum.hxx> + +class FloatingWindow; +class ToolBox; + +namespace svx { namespace sidebar { + +class SvxSBFontNameBox; +class PopupControl; +class PopupContainer; + +class TextPropertyPanel + : public Control, + public ::sfx2::sidebar::IContextChangeReceiver, + public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface +{ +public: + static TextPropertyPanel* Create ( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings, + const cssu::Reference<css::ui::XSidebar>& rxSidebar); + + virtual void DataChanged (const DataChangedEvent& rEvent); + SfxBindings* GetBindings(); + ::sfx2::sidebar::ControllerItem& GetSpaceController(); + long GetSelFontSize(); + void SetSpacing(long nKern); + void EndSpacingPopupMode (void); + void EndUnderlinePopupMode (void); + Color GetFontColor (void) const; + void SetFontColor (const String& rsColorName,const Color aColor); + Color GetBrushColor (void) const; + void SetBrushColor (const String& rsColorName,const Color aColor); + void SetUnderline(FontUnderline eUnderline); + Color& GetUnderlineColor(); + void SetDefaultUnderline(FontUnderline eUnderline); + + + enum ColorType + { + FONT_COLOR = 1, + BACK_COLOR = 2 + }; + + 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<Window> mpToolBoxIncDecBackground; + ::boost::scoped_ptr<ToolBox> mpToolBoxIncDec; + ::boost::scoped_ptr<Window> mpToolBoxFontBackground; + ::boost::scoped_ptr<ToolBox> mpToolBoxFont; + ::boost::scoped_ptr<Window> mpToolBoxFontColorBackground; + ::boost::scoped_ptr<ToolBox> mpToolBoxFontColor; + ::boost::scoped_ptr<Window> mpToolBoxScriptBackground; + ::boost::scoped_ptr<ToolBox> mpToolBoxScript; + ::boost::scoped_ptr<Window> mpToolBoxScriptSwBackground; + ::boost::scoped_ptr<ToolBox> mpToolBoxScriptSw; + ::boost::scoped_ptr<Window> mpToolBoxSpacingBackground; + ::boost::scoped_ptr<ToolBox> mpToolBoxSpacing; + ::boost::scoped_ptr<Window> mpToolBoxHighlightBackground; + ::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 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; + TextCharacterSpacingPopup maCharSpacePopup; + TextUnderlinePopup maUnderlinePopup; + ColorPopup maFontColorPopup; + ColorPopup maBrushColorPopup; + + cssu::Reference<css::frame::XFrame> mxFrame; + ::sfx2::sidebar::EnumContext maContext; + SfxBindings* mpBindings; + cssu::Reference<css::ui::XSidebar> mxSidebar; + + TextPropertyPanel ( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings, + const cssu::Reference<css::ui::XSidebar>& rxSidebar); + virtual ~TextPropertyPanel (void); + + + PopupControl* CreateCharacterSpacingControl (PopupContainer* pParent); + PopupControl* CreateFontColorPopupControl (PopupContainer* pParent); + PopupControl* CreateBrushColorPopupControl (PopupContainer* pParent); + PopupControl* CreateUnderlinePopupControl (PopupContainer* pParent); + DECL_LINK(SpacingClickHdl, ToolBox*); + DECL_LINK(ToolBoxFontColorDropHdl, ToolBox *); //for new color picker + DECL_LINK(ToolBoxHighlightDropHdl, ToolBox *); + DECL_LINK(ToolBoxUnderlineClickHdl, ToolBox* ); + + 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(); + + 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(ImplPopupModeEndHdl, FloatingWindow* ); + DECL_LINK(ToolBoxSwScriptSelectHdl, ToolBox *); + DECL_LINK(ToolBoxScriptSelectHdl, ToolBox *); + + + + void TextStyleChanged(); + + Image GetIcon (const ::rtl::OUString& rsURL); +}; + +} } // end of namespace ::svx::sidebar + +#endif diff --git a/svx/source/sidebar/text/TextPropertyPanel.src b/svx/source/sidebar/text/TextPropertyPanel.src new file mode 100644 index 000000000000..b492a9005b71 --- /dev/null +++ b/svx/source/sidebar/text/TextPropertyPanel.src @@ -0,0 +1,801 @@ +/************************************************************** + * + * 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 "TextPropertyPanel.hrc" +#include <sfx2/sidebar/propertypanel.hrc> +#include "helpid.hrc" + +#define CONTROL_HEIGHT_FONT_NAME 250 +#define CONTROL_HEIGHT_FONT_SIZE 180 +#define FONTNAME_WIDTH TOOLBOX_ITEM_WIDTH * 2 + TOOLBOX_ITEM_DD_WIDTH +#define FONTSIZE_WIDTH TOOLBOX_ITEM_WIDTH * 2 + +#define TB_SPACE 18 +#define TB_SPACE_V 4 +#define TEXT_WIDTH TOOLBOX_42_42_ITEM_DD_WIDTH + TB_SPACE - 3 + +#define FT_TB_SPACE 1 +#define BK_IMG 20 + +Control RID_SIDEBAR_TEXT_PANEL +{ + OutputSize = TRUE; + DialogControl = TRUE; + Border = FALSE; + + Size = MAP_APPFONT( PROPERTYPAGE_WIDTH, SECTIONPAGE_MARGIN_VERTICAL_TOP + CBOX_HEIGHT + TOOLBOX_ITEM_HEIGHT * 2 + CONTROL_SPACING_VERTICAL * 2 + SECTIONPAGE_MARGIN_VERTICAL_BOT ); + HelpID = HID_PROPERTYPANEL_TEXT_SECTION ; + Text = "Text"; + + ComboBox CB_SBFONT_FONT + { + Border = TRUE; + Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL , SECTIONPAGE_MARGIN_VERTICAL_TOP ); + Size = MAP_APPFONT ( FONTNAME_WIDTH , CONTROL_HEIGHT_FONT_NAME ); + TabStop = TRUE; + DropDown = TRUE; + HelpID = HID_COMBO_FONT_NAME ; + QuickHelpText [ en-US ] = "Font"; + }; + MetricBox MB_SBFONT_FONTSIZE + { + Border = TRUE; + Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL + FONTNAME_WIDTH + 2, SECTIONPAGE_MARGIN_VERTICAL_TOP); + Size = MAP_APPFONT ( FONTSIZE_WIDTH - 1, CONTROL_HEIGHT_FONT_SIZE ); + TabStop = TRUE; + DropDown = TRUE; + HelpID = HID_METRIC_FONT_SIZE; + QuickHelpText [ en-US ] = "Font Size"; + }; + + ToolBox TB_INCREASE_DECREASE + { + SVLook = TRUE ; + Pos = MAP_APPFONT ( PROPERTYPAGE_WIDTH - SECTIONPAGE_MARGIN_HORIZONTAL - TOOLBOX_ITEM_WIDTH * 2, SECTIONPAGE_MARGIN_VERTICAL_TOP) ; + Size = MAP_APPFONT ( TOOLBOX_ITEM_WIDTH * 2 ,TOOLBOX_ITEM_HEIGHT ) ; + TabStop = TRUE ; +// HelpID = HID_TB_INCREASE_DECREASE; + HelpID = HID_PPROPERTYPANEL_TEXT_TBX_FONTSIZE_INDE; + Text = "Font Size Adjusting" ; + ItemList = + { + ToolBoxItem + { + Identifier = TBI_INCREASE; + Text [ en-US ] = "Increase Font Size" ; +// HelpID = HID_TBI_INCREASE; + HelpID = HID_PPROPERTYPANEL_TEXT_TBI_INCREASE; + }; + ToolBoxItem + { + Identifier = TBI_DECREASE; + Text [ en-US ] = "Decrease Font Size" ; +// HelpID = HID_TBI_DECREASE; + HelpID = HID_PPROPERTYPANEL_TEXT_TBI_DECREASE; + }; + }; + }; + ToolBox TB_FONT + { + SVLook = TRUE ; + Pos = MAP_APPFONT (SECTIONPAGE_MARGIN_HORIZONTAL + 1, SECTIONPAGE_MARGIN_VERTICAL_TOP + CBOX_HEIGHT + CONTROL_SPACING_VERTICAL + 1) ; + Size = MAP_APPFONT ( TOOLBOX_ITEM_WIDTH * 4 + TOOLBOX_ITEM_DD_WIDTH, TOOLBOX_ITEM_HEIGHT ) ; + TabStop = TRUE ; +// HelpID = HID_TB_FONT; + HelpID = HID_PPROPERTYPANEL_TEXT_TBX_FONT; + Text = "Font Effects" ; + ItemList = + { + ToolBoxItem + { + Identifier = TBI_BOLD; + Text [ en-US ] = "Bold" ; +// HelpID = HID_TBI_FONT_BOLD; + HelpID = HID_PPROPERTYPANEL_TEXT_TBI_BOLD; + }; + ToolBoxItem + { + Identifier = TBI_ITALIC; + Text [ en-US ] = "Italic" ; +// HelpID = HID_TBI_FONT_ITALIC; + HelpID = HID_PPROPERTYPANEL_TEXT_TBI_ITALIC; + }; + ToolBoxItem + { + Identifier = TBI_UNDERLINE; + DropDown = TRUE ; + Text [ en-US ] = "Underline" ; +// HelpID = HID_TBI_FONT_UNDERLINE; + HelpID = HID_PPROPERTYPANEL_TEXT_TBI_UNDERLINE; + }; + ToolBoxItem + { + Identifier = TBI_STRIKEOUT; + Text [ en-US ] = "Strikethrough" ; +// HelpID = HID_TBI_FONT_STRIKEOUT; + HelpID = HID_PPROPERTYPANEL_TEXT_TBI_STRIKEOUT; + }; + ToolBoxItem + { + Identifier = TBI_SHADOWED; + Text [ en-US ] = "Shadow" ; +// HelpID = HID_TBI_FONT_SHADOWED; + HelpID = HID_PPROPERTYPANEL_TEXT_TBI_SHADOWED; + }; + }; + }; + + String STR_QH_BOLD + { + Text [ en-US ] = "Bold (Ctrl+B)"; + }; + String STR_QH_ITALIC + { + Text [ en-US ] = "Italic (Ctrl+I)"; + }; + String STR_QH_UNDERLINE + { + Text [ en-US ] = "Underline (Ctrl+U)"; + }; + + + ToolBox TB_FONTCOLOR + { +// HelpID = HID_TB_COLOR; + HelpID = HID_PPROPERTYPANEL_TEXT_TBX_FONT_COLOR; + SVLook = TRUE ; + Pos = MAP_APPFONT (PROPERTYPAGE_WIDTH - SECTIONPAGE_MARGIN_HORIZONTAL - TOOLBOX_ITEM_WIDTH * 2, SECTIONPAGE_MARGIN_VERTICAL_TOP + CBOX_HEIGHT + CONTROL_SPACING_VERTICAL + 1) ; + Size = MAP_APPFONT (TOOLBOX_ITEM_DD_WIDTH ,TOOLBOX_ITEM_HEIGHT ) ; + TabStop = TRUE ; + Text = "Font Color" ; + ItemList = + { + ToolBoxItem + { + Identifier = TBI_FONTCOLOR ; +// HelpID = HID_TBI_COLOR; + HelpID = HID_PPROPERTYPANEL_TEXT_TBI_FONT_COLOR; + DropDown = TRUE ; + Text [ en-US ] = "Font Color" ; + }; + }; + }; + + ToolBox TB_HIGHLIGHT + { + SVLook = TRUE ; + Pos = MAP_APPFONT (PROPERTYPAGE_WIDTH - SECTIONPAGE_MARGIN_HORIZONTAL - TOOLBOX_ITEM_WIDTH * 2 , SECTIONPAGE_MARGIN_VERTICAL_TOP + CBOX_HEIGHT + (TOOLBOX_ITEM_HEIGHT + 2) + CONTROL_SPACING_VERTICAL * 2 + 1) ; + Size = MAP_APPFONT (TOOLBOX_ITEM_DD_WIDTH ,TOOLBOX_ITEM_HEIGHT ) ; + TabStop = TRUE ; +// HelpID = HID_TB_HIGHLIGHT; + HelpID = HID_PPROPERTYPANEL_TEXT_TBX_HIGHLIGHT_COLOR; + Text = "Highlight Color" ; + ItemList = + { + ToolBoxItem + { + Identifier = TBI_HIGHLIGHT ; +// HelpID = HID_TBI_HIGHLIGHT; + HelpID = HID_PPROPERTYPANEL_TEXT_TBI_HIGHLIGHT_COLOR; + DropDown = TRUE ; + Text [ en-US ] = "Highlight Color" ; + }; + }; + }; + + ToolBox TB_SCRIPT_SW + { + SVLook = TRUE ; + Pos = MAP_APPFONT (SECTIONPAGE_MARGIN_HORIZONTAL + 1 , SECTIONPAGE_MARGIN_VERTICAL_TOP + CBOX_HEIGHT + CONTROL_SPACING_VERTICAL * 2 + (TOOLBOX_ITEM_HEIGHT + 2) + 1) ; + Size = MAP_APPFONT (TOOLBOX_ITEM_WIDTH * 2 ,TOOLBOX_ITEM_HEIGHT ) ; + TabStop = TRUE ; +// HelpID = HID_TB_SCRIPT_SW; + HelpID = HID_PPROPERTYPANEL_TEXT_TBX_SCRIPT_SW; + Text = "Font Position" ; + ItemList = + { + ToolBoxItem + { + Identifier = TBI_SUPER_SW; + Text [ en-US ] = "Superscript" ; +// HelpID = HID_TBI_SCRIPT_SW_SUPER; + HelpID = HID_PPROPERTYPANEL_TEXT_TBI_SUPER_SW; + }; + ToolBoxItem + { + Identifier = TBI_SUB_SW; + Text [ en-US ] = "Subscript" ; +// HelpID = HID_TBI_SCRIPT_SW_SUB; + HelpID = HID_PPROPERTYPANEL_TEXT_TBI_SUB_SW; + }; + }; + }; + ToolBox TB_SCRIPT + { + SVLook = TRUE ; + Pos = MAP_APPFONT (SECTIONPAGE_MARGIN_HORIZONTAL + 1 , SECTIONPAGE_MARGIN_VERTICAL_TOP + CBOX_HEIGHT + CONTROL_SPACING_VERTICAL * 2 + (TOOLBOX_ITEM_HEIGHT + 2) + 1) ; + Size = MAP_APPFONT (TOOLBOX_ITEM_WIDTH * 2 ,TOOLBOX_ITEM_HEIGHT ) ; + TabStop = TRUE ; +// HelpID = HID_TB_SCRIPT; + HelpID = HID_PPROPERTYPANEL_TEXT_TBX_SCRIPT; + Text = "Font Position" ; + ItemList = + { + ToolBoxItem + { + Identifier = TBI_SUPER; + Text [ en-US ] = "Superscript" ; +// HelpID = HID_TBI_SCRIPT_SUPER; + HelpID = HID_PPROPERTYPANEL_TEXT_TBI_SUPER; + }; + ToolBoxItem + { + Identifier = TBI_SUB; + Text [ en-US ] = "Subscript" ; +// HelpID = HID_TBI_SCRIPT_SUB; + HelpID = HID_PPROPERTYPANEL_TEXT_TBI_SUB; + }; + }; + }; + + ToolBox TB_SPACING + { + SVLook = TRUE ; + Pos = MAP_APPFONT (SECTIONPAGE_MARGIN_HORIZONTAL + 1 + TOOLBOX_ITEM_WIDTH * 2 + 4 , SECTIONPAGE_MARGIN_VERTICAL_TOP + CBOX_HEIGHT + CONTROL_SPACING_VERTICAL * 2 + (TOOLBOX_ITEM_HEIGHT + 2) + 1) ; + Size = MAP_APPFONT (TOOLBOX_24_16_ITEM_DD_WIDTH, TOOLBOX_24_16_ITEM_HEIGHT ) ; + TabStop = TRUE ; + HelpID = HID_TB_SPACING; + Text = "Character Spacing" ; + ItemList = + { + ToolBoxItem + { + Identifier = TBI_SPACING; + DropDown = TRUE ; + Text [ en-US ] = "Character Spacing" ; + HelpID = HID_TBI_SPACING; + }; + }; + }; + + Image IMG_INCREASE + { + ImageBitmap = Bitmap{File = "symphony/enlarge font.png";}; + // MaskColor = IMAGE_MASK_COLOR; + }; + Image IMG_INCREASE_H + { + ImageBitmap = Bitmap{File = "symphony/enlarge font.png";}; + }; + Image IMG_DECREASE + { + ImageBitmap = Bitmap{File = "symphony/decrease font.png";}; + }; + Image IMG_DECREASE_H + { + ImageBitmap = Bitmap{File = "symphony/decrease font.png";}; + }; + Image IMG_BOLD + { + ImageBitmap = Bitmap{File = "symphony/sc_bold.png";};//sc_bold.bmp + }; + Image IMG_BOLD_H + { + ImageBitmap = Bitmap{File = "symphony/sc_bold.png";}; + }; + Image IMG_ITALIC + { + ImageBitmap = Bitmap{File = "symphony/sc_italic.png";};//sc_italic.bmp + }; + Image IMG_ITALIC_H + { + ImageBitmap = Bitmap{File = "symphony/sc_italic.png";}; + }; + Image IMG_UNDERLINE + { + ImageBitmap = Bitmap{File = "symphony/sc_underline.png";};//sc_underline.png + }; + Image IMG_UNDERLINE_H + { + ImageBitmap = Bitmap{File = "symphony/sc_underline.png";}; + }; + + Image IMG_STRIKEOUT + { + ImageBitmap = Bitmap{File = "symphony/sc_strikeout.png";};//sc_strikeout.png + }; + Image IMG_STRIKEOUT_H + { + ImageBitmap = Bitmap{File = "symphony/sc_strikeout.png";}; + }; + Image IMG_SHADOWED + { + ImageBitmap = Bitmap{File = "symphony/sc_shadowed.png";};//sc_shadowed.png + }; + Image IMG_SHADOWED_H + { + ImageBitmap = Bitmap{File = "symphony/sc_shadowed.png";}; + }; + Image IMG_FONTCOLOR + { + ImageBitmap = Bitmap{File = "symphony/sc_color.png";}; + }; + Image IMG_FONTCOLOR_H + { + ImageBitmap = Bitmap{File = "symphony/sc_color.png";}; + }; + Image IMG_SUPSCRIPT + { + ImageBitmap = Bitmap{File = "symphony/sc_superscript.png";}; + }; + Image IMG_SUPSCRIPT_H + { + ImageBitmap = Bitmap{File = "symphony/sc_superscript.png";}; + }; + Image IMG_SUBSCRIPT + { + ImageBitmap = Bitmap{File = "symphony/sc_subscript.png";}; + }; + Image IMG_SUBSCRIPT_H + { + ImageBitmap = Bitmap{File = "symphony/sc_subscript.png";}; + }; +// Image IMG_SPACING +// { +// ImageBitmap = Bitmap{File = "symphony/icon_normal.png";}; +// }; +// Image IMG_SPACING_H +// { +// ImageBitmap = Bitmap{File = "symphony/icon_normal.png";}; +// }; + Image IMG_HIGHLIGHT + { + ImageBitmap = Bitmap{File = "symphony/Highlight.png";};//sc_backcolor + }; + Image IMG_HIGHLIGHT_H + { + ImageBitmap = Bitmap{File = "symphony/Highlight.png";}; + }; + + //small icon for spacing + Image IMG_SPACING_D + { + ImageBitmap = Bitmap{File = "symphony/icon_normal.png";}; + }; +}; + +Control RID_POPUPPANEL_TEXTPAGE_UNDERLINE +{ + OutputSize = TRUE; + DialogControl = TRUE; + Border = FALSE; + + Size = MAP_APPFONT( POPUPPANEL_MARGIN_SMALL * 2 + POPUP_BORDER_WIDTH + VS_UNDERLINE_WIDTH, 13+ VS_UNDERLINE_HEIGHT + POPUP_BORDER_HEIGHT + POPUPPANEL_MARGIN_SMALL * 2 + POPUPPANEL_MARGIN_LARGE); + Control VS_UNDERLINE + { +// HelpID = HID_UNDERLINE_VS ; + HelpID = HID_PPROPERTYPANEL_TEXT_UNDERLINE_VS; + Hide = TRUE ; + Pos = MAP_APPFONT( POPUPPANEL_MARGIN_SMALL + OFFSET_X , POPUPPANEL_MARGIN_SMALL + OFFSET_Y ); + Size = MAP_APPFONT ( VS_UNDERLINE_WIDTH ,VS_UNDERLINE_HEIGHT); + TabStop = TRUE ; + Text = "Underline"; + }; + + PushButton PB_OPTIONS + { + HelpID = HID_UNDERLINE_BTN; + Pos = MAP_APPFONT ( POPUPPANEL_MARGIN_SMALL + OFFSET_X , POPUPPANEL_MARGIN_SMALL * 2 + OFFSET_Y + VS_UNDERLINE_HEIGHT ); + Size = MAP_APPFONT ( VS_UNDERLINE_WIDTH, 13 ); + TabStop = TRUE; + Text [ en-US ] = "~More Options..."; + }; + + + Image IMG_SINGLE + { + ImageBitmap = Bitmap{File = "symphony/line1.bmp";}; + }; + Image IMG_DOUBLE + { + ImageBitmap = Bitmap{File = "symphony/line2.bmp";}; + }; + Image IMG_BOLD2 + { + ImageBitmap = Bitmap{File = "symphony/line3.bmp";}; + }; + Image IMG_DOT + { + ImageBitmap = Bitmap{File = "symphony/line4.bmp";}; + }; + Image IMG_DOT_BOLD + { + ImageBitmap = Bitmap{File = "symphony/line5.bmp";}; + }; + Image IMG_DASH + { + ImageBitmap = Bitmap{File = "symphony/line6.bmp";}; + }; + Image IMG_DASH_LONG + { + ImageBitmap = Bitmap{File = "symphony/line7.bmp";}; + }; + Image IMG_DASH_DOT + { + ImageBitmap = Bitmap{File = "symphony/line8.bmp";}; + }; + Image IMG_DASH_DOT_DOT + { + ImageBitmap = Bitmap{File = "symphony/line9.bmp";}; + }; + Image IMG_WAVE + { + ImageBitmap = Bitmap{File = "symphony/line10.bmp";}; + }; + + //high contract + Image IMG_SINGLE_H + { + ImageBitmap = Bitmap{File = "symphony/line1_h.bmp";}; + }; + Image IMG_DOUBLE_H + { + ImageBitmap = Bitmap{File = "symphony/line2_h.bmp";}; + }; + Image IMG_BOLD2_H + { + ImageBitmap = Bitmap{File = "symphony/line3_h.bmp";}; + }; + Image IMG_DOT_H + { + ImageBitmap = Bitmap{File = "symphony/line4_h.bmp";}; + }; + Image IMG_DOT_BOLD_H + { + ImageBitmap = Bitmap{File = "symphony/line5_h.bmp";}; + }; + Image IMG_DASH_H + { + ImageBitmap = Bitmap{File = "symphony/line6_h.bmp";}; + }; + Image IMG_DASH_LONG_H + { + ImageBitmap = Bitmap{File = "symphony/line7_h.bmp";}; + }; + Image IMG_DASH_DOT_H + { + ImageBitmap = Bitmap{File = "symphony/line8_h.bmp";}; + }; + Image IMG_DASH_DOT_DOT_H + { + ImageBitmap = Bitmap{File = "symphony/line9_h.bmp";}; + }; + Image IMG_WAVE_H + { + ImageBitmap = Bitmap{File = "symphony/line10_h.bmp";}; + }; + + //image when selected + Image IMG_SINGLE_SEL + { + ImageBitmap = Bitmap{File = "symphony/selected-line1.bmp";}; + }; + Image IMG_DOUBLE_SEL + { + ImageBitmap = Bitmap{File = "symphony/selected-line2.bmp";}; + }; + Image IMG_BOLD2_SEL + { + ImageBitmap = Bitmap{File = "symphony/selected-line3.bmp";}; + }; + Image IMG_DOT_SEL + { + ImageBitmap = Bitmap{File = "symphony/selected-line4.bmp";}; + }; + Image IMG_DOT_BOLD_SEL + { + ImageBitmap = Bitmap{File = "symphony/selected-line5.bmp";}; + }; + Image IMG_DASH_SEL + { + ImageBitmap = Bitmap{File = "symphony/selected-line6.bmp";}; + }; + Image IMG_DASH_LONG_SEL + { + ImageBitmap = Bitmap{File = "symphony/selected-line7.bmp";}; + }; + Image IMG_DASH_DOT_SEL + { + ImageBitmap = Bitmap{File = "symphony/selected-line8.bmp";}; + }; + Image IMG_DASH_DOT_DOT_SEL + { + ImageBitmap = Bitmap{File = "symphony/selected-line9.bmp";}; + }; + Image IMG_WAVE_SEL + { + ImageBitmap = Bitmap{File = "symphony/selected-line10.bmp";}; + }; + +// //more button bmps +// Bitmap BMP_UNDERLINE_MORE +// { +// File = "symphony/morebutton.bmp"; +// }; +// Bitmap BMP_UNDERLINE_MORE_H +// { +// File = "symphony/morebutton_h.bmp"; +// }; + + //tips + String STR_SINGLE + { + Text [ en-US ] = "Single"; + }; + String STR_DOUBLE + { + Text [ en-US ] = "Double"; + }; + String STR_BOLD + { + Text [ en-US ] = "Bold"; + }; + String STR_DOT + { + Text [ en-US ] = "Dotted"; + }; + String STR_DOT_BOLD + { + Text [ en-US ] = "Dotted (Bold)"; + }; + String STR_DASH + { + Text [ en-US ] = "Dash"; + }; + String STR_DASH_LONG + { + Text [ en-US ] = "Long Dash"; + }; + String STR_DASH_DOT + { + Text [ en-US ] = "Dot Dash"; + }; + String STR_DASH_DOT_DOT + { + Text [ en-US ] = "Dot Dot Dash"; + }; + String STR_WAVE + { + Text [ en-US ] = "Wave"; + }; + +}; + + +Control RID_POPUPPANEL_TEXTPAGE_FONT_COLOR +{ + OutputSize = TRUE; + DialogControl = TRUE; + Border = FALSE; + Size = MAP_APPFONT( POPUP_COLOR_PICKER_WIDTH , POPUP_COLOR_PICKER_HEIGHT ); + + Control VS_FONT_COLOR + { +// HelpID = HID_COLOR_VS ; + HelpID = HID_PPROPERTYPANEL_TEXT_COLOR_VS; + Hide = TRUE ; + Pos = MAP_APPFONT ( OFFSET_X , OFFSET_Y ); + Size = MAP_APPFONT ( POPUP_COLOR_PICKER_WIDTH - OFFSET_X * 2, POPUP_COLOR_PICKER_HEIGHT - OFFSET_Y * 2); + TabStop = TRUE ; + Text = "Color Picker"; + }; + String STR_AUTOMATICE + { + Text [ en-US ] = "Automatic"; + }; + +}; + +Control RID_POPUPPANEL_TEXTPAGE_SPACING +{ + OutputSize = TRUE; + DialogControl = TRUE; + Border = FALSE; + + Size = MAP_APPFONT( POPUPPANEL_MARGIN_SMALL * 2 + POPUP_BORDER_WIDTH + VS_SPACING_WIDTH , POPUPPANEL_MARGIN_SMALL * 3 + 15 * 6 + CUSTOM_HEIGHT + TEXT_HEIGHT + POPUPPANEL_MARGIN_LARGE + POPUP_BORDER_WIDTH + 1); + + Control VS_SPACING + { + HelpId = HID_PPROPERTYPANEL_TEXT_SPACING_VS ; + Hide = TRUE ; + Pos = MAP_APPFONT( POPUPPANEL_MARGIN_SMALL + OFFSET_X , POPUPPANEL_MARGIN_SMALL + OFFSET_Y ); + Size = MAP_APPFONT ( VS_SPACING_WIDTH , 15 * 6); + TabStop = TRUE ; + Text = "Character Spacing"; + }; + + FixedText FT_LASTCUSTOM + { + Pos = MAP_APPFONT ( POPUPPANEL_MARGIN_LARGE + OFFSET_X ,POPUPPANEL_MARGIN_SMALL + OFFSET_Y + POPUPPANEL_MARGIN_SMALL + 15 * 6) ; + Size = MAP_APPFONT ( CUSTOM_WIDTH , TEXT_HEIGHT ); + Left = TRUE ; + Text [ en-US ] = "Custom:" ; + }; + //custom area +// Control CT_BORDER +// { +// Pos = MAP_APPFONT ( POPUPPANEL_MARGIN_LARGE + OFFSET_X + 1 , OFFSET_Y + POPUPPANEL_MARGIN_SMALL * 3 + 15 * 6 + TEXT_HEIGHT) ; +// Size = MAP_APPFONT (CUSTOM_WIDTH , CUSTOM_HEIGHT ) ;// TOOLBOX_42_42_ITEM_DD_WIDTH * 2 + TB_SPACE * 2 - 5 + TEXT_WIDTH - 2 +// DialogControl = TRUE; +// }; + FixedText FT_SPACING + { + Pos = MAP_APPFONT ( CUSTOM_X + POPUPPANEL_MARGIN_LARGE, CUSTOM_Y + POPUPPANEL_MARGIN_LARGE); + Size = MAP_APPFONT ( CUSTOM_WIDTH - POPUPPANEL_MARGIN_LARGE * 2 , TEXT_HEIGHT ); + Left = TRUE ; + Text [ en-US ] = "~Character spacing: " ; + }; + ListBox LB_KERNING + { + Border = TRUE; + Pos = MAP_APPFONT ( CUSTOM_X + POPUPPANEL_MARGIN_LARGE, CUSTOM_Y + POPUPPANEL_MARGIN_LARGE + TEXT_HEIGHT + POPUPPANEL_MARGIN_SMALL);//20 + Size = MAP_APPFONT ( CUSTOM_WIDTH - POPUPPANEL_MARGIN_LARGE * 2 , 80 ) ; + TabStop = TRUE; + DropDown = TRUE ; + HelpID = HID_SPACING_CB_KERN; + StringList [ en-US ] = + { + < "Default" ; Default ; > ; + < "Expanded" ; Default ; > ; + < "Condensed" ; Default ; > ; + }; + }; + FixedText FT_BY + { + Pos = MAP_APPFONT ( CUSTOM_X + POPUPPANEL_MARGIN_LARGE, CUSTOM_Y + POPUPPANEL_MARGIN_LARGE * 2 + TEXT_HEIGHT + POPUPPANEL_MARGIN_SMALL + CBOX_HEIGHT ); + Size = MAP_APPFONT ( CUSTOM_WIDTH - POPUPPANEL_MARGIN_LARGE * 2 , TEXT_HEIGHT ); + Left = TRUE ; + Text [ en-US ] = "Change ~by: " ; + }; + MetricField ED_KERNING + { + HelpID = HID_SPACING_MB_KERN; + Border = TRUE; + Pos = MAP_APPFONT ( CUSTOM_X + POPUPPANEL_MARGIN_LARGE, CUSTOM_Y + POPUPPANEL_MARGIN_LARGE * 2 + TEXT_HEIGHT * 2 + POPUPPANEL_MARGIN_SMALL * 2 + CBOX_HEIGHT);//60 + Size = MAP_APPFONT ( CUSTOM_WIDTH - POPUPPANEL_MARGIN_LARGE * 2 , MBOX_HEIGHT ); + TabStop = TRUE; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 9999 ; + DecimalDigits = 1 ; + Unit = FUNIT_POINT ; + SpinSize = 10 ; + }; + + Image IMG_NORMAL + { + ImageBitmap = Bitmap{File = "symphony/spacing_normal.bmp" ;};//"spacing_normal.bmp" + }; + Image IMG_VERY_TIGHT + { + ImageBitmap = Bitmap{File = "symphony/spacing_very tight.bmp";}; + }; + Image IMG_TIGHT + { + ImageBitmap = Bitmap{File = "symphony/spacing_tight.bmp";}; + }; + Image IMG_LOOSE + { + ImageBitmap = Bitmap{File = "symphony/spacing_loose.bmp";}; + }; + Image IMG_VERY_LOOSE + { + ImageBitmap = Bitmap{File = "symphony/spacing_very loose.bmp";}; + }; + + Image IMG_NORMAL_S + { + ImageBitmap = Bitmap{File = "symphony/spacing_normal_s.bmp";}; + }; + Image IMG_VERY_TIGHT_S + { + ImageBitmap = Bitmap{File = "symphony/spacing_very tight_s.bmp";}; + }; + Image IMG_TIGHT_S + { + ImageBitmap = Bitmap{File = "symphony/spacing_tight_s.bmp";}; + }; + Image IMG_LOOSE_S + { + ImageBitmap = Bitmap{File = "symphony/spacing_loose_s.bmp";}; + }; + Image IMG_VERY_LOOSE_S + { + ImageBitmap = Bitmap{File = "symphony/spacing_very loose_s.bmp";}; + }; + + Image IMG_CUSTOM + { + ImageBitmap = Bitmap{File = "symphony/last_custom_common.png";}; + }; + Image IMG_CUSTOM_GRAY + { + ImageBitmap = Bitmap{File = "symphony/last_custom_common_grey.png";}; + }; + + String STR_VERY_TIGHT + { + Text [ en-US ] = "Very Tight"; + }; + String STR_TIGHT + { + Text [ en-US ] = "Tight"; + }; + String STR_NORMAL + { + Text [ en-US ] = "Normal"; + }; + String STR_LOOSE + { + Text [ en-US ] = "Loose"; + }; + String STR_VERY_LOOSE + { + Text [ en-US ] = "Very Loose"; + }; + String STR_CUSTOM + { + Text [ en-US ] = "Last Custom Value"; + }; + + String STR_VERY_TIGHT_TIP + { + Text [ en-US ] = " Spacing: Condensed By: 3pt"; + }; + String STR_TIGHT_TIP + { + Text [ en-US ] = " Spacing: Condensed By: 1.5pt"; + }; + String STR_NORMAL_TIP + { + Text [ en-US ] = " Spacing: Normal"; + }; + String STR_LOOSE_TIP + { + Text [ en-US ] = " Spacing: Expanded By: 3pt"; + }; + String STR_VERY_LOOSE_TIP + { + Text [ en-US ] = " Spacing: Expanded By: 6pt"; + }; + String STR_CUSTOM_C_TIP + { + Text [ en-US ] = " Spacing: Condensed By: "; + }; + String STR_CUSTOM_E_TIP + { + Text [ en-US ] = " Spacing: Expanded By: "; + }; + String STR_PT + { + Text[ en-US ] = "pt"; + }; +}; diff --git a/svx/source/sidebar/text/TextUnderlineControl.cxx b/svx/source/sidebar/text/TextUnderlineControl.cxx new file mode 100644 index 000000000000..5ab48be6808e --- /dev/null +++ b/svx/source/sidebar/text/TextUnderlineControl.cxx @@ -0,0 +1,281 @@ +/************************************************************** + * + * 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 "TextUnderlineControl.hxx" +#include "TextPropertyPanel.hrc" +#include <sfx2/sidebar/propertypanel.hrc> +#include <svx/dialogs.hrc> +#include <svx/dialmgr.hxx> +#include <unotools/viewoptions.hxx> +#include <editeng/kernitem.hxx> +#include <sfx2/bindings.hxx> +#include <sfx2/dispatch.hxx> +#include <sfx2/sidebar/Theme.hxx> +#include <editeng/udlnitem.hxx> + +namespace svx { namespace sidebar { + +TextUnderlineControl::TextUnderlineControl(Window* pParent, svx::sidebar::TextPropertyPanel& rPanel) +: svx::sidebar::PopupControl( pParent,SVX_RES(RID_POPUPPANEL_TEXTPAGE_UNDERLINE)) +, mrTextPropertyPanel(rPanel) +, mpBindings(NULL) +, maVSUnderline( this, SVX_RES(VS_UNDERLINE)) +, maPBOptions (this, SVX_RES(PB_OPTIONS) ) + +, maIMGSingle (SVX_RES(IMG_SINGLE)) +, maIMGDouble (SVX_RES(IMG_DOUBLE)) +, maIMGBold (SVX_RES(IMG_BOLD2)) +, maIMGDot (SVX_RES(IMG_DOT)) +, maIMGDotBold (SVX_RES(IMG_DOT_BOLD)) +, maIMGDash (SVX_RES(IMG_DASH)) +, maIMGDashLong (SVX_RES(IMG_DASH_LONG)) +, maIMGDashDot (SVX_RES(IMG_DASH_DOT)) +, maIMGDashDotDot (SVX_RES(IMG_DASH_DOT_DOT)) +, maIMGWave (SVX_RES(IMG_WAVE)) + +// high contrast +, maIMGSingleH (SVX_RES(IMG_SINGLE_H)) +, maIMGDoubleH (SVX_RES(IMG_DOUBLE_H)) +, maIMGBoldH (SVX_RES(IMG_BOLD2_H)) +, maIMGDotH (SVX_RES(IMG_DOT_H)) +, maIMGDotBoldH (SVX_RES(IMG_DOT_BOLD_H)) +, maIMGDashH (SVX_RES(IMG_DASH_H)) +, maIMGDashLongH (SVX_RES(IMG_DASH_LONG_H)) +, maIMGDashDotH (SVX_RES(IMG_DASH_DOT_H)) +, maIMGDashDotDotH(SVX_RES(IMG_DASH_DOT_DOT_H)) +, maIMGWaveH (SVX_RES(IMG_WAVE_H)) + +, maIMGSingleSel (SVX_RES(IMG_SINGLE_SEL)) +, maIMGDoubleSel (SVX_RES(IMG_DOUBLE_SEL)) +, maIMGBoldSel (SVX_RES(IMG_BOLD2_SEL)) +, maIMGDotSel (SVX_RES(IMG_DOT_SEL)) +, maIMGDotBoldSel (SVX_RES(IMG_DOT_BOLD_SEL)) +, maIMGDashSel (SVX_RES(IMG_DASH_SEL)) +, maIMGDashLongSel (SVX_RES(IMG_DASH_LONG_SEL)) +, maIMGDashDotSel (SVX_RES(IMG_DASH_DOT_SEL)) +, maIMGDashDotDotSel (SVX_RES(IMG_DASH_DOT_DOT_SEL)) +, maIMGWaveSel (SVX_RES(IMG_WAVE_SEL)) + +{ + initial(); + FreeResource(); + mpBindings = mrTextPropertyPanel.GetBindings(); +} + +void TextUnderlineControl::initial() +{ + /*maPBOptions.SetDefBkColor(GetSettings().GetStyleSettings().GetHighContrastMode()? + GetSettings().GetStyleSettings().GetMenuColor(): + sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_DropDownBackground ));//Color(244,245,249)//for high contract + maPBOptions.SetHoverBkColor(GetSettings().GetStyleSettings().GetHighContrastMode()? + GetSettings().GetStyleSettings().GetMenuColor(): + sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground ) );//Color( 93, 120, 163 ) + maPBOptions.SetHoverTxtColor( sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Color_PanelTitleFont ) );//Color( 255, 255, 255 ) + maPBOptions.SetIcoPosX( 2);*/ + maVSUnderline.SetColor(GetSettings().GetStyleSettings().GetHighContrastMode()? + GetSettings().GetStyleSettings().GetMenuColor(): + sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground )); + maVSUnderline.SetBackground(GetSettings().GetStyleSettings().GetHighContrastMode()? + GetSettings().GetStyleSettings().GetMenuColor(): + sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground )); + + Link aLink = LINK( this, TextUnderlineControl, PBClickHdl ) ; + maPBOptions.SetClickHdl(aLink); + + maVSUnderline.SetStyle( maVSUnderline.GetStyle()| WB_3DLOOK | WB_NO_DIRECTSELECT );// WB_NAMEFIELD | WB_ITEMBORDER |WB_DOUBLEBORDER | WB_NONEFIELD | + + maVSUnderline.InsertItem(1, maIMGSingle ,String(SVX_RES(STR_SINGLE))); + maVSUnderline.SetItemData(1, (void*)(sal_uInt64)UNDERLINE_SINGLE); + + maVSUnderline.InsertItem(2, maIMGDouble ,String(SVX_RES(STR_DOUBLE))); + maVSUnderline.SetItemData(2, (void*)(sal_uInt64)UNDERLINE_DOUBLE); + + maVSUnderline.InsertItem(3, maIMGBold, String(SVX_RES(STR_BOLD))); + maVSUnderline.SetItemData(3,(void*)(sal_uInt64)UNDERLINE_BOLD); + + maVSUnderline.InsertItem(4, maIMGDot, String(SVX_RES(STR_DOT))); + maVSUnderline.SetItemData(4,(void*)(sal_uInt64)UNDERLINE_DOTTED); + + maVSUnderline.InsertItem(5, maIMGDotBold, String(SVX_RES(STR_DOT_BOLD))); + maVSUnderline.SetItemData(5,(void*)(sal_uInt64)UNDERLINE_BOLDDOTTED); + + maVSUnderline.InsertItem(6, maIMGDash, String(SVX_RES(STR_DASH))); + maVSUnderline.SetItemData(6,(void*)(sal_uInt64)UNDERLINE_DASH); + + maVSUnderline.InsertItem(7, maIMGDashLong,String(SVX_RES(STR_DASH_LONG))); + maVSUnderline.SetItemData(7,(void*)(sal_uInt64)UNDERLINE_LONGDASH); + + maVSUnderline.InsertItem(8, maIMGDashDot, String(SVX_RES(STR_DASH_DOT))); + maVSUnderline.SetItemData(8,(void*)(sal_uInt64)UNDERLINE_DASHDOT); + + maVSUnderline.InsertItem(9, maIMGDashDotDot, String(SVX_RES(STR_DASH_DOT_DOT))); + maVSUnderline.SetItemData(9,(void*)(sal_uInt64)UNDERLINE_DASHDOTDOT); + + maVSUnderline.InsertItem(10, maIMGWave, String(SVX_RES(STR_WAVE))); + maVSUnderline.SetItemData(10,(void*)(sal_uInt64)UNDERLINE_WAVE); + + maVSUnderline.SetColCount( 1 ); + aLink = LINK( this, TextUnderlineControl, VSSelectHdl ) ; + maVSUnderline.SetSelectHdl(aLink); + + maVSUnderline.StartSelection(); + maVSUnderline.Show(); +} + +void TextUnderlineControl::GetFocus() +{ + maVSUnderline.GrabFocus(); +} +void TextUnderlineControl::Rearrange(FontUnderline eLine) +{ + // high contrast + maVSUnderline.SetItemImage(1, GetDisplayBackground().GetColor().IsDark()? maIMGSingleH :maIMGSingle); + maVSUnderline.SetItemImage(2, GetDisplayBackground().GetColor().IsDark()? maIMGDoubleH : maIMGDouble ); + maVSUnderline.SetItemImage(3, GetDisplayBackground().GetColor().IsDark()? maIMGBoldH : maIMGBold); + maVSUnderline.SetItemImage(4, GetDisplayBackground().GetColor().IsDark()? maIMGDotH : maIMGDot); + maVSUnderline.SetItemImage(5, GetDisplayBackground().GetColor().IsDark()? maIMGDotBoldH :maIMGDotBold); + maVSUnderline.SetItemImage(6, GetDisplayBackground().GetColor().IsDark()? maIMGDashH :maIMGDash); + maVSUnderline.SetItemImage(7, GetDisplayBackground().GetColor().IsDark()? maIMGDashLongH : maIMGDashLong); + maVSUnderline.SetItemImage(8, GetDisplayBackground().GetColor().IsDark()? maIMGDashDotH : maIMGDashDot); + maVSUnderline.SetItemImage(9, GetDisplayBackground().GetColor().IsDark()? maIMGDashDotDotH : maIMGDashDotDot); + maVSUnderline.SetItemImage(10, GetDisplayBackground().GetColor().IsDark()? maIMGWaveH : maIMGWave); +// maVSUnderline.SelectItem(0); //delete +// maVSUnderline.SetNoSelection(); + + switch(eLine) + { + case UNDERLINE_SINGLE: + maVSUnderline.SetItemImage(1, maIMGSingleSel); + maVSUnderline.SelectItem(1); //add + maVSUnderline.GrabFocus(); + break; + case UNDERLINE_DOUBLE: + maVSUnderline.SetItemImage(2, maIMGDoubleSel); + maVSUnderline.SelectItem(2); //add + maVSUnderline.GrabFocus(); + break; + case UNDERLINE_BOLD: + maVSUnderline.SetItemImage(3, maIMGBoldSel); + maVSUnderline.SelectItem(3); //add + maVSUnderline.GrabFocus(); + break; + case UNDERLINE_DOTTED: + maVSUnderline.SetItemImage(4, maIMGDotSel); + maVSUnderline.SelectItem(4); //add + maVSUnderline.GrabFocus(); + break; + case UNDERLINE_BOLDDOTTED: + maVSUnderline.SetItemImage(5, maIMGDotBoldSel); + maVSUnderline.SelectItem(5); //add + maVSUnderline.GrabFocus(); + break; + case UNDERLINE_DASH: + maVSUnderline.SetItemImage(6, maIMGDashSel); + maVSUnderline.SelectItem(6); //add + maVSUnderline.GrabFocus(); + break; + case UNDERLINE_LONGDASH: + maVSUnderline.SetItemImage(7, maIMGDashLongSel); + maVSUnderline.SelectItem(7); //add + maVSUnderline.GrabFocus(); + break; + case UNDERLINE_DASHDOT: + maVSUnderline.SetItemImage(8, maIMGDashDotSel); + maVSUnderline.SelectItem(8); //add + maVSUnderline.GrabFocus(); + break; + case UNDERLINE_DASHDOTDOT: + maVSUnderline.SetItemImage(9, maIMGDashDotDotSel); + maVSUnderline.SelectItem(9); //add + maVSUnderline.GrabFocus(); + break; + case UNDERLINE_WAVE: + maVSUnderline.SetItemImage(10, maIMGWaveSel); + maVSUnderline.SelectItem(10); //add + maVSUnderline.GrabFocus(); + break; + case UNDERLINE_NONE: + default: + maVSUnderline.SelectItem(1); + maVSUnderline.SetNoSelection();//add + maPBOptions.GrabFocus(); + } + maVSUnderline.StartSelection(); + //removed + //if(mpPage->meContextType == PROPERTY_CONTEXT_SC_CELL) + // maPBOptions.Disable(); + //else + // maPBOptions.Enable(); + //removed end +} +ValueSet& TextUnderlineControl::GetValueSet() +{ + return maVSUnderline; +} +Control& TextUnderlineControl::GetPB() +{ + return maPBOptions; +} +IMPL_LINK(TextUnderlineControl, VSSelectHdl, void *, pControl) +{ + if(pControl == &maVSUnderline) + { + sal_uInt16 iPos = maVSUnderline.GetSelectItemId(); + FontUnderline eUnderline = (FontUnderline)(sal_uInt64)maVSUnderline.GetItemData( iPos ); + + //<<modified + //SvxTextLineItem aLineItem(eUnderline, SID_ATTR_CHAR_UNDERLINE); + SvxUnderlineItem aLineItem(eUnderline, SID_ATTR_CHAR_UNDERLINE); + //modify end>> + + //<<add , this line of code will keep the new underline use pre-color + aLineItem.SetColor(mrTextPropertyPanel.GetUnderlineColor()); + //add end>> + mpBindings->GetDispatcher()->Execute(SID_ATTR_CHAR_UNDERLINE, SFX_CALLMODE_RECORD, &aLineItem, 0L); + + //add , for the popup page not update immediately + mrTextPropertyPanel.SetUnderline(eUnderline); + //add end + //mrTextPropertyPanel.SetDefaultUnderline(eUnderline); + + mrTextPropertyPanel.EndUnderlinePopupMode(); + } + return( 0L ); +} + +IMPL_LINK(TextUnderlineControl, PBClickHdl, PushButton *, pPBtn) +{ + if(pPBtn == &maPBOptions) + { + if (mpBindings) + { + SfxDispatcher* pDisp = mpBindings->GetDispatcher(); + pDisp->Execute( SID_CHAR_DLG_EFFECT, SFX_CALLMODE_ASYNCHRON ); + } + //add + mrTextPropertyPanel.EndUnderlinePopupMode(); + //add end + } + return 0; +} + +}} diff --git a/svx/source/sidebar/text/TextUnderlineControl.hxx b/svx/source/sidebar/text/TextUnderlineControl.hxx new file mode 100644 index 000000000000..a579934f0fad --- /dev/null +++ b/svx/source/sidebar/text/TextUnderlineControl.hxx @@ -0,0 +1,94 @@ +/************************************************************** + * + * 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_UNDERLINE_CONTROL_HXX_ +#define _SVX_SIDEBAR_UNDERLINE_CONTROL_HXX_ + +#include "svx/sidebar/PopupControl.hxx" +#include <sfx2/bindings.hxx> +#include <svtools/ctrlbox.hxx> +#include <svtools/ctrltool.hxx> +#include "TextPropertyPanel.hxx" +#include <vcl/fixed.hxx> +#include <vcl/button.hxx> + +#include <vcl/vclenum.hxx> +#include <svtools/valueset.hxx> + +namespace svx{ namespace sidebar { + +class TextUnderlineControl:public svx::sidebar::PopupControl +{ +public: + TextUnderlineControl(Window* pParent, svx::sidebar::TextPropertyPanel& rPanel); + void GetFocus(); + void Rearrange(FontUnderline eLine); + ValueSet& GetValueSet(); + Control& GetPB(); +private: + svx::sidebar::TextPropertyPanel& mrTextPropertyPanel; + SfxBindings* mpBindings; + ValueSet maVSUnderline; + PushButton maPBOptions; + + Image maIMGSingle; + Image maIMGDouble; + Image maIMGBold; + Image maIMGDot; + Image maIMGDotBold; + Image maIMGDash; + Image maIMGDashLong; + Image maIMGDashDot; + Image maIMGDashDotDot; + Image maIMGWave; + + //add for high contract + Image maIMGSingleH; + Image maIMGDoubleH; + Image maIMGBoldH; + Image maIMGDotH; + Image maIMGDotBoldH; + Image maIMGDashH; + Image maIMGDashLongH; + Image maIMGDashDotH; + Image maIMGDashDotDotH; + Image maIMGWaveH; + + Image maIMGSingleSel; + Image maIMGDoubleSel; + Image maIMGBoldSel; + Image maIMGDotSel; + Image maIMGDotBoldSel; + Image maIMGDashSel; + Image maIMGDashLongSel; + Image maIMGDashDotSel; + Image maIMGDashDotDotSel; + Image maIMGWaveSel; + + void initial(); + + DECL_LINK( PBClickHdl, PushButton *); + DECL_LINK(VSSelectHdl, void *); +}; +}} + + +#endif + diff --git a/svx/source/sidebar/text/TextUnderlinePopup.cxx b/svx/source/sidebar/text/TextUnderlinePopup.cxx new file mode 100644 index 000000000000..307eda3909aa --- /dev/null +++ b/svx/source/sidebar/text/TextUnderlinePopup.cxx @@ -0,0 +1,60 @@ +/************************************************************** + * + * 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 "TextUnderlinePopup.hxx" +#include "TextUnderlineControl.hxx" + + +namespace svx { namespace sidebar { + +TextUnderlinePopup::TextUnderlinePopup ( + Window* pParent, + const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator) + : Popup( + pParent, + rControlCreator, + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Character Spacing"))) +{ +} + + + + +TextUnderlinePopup::~TextUnderlinePopup (void) +{ +} + + + + +void TextUnderlinePopup::Rearrange (FontUnderline eLine) +{ + ProvideContainerAndControl(); + + TextUnderlineControl* pControl = dynamic_cast<TextUnderlineControl*>(mpControl.get()); + if (pControl != NULL) + pControl->Rearrange(eLine); +} + + +} } // end of namespace svx::sidebar + + diff --git a/svx/source/sidebar/text/TextUnderlinePopup.hxx b/svx/source/sidebar/text/TextUnderlinePopup.hxx new file mode 100644 index 000000000000..8343590e02bc --- /dev/null +++ b/svx/source/sidebar/text/TextUnderlinePopup.hxx @@ -0,0 +1,47 @@ +/************************************************************** + * + * 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_UNDERLINE_POPUP_HXX_ +#define _SVX_SIDEBAR_UNDERLINE_POPUP_HXX_ + +#include "svx/sidebar/Popup.hxx" + +#include <boost/function.hpp> +#include <vcl/vclenum.hxx> +namespace svx { namespace sidebar { + +class TextUnderlinePopup + : public Popup +{ +public : + TextUnderlinePopup ( + Window* pParent, + const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator); + ~TextUnderlinePopup (void); + + void Rearrange (FontUnderline eLine); +}; + +} } // end of namespace svx::sidebar + +#endif + + |