LCOV - code coverage report
Current view: top level - cui/source/dialogs - zoom.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 238 0.0 %
Date: 2012-08-25 Functions: 0 19 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 366 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 <svl/itemset.hxx>
      31                 :            : #include <svl/itempool.hxx>
      32                 :            : #include <sfx2/objsh.hxx>
      33                 :            : #include <vcl/msgbox.hxx>
      34                 :            : 
      35                 :            : #define _SVX_ZOOM_CXX
      36                 :            : 
      37                 :            : #include <cuires.hrc>
      38                 :            : #include "zoom.hrc"
      39                 :            : 
      40                 :            : #include "zoom.hxx"
      41                 :            : #include <sfx2/zoomitem.hxx>
      42                 :            : #include <svx/viewlayoutitem.hxx>
      43                 :            : #include <dialmgr.hxx>
      44                 :            : #include <svx/zoom_def.hxx>
      45                 :            : #include <svx/dialogs.hrc>  // RID_SVXDLG_ZOOM
      46                 :            : 
      47                 :            : // static ----------------------------------------------------------------
      48                 :            : 
      49                 :            : #define SPECIAL_FACTOR  ((sal_uInt16)0xFFFF)
      50                 :            : 
      51                 :            : // class SvxZoomDialog ---------------------------------------------------
      52                 :            : 
      53                 :          0 : sal_uInt16 SvxZoomDialog::GetFactor() const
      54                 :            : {
      55         [ #  # ]:          0 :     if ( a100Btn.IsChecked() )
      56                 :          0 :         return 100;
      57         [ #  # ]:          0 :     if ( aUserBtn.IsChecked() )
      58                 :          0 :         return (sal_uInt16)aUserEdit.GetValue();
      59                 :            :     else
      60                 :          0 :         return SPECIAL_FACTOR;
      61                 :            : }
      62                 :            : 
      63                 :            : // -----------------------------------------------------------------------
      64                 :            : 
      65                 :          0 : void SvxZoomDialog::SetFactor( sal_uInt16 nNewFactor, sal_uInt16 nBtnId )
      66                 :            : {
      67                 :          0 :     aUserEdit.Disable();
      68                 :            : 
      69         [ #  # ]:          0 :     if ( !nBtnId )
      70                 :            :     {
      71         [ #  # ]:          0 :         if ( nNewFactor == 100 )
      72                 :            :         {
      73                 :          0 :             a100Btn.Check();
      74                 :          0 :             a100Btn.GrabFocus();
      75                 :            :         }
      76                 :            :         else
      77                 :            :         {
      78                 :          0 :             aUserBtn.Check();
      79                 :          0 :             aUserEdit.Enable();
      80                 :          0 :             aUserEdit.SetValue( (long)nNewFactor );
      81                 :          0 :             aUserEdit.GrabFocus();
      82                 :            :         }
      83                 :            :     }
      84                 :            :     else
      85                 :            :     {
      86                 :          0 :         aUserEdit.SetValue( (long)nNewFactor );
      87                 :            : 
      88         [ #  # ]:          0 :         if ( ZOOMBTN_OPTIMAL == nBtnId )
      89                 :            :         {
      90                 :          0 :             aOptimalBtn.Check();
      91                 :          0 :             aOptimalBtn.GrabFocus();
      92                 :            :         }
      93         [ #  # ]:          0 :         else if ( ZOOMBTN_PAGEWIDTH == nBtnId )
      94                 :            :         {
      95                 :          0 :             aPageWidthBtn.Check();
      96                 :          0 :             aPageWidthBtn.GrabFocus();
      97                 :            :         }
      98         [ #  # ]:          0 :         else if ( ZOOMBTN_WHOLEPAGE == nBtnId )
      99                 :            :         {
     100                 :          0 :             aWholePageBtn.Check();
     101                 :          0 :             aWholePageBtn.GrabFocus();
     102                 :            :         }
     103                 :            :     }
     104                 :          0 : }
     105                 :            : 
     106                 :            : // -----------------------------------------------------------------------
     107                 :            : 
     108                 :          0 : void SvxZoomDialog::HideButton( sal_uInt16 nBtnId )
     109                 :            : {
     110   [ #  #  #  # ]:          0 :     switch ( nBtnId )
     111                 :            :     {
     112                 :            :         case ZOOMBTN_OPTIMAL:
     113                 :          0 :             aOptimalBtn.Hide();
     114                 :          0 :             break;
     115                 :            : 
     116                 :            :         case ZOOMBTN_PAGEWIDTH:
     117                 :          0 :             aPageWidthBtn.Hide();
     118                 :          0 :             break;
     119                 :            : 
     120                 :            :         case ZOOMBTN_WHOLEPAGE:
     121                 :          0 :             aWholePageBtn.Hide();
     122                 :          0 :             break;
     123                 :            : 
     124                 :            :         default:
     125                 :            :             OSL_FAIL( "Falsche Button-Nummer!!!" );
     126                 :            :     }
     127                 :          0 : }
     128                 :            : 
     129                 :            : // -----------------------------------------------------------------------
     130                 :            : 
     131                 :          0 : void SvxZoomDialog::SetLimits( sal_uInt16 nMin, sal_uInt16 nMax )
     132                 :            : {
     133                 :            :     DBG_ASSERT( nMin < nMax, "invalid limits" );
     134                 :          0 :     aUserEdit.SetMin( nMin );
     135                 :          0 :     aUserEdit.SetFirst( nMin );
     136                 :          0 :     aUserEdit.SetMax( nMax );
     137                 :          0 :     aUserEdit.SetLast( nMax );
     138                 :          0 : }
     139                 :            : 
     140                 :            : // -----------------------------------------------------------------------
     141                 :            : 
     142                 :          0 : SvxZoomDialog::SvxZoomDialog( Window* pParent, const SfxItemSet& rCoreSet ) :
     143                 :            : 
     144                 :          0 :     SfxModalDialog( pParent, CUI_RES( RID_SVXDLG_ZOOM ) ),
     145                 :            : 
     146         [ #  # ]:          0 :     aZoomFl         ( this, CUI_RES( FL_ZOOM ) ),
     147         [ #  # ]:          0 :     aOptimalBtn     ( this, CUI_RES( BTN_OPTIMAL ) ),
     148         [ #  # ]:          0 :     aWholePageBtn   ( this, CUI_RES( BTN_WHOLE_PAGE ) ),
     149         [ #  # ]:          0 :     aPageWidthBtn   ( this, CUI_RES( BTN_PAGE_WIDTH ) ),
     150         [ #  # ]:          0 :     a100Btn         ( this, CUI_RES( BTN_100 ) ),
     151         [ #  # ]:          0 :     aUserBtn        ( this, CUI_RES( BTN_USER ) ),
     152         [ #  # ]:          0 :     aUserEdit       ( this, CUI_RES( ED_USER ) ),
     153                 :            : 
     154         [ #  # ]:          0 :     aViewLayoutFl   ( this, CUI_RES( FL_VIEWLAYOUT ) ),
     155         [ #  # ]:          0 :     aAutomaticBtn   ( this, CUI_RES( BTN_AUTOMATIC ) ),
     156         [ #  # ]:          0 :     aSingleBtn      ( this, CUI_RES( BTN_SINGLE ) ),
     157         [ #  # ]:          0 :     aColumnsBtn     ( this, CUI_RES( BTN_COLUMNS ) ),
     158         [ #  # ]:          0 :     aColumnsEdit    ( this, CUI_RES( ED_COLUMNS ) ),
     159         [ #  # ]:          0 :     aBookModeChk    ( this, CUI_RES( CHK_BOOK ) ),
     160                 :            : 
     161         [ #  # ]:          0 :     aBottomFl       ( this, CUI_RES( FL_BOTTOM ) ),
     162         [ #  # ]:          0 :     aOKBtn          ( this, CUI_RES( BTN_ZOOM_OK ) ),
     163         [ #  # ]:          0 :     aCancelBtn      ( this, CUI_RES( BTN_ZOOM_CANCEL ) ),
     164         [ #  # ]:          0 :     aHelpBtn        ( this, CUI_RES( BTN_ZOOM_HELP ) ),
     165                 :            : 
     166                 :            :     rSet        ( rCoreSet ),
     167                 :            :     pOutSet     ( NULL ),
     168 [ #  # ][ #  # ]:          0 :     bModified   ( sal_False )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     169                 :            : 
     170                 :            : {
     171         [ #  # ]:          0 :     Link aLink = LINK( this, SvxZoomDialog, UserHdl );
     172                 :          0 :     a100Btn.SetClickHdl( aLink );
     173                 :          0 :     aOptimalBtn.SetClickHdl( aLink );
     174                 :          0 :     aPageWidthBtn.SetClickHdl( aLink );
     175                 :          0 :     aWholePageBtn.SetClickHdl( aLink );
     176                 :          0 :     aUserBtn.SetClickHdl( aLink );
     177                 :            : 
     178         [ #  # ]:          0 :     Link aViewLayoutLink = LINK( this, SvxZoomDialog, ViewLayoutUserHdl );
     179                 :          0 :     aAutomaticBtn.SetClickHdl( aViewLayoutLink );
     180                 :          0 :     aSingleBtn.SetClickHdl( aViewLayoutLink );
     181                 :          0 :     aColumnsBtn.SetClickHdl( aViewLayoutLink );
     182                 :            : 
     183         [ #  # ]:          0 :     Link aViewLayoutSpinLink = LINK( this, SvxZoomDialog, ViewLayoutSpinHdl );
     184                 :          0 :     aColumnsEdit.SetModifyHdl( aViewLayoutSpinLink );
     185                 :            : 
     186         [ #  # ]:          0 :     Link aViewLayoutCheckLink = LINK( this, SvxZoomDialog, ViewLayoutCheckHdl );
     187                 :          0 :     aBookModeChk.SetClickHdl( aViewLayoutCheckLink );
     188                 :            : 
     189         [ #  # ]:          0 :     aOKBtn.SetClickHdl( LINK( this, SvxZoomDialog, OKHdl ) );
     190         [ #  # ]:          0 :     aUserEdit.SetModifyHdl( LINK( this, SvxZoomDialog, SpinHdl ) );
     191                 :            : 
     192                 :            :     // default values
     193                 :          0 :     sal_uInt16 nValue = 100;
     194                 :          0 :     sal_uInt16 nMin = 10;
     195                 :          0 :     sal_uInt16 nMax = 1000;
     196                 :            : 
     197                 :            :     // maybe get the old value first
     198                 :          0 :     const SfxUInt16Item* pOldUserItem = 0;
     199         [ #  # ]:          0 :     SfxObjectShell* pSh = SfxObjectShell::Current();
     200                 :            : 
     201         [ #  # ]:          0 :     if ( pSh )
     202         [ #  # ]:          0 :         pOldUserItem = (const SfxUInt16Item*)pSh->GetItem( SID_ATTR_ZOOM_USER );
     203                 :            : 
     204         [ #  # ]:          0 :     if ( pOldUserItem )
     205                 :          0 :         nValue = pOldUserItem->GetValue();
     206                 :            : 
     207                 :            :     // initialize UserEdit
     208         [ #  # ]:          0 :     if ( nMin > nValue )
     209                 :          0 :         nMin = nValue;
     210         [ #  # ]:          0 :     if ( nMax < nValue )
     211                 :          0 :         nMax = nValue;
     212         [ #  # ]:          0 :     aUserEdit.SetMin( nMin );
     213         [ #  # ]:          0 :     aUserEdit.SetFirst( nMin );
     214         [ #  # ]:          0 :     aUserEdit.SetMax( nMax );
     215         [ #  # ]:          0 :     aUserEdit.SetLast( nMax );
     216         [ #  # ]:          0 :     aUserEdit.SetValue( nValue );
     217                 :            : 
     218         [ #  # ]:          0 :     aUserEdit.SetAccessibleRelationLabeledBy( &aUserBtn );
     219 [ #  # ][ #  # ]:          0 :     aUserEdit.SetAccessibleName(aUserBtn.GetText());
                 [ #  # ]
     220         [ #  # ]:          0 :     aColumnsEdit.SetAccessibleRelationLabeledBy(&aColumnsBtn);
     221 [ #  # ][ #  # ]:          0 :     aColumnsEdit.SetAccessibleName(aColumnsBtn.GetText());
                 [ #  # ]
     222         [ #  # ]:          0 :     aColumnsEdit.SetAccessibleRelationMemberOf(&aColumnsBtn);
     223         [ #  # ]:          0 :     aBookModeChk.SetAccessibleRelationLabeledBy(&aColumnsBtn);
     224         [ #  # ]:          0 :     aBookModeChk.SetAccessibleRelationMemberOf(&aColumnsBtn);
     225                 :            : 
     226 [ #  # ][ #  # ]:          0 :     const SfxPoolItem& rItem = rSet.Get( rSet.GetPool()->GetWhich( SID_ATTR_ZOOM ) );
     227                 :            : 
     228 [ #  # ][ #  # ]:          0 :     if ( rItem.ISA(SvxZoomItem) )
                 [ #  # ]
     229                 :            :     {
     230                 :          0 :         const SvxZoomItem& rZoomItem = (const SvxZoomItem&)rItem;
     231                 :          0 :         const sal_uInt16 nZoom = rZoomItem.GetValue();
     232                 :          0 :         const SvxZoomType eType = rZoomItem.GetType();
     233                 :          0 :         const sal_uInt16 nValSet = rZoomItem.GetValueSet();
     234                 :          0 :         sal_uInt16 nBtnId = 0;
     235                 :            : 
     236   [ #  #  #  #  :          0 :         switch ( eType )
                   #  # ]
     237                 :            :         {
     238                 :            :             case SVX_ZOOM_OPTIMAL:
     239                 :          0 :                 nBtnId = ZOOMBTN_OPTIMAL;
     240                 :          0 :                 break;
     241                 :            :             case SVX_ZOOM_PAGEWIDTH:
     242                 :          0 :                 nBtnId = ZOOMBTN_PAGEWIDTH;
     243                 :          0 :                 break;
     244                 :            :             case SVX_ZOOM_WHOLEPAGE:
     245                 :          0 :                 nBtnId = ZOOMBTN_WHOLEPAGE;
     246                 :          0 :                 break;
     247                 :            :             case SVX_ZOOM_PERCENT:
     248                 :          0 :                 break;
     249                 :            :             case SVX_ZOOM_PAGEWIDTH_NOBORDER:
     250                 :          0 :                 break;
     251                 :            :         }
     252                 :            : 
     253         [ #  # ]:          0 :         if ( !(SVX_ZOOM_ENABLE_100 & nValSet) )
     254         [ #  # ]:          0 :             a100Btn.Disable();
     255         [ #  # ]:          0 :         if ( !(SVX_ZOOM_ENABLE_OPTIMAL & nValSet) )
     256         [ #  # ]:          0 :             aOptimalBtn.Disable();
     257         [ #  # ]:          0 :         if ( !(SVX_ZOOM_ENABLE_PAGEWIDTH & nValSet) )
     258         [ #  # ]:          0 :             aPageWidthBtn.Disable();
     259         [ #  # ]:          0 :         if ( !(SVX_ZOOM_ENABLE_WHOLEPAGE & nValSet) )
     260         [ #  # ]:          0 :             aWholePageBtn.Disable();
     261         [ #  # ]:          0 :         SetFactor( nZoom, nBtnId );
     262                 :            :     }
     263                 :            :     else
     264                 :            :     {
     265                 :          0 :         const sal_uInt16 nZoom = ( (const SfxUInt16Item&)rItem ).GetValue();
     266         [ #  # ]:          0 :         SetFactor( nZoom );
     267                 :            :     }
     268                 :            : 
     269                 :          0 :     const SfxPoolItem* pViewLayoutItem = 0;
     270 [ #  # ][ #  # ]:          0 :     if ( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_VIEWLAYOUT, sal_False, &pViewLayoutItem ) )
     271                 :            :     {
     272                 :          0 :         const sal_uInt16 nColumns = static_cast<const SvxViewLayoutItem*>(pViewLayoutItem)->GetValue();
     273                 :          0 :         const bool bBookMode  = static_cast<const SvxViewLayoutItem*>(pViewLayoutItem)->IsBookMode();
     274                 :            : 
     275         [ #  # ]:          0 :         if ( 0 == nColumns )
     276                 :            :         {
     277         [ #  # ]:          0 :             aAutomaticBtn.Check();
     278         [ #  # ]:          0 :             aColumnsEdit.SetValue( 2 );
     279         [ #  # ]:          0 :             aColumnsEdit.Disable();
     280         [ #  # ]:          0 :             aBookModeChk.Disable();
     281                 :            :         }
     282         [ #  # ]:          0 :         else if ( 1 == nColumns)
     283                 :            :         {
     284         [ #  # ]:          0 :             aSingleBtn.Check();
     285         [ #  # ]:          0 :             aColumnsEdit.SetValue( 2 );
     286         [ #  # ]:          0 :             aColumnsEdit.Disable();
     287         [ #  # ]:          0 :             aBookModeChk.Disable();
     288                 :            :         }
     289                 :            :         else
     290                 :            :         {
     291         [ #  # ]:          0 :             aColumnsBtn.Check();
     292         [ #  # ]:          0 :             if ( !bBookMode )
     293                 :            :             {
     294         [ #  # ]:          0 :                 aColumnsEdit.SetValue( nColumns );
     295         [ #  # ]:          0 :                 if ( 0 != nColumns % 2 )
     296         [ #  # ]:          0 :                     aBookModeChk.Disable();
     297                 :            :             }
     298                 :            :             else
     299                 :            :             {
     300         [ #  # ]:          0 :                 aColumnsEdit.SetValue( nColumns );
     301         [ #  # ]:          0 :                 aBookModeChk.Check();
     302                 :            :             }
     303                 :            :         }
     304                 :            :     }
     305                 :            :     else
     306                 :            :     {
     307                 :            :         // hide view layout related controls:
     308         [ #  # ]:          0 :         aViewLayoutFl.Disable();
     309         [ #  # ]:          0 :         aAutomaticBtn.Disable();
     310         [ #  # ]:          0 :         aSingleBtn.Disable();
     311         [ #  # ]:          0 :         aColumnsBtn.Disable();
     312         [ #  # ]:          0 :         aColumnsEdit.Disable();
     313         [ #  # ]:          0 :         aBookModeChk.Disable();
     314                 :            :     }
     315                 :            : 
     316         [ #  # ]:          0 :     FreeResource();
     317                 :          0 : }
     318                 :            : 
     319                 :            : // -----------------------------------------------------------------------
     320                 :            : 
     321 [ #  # ][ #  # ]:          0 : SvxZoomDialog::~SvxZoomDialog()
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     322                 :            : {
     323 [ #  # ][ #  # ]:          0 :     delete pOutSet;
     324                 :          0 :     pOutSet = 0;
     325         [ #  # ]:          0 : }
     326                 :            : 
     327                 :            : // -----------------------------------------------------------------------
     328                 :            : 
     329                 :          0 : IMPL_LINK( SvxZoomDialog, UserHdl, RadioButton *, pBtn )
     330                 :            : {
     331                 :          0 :     bModified |= sal_True;
     332                 :            : 
     333         [ #  # ]:          0 :     if ( pBtn == &aUserBtn )
     334                 :            :     {
     335                 :          0 :         aUserEdit.Enable();
     336                 :          0 :         aUserEdit.GrabFocus();
     337                 :            :     }
     338                 :            :     else
     339                 :          0 :         aUserEdit.Disable();
     340                 :          0 :     return 0;
     341                 :            : }
     342                 :            : 
     343                 :            : // -----------------------------------------------------------------------
     344                 :            : 
     345                 :          0 : IMPL_LINK_NOARG(SvxZoomDialog, SpinHdl)
     346                 :            : {
     347         [ #  # ]:          0 :     if ( !aUserBtn.IsChecked() )
     348                 :          0 :         return 0;
     349                 :          0 :     bModified |= sal_True;
     350                 :          0 :     return 0;
     351                 :            : }
     352                 :            : 
     353                 :            : // -----------------------------------------------------------------------
     354                 :            : 
     355                 :          0 : IMPL_LINK( SvxZoomDialog, ViewLayoutUserHdl, RadioButton *, pBtn )
     356                 :            : {
     357                 :          0 :     bModified |= sal_True;
     358                 :            : 
     359         [ #  # ]:          0 :     if ( pBtn == &aAutomaticBtn )
     360                 :            :     {
     361                 :          0 :         aColumnsEdit.Disable();
     362                 :          0 :         aBookModeChk.Disable();
     363                 :            :     }
     364         [ #  # ]:          0 :     else if ( pBtn == &aSingleBtn )
     365                 :            :     {
     366                 :          0 :         aColumnsEdit.Disable();
     367                 :          0 :         aBookModeChk.Disable();
     368                 :            :     }
     369         [ #  # ]:          0 :     else if ( pBtn == &aColumnsBtn )
     370                 :            :     {
     371                 :          0 :         aColumnsEdit.Enable();
     372                 :          0 :         aColumnsEdit.GrabFocus();
     373         [ #  # ]:          0 :         if ( 0 == aColumnsEdit.GetValue() % 2 )
     374                 :          0 :             aBookModeChk.Enable();
     375                 :            :     }
     376                 :            :     else
     377                 :            :     {
     378                 :            :         OSL_FAIL( "Wrong Button" );
     379                 :          0 :         return 0;
     380                 :            :     }
     381                 :            : 
     382                 :          0 :     return 0;
     383                 :            : }
     384                 :            : 
     385                 :            : // -----------------------------------------------------------------------
     386                 :            : 
     387                 :          0 : IMPL_LINK( SvxZoomDialog, ViewLayoutSpinHdl, MetricField *, pEdt )
     388                 :            : {
     389 [ #  # ][ #  # ]:          0 :     if ( pEdt == &aColumnsEdit && !aColumnsBtn.IsChecked() )
                 [ #  # ]
     390                 :          0 :         return 0;
     391                 :            : 
     392         [ #  # ]:          0 :     if ( 0 == aColumnsEdit.GetValue() % 2 )
     393                 :          0 :         aBookModeChk.Enable();
     394                 :            :     else
     395                 :            :     {
     396                 :          0 :         aBookModeChk.Check( sal_False );
     397                 :          0 :         aBookModeChk.Disable();
     398                 :            :     }
     399                 :            : 
     400                 :          0 :     bModified |= sal_True;
     401                 :            : 
     402                 :          0 :     return 0;
     403                 :            : }
     404                 :            : 
     405                 :            : // -----------------------------------------------------------------------
     406                 :            : 
     407                 :          0 : IMPL_LINK( SvxZoomDialog, ViewLayoutCheckHdl, CheckBox *, pChk )
     408                 :            : {
     409 [ #  # ][ #  # ]:          0 :     if ( pChk == &aBookModeChk && !aColumnsBtn.IsChecked() )
                 [ #  # ]
     410                 :          0 :         return 0;
     411                 :            : 
     412                 :          0 :     bModified |= sal_True;
     413                 :            : 
     414                 :          0 :     return 0;
     415                 :            : }
     416                 :            : 
     417                 :            : // -----------------------------------------------------------------------
     418                 :            : 
     419                 :          0 : IMPL_LINK( SvxZoomDialog, OKHdl, Button *, pBtn )
     420                 :            : {
     421 [ #  # ][ #  # ]:          0 :     if ( bModified || &aOKBtn != pBtn )
     422                 :            :     {
     423 [ #  # ][ #  # ]:          0 :         SvxZoomItem aZoomItem( SVX_ZOOM_PERCENT, 0, rSet.GetPool()->GetWhich( SID_ATTR_ZOOM ) );
     424 [ #  # ][ #  # ]:          0 :         SvxViewLayoutItem aViewLayoutItem( 0, false, rSet.GetPool()->GetWhich( SID_ATTR_VIEWLAYOUT ) );
     425                 :            : 
     426         [ #  # ]:          0 :         if ( &aOKBtn == pBtn )
     427                 :            :         {
     428         [ #  # ]:          0 :             sal_uInt16 nFactor = GetFactor();
     429                 :            : 
     430         [ #  # ]:          0 :             if ( SPECIAL_FACTOR == nFactor )
     431                 :            :             {
     432         [ #  # ]:          0 :                 if ( aOptimalBtn.IsChecked() )
     433                 :          0 :                     aZoomItem.SetType( SVX_ZOOM_OPTIMAL );
     434         [ #  # ]:          0 :                 else if ( aPageWidthBtn.IsChecked() )
     435                 :          0 :                     aZoomItem.SetType( SVX_ZOOM_PAGEWIDTH );
     436         [ #  # ]:          0 :                 else if ( aWholePageBtn.IsChecked() )
     437                 :          0 :                     aZoomItem.SetType( SVX_ZOOM_WHOLEPAGE );
     438                 :            :             }
     439                 :            :             else
     440                 :          0 :                 aZoomItem.SetValue( nFactor );
     441                 :            : 
     442         [ #  # ]:          0 :             if ( aAutomaticBtn.IsChecked() )
     443                 :            :             {
     444                 :          0 :                 aViewLayoutItem.SetValue( 0 );
     445                 :          0 :                 aViewLayoutItem.SetBookMode( false );
     446                 :            :             }
     447         [ #  # ]:          0 :             if ( aSingleBtn.IsChecked() )
     448                 :            :             {
     449                 :          0 :                 aViewLayoutItem.SetValue( 1 );
     450                 :          0 :                 aViewLayoutItem.SetBookMode( false );
     451                 :            :             }
     452         [ #  # ]:          0 :             else if ( aColumnsBtn.IsChecked() )
     453                 :            :             {
     454         [ #  # ]:          0 :                 aViewLayoutItem.SetValue( static_cast<sal_uInt16>(aColumnsEdit.GetValue()) );
     455         [ #  # ]:          0 :                 aViewLayoutItem.SetBookMode( aBookModeChk.IsChecked() );
     456                 :            :             }
     457                 :            :         }
     458                 :            :         else
     459                 :            :         {
     460                 :            :             OSL_FAIL( "Wrong Button" );
     461                 :          0 :             return 0;
     462                 :            :         }
     463 [ #  # ][ #  # ]:          0 :         pOutSet = new SfxItemSet( rSet );
     464         [ #  # ]:          0 :         pOutSet->Put( aZoomItem );
     465                 :            : 
     466                 :            :         // don't set attribute in case the whole viewlayout stuff is disabled:
     467 [ #  # ][ #  # ]:          0 :         if ( aViewLayoutFl.IsEnabled() )
     468         [ #  # ]:          0 :             pOutSet->Put( aViewLayoutItem );
     469                 :            : 
     470                 :            :         // memorize value from the UserEdit beyond the dialog
     471         [ #  # ]:          0 :         SfxObjectShell* pSh = SfxObjectShell::Current();
     472                 :            : 
     473         [ #  # ]:          0 :         if ( pSh )
     474                 :            :             pSh->PutItem( SfxUInt16Item( SID_ATTR_ZOOM_USER,
     475 [ #  # ][ #  # ]:          0 :                                          (sal_uInt16)aUserEdit.GetValue() ) );
         [ #  # ][ #  # ]
     476 [ #  # ][ #  # ]:          0 :         EndDialog( RET_OK );
         [ #  # ][ #  # ]
                 [ #  # ]
     477                 :            :     }
     478                 :            :     else
     479                 :          0 :         EndDialog( RET_CANCEL );
     480                 :          0 :     return 0;
     481                 :            : }
     482                 :            : 
     483                 :            : 
     484                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10