24#include <com/sun/star/awt/XItemEventBroadcaster.hpp>
25#include <com/sun/star/beans/XPropertySet.hpp>
26#include <com/sun/star/container/XIndexContainer.hpp>
27#include <com/sun/star/frame/XStorable.hpp>
28#include <com/sun/star/frame/XTitle.hpp>
29#include <com/sun/star/lang/XSingleServiceFactory.hpp>
30#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
31#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
32#include <com/sun/star/io/IOException.hpp>
33#include <com/sun/star/util/XModifiable.hpp>
45#include <bitmaps.hlst>
59 :
vcl::OWizardPage(pPage, &rOptimizerDialog,
"modules/simpress/ui/pmintropage.ui",
"PMIntroPage")
60 , mrOptimizerDialog(rOptimizerDialog)
61 , mxComboBox(m_xBuilder->weld_combo_box(
"LB_SETTINGS"))
62 , mxButton(m_xBuilder->weld_button(
"STR_REMOVE"))
72 for (
const auto&
a : rItemList)
75 mxButton->set_sensitive(bRemoveButtonEnabled);
79 :
vcl::OWizardPage(pPage, &rOptimizerDialog,
"modules/simpress/ui/pmslidespage.ui",
"PMSlidesPage")
80 , mrOptimizerDialog(rOptimizerDialog)
81 , mxMasterSlides(m_xBuilder->weld_check_button(
"STR_DELETE_MASTER_PAGES"))
82 , mxHiddenSlides(m_xBuilder->weld_check_button(
"STR_DELETE_HIDDEN_SLIDES"))
83 , mxUnusedSlides(m_xBuilder->weld_check_button(
"STR_CUSTOM_SHOW"))
84 , mxComboBox(m_xBuilder->weld_combo_box(
"LB_SLIDES"))
85 , mxClearNodes(m_xBuilder->weld_check_button(
"STR_DELETE_NOTES_PAGES"))
97 for (
const auto&
a : rCustomShowList)
111 :
vcl::OWizardPage(pPage, &rOptimizerDialog,
"modules/simpress/ui/pmimagespage.ui",
"PMImagesPage")
112 , mrOptimizerDialog(rOptimizerDialog)
113 , m_xLossLessCompression(m_xBuilder->weld_radio_button(
"STR_LOSSLESS_COMPRESSION"))
114 , m_xQualityLabel(m_xBuilder->weld_label(
"STR_QUALITY"))
115 , m_xQuality(m_xBuilder->weld_spin_button(
"SB_QUALITY"))
116 , m_xJpegCompression(m_xBuilder->weld_radio_button(
"STR_JPEG_COMPRESSION"))
117 , m_xResolution(m_xBuilder->weld_combo_box(
"LB_RESOLUTION"))
118 , m_xRemoveCropArea(m_xBuilder->weld_check_button(
"STR_REMOVE_CROP_AREA"))
119 , m_xEmbedLinkedGraphics(m_xBuilder->weld_check_button(
"STR_EMBED_LINKED_GRAPHICS"))
132 int nResolution,
bool bEmbedLinkedGraphics)
145 :
vcl::OWizardPage(pPage, &rOptimizerDialog,
"modules/simpress/ui/pmobjectspage.ui",
"PMObjectsPage")
146 , mrOptimizerDialog(rOptimizerDialog)
147 , m_xCreateStaticImage(m_xBuilder->weld_check_button(
"STR_OLE_REPLACE"))
148 , m_xAllOLEObjects(m_xBuilder->weld_radio_button(
"STR_ALL_OLE_OBJECTS"))
149 , m_xForeignOLEObjects(m_xBuilder->weld_radio_button(
"STR_ALIEN_OLE_OBJECTS_ONLY"))
150 ,
m_xLabel(m_xBuilder->weld_label(
"STR_OLE_OBJECTS_DESC"))
173 :
vcl::OWizardPage(pPage, &rOptimizerDialog,
"modules/simpress/ui/pmsummarypage.ui",
"PMSummaryPage")
174 , mrOptimizerDialog(rOptimizerDialog)
175 , m_xLabel1(m_xBuilder->weld_label(
"LABEL1"))
176 , m_xLabel2(m_xBuilder->weld_label(
"LABEL2"))
177 , m_xLabel3(m_xBuilder->weld_label(
"LABEL3"))
178 , m_xCurrentSize(m_xBuilder->weld_label(
"CURRENT_FILESIZE"))
179 , m_xEstimatedSize(m_xBuilder->weld_label(
"ESTIMATED_FILESIZE"))
180 , m_xStatus(m_xBuilder->weld_label(
"STR_STATUS"))
181 , m_xProgress(m_xBuilder->weld_progress_bar(
"PROGRESS"))
182 , m_xApplyToCurrent(m_xBuilder->weld_radio_button(
"STR_APPLY_TO_CURRENT"))
183 , m_xSaveToNew(m_xBuilder->weld_radio_button(
"STR_SAVE_AS"))
184 , m_xComboBox(m_xBuilder->weld_combo_box(
"MY_SETTINGS"))
185 , m_xSaveSettings(m_xBuilder->weld_check_button(
"STR_SAVE_SETTINGS"))
201 const std::vector<OUString>& rItemList,
202 const std::vector<OUString>& rSummaryStrings,
203 const OUString& rCurrentFileSize,
204 const OUString& rEstimatedFileSize)
209 for (
const auto&
a : rItemList)
215 assert(rSummaryStrings.size() == 3);
216 m_xLabel1->set_label(rSummaryStrings[0]);
217 m_xLabel2->set_label(rSummaryStrings[1]);
218 m_xLabel3->set_label(rSummaryStrings[2]);
250 m_xAssistant->set_page_side_image(BMP_PRESENTATION_MINIMIZER);
257 if (!sTKName.isEmpty())
262 if (!sTKCustomShowName.isEmpty())
271 , mxController(rxFrame->getController())
272 , mxStatusDispatcher(rxStatusDispatcher)
274 Reference< XStorable > xStorable(
mxController->getModel(), UNO_QUERY_THROW );
315 OUString sIdent(OUString::number(
nState));
318 std::unique_ptr<vcl::OWizardPage> xRet;
323 xRet.reset(
new IntroPage(pPageContainer, *
this));
326 xRet.reset(
new SlidesPage(pPageContainer, *
this));
329 xRet.reset(
new ImagesPage(pPageContainer, *
this));
332 xRet.reset(
new ObjectsPage(pPageContainer, *
this));
335 xRet.reset(
new SummaryPage(pPageContainer, *
this));
384 if ( *pVal >>= sStatus )
392 sal_Int32 nProgress = 0;
393 if ( *pVal >>= nProgress )
405 if (!rBox.get_active())
408 const bool bSaveToNew = &rBox == m_xSaveToNew.get();
409 mrOptimizerDialog.SetConfigProperty(
TK_SaveAs,
Any(bSaveToNew) );
414 m_xComboBox->set_sensitive(rBox.get_active());
419 if (!rBox.get_active())
422 const bool bALLOles = &rBox == m_xAllOLEObjects.get();
423 sal_Int16 nInt16 = bALLOles ? 0 : 1;
429 const bool bOLEOptimization = rBox.get_active();
431 m_xAllOLEObjects->set_sensitive(bOLEOptimization);
432 m_xForeignOLEObjects->set_sensitive(bOLEOptimization);
437 if (!rBox.get_active())
440 const bool bJPEGCompression = &rBox == m_xJpegCompression.get();
442 m_xQualityLabel->set_sensitive(bJPEGCompression);
443 m_xQuality->set_sensitive(bJPEGCompression);
473 mxComboBox->set_sensitive(rBox.get_active());
487 bool bSuccessfullyExecuted =
true;
496 Reference< XStorable > xStorable(
mxController->getModel(), UNO_QUERY );
497 if ( xStorable.is() && xStorable->hasLocation() )
511 Reference<XTitle> xTitle(
512 GetFrame()->getController()->getModel(), UNO_QUERY);
513 aName = xTitle->getTitle();
516 if (!
aName.isEmpty())
522 if (aFileOpenDialog.
execute() == dialogs::ExecutableDialogResults::OK)
524 aSaveAsURL = aFileOpenDialog.
getURL();
528 if ( aSaveAsURL.isEmpty() )
531 bSuccessfullyExecuted =
false;
536 for ( sal_uInt32
i = osl_getGlobalTimer(); (
i + 500 ) > ( osl_getGlobalTimer() ); )
542 Reference<XModifiable> xModifiable(
mxController->getModel(),
544 if ( xModifiable->isModified() )
548 m_xAssistant.get(), VclMessageType::Question, VclButtonsType::YesNo,
550 if (popupDlg->run() !=
RET_YES)
561 if ( bSuccessfullyExecuted )
566 if (bSaveSettings && !aSettingsName.isEmpty())
571 aNewSettings.
maName = aSettingsName;
572 if ( aIter == rSettings.end() )
573 rSettings.push_back( aNewSettings );
575 *aIter = aNewSettings;
578 if ( bSuccessfullyExecuted )
581 aURL.Protocol =
"vnd.com.sun.star.comp.PPPOptimizer:";
582 aURL.Path =
"optimize";
584 Sequence< PropertyValue > lArguments{
597 catch (css::io::IOException&)
603 catch (css::uno::Exception&)
639 OUString aSelectedItem(mxComboBox->get_active_text());
640 if ( !aSelectedItem.isEmpty() )
642 std::vector< OptimizerSettings >::iterator aIter( mrOptimizerDialog.GetOptimizerSettingsByName( aSelectedItem ) );
643 std::vector< OptimizerSettings >& rList( mrOptimizerDialog.GetOptimizerSettings() );
644 if ( aIter != rList.end() )
646 rList.erase( aIter );
647 mrOptimizerDialog.UpdateControlStates();
654 OUString sActionCommand(rBox.get_active_text());
655 if (!sActionCommand.isEmpty())
657 std::vector< OptimizerSettings >::iterator aIter( mrOptimizerDialog.GetOptimizerSettingsByName(sActionCommand) );
658 std::vector< OptimizerSettings >& rList( mrOptimizerDialog.GetOptimizerSettings() );
659 if ( aIter != rList.end() )
662 mrOptimizerDialog.UpdateControlStates();
667 mrOptimizerDialog.SetConfigProperty(
TK_JPEGQuality,
Any(
static_cast<sal_Int32
>(rBox.get_value()) ) );
672 mrOptimizerDialog.SetConfigProperty(
TK_ImageResolution,
Any( m_xResolution->get_active_id().toInt32() ) );
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, const ILibreOfficeKitNotifier *pNotifier=nullptr)
static bool Reschedule(bool bHandleAllCurrentEvents=false)
std::vector< OptimizerSettings > & GetOptimizerSettings()
OUString getString(const PPPOptimizerTokenEnum) const
css::uno::Sequence< css::beans::PropertyValue > GetConfigurationSequence()
void SetConfigProperty(const PPPOptimizerTokenEnum, const css::uno::Any &aValue)
css::uno::Any GetConfigProperty(const PPPOptimizerTokenEnum) const
std::vector< OptimizerSettings >::iterator GetOptimizerSettingsByName(const OUString &rName)
css::uno::Reference< css::uno::XComponentContext > mxContext
static DialogMask HandleError(ErrCode nId, weld::Window *pParent=nullptr, DialogMask nMask=DialogMask::MAX)
void setDefaultName(const OUString &)
OUString getFilterName() const
OUString getName(sal_Int32 nIndex=LAST_SEGMENT, bool bIgnoreFinalSlash=true, DecodeMechanism eMechanism=DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
bool removeExtension(sal_Int32 nIndex=LAST_SEGMENT, bool bIgnoreFinalSlash=true)
bool hasFinalSlash() const
std::unique_ptr< weld::RadioButton > m_xLossLessCompression
std::unique_ptr< weld::CheckButton > m_xEmbedLinkedGraphics
void UpdateControlStates(bool bJPEGCompression, int nJPEGQuality, bool bRemoveCropArea, int nResolution, bool bEmbedLinkedGraphics)
ImagesPage(weld::Container *pPage, OptimizerDialog &rOptimizerDialog)
std::unique_ptr< weld::CheckButton > m_xRemoveCropArea
std::unique_ptr< weld::ComboBox > m_xResolution
std::unique_ptr< weld::Label > m_xQualityLabel
std::unique_ptr< weld::RadioButton > m_xJpegCompression
std::unique_ptr< weld::SpinButton > m_xQuality
OUString Get_TK_Name() const
void UpdateControlStates(const std::vector< OUString > &rItemList, int nSelectedItem, bool bRemoveButtonEnabled)
IntroPage(weld::Container *pPage, OptimizerDialog &rOptimizerDialog)
std::unique_ptr< weld::ComboBox > mxComboBox
std::unique_ptr< weld::Button > mxButton
void Init(const OUString &rDesc)
std::unique_ptr< weld::RadioButton > m_xForeignOLEObjects
std::unique_ptr< weld::Label > m_xLabel
std::unique_ptr< weld::RadioButton > m_xAllOLEObjects
ObjectsPage(weld::Container *pPage, OptimizerDialog &rOptimizerDialog)
void UpdateControlStates(bool bConvertOLEObjects, int nOLEOptimizationType)
std::unique_ptr< weld::CheckButton > m_xCreateStaticImage
css::beans::PropertyValues GetStatusSequence()
void SetStatusValue(const PPPOptimizerTokenEnum eStat, const css::uno::Any &rStatValue)
const css::uno::Any * GetStatusValue(const PPPOptimizerTokenEnum eStat) const
void InitializeStatusValues(const css::uno::Sequence< css::beans::PropertyValue > &rOptimizationStats)
void InitializeStatusValuesFromDocument(const css::uno::Reference< css::frame::XModel > &rxModel)
void UpdateControlStatesPage0()
std::unique_ptr< BuilderPage > createPage(vcl::WizardTypes::WizardState nState) override
css::uno::Reference< css::frame::XController > mxController
void SetIntroPage(IntroPage *pPage0)
void UpdateControlStates(sal_Int16 nStep=-1)
OptimizerDialog(const css::uno::Reference< css::uno::XComponentContext > &rxContext, css::uno::Reference< css::frame::XFrame > const &rxFrame, css::uno::Reference< css::frame::XDispatch > const &rxStatusDispatcher)
css::uno::Reference< css::frame::XFrame > & GetFrame()
void UpdateControlStatesPage2()
void SetImagesPage(ImagesPage *pPage2)
void SetSlidesPage(SlidesPage *pPage1)
OptimizationStats maStats
css::uno::Reference< css::frame::XDispatch > & GetStatusDispatcher()
void UpdateStatus(const css::uno::Sequence< css::beans::PropertyValue > &rStatus)
void UpdateConfiguration()
void UpdateControlStatesPage3()
void SetObjectsPage(ObjectsPage *pPage3)
virtual OUString getStateDisplayName(vcl::WizardTypes::WizardState nState) const override
void UpdateControlStatesPage4()
void SetSummaryPage(SummaryPage *pPage4)
void UpdateControlStatesPage1()
virtual bool onFinish() override
void Init(const css::uno::Sequence< OUString > &rCustomShowList)
std::unique_ptr< weld::CheckButton > mxClearNodes
OUString Get_TK_CustomShowName() const
std::unique_ptr< weld::CheckButton > mxUnusedSlides
std::unique_ptr< weld::CheckButton > mxHiddenSlides
void UpdateControlStates(bool bDeleteUnusedMasterPages, bool bDeleteHiddenSlides, bool bDeleteNotesPages)
SlidesPage(weld::Container *pPage, OptimizerDialog &rOptimizerDialog)
std::unique_ptr< weld::ComboBox > mxComboBox
std::unique_ptr< weld::CheckButton > mxMasterSlides
void Init(const OUString &rSettingsName, bool bIsReadonly)
SummaryPage(weld::Container *pPage, OptimizerDialog &rOptimizerDialog)
void UpdateControlStates(bool bSaveAs, bool bSaveSettingsEnabled, const std::vector< OUString > &rItemList, const std::vector< OUString > &rSummaryStrings, const OUString &rCurrentFileSize, const OUString &rEstimatedFileSize)
bool GetSaveAsNew() const
std::unique_ptr< weld::Label > m_xLabel3
std::unique_ptr< weld::Label > m_xLabel2
std::unique_ptr< weld::Label > m_xEstimatedSize
bool GetSaveSettings() const
std::unique_ptr< weld::CheckButton > m_xSaveSettings
std::unique_ptr< weld::Label > m_xLabel1
std::unique_ptr< weld::ProgressBar > m_xProgress
OUString GetSettingsName() const
void UpdateProgressValue(int nProgress)
std::unique_ptr< weld::Label > m_xCurrentSize
std::unique_ptr< weld::Label > m_xStatus
void UpdateStatusLabel(const OUString &rStatus)
std::unique_ptr< weld::ComboBox > m_xComboBox
std::unique_ptr< weld::RadioButton > m_xSaveToNew
std::unique_ptr< weld::RadioButton > m_xApplyToCurrent
std::unique_ptr< weld::Label > m_xLabel
void declarePath(RoadmapWizardTypes::PathId _nPathId, const RoadmapWizardTypes::WizardPath &_lWizardStates)
std::unique_ptr< weld::Button > m_xNextPage
std::unique_ptr< weld::Button > m_xCancel
std::unique_ptr< weld::Button > m_xPrevPage
virtual void ActivatePage()
bool ShowPage(WizardTypes::WizardState nState)
std::unique_ptr< weld::Button > m_xFinish
std::unique_ptr< weld::Assistant > m_xAssistant
void set_title(const OUString &rTitle)
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
#define ERRCODE_IO_GENERAL
#define ERRCODE_IO_CANTWRITE
#define LINK(Instance, Class, Member)
css::beans::PropertyValue makePropertyValue(const OUString &rName, T &&rValue)
IMPL_LINK_NOARG(IntroPage, ButtonActionPerformed, weld::Button &, void)
IMPL_LINK(SummaryPage, SaveAsNewActionPerformed, weld::Toggleable &, rBox, void)
#define ITEM_ID_OLE_OPTIMIZATION
#define ITEM_ID_INTRODUCTION
#define ITEM_ID_GRAPHIC_OPTIMIZATION
PPPOptimizerTokenEnum TKGet(std::u16string_view rToken)
@ STR_WARN_UNSAVED_PRESENTATION
@ STR_SUN_OPTIMIZATION_WIZARD2
@ TK_DeleteUnusedMasterPages
#define ERRCTX_SFX_SAVEASDOC