summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <michael.stahl@allotropia.de>2023-03-14 15:20:22 +0100
committerMichael Stahl <michael.stahl@allotropia.de>2023-03-16 09:09:50 +0000
commit529afed0ba3ca5e659cea661816e9164846630e8 (patch)
treec5ca999c3e5938924b1aa3953997836396e95a0b
parent7a7eb4aa21ca0c83db825fe8d5a5278611b391d8 (diff)
tdf#39667 filter,officecfg: PDF export dialog: set initial view to...
... Outline for PDF/UA. * change the dialog to disable the radio buttons if PDF/UA is enabled * also change the configuration to make Outline the default Change-Id: Iea8c5e0f8560c972dc250859198bea1cb9fc3597 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148883 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
-rw-r--r--filter/source/pdf/impdialog.cxx70
-rw-r--r--filter/source/pdf/impdialog.hxx7
-rw-r--r--officecfg/registry/schema/org/openoffice/Office/Common.xcs2
-rw-r--r--sc/qa/uitest/calc_tests4/exportToPDF.py4
-rw-r--r--sd/qa/uitest/impress_tests/exportToPDF.py4
-rw-r--r--sw/qa/uitest/writer_tests4/exportToPDF.py4
6 files changed, 81 insertions, 10 deletions
diff --git a/filter/source/pdf/impdialog.cxx b/filter/source/pdf/impdialog.cxx
index b3314ba0df1d..a214e9d9cde9 100644
--- a/filter/source/pdf/impdialog.cxx
+++ b/filter/source/pdf/impdialog.cxx
@@ -93,7 +93,7 @@ ImpPDFTabDialog::ImpPDFTabDialog(weld::Window* pParent, const Sequence< Property
mbOpenInFullScreenMode( false ),
mbDisplayPDFDocumentTitle( false ),
mnMagnification( 0 ),
- mnInitialView( 0 ),
+ mnInitialView( 1 ),
mnZoom( 0 ),
mnInitialPage( 1 ),
mnPageLayout( 0 ),
@@ -225,6 +225,7 @@ ImpPDFTabDialog::ImpPDFTabDialog(weld::Window* pParent, const Sequence< Property
mbDisplayPDFDocumentTitle = maConfigItem.ReadBool( "DisplayPDFDocumentTitle", true );
mnInitialView = maConfigItem.ReadInt32( "InitialView", 0 );
+ mnInitialViewUserSelection = mnInitialView;
mnMagnification = maConfigItem.ReadInt32( "Magnification", 0 );
mnZoom = maConfigItem.ReadInt32( "Zoom", 100 );
mnPageLayout = maConfigItem.ReadInt32( "PageLayout", 0 );
@@ -288,6 +289,15 @@ ImpPDFTabSecurityPage* ImpPDFTabDialog::getSecurityPage() const
return nullptr;
}
+ImpPDFTabOpnFtrPage * ImpPDFTabDialog::getOpenPage() const
+{
+ SfxTabPage* pOpenPage = GetTabPage("initialview");
+ if (pOpenPage)
+ {
+ return static_cast<ImpPDFTabOpnFtrPage*>(pOpenPage);
+ }
+ return nullptr;
+}
ImpPDFTabLinksPage* ImpPDFTabDialog::getLinksPage() const
{
@@ -920,6 +930,12 @@ IMPL_LINK_NOARG(ImpPDFTabGeneralPage, TogglePDFVersionOrUniversalAccessibilityHa
}
mxCbExportBookmarks->set_sensitive(!bIsPDFUA);
+ ImpPDFTabOpnFtrPage *const pOpenPage(mpParent ? mpParent->getOpenPage() : nullptr);
+ if (pOpenPage)
+ {
+ pOpenPage->ToggleInitialView(*mpParent);
+ }
+
// PDF/A doesn't allow launch action, so enable/disable the selection on the Link page
ImpPDFTabLinksPage* pLinksPage = mpParent ? mpParent->getLinksPage() : nullptr;
if (pLinksPage)
@@ -969,6 +985,10 @@ void ImpPDFTabOpnFtrPage::GetFilterConfigItem( ImpPDFTabDialog* pParent )
pParent->mnInitialView = 1;
else if( mxRbOpnThumbs->get_active() )
pParent->mnInitialView = 2;
+ if (!pParent->mbPDFUACompliance)
+ {
+ pParent->mnInitialViewUserSelection = pParent->mnInitialView;
+ }
pParent->mnMagnification = 0;
if( mxRbMagnFitWin->get_active() )
@@ -996,7 +1016,7 @@ void ImpPDFTabOpnFtrPage::GetFilterConfigItem( ImpPDFTabDialog* pParent )
pParent->mbFirstPageLeft = mbUseCTLFont && mxCbPgLyFirstOnLeft->get_active();
}
-void ImpPDFTabOpnFtrPage::SetFilterConfigItem( const ImpPDFTabDialog* pParent )
+void ImpPDFTabOpnFtrPage::SetFilterConfigItem(ImpPDFTabDialog *const pParent)
{
mbUseCTLFont = pParent->mbUseCTLFont;
switch( pParent->mnPageLayout )
@@ -1066,6 +1086,52 @@ void ImpPDFTabOpnFtrPage::SetFilterConfigItem( const ImpPDFTabDialog* pParent )
mxCbPgLyFirstOnLeft->set_active(pParent->mbFirstPageLeft);
ToggleRbPgLyContinueFacingHdl();
}
+
+ // The call from ImpPDFTabGeneralPage::SetFilterConfigItem() did not init
+ // the radio buttons correctly becuse ImpPDFTabOpnFtrPage did not yet exist.
+ ToggleInitialView(*pParent);
+}
+
+void ImpPDFTabOpnFtrPage::ToggleInitialView(ImpPDFTabDialog & rParent)
+{
+ bool const bIsPDFUA(rParent.getGeneralPage()->IsPdfUaSelected());
+ if (bIsPDFUA)
+ { // only allow Outline for PDF/UA
+ if (mxRbOpnOutline->get_sensitive())
+ {
+ if (mxRbOpnPageOnly->get_active())
+ {
+ rParent.mnInitialViewUserSelection = 0;
+ }
+ else if (mxRbOpnOutline->get_active())
+ {
+ rParent.mnInitialViewUserSelection = 1;
+ }
+ else if (mxRbOpnThumbs->get_active())
+ {
+ rParent.mnInitialViewUserSelection = 2;
+ }
+ mxRbOpnOutline->set_active(true);
+ }
+ }
+ else
+ {
+ switch (rParent.mnInitialViewUserSelection)
+ {
+ case 0:
+ mxRbOpnPageOnly->set_active(true);
+ break;
+ case 1:
+ mxRbOpnOutline->set_active(true);
+ break;
+ case 2:
+ mxRbOpnThumbs->set_active(true);
+ break;
+ }
+ }
+ mxRbOpnPageOnly->set_sensitive(!bIsPDFUA);
+ mxRbOpnThumbs->set_sensitive(!bIsPDFUA);
+ mxRbOpnOutline->set_sensitive(!bIsPDFUA);
}
IMPL_LINK_NOARG(ImpPDFTabOpnFtrPage, ToggleRbPgLyContinueFacingHdl, weld::Toggleable&, void)
diff --git a/filter/source/pdf/impdialog.hxx b/filter/source/pdf/impdialog.hxx
index aac0185482b6..62ed7d580f44 100644
--- a/filter/source/pdf/impdialog.hxx
+++ b/filter/source/pdf/impdialog.hxx
@@ -111,6 +111,7 @@ class ImpPDFTabDialog final : public SfxTabDialogController
bool mbDisplayPDFDocumentTitle;
sal_Int32 mnMagnification;
sal_Int32 mnInitialView;
+ sal_Int32 mnInitialViewUserSelection;
sal_Int32 mnZoom;
sal_Int32 mnInitialPage;
@@ -163,6 +164,7 @@ public:
Sequence< PropertyValue > GetFilterData();
+ ImpPDFTabOpnFtrPage* getOpenPage() const;
ImpPDFTabSecurityPage* getSecurityPage() const;
ImpPDFTabLinksPage* getLinksPage() const;
ImpPDFTabGeneralPage* getGeneralPage() const;
@@ -252,6 +254,8 @@ public:
/// Class tab page viewer
class ImpPDFTabOpnFtrPage : public SfxTabPage
{
+ friend class ImpPDFTabGeneralPage;
+
bool mbUseCTLFont;
std::unique_ptr<weld::RadioButton> mxRbOpnPageOnly;
@@ -274,6 +278,7 @@ class ImpPDFTabOpnFtrPage : public SfxTabPage
DECL_LINK(ToggleRbMagnHdl, weld::Toggleable&, void);
void ToggleRbPgLyContinueFacingHdl();
+ void ToggleInitialView(ImpPDFTabDialog & rParent);
public:
ImpPDFTabOpnFtrPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
@@ -282,7 +287,7 @@ public:
static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrSet );
void GetFilterConfigItem( ImpPDFTabDialog* paParent);
- void SetFilterConfigItem( const ImpPDFTabDialog* paParent );
+ void SetFilterConfigItem(ImpPDFTabDialog* pParent);
};
/// Class tab page viewer
diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index d59cb26b01e7..fb262b8e7ab3 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -5267,7 +5267,7 @@
</info>
</enumeration>
</constraints>
- <value>0</value>
+ <value>1</value>
</prop>
<prop oor:name="Magnification" oor:type="xs:int" oor:nillable="false">
<info>
diff --git a/sc/qa/uitest/calc_tests4/exportToPDF.py b/sc/qa/uitest/calc_tests4/exportToPDF.py
index e44d80be0ef4..a635ee60a5d0 100644
--- a/sc/qa/uitest/calc_tests4/exportToPDF.py
+++ b/sc/qa/uitest/calc_tests4/exportToPDF.py
@@ -47,13 +47,13 @@ class exportToPDF(UITestCase):
for child in nonSelectedChildren:
self.assertEqual("false", get_state_as_dict(xDialog.getChild(child))['Selected'])
- checkedChildren = ['allbookmarks', 'changeany', 'default', 'defaultlayout', 'fitdefault', 'jpegcompress', 'pageonly', 'printhigh', 'selection']
+ checkedChildren = ['allbookmarks', 'changeany', 'default', 'defaultlayout', 'fitdefault', 'jpegcompress', 'outline', 'printhigh', 'selection']
for child in checkedChildren:
self.assertEqual("true", get_state_as_dict(xDialog.getChild(child))['Checked'])
nonCheckedChildren = ['all', 'changecomment', 'changeform', 'changeinsdel', 'changenone', 'contfacinglayout', 'contlayout', 'fitvis', 'fitwidth',
- 'fitwin', 'fitzoom', 'losslesscompress', 'openinternet', 'openpdf', 'outline', 'printlow', 'printnone', 'range',
+ 'fitwin', 'fitzoom', 'losslesscompress', 'openinternet', 'openpdf', 'pageonly', 'printlow', 'printnone', 'range',
'singlelayout', 'thumbs', 'visiblebookmark']
for child in nonCheckedChildren:
diff --git a/sd/qa/uitest/impress_tests/exportToPDF.py b/sd/qa/uitest/impress_tests/exportToPDF.py
index f1240fabf165..429e28df4f0d 100644
--- a/sd/qa/uitest/impress_tests/exportToPDF.py
+++ b/sd/qa/uitest/impress_tests/exportToPDF.py
@@ -49,13 +49,13 @@ class exportToPDF(UITestCase):
for child in nonSelectedChildren:
self.assertEqual("false", get_state_as_dict(xDialog.getChild(child))['Selected'])
- checkedChildren = ['all', 'allbookmarks', 'changeany', 'default', 'defaultlayout', 'fitdefault', 'jpegcompress', 'pageonly', 'printhigh']
+ checkedChildren = ['all', 'allbookmarks', 'changeany', 'default', 'defaultlayout', 'fitdefault', 'jpegcompress', 'outline', 'printhigh']
for child in checkedChildren:
self.assertEqual("true", get_state_as_dict(xDialog.getChild(child))['Checked'])
nonCheckedChildren = ['changecomment', 'changeform', 'changeinsdel', 'changenone', 'contfacinglayout', 'contlayout', 'fitvis',
- 'fitwidth', 'fitwin', 'fitzoom', 'losslesscompress', 'openinternet', 'openpdf', 'outline', 'printlow', 'printnone', 'range',
+ 'fitwidth', 'fitwin', 'fitzoom', 'losslesscompress', 'openinternet', 'openpdf', 'pageonly', 'printlow', 'printnone', 'range',
'selection', 'singlelayout', 'thumbs', 'visiblebookmark']
for child in nonCheckedChildren:
diff --git a/sw/qa/uitest/writer_tests4/exportToPDF.py b/sw/qa/uitest/writer_tests4/exportToPDF.py
index 18eb56c75615..ef628d4eea68 100644
--- a/sw/qa/uitest/writer_tests4/exportToPDF.py
+++ b/sw/qa/uitest/writer_tests4/exportToPDF.py
@@ -45,13 +45,13 @@ class exportToPDF(UITestCase):
for child in nonSelectedChildren:
self.assertEqual("false", get_state_as_dict(xDialog.getChild(child))['Selected'])
- checkedChildren = ['all', 'allbookmarks', 'changeany', 'default', 'defaultlayout', 'fitdefault', 'jpegcompress', 'pageonly', 'printhigh']
+ checkedChildren = ['all', 'allbookmarks', 'changeany', 'default', 'defaultlayout', 'fitdefault', 'jpegcompress', 'outline', 'printhigh']
for child in checkedChildren:
self.assertEqual("true", get_state_as_dict(xDialog.getChild(child))['Checked'])
nonCheckedChildren = ['changecomment', 'changeform', 'changeinsdel', 'changenone', 'contfacinglayout', 'contlayout', 'fitvis',
- 'fitwidth', 'fitwin', 'fitzoom', 'losslesscompress', 'openinternet', 'openpdf', 'outline', 'printlow', 'printnone', 'range',
+ 'fitwidth', 'fitwin', 'fitzoom', 'losslesscompress', 'openinternet', 'openpdf', 'pageonly', 'printlow', 'printnone', 'range',
'selection', 'singlelayout', 'thumbs', 'visiblebookmark']
for child in nonCheckedChildren: