LCOV - code coverage report
Current view: top level - sd/source/ui/func - fusumry.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 100 0.0 %
Date: 2012-08-25 Functions: 0 8 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 226 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                 :            : #include "fusumry.hxx"
      30                 :            : #include <editeng/eeitem.hxx>
      31                 :            : #include <svx/svdotext.hxx>
      32                 :            : #include <svx/svdundo.hxx>
      33                 :            : #include <sfx2/printer.hxx>
      34                 :            : #include <editeng/outlobj.hxx>
      35                 :            : 
      36                 :            : #include "strings.hrc"
      37                 :            : 
      38                 :            : #include "pres.hxx"
      39                 :            : #include "View.hxx"
      40                 :            : #include "sdpage.hxx"
      41                 :            : #include "Outliner.hxx"
      42                 :            : #include "drawview.hxx"
      43                 :            : #include "drawdoc.hxx"
      44                 :            : #include "ViewShell.hxx"
      45                 :            : #include "DrawDocShell.hxx"
      46                 :            : #include "sdresid.hxx"
      47                 :            : #include "optsitem.hxx"
      48                 :            : #include "DrawViewShell.hxx"
      49                 :            : 
      50                 :            : namespace sd {
      51                 :            : 
      52 [ #  # ][ #  # ]:          0 : TYPEINIT1( FuSummaryPage, FuPoor );
      53                 :            : 
      54                 :            : /*************************************************************************
      55                 :            : |*
      56                 :            : |* Konstruktor
      57                 :            : |*
      58                 :            : \************************************************************************/
      59                 :          0 : FuSummaryPage::FuSummaryPage (
      60                 :            :     ViewShell* pViewSh,
      61                 :            :     ::sd::Window* pWin,
      62                 :            :     ::sd::View* pView,
      63                 :            :     SdDrawDocument* pDoc,
      64                 :            :     SfxRequest& rReq)
      65                 :          0 :     : FuPoor(pViewSh, pWin, pView, pDoc, rReq)
      66                 :            : {
      67                 :          0 : }
      68                 :            : 
      69                 :          0 : FunctionReference FuSummaryPage::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
      70                 :            : {
      71 [ #  # ][ #  # ]:          0 :     FunctionReference xFunc( new FuSummaryPage( pViewSh, pWin, pView, pDoc, rReq ) );
      72         [ #  # ]:          0 :     xFunc->DoExecute(rReq);
      73                 :          0 :     return xFunc;
      74                 :            : }
      75                 :            : 
      76                 :          0 : void FuSummaryPage::DoExecute( SfxRequest& )
      77                 :            : {
      78                 :          0 :     ::sd::Outliner* pOutl = NULL;
      79                 :          0 :     SdPage* pSummaryPage = NULL;
      80                 :          0 :     sal_uInt16 i = 0;
      81                 :          0 :     sal_uInt16 nFirstPage = SDRPAGE_NOTFOUND;
      82                 :          0 :     sal_uInt16 nSelectedPages = 0;
      83                 :          0 :     sal_uInt16 nCount = mpDoc->GetSdPageCount(PK_STANDARD);
      84                 :            : 
      85 [ #  # ][ #  # ]:          0 :     while (i < nCount && nSelectedPages <= 1)
                 [ #  # ]
      86                 :            :     {
      87                 :            :         /**********************************************************************
      88                 :            :         * Wieviele Seiten sind selektiert?
      89                 :            :         * Genau eine Seite selektiert: Ab dieser Seite alles zusammenfassen
      90                 :            :         * sonst: Nur die selektierten Seiten zusammenfassen
      91                 :            :         **********************************************************************/
      92                 :          0 :         SdPage* pActualPage = mpDoc->GetSdPage(i, PK_STANDARD);
      93                 :            : 
      94         [ #  # ]:          0 :         if (pActualPage->IsSelected())
      95                 :            :         {
      96         [ #  # ]:          0 :             if (nFirstPage == SDRPAGE_NOTFOUND)
      97                 :            :             {
      98                 :          0 :                 nFirstPage = i;
      99                 :            :             }
     100                 :            : 
     101                 :          0 :             nSelectedPages++;
     102                 :            :         }
     103                 :            : 
     104                 :          0 :         i++;
     105                 :            :     }
     106                 :            : 
     107                 :          0 :     bool bBegUndo = false;
     108                 :            : 
     109                 :          0 :     SfxStyleSheet* pStyle = NULL;
     110                 :            : 
     111         [ #  # ]:          0 :     for (i = nFirstPage; i < nCount; i++)
     112                 :            :     {
     113                 :          0 :         SdPage* pActualPage = mpDoc->GetSdPage(i, PK_STANDARD);
     114                 :            : 
     115 [ #  # ][ #  # ]:          0 :         if (nSelectedPages <= 1 || pActualPage->IsSelected())
                 [ #  # ]
     116                 :            :         {
     117                 :          0 :             SdPage* pActualNotesPage = mpDoc->GetSdPage(i, PK_NOTES);
     118                 :          0 :             SdrTextObj* pTextObj = (SdrTextObj*) pActualPage->GetPresObj(PRESOBJ_TITLE);
     119                 :            : 
     120 [ #  # ][ #  # ]:          0 :             if (pTextObj && !pTextObj->IsEmptyPresObj())
                 [ #  # ]
     121                 :            :             {
     122         [ #  # ]:          0 :                 if (!pSummaryPage)
     123                 :            :                 {
     124                 :            :                     /**********************************************************
     125                 :            :                     * Inhaltsverzeichnis-Seite einfuegen und Outliner anlegen
     126                 :            :                     **********************************************************/
     127         [ #  # ]:          0 :                     const bool bUndo = mpView->IsUndoEnabled();
     128                 :            : 
     129         [ #  # ]:          0 :                     if( bUndo )
     130                 :            :                     {
     131 [ #  # ][ #  # ]:          0 :                         mpView->BegUndo(String(SdResId(STR_UNDO_SUMMARY_PAGE)));
         [ #  # ][ #  # ]
     132                 :          0 :                         bBegUndo = true;
     133                 :            :                     }
     134                 :            : 
     135         [ #  # ]:          0 :                     SetOfByte aVisibleLayers = pActualPage->TRG_GetMasterPageVisibleLayers();
     136                 :            : 
     137                 :            :                     // Seite mit Titel & Gliederung!
     138         [ #  # ]:          0 :                     pSummaryPage = (SdPage*) mpDoc->AllocPage(sal_False);
     139 [ #  # ][ #  # ]:          0 :                     pSummaryPage->SetSize(pActualPage->GetSize() );
     140                 :          0 :                     pSummaryPage->SetBorder(pActualPage->GetLftBorder(),
     141                 :          0 :                                      pActualPage->GetUppBorder(),
     142                 :          0 :                                      pActualPage->GetRgtBorder(),
     143 [ #  # ][ #  # ]:          0 :                                      pActualPage->GetLwrBorder() );
         [ #  # ][ #  # ]
                 [ #  # ]
     144                 :            : 
     145                 :            :                     // Seite hinten einfuegen
     146         [ #  # ]:          0 :                     mpDoc->InsertPage(pSummaryPage, nCount * 2 + 1);
     147         [ #  # ]:          0 :                     if( bUndo )
     148 [ #  # ][ #  # ]:          0 :                         mpView->AddUndo(mpDoc->GetSdrUndoFactory().CreateUndoNewPage(*pSummaryPage));
                 [ #  # ]
     149                 :            : 
     150                 :            :                     // MasterPage der aktuellen Seite verwenden
     151 [ #  # ][ #  # ]:          0 :                     pSummaryPage->TRG_SetMasterPage(pActualPage->TRG_GetMasterPage());
     152 [ #  # ][ #  # ]:          0 :                     pSummaryPage->SetLayoutName(pActualPage->GetLayoutName());
                 [ #  # ]
     153         [ #  # ]:          0 :                     pSummaryPage->SetAutoLayout(AUTOLAYOUT_ENUM, sal_True);
     154         [ #  # ]:          0 :                     pSummaryPage->TRG_SetMasterPageVisibleLayers(aVisibleLayers);
     155 [ #  # ][ #  # ]:          0 :                     pSummaryPage->setHeaderFooterSettings(pActualPage->getHeaderFooterSettings());
     156                 :            : 
     157                 :            :                     // Notiz-Seite
     158         [ #  # ]:          0 :                     SdPage* pNotesPage = (SdPage*) mpDoc->AllocPage(sal_False);
     159 [ #  # ][ #  # ]:          0 :                     pNotesPage->SetSize(pActualNotesPage->GetSize());
     160                 :          0 :                     pNotesPage->SetBorder(pActualNotesPage->GetLftBorder(),
     161                 :          0 :                                           pActualNotesPage->GetUppBorder(),
     162                 :          0 :                                           pActualNotesPage->GetRgtBorder(),
     163 [ #  # ][ #  # ]:          0 :                                           pActualNotesPage->GetLwrBorder() );
         [ #  # ][ #  # ]
                 [ #  # ]
     164                 :          0 :                     pNotesPage->SetPageKind(PK_NOTES);
     165                 :            : 
     166                 :            :                     // Seite hinten einfuegen
     167         [ #  # ]:          0 :                     mpDoc->InsertPage(pNotesPage, nCount * 2 + 2);
     168                 :            : 
     169         [ #  # ]:          0 :                     if( bUndo )
     170 [ #  # ][ #  # ]:          0 :                         mpView->AddUndo(mpDoc->GetSdrUndoFactory().CreateUndoNewPage(*pNotesPage));
                 [ #  # ]
     171                 :            : 
     172                 :            :                     // MasterPage der aktuellen Seite verwenden
     173 [ #  # ][ #  # ]:          0 :                     pNotesPage->TRG_SetMasterPage(pActualNotesPage->TRG_GetMasterPage());
     174 [ #  # ][ #  # ]:          0 :                     pNotesPage->SetLayoutName(pActualNotesPage->GetLayoutName());
                 [ #  # ]
     175         [ #  # ]:          0 :                     pNotesPage->SetAutoLayout(pActualNotesPage->GetAutoLayout(), sal_True);
     176         [ #  # ]:          0 :                     pNotesPage->TRG_SetMasterPageVisibleLayers(aVisibleLayers);
     177 [ #  # ][ #  # ]:          0 :                     pNotesPage->setHeaderFooterSettings(pActualNotesPage->getHeaderFooterSettings());
     178                 :            : 
     179 [ #  # ][ #  # ]:          0 :                     pOutl = new ::sd::Outliner( mpDoc, OUTLINERMODE_OUTLINEOBJECT );
     180         [ #  # ]:          0 :                     pOutl->SetUpdateMode(sal_False);
     181         [ #  # ]:          0 :                     pOutl->EnableUndo(sal_False);
     182                 :            : 
     183         [ #  # ]:          0 :                     if (mpDocSh)
     184 [ #  # ][ #  # ]:          0 :                         pOutl->SetRefDevice(SD_MOD()->GetRefDevice( *mpDocSh ));
                 [ #  # ]
     185                 :            : 
     186         [ #  # ]:          0 :                     pOutl->SetDefTab( mpDoc->GetDefaultTabulator() );
     187 [ #  # ][ #  # ]:          0 :                     pOutl->SetStyleSheetPool((SfxStyleSheetPool*) mpDoc->GetStyleSheetPool());
     188         [ #  # ]:          0 :                     pStyle = pSummaryPage->GetStyleSheetForPresObj( PRESOBJ_OUTLINE );
     189         [ #  # ]:          0 :                     pOutl->SetStyleSheet( 0, pStyle );
     190                 :            :                 }
     191                 :            : 
     192                 :            :                 /**************************************************************
     193                 :            :                 * Text hinzufuegen
     194                 :            :                 **************************************************************/
     195                 :          0 :                 OutlinerParaObject* pParaObj = pTextObj->GetOutlinerParaObject();
     196                 :          0 :                 pParaObj->SetOutlinerMode( OUTLINERMODE_OUTLINEOBJECT );
     197                 :          0 :                 pOutl->AddText(*pParaObj);
     198                 :            :             }
     199                 :            :         }
     200                 :            :     }
     201                 :            : 
     202         [ #  # ]:          0 :     if (pSummaryPage)
     203                 :            :     {
     204         [ #  # ]:          0 :         SdrTextObj* pTextObj = (SdrTextObj*) pSummaryPage->GetPresObj(PRESOBJ_OUTLINE);
     205                 :            : 
     206                 :            :         // Harte Absatz- und Zeichenattribute entfernen
     207         [ #  # ]:          0 :         SfxItemSet aEmptyEEAttr(mpDoc->GetPool(), EE_ITEMS_START, EE_ITEMS_END);
     208         [ #  # ]:          0 :         sal_uLong nParaCount = pOutl->GetParagraphCount();
     209                 :            : 
     210         [ #  # ]:          0 :         for (sal_uInt16 nPara = 0; nPara < nParaCount; nPara++)
     211                 :            :         {
     212         [ #  # ]:          0 :             pOutl->SetStyleSheet( nPara, pStyle );
     213         [ #  # ]:          0 :             pOutl->QuickRemoveCharAttribs(nPara);
     214         [ #  # ]:          0 :             pOutl->SetParaAttribs(nPara, aEmptyEEAttr);
     215 [ #  # ][ #  # ]:          0 :             pOutl->SetDepth(pOutl->GetParagraph(nPara), 0);
     216                 :            :         }
     217                 :            : 
     218 [ #  # ][ #  # ]:          0 :         pTextObj->SetOutlinerParaObject( pOutl->CreateParaObject() );
     219         [ #  # ]:          0 :         pTextObj->SetEmptyPresObj(sal_False);
     220                 :            : 
     221                 :            :         // Harte Attribute entfernen (Flag auf sal_True)
     222         [ #  # ]:          0 :         SfxItemSet aAttr(mpDoc->GetPool());
     223 [ #  # ][ #  # ]:          0 :         aAttr.Put(XLineStyleItem(XLINE_NONE));
                 [ #  # ]
     224 [ #  # ][ #  # ]:          0 :         aAttr.Put(XFillStyleItem(XFILL_NONE));
                 [ #  # ]
     225         [ #  # ]:          0 :         pTextObj->SetMergedItemSet(aAttr);
     226                 :            : 
     227         [ #  # ]:          0 :         if( bBegUndo )
     228         [ #  # ]:          0 :             mpView->EndUndo();
     229 [ #  # ][ #  # ]:          0 :         delete pOutl;
     230                 :            : 
     231         [ #  # ]:          0 :         DrawViewShell* pDrawViewShell= dynamic_cast< DrawViewShell* >( mpViewShell );
     232         [ #  # ]:          0 :         if(pDrawViewShell)
     233                 :            :         {
     234 [ #  # ][ #  # ]:          0 :             pDrawViewShell->SwitchPage( (pSummaryPage->GetPageNum() - 1) / 2);
     235 [ #  # ][ #  # ]:          0 :         }
     236                 :            :     }
     237                 :          0 : }
     238                 :            : 
     239                 :            : 
     240                 :            : } // end of namespace sd
     241                 :            : 
     242                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10