2010-10-12 15:59:00 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2001-05-11 15:23:52 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-10 21:16:51 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2001-05-11 15:23:52 +00:00
|
|
|
*
|
2010-02-12 15:01:35 +01:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2001-05-11 15:23:52 +00:00
|
|
|
*
|
2008-04-10 21:16:51 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2001-05-11 15:23:52 +00:00
|
|
|
*
|
2008-04-10 21:16:51 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2001-05-11 15:23:52 +00:00
|
|
|
*
|
2008-04-10 21:16:51 +00:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2001-05-11 15:23:52 +00:00
|
|
|
*
|
2008-04-10 21:16:51 +00:00
|
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2001-05-11 15:23:52 +00:00
|
|
|
*
|
2008-04-10 21:16:51 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2001-05-11 15:23:52 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
#include <sfx2/printer.hxx>
|
|
|
|
#include <vcl/virdev.hxx>
|
|
|
|
|
|
|
|
#include "sizedev.hxx"
|
|
|
|
#include "docsh.hxx"
|
|
|
|
#include "scmod.hxx"
|
|
|
|
#include "inputopt.hxx"
|
|
|
|
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
|
|
|
|
ScSizeDeviceProvider::ScSizeDeviceProvider( ScDocShell* pDocSh )
|
|
|
|
{
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_Bool bTextWysiwyg = SC_MOD()->GetInputOptions().GetTextWysiwyg();
|
2001-05-11 15:23:52 +00:00
|
|
|
if ( bTextWysiwyg )
|
|
|
|
{
|
|
|
|
pDevice = pDocSh->GetPrinter();
|
2011-03-10 16:55:21 -05:00
|
|
|
bOwner = false;
|
2001-05-15 12:41:30 +00:00
|
|
|
|
|
|
|
aOldMapMode = pDevice->GetMapMode();
|
|
|
|
pDevice->SetMapMode( MAP_PIXEL ); // GetNeededSize needs pixel MapMode
|
2003-05-27 14:08:48 +00:00
|
|
|
// printer has right DigitLanguage already
|
2001-05-11 15:23:52 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pDevice = new VirtualDevice;
|
2003-05-27 14:08:48 +00:00
|
|
|
pDevice->SetDigitLanguage( SC_MOD()->GetOptDigitLanguage() );
|
2011-01-17 13:20:22 +01:00
|
|
|
bOwner = sal_True;
|
2001-05-11 15:23:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Point aLogic = pDevice->LogicToPixel( Point(1000,1000), MAP_TWIP );
|
|
|
|
nPPTX = aLogic.X() / 1000.0;
|
|
|
|
nPPTY = aLogic.Y() / 1000.0;
|
|
|
|
|
|
|
|
if ( !bTextWysiwyg )
|
|
|
|
nPPTX /= pDocSh->GetOutputFactor();
|
|
|
|
}
|
|
|
|
|
|
|
|
ScSizeDeviceProvider::~ScSizeDeviceProvider()
|
|
|
|
{
|
|
|
|
if (bOwner)
|
|
|
|
delete pDevice;
|
2001-05-15 12:41:30 +00:00
|
|
|
else
|
|
|
|
pDevice->SetMapMode( aOldMapMode );
|
2001-05-11 15:23:52 +00:00
|
|
|
}
|
|
|
|
|
2010-10-12 15:59:00 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|