[Libreoffice-commits] core.git: Branch 'feature/gsoc-impresslayout' - sd/source sd/xml test/user-template

2013-08-15 Thread Vishv Brahmbhatt
 sd/source/core/sdpage.cxx  |8 
 sd/xml/layoutlist.xml  |   92 
+-
 test/user-template/user/config/soffice.cfg/simpress/layoutlist.xml |   90 
+
 3 files changed, 104 insertions(+), 86 deletions(-)

New commits:
commit 820d186be8928265528ab6b2ec1ba00c9b7476ff
Author: Vishv Brahmbhatt 
Date:   Thu Aug 15 18:44:00 2013 +0530

Few name conventions changes.

Changed the name of attributes from "title-shape-relative-height" to 
"relative-height" & all others.

Change-Id: I3010e8faf8a9bf347a7bec366449bbba77f0a69f

diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx
index 2693375..9fd6b68 100644
--- a/sd/source/core/sdpage.cxx
+++ b/sd/source/core/sdpage.cxx
@@ -1317,19 +1317,19 @@ static void CalcAutoLayoutRectangles( SdPage& 
rPage,Rectangle* rRectangle ,const
 {
 Reference presObjAttributes = 
presobj->getAttributes();
 
-Reference presObjSizeHeight = 
presObjAttributes->getNamedItem("title-shape-relative-height");
+Reference presObjSizeHeight = 
presObjAttributes->getNamedItem("relative-height");
 rtl::OUString sValue = presObjSizeHeight->getNodeValue();
 propvalue[0] = sValue.toDouble();
 
-Reference presObjSizeWidth = 
presObjAttributes->getNamedItem("title-shape-relative-width");
+Reference presObjSizeWidth = 
presObjAttributes->getNamedItem("relative-width");
 sValue = presObjSizeWidth->getNodeValue();
 propvalue[1] = sValue.toDouble();
 
-Reference presObjPosX = 
presObjAttributes->getNamedItem("title-shape-relative-posX");
+Reference presObjPosX = 
presObjAttributes->getNamedItem("relative-posX");
 sValue = presObjPosX->getNodeValue();
 propvalue[2] = sValue.toDouble();
 
-Reference presObjPosY = 
presObjAttributes->getNamedItem("title-shape-relative-posY");
+Reference presObjPosY = 
presObjAttributes->getNamedItem("relative-posY");
 sValue = presObjPosY->getNodeValue();
 propvalue[3] = sValue.toDouble();
 
diff --git a/sd/xml/layoutlist.xml b/sd/xml/layoutlist.xml
index b99a18f..08328e9 100644
--- a/sd/xml/layoutlist.xml
+++ b/sd/xml/layoutlist.xml
@@ -3,79 +3,79 @@
 -->
 
 
-
-
+
+
 
 
-
-
-
+
+
+
 
 
-
-
-
+
+
+
 
 
-
-
-
-
+
+
+
+
 
 
-
-
-
-
-
+
+
+
+
+
 
 
-
+
 
 
-
+
 
 
-
-
-
-
-
-
-
+
+
+
+
+
+
+
 
 
-
-
+
+
 
 
-
-
-
-
+
+
+
+
 
 
-
-
-
-
+
+
+
+
 
 
-
-
+
+
 
 
-
-
-
+
+
+
 
 
-
-
+
+
 
 
-
-
-
+
+
+
 
 
\ No newline at end of file
diff --git a/test/user-template/user/config/soffice.cfg/simpress/layoutlist.xml 
b/test/user-template/user/config/soffice.cfg/simpress/layoutlist.xml
index d02bf2a..08328e9 100644
--- a/test/user-template/user/config/soffice.cfg/simpress/layoutlist.xml
+++ b/test/user-template/user/config/soffice.cfg/simpress/layoutlist.xml
@@ -3,61 +3,79 @@
 -->
 
 
-
-
+
+
 
 
-
-
-
+
+
+
 
 
-
-
-
+
+
+
 
 
-
-
-
-
+
+
+
+
 
 
-
-
-
-
-
+
+
+
+
+
 
 
-
+
 
 
-
+
 
 
-
-
-
-
-
-
-
+
+
+
+
+
+
+
 
 
-
-
+
+
 
 
-
-
-
-
+
+
+
+
 
 
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 
 
\ No newl

[Libreoffice-commits] core.git: Branch 'feature/gsoc-impresslayout' - sd/source sd/xml

2013-08-13 Thread Vishv Brahmbhatt
 sd/source/core/sdpage.cxx |  188 +++---
 sd/xml/layoutlist.xml |   20 
 2 files changed, 35 insertions(+), 173 deletions(-)

New commits:
commit 6276440a71ce779951bb2de8e544701dd1fbed6d
Author: Vishv Brahmbhatt 
Date:   Tue Aug 13 19:15:14 2013 +0530

Adding vertical layouts to XML file.

The new vertical layouts and the old layouts works well on my maschine.
Also the 'vertical writing' mode seems to be working perfectly for 
'vertical layouts'.
And removed the 'switch'case from the "sdpage.cxx".

Change-Id: Ic9f6af68cdeb635f79e67b959f95ac0a79c119ca

diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx
index d7b6f44..2693375 100644
--- a/sd/source/core/sdpage.cxx
+++ b/sd/source/core/sdpage.cxx
@@ -1197,9 +1197,6 @@ rtl::OUString enumtoString(AutoLayout aut)
 case AUTOLAYOUT_TITLE_CONTENT:
 retstr="AUTOLAYOUT_TITLE_CONTENT";
 break;
-case AUTOLAYOUT_TITLE_2VTEXT:
-retstr="AUTOLAYOUT_TITLE_2VTEXT";
-break;
 case AUTOLAYOUT_TITLE_CONTENT_OVER_CONTENT:
 retstr="AUTOLAYOUT_TITLE_CONTENT_OVER_CONTENT";
 break;
@@ -1230,6 +1227,18 @@ rtl::OUString enumtoString(AutoLayout aut)
 case AUTOLAYOUT_TITLE_2CONTENT:
 retstr="AUTOLAYOUT_TITLE_2CONTENT";
 break;
+case AUTOLAYOUT_VTITLE_VCONTENT:
+retstr="AUTOLAYOUT_VTITLE_VCONTENT";
+break;
+case AUTOLAYOUT_VTITLE_VCONTENT_OVER_VCONTENT:
+retstr="AUTOLAYOUT_VTITLE_VCONTENT_OVER_VCONTENT";
+break;
+case AUTOLAYOUT_TITLE_VCONTENT:
+retstr="AUTOLAYOUT_TITLE_VCONTENT";
+break;
+case AUTOLAYOUT_TITLE_2VTEXT:
+retstr="AUTOLAYOUT_TITLE_2VTEXT";
+break;
 default:
 retstr="unknown";
 break;
@@ -1238,7 +1247,7 @@ rtl::OUString enumtoString(AutoLayout aut)
 return retstr;
 }
 
-static void CalcAutoLayoutRectangles( SdPage& rPage, int nLayout, Rectangle* 
rRectangle ,const rtl::OUString& autolayout)
+static void CalcAutoLayoutRectangles( SdPage& rPage,Rectangle* rRectangle 
,const rtl::OUString& autolayout)
 {
 Rectangle aTitleRect;
 Rectangle aLayoutRect;
@@ -1283,10 +1292,9 @@ static void CalcAutoLayoutRectangles( SdPage& rPage, int 
nLayout, Rectangle* rRe
 SizeaTempSize;
 Point   aTempPnt;
 aTempSize = aLayoutSize;
-aTempPnt = aLayoutPos;
-sal_BoolbRightToLeft = ( rPage.GetModel() && static_cast< 
SdDrawDocument* >( rPage.GetModel() )->GetDefaultWritingMode() == 
::com::sun::star::text::WritingMode_RL_TB );
+aTempPnt  = aLayoutPos;
 
-std::vector>  &layoutinfo = static_cast< SdDrawDocument* 
>( rPage.GetModel() )->GetLayoutVector(); //getting vector from 
"SdDrawDocument" ,not sure about the correct mechanism
+const std::vector>  &layoutinfo = static_cast< 
SdDrawDocument* >( rPage.GetModel() )->GetLayoutVector(); //getting vector from 
"SdDrawDocument" ,not sure about the correct mechanism
 for(size_t y=0; y < layoutinfo.size(); y++) //loop through vector of Xnodes
 {
 Reference layoutnode = layoutinfo[y];  //get i'th layout 
element
@@ -1351,170 +1359,6 @@ static void CalcAutoLayoutRectangles( SdPage& rPage, 
int nLayout, Rectangle* rRe
 break;
 }
 }
-
-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
-
-// if( bRightToLeft && (nLayout != 9) )
-// ::std::swap( 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( 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

[Libreoffice-commits] core.git: Branch 'feature/gsoc-impresslayout' - sd/source sd/xml

2013-08-08 Thread Vishv Brahmbhatt
 sd/source/core/drawdoc.cxx |4 -
 sd/source/core/sdpage.cxx  |  139 ++---
 sd/xml/layoutlist.xml  |   74 +++
 3 files changed, 109 insertions(+), 108 deletions(-)

New commits:
commit e7220a786f9271114c2cfeb687cccfad780b8aed
Author: Vishv Brahmbhatt 
Date:   Thu Aug 8 16:19:48 2013 +0530

Making few changes to the parser logic.

The logical change seems to work perfectly,only few of the layouts involving
'vertical title' are left to be handled in the XML file.Also commenting out
some of the code in the switch case for temporary reference.It will
be deleted in the subsequent commit.

Change-Id: I491e414dec3dbd01d8566f23ab31096daa7bbfa8

diff --git a/sd/source/core/drawdoc.cxx b/sd/source/core/drawdoc.cxx
index dc631cf..68180f1 100644
--- a/sd/source/core/drawdoc.cxx
+++ b/sd/source/core/drawdoc.cxx
@@ -77,6 +77,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include "drawdoc.hxx"
@@ -1019,6 +1020,7 @@ Reference getRoot()
 xConfigProvider->createInstanceWithArguments(
 "com.sun.star.configuration.ConfigurationAccess",
 Sequence( &propValue, 1 ) ), UNO_QUERY_THROW );
+
 Sequence< rtl::OUString > aFiles;
 xNameAccess->getByName( "LayoutListFiles" ) >>= aFiles;
 rtl::OUString aURL;
@@ -1044,7 +1046,7 @@ Reference getRoot()
 aURL = aSysPath;
 }
 
-const Reference xDocBuilder( 
css::xml::dom::DocumentBuilder::create( comphelper::getComponentContext 
(xServiceFactory)) );
+const Reference xDocBuilder( 
css::xml::dom::DocumentBuilder::create( comphelper::getComponentContext 
(xServiceFactory) ) );
 const Reference xDoc = xDocBuilder->parseURI( aURL );
 const Reference xRoot = xDoc->getDocumentElement();
 return xRoot;  //this loops seems to work only once,so 
returning the root element
diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx
index f6cb6a0..d7b6f44 100644
--- a/sd/source/core/sdpage.cxx
+++ b/sd/source/core/sdpage.cxx
@@ -1227,6 +1227,9 @@ rtl::OUString enumtoString(AutoLayout aut)
 case AUTOLAYOUT_TITLE_2CONTENT_OVER_CONTENT:
 retstr="AUTOLAYOUT_TITLE_2CONTENT_OVER_CONTENT";
 break;
+case AUTOLAYOUT_TITLE_2CONTENT:
+retstr="AUTOLAYOUT_TITLE_2CONTENT";
+break;
 default:
 retstr="unknown";
 break;
@@ -1314,12 +1317,12 @@ static void CalcAutoLayoutRectangles( SdPage& rPage, 
int nLayout, Rectangle* rRe
 sValue = presObjSizeWidth->getNodeValue();
 propvalue[1] = sValue.toDouble();
 
-Reference presObjPos = 
presObjAttributes->getNamedItem("title-shape-relative-pos");
-sValue = presObjPos->getNodeValue();
+Reference presObjPosX = 
presObjAttributes->getNamedItem("title-shape-relative-posX");
+sValue = presObjPosX->getNodeValue();
 propvalue[2] = sValue.toDouble();
 
-Reference presObjBool = 
presObjAttributes->getNamedItem("boolx");
-sValue = presObjBool->getNodeValue();
+Reference presObjPosY = 
presObjAttributes->getNamedItem("title-shape-relative-posY");
+sValue = presObjPosY->getNodeValue();
 propvalue[3] = sValue.toDouble();
 
 if(count==0)
@@ -1327,23 +1330,19 @@ static void CalcAutoLayoutRectangles( SdPage& rPage, 
int nLayout, Rectangle* rRe
 Size aTitleSize ( aTitleRect.GetSize() );
 aTitleSize.Height() = sal_Int32(aTitleSize.Height() * 
propvalue[0]);
 aTitleSize.Width() = sal_Int32(aTitleSize.Width() * 
propvalue[1]);
-if(propvalue[3]==1)
-aTitlePos.X() = sal_Int32(aTitlePos.X() 
+(aTitleSize.Width() * propvalue[2]));
-else
-aTitlePos.Y() = sal_Int32(aTitlePos.Y() + 
(aTitleSize.Height() * propvalue[2]));
+aTitlePos.X() = sal_Int32(aTitlePos.X() 
+(aTitleSize.Width() * propvalue[2]));
+aTitlePos.Y() = sal_Int32(aTitlePos.Y() + 
(aTitleSize.Height() * propvalue[3]));
 rRectangle[count] = Rectangle (aTitlePos, aTitleSize);
 count = count+1;
 }
 else
 {
-aLayoutSize = aTempSize;//to regain fixed layout size
-aLayoutPos = aTempPnt;
+aLayoutSize = aTempSize; //to re-gain fixed layout size
+aLayoutPos = aTempPnt;  //to re-gain fixed layout pos
 aLayoutSize.Height() = sal_Int32(aLayoutSize.Height() 
* propvalue[0]);
 aLayoutSize.Width() = sal_Int32(aLayoutSize.Width() * 
propvalue[1]);

[Libreoffice-commits] core.git: Branch 'feature/gsoc-impresslayout' - sd/source sd/xml

2013-08-01 Thread Vishv Brahmbhatt
 sd/source/core/sdpage.cxx |   85 ++
 sd/xml/layoutlist.xml |   72 +++---
 2 files changed, 78 insertions(+), 79 deletions(-)

New commits:
commit 2a592701e57a7ff7ee257da72218c4cf973c8dc8
Author: Vishv Brahmbhatt 
Date:   Fri Aug 2 11:27:47 2013 +0530

Few changes to the logic of parsing

This changes are pushed for quick reference as there are some more changes
that are left to be done.

Change-Id: I8c79fa7730dcab9250bebe6bd84f49a8664e338d

diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx
index d070a3f..03837b3 100644
--- a/sd/source/core/sdpage.cxx
+++ b/sd/source/core/sdpage.cxx
@@ -1238,7 +1238,7 @@ Reference getRootElement()
 }
 
 //read the information from XML file(traversing from layout node)
-void readLayoutPropFromFile(const Reference& root, const 
rtl::OUString& sLayoutType, const rtl::OUString& sPresObjKind, sal_Int32 
propvalue[])
+void readLayoutPropFromFile(const Reference& root, const 
rtl::OUString& sLayoutType, const rtl::OUString& sPresObjKind, double 
propvalue[])
 {
 long presobjsize;
 long layoutlistsize;
@@ -1367,7 +1367,7 @@ static void CalcAutoLayoutRectangles( SdPage& rPage, int 
nLayout, Rectangle* rRe
 int presobjsize;
 rtl::OUString sLayoutAttName;
 rtl::OUString sPresObjKindAttName;
-sal_Int32 propvalue[4];
+double propvalue[4];
 
 if( rPage.GetPageKind() != PK_HANDOUT )
 {
@@ -1406,7 +1406,8 @@ static void CalcAutoLayoutRectangles( SdPage& rPage, int 
nLayout, Rectangle* rRe
 Point   aLayoutPos( aLayoutRect.TopLeft() );
 SizeaTempSize;
 Point   aTempPnt;
-
+aTempSize = aLayoutSize;
+aTempPnt = aLayoutPos;
 sal_BoolbRightToLeft = ( rPage.GetModel() && static_cast< 
SdDrawDocument* >( rPage.GetModel() )->GetDefaultWritingMode() == 
::com::sun::star::text::WritingMode_RL_TB );
 
 parseXml(); //calling this for temporary reference,have to use it 
somewhere else.
@@ -1432,28 +1433,47 @@ static void CalcAutoLayoutRectangles( SdPage& rPage, 
int nLayout, Rectangle* rRe
 {
 Reference presObjAttributes = 
presobj->getAttributes();
 
-Reference presObjPosX = 
presObjAttributes->getNamedItem("layout-pos-x");
-rtl::OUString sValue = presObjPosX->getNodeValue();
-propvalue[0] = sValue.toInt32();
+Reference presObjSizeHeight = 
presObjAttributes->getNamedItem("title-shape-relative-height");
+rtl::OUString sValue = presObjSizeHeight->getNodeValue();
+propvalue[0] = sValue.toDouble();
+
+Reference presObjSizeWidth = 
presObjAttributes->getNamedItem("title-shape-relative-width");
+sValue = presObjSizeWidth->getNodeValue();
+propvalue[1] = sValue.toDouble();
 
-Reference presObjPosY = 
presObjAttributes->getNamedItem("layout-pos-y");
-sValue = presObjPosY->getNodeValue();
-propvalue[1] = sValue.toInt32();
+Reference presObjPos = 
presObjAttributes->getNamedItem("title-shape-relative-pos");
+sValue = presObjPos->getNodeValue();
+propvalue[2] = sValue.toDouble();
 
-Reference presObjSizeHeight = 
presObjAttributes->getNamedItem("layout-size-height");
-sValue = presObjSizeHeight->getNodeValue();
-propvalue[2] = sValue.toInt32();
+Reference presObjBool = 
presObjAttributes->getNamedItem("boolx");
+sValue = presObjBool->getNodeValue();
+propvalue[3] = sValue.toDouble();
 
-Reference presObjSizeWidth = 
presObjAttributes->getNamedItem("layout-size-width");
-sValue = presObjSizeWidth->getNodeValue();
-propvalue[3] = sValue.toInt32();
-
-aLayoutPos.X() = propvalue[0];
-aLayoutPos.Y() = propvalue[1];
-aLayoutSize.Height() = propvalue[2];
-aLayoutSize.Width() = propvalue[3];
-rRectangle[count] = Rectangle (aLayoutPos, aLayoutSize);
-count=count+1;
+if(count==0)
+{
+Size aTitleSize ( aTitleRect.GetSize() );
+aTitleSize.Height() = sal_Int32(aTitleSize.Height() * 
propvalue[0]);
+aTitleSize.Width() = sal_Int32(aTitleSize.Width() * 
propvalue[1]);
+if(propvalue[3]==1)
+aTitlePos.X() = sal_Int32(aTitlePos.X() 
+(aTitleSize.Width() * propvalue[2]));
+else
+aTitlePos.Y() = sal_Int32(aTitlePos.Y() + 
(aTitleSize.Height() * propvalue[2]));
+rRectangle

[Libreoffice-commits] core.git: Branch 'feature/gsoc-impresslayout' - sd/source sd/xml

2013-07-28 Thread Vishv Brahmbhatt
 sd/source/core/sdpage.cxx |   18 
 sd/xml/layoutlist.xml |   49 +-
 2 files changed, 58 insertions(+), 9 deletions(-)

New commits:
commit e187f3a747033f8efc71699434ab46a5a07b4077
Author: Vishv Brahmbhatt 
Date:   Sun Jul 28 21:50:34 2013 +0530

Added few more new samples to "layoutlist.xml"

New samples are added to "layoutlist.xml" and corresponding changes are 
made in the "sdpage.cxx".
Few changes are still left to be made in the values,which will be done in 
the next commit.

Change-Id: Ia388f416906f4416ec596ae4631a51940e6ccf93

diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx
index c244da6..a7d4b51 100644
--- a/sd/source/core/sdpage.cxx
+++ b/sd/source/core/sdpage.cxx
@@ -1321,6 +1321,24 @@ rtl::OUString enumtoString(AutoLayout aut)
 case AUTOLAYOUT_TITLE_4CONTENT:
 retstr="AUTOLAYOUT_TITLE_4CONTENT";
 break;
+case AUTOLAYOUT_ONLY_TEXT:
+retstr="AUTOLAYOUT_ONLY_TEXT";
+break;
+case AUTOLAYOUT_TITLE_ONLY:
+retstr="AUTOLAYOUT_TITLE_ONLY";
+break;
+case AUTOLAYOUT_TITLE_6CONTENT:
+retstr="AUTOLAYOUT_TITLE_6CONTENT";
+break;
+case AUTOLAYOUT__START:
+retstr="AUTOLAYOUT__START";
+break;
+case AUTOLAYOUT_TITLE_2CONTENT_CONTENT:
+retstr="AUTOLAYOUT_TITLE_2CONTENT_CONTENT";
+break;
+case AUTOLAYOUT_TITLE_2CONTENT_OVER_CONTENT:
+retstr="AUTOLAYOUT_TITLE_2CONTENT_OVER_CONTENT";
+break;
 default:
 retstr="unknown";
 break;
diff --git a/sd/xml/layoutlist.xml b/sd/xml/layoutlist.xml
index 88ec811..82424b0 100644
--- a/sd/xml/layoutlist.xml
+++ b/sd/xml/layoutlist.xml
@@ -3,30 +3,61 @@
 -->
 
 
-
-
+
+
 
 
-
+
 
 
 
 
-
+
 
 
 
 
-
-
-
-
+
+
+
+
 
 
-
+
 
 
 
 
 
+
+
+ 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 
\ No newline at end of file
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'feature/gsoc-impresslayout' - sd/source sd/xml

2013-07-28 Thread Vishv Brahmbhatt
 sd/source/core/sdpage.cxx |  108 +-
 sd/xml/layoutlist.xml |2 
 2 files changed, 60 insertions(+), 50 deletions(-)

New commits:
commit 57866f97931e789b33e650d1c2bf81afe1a6ed11
Author: Vishv Brahmbhatt 
Date:   Sun Jul 28 12:33:45 2013 +0530

Changed the logic of parsing

Have added a vector list of XNode to store the parse XML and referring it 
instead of XML eveytime.
Need to make scope level changes for vector and parseXml() in the next 
commit.

Change-Id: I2f270fc18058772fbf30a2a44e564c8290c316c4

diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx
index 0aace256..c244da6 100644
--- a/sd/source/core/sdpage.cxx
+++ b/sd/source/core/sdpage.cxx
@@ -1117,6 +1117,7 @@ Rectangle SdPage::GetLayoutRect() const
 const int MAX_PRESOBJS = 7; // maximum number of presentation objects per 
layout
 const int VERTICAL = 0x8000;
 const int PRESOBJPROP = 4;
+std::vector> layoutinfo; //temporarily at global scope
 
 struct LayoutDescriptor
 {
@@ -1317,6 +1318,9 @@ rtl::OUString enumtoString(AutoLayout aut)
 case AUTOLAYOUT_TITLE_CONTENT_2CONTENT:
 retstr="AUTOLAYOUT_TITLE_CONTENT_2CONTENT";
 break;
+case AUTOLAYOUT_TITLE_4CONTENT:
+retstr="AUTOLAYOUT_TITLE_4CONTENT";
+break;
 default:
 retstr="unknown";
 break;
@@ -1325,6 +1329,19 @@ rtl::OUString enumtoString(AutoLayout aut)
 return retstr;
 }
 
+void parseXml()
+{
+int layoutlistsize;
+const Reference root= getRootElement();//get the root element of 
my xml file
+const Reference layoutlist = 
root->getElementsByTagName("layout");
+layoutlistsize=layoutlist->getLength();
+for( long index=0; index layoutnode = layoutlist->item(index);  //get i'th 
layout element
+layoutinfo.push_back(layoutnode);
+}
+}
+
 static void CalcAutoLayoutRectangles( SdPage& rPage, int nLayout, Rectangle* 
rRectangle ,const rtl::OUString& autolayout)
 {
 Rectangle aTitleRect;
@@ -1333,7 +1350,6 @@ static void CalcAutoLayoutRectangles( SdPage& rPage, int 
nLayout, Rectangle* rRe
 long layoutlistsize;
 rtl::OUString sLayoutAttName;
 rtl::OUString sPresObjKindAttName;
-bool bnoprop=true;   //use it to skip the remaining loop 
,once propvalue is obtained
 double propvalue[4];
 
 if( rPage.GetPageKind() != PK_HANDOUT )
@@ -1376,61 +1392,55 @@ static void CalcAutoLayoutRectangles( SdPage& rPage, 
int nLayout, Rectangle* rRe
 
 sal_BoolbRightToLeft = ( rPage.GetModel() && static_cast< 
SdDrawDocument* >( rPage.GetModel() )->GetDefaultWritingMode() == 
::com::sun::star::text::WritingMode_RL_TB );
 
-const Reference layoutlist = 
root->getElementsByTagName("layout");
-layoutlistsize=layoutlist->getLength();
-rtl::OUString sLayoutType = autolayout;
-for( long index=0; index layoutnode = layoutlist->item(index);  //get 
i'th layout element
-Reference layoutattrlist 
=layoutnode->getAttributes();
-Reference layoutattr = layoutattrlist->getNamedItem("type");
-sLayoutAttName=layoutattr->getNodeValue();  //get the 
attribute value of layout(i.e it's type)
+Reference layoutnode = layoutinfo[y];  //get i'th layout 
element
+Reference layoutattrlist =layoutnode->getAttributes();
+Reference layoutattr = layoutattrlist->getNamedItem("type");
+sLayoutAttName=layoutattr->getNodeValue();  //get the 
attribute value of layout(i.e it's type)
+rtl::OUString sLayoutType = autolayout;
 
-if(sLayoutAttName==sLayoutType)
+if(sLayoutAttName==sLayoutType)
+{
+int count=0;
+Reference layoutchildrens = layoutnode->getChildNodes();
+presobjsize = layoutchildrens->getLength(); //get the 
length of that of the layout(number of pres objects)
+for( long j=0; j< presobjsize ; j++)
 {
-Reference layoutchildrens = 
layoutnode->getChildNodes();
-presobjsize = layoutchildrens->getLength(); //get the 
length of that of the layout(number of pres objects)
-for( long j=1; j< presobjsize ; j++)
+rtl::OUString nodename;
+Reference presobj = layoutchildrens->item(j);//get 
the j'th presobj for that layout
+nodename=presobj->getNodeName();
+if(nodename=="presobj")//check whether children is blank 
'text-node' or 'presobj' node
 {
-rtl::OUString nodename;
-Reference presobj = layoutchildrens->item(j);
//get the j'th presobj for that layout
-nodename=presobj->getNodeName();
-if(nodename=="presobj")//check whether children is blank 
'text-node' or 'presobj' node
-{
-Reference presObjAttributes = 
presobj->getAttribute

[Libreoffice-commits] core.git: Branch 'feature/gsoc-impresslayout' - sd/source sd/xml test/user-template

2013-07-22 Thread Vishv Brahmbhatt
 sd/source/core/sdpage.cxx  |   46 
+-
 sd/xml/layoutlist.xml  |   32 
+-
 test/user-template/user/config/soffice.cfg/simpress/layoutlist.xml |   32 
+-
 3 files changed, 79 insertions(+), 31 deletions(-)

New commits:
commit e283e81165914c337815227bb3f91e2e9bc11ef4
Author: Vishv Brahmbhatt 
Date:   Mon Jul 22 20:01:24 2013 +0530

Solved the identation problem related to "layoutlist.xml".

Have added a 'if' conditional statement to know whether layout's child is a 
empty 'text' node or 'presobj' node.And proceed with rest of the
things ,if it is a 'presobj' node.Also the xml files are indented.

Change-Id: I676e710b86b1f50dbd861f2cb180bf9be839b867

diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx
index 051cadc..ecd481f 100644
--- a/sd/source/core/sdpage.cxx
+++ b/sd/source/core/sdpage.cxx
@@ -1261,30 +1261,34 @@ void readLayoutPropFromFile(const Reference& 
root, const rtl::OUString
 Reference layoutchildrens = 
layoutnode->getChildNodes();
 presobjsize = layoutchildrens->getLength(); //get the 
length of that of the layout(number of pres objects)
 for( long j=0; j< presobjsize ; j++)
-{
+{   rtl::OUString nodename;
 Reference presobj = layoutchildrens->item(j);
//get the j'th presobj for that layout
-Reference presObjAttributes = 
presobj->getAttributes();
-Reference presObjKindAttr = 
presObjAttributes->getNamedItem("kind");
-sPresObjKindAttName = presObjKindAttr->getNodeValue();  
//get the value of it's presobj kind
-if(sPresObjKindAttName==sPresObjKind)
+nodename=presobj->getNodeName();
+if(nodename=="presobj")//check whether children is blank 
'text-node' or 'presobj' node
 {
-Reference presObjPosX = 
presObjAttributes->getNamedItem("layout-pos-x");
-rtl::OUString sValue = presObjPosX->getNodeValue();
-propvalue[0] = sValue.toDouble();
-Reference presObjPosY = 
presObjAttributes->getNamedItem("layout-pos-y");
-sValue = presObjPosY->getNodeValue();
-propvalue[1] = sValue.toDouble();
-Reference presObjSizeHeight = 
presObjAttributes->getNamedItem("layout-size-height");
-sValue = presObjSizeHeight->getNodeValue();
-propvalue[2] = sValue.toDouble();
-Reference presObjSizeWidth = 
presObjAttributes->getNamedItem("layout-size-width");
-sValue = presObjSizeWidth->getNodeValue();
-propvalue[3] = sValue.toDouble();
-bnoprop=false;
-break;
+Reference presObjAttributes = 
presobj->getAttributes();
+Reference presObjKindAttr = 
presObjAttributes->getNamedItem("kind");
+sPresObjKindAttName = presObjKindAttr->getNodeValue(); 
 //get the value of it's presobj kind
+if(sPresObjKindAttName==sPresObjKind)
+{
+Reference presObjPosX = 
presObjAttributes->getNamedItem("layout-pos-x");
+rtl::OUString sValue = presObjPosX->getNodeValue();
+propvalue[0] = sValue.toDouble();
+Reference presObjPosY = 
presObjAttributes->getNamedItem("layout-pos-y");
+sValue = presObjPosY->getNodeValue();
+propvalue[1] = sValue.toDouble();
+Reference presObjSizeHeight = 
presObjAttributes->getNamedItem("layout-size-height");
+sValue = presObjSizeHeight->getNodeValue();
+propvalue[2] = sValue.toDouble();
+Reference presObjSizeWidth = 
presObjAttributes->getNamedItem("layout-size-width");
+sValue = presObjSizeWidth->getNodeValue();
+propvalue[3] = sValue.toDouble();
+bnoprop=false;
+break;
+}
+else
+continue;
 }
-else
-continue;
 }
 }
 else
diff --git a/sd/xml/layoutlist.xml b/sd/xml/layoutlist.xml
index 6695c53..cfe1f1e 100644
--- a/sd/xml/layoutlist.xml
+++ b/sd/xml/layoutlist.xml
@@ -2,9 +2,31 @@
 
 
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+   

[Libreoffice-commits] core.git: Branch 'feature/gsoc-impresslayout' - sd/source sd/xml test/user-template

2013-07-10 Thread Vishv Brahmbhatt
 sd/source/core/sdpage.cxx  |   75 
--
 sd/xml/layoutlist.xml  |2 
 test/user-template/user/config/soffice.cfg/simpress/layoutlist.xml |2 
 3 files changed, 66 insertions(+), 13 deletions(-)

New commits:
commit 04f7fafadcda40d35b92aa580984e2bc7da03dbb
Author: Vishv Brahmbhatt 
Date:   Wed Jul 10 20:25:43 2013 +0530

Adding new Slide Layouts Samples to "layoutlist.xml".

Have added new "Slide Layouts" samples.So commented out the code related to 
existing slide layouts in "sdpage.cxx" and also added some code
for XML parsing of the new layouts.

Change-Id: I8f5fdcab5f2eb41e37fa522a7801b388cbfefed5

diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx
index 96961a0..051cadc 100644
--- a/sd/source/core/sdpage.cxx
+++ b/sd/source/core/sdpage.cxx
@@ -1417,34 +1417,83 @@ static void CalcAutoLayoutRectangles( SdPage& rPage, 
int nLayout, Rectangle* rRe
 break;
 
 case 5: // title, 2 shapes above shape
-aLayoutSize.Height() = long (aLayoutSize.Height() * 0.477);
-aLayoutSize.Width() = long (aLayoutSize.Width() * 0.488);
+// 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;
+readLayoutPropFromFile(root, "AUTOLAYOUT_TITLE_CONTENT_2CONTENT" 
,"PRESOBJ_OUTLINE1" ,propvalue);
+aLayoutPos.X() = propvalue[0];
+aLayoutPos.Y() = propvalue[1];
+aLayoutSize.Height() = propvalue[2];
+aLayoutSize.Width() = propvalue[3];
 rRectangle[1] = Rectangle (aLayoutPos, aLayoutSize);
 
-aTempPnt = aLayoutPos;
-aLayoutPos.X() = long (aLayoutPos.X() + aLayoutSize.Width() * 1.05);
+readLayoutPropFromFile(root, "AUTOLAYOUT_TITLE_CONTENT_2CONTENT" 
,"PRESOBJ_OUTLINE2" ,propvalue);
+aLayoutPos.X() = propvalue[0];
+aLayoutPos.Y() = propvalue[1];
+aLayoutSize.Height() = propvalue[2];
+aLayoutSize.Width() = propvalue[3];
 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);
+readLayoutPropFromFile(root, "AUTOLAYOUT_TITLE_CONTENT_2CONTENT" 
,"PRESOBJ_OUTLINE3" ,propvalue);
+aLayoutPos.X() = propvalue[0];
+aLayoutPos.Y() = propvalue[1];
+aLayoutSize.Height() = propvalue[2];
+aLayoutSize.Width() = propvalue[3];
 rRectangle[3] = Rectangle (aLayoutPos, aLayoutSize);
 break;
 case 6: // title, 4 shapes
 {
-sal_uLong nX = long (aLayoutPos.X());
+// sal_uLong nX = long (aLayoutPos.X());
 
-aLayoutSize.Height() = long (aLayoutSize.Height() * 0.477);
-aLayoutSize.Width()  = long (aLayoutSize.Width() * 0.488);
+// 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;
+readLayoutPropFromFile(root, "AUTOLAYOUT_TITLE_4SCONTENT" 
,"PRESOBJ_OUTLINE1" ,propvalue);
+aLayoutPos.X() = propvalue[0];
+aLayoutPos.Y() = propvalue[1];
+aLayoutSize.Height() = propvalue[2];
+aLayoutSize.Width() = propvalue[3];
 rRectangle[1] = Rectangle (aLayoutPos, aLayoutSize);
 
-aLayoutPos.X() = long (nX + aLayoutSize.Width() * 1.05);
+readLayoutPropFromFile(root, "AUTOLAYOUT_TITLE_4SCONTENT" 
,"PRESOBJ_OUTLINE2" ,propvalue);
+aLayoutPos.X() = propvalue[0];
+aLayoutPos.Y() = propvalue[1];
+aLayoutSize.Height() = propvalue[2];
+aLayoutSize.Width() = propvalue[3];
 rRectangle[2] = Rectangle (aLayoutPos, aLayoutSize);
 
-aLayoutPos.Y() = long (aLayoutPos.Y() + aLayoutSize.Height() * 1.095);
+readLayoutPropFromFile(root, "AUTOLAYOUT_TITLE_4SCONTENT" 
,"PRESOBJ_OUTLIN