LCOV - code coverage report
Current view: top level - libreoffice/sw/source/ui/frmdlg - frmdlg.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 79 0.0 %
Date: 2012-12-27 Functions: 0 6 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 <svx/dialogs.hrc>
      21             : #include <hintids.hxx>
      22             : #include <sfx2/viewfrm.hxx>
      23             : #include <svx/htmlmode.hxx>
      24             : #include <fmtfsize.hxx>
      25             : #include <wrtsh.hxx>
      26             : #include <view.hxx>
      27             : #include <docsh.hxx>
      28             : #include <viewopt.hxx>
      29             : #include <frmdlg.hxx>
      30             : #include <frmpage.hxx>
      31             : #include <wrap.hxx>
      32             : #include <column.hxx>
      33             : #include <macassgn.hxx>
      34             : 
      35             : #include <frmui.hrc>
      36             : #include <globals.hrc>
      37             : #include <svx/svxids.hrc>
      38             : #include <svx/flagsdef.hxx>
      39             : #include <svx/svxdlg.hxx>
      40             : 
      41             : /*--------------------------------------------------------------------
      42             :     Description:    the dialog's carrier
      43             :  --------------------------------------------------------------------*/
      44           0 : SwFrmDlg::SwFrmDlg( SfxViewFrame*       pViewFrame,
      45             :                     Window*             pParent,
      46             :                     const SfxItemSet&   rCoreSet,
      47             :                     sal_Bool                bNewFrm,
      48             :                     sal_uInt16              nResType,
      49             :                     sal_Bool                bFormat,
      50             :                     sal_uInt16              nDefPage,
      51             :                     const String*       pStr) :
      52             : 
      53             :     SfxTabDialog(pViewFrame, pParent, SW_RES(nResType), &rCoreSet, pStr != 0),
      54             :     m_bFormat(bFormat),
      55             :     m_bNew(bNewFrm),
      56             :     m_rSet(rCoreSet),
      57             :     m_nDlgType(nResType),
      58           0 :     m_pWrtShell(((SwView*)pViewFrame->GetViewShell())->GetWrtShellPtr())
      59             : {
      60           0 :     FreeResource();
      61           0 :     sal_uInt16 nHtmlMode = ::GetHtmlMode(m_pWrtShell->GetView().GetDocShell());
      62           0 :     m_bHTMLMode = static_cast< sal_Bool >(nHtmlMode & HTMLMODE_ON);
      63             : 
      64             :     // example font for both example TabPages
      65             :     //
      66           0 :     if(pStr)
      67             :     {
      68           0 :         String aTmp( GetText() );
      69           0 :         aTmp += SW_RESSTR(STR_COLL_HEADER);
      70           0 :         aTmp += *pStr;
      71           0 :         aTmp += ')';
      72             :     }
      73             : 
      74           0 :     AddTabPage(TP_FRM_STD,  SwFrmPage::Create, 0);
      75           0 :     AddTabPage(TP_FRM_ADD,  SwFrmAddPage::Create, 0);
      76           0 :     AddTabPage(TP_FRM_WRAP, SwWrapTabPage::Create, 0);
      77           0 :     AddTabPage(TP_FRM_URL,  SwFrmURLPage::Create, 0);
      78           0 :     if(m_nDlgType == DLG_FRM_GRF)
      79             :     {
      80           0 :         AddTabPage( TP_GRF_EXT, SwGrfExtPage::Create, 0 );
      81           0 :         AddTabPage( RID_SVXPAGE_GRFCROP );
      82             :     }
      83           0 :     if (m_nDlgType == DLG_FRM_STD)
      84             :     {
      85           0 :         AddTabPage(TP_COLUMN,   SwColumnPage::Create,    0);
      86             :     }
      87           0 :     SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
      88             :     OSL_ENSURE(pFact, "Dialogdiet fail!");
      89           0 :     AddTabPage(TP_BACKGROUND, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), 0 );
      90           0 :     AddTabPage( TP_MACRO_ASSIGN, pFact->GetTabPageCreatorFunc(RID_SVXPAGE_MACROASSIGN), 0);
      91           0 :     AddTabPage( TP_BORDER, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), 0 );
      92             : 
      93           0 :     if(m_bHTMLMode)
      94             :     {
      95           0 :         switch( m_nDlgType )
      96             :         {
      97             :         case DLG_FRM_STD:
      98           0 :                 RemoveTabPage(TP_COLUMN);
      99             :             // no break
     100             :         case DLG_FRM_OLE:
     101           0 :                 RemoveTabPage(TP_FRM_URL);
     102           0 :                 RemoveTabPage(TP_MACRO_ASSIGN);
     103           0 :             break;
     104             :         case DLG_FRM_GRF:
     105           0 :                 RemoveTabPage(RID_SVXPAGE_GRFCROP);
     106           0 :             break;
     107             :         }
     108           0 :         if( m_nDlgType != DLG_FRM_STD )
     109           0 :             RemoveTabPage(TP_BACKGROUND);
     110             :     }
     111             : 
     112           0 :     if (m_bNew)
     113           0 :         SetCurPageId(TP_FRM_STD);
     114             : 
     115           0 :     if (nDefPage)
     116           0 :         SetCurPageId(nDefPage);
     117           0 : }
     118             : 
     119           0 : SwFrmDlg::~SwFrmDlg()
     120             : {
     121           0 : }
     122             : 
     123           0 : void SwFrmDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage )
     124             : {
     125           0 :     SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
     126           0 :     switch ( nId )
     127             :     {
     128             :     case TP_FRM_STD:
     129           0 :         ((SwFrmPage&)rPage).SetNewFrame(m_bNew);
     130           0 :         ((SwFrmPage&)rPage).SetFormatUsed(m_bFormat);
     131           0 :         ((SwFrmPage&)rPage).SetFrmType(m_nDlgType);
     132           0 :         break;
     133             : 
     134             :     case TP_FRM_ADD:
     135           0 :         ((SwFrmAddPage&)rPage).SetFormatUsed(m_bFormat);
     136           0 :         ((SwFrmAddPage&)rPage).SetFrmType(m_nDlgType);
     137           0 :         ((SwFrmAddPage&)rPage).SetNewFrame(m_bNew);
     138           0 :         ((SwFrmAddPage&)rPage).SetShell(m_pWrtShell);
     139           0 :         break;
     140             : 
     141             :     case TP_FRM_WRAP:
     142           0 :         ((SwWrapTabPage&)rPage).SetNewFrame(m_bNew);
     143           0 :         ((SwWrapTabPage&)rPage).SetFormatUsed(m_bFormat, sal_False);
     144           0 :         ((SwWrapTabPage&)rPage).SetShell(m_pWrtShell);
     145           0 :         break;
     146             : 
     147             :     case TP_COLUMN:
     148             :         {
     149           0 :             ((SwColumnPage&)rPage).SetFrmMode(sal_True);
     150           0 :             ((SwColumnPage&)rPage).SetFormatUsed(m_bFormat);
     151             : 
     152             :             const SwFmtFrmSize& rSize = (const SwFmtFrmSize&)
     153           0 :                                                 m_rSet.Get( RES_FRM_SIZE );
     154           0 :             ((SwColumnPage&)rPage).SetPageWidth( rSize.GetWidth() );
     155             :         }
     156           0 :         break;
     157             : 
     158             :     case TP_MACRO_ASSIGN:
     159             :         {
     160           0 :         SfxAllItemSet aNewSet(*aSet.GetPool());
     161             :         aNewSet.Put( SwMacroAssignDlg::AddEvents(
     162           0 :             DLG_FRM_GRF == m_nDlgType ? MACASSGN_GRAPHIC : DLG_FRM_OLE == m_nDlgType ? MACASSGN_OLE : MACASSGN_FRMURL ) );
     163           0 :         if ( m_pWrtShell )
     164           0 :             rPage.SetFrame( m_pWrtShell->GetView().GetViewFrame()->GetFrame().GetFrameInterface() );
     165           0 :         rPage.PageCreated(aNewSet);
     166           0 :         break;
     167             :         }
     168             : 
     169             :     case TP_BACKGROUND:
     170           0 :         if( DLG_FRM_STD == m_nDlgType )
     171             :         {
     172           0 :             sal_Int32 nFlagType = SVX_SHOW_SELECTOR;
     173           0 :             if(!m_bHTMLMode)
     174           0 :                 nFlagType |= SVX_ENABLE_TRANSPARENCY;
     175           0 :             aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, nFlagType));
     176           0 :             rPage.PageCreated(aSet);
     177             :         }
     178           0 :         break;
     179             : 
     180             :     case TP_BORDER:
     181             :         {
     182           0 :             aSet.Put (SfxUInt16Item(SID_SWMODE_TYPE,SW_BORDER_MODE_FRAME));
     183           0 :             rPage.PageCreated(aSet);
     184             :         }
     185           0 :         break;
     186           0 :     }
     187           0 : }
     188             : 
     189             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10