24#include <com/sun/star/awt/XDevice.hpp>
25#include <com/sun/star/frame/Desktop.hpp>
26#include <com/sun/star/frame/XFrame.hpp>
27#include <com/sun/star/i18n/ScriptType.hpp>
37#include <sfx2/sfxsids.hrc>
38#include <vcl/font.hxx>
46#include <document.hxx>
63namespace ApiScriptType = ::com::sun::star::i18n::ScriptType;
65using ::com::sun::star::uno::Exception;
66using ::com::sun::star::uno::Reference;
67using ::com::sun::star::uno::UNO_QUERY_THROW;
68using ::com::sun::star::uno::UNO_SET_THROW;
69using ::com::sun::star::awt::XDevice;
70using ::com::sun::star::awt::DeviceInfo;
71using ::com::sun::star::frame::XFrame;
80 OSL_ENSURE(
mnObjCnt == 0,
"XclDebugObjCounter::~XclDebugObjCounter - wrong root object count" );
89 mxRootStrg(
std::move( xRootStrg )),
91 meTextEnc( eTextEnc ),
92 meSysLang(
Application::GetSettings().GetLanguageTag().getLanguageType() ),
93 meDocLang(
Application::GetSettings().GetLanguageTag().getLanguageType() ),
94 meUILang(
Application::GetSettings().GetUILanguageTag().getLanguageType() ),
95 mnDefApiScript( ApiScriptType::
LATIN ),
96 maScMaxPos( mrDoc.MaxCol(), mrDoc.MaxRow(),
MAXTAB ),
102 mfScreenPixelX( 50.0 ),
103 mfScreenPixelY( 50.0 ),
116 case SvtScriptType::LATIN:
mnDefApiScript = ApiScriptType::LATIN;
break;
117 case SvtScriptType::ASIAN:
mnDefApiScript = ApiScriptType::ASIAN;
break;
118 case SvtScriptType::COMPLEX:
mnDefApiScript = ApiScriptType::COMPLEX;
break;
119 default:
SAL_WARN(
"sc",
"XclRootData::XclRootData - unknown script type" );
143 mxExtDocOpt = std::make_shared<ScExtDocOptions>( *pOldDocOpt );
150 Reference< frame::XDesktop2 > xFramesSupp = frame::Desktop::create( ::comphelper::getProcessComponentContext() );
151 Reference< XFrame >
xFrame( xFramesSupp->getActiveFrame(), UNO_SET_THROW );
152 Reference< XDevice > xDevice(
xFrame->getContainerWindow(), UNO_QUERY_THROW );
153 DeviceInfo aDeviceInfo = xDevice->getInfo();
154 mfScreenPixelX = (aDeviceInfo.PixelPerMeterX > 0) ? (100000.0 / aDeviceInfo.PixelPerMeterX) : 50.0;
155 mfScreenPixelY = (aDeviceInfo.PixelPerMeterY > 0) ? (100000.0 / aDeviceInfo.PixelPerMeterY) : 50.0;
170#if defined(DBG_UTIL) && OSL_DEBUG_LEVEL > 0
181#if defined(DBG_UTIL) && OSL_DEBUG_LEVEL > 0
188#if defined(DBG_UTIL) && OSL_DEBUG_LEVEL > 0
197 OSL_ENSURE( &
mrData == &rRoot.
mrData,
"XclRoot::operator= - incompatible root data" );
203 if( eTextEnc != RTL_TEXTENCODING_DONTKNOW )
216 pPrinter->SetFont( aFont );
220 for (
sal_Unicode cChar =
'0'; cChar <=
'9'; ++cChar)
229 SAL_WARN(
"sc",
"XclRoot::SetCharWidth - invalid character width (no printer?)" );
234 SAL_WARN(
"sc",
"XclRoot::SetCharWidth - invalid character width (no printer?)" );
298 return pDocShell ? comphelper::getFromUnoTunnel<ScModelObj>( pDocShell->
GetModel() ) :
nullptr;
318 return ((nScTab >= 0) &&
GetDoc().GetDrawLayer()) ?
335 return (
GetNullDate().GetYear() == 1904) ? 1904 : 1900;
static double Sub(const DateTime &rDateTime1, const DateTime &rDateTime2)
void AddDays(sal_Int32 nAddDays)
bool SetUpdateLayout(bool bUpdate, bool bRestoring=false)
void SetEditTextObjectPool(SfxItemPool *pPool)
EEControlBits GetControlWord() const
void EnableUndo(bool bEnable)
void SetRefMapMode(const MapMode &rMapMode)
static rtl::Reference< SfxItemPool > CreatePool()
const SfxItemSet & GetEmptyItemSet() const
void SetControlWord(EEControlBits nWord)
void SetStyleSheetPool(SfxStyleSheetPool *pSPool)
void Set(SCCOL nCol, SCROW nRow, SCTAB nTab)
SC_DLLPUBLIC OutputDevice * GetRefDevice()
ScExtDocOptions * GetExtDocOptions()
SC_DLLPUBLIC ScDrawLayer * GetDrawLayer()
SfxObjectShell * GetDocumentShell() const
SC_DLLPUBLIC ScStyleSheetPool * GetStyleSheetPool() const
SC_DLLPUBLIC SvNumberFormatter * GetFormatTable() const
SC_DLLPUBLIC ScRangeName * GetRangeName(SCTAB nTab) const
void SetDefaults(const SfxItemSet &rDefaults, bool bRememberCopy=true)
Creates a copy of SfxItemSet if bRememberCopy set.
Extended options held by an ScDocument containing additional settings for filters.
static SC_DLLPUBLIC SvtScriptType GetDefaultScriptType()
static void FillToEditItemSet(SfxItemSet &rEditSet, const SfxItemSet &rSrcSet, const SfxItemSet *pCondSet=nullptr)
Converts all Calc items contained in rSrcSet to edit engine items and puts them into rEditSet.
static css::uno::Sequence< css::beans::NamedValue > QueryEncryptionDataForMedium(SfxMedium &rMedium, ::comphelper::IDocPasswordVerifier &rVerifier, const ::std::vector< OUString > *pDefaultPasswords)
Opens a password dialog and returns the encryption data.
const SdrPage * GetPage(sal_uInt16 nPgNum) const
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
SfxItemSet & GetItemSet() const
css::uno::Reference< css::frame::XModel3 > GetModel() const
std::unique_ptr< SfxPoolItem > CloneSetWhich(sal_uInt16 nNewWhich) const
Helper class for usage of property sets.
Helper class for usage of property sets.
Access to global data for a filter object (imported or exported document) from other classes.
SfxObjectShell * GetDocShell() const
Returns the object shell of the Calc document.
ScModelObj * GetDocModelObj() const
Returns the object model of the Calc document.
tools::SvRef< SotStorage > OpenStorage(tools::SvRef< SotStorage > const &xStrg, const OUString &rStrgName) const
Tries to open a storage as child of the specified storage for reading or writing.
const tools::SvRef< SotStorage > & GetRootStorage() const
Returns the OLE2 root storage of the imported/exported file.
ScHeaderEditEngine & GetHFEditEngine() const
Returns the edit engine for import/export of headers/footers.
const OUString & GetDocUrl() const
Returns the document URL of the imported/exported file.
ScExtDocOptions & GetExtDocOptions() const
Returns the extended document options.
rtl_TextEncoding GetTextEncoding() const
Returns the text encoding to import/export byte strings.
XclRoot(XclRootData &rRootData)
OutputDevice * GetPrinter() const
Returns pointer to the printer of the Calc document.
css::uno::Sequence< css::beans::NamedValue > RequestEncryptionData(::comphelper::IDocPasswordVerifier &rVerifier) const
Requests and verifies a password from the medium or the user.
void SetTextEncoding(rtl_TextEncoding eTextEnc)
Sets the text encoding to import/export byte strings.
DateTime GetNullDate() const
Returns the null date of the current number formatter.
XclTracer & GetTracer() const
Returns the filter tracer.
SvNumberFormatter & GetFormatter() const
Returns the number formatter of the Calc document.
tools::SvRef< SotStorageStream > OpenStream(tools::SvRef< SotStorage > const &xStrg, const OUString &rStrmName) const
Tries to open a new stream in the specified storage for reading or writing.
sal_Int32 GetHmmFromPixelX(double fPixelX) const
Calculates the width of the passed number of pixels in 1/100 mm.
ScEditEngineDefaulter & GetEditEngine() const
Returns the edit engine for import/export of rich strings etc.
EditEngine & GetDrawEditEngine() const
Returns the edit engine for import/export of drawing text boxes.
void SetCharWidth(const XclFontData &rFontData)
Sets the width of the '0' - '9' digit character as well as the ' ' space char (using the default font...
XclChPropSetHelper & GetChartPropSetHelper() const
Returns the property set helper for the chart filters.
bool HasVbaStorage() const
Returns true, if the document contains a VBA storage.
ScStyleSheetPool & GetStyleSheetPool() const
Returns the style sheet pool of the Calc document.
sal_Int32 GetHmmFromPixelY(double fPixelY) const
Calculates the height of the passed number of pixels in 1/100 mm.
DateTime GetDateTimeFromDouble(double fValue) const
Converts a floating-point value to a date/time value.
ScRangeName & GetNamedRanges() const
Returns the defined names container of the Calc document.
XclRoot & operator=(const XclRoot &rRoot)
double GetDoubleFromDateTime(const DateTime &rDateTime) const
Converts a date/time value to a floating-point value.
sal_uInt16 GetBaseYear() const
Returns the base year depending on the current null date (1900 or 1904).
ScDocument & GetDoc() const
Returns reference to the destination document (import) or source document (export).
SdrPage * GetSdrPage(SCTAB nScTab) const
Returns the drawing layer page of the passed sheet, if present.
XclFontPropSetHelper & GetFontPropSetHelper() const
Returns the property set helper for fonts.
This class wraps an MSFilterTracer to create trace logs for import/export filters.
void SetWeight(FontWeight)
void SetFamily(FontFamily)
void SetCharSet(rtl_TextEncoding)
#define TOOLS_WARN_EXCEPTION(area, stream)
constexpr TypedWhichId< SvxFontHeightItem > EE_CHAR_FONTHEIGHT(EE_CHAR_START+2)
constexpr TypedWhichId< SvxFontHeightItem > EE_CHAR_FONTHEIGHT_CTL(EE_CHAR_START+20)
constexpr TypedWhichId< SvxFontHeightItem > EE_CHAR_FONTHEIGHT_CJK(EE_CHAR_START+19)
#define SAL_WARN(area, stream)
std::shared_ptr< T > make_shared(Args &&... args)
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
constexpr TypedWhichId< SvxFontHeightItem > ATTR_FONT_HEIGHT(101)
constexpr TypedWhichId< SvxFontHeightItem > ATTR_CJK_FONT_HEIGHT(112)
constexpr TypedWhichId< SvxFontHeightItem > ATTR_CTL_FONT_HEIGHT(117)
This struct helps reading and writing Excel fonts.
sal_uInt16 mnHeight
String with styles (bold, italic).
FontWeight GetScWeight() const
Returns the Calc font weight.
FontFamily GetScFamily(rtl_TextEncoding eDefTextEnc) const
Returns the Calc font family.
rtl_TextEncoding GetFontEncoding() const
Returns the font text encoding.
Stores global buffers and data needed elsewhere in the Excel filters.
XclChPropSetHlpRef mxChPropSetHlp
Property set helper for fonts.
rtl_TextEncoding meTextEnc
The default password used for stream encryption.
XclFontPropSetHlpRef mxFontPropSetHlp
Edit engine for text boxes.
ScAddress maMaxPos
Highest Excel cell position.
ScAddress maScMaxPos
Default script type for blank cells (API constant).
ScAddress maXclMaxPos
Highest Calc cell position.
const bool mbExport
Current Calc sheet index.
double mfScreenPixelX
Old RootData struct. Will be removed.
SfxMedium & mrMedium
Current Output format.
tools::Long mnCharWidth
Height of a screen pixel (1/100 mm).
EditEngineRef mxDrawEditEng
Edit engine for header/footer.
OUString maBasePath
Document URL of imported/exported file.
static constexpr OUStringLiteral gaDefPassword
Current user name.
OUString maDocUrl
The source or destination document.
ScExtDocOptRef mxExtDocOpt
Property set helper for chart filter.
ScHeaderEERef mxHFEditEngine
Edit engine for rich strings etc.
OUString maUserName
Base path of imported/exported file (path of maDocUrl).
sal_Int16 mnDefApiScript
UI language (import: from file, export: from system).
XclTracerRef mxTracer
Extended document options.
ScDocument & mrDoc
The root OLE storage of imported/exported file.
tools::Long mnSpaceWidth
Width of '0' in default font (twips).
ScEEDefaulterRef mxEditEngine
Highest position valid in Calc and Excel.
double mfScreenPixelY
Width of a screen pixel (1/100 mm).
XclRootData(XclBiff eBiff, SfxMedium &rMedium, tools::SvRef< SotStorage > xRootStrg, ScDocument &rDoc, rtl_TextEncoding eTextEnc, bool bExport)
false = Import, true = Export.
Reference< XFrame > xFrame
XclBiff
An enumeration for all Excel file format types (BIFF types).
@ EXC_BIFF8
MS Excel 5.0, MS Excel 7.0 (95)
constexpr OUStringLiteral EXC_STORAGE_VBA_PROJECT
const DateTime theOurCompatNullDate(Date(30, 12, 1899))
const DateTime theExcelCutOverDate(Date(1, 3, 1900))