diff options
author | Abdulmajeed Al-Abaulrazzaq <aalabdulrazzaq@kacst.edu.sa> | 2012-12-24 12:38:10 +0300 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2013-01-07 13:05:00 +0000 |
commit | 07969f6effe89b8cdc65764135337054751f280e (patch) | |
tree | f7da5bf10c4c100ad4f91362aca52957f9a459a5 /sdext/source | |
parent | 37c6106f3a74f249cd421454d20f8ce561f71eb0 (diff) |
Code enhancement remove duplicate code from presenter console
Change-Id: Ibbb131b64c66307d38a135ac570c1e2ed37bef6c
Reviewed-on: https://gerrit.libreoffice.org/1480
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Tested-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'sdext/source')
-rw-r--r-- | sdext/source/presenter/PresenterWindowManager.cxx | 125 |
1 files changed, 28 insertions, 97 deletions
diff --git a/sdext/source/presenter/PresenterWindowManager.cxx b/sdext/source/presenter/PresenterWindowManager.cxx index 7c8124d17d13..9f1e8d074318 100644 --- a/sdext/source/presenter/PresenterWindowManager.cxx +++ b/sdext/source/presenter/PresenterWindowManager.cxx @@ -656,8 +656,8 @@ void PresenterWindowManager::LayoutStandardMode (void) const double nGap (20); const double nHorizontalSlideDivide (aBox.Width / nGoldenRatio); double nSlidePreviewTop (0); - /// check whether RTL interface or not - if(!Application::GetSettings().GetLayoutRTL()){ + + // For the current slide view calculate the outer height from the outer // width. This takes into acount the slide aspect ratio and thus has to // go over the inner pane size. @@ -669,9 +669,13 @@ void PresenterWindowManager::LayoutStandardMode (void) nHorizontalSlideDivide - 1.5*nGap, PresenterPaneFactory::msCurrentSlidePreviewPaneURL)); nSlidePreviewTop = (aBox.Height - aCurrentSlideOuterBox.Height) / 2; + double Temp=nGap; + /// check whether RTL interface or not + if(Application::GetSettings().GetLayoutRTL()) + Temp=aBox.Width - aCurrentSlideOuterBox.Width - nGap; SetPanePosSizeAbsolute ( PresenterPaneFactory::msCurrentSlidePreviewPaneURL, - nGap, + Temp, nSlidePreviewTop, aCurrentSlideOuterBox.Width, aCurrentSlideOuterBox.Height); @@ -686,51 +690,18 @@ void PresenterWindowManager::LayoutStandardMode (void) const awt::Size aNextSlideOuterBox (CalculatePaneSize( aBox.Width - nHorizontalSlideDivide - 1.5*nGap, PresenterPaneFactory::msNextSlidePreviewPaneURL)); + double Temp=aBox.Width - aNextSlideOuterBox.Width - nGap; + /// check whether RTL interface or not + if(Application::GetSettings().GetLayoutRTL()) + Temp=nGap; SetPanePosSizeAbsolute ( PresenterPaneFactory::msNextSlidePreviewPaneURL, - aBox.Width - aNextSlideOuterBox.Width - nGap, + Temp, nSlidePreviewTop, aNextSlideOuterBox.Width, aNextSlideOuterBox.Height); } - }else{ - // For the current slide view calculate the outer height from the outer - // width. This takes into acount the slide aspect ratio and thus has to - // go over the inner pane size. - PresenterPaneContainer::SharedPaneDescriptor pPane ( - mpPaneContainer->FindPaneURL(PresenterPaneFactory::msCurrentSlidePreviewPaneURL)); - if (pPane.get() != NULL) - { - const awt::Size aNextSlideOuterBox (CalculatePaneSize( - nHorizontalSlideDivide - 1.5*nGap, - PresenterPaneFactory::msCurrentSlidePreviewPaneURL)); - nSlidePreviewTop = (aBox.Height - aNextSlideOuterBox.Height) / 2; - SetPanePosSizeAbsolute ( - PresenterPaneFactory::msCurrentSlidePreviewPaneURL, - aBox.Width - aNextSlideOuterBox.Width - nGap, - nSlidePreviewTop, - aNextSlideOuterBox.Width, - aNextSlideOuterBox.Height); - } - - // For the next slide view calculate the outer height from the outer - // width. This takes into acount the slide aspect ratio and thus has to - // go over the inner pane size. - pPane = mpPaneContainer->FindPaneURL(PresenterPaneFactory::msNextSlidePreviewPaneURL); - if (pPane.get() != NULL) - { - const awt::Size aCurrentSlideOuterBox(CalculatePaneSize( - aBox.Width - nHorizontalSlideDivide - 1.5*nGap, - PresenterPaneFactory::msNextSlidePreviewPaneURL)); - SetPanePosSizeAbsolute ( - PresenterPaneFactory::msNextSlidePreviewPaneURL, - nGap, - nSlidePreviewTop, - aCurrentSlideOuterBox.Width, - aCurrentSlideOuterBox.Height); - } - } LayoutToolBar(); } @@ -748,7 +719,7 @@ void PresenterWindowManager::LayoutNotesMode (void) double nSlidePreviewTop (0); double nNotesViewBottom (aToolBarBox.Y1 - nGap); /// check whether RTL interface or not - if(!Application::GetSettings().GetLayoutRTL()){ + // The notes view has no fixed aspect ratio. PresenterPaneContainer::SharedPaneDescriptor pPane ( @@ -760,9 +731,13 @@ void PresenterWindowManager::LayoutNotesMode (void) nNotesViewBottom); nSlidePreviewTop = (aBox.Height - aToolBarBox.Y2 + aToolBarBox.Y1 - aNotesViewOuterSize.Height) / 2; + /// check whether RTL interface or not + double Temp=aBox.Width - aNotesViewOuterSize.Width - nGap; + if(Application::GetSettings().GetLayoutRTL()) + Temp=nGap; SetPanePosSizeAbsolute ( PresenterPaneFactory::msNotesPaneURL, - aBox.Width - aNotesViewOuterSize.Width - nGap, + Temp, nSlidePreviewTop, aNotesViewOuterSize.Width, aNotesViewOuterSize.Height); @@ -778,9 +753,13 @@ void PresenterWindowManager::LayoutNotesMode (void) const awt::Size aCurrentSlideOuterBox(CalculatePaneSize( nSecondaryWidth - 1.5*nGap, PresenterPaneFactory::msCurrentSlidePreviewPaneURL)); + /// check whether RTL interface or not + double Temp=nGap; + if(Application::GetSettings().GetLayoutRTL()) + Temp=aBox.Width - aCurrentSlideOuterBox.Width - nGap; SetPanePosSizeAbsolute ( PresenterPaneFactory::msCurrentSlidePreviewPaneURL, - nGap, + Temp, nSlidePreviewTop, aCurrentSlideOuterBox.Width, aCurrentSlideOuterBox.Height); @@ -795,68 +774,20 @@ void PresenterWindowManager::LayoutNotesMode (void) const awt::Size aNextSlideOuterBox (CalculatePaneSize( nTertiaryWidth, PresenterPaneFactory::msNextSlidePreviewPaneURL)); + /// check whether RTL interface or not + double Temp=nGap; + if(Application::GetSettings().GetLayoutRTL()) + Temp=aBox.Width - aNextSlideOuterBox.Width - nGap; SetPanePosSizeAbsolute ( PresenterPaneFactory::msNextSlidePreviewPaneURL, - nGap, + Temp, nNotesViewBottom - aNextSlideOuterBox.Height, aNextSlideOuterBox.Width, aNextSlideOuterBox.Height); } - }else { - // The notes view has no fixed aspect ratio. - PresenterPaneContainer::SharedPaneDescriptor pPane ( - mpPaneContainer->FindPaneURL(PresenterPaneFactory::msNotesPaneURL)); - if (pPane.get() != NULL) - { - const geometry::RealSize2D aNotesViewOuterSize( - nPrimaryWidth - 1.5*nGap + 0.5, - nNotesViewBottom); - nSlidePreviewTop = (aBox.Height - - aToolBarBox.Y2 + aToolBarBox.Y1 - aNotesViewOuterSize.Height) / 2; - SetPanePosSizeAbsolute ( - PresenterPaneFactory::msNotesPaneURL, - nGap, - nSlidePreviewTop, - aNotesViewOuterSize.Width, - aNotesViewOuterSize.Height); - nNotesViewBottom = nSlidePreviewTop + aNotesViewOuterSize.Height; - } - - // For the current slide view calculate the outer height from the outer - // width. This takes into acount the slide aspect ratio and thus has to - // go over the inner pane size. - pPane = mpPaneContainer->FindPaneURL(PresenterPaneFactory::msCurrentSlidePreviewPaneURL); - if (pPane.get() != NULL) - { - const awt::Size aCurrentSlideOuterBox(CalculatePaneSize( - nSecondaryWidth - 1.5*nGap, - PresenterPaneFactory::msCurrentSlidePreviewPaneURL)); - SetPanePosSizeAbsolute ( - PresenterPaneFactory::msCurrentSlidePreviewPaneURL, - aBox.Width - aCurrentSlideOuterBox.Width - nGap, - nSlidePreviewTop, - aCurrentSlideOuterBox.Width, - aCurrentSlideOuterBox.Height); - } - // For the next slide view calculate the outer height from the outer - // width. This takes into acount the slide aspect ratio and thus has to - // go over the inner pane size. - pPane = mpPaneContainer->FindPaneURL(PresenterPaneFactory::msNextSlidePreviewPaneURL); - if (pPane.get() != NULL) - { - const awt::Size aNextSlideOuterBox (CalculatePaneSize( - nTertiaryWidth, - PresenterPaneFactory::msNextSlidePreviewPaneURL)); - SetPanePosSizeAbsolute ( - PresenterPaneFactory::msNextSlidePreviewPaneURL, - aBox.Width - aNextSlideOuterBox.Width - nGap, - nNotesViewBottom - aNextSlideOuterBox.Height, - aNextSlideOuterBox.Width, - aNextSlideOuterBox.Height); - }} } void PresenterWindowManager::LayoutSlideSorterMode (void) |