LCOV - code coverage report
Current view: top level - sd/source/ui/view - drviewsb.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 70 0.0 %
Date: 2014-04-14 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 <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 OUString & 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( SD_RESSTR(STR_LAYER_BCKGRND), false );
      85           0 :         sal_uInt8 nBgObj = rLayerAdmin.GetLayerID( SD_RESSTR(STR_LAYER_BCKGRNDOBJ), 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 = (rName == 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( true );
     121             : 
     122             :         // inform navigator about change
     123           0 :         SfxBoolItem aItem( SID_NAVIGATOR_INIT, 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 :     OUString aNewName;
     150           0 :     pDialog->GetName( aNewName );
     151             : 
     152           0 :     SdPage* pCurrentPage = GetDoc()->GetSdPage( maTabControl.GetCurPageId() - 1, GetPageKind() );
     153             : 
     154           0 :     return long(pCurrentPage && ( aNewName == pCurrentPage->GetName() || GetDocSh()->IsNewPageNameValid( aNewName ) ));
     155             : }
     156             : 
     157             : 
     158             : 
     159             : 
     160           0 : void DrawViewShell::ModifyLayer (
     161             :     SdrLayer* pLayer,
     162             :     const OUString& rLayerName,
     163             :     const OUString& rLayerTitle,
     164             :     const OUString& rLayerDesc,
     165             :     bool bIsVisible,
     166             :     bool bIsLocked,
     167             :     bool bIsPrintable)
     168             : {
     169           0 :     if(!GetLayerTabControl()) // #i87182#
     170             :     {
     171             :         OSL_ENSURE(false, "No LayerTabBar (!)");
     172           0 :         return;
     173             :     }
     174             : 
     175           0 :     if( pLayer )
     176             :     {
     177           0 :         const sal_uInt16 nPageCount = GetLayerTabControl()->GetPageCount();
     178           0 :         sal_uInt16 nCurPage = 0;
     179             :         sal_uInt16 nPos;
     180           0 :         for( nPos = 0; nPos < nPageCount; nPos++ )
     181             :         {
     182           0 :             sal_uInt16 nId = GetLayerTabControl()->GetPageId( nPos );
     183           0 :             if (GetLayerTabControl()->GetPageText(nId).equals(pLayer->GetName()))
     184             :             {
     185           0 :                 nCurPage = nId;
     186           0 :                 break;
     187             :             }
     188             :         }
     189             : 
     190           0 :         pLayer->SetName( rLayerName );
     191           0 :         pLayer->SetTitle( rLayerTitle );
     192           0 :         pLayer->SetDescription( rLayerDesc );
     193           0 :         mpDrawView->SetLayerVisible( rLayerName, bIsVisible );
     194           0 :         mpDrawView->SetLayerLocked( rLayerName, bIsLocked);
     195           0 :         mpDrawView->SetLayerPrintable(rLayerName, bIsPrintable);
     196             : 
     197           0 :         GetDoc()->SetChanged(true);
     198             : 
     199           0 :         GetLayerTabControl()->SetPageText(nCurPage, rLayerName);
     200             : 
     201           0 :         TabBarPageBits nBits = 0;
     202             : 
     203           0 :         if (!bIsVisible)
     204             :         {
     205             :             // invisible layers are presented different
     206           0 :             nBits = TPB_SPECIAL;
     207             :         }
     208             : 
     209           0 :         GetLayerTabControl()->SetPageBits(nCurPage, nBits);
     210             : 
     211             :         GetViewFrame()->GetDispatcher()->Execute(
     212             :             SID_SWITCHLAYER,
     213           0 :             SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
     214             : 
     215             :         // Call Invalidate at the form shell.
     216           0 :         FmFormShell* pFormShell = GetViewShellBase().GetFormShellManager()->GetFormShell();
     217           0 :         if (pFormShell != NULL)
     218           0 :             pFormShell->Invalidate();
     219             :     }
     220             : }
     221             : 
     222           0 : } // end of namespace sd
     223             : 
     224             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10