From ed5640d8b587fbcfed7dd7967f3de04b37a76f26 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 11:06:44 +0200 Subject: Adding upstream version 4:7.4.7. Signed-off-by: Daniel Baumann --- vcl/inc/printdlg.hxx | 277 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 277 insertions(+) create mode 100644 vcl/inc/printdlg.hxx (limited to 'vcl/inc/printdlg.hxx') diff --git a/vcl/inc/printdlg.hxx b/vcl/inc/printdlg.hxx new file mode 100644 index 000000000..5b9641747 --- /dev/null +++ b/vcl/inc/printdlg.hxx @@ -0,0 +1,277 @@ +/* -*- 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 VCL_INC_NEWPRINTDLG_HXX +#define VCL_INC_NEWPRINTDLG_HXX + +#include +#include +#include +#include +#include +#include +#include + +namespace vcl { + class PrintDialog; +} + +namespace vcl +{ + class PrintDialog final : public weld::GenericDialogController + { + friend class MoreOptionsDialog; + public: + + class PrintPreviewWindow final : public weld::CustomWidgetController + { + PrintDialog* mpDialog; + GDIMetaFile maMtf; + Size maOrigSize; + Size maPreviewSize; + sal_Int32 mnDPIX; + sal_Int32 mnDPIY; + BitmapEx maPreviewBitmap; + OUString maReplacementString; + bool mbGreyscale; + + OUString maHorzText; + OUString maVertText; + + void preparePreviewBitmap(); + + public: + PrintPreviewWindow(PrintDialog* pDialog); + virtual ~PrintPreviewWindow() override; + + virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override; + virtual bool Command( const CommandEvent& ) override; + virtual void Resize() override; + + void setPreview( const GDIMetaFile&, const Size& i_rPaperSize, + std::u16string_view i_rPaperName, + const OUString& i_rNoPageString, + sal_Int32 i_nDPIX, sal_Int32 i_nDPIY, + bool i_bGreyscale + ); + }; + + class ShowNupOrderWindow final : public weld::CustomWidgetController + { + NupOrderType mnOrderMode; + int mnRows; + int mnColumns; + public: + ShowNupOrderWindow(); + + virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override; + + virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& ) override; + + void setValues( NupOrderType i_nOrderMode, int i_nColumns, int i_nRows ) + { + mnOrderMode = i_nOrderMode; + mnRows = i_nRows; + mnColumns = i_nColumns; + Invalidate(); + } + }; + + PrintDialog(weld::Window*, const std::shared_ptr&); + virtual ~PrintDialog() override; + + bool isPrintToFile() const; + bool isCollate() const; + bool isSingleJobs() const; + bool hasPreview() const; + + void setPaperSizes(); + void previewForward(); + void previewBackward(); + void previewFirst(); + void previewLast(); + + private: + + std::unique_ptr mxCustomOptionsUIBuilder; + + std::shared_ptr maPController; + + std::unique_ptr mxTabCtrl; + std::unique_ptr mxScrolledWindow; + std::unique_ptr mxPageLayoutFrame; + std::unique_ptr mxPrinters; + std::unique_ptr mxStatusTxt; + std::unique_ptr mxSetupButton; + + std::unique_ptr mxCopyCountField; + std::unique_ptr mxCollateBox; + std::unique_ptr mxCollateImage; + std::unique_ptr mxPageRangeEdit; + std::unique_ptr mxPageRangesRadioButton; + std::unique_ptr mxPaperSidesBox; + std::unique_ptr mxSingleJobsBox; + std::unique_ptr mxReverseOrderBox; + + std::unique_ptr mxOKButton; + std::unique_ptr mxCancelButton; + std::unique_ptr mxHelpButton; + std::unique_ptr mxMoreOptionsBtn; + + std::unique_ptr mxBackwardBtn; + std::unique_ptr mxForwardBtn; + std::unique_ptr mxFirstBtn; + std::unique_ptr mxLastBtn; + + std::unique_ptr mxPreviewBox; + std::unique_ptr mxNumPagesText; + std::unique_ptr mxPreview; + std::unique_ptr mxPreviewWindow; + std::unique_ptr mxPageEdit; + + std::unique_ptr mxPagesBtn; + std::unique_ptr mxBrochureBtn; + std::unique_ptr mxPagesBoxTitleTxt; + std::unique_ptr mxNupPagesBox; + + // controls for "Custom" page mode + std::unique_ptr mxNupNumPagesTxt; + std::unique_ptr mxNupColEdt; + std::unique_ptr mxNupTimesTxt; + std::unique_ptr mxNupRowsEdt; + std::unique_ptr mxPageMarginTxt1; + std::unique_ptr mxPageMarginEdt; + std::unique_ptr mxPageMarginTxt2; + std::unique_ptr mxSheetMarginTxt1; + std::unique_ptr mxSheetMarginEdt; + std::unique_ptr mxSheetMarginTxt2; + std::unique_ptr mxPaperSizeBox; + std::unique_ptr mxOrientationBox; + + // page order ("left to right, then down") + std::unique_ptr mxNupOrderTxt; + std::unique_ptr mxNupOrderBox; + std::unique_ptr mxNupOrder; + std::unique_ptr mxNupOrderWin; + /// border around each page + std::unique_ptr mxBorderCB; + std::unique_ptr mxRangeExpander; + std::unique_ptr mxLayoutExpander; + std::unique_ptr mxCustom; + + OUString maPrintToFileText; + OUString maPrintText; + OUString maDefPrtText; + + OUString maPageStr; + OUString maNoPageStr; + OUString maNoPreviewStr; + sal_Int32 mnCurPage; + sal_Int32 mnCachedPages; + + bool mbCollateAlwaysOff; + + std::vector> + maExtraControls; + + std::map + maControlToPropertyMap; + std::map> + maPropertyToWindowMap; + std::map + maControlToNumValMap; + + Size maNupPortraitSize; + Size maNupLandscapeSize; + /// internal, used for automatic Nup-Portrait/landscape + Size maFirstPageSize; + + bool mbShowLayoutFrame; + + Paper mePaper; + + Idle maUpdatePreviewIdle; + DECL_LINK(updatePreviewIdle, Timer*, void); + Idle maUpdatePreviewNoCacheIdle; + DECL_LINK(updatePreviewNoCacheIdle, Timer*, void); + + DECL_LINK( ClickHdl, weld::Button&, void ); + DECL_LINK( SelectHdl, weld::ComboBox&, void ); + DECL_LINK( ActivateHdl, weld::Entry&, bool ); + DECL_LINK( FocusOutHdl, weld::Widget&, void ); + DECL_LINK( SpinModifyHdl, weld::SpinButton&, void ); + DECL_LINK( MetricSpinModifyHdl, weld::MetricSpinButton&, void ); + DECL_LINK( ToggleHdl, weld::Toggleable&, void ); + + DECL_LINK( UIOption_CheckHdl, weld::Toggleable&, void ); + DECL_LINK( UIOption_RadioHdl, weld::Toggleable&, void ); + DECL_LINK( UIOption_SelectHdl, weld::ComboBox&, void ); + DECL_LINK( UIOption_SpinModifyHdl, weld::SpinButton&, void ); + DECL_LINK( UIOption_EntryModifyHdl, weld::Entry&, void ); + + css::beans::PropertyValue* getValueForWindow(weld::Widget*) const; + + void preparePreview( bool i_bMayUseCache ); + void setupPaperSidesBox(); + void storeToSettings(); + void readFromSettings(); + void setPaperOrientation( Orientation eOrientation, bool fromUser ); + void updateOrientationBox( bool bAutomatic = true ); + bool hasOrientationChanged() const; + void setPreviewText(); + void updatePrinterText(); + void checkControlDependencies(); + void checkOptionalControlDependencies(); + void makeEnabled( weld::Widget* ); + void updateWindowFromProperty( const OUString& ); + void initFromMultiPageSetup( const vcl::PrinterController::MultiPageSetup& ); + void showAdvancedControls( bool ); + void updateNup( bool i_bMayUseCache = true ); + void updateNupFromPages( bool i_bMayUseCache = true ); + void enableNupControls( bool bEnable ); + void setupOptionalUI(); + Size const & getJobPageSize(); + + }; + + class PrintProgressDialog final : public weld::GenericDialogController + { + OUString maStr; + bool mbCanceled; + sal_Int32 mnCur; + sal_Int32 mnMax; + + std::unique_ptr mxText; + std::unique_ptr mxProgress; + std::unique_ptr mxButton; + + DECL_LINK( ClickHdl, weld::Button&, void ); + + public: + PrintProgressDialog(weld::Window* i_pParent, int i_nMax); + virtual ~PrintProgressDialog() override; + bool isCanceled() const { return mbCanceled; } + void setProgress( int i_nCurrent ); + void tick(); + }; +} + +#endif // VCL_INC_NEWPRINTDLG_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit v1.2.3