summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorDaniel <danielfaleirosilva@gmail.com>2018-04-29 14:51:08 -0300
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2018-05-07 00:29:15 +0200
commit6a8ae73b4c23ec80f97bcafd8b9a5e8f14b2abc7 (patch)
treeddd0c09f3e1d376ec38bc5e481b2da62054846c2 /sd
parent239d985b712301a5922fe4d32f29db94e5f73766 (diff)
tdf#99301 fix handouts selected order
Change-Id: I757d41a4ec2ce832b16243e9d9c6fbd5fba6add6 Reviewed-on: https://gerrit.libreoffice.org/53628 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Diffstat (limited to 'sd')
-rw-r--r--sd/source/core/sdpage.cxx68
1 files changed, 51 insertions, 17 deletions
diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx
index aadb6a91e905..96835106736d 100644
--- a/sd/source/core/sdpage.cxx
+++ b/sd/source/core/sdpage.cxx
@@ -2936,21 +2936,67 @@ void SdPage::CalculateHandoutAreas( SdDrawDocument& rModel, AutoLayout eLayout,
{
SdPage& rHandoutMaster = *rModel.GetMasterSdPage( 0, PageKind::Handout );
+ static const sal_uInt16 aOffsets[5][9] =
+ {
+ { 0, 1, 2, 3, 4, 5, 6, 7, 8 }, // AUTOLAYOUT_HANDOUT9, Portrait, Horizontal order
+ { 0, 2, 4, 1, 3, 5, 0, 0, 0 }, // AUTOLAYOUT_HANDOUT3, Landscape, Vertical
+ { 0, 2, 1, 3, 0, 0, 0, 0, 0 }, // AUTOLAYOUT_HANDOUT4, Landscape, Vertical
+ { 0, 3, 1, 4, 2, 5, 0, 0, 0 }, // AUTOLAYOUT_HANDOUT4, Portrait, Vertical
+ { 0, 3, 6, 1, 4, 7, 2, 5, 8 }, // AUTOLAYOUT_HANDOUT9, Landscape, Vertical
+ };
+
+ const sal_uInt16* pOffsets = aOffsets[0];
+
+ Size aArea = rHandoutMaster.GetSize();
+ const bool bLandscape = aArea.Width() > aArea.Height();
+
if( eLayout == AUTOLAYOUT_NONE )
{
// use layout from handout master
SdrObjListIter aShapeIter (rHandoutMaster);
- while (aShapeIter.IsMore())
+
+ std::vector< ::tools::Rectangle > vSlidesAreas;
+ while ( aShapeIter.IsMore() )
{
- SdrPageObj* pPageObj = dynamic_cast<SdrPageObj*>(aShapeIter.Next());
+ SdrPageObj* pPageObj = dynamic_cast<SdrPageObj*>( aShapeIter.Next() );
+ // get slide rectangles
if (pPageObj)
- rAreas.push_back( pPageObj->GetCurrentBoundRect() );
+ vSlidesAreas.push_back( pPageObj->GetCurrentBoundRect() );
+ }
+
+ if ( !bHorizontal || vSlidesAreas.size() < 4 )
+ { // top to bottom, then right
+ rAreas.swap( vSlidesAreas );
+ }
+ else
+ { // left to right, then down
+ switch ( vSlidesAreas.size() )
+ {
+ case 4:
+ pOffsets = aOffsets[2];
+ break;
+
+ default:
+ SAL_FALLTHROUGH;
+ case 6:
+ pOffsets = aOffsets[ bLandscape ? 3 : 1 ];
+ break;
+
+ case 9:
+ pOffsets = aOffsets[4];
+ break;
+ }
+
+ rAreas.resize( static_cast<size_t>(vSlidesAreas.size()) );
+
+ for( const tools::Rectangle& rRect : vSlidesAreas )
+ {
+ rAreas[*pOffsets++] = rRect;
+ }
}
}
else
{
- Size aArea = rHandoutMaster.GetSize();
-
const long nGapW = 1000; // gap is 1cm
const long nGapH = 1000;
@@ -2970,18 +3016,6 @@ void SdPage::CalculateHandoutAreas( SdDrawDocument& rModel, AutoLayout eLayout,
aArea.AdjustWidth( -(nGapW * 2 + nLeftBorder + nRightBorder) );
aArea.AdjustHeight( -(nGapH * 2 + nTopBorder + nBottomBorder) );
- const bool bLandscape = aArea.Width() > aArea.Height();
-
- static const sal_uInt16 aOffsets[5][9] =
- {
- { 0, 1, 2, 3, 4, 5, 6, 7, 8 }, // AUTOLAYOUT_HANDOUT9, Portrait, Horizontal order
- { 0, 2, 4, 1, 3, 5, 0, 0, 0 }, // AUTOLAYOUT_HANDOUT3, Landscape, Vertical
- { 0, 2, 1, 3, 0, 0, 0, 0, 0 }, // AUTOLAYOUT_HANDOUT4, Landscape, Vertical
- { 0, 3, 1, 4, 2, 5, 0, 0, 0 }, // AUTOLAYOUT_HANDOUT4, Portrait, Vertical
- { 0, 3, 6, 1, 4, 7, 2, 5, 8 }, // AUTOLAYOUT_HANDOUT9, Landscape, Vertical
- };
-
- const sal_uInt16* pOffsets = aOffsets[0];
sal_uInt16 nColCnt = 0, nRowCnt = 0;
switch ( eLayout )
{