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

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
üst 96087f52
......@@ -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
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 );
aTempPnt = aLayoutPos;
std::vector<Reference<XNode>> &layoutinfo = static_cast< SdDrawDocument* >( rPage.GetModel() )->GetLayoutVector(); //getting vector from "SdDrawDocument" ,not sure about the correct mechanism
const std::vector<Reference<XNode>> &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<XNode> 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 (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( 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
{
// sal_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;
}
case 11: // title, 6 shapes
{
// 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);
// 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.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() = nX;
// rRectangle[6] = Rectangle (aLayoutPos, aLayoutSize);
break;
}
}
}
......@@ -1703,7 +1547,7 @@ void SdPage::SetAutoLayout(AutoLayout eLayout, sal_Bool bInit, sal_Bool bCreate
Rectangle aRectangle[MAX_PRESOBJS];
const LayoutDescriptor& aDescriptor = GetLayoutDescriptor( meAutoLayout );
autolayout=enumtoString(meAutoLayout);
CalcAutoLayoutRectangles( *this, aDescriptor.mnLayout, aRectangle, autolayout);
CalcAutoLayoutRectangles( *this, aRectangle, autolayout);
std::set< SdrObject* > aUsedPresentationObjects;
......
......@@ -30,7 +30,7 @@
<presobj kind="PRESOBJ_OUTLINE4" title-shape-relative-height="0.477" title-shape-relative-width="0.488" title-shape-relative-posX="0" title-shape-relative-posY="1.095"/>
</layout>
<layout type="AUTOLAYOUT_ONLY_TEXT">
<presobj kind="PRESOBJ_OUTLINE1" title-shape-relative-height="1" title-shape-relative-width="1" title-shape-relative-posX="0" title-shape-relative-posY="0"/>
<presobj kind="PRESOBJ_OUTLINE1" title-shape-relative-height="4.6354" title-shape-relative-width="1" title-shape-relative-posX="0" title-shape-relative-posY="0"/>
</layout>
<layout type="AUTOLAYOUT_TITLE_ONLY">
<presobj kind="PRESOBJ_TITLE" title-shape-relative-height="1" title-shape-relative-width="1" title-shape-relative-posX="0" title-shape-relative-posY="0"/>
......@@ -60,4 +60,22 @@
<presobj kind="PRESOBJ_OUTLINE2" title-shape-relative-height="0.477" title-shape-relative-width="0.488" title-shape-relative-posX="1.05" title-shape-relative-posY="0"/>
<presobj kind="PRESOBJ_OUTLINE3" title-shape-relative-height="0.477" title-shape-relative-width="1" title-shape-relative-posX="0" title-shape-relative-posY="1.095"/>
</layout>
<layout type="AUTOLAYOUT_VTITLE_VCONTENT">
<presobj kind="PRESOBJ_TITLE" title-shape-relative-height="4.6354" title-shape-relative-width="0.139167" title-shape-relative-posX="6.1856" title-shape-relative-posY="0"/>
<presobj kind="PRESOBJ_OUTLINE1" title-shape-relative-height="1.3347" title-shape-relative-width="0.777778" title-shape-relative-posX="0" title-shape-relative-posY="-0.2508"/>
</layout>
<layout type="AUTOLAYOUT_VTITLE_VCONTENT_OVER_VCONTENT">
<presobj kind="PRESOBJ_TITLE" title-shape-relative-height="4.6354" title-shape-relative-width="0.139167" title-shape-relative-posX="6.1856" title-shape-relative-posY="0"/>
<presobj kind="PRESOBJ_OUTLINE1" title-shape-relative-height="0.628" title-shape-relative-width="0.777778" title-shape-relative-posX="0" title-shape-relative-posY="-0.5337"/>
<presobj kind="PRESOBJ_OUTLINE2" title-shape-relative-height="0.628" title-shape-relative-width="0.777778" title-shape-relative-posX="0" title-shape-relative-posY="0.594"/>
</layout>
<layout type="AUTOLAYOUT_TITLE_VCONTENT">
<presobj kind="PRESOBJ_TITLE" title-shape-relative-height="1" title-shape-relative-width="1" title-shape-relative-posX="0" title-shape-relative-posY="0"/>
<presobj kind="PRESOBJ_OUTLINE1" title-shape-relative-height="1" title-shape-relative-width="1" title-shape-relative-posX="0" title-shape-relative-posY="0"/>
</layout>
<layout type="AUTOLAYOUT_TITLE_2VTEXT">
<presobj kind="PRESOBJ_TITLE" title-shape-relative-height="1" title-shape-relative-width="1" title-shape-relative-posX="0" title-shape-relative-posY="0"/>
<presobj kind="PRESOBJ_OUTLINE1" title-shape-relative-height="1" title-shape-relative-width="0.488" title-shape-relative-posX="0" title-shape-relative-posY="0"/>
<presobj kind="PRESOBJ_OUTLINE2" title-shape-relative-height="1" title-shape-relative-width="0.488" title-shape-relative-posX="1.05" title-shape-relative-posY="0"/>
</layout>
</layout-list>
\ No newline at end of file
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