LCOV - code coverage report
Current view: top level - sd/source/ui/docshell - docshel2.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 55 199 27.6 %
Date: 2012-08-25 Functions: 7 13 53.8 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 53 414 12.8 %

           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 "DrawDocShell.hxx"
      31                 :            : #include <vcl/msgbox.hxx>
      32                 :            : #include <svx/svdpagv.hxx>
      33                 :            : #include <svx/svxdlg.hxx>
      34                 :            : #include <svx/dialogs.hrc>
      35                 :            : 
      36                 :            : #include "helpids.h"
      37                 :            : #include "ViewShell.hxx"
      38                 :            : #include "drawview.hxx"
      39                 :            : #include "FrameView.hxx"
      40                 :            : #include "drawdoc.hxx"
      41                 :            : #include "sdpage.hxx"
      42                 :            : #include "View.hxx"
      43                 :            : #include "ClientView.hxx"
      44                 :            : #include "Window.hxx"
      45                 :            : #include "strings.hrc"
      46                 :            : #include "res_bmp.hrc"
      47                 :            : #include "sdresid.hxx"
      48                 :            : #include "strmname.h"
      49                 :            : #include "fupoor.hxx"
      50                 :            : #include <vcl/svapp.hxx>
      51                 :            : #include <vcl/virdev.hxx>
      52                 :            : #include <comphelper/string.hxx>
      53                 :            : 
      54                 :            : namespace sd {
      55                 :            : 
      56                 :            : /*************************************************************************
      57                 :            : |*
      58                 :            : |* Zeichnen der DocShell (mittels der Hilfsklasse SdDrawViewShell)
      59                 :            : |*
      60                 :            : \************************************************************************/
      61                 :            : 
      62                 :          8 : void DrawDocShell::Draw(OutputDevice* pOut, const JobSetup&, sal_uInt16 nAspect)
      63                 :            : {
      64                 :            :     if (nAspect == ASPECT_THUMBNAIL)
      65                 :            :     {
      66                 :            :         /**********************************************************************
      67                 :            :         * THUMBNAIL: Hier koennte ev. einmal der Draft-Mode gesetzt werden
      68                 :            :         **********************************************************************/
      69                 :            :     }
      70                 :            : 
      71 [ +  - ][ +  - ]:          8 :     ClientView* pView = new ClientView(this, pOut, NULL);
      72                 :            : 
      73         [ +  - ]:          8 :     pView->SetHlplVisible(sal_False);
      74         [ +  - ]:          8 :     pView->SetGridVisible(sal_False);
      75         [ +  - ]:          8 :     pView->SetBordVisible(sal_False);
      76         [ +  - ]:          8 :     pView->SetPageVisible(sal_False);
      77         [ +  - ]:          8 :     pView->SetGlueVisible(sal_False);
      78                 :            : 
      79                 :          8 :     SdPage* pSelectedPage = NULL;
      80                 :            : 
      81                 :          8 :     const std::vector<sd::FrameView*> &rViews = mpDoc->GetFrameViewList();
      82         [ -  + ]:          8 :     if( !rViews.empty() )
      83                 :            :     {
      84         [ #  # ]:          0 :         sd::FrameView* pFrameView = rViews[0];
      85         [ #  # ]:          0 :         if( pFrameView->GetPageKind() == PK_STANDARD )
      86                 :            :         {
      87         [ #  # ]:          0 :             sal_uInt16 nSelectedPage = pFrameView->GetSelectedPage();
      88         [ #  # ]:          0 :             pSelectedPage = mpDoc->GetSdPage(nSelectedPage, PK_STANDARD);
      89                 :            :         }
      90                 :            :     }
      91                 :            : 
      92         [ +  - ]:          8 :     if( NULL == pSelectedPage )
      93                 :            :     {
      94                 :          8 :         SdPage* pPage = NULL;
      95         [ +  - ]:          8 :         sal_uInt16 nPageCnt = (sal_uInt16) mpDoc->GetSdPageCount(PK_STANDARD);
      96                 :            : 
      97         [ +  + ]:         16 :         for (sal_uInt16 i = 0; i < nPageCnt; i++)
      98                 :            :         {
      99         [ +  - ]:          8 :             pPage = mpDoc->GetSdPage(i, PK_STANDARD);
     100                 :            : 
     101         [ +  - ]:          8 :             if ( pPage->IsSelected() )
     102                 :          8 :                 pSelectedPage = pPage;
     103                 :            :         }
     104                 :            : 
     105         [ -  + ]:          8 :         if( NULL == pSelectedPage )
     106         [ #  # ]:          0 :             pSelectedPage = mpDoc->GetSdPage(0, PK_STANDARD);
     107                 :            :     }
     108                 :            : 
     109         [ +  - ]:          8 :     Rectangle aVisArea = GetVisArea(nAspect);
     110         [ +  - ]:          8 :     pOut->IntersectClipRegion(aVisArea);
     111         [ +  - ]:          8 :     pView->ShowSdrPage(pSelectedPage);
     112                 :            : 
     113         [ +  - ]:          8 :     if (pOut->GetOutDevType() != OUTDEV_WINDOW)
     114                 :            :     {
     115         [ +  - ]:          8 :         MapMode aOldMapMode = pOut->GetMapMode();
     116                 :            : 
     117         [ -  + ]:          8 :         if (pOut->GetOutDevType() == OUTDEV_PRINTER)
     118                 :            :         {
     119         [ #  # ]:          0 :             MapMode aMapMode = aOldMapMode;
     120                 :          0 :             Point aOrigin = aMapMode.GetOrigin();
     121                 :          0 :             aOrigin.X() += 1;
     122                 :          0 :             aOrigin.Y() += 1;
     123         [ #  # ]:          0 :             aMapMode.SetOrigin(aOrigin);
     124 [ #  # ][ #  # ]:          0 :             pOut->SetMapMode(aMapMode);
     125                 :            :         }
     126                 :            : 
     127         [ +  - ]:          8 :         Region aRegion(aVisArea);
     128         [ +  - ]:          8 :         pView->CompleteRedraw(pOut, aRegion);
     129                 :            : 
     130         [ -  + ]:          8 :         if (pOut->GetOutDevType() == OUTDEV_PRINTER)
     131                 :            :         {
     132         [ #  # ]:          0 :             pOut->SetMapMode(aOldMapMode);
     133 [ +  - ][ +  - ]:          8 :         }
     134                 :            :     }
     135                 :            : 
     136 [ +  - ][ +  - ]:          8 :     delete pView;
     137                 :            : 
     138                 :          8 : }
     139                 :            : 
     140                 :        556 : Rectangle DrawDocShell::GetVisArea(sal_uInt16 nAspect) const
     141                 :            : {
     142                 :        556 :     Rectangle aVisArea;
     143                 :            : 
     144 [ -  + ][ +  + ]:        556 :     if( ( ASPECT_THUMBNAIL == nAspect ) || ( ASPECT_DOCPRINT == nAspect ) )
     145                 :            :     {
     146                 :            :         // Groesse der ersten Seite herausgeben
     147         [ +  - ]:         32 :         MapMode aSrcMapMode(MAP_PIXEL);
     148         [ +  - ]:         32 :         MapMode aDstMapMode(MAP_100TH_MM);
     149 [ +  - ][ +  - ]:         32 :         Size aSize = mpDoc->GetSdPage(0, PK_STANDARD)->GetSize();
     150         [ +  - ]:         32 :         aSrcMapMode.SetMapUnit(MAP_100TH_MM);
     151                 :            : 
     152 [ +  - ][ +  - ]:         32 :         aSize = Application::GetDefaultDevice()->LogicToLogic(aSize, &aSrcMapMode, &aDstMapMode);
     153 [ +  - ][ +  - ]:         32 :         aVisArea.SetSize(aSize);
                 [ +  - ]
     154                 :            :     }
     155                 :            :     else
     156                 :            :     {
     157                 :        524 :         aVisArea = SfxObjectShell::GetVisArea(nAspect);
     158                 :            :     }
     159                 :            : 
     160 [ +  + ][ +  - ]:        556 :     if (aVisArea.IsEmpty() && mpViewShell)
                 [ +  + ]
     161                 :            :     {
     162                 :          8 :         Window* pWin = mpViewShell->GetActiveWindow();
     163                 :            : 
     164         [ +  - ]:          8 :         if (pWin)
     165                 :            :         {
     166 [ +  - ][ +  - ]:          8 :             aVisArea = pWin->PixelToLogic(Rectangle(Point(0,0), pWin->GetOutputSizePixel()));
     167                 :            :         }
     168                 :            :     }
     169                 :            : 
     170                 :        556 :     return (aVisArea);
     171                 :            : }
     172                 :            : 
     173                 :            : /*************************************************************************
     174                 :            : |*
     175                 :            : |* ViewShell anmelden
     176                 :            : |*
     177                 :            : \************************************************************************/
     178                 :            : 
     179                 :        535 : void DrawDocShell::Connect(ViewShell* pViewSh)
     180                 :            : {
     181                 :        535 :     mpViewShell = pViewSh;
     182                 :        535 : }
     183                 :            : 
     184                 :            : /*************************************************************************
     185                 :            : |*
     186                 :            : |* ViewShell abmelden
     187                 :            : |*
     188                 :            : \************************************************************************/
     189                 :            : 
     190                 :       1653 : void DrawDocShell::Disconnect(ViewShell* pViewSh)
     191                 :            : {
     192         [ +  + ]:       1653 :     if (mpViewShell == pViewSh)
     193                 :            :     {
     194                 :        431 :         mpViewShell = NULL;
     195                 :            :     }
     196                 :       1653 : }
     197                 :            : 
     198                 :          0 : FrameView* DrawDocShell::GetFrameView()
     199                 :            : {
     200                 :          0 :     FrameView* pFrameView = NULL;
     201                 :            : 
     202         [ #  # ]:          0 :     if (mpViewShell)
     203                 :            :     {
     204                 :          0 :         pFrameView = mpViewShell->GetFrameView();
     205                 :            :     }
     206                 :            : 
     207                 :          0 :     return(pFrameView);
     208                 :            : }
     209                 :            : 
     210                 :            : /*************************************************************************
     211                 :            : |*
     212                 :            : |* Groesse der ersten Seite zurueckgeben
     213                 :            : |*
     214                 :            : \************************************************************************/
     215                 :            : 
     216                 :          8 : Size DrawDocShell::GetFirstPageSize()
     217                 :            : {
     218                 :          8 :     return SfxObjectShell::GetFirstPageSize();
     219                 :            : }
     220                 :            : 
     221                 :            : /*************************************************************************
     222                 :            : |*
     223                 :            : |* Bitmap einer beliebigen Seite erzeugen
     224                 :            : |*
     225                 :            : \************************************************************************/
     226                 :            : 
     227                 :          0 : Bitmap DrawDocShell::GetPagePreviewBitmap(SdPage* pPage, sal_uInt16 nMaxEdgePixel)
     228                 :            : {
     229         [ #  # ]:          0 :     MapMode         aMapMode( MAP_100TH_MM );
     230         [ #  # ]:          0 :     const Size      aSize( pPage->GetSize() );
     231                 :          0 :     const Point     aNullPt;
     232 [ #  # ][ #  # ]:          0 :     VirtualDevice   aVDev( *Application::GetDefaultDevice() );
     233                 :            : 
     234         [ #  # ]:          0 :     aVDev.SetMapMode( aMapMode );
     235                 :            : 
     236         [ #  # ]:          0 :     const Size  aPixSize( aVDev.LogicToPixel( aSize ) );
     237                 :          0 :     const sal_uLong nMaxEdgePix = Max( aPixSize.Width(), aPixSize.Height() );
     238         [ #  # ]:          0 :     Fraction    aFrac( nMaxEdgePixel, nMaxEdgePix );
     239                 :            : 
     240         [ #  # ]:          0 :     aMapMode.SetScaleX( aFrac );
     241         [ #  # ]:          0 :     aMapMode.SetScaleY( aFrac );
     242         [ #  # ]:          0 :     aVDev.SetMapMode( aMapMode );
     243         [ #  # ]:          0 :     aVDev.SetOutputSize( aSize );
     244                 :            : 
     245                 :            :     // damit die dunklen Linien am rechten und unteren Seitenrans mitkommen
     246 [ #  # ][ #  # ]:          0 :     aFrac = Fraction( nMaxEdgePixel - 1, nMaxEdgePix );
     247         [ #  # ]:          0 :     aMapMode.SetScaleX( aFrac );
     248         [ #  # ]:          0 :     aMapMode.SetScaleY( aFrac );
     249         [ #  # ]:          0 :     aVDev.SetMapMode( aMapMode );
     250                 :            : 
     251 [ #  # ][ #  # ]:          0 :     ClientView* pView = new ClientView( this, &aVDev, NULL );
     252         [ #  # ]:          0 :     FrameView*      pFrameView = GetFrameView();
     253         [ #  # ]:          0 :     pView->ShowSdrPage( pPage );
     254                 :            : 
     255 [ #  # ][ #  # ]:          0 :     if ( GetFrameView() )
     256                 :            :     {
     257                 :            :         // Initialisierungen der Zeichen-(Bildschirm-)Attribute
     258                 :          0 :         pView->SetGridCoarse( pFrameView->GetGridCoarse() );
     259         [ #  # ]:          0 :         pView->SetGridFine( pFrameView->GetGridFine() );
     260         [ #  # ]:          0 :         pView->SetSnapGridWidth(pFrameView->GetSnapGridWidthX(), pFrameView->GetSnapGridWidthY());
     261         [ #  # ]:          0 :         pView->SetGridVisible( pFrameView->IsGridVisible() );
     262         [ #  # ]:          0 :         pView->SetGridFront( pFrameView->IsGridFront() );
     263                 :          0 :         pView->SetSnapAngle( pFrameView->GetSnapAngle() );
     264                 :          0 :         pView->SetGridSnap( pFrameView->IsGridSnap() );
     265                 :          0 :         pView->SetBordSnap( pFrameView->IsBordSnap() );
     266                 :          0 :         pView->SetHlplSnap( pFrameView->IsHlplSnap() );
     267                 :          0 :         pView->SetOFrmSnap( pFrameView->IsOFrmSnap() );
     268                 :          0 :         pView->SetOPntSnap( pFrameView->IsOPntSnap() );
     269                 :          0 :         pView->SetOConSnap( pFrameView->IsOConSnap() );
     270         [ #  # ]:          0 :         pView->SetDragStripes( pFrameView->IsDragStripes() );
     271         [ #  # ]:          0 :         pView->SetFrameDragSingles( pFrameView->IsFrameDragSingles() );
     272                 :          0 :         pView->SetSnapMagneticPixel( pFrameView->GetSnapMagneticPixel() );
     273                 :          0 :         pView->SetMarkedHitMovesAlways( pFrameView->IsMarkedHitMovesAlways() );
     274                 :          0 :         pView->SetMoveOnlyDragging( pFrameView->IsMoveOnlyDragging() );
     275                 :          0 :         pView->SetSlantButShear( pFrameView->IsSlantButShear() );
     276         [ #  # ]:          0 :         pView->SetNoDragXorPolys( pFrameView->IsNoDragXorPolys() );
     277                 :          0 :         pView->SetCrookNoContortion( pFrameView->IsCrookNoContortion() );
     278                 :          0 :         pView->SetAngleSnapEnabled( pFrameView->IsAngleSnapEnabled() );
     279                 :          0 :         pView->SetBigOrtho( pFrameView->IsBigOrtho() );
     280                 :          0 :         pView->SetOrtho( pFrameView->IsOrtho() );
     281                 :            : 
     282                 :          0 :         SdrPageView* pPageView = pView->GetSdrPageView();
     283                 :            : 
     284         [ #  # ]:          0 :         if (pPageView)
     285                 :            :         {
     286         [ #  # ]:          0 :             if ( pPageView->GetVisibleLayers() != pFrameView->GetVisibleLayers() )
     287         [ #  # ]:          0 :                 pPageView->SetVisibleLayers( pFrameView->GetVisibleLayers() );
     288                 :            : 
     289         [ #  # ]:          0 :             if ( pPageView->GetPrintableLayers() != pFrameView->GetPrintableLayers() )
     290                 :          0 :                 pPageView->SetPrintableLayers( pFrameView->GetPrintableLayers() );
     291                 :            : 
     292         [ #  # ]:          0 :             if ( pPageView->GetLockedLayers() != pFrameView->GetLockedLayers() )
     293                 :          0 :                 pPageView->SetLockedLayers( pFrameView->GetLockedLayers() );
     294                 :            : 
     295         [ #  # ]:          0 :                 pPageView->SetHelpLines( pFrameView->GetStandardHelpLines() );
     296                 :            :         }
     297                 :            : 
     298 [ #  # ][ #  # ]:          0 :         if ( pView->GetActiveLayer() != pFrameView->GetActiveLayer() )
     299         [ #  # ]:          0 :             pView->SetActiveLayer( pFrameView->GetActiveLayer() );
     300                 :            :     }
     301                 :            : 
     302 [ #  # ][ #  # ]:          0 :     pView->CompleteRedraw( &aVDev, Rectangle( aNullPt, aSize ) );
         [ #  # ][ #  # ]
     303                 :            : 
     304                 :            :     // IsRedrawReady() always gives sal_True while ( !pView->IsRedrawReady() ) {}
     305 [ #  # ][ #  # ]:          0 :     delete pView;
     306                 :            : 
     307 [ #  # ][ #  # ]:          0 :     aVDev.SetMapMode( MapMode() );
                 [ #  # ]
     308                 :            : 
     309         [ #  # ]:          0 :     Bitmap aPreview( aVDev.GetBitmap( aNullPt, aVDev.GetOutputSizePixel() ) );
     310                 :            : 
     311                 :            :     DBG_ASSERT(!!aPreview, "Vorschau-Bitmap konnte nicht erzeugt werden");
     312                 :            : 
     313 [ #  # ][ #  # ]:          0 :     return aPreview;
     314                 :            : }
     315                 :            : 
     316                 :            : 
     317                 :            : /*************************************************************************
     318                 :            : |*
     319                 :            : |* Pruefen, ob die Seite vorhanden ist und dann den Anwender zwingen einen
     320                 :            : |* noch nicht vorhandenen Namen einzugeben. Wird sal_False zurueckgegeben,
     321                 :            : |* wurde die Aktion vom Anwender abgebrochen.
     322                 :            : |*
     323                 :            : \************************************************************************/
     324                 :            : 
     325                 :          0 : sal_Bool DrawDocShell::CheckPageName (::Window* pWin, String& rName )
     326                 :            : {
     327         [ #  # ]:          0 :     const String aStrForDlg( rName );
     328         [ #  # ]:          0 :     bool bIsNameValid = IsNewPageNameValid( rName, true );
     329                 :            : 
     330         [ #  # ]:          0 :     if( ! bIsNameValid )
     331                 :            :     {
     332 [ #  # ][ #  # ]:          0 :         String aDesc( SdResId( STR_WARN_PAGE_EXISTS ) );
     333         [ #  # ]:          0 :         SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
     334 [ #  # ][ #  # ]:          0 :         AbstractSvxNameDialog* aNameDlg = pFact ? pFact->CreateSvxNameDialog( pWin, aStrForDlg, aDesc ) : 0;
     335         [ #  # ]:          0 :         if( aNameDlg )
     336                 :            :         {
     337         [ #  # ]:          0 :             aNameDlg->SetEditHelpId( HID_SD_NAMEDIALOG_PAGE );
     338                 :            : 
     339         [ #  # ]:          0 :             if( mpViewShell )
     340 [ #  # ][ #  # ]:          0 :                 aNameDlg->SetCheckNameHdl( LINK( this, DrawDocShell, RenameSlideHdl ) );
     341                 :            : 
     342         [ #  # ]:          0 :             FunctionReference xFunc( mpViewShell->GetCurrentFunction() );
     343         [ #  # ]:          0 :             if( xFunc.is() )
     344         [ #  # ]:          0 :                 xFunc->cancel();
     345                 :            : 
     346 [ #  # ][ #  # ]:          0 :             if( aNameDlg->Execute() == RET_OK )
     347                 :            :             {
     348         [ #  # ]:          0 :                 aNameDlg->GetName( rName );
     349         [ #  # ]:          0 :                 bIsNameValid = IsNewPageNameValid( rName );
     350                 :            :             }
     351 [ #  # ][ #  # ]:          0 :             delete aNameDlg;
                 [ #  # ]
     352         [ #  # ]:          0 :         }
     353                 :            :     }
     354                 :            : 
     355 [ #  # ][ #  # ]:          0 :     return ( bIsNameValid ? sal_True : sal_False );
     356                 :            : }
     357                 :            : 
     358                 :          0 : bool DrawDocShell::IsNewPageNameValid( String & rInOutPageName, bool bResetStringIfStandardName /* = false */ )
     359                 :            : {
     360                 :          0 :     bool bCanUseNewName = false;
     361                 :            : 
     362                 :            :     // check if name is something like 'Slide n'
     363 [ #  # ][ #  # ]:          0 :     String aStrPage( SdResId( STR_SD_PAGE ) );
     364         [ #  # ]:          0 :     aStrPage += ' ';
     365                 :            : 
     366                 :          0 :     bool bIsStandardName = false;
     367                 :            : 
     368                 :            :     // prevent also _future_ slide names of the form "'STR_SD_PAGE' + ' ' + '[0-9]+|[a-z]|[A-Z]|[CDILMVX]+|[cdilmvx]+'"
     369                 :            :     // (arabic, lower- and upper case single letter, lower- and upper case roman numbers)
     370 [ #  # ][ #  # ]:          0 :     if( 0 == rInOutPageName.Search( aStrPage ) )
     371                 :            :     {
     372         [ #  # ]:          0 :         if( rInOutPageName.GetToken( 1, sal_Unicode(' ') ).GetChar(0) >= '0' &&
           [ #  #  #  # ]
         [ #  # ][ #  # ]
           [ #  #  #  # ]
     373 [ #  # ][ #  # ]:          0 :             rInOutPageName.GetToken( 1, sal_Unicode(' ') ).GetChar(0) <= '9' )
         [ #  # ][ #  # ]
     374                 :            :         {
     375                 :            :             // check for arabic numbering
     376                 :            : 
     377                 :            :             // gobble up all following numbers
     378         [ #  # ]:          0 :             String sRemainder = rInOutPageName.GetToken( 1, sal_Unicode(' ') );
     379   [ #  #  #  #  :          0 :             while( sRemainder.Len() &&
           #  # ][ #  # ]
     380                 :          0 :                    sRemainder.GetChar(0) >= '0' &&
     381                 :          0 :                    sRemainder.GetChar(0) <= '9' )
     382                 :            :             {
     383                 :            :                 // trim by one
     384         [ #  # ]:          0 :                 sRemainder.Erase(0, 1);
     385                 :            :             }
     386                 :            : 
     387                 :            :             // EOL? Reserved name!
     388         [ #  # ]:          0 :             if( !sRemainder.Len() )
     389                 :            :             {
     390                 :          0 :                 bIsStandardName = true;
     391         [ #  # ]:          0 :             }
     392                 :            :         }
     393 [ #  # ][ #  # ]:          0 :         else if( rInOutPageName.GetToken( 1, sal_Unicode(' ') ).Len() == 1 &&
         [ #  # ][ #  # ]
                 [ #  # ]
           [ #  #  #  # ]
     394 [ #  # ][ #  # ]:          0 :                  comphelper::string::islowerAscii(rInOutPageName.GetToken( 1, sal_Unicode(' ') ).GetChar(0) ) )
         [ #  # ][ #  # ]
                 [ #  # ]
     395                 :            :         {
     396                 :            :             // lower case, single character: reserved
     397                 :          0 :             bIsStandardName = true;
     398                 :            :         }
     399 [ #  # ][ #  # ]:          0 :         else if( rInOutPageName.GetToken( 1, sal_Unicode(' ') ).Len() == 1 &&
         [ #  # ][ #  # ]
                 [ #  # ]
           [ #  #  #  # ]
     400 [ #  # ][ #  # ]:          0 :                  comphelper::string::isupperAscii(rInOutPageName.GetToken( 1, sal_Unicode(' ') ).GetChar(0) ) )
         [ #  # ][ #  # ]
                 [ #  # ]
     401                 :            :         {
     402                 :            :             // upper case, single character: reserved
     403                 :          0 :             bIsStandardName = true;
     404                 :            :         }
     405                 :            :         else
     406                 :            :         {
     407                 :            :             // check for upper/lower case roman numbering
     408         [ #  # ]:          0 :             String sReserved( rtl::OUString("cdilmvx") );
     409                 :            : 
     410                 :            :             // gobble up all following characters contained in one reserved class
     411         [ #  # ]:          0 :             String sRemainder = rInOutPageName.GetToken( 1, sal_Unicode(' ') );
     412 [ #  # ][ #  # ]:          0 :             if( sReserved.Search( sRemainder.GetChar(0) ) == STRING_NOTFOUND )
     413         [ #  # ]:          0 :                 sReserved.ToUpperAscii();
     414                 :            : 
     415 [ #  # ][ #  # ]:          0 :             while( sReserved.Search( sRemainder.GetChar(0) ) != STRING_NOTFOUND )
     416                 :            :             {
     417                 :            :                 // trim by one
     418         [ #  # ]:          0 :                 sRemainder.Erase(0, 1);
     419                 :            :             }
     420                 :            : 
     421                 :            :             // EOL? Reserved name!
     422         [ #  # ]:          0 :             if( !sRemainder.Len() )
     423                 :            :             {
     424                 :          0 :                 bIsStandardName = true;
     425 [ #  # ][ #  # ]:          0 :             }
     426                 :            :         }
     427                 :            :     }
     428                 :            : 
     429         [ #  # ]:          0 :     if( bIsStandardName )
     430                 :            :     {
     431         [ #  # ]:          0 :         if( bResetStringIfStandardName )
     432                 :            :         {
     433                 :            :             // this is for insertion of slides from other files with standard
     434                 :            :             // name.  They get a new standard name, if the string is set to an
     435                 :            :             // empty one.
     436 [ #  # ][ #  # ]:          0 :             rInOutPageName = String();
                 [ #  # ]
     437                 :          0 :             bCanUseNewName = true;
     438                 :            :         }
     439                 :            :         else
     440                 :          0 :             bCanUseNewName = false;
     441                 :            :     }
     442                 :            :     else
     443                 :            :     {
     444         [ #  # ]:          0 :         if( rInOutPageName.Len() > 0 )
     445                 :            :         {
     446                 :            :             sal_Bool   bOutDummy;
     447         [ #  # ]:          0 :             sal_uInt16 nExistingPageNum = mpDoc->GetPageByName( rInOutPageName, bOutDummy );
     448                 :          0 :             bCanUseNewName = ( nExistingPageNum == SDRPAGE_NOTFOUND );
     449                 :            :         }
     450                 :            :         else
     451                 :          0 :             bCanUseNewName = false;
     452                 :            :     }
     453                 :            : 
     454         [ #  # ]:          0 :     return bCanUseNewName;
     455                 :            : }
     456                 :            : 
     457                 :          0 : IMPL_LINK( DrawDocShell, RenameSlideHdl, AbstractSvxNameDialog*, pDialog )
     458                 :            : {
     459         [ #  # ]:          0 :     if( ! pDialog )
     460                 :          0 :         return 0;
     461                 :            : 
     462         [ #  # ]:          0 :     String aNewName;
     463         [ #  # ]:          0 :     pDialog->GetName( aNewName );
     464                 :            : 
     465 [ #  # ][ #  # ]:          0 :     return IsNewPageNameValid( aNewName );
     466                 :            : }
     467 [ +  - ][ +  - ]:         75 : } // end of namespace sd
     468                 :            : 
     469                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10