LCOV - code coverage report
Current view: top level - sc/source/ui/sidebar - AlignmentPropertyPanel.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 291 0.0 %
Date: 2014-04-14 Functions: 0 28 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <sfx2/sidebar/ResourceDefinitions.hrc>
      21             : #include <sfx2/sidebar/Theme.hxx>
      22             : #include <sfx2/sidebar/ControlFactory.hxx>
      23             : #include <AlignmentPropertyPanel.hxx>
      24             : #include <editeng/justifyitem.hxx>
      25             : #include <svx/dialmgr.hxx>
      26             : #include "sc.hrc"
      27             : #include "scresid.hxx"
      28             : #include <sfx2/bindings.hxx>
      29             : #include <sfx2/dispatch.hxx>
      30             : #include <svx/algitem.hxx>
      31             : #include <svx/dlgutil.hxx>
      32             : #include <vcl/toolbox.hxx>
      33             : #include <svx/sidebar/SidebarDialControl.hxx>
      34             : 
      35             : using namespace css;
      36             : using namespace cssu;
      37             : using ::sfx2::sidebar::ControlFactory;
      38             : 
      39             : const char UNO_ALIGNBLOCK[]            = ".uno:AlignBlock";
      40             : const char UNO_ALIGNBOTTOM[]           = ".uno:AlignBottom";
      41             : const char UNO_ALIGNLEFT[]             = ".uno:AlignLeft";
      42             : const char UNO_ALIGNHORIZONTALCENTER[] = ".uno:AlignHorizontalCenter";
      43             : const char UNO_ALIGNRIGHT[]            = ".uno:AlignRight";
      44             : const char UNO_ALIGNTOP[]              = ".uno:AlignTop";
      45             : const char UNO_ALIGNVCENTER[]          = ".uno:AlignVCenter";
      46             : 
      47             : 
      48             : // namespace open
      49             : 
      50             : namespace sc { namespace sidebar {
      51             : 
      52           0 : AlignmentPropertyPanel::AlignmentPropertyPanel(
      53             :     Window* pParent,
      54             :     const cssu::Reference<css::frame::XFrame>& rxFrame,
      55             :     SfxBindings* pBindings)
      56             :     : PanelLayout(pParent, "AlignmentPropertyPanel", "modules/scalc/ui/sidebaralignment.ui", rxFrame),
      57             :       maAlignHorControl(SID_H_ALIGNCELL, *pBindings, *this),
      58             :       maAlignVerControl(SID_V_ALIGNCELL, *pBindings, *this),
      59             :       maLeftIndentControl(SID_ATTR_ALIGN_INDENT, *pBindings, *this),
      60             :       maMergeCellControl(FID_MERGE_TOGGLE, *pBindings, *this),
      61             :       maWrapTextControl(SID_ATTR_ALIGN_LINEBREAK, *pBindings, *this),
      62             :       maAngleControl(SID_ATTR_ALIGN_DEGREES, *pBindings, *this),
      63             :       maStackControl(SID_ATTR_ALIGN_STACKED, *pBindings, *this),
      64             :       meHorAlignState(SVX_HOR_JUSTIFY_STANDARD),
      65             :       meVerAlignState(SVX_VER_JUSTIFY_STANDARD),
      66             :       mbMultiDisable(false),
      67             :       mxFrame(rxFrame),
      68             :       maContext(),
      69           0 :       mpBindings(pBindings)
      70             : {
      71           0 :     get(mpTBHorizontal, "horizontalalignment");
      72           0 :     get(mpTBVertical, "verticalalignment");
      73           0 :     get(mpFTLeftIndent, "leftindentlabel");
      74           0 :     get(mpMFLeftIndent, "leftindent");
      75           0 :     get(mpCBXWrapText, "wraptext");
      76           0 :     get(mpCBXMergeCell, "mergecells");
      77           0 :     get(mpFtRotate, "orientationlabel");
      78           0 :     get(mpCtrlDial, "orientationcontrol");
      79           0 :     get(mpMtrAngle, "orientationdegrees");
      80           0 :     get(mpCbStacked, "verticallystacked");
      81             : 
      82           0 :     Initialize();
      83             : 
      84           0 :     mpFTLeftIndent->SetBackground(Wallpaper());
      85           0 :     mpFtRotate->SetBackground(Wallpaper());
      86           0 : }
      87             : 
      88           0 : AlignmentPropertyPanel::~AlignmentPropertyPanel()
      89             : {
      90           0 : }
      91             : 
      92           0 : void AlignmentPropertyPanel::Initialize()
      93             : {
      94           0 :     Link aLink = LINK(this, AlignmentPropertyPanel, TbxHorAlignSelectHdl);
      95           0 :     mpTBHorizontal->SetSelectHdl ( aLink );
      96             : 
      97           0 :     aLink = LINK(this, AlignmentPropertyPanel, TbxVerAlignSelectHdl);
      98           0 :     mpTBVertical->SetSelectHdl ( aLink );
      99             : 
     100           0 :     mpFTLeftIndent->Disable();
     101           0 :     mpMFLeftIndent->Disable();
     102           0 :     mpMFLeftIndent->SetAccessibleName(OUString( "Left Indent"));    //wj acc
     103           0 :     aLink = LINK(this, AlignmentPropertyPanel, MFLeftIndentMdyHdl);
     104           0 :     mpMFLeftIndent->SetModifyHdl ( aLink );
     105             : 
     106           0 :     aLink = LINK(this, AlignmentPropertyPanel, CBOXMergnCellClkHdl);
     107           0 :     mpCBXMergeCell->SetClickHdl ( aLink );
     108             : 
     109           0 :     aLink = LINK(this, AlignmentPropertyPanel, CBOXWrapTextClkHdl);
     110           0 :     mpCBXWrapText->SetClickHdl ( aLink );
     111             : 
     112             :     //rotation control
     113           0 :     mpCtrlDial->SetAccessibleName(OUString( "Text Orientation"));   //wj acc
     114           0 :     mpCtrlDial->SetModifyHdl(LINK( this, AlignmentPropertyPanel, RotationHdl));
     115             : 
     116             :     //rotation
     117           0 :     mpMtrAngle->SetAccessibleName(OUString( "Text Orientation"));   //wj acc
     118           0 :     mpMtrAngle->SetModifyHdl(LINK( this, AlignmentPropertyPanel, AngleModifiedHdl));
     119           0 :     mpMtrAngle->EnableAutocomplete( false );
     120             : 
     121             :     //Vertical stacked
     122           0 :     mpCbStacked->SetClickHdl( LINK( this, AlignmentPropertyPanel, ClickStackHdl ) );
     123             : 
     124           0 :     mpMtrAngle->InsertValue(0, FUNIT_CUSTOM);
     125           0 :     mpMtrAngle->InsertValue(45, FUNIT_CUSTOM);
     126           0 :     mpMtrAngle->InsertValue(90, FUNIT_CUSTOM);
     127           0 :     mpMtrAngle->InsertValue(135, FUNIT_CUSTOM);
     128           0 :     mpMtrAngle->InsertValue(180, FUNIT_CUSTOM);
     129           0 :     mpMtrAngle->InsertValue(225, FUNIT_CUSTOM);
     130           0 :     mpMtrAngle->InsertValue(270, FUNIT_CUSTOM);
     131           0 :     mpMtrAngle->InsertValue(315, FUNIT_CUSTOM);
     132           0 :     mpMtrAngle->SetDropDownLineCount(mpMtrAngle->GetEntryCount());
     133             : 
     134           0 :     mpTBHorizontal->SetAccessibleRelationLabeledBy(mpTBHorizontal);
     135           0 :     mpTBVertical->SetAccessibleRelationLabeledBy(mpTBVertical);
     136           0 :     mpMFLeftIndent->SetAccessibleRelationLabeledBy(mpFTLeftIndent);
     137           0 :     mpMtrAngle->SetAccessibleRelationLabeledBy(mpFtRotate);
     138             : #ifdef HAS_IA2
     139             :     mpMtrAngle->SetMpSubEditAccLableBy(mpFtRotate);
     140             : #endif
     141           0 : }
     142             : 
     143           0 : IMPL_LINK( AlignmentPropertyPanel, AngleModifiedHdl, void *, EMPTYARG )
     144             : {
     145           0 :     OUString sTmp = mpMtrAngle->GetText();
     146             : 
     147           0 :     sal_Unicode nChar = sTmp.isEmpty() ? 0 : sTmp[0];
     148           0 :     if((sTmp.getLength()== 1 &&  nChar == '-') ||
     149           0 :         (nChar != '-' && ((nChar < '0') || (nChar > '9') ) ))   ////modify
     150           0 :         return 0;
     151             : 
     152           0 :     double dTmp = sTmp.toDouble();
     153           0 :     FormatDegrees(dTmp);
     154             : 
     155           0 :     sal_Int64 nTmp = (sal_Int64)dTmp*100;
     156           0 :     SfxInt32Item aAngleItem( SID_ATTR_ALIGN_DEGREES,(sal_uInt32) nTmp);
     157             : 
     158             :     GetBindings()->GetDispatcher()->Execute(
     159           0 :         SID_ATTR_ALIGN_DEGREES, SFX_CALLMODE_RECORD, &aAngleItem, 0L );
     160           0 :     return 0;
     161             : }
     162             : 
     163           0 : IMPL_LINK( AlignmentPropertyPanel, RotationHdl, void *, EMPTYARG )
     164             : {
     165           0 :     sal_Int32 nTmp = mpCtrlDial->GetRotation();
     166           0 :     SfxInt32Item aAngleItem( SID_ATTR_ALIGN_DEGREES,(sal_uInt32) nTmp);
     167             : 
     168             :     GetBindings()->GetDispatcher()->Execute(
     169           0 :         SID_ATTR_ALIGN_DEGREES, SFX_CALLMODE_RECORD, &aAngleItem, 0L );
     170             : 
     171           0 :     return 0;
     172             : }
     173             : 
     174           0 : IMPL_LINK( AlignmentPropertyPanel, ClickStackHdl, void *, EMPTYARG )
     175             : {
     176           0 :     bool bVertical = mpCbStacked->IsChecked() ? true : false;
     177           0 :     SfxBoolItem  aStackItem( SID_ATTR_ALIGN_STACKED, bVertical );
     178             :     GetBindings()->GetDispatcher()->Execute(
     179           0 :         SID_ATTR_ALIGN_STACKED, SFX_CALLMODE_RECORD, &aStackItem, 0L );
     180           0 :     return 0;
     181             : }
     182             : 
     183           0 : IMPL_LINK(AlignmentPropertyPanel, TbxHorAlignSelectHdl, ToolBox*, pToolBox)
     184             : {
     185           0 :     const OUString aCommand(pToolBox->GetItemCommand(pToolBox->GetCurItemId()));
     186             : 
     187           0 :     if(aCommand == UNO_ALIGNLEFT)
     188             :     {
     189           0 :         if(meHorAlignState != SVX_HOR_JUSTIFY_LEFT)
     190           0 :             meHorAlignState = SVX_HOR_JUSTIFY_LEFT;
     191             :         else
     192           0 :             meHorAlignState = SVX_HOR_JUSTIFY_STANDARD;
     193             :     }
     194           0 :     else if(aCommand == UNO_ALIGNHORIZONTALCENTER )
     195             :     {
     196           0 :         if(meHorAlignState != SVX_HOR_JUSTIFY_CENTER)
     197           0 :             meHorAlignState = SVX_HOR_JUSTIFY_CENTER;
     198             :         else
     199           0 :             meHorAlignState = SVX_HOR_JUSTIFY_STANDARD;
     200             :     }
     201           0 :     else if(aCommand == UNO_ALIGNRIGHT )
     202             :     {
     203           0 :         if(meHorAlignState != SVX_HOR_JUSTIFY_RIGHT)
     204           0 :             meHorAlignState = SVX_HOR_JUSTIFY_RIGHT;
     205             :         else
     206           0 :             meHorAlignState = SVX_HOR_JUSTIFY_STANDARD;
     207             :     }
     208           0 :     else if(aCommand == UNO_ALIGNBLOCK )
     209             :     {
     210           0 :         if(meHorAlignState != SVX_HOR_JUSTIFY_BLOCK)
     211           0 :             meHorAlignState = SVX_HOR_JUSTIFY_BLOCK;
     212             :         else
     213           0 :             meHorAlignState = SVX_HOR_JUSTIFY_STANDARD;
     214             :     }
     215           0 :     SvxHorJustifyItem aHorItem(meHorAlignState, SID_H_ALIGNCELL);
     216           0 :     GetBindings()->GetDispatcher()->Execute(SID_H_ALIGNCELL, SFX_CALLMODE_RECORD, &aHorItem, 0L);
     217           0 :     UpdateHorAlign();
     218           0 :     return 0;
     219             : }
     220             : 
     221           0 : IMPL_LINK(AlignmentPropertyPanel, TbxVerAlignSelectHdl, ToolBox*, pToolBox)
     222             : {
     223           0 :     const OUString aCommand(pToolBox->GetItemCommand(pToolBox->GetCurItemId()));
     224             : 
     225           0 :     if(aCommand == UNO_ALIGNTOP)
     226             :     {
     227           0 :         if(meVerAlignState != SVX_VER_JUSTIFY_TOP)
     228           0 :             meVerAlignState = SVX_VER_JUSTIFY_TOP;
     229             :         else
     230           0 :             meVerAlignState = SVX_VER_JUSTIFY_STANDARD;
     231             :     }
     232           0 :     else if(aCommand == UNO_ALIGNVCENTER)
     233             :     {
     234           0 :         if(meVerAlignState != SVX_VER_JUSTIFY_CENTER)
     235           0 :             meVerAlignState = SVX_VER_JUSTIFY_CENTER;
     236             :         else
     237           0 :             meVerAlignState = SVX_VER_JUSTIFY_STANDARD;
     238             :     }
     239           0 :     else if(aCommand == UNO_ALIGNBOTTOM)
     240             :     {
     241           0 :         if(meVerAlignState != SVX_VER_JUSTIFY_BOTTOM)
     242           0 :             meVerAlignState = SVX_VER_JUSTIFY_BOTTOM;
     243             :         else
     244           0 :             meVerAlignState = SVX_VER_JUSTIFY_STANDARD;
     245             :     }
     246           0 :     SvxVerJustifyItem aVerItem(meVerAlignState, SID_V_ALIGNCELL);
     247           0 :     GetBindings()->GetDispatcher()->Execute(SID_V_ALIGNCELL, SFX_CALLMODE_RECORD, &aVerItem, 0L);
     248           0 :     UpdateVerAlign();
     249           0 :     return 0;
     250             : }
     251             : 
     252           0 : IMPL_LINK(AlignmentPropertyPanel, MFLeftIndentMdyHdl, void*, EMPTYARG)
     253             : {
     254           0 :     mpCBXWrapText->EnableTriState(false);
     255           0 :     sal_uInt16 nVal = (sal_uInt16)mpMFLeftIndent->GetValue();
     256           0 :     SfxUInt16Item aItem( SID_ATTR_ALIGN_INDENT,  (sal_uInt16)CalcToUnit( nVal,  SFX_MAPUNIT_TWIP ) );
     257             : 
     258           0 :     GetBindings()->GetDispatcher()->Execute(SID_ATTR_ALIGN_INDENT, SFX_CALLMODE_RECORD, &aItem, 0L);
     259           0 :     return( 0L );
     260             : }
     261             : 
     262           0 : IMPL_LINK(AlignmentPropertyPanel, CBOXMergnCellClkHdl, void*, EMPTYARG)
     263             : {
     264           0 :     bool bState = mpCBXMergeCell->IsChecked();
     265             : 
     266             :     //Modified
     267             :     //SfxBoolItem aItem( FID_MERGE_TOGGLE , bState);
     268             :     //GetBindings()->GetDispatcher()->Execute(FID_MERGE_TOGGLE, SFX_CALLMODE_RECORD, &aItem, false, 0L);
     269           0 :     if(bState)
     270           0 :         GetBindings()->GetDispatcher()->Execute(FID_MERGE_ON, SFX_CALLMODE_RECORD);
     271             :     else
     272           0 :         GetBindings()->GetDispatcher()->Execute(FID_MERGE_OFF, SFX_CALLMODE_RECORD);
     273           0 :     GetBindings()->Invalidate(FID_MERGE_TOGGLE,true,false);
     274             :     //modified end
     275             : 
     276           0 :     return 0;
     277             : }
     278             : 
     279           0 : IMPL_LINK(AlignmentPropertyPanel, CBOXWrapTextClkHdl, void*, EMPTYARG)
     280             : {
     281           0 :     bool bState = mpCBXWrapText->IsChecked();
     282           0 :     SfxBoolItem aItem( SID_ATTR_ALIGN_LINEBREAK , bState);
     283           0 :     GetBindings()->GetDispatcher()->Execute(SID_ATTR_ALIGN_LINEBREAK, SFX_CALLMODE_RECORD, &aItem, 0L);
     284           0 :     return 0;
     285             : }
     286             : 
     287           0 : AlignmentPropertyPanel* AlignmentPropertyPanel::Create (
     288             :     Window* pParent,
     289             :     const cssu::Reference<css::frame::XFrame>& rxFrame,
     290             :     SfxBindings* pBindings)
     291             : {
     292           0 :     if (pParent == NULL)
     293           0 :         throw lang::IllegalArgumentException("no parent Window given to AlignmentPropertyPanel::Create", NULL, 0);
     294           0 :     if ( ! rxFrame.is())
     295           0 :         throw lang::IllegalArgumentException("no XFrame given to AlignmentPropertyPanel::Create", NULL, 1);
     296           0 :     if (pBindings == NULL)
     297           0 :         throw lang::IllegalArgumentException("no SfxBindings given to AlignmentPropertyPanel::Create", NULL, 2);
     298             : 
     299             :     return new AlignmentPropertyPanel(
     300             :         pParent,
     301             :         rxFrame,
     302           0 :         pBindings);
     303             : }
     304             : 
     305           0 : void AlignmentPropertyPanel::DataChanged(
     306             :     const DataChangedEvent& rEvent)
     307             : {
     308             :     (void)rEvent;
     309           0 : }
     310             : 
     311           0 : void AlignmentPropertyPanel::HandleContextChange(
     312             :     const ::sfx2::sidebar::EnumContext aContext)
     313             : {
     314           0 :     if(maContext == aContext)
     315             :     {
     316             :         // Nothing to do.
     317           0 :         return;
     318             :     }
     319             : 
     320           0 :     maContext = aContext;
     321             : 
     322             :     // todo
     323             : }
     324             : 
     325           0 : void AlignmentPropertyPanel::NotifyItemUpdate(
     326             :     sal_uInt16 nSID,
     327             :     SfxItemState eState,
     328             :     const SfxPoolItem* pState,
     329             :     const bool bIsEnabled)
     330             : {
     331             :     (void)bIsEnabled;
     332             : 
     333           0 :     switch(nSID)
     334             :     {
     335             :     case SID_H_ALIGNCELL:
     336           0 :         if(eState >= SFX_ITEM_DEFAULT && pState && pState->ISA(SvxHorJustifyItem) )
     337             :         {
     338           0 :                 const SvxHorJustifyItem* pItem = (const SvxHorJustifyItem*)pState;
     339           0 :                 meHorAlignState = (SvxCellHorJustify)pItem->GetValue();
     340             :         }
     341             :         else
     342             :         {
     343           0 :             meHorAlignState = SVX_HOR_JUSTIFY_STANDARD;
     344             :         }
     345           0 :         UpdateHorAlign();
     346           0 :         break;
     347             :     case SID_V_ALIGNCELL:
     348           0 :         if(eState >= SFX_ITEM_DEFAULT && pState && pState->ISA(SvxVerJustifyItem) )
     349             :         {
     350           0 :                 const SvxVerJustifyItem* pItem = (const SvxVerJustifyItem*)pState;
     351           0 :                 meVerAlignState = (SvxCellVerJustify)pItem->GetValue();
     352             :         }
     353             :         else
     354             :         {
     355           0 :             meVerAlignState = SVX_VER_JUSTIFY_STANDARD;
     356             :         }
     357           0 :         UpdateVerAlign();
     358           0 :         break;
     359             :     case SID_ATTR_ALIGN_INDENT:
     360           0 :         if(eState >= SFX_ITEM_DEFAULT && pState && pState->ISA(SfxUInt16Item) )
     361             :         {
     362           0 :                 const SfxUInt16Item* pItem = (const SfxUInt16Item*)pState;
     363           0 :                 sal_uInt16 nVal = pItem->GetValue();
     364           0 :                 mpMFLeftIndent->SetValue( CalcToPoint(nVal, SFX_MAPUNIT_TWIP, 1) );
     365             :         }
     366             :         else
     367             :         {
     368           0 :             mpMFLeftIndent->SetValue(0);
     369           0 :             mpMFLeftIndent->SetText(OUString());
     370             :         }
     371           0 :         break;
     372             :     case FID_MERGE_TOGGLE:
     373           0 :         if(eState >= SFX_ITEM_DEFAULT && pState && pState->ISA(SfxBoolItem) )
     374             :         {
     375           0 :             mpCBXMergeCell->Enable();
     376           0 :             const SfxBoolItem* pItem = (const SfxBoolItem*)pState;
     377           0 :             bool bVal = pItem->GetValue();
     378           0 :             if(bVal)
     379           0 :                 mpCBXMergeCell->Check(true);
     380             :             else
     381           0 :                 mpCBXMergeCell->Check(false);
     382             :         }
     383             :         else
     384             :         {
     385           0 :             mpCBXMergeCell->Check(false);
     386           0 :             mpCBXMergeCell->Disable();
     387             :         }
     388           0 :         break;
     389             : 
     390             :     case SID_ATTR_ALIGN_LINEBREAK:
     391           0 :         if(eState == SFX_ITEM_DISABLED)
     392             :         {
     393           0 :             mpCBXWrapText->EnableTriState(false);
     394           0 :             mpCBXWrapText->Check(false);
     395           0 :             mpCBXWrapText->Disable();
     396             :         }
     397             :         else
     398             :         {
     399           0 :             mpCBXWrapText->Enable();
     400           0 :             if(eState >= SFX_ITEM_DEFAULT && pState && pState->ISA(SfxBoolItem) )
     401             :             {
     402           0 :                 mpCBXWrapText->EnableTriState(false);
     403           0 :                 const SfxBoolItem* pItem = (const SfxBoolItem*)pState;
     404           0 :                 bool bVal = pItem->GetValue();
     405           0 :                 if(bVal)
     406           0 :                     mpCBXWrapText->Check(true);
     407             :                 else
     408           0 :                     mpCBXWrapText->Check(false);
     409             :             }
     410           0 :             else if(eState == SFX_ITEM_DONTCARE)
     411             :             {
     412           0 :                 mpCBXWrapText->EnableTriState(true);
     413           0 :                 mpCBXWrapText->SetState(TRISTATE_INDET);
     414             :             }
     415             :         }
     416           0 :         break;
     417             :     case SID_ATTR_ALIGN_DEGREES:
     418           0 :         if (eState >= SFX_ITEM_AVAILABLE)
     419             :         {
     420           0 :             long nTmp = ((const SfxInt32Item*)pState)->GetValue();
     421           0 :             mpMtrAngle->SetValue( nTmp / 100);  //wj
     422           0 :             mpCtrlDial->SetRotation( nTmp );
     423           0 :             switch(nTmp)
     424             :             {
     425             :                 case 0:
     426           0 :                     mpMtrAngle->SelectEntryPos(0);
     427           0 :                 break;
     428             :                 case 4500:
     429           0 :                     mpMtrAngle->SelectEntryPos(1);
     430           0 :                 break;
     431             :                 case 9000:
     432           0 :                     mpMtrAngle->SelectEntryPos(2);
     433           0 :                 break;
     434             :                 case 13500:
     435           0 :                     mpMtrAngle->SelectEntryPos(3);
     436           0 :                 break;
     437             :                 case 18000:
     438           0 :                     mpMtrAngle->SelectEntryPos(4);
     439           0 :                 break;
     440             :                 case 22500:
     441           0 :                     mpMtrAngle->SelectEntryPos(5);
     442           0 :                 break;
     443             :                 case 27000:
     444           0 :                     mpMtrAngle->SelectEntryPos(6);
     445           0 :                 break;
     446             :                 case 31500:
     447           0 :                     mpMtrAngle->SelectEntryPos(7);
     448             :             }
     449             :         }
     450             :         else
     451             :         {
     452           0 :             mpMtrAngle->SetText( OUString() );
     453           0 :             mpCtrlDial->SetRotation( 0 );
     454             :         }
     455           0 :         break;
     456             :     case SID_ATTR_ALIGN_STACKED:
     457           0 :         if (eState >= SFX_ITEM_AVAILABLE)
     458             :         {
     459           0 :             mpCbStacked->EnableTriState(false);
     460           0 :             const SfxBoolItem* aStackItem = (const SfxBoolItem*)pState;
     461           0 :             bool IsChecked = (bool)aStackItem->GetValue();
     462           0 :             if(IsChecked)
     463             :             {
     464           0 :                 mpCbStacked->Check(IsChecked);
     465           0 :                 mpFtRotate->Disable();
     466           0 :                 mpMtrAngle->Disable();
     467           0 :                 mpCtrlDial->Disable();
     468           0 :                 mbMultiDisable = true;
     469             :             }
     470             :             else
     471             :             {
     472           0 :                 mpCbStacked->Check(IsChecked);
     473           0 :                 mpFtRotate->Enable();
     474           0 :                 mpMtrAngle->Enable();
     475           0 :                 mpCtrlDial->Enable();
     476           0 :                 mbMultiDisable = false;
     477             :             }
     478             :         }
     479             :         else
     480             :         {
     481           0 :             mbMultiDisable = true;
     482           0 :             mpFtRotate->Disable();
     483           0 :             mpMtrAngle->Disable();
     484           0 :             mpCtrlDial->Disable();
     485           0 :             mpCbStacked->EnableTriState(true);
     486           0 :             mpCbStacked->SetState(TRISTATE_INDET);
     487             :         }
     488             :     }
     489           0 : }
     490             : 
     491           0 : SfxBindings* AlignmentPropertyPanel::GetBindings()
     492             : {
     493           0 :     return mpBindings;
     494             : }
     495             : 
     496           0 : void AlignmentPropertyPanel::FormatDegrees(double& dTmp)
     497             : {
     498           0 :     while(dTmp<0)
     499           0 :         dTmp += 360;
     500           0 :     while (dTmp > 359)  //modify
     501           0 :         dTmp = 359;
     502           0 : }
     503             : 
     504           0 : void AlignmentPropertyPanel::UpdateHorAlign()
     505             : {
     506           0 :     const sal_uInt16 nIdLeft = mpTBHorizontal->GetItemId(UNO_ALIGNLEFT);
     507           0 :     const sal_uInt16 nIdCenter = mpTBHorizontal->GetItemId(UNO_ALIGNHORIZONTALCENTER);
     508           0 :     const sal_uInt16 nIdRight = mpTBHorizontal->GetItemId(UNO_ALIGNRIGHT);
     509           0 :     const sal_uInt16 nIdBlock = mpTBHorizontal->GetItemId(UNO_ALIGNBLOCK);
     510             : 
     511           0 :     mpTBHorizontal->SetItemState(nIdLeft, TRISTATE_FALSE);
     512           0 :     mpTBHorizontal->SetItemState(nIdCenter, TRISTATE_FALSE);
     513           0 :     mpTBHorizontal->SetItemState(nIdRight, TRISTATE_FALSE);
     514           0 :     mpTBHorizontal->SetItemState(nIdBlock, TRISTATE_FALSE);
     515           0 :     mpFTLeftIndent->Disable();
     516           0 :     mpMFLeftIndent->Disable();
     517           0 :     if(meHorAlignState==SVX_HOR_JUSTIFY_REPEAT)
     518             :     {
     519           0 :         mpFtRotate->Disable();
     520           0 :         mpCtrlDial->Disable();
     521           0 :         mpMtrAngle->Disable();
     522           0 :         mpCbStacked->Disable();
     523             :     }
     524             :     else
     525             :     {
     526           0 :         if(!mbMultiDisable)
     527             :         {
     528           0 :             mpFtRotate->Enable();
     529           0 :             mpCtrlDial->Enable();
     530           0 :             mpMtrAngle->Enable();
     531             :         }
     532             :         else
     533             :         {
     534           0 :             mpFtRotate->Disable();
     535           0 :             mpCtrlDial->Disable();
     536           0 :             mpMtrAngle->Disable();
     537             :         }
     538           0 :         mpCbStacked->Enable();
     539             :     }
     540           0 :     switch(meHorAlignState)
     541             :     {
     542             :     case SVX_HOR_JUSTIFY_LEFT:
     543           0 :         mpTBHorizontal->SetItemState(nIdLeft, TRISTATE_TRUE);
     544           0 :         mpFTLeftIndent->Enable();
     545           0 :         mpMFLeftIndent->Enable();
     546           0 :         break;
     547           0 :     case SVX_HOR_JUSTIFY_CENTER:mpTBHorizontal->SetItemState(nIdCenter, TRISTATE_TRUE);break;
     548           0 :     case SVX_HOR_JUSTIFY_RIGHT: mpTBHorizontal->SetItemState(nIdRight, TRISTATE_TRUE);break;
     549           0 :     case SVX_HOR_JUSTIFY_BLOCK: mpTBHorizontal->SetItemState(nIdBlock, TRISTATE_TRUE);break;
     550             :     default:;
     551             :     }
     552           0 : }
     553             : 
     554           0 : void AlignmentPropertyPanel::UpdateVerAlign()
     555             : {
     556           0 :     const sal_uInt16 nIdTop = mpTBVertical->GetItemId(UNO_ALIGNTOP);
     557           0 :     const sal_uInt16 nIdVCenter = mpTBVertical->GetItemId(UNO_ALIGNVCENTER);
     558           0 :     const sal_uInt16 nIdBottom = mpTBVertical->GetItemId(UNO_ALIGNBOTTOM);
     559             : 
     560           0 :     mpTBVertical->SetItemState(nIdTop, TRISTATE_FALSE);
     561           0 :     mpTBVertical->SetItemState(nIdVCenter, TRISTATE_FALSE);
     562           0 :     mpTBVertical->SetItemState(nIdBottom, TRISTATE_FALSE);
     563             : 
     564           0 :     switch(meVerAlignState)
     565             :     {
     566           0 :     case SVX_VER_JUSTIFY_TOP:   mpTBVertical->SetItemState(nIdTop, TRISTATE_TRUE);break;
     567           0 :     case SVX_VER_JUSTIFY_CENTER:mpTBVertical->SetItemState(nIdVCenter, TRISTATE_TRUE);break;
     568           0 :     case SVX_VER_JUSTIFY_BOTTOM:mpTBVertical->SetItemState(nIdBottom, TRISTATE_TRUE);break;
     569             :     default:;
     570             :     }
     571           0 : }
     572             : 
     573             : 
     574             : // namespace close
     575             : 
     576             : }} // end of namespace ::sc::sidebar
     577             : 
     578             : 
     579             : // eof
     580             : 
     581             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10