Kaydet (Commit) d80ba735 authored tarafından Eike Rathke's avatar Eike Rathke

Ditch now unused GraphicExportDialog, GraphicExportOptionsDialog

That was a dead end anyway, trying to partly reimplement
SvFilterOptionsDialog ExportDialog, instead of implementing the
necessary bits to use that one which has everything.

Change-Id: Icde7422f2c2d7e26c07dfe921a4abda41e222b09
Reviewed-on: https://gerrit.libreoffice.org/42503Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarEike Rathke <erack@redhat.com>
üst b9de0474
......@@ -391,7 +391,6 @@ bool CheckUnusedParams::VisitFunctionDecl(FunctionDecl const * decl) {
|| fqn == "textconversiondlgs::ChineseTranslation_UnoDialog::create"
|| fqn == "pcr::DefaultHelpProvider::Create"
|| fqn == "pcr::DefaultFormComponentInspectorModel::Create"
|| fqn == "GraphicExportDialog::GraphicExportDialog"
|| fqn == "pcr::ObjectInspectorModel::Create"
|| fqn == "GraphicExportFilter::GraphicExportFilter"
|| fqn == "CertificateContainer::CertificateContainer"
......
......@@ -48,7 +48,6 @@ $(eval $(call gb_Library_use_libraries,graphicfilter,\
$(eval $(call gb_Library_add_exception_objects,graphicfilter,\
filter/source/graphic/GraphicExportFilter \
filter/source/graphic/GraphicExportDialog \
filter/source/graphic/Services \
))
......
/* -*- 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 "GraphicExportDialog.hxx"
#include <vcl/graphicfilter.hxx>
#include <vcl/svapp.hxx>
#include <com/sun/star/container/XIndexAccess.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/uno/Sequence.h>
#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
#include <svtools/GraphicExportOptionsDialog.hxx>
#include <unotools/syslocale.hxx>
using namespace css;
using namespace css::uno;
using namespace css::beans;
using namespace css::lang;
GraphicExportDialog::GraphicExportDialog( const Reference< XComponentContext >& ) :
meFieldUnit(FUNIT_NONE),
mbSelectionOnly(false)
{
}
GraphicExportDialog::~GraphicExportDialog()
{
}
// XInitialization
void SAL_CALL GraphicExportDialog::initialize( const Sequence<Any>& )
{}
// XPropertyAccess
Sequence<PropertyValue> GraphicExportDialog::getPropertyValues()
{
sal_Int32 i;
sal_Int32 nCount = maMediaDescriptor.getLength();
for ( i = 0; i < nCount; i++ )
{
if ( maMediaDescriptor[ i ].Name == "FilterData" )
{
break;
}
}
if ( i >= nCount )
{
nCount++;
maMediaDescriptor.realloc( nCount );
}
maMediaDescriptor[ i ].Name = "FilterData";
maMediaDescriptor[ i ].Value <<= maFilterDataSequence;
return maMediaDescriptor;
}
void GraphicExportDialog::setPropertyValues( const Sequence<PropertyValue>& aProps )
{
maMediaDescriptor = aProps;
sal_Int32 i, nCount;
for ( i = 0, nCount = maMediaDescriptor.getLength(); i < nCount; i++ )
{
if ( maMediaDescriptor[ i ].Name == "FilterData" )
{
maMediaDescriptor[ i ].Value >>= maFilterDataSequence;
}
else if ( maMediaDescriptor[ i ].Name == "SelectionOnly" )
{
maMediaDescriptor[ i ].Value >>= mbSelectionOnly;
}
}
}
// XExecutableDialog
void GraphicExportDialog::setTitle( const OUString& aTitle )
{
maDialogTitle = aTitle;
}
sal_Int16 GraphicExportDialog::execute()
{
sal_Int16 nReturn = ui::dialogs::ExecutableDialogResults::CANCEL;
ScopedVclPtrInstance< GraphicExportOptionsDialog > graphicExportOptionsDialog( Application::GetDefDialogParent(),
mxSourceDocument, mbSelectionOnly );
if (graphicExportOptionsDialog->Execute() == RET_OK )
{
maFilterDataSequence = graphicExportOptionsDialog->getFilterData();
nReturn = ui::dialogs::ExecutableDialogResults::OK;
}
return nReturn;
}
// XEmporter
void GraphicExportDialog::setSourceDocument( const Reference<XComponent>& xDocument )
{
mxSourceDocument = xDocument;
// try to set the corresponding metric unit
OUString aConfigPath;
Reference< XServiceInfo > xServiceInfo ( xDocument, UNO_QUERY );
if ( xServiceInfo.is() )
{
if ( xServiceInfo->supportsService("com.sun.star.presentation.PresentationDocument") )
{
aConfigPath = "Office.Impress/Layout/Other/MeasureUnit";
}
else if ( xServiceInfo->supportsService("com.sun.star.drawing.DrawingDocument") )
{
aConfigPath = "Office.Draw/Layout/Other/MeasureUnit";
}
else if ( xServiceInfo->supportsService("com.sun.star.sheet.SpreadsheetDocument") )
{
aConfigPath = "Office.Calc/Layout/Other/MeasureUnit";
}
else if ( xServiceInfo->supportsService("com.sun.star.text.TextDocument") || xServiceInfo->supportsService("com.sun.star.text.WebDocument") )
{
aConfigPath = "Office.Writer/Layout/Other/MeasureUnit";
}
if ( !aConfigPath.isEmpty() )
{
FilterConfigItem aConfigItem( aConfigPath );
OUString aPropertyName;
SvtSysLocale aSysLocale;
if ( aSysLocale.GetLocaleDataPtr()->getMeasurementSystemEnum() == MeasurementSystem::Metric )
{
aPropertyName = "Metric";
}
else
{
aPropertyName = "NonMetric";
}
meFieldUnit = (FieldUnit) aConfigItem.ReadInt32( aPropertyName, FUNIT_CM );
}
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- 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_FILTER_SOURCE_GRAPHIC_GRAPHICEXPORTDIALOG_HXX
#define INCLUDED_FILTER_SOURCE_GRAPHIC_GRAPHICEXPORTDIALOG_HXX
#include <tools/fldunit.hxx>
#include <cppuhelper/implbase.hxx>
#include <comphelper/processfactory.hxx>
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/beans/XPropertyAccess.hpp>
#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
#include <com/sun/star/document/XExporter.hpp>
using namespace css;
using namespace css::uno;
using namespace css::beans;
using namespace css::lang;
class GraphicExportDialog : public cppu::WeakImplHelper
<
document::XExporter,
ui::dialogs::XExecutableDialog,
beans::XPropertyAccess,
lang::XInitialization
>
{
Sequence<PropertyValue> maMediaDescriptor;
Sequence<PropertyValue> maFilterDataSequence;
Reference<XComponent> mxSourceDocument;
OUString maDialogTitle;
FieldUnit meFieldUnit;
bool mbSelectionOnly;
public:
explicit GraphicExportDialog( const Reference<XComponentContext>& rxContext );
virtual ~GraphicExportDialog() override;
// XInitialization
virtual void SAL_CALL initialize( const Sequence<Any>& aArguments ) override;
// XPropertyAccess
virtual Sequence<PropertyValue> SAL_CALL getPropertyValues() override;
virtual void SAL_CALL setPropertyValues( const Sequence<PropertyValue>& aProps ) override;
// XExecuteDialog
virtual sal_Int16 SAL_CALL execute() override;
virtual void SAL_CALL setTitle( const OUString& aTitle ) override;
// XExporter
virtual void SAL_CALL setSourceDocument( const Reference<lang::XComponent>& xDocument ) override;
};
#endif // _GRAPHICEXPORTDIALOGUNO_HXX_
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -17,12 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include "GraphicExportDialog.hxx"
#include "GraphicExportFilter.hxx"
#include <comphelper/servicedecl.hxx>
#define GRAPHIC_EXPORT_FILTER_SERVICE "com.sun.star.comp.GraphicExportFilter"
#define GRAPHIC_EXPORT_DIALOG_SERVICE "com.sun.star.comp.GraphicExportDialog"
comphelper::service_decl::class_<GraphicExportFilter> const serviceGraphicExportFilter;
const comphelper::service_decl::ServiceDecl graphicExportFilter(
......@@ -30,12 +28,6 @@ const comphelper::service_decl::ServiceDecl graphicExportFilter(
GRAPHIC_EXPORT_FILTER_SERVICE,
"com.sun.star.document.ExportFilter" );
comphelper::service_decl::class_<GraphicExportDialog> const serviceGraphicExportDialog;
const comphelper::service_decl::ServiceDecl graphicExportDialog(
serviceGraphicExportDialog,
GRAPHIC_EXPORT_DIALOG_SERVICE,
"com.sun.star.ui.dialog.FilterOptionsDialog" );
extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL graphicfilter_component_getFactory(
sal_Char const* pImplementationName, void*, void*)
......@@ -44,10 +36,6 @@ extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL graphicfilter_component_getFactor
{
return comphelper::service_decl::component_getFactoryHelper( pImplementationName, {&graphicExportFilter} );
}
else if ( rtl_str_compare (pImplementationName, GRAPHIC_EXPORT_DIALOG_SERVICE) == 0 )
{
return comphelper::service_decl::component_getFactoryHelper( pImplementationName, {&graphicExportDialog} );
}
return nullptr;
}
......
......@@ -22,7 +22,4 @@
<implementation name="com.sun.star.comp.GraphicExportFilter">
<service name="com.sun.star.document.ExportFilter"/>
</implementation>
<implementation name="com.sun.star.comp.GraphicExportDialog">
<service name="com.sun.star.ui.dialog.FilterOptionsDialog"/>
</implementation>
</component>
/* -*- 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_SVTOOLS_GRAPHICEXPORTOPTIONSDIALOG_HXX
#define INCLUDED_SVTOOLS_GRAPHICEXPORTOPTIONSDIALOG_HXX
#include <vcl/fltcall.hxx>
#include <vcl/dialog.hxx>
#include <vcl/button.hxx>
#include <vcl/fixed.hxx>
#include <vcl/field.hxx>
#include <vcl/layout.hxx>
#include <vcl/lstbox.hxx>
#include <vcl/msgbox.hxx>
#include <vcl/scrbar.hxx>
#include <svtools/DocumentToGraphicRenderer.hxx>
#include <svtools/svtdllapi.h>
class SVT_DLLPUBLIC GraphicExportOptionsDialog : public ModalDialog
{
private:
VclPtr<NumericField> mpWidth;
VclPtr<NumericField> mpHeight;
VclPtr<ComboBox> mpResolution;
Size mSize100mm;
double mResolution;
DocumentToGraphicRenderer mRenderer;
sal_Int32 mCurrentPage;
void initialize();
void updateWidth();
void updateHeight();
void updateResolution();
double getViewWidthInch();
double getViewHeightInch();
DECL_LINK( widthModifiedHandle, Edit&, void );
DECL_LINK( heightModifiedHandle, Edit&, void );
DECL_LINK( resolutionModifiedHandle, Edit&, void );
public:
GraphicExportOptionsDialog( vcl::Window* pWindow,
const css::uno::Reference<css::lang::XComponent>& rxSourceDocument, bool bSelectionOnly );
virtual ~GraphicExportOptionsDialog() override;
virtual void dispose() override;
css::uno::Sequence<css::beans::PropertyValue> getFilterData();
};
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -480,7 +480,7 @@ ${MYCMD} --base sfx2/uiconfig/ui --files alienwarndialog.ui bookmarkdialog.ui ch
${MYCMD} --base starmath/uiconfig/smath/ui --files alignmentdialog.ui catalogdialog.ui dockingelements.ui fontdialog.ui fontsizedialog.ui fonttypedialog.ui printeroptions.ui savedefaultsdialog.ui smathsettings.ui spacingdialog.ui symdefinedialog.ui
${MYCMD} --base svtools/uiconfig/ui --files addresstemplatedialog.ui graphicexport.ui GraphicExportOptionsDialog.ui javadisableddialog.ui placeedit.ui printersetupdialog.ui querydeletedialog.ui restartdialog.ui wizarddialog.ui
${MYCMD} --base svtools/uiconfig/ui --files addresstemplatedialog.ui graphicexport.ui javadisableddialog.ui placeedit.ui printersetupdialog.ui querydeletedialog.ui restartdialog.ui wizarddialog.ui
${MYCMD} --base svx/uiconfig/ui --files acceptrejectchangesdialog.ui addconditiondialog.ui adddataitemdialog.ui addinstancedialog.ui addmodeldialog.ui addnamespacedialog.ui addsubmissiondialog.ui asianphoneticguidedialog.ui chineseconversiondialog.ui chinesedictionary.ui colorwindow.ui compressgraphicdialog.ui crashreportdlg.ui datanavigator.ui deletefooterdialog.ui deleteheaderdialog.ui docking3deffects.ui dockingcolorreplace.ui dockingfontwork.ui docrecoverybrokendialog.ui docrecoveryprogressdialog.ui docrecoveryrecoverdialog.ui docrecoverysavedialog.ui extrustiondepthdialog.ui findreplacedialog.ui floatingcontour.ui floatingundoredo.ui fontworkgallerydialog.ui fontworkspacingdialog.ui formlinkwarndialog.ui headfootformatpage.ui imapdialog.ui linkwarndialog.ui namespacedialog.ui optgridpage.ui paralinespacingcontrol.ui passwd.ui querydeletecontourdialog.ui querydeleteobjectdialog.ui querydeletethemedialog.ui querymodifyimagemapchangesdialog.ui querynewcontourdialog.ui querysavecontchangesdialog.ui querysaveimagemapchangesdialog.ui queryunlinkgraphicsdialog.ui redlinecontrol.ui redlinefilterpage.ui redlineviewpage.ui savemodifieddialog.ui sidebararea.ui sidebargraphic.ui sidebarinsert.ui sidebarline.ui sidebarparagraph.ui sidebarpossize.ui sidebarshadow.ui sidebarstylespanel.ui sidebartextpanel.ui textcontrolchardialog.ui textcontrolparadialog.ui xformspage.ui
......
......@@ -149,7 +149,6 @@ $(eval $(call gb_Library_add_exception_objects,svt,\
svtools/source/edit/svmedit2 \
svtools/source/edit/textwindowpeer \
svtools/source/filter/SvFilterOptionsDialog \
svtools/source/filter/GraphicExportOptionsDialog \
svtools/source/filter/DocumentToGraphicRenderer \
svtools/source/filter/exportdialog \
svtools/source/graphic/descriptor \
......
......@@ -13,7 +13,6 @@ $(eval $(call gb_UIConfig_add_uifiles,svt,\
svtools/uiconfig/ui/addresstemplatedialog \
svtools/uiconfig/ui/fileviewmenu \
svtools/uiconfig/ui/graphicexport \
svtools/uiconfig/ui/GraphicExportOptionsDialog \
svtools/uiconfig/ui/javadisableddialog \
svtools/uiconfig/ui/placeedit \
svtools/uiconfig/ui/printersetupdialog \
......
......@@ -39,7 +39,6 @@ svt/ui/placeedit.ui
svt/ui/printersetupdialog.ui
svt/ui/restartdialog.ui
svt/ui/graphicexport.ui
svt/ui/GraphicExportOptionsDialog.ui
svt/ui/wizarddialog.ui
svt/ui/querydeletedialog.ui
svt/ui/javadisableddialog.ui
/* -*- 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 <svtools/GraphicExportOptionsDialog.hxx>
#include <vcl/svapp.hxx>
using namespace css::beans;
using namespace css::lang;
using namespace css::uno;
GraphicExportOptionsDialog::GraphicExportOptionsDialog(vcl::Window* pWindow,
const Reference<XComponent>& rxSourceDocument, bool bSelectionOnly) :
ModalDialog(pWindow, "GraphicExporter", "svt/ui/GraphicExportOptionsDialog.ui"),
mResolution(96.0),
mRenderer(rxSourceDocument, bSelectionOnly)
{
get(mpWidth, "spin-width");
get(mpHeight, "spin-height");
get(mpResolution, "combo-resolution");
mpWidth->SetModifyHdl( LINK( this, GraphicExportOptionsDialog, widthModifiedHandle ));
mpHeight->SetModifyHdl( LINK( this, GraphicExportOptionsDialog, heightModifiedHandle ));
mpResolution->SetModifyHdl( LINK( this, GraphicExportOptionsDialog, resolutionModifiedHandle ));
initialize();
updateWidth();
updateHeight();
updateResolution();
}
GraphicExportOptionsDialog::~GraphicExportOptionsDialog()
{
disposeOnce();
}
void GraphicExportOptionsDialog::dispose()
{
mpWidth.clear();
mpHeight.clear();
mpResolution.clear();
ModalDialog::dispose();
}
void GraphicExportOptionsDialog::initialize()
{
mCurrentPage = mRenderer.getCurrentPage();
mSize100mm = mRenderer.getDocumentSizeIn100mm(mCurrentPage);
// Init DPI with screen resolution, taking width. This may lead to unusual
// DPI values but ensures a size in pixels that matches the actual screen
// content, which is vital for example for Calc with drawing layer and
// pixel images.
Size aSizePixels = Application::GetDefaultDevice()->LogicToPixel( mSize100mm, MapUnit::Map100thMM );
mResolution = aSizePixels.Width() / getViewWidthInch();
}
IMPL_LINK_NOARG( GraphicExportOptionsDialog, widthModifiedHandle, Edit&, void )
{
mResolution = mpWidth->GetValue() / getViewWidthInch();
updateHeight();
updateResolution();
}
IMPL_LINK_NOARG( GraphicExportOptionsDialog, heightModifiedHandle, Edit&, void )
{
mResolution = mpHeight->GetValue() / getViewHeightInch();
updateWidth();
updateResolution();
}
IMPL_LINK_NOARG( GraphicExportOptionsDialog, resolutionModifiedHandle, Edit&, void )
{
mResolution = mpResolution->GetText().toInt32();
updateWidth();
updateHeight();
Update();
}
double GraphicExportOptionsDialog::getViewWidthInch()
{
return (double) MetricField::ConvertValue(mSize100mm.Width(), 2, MapUnit::Map100thMM, FUNIT_INCH) / 100.0;
}
double GraphicExportOptionsDialog::getViewHeightInch()
{
return (double) MetricField::ConvertValue(mSize100mm.Height(), 2, MapUnit::Map100thMM, FUNIT_INCH) / 100.0;
}
void GraphicExportOptionsDialog::updateWidth()
{
sal_Int32 aWidth = (sal_Int32)( getViewWidthInch() * mResolution );
mpWidth->SetText( OUString::number( aWidth ));
}
void GraphicExportOptionsDialog::updateHeight()
{
sal_Int32 aHeight = (sal_Int32)( getViewHeightInch() * mResolution );
mpHeight->SetText( OUString::number( aHeight ));
}
void GraphicExportOptionsDialog::updateResolution()
{
mpResolution->SetText( OUString::number( (sal_Int32) mResolution ) );
}
Sequence<PropertyValue> GraphicExportOptionsDialog::getFilterData()
{
sal_Int32 aWidth = (sal_Int32)( getViewWidthInch() * mResolution );
sal_Int32 aHeight = (sal_Int32)( getViewHeightInch() * mResolution );
Sequence<PropertyValue> aFilterData;
aFilterData.realloc( 2 );
aFilterData[ 0 ].Name = "PixelWidth";
aFilterData[ 0 ].Value <<= aWidth;
aFilterData[ 1 ].Name = "PixelHeight";
aFilterData[ 1 ].Value <<= aHeight;
return aFilterData;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment