LibreOffice Module sc (master)
1
sc
source
filter
lotus
lotus.cxx
Go to the documentation of this file.
1
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
/*
3
* This file is part of the LibreOffice project.
4
*
5
* This Source Code Form is subject to the terms of the Mozilla Public
6
* License, v. 2.0. If a copy of the MPL was not distributed with this
7
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
8
*
9
* This file incorporates work covered by the following license notice:
10
*
11
* Licensed to the Apache Software Foundation (ASF) under one or more
12
* contributor license agreements. See the NOTICE file distributed
13
* with this work for additional information regarding copyright
14
* ownership. The ASF licenses this file to you under the Apache
15
* License, Version 2.0 (the "License"); you may not use this file
16
* except in compliance with the License. You may obtain a copy of
17
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
18
*/
19
20
#include "
lotfilter.hxx
"
21
#include <
lotimpop.hxx
>
22
23
#include <
editeng/justifyitem.hxx
>
24
#include <
sfx2/docfile.hxx
>
25
#include <
tools/urlobj.hxx
>
26
#include <
scerrors.hxx
>
27
#include <
filtopt.hxx
>
28
#include <ftools.hxx>
29
#include <
tool.h
>
30
31
ErrCode
ScFormatFilterPluginImpl::ScImportLotus123
(
SfxMedium
& rMedium,
ScDocument
& rDocument, rtl_TextEncoding eSrc )
32
{
33
SvStream
* pStream = rMedium.
GetInStream
();
34
if
(!pStream)
35
return
SCERR_IMPORT_OPEN
;
36
37
pStream->
Seek
( 0 );
38
39
pStream->
SetBufferSize
( 32768 );
40
41
LotusContext
aContext(rDocument, eSrc);
42
43
ImportLotus
aLotusImport(aContext, *pStream, eSrc);
44
45
ErrCode
eRet;
46
if
(
ScFilterOptions
().GetWK3Flag())
47
eRet = aLotusImport.
Read
();
48
else
49
eRet =
ErrCode
(0xFFFFFFFF);
// force WK1 /WKS
50
51
// WARNING: QUICK-HACK for WK1 / WKS <-> WK3 / WK4
52
if
( eRet ==
ErrCode
(0xFFFFFFFF) )
53
{
54
pStream->
Seek
( 0 );
55
pStream->
SetBufferSize
( 32768 );
56
assert(&rDocument == &aContext.
rDoc
);
57
eRet =
ScImportLotus123old
(aContext, *pStream, eSrc);
58
pStream->
SetBufferSize
( 0 );
59
return
eRet;
60
}
61
62
if
( eRet !=
ERRCODE_NONE
)
63
return
eRet;
64
65
if
(aContext.
eFirstType
==
Lotus123Typ::WK3
)
66
{
67
// try to load *.FM3 file
68
INetURLObject
aURL
( rMedium.
GetURLObject
() );
69
aURL
.setExtension(
u
"FM3"
);
70
SfxMedium
aMedium(
aURL
.GetMainURL(
INetURLObject::DecodeMechanism::NONE
), StreamMode::STD_READ );
71
pStream = aMedium.
GetInStream
();
72
if
( pStream )
73
{
74
if
( aLotusImport.
Read
( *pStream ) !=
ERRCODE_NONE
)
75
eRet =
SCWARN_IMPORT_WRONG_FM3
;
76
}
77
else
78
eRet =
SCWARN_IMPORT_OPEN_FM3
;
79
}
80
81
return
eRet;
82
}
83
84
LotusContext::LotusContext
(
ScDocument
& rDocP, rtl_TextEncoding eQ)
85
: eTyp(
eWK_UNKNOWN
)
86
, bEOF(false)
87
, eCharset(eQ)
88
, rDoc(rDocP)
89
, eFirstType(
Lotus123Typ
::
X
)
90
, eActType(
Lotus123Typ
::
X
)
91
, pRngNmBffWK3( new
RangeNameBufferWK3
(rDocP) )
92
, maAttrTable( *this )
93
{
94
}
95
96
LotusContext::~LotusContext
()
97
{
98
}
99
100
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
ErrCode
INetURLObject
INetURLObject::DecodeMechanism::NONE
@ NONE
ImportLotus
Definition:
lotimpop.hxx:32
ImportLotus::Read
void Read(ScAddress &)
Definition:
lotimpop.hxx:83
RangeNameBufferWK3
Definition:
namebuff.hxx:74
ScDocument
Definition:
document.hxx:323
ScFilterOptions
Definition:
filtopt.hxx:28
ScFormatFilterPluginImpl::ScImportLotus123
virtual ErrCode ScImportLotus123(SfxMedium &, ScDocument &, rtl_TextEncoding eSrc) override
Definition:
lotus.cxx:31
SfxMedium
SfxMedium::GetURLObject
const INetURLObject & GetURLObject() const
SfxMedium::GetInStream
SvStream * GetInStream()
SvStream
SvStream::SetBufferSize
void SetBufferSize(sal_uInt16 m_nBufSize)
SvStream::Seek
sal_uInt64 Seek(sal_uInt64 nPos)
eWK_UNKNOWN
@ eWK_UNKNOWN
Definition:
decl.h:23
E3dDragConstraint::X
@ X
aURL
URL aURL
docfile.hxx
u
float u
ERRCODE_NONE
#define ERRCODE_NONE
ScImportLotus123old
ErrCode ScImportLotus123old(LotusContext &rContext, SvStream &aStream, rtl_TextEncoding eSrc)
Definition:
filter.cxx:185
filtopt.hxx
Lotus123Typ
Lotus123Typ
Definition:
flttypes.hxx:33
Lotus123Typ::WK3
@ WK3
justifyitem.hxx
lotfilter.hxx
lotimpop.hxx
scerrors.hxx
SCERR_IMPORT_OPEN
#define SCERR_IMPORT_OPEN
Definition:
scerrors.hxx:26
SCWARN_IMPORT_WRONG_FM3
#define SCWARN_IMPORT_WRONG_FM3
Definition:
scerrors.hxx:45
SCWARN_IMPORT_OPEN_FM3
#define SCWARN_IMPORT_OPEN_FM3
Definition:
scerrors.hxx:44
LotusContext
Definition:
lotfilter.hxx:36
LotusContext::LotusContext
LotusContext(ScDocument &rDocP, rtl_TextEncoding eQ)
Definition:
lotus.cxx:84
LotusContext::eFirstType
Lotus123Typ eFirstType
Definition:
lotfilter.hxx:52
LotusContext::~LotusContext
~LotusContext()
Definition:
lotus.cxx:96
LotusContext::rDoc
ScDocument & rDoc
Definition:
lotfilter.hxx:44
tool.h
urlobj.hxx
Generated on Sun Jul 30 2023 04:28:44 for LibreOffice Module sc (master) by
1.9.3