[Libreoffice-commits] .: Branch 'libreoffice-3-5' - sd/source

David Tardon dtardon at kemper.freedesktop.org
Tue Feb 7 22:01:26 PST 2012


 sd/source/ui/unoidl/unopage.cxx |   15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

New commits:
commit 6d49075a032191b4f7034b1b8c799d163d35a58c
Author: Muthu Subramanian <sumuthu at suse.com>
Date:   Wed Feb 1 18:01:17 2012 +0530

    n#735533: Donot set duplicate master slide names.
    
    Signed-off-by: David Tardon <dtardon at redhat.com>

diff --git a/sd/source/ui/unoidl/unopage.cxx b/sd/source/ui/unoidl/unopage.cxx
index 84a76d3..2f441e9 100644
--- a/sd/source/ui/unoidl/unopage.cxx
+++ b/sd/source/ui/unoidl/unopage.cxx
@@ -3015,7 +3015,7 @@ void SdMasterPage::getBackground( Any& rValue ) throw()
 }
 
 // XNamed
-void SAL_CALL SdMasterPage::setName( const OUString& aName )
+void SAL_CALL SdMasterPage::setName( const OUString& rName )
     throw(uno::RuntimeException)
 {
     ::SolarMutexGuard aGuard;
@@ -3024,11 +3024,18 @@ void SAL_CALL SdMasterPage::setName( const OUString& aName )
 
     if(SvxFmDrawPage::mpPage && GetPage()->GetPageKind() != PK_NOTES)
     {
-        String aNewName( aName );
+        SdDrawDocument* pDoc = GetModel()->GetDoc();
+        sal_Bool bOutDummy;
+        String aNewName( rName );
+
+        // Slide Name has to be unique
+        if( pDoc && pDoc->GetPageByName( aNewName, bOutDummy ) != SDRPAGE_NOTFOUND )
+            return; // throw Exception ?
+
         GetPage()->SetName( aNewName );
 
-        if(GetModel()->GetDoc())
-            GetModel()->GetDoc()->RenameLayoutTemplate(GetPage()->GetLayoutName(), aNewName);
+        if( pDoc )
+            pDoc->RenameLayoutTemplate( GetPage()->GetLayoutName(), aNewName );
 
         // fake a mode change to repaint the page tab bar
         ::sd::DrawDocShell* pDocSh = GetModel()->GetDocShell();


More information about the Libreoffice-commits mailing list