summaryrefslogtreecommitdiff
path: root/filter
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 /filter
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>
Diffstat (limited to 'filter')
-rw-r--r--filter/source/pdf/impdialog.cxx70
-rw-r--r--filter/source/pdf/impdialog.hxx7
2 files changed, 74 insertions, 3 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