summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--officecfg/registry/data/org/openoffice/Office/PresentationMinimizer.xcu3
-rw-r--r--officecfg/registry/schema/org/openoffice/Office/PresentationMinimizer.xcs4
-rw-r--r--sdext/Library_PresentationMinimizer.mk1
-rw-r--r--sdext/source/minimizer/errordialog.cxx96
-rw-r--r--sdext/source/minimizer/errordialog.hxx56
-rw-r--r--sdext/source/minimizer/informationdialog.cxx16
-rw-r--r--sdext/source/minimizer/informationdialog.hxx18
-rw-r--r--sdext/source/minimizer/optimizerdialog.cxx31
-rw-r--r--sdext/source/minimizer/pppoptimizertoken.cxx1
-rw-r--r--sdext/source/minimizer/pppoptimizertoken.hxx1
10 files changed, 209 insertions, 18 deletions
diff --git a/officecfg/registry/data/org/openoffice/Office/PresentationMinimizer.xcu b/officecfg/registry/data/org/openoffice/Office/PresentationMinimizer.xcu
index fab5d1945cc7..3308ad80ab58 100644
--- a/officecfg/registry/data/org/openoffice/Office/PresentationMinimizer.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/PresentationMinimizer.xcu
@@ -196,6 +196,9 @@ The current presentation contains no OLE objects.</value>
<prop oor:name="STR_FILESIZESEPARATOR">
<value xml:lang="en-US">.</value>
</prop>
+ <prop oor:name="STR_ERROR_IO">
+ <value xml:lang="en-US">Writing output file failed!</value>
+ </prop>
</node>
<node oor:name="LastUsedSettings">
<prop oor:name="Name">
diff --git a/officecfg/registry/schema/org/openoffice/Office/PresentationMinimizer.xcs b/officecfg/registry/schema/org/openoffice/Office/PresentationMinimizer.xcs
index 179637d7d677..7f8259af891d 100644
--- a/officecfg/registry/schema/org/openoffice/Office/PresentationMinimizer.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/PresentationMinimizer.xcs
@@ -361,6 +361,10 @@ The current presentation contains no OLE objects.</value>
<info><desc>String STR_FILESIZESEPARATOR.</desc></info>
<value>.</value>
</prop>
+ <prop oor:name="STR_ERROR_IO" oor:type="xs:string" oor:localized="true">
+ <info><desc>String STR_ERROR_IO.</desc></info>
+ <value>Writing output file failed!</value>
+ </prop>
</group>
<node-ref oor:name="LastUsedSettings" oor:node-type="OptimizerSettings">
<info>
diff --git a/sdext/Library_PresentationMinimizer.mk b/sdext/Library_PresentationMinimizer.mk
index 2ae650a5f855..0da54ed887b6 100644
--- a/sdext/Library_PresentationMinimizer.mk
+++ b/sdext/Library_PresentationMinimizer.mk
@@ -45,6 +45,7 @@ $(eval $(call gb_Library_add_exception_objects,PresentationMinimizer,\
sdext/source/minimizer/pppoptimizertoken \
sdext/source/minimizer/pppoptimizeruno \
sdext/source/minimizer/unodialog \
+ sdext/source/minimizer/errordialog \
))
# vim:set noet sw=4 ts=4:
diff --git a/sdext/source/minimizer/errordialog.cxx b/sdext/source/minimizer/errordialog.cxx
new file mode 100644
index 000000000000..08e4ee48e760
--- /dev/null
+++ b/sdext/source/minimizer/errordialog.cxx
@@ -0,0 +1,96 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include "errordialog.hxx"
+#include "informationdialog.hxx"
+#include "optimizationstats.hxx"
+#include <com/sun/star/graphic/GraphicProvider.hpp>
+#include <com/sun/star/graphic/XGraphicProvider.hpp>
+#include <com/sun/star/graphic/XGraphic.hpp>
+#include <com/sun/star/io/TempFile.hpp>
+#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
+#include <com/sun/star/util/URL.hpp>
+#include <com/sun/star/util/URLTransformer.hpp>
+#include <com/sun/star/util/XURLTransformer.hpp>
+#include <rtl/ustrbuf.hxx>
+#include <sal/macros.h>
+
+#define DIALOG_WIDTH 240
+#define DIALOG_HEIGHT 60
+#define PAGE_POS_X 35
+#define PAGE_WIDTH (DIALOG_WIDTH - PAGE_POS_X) - 6
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::io;
+using namespace ::com::sun::star::ui;
+using namespace ::com::sun::star::awt;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::util;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::frame;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::container;
+
+void ErrorDialog::InitDialog()
+{
+ // setting the dialog properties
+ OUString pNames[]
+ = { OUString("Closeable"), OUString("Height"), OUString("Moveable"), OUString("PositionX"),
+ OUString("PositionY"), OUString("Title"), OUString("Width") };
+
+ Any pValues[] = { Any(true),
+ Any(sal_Int32(DIALOG_HEIGHT)),
+ Any(true),
+ Any(sal_Int32(245)),
+ Any(sal_Int32(115)),
+ Any(getString(STR_SUN_OPTIMIZATION_WIZARD2)),
+ Any(sal_Int32(DIALOG_WIDTH)) };
+
+ sal_Int32 nCount = SAL_N_ELEMENTS(pNames);
+
+ Sequence<OUString> aNames(pNames, nCount);
+ Sequence<Any> aValues(pValues, nCount);
+
+ mxDialogModelMultiPropertySet->setPropertyValues(aNames, aValues);
+
+ css::uno::Reference<css::awt::XItemListener> xItemListener;
+ InsertImage(*this, "aboutimage", "private:standardimage/error", 5, 5, 25, 25, false);
+ InsertFixedText(*this, "fixedtext", maText, PAGE_POS_X, 6, PAGE_WIDTH, 24, true, 0);
+ InsertButton(*this, "button", mxActionListener, DIALOG_WIDTH / 2 - 25, DIALOG_HEIGHT - 20,
+ 50, 14, 2, getString(STR_OK));
+}
+
+ErrorDialog::ErrorDialog(const Reference<XComponentContext>& rxContext,
+ Reference<XFrame>& rxFrame, const OUString& rText)
+ : UnoDialog(rxContext, rxFrame)
+ , ConfigurationAccess(rxContext)
+ , mxActionListener(new OKActionListener(*this))
+ , maText(rText)
+{
+ Reference<XFrame> xFrame(mxController->getFrame());
+ Reference<XWindow> xContainerWindow(xFrame->getContainerWindow());
+ Reference<XWindowPeer> xWindowPeer(xContainerWindow, UNO_QUERY_THROW);
+ createWindowPeer(xWindowPeer);
+
+ InitDialog();
+}
+
+ErrorDialog::~ErrorDialog() {}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sdext/source/minimizer/errordialog.hxx b/sdext/source/minimizer/errordialog.hxx
new file mode 100644
index 000000000000..a4cb2d4a0f07
--- /dev/null
+++ b/sdext/source/minimizer/errordialog.hxx
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SDEXT_SOURCE_MINIMIZER_ERRORDIALOG_HXX
+#define INCLUDED_SDEXT_SOURCE_MINIMIZER_ERRORDIALOG_HXX
+
+#include "unodialog.hxx"
+#include "configurationaccess.hxx"
+#include "pppoptimizertoken.hxx"
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/awt/XItemListener.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/text/XTextRange.hpp>
+#include <com/sun/star/drawing/XShapes.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/view/XSelectionSupplier.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/awt/XItemEventBroadcaster.hpp>
+#include <com/sun/star/awt/PushButtonType.hpp>
+#include <com/sun/star/io/XStream.hpp>
+#include <cppuhelper/implbase.hxx>
+
+class ErrorDialog : public UnoDialog, public ConfigurationAccess
+{
+public:
+ ErrorDialog(const css::uno::Reference<css::uno::XComponentContext>& rxContext,
+ css::uno::Reference<css::frame::XFrame>& rxFrame, const OUString& rText);
+ ~ErrorDialog();
+
+private:
+ css::uno::Reference<css::awt::XActionListener> mxActionListener;
+
+ void InitDialog();
+
+ const OUString& maText;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sdext/source/minimizer/informationdialog.cxx b/sdext/source/minimizer/informationdialog.cxx
index 07c6fde501e9..f974701dc2ba 100644
--- a/sdext/source/minimizer/informationdialog.cxx
+++ b/sdext/source/minimizer/informationdialog.cxx
@@ -50,7 +50,7 @@ using namespace ::com::sun::star::script;
using namespace ::com::sun::star::container;
-OUString InsertFixedText( InformationDialog& rInformationDialog, const OUString& rControlName, const OUString& rLabel,
+OUString InsertFixedText( UnoDialog& rInformationDialog, const OUString& rControlName, const OUString& rLabel,
sal_Int32 nXPos, sal_Int32 nYPos, sal_Int32 nWidth, sal_Int32 nHeight, bool bMultiLine, sal_Int16 nTabIndex )
{
OUString pNames[] = {
@@ -83,7 +83,7 @@ OUString InsertFixedText( InformationDialog& rInformationDialog, const OUString&
}
OUString InsertImage(
- InformationDialog& rInformationDialog,
+ UnoDialog& rInformationDialog,
const OUString& rControlName,
const OUString& rURL,
sal_Int32 nPosX,
@@ -118,7 +118,7 @@ OUString InsertImage(
return rControlName;
}
-OUString InsertCheckBox( InformationDialog& rInformationDialog, const OUString& rControlName,
+OUString InsertCheckBox( UnoDialog& rInformationDialog, const OUString& rControlName,
const Reference< XItemListener >& rItemListener, const OUString& rLabel,
sal_Int32 nXPos, sal_Int32 nYPos, sal_Int32 nWidth, sal_Int32 nHeight, sal_Int16 nTabIndex )
{
@@ -153,8 +153,8 @@ OUString InsertCheckBox( InformationDialog& rInformationDialog, const OUString&
return rControlName;
}
-OUString InsertButton( InformationDialog& rInformationDialog, const OUString& rControlName, Reference< XActionListener >& xActionListener,
- sal_Int32 nXPos, sal_Int32 nYPos, sal_Int32 nWidth, sal_Int32 nHeight, sal_Int16 nTabIndex, PPPOptimizerTokenEnum nResID )
+OUString InsertButton( UnoDialog& rInformationDialog, const OUString& rControlName, Reference< XActionListener >& xActionListener,
+ sal_Int32 nXPos, sal_Int32 nYPos, sal_Int32 nWidth, sal_Int32 nHeight, sal_Int16 nTabIndex, const OUString& rText )
{
OUString pNames[] = {
OUString("Enabled"),
@@ -170,7 +170,7 @@ OUString InsertButton( InformationDialog& rInformationDialog, const OUString& rC
Any pValues[] = {
Any( true ),
Any( nHeight ),
- Any( rInformationDialog.getString( nResID ) ),
+ Any( rText ),
Any( nXPos ),
Any( nYPos ),
Any( static_cast< sal_Int16 >( PushButtonType_OK ) ),
@@ -297,7 +297,7 @@ void InformationDialog::InitDialog()
InsertFixedText( *this, "fixedtext", aInfoString, PAGE_POS_X, 6, PAGE_WIDTH, 24, true, 0 );
if ( !maSaveAsURL.isEmpty() )
InsertCheckBox( *this, "OpenNewDocument", xItemListener, getString( STR_AUTOMATICALLY_OPEN ), PAGE_POS_X, 42, PAGE_WIDTH, 8, 1 );
- InsertButton( *this, "button", mxActionListener, DIALOG_WIDTH / 2 - 25, nDialogHeight - 20, 50, 14, 2, STR_OK );
+ InsertButton( *this, "button", mxActionListener, DIALOG_WIDTH / 2 - 25, nDialogHeight - 20, 50, 14, 2, getString( STR_OK ) );
bool bOpenNewDocument = mrbOpenNewDocument;
setControlProperty( "OpenNewDocument", "State", Any( (sal_Int16)bOpenNewDocument ) );
@@ -350,7 +350,7 @@ void OKActionListener::actionPerformed( const ActionEvent& rEvent )
{
if ( rEvent.ActionCommand == "button" )
{
- mrInformationDialog.endExecute( true );
+ mrDialog.endExecute( true );
}
}
void OKActionListener::disposing( const css::lang::EventObject& /* Source */ )
diff --git a/sdext/source/minimizer/informationdialog.hxx b/sdext/source/minimizer/informationdialog.hxx
index 3de345eb8234..5853e922fe6c 100644
--- a/sdext/source/minimizer/informationdialog.hxx
+++ b/sdext/source/minimizer/informationdialog.hxx
@@ -39,6 +39,20 @@
#include <com/sun/star/io/XStream.hpp>
#include <cppuhelper/implbase.hxx>
+OUString InsertFixedText( UnoDialog& rInformationDialog, const OUString& rControlName, const OUString& rLabel,
+ sal_Int32 nXPos, sal_Int32 nYPos, sal_Int32 nWidth, sal_Int32 nHeight, bool bMultiLine, sal_Int16 nTabIndex );
+
+OUString InsertImage( UnoDialog& rInformationDialog, const OUString& rControlName, const OUString& rURL,
+ sal_Int32 nPosX, sal_Int32 nPosY, sal_Int32 nWidth, sal_Int32 nHeight, bool bScale );
+
+OUString InsertCheckBox( UnoDialog& rInformationDialog, const OUString& rControlName,
+ const css::uno::Reference< css::awt::XItemListener >& rItemListener, const OUString& rLabel,
+ sal_Int32 nXPos, sal_Int32 nYPos, sal_Int32 nWidth, sal_Int16 nTabIndex );
+
+OUString InsertButton( UnoDialog& rInformationDialog, const OUString& rControlName,
+ css::uno::Reference< css::awt::XActionListener >& xActionListener, sal_Int32 nXPos, sal_Int32 nYPos,
+ sal_Int32 nWidth, sal_Int32 nHeight, sal_Int16 nTabIndex, const OUString& rText );
+
class InformationDialog : public UnoDialog, public ConfigurationAccess
{
@@ -67,13 +81,13 @@ private:
class OKActionListener : public ::cppu::WeakImplHelper< css::awt::XActionListener >
{
public:
- explicit OKActionListener( InformationDialog& rInformationDialog ) : mrInformationDialog( rInformationDialog ){}
+ explicit OKActionListener( UnoDialog& rDialog ) : mrDialog( rDialog ){}
virtual void SAL_CALL actionPerformed( const css::awt::ActionEvent& Event ) throw ( css::uno::RuntimeException, std::exception ) override;
virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) throw ( css::uno::RuntimeException, std::exception) override;
private:
- InformationDialog& mrInformationDialog;
+ UnoDialog& mrDialog;
};
#endif
diff --git a/sdext/source/minimizer/optimizerdialog.cxx b/sdext/source/minimizer/optimizerdialog.cxx
index 9b3d7c723024..fc3fe776a0b1 100644
--- a/sdext/source/minimizer/optimizerdialog.cxx
+++ b/sdext/source/minimizer/optimizerdialog.cxx
@@ -19,11 +19,13 @@
#include "optimizerdialog.hxx"
-#include "pppoptimizer.hxx"
+#include "impoptimizer.hxx"
#include "fileopendialog.hxx"
+#include "errordialog.hxx"
#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/io/IOException.hpp>
#include <com/sun/star/util/XCloseBroadcaster.hpp>
#include <com/sun/star/frame/XComponentLoader.hpp>
#include <com/sun/star/frame/XLayoutManager.hpp>
@@ -478,7 +480,6 @@ void ItemListener::disposing( const css::lang::EventObject& /* Source */ )
{
}
-
void ActionListener::actionPerformed( const ActionEvent& rEvent )
throw ( css::uno::RuntimeException, std::exception )
{
@@ -572,11 +573,6 @@ void ActionListener::actionPerformed( const ActionEvent& rEvent )
}
if ( bSuccessfullyExecuted )
{
- Reference < XDispatch > xDispatch(
- new PPPOptimizer(
- mrOptimizerDialog.GetComponentContext(),
- mrOptimizerDialog.GetFrame()));
-
URL aURL;
aURL.Protocol = "vnd.com.sun.star.comp.PPPOptimizer:";
aURL.Path = "optimize";
@@ -589,7 +585,26 @@ void ActionListener::actionPerformed( const ActionEvent& rEvent )
lArguments[ 2 ].Name = "InformationDialog";
lArguments[ 2 ].Value <<= mrOptimizerDialog.GetFrame();
- xDispatch->dispatch( aURL, lArguments );
+ try
+ {
+ ImpOptimizer aOptimizer(
+ mrOptimizerDialog.GetComponentContext(),
+ mrOptimizerDialog.GetFrame()->getController()->getModel());
+ aOptimizer.Optimize(lArguments);
+ }
+ catch (css::io::IOException&)
+ {
+ mrOptimizerDialog.maStats.SetStatusValue(TK_Progress, Any(static_cast<sal_Int32>(0)));
+ mrOptimizerDialog.setControlProperty("btnNavBack", "Enabled", Any(true));
+ mrOptimizerDialog.setControlProperty("btnNavNext", "Enabled", Any(false));
+ mrOptimizerDialog.setControlProperty("btnNavFinish", "Enabled", Any(true));
+ mrOptimizerDialog.setControlProperty("btnNavCancel", "Enabled", Any(true));
+ ErrorDialog aInformationDialog(
+ mrOptimizerDialog.UnoDialog::mxContext, mrOptimizerDialog.GetFrame(),
+ mrOptimizerDialog.getString(STR_ERROR_IO));
+ aInformationDialog.execute();
+ break;
+ }
mrOptimizerDialog.endExecute( bSuccessfullyExecuted );
}
diff --git a/sdext/source/minimizer/pppoptimizertoken.cxx b/sdext/source/minimizer/pppoptimizertoken.cxx
index d99c49bfb15b..24866ba625c3 100644
--- a/sdext/source/minimizer/pppoptimizertoken.cxx
+++ b/sdext/source/minimizer/pppoptimizertoken.cxx
@@ -152,6 +152,7 @@ static const TokenTable pTokenTableArray[] =
{ "STR_OPTIMIZING_GRAPHICS", STR_OPTIMIZING_GRAPHICS },
{ "STR_CREATING_OLE_REPLACEMENTS",STR_CREATING_OLE_REPLACEMENTS },
{ "STR_FileSizeSeparator", STR_FILESIZESEPARATOR },
+ { "STR_ERROR_IO", STR_ERROR_IO },
{ "NotFound", TK_NotFound }
};
diff --git a/sdext/source/minimizer/pppoptimizertoken.hxx b/sdext/source/minimizer/pppoptimizertoken.hxx
index e458da0d3181..3562e8b0ca89 100644
--- a/sdext/source/minimizer/pppoptimizertoken.hxx
+++ b/sdext/source/minimizer/pppoptimizertoken.hxx
@@ -135,6 +135,7 @@ enum PPPOptimizerTokenEnum
STR_OPTIMIZING_GRAPHICS,
STR_CREATING_OLE_REPLACEMENTS,
STR_FILESIZESEPARATOR,
+ STR_ERROR_IO,
TK_NotFound
};