27#include <com/sun/star/awt/PushButtonType.hpp>
28#include <com/sun/star/awt/XSpinField.hpp>
29#include <com/sun/star/awt/XTextComponent.hpp>
30#include <com/sun/star/presentation/XCustomPresentationSupplier.hpp>
31#include <com/sun/star/drawing/XMasterPagesSupplier.hpp>
32#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
33#include <com/sun/star/awt/FontDescriptor.hpp>
34#include <com/sun/star/awt/FontWeight.hpp>
35#include <com/sun/star/frame/XStorable.hpp>
36#include <rtl/ustrbuf.hxx>
57 int nSelectedItem = -1;
58 std::vector<OUString> aItemList;
60 if ( rList.size() > 1 )
62 for ( std::vector<OptimizerSettings>::size_type
i = 1;
i < rList.size();
i++ )
64 aItemList.push_back(rList[
i].
maName);
65 if ( nSelectedItem < 0 )
67 if ( rList[
i ] == rList[ 0 ] )
68 nSelectedItem =
static_cast< short >(
i - 1 );
72 bool bRemoveButtonEnabled =
false;
73 if ( nSelectedItem >= 0 )
75 if ( nSelectedItem > 2 )
76 bRemoveButtonEnabled =
true;
96 Sequence< OUString > aCustomShowList;
100 Reference< XCustomPresentationSupplier > aXCPSup(
xModel, UNO_QUERY_THROW );
101 Reference< XNameContainer > aXCont( aXCPSup->getCustomPresentations() );
103 aCustomShowList = aXCont->getElementNames();
138 Reference< XDrawPagesSupplier > xDrawPagesSupplier(
xModel, UNO_QUERY_THROW );
139 Reference< XDrawPages > xDrawPages( xDrawPagesSupplier->getDrawPages(), UNO_SET_THROW );
140 for ( sal_Int32
i = 0;
i < xDrawPages->getCount();
i++ )
142 Reference< XShapes > xShapes( xDrawPages->getByIndex(
i ), UNO_QUERY_THROW );
143 for ( sal_Int32 j = 0; j < xShapes->getCount(); j++ )
145 Reference< XShape > xShape( xShapes->getByIndex( j ), UNO_QUERY_THROW );
146 if ( xShape->getShapeType() ==
"com.sun.star.drawing.OLE2Shape" )
158 double fVal(
static_cast<double>( rVal ) );
161 OUStringBuffer aVal( OUString::number( fVal ) );
162 sal_Int32 nX( aVal.indexOf(
'.' ) );
165 aVal.setLength( nX + 2 );
166 aVal[nX] = nSeparator;
168 aVal.append(
" MB" );
169 return aVal.makeStringAndClear();
178 std::vector<OUString> aItemList;
180 if ( rList.size() > 1 )
182 for ( std::vector<OptimizerSettings>::size_type
w = 1;
w < rList.size();
w++ )
183 aItemList.push_back(rList[
w ].maName);
187 bool bSaveSettingsEnabled =
true;
188 if ( rList.size() > 1 )
190 for ( std::vector<OptimizerSettings>::size_type
w = 1;
w < rList.size();
w++ )
192 if ( rList[
w ] == rList[ 0 ] )
194 bSaveSettingsEnabled =
false;
200 std::vector< OUString > aSummaryStrings;
203 sal_Int32 nDeletedSlides = 0;
205 if (!sTKCustomShowName.isEmpty())
209 Reference< XDrawPagesSupplier > xDrawPagesSupplier(
mxController->getModel(), UNO_QUERY_THROW );
210 Reference< XDrawPages > xDrawPages( xDrawPagesSupplier->getDrawPages(), UNO_SET_THROW );
211 for( sal_Int32
i = 0;
i < xDrawPages->getCount();
i++ )
213 Reference< XDrawPage > xDrawPage( xDrawPages->getByIndex(
i ), UNO_QUERY_THROW );
214 Reference< XPropertySet > xPropSet( xDrawPage, UNO_QUERY_THROW );
217 if ( xPropSet->getPropertyValue(
"Visible" ) >>=
bVisible )
226 std::vector< PageCollector::MasterPageEntity > aMasterPageList;
228 Reference< XMasterPagesSupplier > xMasterPagesSupplier(
mxController->getModel(), UNO_QUERY_THROW );
229 Reference< XDrawPages > xMasterPages( xMasterPagesSupplier->getMasterPages(), UNO_SET_THROW );
230 nDeletedSlides += std::count_if(aMasterPageList.begin(), aMasterPageList.end(),
233 if ( nDeletedSlides > 1 )
236 OUString aPlaceholder(
"%SLIDES" );
237 sal_Int32
i =
aStr.indexOf( aPlaceholder );
239 aStr =
aStr.replaceAt(
i, aPlaceholder.getLength(), OUString::number( nDeletedSlides ) );
240 aSummaryStrings.push_back(
aStr );
244 sal_Int32 nGraphics = 0;
254 OUString aImagePlaceholder(
"%IMAGES" );
255 OUString aQualityPlaceholder(
"%QUALITY" );
256 OUString aResolutionPlaceholder(
"%RESOLUTION" );
257 sal_Int32
i =
aStr.indexOf( aImagePlaceholder );
259 aStr =
aStr.replaceAt(
i, aImagePlaceholder.getLength(), OUString::number( nGraphics ) );
261 sal_Int32 j =
aStr.indexOf( aQualityPlaceholder );
263 aStr =
aStr.replaceAt( j, aQualityPlaceholder.getLength(), OUString::number( nJPEGQuality ) );
265 sal_Int32 k =
aStr.indexOf( aResolutionPlaceholder );
267 aStr =
aStr.replaceAt( k, aResolutionPlaceholder.getLength(), OUString::number( nImageResolution ) );
269 aSummaryStrings.push_back(
aStr );
274 sal_Int32 nOLEReplacements = 0;
275 Reference< XDrawPagesSupplier > xDrawPagesSupplier(
mxController->getModel(), UNO_QUERY_THROW );
276 Reference< XDrawPages > xDrawPages( xDrawPagesSupplier->getDrawPages(), UNO_SET_THROW );
277 for ( sal_Int32
i = 0;
i < xDrawPages->getCount();
i++ )
279 Reference< XShapes > xShapes( xDrawPages->getByIndex(
i ), UNO_QUERY_THROW );
280 for ( sal_Int32 j = 0; j < xShapes->getCount(); j++ )
282 Reference< XShape > xShape( xShapes->getByIndex( j ), UNO_QUERY_THROW );
283 if ( xShape->getShapeType() ==
"com.sun.star.drawing.OLE2Shape" )
287 if ( nOLEReplacements > 1 )
290 OUString aPlaceholder(
"%OLE" );
291 sal_Int32
i =
aStr.indexOf( aPlaceholder );
293 aStr =
aStr.replaceAt(
i, aPlaceholder.getLength(), OUString::number( nOLEReplacements ) );
294 aSummaryStrings.push_back(
aStr );
297 while( aSummaryStrings.size() < 3 )
298 aSummaryStrings.emplace_back( );
300 sal_Int64 nCurrentFileSize = 0;
301 sal_Int64 nEstimatedFileSize = 0;
302 Reference< XStorable > xStorable(
mxController->getModel(), UNO_QUERY );
303 if ( xStorable.is() && xStorable->hasLocation() )
306 if ( nCurrentFileSize )
308 double fE =
static_cast< double >( nCurrentFileSize );
309 if ( nImageResolution )
311 double v = (
static_cast< double >( nImageResolution ) + 75.0 ) / 300.0;
315 if ( bJPEGCompression )
317 double v = 0.75 - ( ( 100.0 -
static_cast< double >( nJPEGQuality ) ) / 400.0 ) ;
320 nEstimatedFileSize =
static_cast< sal_Int64
>( fE );
324 if ( !
aStr.isEmpty() )
325 nSeparator =
aStr[ 0 ];
336 OUString aSettingsName;
338 sal_Int32 nSession = 1;
339 std::vector<OptimizerSettings>::size_type
i;
343 OUString aTemp = aDefault + OUString::number( nSession++ );
344 for (
i = 1;
i < rList.size();
i++ )
346 if ( rList[
i ].
maName == aTemp )
349 if (
i == rList.size() )
350 aSettingsName = aTemp;
352 while( aSettingsName.isEmpty() );
std::vector< OptimizerSettings > & GetOptimizerSettings()
OUString getString(const PPPOptimizerTokenEnum) const
void SetConfigProperty(const PPPOptimizerTokenEnum, const css::uno::Any &aValue)
css::uno::Any GetConfigProperty(const PPPOptimizerTokenEnum) const
css::uno::Reference< css::uno::XComponentContext > mxContext
static void CountGraphics(const css::uno::Reference< css::uno::XComponentContext > &rxMSF, const css::uno::Reference< css::frame::XModel > &rxModel, const GraphicSettings &rGraphicSettings, sal_Int32 &rGraphics)
void UpdateControlStates(bool bJPEGCompression, int nJPEGQuality, bool bRemoveCropArea, int nResolution, bool bEmbedLinkedGraphics)
void UpdateControlStates(const std::vector< OUString > &rItemList, int nSelectedItem, bool bRemoveButtonEnabled)
void Init(const OUString &rDesc)
void UpdateControlStates(bool bConvertOLEObjects, int nOLEOptimizationType)
void UpdateControlStatesPage0()
css::uno::Reference< css::frame::XController > mxController
void UpdateControlStatesPage2()
void UpdateControlStatesPage3()
void UpdateControlStatesPage4()
void UpdateControlStatesPage1()
static void CollectMasterPages(const css::uno::Reference< css::frame::XModel > &, std::vector< MasterPageEntity > &)
void Init(const css::uno::Sequence< OUString > &rCustomShowList)
OUString Get_TK_CustomShowName() const
void UpdateControlStates(bool bDeleteUnusedMasterPages, bool bDeleteHiddenSlides, bool bDeleteNotesPages)
void Init(const OUString &rSettingsName, bool bIsReadonly)
void UpdateControlStates(bool bSaveAs, bool bSaveSettingsEnabled, const std::vector< OUString > &rItemList, const std::vector< OUString > &rSummaryStrings, const OUString &rCurrentFileSize, const OUString &rEstimatedFileSize)
std::unique_ptr< weld::Button > m_xHelp
static OUString ImpValueOfInMB(sal_Int64 rVal, sal_Unicode nSeparator)
@ TK_DeleteUnusedMasterPages
@ STR_NO_OLE_OBJECTS_DESC
static sal_Int64 GetFileSize(const OUString &rURL)
Reference< XModel > xModel