Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


This patch just replace using a List to save Slide Show names and displaying
them in the slide show setting dialog.

The code can be tested going to impress, Slide Show->Slide Show Settings.
From 2efc2f86e67f13a4d2140b3c6494d1ee4f30e449 Mon Sep 17 00:00:00 2001
From: Rafael Dominguez <venccsralph@gmail.com>
Date: Sun, 12 Jun 2011 17:50:47 -0430
Subject: [PATCH 2/9] Replace List with std::vector<String>.

---
 sd/inc/sdabstdlg.hxx           |    3 ++-
 sd/source/ui/dlg/present.cxx   |   12 +++---------
 sd/source/ui/dlg/sddlgfact.cxx |    3 ++-
 sd/source/ui/dlg/sddlgfact.hxx |    3 ++-
 sd/source/ui/func/fusldlg.cxx  |   19 ++++++++-----------
 sd/source/ui/inc/present.hxx   |    2 +-
 6 files changed, 18 insertions(+), 24 deletions(-)

diff --git a/sd/inc/sdabstdlg.hxx b/sd/inc/sdabstdlg.hxx
index d1cede9..bdcb832 100644
--- a/sd/inc/sdabstdlg.hxx
+++ b/sd/inc/sdabstdlg.hxx
@@ -200,7 +200,8 @@ public:
     virtual AbstractMorphDlg*                  CreateMorphDlg( ::Window* pParent, const SdrObject* 
pObj1, const SdrObject* pObj2) = 0;
     virtual SfxAbstractTabDialog*              CreateSdOutlineBulletTabDlg ( ::Window* pParent, 
const SfxItemSet* pAttr, ::sd::View* pView = NULL ) = 0;
     virtual SfxAbstractTabDialog*              CreateSdParagraphTabDlg ( ::Window* pParent, const 
SfxItemSet* pAttr ) = 0;
-    virtual AbstractSdStartPresDlg*            CreateSdStartPresentationDlg( ::Window* pWindow, 
const SfxItemSet& rInAttrs, List& rPageNames, List* pCSList ) = 0;
+    virtual AbstractSdStartPresDlg*            CreateSdStartPresentationDlg( ::Window* pWindow, 
const SfxItemSet& rInAttrs,
+                                                                     const std::vector<String> 
&rPageNames, List* pCSList ) = 0;
     virtual SfxAbstractTabDialog*              CreateSdPresLayoutTemplateDlg( SfxObjectShell* 
pDocSh, ::Window* pParent, SdResId DlgId, SfxStyleSheetBase& rStyleBase, PresentationObjects ePO, 
SfxStyleSheetBasePool* pSSPool ) = 0;
     virtual AbstractSdPresLayoutDlg*   CreateSdPresLayoutDlg( ::sd::DrawDocShell* pDocShell, 
::sd::ViewShell* pViewShell, ::Window* pWindow, const SfxItemSet& rInAttrs) = 0;
     virtual SfxAbstractTabDialog*              CreateSdTabTemplateDlg( ::Window* pParent, const 
SfxObjectShell* pDocShell, SfxStyleSheetBase& rStyleBase, SdrModel* pModel, SdrView* pView ) = 0;
diff --git a/sd/source/ui/dlg/present.cxx b/sd/source/ui/dlg/present.cxx
index f164dcf..30f609d 100644
--- a/sd/source/ui/dlg/present.cxx
+++ b/sd/source/ui/dlg/present.cxx
@@ -55,7 +55,7 @@ using namespace ::com::sun::star::beans;
 \************************************************************************/
 SdStartPresentationDlg::SdStartPresentationDlg( Window* pWindow,
                                   const SfxItemSet& rInAttrs,
-                                  List& rPageNames, List* pCSList ) :
+                                  const std::vector<String> &rPageNames, List* pCSList ) :
                 ModalDialog     ( pWindow, SdResId( DLG_START_PRESENTATION ) ),
                 aGrpRange               ( this, SdResId( GRP_RANGE ) ),
                 aRbtAll                 ( this, SdResId( RBT_ALL ) ),
@@ -119,14 +119,8 @@ SdStartPresentationDlg::SdStartPresentationDlg( Window* pWindow,
     aTmfPause.SetAccessibleName(aRbtAuto.GetText());
 
     // Listbox mit Seitennamen fuellen
-    rPageNames.First();
-    for( sal_uInt16 i = 0;
-         i < rPageNames.Count();
-         i++ )
-    {
-        aLbDias.InsertEntry( *( String* ) rPageNames.GetCurObject() );
-        rPageNames.Next();
-    }
+    for (std::vector<String>::const_iterator pIter = rPageNames.begin(); pIter != 
rPageNames.end(); ++pIter)
+        aLbDias.InsertEntry(*pIter);
 
     if( pCustomShowList )
     {
diff --git a/sd/source/ui/dlg/sddlgfact.cxx b/sd/source/ui/dlg/sddlgfact.cxx
index 90c60c9..6f36175 100644
--- a/sd/source/ui/dlg/sddlgfact.cxx
+++ b/sd/source/ui/dlg/sddlgfact.cxx
@@ -484,7 +484,8 @@ SfxAbstractTabDialog *  SdAbstractDialogFactory_Impl::CreateSdParagraphTabDlg( :
 // add for OutlineBulletDlg end 
 
 // add for SdStartPresentationDlg begin
-AbstractSdStartPresDlg *  SdAbstractDialogFactory_Impl::CreateSdStartPresentationDlg( ::Window* 
pWindow, const SfxItemSet& rInAttrs, List& rPageNames, List* pCSList )
+AbstractSdStartPresDlg *  SdAbstractDialogFactory_Impl::CreateSdStartPresentationDlg( ::Window* 
pWindow, const SfxItemSet& rInAttrs,
+                                                                                     const 
std::vector<String> &rPageNames, List* pCSList )
 {
     return new AbstractSdStartPresDlg_Impl( new SdStartPresentationDlg( pWindow, rInAttrs, 
rPageNames, pCSList ) );
 }
diff --git a/sd/source/ui/dlg/sddlgfact.hxx b/sd/source/ui/dlg/sddlgfact.hxx
index d227e77..895ac84 100644
--- a/sd/source/ui/dlg/sddlgfact.hxx
+++ b/sd/source/ui/dlg/sddlgfact.hxx
@@ -273,7 +273,8 @@ public:
     virtual AbstractMorphDlg*                  CreateMorphDlg( ::Window* pParent, const SdrObject* 
pObj1, const SdrObject* pObj2);
     virtual SfxAbstractTabDialog*              CreateSdOutlineBulletTabDlg ( ::Window* pParent, 
const SfxItemSet* pAttr, ::sd::View* pView = NULL );
     virtual SfxAbstractTabDialog*              CreateSdParagraphTabDlg ( ::Window* pParent, const 
SfxItemSet* pAttr );
-    virtual AbstractSdStartPresDlg*            CreateSdStartPresentationDlg( ::Window* pWindow, 
const SfxItemSet& rInAttrs, List& rPageNames, List* pCSList );
+    virtual AbstractSdStartPresDlg*            CreateSdStartPresentationDlg( ::Window* pWindow, 
const SfxItemSet& rInAttrs,
+                                                                     const std::vector<String> 
&rPageNames, List* pCSList );
     virtual SfxAbstractTabDialog*              CreateSdPresLayoutTemplateDlg( SfxObjectShell* 
pDocSh, ::Window* pParent, SdResId DlgId, SfxStyleSheetBase& rStyleBase, PresentationObjects ePO, 
SfxStyleSheetBasePool* pSSPool );
     virtual AbstractSdPresLayoutDlg*   CreateSdPresLayoutDlg( ::sd::DrawDocShell* pDocShell, 
::sd::ViewShell* pViewShell, ::Window* pWindow, const SfxItemSet& rInAttrs);
     virtual SfxAbstractTabDialog*              CreateSdTabTemplateDlg( ::Window* pParent, const 
SfxObjectShell* pDocShell, SfxStyleSheetBase& rStyleBase, SdrModel* pModel, SdrView* pView );
diff --git a/sd/source/ui/func/fusldlg.cxx b/sd/source/ui/func/fusldlg.cxx
index 409e99a..0c805db 100644
--- a/sd/source/ui/func/fusldlg.cxx
+++ b/sd/source/ui/func/fusldlg.cxx
@@ -81,7 +81,7 @@ void FuSlideShowDlg::DoExecute( SfxRequest& )
     PresentationSettings& rPresentationSettings = mpDoc->getPresentationSettings();
 
     SfxItemSet         aDlgSet( mpDoc->GetPool(), ATTR_PRESENT_START, ATTR_PRESENT_END );
-    List                       aPageNameList;
+    std::vector<String> aPageNameList(mpDoc->GetSdPageCount( PK_STANDARD ));
     const String&      rPresPage = rPresentationSettings.maPresPage;
     String                     aFirstPage;
     String                     aStandardName( SdResId( STR_PAGE ) );
@@ -91,21 +91,21 @@ void FuSlideShowDlg::DoExecute( SfxRequest& )
     for( nPage = mpDoc->GetSdPageCount( PK_STANDARD ) - 1L; nPage >= 0L; nPage-- )
     {
         pPage = mpDoc->GetSdPage( (sal_uInt16) nPage, PK_STANDARD );
-        String* pStr = new String( pPage->GetName() );
+        String aStr( pPage->GetName() );
 
-        if ( !pStr->Len() )
+        if ( !aStr.Len() )
         {
-            *pStr = String( SdResId( STR_PAGE ) );
-            (*pStr).Append( UniString::CreateFromInt32( nPage + 1 ) );
+            aStr = String( SdResId( STR_PAGE ) );
+            aStr.Append( UniString::CreateFromInt32( nPage + 1 ) );
         }
 
-        aPageNameList.Insert( pStr, (sal_uLong) 0 );
+        aPageNameList[ nPage ] = aStr;
 
         // ist dies unsere (vorhandene) erste Seite?
-        if ( rPresPage == *pStr )
+        if ( rPresPage == aStr )
             aFirstPage = rPresPage;
         else if ( pPage->IsSelected() && !aFirstPage.Len() )
-            aFirstPage = *pStr;
+            aFirstPage = aStr;
     }
     List* pCustomShowList = mpDoc->GetCustomShowList(); // No Create
 
@@ -248,9 +248,6 @@ void FuSlideShowDlg::DoExecute( SfxRequest& )
             mpDoc->SetChanged( sal_True );
     }
     delete pDlg;
-    // Strings aus Liste loeschen
-    for( void* pStr = aPageNameList.First(); pStr; pStr = aPageNameList.Next() )
-        delete (String*) pStr;
 }
 
 } // end of namespace sd
diff --git a/sd/source/ui/inc/present.hxx b/sd/source/ui/inc/present.hxx
index 6069edc..11681ce 100644
--- a/sd/source/ui/inc/present.hxx
+++ b/sd/source/ui/inc/present.hxx
@@ -95,7 +95,7 @@ private:
 public:
                         SdStartPresentationDlg( Window* pWindow,
                                 const SfxItemSet& rInAttrs,
-                                List& rPageNames,
+                                const std::vector<String> &rPageNames,
                                 List* pCSList );
 
     void                               GetAttr( SfxItemSet& rOutAttrs );
-- 
1.7.3.4


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.