LCOV - code coverage report
Current view: top level - cui/source/tabpages - labdlg.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 0 260 0.0 %
Date: 2014-04-11 Functions: 0 23 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 <comphelper/string.hxx>
      21             : #include <cuires.hrc>
      22             : #include <dialmgr.hxx>
      23             : #include <sfx2/app.hxx>
      24             : #include <sfx2/module.hxx>
      25             : #include <swpossizetabpage.hxx>
      26             : #include <tools/shl.hxx>
      27             : #include <vcl/settings.hxx>
      28             : 
      29             : #include <svx/dialogs.hrc>
      30             : #include <svx/svddef.hxx>
      31             : #include <svx/sxcaitm.hxx>
      32             : #include <svx/sxcecitm.hxx>
      33             : #include <svx/sxcgitm.hxx>
      34             : #include <svx/sxcllitm.hxx>
      35             : #include <svx/sxctitm.hxx>
      36             : 
      37             : #include "svx/dlgutil.hxx"
      38             : #include "labdlg.hxx"
      39             : #include "transfrm.hxx"
      40             : 
      41             : // define ----------------------------------------------------------------
      42             : 
      43             : #define AZ_OPTIMAL      0
      44             : #define AZ_VON_OBEN     1
      45             : #define AZ_VON_LINKS    2
      46             : #define AZ_HORIZONTAL   3
      47             : #define AZ_VERTIKAL     4
      48             : 
      49             : #define AT_OBEN         0
      50             : #define AT_MITTE        1
      51             : #define AT_UNTEN        2
      52             : 
      53             : #define BMP_CAPTTYPE_1  1
      54             : #define BMP_CAPTTYPE_2  2
      55             : #define BMP_CAPTTYPE_3  3
      56             : 
      57             : // static ----------------------------------------------------------------
      58             : 
      59             : static sal_uInt16 pCaptionRanges[] =
      60             : {
      61             :     SDRATTR_CAPTIONTYPE,
      62             :     SDRATTR_CAPTIONFIXEDANGLE,
      63             :     SDRATTR_CAPTIONANGLE,
      64             :     SDRATTR_CAPTIONGAP,
      65             :     SDRATTR_CAPTIONESCDIR,
      66             :     SDRATTR_CAPTIONESCISREL,
      67             :     SDRATTR_CAPTIONESCREL,
      68             :     SDRATTR_CAPTIONESCABS,
      69             :     SDRATTR_CAPTIONLINELEN,
      70             :     SDRATTR_CAPTIONFITLINELEN,
      71             :     0
      72             : };
      73             : 
      74             : 
      75             : 
      76           0 : SvxCaptionTabPage::SvxCaptionTabPage(Window* pParent, const SfxItemSet& rInAttrs)
      77             :     : SfxTabPage(pParent, "CalloutPage", "cui/ui/calloutpage.ui", rInAttrs)
      78           0 :     , rOutAttrs(rInAttrs)
      79             : {
      80           0 :     get(m_pCT_CAPTTYPE, "valueset");
      81             : 
      82           0 :     Size aSize(m_pCT_CAPTTYPE->LogicToPixel(Size(187, 38), MAP_APPFONT));
      83           0 :     m_pCT_CAPTTYPE->set_width_request(aSize.Width());
      84           0 :     m_pCT_CAPTTYPE->set_height_request(aSize.Height());
      85             : 
      86           0 :     get(m_pMF_ABSTAND, "spacing");
      87           0 :     get(m_pLB_ANSATZ, "extension");
      88           0 :     get(m_pFT_UM, "byft");
      89           0 :     get(m_pMF_ANSATZ, "by");
      90           0 :     get(m_pFT_ANSATZ_REL, "positionft");
      91           0 :     get(m_pLB_ANSATZ_REL, "position");
      92             : 
      93             :     assert(m_pLB_ANSATZ_REL->GetEntryCount() == 6);
      94           0 :     for (int i = 0;  i < 3; ++i)
      95           0 :         m_aStrHorzList.push_back(m_pLB_ANSATZ_REL->GetEntry(i));
      96           0 :     for (int i = 3;  i < 6; ++i)
      97           0 :         m_aStrVertList.push_back(m_pLB_ANSATZ_REL->GetEntry(i));
      98           0 :     m_pLB_ANSATZ_REL->Clear();
      99             : 
     100           0 :     ListBox *pLineTypes = get<ListBox>("linetypes");
     101             :     assert(pLineTypes->GetEntryCount() == 3);
     102           0 :     for (int i = 0;  i < 3; ++i)
     103           0 :         m_aLineTypes.push_back(pLineTypes->GetEntry(i));
     104             : 
     105           0 :     get(m_pFT_LAENGE, "lengthft");
     106           0 :     get(m_pMF_LAENGE, "length");
     107           0 :     get(m_pCB_LAENGE, "optimal");
     108             : 
     109           0 :     for(sal_uInt16 nBitmap = 0; nBitmap < CAPTYPE_BITMAPS_COUNT; ++nBitmap)
     110             :     {
     111           0 :         FixedImage *pImage = get<FixedImage>(OString("legtyp") + OString::number(nBitmap+1));
     112           0 :         m_aBmpCapTypes[nBitmap] = pImage->GetImage();
     113             :     }
     114             : 
     115             :     //------------install ValueSet--------------------------
     116           0 :     m_pCT_CAPTTYPE->SetStyle( m_pCT_CAPTTYPE->GetStyle() | WB_ITEMBORDER | WB_DOUBLEBORDER | WB_NAMEFIELD );
     117           0 :     m_pCT_CAPTTYPE->SetColCount(5);//XXX
     118           0 :     m_pCT_CAPTTYPE->SetLineCount(1);
     119           0 :     m_pCT_CAPTTYPE->SetSelectHdl(LINK( this, SvxCaptionTabPage, SelectCaptTypeHdl_Impl));
     120             : 
     121           0 :     Image aImage;
     122           0 :     m_pCT_CAPTTYPE->InsertItem(BMP_CAPTTYPE_1, aImage, m_aLineTypes[0]);
     123           0 :     m_pCT_CAPTTYPE->InsertItem(BMP_CAPTTYPE_2, aImage, m_aLineTypes[1]);
     124           0 :     m_pCT_CAPTTYPE->InsertItem(BMP_CAPTTYPE_3, aImage, m_aLineTypes[2]);
     125             : 
     126           0 :     FillValueSet();
     127             : 
     128           0 :     m_pLB_ANSATZ->SetSelectHdl(LINK(this,SvxCaptionTabPage,AnsatzSelectHdl_Impl));
     129           0 :     m_pLB_ANSATZ_REL->SetSelectHdl(LINK(this,SvxCaptionTabPage,AnsatzRelSelectHdl_Impl));
     130           0 :     m_pCB_LAENGE->SetClickHdl(LINK(this,SvxCaptionTabPage,LineOptHdl_Impl));
     131           0 : }
     132             : 
     133             : 
     134             : 
     135           0 : void SvxCaptionTabPage::Construct()
     136             : {
     137             :     // set rectangle and working area
     138             :     DBG_ASSERT( pView, "Keine gueltige View Uebergeben!" );
     139           0 : }
     140             : 
     141             : 
     142             : 
     143           0 : bool SvxCaptionTabPage::FillItemSet( SfxItemSet&  _rOutAttrs)
     144             : {
     145           0 :     SfxItemPool*    pPool = _rOutAttrs.GetPool();
     146             :     DBG_ASSERT( pPool, "Wo ist der Pool" );
     147             : 
     148             :     SfxMapUnit      eUnit;
     149             : 
     150           0 :     nCaptionType = m_pCT_CAPTTYPE->GetSelectItemId()-1;
     151             : 
     152           0 :     _rOutAttrs.Put( SdrCaptionTypeItem( (SdrCaptionType) nCaptionType ) );
     153             : 
     154           0 :     if( m_pMF_ABSTAND->IsValueModified() )
     155             :     {
     156           0 :         eUnit = pPool->GetMetric( GetWhich( SDRATTR_CAPTIONGAP ) );
     157           0 :         _rOutAttrs.Put( SdrCaptionGapItem( GetCoreValue(*m_pMF_ABSTAND, eUnit ) ) );
     158             :     }
     159             : 
     160             :     // special treatment!!! XXX
     161           0 :     if( nCaptionType==SDRCAPT_TYPE1 )
     162             :     {
     163           0 :         switch( nEscDir )
     164             :         {
     165           0 :             case SDRCAPT_ESCHORIZONTAL:     nEscDir=SDRCAPT_ESCVERTICAL;break;
     166           0 :             case SDRCAPT_ESCVERTICAL:       nEscDir=SDRCAPT_ESCHORIZONTAL;break;
     167             :         }
     168             :     }
     169             : 
     170           0 :     _rOutAttrs.Put( SdrCaptionEscDirItem( (SdrCaptionEscDir)nEscDir ) );
     171             : 
     172           0 :     bEscRel = m_pLB_ANSATZ_REL->IsVisible();
     173           0 :     _rOutAttrs.Put( SdrCaptionEscIsRelItem( bEscRel ) );
     174             : 
     175           0 :     if( bEscRel )
     176             :     {
     177           0 :         long    nVal = 0;
     178             : 
     179           0 :         switch( m_pLB_ANSATZ_REL->GetSelectEntryPos() )
     180             :         {
     181           0 :             case AT_OBEN:   nVal=0;break;
     182           0 :             case AT_MITTE:  nVal=5000;break;
     183           0 :             case AT_UNTEN:  nVal=10000;break;
     184             :         }
     185           0 :         _rOutAttrs.Put( SdrCaptionEscRelItem( nVal ) );
     186             :     }
     187             :     else
     188             :     {
     189           0 :         if( m_pMF_ANSATZ->IsValueModified() )
     190             :         {
     191           0 :             eUnit = pPool->GetMetric( GetWhich( SDRATTR_CAPTIONESCABS ) );
     192           0 :             _rOutAttrs.Put( SdrCaptionEscAbsItem( GetCoreValue(*m_pMF_ANSATZ, eUnit ) ) );
     193             :         }
     194             :     }
     195             : 
     196           0 :     bFitLineLen = m_pCB_LAENGE->IsChecked();
     197           0 :     _rOutAttrs.Put( SdrCaptionFitLineLenItem( bFitLineLen ) );
     198             : 
     199           0 :     if( ! bFitLineLen )
     200             :     {
     201           0 :         if( m_pMF_LAENGE->IsValueModified() )
     202             :         {
     203           0 :             eUnit = pPool->GetMetric( GetWhich( SDRATTR_CAPTIONLINELEN ) );
     204           0 :             _rOutAttrs.Put( SdrCaptionLineLenItem( GetCoreValue(*m_pMF_LAENGE, eUnit ) ) );
     205             :         }
     206             :     }
     207             : 
     208             : //NYI-------------the angles have to be added here!!! XXX----------------------
     209             : 
     210           0 :     return true;
     211             : }
     212             : 
     213             : 
     214             : 
     215           0 : void SvxCaptionTabPage::Reset( const SfxItemSet&  )
     216             : {
     217             : 
     218             :     //------------set metric-----------------------------
     219             : 
     220           0 :     FieldUnit eFUnit = GetModuleFieldUnit( rOutAttrs );
     221             : 
     222           0 :     switch ( eFUnit )
     223             :     {
     224             :         case FUNIT_CM:
     225             :         case FUNIT_M:
     226             :         case FUNIT_KM:
     227           0 :             eFUnit = FUNIT_MM;
     228           0 :             break;
     229             :         default: ;//prevent warning
     230             :     }
     231           0 :     SetFieldUnit( *m_pMF_ABSTAND, eFUnit );
     232           0 :     SetFieldUnit( *m_pMF_ANSATZ, eFUnit );
     233           0 :     SetFieldUnit( *m_pMF_LAENGE, eFUnit );
     234             : 
     235           0 :     SfxItemPool*    pPool = rOutAttrs.GetPool();
     236             :     DBG_ASSERT( pPool, "Wo ist der Pool" );
     237             : 
     238             :     sal_uInt16          nWhich;
     239             :     SfxMapUnit      eUnit;
     240             : 
     241           0 :     nWhich = GetWhich( SDRATTR_CAPTIONESCABS );
     242           0 :     eUnit = pPool->GetMetric( nWhich );
     243           0 :     nEscAbs = ( ( const SdrCaptionEscAbsItem& ) rOutAttrs.Get( nWhich ) ).GetValue();
     244           0 :     SetMetricValue( *m_pMF_ANSATZ, nEscAbs, eUnit );
     245           0 :     nEscAbs = static_cast<long>(m_pMF_ANSATZ->GetValue());
     246             : 
     247           0 :     nWhich = GetWhich( SDRATTR_CAPTIONESCREL );
     248           0 :     nEscRel = (long)( ( const SdrCaptionEscRelItem& ) rOutAttrs.Get( nWhich ) ).GetValue();
     249             : 
     250             :     //------- line length ----------
     251           0 :     nWhich = GetWhich( SDRATTR_CAPTIONLINELEN );
     252           0 :     eUnit = pPool->GetMetric( nWhich );
     253           0 :     nLineLen = ( ( const SdrCaptionLineLenItem& ) rOutAttrs.Get( nWhich ) ).GetValue();
     254           0 :     SetMetricValue( *m_pMF_LAENGE, nLineLen, eUnit );
     255           0 :     nLineLen = static_cast<long>(m_pMF_LAENGE->GetValue());
     256             : 
     257             :     //------- distance to box ----------
     258           0 :     nWhich = GetWhich( SDRATTR_CAPTIONGAP );
     259           0 :     eUnit = pPool->GetMetric( nWhich );
     260           0 :     nGap = ( ( const SdrCaptionGapItem& ) rOutAttrs.Get( nWhich ) ).GetValue();
     261           0 :     SetMetricValue( *m_pMF_ABSTAND, nGap, eUnit );
     262           0 :     nGap = static_cast<long>(m_pMF_ABSTAND->GetValue());
     263             : 
     264           0 :     nCaptionType = (short)( ( const SdrCaptionTypeItem& ) rOutAttrs.Get( GetWhich( SDRATTR_CAPTIONTYPE ) ) ).GetValue();
     265           0 :     bFitLineLen = ( ( const SfxBoolItem& ) rOutAttrs.Get( GetWhich( SDRATTR_CAPTIONFITLINELEN ) ) ).GetValue();
     266           0 :     nEscDir = (short)( ( const SdrCaptionEscDirItem& ) rOutAttrs.Get( GetWhich( SDRATTR_CAPTIONESCDIR ) ) ).GetValue();
     267           0 :     bEscRel = ( ( const SfxBoolItem& ) rOutAttrs.Get( GetWhich( SDRATTR_CAPTIONESCISREL ) ) ).GetValue();
     268             : 
     269             :     // special treatment!!! XXX
     270           0 :     if( nCaptionType==SDRCAPT_TYPE1 )
     271             :     {
     272           0 :         switch( nEscDir )
     273             :         {
     274           0 :             case SDRCAPT_ESCHORIZONTAL:     nEscDir=SDRCAPT_ESCVERTICAL;break;
     275           0 :             case SDRCAPT_ESCVERTICAL:       nEscDir=SDRCAPT_ESCHORIZONTAL;break;
     276             :         }
     277             :     }
     278             : 
     279           0 :     nAnsatzRelPos=AT_MITTE;
     280           0 :     nAnsatzTypePos=AZ_OPTIMAL;
     281             : 
     282           0 :     m_pMF_ABSTAND->SetValue( nGap );
     283             : 
     284           0 :     if( nEscDir == SDRCAPT_ESCHORIZONTAL )
     285             :     {
     286           0 :         if( bEscRel )
     287             :         {
     288           0 :             if( nEscRel < 3333 )
     289           0 :                 nAnsatzRelPos = AT_OBEN;
     290           0 :             if( nEscRel > 6666 )
     291           0 :                 nAnsatzRelPos = AT_UNTEN;
     292           0 :             nAnsatzTypePos = AZ_HORIZONTAL;
     293             :         }
     294             :         else
     295             :         {
     296           0 :             nAnsatzTypePos = AZ_VON_OBEN;
     297           0 :             m_pMF_ANSATZ->SetValue( nEscAbs );
     298             :         }
     299             :     }
     300           0 :     else if( nEscDir == SDRCAPT_ESCVERTICAL )
     301             :     {
     302           0 :         if( bEscRel )
     303             :         {
     304           0 :             if( nEscRel < 3333 )
     305           0 :                 nAnsatzRelPos = AT_OBEN;
     306           0 :             if( nEscRel > 6666 )
     307           0 :                 nAnsatzRelPos = AT_UNTEN;
     308           0 :             nAnsatzTypePos = AZ_VERTIKAL;
     309             :         }
     310             :         else
     311             :         {
     312           0 :             nAnsatzTypePos = AZ_VON_LINKS;
     313           0 :             m_pMF_ANSATZ->SetValue( nEscAbs );
     314             :         }
     315             :     }
     316           0 :     else if( nEscDir == SDRCAPT_ESCBESTFIT )
     317             :     {
     318           0 :         nAnsatzTypePos = AZ_OPTIMAL;
     319             :     }
     320             : 
     321           0 :     m_pCB_LAENGE->Check( bFitLineLen );
     322           0 :     m_pMF_LAENGE->SetValue( nLineLen );
     323             : 
     324           0 :     m_pLB_ANSATZ->SelectEntryPos( nAnsatzTypePos );
     325             : 
     326           0 :     SetupAnsatz_Impl( nAnsatzTypePos );
     327           0 :     m_pCT_CAPTTYPE->SelectItem( nCaptionType+1 ); // Enum starts at 0!
     328           0 :     SetupType_Impl( nCaptionType+1 );
     329           0 : }
     330             : 
     331             : 
     332             : 
     333           0 : SfxTabPage* SvxCaptionTabPage::Create( Window* pWindow,
     334             :                 const SfxItemSet& rOutAttrs )
     335             : {
     336           0 :     return( new SvxCaptionTabPage( pWindow, rOutAttrs ) );
     337             : }
     338             : 
     339             : 
     340             : 
     341           0 : sal_uInt16* SvxCaptionTabPage::GetRanges()
     342             : {
     343           0 :     return( pCaptionRanges );
     344             : }
     345             : 
     346             : 
     347             : 
     348           0 : void SvxCaptionTabPage::SetupAnsatz_Impl( sal_uInt16 nType )
     349             : {
     350           0 :     switch( nType )
     351             :     {
     352             :         case AZ_OPTIMAL:
     353           0 :         m_pMF_ANSATZ->Show();
     354           0 :         m_pFT_UM->Show();
     355           0 :         m_pFT_ANSATZ_REL->Hide();
     356           0 :         m_pLB_ANSATZ_REL->Hide();
     357           0 :         nEscDir = SDRCAPT_ESCBESTFIT;
     358           0 :         break;
     359             : 
     360             :         case AZ_VON_OBEN:
     361           0 :         m_pMF_ANSATZ->Show();
     362           0 :         m_pFT_UM->Show();
     363           0 :         m_pFT_ANSATZ_REL->Hide();
     364           0 :         m_pLB_ANSATZ_REL->Hide();
     365           0 :         nEscDir = SDRCAPT_ESCHORIZONTAL;
     366           0 :         break;
     367             : 
     368             :         case AZ_VON_LINKS:
     369           0 :         m_pMF_ANSATZ->Show();
     370           0 :         m_pFT_UM->Show();
     371           0 :         m_pFT_ANSATZ_REL->Hide();
     372           0 :         m_pLB_ANSATZ_REL->Hide();
     373           0 :         nEscDir = SDRCAPT_ESCVERTICAL;
     374           0 :         break;
     375             : 
     376             :         case AZ_HORIZONTAL:
     377           0 :         m_pLB_ANSATZ_REL->Clear();
     378           0 :         for (size_t i = 0 ; i < m_aStrHorzList.size(); ++i)
     379           0 :             m_pLB_ANSATZ_REL->InsertEntry(m_aStrHorzList[i]);
     380           0 :         m_pLB_ANSATZ_REL->SelectEntryPos(nAnsatzRelPos);
     381             : 
     382           0 :         m_pMF_ANSATZ->Hide();
     383           0 :         m_pFT_UM->Hide();
     384           0 :         m_pFT_ANSATZ_REL->Show();
     385           0 :         m_pLB_ANSATZ_REL->Show();
     386           0 :         nEscDir = SDRCAPT_ESCHORIZONTAL;
     387           0 :         break;
     388             : 
     389             :         case AZ_VERTIKAL:
     390           0 :         m_pLB_ANSATZ_REL->Clear();
     391           0 :         for (size_t i = 0 ; i < m_aStrVertList.size(); ++i)
     392           0 :             m_pLB_ANSATZ_REL->InsertEntry(m_aStrVertList[i]);
     393           0 :         m_pLB_ANSATZ_REL->SelectEntryPos(nAnsatzRelPos);
     394             : 
     395           0 :         m_pMF_ANSATZ->Hide();
     396           0 :         m_pFT_UM->Hide();
     397           0 :         m_pFT_ANSATZ_REL->Show();
     398           0 :         m_pLB_ANSATZ_REL->Show();
     399           0 :         nEscDir = SDRCAPT_ESCVERTICAL;
     400           0 :         break;
     401             :     }
     402           0 : }
     403             : 
     404             : 
     405             : 
     406           0 : IMPL_LINK_INLINE_START( SvxCaptionTabPage, AnsatzSelectHdl_Impl, ListBox *, pListBox )
     407             : {
     408           0 :     if (pListBox == m_pLB_ANSATZ)
     409             :     {
     410           0 :         SetupAnsatz_Impl( m_pLB_ANSATZ->GetSelectEntryPos() );
     411             :     }
     412           0 :     return 0;
     413             : }
     414           0 : IMPL_LINK_INLINE_END( SvxCaptionTabPage, AnsatzSelectHdl_Impl, ListBox *, pListBox )
     415             : 
     416             : 
     417             : 
     418           0 : IMPL_LINK_INLINE_START( SvxCaptionTabPage, AnsatzRelSelectHdl_Impl, ListBox *, pListBox )
     419             : {
     420           0 :     if (pListBox == m_pLB_ANSATZ_REL)
     421             :     {
     422           0 :         nAnsatzRelPos = m_pLB_ANSATZ_REL->GetSelectEntryPos();
     423             :     }
     424           0 :     return 0;
     425             : }
     426           0 : IMPL_LINK_INLINE_END( SvxCaptionTabPage, AnsatzRelSelectHdl_Impl, ListBox *, pListBox )
     427             : 
     428             : 
     429             : 
     430           0 : IMPL_LINK( SvxCaptionTabPage, LineOptHdl_Impl, Button *, pButton )
     431             : {
     432           0 :     if (pButton == m_pCB_LAENGE)
     433             :     {
     434           0 :         if( m_pCB_LAENGE->IsChecked() || ! m_pCB_LAENGE->IsEnabled() )
     435             :         {
     436           0 :             m_pFT_LAENGE->Disable();
     437           0 :             m_pMF_LAENGE->Disable();
     438             :         }
     439             :         else
     440             :         {
     441           0 :             m_pFT_LAENGE->Enable();
     442           0 :             m_pMF_LAENGE->Enable();
     443             :         }
     444             :     }
     445           0 :     return 0;
     446             : }
     447             : 
     448             : 
     449             : 
     450           0 : IMPL_LINK_NOARG_INLINE_START(SvxCaptionTabPage, SelectCaptTypeHdl_Impl)
     451             : {
     452           0 :     SetupType_Impl( m_pCT_CAPTTYPE->GetSelectItemId() );
     453           0 :     return 0;
     454             : }
     455           0 : IMPL_LINK_NOARG_INLINE_END(SvxCaptionTabPage, SelectCaptTypeHdl_Impl)
     456             : 
     457             : 
     458             : 
     459           0 : void SvxCaptionTabPage::SetupType_Impl( sal_uInt16 nType )
     460             : {
     461           0 :     switch( nType-1 )
     462             :     {
     463             :         case SDRCAPT_TYPE1:
     464           0 :         m_pFT_LAENGE->Disable();
     465           0 :         m_pCB_LAENGE->Disable();
     466           0 :         LineOptHdl_Impl( m_pCB_LAENGE );
     467           0 :         break;
     468             : 
     469             :         case SDRCAPT_TYPE2:
     470           0 :         m_pFT_LAENGE->Disable();
     471           0 :         m_pCB_LAENGE->Disable();
     472           0 :         LineOptHdl_Impl( m_pCB_LAENGE );
     473           0 :         break;
     474             : 
     475             :         case SDRCAPT_TYPE3:
     476           0 :         m_pFT_LAENGE->Enable();
     477           0 :         m_pCB_LAENGE->Enable();
     478           0 :         LineOptHdl_Impl( m_pCB_LAENGE );
     479           0 :         break;
     480             : 
     481             :         case SDRCAPT_TYPE4:
     482           0 :         m_pFT_LAENGE->Enable();
     483           0 :         m_pCB_LAENGE->Enable();
     484           0 :         LineOptHdl_Impl( m_pCB_LAENGE );
     485           0 :         break;
     486             :     }
     487           0 : }
     488             : 
     489             : 
     490             : 
     491           0 : void SvxCaptionTabPage::DataChanged( const DataChangedEvent& rDCEvt )
     492             : {
     493           0 :     SfxTabPage::DataChanged( rDCEvt );
     494             : 
     495           0 :     if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) )
     496           0 :             FillValueSet();
     497           0 : }
     498             : 
     499             : 
     500             : 
     501           0 : void SvxCaptionTabPage::FillValueSet()
     502             : {
     503           0 :     m_pCT_CAPTTYPE->SetItemImage(BMP_CAPTTYPE_1, m_aBmpCapTypes[0] );
     504           0 :     m_pCT_CAPTTYPE->SetItemImage(BMP_CAPTTYPE_2, m_aBmpCapTypes[1] );
     505           0 :     m_pCT_CAPTTYPE->SetItemImage(BMP_CAPTTYPE_3, m_aBmpCapTypes[2] );
     506           0 : }
     507             : 
     508             : 
     509             : 
     510             : 
     511           0 : SvxCaptionTabDialog::SvxCaptionTabDialog(Window* pParent, const SdrView* pSdrView,
     512             :     sal_uInt16 nAnchorTypes)
     513             :     : SfxTabDialog( pParent, "CalloutDialog", "cui/ui/calloutdialog.ui")
     514             :     , pView(pSdrView)
     515             :     , nAnchorCtrls(nAnchorTypes)
     516             :     , m_nSwPosSizePageId(0)
     517             :     , m_nPositionSizePageId(0)
     518           0 :     , m_nCaptionPageId(0)
     519             : {
     520             :     assert(pView); //Keine gueltige View Uebergeben!
     521             : 
     522             :     //different positioning page in Writer
     523           0 :     if (nAnchorCtrls & 0x00ff)
     524             :     {
     525             :         m_nSwPosSizePageId = AddTabPage("RID_SVXPAGE_SWPOSSIZE", SvxSwPosSizeTabPage::Create,
     526           0 :             SvxSwPosSizeTabPage::GetRanges );
     527           0 :         RemoveTabPage("RID_SVXPAGE_POSITION_SIZE");
     528             :     }
     529             :     else
     530             :     {
     531             :         m_nPositionSizePageId = AddTabPage("RID_SVXPAGE_POSITION_SIZE", SvxPositionSizeTabPage::Create,
     532           0 :             SvxPositionSizeTabPage::GetRanges );
     533           0 :         RemoveTabPage("RID_SVXPAGE_SWPOSSIZE");
     534             :     }
     535             :     m_nCaptionPageId = AddTabPage("RID_SVXPAGE_CAPTION", SvxCaptionTabPage::Create,
     536           0 :         SvxCaptionTabPage::GetRanges );
     537           0 : }
     538             : 
     539           0 : void SvxCaptionTabDialog::PageCreated( sal_uInt16 nId, SfxTabPage &rPage )
     540             : {
     541           0 :     if (nId == m_nPositionSizePageId)
     542             :     {
     543           0 :         ( (SvxPositionSizeTabPage&) rPage ).SetView( pView );
     544           0 :         ( (SvxPositionSizeTabPage&) rPage ).Construct();
     545           0 :         if( nAnchorCtrls & SVX_OBJ_NORESIZE )
     546           0 :             ( (SvxPositionSizeTabPage&) rPage ).DisableResize();
     547             : 
     548           0 :         if( nAnchorCtrls & SVX_OBJ_NOPROTECT )
     549           0 :             ( (SvxPositionSizeTabPage&) rPage ).DisableProtect();
     550             :     }
     551           0 :     else if (nId == m_nSwPosSizePageId)
     552             :     {
     553           0 :         SvxSwPosSizeTabPage& rSwPage = static_cast<SvxSwPosSizeTabPage&>(rPage);
     554           0 :         rSwPage.EnableAnchorTypes(nAnchorCtrls);
     555           0 :         rSwPage.SetValidateFramePosLink( aValidateLink );
     556             :     }
     557           0 :     else if (nId == m_nCaptionPageId)
     558             :     {
     559           0 :         ( (SvxCaptionTabPage&) rPage ).SetView( pView );
     560           0 :         ( (SvxCaptionTabPage&) rPage ).Construct();
     561             :     }
     562           0 : }
     563             : 
     564           0 : void SvxCaptionTabDialog::SetValidateFramePosLink( const Link& rLink )
     565             : {
     566           0 :     aValidateLink = rLink;
     567           0 : }
     568             : 
     569             : 
     570             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10