Kaydet (Commit) 07969f6e authored tarafından Abdulmajeed Al-Abaulrazzaq's avatar Abdulmajeed Al-Abaulrazzaq Kaydeden (comit) Michael Stahl

Code enhancement remove duplicate code from presenter console

Change-Id: Ibbb131b64c66307d38a135ac570c1e2ed37bef6c
Reviewed-on: https://gerrit.libreoffice.org/1480Reviewed-by: 's avatarMichael Stahl <mstahl@redhat.com>
Tested-by: 's avatarMichael Stahl <mstahl@redhat.com>
üst 37c6106f
...@@ -656,8 +656,8 @@ void PresenterWindowManager::LayoutStandardMode (void) ...@@ -656,8 +656,8 @@ void PresenterWindowManager::LayoutStandardMode (void)
const double nGap (20); const double nGap (20);
const double nHorizontalSlideDivide (aBox.Width / nGoldenRatio); const double nHorizontalSlideDivide (aBox.Width / nGoldenRatio);
double nSlidePreviewTop (0); 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 // 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 // width. This takes into acount the slide aspect ratio and thus has to
// go over the inner pane size. // go over the inner pane size.
...@@ -669,9 +669,13 @@ void PresenterWindowManager::LayoutStandardMode (void) ...@@ -669,9 +669,13 @@ void PresenterWindowManager::LayoutStandardMode (void)
nHorizontalSlideDivide - 1.5*nGap, nHorizontalSlideDivide - 1.5*nGap,
PresenterPaneFactory::msCurrentSlidePreviewPaneURL)); PresenterPaneFactory::msCurrentSlidePreviewPaneURL));
nSlidePreviewTop = (aBox.Height - aCurrentSlideOuterBox.Height) / 2; 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 ( SetPanePosSizeAbsolute (
PresenterPaneFactory::msCurrentSlidePreviewPaneURL, PresenterPaneFactory::msCurrentSlidePreviewPaneURL,
nGap, Temp,
nSlidePreviewTop, nSlidePreviewTop,
aCurrentSlideOuterBox.Width, aCurrentSlideOuterBox.Width,
aCurrentSlideOuterBox.Height); aCurrentSlideOuterBox.Height);
...@@ -686,51 +690,18 @@ void PresenterWindowManager::LayoutStandardMode (void) ...@@ -686,51 +690,18 @@ void PresenterWindowManager::LayoutStandardMode (void)
const awt::Size aNextSlideOuterBox (CalculatePaneSize( const awt::Size aNextSlideOuterBox (CalculatePaneSize(
aBox.Width - nHorizontalSlideDivide - 1.5*nGap, aBox.Width - nHorizontalSlideDivide - 1.5*nGap,
PresenterPaneFactory::msNextSlidePreviewPaneURL)); PresenterPaneFactory::msNextSlidePreviewPaneURL));
double Temp=aBox.Width - aNextSlideOuterBox.Width - nGap;
/// check whether RTL interface or not
if(Application::GetSettings().GetLayoutRTL())
Temp=nGap;
SetPanePosSizeAbsolute ( SetPanePosSizeAbsolute (
PresenterPaneFactory::msNextSlidePreviewPaneURL, PresenterPaneFactory::msNextSlidePreviewPaneURL,
aBox.Width - aNextSlideOuterBox.Width - nGap, Temp,
nSlidePreviewTop, nSlidePreviewTop,
aNextSlideOuterBox.Width, aNextSlideOuterBox.Width,
aNextSlideOuterBox.Height); 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(); LayoutToolBar();
} }
...@@ -748,7 +719,7 @@ void PresenterWindowManager::LayoutNotesMode (void) ...@@ -748,7 +719,7 @@ void PresenterWindowManager::LayoutNotesMode (void)
double nSlidePreviewTop (0); double nSlidePreviewTop (0);
double nNotesViewBottom (aToolBarBox.Y1 - nGap); double nNotesViewBottom (aToolBarBox.Y1 - nGap);
/// check whether RTL interface or not /// check whether RTL interface or not
if(!Application::GetSettings().GetLayoutRTL()){
// The notes view has no fixed aspect ratio. // The notes view has no fixed aspect ratio.
PresenterPaneContainer::SharedPaneDescriptor pPane ( PresenterPaneContainer::SharedPaneDescriptor pPane (
...@@ -760,9 +731,13 @@ void PresenterWindowManager::LayoutNotesMode (void) ...@@ -760,9 +731,13 @@ void PresenterWindowManager::LayoutNotesMode (void)
nNotesViewBottom); nNotesViewBottom);
nSlidePreviewTop = (aBox.Height nSlidePreviewTop = (aBox.Height
- aToolBarBox.Y2 + aToolBarBox.Y1 - aNotesViewOuterSize.Height) / 2; - 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 ( SetPanePosSizeAbsolute (
PresenterPaneFactory::msNotesPaneURL, PresenterPaneFactory::msNotesPaneURL,
aBox.Width - aNotesViewOuterSize.Width - nGap, Temp,
nSlidePreviewTop, nSlidePreviewTop,
aNotesViewOuterSize.Width, aNotesViewOuterSize.Width,
aNotesViewOuterSize.Height); aNotesViewOuterSize.Height);
...@@ -778,9 +753,13 @@ void PresenterWindowManager::LayoutNotesMode (void) ...@@ -778,9 +753,13 @@ void PresenterWindowManager::LayoutNotesMode (void)
const awt::Size aCurrentSlideOuterBox(CalculatePaneSize( const awt::Size aCurrentSlideOuterBox(CalculatePaneSize(
nSecondaryWidth - 1.5*nGap, nSecondaryWidth - 1.5*nGap,
PresenterPaneFactory::msCurrentSlidePreviewPaneURL)); PresenterPaneFactory::msCurrentSlidePreviewPaneURL));
/// check whether RTL interface or not
double Temp=nGap;
if(Application::GetSettings().GetLayoutRTL())
Temp=aBox.Width - aCurrentSlideOuterBox.Width - nGap;
SetPanePosSizeAbsolute ( SetPanePosSizeAbsolute (
PresenterPaneFactory::msCurrentSlidePreviewPaneURL, PresenterPaneFactory::msCurrentSlidePreviewPaneURL,
nGap, Temp,
nSlidePreviewTop, nSlidePreviewTop,
aCurrentSlideOuterBox.Width, aCurrentSlideOuterBox.Width,
aCurrentSlideOuterBox.Height); aCurrentSlideOuterBox.Height);
...@@ -795,68 +774,20 @@ void PresenterWindowManager::LayoutNotesMode (void) ...@@ -795,68 +774,20 @@ void PresenterWindowManager::LayoutNotesMode (void)
const awt::Size aNextSlideOuterBox (CalculatePaneSize( const awt::Size aNextSlideOuterBox (CalculatePaneSize(
nTertiaryWidth, nTertiaryWidth,
PresenterPaneFactory::msNextSlidePreviewPaneURL)); PresenterPaneFactory::msNextSlidePreviewPaneURL));
/// check whether RTL interface or not
double Temp=nGap;
if(Application::GetSettings().GetLayoutRTL())
Temp=aBox.Width - aNextSlideOuterBox.Width - nGap;
SetPanePosSizeAbsolute ( SetPanePosSizeAbsolute (
PresenterPaneFactory::msNextSlidePreviewPaneURL, PresenterPaneFactory::msNextSlidePreviewPaneURL,
nGap, Temp,
nNotesViewBottom - aNextSlideOuterBox.Height, nNotesViewBottom - aNextSlideOuterBox.Height,
aNextSlideOuterBox.Width, aNextSlideOuterBox.Width,
aNextSlideOuterBox.Height); 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) void PresenterWindowManager::LayoutSlideSorterMode (void)
......
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