LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/sd/source/ui/view - drviewsb.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 69 1.4 %
Date: 2013-07-09 Functions: 2 6 33.3 %
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 <com/sun/star/ui/dialogs/XSLTFilterDialog.hpp>
      21             : #include <comphelper/processfactory.hxx>
      22             : #include <svx/svdlayer.hxx>
      23             : #include <svx/svxids.hrc>
      24             : #include <sfx2/msgpool.hxx>
      25             : #include <sfx2/viewfrm.hxx>
      26             : #include <svx/hlnkitem.hxx>
      27             : #include <editeng/eeitem.hxx>
      28             : #include <editeng/flditem.hxx>
      29             : #include <vcl/msgbox.hxx>
      30             : #include <sfx2/request.hxx>
      31             : #include <sfx2/dispatch.hxx>
      32             : #include <svx/svdorect.hxx>
      33             : #include <sfx2/docfile.hxx>
      34             : #include <basic/sbstar.hxx>
      35             : #include <basic/sberrors.hxx>
      36             : #include <svx/fmshell.hxx>
      37             : #include <svx/svxdlg.hxx>
      38             : #include <svx/dialogs.hrc>
      39             : #include <unotools/useroptions.hxx>
      40             : #include <tools/diagnose_ex.h>
      41             : 
      42             : #include "app.hrc"
      43             : #include "strings.hrc"
      44             : #include "res_bmp.hrc"
      45             : #include "glob.hrc"
      46             : #include "Outliner.hxx"
      47             : #include "Window.hxx"
      48             : #include "sdmod.hxx"
      49             : #include "sdattr.hxx"
      50             : #include "drawdoc.hxx"
      51             : #include "DrawDocShell.hxx"
      52             : #include "sdresid.hxx"
      53             : #include "sdpage.hxx"
      54             : #include "DrawViewShell.hxx"
      55             : #include "drawview.hxx"
      56             : #include "unmodpg.hxx"
      57             : #include "undolayer.hxx"
      58             : #include "ViewShellBase.hxx"
      59             : #include "FormShellManager.hxx"
      60             : #include "LayerTabBar.hxx"
      61             : #include "sdabstdlg.hxx"
      62             : #include "SlideSorterViewShell.hxx"
      63             : #include "SlideSorter.hxx"
      64             : #include "controller/SlideSorterController.hxx"
      65             : 
      66             : namespace sd {
      67             : 
      68           0 : bool DrawViewShell::RenameSlide( sal_uInt16 nPageId, const String & rName  )
      69             : {
      70             :     sal_Bool   bOutDummy;
      71           0 :     if( GetDoc()->GetPageByName( rName, bOutDummy ) != SDRPAGE_NOTFOUND )
      72           0 :         return false;
      73             : 
      74           0 :     SdPage* pPageToRename = NULL;
      75           0 :     PageKind ePageKind = GetPageKind();
      76             : 
      77           0 :     if( GetEditMode() == EM_PAGE )
      78             :     {
      79           0 :         pPageToRename = GetDoc()->GetSdPage( nPageId - 1, ePageKind );
      80             : 
      81             :         // Undo
      82           0 :         SdPage* pUndoPage = pPageToRename;
      83           0 :         SdrLayerAdmin &  rLayerAdmin = GetDoc()->GetLayerAdmin();
      84           0 :         sal_uInt8 nBackground = rLayerAdmin.GetLayerID( String( SdResId( STR_LAYER_BCKGRND )), sal_False );
      85           0 :         sal_uInt8 nBgObj = rLayerAdmin.GetLayerID( String( SdResId( STR_LAYER_BCKGRNDOBJ )), sal_False );
      86           0 :         SetOfByte aVisibleLayers = mpActualPage->TRG_GetMasterPageVisibleLayers();
      87             : 
      88           0 :         ::svl::IUndoManager* pManager = GetDoc()->GetDocSh()->GetUndoManager();
      89             :         ModifyPageUndoAction* pAction = new ModifyPageUndoAction(
      90           0 :             GetDoc(), pUndoPage, rName, pUndoPage->GetAutoLayout(),
      91           0 :             aVisibleLayers.IsSet( nBackground ),
      92           0 :             aVisibleLayers.IsSet( nBgObj ));
      93           0 :         pManager->AddUndoAction( pAction );
      94             : 
      95             :         // rename
      96           0 :         pPageToRename->SetName( rName );
      97             : 
      98           0 :         if( ePageKind == PK_STANDARD )
      99             :         {
     100             :             // also rename notes-page
     101           0 :             SdPage* pNotesPage = GetDoc()->GetSdPage( nPageId - 1, PK_NOTES );
     102           0 :             pNotesPage->SetName( rName );
     103             :         }
     104             :     }
     105             :     else
     106             :     {
     107             :         // rename MasterPage -> rename LayoutTemplate
     108           0 :         pPageToRename = GetDoc()->GetMasterSdPage( nPageId - 1, ePageKind );
     109           0 :         GetDoc()->RenameLayoutTemplate( pPageToRename->GetLayoutName(), rName );
     110             :     }
     111             : 
     112           0 :     bool bSuccess = ( sal_False != rName.Equals( pPageToRename->GetName()));
     113             : 
     114           0 :     if( bSuccess )
     115             :     {
     116             :         // user edited page names may be changed by the page so update control
     117           0 :         maTabControl.SetPageText( nPageId, rName );
     118             : 
     119             :         // set document to modified state
     120           0 :         GetDoc()->SetChanged( sal_True );
     121             : 
     122             :         // inform navigator about change
     123           0 :         SfxBoolItem aItem( SID_NAVIGATOR_INIT, sal_True );
     124             :         GetViewFrame()->GetDispatcher()->Execute(
     125           0 :             SID_NAVIGATOR_INIT, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aItem, 0L );
     126             : 
     127             :         // Tell the slide sorter about the name change (necessary for
     128             :         // accessibility.)
     129             :         slidesorter::SlideSorterViewShell* pSlideSorterViewShell
     130           0 :             = slidesorter::SlideSorterViewShell::GetSlideSorter(GetViewShellBase());
     131           0 :         if (pSlideSorterViewShell != NULL)
     132             :         {
     133           0 :             pSlideSorterViewShell->GetSlideSorter().GetController().PageNameHasChanged(
     134           0 :                 nPageId-1, rName);
     135           0 :         }
     136             :     }
     137             : 
     138           0 :     return bSuccess;
     139             : }
     140             : 
     141             : 
     142             : 
     143             : 
     144           0 : IMPL_LINK( DrawViewShell, RenameSlideHdl, AbstractSvxNameDialog*, pDialog )
     145             : {
     146           0 :     if( ! pDialog )
     147           0 :         return 0;
     148             : 
     149           0 :     String aNewName;
     150           0 :     pDialog->GetName( aNewName );
     151             : 
     152           0 :     SdPage* pCurrentPage = GetDoc()->GetSdPage( maTabControl.GetCurPageId() - 1, GetPageKind() );
     153             : 
     154           0 :     return pCurrentPage && ( aNewName.Equals( pCurrentPage->GetName() ) || GetDocSh()->IsNewPageNameValid( aNewName ) );
     155             : }
     156             : 
     157             : 
     158             : 
     159             : 
     160           0 : void DrawViewShell::ModifyLayer (
     161             :     SdrLayer* pLayer,
     162             :     const String& rLayerName,
     163             :     const String& rLayerTitle,
     164             :     const String& rLayerDesc,
     165             :     bool bIsVisible,
     166             :     bool bIsLocked,
     167             :     bool bIsPrintable)
     168             : {
     169           0 :     if( pLayer )
     170             :     {
     171           0 :         const sal_uInt16 nPageCount = GetLayerTabControl()->GetPageCount();
     172           0 :         sal_uInt16 nCurPage = 0;
     173             :         sal_uInt16 nPos;
     174           0 :         for( nPos = 0; nPos < nPageCount; nPos++ )
     175             :         {
     176           0 :             sal_uInt16 nId = GetLayerTabControl()->GetPageId( nPos );
     177           0 :             if (GetLayerTabControl()->GetPageText(nId).equals(pLayer->GetName()))
     178             :             {
     179           0 :                 nCurPage = nId;
     180           0 :                 break;
     181             :             }
     182             :         }
     183             : 
     184           0 :         pLayer->SetName( rLayerName );
     185           0 :         pLayer->SetTitle( rLayerTitle );
     186           0 :         pLayer->SetDescription( rLayerDesc );
     187           0 :         mpDrawView->SetLayerVisible( rLayerName, bIsVisible );
     188           0 :         mpDrawView->SetLayerLocked( rLayerName, bIsLocked);
     189           0 :         mpDrawView->SetLayerPrintable(rLayerName, bIsPrintable);
     190             : 
     191           0 :         GetDoc()->SetChanged(sal_True);
     192             : 
     193           0 :         GetLayerTabControl()->SetPageText(nCurPage, rLayerName);
     194             : 
     195           0 :         TabBarPageBits nBits = 0;
     196             : 
     197           0 :         if (!bIsVisible)
     198             :         {
     199             :             // invisible layers are presented different
     200           0 :             nBits = TPB_SPECIAL;
     201             :         }
     202             : 
     203           0 :         GetLayerTabControl()->SetPageBits(nCurPage, nBits);
     204             : 
     205             :         GetViewFrame()->GetDispatcher()->Execute(
     206             :             SID_SWITCHLAYER,
     207           0 :             SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
     208             : 
     209             :         // Call Invalidate at the form shell.
     210           0 :         FmFormShell* pFormShell = GetViewShellBase().GetFormShellManager()->GetFormShell();
     211           0 :         if (pFormShell != NULL)
     212           0 :             pFormShell->Invalidate();
     213             :     }
     214           0 : }
     215             : 
     216          33 : } // end of namespace sd
     217             : 
     218             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10