LCOV - code coverage report
Current view: top level - reportdesign/source/ui/dlg - PageNumber.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 44 0.0 %
Date: 2014-04-14 Functions: 0 4 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             : #include "PageNumber.hxx"
      20             : #include <com/sun/star/beans/XPropertySet.hpp>
      21             : #include <tools/debug.hxx>
      22             : #include "RptResId.hrc"
      23             : #include "rptui_slotid.hrc"
      24             : #include "ModuleHelper.hxx"
      25             : #include "RptDef.hxx"
      26             : #include "helpids.hrc"
      27             : #include <vcl/msgbox.hxx>
      28             : #include <vcl/settings.hxx>
      29             : 
      30             : #include "UITools.hxx"
      31             : #include "uistrings.hrc"
      32             : #include "ReportController.hxx"
      33             : #include <com/sun/star/report/XFixedText.hpp>
      34             : #include <algorithm>
      35             : 
      36             : namespace rptui
      37             : {
      38             : using namespace ::com::sun::star;
      39             : using namespace ::comphelper;
      40             : 
      41             : 
      42             : // class OPageNumberDialog
      43             : 
      44           0 : OPageNumberDialog::OPageNumberDialog( Window* _pParent
      45             :                                            ,const uno::Reference< report::XReportDefinition >& _xHoldAlive
      46             :                                            ,OReportController* _pController)
      47             :     : ModalDialog( _pParent, "PageNumberDialog" , "modules/dbreport/ui/pagenumberdialog.ui" )
      48             :     ,m_pController(_pController)
      49           0 :     ,m_xHoldAlive(_xHoldAlive)
      50             : {
      51           0 :     get(m_pPageN,"pagen");
      52           0 :     get(m_pPageNofM,"pagenofm");
      53           0 :     get(m_pTopPage,"toppage");
      54           0 :     get(m_pBottomPage,"bottompage");
      55           0 :     get(m_pAlignmentLst,"alignment");
      56           0 :     get(m_pShowNumberOnFirstPage,"shownumberonfirstpage");
      57             : 
      58             : 
      59           0 :     m_pShowNumberOnFirstPage->Hide();
      60             : 
      61           0 : }
      62             : 
      63             : 
      64           0 : OPageNumberDialog::~OPageNumberDialog()
      65             : {
      66           0 : }
      67             : 
      68           0 : short OPageNumberDialog::Execute()
      69             : {
      70           0 :     short nRet = ModalDialog::Execute();
      71           0 :     if ( nRet == RET_OK )
      72             :     {
      73             :         try
      74             :         {
      75           0 :             sal_Int32 nControlMaxSize = 3000;
      76           0 :             sal_Int32 nPosX = 0;
      77           0 :             sal_Int32 nPos2X = 0;
      78           0 :             awt::Size aRptSize = getStyleProperty<awt::Size>(m_xHoldAlive,PROPERTY_PAPERSIZE);
      79           0 :             switch ( m_pAlignmentLst->GetSelectEntryPos() )
      80             :             {
      81             :                 case 0: // left
      82           0 :                     nPosX = getStyleProperty<sal_Int32>(m_xHoldAlive,PROPERTY_LEFTMARGIN);
      83           0 :                     break;
      84             :                 case 1: // middle
      85           0 :                     nPosX = getStyleProperty<sal_Int32>(m_xHoldAlive,PROPERTY_LEFTMARGIN) + (aRptSize.Width - getStyleProperty<sal_Int32>(m_xHoldAlive,PROPERTY_LEFTMARGIN) - getStyleProperty<sal_Int32>(m_xHoldAlive,PROPERTY_RIGHTMARGIN) - nControlMaxSize) / 2;
      86           0 :                     break;
      87             :                 case 2: // right
      88           0 :                     nPosX = (aRptSize.Width - getStyleProperty<sal_Int32>(m_xHoldAlive,PROPERTY_RIGHTMARGIN) - nControlMaxSize);
      89           0 :                     break;
      90             :                 case 3: // inner
      91             :                 case 4: // outer
      92           0 :                     nPosX = getStyleProperty<sal_Int32>(m_xHoldAlive,PROPERTY_LEFTMARGIN);
      93           0 :                     nPos2X = (aRptSize.Width - getStyleProperty<sal_Int32>(m_xHoldAlive,PROPERTY_RIGHTMARGIN) - nControlMaxSize);
      94           0 :                     break;
      95             :                 default:
      96           0 :                     break;
      97             :             }
      98           0 :             if ( m_pAlignmentLst->GetSelectEntryPos() > 2 )
      99           0 :                 nPosX = nPos2X;
     100             : 
     101           0 :             sal_Int32 nLength = 0;
     102           0 :             uno::Sequence<beans::PropertyValue> aValues( 3 );
     103           0 :             aValues[nLength].Name = PROPERTY_POSITION;
     104           0 :             aValues[nLength++].Value <<= awt::Point(nPosX,0);
     105             : 
     106           0 :             aValues[nLength].Name = PROPERTY_PAGEHEADERON;
     107           0 :             aValues[nLength++].Value <<= m_pTopPage->IsChecked();
     108             : 
     109           0 :             aValues[nLength].Name = PROPERTY_STATE;
     110           0 :             aValues[nLength++].Value <<= m_pPageNofM->IsChecked();
     111             : 
     112           0 :             m_pController->executeChecked(SID_INSERT_FLD_PGNUMBER,aValues);
     113             :         }
     114           0 :         catch(uno::Exception&)
     115             :         {
     116           0 :             nRet = RET_NO;
     117             :         }
     118             :     }
     119           0 :     return nRet;
     120             : }
     121             : 
     122             : } // rptui
     123             : 
     124             : 
     125             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10