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
f3611760
Kaydet (Commit)
f3611760
authored
May 24, 2013
tarafından
Noel Power
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
reorg styles code slightly, process normal (and row ) style in own method
Change-Id: I701d12cf8f672824d7cfca1e995f02040fdd3095
üst
fc861c70
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
76 additions
and
75 deletions
+76
-75
sheetdatabuffer.hxx
sc/source/filter/inc/sheetdatabuffer.hxx
+18
-1
sheetdatabuffer.cxx
sc/source/filter/oox/sheetdatabuffer.cxx
+58
-74
No files found.
sc/source/filter/inc/sheetdatabuffer.hxx
Dosyayı görüntüle @
f3611760
...
@@ -192,7 +192,7 @@ private:
...
@@ -192,7 +192,7 @@ private:
/** Writes all cell formatting attributes to the passed cell range list. (depreciates writeXfIdRangeProperties) */
/** Writes all cell formatting attributes to the passed cell range list. (depreciates writeXfIdRangeProperties) */
void
writeXfIdRangeListProperties
(
sal_Int32
nXfId
,
sal_Int32
nNumFmtId
,
const
ApiCellRangeList
&
rRanges
)
const
;
void
writeXfIdRangeListProperties
(
sal_Int32
nXfId
,
sal_Int32
nNumFmtId
,
const
ApiCellRangeList
&
rRanges
)
const
;
void
applyCellMerging
(
const
::
com
::
sun
::
star
::
table
::
CellRangeAddress
&
rRange
);
void
applyCellMerging
(
const
::
com
::
sun
::
star
::
table
::
CellRangeAddress
&
rRange
);
void
addColXfStyle
(
sal_Int32
nXfId
,
sal_Int32
nFormatId
,
const
::
com
::
sun
::
star
::
table
::
CellRangeAddress
&
rAddress
,
bool
bProcessRowRange
=
false
);
private
:
private
:
/** Stores cell range address and formula token array of an array formula. */
/** Stores cell range address and formula token array of an array formula. */
typedef
::
std
::
pair
<
::
com
::
sun
::
star
::
table
::
CellRangeAddress
,
ApiTokenSequence
>
ArrayFormula
;
typedef
::
std
::
pair
<
::
com
::
sun
::
star
::
table
::
CellRangeAddress
,
ApiTokenSequence
>
ArrayFormula
;
...
@@ -217,6 +217,22 @@ private:
...
@@ -217,6 +217,22 @@ private:
typedef
::
std
::
pair
<
sal_Int32
,
sal_Int32
>
XfIdNumFmtKey
;
typedef
::
std
::
pair
<
sal_Int32
,
sal_Int32
>
XfIdNumFmtKey
;
typedef
::
std
::
map
<
XfIdNumFmtKey
,
ApiCellRangeList
>
XfIdRangeListMap
;
typedef
::
std
::
map
<
XfIdNumFmtKey
,
ApiCellRangeList
>
XfIdRangeListMap
;
typedef
::
std
::
pair
<
sal_Int32
,
sal_Int32
>
RowRange
;
struct
RowRangeStyle
{
sal_Int32
mnStartRow
;
sal_Int32
mnEndRow
;
XfIdNumFmtKey
mnNumFmt
;
};
struct
StyleRowRangeComp
{
bool
operator
()
(
const
RowRangeStyle
&
lhs
,
const
RowRangeStyle
&
rhs
)
const
{
return
lhs
.
mnEndRow
<
rhs
.
mnStartRow
;
}
};
typedef
::
std
::
set
<
RowRangeStyle
,
StyleRowRangeComp
>
RowStyles
;
typedef
::
std
::
map
<
sal_Int32
,
RowStyles
>
ColStyles
;
/** Stores information about a merged cell range. */
/** Stores information about a merged cell range. */
struct
MergedRange
struct
MergedRange
{
{
...
@@ -230,6 +246,7 @@ private:
...
@@ -230,6 +246,7 @@ private:
};
};
typedef
::
std
::
list
<
MergedRange
>
MergedRangeList
;
typedef
::
std
::
list
<
MergedRange
>
MergedRangeList
;
ColStyles
maStylesPerColumn
;
/// Stores cell styles by column ( in row ranges )
CellBlockBuffer
maCellBlocks
;
/// Manages all open cell blocks.
CellBlockBuffer
maCellBlocks
;
/// Manages all open cell blocks.
ArrayFormulaList
maArrayFormulas
;
/// All array formulas in the sheet.
ArrayFormulaList
maArrayFormulas
;
/// All array formulas in the sheet.
TableOperationList
maTableOperations
;
/// All table operations in the sheet.
TableOperationList
maTableOperations
;
/// All table operations in the sheet.
...
...
sc/source/filter/oox/sheetdatabuffer.cxx
Dosyayı görüntüle @
f3611760
...
@@ -346,82 +346,20 @@ void addIfNotInMyMap( StylesBuffer& rStyles, std::map< std::pair< sal_Int32, sal
...
@@ -346,82 +346,20 @@ void addIfNotInMyMap( StylesBuffer& rStyles, std::map< std::pair< sal_Int32, sal
}
}
}
}
void
SheetDataBuffer
::
finalizeImport
(
)
void
SheetDataBuffer
::
addColXfStyle
(
sal_Int32
nXfId
,
sal_Int32
nFormatId
,
const
::
com
::
sun
::
star
::
table
::
CellRangeAddress
&
rAddress
,
bool
bProcessRowRange
)
{
{
// insert all cells of all open cell blocks
maCellBlocks
.
finalizeImport
();
// create all array formulas
for
(
ArrayFormulaList
::
iterator
aIt
=
maArrayFormulas
.
begin
(),
aEnd
=
maArrayFormulas
.
end
();
aIt
!=
aEnd
;
++
aIt
)
finalizeArrayFormula
(
aIt
->
first
,
aIt
->
second
);
// create all table operations
for
(
TableOperationList
::
iterator
aIt
=
maTableOperations
.
begin
(),
aEnd
=
maTableOperations
.
end
();
aIt
!=
aEnd
;
++
aIt
)
finalizeTableOperation
(
aIt
->
first
,
aIt
->
second
);
// write default formatting of remaining row range
maXfIdRowRangeList
[
maXfIdRowRange
.
mnXfId
].
push_back
(
maXfIdRowRange
.
maRowRange
);
typedef
::
std
::
pair
<
sal_Int32
,
sal_Int32
>
RowRange
;
struct
RowRangeStyle
{
sal_Int32
mnStartRow
;
sal_Int32
mnEndRow
;
XfIdNumFmtKey
mnNumFmt
;
};
struct
StyleRowRangeComp
{
bool
operator
()
(
const
RowRangeStyle
&
lhs
,
const
RowRangeStyle
&
rhs
)
const
{
return
lhs
.
mnEndRow
<
rhs
.
mnStartRow
;
}
};
typedef
::
std
::
set
<
RowRangeStyle
,
StyleRowRangeComp
>
RowStyles
;
typedef
::
std
::
map
<
sal_Int32
,
RowStyles
>
ColStyles
;
ColStyles
aStylesPerColumn
;
StylesBuffer
&
rStyles
=
getStyles
();
std
::
map
<
std
::
pair
<
sal_Int32
,
sal_Int32
>
,
ApiCellRangeList
>
rangeStyleListMap
;
for
(
XfIdRangeListMap
::
const_iterator
aIt
=
maXfIdRangeLists
.
begin
(),
aEnd
=
maXfIdRangeLists
.
end
();
aIt
!=
aEnd
;
++
aIt
)
addIfNotInMyMap
(
getStyles
(),
rangeStyleListMap
,
aIt
->
first
.
first
,
aIt
->
first
.
second
,
aIt
->
second
);
// gather all ranges that have the same style and apply them in bulk
for
(
std
::
map
<
std
::
pair
<
sal_Int32
,
sal_Int32
>
,
ApiCellRangeList
>::
iterator
it
=
rangeStyleListMap
.
begin
(),
it_end
=
rangeStyleListMap
.
end
();
it
!=
it_end
;
++
it
)
{
const
ApiCellRangeList
&
rRanges
(
it
->
second
);
for
(
ApiCellRangeList
::
const_iterator
it_range
=
rRanges
.
begin
(),
it_rangeend
=
rRanges
.
end
();
it_range
!=
it_rangeend
;
++
it_range
)
{
RowRangeStyle
aStyleRows
;
aStyleRows
.
mnNumFmt
.
first
=
it
->
first
.
first
;
aStyleRows
.
mnNumFmt
.
second
=
it
->
first
.
second
;
aStyleRows
.
mnStartRow
=
it_range
->
StartRow
;
aStyleRows
.
mnEndRow
=
it_range
->
EndRow
;
for
(
sal_Int32
nCol
=
it_range
->
StartColumn
;
nCol
<=
it_range
->
EndColumn
;
++
nCol
)
aStylesPerColumn
[
nCol
].
insert
(
aStyleRows
);
}
}
// process row ranges for each column, don't overwrite any existing row entries for a column
for
(
std
::
map
<
sal_Int32
,
std
::
vector
<
ValueRange
>
>::
iterator
it
=
maXfIdRowRangeList
.
begin
(),
it_end
=
maXfIdRowRangeList
.
end
();
it
!=
it_end
;
++
it
)
{
ApiCellRangeList
rangeList
;
AddressConverter
&
rAddrConv
=
getAddressConverter
();
// get all row ranges for id
for
(
std
::
vector
<
ValueRange
>::
iterator
rangeIter
=
it
->
second
.
begin
(),
rangeIter_end
=
it
->
second
.
end
();
rangeIter
!=
rangeIter_end
;
++
rangeIter
)
{
RowRangeStyle
aStyleRows
;
RowRangeStyle
aStyleRows
;
aStyleRows
.
mnNumFmt
.
first
=
it
->
first
;
aStyleRows
.
mnNumFmt
.
first
=
nXfId
;
if
(
aStyleRows
.
mnNumFmt
.
first
==
-
1
)
// dud
aStyleRows
.
mnNumFmt
.
second
=
nFormatId
;
continue
;
aStyleRows
.
mnStartRow
=
rAddress
.
StartRow
;
aStyleRows
.
mnNumFmt
.
second
=
-
1
;
aStyleRows
.
mnEndRow
=
rAddress
.
EndRow
;
aStyleRows
.
mnStartRow
=
rangeIter
->
mnFirst
;
for
(
sal_Int32
nCol
=
rAddress
.
StartColumn
;
nCol
<=
rAddress
.
EndColumn
;
++
nCol
)
aStyleRows
.
mnEndRow
=
rangeIter
->
mnLast
;
{
for
(
sal_Int32
nCol
=
0
;
nCol
<=
rAddrConv
.
getMaxApiAddress
().
Column
;
++
nCol
)
if
(
!
bProcessRowRange
)
maStylesPerColumn
[
nCol
].
insert
(
aStyleRows
);
else
{
{
RowStyles
&
rRowStyles
=
aStylesPerColumn
[
nCol
];
RowStyles
&
rRowStyles
=
m
aStylesPerColumn
[
nCol
];
// If the rowrange style includes rows already
// If the rowrange style includes rows already
// allocated to a style then we need to split
// allocated to a style then we need to split
// the range style Rows into sections ( to
// the range style Rows into sections ( to
...
@@ -467,9 +405,54 @@ void SheetDataBuffer::finalizeImport()
...
@@ -467,9 +405,54 @@ void SheetDataBuffer::finalizeImport()
rRowStyles
.
insert
(
aStyleRows
);
rRowStyles
.
insert
(
aStyleRows
);
}
}
}
}
}
void
SheetDataBuffer
::
finalizeImport
()
{
// insert all cells of all open cell blocks
maCellBlocks
.
finalizeImport
();
// create all array formulas
for
(
ArrayFormulaList
::
iterator
aIt
=
maArrayFormulas
.
begin
(),
aEnd
=
maArrayFormulas
.
end
();
aIt
!=
aEnd
;
++
aIt
)
finalizeArrayFormula
(
aIt
->
first
,
aIt
->
second
);
// create all table operations
for
(
TableOperationList
::
iterator
aIt
=
maTableOperations
.
begin
(),
aEnd
=
maTableOperations
.
end
();
aIt
!=
aEnd
;
++
aIt
)
finalizeTableOperation
(
aIt
->
first
,
aIt
->
second
);
// write default formatting of remaining row range
maXfIdRowRangeList
[
maXfIdRowRange
.
mnXfId
].
push_back
(
maXfIdRowRange
.
maRowRange
);
std
::
map
<
std
::
pair
<
sal_Int32
,
sal_Int32
>
,
ApiCellRangeList
>
rangeStyleListMap
;
for
(
XfIdRangeListMap
::
const_iterator
aIt
=
maXfIdRangeLists
.
begin
(),
aEnd
=
maXfIdRangeLists
.
end
();
aIt
!=
aEnd
;
++
aIt
)
{
addIfNotInMyMap
(
getStyles
(),
rangeStyleListMap
,
aIt
->
first
.
first
,
aIt
->
first
.
second
,
aIt
->
second
);
}
// gather all ranges that have the same style and apply them in bulk
for
(
std
::
map
<
std
::
pair
<
sal_Int32
,
sal_Int32
>
,
ApiCellRangeList
>::
iterator
it
=
rangeStyleListMap
.
begin
(),
it_end
=
rangeStyleListMap
.
end
();
it
!=
it_end
;
++
it
)
{
const
ApiCellRangeList
&
rRanges
(
it
->
second
);
for
(
ApiCellRangeList
::
const_iterator
it_range
=
rRanges
.
begin
(),
it_rangeend
=
rRanges
.
end
();
it_range
!=
it_rangeend
;
++
it_range
)
addColXfStyle
(
it
->
first
.
first
,
it
->
first
.
second
,
*
it_range
);
}
for
(
std
::
map
<
sal_Int32
,
std
::
vector
<
ValueRange
>
>::
iterator
it
=
maXfIdRowRangeList
.
begin
(),
it_end
=
maXfIdRowRangeList
.
end
();
it
!=
it_end
;
++
it
)
{
ApiCellRangeList
rangeList
;
AddressConverter
&
rAddrConv
=
getAddressConverter
();
// get all row ranges for id
for
(
std
::
vector
<
ValueRange
>::
iterator
rangeIter
=
it
->
second
.
begin
(),
rangeIter_end
=
it
->
second
.
end
();
rangeIter
!=
rangeIter_end
;
++
rangeIter
)
{
if
(
it
->
first
==
-
1
)
// it's a dud skip it
continue
;
CellRangeAddress
aRange
(
getSheetIndex
(),
0
,
rangeIter
->
mnFirst
,
rAddrConv
.
getMaxApiAddress
().
Column
,
rangeIter
->
mnLast
);
addColXfStyle
(
it
->
first
,
-
1
,
aRange
,
true
);
}
}
}
ScDocument
&
rDoc
=
getScDocument
();
ScDocument
&
rDoc
=
getScDocument
();
for
(
ColStyles
::
iterator
col
=
aStylesPerColumn
.
begin
(),
col_end
=
aStylesPerColumn
.
end
();
col
!=
col_end
;
++
col
)
StylesBuffer
&
rStyles
=
getStyles
();
for
(
ColStyles
::
iterator
col
=
maStylesPerColumn
.
begin
(),
col_end
=
maStylesPerColumn
.
end
();
col
!=
col_end
;
++
col
)
{
{
RowStyles
&
rRowStyles
=
col
->
second
;
RowStyles
&
rRowStyles
=
col
->
second
;
std
::
list
<
ScAttrEntry
>
aAttrs
;
std
::
list
<
ScAttrEntry
>
aAttrs
;
...
@@ -497,6 +480,7 @@ void SheetDataBuffer::finalizeImport()
...
@@ -497,6 +480,7 @@ void SheetDataBuffer::finalizeImport()
rDoc
.
SetAttrEntries
(
nScCol
,
getSheetIndex
(),
pData
,
static_cast
<
SCSIZE
>
(
nAttrSize
));
rDoc
.
SetAttrEntries
(
nScCol
,
getSheetIndex
(),
pData
,
static_cast
<
SCSIZE
>
(
nAttrSize
));
}
}
// merge all cached merged ranges and update right/bottom cell borders
// merge all cached merged ranges and update right/bottom cell borders
for
(
MergedRangeList
::
iterator
aIt
=
maMergedRanges
.
begin
(),
aEnd
=
maMergedRanges
.
end
();
aIt
!=
aEnd
;
++
aIt
)
for
(
MergedRangeList
::
iterator
aIt
=
maMergedRanges
.
begin
(),
aEnd
=
maMergedRanges
.
end
();
aIt
!=
aEnd
;
++
aIt
)
applyCellMerging
(
aIt
->
maRange
);
applyCellMerging
(
aIt
->
maRange
);
...
...
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