summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2023-05-07 17:49:31 +0200
committerJulien Nabet <serval2412@yahoo.fr>2023-05-07 19:12:46 +0200
commit7acdb3c81f168321977e56995b27f0fe0c36dc1e (patch)
tree9a5710937260451bc953f2104d7886b8206a654a /sfx2
parent45aa6f7ca99fff8388ade3484f5d5458a84af015 (diff)
Simplify some initializations in sfx2/source/doc/printhelper.cxx
Change-Id: Ia85598b6558f8f34187f40d6f5e5285bbc28abf8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151471 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/doc/printhelper.cxx43
1 files changed, 12 insertions, 31 deletions
diff --git a/sfx2/source/doc/printhelper.cxx b/sfx2/source/doc/printhelper.cxx
index 732aca4f3a33..6ca15e6cdbd9 100644
--- a/sfx2/source/doc/printhelper.cxx
+++ b/sfx2/source/doc/printhelper.cxx
@@ -29,6 +29,7 @@
#include <com/sun/star/frame/XModel.hpp>
#include <com/sun/star/view/DuplexMode.hpp>
#include <comphelper/processfactory.hxx>
+#include <comphelper/propertyvalue.hxx>
#include <svl/itemset.hxx>
#include <svl/lstner.hxx>
#include <unotools/tempfile.hxx>
@@ -266,37 +267,17 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SfxPrintHelper::getPrinter()
if ( !pPrinter )
return uno::Sequence< beans::PropertyValue >();
- uno::Sequence< beans::PropertyValue > aPrinter(8);
-
- aPrinter.getArray()[7].Name = "CanSetPaperSize";
- aPrinter.getArray()[7].Value <<= pPrinter->HasSupport( PrinterSupport::SetPaperSize );
-
- aPrinter.getArray()[6].Name = "CanSetPaperFormat";
- aPrinter.getArray()[6].Value <<= pPrinter->HasSupport( PrinterSupport::SetPaper );
-
- aPrinter.getArray()[5].Name = "CanSetPaperOrientation";
- aPrinter.getArray()[5].Value <<= pPrinter->HasSupport( PrinterSupport::SetOrientation );
-
- aPrinter.getArray()[4].Name = "IsBusy";
- aPrinter.getArray()[4].Value <<= pPrinter->IsPrinting();
-
- aPrinter.getArray()[3].Name = "PaperSize";
- awt::Size aSize = impl_Size_Object2Struct(pPrinter->GetPaperSize() );
- aPrinter.getArray()[3].Value <<= aSize;
-
- aPrinter.getArray()[2].Name = "PaperFormat";
- view::PaperFormat eFormat = convertToPaperFormat(pPrinter->GetPaper());
- aPrinter.getArray()[2].Value <<= eFormat;
-
- aPrinter.getArray()[1].Name = "PaperOrientation";
- view::PaperOrientation eOrient = static_cast<view::PaperOrientation>(pPrinter->GetOrientation());
- aPrinter.getArray()[1].Value <<= eOrient;
-
- aPrinter.getArray()[0].Name = "Name";
- OUString sStringTemp = pPrinter->GetName() ;
- aPrinter.getArray()[0].Value <<= sStringTemp;
-
- return aPrinter;
+ return
+ {
+ comphelper::makePropertyValue("Name", pPrinter->GetName()),
+ comphelper::makePropertyValue("PaperOrientation", static_cast<view::PaperOrientation>(pPrinter->GetOrientation())),
+ comphelper::makePropertyValue("PaperFormat", convertToPaperFormat(pPrinter->GetPaper())),
+ comphelper::makePropertyValue("PaperSize", impl_Size_Object2Struct(pPrinter->GetPaperSize() )),
+ comphelper::makePropertyValue("IsBusy", pPrinter->IsPrinting()),
+ comphelper::makePropertyValue("CanSetPaperOrientation", pPrinter->HasSupport( PrinterSupport::SetOrientation )),
+ comphelper::makePropertyValue("CanSetPaperFormat", pPrinter->HasSupport( PrinterSupport::SetPaper )),
+ comphelper::makePropertyValue("CanSetPaperSize", pPrinter->HasSupport( PrinterSupport::SetPaperSize ))
+ };
}