LCOV - code coverage report
Current view: top level - sw/source/ui/frmdlg - frmdlg.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 0 80 0.0 %
Date: 2014-11-03 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 <sfx2/htmlmode.hxx>
      24             : #include <fmtfsize.hxx>
      25             : #include <wrtsh.hxx>
      26             : #include <doc.hxx>
      27             : #include <view.hxx>
      28             : #include <docsh.hxx>
      29             : #include <viewopt.hxx>
      30             : #include <frmdlg.hxx>
      31             : #include <frmpage.hxx>
      32             : #include <wrap.hxx>
      33             : #include <column.hxx>
      34             : #include <macassgn.hxx>
      35             : 
      36             : #include <frmui.hrc>
      37             : #include <globals.hrc>
      38             : #include <svx/svxids.hrc>
      39             : #include <svx/flagsdef.hxx>
      40             : #include <svx/svxdlg.hxx>
      41             : #include <svx/svdmodel.hxx>
      42             : #include <svx/drawitem.hxx>
      43             : #include <svx/xfillit0.hxx>
      44             : #include <svx/xflgrit.hxx>
      45             : 
      46             : // the dialog's carrier
      47           0 : SwFrmDlg::SwFrmDlg( SfxViewFrame*       pViewFrame,
      48             :                     vcl::Window*             pParent,
      49             :                     const SfxItemSet&   rCoreSet,
      50             :                     bool                bNewFrm,
      51             :                     const OString&      sResType,
      52             :                     bool                bFormat,
      53             :                     const OString&      sDefPage,
      54             :                     const OUString*     pStr)
      55             : 
      56             :     : SfxTabDialog(pViewFrame, pParent, sResType,
      57           0 :         OUString("modules/swriter/ui/") +
      58           0 :         OStringToOUString(sResType.toAsciiLowerCase(), RTL_TEXTENCODING_UTF8) +
      59             :         (".ui"), &rCoreSet, pStr != 0)
      60             :     , m_bFormat(bFormat)
      61             :     , m_bNew(bNewFrm)
      62             :     , m_rSet(rCoreSet)
      63             :     , m_sDlgType(sResType)
      64           0 :     , m_pWrtShell(((SwView*)pViewFrame->GetViewShell())->GetWrtShellPtr())
      65             :     , m_nStdId(0)
      66             :     , m_nAddId(0)
      67             :     , m_nWrapId(0)
      68             :     , m_nUrlId(0)
      69             :     , m_nPictureId(0)
      70             :     , m_nCropId(0)
      71             :     , m_nColumnId(0)
      72             :     //, m_nBackgroundId(0)
      73             :     , m_nAreaId(0)
      74             :     , m_nTransparenceId(0)
      75             :     , m_nMacroId(0)
      76           0 :     , m_nBorderId(0)
      77             : {
      78           0 :     sal_uInt16 nHtmlMode = ::GetHtmlMode(m_pWrtShell->GetView().GetDocShell());
      79           0 :     m_bHTMLMode = (nHtmlMode & HTMLMODE_ON) != 0;
      80             : 
      81             :     // example font for both example TabPages
      82             : 
      83           0 :     if(pStr)
      84             :     {
      85           0 :         SetText(GetText() + SW_RESSTR(STR_COLL_HEADER) + *pStr + OUString(')'));
      86             :     }
      87             : 
      88           0 :     m_nStdId = AddTabPage("type",  SwFrmPage::Create, 0);
      89           0 :     m_nAddId = AddTabPage("options",  SwFrmAddPage::Create, 0);
      90           0 :     m_nWrapId = AddTabPage("wrap", SwWrapTabPage::Create, 0);
      91           0 :     m_nUrlId = AddTabPage("hyperlink",  SwFrmURLPage::Create, 0);
      92           0 :     if (m_sDlgType == "PictureDialog")
      93             :     {
      94           0 :         m_nPictureId = AddTabPage("picture", SwGrfExtPage::Create, 0);
      95           0 :         m_nCropId = AddTabPage("crop", RID_SVXPAGE_GRFCROP);
      96             :     }
      97           0 :     if (m_sDlgType == "FrameDialog")
      98             :     {
      99           0 :         m_nColumnId = AddTabPage("columns", SwColumnPage::Create, 0);
     100             :     }
     101           0 :     SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
     102             :     OSL_ENSURE(pFact, "Dialog creation failed!");
     103             : 
     104             :     //UUUU remove?
     105             :     // m_nBackgroundId = AddTabPage("background", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), 0);
     106             : 
     107             :     //UUUU add Area and Transparence TabPages
     108           0 :     m_nAreaId = AddTabPage("area", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_AREA ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_AREA ));
     109           0 :     m_nTransparenceId = AddTabPage("transparence", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_TRANSPARENCE ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_TRANSPARENCE ) );
     110             : 
     111           0 :     m_nMacroId = AddTabPage("macro", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_MACROASSIGN), 0);
     112           0 :     m_nBorderId = AddTabPage("borders", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), 0);
     113             : 
     114           0 :     if(m_bHTMLMode)
     115             :     {
     116           0 :         if (m_sDlgType == "FrameDialog" || m_sDlgType == "ObjectDialog")
     117             :         {
     118           0 :             if (m_sDlgType == "FrameDialog")
     119           0 :                 RemoveTabPage("columns");
     120           0 :             RemoveTabPage("hyperlink");
     121           0 :             RemoveTabPage("macro");
     122             :         }
     123           0 :         else if (m_sDlgType == "PictureDialog")
     124           0 :             RemoveTabPage("crop");
     125           0 :         if( m_sDlgType != "FrameDialog" )
     126             :         {
     127             :             //UUUU RemoveTabPage("background");
     128           0 :             RemoveTabPage("area");
     129           0 :             RemoveTabPage("transparence");
     130             :         }
     131             :     }
     132             : 
     133           0 :     if (m_bNew)
     134           0 :         SetCurPageId("type");
     135             : 
     136           0 :     if (!sDefPage.isEmpty())
     137           0 :         SetCurPageId(sDefPage);
     138           0 : }
     139             : 
     140           0 : SwFrmDlg::~SwFrmDlg()
     141             : {
     142           0 : }
     143             : 
     144           0 : void SwFrmDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage )
     145             : {
     146           0 :     SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
     147           0 :     if (nId == m_nStdId)
     148             :     {
     149           0 :         ((SwFrmPage&)rPage).SetNewFrame(m_bNew);
     150           0 :         ((SwFrmPage&)rPage).SetFormatUsed(m_bFormat);
     151           0 :         ((SwFrmPage&)rPage).SetFrmType(m_sDlgType);
     152             :     }
     153           0 :     else if (nId == m_nAddId)
     154             :     {
     155           0 :         ((SwFrmAddPage&)rPage).SetFormatUsed(m_bFormat);
     156           0 :         ((SwFrmAddPage&)rPage).SetFrmType(m_sDlgType);
     157           0 :         ((SwFrmAddPage&)rPage).SetNewFrame(m_bNew);
     158           0 :         ((SwFrmAddPage&)rPage).SetShell(m_pWrtShell);
     159             :     }
     160           0 :     else if (nId == m_nWrapId)
     161             :     {
     162           0 :         ((SwWrapTabPage&)rPage).SetNewFrame(m_bNew);
     163           0 :         ((SwWrapTabPage&)rPage).SetFormatUsed(m_bFormat, false);
     164           0 :         ((SwWrapTabPage&)rPage).SetShell(m_pWrtShell);
     165             :     }
     166           0 :     else if (nId == m_nColumnId)
     167             :     {
     168           0 :         ((SwColumnPage&)rPage).SetFrmMode(true);
     169           0 :         ((SwColumnPage&)rPage).SetFormatUsed(m_bFormat);
     170             : 
     171             :         const SwFmtFrmSize& rSize = (const SwFmtFrmSize&)
     172           0 :                                             m_rSet.Get( RES_FRM_SIZE );
     173           0 :         ((SwColumnPage&)rPage).SetPageWidth( rSize.GetWidth() );
     174             :     }
     175           0 :     else if (nId == m_nMacroId)
     176             :     {
     177           0 :         SfxAllItemSet aNewSet(*aSet.GetPool());
     178             :         aNewSet.Put( SwMacroAssignDlg::AddEvents(
     179           0 :             m_sDlgType == "PictureDialog" ? MACASSGN_GRAPHIC : m_sDlgType == "ObjectDialog" ? MACASSGN_OLE : MACASSGN_FRMURL ) );
     180           0 :         if (m_pWrtShell)
     181           0 :             rPage.SetFrame( m_pWrtShell->GetView().GetViewFrame()->GetFrame().GetFrameInterface() );
     182           0 :         rPage.PageCreated(aNewSet);
     183             :     }
     184             :     //UUUU
     185             :     //else if (nId == m_nBackgroundId && m_sDlgType == "FrameDialog")
     186             :     //{
     187             :     //    sal_Int32 nFlagType = SVX_SHOW_SELECTOR;
     188             :     //    if (!m_bHTMLMode)
     189             :     //        nFlagType |= SVX_ENABLE_TRANSPARENCY;
     190             :     //    aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, nFlagType));
     191             :     //
     192             :     //    rPage.PageCreated(aSet);
     193             :     //}
     194           0 :     else if (nId == m_nBorderId)
     195             :     {
     196           0 :         aSet.Put (SfxUInt16Item(SID_SWMODE_TYPE,SW_BORDER_MODE_FRAME));
     197           0 :         rPage.PageCreated(aSet);
     198             :     }
     199             :     //UUUU inits for Area and Transparency TabPages
     200             :     // The selection attribute lists (XPropertyList derivates, e.g. XColorList for
     201             :     // the color table) need to be added as items (e.g. SvxColorListItem) to make
     202             :     // these pages find the needed attributes for fill style suggestions.
     203             :     // These are set in preparation to trigger this dialog (FN_FORMAT_FRAME_DLG and
     204             :     // FN_DRAW_WRAP_DLG), but could also be directly added from the DrawModel.
     205           0 :     else if (nId == m_nAreaId)
     206             :     {
     207           0 :         SfxItemSet aNew(*GetInputSetImpl()->GetPool(),
     208             :                         SID_COLOR_TABLE, SID_BITMAP_LIST,
     209           0 :                         SID_OFFER_IMPORT, SID_OFFER_IMPORT, 0, 0);
     210             : 
     211           0 :         aNew.Put(m_rSet);
     212             : 
     213             :         // add flag for direct graphic content selection
     214           0 :         aNew.Put(SfxBoolItem(SID_OFFER_IMPORT, true));
     215             : 
     216           0 :         rPage.PageCreated(aNew);
     217             :     }
     218           0 :     else if (nId == m_nTransparenceId)
     219             :     {
     220           0 :         rPage.PageCreated(m_rSet);
     221           0 :     }
     222           0 : }
     223             : 
     224             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10