summaryrefslogtreecommitdiff
path: root/starmath
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2022-11-03 17:11:01 +0100
committerStephan Bergmann <sbergman@redhat.com>2022-11-04 10:08:36 +0100
commit20926c0a7559ea9c4f82c662f11a395fa1eb79a3 (patch)
tree1c51a3bceb57b2e20c068e3c07e6d9bfcd53cbe4 /starmath
parent670fa33edd7c9da77d5cbed5c7978ef24df59f15 (diff)
Reinstate removal of lcl_GuessPaperSize
...originally done with 1d7964c5ff579ff93067dc1c3e45b522e3cb2b4e "CWS-TOOLING: integrate CWS unifypaper01" on 2009-06-12. However, the removed lcl_GuessPaperSize then reappeared, apparently with the merge commit 4563270cfd37f1a08e0315a5624affa3a7680771 "CWS-TOOLING: integrate CWS printerpullpages" on 2010-01-15, presumably due to a mis-merge somewhere along the way. SmModel::getRenderer and SmModel::render are e.g. called when doing "Export as PDF..." of a Math Formula, but it seems a bit hard to get into the "no real printer" branches there that would actually have called lcl_GuessPaperSize. But anyway, it looks reasonable to replace that function with the more elaborate SvxPaperInfo::GetDefaultPaperSize. (I stumbled over this when the code in lcl_GuessPaperSize caused a newly introduced -Werror=dangling-reference with GCC 13 trunk, similar to e0121b2478526d803681d57d59af0cbf9cf602b4 "-Werror=dangling-reference". So I figured I'd remove that code as apparently intended back in 2009 rather than try to fix it now.) Change-Id: Ia73d9ece8429bbeccd4f65a9efc156c0dee52c01 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142246 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'starmath')
-rw-r--r--starmath/source/unomodel.cxx27
1 files changed, 3 insertions, 24 deletions
diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx
index 51a5fc822af0..76c4e86651b1 100644
--- a/starmath/source/unomodel.cxx
+++ b/starmath/source/unomodel.cxx
@@ -40,6 +40,7 @@
#include <comphelper/servicehelper.hxx>
#include <cppuhelper/queryinterface.hxx>
#include <cppuhelper/supportsservice.hxx>
+#include <editeng/paperinf.hxx>
#include <unotools/moduleoptions.hxx>
#include <tools/mapunit.hxx>
#include <tools/stream.hxx>
@@ -894,28 +895,6 @@ sal_Int32 SAL_CALL SmModel::getRendererCount(
return 1;
}
-
-static Size lcl_GuessPaperSize()
-{
- Size aRes;
- const LocaleDataWrapper& rLocWrp( AllSettings().GetLocaleDataWrapper() );
- if( MeasurementSystem::Metric == rLocWrp.getMeasurementSystemEnum() )
- {
- // in 100th mm
- PaperInfo aInfo( PAPER_A4 );
- aRes.setWidth( aInfo.getWidth() );
- aRes.setHeight( aInfo.getHeight() );
- }
- else
- {
- // in 100th mm
- PaperInfo aInfo( PAPER_LETTER );
- aRes.setWidth( aInfo.getWidth() );
- aRes.setHeight( aInfo.getHeight() );
- }
- return aRes;
-}
-
uno::Sequence< beans::PropertyValue > SAL_CALL SmModel::getRenderer(
sal_Int32 nRenderer,
const uno::Any& /*rSelection*/,
@@ -937,7 +916,7 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SmModel::getRenderer(
// if paper size is 0 (usually if no 'real' printer is found),
// guess the paper size
if (aPrtPaperSize.IsEmpty())
- aPrtPaperSize = lcl_GuessPaperSize();
+ aPrtPaperSize = SvxPaperInfo::GetDefaultPaperSize(MapUnit::Map100thMM);
awt::Size aPageSize( aPrtPaperSize.Width(), aPrtPaperSize.Height() );
uno::Sequence< beans::PropertyValue > aRenderer(1);
@@ -1011,7 +990,7 @@ void SAL_CALL SmModel::render(
// no real printer ??
if (aPrtPaperSize.IsEmpty())
{
- aPrtPaperSize = lcl_GuessPaperSize();
+ aPrtPaperSize = SvxPaperInfo::GetDefaultPaperSize(MapUnit::Map100thMM);
// factors from Windows DIN A4
aOutputSize = Size( static_cast<tools::Long>(aPrtPaperSize.Width() * 0.941),
static_cast<tools::Long>(aPrtPaperSize.Height() * 0.961));