LCOV - code coverage report
Current view: top level - cui/source/tabpages - tabline.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 105 0.0 %
Date: 2012-08-25 Functions: 0 8 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 169 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 <tools/shl.hxx>
      30                 :            : #include <vcl/msgbox.hxx>
      31                 :            : #include <unotools/pathoptions.hxx>
      32                 :            : #include <sfx2/app.hxx>
      33                 :            : #include <sfx2/objsh.hxx>
      34                 :            : #include <svx/dialogs.hrc>
      35                 :            : 
      36                 :            : #define _SVX_TABLINE_CXX
      37                 :            : #include <cuires.hrc>
      38                 :            : #include "tabline.hrc"
      39                 :            : 
      40                 :            : #include "cuitabarea.hxx"
      41                 :            : #include "cuitabline.hxx"
      42                 :            : #include "dlgname.hxx"
      43                 :            : #include <dialmgr.hxx>
      44                 :            : #include <svx/svdmodel.hxx>
      45                 :            : #include <svx/xtable.hxx>
      46                 :            : #include "svx/drawitem.hxx"
      47                 :            : 
      48                 :          0 : SvxLineTabDialog::SvxLineTabDialog
      49                 :            : (
      50                 :            :     Window* pParent,
      51                 :            :     const SfxItemSet* pAttr,
      52                 :            :     SdrModel* pModel,
      53                 :            :     const SdrObject* pSdrObj,
      54                 :            :     sal_Bool bHasObj
      55                 :            : ) :
      56                 :            : 
      57                 :          0 :     SfxTabDialog    ( pParent, CUI_RES( RID_SVXDLG_LINE ), pAttr ),
      58                 :            :     pDrawModel      ( pModel ),
      59                 :            :     pObj            ( pSdrObj ),
      60                 :            :     rOutAttrs       ( *pAttr ),
      61                 :            :     pColorList      ( pModel->GetColorList() ),
      62                 :            :     mpNewColorList  ( pModel->GetColorList() ),
      63                 :            :     pDashList       ( pModel->GetDashList() ),
      64                 :            :     pNewDashList    ( pModel->GetDashList() ),
      65                 :            :     pLineEndList    ( pModel->GetLineEndList() ),
      66                 :            :     pNewLineEndList ( pModel->GetLineEndList() ),
      67                 :            :     bObjSelected    ( bHasObj ),
      68                 :            :     nLineEndListState( CT_NONE ),
      69                 :            :     nDashListState( CT_NONE ),
      70                 :            :     mnColorListState( CT_NONE ),
      71                 :            :     nPageType( 0 ), // We use it here primarily to get the right attributes with FillItemSet
      72                 :            :     nDlgType( 0 ),
      73                 :            :     nPosDashLb( 0 ),
      74                 :            :     nPosLineEndLb( 0 ),
      75                 :            :     mnPos( 0 ),
      76 [ #  # ][ #  # ]:          0 :     mbAreaTP( sal_False )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
      77                 :            : {
      78         [ #  # ]:          0 :     FreeResource();
      79                 :            : 
      80                 :          0 :     bool bLineOnly = false;
      81 [ #  # ][ #  # ]:          0 :     if( pObj && pObj->GetObjInventor() == SdrInventor )
         [ #  # ][ #  # ]
      82                 :            :     {
      83 [ #  # ][ #  # ]:          0 :         switch( pObj->GetObjIdentifier() )
      84                 :            :         {
      85                 :            :         case OBJ_LINE:
      86                 :            :         case OBJ_PLIN:
      87                 :            :         case OBJ_PATHLINE:
      88                 :            :         case OBJ_FREELINE:
      89                 :            :         case OBJ_MEASURE:
      90                 :            :         case OBJ_EDGE:
      91                 :          0 :             bLineOnly = true;
      92                 :            : 
      93                 :            :         default:
      94                 :          0 :             break;
      95                 :            :         }
      96                 :            : 
      97                 :            :     }
      98                 :            : 
      99         [ #  # ]:          0 :     AddTabPage( RID_SVXPAGE_LINE, SvxLineTabPage::Create, 0);
     100         [ #  # ]:          0 :     if( bLineOnly )
     101         [ #  # ]:          0 :         AddTabPage( RID_SVXPAGE_SHADOW, SvxShadowTabPage::Create, 0 );
     102                 :            :     else
     103         [ #  # ]:          0 :         RemoveTabPage( RID_SVXPAGE_SHADOW );
     104                 :            : 
     105         [ #  # ]:          0 :     AddTabPage( RID_SVXPAGE_LINE_DEF, SvxLineDefTabPage::Create, 0);
     106         [ #  # ]:          0 :     AddTabPage( RID_SVXPAGE_LINEEND_DEF, SvxLineEndDefTabPage::Create, 0);
     107                 :            : 
     108                 :          0 :     SetCurPageId( RID_SVXPAGE_LINE );
     109                 :            : 
     110                 :          0 :     CancelButton& rBtnCancel = GetCancelButton();
     111         [ #  # ]:          0 :     rBtnCancel.SetClickHdl( LINK( this, SvxLineTabDialog, CancelHdlImpl ) );
     112                 :          0 : }
     113                 :            : 
     114                 :            : // -----------------------------------------------------------------------
     115                 :            : 
     116                 :          0 : SvxLineTabDialog::~SvxLineTabDialog()
     117                 :            : {
     118         [ #  # ]:          0 : }
     119                 :            : 
     120                 :            : // -----------------------------------------------------------------------
     121                 :            : 
     122                 :          0 : void SvxLineTabDialog::SavePalettes()
     123                 :            : {
     124         [ #  # ]:          0 :     SfxObjectShell* pShell = SfxObjectShell::Current();
     125 [ #  # ][ #  # ]:          0 :     if( mpNewColorList != pDrawModel->GetColorList() )
     126                 :            :     {
     127         [ #  # ]:          0 :         pDrawModel->SetPropertyList( static_cast<XPropertyList *>(mpNewColorList.get()) );
     128         [ #  # ]:          0 :         if ( pShell )
     129 [ #  # ][ #  # ]:          0 :             pShell->PutItem( SvxColorListItem( mpNewColorList, SID_COLOR_TABLE ) );
                 [ #  # ]
     130 [ #  # ][ #  # ]:          0 :         pColorList = pDrawModel->GetColorList();
     131                 :            :     }
     132 [ #  # ][ #  # ]:          0 :     if( pNewDashList != pDrawModel->GetDashList() )
     133                 :            :     {
     134         [ #  # ]:          0 :         pDrawModel->SetPropertyList( static_cast<XPropertyList *>(pNewDashList.get()) );
     135         [ #  # ]:          0 :         if ( pShell )
     136 [ #  # ][ #  # ]:          0 :             pShell->PutItem( SvxDashListItem( pNewDashList, SID_DASH_LIST ) );
                 [ #  # ]
     137 [ #  # ][ #  # ]:          0 :         pDashList = pDrawModel->GetDashList();
     138                 :            :     }
     139 [ #  # ][ #  # ]:          0 :     if( pNewLineEndList != pDrawModel->GetLineEndList() )
     140                 :            :     {
     141         [ #  # ]:          0 :         pDrawModel->SetPropertyList( static_cast<XPropertyList *>(pNewLineEndList.get()) );
     142         [ #  # ]:          0 :         if ( pShell )
     143 [ #  # ][ #  # ]:          0 :             pShell->PutItem( SvxLineEndListItem( pNewLineEndList, SID_LINEEND_LIST ) );
                 [ #  # ]
     144 [ #  # ][ #  # ]:          0 :         pLineEndList = pDrawModel->GetLineEndList();
     145                 :            :     }
     146                 :            : 
     147                 :            :     // Save the tables when they have been changed
     148                 :            : 
     149 [ #  # ][ #  # ]:          0 :     const String aPath( SvtPathOptions().GetPalettePath() );
         [ #  # ][ #  # ]
     150                 :            : 
     151         [ #  # ]:          0 :     if( nDashListState & CT_MODIFIED )
     152                 :            :     {
     153         [ #  # ]:          0 :         pDashList->SetPath( aPath );
     154         [ #  # ]:          0 :         pDashList->Save();
     155                 :            : 
     156                 :            :         // Notify ToolBoxControls
     157         [ #  # ]:          0 :         if ( pShell )
     158 [ #  # ][ #  # ]:          0 :             pShell->PutItem( SvxDashListItem( pDashList, SID_DASH_LIST ) );
                 [ #  # ]
     159                 :            :     }
     160                 :            : 
     161         [ #  # ]:          0 :     if( nLineEndListState & CT_MODIFIED )
     162                 :            :     {
     163         [ #  # ]:          0 :         pLineEndList->SetPath( aPath );
     164         [ #  # ]:          0 :         pLineEndList->Save();
     165                 :            : 
     166                 :            :         // Notify ToolBoxControls
     167         [ #  # ]:          0 :         if ( pShell )
     168 [ #  # ][ #  # ]:          0 :             pShell->PutItem( SvxLineEndListItem( pLineEndList, SID_LINEEND_LIST ) );
                 [ #  # ]
     169                 :            :     }
     170                 :            : 
     171         [ #  # ]:          0 :     if( mnColorListState & CT_MODIFIED )
     172                 :            :     {
     173         [ #  # ]:          0 :         pColorList->SetPath( aPath );
     174         [ #  # ]:          0 :         pColorList->Save();
     175                 :            : 
     176                 :            :         // Notify ToolBoxControls
     177         [ #  # ]:          0 :         if ( pShell )
     178 [ #  # ][ #  # ]:          0 :             pShell->PutItem( SvxColorListItem( pColorList, SID_COLOR_TABLE ) );
                 [ #  # ]
     179         [ #  # ]:          0 :     }
     180                 :          0 : }
     181                 :            : 
     182                 :            : // -----------------------------------------------------------------------
     183                 :            : 
     184                 :          0 : short SvxLineTabDialog::Ok()
     185                 :            : {
     186                 :          0 :     SavePalettes();
     187                 :            : 
     188                 :            :     // We return RET_OK if at least one TabPage in FillItemSet() returns sal_True.
     189                 :            :     // We do this by default at the moment.
     190                 :          0 :     return( SfxTabDialog::Ok() );
     191                 :            : }
     192                 :            : 
     193                 :            : // -----------------------------------------------------------------------
     194                 :            : 
     195                 :          0 : IMPL_LINK_NOARG_INLINE_START(SvxLineTabDialog, CancelHdlImpl)
     196                 :            : {
     197                 :          0 :     SavePalettes();
     198                 :            : 
     199                 :          0 :     EndDialog( RET_CANCEL );
     200                 :          0 :     return 0;
     201                 :            : }
     202                 :          0 : IMPL_LINK_NOARG_INLINE_END(SvxLineTabDialog, CancelHdlImpl)
     203                 :            : 
     204                 :            : // -----------------------------------------------------------------------
     205                 :            : 
     206                 :          0 : void SvxLineTabDialog::PageCreated( sal_uInt16 nId, SfxTabPage &rPage )
     207                 :            : {
     208   [ #  #  #  #  :          0 :     switch( nId )
                      # ]
     209                 :            :     {
     210                 :            :         case RID_SVXPAGE_LINE:
     211         [ #  # ]:          0 :             ( (SvxLineTabPage&) rPage ).SetColorList( pColorList );
     212         [ #  # ]:          0 :             ( (SvxLineTabPage&) rPage ).SetDashList( pDashList );
     213         [ #  # ]:          0 :             ( (SvxLineTabPage&) rPage ).SetLineEndList( pLineEndList );
     214                 :          0 :             ( (SvxLineTabPage&) rPage ).SetDlgType( nDlgType );
     215                 :          0 :             ( (SvxLineTabPage&) rPage ).SetPageType( nPageType );
     216                 :          0 :             ( (SvxLineTabPage&) rPage ).SetPosDashLb( &nPosDashLb );
     217                 :          0 :             ( (SvxLineTabPage&) rPage ).SetPosLineEndLb( &nPosLineEndLb );
     218                 :          0 :             ( (SvxLineTabPage&) rPage ).SetDashChgd( &nDashListState );
     219                 :          0 :             ( (SvxLineTabPage&) rPage ).SetLineEndChgd( &nLineEndListState );
     220                 :          0 :             ( (SvxLineTabPage&) rPage ).SetObjSelected( bObjSelected );
     221                 :          0 :             ( (SvxLineTabPage&) rPage ).Construct();
     222                 :          0 :             ( (SvxLineTabPage&) rPage ).SetColorChgd( &mnColorListState );
     223                 :            :             // ActivatePage() is not called the first time
     224                 :          0 :             ( (SvxLineTabPage&) rPage ).ActivatePage( rOutAttrs );
     225                 :          0 :         break;
     226                 :            : 
     227                 :            :         case RID_SVXPAGE_LINE_DEF:
     228         [ #  # ]:          0 :             ( (SvxLineDefTabPage&) rPage ).SetDashList( pDashList );
     229                 :          0 :             ( (SvxLineDefTabPage&) rPage ).SetDlgType( &nDlgType );
     230                 :          0 :             ( (SvxLineDefTabPage&) rPage ).SetPageType( &nPageType );
     231                 :          0 :             ( (SvxLineDefTabPage&) rPage ).SetPosDashLb( &nPosDashLb );
     232                 :          0 :             ( (SvxLineDefTabPage&) rPage ).SetDashChgd( &nDashListState );
     233                 :          0 :             ( (SvxLineDefTabPage&) rPage ).SetObjSelected( bObjSelected );
     234                 :          0 :             ( (SvxLineDefTabPage&) rPage ).Construct();
     235                 :          0 :         break;
     236                 :            : 
     237                 :            :         case RID_SVXPAGE_LINEEND_DEF:
     238         [ #  # ]:          0 :             ( (SvxLineEndDefTabPage&) rPage ).SetLineEndList( pLineEndList );
     239                 :          0 :             ( (SvxLineEndDefTabPage&) rPage ).SetPolyObj( pObj );
     240                 :          0 :             ( (SvxLineEndDefTabPage&) rPage ).SetDlgType( &nDlgType );
     241                 :          0 :             ( (SvxLineEndDefTabPage&) rPage ).SetPageType( &nPageType );
     242                 :          0 :             ( (SvxLineEndDefTabPage&) rPage ).SetPosLineEndLb( &nPosLineEndLb );
     243                 :          0 :             ( (SvxLineEndDefTabPage&) rPage ).SetLineEndChgd( &nLineEndListState );
     244                 :          0 :             ( (SvxLineEndDefTabPage&) rPage ).SetObjSelected( bObjSelected );
     245                 :          0 :             ( (SvxLineEndDefTabPage&) rPage ).Construct();
     246                 :          0 :         break;
     247                 :            : 
     248                 :            :         case RID_SVXPAGE_SHADOW:
     249                 :            :         {
     250         [ #  # ]:          0 :             ( (SvxShadowTabPage&) rPage ).SetColorList( pColorList );
     251                 :          0 :             ( (SvxShadowTabPage&) rPage ).SetPageType( nPageType );
     252                 :          0 :             ( (SvxShadowTabPage&) rPage ).SetDlgType( nDlgType );
     253                 :          0 :             ( (SvxShadowTabPage&) rPage ).SetAreaTP( &mbAreaTP );
     254                 :          0 :             ( (SvxShadowTabPage&) rPage ).SetColorChgd( &mnColorListState );
     255                 :          0 :             ( (SvxShadowTabPage&) rPage ).Construct();
     256                 :            :         }
     257                 :          0 :         break;
     258                 :            :     }
     259                 :          0 : }
     260                 :            : 
     261                 :            : 
     262                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10