Kaydet (Commit) 6671f931 authored tarafından Vishv Brahmbhatt's avatar Vishv Brahmbhatt Kaydeden (comit) Thorsten Behrens

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
üst 7885ead7
...@@ -1238,7 +1238,7 @@ Reference<XElement> getRootElement() ...@@ -1238,7 +1238,7 @@ Reference<XElement> getRootElement()
} }
//read the information from XML file(traversing from layout node) //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 presobjsize;
long layoutlistsize; long layoutlistsize;
...@@ -1367,7 +1367,7 @@ static void CalcAutoLayoutRectangles( SdPage& rPage, int nLayout, Rectangle* rRe ...@@ -1367,7 +1367,7 @@ static void CalcAutoLayoutRectangles( SdPage& rPage, int nLayout, Rectangle* rRe
int presobjsize; int presobjsize;
rtl::OUString sLayoutAttName; rtl::OUString sLayoutAttName;
rtl::OUString sPresObjKindAttName; rtl::OUString sPresObjKindAttName;
sal_Int32 propvalue[4]; double propvalue[4];
if( rPage.GetPageKind() != PK_HANDOUT ) if( rPage.GetPageKind() != PK_HANDOUT )
{ {
...@@ -1406,7 +1406,8 @@ static void CalcAutoLayoutRectangles( SdPage& rPage, int nLayout, Rectangle* rRe ...@@ -1406,7 +1406,8 @@ static void CalcAutoLayoutRectangles( SdPage& rPage, int nLayout, Rectangle* rRe
Point aLayoutPos( aLayoutRect.TopLeft() ); Point aLayoutPos( aLayoutRect.TopLeft() );
Size aTempSize; Size aTempSize;
Point aTempPnt; Point aTempPnt;
aTempSize = aLayoutSize;
aTempPnt = aLayoutPos;
sal_Bool bRightToLeft = ( rPage.GetModel() && static_cast< SdDrawDocument* >( rPage.GetModel() )->GetDefaultWritingMode() == ::com::sun::star::text::WritingMode_RL_TB ); 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. 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 ...@@ -1432,28 +1433,47 @@ static void CalcAutoLayoutRectangles( SdPage& rPage, int nLayout, Rectangle* rRe
{ {
Reference<XNamedNodeMap> presObjAttributes = presobj->getAttributes(); Reference<XNamedNodeMap> presObjAttributes = presobj->getAttributes();
Reference<XNode> presObjPosX = presObjAttributes->getNamedItem("layout-pos-x"); Reference<XNode> presObjSizeHeight = presObjAttributes->getNamedItem("title-shape-relative-height");
rtl::OUString sValue = presObjPosX->getNodeValue(); rtl::OUString sValue = presObjSizeHeight->getNodeValue();
propvalue[0] = sValue.toInt32(); 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"); Reference<XNode> presObjPos = presObjAttributes->getNamedItem("title-shape-relative-pos");
sValue = presObjPosY->getNodeValue(); sValue = presObjPos->getNodeValue();
propvalue[1] = sValue.toInt32(); propvalue[2] = sValue.toDouble();
Reference<XNode> presObjSizeHeight = presObjAttributes->getNamedItem("layout-size-height"); Reference<XNode> presObjBool = presObjAttributes->getNamedItem("boolx");
sValue = presObjSizeHeight->getNodeValue(); sValue = presObjBool->getNodeValue();
propvalue[2] = sValue.toInt32(); propvalue[3] = sValue.toDouble();
Reference<XNode> presObjSizeWidth = presObjAttributes->getNamedItem("layout-size-width"); if(count==0)
sValue = presObjSizeWidth->getNodeValue(); {
propvalue[3] = sValue.toInt32(); Size aTitleSize ( aTitleRect.GetSize() );
aTitleSize.Height() = sal_Int32(aTitleSize.Height() * propvalue[0]);
aLayoutPos.X() = propvalue[0]; aTitleSize.Width() = sal_Int32(aTitleSize.Width() * propvalue[1]);
aLayoutPos.Y() = propvalue[1]; if(propvalue[3]==1)
aLayoutSize.Height() = propvalue[2]; aTitlePos.X() = sal_Int32(aTitlePos.X() +(aTitleSize.Width() * propvalue[2]));
aLayoutSize.Width() = propvalue[3]; else
rRectangle[count] = Rectangle (aLayoutPos, aLayoutSize); aTitlePos.Y() = sal_Int32(aTitlePos.Y() + (aTitleSize.Height() * propvalue[2]));
count=count+1; 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; break;
...@@ -1549,27 +1569,6 @@ static void CalcAutoLayoutRectangles( SdPage& rPage, int nLayout, Rectangle* rRe ...@@ -1549,27 +1569,6 @@ static void CalcAutoLayoutRectangles( SdPage& rPage, int nLayout, Rectangle* rRe
// aLayoutSize.Width() = long (aLayoutSize.Width() / 0.488); // aLayoutSize.Width() = long (aLayoutSize.Width() / 0.488);
// rRectangle[3] = Rectangle (aLayoutPos, aLayoutSize); // rRectangle[3] = Rectangle (aLayoutPos, aLayoutSize);
// break; // 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 case 6: // title, 4 shapes
{ {
// sal_uLong nX = long (aLayoutPos.X()); // sal_uLong nX = long (aLayoutPos.X());
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment