From 07dccf031f07c6684f75df235df4a2113c2910ff Mon Sep 17 00:00:00 2001 From: Vishv Brahmbhatt Date: Thu, 8 Aug 2013 16:19:48 +0530 Subject: 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 --- sd/source/core/drawdoc.cxx | 4 +- sd/source/core/sdpage.cxx | 139 ++++++++++++++++++++++----------------------- sd/xml/layoutlist.xml | 74 ++++++++++++------------ 3 files changed, 109 insertions(+), 108 deletions(-) diff --git a/sd/source/core/drawdoc.cxx b/sd/source/core/drawdoc.cxx index d1c6bde6a770..97e3367270cf 100644 --- a/sd/source/core/drawdoc.cxx +++ b/sd/source/core/drawdoc.cxx @@ -76,6 +76,7 @@ #include #include #include +#include #include #include "drawdoc.hxx" @@ -1029,6 +1030,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; @@ -1054,7 +1056,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 c3316be80a79..5a9d3ece1033 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]); - if(propvalue[3]==1) - aLayoutPos.X() = sal_Int32(aLayoutPos.X() +(aLayoutSize.Width() * propvalue[2])); - else - aLayoutPos.Y() = sal_Int32(aLayoutPos.Y() + (aLayoutSize.Height() * propvalue[2])); + aLayoutPos.X() = sal_Int32(aLayoutPos.X() +(aLayoutSize.Width() * propvalue[2])); + aLayoutPos.Y() = sal_Int32(aLayoutPos.Y() + (aLayoutSize.Height() * propvalue[3])); rRectangle[count] = Rectangle (aLayoutPos, aLayoutSize); count=count+1; } @@ -1360,59 +1359,59 @@ static void CalcAutoLayoutRectangles( SdPage& rPage, int nLayout, Rectangle* rRe case 1: // title, 2 shapes case 9: // title, 2 vertical shapes - if( bRightToLeft && (nLayout != 9) ) - ::std::swap( rRectangle[1], rRectangle[2] ); + // 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); + // 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.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); + // 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(); - } + // 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); + // 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.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); + // 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( rRectangle[1].Left(), rRectangle[2].Left() ); - rRectangle[3].Left() = rRectangle[2].Left(); - } + // if( bRightToLeft ) + // { + // ::std::swap( 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); + // 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); + // aLayoutPos.Y() = long (aLayoutPos.Y() + aLayoutSize.Height() * 1.095); + // rRectangle[2] = Rectangle (aLayoutPos, aLayoutSize); break; case 5: // title, 2 shapes above shape @@ -1428,7 +1427,7 @@ static void CalcAutoLayoutRectangles( SdPage& rPage, int nLayout, Rectangle* rRe // aLayoutPos.Y() = long (aLayoutPos.Y() + aLayoutSize.Height() * 1.095); // aLayoutSize.Width() = long (aLayoutSize.Width() / 0.488); // rRectangle[3] = Rectangle (aLayoutPos, aLayoutSize); - // break; + break; case 6: // title, 4 shapes { // sal_uLong nX = long (aLayoutPos.X()); @@ -1445,7 +1444,7 @@ static void CalcAutoLayoutRectangles( SdPage& rPage, int nLayout, Rectangle* rRe // aLayoutPos.X() = nX; // rRectangle[4] = Rectangle (aLayoutPos, aLayoutSize); - // break; + break; } case 7: // vertical title, shape above shape { @@ -1491,26 +1490,26 @@ static void CalcAutoLayoutRectangles( SdPage& rPage, int nLayout, Rectangle* rRe } case 11: // title, 6 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.322); - rRectangle[1] = Rectangle (aLayoutPos, aLayoutSize); + // aLayoutSize.Height() = long (aLayoutSize.Height() * 0.477); + // aLayoutSize.Width() = long (aLayoutSize.Width() * 0.322); + // rRectangle[1] = Rectangle (aLayoutPos, aLayoutSize); - aLayoutPos.X() = long (nX + aLayoutSize.Width() * 1.05); - rRectangle[2] = Rectangle (aLayoutPos, aLayoutSize); + // aLayoutPos.X() = long (nX + aLayoutSize.Width() * 1.05); + // rRectangle[2] = Rectangle (aLayoutPos, aLayoutSize); - aLayoutPos.X() = long (nX + aLayoutSize.Width() * 2 * 1.05); - rRectangle[3] = Rectangle (aLayoutPos, aLayoutSize); + // aLayoutPos.X() = long (nX + aLayoutSize.Width() * 2 * 1.05); + // rRectangle[3] = Rectangle (aLayoutPos, aLayoutSize); - aLayoutPos.Y() = long (aLayoutPos.Y() + aLayoutSize.Height() * 1.095); - rRectangle[4] = Rectangle (aLayoutPos, aLayoutSize); + // aLayoutPos.Y() = long (aLayoutPos.Y() + aLayoutSize.Height() * 1.095); + // rRectangle[4] = Rectangle (aLayoutPos, aLayoutSize); - aLayoutPos.X() = long (nX + aLayoutSize.Width() * 1.05); - rRectangle[5] = Rectangle (aLayoutPos, aLayoutSize); + // aLayoutPos.X() = long (nX + aLayoutSize.Width() * 1.05); + // rRectangle[5] = Rectangle (aLayoutPos, aLayoutSize); - aLayoutPos.X() = nX; - rRectangle[6] = Rectangle (aLayoutPos, aLayoutSize); + // aLayoutPos.X() = nX; + // rRectangle[6] = Rectangle (aLayoutPos, aLayoutSize); break; } diff --git a/sd/xml/layoutlist.xml b/sd/xml/layoutlist.xml index c5ed26df819e..d02bf2acfa39 100644 --- a/sd/xml/layoutlist.xml +++ b/sd/xml/layoutlist.xml @@ -3,61 +3,61 @@ --> - - + + - - - - + + + + - - - + + + - - - - + + + + - - - - - + + + + + - + - + - - - - - - - + + + + + + + - - + + - - - - + + + + - - - - + + + + \ No newline at end of file -- cgit