You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by zh...@apache.org on 2013/03/21 21:23:21 UTC
svn commit: r1459509 [2/5] - in /openoffice/branches/sidebar/main:
default_images/svx/res/ default_images/svx/res/symphony/
default_images/sw/res/sidebar/
officecfg/registry/data/org/openoffice/Office/UI/ sc/sdi/
sc/source/ui/drawfunc/ sc/source/ui/inc...
Added: openoffice/branches/sidebar/main/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx?rev=1459509&view=auto
==============================================================================
--- openoffice/branches/sidebar/main/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx (added)
+++ openoffice/branches/sidebar/main/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx Thu Mar 21 20:23:16 2013
@@ -0,0 +1,813 @@
+/**************************************************************
+ *
+ * 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 "ParaLineSpacingControl.hxx"
+#include "ParaPropertyPanel.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 <svtools/unitconv.hxx>
+
+#define _DEFAULT_LINE_SPACING 200
+#define FIX_DIST_DEF 283
+#define LINESPACE_1 100
+#define LINESPACE_15 150
+#define LINESPACE_2 200
+#define LINESPACE_115 115
+
+#define LLINESPACE_1 0
+#define LLINESPACE_15 1
+#define LLINESPACE_2 2
+#define LLINESPACE_PROP 3
+#define LLINESPACE_MIN 4
+#define LLINESPACE_DURCH 5
+#define LLINESPACE_FIX 6
+
+#define DO_NOT_CUSTOM 0
+#define USE_CUSTOM 1
+
+namespace svx { namespace sidebar {
+
+
+ParaLineSpacingControl::ParaLineSpacingControl(Window* pParent, svx::sidebar::ParaPropertyPanel& rPanel)
+: PopupControl( pParent,SVX_RES(RID_POPUPPANEL_PARAPAGE_LINESPACING))
+, mrParaPropertyPanel(rPanel)
+, mpBindings(NULL)
+,aLineDist ( this, SVX_RES( LB_LINE_SPACING )),
+aLineDistAtPercentBox ( this, SVX_RES( ED_SBINDE_LINEDISTPERCENT ) ),
+aLineDistAtMetricBox ( this, SVX_RES( ED_SBINDE_LINEDISTPOINT ) ),
+maCustomFT ( this, SVX_RES( FT_CUSTOM ) ),
+maLSpacingFT ( this, SVX_RES( FT_LINE_SPACING ) ),
+maOfFT ( this, SVX_RES( FT_OF ) ),
+maSpacing1 (SVX_RES(IMG_SPACING1)),
+maSpacing115 (SVX_RES(IMG_SPACING115)),
+maSpacing15 (SVX_RES(IMG_SPACING15)),
+maSpacing2 (SVX_RES(IMG_SPACING2)),
+maLPCustom (SVX_RES(IMG_SPACINGLCUSTOM)),
+maSelSpacing1 (SVX_RES(IMG_SEL_SPACING1)),
+maSelSpacing115 (SVX_RES(IMG_SEL_SPACING115)),
+maSelSpacing15 (SVX_RES(IMG_SEL_SPACING15)),
+maSelSpacing2 (SVX_RES(IMG_SEL_SPACING2)),
+maImgCusGrey (SVX_RES(IMG_CUSTOM_GRAY)),
+maImgCus (SVX_RES(IMG_CUSTOM)),
+maStrCus (SVX_RES(STR_LCVALUE)),
+pActLineDistFld ( &aLineDistAtPercentBox ),
+nMinFixDist ( BEGIN_VALUE ),
+maValue ( 0 ),
+maPos ( 0 ),
+maLineSpacing (ValueSetWithTextControl::IMAGE_TEXT,this, SVX_RES( LINE_SPACING ) ),
+mpImg (NULL),
+mpImgSel (NULL),
+mpStr (NULL),
+mpStrTip (NULL),
+maLine (SVX_RES(STR_LSPACING)),
+maOf (SVX_RES(STR_LS_OF))
+, mbUseLineSPCustom (0)
+, mbLineSPDisable (0)
+{
+ initial();
+ FreeResource();
+ mpBindings = mrParaPropertyPanel.GetBindings();
+// m_eLNSpaceUnit = mrParaPropertyPanel.maLNSpaceControl.GetCoreMetric();
+ m_eLNSpaceUnit = SFX_MAPUNIT_100TH_MM;
+}
+ParaLineSpacingControl::~ParaLineSpacingControl()
+{
+ delete[] mpImg;
+ delete[] mpImgSel;
+ delete[] mpStr;
+ delete[] mpStrTip;
+}
+/*void TextCharacterSpacingControl::Paint(const Rectangle& rect)
+{
+ svx::sidebar::PopupControl::Paint(rect);
+ Color aOldLineColor = GetLineColor();
+ Color aOldFillColor = GetFillColor();
+
+ //Point aPos = maBorder.GetPosPixel();
+ //Size aSize = maBorder.GetSizePixel();
+ Point aPos( LogicToPixel( Point( CUSTOM_X, CUSTOM_Y), MAP_APPFONT ));
+ Size aSize( LogicToPixel( Size( CUSTOM_WIDTH, CUSTOM_HEIGHT ), MAP_APPFONT ));
+ Rectangle aRect( aPos, aSize );
+ aRect.Left() -= 1;
+ aRect.Top() -= 1;
+ aRect.Right() += 1;
+ aRect.Bottom() += 1;
+
+
+ Color aLineColor(189,201,219);
+ if(!GetSettings().GetStyleSettings().GetHighContrastMode())
+ SetLineColor(aLineColor);
+ else
+ SetLineColor(GetSettings().GetStyleSettings().GetShadowColor());
+ SetFillColor(COL_TRANSPARENT);
+ //add for high contract
+ //if(GetSettings().GetStyleSettings().GetHighContrastMode())
+ //{
+ // maBorder.SetBackground(GetSettings().GetStyleSettings().GetMenuColor());
+ // maFTSpacing.SetBackground(GetSettings().GetStyleSettings().GetMenuColor());
+ // maFTBy.SetBackground(GetSettings().GetStyleSettings().GetMenuColor());
+ //}
+ DrawRect(aRect);
+
+
+ SetLineColor(aOldLineColor);
+ SetFillColor(aOldFillColor);
+}*/
+void ParaLineSpacingControl::initial()
+{
+ maLineSpacing.SetStyle( maLineSpacing.GetStyle()| WB_3DLOOK | WB_NO_DIRECTSELECT );
+ maLineSpacing.SetControlBackground(GetSettings().GetStyleSettings().GetMenuColor());
+ maLineSpacing.SetColor(GetSettings().GetStyleSettings().GetMenuColor());
+ //maLineSpacing.SetMinFont();
+
+ mpImg = new Image[4];
+ mpImg[0] = maSpacing1;
+ mpImg[1] = maSpacing115;
+ mpImg[2] = maSpacing15;
+ mpImg[3] = maSpacing2;
+
+ mpImgSel = new Image[4];
+ mpImgSel[0] = maSelSpacing1;
+ mpImgSel[1] = maSelSpacing115;
+ mpImgSel[2] = maSelSpacing15;
+ mpImgSel[3] = maSelSpacing2;
+
+ mpStr = new XubString[4];
+ mpStr[0] = XubString(SVX_RES(STR_SPACING1));
+ mpStr[1] = XubString(SVX_RES(STR_SPACING115));
+ mpStr[2] = XubString(SVX_RES(STR_SPACING15));
+ mpStr[3] = XubString(SVX_RES(STR_SPACING2));
+
+ mpStrTip = new XubString[4];
+ mpStrTip[0] = XubString(SVX_RES(STR_LS_SINGLE));
+ mpStrTip[1] = XubString(SVX_RES(STR_LS_115));
+ mpStrTip[2] = XubString(SVX_RES(STR_LS_15));
+ mpStrTip[3] = XubString(SVX_RES(STR_LS_DOUBLE));
+ for (int i=0;i<4;i++)
+ maLineSpacing.AddItem(mpImg[i], &mpImgSel[i],mpStr[i],&mpStrTip[i]);
+
+ maLineSpacing.InsertCustom(maImgCus, maImgCusGrey, maStrCus);
+ maLineSpacing.SetCustomTip(maStrCus); //Add
+
+ SetAllNoSel();
+ Link aLink = LINK(this, ParaLineSpacingControl,VSSelHdl );
+ maLineSpacing.SetSelectHdl(aLink);
+ maLineSpacing.StartSelection();
+ maLineSpacing.Show();
+
+ aLink = LINK( this, ParaLineSpacingControl, LineSPDistHdl_Impl );
+ aLineDist.SetSelectHdl(aLink);
+ aLineDist.SelectEntryPos( LLINESPACE_1 ) ;
+ aLink = LINK( this, ParaLineSpacingControl, LineSPDistAtHdl_Impl );
+ aLineDistAtPercentBox.SetModifyHdl( aLink );
+ aLineDistAtMetricBox.SetModifyHdl( aLink );
+}
+void ParaLineSpacingControl::ToGetFocus(bool bType)
+{
+ if(!bType)
+ aLineDist.GrabFocus();
+ else
+ maLineSpacing.GrabFocus(); //wj
+}
+
+void ParaLineSpacingControl::Rearrange(SfxItemState currSPState,FieldUnit currMetricUnit,SvxLineSpacingItem* currSPItem,const ::sfx2::sidebar::EnumContext currentContext)
+{
+ SvtViewOptions aWinOpt( E_WINDOW, LSP_POS_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 );
+ maPos = (sal_uInt16)aWinData.ToInt32();
+ }
+
+ SvtViewOptions aWinOpt2( E_WINDOW, LSP_LV_GLOBAL_VALUE );
+ if ( aWinOpt2.Exists() )
+ {
+ ::com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue > aSeq = aWinOpt2.GetUserData();
+ ::rtl::OUString aTmp;
+ if ( aSeq.getLength())
+ aSeq[0].Value >>= aTmp;
+
+ String aWinData( aTmp );
+ maValue = (sal_uInt16)aWinData.ToInt32();
+ }
+ String sHelpText;
+ switch(maPos)
+ {
+ case LLINESPACE_1:
+ sHelpText += mpStrTip[0];
+ break;
+ case LLINESPACE_15:
+ sHelpText += mpStrTip[2];
+ break;
+ case LLINESPACE_2:
+ sHelpText += mpStrTip[3];
+ break;
+ case LLINESPACE_PROP:
+ sHelpText +=maLine;
+ sHelpText.Append(String("Proportion: ", 12, RTL_TEXTENCODING_ASCII_US));
+ sHelpText += maOf;
+ sHelpText.Append( String::CreateFromInt64( maValue ));
+ break;
+ case LLINESPACE_MIN:
+ sHelpText += maLine;
+ sHelpText.Append(String("At Least: ", 10, RTL_TEXTENCODING_ASCII_US));
+ sHelpText += maOf;
+ sHelpText.Append( String::CreateFromInt64( maValue ));
+ break;
+ case LLINESPACE_DURCH:
+ sHelpText += maLine;
+ sHelpText.Append(String("Leading: ", 9, RTL_TEXTENCODING_ASCII_US));
+ sHelpText += maOf;
+ sHelpText.Append( String::CreateFromInt64( maValue ));
+ break;
+ case LLINESPACE_FIX:
+ sHelpText += maLine;
+ sHelpText.Append(String("Fixed: ", 7, RTL_TEXTENCODING_ASCII_US));
+ sHelpText += maOf;
+ sHelpText.Append( String::CreateFromInt64( maValue ));
+ break;
+ }
+ if( !aWinOpt.Exists() && !aWinOpt2.Exists() )
+ mbLineSPDisable = sal_True;
+ else
+ mbLineSPDisable = sal_False;
+
+ if( mbLineSPDisable )
+ maLineSpacing.SetCusEnable(0);
+ else
+ {
+ maLineSpacing.SetCusEnable(1);
+ maLineSpacing.SetCustomTip(sHelpText,sal_True);//Modify for Sym2_7266
+ }
+
+ SfxItemState eState = currSPState;
+
+ SetFieldUnit( aLineDistAtMetricBox, currMetricUnit );
+
+// mpLineSPPage->SetAllNoSel();
+ aLineDist.Enable();
+ pActLineDistFld->Enable();
+ pActLineDistFld->SetText( String() );
+ bool bValueSetFocus = sal_False; //wj
+
+ if( eState >= SFX_ITEM_AVAILABLE )
+ {
+ // SfxMapUnit eUnit = maLNSpaceControl.GetCoreMetric();
+ SfxMapUnit eUnit = SFX_MAPUNIT_100TH_MM;
+ m_eLNSpaceUnit = eUnit;
+
+ switch( currSPItem->GetLineSpaceRule() )
+ {
+ case SVX_LINE_SPACE_AUTO:
+ {
+ SvxInterLineSpace eInter = currSPItem->GetInterLineSpaceRule();
+
+ switch( eInter )
+ {
+ case SVX_INTER_LINE_SPACE_OFF:
+ {
+ aLineDist.SelectEntryPos( LLINESPACE_1 );
+ pActLineDistFld->Disable();
+ pActLineDistFld->SetText( String() );
+ mbUseLineSPCustom = DO_NOT_CUSTOM;
+ if ( LINESPACE_1 == currSPItem->GetPropLineSpace() )
+ {
+ maLineSpacing.SetSelItem(1);
+ bValueSetFocus = sal_True; //wj
+ }
+ }
+ break;
+
+ case SVX_INTER_LINE_SPACE_PROP:
+ {
+ if ( LINESPACE_1 == currSPItem->GetPropLineSpace() )
+ {
+ aLineDist.SelectEntryPos( LLINESPACE_1 );
+ pActLineDistFld->Disable();
+ pActLineDistFld->SetText( String() );
+ mbUseLineSPCustom = DO_NOT_CUSTOM;
+ maLineSpacing.SetSelItem(1);
+ bValueSetFocus = sal_True; //wj
+ break;
+ }
+ if ( LINESPACE_15 == currSPItem->GetPropLineSpace() )
+ {
+ aLineDist.SelectEntryPos( LLINESPACE_15 );
+ pActLineDistFld->Disable();
+ pActLineDistFld->SetText( String() );
+
+ mbUseLineSPCustom = DO_NOT_CUSTOM;
+ maLineSpacing.SetSelItem(3);
+ bValueSetFocus = sal_True; //wj
+ break;
+ }
+ if ( LINESPACE_2 == currSPItem->GetPropLineSpace() )
+ {
+ aLineDist.SelectEntryPos( LLINESPACE_2 );
+ pActLineDistFld->Disable();
+ pActLineDistFld->SetText( String() );
+
+ mbUseLineSPCustom = DO_NOT_CUSTOM;
+ maLineSpacing.SetSelItem(4);
+ bValueSetFocus = sal_True; //wj
+ break;
+ }
+
+ aLineDist.SelectEntryPos( LLINESPACE_PROP );
+ if(pActLineDistFld != &(aLineDistAtPercentBox))
+ {
+ pActLineDistFld->Disable();
+ pActLineDistFld->Hide();
+ pActLineDistFld = &(aLineDistAtPercentBox);
+ }
+ else
+ {
+ pActLineDistFld = &(aLineDistAtMetricBox);
+ pActLineDistFld->Disable();
+ pActLineDistFld->Hide();
+ pActLineDistFld = &(aLineDistAtPercentBox);
+ }
+ pActLineDistFld->Enable();
+ pActLineDistFld->Show();
+ aLineDistAtPercentBox.
+ SetValue( aLineDistAtPercentBox.Normalize(
+ currSPItem->GetPropLineSpace() ) );
+
+ if( currSPItem->GetPropLineSpace() == LINESPACE_115 )
+ {
+ mbUseLineSPCustom = DO_NOT_CUSTOM;
+ maLineSpacing.SetSelItem(2);
+ bValueSetFocus = sal_True; //wj
+ }
+ else
+ {
+ mbUseLineSPCustom = USE_CUSTOM;
+ maLineSpacing.SetSelItem(0);
+ }
+ }
+ break;
+
+ case SVX_INTER_LINE_SPACE_FIX:
+ {
+ if(pActLineDistFld != &(aLineDistAtMetricBox))
+ {
+ pActLineDistFld->Disable();
+ pActLineDistFld->Hide();
+ pActLineDistFld = &(aLineDistAtMetricBox);
+ }
+ else
+ {
+ pActLineDistFld = &(aLineDistAtPercentBox);
+ pActLineDistFld->Disable();
+ pActLineDistFld->Hide();
+ pActLineDistFld = &(aLineDistAtMetricBox);
+ }
+ pActLineDistFld->Enable();
+ pActLineDistFld->Show();
+ maLineSpacing.SetSelItem(0);
+
+ SetMetricValue( aLineDistAtMetricBox,
+ currSPItem->GetInterLineSpace(), eUnit );
+ aLineDist.SelectEntryPos( LLINESPACE_DURCH );
+
+ mbUseLineSPCustom = USE_CUSTOM;
+ }
+ break;
+ }
+ }
+ break;
+ case SVX_LINE_SPACE_FIX:
+ {
+ if(pActLineDistFld != &(aLineDistAtMetricBox))
+ {
+ pActLineDistFld->Disable();
+ pActLineDistFld->Hide();
+ pActLineDistFld = &(aLineDistAtMetricBox);
+ }
+ else
+ {
+ pActLineDistFld = &(aLineDistAtPercentBox);
+ pActLineDistFld->Disable();
+ pActLineDistFld->Hide();
+ pActLineDistFld = &(aLineDistAtMetricBox);
+ }
+ pActLineDistFld->Enable();
+ pActLineDistFld->Show();
+ maLineSpacing.SetSelItem(0);
+
+ SetMetricValue(aLineDistAtMetricBox, currSPItem->GetLineHeight(), eUnit);
+ aLineDist.SelectEntryPos( LLINESPACE_FIX );
+
+ mbUseLineSPCustom = USE_CUSTOM;
+ }
+ break;
+
+ case SVX_LINE_SPACE_MIN:
+ {
+ if(pActLineDistFld != &(aLineDistAtMetricBox))
+ {
+ pActLineDistFld->Disable();
+ pActLineDistFld->Hide();
+ pActLineDistFld = &(aLineDistAtMetricBox);
+ }
+ else
+ {
+ pActLineDistFld = &(aLineDistAtPercentBox);
+ pActLineDistFld->Disable();
+ pActLineDistFld->Hide();
+ pActLineDistFld = &(aLineDistAtMetricBox);
+ }
+ pActLineDistFld->Enable();
+ pActLineDistFld->Show();
+ maLineSpacing.SetSelItem(0);
+
+ SetMetricValue(aLineDistAtMetricBox, currSPItem->GetLineHeight(), eUnit);
+ aLineDist.SelectEntryPos( LLINESPACE_MIN );
+ mbUseLineSPCustom = USE_CUSTOM;
+ }
+ break;
+ }
+ }
+ else if( eState == SFX_ITEM_DISABLED )
+ {
+ aLineDist.Disable();
+ pActLineDistFld->Enable(sal_False);
+ pActLineDistFld->SetText( String() );
+ maLineSpacing.SetSelItem(0);
+
+ mbUseLineSPCustom = DO_NOT_CUSTOM;
+ }
+ else
+ {
+ pActLineDistFld->Enable(sal_False);
+ pActLineDistFld->SetText( String() );
+ aLineDist.SetNoSelection();
+ maLineSpacing.SetSelItem(0);
+ mbUseLineSPCustom = DO_NOT_CUSTOM;
+ }
+
+ aLineDist.SaveValue();
+
+ /*sal_uInt16 nID = pBox->GetCurItemId();
+ pBox->SetItemDown(nID, sal_True);
+
+ Size aFloatSz = GetOutputSizePixel();
+
+ GetLineSPFloatWin()->SetSizePixel( aFloatSz );
+
+ Point aPos=maLineSPTbx->GetPosPixel();
+ aPos.setX(aPos.getX());
+ aPos = OutputToScreenPixel( aPos );
+ Size aSize = maLineSPTbx->GetSizePixel();
+ Rectangle aRect( aPos, aSize );
+
+ GetLineSPFloatWin()->StartPopupMode( aRect, FLOATWIN_POPUPMODE_DOWN | FLOATWIN_POPUPMODE_NOFOCUSCLOSE);
+ GetLineSPFloatWin()->SetPopupModeFlags(GetLineSPFloatWin()->GetPopupModeFlags() | FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE );
+
+ pLineSPPage->ToGetFocus(bValueSetFocus);
+ */
+ sal_uInt16 uCount = aLineDist.GetEntryCount();
+ if( uCount == LLINESPACE_FIX + 1 )
+ {
+ switch (currentContext.GetCombinedContext())
+ {
+ case CombinedEnumContext(Application_Impress, Context_Table):
+ case CombinedEnumContext(Application_Draw, Context_Table):
+ case CombinedEnumContext(Application_Writer, Context_DrawText):
+ case CombinedEnumContext(Application_Calc, Context_DrawText):
+ case CombinedEnumContext(Application_Draw, Context_DrawText):
+ case CombinedEnumContext(Application_Impress, Context_DrawText):
+ case CombinedEnumContext(Application_Writer, Context_Annotation):
+ case CombinedEnumContext(Application_Draw, Context_Draw):
+ case CombinedEnumContext(Application_Draw, Context_TextObject):
+ case CombinedEnumContext(Application_Draw, Context_Graphic):
+ case CombinedEnumContext(Application_Impress, Context_Draw):
+ case CombinedEnumContext(Application_Impress, Context_TextObject):
+ case CombinedEnumContext(Application_Impress, Context_Graphic):
+ {
+ aLineDist.RemoveEntry(LLINESPACE_FIX);
+ }
+ }
+ }
+ else if( uCount == LLINESPACE_FIX)
+ {
+ switch (currentContext.GetCombinedContext())
+ {
+ case CombinedEnumContext(Application_Writer, Context_Default):
+ case CombinedEnumContext(Application_Writer, Context_Text):
+ case CombinedEnumContext(Application_Writer, Context_Table):
+ {
+ aLineDist.InsertEntry(String::CreateFromAscii("Fixed"), LLINESPACE_FIX);
+ }
+ }
+ }
+ maLineSpacing.Format();
+ maLineSpacing.StartSelection();
+}
+
+void ParaLineSpacingControl::SetAllNoSel()
+{
+ maLineSpacing.SelectItem(1); //modified by wj for sym2_5397
+ maLineSpacing.SetNoSelection();
+}
+
+IMPL_LINK( ParaLineSpacingControl, LineSPDistHdl_Impl, ListBox*, pBox )
+{
+ maLineSpacing.SetNoSelection();
+ maLineSpacing.SetSelItem(0);
+ maLineSpacing.Format();
+ maLineSpacing.StartSelection();
+
+ switch( pBox->GetSelectEntryPos() )
+ {
+ case LLINESPACE_1:
+ case LLINESPACE_15:
+ case LLINESPACE_2:
+ pActLineDistFld->Enable(sal_False);
+ pActLineDistFld->SetText( String() );
+ break;
+
+ case LLINESPACE_DURCH:
+ aLineDistAtPercentBox.Hide();
+ pActLineDistFld = &aLineDistAtMetricBox;
+ aLineDistAtMetricBox.SetMin(0);
+
+
+ if ( !aLineDistAtMetricBox.GetText().Len() )
+ aLineDistAtMetricBox.SetValue(
+ aLineDistAtMetricBox.Normalize( 0 ) );
+ aLineDistAtPercentBox.Hide();
+ pActLineDistFld->Show();
+ pActLineDistFld->Enable();
+ break;
+
+ case LLINESPACE_MIN:
+ aLineDistAtPercentBox.Hide();
+ pActLineDistFld = &aLineDistAtMetricBox;
+ aLineDistAtMetricBox.SetMin(0);
+
+ if ( !aLineDistAtMetricBox.GetText().Len() )
+ aLineDistAtMetricBox.SetValue(
+ aLineDistAtMetricBox.Normalize( 0 ), FUNIT_TWIP );
+ aLineDistAtPercentBox.Hide();
+ pActLineDistFld->Show();
+ pActLineDistFld->Enable();
+ break;
+
+ case LLINESPACE_PROP:
+ aLineDistAtMetricBox.Hide();
+ pActLineDistFld = &aLineDistAtPercentBox;
+
+ if ( !aLineDistAtPercentBox.GetText().Len() )
+ aLineDistAtPercentBox.SetValue(
+ aLineDistAtPercentBox.Normalize( 100 ), FUNIT_TWIP );
+ aLineDistAtMetricBox.Hide();
+ pActLineDistFld->Show();
+ pActLineDistFld->Enable();
+ break;
+ case LLINESPACE_FIX:
+ {
+ aLineDistAtPercentBox.Hide();
+ pActLineDistFld = &aLineDistAtMetricBox;
+ sal_Int64 nTemp = aLineDistAtMetricBox.GetValue();
+ aLineDistAtMetricBox.SetMin(aLineDistAtMetricBox.Normalize(nMinFixDist), FUNIT_TWIP);
+
+ if ( aLineDistAtMetricBox.GetValue() != nTemp )
+ SetMetricValue( aLineDistAtMetricBox,
+ FIX_DIST_DEF, SFX_MAPUNIT_TWIP );
+ aLineDistAtPercentBox.Hide();
+ pActLineDistFld->Show();
+ pActLineDistFld->Enable();
+ }
+ break;
+ }
+ ExecuteLineSpace();
+ return 0;
+}
+
+IMPL_LINK( ParaLineSpacingControl, LineSPDistAtHdl_Impl, MetricField*, pBox )
+{
+ ExecuteLineSpace();
+ return (0L);
+}
+
+void ParaLineSpacingControl::ExecuteLineSpace()
+{
+ aLineDist.SaveValue();
+ maLineSpacing.SetNoSelection();
+
+ SvxLineSpacingItem aSpacing(_DEFAULT_LINE_SPACING, SID_ATTR_PARA_LINESPACE);
+ sal_uInt16 nPos = aLineDist.GetSelectEntryPos();
+
+ switch ( nPos )
+ {
+ case LLINESPACE_1:
+ case LLINESPACE_15:
+ case LLINESPACE_2:
+ {
+ SetLineSpace( aSpacing, nPos );
+ maPos = nPos;
+ }
+ break;
+
+ case LLINESPACE_PROP:
+ {
+ SetLineSpace( aSpacing, nPos,
+ aLineDistAtPercentBox.Denormalize(
+ (long)aLineDistAtPercentBox.GetValue() ) );
+ maPos = nPos;
+ maValue =aLineDistAtPercentBox.GetValue();
+ }
+ break;
+
+ case LLINESPACE_MIN:
+ case LLINESPACE_DURCH:
+ case LLINESPACE_FIX:
+ {
+ SetLineSpace( aSpacing, nPos,
+ GetCoreValue( aLineDistAtMetricBox, m_eLNSpaceUnit ) );
+ maPos = nPos;
+ maValue = GetCoreValue( aLineDistAtMetricBox, m_eLNSpaceUnit );
+ }
+ break;
+
+ default:
+ DBG_ERROR( "error!!" );
+ break;
+ }
+
+ mpBindings->GetDispatcher()->Execute(
+ SID_ATTR_PARA_LINESPACE, SFX_CALLMODE_RECORD, &aSpacing, 0L);
+
+ mbUseLineSPCustom = USE_CUSTOM;
+}
+
+void ParaLineSpacingControl::SetLineSpace( SvxLineSpacingItem& rLineSpace,
+ int eSpace, long lValue )
+{
+ switch ( eSpace )
+ {
+ case LLINESPACE_1:
+ rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO;
+ rLineSpace.GetInterLineSpaceRule() = SVX_INTER_LINE_SPACE_OFF;
+ break;
+
+ case LLINESPACE_15:
+ rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO;
+ rLineSpace.SetPropLineSpace( LINESPACE_15 );
+ break;
+
+ case LLINESPACE_2:
+ rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO;
+ rLineSpace.SetPropLineSpace( LINESPACE_2 );
+ break;
+
+ case LLINESPACE_PROP:
+ rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO;
+ rLineSpace.SetPropLineSpace( (sal_uInt8)lValue );
+ break;
+
+ case LLINESPACE_MIN:
+ rLineSpace.SetLineHeight( (sal_uInt16)lValue );
+ rLineSpace.GetInterLineSpaceRule() = SVX_INTER_LINE_SPACE_OFF;
+ break;
+
+ case LLINESPACE_DURCH:
+ rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO;
+ rLineSpace.SetInterLineSpace( (sal_uInt16)lValue );
+ break;
+
+ case LLINESPACE_FIX:
+ rLineSpace.SetLineHeight((sal_uInt16)lValue);
+ rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_FIX;
+ rLineSpace.GetInterLineSpaceRule() = SVX_INTER_LINE_SPACE_OFF;
+ break;
+ }
+}
+
+IMPL_LINK(ParaLineSpacingControl, VSSelHdl, void *, pControl)
+{
+ maLineSpacing.SetNoSelection();
+ bool bClosePop = true;
+ if(pControl == &maLineSpacing)
+ {
+ sal_uInt16 iPos = maLineSpacing.GetSelectItemId();
+ short nKern = 0;
+ long nVal = 0;
+ switch ( iPos )
+ {
+ case 1:
+ ExecuteLineSpacing( 0, 0 );
+ break;
+ case 2:
+ ExecuteLineSpacing( 0, 3 );
+ break;
+ case 3:
+ ExecuteLineSpacing( 0, 1 );
+ break;
+ case 4:
+ ExecuteLineSpacing( 0, 2 );
+ break;
+ case 5:
+ {
+ if(!(mbLineSPDisable))
+ {
+ //maPos = mrParaPropertyPanel.maLinePos;
+ aLineDist.SelectEntryPos( maPos ) ;
+ aLineDist.SaveValue();
+ //maValue = mrParaPropertyPanel.maLineValue;
+
+ SvxLineSpacingItem aSpacing(_DEFAULT_LINE_SPACING, SID_ATTR_PARA_LINESPACE);
+ switch(maPos)
+ {
+ case LLINESPACE_1:
+ case LLINESPACE_15:
+ case LLINESPACE_2:
+ SetLineSpace( aSpacing, maPos );
+ break;
+
+ case LLINESPACE_PROP:
+ SetLineSpace( aSpacing, maPos,
+ aLineDistAtPercentBox.Denormalize( (long)maValue ) );
+ break;
+
+ case LLINESPACE_MIN:
+ case LLINESPACE_DURCH:
+ case LLINESPACE_FIX:
+ SetLineSpace( aSpacing, maPos, (long)maValue );
+ break;
+ }
+
+ mpBindings->GetDispatcher()->Execute(
+ SID_ATTR_PARA_LINESPACE, SFX_CALLMODE_RECORD, &aSpacing, 0L);
+
+ ExecuteLineSpacing( USE_CUSTOM, 0 );
+ }
+ else
+ bClosePop = sal_False;
+ }
+ break;
+ }
+ }
+ if(bClosePop)
+ mrParaPropertyPanel.EndSpacingPopupMode();
+ return 0;
+}
+
+void ParaLineSpacingControl::ExecuteLineSpacing( sal_uInt16 aIsCustom, sal_uInt16 aEntry )
+{
+ if( !aIsCustom )
+ {
+ aLineDist.SelectEntryPos( aEntry ) ;
+ aLineDist.SaveValue();
+ SvxLineSpacingItem aSpacing(_DEFAULT_LINE_SPACING, SID_ATTR_PARA_LINESPACE);
+ sal_uInt16 nPos = aEntry;
+ if( aEntry == LLINESPACE_PROP )
+ SetLineSpace( aSpacing, nPos, aLineDistAtPercentBox.Denormalize( (long)115 ) );
+ else
+ SetLineSpace( aSpacing, nPos );
+
+ mpBindings->GetDispatcher()->Execute(
+ SID_ATTR_PARA_LINESPACE, SFX_CALLMODE_RECORD, &aSpacing, 0L);
+ }
+
+ if( !aIsCustom )
+ {
+ mbUseLineSPCustom = DO_NOT_CUSTOM;
+ mrParaPropertyPanel.EndSpacingPopupMode();
+ }
+ maLineSpacing.SetNoSelection();
+}
+
+}} // end of namespace sidebar
+
Propchange: openoffice/branches/sidebar/main/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx
------------------------------------------------------------------------------
svn:executable = *
Added: openoffice/branches/sidebar/main/svx/source/sidebar/paragraph/ParaLineSpacingControl.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/svx/source/sidebar/paragraph/ParaLineSpacingControl.hxx?rev=1459509&view=auto
==============================================================================
--- openoffice/branches/sidebar/main/svx/source/sidebar/paragraph/ParaLineSpacingControl.hxx (added)
+++ openoffice/branches/sidebar/main/svx/source/sidebar/paragraph/ParaLineSpacingControl.hxx Thu Mar 21 20:23:16 2013
@@ -0,0 +1,115 @@
+/**************************************************************
+ *
+ * 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_LINE_SPACING_CONTROL_HXX_
+#define _SVX_SIDEBAR_LINE_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 "ParaPropertyPanel.hxx"
+#include <vcl/fixed.hxx>
+#include <svl/poolitem.hxx>
+#include <editeng/lspcitem.hxx>
+#include <sfx2/sidebar/EnumContext.hxx>
+
+
+namespace svx { namespace sidebar {
+
+#define LSP_POS_GLOBAL_VALUE String("Line_Spacing_Pos", 16, RTL_TEXTENCODING_ASCII_US)
+#define LSP_LV_GLOBAL_VALUE String("Line_Spacing_Lv", 15, RTL_TEXTENCODING_ASCII_US)
+#define BEGIN_VALUE 28
+class ParaLineSpacingControl:public svx::sidebar::PopupControl
+{
+public:
+ ParaLineSpacingControl(Window* pParent, svx::sidebar::ParaPropertyPanel& rPanel);
+ ~ParaLineSpacingControl();
+ void ToGetFocus(bool bType);
+ void Rearrange(SfxItemState currSPState,FieldUnit currMetricUnit,SvxLineSpacingItem* currSPItem,const ::sfx2::sidebar::EnumContext currentContext);
+ //virtual void Paint(const Rectangle& rect);
+
+ //add
+ short GetLastCustomState();
+ long GetLastCustomValue();
+ //add end
+
+ void ExecuteLineSpace();
+ void SetLineSpace( SvxLineSpacingItem& rLineSpace,
+ int eSpace, long lValue = 0 );
+
+ void ExecuteLineSpacing( sal_uInt16 aIsCustom, sal_uInt16 aEntry );
+ void SetAllNoSel();
+
+private:
+ bool mbUseLineSPCustom;
+ bool mbLineSPDisable;
+ SfxMapUnit m_eLNSpaceUnit;
+ ParaPropertyPanel& mrParaPropertyPanel;
+ SfxBindings* mpBindings;
+
+ long nMinFixDist;
+ Edit* pActLineDistFld;
+
+ ValueSetWithTextControl maLineSpacing;
+
+ FixedText maCustomFT;
+ FixedText maLSpacingFT;
+ ListBox aLineDist;
+
+ FixedText maOfFT;
+ MetricField aLineDistAtPercentBox;
+ MetricField aLineDistAtMetricBox;
+
+ Image maSpacing1;
+ Image maSpacing115;
+ Image maSpacing15;
+ Image maSpacing2;
+ Image maLPCustom;
+
+ Image maSelSpacing1;
+ Image maSelSpacing115;
+ Image maSelSpacing15;
+ Image maSelSpacing2;
+ Image maSelSelHanging;
+ Image maImgCus;
+ Image maImgCusGrey;
+ XubString maStrCus;
+
+ Image* mpImg;
+ Image* mpImgSel;
+ XubString* mpStr;
+ XubString* mpStrTip;
+ String maLine;
+ String maOf;
+
+ sal_Int64 maValue;
+ sal_uInt16 maPos;
+private:
+ void initial();
+ DECL_LINK(LineSPDistHdl_Impl, ListBox*);
+ DECL_LINK(LineSPDistAtHdl_Impl, MetricField*);
+ DECL_LINK(VSSelHdl, void*);
+};
+}}
+
+#endif
+
Propchange: openoffice/branches/sidebar/main/svx/source/sidebar/paragraph/ParaLineSpacingControl.hxx
------------------------------------------------------------------------------
svn:executable = *
Added: openoffice/branches/sidebar/main/svx/source/sidebar/paragraph/ParaLineSpacingPopup.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/svx/source/sidebar/paragraph/ParaLineSpacingPopup.cxx?rev=1459509&view=auto
==============================================================================
--- openoffice/branches/sidebar/main/svx/source/sidebar/paragraph/ParaLineSpacingPopup.cxx (added)
+++ openoffice/branches/sidebar/main/svx/source/sidebar/paragraph/ParaLineSpacingPopup.cxx Thu Mar 21 20:23:16 2013
@@ -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.
+ *
+ *************************************************************/
+
+#include "ParaLineSpacingPopup.hxx"
+#include "ParaLineSpacingControl.hxx"
+#include <boost/bind.hpp>
+#include <unotools/viewoptions.hxx>
+
+namespace svx { namespace sidebar {
+
+ParaLineSpacingPopup::ParaLineSpacingPopup (
+ Window* pParent,
+ const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator)
+ : Popup(
+ pParent,
+ rControlCreator,
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Character Spacing")))
+{
+ SetPopupModeEndHandler(::boost::bind(&ParaLineSpacingPopup::PopupModeEndCallback, this));
+}
+
+
+
+
+ParaLineSpacingPopup::~ParaLineSpacingPopup (void)
+{
+}
+
+
+
+
+void ParaLineSpacingPopup::Rearrange (SfxItemState currSPState,FieldUnit currMetricUnit,SvxLineSpacingItem* currSPItem,const ::sfx2::sidebar::EnumContext currentContext)
+{
+ ProvideContainerAndControl();
+
+ ParaLineSpacingControl* pControl = dynamic_cast<ParaLineSpacingControl*>(mpControl.get());
+ if (pControl != NULL)
+ pControl->Rearrange(currSPState,currMetricUnit, currSPItem,currentContext);
+}
+
+void ParaLineSpacingPopup::PopupModeEndCallback (void)
+{
+ ProvideContainerAndControl();
+ ParaLineSpacingControl* pControl = dynamic_cast<ParaLineSpacingControl*>(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
+
+
Propchange: openoffice/branches/sidebar/main/svx/source/sidebar/paragraph/ParaLineSpacingPopup.cxx
------------------------------------------------------------------------------
svn:executable = *
Added: openoffice/branches/sidebar/main/svx/source/sidebar/paragraph/ParaLineSpacingPopup.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/svx/source/sidebar/paragraph/ParaLineSpacingPopup.hxx?rev=1459509&view=auto
==============================================================================
--- openoffice/branches/sidebar/main/svx/source/sidebar/paragraph/ParaLineSpacingPopup.hxx (added)
+++ openoffice/branches/sidebar/main/svx/source/sidebar/paragraph/ParaLineSpacingPopup.hxx Thu Mar 21 20:23:16 2013
@@ -0,0 +1,53 @@
+/**************************************************************
+ *
+ * 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_LINE_SPACING_POPUP_HXX_
+#define _SVX_SIDEBAR_LINE_SPACING_POPUP_HXX_
+
+#include "svx/sidebar/Popup.hxx"
+
+#include <boost/function.hpp>
+#include <svl/poolitem.hxx>
+#include <tools/fldunit.hxx>
+#include <editeng/lspcitem.hxx>
+#include <sfx2/sidebar/EnumContext.hxx>
+
+namespace svx { namespace sidebar {
+
+class ParaLineSpacingPopup
+ : public Popup
+{
+public :
+ ParaLineSpacingPopup (
+ Window* pParent,
+ const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator);
+ ~ParaLineSpacingPopup (void);
+
+ void Rearrange (SfxItemState currSPState,FieldUnit currMetricUnit,SvxLineSpacingItem* currSPItem ,const ::sfx2::sidebar::EnumContext currentContext);
+private:
+ void PopupModeEndCallback (void);
+};
+
+} } // end of namespace svx::sidebar
+
+#endif
+
+
Propchange: openoffice/branches/sidebar/main/svx/source/sidebar/paragraph/ParaLineSpacingPopup.hxx
------------------------------------------------------------------------------
svn:executable = *