LCOV - code coverage report
Current view: top level - libreoffice/cui/source/tabpages - dstribut.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 89 1.1 %
Date: 2012-12-17 Functions: 2 13 15.4 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <sfx2/basedlgs.hxx>
      21             : #include <cuires.hrc>
      22             : #include "dstribut.hxx"
      23             : #include "dstribut.hrc"
      24             : #include <svx/dialogs.hrc>
      25             : #include <svx/svddef.hxx>
      26             : #include <dialmgr.hxx>
      27             : #include <tools/shl.hxx>
      28             : 
      29             : static sal_uInt16 pRanges[] =
      30             : {
      31             :     SDRATTR_MEASURE_FIRST,
      32             :     SDRATTR_MEASURE_LAST,
      33             :     0
      34             : };
      35             : 
      36             : /*************************************************************************
      37             : |*
      38             : |* Dialog
      39             : |*
      40             : \************************************************************************/
      41             : 
      42           0 : SvxDistributeDialog::SvxDistributeDialog(
      43             :     Window* pParent,
      44             :     const SfxItemSet& rInAttrs,
      45             :     SvxDistributeHorizontal eHor,
      46             :     SvxDistributeVertical eVer)
      47             : :   SfxSingleTabDialog(pParent, rInAttrs, RID_SVXPAGE_DISTRIBUTE ),
      48           0 :     mpPage(0L)
      49             : {
      50           0 :     mpPage = new SvxDistributePage(this, rInAttrs, eHor, eVer);
      51           0 :     SetTabPage(mpPage);
      52           0 :     SetText(mpPage->GetText());
      53           0 : }
      54             : 
      55             : /*************************************************************************
      56             : |*
      57             : |* Dtor
      58             : |*
      59             : \************************************************************************/
      60             : 
      61           0 : SvxDistributeDialog::~SvxDistributeDialog()
      62             : {
      63           0 : }
      64             : 
      65             : /*************************************************************************
      66             : |*
      67             : |* Tabpage
      68             : |*
      69             : \************************************************************************/
      70             : 
      71           0 : SvxDistributePage::SvxDistributePage(
      72             :     Window* pWindow,
      73             :     const SfxItemSet& rInAttrs,
      74             :     SvxDistributeHorizontal eHor,
      75             :     SvxDistributeVertical eVer)
      76           0 : :   SvxTabPage(pWindow, CUI_RES(RID_SVXPAGE_DISTRIBUTE), rInAttrs),
      77             :     meDistributeHor(eHor),
      78             :     meDistributeVer(eVer),
      79           0 :     maFlHorizontal      (this, CUI_RES(FL_HORIZONTAL    )),
      80           0 :     maBtnHorNone        (this, CUI_RES(BTN_HOR_NONE     )),
      81           0 :     maBtnHorLeft        (this, CUI_RES(BTN_HOR_LEFT     )),
      82           0 :     maBtnHorCenter      (this, CUI_RES(BTN_HOR_CENTER   )),
      83           0 :     maBtnHorDistance    (this, CUI_RES(BTN_HOR_DISTANCE )),
      84           0 :     maBtnHorRight       (this, CUI_RES(BTN_HOR_RIGHT    )),
      85           0 :     maHorLow            (this, CUI_RES(IMG_HOR_LOW      )),
      86           0 :     maHorCenter         (this, CUI_RES(IMG_HOR_CENTER   )),
      87           0 :     maHorDistance       (this, CUI_RES(IMG_HOR_DISTANCE )),
      88           0 :     maHorHigh           (this, CUI_RES(IMG_HOR_HIGH     )),
      89           0 :     maFlVertical        (this, CUI_RES(FL_VERTICAL      )),
      90           0 :     maBtnVerNone        (this, CUI_RES(BTN_VER_NONE     )),
      91           0 :     maBtnVerTop         (this, CUI_RES(BTN_VER_TOP      )),
      92           0 :     maBtnVerCenter      (this, CUI_RES(BTN_VER_CENTER   )),
      93           0 :     maBtnVerDistance    (this, CUI_RES(BTN_VER_DISTANCE )),
      94           0 :     maBtnVerBottom      (this, CUI_RES(BTN_VER_BOTTOM   )),
      95           0 :     maVerLow            (this, CUI_RES(IMG_VER_LOW      )),
      96           0 :     maVerCenter         (this, CUI_RES(IMG_VER_CENTER   )),
      97           0 :     maVerDistance       (this, CUI_RES(IMG_VER_DISTANCE )),
      98           0 :     maVerHigh           (this, CUI_RES(IMG_VER_HIGH     ))
      99             : {
     100           0 :     FreeResource();
     101           0 : }
     102             : 
     103             : /*************************************************************************
     104             : |*
     105             : |* Dtor
     106             : |*
     107             : \************************************************************************/
     108             : 
     109           0 : SvxDistributePage::~SvxDistributePage()
     110             : {
     111           0 : }
     112             : 
     113             : /*************************************************************************
     114             : |*
     115             : |* create the tabpage
     116             : |*
     117             : \************************************************************************/
     118             : 
     119           0 : SfxTabPage* SvxDistributePage::Create(Window* pWindow, const SfxItemSet& rAttrs,
     120             :     SvxDistributeHorizontal eHor, SvxDistributeVertical eVer)
     121             : {
     122           0 :     return(new SvxDistributePage(pWindow, rAttrs, eHor, eVer));
     123             : }
     124             : 
     125           0 : sal_uInt16* SvxDistributePage::GetRanges()
     126             : {
     127           0 :     return(pRanges);
     128             : }
     129             : 
     130           0 : void SvxDistributePage::PointChanged(Window* /*pWindow*/, RECT_POINT /*eRP*/)
     131             : {
     132           0 : }
     133             : 
     134             : /*************************************************************************
     135             : |*
     136             : |* read the delivered Item-Set
     137             : |*
     138             : \************************************************************************/
     139             : 
     140           0 : void SvxDistributePage::Reset(const SfxItemSet& )
     141             : {
     142           0 :     maBtnHorNone.SetState(sal_False);
     143           0 :     maBtnHorLeft.SetState(sal_False);
     144           0 :     maBtnHorCenter.SetState(sal_False);
     145           0 :     maBtnHorDistance.SetState(sal_False);
     146           0 :     maBtnHorRight.SetState(sal_False);
     147             : 
     148           0 :     switch(meDistributeHor)
     149             :     {
     150           0 :         case SvxDistributeHorizontalNone : maBtnHorNone.SetState(sal_True); break;
     151           0 :         case SvxDistributeHorizontalLeft : maBtnHorLeft.SetState(sal_True); break;
     152           0 :         case SvxDistributeHorizontalCenter : maBtnHorCenter.SetState(sal_True); break;
     153           0 :         case SvxDistributeHorizontalDistance : maBtnHorDistance.SetState(sal_True); break;
     154           0 :         case SvxDistributeHorizontalRight    : maBtnHorRight.SetState(sal_True);    break;
     155             :     }
     156             : 
     157           0 :     maBtnVerNone.SetState(sal_False);
     158           0 :     maBtnVerTop.SetState(sal_False);
     159           0 :     maBtnVerCenter.SetState(sal_False);
     160           0 :     maBtnVerDistance.SetState(sal_False);
     161           0 :     maBtnVerBottom.SetState(sal_False);
     162             : 
     163           0 :     switch(meDistributeVer)
     164             :     {
     165           0 :         case SvxDistributeVerticalNone : maBtnVerNone.SetState(sal_True); break;
     166           0 :         case SvxDistributeVerticalTop : maBtnVerTop.SetState(sal_True); break;
     167           0 :         case SvxDistributeVerticalCenter : maBtnVerCenter.SetState(sal_True); break;
     168           0 :         case SvxDistributeVerticalDistance : maBtnVerDistance.SetState(sal_True); break;
     169           0 :         case SvxDistributeVerticalBottom : maBtnVerBottom.SetState(sal_True); break;
     170             :     }
     171           0 : }
     172             : 
     173             : /*************************************************************************
     174             : |*
     175             : |* Fill the delivered Item-Set with dialogbox-attributes
     176             : |*
     177             : \************************************************************************/
     178             : 
     179           0 : sal_Bool SvxDistributePage::FillItemSet( SfxItemSet& )
     180             : {
     181           0 :     SvxDistributeHorizontal eDistributeHor(SvxDistributeHorizontalNone);
     182           0 :     SvxDistributeVertical eDistributeVer(SvxDistributeVerticalNone);
     183             : 
     184           0 :     if(maBtnHorLeft.IsChecked())
     185           0 :         eDistributeHor = SvxDistributeHorizontalLeft;
     186           0 :     else if(maBtnHorCenter.IsChecked())
     187           0 :         eDistributeHor = SvxDistributeHorizontalCenter;
     188           0 :     else if(maBtnHorDistance.IsChecked())
     189           0 :         eDistributeHor = SvxDistributeHorizontalDistance;
     190           0 :     else if(maBtnHorRight.IsChecked())
     191           0 :         eDistributeHor = SvxDistributeHorizontalRight;
     192             : 
     193           0 :     if(maBtnVerTop.IsChecked())
     194           0 :         eDistributeVer = SvxDistributeVerticalTop;
     195           0 :     else if(maBtnVerCenter.IsChecked())
     196           0 :         eDistributeVer = SvxDistributeVerticalCenter;
     197           0 :     else if(maBtnVerDistance.IsChecked())
     198           0 :         eDistributeVer = SvxDistributeVerticalDistance;
     199           0 :     else if(maBtnVerBottom.IsChecked())
     200           0 :         eDistributeVer = SvxDistributeVerticalBottom;
     201             : 
     202           0 :     if(eDistributeHor != meDistributeHor || eDistributeVer != meDistributeVer)
     203             :     {
     204           0 :         meDistributeHor = eDistributeHor;
     205           0 :         meDistributeVer = eDistributeVer;
     206           0 :         return sal_True;
     207             :     }
     208             : 
     209           0 :     return sal_False;
     210           6 : }
     211             : 
     212             : 
     213             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10