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 <vishvbrahmbhat...@gmail.com> 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<XElement> getRootElement() } //read the information from XML file(traversing from layout node) -void readLayoutPropFromFile(const Reference<XElement>& root, const rtl::OUString& sLayoutType, const rtl::OUString& sPresObjKind, sal_Int32 propvalue[]) +void readLayoutPropFromFile(const Reference<XElement>& 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() ); Size aTempSize; Point aTempPnt; - + aTempSize = aLayoutSize; + aTempPnt = aLayoutPos; sal_Bool bRightToLeft = ( 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<XNamedNodeMap> presObjAttributes = presobj->getAttributes(); - Reference<XNode> presObjPosX = presObjAttributes->getNamedItem("layout-pos-x"); - rtl::OUString sValue = presObjPosX->getNodeValue(); - propvalue[0] = sValue.toInt32(); + Reference<XNode> presObjSizeHeight = presObjAttributes->getNamedItem("title-shape-relative-height"); + rtl::OUString sValue = presObjSizeHeight->getNodeValue(); + propvalue[0] = sValue.toDouble(); + + Reference<XNode> presObjSizeWidth = presObjAttributes->getNamedItem("title-shape-relative-width"); + sValue = presObjSizeWidth->getNodeValue(); + propvalue[1] = sValue.toDouble(); - Reference<XNode> presObjPosY = presObjAttributes->getNamedItem("layout-pos-y"); - sValue = presObjPosY->getNodeValue(); - propvalue[1] = sValue.toInt32(); + Reference<XNode> presObjPos = presObjAttributes->getNamedItem("title-shape-relative-pos"); + sValue = presObjPos->getNodeValue(); + propvalue[2] = sValue.toDouble(); - Reference<XNode> presObjSizeHeight = presObjAttributes->getNamedItem("layout-size-height"); - sValue = presObjSizeHeight->getNodeValue(); - propvalue[2] = sValue.toInt32(); + Reference<XNode> presObjBool = presObjAttributes->getNamedItem("boolx"); + sValue = presObjBool->getNodeValue(); + propvalue[3] = sValue.toDouble(); - Reference<XNode> 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[count] = Rectangle (aTitlePos, aTitleSize); + count = count+1; + } + else + { + aLayoutSize = aTempSize;//to regain fixed layout size + aLayoutPos = aTempPnt; + 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])); + rRectangle[count] = Rectangle (aLayoutPos, aLayoutSize); + count=count+1; + } } } break; @@ -1549,27 +1569,6 @@ static void CalcAutoLayoutRectangles( SdPage& rPage, int nLayout, Rectangle* rRe // 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); - - 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); - - 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()); diff --git a/sd/xml/layoutlist.xml b/sd/xml/layoutlist.xml index 727e5a8..c5ed26d 100644 --- a/sd/xml/layoutlist.xml +++ b/sd/xml/layoutlist.xml @@ -3,61 +3,61 @@ --> <layout-list> <layout type="AUTOLAYOUT_TITLE_CONTENT"> - <presobj kind="PRESOBJ_TITLE" layout-pos-x="1400" layout-pos-y="837" layout-size-height="3507" layout-size-width="25200"/> - <presobj kind="PRESOBJ_OUTLINE1" layout-pos-x="1400" layout-pos-y="4914" layout-size-height="12297" layout-size-width="25600"/> + <presobj kind="PRESOBJ_TITLE" title-shape-relative-height="1" title-shape-relative-width="1" title-shape-relative-pos="0" boolx="1"/> + <presobj kind="PRESOBJ_OUTLINE1" title-shape-relative-height="0.477" title-shape-relative-width="0.488" title-shape-relative-pos="1.05" boolx="1"/> </layout> <layout type="AUTOLAYOUT_TITLE_2VTEXT"> - <presobj kind="PRESOBJ_TITLE" layout-pos-x="1400" layout-pos-y="837" layout-size-height="3507" layout-size-width="25200"/> - <presobj kind="PRESOBJ_OUTLINE1" layout-pos-x="1400" layout-pos-y="4914" layout-size-height="12297" layout-size-width="12180"/> - <presobj kind="PRESOBJ_OUTLINE2" layout-pos-x="14311" layout-pos-y="4914" layout-size-height="12297" layout-size-width="12180"/> + <presobj kind="PRESOBJ_TITLE" title-shape-relative-height="1" title-shape-relative-width="1" title-shape-relative-pos="0" boolx="1"/> + <presobj kind="PRESOBJ_OUTLINE1" title-shape-relative-height="1" title-shape-relative-width="0.488" title-shape-relative-pos="0" boolx="1"/> + <presobj kind="PRESOBJ_OUTLINE2" title-shape-relative-height="1" title-shape-relative-width="0.488" title-shape-relative-pos="1.05" boolx="1"/> </layout> <layout type="AUTOLAYOUT_TITLE_CONTENT_OVER_CONTENT"> - <presobj kind="PRESOBJ_TITLE" layout-pos-x="1400" layout-pos-y="837" layout-size-height="3507" layout-size-width="25200"/> - <presobj kind="PRESOBJ_OUTLINE1" layout-pos-x="1400" layout-pos-y="4914" layout-size-height="25200" layout-size-width="5809"/> - <presobj kind="PRESOBJ_OUTLINE2" layout-pos-x="1400" layout-pos-y="11274" layout-size-height="25200" layout-size-width="5809"/> + <presobj kind="PRESOBJ_TITLE" title-shape-relative-height="1" title-shape-relative-width="1" title-shape-relative-pos="0" boolx="1"/> + <presobj kind="PRESOBJ_OUTLINE1" title-shape-relative-height="0.477" title-shape-relative-width="1" title-shape-relative-pos="0" boolx="1"/> + <presobj kind="PRESOBJ_OUTLINE2" title-shape-relative-height="0.477" title-shape-relative-width="1" title-shape-relative-pos="1.095" boolx="0"/> </layout> <layout type="AUTOLAYOUT_TITLE_CONTENT_2CONTENT"> - <presobj kind="PRESOBJ_TITLE" layout-pos-x="1400" layout-pos-y="837" layout-size-height="3507" layout-size-width="25200"/> - <presobj kind="PRESOBJ_OUTLINE1" layout-pos-x="1400" layout-pos-y="4914" layout-size-height="12180" layout-size-width="12297"/> - <presobj kind="PRESOBJ_OUTLINE2" layout-pos-x="14311" layout-pos-y="4914" layout-size-height="5809" layout-size-width="12297"/> - <presobj kind="PRESOBJ_OUTLINE3" layout-pos-x="14311" layout-pos-y="11274" layout-size-height="5809" layout-size-width="12297"/> + <presobj kind="PRESOBJ_TITLE" title-shape-relative-height="1" title-shape-relative-width="1" title-shape-relative-pos="0" boolx="1"/> + <presobj kind="PRESOBJ_OUTLINE1" title-shape-relative-height="1" title-shape-relative-width="0.488" title-shape-relative-pos="0" boolx="1"/> + <presobj kind="PRESOBJ_OUTLINE2" title-shape-relative-height="0.477" title-shape-relative-width="0.488" title-shape-relative-pos="1.095" boolx="0"/> + <presobj kind="PRESOBJ_OUTLINE3" title-shape-relative-height="0.477" title-shape-relative-width="0.488" title-shape-relative-pos="1.05" boolx="1"/> </layout> <layout type="AUTOLAYOUT_TITLE_4CONTENT"> - <presobj kind="PRESOBJ_TITLE" layout-pos-x="1400" layout-pos-y="837" layout-size-height="3507" layout-size-width="25200"/> - <presobj kind="PRESOBJ_OUTLINE1" layout-pos-x="1400" layout-pos-y="4914" layout-size-height="12180" layout-size-width="25200"/> - <presobj kind="PRESOBJ_OUTLINE2" layout-pos-x="1400" layout-pos-y="4914" layout-size-height="12180" layout-size-width="25200"/> - <presobj kind="PRESOBJ_OUTLINE3" layout-pos-x="1400" layout-pos-y="4914" layout-size-height="12180" layout-size-width="25200"/> - <presobj kind="PRESOBJ_OUTLINE4" layout-pos-x="1400" layout-pos-y="4914" layout-size-height="12180" layout-size-width="25200"/> + <presobj kind="PRESOBJ_TITLE" title-shape-relative-height="1" title-shape-relative-width="1" title-shape-relative-pos="0" boolx="1"/> + <presobj kind="PRESOBJ_OUTLINE1" title-shape-relative-height="0.477" title-shape-relative-width="0.488" title-shape-relative-pos="0" boolx="1"/> + <presobj kind="PRESOBJ_OUTLINE2" title-shape-relative-height="0.477" title-shape-relative-width="0.488" title-shape-relative-pos="1.05" boolx="1"/> + <presobj kind="PRESOBJ_OUTLINE3" title-shape-relative-height="0.477" title-shape-relative-width="0.488" title-shape-relative-pos="1.095" boolx="0"/> + <presobj kind="PRESOBJ_OUTLINE4" title-shape-relative-height="0.477" title-shape-relative-width="0.488" title-shape-relative-pos="1.095" boolx="0"/> </layout> <layout type="AUTOLAYOUT_ONLY_TEXT"> - <presobj kind="PRESOBJ_OUTLINE1" layout-pos-x="1400" layout-pos-y="837" layout-size-height="25200" layout-size-width="16256"/> + <presobj kind="PRESOBJ_OUTLINE1" title-shape-relative-height="1" title-shape-relative-width="1" title-shape-relative-pos="0" boolx="1"/> </layout> <layout type="AUTOLAYOUT_TITLE_ONLY"> - <presobj kind="PRESOBJ_TITLE" layout-pos-x="1400" layout-pos-y="837" layout-size-height="3507" layout-size-width="25200"/> + <presobj kind="PRESOBJ_TITLE" title-shape-relative-height="1" title-shape-relative-width="1" title-shape-relative-pos="0" boolx="1"/> </layout> <layout type="AUTOLAYOUT_TITLE_6CONTENT"> - <presobj kind="PRESOBJ_TITLE" layout-pos-x="1400" layout-pos-y="837" layout-size-height="3507" layout-size-width="25200"/> - <presobj kind="PRESOBJ_OUTLINE1" layout-pos-x="1400" layout-pos-y="4914" layout-size-height="5809" layout-size-width="8114"/> - <presobj kind="PRESOBJ_OUTLINE2" layout-pos-x="9919" layout-pos-y="4914" layout-size-height="5809" layout-size-width="8114"/> - <presobj kind="PRESOBJ_OUTLINE3" layout-pos-x="18439" layout-pos-y="4914" layout-size-height="5809" layout-size-width="8114"/> - <presobj kind="PRESOBJ_OUTLINE4" layout-pos-x="18439" layout-pos-y="11274" layout-size-height="5809" layout-size-width="8114"/> - <presobj kind="PRESOBJ_OUTLINE5" layout-pos-x="9919" layout-pos-y="11274" layout-size-height="5809" layout-size-width="8114"/> - <presobj kind="PRESOBJ_OUTLINE6" layout-pos-x="1400" layout-pos-y="11274" layout-size-height="5809" layout-size-width="8114"/> + <presobj kind="PRESOBJ_TITLE" title-shape-relative-height="1" title-shape-relative-width="1" title-shape-relative-pos="0" boolx="1"/> + <presobj kind="PRESOBJ_OUTLINE1" title-shape-relative-height="0.477" title-shape-relative-width="0.322" title-shape-relative-pos="0" boolx="1"/> + <presobj kind="PRESOBJ_OUTLINE2" title-shape-relative-height="0.477" title-shape-relative-width="0.322" title-shape-relative-pos="1.05" boolx="1"/> + <presobj kind="PRESOBJ_OUTLINE3" title-shape-relative-height="0.477" title-shape-relative-width="0.322" title-shape-relative-pos="2.10" boolx="1"/> + <presobj kind="PRESOBJ_OUTLINE4" title-shape-relative-height="0.477" title-shape-relative-width="0.322" title-shape-relative-pos="1.095" boolx="0"/> + <presobj kind="PRESOBJ_OUTLINE5" title-shape-relative-height="0.477" title-shape-relative-width="0.322" title-shape-relative-pos="1.05" boolx="1"/> + <presobj kind="PRESOBJ_OUTLINE6" title-shape-relative-height="0.477" title-shape-relative-width="0.322" title-shape-relative-pos="1.095" boolx="0"/> </layout> <layout type="AUTOLAYOUT__START"> - <presobj kind="PRESOBJ_TITLE" layout-pos-x="1400" layout-pos-y="837" layout-size-height="3507" layout-size-width="25200"/> - <presobj kind="PRESOBJ_OUTLINE1" layout-pos-x="1400" layout-pos-y="4914" layout-size-height="12297" layout-size-width="25600"/> + <presobj kind="PRESOBJ_TITLE" title-shape-relative-height="1" title-shape-relative-width="1" title-shape-relative-pos="0" boolx="1"/> + <presobj kind="PRESOBJ_OUTLINE1" title-shape-relative-height="1" title-shape-relative-width="1" title-shape-relative-pos="0" boolx="1"/> </layout> <layout type="AUTOLAYOUT_TITLE_2CONTENT_CONTENT"> - <presobj kind="PRESOBJ_TITLE" layout-pos-x="1400" layout-pos-y="837" layout-size-height="3507" layout-size-width="25200"/> - <presobj kind="PRESOBJ_OUTLINE1" layout-pos-x="1400" layout-pos-y="4914" layout-size-height="5809" layout-size-width="12297"/> - <presobj kind="PRESOBJ_OUTLINE2" layout-pos-x="1400" layout-pos-y="11274" layout-size-height="5809" layout-size-width="12297"> - <presobj kind="PRESOBJ_OUTLINE3" layout-pos-x="14311" layout-pos-y="4914" layout-size-height="12180" layout-size-width="12297"/> + <presobj kind="PRESOBJ_TITLE" title-shape-relative-height="1" title-shape-relative-width="1" title-shape-relative-pos="0" boolx="1"/> + <presobj kind="PRESOBJ_OUTLINE1" title-shape-relative-height="0.477" title-shape-relative-width="0.488" title-shape-relative-pos="0" boolx="1"/> + <presobj kind="PRESOBJ_OUTLINE2" title-shape-relative-height="0.477" title-shape-relative-width="0.488" title-shape-relative-pos="1.095" boolx="0"/> + <presobj kind="PRESOBJ_OUTLINE3" title-shape-relative-height="1" title-shape-relative-width="0.488" title-shape-relative-pos="1.05" boolx="1"/> </layout> <layout type="AUTOLAYOUT_TITLE_2CONTENT_OVER_CONTENT"> - <presobj kind="PRESOBJ_TITLE" layout-pos-x="1400" layout-pos-y="837" layout-size-height="3507" layout-size-width="25200"/> - <presobj kind="PRESOBJ_OUTLINE1" layout-pos-x="1400" layout-pos-y="4914" layout-size-height="5809" layout-size-width="12297"/> - <presobj kind="PRESOBJ_OUTLINE2" layout-pos-x="14311" layout-pos-y="4914" layout-size-height="5809" layout-size-width="12297"/> - <presobj kind="PRESOBJ_OUTLINE3" layout-pos-x="1400" layout-pos-y="11274" layout-size-height="5809" layout-size-width="25198"/> + <presobj kind="PRESOBJ_TITLE" title-shape-relative-height="1" title-shape-relative-width="1" title-shape-relative-pos="0" boolx="1"/> + <presobj kind="PRESOBJ_OUTLINE1" title-shape-relative-height="0.477" title-shape-relative-width="0.488" title-shape-relative-pos="0" boolx="1"/> + <presobj kind="PRESOBJ_OUTLINE2" title-shape-relative-height="0.477" title-shape-relative-width="0.488" title-shape-relative-pos="1.05" boolx="1"/> + <presobj kind="PRESOBJ_OUTLINE3" title-shape-relative-height="1" title-shape-relative-width="1" title-shape-relative-pos="1.095" boolx="0"/> </layout> </layout-list> \ No newline at end of file _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits