[ooo-build-commit] patches/dev300

Radek Doulík rodo at kemper.freedesktop.org
Mon Jul 20 22:53:11 PDT 2009


 patches/dev300/apply                 |    5 
 patches/dev300/layoutcode071809.diff | 4289 +++++++++++++++++++++++++++++++++++
 2 files changed, 4293 insertions(+), 1 deletion(-)

New commits:
commit e0f2cdb084a3fb1987bfa9c6c7d62ed0e5a66a2a
Author: Radek Doulik <rodo at novell.com>
Date:   Mon Jul 20 23:35:05 2009 +0200

    added experimental patch from Dona Hertel
    
    * it extracts autolayout code in sd core to separate classes - LayoutType and LayoutList
    * introduces serializing of these classes to XML
    
    * patches/dev300/apply:
    * patches/dev300/layoutcode071809.diff:

diff --git a/patches/dev300/apply b/patches/dev300/apply
index 7817dff..f72ff04 100644
--- a/patches/dev300/apply
+++ b/patches/dev300/apply
@@ -34,7 +34,7 @@ Experimental: VBAUntested, ArkOnlyExperimental, \
 	      PostgreSQL, SELinux, VOSremoval, Glib2, \
 	      UnitBootstrap, RadioButtons, UnstableLibwpd, WWInProgress, \
 	      KDE4Experimental, MinGW, CalcExperimental, Mono24, \
-	      OOXMLExportExperimental, CrossWin32Patches
+	      OOXMLExportExperimental, CrossWin32Patches, AutoLayout
 DebianLooseSections: DebianBaseNoHelpContent
 # Optional sections
 Optional : DejaVuFonts, NovellOnlyExtensionFixes, Win32OnlyExtensionFixes, Linux32OnlyExtensionFixes
@@ -3349,3 +3349,6 @@ desktop-cmd-bulk-conversion.diff, flr
 SectionOwner => kohei
 
 calc-formula-externref-countif-fix.diff, n#521624, i#102750, kohei
+
+[ AutoLayout ]
+layoutcode071809.diff, cocofan
diff --git a/patches/dev300/layoutcode071809.diff b/patches/dev300/layoutcode071809.diff
new file mode 100644
index 0000000..755f0ed
--- /dev/null
+++ b/patches/dev300/layoutcode071809.diff
@@ -0,0 +1,4289 @@
+diff -Nrup sd-m15/inc/drawdoc.hxx sd/inc/drawdoc.hxx
+--- sd-m15/inc/drawdoc.hxx	2009-07-15 21:39:04.000000000 -0700
++++ sd/inc/drawdoc.hxx	2009-07-18 23:21:35.000000000 -0700
+@@ -57,6 +57,11 @@
+ #endif
+ #include "sddllapi.h"
+ #include "sdpage.hxx"
++#include "layoutlist.hxx"
++
++
++sd::LayoutList* GetLayoutList();
++
+ 
+ namespace com
+ {
+@@ -522,8 +527,8 @@ public:
+         PageKind ePageKind,
+         const String& sStandardPageName,
+         const String& sNotesPageName,
+-        AutoLayout eStandardLayout,
+-        AutoLayout eNotesLayout,
++        sd::AutoLayout eStandardLayout,
++        sd::AutoLayout eNotesLayout,
+         BOOL bIsPageBack,
+         BOOL bIsPageObj);
+ 
+@@ -578,8 +583,8 @@ public:
+         PageKind ePageKind,
+         const String& sStandardPageName,
+         const String& sNotesPageName,
+-        AutoLayout eStandardLayout,
+-        AutoLayout eNotesLayout,
++        sd::AutoLayout eStandardLayout,
++        sd::AutoLayout eNotesLayout,
+         BOOL bIsPageBack,
+         BOOL bIsPageObj);
+ 
+@@ -643,8 +648,8 @@ private:
+         PageKind ePageKind,
+         const String& sStandardPageName,
+         const String& sNotesPageName,
+-        AutoLayout eStandardLayout,
+-        AutoLayout eNotesLayout,
++        sd::AutoLayout eStandardLayout,
++        sd::AutoLayout eNotesLayout,
+         BOOL bIsPageBack,
+         BOOL bIsPageObj,
+ 
+diff -Nrup sd-m15/inc/layoutlist.hxx sd/inc/layoutlist.hxx
+--- sd-m15/inc/layoutlist.hxx	1969-12-31 16:00:00.000000000 -0800
++++ sd/inc/layoutlist.hxx	2009-07-18 23:21:35.000000000 -0700
+@@ -0,0 +1,208 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ * 
++ * Copyright 2008 by Sun Microsystems, Inc.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * $RCSfile: layoutlist.hxx,v $
++ * $Revision: 0.1 $
++ *
++ * This file is part of OpenOffice.org.
++ *
++ * OpenOffice.org is free software: you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License version 3
++ * only, as published by the Free Software Foundation.
++ *
++ * OpenOffice.org is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ * GNU Lesser General Public License version 3 for more details
++ * (a copy is included in the LICENSE file that accompanied this code).
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * version 3 along with OpenOffice.org.  If not, see
++ * <http://www.openoffice.org/license.html>
++ * for a copy of the LGPLv3 License.
++ *
++ ************************************************************************/
++
++
++#ifndef _LAYOUTLIST_HXX
++#define _LAYOUTLIST_HXX
++
++
++#define LL_NOT_FOUND 100000
++
++#include <vector>
++#include "layouttype.hxx"
++#include "sal/types.h"
++#include "tools/string.hxx"
++#include "sdresid.hxx"
++#include "../source/ui/inc/strings.hrc"
++#include "pres.hxx"
++
++
++// needed for pptin.cxx (PowerPoint filter)
++// among other files.
++
++#define AUTOLAYOUT_TITLE 0
++#define	AUTOLAYOUT_ENUM 1
++#define	AUTOLAYOUT_CHART 2
++#define	AUTOLAYOUT_2TEXT 3
++#define	AUTOLAYOUT_TEXTCHART 4
++#define	AUTOLAYOUT_ORG 5
++#define	AUTOLAYOUT_TEXTCLIP 6
++#define	AUTOLAYOUT_CHARTTEXT 7
++#define	AUTOLAYOUT_TAB 8
++#define	AUTOLAYOUT_CLIPTEXT 9
++#define	AUTOLAYOUT_TEXTOBJ 10
++#define	AUTOLAYOUT_OBJ 11
++#define	AUTOLAYOUT_TEXT2OBJ 12
++#define	AUTOLAYOUT_OBJTEXT 13
++#define	AUTOLAYOUT_OBJOVERTEXT 14
++#define	AUTOLAYOUT_2OBJTEXT 15
++#define	AUTOLAYOUT_2OBJOVERTEXT 16
++#define	AUTOLAYOUT_TEXTOVEROBJ 17
++#define	AUTOLAYOUT_4OBJ 18
++#define	AUTOLAYOUT_ONLY_TITLE 19
++#define	AUTOLAYOUT_NONE 20
++#define	AUTOLAYOUT_NOTES 21
++#define	AUTOLAYOUT_HANDOUT1 22
++#define	AUTOLAYOUT_HANDOUT2 23
++#define	AUTOLAYOUT_HANDOUT3 24
++#define	AUTOLAYOUT_HANDOUT4 25
++#define	AUTOLAYOUT_HANDOUT6 26
++#define	AUTOLAYOUT_VERTICAL_TITLE_TEXT_CHART 27
++#define	AUTOLAYOUT_VERTICAL_TITLE_VERTICAL_OUTLINE 28
++#define	AUTOLAYOUT_TITLE_VERTICAL_OUTLINE 29
++#define	AUTOLAYOUT_TITLE_VERTICAL_OUTLINE_CLIPART 30
++#define	AUTOLAYOUT_HANDOUT9 31
++#define AUTOLAYOUT_ONLY_TEXT 32
++#define AL_NUM_OF_BUILTINS 33
++
++
++namespace sd {
++   
++   typedef sal_Int32 AutoLayout;
++   
++   class LayoutList
++   {
++   public:
++       
++	   LayoutList();
++	   ~LayoutList();
++    
++       /** passes back the absolute path plus file name
++        *  of the autolayout configuration file. 
++        */   
++       String* getConfigFile();
++    
++       /** write entire layout information to a config file
++        */
++       void writeToFile();
++       
++       /** read entire layout information to a config file
++        */
++        void readFromFile();
++		   
++	   /** adds a layout object to the list
++	    *  passes back a true if the layout
++		*  was successfully added and passes back
++		*  a false if not (name already in the list,
++		*  for example). Also, adds to the given 
++		*  menu list at the given index (or at
++		*  the end if the index is negative(-1)) */
++	   bool addLayout(LayoutType* pLayout, const sal_Int32& menuIndex,
++	                  const PageKind& eMenu);
++		
++	   /** removes layout from list with given name.
++	    *  Doesn't delete object and does nothing if 
++		* not in the list.  It also, finds the menu
++		* entry and removes it completely.  Items will
++		* be moved up in the menu list.
++		*/
++	   void removeLayoutFromList(const LString& sName);
++	
++	   /** this will delete the layout as well as
++	    *  remove it from all lists. */
++	   void deleteLayout(const LString& sName);
++	   
++	   /** return the length of the list. This may not be
++	    * the number of actual layouts in the list */
++	   sal_uInt32 length() const;
++
++	   /** return the number of actual layouts in the list */
++	   sal_uInt32 numberOfLayouts() const;
++
++       /** pass in the index to the list.  for iterating
++	       the list. Will send back a NULL if a layout isn't there.*/
++	   LayoutType* getLayoutByIndex(const sal_uInt32 nIndex);
++	
++		/** find and pass back a layout object with the given
++		   name or NULL */
++	   LayoutType* getLayoutByName(const LString& sName);
++	   
++	   /** get the autolayout value of the  given name. It will
++	    *  send back a LL_NOT_FOUND if there is no layout.  Need to
++		*  cast this value to a sal_uInt32 to use as an
++		*  index into the list. */
++	   sal_uInt32 getLayoutIndex(const LString& sName);
++	   
++	   /** get the layout object for the given layoutMenu
++	    * index.
++	    */
++	   LayoutType* getLayoutAtMenuIndex(const sal_uInt32& nIndex,
++	                                    const PageKind& eMenu);
++	   
++	   /** get the size of a particular menu list */
++	   sal_uInt32 getMenuLength(const PageKind& eMenu);
++	   
++	   /** given an autolayout number, find the index in the menu.
++	    *   If not in the list, then passes back LL_NOT_FOUND*/
++	   sal_uInt32 getMenuIndex(const AutoLayout& nLayout,
++	                           const PageKind& nMenu);
++	   
++	   /** remove the autolayout from the list. Need to move 
++	    *  the layouts over.
++		*/
++	   void removeFromMenuList(const AutoLayout& lnum,
++	                           const PageKind& eMenu);
++	   
++	   /** add an autolayout to the menu list.  will grow
++	    *  the list to fit the given index.  A negative index
++		*  will cause the autolayout to be appended to the
++		* end of the list. */
++	   
++	   void addToMenuList(const sal_Int32& index,
++	                      const AutoLayout& lnum,
++						  const PageKind& eMenu);
++	   
++   private: 
++   
++       typedef std::vector<AutoLayout> MEListImpl;
++       typedef std::vector<LayoutType*> LListImpl;
++	    
++	   // list used for storing info about
++	   // both builtin and custom layouts
++	   LListImpl maLayoutList;
++	   
++       // lists used to fill the LayoutMenu
++	   // Gives the layouts in order by index.
++	   // There is a list for each view mode.
++	   MEListImpl maStandard; //standard view
++	   MEListImpl maNotes;   // notes view
++	   MEListImpl maHandout;  // handout view
++	   
++	   void initializeList();
++	   void initializeMenuOrder();
++	   
++	   
++	   
++		   
++  }; // Class LayoutList
++	
++}
++
++#endif	   // _LAYOUTLIST_HXX
+diff -Nrup sd-m15/inc/layouttype.hxx sd/inc/layouttype.hxx
+--- sd-m15/inc/layouttype.hxx	1969-12-31 16:00:00.000000000 -0800
++++ sd/inc/layouttype.hxx	2009-07-18 23:21:35.000000000 -0700
+@@ -0,0 +1,230 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ * 
++ * Copyright 2008 by Sun Microsystems, Inc.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * $RCSfile: layouttype.hxx,v $
++ * $Revision: 0.1 $
++ *
++ * This file is part of OpenOffice.org.
++ *
++ * OpenOffice.org is free software: you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License version 3
++ * only, as published by the Free Software Foundation.
++ *
++ * OpenOffice.org is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ * GNU Lesser General Public License version 3 for more details
++ * (a copy is included in the LICENSE file that accompanied this code).
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * version 3 along with OpenOffice.org.  If not, see
++ * <http://www.openoffice.org/license.html>
++ * for a copy of the LGPLv3 License.
++ *
++ ************************************************************************/
++
++
++#ifndef _LAYOUTTYPE_HXX
++#define _LAYOUTTYPE_HXX
++
++#include <vector>
++#include <com/sun/star/text/WritingMode.hpp>
++#include "sal/types.h"
++#include "tools/string.hxx"
++#include "tools/gen.hxx"
++#include "pres.hxx"
++#include <sax/fshelper.hxx>
++#include <com/sun/star/uno/Reference.hxx>
++#include <com/sun/star/xml/dom/XDocumentBuilder.hpp>
++
++
++
++using ::com::sun::star::uno::Reference;
++using namespace ::com::sun::star::xml;
++using namespace ::com::sun::star::text;
++using namespace ::sax_fastparser;
++
++namespace sd {
++  
++   typedef String LString;
++
++   /** RectType determines which
++    *  standard rectangle to use
++    *  to calculate bounding rects
++    *  and also determine the factors
++    *  used to calculate the rects.
++    */
++    
++   enum RectType {
++	   RT_TITLE,  // a non-vertical title
++	   RT_VERTICAL_TITLE,
++	   RT_LAYOUT,  // a non-vertical non-title shape
++	   RT_VERTICAL_LAYOUT,
++	   RT_TEXT_ONLY, // for the text only layout
++	   RT_LAYOUT_SWITCH, // use if shapes need switching
++	                    // for right to left writing
++	   RT_ERROR
++   };
++
++   /** ElemType defines the information for
++    *  one element (or pres. object) in
++    *  a layout.
++    */
++    
++   typedef struct {
++      PresObjKind kind; // the type of pres. object
++	  bool isVertical;  // whether to make this obj. vertical
++	  double factorX;  // factor for calculating topleft x value
++	  double factorY;  // factor for calculating topleft y value
++	  double factorHt; // factor for calculating height
++	  double factorWt; // factor for calculating width
++	  RectType recttype;  // type of standard rect to use
++	                      // for calculating rects.
++   } ElemType;
++	
++   /** LayoutType represents on autolayout */
++   
++   class LayoutType
++   {
++   public:
++	   LayoutType();
++	   ~LayoutType();
++       
++      /** functions for writing this layout to a xml configuration file */
++       void writeLayoutToFile(FastSerializerHelper& fsh, sal_Int32 autolayout);
++       void writeElementTofile(FastSerializerHelper& fsh,
++                               const sal_uInt32 i,
++                               const char* sNumber,
++                               const ElemType* elem);
++
++      /** functions for reading this layout in from a xml configuration
++       *  file.  Passes back entry in the list.
++       */ 
++       sal_Int32 getIntValue(const Reference<dom::XNode>& node);
++       double getDoubleValue(const Reference<dom::XNode>& node);
++       sal_Int32 readLayoutFromFile(const Reference<dom::XNode>& node);
++		
++		/** get functions for variables 
++         *  other than elements 
++         */
++        
++	   LString getName();
++       sal_uInt32 getStrId();
++	   sal_uInt32 getLayoutNumber();
++	   WritingMode getWritingMode();
++	   sal_uInt32 getHBitmapId();
++	   sal_uInt32 getLBitmapId();
++	   
++	   /** get functions for elements by index
++	    * and element list functions
++        */
++	   ElemType* getElemByIndex(const sal_uInt32& nIndex);
++	   sal_uInt32 length();
++	   PresObjKind getKind(const sal_uInt32& nIndex);
++	   bool isVertical(const sal_uInt32& nIndex);
++	   double factorX(const sal_uInt32& nIndex);
++	   double factorY(const sal_uInt32& nIndex);
++	   double factorHt(const sal_uInt32& nIndex);
++	   double factorWt(const sal_uInt32& nIndex);
++	   RectType recttype(const sal_uInt32& nIndex);
++	   
++	   /** set functions for variables other
++        *  than elements.
++        */
++        
++	   void setName(const LString& sName);
++       void setStrId(const sal_uInt32 id);
++	   void setLayoutNumber(const sal_uInt32& number);
++	   void setWritingMode(const WritingMode& wmode);
++	   void setHBitmapId(const sal_uInt32& id);
++	   void setLBitmapId(const sal_uInt32& id);
++
++	   
++	   /** set functions for elements and list
++        */
++        
++	   void createDefaultElement();
++	   void setKind(const sal_uInt32& nIndex, PresObjKind nKind);
++	   void setVertical(const sal_uInt32& nIndex, bool bVertical);
++	   void setFactorX(const sal_uInt32& nIndex, double fx);
++	   void setFactorY(const sal_uInt32& nIndex, double fy);
++	   void setFactorHt(const sal_uInt32& nIndex, double ht);
++	   void setFactorWt(const sal_uInt32& nIndex, double wt);
++	   void setRecttype(const sal_uInt32& nIndex, RectType rect);
++       /** add a passed in element to the list */
++	   void addElemToList(ElemType& rElement);
++	   /** deletes element and also removes from list */
++	   void deleteElement(const sal_uInt32& nIndex);
++	   
++	   /** sets the bounding rectangle information
++	    *  for a custom layout.  rRect is the actual
++		*  rectangle from the pres object. rStandard
++		*  is the generic title or layout rectangle.
++		*  For non-vertical titles, use RT_TITLE
++		*  and pass in the generic title rect.
++		*  For non-vertical all else, use RT_LAYOUT,
++		*  (or RT_LAYOUT_SWITCH if a switching of 
++		*  rectangles is needed for right to left
++		*  writing) and pass in a generic layout rect.
++		*  For vertical, use the corresponding
++		*  RT_VERTICAL_ type (see above).
++		*/
++	   void setCustomRectInfo(const sal_uInt32& nIndex, 
++                              const RectType& rType,
++                              const Rectangle& rRect,
++							  const Rectangle& rStandard);
++	   
++	    /** sets up an array of bounding rectangles
++		 *  used in drawing the autolayout elements. 
++	    *  Needs a default title rectangle, layout rectangle,
++		*   page size, upper and lower border of page and
++		*   whether the writing is right to left.
++		*/
++									  
++	  void calcAutoLayoutRectangles(const Rectangle& aTitleRect,
++                                      const Rectangle& aLayoutRect,
++									  const Size& aPageSize,
++								      const bool& bRightToLeft,
++									  Rectangle* rRectangle );
++                                      
++   		/** initialize the rectInfo. Mainly designed for builtins 
++		 *  but might be useful for custom layouts. 
++		 *  Should be called after the elements are
++		 *  all in the list, otherwise some elements won't be
++		 *  initialized at all. 
++         *  These functions may not be
++         *  needed after the configuration
++         *  file code is done. */
++		
++	   void initializeRectInfo();
++	   void initFromLayoutNumber(ElemType* elem,
++                                 const sal_uInt32& i);									  
++	   
++   private: 
++	   LString name;  // String name of the layout
++       sal_uInt32 nStrId;  // resource id for the string.
++	   WritingMode nWritingMode; // righttoleft or toptobottom
++	   sal_uInt32 nHBitmapId;  // resource id for the High Contrast Bitmap
++	   sal_uInt32 nLBitmapId;  // resource id for the Low contrast Bitmap
++       
++       // list of elements whicht the pres. objects will be
++       // created from for this layout.
++	   typedef std::vector< ElemType* > ListImpl;
++	   ListImpl elemList;
++       
++	   sal_uInt32 nLayout; // for accessing correct case in switch 
++	                       // statement.  Will be removed when the
++						   // XML file is implemented.
++	   
++	   
++   }; // Class LayoutType
++	
++} //namespace sd
++
++#endif	   // _LAYOUTTYPE_HXX
++
+diff -Nrup sd-m15/inc/pres.hxx sd/inc/pres.hxx
+--- sd-m15/inc/pres.hxx	2009-07-15 21:39:04.000000000 -0700
++++ sd/inc/pres.hxx	2009-07-18 23:21:36.000000000 -0700
+@@ -54,44 +54,6 @@ enum PresObjKind
+ 	PRESOBJ_MAX
+ };
+ 
+-enum AutoLayout
+-{
+-    AUTOLAYOUT__START,
+-	AUTOLAYOUT_TITLE = AUTOLAYOUT__START,
+-	AUTOLAYOUT_ENUM,
+-	AUTOLAYOUT_CHART,
+-	AUTOLAYOUT_2TEXT,
+-	AUTOLAYOUT_TEXTCHART,
+-	AUTOLAYOUT_ORG,
+-	AUTOLAYOUT_TEXTCLIP,
+-	AUTOLAYOUT_CHARTTEXT,
+-	AUTOLAYOUT_TAB,
+-	AUTOLAYOUT_CLIPTEXT,
+-	AUTOLAYOUT_TEXTOBJ,
+-	AUTOLAYOUT_OBJ,
+-	AUTOLAYOUT_TEXT2OBJ,
+-	AUTOLAYOUT_OBJTEXT,
+-	AUTOLAYOUT_OBJOVERTEXT,
+-	AUTOLAYOUT_2OBJTEXT,
+-	AUTOLAYOUT_2OBJOVERTEXT,
+-	AUTOLAYOUT_TEXTOVEROBJ,
+-	AUTOLAYOUT_4OBJ,
+-	AUTOLAYOUT_ONLY_TITLE,
+-	AUTOLAYOUT_NONE,
+-	AUTOLAYOUT_NOTES,
+-	AUTOLAYOUT_HANDOUT1,
+-	AUTOLAYOUT_HANDOUT2,
+-	AUTOLAYOUT_HANDOUT3,
+-	AUTOLAYOUT_HANDOUT4,
+-	AUTOLAYOUT_HANDOUT6,
+-	AUTOLAYOUT_VERTICAL_TITLE_TEXT_CHART,
+-	AUTOLAYOUT_VERTICAL_TITLE_VERTICAL_OUTLINE,
+-	AUTOLAYOUT_TITLE_VERTICAL_OUTLINE,
+-	AUTOLAYOUT_TITLE_VERTICAL_OUTLINE_CLIPART,
+-	AUTOLAYOUT_HANDOUT9,
+-    AUTOLAYOUT_ONLY_TEXT,
+-    AUTOLAYOUT__END
+-};
+ 
+ enum PageKind
+ {
+diff -Nrup sd-m15/inc/sdpage.hxx sd/inc/sdpage.hxx
+--- sd-m15/inc/sdpage.hxx	2009-07-15 21:39:04.000000000 -0700
++++ sd/inc/sdpage.hxx	2009-07-18 23:21:35.000000000 -0700
+@@ -45,6 +45,8 @@
+ #include <list>
+ #include <functional>
+ #include <vector>
++#include "layoutlist.hxx"
++#include "layouttype.hxx"
+ #include <svx/svdobj.hxx>
+ #ifndef _FM_FMPAGE_HXX //autogen
+ #include <svx/fmpage.hxx>
+@@ -126,7 +128,7 @@ friend class sd::UndoAttrObject;
+ 
+ protected:
+ 	PageKind	mePageKind;				  // Seitentyp
+-	AutoLayout	meAutoLayout;			  // AutoLayout
++    sd::AutoLayout	meAutoLayout;			  // AutoLayout
+ 	sd::ShapeList maPresentationShapeList;			  // Praesentationsobjekte
+ 	sd::ScopeLock maLockAutoLayoutArrangement;
+ 	BOOL		mbSelected;				  // Selektionskennung
+@@ -208,9 +210,8 @@ public:
+ 
+ 	/** inserts the given SdrObject into the presentation object list */
+ 	void			InsertPresObj(SdrObject* pObj, PresObjKind eKind );
+-
+-	void			SetAutoLayout(AutoLayout eLayout, BOOL bInit=FALSE, BOOL bCreate=FALSE);
+-	AutoLayout		GetAutoLayout() const { return meAutoLayout; }
++	void			SetAutoLayout(sd::AutoLayout eLayout, BOOL bInit=FALSE, BOOL bCreate=FALSE);
++	sd::AutoLayout		GetAutoLayout() const { return meAutoLayout; }
+ 	void            CreateTitleAndLayout(BOOL bInit=FALSE, BOOL bCreate=FALSE);
+ 	SdrObject*		InsertAutoLayoutShape(SdrObject* pObj, PresObjKind eObjKind, bool bVertical, Rectangle aRect, bool bInit );
+ 
+@@ -375,8 +376,7 @@ public:
+ 
+ 	Rectangle   GetTitleRect() const;
+ 	Rectangle   GetLayoutRect() const;
+-
+-	static void CalculateHandoutAreas( SdDrawDocument& rModel, AutoLayout eLayout, bool bHorizontal, std::vector< Rectangle >& rAreas );
++	static void CalculateHandoutAreas( SdDrawDocument& rModel, sd::AutoLayout eLayout, bool bHorizontal, std::vector< Rectangle >& rAreas );
+ 
+     /** Set the "precious" flag to the given value.
+     */
+diff -Nrup sd-m15/inc/Test.hxx sd/inc/Test.hxx
+--- sd-m15/inc/Test.hxx	1969-12-31 16:00:00.000000000 -0800
++++ sd/inc/Test.hxx	2009-07-18 23:21:36.000000000 -0700
+@@ -0,0 +1,43 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ * 
++ * Copyright 2008 by Sun Microsystems, Inc.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * $RCSfile: LayoutMenu.cxx,v $
++ * $Revision: 1.27 $
++ *
++ * This file is part of OpenOffice.org.
++ *
++ * OpenOffice.org is free software: you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License version 3
++ * only, as published by the Free Software Foundation.
++ *
++ * OpenOffice.org is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ * GNU Lesser General Public License version 3 for more details
++ * (a copy is included in the LICENSE file that accompanied this code).
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * version 3 along with OpenOffice.org.  If not, see
++ * <http://www.openoffice.org/license.html>
++ * for a copy of the LGPLv3 License.
++ *
++ ************************************************************************/
++#ifndef _TEST_HXX
++#define _TEST_HXX
++
++#include <vector>
++
++#include "sal/types.h"
++#include "rtl/ustring.hxx"
++#include "tools/string.hxx"
++#include "pres.hxx"
++
++using namespace rtl;
++
++#endif
++
+diff -Nrup sd-m15/source/core/drawdoc3.cxx sd/source/core/drawdoc3.cxx
+--- sd-m15/source/core/drawdoc3.cxx	2009-07-15 21:39:20.000000000 -0700
++++ sd/source/core/drawdoc3.cxx	2009-07-18 23:21:36.000000000 -0700
+@@ -1756,7 +1756,7 @@ void SdDrawDocument::SetMasterPage(USHOR
+ 		pPage = (SdPage*)pPageList->First();
+ 		while (pPage)
+ 		{
+-			AutoLayout eAutoLayout = pPage->GetAutoLayout();
++			sd::AutoLayout eAutoLayout = pPage->GetAutoLayout();
+ 
+ 			SdPresentationLayoutUndoAction * pPLUndoAction =
+ 				new SdPresentationLayoutUndoAction
+@@ -1926,8 +1926,8 @@ void SdDrawDocument::SetMasterPage(USHOR
+ 		pPage = (SdPage*)pPageList->First();
+ 		while(pPage)
+ 		{
+-			AutoLayout eOldAutoLayout = pPage->GetAutoLayout();
+-			AutoLayout eNewAutoLayout =
++			sd::AutoLayout eOldAutoLayout = pPage->GetAutoLayout();
++			sd::AutoLayout eNewAutoLayout =
+ 				pPage->GetPageKind() == PK_STANDARD ? AUTOLAYOUT_NONE : AUTOLAYOUT_NOTES;
+ 
+ 			SdPresentationLayoutUndoAction * pPLUndoAction =
+diff -Nrup sd-m15/source/core/drawdoc.cxx sd/source/core/drawdoc.cxx
+--- sd-m15/source/core/drawdoc.cxx	2009-07-15 21:39:20.000000000 -0700
++++ sd/source/core/drawdoc.cxx	2009-07-18 23:21:35.000000000 -0700
+@@ -97,6 +97,10 @@
+ #include "../ui/inc/optsitem.hxx"
+ #include "../ui/inc/FrameView.hxx"
+ 
++//FOR TESTING LAYOUTLIST
++#include "../ui/inc/res_bmp.hrc"
++#include "../ui/inc/strings.hrc"
++
+ // #90477#
+ #include <tools/tenccvt.hxx>
+ 
+@@ -107,6 +111,30 @@ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::lang;
+ using namespace ::com::sun::star::linguistic2;
+ 
++
++// to be placed here until decided where to do
++LayoutList* autolayoutList=NULL;
++
++sd::LayoutList* GetLayoutList()
++{
++	if(autolayoutList) return autolayoutList;
++	autolayoutList = new LayoutList();
++	return autolayoutList;
++}
++
++void DeleteLayoutList()
++{
++    if(autolayoutList)
++    {
++         delete autolayoutList;
++         autolayoutList = NULL;
++     }
++}
++
++
++
++
++
+
+ //////////////////////////////////////////////////////////////////////////////
+ 
+@@ -374,6 +402,55 @@ SdDrawDocument::SdDrawDocument(DocumentT
+ 		rLayerAdmin.SetControlLayerName(aControlLayerName);
+ 	}
+ 
++    // THIS IS HERE FOR TESTING THE LAYOUTLIST CLASSES
++	
++	//LayoutList* list = GetLayoutList();
++	//LayoutType* test;
++	
++	//test = new LayoutType();
++	//test->setName(LString::CreateFromAscii("testing1..."));
++//	test->setLayoutNumber(0);
++	//test->setWritingMode(WritingMode_LR_TB);
++	//test->setHBitmapId(BMP_FOIL_02_H);
++	//test->setLBitmapId(BMP_FOIL_02);
++	
++	//test->createDefaultElement(); // for title
++	//test->createDefaultElement();
++    //test->setKind(1,PRESOBJ_OUTLINE); // for outline
++	//test->setFactorHt(1,.5);   // change to new settings
++//	test->setFactorWt(1,.5);
++	//test->setRecttype(1, RT_LAYOUT);
++	//
++	//if(!list->addLayout(test, 3, PK_STANDARD))
++   // { DBG_ERROR("Layout1 not added"); }
++	 
++	// another one
++//	test = new LayoutType();
++//	test->setName(LString::CreateFromAscii("Testing2...."));
++//	test->setLayoutNumber(0); 
++//	test->setWritingMode(WritingMode_LR_TB);
++//	test->setHBitmapId(BMP_FOIL_21_H);
++//	test->setLBitmapId(BMP_FOIL_21);
++	
++	
++	//test->createDefaultElement(); // title
++	//test->createDefaultElement();
++    //test->setKind(1, PRESOBJ_CHART); // chart 
++	//test->setFactorX(1,.5);
++	//test->setFactorY(1,.5);
++    //test->setFactorHt(1,.333);
++	//test->setFactorWt(1,.333);
++    //test->setRecttype(1, RT_LAYOUT);
++	//test->createDefaultElement();
++	//test->setKind(2,PRESOBJ_OUTLINE);
++	//test->setFactorHt(2,.333);
++	//test->setFactorWt(2,.333);
++	//test->setRecttype(2, RT_LAYOUT);
++	
++	//if(!list->addLayout(test, -1, PK_STANDARD))
++	// { DBG_ERROR("Layout2 not added"); }
++
++
+ 
+ }
+ 
+@@ -457,6 +534,8 @@ SdDrawDocument::~SdDrawDocument()
+ 
+ 	delete mpCharClass;
+ 	mpCharClass = NULL;
++    
++    DeleteLayoutList(); // needed to write autolayouts to the config file
+ }
+ 
+ /*************************************************************************
+diff -Nrup sd-m15/source/core/layoutlist.cxx sd/source/core/layoutlist.cxx
+--- sd-m15/source/core/layoutlist.cxx	1969-12-31 16:00:00.000000000 -0800
++++ sd/source/core/layoutlist.cxx	2009-07-18 23:21:35.000000000 -0700
+@@ -0,0 +1,1236 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ * 
++ * Copyright 2008 by Sun Microsystems, Inc.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * $RCSfile: layoutlist.cxx,v $
++ * $Revision: 0.1$
++ *
++ * This file is part of OpenOffice.org.
++ *
++ * OpenOffice.org is free software: you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License version 3
++ * only, as published by the Free Software Foundation.
++ *
++ * OpenOffice.org is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ * GNU Lesser General Public License version 3 for more details
++ * (a copy is included in the LICENSE file that accompanied this code).
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * version 3 along with OpenOffice.org.  If not, see
++ * <http://www.openoffice.org/license.html>
++ * for a copy of the LGPLv3 License.
++ *
++ ************************************************************************/
++ 
++// MARKER(update_precomp.py): autogen include statement, do not remove
++#include "precompiled_sd.hxx"
++#include <stdio.h>
++#include <tools/debug.hxx>
++#include "osl/diagnose.h"
++#include "osl/file.hxx"
++#include "osl/security.hxx"
++#include "tools/stream.hxx"
++#include <vcl/unohelp.hxx>
++#include <com/sun/star/uno/Reference.hxx>
++#include <com/sun/star/lang/XMultiServiceFactory.hpp>
++#include <com/sun/star/xml/dom/XDocumentBuilder.hpp>
++#include <unotools/streamwrap.hxx>
++#include <sax/fshelper.hxx>
++#include "layoutlist.hxx"
++#include "sal/types.h"
++#include "tools/string.hxx"
++#include "rtl/string.hxx"
++#include "sdresid.hxx"
++#include "../ui/inc/res_bmp.hrc"
++#include "pres.hxx"
++#include "../ui/inc/strings.hrc"
++
++#define CHARTOOUSTR(x) rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( x ) )
++#define CHATTOSTR(x) String::createFromAscii(x);
++#define STRTOCHAR(x) (char*) ByteString(x, RTL_TEXTENCODING_UTF8).GetBuffer()
++#define OUSTRTOCHAR(x) (OUStringToOString(x, RTL_TEXTENCODING_UTF8)).getStr()
++
++using namespace sd;
++using ::com::sun::star::uno::Reference;
++using ::com::sun::star::io::XOutputStream;
++using ::com::sun::star::io::XInputStream;
++using namespace ::com::sun::star::uno;
++using namespace ::com::sun::star::xml::dom;
++using namespace ::com::sun::star::xml::sax;
++using namespace ::com::sun::star::lang;
++using namespace ::sax_fastparser;
++
++
++/** xml tags used by the layoutlist class
++ * for reading and writing to the
++ *  configuration file.
++ */
++   
++static char sTopTag[] = "AutoLayoutInfo";
++static char sLListTag[] = "layoutList";
++static char sCountTag[] = "count";
++static char sStandardTag[] = "MenuStandard";
++static char sNotesTag[] = "MenuNotes";
++static char sHandoutTag[] = "MenuHandout";
++static char sNumTag[] = "number";
++
++LayoutList::LayoutList()
++{
++
++    maLayoutList.reserve(50);
++	maStandard.reserve(50);
++	maHandout.reserve(50);
++	maNotes.reserve(50);
++	
++    
++	initializeList();
++    writeToFile();
++    
++    readFromFile();
++}
++
++LayoutList::~LayoutList()
++{
++  sal_uInt32 size = length();
++  LayoutType* layout;
++  
++  if(size == 0) return; // empty list
++  
++  //first, save information to the config file
++  //writeToFile();
++  
++  // delete objects in the list if
++  // they are there.
++  for(sal_uInt32 i = 0; i < size; i++)
++  {
++     layout = getLayoutByIndex(i);
++	 if(layout) 
++	 {
++		 // need to do clean up 
++		 // in the layout class
++	    delete layout;
++	 }
++  }
++  
++  maLayoutList.clear();
++}
++
++String* LayoutList::getConfigFile()
++{
++    rtl::OUString ousFilePath(rtl::OUString::createFromAscii(""));
++    rtl::OUString ousFileName(rtl::OUString::createFromAscii("/AutoLayout.xml"));
++    rtl::OUString ousConfigURL(rtl::OUString::createFromAscii(""));
++    osl::Security sec;
++    osl::FileBase convert;
++    
++    sec.getConfigDir(ousConfigURL);
++    
++    OSL_TRACE("AUTOLAYOUT CONFIG URL: %s", OUSTRTOCHAR(ousConfigURL )); 
++    ousConfigURL += ousFileName;
++    convert.getSystemPathFromFileURL(ousConfigURL, ousFilePath);
++    String* psFilePath = new String(ousFilePath);
++    
++    OSL_TRACE("AUTOLAYOUT CONFIG PATH/FILE: %s", OUSTRTOCHAR(ousFilePath)); 
++    return psFilePath;
++}
++
++void LayoutList::writeToFile()
++{
++    String* psFileName = getConfigFile();
++    StreamMode eMode = (STREAM_WRITE | STREAM_TRUNC);
++    SvFileStream fs(*psFileName, eMode);
++   
++    
++    if(fs.IsOpen())
++    {
++        LayoutType* layout;
++        static char sCountValue[4];
++        static char sNum[10];
++       
++        sal_Int32 size = (sal_Int32) length();
++        utl::OOutputStreamWrapper* osw = new utl::OOutputStreamWrapper(fs); 
++        Reference< XOutputStream > xos(osw);
++        FastSerializerHelper fsh(xos);
++       
++        sprintf(sCountValue, "%d", (int) length());
++       
++        fsh.startElement(sTopTag,NULL);
++        fsh.startElement(sLListTag, sCountTag, sCountValue, NULL);
++       
++        for(sal_Int32 i=0; i < size; i++)
++        {
++            layout = getLayoutByIndex(i);
++            if(layout)
++            {
++                layout->writeLayoutToFile(fsh, i);
++            }
++        }
++       
++        fsh.endElement(sLListTag);
++       
++        fsh.startElement(sStandardTag, NULL);
++       
++        for(sal_uInt32 i=0; i < maStandard.size(); i++)
++        {
++            sprintf(sNum,"%d", (int) maStandard[i]);
++            fsh.singleElement(sStandardTag, sNumTag, sNum, NULL);
++        }
++       
++        fsh.endElement(sStandardTag);
++      
++        fsh.startElement(sNotesTag,NULL);
++      
++        for(sal_uInt32 i=0; i < maNotes.size(); i++)
++        {
++            sprintf(sNum,"%d", (int) maNotes[i]);
++            fsh.singleElement(sNotesTag, sNumTag, sNum, NULL);
++        }
++       
++        fsh.endElement(sNotesTag);
++      
++        fsh.startElement(sHandoutTag,NULL);
++      
++        for(sal_uInt32 i=0; i < maHandout.size(); i++)
++        {
++            sprintf(sNum,"%d", (int) maHandout[i]);
++            fsh.singleElement(sHandoutTag, sNumTag, sNum, NULL);
++        }
++       
++        fsh.endElement(sHandoutTag);
++      
++        fsh.endElement(sTopTag);
++    }
++    fs.Close();
++    delete psFileName;
++
++}            
++    
++
++void LayoutList::readFromFile()
++{
++     const Reference<XMultiServiceFactory> xServiceFactory( vcl::unohelper::GetMultiServiceFactory(), UNO_QUERY );
++     rtl::OUString sServName = rtl::OUString::createFromAscii("com.sun.star.xml.dom.DocumentBuilder");
++     Reference<XDocumentBuilder> xDb( xServiceFactory->createInstance(sServName), UNO_QUERY);
++                   
++     String* psFileName = getConfigFile();
++     StreamMode eMode = STREAM_READ;
++     SvFileStream fs(*psFileName, eMode);
++    
++     utl::OInputStreamWrapper* isw = new utl::OInputStreamWrapper(fs); 
++     const Reference<XInputStream> xIs(isw);
++    
++     if(psFileName)
++        OSL_TRACE("READ: %s", STRTOCHAR(*psFileName));
++     else
++        OSL_TRACE("READ: no file name");
++       
++     const Reference<XDocument> xDom(xDb->parse(xIs), UNO_QUERY_THROW );
++     const Reference<XElement> xElem( xDom->getDocumentElement(), UNO_QUERY_THROW );
++
++
++     const Reference<XNodeList> topllist(xElem->getElementsByTagName(CHARTOOUSTR(sLListTag)));
++     const Reference<XNode> llist = topllist->item(0);
++     const Reference<XNodeList> layouts = llist->getChildNodes();
++    
++     sal_Int32 lngth = layouts->getLength();
++     sal_Int32 index;
++    
++     maLayoutList.resize(lngth, NULL);
++    
++     for(sal_Int32 i=0; i < lngth; i++)
++     {
++         LayoutType* layout = new LayoutType();
++         Reference<XNode> alayout = layouts->item(i);
++         index = layout->readLayoutFromFile(alayout);
++         //TODO:  disable putting into the list until
++         //       I have a chance to debug this more 
++         //       thoroughly
++     //    if((index >= 0)&&(index < lngth)) maLayoutList[index] = layout;
++      }
++    
++}  
++
++
++bool LayoutList::addLayout(LayoutType* pLayout,
++                    const sal_Int32& menuIndex, const PageKind& eMenu)
++{
++	sal_Int32 idx;
++	
++	LString name = pLayout->getName();
++	idx = getLayoutIndex(name);
++	if(idx != LL_NOT_FOUND)
++	{
++		//DBG_ERROR("sd::LayoutList::addLayout(), given layout name already part of list!");
++		return false;
++	}
++	
++	//  push onto the back of the list
++    maLayoutList.push_back(pLayout);
++	
++	//now, find where it was put
++    idx = getLayoutIndex(name);
++	// add this value to the given menu at the given location
++	addToMenuList(menuIndex, (AutoLayout) idx, eMenu);
++	
++	return true;
++}
++	
++
++void LayoutList::removeLayoutFromList(const LString& sName)
++{
++	sal_Int32 index;
++	
++	index = getLayoutIndex(sName);
++	if(index >= 0) // name in list
++	{
++		// Since the indices will change if
++		// I use erase (the item get move up
++		// by one) and I don't want to reorder
++		// the list. I'll just, set the space to 
++		// to NULL
++		maLayoutList[index] = NULL;
++		// take out of the menu lists.
++		removeFromMenuList((AutoLayout) index, PK_STANDARD);
++		removeFromMenuList((AutoLayout) index, PK_NOTES);
++		removeFromMenuList((AutoLayout) index, PK_HANDOUT);
++	}
++}
++ void LayoutList::deleteLayout(const LString& sName)
++ {
++	 LayoutType* layout = getLayoutByName(sName);
++	 if(layout)
++	 {
++		 removeLayoutFromList(sName);
++		 delete layout;
++	 }
++	 
++ }
++
++sal_uInt32 LayoutList::length() const
++{
++	return maLayoutList.size();
++}
++
++sal_uInt32 LayoutList::numberOfLayouts() const
++{
++	sal_uInt32 count = 0;
++	unsigned int size = (unsigned int) length();
++	
++	for(unsigned int i=0; i < size; i++)
++	{
++		if(maLayoutList[i] != NULL)
++		   count++;
++	}
++	return count; 
++}
++
++LayoutType* LayoutList::getLayoutByIndex(const sal_uInt32 nIndex)
++{
++	// check for valid index (no need to check for less than zero)
++	if(nIndex > length()-1)  return NULL;
++	
++	return maLayoutList[nIndex];
++	
++}
++
++LayoutType* LayoutList::getLayoutByName(const LString& sName)
++{
++	LayoutType* pLayout=NULL;
++	
++	for(sal_uInt32 i = 0; i < length(); i++)
++	{
++		if ((maLayoutList[i])&&(sName == maLayoutList[i]->getName()))
++		    pLayout = maLayoutList[i];
++			break;
++	}
++	
++	return pLayout;
++}
++
++sal_uInt32 LayoutList::getLayoutIndex(const LString& sName)
++{
++	sal_uInt32 idx = LL_NOT_FOUND;
++	
++	for(unsigned int i = 0; i < length(); i++)
++	{
++		if((maLayoutList[i])&&(sName == maLayoutList[i]->getName()))
++		{
++		    idx = (sal_Int32) i;
++			break;
++		}
++	}
++	
++	return idx;
++}
++
++LayoutType* LayoutList::getLayoutAtMenuIndex(const sal_uInt32& nIndex,
++                                             const PageKind& eMenu)
++{
++   sal_uInt32 size = getMenuLength(eMenu);
++   sal_uInt32 index;
++   
++   if(nIndex >= size) return NULL;  //not a valid index
++   
++   switch (eMenu) {
++	   
++     case PK_STANDARD: index = maStandard[nIndex];
++                        break;
++     case PK_NOTES:    index = maNotes[nIndex];
++                        break;
++	 case PK_HANDOUT:  index = maHandout[nIndex];
++	                    break;
++	 default:           return NULL;   // not a valid menu type
++	 
++	}
++	
++	return maLayoutList[index];
++	
++}
++
++sal_uInt32 LayoutList::getMenuIndex(const AutoLayout& nLayout,
++	                                const PageKind& nMenu)
++{
++	sal_uInt32 count = getMenuLength(nMenu);
++	sal_uInt32 idx = LL_NOT_FOUND;
++	MEListImpl* list = NULL;
++	
++	for(sal_uInt32 i = 0; i < count; i++)
++	{
++		 switch (nMenu) {
++			 case PK_STANDARD:  list = &maStandard;
++			                    break;
++			 case PK_NOTES:     list = &maNotes;
++								break;
++			 case PK_HANDOUT:   list = &maHandout;
++								break;
++			 default: /* leave as NULL */;
++		 }
++		 
++	    if(list)
++	    {
++		   if((AutoLayout)(*list)[i] == nLayout)
++		   {
++			  idx = i;
++			  break;
++		   }
++	    }
++     }
++	 
++	 return idx;
++ }
++	
++	
++
++
++sal_uInt32 LayoutList::getMenuLength(const PageKind& eMenu)
++{
++    sal_uInt32 size;  
++	
++	switch (eMenu) {
++	   
++      case PK_STANDARD: size = maStandard.size();
++                        break;
++      case PK_NOTES:    size = maNotes.size();
++                        break;
++	  case PK_HANDOUT:  size = maHandout.size();
++	                    break;     
++	  default:          size = 0; // not a valid menu type
++	}
++
++    return size;
++}
++
++void LayoutList::removeFromMenuList(const AutoLayout& lnum,
++	                                const PageKind& eMenu)
++{
++	 sal_uInt32 index = getMenuIndex(lnum, eMenu);
++	 
++	 if(index == LL_NOT_FOUND) return;
++	 
++	 switch (eMenu) 
++	 {
++		case PK_STANDARD:  maStandard.erase(maStandard.begin()+index);
++		                   break;
++		case PK_NOTES:     maNotes.erase(maNotes.begin()+index);
++		                   break;
++		case PK_HANDOUT:   maHandout.erase(maHandout.begin()+index);
++		                   break;
++	}
++
++	
++}
++	   
++void LayoutList::addToMenuList(const sal_Int32& index,
++	                      const AutoLayout& lnum,
++						  const PageKind& eMenu)
++{
++	 sal_Int32 size;
++	 MEListImpl* list = NULL;
++	
++	 switch (eMenu) 
++	 {
++		case PK_STANDARD:  list = &maStandard;
++		                   break;
++		case PK_NOTES:     list = &maNotes;
++		                   break;
++		case PK_HANDOUT:   list = &maHandout;
++		                   break;
++	 }
++	
++	if(list)
++	{
++		size = list->size();
++		if((index < 0)||(index >= size))
++		{
++			//if too low or too high an index
++			// then assign it to the back of
++			// the list
++			list->push_back(lnum);
++		}
++		else
++		{
++		   // insert at the given index
++		    list->insert(list->begin() + index, lnum);
++		 }
++		
++	}
++	
++}
++
++void LayoutList::initializeMenuOrder()
++{
++	// this probably would be best store in a file too.
++	// for keeping track of menu order for builtins
++	
++	maStandard.resize(25, LL_NOT_FOUND);
++	maNotes.resize(1, LL_NOT_FOUND);
++	maHandout.resize(6, LL_NOT_FOUND);
++	
++	// will put custom layouts on the end:
++	
++	// for standard view mode:
++	maStandard[0] = AUTOLAYOUT_NONE;
++	maStandard[1] = AUTOLAYOUT_TITLE;
++	maStandard[2] = AUTOLAYOUT_ENUM;
++	maStandard[3] = AUTOLAYOUT_2TEXT;
++	maStandard[4] = AUTOLAYOUT_ONLY_TITLE;
++	maStandard[5] = AUTOLAYOUT_ONLY_TEXT;
++	maStandard[6] = AUTOLAYOUT_OBJ;
++	maStandard[7] = AUTOLAYOUT_CHART;
++	maStandard[8] = AUTOLAYOUT_TAB;
++	maStandard[9] = AUTOLAYOUT_CLIPTEXT;
++	maStandard[10] = AUTOLAYOUT_TEXTCHART;
++	maStandard[11] = AUTOLAYOUT_TEXTCLIP;
++	maStandard[12] = AUTOLAYOUT_CHARTTEXT;
++	maStandard[13] = AUTOLAYOUT_TEXTOBJ;
++	maStandard[14] = AUTOLAYOUT_TEXT2OBJ;
++	maStandard[15] = AUTOLAYOUT_OBJTEXT;
++	maStandard[16] = AUTOLAYOUT_OBJOVERTEXT;
++	maStandard[17] = AUTOLAYOUT_2OBJTEXT;
++	maStandard[18] = AUTOLAYOUT_2OBJOVERTEXT;
++	maStandard[19] = AUTOLAYOUT_TEXTOVEROBJ;
++	maStandard[20] = AUTOLAYOUT_4OBJ;
++	maStandard[21] = AUTOLAYOUT_VERTICAL_TITLE_TEXT_CHART;
++	maStandard[22] = AUTOLAYOUT_VERTICAL_TITLE_VERTICAL_OUTLINE;
++	maStandard[23] = AUTOLAYOUT_TITLE_VERTICAL_OUTLINE;
++	maStandard[24] = AUTOLAYOUT_TITLE_VERTICAL_OUTLINE_CLIPART;
++	
++	//for notes view:
++	maNotes[0] = AUTOLAYOUT_NOTES;
++	
++	//for handout:
++	maHandout[0] = AUTOLAYOUT_HANDOUT1;
++	maHandout[1] = AUTOLAYOUT_HANDOUT2;
++	maHandout[2] = AUTOLAYOUT_HANDOUT3;
++	maHandout[3] = AUTOLAYOUT_HANDOUT4;
++	maHandout[4] = AUTOLAYOUT_HANDOUT6;
++	maHandout[5] = AUTOLAYOUT_HANDOUT9;
++	
++}
++
++void LayoutList::initializeList()
++{
++	LayoutType* pLayout;
++	
++	initializeMenuOrder();
++	
++	// eventually, the layouts will be obtained by string name
++	// for until LayoutMenu is converted, I need to make sure
++	// the indices match the correct autolayout number.
++	// resize to more than needed (for adding layouts)
++	// and initialize all to NULL.
++	
++	maLayoutList.resize(35,NULL);
++	
++	// AUTOLAYOUT_TITLE (standard title with text box)
++	pLayout = new LayoutType();
++	pLayout->setName(LString(SdResId(STR_AUTOLAYOUT_TITLE)));
++    pLayout->setStrId(STR_AUTOLAYOUT_TITLE);
++	//This is the case number to get the bounding rectangle
++	// for this layout.  Will eventually be taken out in the future
++	pLayout->setLayoutNumber(0); 
++	pLayout->setWritingMode(WritingMode_LR_TB);
++	pLayout->setHBitmapId(BMP_FOIL_00_H);
++	pLayout->setLBitmapId(BMP_FOIL_00);
++	
++	pLayout->createDefaultElement(); // title element
++	
++	pLayout->createDefaultElement();  // text element
++	pLayout->setKind(1,PRESOBJ_TEXT);
++	pLayout->initializeRectInfo(); // initialize each element
++	
++	maLayoutList[AUTOLAYOUT_TITLE] = pLayout;
++	
++	// AUTOLAYOUT_ENUM (title and outline)
++	pLayout = new LayoutType();
++	pLayout->setName(LString(SdResId(STR_AUTOLAYOUT_ENUM)));
++    pLayout->setStrId(STR_AUTOLAYOUT_ENUM);
++	//This is the case number to get the bounding rectangle
++	// for this layout.  Will eventually be taken out in the future
++	pLayout->setLayoutNumber(0); 
++	pLayout->setWritingMode(WritingMode_LR_TB);
++	pLayout->setHBitmapId(BMP_FOIL_01_H);
++	pLayout->setLBitmapId(BMP_FOIL_01);
++	pLayout->createDefaultElement(); // title element
++	
++	pLayout->createDefaultElement();  // outline element
++	pLayout->setKind(1,PRESOBJ_OUTLINE);
++	pLayout->initializeRectInfo(); // initialize each element
++	
++	maLayoutList[AUTOLAYOUT_ENUM] = pLayout;
++	
++	//  AUTOLAYOUT_CHART (title and Chart)
++	pLayout = new LayoutType();
++	pLayout->setName(LString(SdResId(STR_AUTOLAYOUT_CHART)));
++    pLayout->setStrId(STR_AUTOLAYOUT_CHART);
++	//This is the case number to get the bounding rectangle
++	// for this layout.  Will eventually be taken out in the future
++	pLayout->setLayoutNumber(0);
++	pLayout->setWritingMode(WritingMode_LR_TB);
++	pLayout->setHBitmapId(BMP_FOIL_02_H);
++	pLayout->setLBitmapId(BMP_FOIL_02);
++	 
++	pLayout->createDefaultElement(); // title element
++	
++	pLayout->createDefaultElement();  // chart element
++	pLayout->setKind(1,PRESOBJ_CHART);
++	pLayout->initializeRectInfo(); // initialize each element
++	
++	maLayoutList[AUTOLAYOUT_CHART] = pLayout;
++	
++	//  AUTOLAYOUT_2TEXT (title and 2 outlines)
++	pLayout = new LayoutType();
++	pLayout->setName(LString(SdResId(STR_AUTOLAYOUT_2TEXT)));
++    pLayout->setStrId(STR_AUTOLAYOUT_2TEXT);
++	//This is the case number to get the bounding rectangle
++	// for this layout.  Will eventually be taken out in the future
++	pLayout->setLayoutNumber(1);
++	pLayout->setWritingMode(WritingMode_LR_TB);
++	pLayout->setHBitmapId(BMP_FOIL_03_H);
++	pLayout->setLBitmapId(BMP_FOIL_03);
++	 
++    pLayout->createDefaultElement(); // title element
++	
++	pLayout->createDefaultElement();  // outline1 element
++	pLayout->setKind(1,PRESOBJ_OUTLINE);
++	
++	pLayout->createDefaultElement();  // outline2 element
++	pLayout->setKind(2,PRESOBJ_OUTLINE);
++	pLayout->initializeRectInfo(); // initialize each element
++	
++	maLayoutList[AUTOLAYOUT_2TEXT] = pLayout;
++	
++	//  AUTOLAYOUT_TEXTCHART (title, outline and chart)
++	pLayout = new LayoutType();
++	pLayout->setName(LString(SdResId(STR_AUTOLAYOUT_TEXTCHART)));
++    pLayout->setStrId(STR_AUTOLAYOUT_TEXTCHART);
++	//This is the case number to get the bounding rectangle
++	// for this layout.  Will eventually be taken out in the future
++	pLayout->setLayoutNumber(1); 
++	pLayout->setWritingMode(WritingMode_LR_TB);
++	pLayout->setHBitmapId(BMP_FOIL_04_H);
++	pLayout->setLBitmapId(BMP_FOIL_04);
++	
++	pLayout->createDefaultElement(); // title element
++	
++	pLayout->createDefaultElement();  // outline element
++	pLayout->setKind(1,PRESOBJ_OUTLINE);
++	
++	pLayout->createDefaultElement();  // chart element
++	pLayout->setKind(2,PRESOBJ_CHART);
++	pLayout->initializeRectInfo(); // initialize each element
++	
++	maLayoutList[AUTOLAYOUT_TEXTCHART] = pLayout;
++	
++	// AUTOLAYOUT_ORG (title and org. chart)
++	// This layout isn't even put into the menu!
++	// No string resource so for now, I'll borrow chart
++	// TODO:  See if I can eliminate this if not being used.
++	pLayout = new LayoutType();
++	pLayout->setName(LString::CreateFromAscii(""));
++        pLayout->setStrId(0);
++	//This is the case number to get the bounding rectangle
++	// for this layout.  Will eventually be taken out in the future
++	pLayout->setLayoutNumber(0); 
++	pLayout->setWritingMode(WritingMode_LR_TB);
++	pLayout->setHBitmapId(BMP_FOIL_05_H);  // guessing here :)
++	pLayout->setLBitmapId(BMP_FOIL_05);
++	
++	pLayout->createDefaultElement(); // title element
++	
++	pLayout->createDefaultElement();  // organ. chart element
++	pLayout->setKind(1,PRESOBJ_ORGCHART);
++	pLayout->initializeRectInfo(); // initialize each element
++	
++    maLayoutList[AUTOLAYOUT_ORG] = pLayout;	
++	
++	//  AUTOLAYOUT_TEXTCLIP (title, outline and clipart (graphic))
++	pLayout = new LayoutType();
++	pLayout->setName(LString(SdResId(STR_AUTOLAYOUT_TEXTCLIP)));
++    pLayout->setStrId(STR_AUTOLAYOUT_TEXTCLIP);
++	//This is the case number to get the bounding rectangle
++	// for this layout.  Will eventually be taken out in the future
++	pLayout->setLayoutNumber(1);
++    pLayout->setWritingMode(WritingMode_LR_TB);
++	pLayout->setHBitmapId(BMP_FOIL_06_H);
++	pLayout->setLBitmapId(BMP_FOIL_06);
++	
++    pLayout->createDefaultElement(); // title element
++	
++	pLayout->createDefaultElement();  // outline element
++	pLayout->setKind(1,PRESOBJ_OUTLINE);
++	
++	pLayout->createDefaultElement();  // picture element
++	pLayout->setKind(2,PRESOBJ_GRAPHIC);
++	pLayout->initializeRectInfo(); // initialize each element
++	
++	maLayoutList[AUTOLAYOUT_TEXTCLIP] = pLayout;
++	
++    //  AUTOLAYOUT_CHARTTEXT (title, chart and outline)
++	pLayout = new LayoutType();
++	pLayout->setName(LString(SdResId(STR_AUTOLAYOUT_CHARTTEXT)));
++    pLayout->setStrId(STR_AUTOLAYOUT_CHARTTEXT);
++	//This is the case number to get the bounding rectangle
++	// for this layout.  Will eventually be taken out in the future
++	pLayout->setLayoutNumber(1); 
++	pLayout->setWritingMode(WritingMode_LR_TB);
++	pLayout->setHBitmapId(BMP_FOIL_07_H);
++	pLayout->setLBitmapId(BMP_FOIL_07);
++	
++	pLayout->createDefaultElement(); // title element
++	
++	pLayout->createDefaultElement();  // chart element
++	pLayout->setKind(1,PRESOBJ_CHART);
++	
++	pLayout->createDefaultElement();  // outline element
++	pLayout->setKind(2,PRESOBJ_OUTLINE);
++	pLayout->initializeRectInfo(); // initialize each element
++	
++	maLayoutList[AUTOLAYOUT_CHARTTEXT] = pLayout;
++	
++    //  AUTOLAYOUT_TAB (title and table)
++	pLayout = new LayoutType();
++	pLayout->setName(LString(SdResId(STR_AUTOLAYOUT_TAB)));
++    pLayout->setStrId(STR_AUTOLAYOUT_TAB);
++	//This is the case number to get the bounding rectangle
++	// for this layout.  Will eventually be taken out in the future
++	pLayout->setLayoutNumber(0);
++	pLayout->setWritingMode(WritingMode_LR_TB);
++	pLayout->setHBitmapId(BMP_FOIL_08_H);
++	pLayout->setLBitmapId(BMP_FOIL_08);
++	
++	pLayout->createDefaultElement(); // title element
++	
++	pLayout->createDefaultElement();  // table element
++	pLayout->setKind(1,PRESOBJ_TABLE);
++	pLayout->initializeRectInfo(); // initialize each element
++	
++	maLayoutList[AUTOLAYOUT_TAB] = pLayout;
++	
++    //  AUTOLAYOUT_CLIPTEXT (title, clipart (graphic) and outline)
++	pLayout = new LayoutType();
++	pLayout->setName(LString(SdResId(STR_AUTOLAYOUT_CLIPTEXT)));
++    pLayout->setStrId(STR_AUTOLAYOUT_CLIPTEXT);
++	//This is the case number to get the bounding rectangle
++	// for this layout.  Will eventually be taken out in the future
++	pLayout->setLayoutNumber(1);
++	pLayout->setWritingMode(WritingMode_LR_TB);
++	pLayout->setHBitmapId(BMP_FOIL_09_H);
++	pLayout->setLBitmapId(BMP_FOIL_09);
++	
++	pLayout->createDefaultElement(); // title element
++	
++	pLayout->createDefaultElement();  // picture element
++	pLayout->setKind(1,PRESOBJ_GRAPHIC);
++	
++	pLayout->createDefaultElement();  // outline element
++	pLayout->setKind(2,PRESOBJ_OUTLINE);
++	pLayout->initializeRectInfo(); // initialize each element
++	
++	maLayoutList[AUTOLAYOUT_CLIPTEXT] = pLayout;
++	
++	//  AUTOLAYOUT_TEXTOBJ (title, outline and object)
++	pLayout = new LayoutType();
++	pLayout->setName(LString(SdResId(STR_AUTOLAYOUT_TEXTOBJ)));
++    pLayout->setStrId(STR_AUTOLAYOUT_TEXTOBJ);
++	//This is the case number to get the bounding rectangle
++	// for this layout.  Will eventually be taken out in the future
++	pLayout->setLayoutNumber(1);
++	pLayout->setWritingMode(WritingMode_LR_TB);
++	pLayout->setHBitmapId(BMP_FOIL_10_H);
++	pLayout->setLBitmapId(BMP_FOIL_10);
++	
++	pLayout->createDefaultElement(); // title element
++	
++	pLayout->createDefaultElement();  // outline1 element
++	pLayout->setKind(1,PRESOBJ_OUTLINE);
++	
++	pLayout->createDefaultElement();  // object element
++	pLayout->setKind(2,PRESOBJ_OBJECT);
++	pLayout->initializeRectInfo(); // initialize each element
++	
++	maLayoutList[AUTOLAYOUT_TEXTOBJ] = pLayout;
++	
++    // AUTOLAYOUT_OBJ (title and object)
++	pLayout = new LayoutType();
++	pLayout->setName(LString(SdResId(STR_AUTOLAYOUT_OBJ)));
++        pLayout->setStrId(STR_AUTOLAYOUT_OBJ);
++	//This is the case number to get the bounding rectangle
++	// for this layout.  Will eventually be taken out in the future
++	pLayout->setLayoutNumber(0); 
++	pLayout->setWritingMode(WritingMode_LR_TB);
++	pLayout->setHBitmapId(BMP_FOIL_11_H);
++	pLayout->setLBitmapId(BMP_FOIL_11);
++	
++	pLayout->createDefaultElement(); // title element
++	
++	pLayout->createDefaultElement();  // object element
++	pLayout->setKind(1,PRESOBJ_OBJECT);
++	pLayout->initializeRectInfo(); // initialize each element
++	
++	maLayoutList[AUTOLAYOUT_OBJ] = pLayout;	
++	
++	
++	//  AUTOLAYOUT_TEXT2OBJ (title, outline and 2 objects)
++	pLayout = new LayoutType();
++	pLayout->setName(LString(SdResId(STR_AUTOLAYOUT_TEXT2OBJ)));
++    pLayout->setStrId(STR_AUTOLAYOUT_TEXT2OBJ);
++	//This is the case number to get the bounding rectangle
++	// for this layout.  Will eventually be taken out in the future
++	pLayout->setLayoutNumber(2);
++	pLayout->setWritingMode(WritingMode_LR_TB);
++	pLayout->setHBitmapId(BMP_FOIL_12_H);
++	pLayout->setLBitmapId(BMP_FOIL_12);
++	
++	pLayout->createDefaultElement(); // title element
++	
++	pLayout->createDefaultElement();  // outline element
++	pLayout->setKind(1,PRESOBJ_OUTLINE);
++	
++    pLayout->createDefaultElement();  // object1 element
++	pLayout->setKind(2,PRESOBJ_OBJECT);
++	
++	pLayout->createDefaultElement();  // object2 element
++	pLayout->setKind(3,PRESOBJ_OBJECT);
++	pLayout->initializeRectInfo(); // initialize each element
++	
++	maLayoutList[AUTOLAYOUT_TEXT2OBJ] = pLayout;
++	
++	// AUTOLAYOUT_OBJTEXT (title, object and outline)
++	pLayout = new LayoutType();
++	pLayout->setName(LString(SdResId(STR_AUTOLAYOUT_OBJTEXT)));
++    pLayout->setStrId(STR_AUTOLAYOUT_OBJTEXT);
++	//This is the case number to get the bounding rectangle
++	// for this layout.  Will eventually be taken out in the future
++	pLayout->setLayoutNumber(1); 
++	pLayout->setWritingMode(WritingMode_LR_TB);
++	pLayout->setHBitmapId(BMP_FOIL_13_H);
++	pLayout->setLBitmapId(BMP_FOIL_13);
++	
++    pLayout->createDefaultElement(); // title element
++	
++	pLayout->createDefaultElement();  // object element
++	pLayout->setKind(1,PRESOBJ_OBJECT);
++	
++	pLayout->createDefaultElement();  // outline element
++	pLayout->setKind(2,PRESOBJ_OUTLINE);
++	pLayout->initializeRectInfo(); // initialize each element
++	
++	maLayoutList[AUTOLAYOUT_OBJTEXT] = pLayout;
++	
++	// AUTOLAYOUT_OBJOVERTEXT (title, object over an outline)
++	pLayout = new LayoutType();
++	pLayout->setName(LString(SdResId(STR_AUTOLAYOUT_OBJOVERTEXT)));
++    pLayout->setStrId(STR_AUTOLAYOUT_OBJOVERTEXT);
++	//This is the case number to get the bounding rectangle
++	// for this layout.  Will eventually be taken out in the future
++	pLayout->setLayoutNumber(4); 
++	pLayout->setWritingMode(WritingMode_LR_TB);
++	pLayout->setHBitmapId(BMP_FOIL_14_H);
++	pLayout->setLBitmapId(BMP_FOIL_14);
++	
++    pLayout->createDefaultElement(); // title element
++	
++	pLayout->createDefaultElement();  // object element
++	pLayout->setKind(1,PRESOBJ_OBJECT);
++	
++	pLayout->createDefaultElement();  // outline element
++	pLayout->setKind(2,PRESOBJ_OUTLINE);
++	pLayout->initializeRectInfo(); // initialize each element
++	
++    maLayoutList[AUTOLAYOUT_OBJOVERTEXT] = pLayout;
++	
++	// AUTOLAYOUT_2OBJTEXT (2 objects and an outline)
++	pLayout = new LayoutType();
++	pLayout->setName(LString(SdResId(STR_AUTOLAYOUT_2OBJTEXT)));
++        pLayout->setStrId(STR_AUTOLAYOUT_2OBJTEXT);
++	//This is the case number to get the bounding rectangle
++	// for this layout.  Will eventually be taken out in the future
++	pLayout->setLayoutNumber(3); 
++	pLayout->setWritingMode(WritingMode_LR_TB);
++	pLayout->setHBitmapId(BMP_FOIL_15_H);
++	pLayout->setLBitmapId(BMP_FOIL_15);
++	
++	pLayout->createDefaultElement(); // title element
++	
++	pLayout->createDefaultElement();  // object1 element
++	pLayout->setKind(1,PRESOBJ_OBJECT);
++	
++	pLayout->createDefaultElement();  // object2 element
++	pLayout->setKind(2,PRESOBJ_OBJECT);
++    
++        pLayout->createDefaultElement();  // outline element
++	pLayout->setKind(3,PRESOBJ_OUTLINE);
++	pLayout->initializeRectInfo(); // initialize each element
++	
++	maLayoutList[AUTOLAYOUT_2OBJTEXT] = pLayout;
++	
++	// AUTOLAYOUT_2OBJOVERTEXT (2 objects over the outline)
++	
++	pLayout = new LayoutType();
++	pLayout->setName(LString(SdResId(STR_AUTOLAYOUT_2OBJOVERTEXT)));
++    pLayout->setStrId(STR_AUTOLAYOUT_2OBJOVERTEXT);
++	//This is the case number to get the bounding rectangle
++	// for this layout.  Will eventually be taken out in the future
++	pLayout->setLayoutNumber(5); 
++	pLayout->setWritingMode(WritingMode_LR_TB);
++	pLayout->setHBitmapId(BMP_FOIL_16_H);
++	pLayout->setLBitmapId(BMP_FOIL_16);
++	
++    pLayout->createDefaultElement(); // title element
++	
++	pLayout->createDefaultElement();  // object1 element
++	pLayout->setKind(1,PRESOBJ_OBJECT);
++	
++	pLayout->createDefaultElement();  // object2 element
++	pLayout->setKind(2,PRESOBJ_OBJECT);
++	
++    pLayout->createDefaultElement();  // outline element
++	pLayout->setKind(3,PRESOBJ_OUTLINE);
++	pLayout->initializeRectInfo(); // initialize each element
++	
++	maLayoutList[AUTOLAYOUT_2OBJOVERTEXT] = pLayout;
++	
++	// AUTOLAYOUT_TEXTOVEROBJ (title, an outline over an object)
++	pLayout = new LayoutType();
++	pLayout->setName(LString(SdResId(STR_AUTOLAYOUT_TEXTOVEROBJ)));
++    pLayout->setStrId(STR_AUTOLAYOUT_TEXTOVEROBJ);
++	//This is the case number to get the bounding rectangle
++	// for this layout.  Will eventually be taken out in the future
++	pLayout->setLayoutNumber(4);
++	pLayout->setWritingMode(WritingMode_LR_TB);
++	pLayout->setHBitmapId(BMP_FOIL_17_H);
++	pLayout->setLBitmapId(BMP_FOIL_17);
++	
++	pLayout->createDefaultElement(); // title element
++	
++	pLayout->createDefaultElement();  // outline element
++	pLayout->setKind(1,PRESOBJ_OUTLINE);
++	
++	pLayout->createDefaultElement();  // object element
++	pLayout->setKind(2,PRESOBJ_OBJECT);	
++
++	pLayout->initializeRectInfo(); // initialize each element
++	
++	maLayoutList[AUTOLAYOUT_TEXTOVEROBJ] = pLayout;
++	
++	//  AUTOLAYOUT_4OBJ (title and 4 objects)
++	pLayout = new LayoutType();
++	pLayout->setName(LString(SdResId(STR_AUTOLAYOUT_4OBJ)));
++    pLayout->setStrId(STR_AUTOLAYOUT_4OBJ);
++	//This is the case number to get the bounding rectangle
++	// for this layout.  Will eventually be taken out in the future
++	pLayout->setLayoutNumber(6); 
++	pLayout->setWritingMode(WritingMode_LR_TB);
++	pLayout->setHBitmapId(BMP_FOIL_18_H);
++	pLayout->setLBitmapId(BMP_FOIL_18);
++	
++	pLayout->createDefaultElement(); // title element
++	
++	pLayout->createDefaultElement();  // object1 element
++    pLayout->setKind(1,PRESOBJ_OBJECT);
++	    
++	pLayout->createDefaultElement();  // object2 element
++	pLayout->setKind(2,PRESOBJ_OBJECT);
++
++    pLayout->createDefaultElement();  // object3 element
++	pLayout->setKind(3,PRESOBJ_OBJECT);
++	
++	pLayout->createDefaultElement();  // object4 element
++	pLayout->setKind(4,PRESOBJ_OBJECT);
++	pLayout->initializeRectInfo(); // initialize each element
++	
++	maLayoutList[AUTOLAYOUT_4OBJ] = pLayout;
++	
++	//  AUTOLAYOUT_ONLY_TITLE (just a title)
++	pLayout = new LayoutType();
++	pLayout->setName(LString(SdResId(STR_AUTOLAYOUT_ONLY_TITLE)));
++    pLayout->setStrId(STR_AUTOLAYOUT_ONLY_TITLE);
++	//This is the case number to get the bounding rectangle
++	// for this layout.  Will eventually be taken out in the future
++	pLayout->setLayoutNumber(0); 
++	pLayout->setWritingMode(WritingMode_LR_TB);
++	pLayout->setHBitmapId(BMP_FOIL_19_H);
++	pLayout->setLBitmapId(BMP_FOIL_19);
++	
++	pLayout->createDefaultElement();  // title element
++	pLayout->initializeRectInfo();
++	
++	maLayoutList[AUTOLAYOUT_ONLY_TITLE] = pLayout;
++	
++	//  AUTOLAYOUT_NONE (blank page)
++	pLayout = new LayoutType();
++	pLayout->setName(LString(SdResId(STR_AUTOLAYOUT_NONE)));\
++    pLayout->setStrId(STR_AUTOLAYOUT_NONE);
++	//This is the case number to get the bounding rectangle
++	// for this layout.  Will eventually be taken out in the future
++	pLayout->setLayoutNumber(0); 
++	pLayout->setWritingMode(WritingMode_LR_TB);
++	pLayout->setHBitmapId(BMP_FOIL_20_H);
++	pLayout->setLBitmapId(BMP_FOIL_20);
++	
++	maLayoutList[AUTOLAYOUT_NONE] = pLayout;
++
++    // AUTOLAYOUT_NOTES (notes page)
++	pLayout = new LayoutType();
++	pLayout->setName(LString(SdResId(STR_AUTOLAYOUT_NOTES)));
++    pLayout->setStrId(STR_AUTOLAYOUT_NOTES);
++	//This is the case number to get the bounding rectangle
++	// for this layout.  Will eventually be taken out in the future
++	pLayout->setLayoutNumber(0); 
++	pLayout->setWritingMode(WritingMode_LR_TB);
++	pLayout->setHBitmapId(BMP_FOILN_01_H);
++	pLayout->setLBitmapId(BMP_FOILN_01);
++
++    pLayout->createDefaultElement();  // page element
++	pLayout->setKind(0,PRESOBJ_PAGE);
++    pLayout->setRecttype(0, RT_TITLE);
++	
++	pLayout->createDefaultElement();  // notes element
++	pLayout->setKind(1,PRESOBJ_NOTES);
++    pLayout->setRecttype(1,RT_LAYOUT);
++	
++	maLayoutList[AUTOLAYOUT_NOTES] = pLayout;
++	
++	// AUTOLAYOUT_HANDOUT1 (1 page)
++	pLayout = new LayoutType();
++	pLayout->setName(LString(SdResId(STR_AUTOLAYOUT_HANDOUT1)));
++    pLayout->setStrId(STR_AUTOLAYOUT_HANDOUT1);
++	//This is the case number to get the bounding rectangle
++	// for this layout.  Will eventually be taken out in the future
++	pLayout->setLayoutNumber(0);
++	pLayout->setWritingMode(WritingMode_LR_TB);
++	pLayout->setHBitmapId(BMP_FOILH_01_H);
++	pLayout->setLBitmapId(BMP_FOILH_01);
++	
++	maLayoutList[AUTOLAYOUT_HANDOUT1] = pLayout;
++	
++	// AUTOLAYOUT_HANDOUT2 (2 page)
++	pLayout = new LayoutType();
++	pLayout->setName(LString(SdResId(STR_AUTOLAYOUT_HANDOUT2)));
++    pLayout->setStrId(STR_AUTOLAYOUT_HANDOUT2);
++	//This is the case number to get the bounding rectangle
++	// for this layout.  Will eventually be taken out in the future
++	pLayout->setLayoutNumber(0);
++	pLayout->setWritingMode(WritingMode_LR_TB);
++	pLayout->setHBitmapId(BMP_FOILH_02_H);
++	pLayout->setLBitmapId(BMP_FOILH_02);
++	
++	maLayoutList[AUTOLAYOUT_HANDOUT2] = pLayout;
++	
++	// AUTOLAYOUT_HANDOUT3 (3 page)
++	pLayout = new LayoutType();
++	pLayout->setName(LString(SdResId(STR_AUTOLAYOUT_HANDOUT3)));
++    pLayout->setStrId(STR_AUTOLAYOUT_HANDOUT3);
++	//This is the case number to get the bounding rectangle
++	// for this layout.  Will eventually be taken out in the future
++	pLayout->setLayoutNumber(0);
++	pLayout->setWritingMode(WritingMode_LR_TB);
++	pLayout->setHBitmapId(BMP_FOILH_03_H);
++	pLayout->setLBitmapId(BMP_FOILH_03);
++	
++	maLayoutList[AUTOLAYOUT_HANDOUT3] = pLayout;
++	
++	// AUTOLAYOUT_HANDOUT4 (4 page)
++	pLayout = new LayoutType();
++	pLayout->setName(LString(SdResId(STR_AUTOLAYOUT_HANDOUT4)));
++    pLayout->setStrId(STR_AUTOLAYOUT_HANDOUT4);
++	//This is the case number to get the bounding rectangle
++	// for this layout.  Will eventually be taken out in the future
++	pLayout->setLayoutNumber(0);
++	pLayout->setWritingMode(WritingMode_LR_TB);
++	pLayout->setHBitmapId(BMP_FOILH_04_H);
++	pLayout->setLBitmapId(BMP_FOILH_04);
++	
++	maLayoutList[AUTOLAYOUT_HANDOUT4] = pLayout;
++	
++	// AUTOLAYOUT_HANDOUT6 (6 page)
++	pLayout = new LayoutType();
++	pLayout->setName(LString(SdResId(STR_AUTOLAYOUT_HANDOUT6)));
++    pLayout->setStrId(STR_AUTOLAYOUT_HANDOUT6);
++	//This is the case number to get the bounding rectangle
++	// for this layout.  Will eventually be taken out in the future
++	pLayout->setLayoutNumber(0); 
++	pLayout->setWritingMode(WritingMode_LR_TB);
++	pLayout->setHBitmapId(BMP_FOILH_06_H);
++	pLayout->setLBitmapId(BMP_FOILH_06);
++	
++	maLayoutList[AUTOLAYOUT_HANDOUT6] = pLayout;
++	
++	// AUTOLAYOUT_VERTICAL_TITLE_TEXT_CHART (vertical title
++	// and outline with chart)
++	pLayout = new LayoutType();
++	pLayout->setName(LString(SdResId(STR_AL_VERT_TITLE_TEXT_CHART)));
++       pLayout->setStrId(STR_AL_VERT_TITLE_TEXT_CHART);
++	//This is the case number to get the bounding rectangle
++	// for this layout.  Will eventually be taken out in the future
++	pLayout->setLayoutNumber(7); 
++	pLayout->setWritingMode(WritingMode_TB_RL);
++	pLayout->setHBitmapId(BMP_FOIL_21_H);
++	pLayout->setLBitmapId(BMP_FOIL_21);
++	
++	pLayout->createDefaultElement(); // title element
++	pLayout->setVertical(0,true);
++	pLayout->setRecttype(0, RT_VERTICAL_TITLE);
++	
++	pLayout->createDefaultElement();  // outline1 element
++	pLayout->setKind(1,PRESOBJ_OUTLINE);
++	pLayout->setVertical(1, true);
++	pLayout->setRecttype(1, RT_VERTICAL_LAYOUT);
++	
++	pLayout->createDefaultElement();  // chart element
++	pLayout->setKind(2,PRESOBJ_CHART);
++	pLayout->setRecttype(2, RT_VERTICAL_LAYOUT);
++	pLayout->initializeRectInfo(); // initialize each element
++	
++	maLayoutList[AUTOLAYOUT_VERTICAL_TITLE_TEXT_CHART] = pLayout;
++	
++	// AUTOLAYOUT_VERTICAL_TITLE_VERTICAL_OUTLINE
++	pLayout = new LayoutType();
++	pLayout->setName(LString(SdResId(STR_AL_VERT_TITLE_VERT_OUTLINE)));
++    pLayout->setStrId(STR_AL_VERT_TITLE_VERT_OUTLINE);
++	//This is the case number to get the bounding rectangle
++	// for this layout.  Will eventually be taken out in the future
++	pLayout->setLayoutNumber(8); 
++	pLayout->setWritingMode(WritingMode_TB_RL);
++	pLayout->setHBitmapId(BMP_FOIL_22_H);
++	pLayout->setLBitmapId(BMP_FOIL_22);
++	
++	pLayout->createDefaultElement(); // title element
++	pLayout->setVertical(0,true);
++	pLayout->setRecttype(0,RT_VERTICAL_TITLE);
++	
++	pLayout->createDefaultElement();  // outline1 element
++	pLayout->setKind(1,PRESOBJ_OUTLINE);
++	pLayout->setVertical(1, true);
++	pLayout->setRecttype(1, RT_VERTICAL_LAYOUT);
++	pLayout->initializeRectInfo(); // initialize each element
++	
++	maLayoutList[AUTOLAYOUT_VERTICAL_TITLE_VERTICAL_OUTLINE] = pLayout;
++	
++	// AUTOLAYOUT_TITLE_VERTICAL_OUTLINE
++	pLayout = new LayoutType();
++	pLayout->setName(LString(SdResId(STR_AL_TITLE_VERT_OUTLINE)));
++    pLayout->setStrId(STR_AL_TITLE_VERT_OUTLINE);
++	//This is the case number to get the bounding rectangle
++	// for this layout.  Will eventually be taken out in the future
++	pLayout->setLayoutNumber(0); 
++	pLayout->setWritingMode(WritingMode_TB_RL);
++	pLayout->setHBitmapId(BMP_FOIL_23_H);
++	pLayout->setLBitmapId(BMP_FOIL_23);
++	
++	pLayout->createDefaultElement(); // title element
++	
++	pLayout->createDefaultElement();  // outline element
++	pLayout->setKind(1,PRESOBJ_OUTLINE);
++	pLayout->setVertical(1, true);
++    pLayout->setRecttype(1,RT_VERTICAL_LAYOUT);
++	pLayout->initializeRectInfo(); // initialize each element
++	
++	maLayoutList[AUTOLAYOUT_TITLE_VERTICAL_OUTLINE] = pLayout;
++	
++	
++	// AUTOLAYOUT_TITLE_VERTICAL_OUTLINE_CLIPART
++	pLayout = new LayoutType();
++	pLayout->setName(LString(SdResId(STR_AL_TITLE_VERT_OUTLINE_CLIPART)));
++    pLayout->setStrId(STR_AL_TITLE_VERT_OUTLINE_CLIPART);
++	//This is the case number to get the bounding rectangle
++	// for this layout.  Will eventually be taken out in the future
++	pLayout->setLayoutNumber(9); 
++	pLayout->setWritingMode(WritingMode_TB_RL);
++	pLayout->setHBitmapId(BMP_FOIL_24_H);
++	pLayout->setLBitmapId(BMP_FOIL_24);
++	
++	pLayout->createDefaultElement(); // title element
++	
++    pLayout->createDefaultElement();  // picture element
++	pLayout->setKind(1,PRESOBJ_GRAPHIC);
++    pLayout->setRecttype(1,RT_LAYOUT);
++
++    pLayout->createDefaultElement();  // outline element
++	pLayout->setKind(2,PRESOBJ_OUTLINE);
++    pLayout->setRecttype(2, RT_LAYOUT);
++	pLayout->setVertical(2, true);
++    pLayout->initializeRectInfo(); // initialize each element
++    
++	maLayoutList[AUTOLAYOUT_TITLE_VERTICAL_OUTLINE_CLIPART] = pLayout;
++	
++	// AUTOLAYOUT_HANDOUT9 (9 per page)
++	pLayout = new LayoutType();
++	pLayout->setName(LString(SdResId(STR_AUTOLAYOUT_HANDOUT9)));
++    pLayout->setStrId(STR_AUTOLAYOUT_HANDOUT9);
++	//This is the case number to get the bounding rectangle
++	// for this layout.  Will eventually be taken out in the future
++	pLayout->setLayoutNumber(0);
++	pLayout->setWritingMode(WritingMode_LR_TB);
++	pLayout->setHBitmapId(BMP_FOILH_09_H);
++	pLayout->setLBitmapId(BMP_FOILH_09);
++	
++	maLayoutList[AUTOLAYOUT_HANDOUT9] = pLayout;
++	
++	// AUTOLAYOUT_ONLY_TEXT (just a text box)
++	pLayout = new LayoutType();
++	pLayout->setName(LString(SdResId(STR_AUTOLAYOUT_ONLY_TEXT)));
++    pLayout->setStrId(STR_AUTOLAYOUT_ONLY_TEXT);
++	//This is the case number to get the bounding rectangle
++	// for this layout.  Will eventually be taken out in the future
++	pLayout->setLayoutNumber(10);
++	pLayout->setWritingMode(WritingMode_LR_TB);
++	pLayout->setHBitmapId(BMP_FOIL_25_H);
++	pLayout->setLBitmapId(BMP_FOIL_25);
++	
++	pLayout->createDefaultElement();  // text element
++	pLayout->setKind(0,PRESOBJ_TEXT);
++	pLayout->setRecttype(0,RT_TEXT_ONLY);
++	pLayout->initializeRectInfo();
++	
++	maLayoutList[AUTOLAYOUT_ONLY_TEXT] = pLayout;
++	
++}
++
+diff -Nrup sd-m15/source/core/layouttype.cxx sd/source/core/layouttype.cxx
+--- sd-m15/source/core/layouttype.cxx	1969-12-31 16:00:00.000000000 -0800
++++ sd/source/core/layouttype.cxx	2009-07-18 23:21:35.000000000 -0700
+@@ -0,0 +1,844 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ * 
++ * Copyright 2008 by Sun Microsystems, Inc.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * $RCSfile: layouttype.cxx,v $
++ * $Revision: 0.1 $
++ *
++ * This file is part of OpenOffice.org.
++ *
++ * OpenOffice.org is free software: you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License version 3
++ * only, as published by the Free Software Foundation.
++ *
++ * OpenOffice.org is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ * GNU Lesser General Public License version 3 for more details
++ * (a copy is included in the LICENSE file that accompanied this code).
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * version 3 along with OpenOffice.org.  If not, see
++ * <http://www.openoffice.org/license.html>
++ * for a copy of the LGPLv3 License.
++ *
++ ************************************************************************/
++
++// MARKER(update_precomp.py): autogen include statement, do not remove
++#include "precompiled_sd.hxx"
++#include <tools/debug.hxx>
++#include <stdio.h>
++#include <com/sun/star/uno/Reference.hxx>
++#include <com/sun/star/xml/dom/XDocumentBuilder.hpp>
++#include "sdresid.hxx"
++#include "layouttype.hxx"
++
++#define CHARTOOUSTR(x) rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( x ) )
++#define CHATTOSTR(x) String::createFromAscii(x);
++#define STRTOCHAR(x) (char*) ByteString(x, RTL_TEXTENCODING_UTF8).GetBuffer()
++#define OUSTRTOCHAR(x) (OUStringToOString(x, RTL_TEXTENCODING_UTF8)).getStr()
++
++using namespace sd;
++using namespace ::sax_fastparser;
++using namespace ::com::sun::star::uno;
++using namespace ::com::sun::star::xml;
++
++/** xml tags used by the layoutlist class
++ * for reading and writing to the
++ *  configuration file.
++ */
++
++static char sElemTag[] = "Element";
++static char sKindTag[] = "PresObjKind";
++static char sVerticalTag[] = "IsVertical";
++static char sFxTag[] = "XFactor";
++static char sFyTag[] = "YFactor";
++static char sFhtTag[] = "HtFactor";
++static char sFwtTag[] = "WtFactor";
++static char sRectTag[] = "RectType";
++static char sLayoutTag[] = "layout";
++static char sNumberTag[] = "number";
++static char sNameTag[] = "Name";
++static char sStrIdTag[] = "StrId";
++static char sWmTag[] = "WritingMode";
++static char sHBitmapTag[] = "HBitmapId";
++static char sLBitmapTag[] = "LBitmapId";
++static char sElemListTag[] = "ElementList";
++
++
++
++LayoutType::LayoutType()
++{
++   elemList.reserve(20);
++}
++
++LayoutType::~LayoutType()
++{
++	sal_uInt32 size = elemList.size();
++	
++	for(sal_uInt32 i = 0; i < size; i++)
++	{
++		deleteElement(i);
++	}
++	
++	elemList.clear(); 
++}
++
++/** writes the element list for this layout to the config file */
++
++void LayoutType::writeElementTofile(FastSerializerHelper& fsh,
++                                    const sal_uInt32 i,
++                                    const char* sNumber,
++                                    const ElemType* elem)
++{
++   
++
++   static char sElemNumber[10];       
++   static char sKind[10];
++   static char sVertical[10];
++   static char sRect[10];
++   static char sFx[10];
++   static char sFy[10];
++   static char sHt[10];
++   static char sWt[10];
++   
++   
++   sprintf(sElemNumber,"%d", (int) i); 
++   sprintf(sKind, "%d", (int) elem->kind); // the type of pres. object
++   sprintf(sVertical, "%d", ((elem->isVertical) ? 1 : 0));
++   sprintf(sFx, "%f", elem->factorX);  // factor for finding topleft x value
++   sprintf(sFy,"%f", elem->factorY);  // factor for finding topleft y value
++   sprintf(sHt,"%f", elem->factorHt); // factor for finding height
++   sprintf(sWt,"%f", elem->factorWt); // factor for finding width
++   sprintf(sRect, "%d", (int) elem->recttype);  // type of standard rect to use
++          
++   fsh.singleElement(sLayoutTag,
++                     sElemTag, sElemNumber, 
++                     sNumberTag, sNumber,
++                     sKindTag, sKind,
++                     sVerticalTag, sVertical,
++                     sFxTag, sFx,
++                     sFyTag, sFy,
++                     sFhtTag, sHt,
++                     sFwtTag, sWt,
++                     sRectTag, sRect, NULL);
++    
++    
++}
++
++/** writes this layout to a xml configuration file */
++  
++void LayoutType::writeLayoutToFile(FastSerializerHelper& fsh, const sal_Int32 autolayout)
++{
++   static char sNumber[10];
++   static char sName[40];
++   static char sStrId[10];
++   static char sWm[10]; 
++   static char sHBitmap[10];
++   static char sLBitmap[10];
++   
++   // write out layout information 
++   sprintf(sNumber,"%d", (int) autolayout);
++   sprintf(sName,"%s", (char*) ByteString(name, RTL_TEXTENCODING_UTF8).GetBuffer());
++   sprintf(sStrId,"%d", (int) nStrId);
++   sprintf(sWm, "%d", (int) nWritingMode);
++   sprintf(sHBitmap, "%d", (int) nHBitmapId);
++   sprintf(sLBitmap, "%d", (int) nLBitmapId);
++    
++   fsh.startElement(sLayoutTag, NULL);
++    
++   fsh.singleElement(sLayoutTag, sNameTag, sName,
++                     sNumberTag, sNumber,
++                     sStrIdTag, sStrId,
++                     sWmTag, sWm,
++                     sHBitmapTag, sHBitmap,
++                     sLBitmapTag, sLBitmap, NULL);
++                     
++                     
++   // write out element list 
++   ElemType* elem;
++   
++   fsh.startElement(sElemListTag, NULL);
++
++   for(sal_uInt32 i=0; i<length();i++)
++   {
++      elem = getElemByIndex(i);
++      if(elem) writeElementTofile(fsh, i, sNumber, elem);
++   }
++    
++    fsh.endElement(sElemListTag);
++
++    fsh.endElement(sLayoutTag);
++
++}
++
++sal_Int32 LayoutType::getIntValue(const Reference<dom::XNode>& node)
++{
++    sal_Int32 num=0;
++    
++    if(node.is())
++    {
++       rtl::OUString sStr= node->getNodeValue();
++       num = sStr.toInt32();
++    }
++
++    return num;
++}
++
++double LayoutType::getDoubleValue(const Reference<dom::XNode>& node)
++{
++    double dnum=0.0;
++    
++    if(node.is())
++    {
++       rtl::OUString sStr= node->getNodeValue();
++       dnum = sStr.toDouble();
++    }
++
++    return dnum;
++    
++}
++
++/** reads in the layout information from
++ * the configuration file 
++ */
++
++sal_Int32 LayoutType::readLayoutFromFile(const Reference<dom::XNode>& node)
++{
++   sal_Int32 lnum=-1;
++   sal_Int32 num;
++   double dnum;
++   Reference<dom::XNodeList> topnodes = node->getChildNodes();
++   Reference<dom::XNode> layoutattrnode = topnodes->item(0);
++   
++   if(layoutattrnode->hasAttributes())
++   {
++       Reference<dom::XNamedNodeMap> attrlist = layoutattrnode->getAttributes();
++       
++       Reference<dom::XNode> anode = attrlist->getNamedItem(CHARTOOUSTR(sStrIdTag));
++       num = getIntValue(anode);
++       if(num > 0)
++       {
++          nStrId = num;
++          name = (LString) SdResId(num);
++       } else
++       {
++          nStrId = -1;
++          Reference<dom::XNode> nameNode = attrlist->getNamedItem(CHARTOOUSTR(sNameTag));
++          rtl::OUString sName = nameNode->getNodeValue();
++          name = LString::CreateFromAscii(OUSTRTOCHAR(sName));
++        }
++        OSL_TRACE("AUTOLAYOUT NAME: %s", STRTOCHAR(name));
++       
++        anode = attrlist->getNamedItem(CHARTOOUSTR(sWmTag));
++        nWritingMode = (WritingMode) getIntValue(anode);
++        OSL_TRACE("  writing mode %d", (int) nWritingMode);
++       
++        anode = attrlist->getNamedItem(CHARTOOUSTR(sNumberTag));
++        lnum = getIntValue(anode);
++        OSL_TRACE("   AutoLayout number %d", (int) lnum);
++       
++         anode = attrlist->getNamedItem(CHARTOOUSTR(sHBitmapTag));
++         nHBitmapId = getIntValue(anode);
++         OSL_TRACE("   HBitmap ID: %d", (int) nHBitmapId);
++       
++         anode = attrlist->getNamedItem(CHARTOOUSTR(sLBitmapTag));
++         nLBitmapId = getIntValue(anode);
++         OSL_TRACE("   LBitmap ID: %d", (int) nLBitmapId);
++        
++   }
++   
++   Reference<dom::XNode> elemlistnode = topnodes->item(1);
++   Reference<dom::XNodeList> elemnodes = elemlistnode->getChildNodes();
++   sal_Int32 elemsize;
++   
++   elemsize = elemnodes->getLength();
++   OSL_TRACE("NUMBER OF ELEM %d", elemsize);
++   for(sal_Int32 i=0; i < elemsize;i++)
++   {
++       Reference<dom::XNode> elemnode = elemnodes->item(i);
++       OSL_TRACE("ELEMENT: %i", i);
++       if(elemnode->hasAttributes())
++       {
++          Reference<dom::XNamedNodeMap> attrlist = elemnode->getAttributes();
++          
++          createDefaultElement();
++          Reference<dom::XNode> anode = attrlist->getNamedItem(CHARTOOUSTR(sKindTag));
++          num = getIntValue(anode);
++          setKind(i, (PresObjKind) num);
++          OSL_TRACE("   Kind = %l", (long) getKind(i));
++          
++          anode = attrlist->getNamedItem(CHARTOOUSTR(sVerticalTag));
++          num = getIntValue(anode);
++          bool bVert = (num ? true : false);
++          setVertical(i, bVert);
++          OSL_TRACE("   isvertical = %d", (isVertical(i) ? 1 : 0));
++          
++          anode = attrlist->getNamedItem(CHARTOOUSTR(sFxTag));
++          dnum = getDoubleValue(anode);
++          setFactorX(i, dnum);
++          OSL_TRACE("   X = %f", factorX(i));
++          
++          anode = attrlist->getNamedItem(CHARTOOUSTR(sFyTag));
++          dnum = getDoubleValue(anode);
++          setFactorY(i, dnum);
++          OSL_TRACE("   Y = %f", factorY(i));
++          
++          anode = attrlist->getNamedItem(CHARTOOUSTR(sFhtTag));
++          dnum = getDoubleValue(anode);
++          setFactorHt(i, dnum);
++          OSL_TRACE("   Ht = %f", factorHt(i));
++          
++          anode = attrlist->getNamedItem(CHARTOOUSTR(sFwtTag));
++          dnum = getDoubleValue(anode);
++          setFactorWt(i, dnum);
++          OSL_TRACE("   Wt = %f", factorWt(i));
++          
++          anode = attrlist->getNamedItem(CHARTOOUSTR(sRectTag));
++          num = getIntValue(anode);
++          setRecttype(i, (RectType) num);
++          OSL_TRACE("   recttype = %d", recttype(i));
++          
++       }
++       
++   }
++   return lnum;
++    
++}
++  
++/** creates an element of type TITLE
++ *  with default rect bounds.
++ *  and puts it in the elem list
++ * at the end.
++ */
++  
++void LayoutType::createDefaultElement()
++{
++	ElemType* elem = new ElemType;
++	
++	elem->kind = PRESOBJ_TITLE;
++	elem->isVertical = false;
++	elem->factorX = 0.0;
++	elem->factorY = 0.0;
++	elem->factorHt = 1.0;
++	elem->factorWt = 1.0;
++	elem->recttype = RT_TITLE;
++	
++	addElemToList(*elem);
++	
++}
++
++/** Get functions for layout information */
++
++LString LayoutType::getName() 
++{
++	return name;	
++}
++
++sal_uInt32 LayoutType::getStrId() 
++{
++	return nStrId;	
++}
++
++sal_uInt32 LayoutType::getLayoutNumber() 
++{	
++	return nLayout;
++}
++
++WritingMode LayoutType::getWritingMode()
++ {
++	return nWritingMode; 	 
++ }
++
++sal_uInt32 LayoutType::getHBitmapId()
++{
++	return nHBitmapId;	
++}
++
++sal_uInt32 LayoutType::getLBitmapId()
++{
++	return nLBitmapId;
++}
++
++
++/** gets the element at the given index 
++ * into the elem list 
++ */
++
++ElemType* LayoutType::getElemByIndex(const sal_uInt32& nIndex)
++{
++	// check for valid index (no need to check for negative)
++	if(nIndex >= length())  return NULL;
++	
++	return elemList[nIndex];
++}
++
++/** gets length of elem list. */
++	
++sal_uInt32 LayoutType::length() 
++{
++	return elemList.size();
++}
++
++/**  these are get functions for the element list
++ *   They require passing in the index at which
++ *   the element is located in the list
++ */
++
++ PresObjKind LayoutType::getKind(const sal_uInt32& nIndex) 
++ {
++	ElemType* elem;
++	elem = getElemByIndex(nIndex);
++	if(elem) return elem->kind;
++	return PRESOBJ_NONE;
++	 
++ }
++ 
++ 
++bool LayoutType::isVertical(const sal_uInt32& nIndex)
++{
++	ElemType* elem;
++	elem = getElemByIndex(nIndex);
++	if(elem) return elem->isVertical;
++	return false;
++}
++
++double LayoutType::factorX(const sal_uInt32& nIndex)
++{
++	ElemType* elem;
++	elem = getElemByIndex(nIndex);
++	if(elem) return elem->factorX;
++	return 0.0;
++}
++
++double LayoutType::factorY(const sal_uInt32& nIndex)
++{
++	ElemType* elem;
++	elem = getElemByIndex(nIndex);
++	if(elem) return elem->factorY;
++	return 0.0;
++}
++
++double LayoutType::factorHt(const sal_uInt32& nIndex)
++{
++	ElemType* elem;
++	elem = getElemByIndex(nIndex);
++	if(elem) return elem->factorHt;
++	return 1.0;
++}
++
++double LayoutType::factorWt(const sal_uInt32& nIndex)
++{
++	ElemType* elem;
++	elem = getElemByIndex(nIndex);
++	if(elem) return elem->factorWt;
++	return 1.0;
++}
++
++RectType LayoutType::recttype(const sal_uInt32& nIndex)
++{
++	ElemType* elem;
++	elem = getElemByIndex(nIndex);
++	if(elem) return elem->recttype;
++	return RT_ERROR;
++}
++
++/** Set functions for the layout */
++	
++void LayoutType::setName(const LString& sName)
++{
++   name = sName;	
++}
++
++void LayoutType::setStrId(const sal_uInt32 id)
++{
++	nStrId = id;	
++}
++
++void LayoutType::setLayoutNumber(const sal_uInt32& number)
++{
++	nLayout = number;
++}
++
++ 
++void LayoutType::setWritingMode(const WritingMode& wmode)
++{
++	nWritingMode = wmode;
++}
++
++void LayoutType::setHBitmapId(const sal_uInt32& id)
++{
++	nHBitmapId = id;
++}
++	   
++void LayoutType::setLBitmapId(const sal_uInt32& id)
++{
++	nLBitmapId = id;
++}
++
++/** set functions for the elements in the
++ *  list.  Requires passing in the index
++ *  in the list where the element is
++ *  located
++ */
++
++void LayoutType::setKind(const sal_uInt32& nIndex, PresObjKind nKind)
++{
++	ElemType* elem;
++	elem = getElemByIndex(nIndex);
++	if(elem) elem->kind = nKind;
++}
++
++
++void LayoutType::setVertical(const sal_uInt32& nIndex, bool bVertical)
++{
++	ElemType* elem;
++	elem = getElemByIndex(nIndex);
++	if(elem) elem->isVertical = bVertical;
++}
++
++void LayoutType::setFactorX(const sal_uInt32& nIndex, double fx)
++{
++    ElemType* elem;
++	elem = getElemByIndex(nIndex);
++	if(elem) elem->factorX = fx;
++}
++
++void LayoutType::setFactorY(const sal_uInt32& nIndex, double fy)
++{
++    ElemType* elem;
++	elem = getElemByIndex(nIndex);
++	if(elem) elem->factorY = fy;
++}
++
++void LayoutType::setFactorHt(const sal_uInt32& nIndex, double ht)
++{
++	ElemType* elem;
++	elem = getElemByIndex(nIndex);
++	if(elem) elem->factorHt = ht;
++}
++
++void LayoutType::setFactorWt(const sal_uInt32& nIndex, double wt)
++{
++	ElemType* elem;
++	elem = getElemByIndex(nIndex);
++	if(elem) elem->factorWt = wt;
++}
++
++void LayoutType::setRecttype(const sal_uInt32& nIndex, RectType rect)
++{
++	ElemType* elem;
++	elem = getElemByIndex(nIndex);
++	if(elem) elem->recttype = rect;
++}
++
++/** adds a passed in element object to the 
++ *  back of the list
++ */
++
++void LayoutType::addElemToList(ElemType& rElement) 
++{
++	elemList.push_back(&rElement);
++		
++}
++
++/** deletes an element from the list 
++ *  This will move elements up
++ *  from where they are
++ */
++
++void LayoutType::deleteElement(const sal_uInt32& nIndex)  
++{
++	ElemType* elem;
++	if(nIndex > length()) return;
++	elem = elemList[nIndex];
++	elemList.erase(elemList.begin() + nIndex);
++	if(elem) delete elem;
++}
++
++/** Helper function for initializing builtins
++ *  based on a given number.  To possibly be
++ *  removed when the configuration files
++ *  are created
++ */
++
++void LayoutType::initFromLayoutNumber(ElemType* elem,
++                                      const sal_uInt32& i)
++{
++   Point ncpos(0,0);  //no changes to position
++   Size ncsize(1,1);  //no changes to size
++   Size size;
++   Point pos;	
++   
++   switch (nLayout)
++
++   {
++	  case 9:  // title and 2 vertical side by side layouts
++      case 1:  // TITLE AND 2 side by side LAYOUTS
++         // for right to left switching if needed.
++	     if(nLayout != 9) elem->recttype = RT_LAYOUT_SWITCH; 
++	     elem->factorWt = .488;
++		 if(i == 2) elem->factorX = .5124;
++		 break;
++	  case 2: // TITLE on top, 1 right, 2 left layouts
++	     elem->recttype = RT_LAYOUT_SWITCH;  // for right to left switching
++		                           // if needed.
++		 elem->factorWt = .488;
++		 if((i == 2)||(i == 3)) //2 top to bot.
++		 {
++		    elem->factorHt = .477;
++			elem->factorX = .5124;
++			if(i == 3) elem->factorY = .5223;
++		 }
++		 break;
++	  case 3:  //TITLE, 2 right, 1 left layouts
++	     elem->recttype = RT_LAYOUT_SWITCH;  // for right to left switching
++		                           // if needed. 
++		 elem->factorWt = .488;
++		 if((i == 1)||(i == 2)) //2 top to bot.
++		 {
++		    elem->factorHt = .477;
++			if(i == 2) elem->factorY = .5223;
++		 }
++		 if(i == 3) elem->factorX = .5124;
++		 break;
++	  case 4: //TITLE, 2 layouts top to bot.
++		 elem->factorHt = .477;
++		 if(i == 2) elem->factorY = .5223;		 
++		 break;
++	  case 5:  //TITLE, 2 layouts above 1 layout
++		 elem->factorHt = .477;
++		 if(i != 3) elem->factorWt = .488;
++		 if(i == 2) elem->factorX = .5124;
++		 if(i == 3) elem->factorY = .5223;
++		 break;
++	  case 6:  // 4 layouts (in a square)
++		 elem->factorHt = .477;
++		 elem->factorWt = .488;
++		 if((i == 2)||(i == 3)) elem->factorX = .5124;
++		 if((i == 3)||(i == 4)) elem->factorY = .5223;
++		 break;
++	  case 7: // a vertical title and two layouts (top to bottom)
++	     elem->recttype = RT_VERTICAL_LAYOUT;
++	     elem->factorHt = .47;
++		 elem->factorWt = .7;
++		 if(i == 2) elem->factorY = .53;
++		 break;
++	 case 8: // a vertical title and one shape
++	     elem->recttype = RT_VERTICAL_LAYOUT;
++	     elem->factorWt = .7;
++		 break;
++	 case 0:
++     default:  break; /* do nothing */
++   } // switch nLayout  
++	
++}
++
++/** to be used when the user customizes
++ *  an autolayout.  It sets rect bounds
++ *  factors based on the sizes of a standard
++ *  title (for titles) or layout
++ *  rectangle.
++ */ 
++
++
++void LayoutType::setCustomRectInfo(const sal_uInt32& nIndex, 
++                                   const RectType& rType,
++                                   const Rectangle& rRect,
++								   const Rectangle& rStandard)
++{
++	ElemType* elem;
++	double x, y, ht, wt;
++	double sx, sy, sht, swt;
++	
++	// the actual rectangle
++	x = rRect.TopLeft().X();
++	y = rRect.TopLeft().Y();
++	ht = rRect.getHeight();
++	wt = rRect.getWidth();
++	
++	// the standard to use
++	// to get rel. size factors
++	sx = rStandard.TopLeft().X();
++	sy = rStandard.TopLeft().Y();
++	sht = rStandard.getHeight();
++	swt = rStandard.getWidth();
++	
++	elem = getElemByIndex(nIndex);
++	if(elem)
++	{
++	   	elem->recttype = rType;
++		elem->factorHt = ht/sht;
++		elem->factorWt = wt/swt;
++		elem->factorX = (x - sx)/swt;
++		elem->factorY = (y - sy)/sht;
++	}
++	
++}
++
++/** for initializing rect bounds factors
++ *  for builtins. To be removed once the
++ *  configuration file is implemented.
++ */
++
++void LayoutType::initializeRectInfo()
++{
++	ElemType* elem;
++	//Point ncpos(0,0);  //no changes to position
++	//Size ncsize(1,1);  //no changes to size
++	//Size size;
++	//Point pos;
++	
++	for(sal_uInt32 i=0; i < length();i++)
++	{
++	   elem = getElemByIndex(i);
++	   if(!elem) continue;
++	   if(elem->kind == PRESOBJ_NONE) continue;
++	   // default to doing nothing with
++	   // the position and size.
++	   // this will work for 1/2 the
++	   // builtins (ones with 0 )
++	   // and works with some values
++	   // for the others.
++	   elem->factorX = 0.0;
++	   elem->factorY = 0.0;
++	   elem->factorHt = 1.0;
++	   elem->factorWt = 1.0;
++	   switch(elem->kind) {
++		   case PRESOBJ_TITLE:  
++		      if(elem->isVertical)
++			  {
++			     elem->recttype = RT_VERTICAL_TITLE;	
++			  }
++			  else
++			  {
++			     elem->recttype = RT_TITLE;
++			  }
++			  break;
++		   case PRESOBJ_TEXT:
++		      if(nLayout == 10) //TEXT_ONLY
++		      {
++			    elem->recttype = RT_TEXT_ONLY;
++				break;
++			  }
++		   case PRESOBJ_OUTLINE: 
++	       case PRESOBJ_GRAPHIC:
++           case PRESOBJ_OBJECT:
++	       case PRESOBJ_CHART:
++	       case PRESOBJ_TABLE:
++			    elem->recttype = RT_LAYOUT;
++		        initFromLayoutNumber(elem,i);
++			    break;
++		   case PRESOBJ_NONE:
++		   case PRESOBJ_ORGCHART:
++	       case PRESOBJ_IMAGE:
++	       case PRESOBJ_BACKGROUND:
++	       case PRESOBJ_PAGE:
++	       case PRESOBJ_HANDOUT:
++	       case PRESOBJ_NOTES:
++	       case PRESOBJ_HEADER:
++	       case PRESOBJ_FOOTER:
++	       case PRESOBJ_DATETIME:
++	       case PRESOBJ_SLIDENUMBER:
++		   case PRESOBJ_MAX:
++		   default:  break; /* do nothing.  all the above handled elsewhere */ 
++		} //switch nKind
++	 } // for		
++	
++}
++
++/** the function called by sdpage.cxx to get rect bounds
++ *  from the factors for each element.
++ */
++
++void LayoutType::calcAutoLayoutRectangles(const Rectangle& aTitleRect,
++                                      const Rectangle& aLayoutRect,
++									  const Size& aPageSize,
++								      const bool& bRightToLeft,
++									  Rectangle* rRectangle )
++{
++    ElemType* elem;
++	sal_uInt32 count = length();
++	long x,y,ht,wt;
++	long pageHt, pageWt;
++	long vtx, vty, vtht, vtwt;
++	long tx, ty, lx, ly;
++	
++	pageHt = aLayoutRect.BottomLeft().Y() - aTitleRect.TopLeft().Y();
++	pageWt = aPageSize.getWidth();
++	vtx = aTitleRect.TopRight().X()-aTitleRect.getHeight();
++	vty = aTitleRect.TopRight().Y();
++	vtht = pageHt;
++	vtwt = aTitleRect.getHeight();
++	tx = aTitleRect.TopLeft().X();
++	ty = aTitleRect.TopLeft().Y();
++	lx = aLayoutRect.TopLeft().X();
++	ly = aLayoutRect.TopLeft().Y();
++	
++	for(sal_uInt32 i=0; i < count;i++)
++	{
++	   elem = getElemByIndex(i);
++	   if(!elem) continue;
++	   if(elem->kind == PRESOBJ_NONE) continue;
++	   switch (elem->recttype)
++	   {
++	      case RT_TITLE:
++		      x = (long) tx + aTitleRect.getWidth()*elem->factorX;
++		      y = (long) ty + aTitleRect.getHeight()*elem->factorY;
++			  ht = (long) aTitleRect.getHeight()*elem->factorHt;
++			  wt = (long) aTitleRect.getWidth()*elem->factorWt;
++			  break;  
++		  case RT_VERTICAL_TITLE: 
++		      x = vtx;
++			  y =  vty;
++			  ht = vtht;
++			  wt = vtwt;
++		      break;
++		  case RT_VERTICAL_LAYOUT: // need vertical title
++		      ht = vtht*elem->factorHt;
++			  wt = pageWt*elem->factorWt;
++		      x = tx + vtwt*elem->factorX;
++			  y = ty + vtht*elem->factorY;
++			  break;
++		  case RT_TEXT_ONLY: // this takes up the whole page.
++		      ht = pageHt;
++			  wt = aTitleRect.getWidth();
++			  x = tx;
++			  y = ty;
++			  break;
++		  case RT_LAYOUT:
++		  case RT_LAYOUT_SWITCH:
++		  default:  // use layout as default
++		      x = (long) lx + aLayoutRect.getWidth()*elem->factorX;
++		      y = (long) ly + aLayoutRect.getHeight()*elem->factorY;
++			  ht = (long) aLayoutRect.getHeight()*elem->factorHt;
++			  wt = (long) aLayoutRect.getWidth()*elem->factorWt;
++	   }	
++	
++	   rRectangle[i] = Rectangle(Point(x,y), Size(wt, ht));
++   }
++   
++   if((bRightToLeft)&&(elem->recttype == RT_LAYOUT_SWITCH))
++   {
++	   switch (count)
++	   {
++		   case 3:  //2 shapes, switch these
++		      ::std::swap< Rectangle >( rRectangle[1], rRectangle[2] );
++			  break;
++		   case 4:  //3 shapes, rotate
++		      ::std::swap< long >( rRectangle[1].Left(), rRectangle[2].Left() );
++			  rRectangle[3].Left() = rRectangle[2].Left();
++			  break;
++		   default: break;  /* do nothing */
++		}
++		   
++	}
++	  
++ 
++}
++
++
+diff -Nrup sd-m15/source/core/makefile.mk sd/source/core/makefile.mk
+--- sd-m15/source/core/makefile.mk	2009-07-15 21:39:20.000000000 -0700
++++ sd/source/core/makefile.mk	2009-07-18 23:21:36.000000000 -0700
+@@ -57,6 +57,8 @@ SLOFILES = $(SLO)$/stlsheet.obj  \
+            $(SLO)$/drawdoc3.obj \
+ 		   $(SLO)$/drawdoc4.obj \
+ 		   $(SLO)$/drawdoc_animations.obj\
++		   $(SLO)$/layoutlist.obj \
++		   $(SLO)$/layouttype.obj \
+ 		   $(SLO)$/sdpage.obj \
+ 		   $(SLO)$/sdpage2.obj	\
+ 		   $(SLO)$/sdattr.obj \
+diff -Nrup sd-m15/source/core/sdpage.cxx sd/source/core/sdpage.cxx
+--- sd-m15/source/core/sdpage.cxx	2009-07-15 21:39:20.000000000 -0700
++++ sd/source/core/sdpage.cxx	2009-07-18 23:21:35.000000000 -0700
+@@ -1058,261 +1058,14 @@ Rectangle SdPage::GetLayoutRect() const
+ |*
+ \*************************************************************************/
+ 
+-const int MAX_PRESOBJS = 5;	// maximum number of presentation objects per layout
++const int MAX_PRESOBJS = 5;	// TODO eliminate this 
+ const int VERTICAL = 0x8000;
+ 
+-struct LayoutDescriptor
+-{
+-	int mnLayout;
+-	PresObjKind meKind[MAX_PRESOBJS];
+-	bool mbVertical[MAX_PRESOBJS];
+-
+-	LayoutDescriptor( int nLayout, int k0 = 0, int k1 = 0, int k2 = 0, int k3 = 0, int k4 = 0 );
+-};
+-
+-LayoutDescriptor::LayoutDescriptor( int nLayout, int k0, int k1, int k2, int k3, int k4 )
+-: mnLayout( nLayout )
+-{
+-	meKind[0] = static_cast<PresObjKind>(k0 & (~VERTICAL)); mbVertical[0] = (k0 & VERTICAL) == VERTICAL;
+-	meKind[1] = static_cast<PresObjKind>(k1 & (~VERTICAL)); mbVertical[1] = (k1 & VERTICAL) == VERTICAL;
+-	meKind[2] = static_cast<PresObjKind>(k2 & (~VERTICAL)); mbVertical[2] = (k2 & VERTICAL) == VERTICAL;
+-	meKind[3] = static_cast<PresObjKind>(k3 & (~VERTICAL)); mbVertical[3] = (k3 & VERTICAL) == VERTICAL;
+-	meKind[4] = static_cast<PresObjKind>(k4 & (~VERTICAL)); mbVertical[4] = (k4 & VERTICAL) == VERTICAL;
+-}
+-
+-static const LayoutDescriptor& GetLayoutDescriptor( AutoLayout eLayout )
+-{
+-	static LayoutDescriptor aLayouts[AUTOLAYOUT__END-AUTOLAYOUT__START] =
+-	{
+-		LayoutDescriptor( 0, PRESOBJ_TITLE, PRESOBJ_TEXT ),									// AUTOLAYOUT_TITLE
+-		LayoutDescriptor( 0, PRESOBJ_TITLE, PRESOBJ_OUTLINE ),								// AUTOLAYOUT_ENUM
+-		LayoutDescriptor( 0, PRESOBJ_TITLE, PRESOBJ_CHART ),								// AUTOLAYOUT_CHART
+-		LayoutDescriptor( 1, PRESOBJ_TITLE, PRESOBJ_OUTLINE, PRESOBJ_OUTLINE ),				// AUTOLAYOUT_2TEXT
+-		LayoutDescriptor( 1, PRESOBJ_TITLE, PRESOBJ_OUTLINE, PRESOBJ_CHART ),				// AUTOLAYOUT_TEXTCHART
+-		LayoutDescriptor( 0, PRESOBJ_TITLE, PRESOBJ_ORGCHART ),								// AUTOLAYOUT_ORG
+-		LayoutDescriptor( 1, PRESOBJ_TITLE, PRESOBJ_OUTLINE, PRESOBJ_GRAPHIC ),				// AUTOLAYOUT_TEXTCLbIP
+-		LayoutDescriptor( 1, PRESOBJ_TITLE, PRESOBJ_CHART, PRESOBJ_OUTLINE ),				// AUTOLAYOUT_CHARTTEXT
+-		LayoutDescriptor( 0, PRESOBJ_TITLE, PRESOBJ_TABLE ),								// AUTOLAYOUT_TAB
+-		LayoutDescriptor( 1, PRESOBJ_TITLE, PRESOBJ_GRAPHIC, PRESOBJ_OUTLINE ),				// AUTOLAYOUT_CLIPTEXT
+-		LayoutDescriptor( 1, PRESOBJ_TITLE, PRESOBJ_OUTLINE, PRESOBJ_OBJECT ),				// AUTOLAYOUT_TEXTOBJ
+-		LayoutDescriptor( 0, PRESOBJ_TITLE, PRESOBJ_OBJECT ),								// AUTOLAYOUT_OBJ
+-		LayoutDescriptor( 2, PRESOBJ_TITLE, PRESOBJ_OUTLINE, PRESOBJ_OBJECT, PRESOBJ_OBJECT ),	// AUTOLAYOUT_TEXT2OBJ
+-		LayoutDescriptor( 1, PRESOBJ_TITLE, PRESOBJ_OBJECT, PRESOBJ_OUTLINE ),				// AUTOLAYOUT_TEXTOBJ
+-		LayoutDescriptor( 4, PRESOBJ_TITLE, PRESOBJ_OBJECT, PRESOBJ_OUTLINE ),				// AUTOLAYOUT_OBJOVERTEXT
+-		LayoutDescriptor( 3, PRESOBJ_TITLE, PRESOBJ_OBJECT, PRESOBJ_OBJECT, PRESOBJ_OUTLINE ),	// AUTOLAYOUT_2OBJTEXT
+-		LayoutDescriptor( 5, PRESOBJ_TITLE, PRESOBJ_OBJECT, PRESOBJ_OBJECT, PRESOBJ_OUTLINE ),	// AUTOLAYOUT_2OBJOVERTEXT
+-		LayoutDescriptor( 4, PRESOBJ_TITLE, PRESOBJ_OUTLINE, PRESOBJ_OBJECT ),				// AUTOLAYOUT_TEXTOVEROBJ
+-		LayoutDescriptor( 6, PRESOBJ_TITLE, PRESOBJ_OBJECT, PRESOBJ_OBJECT,					// AUTOLAYOUT_4OBJ
+-			PRESOBJ_OBJECT, PRESOBJ_OBJECT ),
+-		LayoutDescriptor( 0, PRESOBJ_TITLE, PRESOBJ_NONE ),									// AUTOLAYOUT_ONLY_TITLE
+-		LayoutDescriptor( 0, PRESOBJ_NONE ),												// AUTOLAYOUT_NONE
+-		LayoutDescriptor( 0, PRESOBJ_PAGE, PRESOBJ_NOTES ),									// AUTOLAYOUT_NOTES
+-		LayoutDescriptor( 0 ),																// AUTOLAYOUT_HANDOUT1
+-		LayoutDescriptor( 0 ),																// AUTOLAYOUT_HANDOUT2
+-		LayoutDescriptor( 0 ),																// AUTOLAYOUT_HANDOUT3
+-		LayoutDescriptor( 0 ),																// AUTOLAYOUT_HANDOUT4
+-		LayoutDescriptor( 0 ),																// AUTOLAYOUT_HANDOUT6
+-		LayoutDescriptor( 7, PRESOBJ_TITLE|VERTICAL, PRESOBJ_OUTLINE|VERTICAL, PRESOBJ_CHART ),// AUTOLAYOUT_VERTICAL_TITLE_TEXT_CHART
+-		LayoutDescriptor( 8, PRESOBJ_TITLE|VERTICAL, PRESOBJ_OUTLINE|VERTICAL ),			// AUTOLAYOUT_VERTICAL_TITLE_VERTICAL_OUTLINE
+-		LayoutDescriptor( 0, PRESOBJ_TITLE, PRESOBJ_OUTLINE|VERTICAL ),						// AUTOLAYOUT_TITLE_VERTICAL_OUTLINE
+-		LayoutDescriptor( 9, PRESOBJ_TITLE, PRESOBJ_GRAPHIC, PRESOBJ_OUTLINE|VERTICAL ),	// AUTOLAYOUT_TITLE_VERTICAL_OUTLINE_CLIPART
+-		LayoutDescriptor( 0 ),																// AUTOLAYOUT_HANDOUT9
+-        LayoutDescriptor( 10, PRESOBJ_TEXT, PRESOBJ_NONE )                                  // AUTOLAYOUT_ONLY_TEXT
+-	};
+-
+-	if( (eLayout < AUTOLAYOUT__START) || (eLayout >= AUTOLAYOUT__END) )
+-		eLayout = AUTOLAYOUT_NONE;
+-
+-	return aLayouts[ eLayout - AUTOLAYOUT__START ];
+-}
+-
+-static void CalcAutoLayoutRectangles( SdPage& rPage, int nLayout, Rectangle* rRectangle )
+-{
+-	Rectangle aTitleRect;
+-	Rectangle aLayoutRect;
+-
+-	if( rPage.GetPageKind() != PK_HANDOUT )
+-	{
+-		SdPage& rMasterPage = static_cast<SdPage&>(rPage.TRG_GetMasterPage());
+-		SdrObject* pMasterTitle = rMasterPage.GetPresObj( PRESOBJ_TITLE );
+-		SdrObject* pMasterOutline = rMasterPage.GetPresObj( rPage.GetPageKind()==PK_NOTES ? PRESOBJ_NOTES : PRESOBJ_OUTLINE );
+-
+-		if( pMasterTitle )
+-			aTitleRect = pMasterTitle->GetLogicRect();
+-
+-		if (aTitleRect.IsEmpty() )
+-			aTitleRect = rPage.GetTitleRect();
+-
+-		if( pMasterOutline )
+-			aLayoutRect = pMasterOutline->GetLogicRect();
+-
+-		if (aLayoutRect.IsEmpty() )
+-			aLayoutRect = rPage.GetLayoutRect();
+-	}
+-
+-	rRectangle[0] = aTitleRect;
+-
+-	int i;
+-	for( i = 1; i < MAX_PRESOBJS; i++ )
+-		rRectangle[i] = aLayoutRect;
+-
+-	Size        aTitleSize( aTitleRect.GetSize() );
+-	Point       aTitlePos( aTitleRect.TopLeft() );
+-	Size        aLayoutSize( aLayoutRect.GetSize() );
+-	Point       aLayoutPos( aLayoutRect.TopLeft() );
+-	Size        aTempSize;
+-	Point       aTempPnt;
+-
+-    sal_Bool    bRightToLeft = ( rPage.GetModel() && static_cast< SdDrawDocument* >( rPage.GetModel() )->GetDefaultWritingMode() == ::com::sun::star::text::WritingMode_RL_TB );
+-
+-	switch( nLayout )
+-	{
+-	case 0: // default layout using only the title and layout area
+-		break; // do nothing
+-	case 1: // title, 2 shapes
+-	case 9: // title, 2 vertical shapes
+-		aLayoutSize.Width()  = long (aLayoutSize.Width() * 0.488);
+-		rRectangle[1] = Rectangle (aLayoutPos, aLayoutSize);
+-
+-		aLayoutPos.X() = long (aLayoutPos.X() + aLayoutSize.Width() * 1.05);
+-		rRectangle[2] = Rectangle (aLayoutPos, aLayoutSize);
+-
+-        if( bRightToLeft && (nLayout != 9) )
+-            ::std::swap< Rectangle >( rRectangle[1], rRectangle[2] );
+-		break;
+-	case 2: // title, shape, 2 shapes
+-		aTempPnt = aLayoutPos;
+-		aTempSize = aLayoutSize;
+-		aLayoutSize.Height() = long (aLayoutSize.Height() * 0.477);
+-		aLayoutSize.Width() = long (aLayoutSize.Width() * 0.488);
+-		aLayoutPos.X() = long (aLayoutPos.X() + aLayoutSize.Width() * 1.05);
+-		rRectangle[2] = Rectangle (aLayoutPos, aLayoutSize);
+-
+-		aLayoutPos.Y() = long (aLayoutPos.Y() + aLayoutSize.Height() * 1.095);
+-		rRectangle[3] = Rectangle (aLayoutPos, aLayoutSize);
+-
+-		aLayoutPos = aTempPnt;
+-		aLayoutSize = aTempSize;
+-		aLayoutSize.Width() = long (aLayoutSize.Width() * 0.488);
+-		rRectangle[1] = Rectangle (aLayoutPos, aLayoutSize);
+-
+-		if( bRightToLeft )
+-		{
+-			::std::swap< long >( rRectangle[1].Left(), rRectangle[2].Left() );
+-			rRectangle[3].Left() = rRectangle[2].Left();
+-		}
+-		break;
+-	case 3: // title, 2 shapes, shape
+-		aTempPnt = aLayoutPos;
+-		aTempSize = aLayoutSize;
+-		aLayoutSize.Height() = long (aLayoutSize.Height() * 0.477);
+-		aLayoutSize.Width() = long (aLayoutSize.Width() * 0.488);
+-		rRectangle[1] = Rectangle (aLayoutPos, aLayoutSize);
+-
+-		aLayoutPos.Y() = long (aLayoutPos.Y() + aLayoutSize.Height() * 1.095);
+-		rRectangle[2] = Rectangle (aLayoutPos, aLayoutSize);
+-
+-		aLayoutPos = aTempPnt;
+-		aLayoutSize = aTempSize;
+-		aLayoutSize.Width() = long (aLayoutSize.Width() * 0.488);
+-		aLayoutPos.X() = long (aLayoutPos.X() + aLayoutSize.Width() * 1.05);
+-		rRectangle[3] = Rectangle (aLayoutPos, aLayoutSize);
+ 
+-        if( bRightToLeft )
+-        {
+-            ::std::swap< long >( rRectangle[1].Left(), rRectangle[2].Left() );
+-            rRectangle[3].Left() = rRectangle[2].Left();
+-        }
+-		break;
+-	case 4: // title, shape above shape
+-		aLayoutSize.Height() = long (aLayoutSize.Height() * 0.477);
+-		rRectangle[1] = Rectangle (aLayoutPos, aLayoutSize);
+-
+-		aLayoutPos.Y() = long (aLayoutPos.Y() + aLayoutSize.Height() * 1.095);
+-		rRectangle[2] = Rectangle (aLayoutPos, aLayoutSize);
+-		break;
+-
+-	case 5: // title, 2 shapes above shape
+-		aLayoutSize.Height() = long (aLayoutSize.Height() * 0.477);
+-		aLayoutSize.Width() = long (aLayoutSize.Width() * 0.488);
+-		rRectangle[1] = Rectangle (aLayoutPos, aLayoutSize);
+-
+-		aTempPnt = aLayoutPos;
+-		aLayoutPos.X() = long (aLayoutPos.X() + aLayoutSize.Width() * 1.05);
+-		rRectangle[2] = Rectangle (aLayoutPos, aLayoutSize);
+-
+-		aLayoutPos.X() = aTempPnt.X();
+-		aLayoutPos.Y() = long (aLayoutPos.Y() + aLayoutSize.Height() * 1.095);
+-		aLayoutSize.Width() = long (aLayoutSize.Width() / 0.488);
+-		rRectangle[3] = Rectangle (aLayoutPos, aLayoutSize);
+-		break;
+-	case 6: // title, 4 shapes
+-	{
+-		ULONG nX = long (aLayoutPos.X());
+-
+-		aLayoutSize.Height() = long (aLayoutSize.Height() * 0.477);
+-		aLayoutSize.Width()  = long (aLayoutSize.Width() * 0.488);
+-		rRectangle[1] = Rectangle (aLayoutPos, aLayoutSize);
+-
+-		aLayoutPos.X() = long (nX + aLayoutSize.Width() * 1.05);
+-		rRectangle[2] = Rectangle (aLayoutPos, aLayoutSize);
+-
+-		aLayoutPos.Y() = long (aLayoutPos.Y() + aLayoutSize.Height() * 1.095);
+-		rRectangle[3] = Rectangle (aLayoutPos, aLayoutSize);
+-
+-		aLayoutPos.X() = nX;
+-		rRectangle[4] = Rectangle (aLayoutPos, aLayoutSize);
+-		break;
+-	}
+-	case 7: // vertical title, shape above shape
+-	{
+-		Size aSize( rRectangle[0].GetSize().Height(), rRectangle[1].BottomLeft().Y() - rRectangle[0].TopLeft().Y() );
+-		rRectangle[0].SetSize( aSize );
+-		rRectangle[0].SetPos( aTitleRect.TopRight() - Point( aSize.Width(), 0 ) );
+-
+-		Size aPageSize ( rPage.GetSize() );
+-		aPageSize.Height() -= rPage.GetUppBorder() + rPage.GetLwrBorder();
+-		aSize.Height() = long ( rRectangle[0].GetSize().Height() * 0.47 );
+-		aSize.Width() = long( aPageSize.Width() * 0.7 );
+-		rRectangle[1].SetPos( aTitleRect.TopLeft() );
+-		rRectangle[1].SetSize( aSize );
+-
+-		aSize.Height() = rRectangle[0].GetSize().Height();
+-		Point aPos( aTitleRect.TopLeft() );
+-		aPos.Y() += long ( aSize.Height() * 0.53 );
+-		rRectangle[2].SetPos( aPos );
+-		aSize.Height() = long ( rRectangle[0].GetSize().Height() * 0.47 );
+-		rRectangle[2].SetSize( aSize );
+-		break;
+-	}
+-	case 8: // vertical title, shape
+-	{
+-		Size aSize( rRectangle[0].GetSize().Height(), rRectangle[1].BottomLeft().Y() - rRectangle[0].TopLeft().Y() );
+-		rRectangle[0].SetSize( aSize );
+-		rRectangle[0].SetPos( aTitleRect.TopRight() - Point( aSize.Width(), 0 ) );
+-
+-		Size aPageSize ( rPage.GetSize() );
+-		aPageSize.Height() -= rPage.GetUppBorder() + rPage.GetLwrBorder();
+-		aSize.Height() = rRectangle[0].GetSize().Height();
+-		aSize.Width() = long( aPageSize.Width() * 0.7 );
+-		rRectangle[1].SetPos( aTitleRect.TopLeft() );
+-		rRectangle[1].SetSize( aSize );
+-		break;
+-	}
+-    case 10: // onlytext
+-    {
+-        Size aSize( rRectangle[0].GetSize().Width(), rRectangle[1].BottomLeft().Y() - rRectangle[0].TopLeft().Y() );
+-		rRectangle[0].SetSize( aSize );
+-		rRectangle[0].SetPos( aTitlePos);
+-		break;
+-    }
+-	}
+-}
+-
+-
+-void findAutoLayoutShapesImpl( SdPage& rPage, const LayoutDescriptor& rDescriptor, std::vector< SdrObject* >& rShapes, bool bInit )
++void findAutoLayoutShapesImpl( SdPage& rPage, LayoutType* layout, std::vector< SdrObject* >& rShapes, bool bInit )
+ {
+-	int i;
++    int i, elemcount = layout->length();
++	PresObjKind eKind;
+ 
+ 	// init list of indexes for each presentation shape kind
+ 	// this is used to find subsequent shapes with the same presentation shape kind
+@@ -1321,10 +1074,16 @@ void findAutoLayoutShapesImpl( SdPage& r
+ 
+ 	bool bMissing = false;
+ 
+-	// for each entry in the layoutdescriptor, arrange a presentation shape
+-	for( i = 0; (i < PRESOBJ_MAX) && (rDescriptor.meKind[i] != PRESOBJ_NONE); i++ )
++	if(layout)
+ 	{
+-		PresObjKind eKind = rDescriptor.meKind[i];
++	   // for each entry in the element list, arrange a presentation shape
++	for( i = 0; i < elemcount ; i++ )
++ 	{
++        eKind = layout->getKind(i);
++		if (eKind == PRESOBJ_NONE)
++		{
++			continue;
++		}
+ 		SdrObject* pObj = rPage.GetPresObj( eKind, PresObjIndex[eKind] );
+ 		if( pObj )
+ 		{
+@@ -1339,14 +1098,17 @@ void findAutoLayoutShapesImpl( SdPage& r
+ 
+ 	if( bMissing && bInit )
+ 	{
+-		// for each entry in the layoutdescriptor, look for an alternative shape
+-		for( i = 0; (i < PRESOBJ_MAX) && (rDescriptor.meKind[i] != PRESOBJ_NONE); i++ )
+-		{
++        // for each entry in the element list, look for an alternative shape
++		for( i = 0; i < elemcount; i++ )
++ 		{
++			eKind = layout->getKind(i);
++			if(eKind == PRESOBJ_NONE)
++			{
++				continue;
++			}
+ 			if( rShapes[i] )
+ 				continue;
+ 
+-			PresObjKind eKind = rDescriptor.meKind[i];
+-
+ 			SdrObject* pObj = 0;
+ 			bool bFound = false;
+ 
+@@ -1411,10 +1173,10 @@ void findAutoLayoutShapesImpl( SdPage& r
+                                             bFound = true;
+                                         }
+ 								    }
+-							    }
+-                             }
+-                         }
+-                    }
++							    } // if(pPersist...
++                             }// else if (rGetModel...
++                         } // if(pOle2..
++                    }// if(eSdrObjKind...
+ 					break;
+ 				case PRESOBJ_CHART:
+ 				case PRESOBJ_TABLE:
+@@ -1434,7 +1196,7 @@ void findAutoLayoutShapesImpl( SdPage& r
+ 							}
+ 						}
+ 						break;
+-					}
++					} 
+ 					break;
+ 				case PRESOBJ_PAGE:
+ 				case PRESOBJ_HANDOUT:
+@@ -1446,13 +1208,14 @@ void findAutoLayoutShapesImpl( SdPage& r
+ 					break;
+ 				default:
+ 					break;
+-				}
+-			}
++				} // switch (eKind)...
++			} // while(nShapesIndex...
+ 
+ 			if( bFound )
+ 				rShapes[i] = pObj;
+-		}
+-	}
++		} // for(i = 0; i < elemcount..
++	 } // if(bMissing && bInit..
++   } // if(layout)...
+ }
+ 
+ void SdPage::SetAutoLayout(AutoLayout eLayout, BOOL bInit, BOOL bCreate )
+@@ -1472,64 +1235,107 @@ void SdPage::SetAutoLayout(AutoLayout eL
+ 		// MasterPage or no layout and no presentation shapes available, noting to do
+ 		return;
+ 	}
+-
+-	Rectangle aRectangle[MAX_PRESOBJS];
+-	const LayoutDescriptor& aDescriptor = GetLayoutDescriptor( meAutoLayout );
+-	CalcAutoLayoutRectangles( *this, aDescriptor.mnLayout, aRectangle );
+-
+-	std::set< SdrObject* > aUsedPresentationObjects;
+-
+-
+-	std::vector< SdrObject* > aLayoutShapes(PRESOBJ_MAX, 0);
+-	findAutoLayoutShapesImpl( *this, aDescriptor, aLayoutShapes, bInit );
+-
+-	int i;
+-
+-	// for each entry in the layoutdescriptor, arrange a presentation shape
+-	for( i = 0; (i < PRESOBJ_MAX) && (aDescriptor.meKind[i] != PRESOBJ_NONE); i++ )
+-	{
+-		PresObjKind eKind = aDescriptor.meKind[i];
+-		SdrObject* pObj = InsertAutoLayoutShape( aLayoutShapes[i], eKind, aDescriptor.mbVertical[i], aRectangle[i], bInit );
+-		if( pObj )
+-			aUsedPresentationObjects.insert(pObj); // remember that we used this empty shape
+-	}
+-
+-	// now delete all empty presentation objects that are no longer used by the new layout
+-	if( bInit )
+-	{
+-		SdrObject* pObj = maPresentationShapeList.getNextShape(0);
+-
+-		while( pObj )
+-		{
+-			SdrObject* pNext = maPresentationShapeList.getNextShape(pObj);
+-			if( aUsedPresentationObjects.count(pObj) == 0 )
+-			{
+-
+-				if( pObj->IsEmptyPresObj() )
+-				{
+-					if( bUndo )
+-						pUndoManager->AddUndoAction(pModel->GetSdrUndoFactory().CreateUndoDeleteObject(*pObj));
+-
+-					RemoveObject( pObj->GetOrdNum() );
+-
+-					if( !bUndo )
+-						SdrObject::Free( pObj );
+-				}
+-				else
+-				{
+-					if( bUndo )
+-					{
+-						pUndoManager->AddUndoAction( new UndoObjectPresentationKind( *pObj ) );
+-						if( pObj->GetUserCall() )
+-							pUndoManager->AddUndoAction( new UndoObjectUserCall( *pObj ) );
+-					}
+-					maPresentationShapeList.removeShape( *pObj );
+-					pObj->SetUserCall(0);
+-				}
+-			}
+-			pObj = pNext;
+-		}
+-	}
++    
++    // get this layout from list
++	LayoutList* list = GetLayoutList();
++    LayoutType* layout = NULL;
++	layout = list->getLayoutByIndex(meAutoLayout);
++	if(layout) 
++	{
++	   int i, elemcount = layout->length();
++	   PresObjKind eKind;
++	   PageKind ePKind  = GetPageKind();
++	   Rectangle aRectangle[elemcount];
++	   Rectangle aTitleRect;
++
++	   Rectangle aLayoutRect;
++       Size aPageSize = GetSize();
++	   bool bRightToLeft = ( GetModel() && static_cast< SdDrawDocument* >( GetModel() )->GetDefaultWritingMode() == ::com::sun::star::text::WritingMode_RL_TB );
++
++									  
++	   if( ePKind != PK_HANDOUT )
++	   {
++		   SdPage& rMasterPage = static_cast<SdPage&>(TRG_GetMasterPage());
++		   SdrObject* pMasterTitle = rMasterPage.GetPresObj( PRESOBJ_TITLE );
++		   SdrObject* pMasterOutline = rMasterPage.GetPresObj( ePKind==PK_NOTES ? PRESOBJ_NOTES : PRESOBJ_OUTLINE );
++
++		   if( pMasterTitle )
++			  aTitleRect = pMasterTitle->GetLogicRect();
++
++
++		   if (aTitleRect.IsEmpty() )
++			  aTitleRect = GetTitleRect();
++
++		   if( pMasterOutline )
++			  aLayoutRect = pMasterOutline->GetLogicRect();
++
++		   if (aLayoutRect.IsEmpty() )
++			  aLayoutRect = GetLayoutRect();
++	   
++        }
++	    layout->calcAutoLayoutRectangles(aTitleRect, aLayoutRect,
++	                  aPageSize, bRightToLeft, aRectangle );
++		
++	   std::set< SdrObject* > aUsedPresentationObjects;
++
++	   std::vector< SdrObject* > aLayoutShapes(PRESOBJ_MAX, 0);
++	   findAutoLayoutShapesImpl( *this, layout, aLayoutShapes, bInit );
++
++	   // for each entry in the element list, arrange a presentation shape
++	   for( i = 0; i < elemcount; i++ )
++	   {
++		   eKind = layout->getKind(i);
++		   if (eKind == PRESOBJ_NONE)
++		   {
++			   continue;
++		   }
++		
++		   SdrObject* pObj = InsertAutoLayoutShape( aLayoutShapes[i], eKind, layout->isVertical(i), aRectangle[i], bInit );
++
++		   if( pObj )
++			  aUsedPresentationObjects.insert(pObj); // remember that we used this empty shape
++	   }
++
++	   // now delete all empty presentation objects that are no longer used by the new layout
++	   if( bInit )
++	   {
++		   SdrObject* pObj = maPresentationShapeList.getNextShape(0);
++
++		   while( pObj )
++		   {
++			   SdrObject* pNext = maPresentationShapeList.getNextShape(pObj);
++			   if( aUsedPresentationObjects.count(pObj) == 0 )
++			   {
++
++				   if( pObj->IsEmptyPresObj() )
++				   {
++					  if( bUndo )
++						  pUndoManager->AddUndoAction(pModel->GetSdrUndoFactory().CreateUndoDeleteObject(*pObj));
++
++					  RemoveObject( pObj->GetOrdNum() );
++
++					  if( !bUndo )
++						  SdrObject::Free( pObj );
++				  }
++				  else
++				  {
++					  if( bUndo )
++					  {
++						  pUndoManager->AddUndoAction( new UndoObjectPresentationKind( *pObj ) );
++						  if( pObj->GetUserCall() )
++						  	  pUndoManager->AddUndoAction( new UndoObjectUserCall( *pObj ) );
++					  }
++					  maPresentationShapeList.removeShape( *pObj );
++					  pObj->SetUserCall(0);
++				  }
++			  }
++			  pObj = pNext;
++		  } // while(pObj...
++	   } // if(bInit...
++	
++	} else { // no autolayout object found.
++       DBG_ERROR("SetAutoLayout: no autolayout object found.");
++ 	}
+ }
+ 
+ /*************************************************************************
+diff -Nrup sd-m15/source/filter/ppt/pptin.cxx sd/source/filter/ppt/pptin.cxx
+--- sd-m15/source/filter/ppt/pptin.cxx	2009-07-15 21:39:23.000000000 -0700
++++ sd/source/filter/ppt/pptin.cxx	2009-07-18 23:21:36.000000000 -0700
+@@ -1097,7 +1097,7 @@ sal_Bool ImplSdPPTImport::Import()
+ 			////////////////////
+ 			SetPageNum( i, PPT_SLIDEPAGE );
+ 			SdPage* pPage = mpDoc->GetSdPage( i, PK_STANDARD );
+-			AutoLayout eAutoLayout = AUTOLAYOUT_NONE;
++			sd::AutoLayout eAutoLayout = AUTOLAYOUT_NONE;
+ 			const PptSlideLayoutAtom* pSlideLayout = GetSlideLayoutAtom();
+ 			if ( pSlideLayout )
+ 			{
+diff -Nrup sd-m15/source/filter/ppt/pptin.hxx sd/source/filter/ppt/pptin.hxx
+--- sd-m15/source/filter/ppt/pptin.hxx	2009-07-15 21:39:23.000000000 -0700
++++ sd/source/filter/ppt/pptin.hxx	2009-07-18 23:21:36.000000000 -0700
+@@ -38,6 +38,7 @@
+ #include <svx/msfiltertracer.hxx>
+ #include <com/sun/star/uno/Any.h>
+ #include <boost/shared_ptr.hpp>
++#include "layoutlist.hxx"
+ 
+ class SdDrawDocument;
+ class SfxMedium;
+diff -Nrup sd-m15/source/ui/func/unprlout.cxx sd/source/ui/func/unprlout.cxx
+--- sd-m15/source/ui/func/unprlout.cxx	2009-07-15 21:39:21.000000000 -0700
++++ sd/source/ui/func/unprlout.cxx	2009-07-18 23:21:36.000000000 -0700
+@@ -54,8 +54,8 @@ SdPresentationLayoutUndoAction::SdPresen
+ 							SdDrawDocument* pTheDoc,
+ 							String          aTheOldLayoutName,
+ 							String          aTheNewLayoutName,
+-							AutoLayout      eTheOldAutoLayout,
+-							AutoLayout      eTheNewAutoLayout,
++							sd::AutoLayout      eTheOldAutoLayout,
++							sd::AutoLayout      eTheNewAutoLayout,
+ 							BOOL            bSet,
+ 							SdPage*         pThePage):
+ 					  SdUndoAction(pTheDoc)
+diff -Nrup sd-m15/source/ui/inc/unmodpg.hxx sd/source/ui/inc/unmodpg.hxx
+--- sd-m15/source/ui/inc/unmodpg.hxx	2009-07-15 21:39:21.000000000 -0700
++++ sd/source/ui/inc/unmodpg.hxx	2009-07-18 23:21:36.000000000 -0700
+@@ -33,6 +33,7 @@
+ 
+ #include "sdundo.hxx"
+ #include "pres.hxx"
++#include "layoutlist.hxx"
+ 
+ class SdDrawDocument;
+ class SdPage;
+@@ -45,8 +46,8 @@ class ModifyPageUndoAction : public SdUn
+ 	SdPage*         mpPage;
+ 	String          maOldName;
+ 	String          maNewName;
+-	AutoLayout      meOldAutoLayout;
+-	AutoLayout      meNewAutoLayout;
++	sd::AutoLayout      meOldAutoLayout;
++	sd::AutoLayout      meNewAutoLayout;
+ 	BOOL            mbOldBckgrndVisible;
+ 	BOOL            mbNewBckgrndVisible;
+ 	BOOL            mbOldBckgrndObjsVisible;
+@@ -61,7 +62,7 @@ public:
+ 		SdDrawDocument*			pTheDoc,
+ 		SdPage*					pThePage,
+ 		String					aTheNewName,
+-		AutoLayout				eTheNewAutoLayout,
++		sd::AutoLayout				eTheNewAutoLayout,
+ 		BOOL					bTheNewBckgrndVisible,
+ 		BOOL					bTheNewBckgrndObjsVisible);
+ 
+diff -Nrup sd-m15/source/ui/inc/unprlout.hxx sd/source/ui/inc/unprlout.hxx
+--- sd-m15/source/ui/inc/unprlout.hxx	2009-07-15 21:39:21.000000000 -0700
++++ sd/source/ui/inc/unprlout.hxx	2009-07-18 23:21:36.000000000 -0700
+@@ -32,7 +32,8 @@
+ #define _SD_UNPRLOUT_HXX
+ 
+ #include "sdundo.hxx"
+-#include "pres.hxx"                 // enum AutoLayout
++#include "pres.hxx"        
++#include "layoutlist.hxx"
+ 
+ class SdDrawDocument;
+ class SdPage;
+@@ -41,8 +42,8 @@ class SdPresentationLayoutUndoAction : p
+ {
+ 	String          aOldLayoutName;
+ 	String          aNewLayoutName;
+-	AutoLayout      eOldAutoLayout;
+-	AutoLayout      eNewAutoLayout;
++	sd::AutoLayout      eOldAutoLayout;
++	sd::AutoLayout      eNewAutoLayout;
+ 	BOOL            bSetAutoLayout;     // TRUE: AutoLayout aendern
+ 	SdPage*         pPage;
+ 	String          aComment;
+@@ -52,8 +53,8 @@ public:
+ 	SdPresentationLayoutUndoAction(SdDrawDocument* pTheDoc,
+ 						 String          aTheOldLayoutName,
+ 						 String          aTheNewLayoutName,
+-						 AutoLayout      eTheOldAutoLayout,
+-						 AutoLayout      eTheNewAutoLayout,
++						 sd::AutoLayout      eTheOldAutoLayout,
++						 sd::AutoLayout      eTheNewAutoLayout,
+ 						 BOOL            bSet,
+ 						 SdPage*         pThePage);
+ 
+diff -Nrup sd-m15/source/ui/inc/ViewShellImplementation.hxx sd/source/ui/inc/ViewShellImplementation.hxx
+--- sd-m15/source/ui/inc/ViewShellImplementation.hxx	2009-07-15 21:39:21.000000000 -0700
++++ sd/source/ui/inc/ViewShellImplementation.hxx	2009-07-18 23:21:36.000000000 -0700
+@@ -34,6 +34,7 @@
+ #include "ViewShell.hxx"
+ #include "ViewShellManager.hxx"
+ #include "ToolBarManager.hxx"
++#include "layoutlist.hxx"
+ 
+ #include <boost/shared_ptr.hpp>
+ #include <boost/weak_ptr.hpp>
+@@ -129,7 +130,7 @@ public:
+     */
+     void AssignLayout (
+         SdPage* pPage,
+-        AutoLayout aLayout);
++        sd::AutoLayout aLayout);
+ 
+     /** Determine the view id of the view shell.  This corresponds to the
+         view id stored in the SfxViewFrame class.  
+diff -Nrup sd-m15/source/ui/slidesorter/controller/SlsSlotManager.cxx sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
+--- sd-m15/source/ui/slidesorter/controller/SlsSlotManager.cxx	2009-07-15 21:39:22.000000000 -0700
++++ sd/source/ui/slidesorter/controller/SlsSlotManager.cxx	2009-07-18 23:21:36.000000000 -0700
+@@ -248,7 +248,7 @@ void SlotManager::FuTemporary (SfxReques
+             pShell->mpImpl->AssignLayout(
+                 pDocument->GetSdPage((USHORT)pWhatPage->GetValue(), 
+                     mrSlideSorter.GetModel().GetPageType()),
+-                (AutoLayout)pWhatLayout->GetValue());
++                (sd::AutoLayout)pWhatLayout->GetValue());
+ 			rRequest.Done ();
+ 		}
+         break;
+diff -Nrup sd-m15/source/ui/toolpanel/LayoutMenu.cxx sd/source/ui/toolpanel/LayoutMenu.cxx
+--- sd-m15/source/ui/toolpanel/LayoutMenu.cxx	2009-07-15 21:39:21.000000000 -0700
++++ sd/source/ui/toolpanel/LayoutMenu.cxx	2009-07-18 23:21:35.000000000 -0700
+@@ -129,99 +129,6 @@ SFX_IMPL_INTERFACE(LayoutMenu, SfxShell,
+ 
+ TYPEINIT1(LayoutMenu, SfxShell);
+ 
+-struct snewfoil_value_info
+-{
+-    USHORT mnBmpResId;
+-    USHORT mnHCBmpResId;
+-    USHORT mnStrResId;
+-    WritingMode meWritingMode;
+-    AutoLayout maAutoLayout;
+-};
+-
+-static snewfoil_value_info notes[] =
+-{
+-    {BMP_FOILN_01, BMP_FOILN_01_H, STR_AUTOLAYOUT_NOTES, WritingMode_LR_TB,
+-     AUTOLAYOUT_NOTES},
+-    {0, 0, 0, WritingMode_LR_TB, AUTOLAYOUT_NONE},
+-};
+-
+-static snewfoil_value_info handout[] =
+-{
+-    {BMP_FOILH_01, BMP_FOILH_01_H, STR_AUTOLAYOUT_HANDOUT1, WritingMode_LR_TB,
+-     AUTOLAYOUT_HANDOUT1},
+-    {BMP_FOILH_02, BMP_FOILH_02_H, STR_AUTOLAYOUT_HANDOUT2, WritingMode_LR_TB,
+-     AUTOLAYOUT_HANDOUT2},
+-    {BMP_FOILH_03, BMP_FOILH_03_H, STR_AUTOLAYOUT_HANDOUT3, WritingMode_LR_TB,
+-     AUTOLAYOUT_HANDOUT3},
+-    {BMP_FOILH_04, BMP_FOILH_04_H, STR_AUTOLAYOUT_HANDOUT4, WritingMode_LR_TB,
+-     AUTOLAYOUT_HANDOUT4},
+-    {BMP_FOILH_06, BMP_FOILH_06_H, STR_AUTOLAYOUT_HANDOUT6, WritingMode_LR_TB,
+-     AUTOLAYOUT_HANDOUT6},
+-    {BMP_FOILH_09, BMP_FOILH_09_H, STR_AUTOLAYOUT_HANDOUT9, WritingMode_LR_TB,
+-     AUTOLAYOUT_HANDOUT9},
+-    {0, 0, 0, WritingMode_LR_TB, AUTOLAYOUT_NONE},
+-};
+-
+-static snewfoil_value_info standard[] =
+-{
+-    {BMP_FOIL_20, BMP_FOIL_20_H, STR_AUTOLAYOUT_NONE, WritingMode_LR_TB,
+-     AUTOLAYOUT_NONE},
+-    {BMP_FOIL_00, BMP_FOIL_00_H, STR_AUTOLAYOUT_TITLE, WritingMode_LR_TB,
+-     AUTOLAYOUT_TITLE},
+-    {BMP_FOIL_01, BMP_FOIL_01_H, STR_AUTOLAYOUT_ENUM, WritingMode_LR_TB,
+-     AUTOLAYOUT_ENUM},
+-    {BMP_FOIL_03, BMP_FOIL_03_H, STR_AUTOLAYOUT_2TEXT, WritingMode_LR_TB,
+-     AUTOLAYOUT_2TEXT},
+-    {BMP_FOIL_19, BMP_FOIL_19_H, STR_AUTOLAYOUT_ONLY_TITLE, WritingMode_LR_TB,
+-     AUTOLAYOUT_ONLY_TITLE},
+-    {BMP_FOIL_25, BMP_FOIL_25_H, STR_AUTOLAYOUT_ONLY_TEXT, WritingMode_LR_TB,
+-     AUTOLAYOUT_ONLY_TEXT},
+-    {BMP_FOIL_11, BMP_FOIL_11_H, STR_AUTOLAYOUT_OBJ, WritingMode_LR_TB,
+-     AUTOLAYOUT_OBJ},
+-    {BMP_FOIL_02, BMP_FOIL_02_H, STR_AUTOLAYOUT_CHART, WritingMode_LR_TB,
+-     AUTOLAYOUT_CHART},
+-    {BMP_FOIL_08, BMP_FOIL_08_H, STR_AUTOLAYOUT_TAB, WritingMode_LR_TB,
+-     AUTOLAYOUT_TAB},
+-    {BMP_FOIL_09, BMP_FOIL_09_H, STR_AUTOLAYOUT_CLIPTEXT, WritingMode_LR_TB,
+-     AUTOLAYOUT_CLIPTEXT},
+-    {BMP_FOIL_04, BMP_FOIL_04_H, STR_AUTOLAYOUT_TEXTCHART, WritingMode_LR_TB,
+-     AUTOLAYOUT_TEXTCHART},
+-    {BMP_FOIL_06, BMP_FOIL_06_H, STR_AUTOLAYOUT_TEXTCLIP, WritingMode_LR_TB,
+-	AUTOLAYOUT_TEXTCLIP},
+-    {BMP_FOIL_07, BMP_FOIL_07_H, STR_AUTOLAYOUT_CHARTTEXT, WritingMode_LR_TB,
+-     AUTOLAYOUT_CHARTTEXT},
+-    {BMP_FOIL_10, BMP_FOIL_10_H, STR_AUTOLAYOUT_TEXTOBJ, WritingMode_LR_TB,
+-     AUTOLAYOUT_TEXTOBJ},
+-    {BMP_FOIL_12, BMP_FOIL_12_H, STR_AUTOLAYOUT_TEXT2OBJ, WritingMode_LR_TB,
+-     AUTOLAYOUT_TEXT2OBJ},
+-    {BMP_FOIL_13, BMP_FOIL_13_H, STR_AUTOLAYOUT_OBJTEXT, WritingMode_LR_TB,
+-     AUTOLAYOUT_OBJTEXT},
+-    {BMP_FOIL_14, BMP_FOIL_14_H, STR_AUTOLAYOUT_OBJOVERTEXT, WritingMode_LR_TB,
+-     AUTOLAYOUT_OBJOVERTEXT},
+-    {BMP_FOIL_15, BMP_FOIL_15_H, STR_AUTOLAYOUT_2OBJTEXT, WritingMode_LR_TB,
+-     AUTOLAYOUT_2OBJTEXT},
+-    {BMP_FOIL_16, BMP_FOIL_16_H, STR_AUTOLAYOUT_2OBJOVERTEXT, 
+-     WritingMode_LR_TB, AUTOLAYOUT_2OBJOVERTEXT},
+-    {BMP_FOIL_17, BMP_FOIL_17_H, STR_AUTOLAYOUT_TEXTOVEROBJ, WritingMode_LR_TB,
+-     AUTOLAYOUT_TEXTOVEROBJ},
+-    {BMP_FOIL_18, BMP_FOIL_18_H, STR_AUTOLAYOUT_4OBJ, WritingMode_LR_TB,
+-     AUTOLAYOUT_4OBJ},
+-    // vertical
+-    {BMP_FOIL_21, BMP_FOIL_21_H, STR_AL_VERT_TITLE_TEXT_CHART, 
+-     WritingMode_TB_RL, AUTOLAYOUT_VERTICAL_TITLE_TEXT_CHART},
+-    {BMP_FOIL_22, BMP_FOIL_22_H, STR_AL_VERT_TITLE_VERT_OUTLINE, 
+-     WritingMode_TB_RL, AUTOLAYOUT_VERTICAL_TITLE_VERTICAL_OUTLINE},
+-    {BMP_FOIL_23, BMP_FOIL_23_H, STR_AL_TITLE_VERT_OUTLINE, WritingMode_TB_RL,
+-     AUTOLAYOUT_TITLE_VERTICAL_OUTLINE},
+-    {BMP_FOIL_24, BMP_FOIL_24_H, STR_AL_TITLE_VERT_OUTLINE_CLIPART, 
+-     WritingMode_TB_RL, AUTOLAYOUT_TITLE_VERTICAL_OUTLINE_CLIPART},
+-    
+-    {0, 0, 0, WritingMode_LR_TB, AUTOLAYOUT_NONE}
+-};
+-
+-
+-
+-
+ LayoutMenu::LayoutMenu (
+     TreeNode* pParent,
+     DrawDocShell& rDocumentShell,
+@@ -763,43 +670,70 @@ void LayoutMenu::Fill (void)
+     catch (RuntimeException&)
+     {}
+     
+-	snewfoil_value_info* pInfo = NULL;
++    LayoutList* list = GetLayoutList();
++	PageKind eMenu;
++	bool aViewExists = true;
++	LayoutType* layout;
++
+     if (sCenterPaneViewName.equals(framework::FrameworkHelper::msNotesViewURL))
+     {
+-        pInfo = notes;
++        eMenu = PK_NOTES;
+     }
+     else if (sCenterPaneViewName.equals(framework::FrameworkHelper::msHandoutViewURL))
+     {
+-        pInfo = handout;
++        eMenu = PK_HANDOUT;
+     }
+     else if (sCenterPaneViewName.equals(framework::FrameworkHelper::msImpressViewURL)
+         || sCenterPaneViewName.equals(framework::FrameworkHelper::msSlideSorterURL))
+     {
+-        pInfo = standard;
++        eMenu = PK_STANDARD;
+     }
+     else
+     {
+-        pInfo = NULL;
++        eMenu = PK_STANDARD;
++		aViewExists = false;
+ 	}
+ 
+     Clear();
+-    int n = 0;
+-	for (sal_uInt16 i=1; pInfo!=NULL&&pInfo->mnBmpResId!=0; i++,pInfo++)
+-	{
+-        if ((WritingMode_TB_RL != pInfo->meWritingMode) || bVertical)
+-        {
+-            BitmapEx aBmp (SdResId (bHighContrast 
+-                             ? pInfo->mnHCBmpResId 
+-                             : pInfo->mnBmpResId));
+-		
+-            if (bRightToLeft && (WritingMode_TB_RL != pInfo->meWritingMode))
+-                aBmp.Mirror (BMP_MIRROR_HORZ);
+-
+-            InsertItem (i, aBmp, String (SdResId (pInfo->mnStrResId)));
+-            SetItemData (i, new AutoLayout(pInfo->maAutoLayout));
+-            n++;
+-        }
+-	}
++    	
++	WritingMode wm;
++	AutoLayout lnum;
++	sal_uInt32 index;
++	sal_uInt32 Hbitmap, Lbitmap;
++	LString name;
++	sal_uInt32 size = list->getMenuLength(eMenu);
++	
++	index = 1;
++	if (aViewExists) {
++	   for (sal_uInt16 i=0; i < size; i++)
++	   {
++		   layout = list->getLayoutAtMenuIndex(i,eMenu);
++		   if(layout) 
++		   {
++		      name = layout->getName();
++		      lnum = list->getLayoutIndex(name);
++			  if(lnum == LL_NOT_FOUND)
++              {
++                 continue;
++              }
++	          wm = layout->getWritingMode();
++		      Hbitmap = layout->getHBitmapId();
++		      Lbitmap = layout->getLBitmapId(); 
++		      if((wm != WritingMode_TB_RL) || bVertical)
++		      {
++		         BitmapEx aBmp (SdResId (bHighContrast 
++                               ? Hbitmap
++                              : Lbitmap));
++		         if(bRightToLeft && (wm != WritingMode_TB_RL))
++		            aBmp.Mirror(BMP_MIRROR_HORZ);
++		          InsertItem (index, aBmp, name);
++                  SetItemData (index, new AutoLayout(lnum));
++                  index++;
++		       
++		      } //if wm...
++	       } //if layout..
++	    } // for...
++    }  // if (aViewExists...
+ 
+     mbSelectionUpdatePending = true;
+ }
+@@ -904,9 +838,7 @@ void LayoutMenu::UpdateSelection (void)
+ 
+         // Get layout of current page.
+         AutoLayout aLayout (pCurrentPage->GetAutoLayout());
+-        if (aLayout<AUTOLAYOUT__START || aLayout>AUTOLAYOUT__END)
+-            break;
+-
++    
+         // Find the entry of the menu for to the layout.
+         USHORT nItemCount (GetItemCount());
+         for (USHORT nId=1; nId<=nItemCount; nId++)
+diff -Nrup sd-m15/source/ui/toolpanel/LayoutMenu.hxx sd/source/ui/toolpanel/LayoutMenu.hxx
+--- sd-m15/source/ui/toolpanel/LayoutMenu.hxx	2009-07-15 21:39:21.000000000 -0700
++++ sd/source/ui/toolpanel/LayoutMenu.hxx	2009-07-18 23:21:35.000000000 -0700
+@@ -39,6 +39,7 @@
+ 
+ #include "glob.hxx"
+ #include "pres.hxx"
++#include "layoutlist.hxx"
+ #include <vcl/ctrl.hxx>
+ #include <svtools/valueset.hxx>
+ #include <svtools/transfer.hxx>
+@@ -198,7 +199,7 @@ private:
+         If no slide sorter is active then this call is ignored.  The slide
+         sorter in the center pane is preferred if the choice exists.
+     */
+-    void AssignLayoutToSelectedSlides (AutoLayout aLayout);
++    void AssignLayoutToSelectedSlides (sd::AutoLayout aLayout);
+ 
+     /** Insert a new page with the given layout.  The page is inserted via
+         the main view shell, i.e. its SID_INSERTPAGE slot is called.  It it
+@@ -206,7 +207,7 @@ private:
+         place.  The new page is inserted after the currently active one (the
+         one returned by ViewShell::GetActualPage().)
+     */
+-    void InsertPageWithLayout (AutoLayout aLayout);
++    void InsertPageWithLayout (sd::AutoLayout aLayout);
+ 
+     /** Create a request structure that can be used with the SID_INSERTPAGE
+         and SID_MODIFYPAGE slots.  The parameters are set so that the given
+@@ -218,7 +219,7 @@ private:
+     */
+     SfxRequest CreateRequest (
+         USHORT nSlotId,
+-        AutoLayout aLayout);
++        sd::AutoLayout aLayout);
+ 
+     /** Select the layout that is used by the current page.
+     */
+diff -Nrup sd-m15/source/ui/unoidl/unopage.cxx sd/source/ui/unoidl/unopage.cxx
+--- sd-m15/source/ui/unoidl/unopage.cxx	2009-07-15 21:39:21.000000000 -0700
++++ sd/source/ui/unoidl/unopage.cxx	2009-07-18 23:21:36.000000000 -0700
+@@ -536,7 +536,7 @@ void SAL_CALL SdGenericDrawPage::setProp
+ 				GetPage()->SetPresChange( (PresChange)nValue );
+ 				break;
+ 			case WID_PAGE_LAYOUT:
+-				GetPage()->SetAutoLayout( (AutoLayout)nValue, sal_True );
++				GetPage()->SetAutoLayout( (sd::AutoLayout)nValue, sal_True );
+ 				break;
+ 			case WID_PAGE_DURATION:
+ 				GetPage()->SetTime((sal_uInt32)nValue);
+diff -Nrup sd-m15/source/ui/view/unmodpg.cxx sd/source/ui/view/unmodpg.cxx
+--- sd-m15/source/ui/view/unmodpg.cxx	2009-07-15 21:39:21.000000000 -0700
++++ sd/source/ui/view/unmodpg.cxx	2009-07-18 23:21:36.000000000 -0700
+@@ -63,7 +63,7 @@ ModifyPageUndoAction::ModifyPageUndoActi
+ 	SdDrawDocument* pTheDoc,
+ 	SdPage* pThePage,
+ 	String aTheNewName,
+-	AutoLayout	eTheNewAutoLayout,
++	sd::AutoLayout	eTheNewAutoLayout,
+ 	BOOL bTheNewBckgrndVisible,
+ 	BOOL bTheNewBckgrndObjsVisible)
+ :	SdUndoAction(pTheDoc),
+diff -Nrup sd-m15/source/ui/view/viewshe3.cxx sd/source/ui/view/viewshe3.cxx
+--- sd-m15/source/ui/view/viewshe3.cxx	2009-07-15 21:39:21.000000000 -0700
++++ sd/source/ui/view/viewshe3.cxx	2009-07-18 23:21:36.000000000 -0700
+@@ -293,33 +293,20 @@ SdPage* ViewShell::CreateOrDuplicatePage
+         SFX_REQUEST_ARG (rRequest, pIsPageBack, SfxBoolItem, ID_VAL_ISPAGEBACK, FALSE);
+         SFX_REQUEST_ARG (rRequest, pIsPageObj, SfxBoolItem, ID_VAL_ISPAGEOBJ, FALSE);
+ 
+-        if (CHECK_RANGE (AUTOLAYOUT__START, (AutoLayout) pLayout->GetValue (), AUTOLAYOUT__END))
++        if (ePageKind == PK_NOTES)
+         {
+-            if (ePageKind == PK_NOTES)
+-            {
+-                aNotesPageName = pPageName->GetValue ();
+-                eNotesLayout   = (AutoLayout) pLayout->GetValue ();
+-            }
+-            else
+-            {
+-                aStandardPageName = pPageName->GetValue ();
+-                eStandardLayout   = (AutoLayout) pLayout->GetValue ();
+-            }
+-
+-            bIsPageBack = pIsPageBack->GetValue ();
+-            bIsPageObj	= pIsPageObj->GetValue ();
++           aNotesPageName = pPageName->GetValue ();
++           eNotesLayout   = (AutoLayout) pLayout->GetValue ();
+         }
+         else
+         {
+-            Cancel();
+-                
+-            if(HasCurrentFunction( SID_BEZIER_EDIT ) )
+-                GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON);
+-
+-            StarBASIC::FatalError (SbERR_BAD_PROP_VALUE);
+-            rRequest.Ignore ();
+-            return NULL;
++            aStandardPageName = pPageName->GetValue ();
++            eStandardLayout   = (AutoLayout) pLayout->GetValue ();
+         }
++
++        bIsPageBack = pIsPageBack->GetValue ();
++        bIsPageObj	= pIsPageObj->GetValue ();
++        
+     }
+ 
+     // 2. Create a new page or duplicate an existing one.
+diff -Nrup sd-m15/source/ui/view/ViewShellImplementation.cxx sd/source/ui/view/ViewShellImplementation.cxx
+--- sd-m15/source/ui/view/ViewShellImplementation.cxx	2009-07-15 21:39:21.000000000 -0700
++++ sd/source/ui/view/ViewShellImplementation.cxx	2009-07-18 23:21:36.000000000 -0700
+@@ -227,20 +227,12 @@ void ViewShell::Implementation::ProcessM
+             SFX_REQUEST_ARG (rRequest, pBVisible, SfxBoolItem, ID_VAL_ISPAGEBACK, FALSE);
+             SFX_REQUEST_ARG (rRequest, pBObjsVisible, SfxBoolItem, ID_VAL_ISPAGEOBJ, FALSE);
+             AutoLayout aLayout ((AutoLayout)pNewAutoLayout->GetValue ());
+-            if (aLayout >= AUTOLAYOUT__START
+-                && aLayout < AUTOLAYOUT__END)
+-            {
+-                aNewName		= pNewName->GetValue ();
+-                aNewAutoLayout = (AutoLayout) pNewAutoLayout->GetValue ();
+-                bBVisible		= pBVisible->GetValue ();
+-                bBObjsVisible	= pBObjsVisible->GetValue ();
+-            }
+-            else
+-            {
+-                StarBASIC::FatalError (SbERR_BAD_PROP_VALUE);
+-                rRequest.Ignore ();
+-                break;
+-            }
++           
++            aNewName		= pNewName->GetValue ();
++            aNewAutoLayout = (AutoLayout) pNewAutoLayout->GetValue ();
++            bBVisible		= pBVisible->GetValue ();
++            bBObjsVisible	= pBObjsVisible->GetValue ();
++                
+             if (ePageKind == PK_HANDOUT)
+             {
+                 bHandoutMode = TRUE;
+diff -Nrup sd-m15/test/export.map sd/test/export.map
+--- sd-m15/test/export.map	1969-12-31 16:00:00.000000000 -0800
++++ sd/test/export.map	2009-07-18 23:21:36.000000000 -0700
+@@ -0,0 +1,38 @@
++#*************************************************************************
++#
++# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++# 
++# Copyright 2008 by Sun Microsystems, Inc.
++#
++# OpenOffice.org - a multi-platform office productivity suite
++#
++# $RCSfile: export.map,v $
++#
++# $Revision: 1.4 $
++#
++# This file is part of OpenOffice.org.
++#
++# OpenOffice.org is free software: you can redistribute it and/or modify
++# it under the terms of the GNU Lesser General Public License version 3
++# only, as published by the Free Software Foundation.
++#
++# OpenOffice.org is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++# GNU Lesser General Public License version 3 for more details
++# (a copy is included in the LICENSE file that accompanied this code).
++#
++# You should have received a copy of the GNU Lesser General Public License
++# version 3 along with OpenOffice.org.  If not, see
++# <http://www.openoffice.org/license.html>
++# for a copy of the LGPLv3 License.
++#
++#*************************************************************************
++
++UDK_3.1 {
++    global:
++		registerAllTestFunction;
++
++    local:
++        *;
++};
+diff -Nrup sd-m15/test/layouttest.cxx sd/test/layouttest.cxx
+--- sd-m15/test/layouttest.cxx	1969-12-31 16:00:00.000000000 -0800
++++ sd/test/layouttest.cxx	2009-07-18 23:21:36.000000000 -0700
+@@ -0,0 +1,271 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ * 
++ * Copyright 2008 by Sun Microsystems, Inc.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * $RCSfile: layouttest.cxx,v $
++ * $Revision: 1.14 $
++ *
++ * This file is part of OpenOffice.org.
++ *
++ * OpenOffice.org is free software: you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License version 3
++ * only, as published by the Free Software Foundation.
++ *
++ * OpenOffice.org is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ * GNU Lesser General Public License version 3 for more details
++ * (a copy is included in the LICENSE file that accompanied this code).
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * version 3 along with OpenOffice.org.  If not, see
++ * <http://www.openoffice.org/license.html>
++ * for a copy of the LGPLv3 License.
++ *
++ ************************************************************************/
++
++
++// MARKER(update_precomp.py): autogen include statement, do not remove
++#include "precompiled_sd.hxx"
++// autogenerated file with codegen.pl
++
++#include <cppunit/simpleheader.hxx>
++#include <com/sun/star/text/WritingMode.hpp>
++#include "layoutlist.hxx"
++
++using namespace sd;
++using namespace rtl;
++
++class LayoutTest : public CppUnit::TestFixture
++{
++public:
++    LayoutTest() {}
++
++    // initialise your test code values here.
++    void setUp()
++    {
++    }
++
++    void tearDown()
++    {
++    }
++
++    // insert your test code here.
++    void layoutTypeTest()
++    {
++		// test values;
++        LayoutType* aTestType = new LayoutType();
++		sal_uInt32 layout, listsize;
++
++		sal_Int32 kind;
++		bool vertical;
++		double fx, fy, ht, wt;
++		RectType rt;
++		WritingMode wm;
++		sal_uInt32 Hbitmap;
++		sal_uInt32 Lbitmap;
++		
++		ElemType* elem1 = new ElemType;
++		ElemType* elem2;
++		ElemType* elem3 = new ElemType;
++		ElemType* elem4 = new ElemType;
++		
++		LString name1(LString::CreateFromAscii("chart"));
++		LString name2;
++
++        // set and get name
++        aTestType->setName(name1);
++		name2 = aTestType->getName();
++        CPPUNIT_ASSERT_MESSAGE("getName/setName", name1 == name2);
++		aTestType->addElemToList(*elem1);
++				
++		// set and get layout number
++		aTestType->setLayoutNumber(1);
++		layout = aTestType->getLayoutNumber();
++		CPPUNIT_ASSERT_MESSAGE("getNumber/setNumber", layout == 1);
++		
++		// set and get kind of 1st element in list
++		aTestType->setKind(0,PRESOBJ_CHART);
++        kind = aTestType->getKind(0);
++		CPPUNIT_ASSERT_MESSAGE("getKind/setKind", PRESOBJ_CHART == kind);
++		
++		// set and get isvertical for 1st element
++		aTestType->setVertical(0,true);
++        vertical = aTestType->isVertical(0);
++		CPPUNIT_ASSERT_MESSAGE("setVertical/isVertical", vertical);
++		
++		// set and get writing mode for layout
++		aTestType->setWritingMode(WritingMode_LR_TB);
++		wm = aTestType->getWritingMode();
++		CPPUNIT_ASSERT_MESSAGE("setwritemode/getwritemode", WritingMode_LR_TB == wm);
++		
++		// set and get High Bitmap
++		aTestType->setHBitmapId(170);
++		Hbitmap = aTestType->getHBitmapId();
++		CPPUNIT_ASSERT_MESSAGE("setHbitmap/getHbitmap", 170 == Hbitmap);
++		
++		// set and get Low Bitmap
++	    aTestType->setLBitmapId(388);
++		Lbitmap = aTestType->getLBitmapId();
++		CPPUNIT_ASSERT_MESSAGE("setLbitmap/getLbitmap", 388 == Lbitmap);
++		
++		// set and get X factor
++		aTestType->setFactorX(0, .5);
++		fx = aTestType->factorX(0);
++		CPPUNIT_ASSERT_MESSAGE("setfactorx/getfactorx", .5 == fx);
++		
++		// set and get Y factor
++		aTestType->setFactorY(0, .75);
++		fy = aTestType->factorY(0);
++		CPPUNIT_ASSERT_MESSAGE("setfactory/getfactory", .75 == fy);
++		
++		// set and get Height factor
++		aTestType->setFactorHt(0, .84);
++		ht = aTestType->factorHt(0);
++		CPPUNIT_ASSERT_MESSAGE("setfactorht/getfactorht", .84 == ht);
++		
++		// set and get Width factor
++		aTestType->setFactorWt(0, 1.25);
++		wt = aTestType->factorWt(0);
++		CPPUNIT_ASSERT_MESSAGE("setfactorwt/getfactorwt", 1.25 == wt);
++		
++		// set and get rectangle type
++		aTestType->setRecttype(0, RT_TITLE);
++		rt = aTestType->recttype(0);
++		CPPUNIT_ASSERT_MESSAGE("setrecttype/getrecttype", RT_TITLE == rt);
++		
++		// set up some elements to add
++		elem3->kind = PRESOBJ_IMAGE;
++		elem4->kind = PRESOBJ_OBJECT;
++		
++		// get an element by its index in the list
++		elem2 = aTestType->getElemByIndex(0);
++		CPPUNIT_ASSERT_MESSAGE("addelem/getbyindex0",  elem1 == elem2);
++		
++		// add an element to the list (at the end)
++		aTestType->addElemToList(*elem3);
++		listsize = aTestType->length();
++		CPPUNIT_ASSERT_MESSAGE("addelem/listsize", listsize == 2);
++		
++        // get an element by index and check to see if equal
++		elem2 = aTestType->getElemByIndex(1);		
++		CPPUNIT_ASSERT_MESSAGE("addelem/getbyindex1",  elem3 == elem2);
++		
++		// test the creating of a default element
++		// get it and check to see if set to a title
++		aTestType->createDefaultElement();
++		elem2 = aTestType->getElemByIndex(2);
++		CPPUNIT_ASSERT_MESSAGE("createelement", ((elem2)&&(elem2->kind == PRESOBJ_TITLE)) );
++	
++    }
++	
++
++    // insert your test code here.
++    void layoutListTest()
++    {
++		
++        LayoutType* alayout1 = new LayoutType();
++		LayoutType* alayout3;
++		LayoutType* alayout2;
++        LayoutList* aTestList = new LayoutList();
++		Rectangle arect;
++		sal_uInt32 listsize, layoutcnt;
++		sal_uInt32 start_size = aTestList->length();
++		
++		// set up a LayoutType
++		alayout1->setLayoutNumber(1);
++		LString name1(LString::CreateFromAscii("ateststring"));
++		LString name2(LString::CreateFromAscii("anotherone")); 
++
++		alayout1->setName(name1);
++	
++		alayout1->createDefaultElement();
++		alayout1->createDefaultElement();
++		alayout1->setKind(1, PRESOBJ_OUTLINE);
++		
++		// add the layout to the list at menu index 0
++		aTestList->addLayout(alayout1, 0, PK_STANDARD);
++	    alayout2 = aTestList->getLayoutByName(name1);
++		CPPUNIT_ASSERT_MESSAGE("addlayout/getbyname",  alayout1 == alayout2);
++
++		// get the layout out of the list
++		alayout2 = aTestList->getLayoutByIndex(start_size);
++		CPPUNIT_ASSERT_MESSAGE("getbyindex", alayout2->getName() == name1);
++
++		
++		// make sure a layout with the same name can't be added
++		alayout3 = new LayoutType();
++		alayout3->setName(name1);
++
++		CPPUNIT_ASSERT_MESSAGE("insertsamename", !aTestList->addLayout(alayout3, 2, PK_STANDARD));
++		// make sure a layout with a different name can be added
++		alayout3->setName(name2);
++		
++		listsize = aTestList->length();
++		layoutcnt = aTestList->numberOfLayouts();
++		CPPUNIT_ASSERT_MESSAGE("insertdiffname", aTestList->addLayout(alayout3, 1, PK_STANDARD));
++		// check list size and number of layouts.
++		CPPUNIT_ASSERT_MESSAGE("listsize", (listsize+1) == aTestList->length());
++	    CPPUNIT_ASSERT_MESSAGE("remove/numberoflayouts", (layoutcnt+1) == aTestList->numberOfLayouts());
++
++		// remove a layout from the list (number of layouts
++		// should be different from size of list)
++		sal_uInt32 origsize = aTestList->length();
++		sal_uInt32 origcount = aTestList->numberOfLayouts();
++		
++		aTestList->removeLayoutFromList(name1);
++		layoutcnt = aTestList->numberOfLayouts();
++		CPPUNIT_ASSERT_MESSAGE("remove/numberoflayouts", layoutcnt == (origcount-1));
++		listsize = aTestList->length();
++		CPPUNIT_ASSERT_MESSAGE("remove/listlength", listsize == origsize);
++
++		// test inserting a layout's index in the menu list
++		alayout2 = aTestList->getLayoutAtMenuIndex(1, PK_STANDARD);
++	    CPPUNIT_ASSERT_MESSAGE("getLayatMenuidx", ((alayout2)&&(alayout2->getName() == alayout3->getName())) );
++	   
++	    // test the length of a menu list
++	    sal_uInt32 count = aTestList->getMenuLength(PK_HANDOUT);
++	    CPPUNIT_ASSERT_MESSAGE("getMenuLength", count = 6);
++		
++		// get a layout's index at the given menu index
++		// this is for layout3
++	    sal_uInt32 idx = aTestList->getMenuIndex(3, PK_STANDARD);
++		CPPUNIT_ASSERT_MESSAGE("getMenuIndex", idx = 1);
++	  
++	   //remove the layout from the menu
++	    aTestList->removeFromMenuList(1, PK_STANDARD);
++		CPPUNIT_ASSERT_MESSAGE("removeMenuIndex", idx = 1);
++	   
++	   // add a layout to the menu list
++	   aTestList->addToMenuList(0, 6, PK_STANDARD);
++	   CPPUNIT_ASSERT_MESSAGE("addtoMenu", idx = 1);
++	
++    }
++
++    // Change the following lines only, if you add, remove or rename 
++    // member functions of the current class, 
++    // because these macros are need by auto register mechanism.
++
++    CPPUNIT_TEST_SUITE(LayoutTest);
++    CPPUNIT_TEST(layoutListTest);
++    CPPUNIT_TEST(layoutTypeTest);
++    CPPUNIT_TEST_SUITE_END();
++	
++	
++	
++}; // class b2dvector
++
++// -----------------------------------------------------------------------------
++
++CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(LayoutTest, "layout test");
++
++// -----------------------------------------------------------------------------
++
++// this macro creates an empty function, which will called by the RegisterAllFunctions()
++// to let the user the possibility to also register some functions by hand.
++NOADDITIONAL;
++
+diff -Nrup sd-m15/test/makefile.mk sd/test/makefile.mk
+--- sd-m15/test/makefile.mk	1969-12-31 16:00:00.000000000 -0800
++++ sd/test/makefile.mk	2009-07-18 23:21:36.000000000 -0700
+@@ -0,0 +1,89 @@
++#*************************************************************************
++#
++# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++# 
++# Copyright 2008 by Sun Microsystems, Inc.
++#
++# OpenOffice.org - a multi-platform office productivity suite
++#
++# $RCSfile: makefile.mk,v $
++#
++# $Revision: 1.7 $
++#
++# This file is part of OpenOffice.org.
++#
++# OpenOffice.org is free software: you can redistribute it and/or modify
++# it under the terms of the GNU Lesser General Public License version 3
++# only, as published by the Free Software Foundation.
++#
++# OpenOffice.org is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++# GNU Lesser General Public License version 3 for more details
++# (a copy is included in the LICENSE file that accompanied this code).
++#
++# You should have received a copy of the GNU Lesser General Public License
++# version 3 along with OpenOffice.org.  If not, see
++# <http://www.openoffice.org/license.html>
++# for a copy of the LGPLv3 License.
++#
++#*************************************************************************
++
++PRJ=..
++
++PRJNAME=sd
++TARGET=tests
++
++ENABLE_EXCEPTIONS=TRUE
++
++# --- Settings -----------------------------------------------------
++
++.INCLUDE :  settings.mk
++
++# --- Common ----------------------------------------------------------
++
++SHL1OBJS=  \
++	$(SLO)$/layouttest.obj \
++	$(SLO)$/layoutlist.obj \
++	$(SLO)$/layouttype.obj
++
++# linking statically against sd parts
++#SHL1LIBS=$(SLB)$/core.lib
++
++SHL1TARGET= sd_tests
++SHL1STDLIBS= \
++                         $(CPPUHELPERLIB) \
++                         $(CPPULIB)       \
++                         $(CPPUNITLIB)    \
++                         $(TOOLSLIB)      \
++                         $(SALLIB)        \
++                         $(ISDLIB)        \
++                         $(SAXLIB)        \
++
++
++SHL1IMPLIB= i$(SHL1TARGET)
++
++DEF1NAME    =$(SHL1TARGET)
++SHL1VERSIONMAP = export.map 
++
++# END ------------------------------------------------------------------
++
++#------------------------------- All object files -------------------------------
++# do this here, so we get correct dependencies
++SLOFILES=$(SHL1OBJS) 
++
++# --- Targets ------------------------------------------------------
++
++.INCLUDE : target.mk
++.INCLUDE : _cppunit.mk 
++
++# --- Enable testshl2 execution in normal build ------------------------
++
++$(MISC)$/unittest_succeeded : $(SHL1TARGETN)
++		@echo ----------------------------------------------------------
++		@echo - start unit test on library $(SHL1TARGETN)
++		@echo ----------------------------------------------------------
++		testshl2 -sf $(mktmp ) -forward $(BIN)$/ $(SHL1TARGETN)
++		$(TOUCH) $@
++
++ALLTAR : $(MISC)$/unittest_succeeded
+diff -Nrup sd-m15/util/makefile.mk sd/util/makefile.mk
+--- sd-m15/util/makefile.mk	2009-07-15 21:39:04.000000000 -0700
++++ sd/util/makefile.mk	2009-07-18 23:21:36.000000000 -0700
+@@ -90,7 +90,8 @@ SHL1STDLIBS+= \
+ 	$(VOSLIB) \
+ 	$(CANVASLIB) \
+ 	$(SALLIB) \
+-	$(AVMEDIALIB)
++	$(AVMEDIALIB) \
++	$(SAXLIB)
+ 
+ SHL1LIBS= $(LIB3TARGET) $(LIB5TARGET) $(LIB6TARGET)
+ SHL1DEPN+=	makefile.mk


More information about the ooo-build-commit mailing list