LCOV - code coverage report
Current view: top level - cui/source/tabpages - labdlg.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 299 0.0 %
Date: 2012-08-25 Functions: 0 25 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 329 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #include <comphelper/string.hxx>
      30                 :            : #include <tools/shl.hxx>
      31                 :            : #include <sfx2/app.hxx>
      32                 :            : #include <sfx2/module.hxx>
      33                 :            : #include <swpossizetabpage.hxx>
      34                 :            : #include <svx/dialogs.hrc>
      35                 :            : #define _SVX_LABDLG_CXX
      36                 :            : 
      37                 :            : #include <svx/svdattrx.hxx>
      38                 :            : #include <cuires.hrc>
      39                 :            : #include <dialmgr.hxx>
      40                 :            : #include "svx/dlgutil.hxx"
      41                 :            : #include "transfrm.hxx"
      42                 :            : 
      43                 :            : #include "labdlg.hrc"
      44                 :            : #include "labdlg.hxx"
      45                 :            : 
      46                 :            : // define ----------------------------------------------------------------
      47                 :            : 
      48                 :            : #define AZ_OPTIMAL      0
      49                 :            : #define AZ_VON_OBEN     1
      50                 :            : #define AZ_VON_LINKS    2
      51                 :            : #define AZ_HORIZONTAL   3
      52                 :            : #define AZ_VERTIKAL     4
      53                 :            : 
      54                 :            : #define AT_OBEN         0
      55                 :            : #define AT_MITTE        1
      56                 :            : #define AT_UNTEN        2
      57                 :            : 
      58                 :            : #define WK_OPTIMAL      0
      59                 :            : #define WK_30           1
      60                 :            : #define WK_45           2
      61                 :            : #define WK_60           3
      62                 :            : #define WK_90           4
      63                 :            : 
      64                 :            : // static ----------------------------------------------------------------
      65                 :            : 
      66                 :            : static sal_uInt16 pCaptionRanges[] =
      67                 :            : {
      68                 :            :     SDRATTR_CAPTIONTYPE,
      69                 :            :     SDRATTR_CAPTIONFIXEDANGLE,
      70                 :            :     SDRATTR_CAPTIONANGLE,
      71                 :            :     SDRATTR_CAPTIONGAP,
      72                 :            :     SDRATTR_CAPTIONESCDIR,
      73                 :            :     SDRATTR_CAPTIONESCISREL,
      74                 :            :     SDRATTR_CAPTIONESCREL,
      75                 :            :     SDRATTR_CAPTIONESCABS,
      76                 :            :     SDRATTR_CAPTIONLINELEN,
      77                 :            :     SDRATTR_CAPTIONFITLINELEN,
      78                 :            :     0
      79                 :            : };
      80                 :            : 
      81                 :            : // -----------------------------------------------------------------------
      82                 :            : 
      83                 :          0 : SvxCaptionTabPage::SvxCaptionTabPage(Window* pParent, const SfxItemSet& rInAttrs)
      84                 :          0 :  :  SfxTabPage( pParent, CUI_RES( RID_SVXPAGE_CAPTION ), rInAttrs ),
      85                 :            : 
      86         [ #  # ]:          0 :     aCT_CAPTTYPE(       this, CUI_RES( CT_CAPTTYPE ) ),
      87         [ #  # ]:          0 :     aFT_ABSTAND(        this, CUI_RES( FT_ABSTAND ) ),
      88         [ #  # ]:          0 :     aMF_ABSTAND(        this, CUI_RES( MF_ABSTAND ) ),
      89         [ #  # ]:          0 :     aFT_WINKEL(         this, CUI_RES( FT_WINKEL ) ),
      90         [ #  # ]:          0 :     aLB_WINKEL(         this, CUI_RES( LB_WINKEL ) ),
      91         [ #  # ]:          0 :     aFT_ANSATZ(         this, CUI_RES( FT_ANSATZ ) ),
      92         [ #  # ]:          0 :     aLB_ANSATZ(         this, CUI_RES( LB_ANSATZ ) ),
      93         [ #  # ]:          0 :     aFT_UM(             this, CUI_RES( FT_UM ) ),
      94         [ #  # ]:          0 :     aMF_ANSATZ(         this, CUI_RES( MF_ANSATZ ) ),
      95         [ #  # ]:          0 :     aFT_ANSATZ_REL(     this, CUI_RES( FT_ANSATZ_REL ) ),
      96         [ #  # ]:          0 :     aLB_ANSATZ_REL(     this, CUI_RES( LB_ANSATZ_REL ) ),
      97         [ #  # ]:          0 :     aFT_LAENGE(         this, CUI_RES( FT_LAENGE ) ),
      98         [ #  # ]:          0 :     aMF_LAENGE(         this, CUI_RES( MF_LAENGE ) ),
      99         [ #  # ]:          0 :     aCB_LAENGE(         this, CUI_RES( CB_LAENGE ) ),
     100                 :            : 
     101         [ #  # ]:          0 :     aStrHorzList( CUI_RES(STR_HORZ_LIST) ),
     102         [ #  # ]:          0 :     aStrVertList( CUI_RES(STR_VERT_LIST) ),
     103                 :            : 
     104 [ #  # ][ #  # ]:          0 :     rOutAttrs       ( rInAttrs )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     105                 :            : {
     106                 :            :     //------------NYI-------------------------------------------
     107         [ #  # ]:          0 :     aFT_WINKEL.Hide();
     108         [ #  # ]:          0 :     aLB_WINKEL.Hide();
     109                 :            : 
     110                 :            :     //------------correct positions-------------------------
     111 [ #  # ][ #  # ]:          0 :     aFT_ANSATZ_REL.SetPosPixel( aFT_UM.GetPosPixel() );
     112                 :            :     aLB_ANSATZ_REL.SetPosPixel(
     113                 :            :         Point(
     114 [ #  # ][ #  # ]:          0 :             aFT_ANSATZ_REL.GetPosPixel().X()+aFT_ANSATZ_REL.GetSizePixel().Width()+6,
     115         [ #  # ]:          0 :             aLB_ANSATZ.GetPosPixel().Y() )
     116         [ #  # ]:          0 :         );
     117                 :            : 
     118                 :            :     aMF_ANSATZ.SetPosPixel(
     119                 :            :         Point(
     120 [ #  # ][ #  # ]:          0 :             aFT_UM.GetPosPixel().X()+aFT_UM.GetSizePixel().Width()+6,
     121         [ #  # ]:          0 :             aLB_ANSATZ.GetPosPixel().Y() )
     122         [ #  # ]:          0 :         );
     123                 :            : 
     124                 :            :     sal_uInt16 nBitmap;
     125         [ #  # ]:          0 :     for( nBitmap = 0; nBitmap < CAPTYPE_BITMAPS_COUNT; nBitmap++ )
     126 [ #  # ][ #  # ]:          0 :         mpBmpCapTypes[nBitmap]  = new Image(Bitmap(CUI_RES(BMP_CAPTTYPE_1   + nBitmap)), COL_LIGHTMAGENTA );
         [ #  # ][ #  # ]
                 [ #  # ]
     127                 :            : 
     128                 :            :     //------------install ValueSet--------------------------
     129 [ #  # ][ #  # ]:          0 :     aCT_CAPTTYPE.SetStyle( aCT_CAPTTYPE.GetStyle() | WB_ITEMBORDER | WB_DOUBLEBORDER | WB_NAMEFIELD );
     130         [ #  # ]:          0 :     aCT_CAPTTYPE.SetColCount(5);//XXX
     131         [ #  # ]:          0 :     aCT_CAPTTYPE.SetLineCount(1);
     132         [ #  # ]:          0 :     aCT_CAPTTYPE.SetSelectHdl(LINK( this, SvxCaptionTabPage, SelectCaptTypeHdl_Impl));
     133                 :            : 
     134         [ #  # ]:          0 :     Image aImage;
     135 [ #  # ][ #  # ]:          0 :     aCT_CAPTTYPE.InsertItem(BMP_CAPTTYPE_1, aImage, String(CUI_RES(STR_CAPTTYPE_1)));
         [ #  # ][ #  # ]
     136 [ #  # ][ #  # ]:          0 :     aCT_CAPTTYPE.InsertItem(BMP_CAPTTYPE_2, aImage, String(CUI_RES(STR_CAPTTYPE_2)));
         [ #  # ][ #  # ]
     137 [ #  # ][ #  # ]:          0 :     aCT_CAPTTYPE.InsertItem(BMP_CAPTTYPE_3, aImage, String(CUI_RES(STR_CAPTTYPE_3)));
         [ #  # ][ #  # ]
     138                 :            : 
     139         [ #  # ]:          0 :     FillValueSet();
     140                 :            : 
     141         [ #  # ]:          0 :     aLB_ANSATZ.SetSelectHdl(LINK(this,SvxCaptionTabPage,AnsatzSelectHdl_Impl));
     142         [ #  # ]:          0 :     aLB_ANSATZ_REL.SetSelectHdl(LINK(this,SvxCaptionTabPage,AnsatzRelSelectHdl_Impl));
     143         [ #  # ]:          0 :     aCB_LAENGE.SetClickHdl(LINK(this,SvxCaptionTabPage,LineOptHdl_Impl));
     144                 :            : 
     145 [ #  # ][ #  # ]:          0 :     FreeResource();
     146                 :          0 : }
     147                 :            : 
     148                 :            : // -----------------------------------------------------------------------
     149                 :            : 
     150 [ #  # ][ #  # ]:          0 : SvxCaptionTabPage::~SvxCaptionTabPage()
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     151                 :            : {
     152                 :            :     sal_uInt16 nBitmap;
     153         [ #  # ]:          0 :     for( nBitmap = 0; nBitmap < CAPTYPE_BITMAPS_COUNT; nBitmap++ )
     154 [ #  # ][ #  # ]:          0 :         delete mpBmpCapTypes[nBitmap];
     155         [ #  # ]:          0 : }
     156                 :            : 
     157                 :            : // -----------------------------------------------------------------------
     158                 :            : 
     159                 :          0 : void SvxCaptionTabPage::Construct()
     160                 :            : {
     161                 :            :     // set rectangle and working area
     162                 :            :     DBG_ASSERT( pView, "Keine gueltige View Uebergeben!" );
     163                 :          0 : }
     164                 :            : 
     165                 :            : // -----------------------------------------------------------------------
     166                 :            : 
     167                 :          0 : sal_Bool SvxCaptionTabPage::FillItemSet( SfxItemSet&  _rOutAttrs)
     168                 :            : {
     169                 :          0 :     SfxItemPool*    pPool = _rOutAttrs.GetPool();
     170                 :            :     DBG_ASSERT( pPool, "Wo ist der Pool" );
     171                 :            : 
     172                 :            :     SfxMapUnit      eUnit;
     173                 :            : 
     174                 :          0 :     nCaptionType = aCT_CAPTTYPE.GetSelectItemId()-1;
     175                 :            : 
     176         [ #  # ]:          0 :     _rOutAttrs.Put( SdrCaptionTypeItem( (SdrCaptionType) nCaptionType ) );
     177                 :            : 
     178         [ #  # ]:          0 :     if( aMF_ABSTAND.IsValueModified() )
     179                 :            :     {
     180                 :          0 :         eUnit = pPool->GetMetric( GetWhich( SDRATTR_CAPTIONGAP ) );
     181         [ #  # ]:          0 :         _rOutAttrs.Put( SdrCaptionGapItem( GetCoreValue(aMF_ABSTAND, eUnit ) ) );
     182                 :            :     }
     183                 :            : 
     184                 :            :     // special treatment!!! XXX
     185         [ #  # ]:          0 :     if( nCaptionType==SDRCAPT_TYPE1 )
     186                 :            :     {
     187      [ #  #  # ]:          0 :         switch( nEscDir )
     188                 :            :         {
     189                 :          0 :             case SDRCAPT_ESCHORIZONTAL:     nEscDir=SDRCAPT_ESCVERTICAL;break;
     190                 :          0 :             case SDRCAPT_ESCVERTICAL:       nEscDir=SDRCAPT_ESCHORIZONTAL;break;
     191                 :            :         }
     192                 :            :     }
     193                 :            : 
     194         [ #  # ]:          0 :     _rOutAttrs.Put( SdrCaptionEscDirItem( (SdrCaptionEscDir)nEscDir ) );
     195                 :            : 
     196                 :          0 :     bEscRel = aLB_ANSATZ_REL.IsVisible();
     197         [ #  # ]:          0 :     _rOutAttrs.Put( SdrCaptionEscIsRelItem( bEscRel ) );
     198                 :            : 
     199         [ #  # ]:          0 :     if( bEscRel )
     200                 :            :     {
     201                 :          0 :         long    nVal = 0;
     202                 :            : 
     203   [ #  #  #  # ]:          0 :         switch( aLB_ANSATZ_REL.GetSelectEntryPos() )
     204                 :            :         {
     205                 :          0 :             case AT_OBEN:   nVal=0;break;
     206                 :          0 :             case AT_MITTE:  nVal=5000;break;
     207                 :          0 :             case AT_UNTEN:  nVal=10000;break;
     208                 :            :         }
     209         [ #  # ]:          0 :         _rOutAttrs.Put( SdrCaptionEscRelItem( nVal ) );
     210                 :            :     }
     211                 :            :     else
     212                 :            :     {
     213         [ #  # ]:          0 :         if( aMF_ANSATZ.IsValueModified() )
     214                 :            :         {
     215                 :          0 :             eUnit = pPool->GetMetric( GetWhich( SDRATTR_CAPTIONESCABS ) );
     216         [ #  # ]:          0 :             _rOutAttrs.Put( SdrCaptionEscAbsItem( GetCoreValue(aMF_ANSATZ, eUnit ) ) );
     217                 :            :         }
     218                 :            :     }
     219                 :            : 
     220                 :          0 :     bFitLineLen = aCB_LAENGE.IsChecked();
     221         [ #  # ]:          0 :     _rOutAttrs.Put( SdrCaptionFitLineLenItem( bFitLineLen ) );
     222                 :            : 
     223         [ #  # ]:          0 :     if( ! bFitLineLen )
     224                 :            :     {
     225         [ #  # ]:          0 :         if( aMF_LAENGE.IsValueModified() )
     226                 :            :         {
     227                 :          0 :             eUnit = pPool->GetMetric( GetWhich( SDRATTR_CAPTIONLINELEN ) );
     228         [ #  # ]:          0 :             _rOutAttrs.Put( SdrCaptionLineLenItem( GetCoreValue(aMF_LAENGE, eUnit ) ) );
     229                 :            :         }
     230                 :            :     }
     231                 :            : 
     232                 :            : //NYI-------------the angles have to be added here!!! XXX----------------------
     233                 :            : 
     234                 :          0 :     return( sal_True );
     235                 :            : }
     236                 :            : 
     237                 :            : // -----------------------------------------------------------------------
     238                 :            : 
     239                 :          0 : void SvxCaptionTabPage::Reset( const SfxItemSet&  )
     240                 :            : {
     241                 :            : 
     242                 :            :     //------------set metric-----------------------------
     243                 :            : 
     244                 :          0 :     FieldUnit eFUnit = GetModuleFieldUnit( rOutAttrs );
     245                 :            : 
     246         [ #  # ]:          0 :     switch ( eFUnit )
     247                 :            :     {
     248                 :            :         case FUNIT_CM:
     249                 :            :         case FUNIT_M:
     250                 :            :         case FUNIT_KM:
     251                 :          0 :             eFUnit = FUNIT_MM;
     252                 :          0 :             break;
     253                 :            :         default: ;//prevent warning
     254                 :            :     }
     255                 :          0 :     SetFieldUnit( aMF_ABSTAND, eFUnit );
     256                 :          0 :     SetFieldUnit( aMF_ANSATZ, eFUnit );
     257                 :          0 :     SetFieldUnit( aMF_LAENGE, eFUnit );
     258                 :            : 
     259                 :          0 :     SfxItemPool*    pPool = rOutAttrs.GetPool();
     260                 :            :     DBG_ASSERT( pPool, "Wo ist der Pool" );
     261                 :            : 
     262                 :            :     sal_uInt16          nWhich;
     263                 :            :     SfxMapUnit      eUnit;
     264                 :            : 
     265                 :            :     //------- angle ----------
     266                 :          0 :     nWhich = GetWhich( SDRATTR_CAPTIONANGLE );
     267                 :          0 :     nFixedAngle = ( ( const SdrCaptionAngleItem& ) rOutAttrs.Get( nWhich ) ).GetValue();
     268                 :            : 
     269                 :          0 :     nWhich = GetWhich( SDRATTR_CAPTIONESCABS );
     270                 :          0 :     eUnit = pPool->GetMetric( nWhich );
     271                 :          0 :     nEscAbs = ( ( const SdrCaptionEscAbsItem& ) rOutAttrs.Get( nWhich ) ).GetValue();
     272                 :          0 :     SetMetricValue( aMF_ANSATZ, nEscAbs, eUnit );
     273                 :          0 :     nEscAbs = static_cast<long>(aMF_ANSATZ.GetValue());
     274                 :            : 
     275                 :          0 :     nWhich = GetWhich( SDRATTR_CAPTIONESCREL );
     276                 :          0 :     nEscRel = (long)( ( const SdrCaptionEscRelItem& ) rOutAttrs.Get( nWhich ) ).GetValue();
     277                 :            : 
     278                 :            :     //------- line length ----------
     279                 :          0 :     nWhich = GetWhich( SDRATTR_CAPTIONLINELEN );
     280                 :          0 :     eUnit = pPool->GetMetric( nWhich );
     281                 :          0 :     nLineLen = ( ( const SdrCaptionLineLenItem& ) rOutAttrs.Get( nWhich ) ).GetValue();
     282                 :          0 :     SetMetricValue( aMF_LAENGE, nLineLen, eUnit );
     283                 :          0 :     nLineLen = static_cast<long>(aMF_LAENGE.GetValue());
     284                 :            : 
     285                 :            :     //------- distance to box ----------
     286                 :          0 :     nWhich = GetWhich( SDRATTR_CAPTIONGAP );
     287                 :          0 :     eUnit = pPool->GetMetric( nWhich );
     288                 :          0 :     nGap = ( ( const SdrCaptionGapItem& ) rOutAttrs.Get( nWhich ) ).GetValue();
     289                 :          0 :     SetMetricValue( aMF_ABSTAND, nGap, eUnit );
     290                 :          0 :     nGap = static_cast<long>(aMF_ABSTAND.GetValue());
     291                 :            : 
     292                 :          0 :     nCaptionType = (short)( ( const SdrCaptionTypeItem& ) rOutAttrs.Get( GetWhich( SDRATTR_CAPTIONTYPE ) ) ).GetValue();
     293                 :          0 :     bFixedAngle = ( ( const SfxBoolItem& ) rOutAttrs.Get( GetWhich( SDRATTR_CAPTIONFIXEDANGLE ) ) ).GetValue();
     294                 :          0 :     bFitLineLen = ( ( const SfxBoolItem& ) rOutAttrs.Get( GetWhich( SDRATTR_CAPTIONFITLINELEN ) ) ).GetValue();
     295                 :          0 :     nEscDir = (short)( ( const SdrCaptionEscDirItem& ) rOutAttrs.Get( GetWhich( SDRATTR_CAPTIONESCDIR ) ) ).GetValue();
     296                 :          0 :     bEscRel = ( ( const SfxBoolItem& ) rOutAttrs.Get( GetWhich( SDRATTR_CAPTIONESCISREL ) ) ).GetValue();
     297                 :            : 
     298                 :            :     // special treatment!!! XXX
     299         [ #  # ]:          0 :     if( nCaptionType==SDRCAPT_TYPE1 )
     300                 :            :     {
     301      [ #  #  # ]:          0 :         switch( nEscDir )
     302                 :            :         {
     303                 :          0 :             case SDRCAPT_ESCHORIZONTAL:     nEscDir=SDRCAPT_ESCVERTICAL;break;
     304                 :          0 :             case SDRCAPT_ESCVERTICAL:       nEscDir=SDRCAPT_ESCHORIZONTAL;break;
     305                 :            :         }
     306                 :            :     }
     307                 :            : 
     308                 :          0 :     nAnsatzRelPos=AT_MITTE;
     309                 :          0 :     nAnsatzTypePos=AZ_OPTIMAL;
     310                 :          0 :     nWinkelTypePos=WK_OPTIMAL;
     311                 :            : 
     312                 :          0 :     aMF_ABSTAND.SetValue( nGap );
     313                 :            : 
     314         [ #  # ]:          0 :     if( nEscDir == SDRCAPT_ESCHORIZONTAL )
     315                 :            :     {
     316         [ #  # ]:          0 :         if( bEscRel )
     317                 :            :         {
     318         [ #  # ]:          0 :             if( nEscRel < 3333 )
     319                 :          0 :                 nAnsatzRelPos = AT_OBEN;
     320         [ #  # ]:          0 :             if( nEscRel > 6666 )
     321                 :          0 :                 nAnsatzRelPos = AT_UNTEN;
     322                 :          0 :             nAnsatzTypePos = AZ_HORIZONTAL;
     323                 :            :         }
     324                 :            :         else
     325                 :            :         {
     326                 :          0 :             nAnsatzTypePos = AZ_VON_OBEN;
     327                 :          0 :             aMF_ANSATZ.SetValue( nEscAbs );
     328                 :            :         }
     329                 :            :     }
     330         [ #  # ]:          0 :     else if( nEscDir == SDRCAPT_ESCVERTICAL )
     331                 :            :     {
     332         [ #  # ]:          0 :         if( bEscRel )
     333                 :            :         {
     334         [ #  # ]:          0 :             if( nEscRel < 3333 )
     335                 :          0 :                 nAnsatzRelPos = AT_OBEN;
     336         [ #  # ]:          0 :             if( nEscRel > 6666 )
     337                 :          0 :                 nAnsatzRelPos = AT_UNTEN;
     338                 :          0 :             nAnsatzTypePos = AZ_VERTIKAL;
     339                 :            :         }
     340                 :            :         else
     341                 :            :         {
     342                 :          0 :             nAnsatzTypePos = AZ_VON_LINKS;
     343                 :          0 :             aMF_ANSATZ.SetValue( nEscAbs );
     344                 :            :         }
     345                 :            :     }
     346         [ #  # ]:          0 :     else if( nEscDir == SDRCAPT_ESCBESTFIT )
     347                 :            :     {
     348                 :          0 :         nAnsatzTypePos = AZ_OPTIMAL;
     349                 :            :     }
     350                 :            : 
     351         [ #  # ]:          0 :     if( bFixedAngle )
     352                 :            :     {
     353         [ #  # ]:          0 :         if( nFixedAngle <= 3000 )
     354                 :          0 :             nWinkelTypePos=WK_30;
     355         [ #  # ]:          0 :         else if( nFixedAngle <= 4500 )
     356                 :          0 :             nWinkelTypePos=WK_45;
     357         [ #  # ]:          0 :         else if( nFixedAngle <= 6000 )
     358                 :          0 :             nWinkelTypePos=WK_60;
     359                 :            :         else
     360                 :          0 :             nWinkelTypePos=WK_90;
     361                 :            :     }
     362                 :            : 
     363                 :          0 :     aCB_LAENGE.Check( bFitLineLen );
     364                 :          0 :     aMF_LAENGE.SetValue( nLineLen );
     365                 :            : 
     366                 :          0 :     aLB_ANSATZ.SelectEntryPos( nAnsatzTypePos );
     367                 :          0 :     aLB_WINKEL.SelectEntryPos( nWinkelTypePos );
     368                 :            : 
     369                 :          0 :     SetupAnsatz_Impl( nAnsatzTypePos );
     370                 :          0 :     aCT_CAPTTYPE.SelectItem( nCaptionType+1 ); // Enum starts at 0!
     371                 :          0 :     SetupType_Impl( nCaptionType+1 );
     372                 :          0 : }
     373                 :            : 
     374                 :            : // -----------------------------------------------------------------------
     375                 :            : 
     376                 :          0 : SfxTabPage* SvxCaptionTabPage::Create( Window* pWindow,
     377                 :            :                 const SfxItemSet& rOutAttrs )
     378                 :            : {
     379         [ #  # ]:          0 :     return( new SvxCaptionTabPage( pWindow, rOutAttrs ) );
     380                 :            : }
     381                 :            : 
     382                 :            : //------------------------------------------------------------------------
     383                 :            : 
     384                 :          0 : sal_uInt16* SvxCaptionTabPage::GetRanges()
     385                 :            : {
     386                 :          0 :     return( pCaptionRanges );
     387                 :            : }
     388                 :            : 
     389                 :            : //------------------------------------------------------------------------
     390                 :            : 
     391                 :          0 : void SvxCaptionTabPage::SetupAnsatz_Impl( sal_uInt16 nType )
     392                 :            : {
     393                 :          0 :     xub_StrLen  nCnt=0, nIdx=0;
     394                 :            : 
     395   [ #  #  #  #  :          0 :     switch( nType )
                   #  # ]
     396                 :            :     {
     397                 :            :         case AZ_OPTIMAL:
     398                 :            : //      aMF_ANSATZ.Hide(); //XXX in case of OPTIMAL also absolute values are taken
     399                 :            : //      aFT_UM.Hide();
     400                 :          0 :         aMF_ANSATZ.Show();
     401                 :          0 :         aFT_UM.Show();
     402                 :          0 :         aFT_ANSATZ_REL.Hide();
     403                 :          0 :         aLB_ANSATZ_REL.Hide();
     404                 :          0 :         nEscDir = SDRCAPT_ESCBESTFIT;
     405                 :          0 :         break;
     406                 :            : 
     407                 :            :         case AZ_VON_OBEN:
     408                 :          0 :         aMF_ANSATZ.Show();
     409                 :          0 :         aFT_UM.Show();
     410                 :          0 :         aFT_ANSATZ_REL.Hide();
     411                 :          0 :         aLB_ANSATZ_REL.Hide();
     412                 :          0 :         nEscDir = SDRCAPT_ESCHORIZONTAL;
     413                 :          0 :         break;
     414                 :            : 
     415                 :            :         case AZ_VON_LINKS:
     416                 :          0 :         aMF_ANSATZ.Show();
     417                 :          0 :         aFT_UM.Show();
     418                 :          0 :         aFT_ANSATZ_REL.Hide();
     419                 :          0 :         aLB_ANSATZ_REL.Hide();
     420                 :          0 :         nEscDir = SDRCAPT_ESCVERTICAL;
     421                 :          0 :         break;
     422                 :            : 
     423                 :            :         case AZ_HORIZONTAL:
     424                 :          0 :         aLB_ANSATZ_REL.Clear();
     425         [ #  # ]:          0 :         nCnt = comphelper::string::getTokenCount(aStrHorzList, ';');
     426         [ #  # ]:          0 :         for( nIdx=0 ; nIdx<nCnt ; nIdx++ )
     427         [ #  # ]:          0 :             aLB_ANSATZ_REL.InsertEntry( aStrHorzList.GetToken(nIdx) );
     428                 :          0 :         aLB_ANSATZ_REL.SelectEntryPos( nAnsatzRelPos );
     429                 :            : 
     430                 :          0 :         aMF_ANSATZ.Hide();
     431                 :          0 :         aFT_UM.Hide();
     432                 :          0 :         aFT_ANSATZ_REL.Show();
     433                 :          0 :         aLB_ANSATZ_REL.Show();
     434                 :          0 :         nEscDir = SDRCAPT_ESCHORIZONTAL;
     435                 :          0 :         break;
     436                 :            : 
     437                 :            :         case AZ_VERTIKAL:
     438                 :          0 :         aLB_ANSATZ_REL.Clear();
     439         [ #  # ]:          0 :         nCnt = comphelper::string::getTokenCount(aStrVertList, ';');
     440         [ #  # ]:          0 :         for( nIdx=0 ; nIdx<nCnt ; nIdx++ )
     441         [ #  # ]:          0 :             aLB_ANSATZ_REL.InsertEntry( aStrVertList.GetToken(nIdx) );
     442                 :          0 :         aLB_ANSATZ_REL.SelectEntryPos( nAnsatzRelPos );
     443                 :            : 
     444                 :          0 :         aMF_ANSATZ.Hide();
     445                 :          0 :         aFT_UM.Hide();
     446                 :          0 :         aFT_ANSATZ_REL.Show();
     447                 :          0 :         aLB_ANSATZ_REL.Show();
     448                 :          0 :         nEscDir = SDRCAPT_ESCVERTICAL;
     449                 :          0 :         break;
     450                 :            :     }
     451                 :          0 : }
     452                 :            : 
     453                 :            : //------------------------------------------------------------------------
     454                 :            : 
     455                 :          0 : IMPL_LINK_INLINE_START( SvxCaptionTabPage, AnsatzSelectHdl_Impl, ListBox *, pListBox )
     456                 :            : {
     457         [ #  # ]:          0 :     if( pListBox == &aLB_ANSATZ )
     458                 :            :     {
     459                 :          0 :         SetupAnsatz_Impl( aLB_ANSATZ.GetSelectEntryPos() );
     460                 :            :     }
     461                 :          0 :     return 0;
     462                 :            : }
     463                 :          0 : IMPL_LINK_INLINE_END( SvxCaptionTabPage, AnsatzSelectHdl_Impl, ListBox *, pListBox )
     464                 :            : 
     465                 :            : //------------------------------------------------------------------------
     466                 :            : 
     467                 :          0 : IMPL_LINK_INLINE_START( SvxCaptionTabPage, AnsatzRelSelectHdl_Impl, ListBox *, pListBox )
     468                 :            : {
     469         [ #  # ]:          0 :     if( pListBox == &aLB_ANSATZ_REL )
     470                 :            :     {
     471                 :          0 :         nAnsatzRelPos = aLB_ANSATZ_REL.GetSelectEntryPos();
     472                 :            :     }
     473                 :          0 :     return 0;
     474                 :            : }
     475                 :          0 : IMPL_LINK_INLINE_END( SvxCaptionTabPage, AnsatzRelSelectHdl_Impl, ListBox *, pListBox )
     476                 :            : 
     477                 :            : //------------------------------------------------------------------------
     478                 :            : 
     479                 :          0 : IMPL_LINK( SvxCaptionTabPage, LineOptHdl_Impl, Button *, pButton )
     480                 :            : {
     481         [ #  # ]:          0 :     if( pButton == &aCB_LAENGE )
     482                 :            :     {
     483 [ #  # ][ #  # ]:          0 :         if( aCB_LAENGE.IsChecked() || ! aCB_LAENGE.IsEnabled() )
                 [ #  # ]
     484                 :            :         {
     485                 :          0 :             aFT_LAENGE.Disable();
     486                 :          0 :             aMF_LAENGE.Disable();
     487                 :            :         }
     488                 :            :         else
     489                 :            :         {
     490                 :          0 :             aFT_LAENGE.Enable();
     491                 :          0 :             aMF_LAENGE.Enable();
     492                 :            :         }
     493                 :            :     }
     494                 :          0 :     return 0;
     495                 :            : }
     496                 :            : 
     497                 :            : //------------------------------------------------------------------------
     498                 :            : 
     499                 :          0 : IMPL_LINK_NOARG_INLINE_START(SvxCaptionTabPage, SelectCaptTypeHdl_Impl)
     500                 :            : {
     501                 :          0 :     SetupType_Impl( aCT_CAPTTYPE.GetSelectItemId() );
     502                 :          0 :     return 0;
     503                 :            : }
     504                 :          0 : IMPL_LINK_NOARG_INLINE_END(SvxCaptionTabPage, SelectCaptTypeHdl_Impl)
     505                 :            : 
     506                 :            : //------------------------------------------------------------------------
     507                 :            : 
     508                 :          0 : void SvxCaptionTabPage::SetupType_Impl( sal_uInt16 nType )
     509                 :            : {
     510   [ #  #  #  #  :          0 :     switch( nType-1 )
                      # ]
     511                 :            :     {
     512                 :            :         case SDRCAPT_TYPE1:
     513                 :          0 :         aFT_WINKEL.Disable();
     514                 :          0 :         aLB_WINKEL.Disable();
     515                 :          0 :         aFT_LAENGE.Disable();
     516                 :          0 :         aCB_LAENGE.Disable();
     517                 :          0 :         LineOptHdl_Impl( &aCB_LAENGE );
     518                 :          0 :         break;
     519                 :            : 
     520                 :            :         case SDRCAPT_TYPE2:
     521                 :          0 :         aFT_WINKEL.Enable();
     522                 :          0 :         aLB_WINKEL.Enable();
     523                 :          0 :         aFT_LAENGE.Disable();
     524                 :          0 :         aCB_LAENGE.Disable();
     525                 :          0 :         LineOptHdl_Impl( &aCB_LAENGE );
     526                 :          0 :         break;
     527                 :            : 
     528                 :            :         case SDRCAPT_TYPE3:
     529                 :          0 :         aFT_WINKEL.Enable();
     530                 :          0 :         aLB_WINKEL.Enable();
     531                 :          0 :         aFT_LAENGE.Enable();
     532                 :          0 :         aCB_LAENGE.Enable();
     533                 :          0 :         LineOptHdl_Impl( &aCB_LAENGE );
     534                 :          0 :         break;
     535                 :            : 
     536                 :            :         case SDRCAPT_TYPE4:
     537                 :          0 :         aFT_WINKEL.Enable();
     538                 :          0 :         aLB_WINKEL.Enable();
     539                 :          0 :         aFT_LAENGE.Enable();
     540                 :          0 :         aCB_LAENGE.Enable();
     541                 :          0 :         LineOptHdl_Impl( &aCB_LAENGE );
     542                 :          0 :         break;
     543                 :            :     }
     544                 :          0 : }
     545                 :            : 
     546                 :            : // -----------------------------------------------------------------------
     547                 :            : 
     548                 :          0 : void SvxCaptionTabPage::DataChanged( const DataChangedEvent& rDCEvt )
     549                 :            : {
     550                 :          0 :     SfxTabPage::DataChanged( rDCEvt );
     551                 :            : 
     552 [ #  # ][ #  # ]:          0 :     if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) )
                 [ #  # ]
     553                 :          0 :             FillValueSet();
     554                 :          0 : }
     555                 :            : 
     556                 :            : // -----------------------------------------------------------------------
     557                 :            : 
     558                 :          0 : void SvxCaptionTabPage::FillValueSet()
     559                 :            : {
     560                 :          0 :     Image** ppBitmaps = mpBmpCapTypes;
     561                 :          0 :     aCT_CAPTTYPE.SetItemImage(BMP_CAPTTYPE_1, *(ppBitmaps[0]) );
     562                 :          0 :     aCT_CAPTTYPE.SetItemImage(BMP_CAPTTYPE_2, *(ppBitmaps[1]) );
     563                 :          0 :     aCT_CAPTTYPE.SetItemImage(BMP_CAPTTYPE_3, *(ppBitmaps[2]) );
     564                 :          0 : }
     565                 :            : 
     566                 :            : //========================================================================
     567                 :            : 
     568                 :            : 
     569                 :          0 : SvxCaptionTabDialog::SvxCaptionTabDialog(Window* pParent, const SdrView* pSdrView, sal_uInt16 nAnchorTypes)
     570                 :          0 :  :  SfxTabDialog( pParent, CUI_RES( RID_SVXDLG_CAPTION ) ),
     571                 :            :     pView       ( pSdrView ),
     572 [ #  # ][ #  # ]:          0 :     nAnchorCtrls(nAnchorTypes)
     573                 :            : {
     574         [ #  # ]:          0 :     FreeResource();
     575                 :            : 
     576                 :            :     DBG_ASSERT( pView, "Keine gueltige View Uebergeben!" );
     577                 :            : 
     578                 :            :     //different positioning page in Writer
     579         [ #  # ]:          0 :     if(nAnchorCtrls & 0x00ff )
     580                 :            :     {
     581                 :            :         AddTabPage( RID_SVXPAGE_SWPOSSIZE, SvxSwPosSizeTabPage::Create,
     582         [ #  # ]:          0 :                                 SvxSwPosSizeTabPage::GetRanges );
     583         [ #  # ]:          0 :         RemoveTabPage( RID_SVXPAGE_POSITION_SIZE);
     584                 :            :     }
     585                 :            :     else
     586                 :            :     {
     587                 :            :         AddTabPage( RID_SVXPAGE_POSITION_SIZE, SvxPositionSizeTabPage::Create,
     588         [ #  # ]:          0 :                                 SvxPositionSizeTabPage::GetRanges );
     589         [ #  # ]:          0 :         RemoveTabPage( RID_SVXPAGE_SWPOSSIZE );
     590                 :            :     }
     591                 :            :     AddTabPage( RID_SVXPAGE_CAPTION, SvxCaptionTabPage::Create,
     592         [ #  # ]:          0 :                             SvxCaptionTabPage::GetRanges );
     593                 :          0 : }
     594                 :            : 
     595                 :            : // -----------------------------------------------------------------------
     596                 :            : 
     597                 :          0 : SvxCaptionTabDialog::~SvxCaptionTabDialog()
     598                 :            : {
     599         [ #  # ]:          0 : }
     600                 :            : 
     601                 :            : // -----------------------------------------------------------------------
     602                 :            : 
     603                 :          0 : void SvxCaptionTabDialog::PageCreated( sal_uInt16 nId, SfxTabPage &rPage )
     604                 :            : {
     605   [ #  #  #  # ]:          0 :     switch( nId )
     606                 :            :     {
     607                 :            :         case RID_SVXPAGE_POSITION_SIZE:
     608                 :          0 :             ( (SvxPositionSizeTabPage&) rPage ).SetView( pView );
     609                 :          0 :             ( (SvxPositionSizeTabPage&) rPage ).Construct();
     610         [ #  # ]:          0 :             if( nAnchorCtrls & SVX_OBJ_NORESIZE )
     611                 :          0 :                 ( (SvxPositionSizeTabPage&) rPage ).DisableResize();
     612                 :            : 
     613         [ #  # ]:          0 :             if( nAnchorCtrls & SVX_OBJ_NOPROTECT )
     614                 :          0 :                 ( (SvxPositionSizeTabPage&) rPage ).DisableProtect();
     615                 :          0 :         break;
     616                 :            :         case RID_SVXPAGE_SWPOSSIZE :
     617                 :            :         {
     618                 :          0 :             SvxSwPosSizeTabPage& rSwPage = static_cast<SvxSwPosSizeTabPage&>(rPage);
     619                 :          0 :             rSwPage.EnableAnchorTypes(nAnchorCtrls);
     620                 :          0 :             rSwPage.SetValidateFramePosLink( aValidateLink );
     621                 :            :         }
     622                 :          0 :         break;
     623                 :            : 
     624                 :            :         case RID_SVXPAGE_CAPTION:
     625                 :          0 :             ( (SvxCaptionTabPage&) rPage ).SetView( pView );
     626                 :          0 :             ( (SvxCaptionTabPage&) rPage ).Construct();
     627                 :          0 :         break;
     628                 :            :     }
     629                 :          0 : }
     630                 :            : 
     631                 :          0 : void SvxCaptionTabDialog::SetValidateFramePosLink( const Link& rLink )
     632                 :            : {
     633                 :          0 :     aValidateLink = rLink;
     634                 :          0 : }
     635                 :            : 
     636                 :            : 
     637                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10