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>
42 #include <bitmaps.hlst>
60 OUString(
"Closeable"),
63 OUString(
"PositionX"),
64 OUString(
"PositionY"),
72 Any( sal_Int32( 200 ) ),
73 Any( sal_Int32( 52 ) ),
80 Sequence< Any > aValues( pValues, nCount );
92 OUString(
"PositionX"),
93 OUString(
"PositionY"),
100 Any( sal_Int32( 0 ) ),
101 Any( sal_Int32( 0 ) ),
102 Any( sal_Int32( 0 ) ),
104 Any( sal_Int32( 85 ) ) };
109 Sequence< Any > aValues( pValues, nCount );
112 "rdmNavi", aNames, aValues );
115 xPropertySet->setPropertyValue(
"Name",
Any( OUString(
"rdmNavi") ) );
123 xPropertySet->setPropertyValue(
"ImageURL",
Any( OUString(
"private:graphicrepository/" BMP_PRESENTATION_MINIMIZER) ) );
124 xPropertySet->setPropertyValue(
"Activated",
Any(
true ) );
125 xPropertySet->setPropertyValue(
"Complete",
Any(
true ) );
141 Reference< XInterface > xRoadmapItem( xSFRoadmap->createInstance(), UNO_SET_THROW );
143 xPropertySet->setPropertyValue(
"Label",
Any( rLabel ) );
144 xPropertySet->setPropertyValue(
"Enabled",
Any(
true ) );
145 xPropertySet->setPropertyValue(
"ID",
Any( nItemID ) );
146 aIndexContainerRoadmap->insertByIndex( nIndex,
Any( xRoadmapItem ) );
157 sal_Int16 nInt16 = 0;
160 Sequence< sal_Int16 > aSelectedItems;
165 if ( aAny >>= aSelectedItems )
167 if ( aSelectedItems.hasElements() )
169 sal_Int16 nSelectedItem = aSelectedItems[ 0 ];
171 if ( aAny >>= aStringItemList )
173 if ( aStringItemList.getLength() > nSelectedItem )
180 if ( !((aAny >>= nInt16) && nInt16) )
184 if ( !(aAny >>= aSelectedItems) )
187 if ( aSelectedItems.hasElements() )
189 sal_Int16 nSelectedItem = aSelectedItems[ 0 ];
191 if ( aAny >>= aStringItemList )
193 if ( aStringItemList.getLength() > nSelectedItem )
212 mxStatusDispatcher( rxStatusDispatcher )
214 Reference< XStorable > xStorable(
mxController->getModel(), UNO_QUERY_THROW );
244 Reference< XItemEventBroadcaster > xRoadmapBroadcaster(
mxRoadmapControl, UNO_QUERY_THROW );
260 else if ( nOldStep == 0 )
300 OUString aSelectedItem;
301 Sequence< sal_Int16 > sSelectedItems;
307 if ( sSelectedItems.getLength() == 1 )
309 sal_Int16 nSelectedItem = sSelectedItems[ 0 ];
310 if ( nSelectedItem < sItemList.getLength() )
311 aSelectedItem = sItemList[ nSelectedItem ];
314 return aSelectedItem;
325 if ( *pVal >>= sStatus )
334 sal_Int32 nProgress = 0;
335 if ( *pVal >>= nProgress )
351 Reference< XControl > xControl;
352 Any aSource( Event.Source );
353 if ( aSource >>= xControl )
356 OUString aControlName;
357 xPropertySet->getPropertyValue(
"Name" ) >>= aControlName;
368 if ( xPropertySet->getPropertyValue(
"State" ) >>= nState )
374 if ( xPropertySet->getPropertyValue(
"State" ) >>= nState )
380 if ( xPropertySet->getPropertyValue(
"State" ) >>= nState )
390 sal_Int16 nInt16 = 0;
391 if ( xPropertySet->getPropertyValue(
"State" ) >>= nInt16 )
402 if ( xPropertySet->getPropertyValue(
"State" ) >>= nState )
413 if ( xPropertySet->getPropertyValue(
"State" ) >>= nInt16 )
422 if ( xPropertySet->getPropertyValue(
"State" ) >>= nState )
428 if ( xPropertySet->getPropertyValue(
"State" ) >>= nState )
434 if ( xPropertySet->getPropertyValue(
"State" ) >>= nState )
440 if ( xPropertySet->getPropertyValue(
"State" ) >>= nState )
446 if ( xPropertySet->getPropertyValue(
"State" ) >>= nState )
452 if ( xPropertySet->getPropertyValue(
"State" ) >>= nState )
459 if ( xPropertySet->getPropertyValue(
"State" ) >>= nState )
479 switch(
TKGet( rEvent.ActionCommand ) )
496 bool bSuccessfullyExecuted =
true;
497 sal_Int16 nInt16 = 0;
508 if ( xStorable.is() && xStorable->hasLocation() )
511 if ( !aURLObj.hasFinalSlash() )
522 Reference<XTitle> xTitle(
524 aName = xTitle->getTitle();
527 if (!aName.isEmpty())
530 aFileOpenDialog.setDefaultName(aName);
533 if (aFileOpenDialog.execute() == dialogs::ExecutableDialogResults::OK)
535 aSaveAsURL = aFileOpenDialog.getURL();
539 if ( aSaveAsURL.isEmpty() )
542 bSuccessfullyExecuted =
false;
547 for ( sal_uInt32
i = osl_getGlobalTimer(); (
i + 500 ) > ( osl_getGlobalTimer() ); )
555 if ( xModifiable->isModified() )
559 nullptr, VclMessageType::Question, VclButtonsType::YesNo,
561 if (popupDlg->run() !=
RET_YES)
574 if ( bSuccessfullyExecuted )
577 OUString aSettingsName;
580 if ( nInt16 && !aSettingsName.isEmpty() )
585 aNewSettings.maName = aSettingsName;
586 if ( aIter == rSettings.end() )
587 rSettings.push_back( aNewSettings );
589 *aIter = aNewSettings;
592 if ( bSuccessfullyExecuted )
595 aURL.Protocol =
"vnd.com.sun.star.comp.PPPOptimizer:";
596 aURL.Path =
"optimize";
598 Sequence< PropertyValue > lArguments( 3 );
599 lArguments[ 0 ].Name =
"Settings";
601 lArguments[ 1 ].Name =
"StatusDispatcher";
603 lArguments[ 2 ].Name =
"InformationDialog";
615 catch (css::io::IOException&)
621 catch (css::uno::Exception&)
631 Any(static_cast<sal_Int32>(0)));
660 if ( !aSelectedItem.isEmpty() )
664 if ( aIter != rList.end() )
666 rList.erase( aIter );
682 if ( !rEvent.ActionCommand.isEmpty() )
686 if ( aIter != rList.end() )
700 if ( aAny >>= fDouble )
710 bool lcl_mapResolution(OUString& rResolution,
const OUString& rImageResolution)
712 if (rImageResolution.getToken(1,
';')!=rResolution)
714 rResolution = rImageResolution.getToken(0,
';');
724 if ( !(aAny >>= aString) )
744 if ( aAny >>= fDouble )
757 if ( aAny >>= fDouble )
virtual void SAL_CALL actionPerformed(const css::awt::ActionEvent &Event) override
void EnablePage(sal_Int16 nStep)
void disableControl(const OUString &rControlName)
const css::uno::Any * GetStatusValue(const PPPOptimizerTokenEnum eStat) const
OptimizerDialog & mrOptimizerDialog
css::uno::Any getControlProperty(const OUString &rControlName, const OUString &rPropertyName)
void InitializeStatusValues(const css::uno::Sequence< css::beans::PropertyValue > &rOptimizationStats)
void UpdateControlStatesPage1()
virtual void SAL_CALL disposing(const css::lang::EventObject &Source) override
void UpdateControlStatesPage4()
virtual void SAL_CALL disposing(const css::lang::EventObject &Source) override
OptimizerDialog & mrOptimizerDialog
bool removeExtension(sal_Int32 nIndex=LAST_SEGMENT, bool bIgnoreFinalSlash=true)
void SetStatusValue(const PPPOptimizerTokenEnum eStat, const css::uno::Any &rStatValue)
css::uno::Sequence< css::beans::PropertyValue > GetConfigurationSequence()
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)
virtual void SAL_CALL disposing(const css::lang::EventObject &Source) override
std::vector< OptimizerSettings >::iterator GetOptimizerSettingsByName(const OUString &rName)
void ActivatePage(sal_Int16 nStep)
css::uno::Reference< css::frame::XFrame > & GetFrame()
virtual void SAL_CALL itemStateChanged(const css::awt::ItemEvent &Event) override
css::uno::Reference< css::frame::XDispatch > & GetStatusDispatcher()
void setPropertyValues(const css::uno::Sequence< OUString > &rNameSeq, const css::uno::Sequence< css::uno::Any > &rValueSeq)
void UpdateControlStatesPage3()
#define ITEM_ID_OLE_OPTIMIZATION
void InsertRoadmapItem(const sal_Int32 nIndex, const OUString &rLabel, const sal_Int32 nItemID)
void setControlProperty(const OUString &rControlName, const OUString &rPropertyName, const css::uno::Any &rPropertyValue)
void InitializeStatusValuesFromDocument(const css::uno::Reference< css::frame::XModel > &rxModel)
OptimizerDialog & mrOptimizerDialog
#define ERRCODE_IO_CANTWRITE
css::uno::Reference< css::uno::XInterface > mxRoadmapControl
OptimizerDialog & mrOptimizerDialog
css::uno::Reference< css::awt::XItemListener > mxItemListener
#define SAL_N_ELEMENTS(arr)
virtual void SAL_CALL disposing(const css::lang::EventObject &Source) override
void SwitchPage(sal_Int16 nNewStep)
OUString getString(const PPPOptimizerTokenEnum) const
#define ERRCODE_IO_GENERAL
void SetConfigProperty(const PPPOptimizerTokenEnum, const css::uno::Any &aValue)
void DeactivatePage(sal_Int16 nStep)
static DialogMask HandleError(ErrCode nId, weld::Window *pParent=nullptr, DialogMask nMask=DialogMask::MAX)
#define ITEM_ID_GRAPHIC_OPTIMIZATION
#define ITEM_ID_INTRODUCTION
void UpdateStatus(const css::uno::Sequence< css::beans::PropertyValue > &rStatus)
void endExecute(bool bStatus)
OptimizerDialog & mrOptimizerDialog
virtual void SAL_CALL actionPerformed(const css::awt::ActionEvent &Event) override
const css::uno::Reference< css::frame::XController > & controller() const
void UpdateConfiguration()
void enableControl(const OUString &rControlName)
void DisablePage(sal_Int16 nStep)
const PropertyValue * pValues
css::uno::Reference< css::frame::XController > mxController
virtual void SAL_CALL disposing(const css::lang::EventObject &Source) override
css::uno::Reference< css::uno::XInterface > insertControlModel(const OUString &rServiceName, const OUString &rName, const css::uno::Sequence< OUString > &rPropertyNames, const css::uno::Sequence< css::uno::Any > &rPropertyValues)
virtual void SAL_CALL textChanged(const css::awt::TextEvent &Event) override
#define ERRCTX_SFX_SAVEASDOC
void UpdateControlStates(sal_Int16 nStep=-1)
std::vector< OptimizerSettings > & GetOptimizerSettings()
css::uno::Reference< css::awt::XControl > getControl(const OUString &rControlName) const
OUString GetSelectedString(OUString const &token)
PPPOptimizerTokenEnum TKGet(const OUString &rToken)
css::beans::PropertyValues GetStatusSequence()
css::uno::Any GetConfigProperty(const PPPOptimizerTokenEnum) const
css::uno::Reference< css::uno::XInterface > mxRoadmapControlModel
void UpdateControlStatesPage0()
OptimizationStats maStats
const css::uno::Reference< css::uno::XComponentContext > & GetComponentContext() const
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, bool bMobile=false)
virtual void SAL_CALL textChanged(const css::awt::TextEvent &Event) override
void UpdateControlStatesPage2()