[ooo-build-commit] .: Branch 'ooo-build-3-2-1' - bin/setup.in bin/unpack configure.in download.in patches/dev300
Cédric Bosdonnat
cbosdo at kemper.freedesktop.org
Mon Sep 20 03:30:26 PDT 2010
bin/setup.in | 2
bin/unpack | 8
configure.in | 22
download.in | 9
patches/dev300/apply | 4
patches/dev300/fields-table-formula.diff | 1120 +++++++++++++++++++++++++++++++
6 files changed, 1164 insertions(+), 1 deletion(-)
New commits:
commit b79b278f45da19229c7bc43fc7962cd7c64fdbf6
Author: Cédric Bosdonnat <cedricbosdo at openoffice.org>
Date: Mon Sep 20 12:28:05 2010 +0200
Fixed n#631912
* bin/setup.in:
* bin/unpack: unpack ixion library
* configure.in: added --enable-ixion as this is a feature
* download.in: download ixion library
* patches/dev300/apply: apply the patch
* patches/dev300/fields-table-formula.diff: the patch itself
diff --git a/bin/setup.in b/bin/setup.in
index f8d65fe..178b47b 100755
--- a/bin/setup.in
+++ b/bin/setup.in
@@ -73,6 +73,8 @@ SYSTEM_LIBWPS=@SYSTEM_LIBWPS@
LIBWPD_TARBALL=@LIBWPD_TARBALL@
LIBWPG_TARBALL=@LIBWPG_TARBALL@
LIBWPS_TARBALL=@LIBWPS_TARBALL@
+IXION_ENABLED=@IXION_ENABLED@
+LIBIXION_TARBALL=@LIBIXION_TARBALL@
GLITZ_VER=@GLITZ_VER@
DEJAVU_FONTS_VER=@DEJAVU_FONTS_VER@
DEJAVU_FONTS_PACK_NAME=@DEJAVU_FONTS_PACK_NAME@
diff --git a/bin/unpack b/bin/unpack
index 39f4e3f..0c70f05 100755
--- a/bin/unpack
+++ b/bin/unpack
@@ -873,6 +873,14 @@ if test "$SYSTEM_LIBWPG" != "YES"; then
$GNUCP $SRCDIR/$LIBWPG_TARBALL $OOBUILDDIR/libwpg/download/ || exit 1
fi
+# Ixion
+if test "$IXION_ENABLED" != "YES"; then
+ check_tarball $SRCDIR/$LIBIXION_TARBALL
+ echo "Copying ixion package into the tree"
+ mkdir -p $OOBUILDDIR/ixion/download || exit 1
+ $GNUCP $SRCDIR/$LIBIXION_TARBALL $OOBUILDDIR/ixion/download/ || exit 1
+fi
+
# OxygenOffice extras
for pack in $OOOP_FONTS_PACK $OOOP_GALLERY_PACK $OOOP_SAMPLES_PACK $OOOP_TEMPLATES_PACK ; do
check_file $SRCDIR/$pack
diff --git a/configure.in b/configure.in
index 129bd62..04a4aa0 100644
--- a/configure.in
+++ b/configure.in
@@ -180,6 +180,11 @@ AC_ARG_ENABLE(cairo,
--enable-cairo Enables cairo canvas backend.],
,)
+AC_ARG_ENABLE(ixion,
+[
+ --enable-ixion Enables use of ixion library.]
+,,enable_ixion="no")
+
AC_ARG_WITH(ooo-builddir,
[
--with-ooo-builddir define the directory where openoffice.org will be
@@ -874,6 +879,23 @@ AC_SUBST(SYSTEM_CAIRO)
AC_SUBST(CAIRO_VER)
AC_SUBST(CAIRO_CONFIGURE_FLAG)
+
+if test "$enable_ixion" != "no"; then
+ IXION_ENABLED=TRUE
+ LIBIXION_TARBALL=ixion-0.2.0.tar.gz
+
+ if test -z "$OOO_ADDITIONAL_SECTIONS" ; then
+ OOO_ADDITIONAL_SECTIONS="IxionUse"
+ else
+ OOO_ADDITIONAL_SECTIONS="$OOO_ADDITIONAL_SECTIONS,IxionUse"
+ fi
+else
+ IXION_ENABLED=
+ LIBIXION_TARBALL=
+fi
+AC_SUBST(IXION_ENABLED)
+AC_SUBST(LIBIXION_TARBALL)
+
PREBUILT_WRITINGAIDS_TIMESTAMP=20091204
AC_SUBST(PREBUILT_WRITINGAIDS_TIMESTAMP)
diff --git a/download.in b/download.in
index 6ee9095..2fa7f15 100755
--- a/download.in
+++ b/download.in
@@ -178,7 +178,10 @@ sub trim($)
'MagyarLinLibertine.*\.zip' => 'http://numbertext.org/linux/',
# Multi-dimensional data structure
- 'mdds_0.3.0.tar.bz2' => 'http://multidimalgorithm.googlecode.com/files/'
+ 'mdds_0.3.0.tar.bz2' => 'http://multidimalgorithm.googlecode.com/files/',
+
+# Ixion formula library
+ 'ixion*' => 'http://download.go-oo.org/src/'
);
@@ -446,6 +449,10 @@ source_file( "biblio.tar.bz2" );
# Required to build sc.
source_file( "mdds_0.3.0.tar.bz2" );
+if ('@IXION_ENABLED@' eq 'TRUE' ) {
+ source_file( "ixion-0.2.0.tar.gz" );
+}
+
if (!$SPLIT && ($download_all || '@ENABLE_BINFILTER@' eq 'TRUE')) {
source_file_ooo( "binfilter" );
}
diff --git a/patches/dev300/apply b/patches/dev300/apply
index 1de3768..177ca01 100644
--- a/patches/dev300/apply
+++ b/patches/dev300/apply
@@ -3050,6 +3050,10 @@ dummy-fields-ole-links.diff, n#628098, cbosdo
fields-nested-set.diff, n#634478, cbosdo
fields-double-click.diff, n#639288, cbosdo
+[ IxionUse ]
+fields-table-formula.diff, n#631912, cbosdo
+
+[ Fixes ]
sw-import-html-controls.diff, n#485609, freuter
svx-hacky-htmlselect-control-import.diff, n#523191, noelpwer
diff --git a/patches/dev300/fields-table-formula.diff b/patches/dev300/fields-table-formula.diff
new file mode 100644
index 0000000..a0e4cce
--- /dev/null
+++ b/patches/dev300/fields-table-formula.diff
@@ -0,0 +1,1120 @@
+Basic implementation for WW8 formula fields import
+
+From: Cédric Bosdonnat <cedricbosdo at openoffice.org>
+
+
+---
+
+ ixion/ixion-0.2.0.diff | 44 ++++++++
+ ixion/makefile.mk | 49 +++++++++
+ ixion/prj/build.lst | 3 +
+ ixion/prj/d.lst | 4 +
+ offapi/com/sun/star/text/XCell2.idl | 58 +++++++++++
+ offapi/com/sun/star/text/makefile.mk | 1
+ sw/inc/cellatr.hxx | 4 -
+ sw/inc/cellfml.hxx | 28 +++--
+ sw/inc/unotbl.hxx | 8 +-
+ sw/prj/build.lst | 2
+ sw/source/core/attr/cellatr.cxx | 6 +
+ sw/source/core/fields/cellfml.cxx | 177 ++++++++++++++++++++++++++++++----
+ sw/source/core/fields/makefile.mk | 3 -
+ sw/source/core/unocore/unotbl.cxx | 13 ++
+ sw/source/filter/ww8/wrtw8nds.cxx | 20 ++++
+ sw/source/filter/ww8/ww8par.hxx | 1
+ sw/source/filter/ww8/ww8par2.cxx | 60 ++++++++++++
+ sw/source/filter/ww8/ww8par5.cxx | 2
+ sw/source/filter/xml/xmltble.cxx | 13 ++
+ sw/source/filter/xml/xmltbli.cxx | 33 +++++-
+ sw/source/filter/xml/xmltbli.hxx | 3 -
+ sw/source/ui/shells/textsh1.cxx | 9 ++
+ sw/util/makefile.mk | 5 +
+ 23 files changed, 485 insertions(+), 61 deletions(-)
+ create mode 100644 ixion/ixion-0.2.0.diff
+ create mode 100644 ixion/makefile.mk
+ create mode 100644 ixion/prj/build.lst
+ create mode 100644 ixion/prj/d.lst
+ create mode 100644 offapi/com/sun/star/text/XCell2.idl
+
+
+diff --git ixion/ixion-0.2.0.diff ixion/ixion-0.2.0.diff
+new file mode 100644
+index 0000000..5aa43a6
+--- /dev/null
++++ ixion/ixion-0.2.0.diff
+@@ -0,0 +1,44 @@
++--- /dev/null
+++++ misc/build/ixion-0.2.0/src/libixion/makefile.mk
++@@ -0,0 +1,41 @@
+++EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
+++
+++PRJ=..$/..$/..$/..$/..$/..
+++
+++PRJNAME=libixion
+++TARGET=ixionlib
+++ENABLE_EXCEPTIONS=TRUE
+++LIBTARGET=NO
+++
+++.INCLUDE : settings.mk
+++
+++CFLAGS+=-I..$/..$/inc -std=c++0x
+++
+++.IF "$(GUI)"=="WNT"
+++CFLAGS+=-GR
+++.ENDIF
+++.IF "$(COM)"=="GCC"
+++CFLAGSCXX+=-frtti
+++.ENDIF
+++
+++SLOFILES= \
+++ $(SLO)$/cell.obj \
+++ $(SLO)$/cell_queue_manager.obj \
+++ $(SLO)$/depends_tracker.obj \
+++ $(SLO)$/formula_functions.obj \
+++ $(SLO)$/formula_interpreter.obj \
+++ $(SLO)$/formula_lexer.obj \
+++ $(SLO)$/formula_parser.obj \
+++ $(SLO)$/formula_result.obj \
+++ $(SLO)$/formula_tokens.obj \
+++ $(SLO)$/global.obj \
+++ $(SLO)$/lexer_tokens.obj \
+++ $(SLO)$/mem_str_buf.obj \
+++ $(SLO)$/model_parser.obj \
+++ $(SLO)$/sort_input_parser.obj \
+++
+++LIB1ARCHIV=$(LB)$/libixionlib.a
+++LIB1TARGET=$(SLB)$/$(TARGET).lib
+++LIB1OBJFILES= $(SLOFILES)
+++
+++.INCLUDE : target.mk
+diff --git ixion/makefile.mk ixion/makefile.mk
+new file mode 100644
+index 0000000..65ef81f
+--- /dev/null
++++ ixion/makefile.mk
+@@ -0,0 +1,49 @@
++#*************************************************************************
++#
++# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++#
++# Copyright 2000, 2010 Oracle and/or its affiliates.
++#
++# OpenOffice.org - a multi-platform office productivity suite
++#
++# 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.
++#
++#*************************************************************************
++
++PRJ=.
++
++PRJNAME=ixion
++TARGET=ixion
++
++# --- Settings -----------------------------------------------------
++
++.INCLUDE : settings.mk
++
++# --- Files --------------------------------------------------------
++
++TARFILE_NAME=ixion-0.2.0
++#PATCH_FILES=$(TARFILE_NAME).diff
++BUILD_ACTION=dmake $(MFLAGS) $(CALLMACROS)
++BUILD_DIR=src$/libixion
++
++# --- Targets ------------------------------------------------------
++
++.INCLUDE : set_ext.mk
++.INCLUDE : target.mk
++.INCLUDE : tg_ext.mk
++
+diff --git ixion/prj/build.lst ixion/prj/build.lst
+new file mode 100644
+index 0000000..0ac7093
+--- /dev/null
++++ ixion/prj/build.lst
+@@ -0,0 +1,3 @@
++ix ixion : solenv external NULL
++ix ixion usr1 - all ix_mkout NULL
++ix ixion nmake - all ix_ixion NULL
+diff --git ixion/prj/d.lst ixion/prj/d.lst
+new file mode 100644
+index 0000000..2dbc5aa
+--- /dev/null
++++ ixion/prj/d.lst
+@@ -0,0 +1,4 @@
++mkdir: %_DEST%\inc%_EXT%\libwpd
++..\%__SRC%\misc\build\ixion*\inc\*.hpp %_DEST%\inc%_EXT%\ixion\
++..\%__SRC%\lib\*.a %_DEST%\lib%_EXT%\*.a
++..\%__SRC%\slb\*.lib %_DEST%\lib%_EXT%\*.lib
+diff --git offapi/com/sun/star/text/XCell2.idl offapi/com/sun/star/text/XCell2.idl
+new file mode 100644
+index 0000000..a26625d
+--- /dev/null
++++ offapi/com/sun/star/text/XCell2.idl
+@@ -0,0 +1,58 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ *
++ * Copyright 2000, 2010 Oracle and/or its affiliates.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * 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 __com_sun_star_text_XCell2_idl__
++#define __com_sun_star_text_XCell2_idl__
++
++#ifndef __com_sun_star_table_XCell_idl__
++#include <com/sun/star/table/XCell.idl>
++#endif
++
++//=============================================================================
++
++module com { module sun { module star { module text {
++
++//=============================================================================
++
++/** provides methods to access the contents of a cell in a text table.
++ */
++interface XCell2: com::sun::star::table::XCell
++{
++ //-------------------------------------------------------------------------
++
++ /** returns true if the cell formula is in the WW format.
++ */
++ boolean isWWFormula();
++
++};
++
++//=============================================================================
++
++}; }; }; };
++
++#endif
++
+diff --git offapi/com/sun/star/text/makefile.mk offapi/com/sun/star/text/makefile.mk
+index a481f54..06ee2f4 100644
+--- offapi/com/sun/star/text/makefile.mk
++++ offapi/com/sun/star/text/makefile.mk
+@@ -203,6 +203,7 @@ IDLFILES=\
+ XAutoTextGroup.idl\
+ XBookmarkInsertTool.idl\
+ XBookmarksSupplier.idl\
++ XCell2.idl\
+ XChapterNumberingSupplier.idl\
+ XDefaultNumberingProvider.idl\
+ XDependentTextField.idl\
+diff --git sw/inc/cellatr.hxx sw/inc/cellatr.hxx
+index 23e7af9..049b35b 100644
+--- sw/inc/cellatr.hxx
++++ sw/inc/cellatr.hxx
+@@ -56,13 +56,13 @@ public:
+ void SetAutoFlag( BOOL bFlag = TRUE ) { bAuto = bFlag; }
+ };
+
+-class SwTblBoxFormula : public SfxPoolItem, public SwTableFormula
++class SW_DLLPUBLIC SwTblBoxFormula : public SfxPoolItem, public SwTableFormula
+ {
+ SwModify* pDefinedIn; // Modify-Object, in dem die Formel steht
+ // kann nur TablenBoxFormat sein
+
+ public:
+- SwTblBoxFormula( const String& rFormula );
++ SwTblBoxFormula( const String& rFormula, bool bWwFormula = false );
+
+ // "pure virtual Methoden" vom SfxPoolItem
+ virtual int operator==( const SfxPoolItem& ) const;
+diff --git sw/inc/cellfml.hxx sw/inc/cellfml.hxx
+index b7a3256..4653ca5 100644
+--- sw/inc/cellfml.hxx
++++ sw/inc/cellfml.hxx
+@@ -28,6 +28,7 @@
+ #ifndef _CELLFML_HXX
+ #define _CELLFML_HXX
+
++#include "swdllapi.h"
+ #include <tools/string.hxx>
+
+ class SwTable;
+@@ -62,7 +63,7 @@ public:
+
+
+
+-class SwTableFormula
++class SW_DLLPUBLIC SwTableFormula
+ {
+ typedef void (SwTableFormula:: *FnScanFormel)( const SwTable&, String&,
+ String&, String*, void* ) const;
+@@ -92,11 +93,14 @@ typedef void (SwTableFormula:: *FnScanFormel)( const SwTable&, String&,
+ void* = 0 ) const;
+
+ const SwTable* FindTable( SwDoc& rDoc, const String& rNm ) const;
++
++ bool bWwFormula;
++ String sInputFormula;
++ String sSwFormula; // Internal formula
+
+ protected:
+ enum NameType { EXTRNL_NAME, INTRNL_NAME, REL_NAME };
+
+- String sFormel; // akt. Formel
+ NameType eNmType; // akt. Darstellungs Art
+ BOOL bValidValue; // TRUE: Formel neu berechnen
+
+@@ -106,7 +110,7 @@ protected:
+ // !!! MUSS VON JEDER ABLEITUNG UEBERLADEN WERDEN !!!
+ virtual const SwNode* GetNodeOfFormula() const = 0;
+
+- SwTableFormula( const String& rFormel );
++ SwTableFormula( const String& rFormel, bool bWwFml = false );
+
+ String MakeFormel( SwTblCalcPara& rCalcPara ) const
+ {
+@@ -122,9 +126,10 @@ public:
+ virtual ~SwTableFormula();
+ SwTableFormula& operator=( const SwTableFormula& rCpy )
+ {
+- sFormel = rCpy.sFormel;
++ SetFormula( rCpy.GetFormula() );
+ eNmType = rCpy.eNmType;
+ bValidValue = rCpy.bValidValue;
++ bWwFormula = rCpy.bWwFormula;
+ return *this;
+ }
+
+@@ -143,16 +148,13 @@ public:
+ NameType GetNameType() const { return eNmType; }
+
+ // erfrage/setze das Flag, ob der akt. Wert gueltig ist
+- BOOL IsValid() const { return bValidValue; }
+- inline void ChgValid( BOOL bNew ) { bValidValue = bNew; }
++ BOOL IsValid() const { return bValidValue; }
++ inline void ChgValid( BOOL bNew ) { bValidValue = bNew; }
+
+- const String& GetFormula() const { return sFormel; }
+- void SetFormula( const String& rNew )
+- {
+- sFormel = rNew;
+- bValidValue = FALSE;
+- eNmType = EXTRNL_NAME;
+- }
++ const String& GetFormula() const { return sInputFormula; }
++ void SetFormula( const String& rNew );
++
++ bool IsWWFormula( ) const { return bWwFormula; }
+
+ USHORT GetBoxesOfFormula( const SwTable& rTbl, SwSelBoxes& rBoxes );
+ // sind alle Boxen gueltig, auf die sich die Formel bezieht?
+diff --git sw/inc/unotbl.hxx sw/inc/unotbl.hxx
+index 3d4c4ec..3e98bfa 100644
+--- sw/inc/unotbl.hxx
++++ sw/inc/unotbl.hxx
+@@ -33,6 +33,7 @@
+ #include <com/sun/star/chart2/data/XLabeledDataSequence.hpp>
+ #include <com/sun/star/text/XTextTableCursor.hpp>
+ #include <com/sun/star/text/XTextTable.hpp>
++#include <com/sun/star/text/XCell2.hpp>
+ #include <com/sun/star/table/XCellRange.hpp>
+ #include <com/sun/star/sheet/XCellRangeData.hpp>
+ #include <com/sun/star/table/XAutoFormattable.hpp>
+@@ -65,7 +66,7 @@ class SwChartEventListenerContainer : public SwEventListenerContainer
+ typedef
+ cppu::WeakImplHelper4
+ <
+- ::com::sun::star::table::XCell,
++ ::com::sun::star::text::XCell2,
+ ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::beans::XPropertySet,
+ ::com::sun::star::container::XEnumerationAccess
+@@ -125,7 +126,10 @@ public:
+ virtual void SAL_CALL setValue( double nValue ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::table::CellContentType SAL_CALL getType( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getError( ) throw(::com::sun::star::uno::RuntimeException);
+-
++
++ //XCell2
++ virtual sal_Bool SAL_CALL isWWFormula( ) throw(::com::sun::star::uno::RuntimeException);
++
+ //XText
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > SAL_CALL createTextCursor(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > SAL_CALL createTextCursorByRange(const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > & aTextPosition) throw( ::com::sun::star::uno::RuntimeException );
+diff --git sw/prj/build.lst sw/prj/build.lst
+index 758bf51..202e750 100644
+--- sw/prj/build.lst
++++ sw/prj/build.lst
+@@ -1,4 +1,4 @@
+-sw sw : l10n connectivity OOo:writerperfect OOo:lotuswordpro svx stoc uui writerfilter vbahelper NULL
++sw sw : l10n connectivity OOo:writerperfect OOo:lotuswordpro svx stoc uui writerfilter vbahelper ixion NULL
+ sw sw usr1 - all sw_mkout NULL
+ sw sw\inc nmake - all sw_inc NULL
+ sw sw\uiconfig\layout nmake - all sw_layout NULL
+diff --git sw/source/core/attr/cellatr.cxx sw/source/core/attr/cellatr.cxx
+index 5eb3231..76f0bb9 100644
+--- sw/source/core/attr/cellatr.cxx
++++ sw/source/core/attr/cellatr.cxx
+@@ -76,9 +76,9 @@ SfxPoolItem* SwTblBoxNumFormat::Clone( SfxItemPool* ) const
+
+
+
+-SwTblBoxFormula::SwTblBoxFormula( const String& rFormula )
++SwTblBoxFormula::SwTblBoxFormula( const String& rFormula, bool bWwFml )
+ : SfxPoolItem( RES_BOXATR_FORMULA ),
+- SwTableFormula( rFormula ),
++ SwTableFormula( rFormula, bWwFml ),
+ pDefinedIn( 0 )
+ {
+ }
+@@ -95,7 +95,7 @@ int SwTblBoxFormula::operator==( const SfxPoolItem& rAttr ) const
+ SfxPoolItem* SwTblBoxFormula::Clone( SfxItemPool* ) const
+ {
+ // auf externe Darstellung umschalten!!
+- SwTblBoxFormula* pNew = new SwTblBoxFormula( GetFormula() );
++ SwTblBoxFormula* pNew = new SwTblBoxFormula( GetFormula(), IsWWFormula() );
+ pNew->SwTableFormula::operator=( *this );
+ return pNew;
+ }
+diff --git sw/source/core/fields/cellfml.cxx sw/source/core/fields/cellfml.cxx
+index 37ea6a5..c7a5576 100644
+--- sw/source/core/fields/cellfml.cxx
++++ sw/source/core/fields/cellfml.cxx
+@@ -51,6 +51,14 @@
+ #include <cellatr.hxx>
+ #include <ndindex.hxx>
+
++#include <sstream>
++#include <string>
++
++#include <ixion/cell.hpp>
++#include <ixion/formula_functions.hpp>
++#include <ixion/formula_lexer.hpp>
++#include <ixion/formula_parser.hpp>
++
+ const sal_Unicode cRelTrenner = ',';
+ const sal_Unicode cRelKennung = ''; // CTRL-R
+
+@@ -306,11 +314,10 @@ BOOL SwTblCalcPara::CalcWithStackOverflow()
+
+ /* */
+
+-SwTableFormula::SwTableFormula( const String& rFormel )
+- : sFormel( rFormel )
++SwTableFormula::SwTableFormula( const String& rFormel, bool bWwFml )
++ : bWwFormula( bWwFml )
+ {
+- eNmType = EXTRNL_NAME;
+- bValidValue = FALSE;
++ SetFormula( rFormel );
+ }
+
+ SwTableFormula::~SwTableFormula()
+@@ -554,7 +561,7 @@ void SwTableFormula::PtrToBoxNm( const SwTable* pTbl )
+ case EXTRNL_NAME:
+ return;
+ }
+- sFormel = ScanString( fnFormel, *pTbl, (void*)pNd );
++ sSwFormula = ScanString( fnFormel, *pTbl, (void*)pNd );
+ eNmType = EXTRNL_NAME;
+ }
+
+@@ -579,7 +586,7 @@ void SwTableFormula::BoxNmToPtr( const SwTable* pTbl )
+ case INTRNL_NAME:
+ return;
+ }
+- sFormel = ScanString( fnFormel, *pTbl, (void*)pNd );
++ sSwFormula = ScanString( fnFormel, *pTbl, (void*)pNd );
+ eNmType = INTRNL_NAME;
+ }
+
+@@ -601,11 +608,138 @@ void SwTableFormula::ToRelBoxNm( const SwTable* pTbl )
+ case REL_NAME:
+ return;
+ }
+- sFormel = ScanString( fnFormel, *pTbl, (void*)pNd );
++ sSwFormula = ScanString( fnFormel, *pTbl, (void*)pNd );
+ eNmType = REL_NAME;
+ }
+
+
++class token_converter : public std::unary_function<ixion::formula_token_base, void>
++{
++public:
++ token_converter(std::ostringstream& os) : m_os(os), m_in_and_or(false) {}
++
++ void operator() (const ixion::formula_token_base& token)
++ {
++ switch (token.get_opcode())
++ {
++ case ixion::fop_unresolved_ref:
++ // Add <> around the name
++ m_os << "<" << token.get_name() << ">";
++ break;
++ case ixion::fop_sep:
++ if ( m_in_and_or )
++ {
++ m_os << m_pending_func_name;
++ m_in_and_or = false;
++ m_pending_func_name = std::string();
++ }
++ else
++ m_os << "|";
++ break;
++ case ixion::fop_function:
++ {
++ ixion::formula_function_t func_oc = ixion::formula_functions::get_function_opcode(token);
++ std::string func_name( ixion::formula_functions::get_function_name(func_oc) );
++
++ m_in_and_or = false;
++
++ if ( func_name.compare( "AVERAGE" ) == 0 )
++ {
++ m_os << "MEAN";
++ }
++ else if ( ( func_name.compare( "AND" ) == 0 ) ||
++ ( func_name.compare( "OR" ) == 0 ) )
++ {
++ // AND(x, y) -> x AND y
++ // OR(x, y) -> x OR y
++ m_in_and_or = true;
++ m_pending_func_name = func_name;
++ }
++ else
++ {
++ m_os << func_name;
++ }
++ }
++ break;
++ case ixion::fop_value:
++ m_os << token.get_value();
++ break;
++ case ixion::fop_plus:
++ m_os << "+";
++ break;
++ case ixion::fop_minus:
++ m_os << "-";
++ break;
++ case ixion::fop_multiply:
++ m_os << "*";
++ break;
++ case ixion::fop_divide:
++ m_os << "/";
++ break;
++ case ixion::fop_open:
++ m_os << "(";
++ break;
++ case ixion::fop_close:
++ m_os << ")";
++ break;
++ default:
++ ;
++ }
++ }
++
++private:
++ std::ostringstream& m_os;
++
++ bool m_in_and_or;
++ std::string m_pending_func_name;
++};
++
++String lcl_ConvertWWFormula( const String& rWWFormula )
++{
++ ixion::mem_str_buf sFormulaBuf;
++ ByteString sAsciiFormula( rWWFormula, RTL_TEXTENCODING_UTF8 );
++ sFormulaBuf.set_start( sAsciiFormula.ToUpperAscii().GetBufferAccess() );
++ for ( int i = 0; i < rWWFormula.Len() - 1; i++ )
++ sFormulaBuf.inc();
++
++ ixion::lexer_tokens_t ltokens;
++
++ // Run the lexer
++ ixion::formula_lexer lexer( sFormulaBuf );
++ lexer.tokenize( );
++ lexer.swap_tokens( ltokens );
++
++ // Run the parser
++ ixion::cell_name_ptr_map_t cell_names;
++
++ ixion::formula_parser parser( ltokens, &cell_names, true );
++ parser.parse();
++
++ ixion::formula_tokens_t ftokens;
++ ftokens.swap( parser.get_tokens() );
++
++ // Convert the tokens to Writer formula string
++ std::ostringstream os;
++ for_each( ftokens.begin(), ftokens.end(), token_converter(os) );
++
++ return String::CreateFromAscii( os.str().c_str() );
++}
++
++void SwTableFormula::SetFormula( const String& rNew )
++{
++ sInputFormula = rNew;
++ sSwFormula = rNew;
++
++ bValidValue = FALSE;
++ eNmType = EXTRNL_NAME;
++
++ if ( bWwFormula )
++ {
++ // Convert the sInputFormula into a Sw formula and store it in sSwFormula
++ sSwFormula = lcl_ConvertWWFormula( sInputFormula );
++ }
++}
++
+ String SwTableFormula::ScanString( FnScanFormel fnFormel, const SwTable& rTbl,
+ void* pPara ) const
+ {
+@@ -617,24 +751,24 @@ String SwTableFormula::ScanString( FnScanFormel fnFormel, const SwTable& rTbl,
+ // benutzen !!
+ const SwTable* pTbl = &rTbl;
+
+- nStt = sFormel.Search( '<', nFml );
++ nStt = sSwFormula.Search( '<', nFml );
+ if( STRING_NOTFOUND != nStt )
+ {
+ while( STRING_NOTFOUND != nStt &&
+- ( ' ' == sFormel.GetChar( nStt + 1 ) ||
+- '=' == sFormel.GetChar( nStt + 1 ) ) )
+- nStt = sFormel.Search( '<', nStt + 1 );
++ ( ' ' == sSwFormula.GetChar( nStt + 1 ) ||
++ '=' == sSwFormula.GetChar( nStt + 1 ) ) )
++ nStt = sSwFormula.Search( '<', nStt + 1 );
+
+ if( STRING_NOTFOUND != nStt )
+- nEnd = sFormel.Search( '>', nStt+1 );
++ nEnd = sSwFormula.Search( '>', nStt+1 );
+ }
+ if( STRING_NOTFOUND == nStt || STRING_NOTFOUND == nEnd )
+ {
+ // den Rest setzen und beenden
+- aStr.Insert( sFormel, nFml, sFormel.Len() - nFml );
++ aStr.Insert( sSwFormula, nFml, sSwFormula.Len() - nFml );
+ break;
+ }
+- aStr.Insert( sFormel, nFml, nStt - nFml ); // Anfang schreiben
++ aStr.Insert( sSwFormula, nFml, nStt - nFml ); // Anfang schreiben
+
+ if( fnFormel != NULL )
+ {
+@@ -643,11 +777,11 @@ String SwTableFormula::ScanString( FnScanFormel fnFormel, const SwTable& rTbl,
+ // JP 22.02.99: der CAST muss fuer den Linux-Compiler sein
+ // JP 28.06.99: rel. BoxName have no preceding tablename!
+ if( fnFormel != (FnScanFormel)&SwTableFormula::_SplitMergeBoxNm &&
+- 1 < sFormel.Len() && cRelKennung != sFormel.GetChar( 1 ) &&
+- STRING_NOTFOUND != ( nTrenner = sFormel.Search( '.', nStt ))
++ 1 < sSwFormula.Len() && cRelKennung != sSwFormula.GetChar( 1 ) &&
++ STRING_NOTFOUND != ( nTrenner = sSwFormula.Search( '.', nStt ))
+ && nTrenner < nEnd )
+ {
+- String sTblNm( sFormel.Copy( nStt, nEnd - nStt ));
++ String sTblNm( sSwFormula.Copy( nStt, nEnd - nStt ));
+
+ // falls im Namen schon die Punkte enthalten sind,
+ // treten diese immer paarig auf!!! (A1.1.1 !!)
+@@ -676,13 +810,13 @@ String SwTableFormula::ScanString( FnScanFormel fnFormel, const SwTable& rTbl,
+ }
+ }
+
+- String sBox( sFormel.Copy( nStt, nEnd - nStt + 1 ));
++ String sBox( sSwFormula.Copy( nStt, nEnd - nStt + 1 ));
+ // ein Bereich in dieser Klammer ?
+- if( STRING_NOTFOUND != ( nTrenner = sFormel.Search( ':', nStt ))
++ if( STRING_NOTFOUND != ( nTrenner = sSwFormula.Search( ':', nStt ))
+ && nTrenner < nEnd )
+ {
+ // ohne die Anfangsklammer
+- String aFirstBox( sFormel.Copy( nStt+1, nTrenner - nStt - 1 ));
++ String aFirstBox( sSwFormula.Copy( nStt+1, nTrenner - nStt - 1 ));
+ (this->*fnFormel)( *pTbl, aStr, sBox, &aFirstBox, pPara );
+ }
+ else
+@@ -691,6 +825,7 @@ String SwTableFormula::ScanString( FnScanFormel fnFormel, const SwTable& rTbl,
+
+ nFml = nEnd+1;
+ } while( TRUE );
++
+ return aStr;
+ }
+
+@@ -1224,7 +1359,7 @@ void SwTableFormula::ToSplitMergeBoxNm( SwTableFmlUpdate& rTblUpd )
+ else
+ pTbl = rTblUpd.pTbl;
+
+- sFormel = ScanString( &SwTableFormula::_SplitMergeBoxNm, *pTbl, (void*)&rTblUpd );
++ sSwFormula = ScanString( &SwTableFormula::_SplitMergeBoxNm, *pTbl, (void*)&rTblUpd );
+ eNmType = INTRNL_NAME;
+ }
+
+diff --git sw/source/core/fields/makefile.mk sw/source/core/fields/makefile.mk
+index 47d7dc4..4cd3db1 100644
+--- sw/source/core/fields/makefile.mk
++++ sw/source/core/fields/makefile.mk
+@@ -86,7 +86,8 @@ SLOFILES = \
+ EXCEPTIONSFILES = \
+ $(SLO)$/flddropdown.obj \
+ $(SLO)$/postithelper.obj \
+- $(SLO)$/docufld.obj
++ $(SLO)$/docufld.obj \
++ $(SLO)$/cellfml.obj
+
+ # --- Tagets -------------------------------------------------------
+
+diff --git sw/source/core/unocore/unotbl.cxx sw/source/core/unocore/unotbl.cxx
+index 3d6d104..d4b2cee 100644
+--- sw/source/core/unocore/unotbl.cxx
++++ sw/source/core/unocore/unotbl.cxx
+@@ -1022,6 +1022,19 @@ sal_Int32 SwXCell::getError(void) throw( uno::RuntimeException )
+ OUString sContent = getString();
+ return sContent.equals(ViewShell::GetShellRes()->aCalc_Error);
+ }
++
++sal_Bool SwXCell::isWWFormula( ) throw( uno::RuntimeException )
++{
++ vos::OGuard aGuard(Application::GetSolarMutex());
++ sal_Bool sRet = sal_False;
++ if(IsValid())
++ {
++ SwTblBoxFormula aFormula( pBox->GetFrmFmt()->GetTblBoxFormula() );
++ sRet = aFormula.IsWWFormula( );
++ }
++ return sRet;
++}
++
+ /*-- 11.12.98 10:56:28---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+diff --git sw/source/filter/ww8/wrtw8nds.cxx sw/source/filter/ww8/wrtw8nds.cxx
+index 886cdce..33d0b51 100644
+--- sw/source/filter/ww8/wrtw8nds.cxx
++++ sw/source/filter/ww8/wrtw8nds.cxx
+@@ -99,6 +99,7 @@
+ #include "ww8par.hxx"
+ #include <IMark.hxx>
+ #include "ww8attributeoutput.hxx"
++#include "cellatr.hxx"
+
+ #include <ndgrf.hxx>
+ #include <ndole.hxx>
+@@ -1690,6 +1691,22 @@ void MSWordExportBase::OutputTextNode( const SwTxtNode& rNode )
+ bool bTxtAtr = aAttrIter.IsTxtAttr( nAktPos );
+ nOpenAttrWithRange += aAttrIter.OutAttrWithRange(nAktPos);
+
++ bool bOutTableFormula = false;
++
++ // Check if a formula is defined on the cell
++ if ( pTextNodeInfo.get() != NULL )
++ {
++ const SwTableBox* pBox = pTextNodeInfo.get()->getTableBox( );
++ const SwTblBoxFormula& rFml = pBox->GetFrmFmt()->GetTblBoxFormula();
++ bOutTableFormula = ( rFml.GetFormula().Len( ) > 0 );
++ if ( bOutTableFormula )
++ {
++ String sFormula = String::CreateFromAscii( "=" ).Append( rFml.GetFormula( ) );
++ OutputField( NULL, ww::eEquals, sFormula, WRITEFIELD_START | WRITEFIELD_CMD_START );
++ OutputField( NULL, ww::eEquals, String(), WRITEFIELD_CMD_END );
++ }
++ }
++
+ xub_StrLen nLen = nNextAttr - nAktPos;
+ if ( !bTxtAtr && nLen )
+ {
+@@ -1778,6 +1795,9 @@ void MSWordExportBase::OutputTextNode( const SwTxtNode& rNode )
+ }
+ AttrOutput().RunText( aSnippet, eChrSet );
+ }
++
++ if ( bOutTableFormula )
++ OutputField( NULL, ww::eEquals, String(), WRITEFIELD_CLOSE );
+
+ if ( aAttrIter.IsDropCap( nNextAttr ) )
+ AttrOutput().FormatDrop( rNode, aAttrIter.GetSwFmtDrop(), nStyle, pTextNodeInfo, pTextNodeInfoInner );
+diff --git sw/source/filter/ww8/ww8par.hxx sw/source/filter/ww8/ww8par.hxx
+index cb96374..75bf4e0 100644
+--- sw/source/filter/ww8/ww8par.hxx
++++ sw/source/filter/ww8/ww8par.hxx
+@@ -1552,6 +1552,7 @@ public: // eigentlich private, geht aber leider nur public
+ eF_ResT Read_F_FileName( WW8FieldDesc*, String& rStr);
+ eF_ResT Read_F_Anz( WW8FieldDesc* pF, String& );
+ eF_ResT Read_F_CurPage( WW8FieldDesc*, String& );
++ eF_ResT Read_F_Formula( WW8FieldDesc*, String& );
+ eF_ResT Read_F_Ref( WW8FieldDesc* pF, String& );
+
+ eF_ResT Read_F_Set( WW8FieldDesc*, String& rStr );
+diff --git sw/source/filter/ww8/ww8par2.cxx sw/source/filter/ww8/ww8par2.cxx
+index 716a36f..2ad4a42 100644
+--- sw/source/filter/ww8/ww8par2.cxx
++++ sw/source/filter/ww8/ww8par2.cxx
+@@ -66,6 +66,7 @@
+ #include <fltshell.hxx> // fuer den Attribut Stack
+ #include <fmtanchr.hxx>
+ #include <fmtrowsplt.hxx>
++#include <cellatr.hxx>
+ // --> OD 2005-01-27 #i33818#
+ #include <fmtfollowtextflow.hxx>
+ // <--
+@@ -80,6 +81,10 @@
+
+ #include <iostream>
+
++#if DEBUG
++#include <cstdio>
++#endif
++
+ #define MAX_COL 64 // WW6-Beschreibung: 32, WW6-UI: 31 & WW8-UI: 63!
+
+ using namespace ::com::sun::star;
+@@ -270,6 +275,8 @@ public:
+ const String& GetNumRuleName() const;
+ void SetNumRuleName( const String& rName );
+
++ void SetCellFormula( SwDoc& rDoc, String& rName, String& rFormat );
++
+ sw::util::RedlineStack* getOldRedlineStack(){ return mpOldRedlineStack; }
+ };
+
+@@ -3460,6 +3467,59 @@ void WW8TabDesc::SetNumRuleName( const String& rName )
+ aNumRuleNames[nCol] = rName;
+ }
+
++void WW8TabDesc::SetCellFormula( SwDoc& rDoc, String& rFml, String& rFormat )
++{
++ SfxItemSet aBoxSet( rDoc.GetAttrPool(), RES_BOXATR_FORMAT, RES_BOXATR_FORMULA );
++
++ if( rFml.EraseLeadingChars().Len() &&
++ '=' == rFml.GetChar( 0 ) )
++ rFml.Erase( 0, 1 );
++ aBoxSet.Put( SwTblBoxFormula( rFml, true ) );
++
++ if ( rFormat.Len() > 0 )
++ {
++ SvNumberFormatter* pFormatter = rDoc.GetNumberFormatter();
++ sal_uInt32 nKey = pFormatter->GetEntryKey( rFormat );
++ aBoxSet.Put( SwTblBoxNumFormat( nKey ) );
++ }
++
++ rDoc.SetTblBoxFormulaAttrs( *pTabBox, aBoxSet );
++}
++
++eF_ResT SwWW8ImplReader::Read_F_Formula( WW8FieldDesc*, String& rStr )
++{
++ // Look for the first switch
++ xub_StrLen nPos = rStr.Search( '\\' );
++ String sFml = rStr.Copy( 0, nPos );
++ String sSwitches = rStr.Copy( nPos );
++
++ // Numeric formatting
++ String sFormat;
++ xub_StrLen nNumSwitchPos = sSwitches.SearchAscii( "\\#", 0 );
++ if ( nNumSwitchPos != STRING_NOTFOUND )
++ {
++ xub_StrLen nStart = nNumSwitchPos + 1;
++ xub_StrLen nEnd = sSwitches.Len() - 1;
++
++ xub_StrLen nQuotePos = sSwitches.SearchAscii( "\"", nNumSwitchPos );
++ if ( nQuotePos != STRING_NOTFOUND )
++ {
++ nStart = nQuotePos + 1;
++ nEnd = sSwitches.SearchAscii( "\"", nStart + 1 );
++ }
++
++ sFormat = sSwitches.Copy( nStart, nEnd - nStart ).EraseAllChars();
++#if DEBUG
++ fprintf( stderr, "TODO SwWW8ImplReader::Read_F_Formula() - Numeric format: %s\n",
++ ByteString( sFormat, RTL_TEXTENCODING_UTF8 ).GetBufferAccess() );
++#endif
++ }
++
++ pTableDesc->SetCellFormula( GetDoc(), sFml, sFormat );
++
++ return FLD_OK;
++}
++
+ bool SwWW8ImplReader::StartTable(WW8_CP nStartCp)
+ {
+ // Entering a table so make sure the the FirstPara flag gets set
+diff --git sw/source/filter/ww8/ww8par5.cxx sw/source/filter/ww8/ww8par5.cxx
+index f22d1b5..96a82ba 100644
+--- sw/source/filter/ww8/ww8par5.cxx
++++ sw/source/filter/ww8/ww8par5.cxx
+@@ -933,7 +933,7 @@ long SwWW8ImplReader::Read_Field(WW8PLCFManResult* pRes)
+ &SwWW8ImplReader::Read_F_DateTime, // 31
+ &SwWW8ImplReader::Read_F_DateTime, // 32
+ &SwWW8ImplReader::Read_F_CurPage, // 33
+- 0,
++ &SwWW8ImplReader::Read_F_Formula, // 34
+ 0,
+ &SwWW8ImplReader::Read_F_IncludeText, // 36
+ &SwWW8ImplReader::Read_F_PgRef, // 37
+diff --git sw/source/filter/xml/xmltble.cxx sw/source/filter/xml/xmltble.cxx
+index 215b11e..9775056 100644
+--- sw/source/filter/xml/xmltble.cxx
++++ sw/source/filter/xml/xmltble.cxx
+@@ -64,7 +64,6 @@
+ #include "xmltexte.hxx"
+ #include "xmlexp.hxx"
+
+-
+ using ::rtl::OUString;
+ using ::rtl::OUStringBuffer;
+ using namespace ::com::sun::star;
+@@ -74,7 +73,7 @@ using namespace ::com::sun::star::beans;
+ using namespace ::com::sun::star::lang;
+ using namespace ::com::sun::star::container;
+ using namespace ::xmloff::token;
+-using table::XCell;
++using text::XCell2;
+
+
+ class SwXMLTableColumn_Impl : public SwWriteTableCol
+@@ -710,7 +709,7 @@ void SwXMLExport::ExportTableLinesAutoStyles( const SwTableLines& rLines,
+ bTop) )
+ ExportFmt( *pFrmFmt2, XML_TABLE_CELL );
+
+- Reference < XCell > xCell = SwXCell::CreateXCell(
++ Reference < XCell2 > xCell = SwXCell::CreateXCell(
+ (SwFrmFmt *)rTblInfo.GetTblFmt(),
+ pBox,
+ (SwTable *)rTblInfo.GetTable() );
+@@ -838,7 +837,7 @@ void SwXMLExport::ExportTableBox( const SwTableBox& rBox,
+ // start node -> normal cell
+
+ // get cell range for table
+- Reference<XCell> xCell = SwXCell::CreateXCell( (SwFrmFmt *)rTblInfo.GetTblFmt(),
++ Reference<XCell2> xCell = SwXCell::CreateXCell( (SwFrmFmt *)rTblInfo.GetTblFmt(),
+ (SwTableBox *)&rBox,
+ (SwTable *)rTblInfo.GetTable() );
+
+@@ -853,9 +852,13 @@ void SwXMLExport::ExportTableBox( const SwTableBox& rBox,
+ // (with value and number format)
+ if (sCellFormula.getLength()>0)
+ {
++ sal_uInt16 nPrefix = XML_NAMESPACE_OOOW;
++ if ( xCell->isWWFormula() )
++ nPrefix = XML_NAMESPACE_FIELD;
++
+ OUString sQValue =
+ GetNamespaceMap().GetQNameByKey(
+- XML_NAMESPACE_OOOW, sCellFormula, sal_False );
++ nPrefix, sCellFormula, sal_False );
+ // formula
+ AddAttribute(XML_NAMESPACE_TABLE, XML_FORMULA, sQValue );
+ }
+diff --git sw/source/filter/xml/xmltbli.cxx sw/source/filter/xml/xmltbli.cxx
+index f172557..1449c89 100644
+--- sw/source/filter/xml/xmltbli.cxx
++++ sw/source/filter/xml/xmltbli.cxx
+@@ -186,6 +186,7 @@ class SwXMLTableCell_Impl
+ sal_Bool bHasValue; // determines whether dValue attribute is valid
+ sal_Bool mbCovered;
+ sal_Bool mbTextValue;
++ sal_Bool mbWWFormula;
+
+ public:
+
+@@ -194,7 +195,8 @@ public:
+ nRowSpan( nRSpan ),
+ nColSpan( nCSpan ),
+ bProtected( sal_False ),
+- mbCovered( sal_False )
++ mbCovered( sal_False ),
++ mbWWFormula( sal_False )
+ {}
+
+ inline void Set( const OUString& rStyleName,
+@@ -206,7 +208,8 @@ public:
+ sal_Bool mbCovered = sal_False,
+ double dVal = 0.0,
+ sal_Bool mbTextValue = sal_False,
+- OUString const& i_rXmlId = OUString());
++ OUString const& i_rXmlId = OUString(),
++ sal_Bool bWWFormula = sal_False );
+
+ sal_Bool IsUsed() const { return pStartNode!=0 ||
+ xSubTable.Is() || bProtected;}
+@@ -222,6 +225,7 @@ public:
+ sal_Bool IsCovered() const { return mbCovered; }
+ sal_Bool HasTextValue() const { return mbTextValue; }
+ const OUString& GetXmlId() const { return mXmlId; }
++ sal_Bool IsWWFormula() const { return mbWWFormula; }
+
+ const SwStartNode *GetStartNode() const { return pStartNode; }
+ inline void SetStartNode( const SwStartNode *pSttNd );
+@@ -241,7 +245,8 @@ inline void SwXMLTableCell_Impl::Set( const OUString& rStyleName,
+ sal_Bool bCov,
+ double dVal,
+ sal_Bool bTextVal,
+- OUString const& i_rXmlId )
++ OUString const& i_rXmlId,
++ sal_Bool bWWFormula )
+ {
+ aStyleName = rStyleName;
+ nRowSpan = nRSpan;
+@@ -253,6 +258,7 @@ inline void SwXMLTableCell_Impl::Set( const OUString& rStyleName,
+ mbCovered = bCov;
+ mbTextValue = bTextVal;
+ bProtected = bProtect;
++ mbWWFormula = bWWFormula;
+
+ if (!mbCovered) // ensure uniqueness
+ {
+@@ -398,6 +404,7 @@ class SwXMLTableCellContext_Impl : public SvXMLImportContext
+ {
+ OUString aStyleName;
+ OUString sFormula;
++ sal_Bool bWWFormula;
+ OUString sSaveParaDefault;
+ OUString mXmlId;
+
+@@ -446,6 +453,7 @@ SwXMLTableCellContext_Impl::SwXMLTableCellContext_Impl(
+ SwXMLTableContext *pTable ) :
+ SvXMLImportContext( rImport, nPrfx, rLName ),
+ sFormula(),
++ bWWFormula( sal_False ),
+ xMyTable( pTable ),
+ fValue( 0.0 ),
+ bHasValue( sal_False ),
+@@ -499,7 +507,12 @@ SwXMLTableCellContext_Impl::SwXMLTableCellContext_Impl(
+ OUString sTmp;
+ sal_uInt16 nPrefix2 = GetImport().GetNamespaceMap().
+ _GetKeyByAttrName( rValue, &sTmp, sal_False );
+- sFormula = XML_NAMESPACE_OOOW == nPrefix2 ? sTmp : rValue;
++ bWWFormula = ( nPrefix2 == XML_NAMESPACE_FIELD );
++ if ( ( XML_NAMESPACE_OOOW == nPrefix2 ) ||
++ ( XML_NAMESPACE_FIELD == nPrefix2 ) )
++ sFormula = sTmp;
++ else
++ sFormula = rValue;
+ }
+ break;
+ case XML_TOK_TABLE_VALUE:
+@@ -570,7 +583,7 @@ inline void SwXMLTableCellContext_Impl::_InsertContent()
+ GetTable()->InsertCell( aStyleName, nRowSpan, nColSpan,
+ GetTable()->InsertTableSection(),
+ mXmlId,
+- NULL, bProtect, &sFormula, bHasValue, fValue, bHasTextValue );
++ NULL, bProtect, &sFormula, bHasValue, fValue, bHasTextValue, bWWFormula );
+ }
+
+ inline void SwXMLTableCellContext_Impl::InsertContent()
+@@ -1590,7 +1603,8 @@ void SwXMLTableContext::InsertCell( const OUString& rStyleName,
+ const OUString* pFormula,
+ sal_Bool bHasValue,
+ double fValue,
+- sal_Bool bTextValue )
++ sal_Bool bTextValue,
++ sal_Bool bWWFormula )
+ {
+ ASSERT( nCurCol < GetColumnCount(),
+ "SwXMLTableContext::InsertCell: row is full" );
+@@ -1686,7 +1700,7 @@ void SwXMLTableContext::InsertCell( const OUString& rStyleName,
+ GetCell( nRowsReq-j, nColsReq-i )
+ ->Set( sStyleName, j, i, pStartNode,
+ pTable, bProtect, pFormula, bHasValue, bCovered, fValue,
+- bTextValue, i_rXmlId );
++ bTextValue, i_rXmlId, bWWFormula );
+ }
+ }
+
+@@ -1756,7 +1770,8 @@ void SwXMLTableContext::InsertRepRows( sal_uInt32 nCount )
+ 0, pSrcCell->IsProtected(),
+ &pSrcCell->GetFormula(),
+ pSrcCell->HasValue(), pSrcCell->GetValue(),
+- pSrcCell->HasTextValue() );
++ pSrcCell->HasTextValue(),
++ pSrcCell->IsWWFormula() );
+ }
+ }
+ FinishRow();
+@@ -2156,7 +2171,7 @@ SwTableBox *SwXMLTableContext::MakeTableBox(
+ if (rFormula.getLength() > 0)
+ {
+ // formula cell: insert formula if valid
+- SwTblBoxFormula aFormulaItem( rFormula );
++ SwTblBoxFormula aFormulaItem( rFormula, pCell->IsWWFormula() );
+ pBoxFmt2->SetFmtAttr( aFormulaItem );
+ }
+ else if( !pCell->HasValue() && pCell->HasTextValue() )
+diff --git sw/source/filter/xml/xmltbli.hxx sw/source/filter/xml/xmltbli.hxx
+index 70fb39a..829389e 100644
+--- sw/source/filter/xml/xmltbli.hxx
++++ sw/source/filter/xml/xmltbli.hxx
+@@ -184,7 +184,8 @@ public:
+ const ::rtl::OUString *pFormula=0,
+ sal_Bool bHasValue = sal_False,
+ double fValue = 0.0,
+- sal_Bool bTextValue = sal_False );
++ sal_Bool bTextValue = sal_False,
++ sal_Bool bWWFormula = sal_False );
+ void InsertRow( const ::rtl::OUString& rStyleName,
+ const ::rtl::OUString& rDfltCellStyleName,
+ sal_Bool bInHead,
+diff --git sw/source/ui/shells/textsh1.cxx sw/source/ui/shells/textsh1.cxx
+index 7801822..1d2fe1b 100644
+--- sw/source/ui/shells/textsh1.cxx
++++ sw/source/ui/shells/textsh1.cxx
+@@ -746,8 +746,15 @@ void SwTextShell::Execute(SfxRequest &rReq)
+ {
+ if( rWrtSh.IsCrsrInTbl() )
+ {
++ // Get the formula item or the default one
+ SfxItemSet aSet( rWrtSh.GetAttrPool(), RES_BOXATR_FORMULA, RES_BOXATR_FORMULA );
+- aSet.Put( SwTblBoxFormula( sFormula ));
++ rWrtSh.GetTblBoxFormulaAttrs( aSet );
++ SwTblBoxFormula& aTblBoxFormula = (SwTblBoxFormula&)aSet.Get( RES_BOXATR_FORMULA );
++ aTblBoxFormula.SetFormula( sFormula );
++
++ if ( aSet.GetItemState( RES_BOXATR_FORMULA ) == SFX_ITEM_DEFAULT )
++ aSet.Put( aTblBoxFormula );
++
+ rWrtSh.SetTblBoxFormulaAttrs( aSet );
+ rWrtSh.UpdateTable();
+ }
+diff --git sw/util/makefile.mk sw/util/makefile.mk
+index f7da0f1..09cc6ea 100644
+--- sw/util/makefile.mk
++++ sw/util/makefile.mk
+@@ -123,7 +123,10 @@ SHL1STDLIBS+= \
+ $(SALHELPERLIB) \
+ $(ICUUCLIB) \
+ $(I18NUTILLIB) \
+- $(AVMEDIALIB)
++ $(AVMEDIALIB) \
++ -lixionlib \
++ -lboost_thread-mt \
++ -pthread
+
+ .IF "$(GUI)"=="WNT"
+ SHL1STDLIBS+= $(ADVAPI32LIB)
More information about the ooo-build-commit
mailing list