LCOV - code coverage report
Current view: top level - sd/source/ui/func - fuprobjs.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 64 0.0 %
Date: 2012-08-25 Functions: 0 8 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 140 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                 :            : 
      30                 :            : #include "fuprobjs.hxx"
      31                 :            : 
      32                 :            : #include <vcl/msgbox.hxx>
      33                 :            : #include <svl/style.hxx>
      34                 :            : #include <editeng/outliner.hxx>
      35                 :            : #include <svl/smplhint.hxx>
      36                 :            : 
      37                 :            : 
      38                 :            : #include "app.hrc"
      39                 :            : #include "res_bmp.hrc"
      40                 :            : #include "strings.hrc"
      41                 :            : #include "glob.hrc"
      42                 :            : #include "prltempl.hrc"
      43                 :            : 
      44                 :            : #include "sdresid.hxx"
      45                 :            : #include "drawdoc.hxx"
      46                 :            : #include "OutlineViewShell.hxx"
      47                 :            : #include "ViewShell.hxx"
      48                 :            : #include "Window.hxx"
      49                 :            : #include "glob.hxx"
      50                 :            : #include "prlayout.hxx"
      51                 :            : #include "unchss.hxx"
      52                 :            : #include "sdabstdlg.hxx"
      53                 :            : namespace sd {
      54                 :            : 
      55 [ #  # ][ #  # ]:          0 : TYPEINIT1( FuPresentationObjects, FuPoor );
      56                 :            : 
      57                 :            : 
      58                 :            : /*************************************************************************
      59                 :            : |*
      60                 :            : |* Konstruktor
      61                 :            : |*
      62                 :            : \************************************************************************/
      63                 :            : 
      64                 :          0 : FuPresentationObjects::FuPresentationObjects (
      65                 :            :     ViewShell* pViewSh,
      66                 :            :     ::sd::Window* pWin,
      67                 :            :     ::sd::View* pView,
      68                 :            :     SdDrawDocument* pDoc,
      69                 :            :     SfxRequest& rReq)
      70                 :          0 :      : FuPoor(pViewSh, pWin, pView, pDoc, rReq)
      71                 :            : {
      72                 :          0 : }
      73                 :            : 
      74                 :          0 : FunctionReference FuPresentationObjects::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
      75                 :            : {
      76 [ #  # ][ #  # ]:          0 :     FunctionReference xFunc( new FuPresentationObjects( pViewSh, pWin, pView, pDoc, rReq ) );
      77         [ #  # ]:          0 :     xFunc->DoExecute(rReq);
      78                 :          0 :     return xFunc;
      79                 :            : }
      80                 :            : 
      81                 :          0 : void FuPresentationObjects::DoExecute( SfxRequest& )
      82                 :            : {
      83         [ #  # ]:          0 :     OutlineViewShell* pOutlineViewShell = dynamic_cast< OutlineViewShell* >( mpViewShell );
      84                 :            :     DBG_ASSERT( pOutlineViewShell, "sd::FuPresentationObjects::DoExecute(), does not work without an OutlineViewShell!");
      85         [ #  # ]:          0 :     if( !pOutlineViewShell )
      86                 :          0 :         return;
      87                 :            : 
      88                 :            :     // ergibt die Selektion ein eindeutiges Praesentationslayout?
      89                 :            :     // wenn nicht, duerfen die Vorlagen nicht bearbeitet werden
      90         [ #  # ]:          0 :     SfxItemSet aSet(mpDoc->GetItemPool(), SID_STATUS_LAYOUT, SID_STATUS_LAYOUT);
      91         [ #  # ]:          0 :     pOutlineViewShell->GetStatusBarState( aSet );
      92 [ #  # ][ #  # ]:          0 :     String aLayoutName = (((SfxStringItem&)aSet.Get(SID_STATUS_LAYOUT)).GetValue());
      93                 :            :     DBG_ASSERT(aLayoutName.Len(), "Layout unbestimmt");
      94                 :            : 
      95                 :          0 :     sal_Bool    bUnique = sal_False;
      96                 :            :     sal_Int16   nDepth, nTmp;
      97                 :          0 :     OutlineView* pOlView = static_cast<OutlineView*>(pOutlineViewShell->GetView());
      98         [ #  # ]:          0 :     OutlinerView* pOutlinerView = pOlView->GetViewByWindow( (Window*) mpWindow );
      99                 :          0 :     ::Outliner* pOutl = pOutlinerView->GetOutliner();
     100                 :            : 
     101         [ #  # ]:          0 :     std::vector<Paragraph*> aSelList;
     102         [ #  # ]:          0 :     pOutlinerView->CreateSelectionList(aSelList);
     103                 :            : 
     104         [ #  # ]:          0 :     std::vector<Paragraph*>::const_iterator iter = aSelList.begin();
     105         [ #  # ]:          0 :     Paragraph* pPara = aSelList.empty() ? NULL : *iter;
     106                 :            : 
     107 [ #  # ][ #  # ]:          0 :     nDepth = pOutl->GetDepth((sal_uInt16)pOutl->GetAbsPos( pPara ) );
     108         [ #  # ]:          0 :     bool bPage = pOutl->HasParaFlag( pPara, PARAFLAG_ISPAGE );
     109                 :            : 
     110 [ #  # ][ #  # ]:          0 :     while( iter != aSelList.end() )
     111                 :            :     {
     112                 :          0 :         pPara = *iter;
     113                 :            : 
     114 [ #  # ][ #  # ]:          0 :         nTmp = pOutl->GetDepth((sal_uInt16) pOutl->GetAbsPos( pPara ) );
     115                 :            : 
     116         [ #  # ]:          0 :         if( nDepth != nTmp )
     117                 :            :         {
     118                 :          0 :             bUnique = sal_False;
     119                 :          0 :             break;
     120                 :            :         }
     121                 :            : 
     122 [ #  # ][ #  # ]:          0 :         if( pOutl->HasParaFlag( pPara, PARAFLAG_ISPAGE ) != bPage )
     123                 :            :         {
     124                 :          0 :             bUnique = sal_False;
     125                 :          0 :             break;
     126                 :            :         }
     127                 :          0 :         bUnique = sal_True;
     128                 :          0 :         ++iter;
     129                 :            :     }
     130                 :            : 
     131         [ #  # ]:          0 :     if( bUnique )
     132                 :            :     {
     133         [ #  # ]:          0 :         String aStyleName = aLayoutName;
     134         [ #  # ]:          0 :         aStyleName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( SD_LT_SEPARATOR ) );
     135                 :          0 :         sal_uInt16 nDlgId = TAB_PRES_LAYOUT_TEMPLATE;
     136                 :            :         PresentationObjects ePO;
     137                 :            : 
     138         [ #  # ]:          0 :         if( bPage )
     139                 :            :         {
     140                 :          0 :             ePO = PO_TITLE;
     141 [ #  # ][ #  # ]:          0 :             String aStr(SdResId( STR_LAYOUT_TITLE ));
     142 [ #  # ][ #  # ]:          0 :             aStyleName.Append( aStr );
     143                 :            :         }
     144                 :            :         else
     145                 :            :         {
     146                 :          0 :             ePO = (PresentationObjects) ( PO_OUTLINE_1 + nDepth - 1 );
     147 [ #  # ][ #  # ]:          0 :             String aStr(SdResId( STR_LAYOUT_OUTLINE ));
     148         [ #  # ]:          0 :             aStyleName.Append( aStr );
     149         [ #  # ]:          0 :             aStyleName.Append( sal_Unicode(' ') );
     150 [ #  # ][ #  # ]:          0 :             aStyleName.Append( UniString::CreateFromInt32( nDepth ) );
         [ #  # ][ #  # ]
     151                 :            :         }
     152                 :            : 
     153         [ #  # ]:          0 :         SfxStyleSheetBasePool* pStyleSheetPool = mpDocSh->GetStyleSheetPool();
     154         [ #  # ]:          0 :         SfxStyleSheetBase* pStyleSheet = pStyleSheetPool->Find( aStyleName, SD_STYLE_FAMILY_MASTERPAGE );
     155                 :            :         DBG_ASSERT(pStyleSheet, "StyleSheet nicht gefunden");
     156                 :            : 
     157         [ #  # ]:          0 :         if( pStyleSheet )
     158                 :            :         {
     159                 :          0 :             SfxStyleSheetBase& rStyleSheet = *pStyleSheet;
     160                 :            : 
     161         [ #  # ]:          0 :             SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
     162 [ #  # ][ #  # ]:          0 :             SfxAbstractTabDialog* pDlg = pFact ? pFact->CreateSdPresLayoutTemplateDlg( mpDocSh, NULL, SdResId( nDlgId ), rStyleSheet, ePO, pStyleSheetPool ) : 0;
         [ #  # ][ #  # ]
                 [ #  # ]
     163 [ #  # ][ #  # ]:          0 :             if( pDlg && (pDlg->Execute() == RET_OK) )
         [ #  # ][ #  # ]
     164                 :            :             {
     165         [ #  # ]:          0 :                 const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
     166                 :            :                 // Undo-Action
     167                 :            :                 StyleSheetUndoAction* pAction = new StyleSheetUndoAction
     168                 :            :                                                 (mpDoc, (SfxStyleSheet*)pStyleSheet,
     169 [ #  # ][ #  # ]:          0 :                                                     pOutSet);
     170 [ #  # ][ #  # ]:          0 :                 mpDocSh->GetUndoManager()->AddUndoAction(pAction);
     171                 :            : 
     172 [ #  # ][ #  # ]:          0 :                 pStyleSheet->GetItemSet().Put( *pOutSet );
     173 [ #  # ][ #  # ]:          0 :                 ( (SfxStyleSheet*) pStyleSheet )->Broadcast( SfxSimpleHint( SFX_HINT_DATACHANGED ) );
                 [ #  # ]
     174                 :            :             }
     175 [ #  # ][ #  # ]:          0 :             delete( pDlg );
     176         [ #  # ]:          0 :         }
     177 [ #  # ][ #  # ]:          0 :     }
     178                 :            : }
     179                 :            : 
     180                 :            : } // end of namespace sd
     181                 :            : 
     182                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10