Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
483dcdaf
Kaydet (Commit)
483dcdaf
authored
Agu 05, 2009
tarafından
sb
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
merged in DEV300_m54
üst
87e01531
399bd6c0
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
461 additions
and
57 deletions
+461
-57
impdialog.src
filter/source/pdf/impdialog.src
+1
-1
pdffilter.cxx
filter/source/pdf/pdffilter.cxx
+1
-0
formulabase.hxx
oox/inc/oox/xls/formulabase.hxx
+45
-49
formulaparser.hxx
oox/inc/oox/xls/formulaparser.hxx
+64
-1
ooxformulaparser.hxx
oox/inc/oox/xls/ooxformulaparser.hxx
+115
-0
workbookhelper.hxx
oox/inc/oox/xls/workbookhelper.hxx
+1
-1
facreg.cxx
oox/source/core/facreg.cxx
+3
-1
properties.txt
oox/source/token/properties.txt
+0
-1
externallinkbuffer.cxx
oox/source/xls/externallinkbuffer.cxx
+2
-3
formulabase.cxx
oox/source/xls/formulabase.cxx
+0
-0
formulaparser.cxx
oox/source/xls/formulaparser.cxx
+0
-0
makefile.mk
oox/source/xls/makefile.mk
+1
-0
ooxformulaparser.cxx
oox/source/xls/ooxformulaparser.cxx
+228
-0
No files found.
filter/source/pdf/impdialog.src
Dosyayı görüntüle @
483dcdaf
...
...
@@ -216,7 +216,7 @@ TabPage RID_PDF_TAB_GENER
Size = MAP_APPFONT ( 158 , 16 ) ;
TabStop = TRUE ;
WordBreak = TRUE ;
Text[ en-US ] = "E
~xp
ort automatically inserted blank pages";
Text[ en-US ] = "E
xp~
ort automatically inserted blank pages";
};
CheckBox CB_ADDSTREAM
{
...
...
filter/source/pdf/pdffilter.cxx
Dosyayı görüntüle @
483dcdaf
...
...
@@ -88,6 +88,7 @@ sal_Bool PDFFilter::implExport( const Sequence< PropertyValue >& rDescriptor )
aCfgItem
.
ReadBool
(
String
(
RTL_CONSTASCII_USTRINGPARAM
(
"ExportNotes"
)
),
sal_True
);
aCfgItem
.
ReadBool
(
String
(
RTL_CONSTASCII_USTRINGPARAM
(
"UseTransitionEffects"
)
),
sal_True
);
aCfgItem
.
ReadBool
(
String
(
RTL_CONSTASCII_USTRINGPARAM
(
"IsSkipEmptyPages"
)
),
sal_False
);
aCfgItem
.
ReadBool
(
String
(
RTL_CONSTASCII_USTRINGPARAM
(
"ExportFormFields"
)
),
sal_True
);
aCfgItem
.
ReadInt32
(
String
(
RTL_CONSTASCII_USTRINGPARAM
(
"FormsType"
)
),
0
);
aCfgItem
.
ReadBool
(
String
(
RTL_CONSTASCII_USTRINGPARAM
(
"HideViewerToolbar"
)
),
sal_False
);
aCfgItem
.
ReadBool
(
String
(
RTL_CONSTASCII_USTRINGPARAM
(
"HideViewerMenubar"
)
),
sal_False
);
...
...
oox/inc/oox/xls/formulabase.hxx
Dosyayı görüntüle @
483dcdaf
...
...
@@ -37,9 +37,11 @@
#include <com/sun/star/sheet/FormulaToken.hpp>
#include <com/sun/star/sheet/FormulaOpCodeMapEntry.hpp>
#include "oox/helper/containerhelper.hxx"
#include "oox/helper/propertyset.hxx"
#include "oox/xls/addressconverter.hxx"
namespace
com
{
namespace
sun
{
namespace
star
{
namespace
sheet
{
class
XFormulaParser
;
}
namespace
sheet
{
class
XFormulaTokens
;
}
namespace
sheet
{
class
XFormulaOpCodeMapper
;
}
}
}
}
...
...
@@ -409,6 +411,8 @@ struct FunctionInfo
bool
mbVarParam
;
/// True = use a tFuncVar token, also if min/max are equal.
};
typedef
RefVector
<
FunctionInfo
>
FunctionInfoVector
;
// function info parameter class iterator =====================================
/** Iterator working on the mpnParamClass member of the FunctionInfo struct.
...
...
@@ -437,8 +441,7 @@ private:
// base function provider =====================================================
class
FunctionProviderImpl
;
namespace
{
struct
FunctionData
;
}
struct
FunctionProviderImpl
;
/** Provides access to function info structs for all available sheet functions.
*/
...
...
@@ -464,47 +467,38 @@ public:
EXTERN.CALL function, or 0 on error. */
const
FunctionInfo
*
getFuncInfoFromMacroName
(
const
::
rtl
::
OUString
&
rFuncName
)
const
;
protected
:
typedef
RefVector
<
FunctionInfo
>
FuncVector
;
typedef
RefMap
<
::
rtl
::
OUString
,
FunctionInfo
>
FuncNameMap
;
typedef
RefMap
<
sal_uInt16
,
FunctionInfo
>
FuncIdMap
;
typedef
::
boost
::
shared_ptr
<
FuncVector
>
FuncVectorRef
;
typedef
::
boost
::
shared_ptr
<
FuncNameMap
>
FuncNameMapRef
;
typedef
::
boost
::
shared_ptr
<
FuncIdMap
>
FuncIdMapRef
;
/** Returns the library type associated with the passed URL of a function
library (function add-in). */
FunctionLibraryType
getFuncLibTypeFromLibraryName
(
const
::
rtl
::
OUString
&
rLibraryName
)
const
;
protected
:
/** Returns the list of all function infos. */
inline
const
FuncVector
&
getFuncs
()
const
{
return
*
mxFuncs
;
}
private
:
/** Creates and inserts a function info struct from the passed function data. */
void
initFunc
(
const
FunctionData
&
rFuncData
,
sal_uInt8
nMaxParam
);
/** Initializes the members from the passed function data list. */
void
initFuncs
(
const
FunctionData
*
pBeg
,
const
FunctionData
*
pEnd
,
sal_uInt8
nMaxParam
,
bool
bImportFilter
);
const
FunctionInfoVector
&
getFuncs
()
const
;
private
:
FuncVectorRef
mxFuncs
;
/// All function infos in one list.
FuncNameMapRef
mxOdfFuncs
;
/// Maps ODF function names to function data.
FuncNameMapRef
mxOoxFuncs
;
/// Maps OOXML function names to function data.
FuncIdMapRef
mxOobFuncs
;
/// Maps OOBIN function indexes to function data.
FuncIdMapRef
mxBiffFuncs
;
/// Maps BIFF function indexes to function data.
FuncNameMapRef
mxMacroFuncs
;
/// Maps macro function names to function data.
typedef
::
boost
::
shared_ptr
<
FunctionProviderImpl
>
FunctionProviderImplRef
;
FunctionProviderImplRef
mxFuncImpl
;
/// Shared implementation between all copies of the provider.
};
// op-code and function provider ==============================================
struct
OpCodeProviderImpl
;
/** Provides access to API op-codes for all available formula tokens and to
function info structs for all available sheet functions.
*/
class
OpCodeProvider
:
public
ApiOpCodes
,
public
FunctionProvider
,
public
WorkbookHelper
class
OpCodeProvider
:
public
FunctionProvider
// not derived from WorkbookHelper to make it usable as UNO service
{
public
:
explicit
OpCodeProvider
(
const
WorkbookHelper
&
rHelper
);
explicit
OpCodeProvider
(
const
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
lang
::
XMultiServiceFactory
>&
rxFactory
,
FilterType
eFilter
,
BiffType
eBiff
,
bool
bImportFilter
);
virtual
~
OpCodeProvider
();
/** Returns the structure containing all token op-codes for operators and
special tokens used by the Calc document and its formula parser. */
const
ApiOpCodes
&
getOpCodes
()
const
;
/** Returns the function info for an API token, or 0 on error. */
const
FunctionInfo
*
getFuncInfoFromApiToken
(
const
ApiToken
&
rToken
)
const
;
...
...
@@ -513,30 +507,32 @@ public:
getOoxParserMap
()
const
;
private
:
typedef
::
std
::
map
<
::
rtl
::
OUString
,
ApiToken
>
ApiTokenMap
;
typedef
::
com
::
sun
::
star
::
uno
::
Sequence
<
::
com
::
sun
::
star
::
sheet
::
FormulaOpCodeMapEntry
>
OpCodeEntrySequence
;
typedef
::
std
::
vector
<
::
com
::
sun
::
star
::
sheet
::
FormulaOpCodeMapEntry
>
OpCodeEntryVector
;
typedef
::
boost
::
shared_ptr
<
OpCodeProviderImpl
>
OpCodeProviderImplRef
;
OpCodeProviderImplRef
mxOpCodeImpl
;
/// Shared implementation between all copies of the provider.
}
;
static
bool
fillEntrySeq
(
OpCodeEntrySequence
&
orEntrySeq
,
const
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
sheet
::
XFormulaOpCodeMapper
>&
rxMapper
,
sal_Int32
nMapGroup
);
static
bool
fillTokenMap
(
ApiTokenMap
&
orTokenMap
,
OpCodeEntrySequence
&
orEntrySeq
,
const
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
sheet
::
XFormulaOpCodeMapper
>&
rxMapper
,
sal_Int32
nMapGroup
);
bool
fillFuncTokenMaps
(
ApiTokenMap
&
orIntFuncTokenMap
,
ApiTokenMap
&
orExtFuncTokenMap
,
OpCodeEntrySequence
&
orEntrySeq
,
const
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
sheet
::
XFormulaOpCodeMapper
>&
rxMapper
)
const
;
// API formula parser wrapper =================================================
static
bool
initOpCode
(
sal_Int32
&
ornOpCode
,
const
OpCodeEntrySequence
&
rEntrySeq
,
sal_Int32
nSpecialId
);
bool
initOpCode
(
sal_Int32
&
ornOpCode
,
const
ApiTokenMap
&
rTokenMap
,
const
::
rtl
::
OUString
&
rOdfName
,
const
::
rtl
::
OUString
&
rOoxName
);
bool
initOpCode
(
sal_Int32
&
ornOpCode
,
const
ApiTokenMap
&
rTokenMap
,
const
sal_Char
*
pcOdfName
,
const
sal_Char
*
pcOoxName
);
bool
initOpCode
(
sal_Int32
&
ornOpCode
,
const
ApiTokenMap
&
rTokenMap
,
sal_Unicode
cOdfName
,
sal_Unicode
cOoxName
);
/** A wrapper around the FormulaParser service provided by the Calc document. */
class
ApiParserWrapper
:
public
OpCodeProvider
{
public
:
explicit
ApiParserWrapper
(
const
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
lang
::
XMultiServiceFactory
>&
rxFactory
,
const
OpCodeProvider
&
rOpCodeProv
);
bool
initFuncOpCode
(
FunctionInfo
&
orFuncInfo
,
const
ApiTokenMap
&
rFuncTokenMap
);
bool
initFuncOpCodes
(
const
ApiTokenMap
&
rIntFuncTokenMap
,
const
ApiTokenMap
&
rExtFuncTokenMap
);
/** Returns read/write access to the formula parser property set. */
inline
PropertySet
&
getParserProperties
()
{
return
maParserProps
;
}
private
:
typedef
RefMap
<
sal_Int32
,
FunctionInfo
>
OpCodeFuncMap
;
typedef
::
boost
::
shared_ptr
<
OpCodeFuncMap
>
OpCodeFuncMapRef
;
typedef
::
boost
::
shared_ptr
<
OpCodeEntryVector
>
OpCodeEntryVectorRef
;
/** Calls the XFormulaParser::parseFormula() function of the API parser. */
ApiTokenSequence
parseFormula
(
const
::
rtl
::
OUString
&
rFormula
,
const
::
com
::
sun
::
star
::
table
::
CellAddress
&
rRefPos
)
;
OpCodeFuncMapRef
mxOpCodeFuncs
;
/// Maps API op-codes to function data.
FuncNameMapRef
mxExtProgFuncs
;
/// Maps programmatical API function names to function data.
OpCodeEntryVectorRef
mxParserMap
;
/// OOXML token mapping for formula parser service.
private
:
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
sheet
::
XFormulaParser
>
mxParser
;
PropertySet
maParserProps
;
};
// formula contexts ===========================================================
...
...
@@ -606,10 +602,10 @@ private:
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
sheet
::
XFormulaTokens
>
mxTokens
;
};
// formula parser/
formula compiler base class ===
==============================
// formula parser/
printer base class for filters
==============================
/** Base class for import formula parsers and export formula compilers. */
class
FormulaProcessorBase
:
public
OpCodeProvider
class
FormulaProcessorBase
:
public
OpCodeProvider
,
protected
ApiOpCodes
,
public
WorkbookHelper
{
public
:
explicit
FormulaProcessorBase
(
const
WorkbookHelper
&
rHelper
);
...
...
oox/inc/oox/xls/formulaparser.hxx
Dosyayı görüntüle @
483dcdaf
...
...
@@ -36,6 +36,69 @@
namespace
oox
{
namespace
xls
{
// formula finalizer ==========================================================
/** A generic formula token array finalizer.
After building a formula token array from alien binary file formats, or
parsing an XML formula string using the com.sun.star.sheet.FormulaParser
service, the token array is still not ready to be put into the spreadsheet
document. There may be functions with a wrong number of parameters (missing
but required parameters, or unsupported parameters) or intermediate tokens
used to encode references to macro functions or add-in functions. This
helper processes a passed token array and builds a new compatible token
array.
Derived classes may add more functionality by overwriting the virtual
functions.
*/
class
FormulaFinalizer
:
public
OpCodeProvider
,
protected
ApiOpCodes
{
public
:
explicit
FormulaFinalizer
(
const
OpCodeProvider
&
rOpCodeProv
);
/** Finalizes and returns the passed token array. */
ApiTokenSequence
finalizeTokenArray
(
const
ApiTokenSequence
&
rTokens
);
protected
:
/** Derived classed may try to find a function info struct from the passed
string extracted from an OPCODE_BAD token.
@param rTokenData The string that has been found in an OPCODE_BAD
token preceding the function parentheses.
*/
virtual
const
FunctionInfo
*
resolveBadFuncName
(
const
::
rtl
::
OUString
&
rTokenData
)
const
;
/** Derived classed may try to find the name of a defined name with the
passed index extracted from an OPCODE_NAME token.
@param nTokenIndex The index of the defined name that has been found
in an OPCODE_NAME token preceding the function parentheses.
*/
virtual
::
rtl
::
OUString
resolveDefinedName
(
sal_Int32
nTokenIndex
)
const
;
private
:
typedef
::
std
::
vector
<
const
ApiToken
*
>
ParameterPosVector
;
const
FunctionInfo
*
getFunctionInfo
(
ApiToken
&
orFuncToken
);
const
FunctionInfo
*
getExternCallInfo
(
ApiToken
&
orFuncToken
,
const
ApiToken
&
rECToken
);
void
processTokens
(
const
ApiToken
*
pToken
,
const
ApiToken
*
pTokenEnd
);
const
ApiToken
*
processParameters
(
const
FunctionInfo
&
rFuncInfo
,
const
ApiToken
*
pToken
,
const
ApiToken
*
pTokenEnd
);
bool
isEmptyParameter
(
const
ApiToken
*
pToken
,
const
ApiToken
*
pTokenEnd
)
const
;
const
ApiToken
*
getSingleToken
(
const
ApiToken
*
pToken
,
const
ApiToken
*
pTokenEnd
)
const
;
const
ApiToken
*
skipParentheses
(
const
ApiToken
*
pToken
,
const
ApiToken
*
pTokenEnd
)
const
;
const
ApiToken
*
findParameters
(
ParameterPosVector
&
rParams
,
const
ApiToken
*
pToken
,
const
ApiToken
*
pTokenEnd
)
const
;
void
appendCalcOnlyParameter
(
const
FunctionInfo
&
rFuncInfo
,
size_t
nParam
);
void
appendRequiredParameters
(
const
FunctionInfo
&
rFuncInfo
,
size_t
nParamCount
);
bool
appendFinalToken
(
const
ApiToken
&
rToken
);
private
:
ApiTokenVector
maTokens
;
};
// ============================================================================
class
FormulaParserImpl
;
...
...
@@ -63,7 +126,7 @@ public:
RecordInputStream
&
rStrm
)
const
;
/** Imports and converts a BIFF token array from the passed stream.
@param pnFmlaSize Size of the token array. If
0
is passed, reads
@param pnFmlaSize Size of the token array. If
null
is passed, reads
it from stream (1 byte in BIFF2, 2 bytes otherwise) first. */
void
importFormula
(
FormulaContext
&
rContext
,
...
...
oox/inc/oox/xls/ooxformulaparser.hxx
0 → 100644
Dosyayı görüntüle @
483dcdaf
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: ooxformulaparser.hxx,v $
* $Revision: 1.1 $
*
* This file is part of OpenOffice.org.
*
* 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.
*
* 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).
*
* 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.
*
************************************************************************/
#ifndef OOX_XLS_OOXFORMULAPARSER_HXX
#define OOX_XLS_OOXFORMULAPARSER_HXX
#include <boost/shared_ptr.hpp>
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/sheet/XFilterFormulaParser.hpp>
#include <cppuhelper/implbase3.hxx>
namespace
oox
{
namespace
xls
{
class
OOXMLFormulaParserImpl
;
class
OOXMLFormulaPrinterImpl
;
// ============================================================================
typedef
::
cppu
::
WeakImplHelper3
<
::
com
::
sun
::
star
::
lang
::
XServiceInfo
,
::
com
::
sun
::
star
::
lang
::
XInitialization
,
::
com
::
sun
::
star
::
sheet
::
XFilterFormulaParser
>
OOXMLFormulaParserBase
;
/** OOXML formula parser/compiler service for usage in ODF filters. */
class
OOXMLFormulaParser
:
public
OOXMLFormulaParserBase
{
public
:
explicit
OOXMLFormulaParser
();
virtual
~
OOXMLFormulaParser
();
// com.sun.star.lang.XServiceInfo interface -------------------------------
virtual
::
rtl
::
OUString
SAL_CALL
getImplementationName
()
throw
(
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
virtual
sal_Bool
SAL_CALL
supportsService
(
const
::
rtl
::
OUString
&
rService
)
throw
(
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
virtual
::
com
::
sun
::
star
::
uno
::
Sequence
<
::
rtl
::
OUString
>
SAL_CALL
getSupportedServiceNames
()
throw
(
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
// com.sun.star.lang.XInitialization interface ----------------------------
virtual
void
SAL_CALL
initialize
(
const
::
com
::
sun
::
star
::
uno
::
Sequence
<
::
com
::
sun
::
star
::
uno
::
Any
>&
rArgs
)
throw
(
::
com
::
sun
::
star
::
uno
::
Exception
,
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
// com.sun.star.sheet.XFilterFormulaParser interface ----------------------
virtual
::
rtl
::
OUString
SAL_CALL
getSupportedNamespace
()
throw
(
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
// com.sun.star.sheet.XFormulaParser interface ----------------------------
virtual
::
com
::
sun
::
star
::
uno
::
Sequence
<
::
com
::
sun
::
star
::
sheet
::
FormulaToken
>
SAL_CALL
parseFormula
(
const
::
rtl
::
OUString
&
rFormula
,
const
::
com
::
sun
::
star
::
table
::
CellAddress
&
rReferencePos
)
throw
(
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
virtual
::
rtl
::
OUString
SAL_CALL
printFormula
(
const
::
com
::
sun
::
star
::
uno
::
Sequence
<
::
com
::
sun
::
star
::
sheet
::
FormulaToken
>&
rTokens
,
const
::
com
::
sun
::
star
::
table
::
CellAddress
&
rReferencePos
)
throw
(
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
private
:
typedef
::
boost
::
shared_ptr
<
OOXMLFormulaParserImpl
>
ParserImplRef
;
typedef
::
boost
::
shared_ptr
<
OOXMLFormulaPrinterImpl
>
PrinterImplRef
;
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
lang
::
XComponent
>
mxComponent
;
ParserImplRef
mxParserImpl
;
/// Implementation of import parser.
PrinterImplRef
mxPrinterImpl
;
/// Implementation of export printer.
};
// ============================================================================
}
// namespace xls
}
// namespace oox
#endif
oox/inc/oox/xls/workbookhelper.hxx
Dosyayı görüntüle @
483dcdaf
...
...
@@ -321,7 +321,7 @@ public:
// converters -------------------------------------------------------------
/** Returns the import formula parser. */
/** Returns the import formula parser
(import filter only!)
. */
FormulaParser
&
getFormulaParser
()
const
;
/** Returns the measurement unit converter. */
UnitConverter
&
getUnitConverter
()
const
;
...
...
oox/source/core/facreg.cxx
Dosyayı görüntüle @
483dcdaf
...
...
@@ -66,6 +66,7 @@ namespace oox {
namespace
shape
{
SERVICE
(
ShapeContextHandler
);
}
namespace
shape
{
SERVICE
(
FastTokenHandlerService
);
}
namespace
docprop
{
SERVICE2
(
OOXMLDocPropImportImpl
);
}
namespace
xls
{
SERVICE2
(
OOXMLFormulaParser
);
}
}
//
...
...
@@ -108,6 +109,7 @@ OOX_DLLPUBLIC sal_Bool SAL_CALL component_writeInfo( void * , void * pRegistryKe
WRITEINFO
(
::
oox
::
shape
::
ShapeContextHandler
);
WRITEINFO
(
::
oox
::
shape
::
FastTokenHandlerService
);
WRITEINFO
(
::
oox
::
docprop
::
OOXMLDocPropImportImpl
);
WRITEINFO
(
::
oox
::
xls
::
OOXMLFormulaParser
);
}
catch
(
registry
::
InvalidRegistryException
&
)
{
...
...
@@ -147,7 +149,6 @@ OOX_DLLPUBLIC void * SAL_CALL component_getFactory( const sal_Char * pImplName,
const
sal_Int32
nImplNameLen
=
strlen
(
pImplName
);
// impress oasis import
SINGLEFACTORY
(
::
oox
::
core
::
FilterDetect
)
else
SINGLEFACTORY
(
oox
::
ppt
::
PowerPointImport
)
else
SINGLEFACTORY
(
::
oox
::
xls
::
BiffDetector
)
...
...
@@ -156,6 +157,7 @@ OOX_DLLPUBLIC void * SAL_CALL component_getFactory( const sal_Char * pImplName,
else
SINGLEFACTORY
(
::
oox
::
shape
::
ShapeContextHandler
)
else
SINGLEFACTORY
(
::
oox
::
shape
::
FastTokenHandlerService
)
else
SINGLEFACTORY2
(
::
oox
::
docprop
::
OOXMLDocPropImportImpl
)
else
SINGLEFACTORY2
(
::
oox
::
xls
::
OOXMLFormulaParser
)
if
(
xFactory
.
is
())
{
...
...
oox/source/token/properties.txt
Dosyayı görüntüle @
483dcdaf
...
...
@@ -288,7 +288,6 @@ Printable
Protected
Reference
ReferenceDevice
ReferencePosition
RegularExpressions
RelId
RelativeHorizontalTabbarWidth
...
...
oox/source/xls/externallinkbuffer.cxx
Dosyayı görüntüle @
483dcdaf
...
...
@@ -750,15 +750,14 @@ void ExternalLink::setExternalTargetUrl( const OUString& rTargetUrl, const OUStr
meLinkType
=
LINKTYPE_UNKNOWN
;
if
(
rTargetType
==
OOX_TARGETTYPE_EXTLINK
)
{
maTargetUrl
=
getBaseFilter
().
getAbsoluteUrl
(
rTargetUrl
);
maTargetUrl
=
getBaseFilter
().
getAbsoluteUrl
(
rTargetUrl
);
if
(
maTargetUrl
.
getLength
()
>
0
)
meLinkType
=
LINKTYPE_EXTERNAL
;
}
else
if
(
rTargetType
==
OOX_TARGETTYPE_LIBRARY
)
{
meLinkType
=
LINKTYPE_LIBRARY
;
if
(
rTargetUrl
.
equalsIgnoreAsciiCaseAscii
(
"EUROTOOL.XLA"
)
||
rTargetUrl
.
equalsIgnoreAsciiCaseAscii
(
"EUROTOOL.XLAM"
)
)
meFuncLibType
=
FUNCLIB_EUROTOOL
;
meFuncLibType
=
getFormulaParser
().
getFuncLibTypeFromLibraryName
(
rTargetUrl
);
}
OSL_ENSURE
(
meLinkType
!=
LINKTYPE_UNKNOWN
,
"ExternalLink::setExternalTargetUrl - empty target URL or unknown target type"
);
...
...
oox/source/xls/formulabase.cxx
Dosyayı görüntüle @
483dcdaf
This diff is collapsed.
Click to expand it.
oox/source/xls/formulaparser.cxx
Dosyayı görüntüle @
483dcdaf
This diff is collapsed.
Click to expand it.
oox/source/xls/makefile.mk
Dosyayı görüntüle @
483dcdaf
...
...
@@ -68,6 +68,7 @@ SLOFILES = \
$(SLO)$/
formulabase.obj
\
$(SLO)$/
formulaparser.obj
\
$(SLO)$/
numberformatsbuffer.obj
\
$(SLO)$/
ooxformulaparser.obj
\
$(SLO)$/
pagesettings.obj
\
$(SLO)$/
pivotcachebuffer.obj
\
$(SLO)$/
pivotcachefragment.obj
\
...
...
oox/source/xls/ooxformulaparser.cxx
0 → 100644
Dosyayı görüntüle @
483dcdaf
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: ooxformulaparser.cxx,v $
* $Revision: 1.1 $
*
* This file is part of OpenOffice.org.
*
* 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.
*
* 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).
*
* 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.
*
************************************************************************/
#include "oox/xls/ooxformulaparser.hxx"
#include <com/sun/star/uno/XComponentContext.hpp>
#include "oox/xls/formulaparser.hxx"
using
::
rtl
::
OUString
;
using
::
com
::
sun
::
star
::
uno
::
Any
;
using
::
com
::
sun
::
star
::
uno
::
Exception
;
using
::
com
::
sun
::
star
::
uno
::
Reference
;
using
::
com
::
sun
::
star
::
uno
::
RuntimeException
;
using
::
com
::
sun
::
star
::
uno
::
Sequence
;
using
::
com
::
sun
::
star
::
uno
::
UNO_QUERY_THROW
;
using
::
com
::
sun
::
star
::
uno
::
XComponentContext
;
using
::
com
::
sun
::
star
::
uno
::
XInterface
;
using
::
com
::
sun
::
star
::
lang
::
XMultiServiceFactory
;
using
::
com
::
sun
::
star
::
table
::
CellAddress
;
using
::
com
::
sun
::
star
::
sheet
::
FormulaToken
;
namespace
oox
{
namespace
xls
{
// ============================================================================
class
OOXMLFormulaParserImpl
:
private
FormulaFinalizer
{
public
:
explicit
OOXMLFormulaParserImpl
(
const
Reference
<
XMultiServiceFactory
>&
rxFactory
);
Sequence
<
FormulaToken
>
parseFormula
(
const
OUString
&
rFormula
,
const
CellAddress
&
rReferencePos
);
protected
:
virtual
const
FunctionInfo
*
resolveBadFuncName
(
const
OUString
&
rTokenData
)
const
;
private
:
ApiParserWrapper
maApiParser
;
};
// ----------------------------------------------------------------------------
OOXMLFormulaParserImpl
::
OOXMLFormulaParserImpl
(
const
Reference
<
XMultiServiceFactory
>&
rxFactory
)
:
FormulaFinalizer
(
OpCodeProvider
(
rxFactory
,
FILTER_OOX
,
BIFF_UNKNOWN
,
true
)
),
maApiParser
(
rxFactory
,
*
this
)
{
}
Sequence
<
FormulaToken
>
OOXMLFormulaParserImpl
::
parseFormula
(
const
OUString
&
rFormula
,
const
CellAddress
&
rReferencePos
)
{
return
finalizeTokenArray
(
maApiParser
.
parseFormula
(
rFormula
,
rReferencePos
)
);
}
const
FunctionInfo
*
OOXMLFormulaParserImpl
::
resolveBadFuncName
(
const
OUString
&
rTokenData
)
const
{
/* Try to parse calls to library functions. The format of such a function
call is assumed to be
"'<path-to-office-install>\Library\<libname>'!<funcname>". */
// the string has to start with an apostroph (followed by the library URL)
if
(
(
rTokenData
.
getLength
()
>=
6
)
&&
(
rTokenData
[
0
]
==
'\''
)
)
{
// library URL and function name are separated by an exclamation mark
sal_Int32
nExclamPos
=
rTokenData
.
lastIndexOf
(
'!'
);
if
(
(
1
<
nExclamPos
)
&&
(
nExclamPos
+
1
<
rTokenData
.
getLength
())
&&
(
rTokenData
[
nExclamPos
-
1
]
==
'\''
)
)
{
// find the last backslash that separates library path and name
sal_Int32
nFileSep
=
rTokenData
.
lastIndexOf
(
'\\'
,
nExclamPos
-
2
);
if
(
nFileSep
>
1
)
{
// find preceding backslash that separates the last directory name
sal_Int32
nDirSep
=
rTokenData
.
lastIndexOf
(
'\\'
,
nFileSep
-
1
);
// function library is located in a directory called 'library'
if
(
(
nDirSep
>
0
)
&&
rTokenData
.
matchIgnoreAsciiCaseAsciiL
(
RTL_CONSTASCII_STRINGPARAM
(
"
\\
LIBRARY
\\
"
),
nDirSep
)
)
{
// try to find a function info for the function name
OUString
aFuncName
=
rTokenData
.
copy
(
nExclamPos
+
1
).
toAsciiUpperCase
();
const
FunctionInfo
*
pFuncInfo
=
getFuncInfoFromOoxFuncName
(
aFuncName
);
if
(
pFuncInfo
&&
(
pFuncInfo
->
meFuncLibType
!=
FUNCLIB_UNKNOWN
)
)
{
// check that the name of the library matches
OUString
aLibName
=
rTokenData
.
copy
(
nFileSep
+
1
,
nExclamPos
-
nFileSep
-
2
);
if
(
pFuncInfo
->
meFuncLibType
==
getFuncLibTypeFromLibraryName
(
aLibName
)
)
return
pFuncInfo
;
}
}
}
}
}
return
0
;
}
// ============================================================================
class
OOXMLFormulaPrinterImpl
:
public
OpCodeProvider
{
public
:
explicit
OOXMLFormulaPrinterImpl
(
const
Reference
<
XMultiServiceFactory
>&
rxFactory
);
private
:
ApiParserWrapper
maApiParser
;
};
// ----------------------------------------------------------------------------
OOXMLFormulaPrinterImpl
::
OOXMLFormulaPrinterImpl
(
const
Reference
<
XMultiServiceFactory
>&
rxFactory
)
:
OpCodeProvider
(
rxFactory
,
FILTER_OOX
,
BIFF_UNKNOWN
,
false
),
maApiParser
(
rxFactory
,
*
this
)
{
}
// ============================================================================
Sequence
<
OUString
>
OOXMLFormulaParser_getSupportedServiceNames
()
{
Sequence
<
OUString
>
aServiceNames
(
1
);
aServiceNames
[
0
]
=
CREATE_OUSTRING
(
"com.sun.star.sheet.FilterFormulaParser"
);
return
aServiceNames
;
}
OUString
OOXMLFormulaParser_getImplementationName
()
{
return
CREATE_OUSTRING
(
"com.sun.star.comp.oox.OOXMLFormulaParser"
);
}
Reference
<
XInterface
>
SAL_CALL
OOXMLFormulaParser_createInstance
(
const
Reference
<
XComponentContext
>&
)
throw
(
Exception
)
{
return
static_cast
<
::
cppu
::
OWeakObject
*
>
(
new
OOXMLFormulaParser
);
}
// ============================================================================
OOXMLFormulaParser
::
OOXMLFormulaParser
()
{
}
OOXMLFormulaParser
::~
OOXMLFormulaParser
()
{
}
// com.sun.star.lang.XServiceInfo interface -----------------------------------
OUString
SAL_CALL
OOXMLFormulaParser
::
getImplementationName
()
throw
(
RuntimeException
)
{
return
OOXMLFormulaParser_getImplementationName
();
}
sal_Bool
SAL_CALL
OOXMLFormulaParser
::
supportsService
(
const
OUString
&
rService
)
throw
(
RuntimeException
)
{
const
Sequence
<
OUString
>
aServices
(
OOXMLFormulaParser_getSupportedServiceNames
()
);
const
OUString
*
pArray
=
aServices
.
getConstArray
();
const
OUString
*
pArrayEnd
=
pArray
+
aServices
.
getLength
();
return
::
std
::
find
(
pArray
,
pArrayEnd
,
rService
)
!=
pArrayEnd
;
}
Sequence
<
OUString
>
SAL_CALL
OOXMLFormulaParser
::
getSupportedServiceNames
()
throw
(
RuntimeException
)
{
return
OOXMLFormulaParser_getSupportedServiceNames
();
}
// com.sun.star.lang.XInitialization interface --------------------------------
void
SAL_CALL
OOXMLFormulaParser
::
initialize
(
const
Sequence
<
Any
>&
rArgs
)
throw
(
Exception
,
RuntimeException
)
{
OSL_ENSURE
(
rArgs
.
hasElements
(),
"OOXMLFormulaParser::initialize - missing arguments"
);
if
(
!
rArgs
.
hasElements
()
)
throw
RuntimeException
();
mxComponent
.
set
(
rArgs
[
0
],
UNO_QUERY_THROW
);
}
// com.sun.star.sheet.XFilterFormulaParser interface --------------------------
OUString
SAL_CALL
OOXMLFormulaParser
::
getSupportedNamespace
()
throw
(
RuntimeException
)
{
return
CREATE_OUSTRING
(
"http://schemas.microsoft.com/office/excel/formula"
);
}
// com.sun.star.sheet.XFormulaParser interface --------------------------------
Sequence
<
FormulaToken
>
SAL_CALL
OOXMLFormulaParser
::
parseFormula
(
const
OUString
&
rFormula
,
const
CellAddress
&
rReferencePos
)
throw
(
RuntimeException
)
{
if
(
!
mxParserImpl
)
{
Reference
<
XMultiServiceFactory
>
xFactory
(
mxComponent
,
UNO_QUERY_THROW
);
mxParserImpl
.
reset
(
new
OOXMLFormulaParserImpl
(
xFactory
)
);
}
return
mxParserImpl
->
parseFormula
(
rFormula
,
rReferencePos
);
}
OUString
SAL_CALL
OOXMLFormulaParser
::
printFormula
(
const
Sequence
<
FormulaToken
>&
/*rTokens*/
,
const
CellAddress
&
/*rReferencePos*/
)
throw
(
RuntimeException
)
{
// not implemented
throw
RuntimeException
();
}
// ============================================================================
}
// namespace xls
}
// namespace oox
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment