summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorDaniel Silva <danielfaleirosilva@gmail.com>2018-07-07 09:42:07 -0300
committerDaniel Silva <danielfaleirosilva@gmail.com>2018-11-29 13:02:16 -0200
commit07e4261ceaea31a20ab2bc1a76df722ed0bd54c4 (patch)
tree59735f3e6c3a03f4244ea0a31bcead6691806e8e /sw
parentcff219f792085645a13b4a703882a8984ce78ddc (diff)
Sets page orientation box in print dialog
Change-Id: If12b833db5db372738ce02d1ed0d77145f3ffa0f Reviewed-on: https://gerrit.libreoffice.org/57131 Tested-by: Jenkins Reviewed-by: Daniel Silva <danielfaleirosilva@gmail.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/uibase/uno/unotxdoc.cxx57
1 files changed, 45 insertions, 12 deletions
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index b4ecdc0649f7..901cea6930a1 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -2368,6 +2368,43 @@ static bool lcl_SeqHasProperty(
return bRes;
}
+static bool lcl_GetBoolProperty(
+ const uno::Sequence< beans::PropertyValue >& rOptions,
+ const sal_Char *pPropName )
+{
+ bool bRes = false;
+ const sal_Int32 nLen = rOptions.getLength();
+ const beans::PropertyValue *pProps = rOptions.getConstArray();
+ for ( sal_Int32 i = 0; i < nLen; ++i )
+ {
+ if ( pProps[i].Name.equalsAscii( pPropName ) )
+ {
+ pProps[i].Value >>= bRes;
+ break;
+ }
+ }
+ return bRes;
+}
+
+static sal_Int32 lcl_GetIntProperty(
+ const uno::Sequence< beans::PropertyValue >& rOptions,
+ const sal_Char *pPropName,
+ sal_Int32 nDefault )
+{
+ sal_Int32 nRes = nDefault;
+ const sal_Int32 nLen = rOptions.getLength();
+ const beans::PropertyValue *pProps = rOptions.getConstArray();
+ for ( sal_Int32 i = 0; i < nLen; ++i )
+ {
+ if ( pProps[i].Name.equalsAscii( pPropName ) )
+ {
+ pProps[i].Value >>= nRes;
+ break;
+ }
+ }
+ return nRes;
+}
+
SfxViewShell * SwXTextDocument::GetRenderView(
bool &rbIsSwSrcView,
const uno::Sequence< beans::PropertyValue >& rOptions,
@@ -2561,6 +2598,13 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount(
if (!pViewShell || !pViewShell->GetLayout())
return 0;
+ // make sure document orientation matches printer paper orientation
+ sal_Int32 nLandscape = lcl_GetIntProperty( rxOptions, "IsLandscape", -1 );
+ if ( nLandscape == 1 )
+ pViewShell->ChgAllPageOrientation( Orientation::Landscape );
+ else if ( nLandscape == 0 )
+ pViewShell->ChgAllPageOrientation( Orientation::Portrait );
+
if (bFormat)
{
// #i38289
@@ -2603,18 +2647,7 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount(
? nullptr : m_pRenderData->GetSwPrtOptions();
bool setShowPlaceHoldersInPDF = false;
if(bIsPDFExport)
- {
- const sal_Int32 nLen = rxOptions.getLength();
- const beans::PropertyValue *pProps = rxOptions.getConstArray();
- for (sal_Int32 i = 0; i < nLen; ++i)
- {
- if (pProps[i].Name == "ExportPlaceholders")
- {
- pProps[i].Value >>= setShowPlaceHoldersInPDF;
- break;
- }
- }
- }
+ setShowPlaceHoldersInPDF = lcl_GetBoolProperty( rxOptions, "ExportPlaceholders" );
m_pRenderData->ViewOptionAdjust( pPrtOptions, setShowPlaceHoldersInPDF );
}