[Libreoffice-commits] .: 10 commits - oox/source writerfilter/source
Jan Holesovsky
kendy at kemper.freedesktop.org
Mon Dec 20 04:20:33 PST 2010
oox/source/xls/worksheethelper.cxx | 134 +++++++++++++++++++++------
writerfilter/source/ooxml/factoryimpl_ns.xsl | 10 +-
2 files changed, 118 insertions(+), 26 deletions(-)
New commits:
commit 74543bf03a69c3a34a260faaa21014b920eeb4ba
Merge: 5951b81... 10535b2...
Author: Jan Holesovsky <kendy at suse.cz>
Date: Mon Dec 20 13:13:26 2010 +0100
Merge branch 'master' of ssh://git.freedesktop.org/git/libreoffice/filters
commit 5951b8164b364aef4612bc8047707c8c61f71f2b
Merge: 61c501a... b3a6643...
Author: Jan Holesovsky <kendy at suse.cz>
Date: Mon Dec 20 01:17:05 2010 +0100
Merge commit 'libreoffice-3.3.0.2'
commit b3a6643f0c4c206ff2b82f6e53d8185b6adb8f02
Author: Petr Mladek <pmladek at suse.cz>
Date: Sat Dec 18 20:35:15 2010 +0100
Version 3.3.0.2, tag libreoffice-3.3.0.2 (3.3-rc2)
commit 57e26a2c5ab5eceef12ad46ef280816ee5bc8796
Merge: 5928d86... 3fbceb8...
Author: Kohei Yoshida <kyoshida at novell.com>
Date: Tue Dec 14 23:22:08 2010 -0500
Merge commit 'ooo/OOO330_m18' into libreoffice-3-3
commit 5928d863afc6926ebdc68e380a08827f89530e5d
Author: Rene Engelhard <rene at debian.org>
Date: Mon Dec 13 20:26:19 2010 +0100
use $(GPERF) instead of hardcoded gperf (fdo#32195)
diff --git a/filter/source/svg/makefile.mk b/filter/source/svg/makefile.mk
index 715ed82..a7df46b 100644
--- a/filter/source/svg/makefile.mk
+++ b/filter/source/svg/makefile.mk
@@ -97,7 +97,7 @@ $(INCCOM)$/tokens.hxx $(MISC)$/tokens.gperf : tokens.txt gentoken.pl
$(PERL) gentoken.pl tokens.txt $(INCCOM)$/tokens.hxx $(MISC)$/tokens.gperf
$(INCCOM)$/tokens.cxx : $(MISC)$/tokens.gperf makefile.mk
- gperf --compare-strncmp -C -m 20 $(MISC)$/tokens.gperf | $(SED) -e "s/(char\*)0/(char\*)0, 0/g" >$(INCCOM)$/tokens.cxx
+ $(GPERF) --compare-strncmp -C -m 20 $(MISC)$/tokens.gperf | $(SED) -e "s/(char\*)0/(char\*)0, 0/g" >$(INCCOM)$/tokens.cxx
$(SLO)$/tokenmap.obj : $(INCCOM)$/tokens.cxx $(INCCOM)$/tokens.hxx
diff --git a/oox/source/token/makefile.mk b/oox/source/token/makefile.mk
index 7884c37..07822f6 100644
--- a/oox/source/token/makefile.mk
+++ b/oox/source/token/makefile.mk
@@ -66,7 +66,7 @@ $(MISC)$/do_namespaces $(do_phony) : namespaces.txt gennamespaces.pl
$(PERL) gennamespaces.pl namespaces.txt $(INCCOM)$/oox$/core$/namespaces.hxx && $(TOUCH) $@
$(INCCOM)$/tokens.inc : $(MISC)$/tokens.gperf $(MISC)$/do_tokens
- $(AUGMENT_LIBRARY_PATH) gperf --compare-strncmp $(MISC)$/tokens.gperf | $(SED) -e "s/(char\*)0/(char\*)0, 0/g" | $(GREP) -v "^#line" >$(INCCOM)$/tokens.inc
+ $(AUGMENT_LIBRARY_PATH) $(GPERF) --compare-strncmp $(MISC)$/tokens.gperf | $(SED) -e "s/(char\*)0/(char\*)0, 0/g" | $(GREP) -v "^#line" >$(INCCOM)$/tokens.inc
$(SLO)$/tokenmap.obj : $(INCCOM)$/tokens.inc $(INCCOM)$/tokenwords.inc $(INCCOM)$/tokens.hxx $(INCCOM)$/oox$/core$/namespaces.hxx $(MISC)$/do_tokens $(MISC)$/do_namespaces
diff --git a/writerfilter/source/ooxml/makefile.mk b/writerfilter/source/ooxml/makefile.mk
index c6a40b4..e05b7d0 100644
--- a/writerfilter/source/ooxml/makefile.mk
+++ b/writerfilter/source/ooxml/makefile.mk
@@ -234,7 +234,7 @@ $(OOXMLNAMESPACEIDSHXX): $(OOXMLHXXOUTDIRCREATED) $(OOXMLNAMESPACEIDSXSL) \
$(GPERFFASTTOKENHXX): $(OOXMLGPERFFASTTOKENXSL) $(MODELPROCESSED)
@echo "Making: " $(@:f)
- $(COMMAND_ECHO)$(XSLTPROC) $(OOXMLGPERFFASTTOKENXSL) $(MODELPROCESSED) | tr -d '\r' | gperf -I -t -E -S1 -c -G -LC++ > $@
+ $(COMMAND_ECHO)$(XSLTPROC) $(OOXMLGPERFFASTTOKENXSL) $(MODELPROCESSED) | tr -d '\r' | $(GPERF) -I -t -E -S1 -c -G -LC++ > $@
$(SLOFACTORIESNAMESPACES): $(OOXMLFACTORYSCXXS) $(OOXMLGENHEADERS)
diff --git a/writerfilter/source/ooxml/rngtocxx b/writerfilter/source/ooxml/rngtocxx
index 8b75d65..d4c902c 100755
--- a/writerfilter/source/ooxml/rngtocxx
+++ b/writerfilter/source/ooxml/rngtocxx
@@ -28,5 +28,5 @@ xalan -xsl tokenmapinit.xsl -in model_processed.xml > TokenMapInit.cxx
xalan -xsl valuesimpl.xsl -in model_processed.xml > OOXMLvalues.cxx
xalan -xsl qnametostr.xsl -in model_processed.xml > qnametostr.tmp
xalan -xsl resourceids.xsl -in model_processed.xml > ../../inc/ooxml/resourceids.hxx
-xalan -xsl gperfattributes.xsl -in model_processed.xml | gperf -t -E -S1 -LC++ > gperfattributes.hxx
-xalan -xsl gperfelements.xsl -in model_processed.xml | gperf -t -E -S1 -LC++ > gperfelements.hxx
+xalan -xsl gperfattributes.xsl -in model_processed.xml | $GPERF -t -E -S1 -LC++ > gperfattributes.hxx
+xalan -xsl gperfelements.xsl -in model_processed.xml | $GPERF -t -E -S1 -LC++ > gperfelements.hxx
commit f6976e336dadde21a8e1fb60afcbb907419f1089
Author: Robert Nagy <robert at openbsd.org>
Date: Tue Dec 14 09:36:55 2010 +0100
only specify $(SLO)$/qnametostr.obj in NOOPTFILES once
diff --git a/writerfilter/source/resourcemodel/makefile.mk b/writerfilter/source/resourcemodel/makefile.mk
index bb5bc05..f52eed5 100644
--- a/writerfilter/source/resourcemodel/makefile.mk
+++ b/writerfilter/source/resourcemodel/makefile.mk
@@ -58,12 +58,6 @@ SLOFILES= \
$(SLO)$/WW8Analyzer.obj \
$(SLO)$/Protocol.obj
-# linux 64 bit: compiler (gcc 4.2.3) fails with 'out of memory'
-.IF "$(OUTPATH)"=="unxlngx6"
-NOOPTFILES= \
- $(SLO)$/qnametostr.obj
-.ENDIF
-
SHL1TARGET=$(TARGET)
.IF "$(GUI)"=="UNX" || "$(GUI)"=="MAC"
commit 3fbceb8b1b81d473c371adc15e7475273c36fddf
Merge: 04950a8... 79dc115...
Author: obo <obo at openoffice.org>
Date: Thu Dec 9 10:58:42 2010 +0100
CWS-TOOLING: integrate CWS calc33stopper3
commit 79dc11590a3da1e8df95d1eea1455a1e3019bd31
Author: Daniel Rentz [dr] <daniel.rentz at oracle.com>
Date: Tue Dec 7 14:54:40 2010 +0100
calc33stopper3: #i115940# improve performance for import of XLSX files with drawing objects
diff --git a/oox/source/xls/worksheethelper.cxx b/oox/source/xls/worksheethelper.cxx
index 908b17b..6354c39 100644
--- a/oox/source/xls/worksheethelper.cxx
+++ b/oox/source/xls/worksheethelper.cxx
@@ -404,7 +404,7 @@ public:
Size getCellSize( sal_Int32 nCol, sal_Int32 nRow ) const;
/** Returns the address of the cell that contains the passed point in 1/100 mm. */
- CellAddress getCellAddressFromPosition( const Point& rPosition, const CellAddress* pStartAddr = 0 ) const;
+ CellAddress getCellAddressFromPosition( const Point& rPosition, const Size& rDrawPageSize ) const;
/** Returns the cell range address that contains the passed rectangle in 1/100 mm. */
CellRangeAddress getCellRangeFromRectangle( const Rectangle& rRect ) const;
@@ -795,41 +795,117 @@ Size WorksheetData::getCellSize( sal_Int32 nCol, sal_Int32 nRow ) const
return aSize;
}
-CellAddress WorksheetData::getCellAddressFromPosition( const Point& rPosition, const CellAddress* pStartAddr ) const
+namespace {
+
+inline sal_Int32 lclGetMidAddr( sal_Int32 nBegAddr, sal_Int32 nEndAddr, sal_Int32 nBegPos, sal_Int32 nEndPos, sal_Int32 nSearchPos )
+{
+ // use sal_Int64 to prevent integer overflow
+ return nBegAddr + 1 + static_cast< sal_Int32 >( static_cast< sal_Int64 >( nEndAddr - nBegAddr - 2 ) * (nSearchPos - nBegPos) / (nEndPos - nBegPos) );
+}
+
+bool lclPrepareInterval( sal_Int32 nBegAddr, sal_Int32& rnMidAddr, sal_Int32 nEndAddr,
+ sal_Int32 nBegPos, sal_Int32 nEndPos, sal_Int32 nSearchPos )
{
- // prepare start address for search loop
- sal_Int32 nCol = pStartAddr ? ::std::min< sal_Int32 >( pStartAddr->Column + 1, mrMaxApiPos.Column ) : 1;
- sal_Int32 nRow = pStartAddr ? ::std::min< sal_Int32 >( pStartAddr->Row + 1, mrMaxApiPos.Row ) : 1;
+ // searched position before nBegPos -> use nBegAddr
+ if( nSearchPos <= nBegPos )
+ {
+ rnMidAddr = nBegAddr;
+ return false;
+ }
+
+ // searched position after nEndPos, or begin next to end -> use nEndAddr
+ if( (nSearchPos >= nEndPos) || (nBegAddr + 1 >= nEndAddr) )
+ {
+ rnMidAddr = nEndAddr;
+ return false;
+ }
+
+ /* Otherwise find mid address according to position. lclGetMidAddr() will
+ return an address between nBegAddr and nEndAddr. */
+ rnMidAddr = lclGetMidAddr( nBegAddr, nEndAddr, nBegPos, nEndPos, nSearchPos );
+ return true;
+}
+
+bool lclUpdateInterval( sal_Int32& rnBegAddr, sal_Int32& rnMidAddr, sal_Int32& rnEndAddr,
+ sal_Int32& rnBegPos, sal_Int32 nMidPos, sal_Int32& rnEndPos, sal_Int32 nSearchPos )
+{
+ // nSearchPos < nMidPos: use the interval [begin,mid] in the next iteration
+ if( nSearchPos < nMidPos )
+ {
+ // if rnBegAddr is next to rnMidAddr, the latter is the column/row in question
+ if( rnBegAddr + 1 >= rnMidAddr )
+ return false;
+ // otherwise, set interval end to mid
+ rnEndPos = nMidPos;
+ rnEndAddr = rnMidAddr;
+ rnMidAddr = lclGetMidAddr( rnBegAddr, rnEndAddr, rnBegPos, rnEndPos, nSearchPos );
+ return true;
+ }
+
+ // nSearchPos > nMidPos: use the interval [mid,end] in the next iteration
+ if( nSearchPos > nMidPos )
+ {
+ // if rnMidAddr is next to rnEndAddr, the latter is the column/row in question
+ if( rnMidAddr + 1 >= rnEndAddr )
+ {
+ rnMidAddr = rnEndAddr;
+ return false;
+ }
+ // otherwise, set interval start to mid
+ rnBegPos = nMidPos;
+ rnBegAddr = rnMidAddr;
+ rnMidAddr = lclGetMidAddr( rnBegAddr, rnEndAddr, rnBegPos, rnEndPos, nSearchPos );
+ return true;
+ }
+
+ // nSearchPos == nMidPos: rnMidAddr is the column/row in question, do not loop anymore
+ return false;
+}
+
+} // namespace
+
+CellAddress WorksheetData::getCellAddressFromPosition( const Point& rPosition, const Size& rDrawPageSize ) const
+{
+ // starting cell address and its position in drawing layer (top-left edge)
+ sal_Int32 nBegCol = 0;
+ sal_Int32 nBegRow = 0;
+ Point aBegPos( 0, 0 );
+
+ // end cell address and its position in drawing layer (bottom-right edge)
+ sal_Int32 nEndCol = mrMaxApiPos.Column + 1;
+ sal_Int32 nEndRow = mrMaxApiPos.Row + 1;
+ Point aEndPos( rDrawPageSize.Width, rDrawPageSize.Height );
+
+ // starting point for interval search
+ sal_Int32 nMidCol, nMidRow;
+ bool bLoopCols = lclPrepareInterval( nBegCol, nMidCol, nEndCol, aBegPos.X, aEndPos.X, rPosition.X );
+ bool bLoopRows = lclPrepareInterval( nBegRow, nMidRow, nEndRow, aBegPos.Y, aEndPos.Y, rPosition.Y );
+ Point aMidPos = getCellPosition( nMidCol, nMidRow );
/* The loop will find the column/row index of the cell right of/below
the cell containing the passed point, unless the point is located at
the top or left border of the containing cell. */
- bool bNextCol = true;
- bool bNextRow = true;
- Point aCellPos;
- do
+ while( bLoopCols || bLoopRows )
{
- aCellPos = getCellPosition( nCol, nRow );
- if( bNextCol && ((bNextCol = (aCellPos.X < rPosition.X) && (nCol < mrMaxApiPos.Column)) == true) )
- ++nCol;
- if( bNextRow && ((bNextRow = (aCellPos.Y < rPosition.Y) && (nRow < mrMaxApiPos.Row)) == true) )
- ++nRow;
+ bLoopCols = bLoopCols && lclUpdateInterval( nBegCol, nMidCol, nEndCol, aBegPos.X, aMidPos.X, aEndPos.X, rPosition.X );
+ bLoopRows = bLoopRows && lclUpdateInterval( nBegRow, nMidRow, nEndRow, aBegPos.Y, aMidPos.Y, aEndPos.Y, rPosition.Y );
+ aMidPos = getCellPosition( nMidCol, nMidRow );
}
- while( bNextCol || bNextRow );
/* The cell left of/above the current search position contains the passed
point, unless the point is located on the top/left border of the cell,
or the last column/row of the sheet has been reached. */
- if( aCellPos.X > rPosition.X ) --nCol;
- if( aCellPos.Y > rPosition.Y ) --nRow;
- return CellAddress( getSheetIndex(), nCol, nRow );
+ if( aMidPos.X > rPosition.X ) --nMidCol;
+ if( aMidPos.Y > rPosition.Y ) --nMidRow;
+ return CellAddress( getSheetIndex(), nMidCol, nMidRow );
}
CellRangeAddress WorksheetData::getCellRangeFromRectangle( const Rectangle& rRect ) const
{
- CellAddress aStartAddr = getCellAddressFromPosition( Point( rRect.X, rRect.Y ) );
+ Size aPageSize = getDrawPageSize();
+ CellAddress aStartAddr = getCellAddressFromPosition( Point( rRect.X, rRect.Y ), aPageSize );
Point aBotRight( rRect.X + rRect.Width, rRect.Y + rRect.Height );
- CellAddress aEndAddr = getCellAddressFromPosition( aBotRight );
+ CellAddress aEndAddr = getCellAddressFromPosition( aBotRight, aPageSize );
bool bMultiCols = aStartAddr.Column < aEndAddr.Column;
bool bMultiRows = aStartAddr.Row < aEndAddr.Row;
if( bMultiCols || bMultiRows )
@@ -945,17 +1021,25 @@ void WorksheetData::extendUsedArea( const CellRangeAddress& rRange )
void WorksheetData::extendShapeBoundingBox( const Rectangle& rShapeRect )
{
+ // scale EMUs to 1/100 mm
+ const UnitConverter& rUnitConv = getUnitConverter();
+ Rectangle aShapeRectHmm(
+ rUnitConv.scaleToMm100( rShapeRect.X, UNIT_EMU ),
+ rUnitConv.scaleToMm100( rShapeRect.Y, UNIT_EMU ),
+ rUnitConv.scaleToMm100( rShapeRect.Width, UNIT_EMU ),
+ rUnitConv.scaleToMm100( rShapeRect.Height, UNIT_EMU ) );
+
if( (maShapeBoundingBox.Width == 0) && (maShapeBoundingBox.Height == 0) )
{
// width and height of maShapeBoundingBox are assumed to be zero on first cell
- maShapeBoundingBox = rShapeRect;
+ maShapeBoundingBox = aShapeRectHmm;
}
else
{
- sal_Int32 nEndX = ::std::max( maShapeBoundingBox.X + maShapeBoundingBox.Width, rShapeRect.X + rShapeRect.Width );
- sal_Int32 nEndY = ::std::max( maShapeBoundingBox.Y + maShapeBoundingBox.Height, rShapeRect.Y + rShapeRect.Height );
- maShapeBoundingBox.X = ::std::min( maShapeBoundingBox.X, rShapeRect.X );
- maShapeBoundingBox.Y = ::std::min( maShapeBoundingBox.Y, rShapeRect.Y );
+ sal_Int32 nEndX = ::std::max( maShapeBoundingBox.X + maShapeBoundingBox.Width, aShapeRectHmm.X + aShapeRectHmm.Width );
+ sal_Int32 nEndY = ::std::max( maShapeBoundingBox.Y + maShapeBoundingBox.Height, aShapeRectHmm.Y + aShapeRectHmm.Height );
+ maShapeBoundingBox.X = ::std::min( maShapeBoundingBox.X, aShapeRectHmm.X );
+ maShapeBoundingBox.Y = ::std::min( maShapeBoundingBox.Y, aShapeRectHmm.Y );
maShapeBoundingBox.Width = nEndX - maShapeBoundingBox.X;
maShapeBoundingBox.Height = nEndY - maShapeBoundingBox.Y;
}
commit 43d18f2604b13716407a254652b94464cf442832
Author: Petr Mladek <pmladek at suse.cz>
Date: Wed Dec 1 15:55:52 2010 +0100
Version 3.3.0.1, tag LIBREOFFICE_3_3_0_1 (3.3-rc1)
commit 57760b09f19f7c8af32f4b176ba047614f2e4827
Author: Cédric Bosdonnat <cedricbosdo at openoffice.org>
Date: Tue Nov 30 16:13:00 2010 +0100
Fix writerfilter XSL to handle more elements
diff --git a/writerfilter/source/ooxml/factoryimpl_ns.xsl b/writerfilter/source/ooxml/factoryimpl_ns.xsl
index 533c3d1..ff0f500 100644
--- a/writerfilter/source/ooxml/factoryimpl_ns.xsl
+++ b/writerfilter/source/ooxml/factoryimpl_ns.xsl
@@ -177,6 +177,15 @@ for a rng:define
<xsl:for-each select=".//rng:data[@type='base64Binary']">
<xsl:text>String</xsl:text>
</xsl:for-each>
+ <xsl:for-each select=".//rng:data[@type='boolean']">
+ <xsl:text>Boolean</xsl:text>
+ </xsl:for-each>
+ <xsl:for-each select=".//rng:data[@type='string']">
+ <xsl:text>String</xsl:text>
+ </xsl:for-each>
+ <xsl:for-each select=".//rng:data[@type='integer']">
+ <xsl:text>Integer</xsl:text>
+ </xsl:for-each>
</xsl:variable>
<xsl:variable name="refdefine1">
@@ -830,4 +839,4 @@ namespace ooxml {
</xsl:text>
</xsl:template>
-</xsl:stylesheet>
\ No newline at end of file
+</xsl:stylesheet>
More information about the Libreoffice-commits
mailing list