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
e57e81ad
Kaydet (Commit)
e57e81ad
authored
Tem 12, 2016
tarafından
Jaskaran Singh
Kaydeden (comit)
Markus Mohrhard
Eyl 17, 2016
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Implement Interface for Importing Styles via Orcus
Change-Id: I2ec4cb1ad358e2e4a49e82e916a54fae81558937
üst
2aea6d51
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
123 additions
and
21 deletions
+123
-21
orcusinterface.hxx
sc/source/filter/inc/orcusinterface.hxx
+16
-0
interface.cxx
sc/source/filter/orcus/interface.cxx
+107
-21
No files found.
sc/source/filter/inc/orcusinterface.hxx
Dosyayı görüntüle @
e57e81ad
...
...
@@ -258,7 +258,12 @@ private:
double
mnSize
;
Color
maColor
;
bool
mbHasFontAttr
;
bool
mbHasUnderlineAttr
;
FontLineStyle
meUnderline
;
FontLineStyle
meUnderlineType
;
FontLineStyle
meUnderlineWidth
;
Color
maUnderlineColor
;
font
();
...
...
@@ -275,6 +280,10 @@ private:
Color
maFgColor
;
Color
maBgColor
;
bool
mbHasFillAttr
;
fill
();
void
applyToItemSet
(
SfxItemSet
&
rSet
)
const
;
};
...
...
@@ -291,6 +300,8 @@ private:
};
std
::
map
<
orcus
::
spreadsheet
::
border_direction_t
,
border_line
>
border_lines
;
bool
mbHasBorderAttr
;
border
();
void
applyToItemSet
(
SfxItemSet
&
rSet
)
const
;
...
...
@@ -306,6 +317,8 @@ private:
bool
mbPrintContent
;
bool
mbFormulaHidden
;
bool
mbHasProtectionAttr
;
protection
();
void
applyToItemSet
(
SfxItemSet
&
rSet
)
const
;
};
...
...
@@ -317,6 +330,9 @@ private:
{
OUString
maCode
;
bool
mbHasNumberFormatAttr
;
number_format
();
void
applyToItemSet
(
SfxItemSet
&
rSet
)
const
;
};
...
...
sc/source/filter/orcus/interface.cxx
Dosyayı görüntüle @
e57e81ad
...
...
@@ -34,13 +34,21 @@
#include <editeng/charhiddenitem.hxx>
#include <editeng/protitem.hxx>
#include <editeng/prntitem.hxx>
#include <editeng/fontitem.hxx>
#include <editeng/fhgtitem.hxx>
#include <formula/token.hxx>
#include <tools/datetime.hxx>
#include <svl/sharedstringpool.hxx>
#include <o3tl/make_unique.hxx>
#include <svl/zforlist.hxx>
#include <svl/intitem.hxx>
#include <com/sun/star/task/XStatusIndicator.hpp>
#include <comphelper/processfactory.hxx>
#include <i18nlangtag/lang.h>
#include <vcl/outdev.hxx>
#include <tools/colordata.hxx>
#include <tools/fontenum.hxx>
using
namespace
com
::
sun
::
star
;
...
...
@@ -736,14 +744,32 @@ size_t ScOrcusSharedStrings::commit_segments()
ScOrcusStyles
::
ScOrcusStyles
(
ScDocument
&
rDoc
)
:
mrDoc
(
rDoc
)
{
mrDoc
.
GetStyleSheetPool
()
->
CreateStandardStyles
();
if
(
!
mrDoc
.
GetStyleSheetPool
()
->
HasStandardStyles
())
mrDoc
.
GetStyleSheetPool
()
->
CreateStandardStyles
();
}
ScOrcusStyles
::
font
::
font
()
:
mbBold
(
false
),
mbItalic
(
false
),
mbHasFontAttr
(
false
),
mbHasUnderlineAttr
(
false
),
mnSize
(
10
),
meUnderline
(
LINESTYLE_NONE
)
meUnderline
(
LINESTYLE_NONE
),
maColor
(
COL_WHITE
,
COL_WHITE
,
COL_WHITE
,
COL_WHITE
)
{
}
ScOrcusStyles
::
fill
::
fill
()
:
maPattern
(
""
),
maFgColor
(
Color
(
COL_WHITE
,
COL_WHITE
,
COL_WHITE
)),
maBgColor
(
Color
(
COL_WHITE
,
COL_WHITE
,
COL_WHITE
)),
mbHasFillAttr
(
false
)
{
}
ScOrcusStyles
::
number_format
::
number_format
()
:
maCode
(
""
),
mbHasNumberFormatAttr
(
false
)
{
}
...
...
@@ -767,9 +793,15 @@ void ScOrcusStyles::font::applyToItemSet(SfxItemSet& rSet) const
FontWeight
eWeight
=
mbBold
?
WEIGHT_BOLD
:
WEIGHT_NORMAL
;
rSet
.
Put
(
SvxWeightItem
(
eWeight
,
ATTR_FONT_WEIGHT
));
rSet
.
Put
(
SvxColorItem
(
maColor
,
ATTR_FONT_COLOR
));
rSet
.
Put
(
SvxUnderlineItem
(
meUnderline
,
ATTR_FONT_UNDERLINE
));
rSet
.
Put
(
SvxColorItem
(
maUnderlineColor
,
ATTR_FONT_UNDERLINE
));
if
(
mbHasUnderlineAttr
)
{
rSet
.
Put
(
SvxUnderlineItem
(
meUnderline
,
ATTR_FONT_UNDERLINE
));
rSet
.
Put
(
SvxColorItem
(
maUnderlineColor
,
ATTR_FONT_UNDERLINE
));
}
rSet
.
Put
(
SvxColorItem
(
maColor
,
ATTR_FONT_COLOR
));
rSet
.
Put
(
SvxFontItem
(
FAMILY_DONTKNOW
,
maName
,
maName
,
PITCH_DONTKNOW
,
RTL_TEXTENCODING_DONTKNOW
,
ATTR_FONT
));
rSet
.
Put
(
SvxFontHeightItem
(
translateToInternal
(
mnSize
,
orcus
::
length_unit_t
::
point
),
100
,
ATTR_FONT_HEIGHT
));
}
void
ScOrcusStyles
::
fill
::
applyToItemSet
(
SfxItemSet
&
rSet
)
const
...
...
@@ -785,20 +817,35 @@ void ScOrcusStyles::fill::applyToItemSet(SfxItemSet& rSet) const
ScOrcusStyles
::
protection
::
protection
()
:
mbHidden
(
false
),
mbLocked
(
false
)
mbLocked
(
true
),
mbPrintContent
(
false
),
mbFormulaHidden
(
false
),
mbHasProtectionAttr
(
true
)
{
}
void
ScOrcusStyles
::
protection
::
applyToItemSet
(
SfxItemSet
&
rSet
)
const
{
rSet
.
Put
(
SvxCharHiddenItem
(
mbHidden
,
ATTR_PROTECTION
));
if
(
mbHidden
)
rSet
.
Put
(
SvxCharHiddenItem
(
mbHidden
,
ATTR_PROTECTION
));
if
(
!
mbLocked
)
{
SvxProtectItem
aItem
(
ATTR_PROTECTION
);
if
(
mbLocked
)
rSet
.
Put
(
SvxProtectItem
(
ATTR_PROTECTION
));
rSet
.
Put
(
SvxPrintItem
(
ATTR_PROTECTION
,
mbPrintContent
));
aItem
.
SetContentProtect
(
false
);
aItem
.
SetSizeProtect
(
false
);
aItem
.
SetPosProtect
(
false
);
rSet
.
Put
(
aItem
);
}
if
(
!
mbPrintContent
)
rSet
.
Put
(
SvxPrintItem
(
ATTR_PROTECTION
,
mbPrintContent
));
}
ScOrcusStyles
::
border
::
border
()
ScOrcusStyles
::
border
::
border
()
:
mbHasBorderAttr
(
false
)
{
}
...
...
@@ -835,16 +882,30 @@ void ScOrcusStyles::border::applyToItemSet(SfxItemSet& rSet) const
for
(
auto
&
current_border_line
:
border_lines
)
{
SvxBoxItemLine
eDir
=
getDirection
(
current_border_line
.
first
);
editeng
::
SvxBorderLine
aLine
(
&
current_border_line
.
second
.
maColor
,
1
);
editeng
::
SvxBorderLine
aLine
(
&
current_border_line
.
second
.
maColor
,
current_border_line
.
second
.
mnWidth
,
current_border_line
.
second
.
mestyle
);
aItem
.
SetLine
(
&
aLine
,
eDir
);
}
rSet
.
Put
(
aItem
);
}
void
ScOrcusStyles
::
number_format
::
applyToItemSet
(
SfxItemSet
&
/*rSet*/
)
const
void
ScOrcusStyles
::
number_format
::
applyToItemSet
(
SfxItemSet
&
rSet
)
const
{
(
void
)
this
;
// loplugin:staticmethods
sal_uInt32
nKey
;
sal_Int32
nCheckPos
;
SvNumberFormatter
NumberFormatter
(
comphelper
::
getProcessComponentContext
(),
LANGUAGE_ENGLISH_US
);
OUString
Code
=
maCode
;
/* <-- Done because the SvNumberFormatter::PutEntry demands a non const NumFormat Code*/
sal_Int16
type
=
css
::
util
::
NumberFormat
::
ALL
;
if
(
NumberFormatter
.
PutEntry
(
Code
,
nCheckPos
,
type
,
nKey
,
LANGUAGE_ENGLISH_US
))
{
if
(
nCheckPos
==
0
)
{
rSet
.
Put
(
SfxUInt32Item
(
nKey
,
ATTR_VALUE_FORMAT
));
}
}
else
SAL_WARN
(
"sc.orcus.style"
,
"Cannot set Number Format"
);
}
ScOrcusStyles
::
xf
::
xf
()
:
...
...
@@ -873,7 +934,8 @@ void ScOrcusStyles::applyXfToItemSet(SfxItemSet& rSet, const xf& rXf)
}
const
font
&
rFont
=
maFonts
[
nFontId
];
rFont
.
applyToItemSet
(
rSet
);
if
(
rFont
.
mbHasFontAttr
)
rFont
.
applyToItemSet
(
rSet
);
size_t
nFillId
=
rXf
.
mnFillId
;
if
(
nFillId
>=
maFills
.
size
())
...
...
@@ -883,7 +945,8 @@ void ScOrcusStyles::applyXfToItemSet(SfxItemSet& rSet, const xf& rXf)
}
const
fill
&
rFill
=
maFills
[
nFillId
];
rFill
.
applyToItemSet
(
rSet
);
if
(
rFill
.
mbHasFillAttr
)
rFill
.
applyToItemSet
(
rSet
);
size_t
nBorderId
=
rXf
.
mnBorderId
;
if
(
nBorderId
>=
maBorders
.
size
())
...
...
@@ -892,7 +955,8 @@ void ScOrcusStyles::applyXfToItemSet(SfxItemSet& rSet, const xf& rXf)
return
;
}
const
border
&
rBorder
=
maBorders
[
nBorderId
];
rBorder
.
applyToItemSet
(
rSet
);
if
(
rBorder
.
mbHasBorderAttr
)
rBorder
.
applyToItemSet
(
rSet
);
size_t
nProtectionId
=
rXf
.
mnProtectionId
;
if
(
nProtectionId
>=
maProtections
.
size
())
...
...
@@ -901,7 +965,8 @@ void ScOrcusStyles::applyXfToItemSet(SfxItemSet& rSet, const xf& rXf)
return
;
}
const
protection
&
rProtection
=
maProtections
[
nProtectionId
];
rProtection
.
applyToItemSet
(
rSet
);
if
(
rProtection
.
mbHasProtectionAttr
)
rProtection
.
applyToItemSet
(
rSet
);
size_t
nNumberFormatId
=
rXf
.
mnNumberFormatId
;
if
(
nNumberFormatId
>=
maNumberFormats
.
size
())
...
...
@@ -910,7 +975,8 @@ void ScOrcusStyles::applyXfToItemSet(SfxItemSet& rSet, const xf& rXf)
return
;
}
const
number_format
&
rFormat
=
maNumberFormats
[
nNumberFormatId
];
rFormat
.
applyToItemSet
(
rSet
);
if
(
rFormat
.
mbHasNumberFormatAttr
)
rFormat
.
applyToItemSet
(
rSet
);
}
void
ScOrcusStyles
::
applyXfToItemSet
(
SfxItemSet
&
rSet
,
size_t
xfId
)
...
...
@@ -945,6 +1011,7 @@ void ScOrcusStyles::set_font_name(const char* s, size_t n)
{
OUString
aName
(
s
,
n
,
RTL_TEXTENCODING_UTF8
);
maCurrentFont
.
maName
=
aName
;
maCurrentFont
.
mbHasFontAttr
=
true
;
}
void
ScOrcusStyles
::
set_font_size
(
double
point
)
...
...
@@ -988,11 +1055,12 @@ void ScOrcusStyles::set_font_underline(orcus::spreadsheet::underline_t e)
default
:
;
}
maCurrentFont
.
mbHasUnderlineAttr
=
true
;
}
void
ScOrcusStyles
::
set_font_underline_width
(
orcus
::
spreadsheet
::
underline_width_t
e
)
{
if
(
e
==
orcus
::
spreadsheet
::
underline_width_t
::
bold
)
if
(
e
==
orcus
::
spreadsheet
::
underline_width_t
::
bold
||
e
==
orcus
::
spreadsheet
::
underline_width_t
::
thick
)
{
switch
(
maCurrentFont
.
meUnderline
)
{
...
...
@@ -1022,6 +1090,7 @@ void ScOrcusStyles::set_font_underline_width(orcus::spreadsheet::underline_width
;
}
}
maCurrentFont
.
mbHasUnderlineAttr
=
true
;
}
void
ScOrcusStyles
::
set_font_underline_mode
(
orcus
::
spreadsheet
::
underline_mode_t
/* e */
)
...
...
@@ -1046,6 +1115,7 @@ void ScOrcusStyles::set_font_underline_type(orcus::spreadsheet::underline_type_t
;
}
}
maCurrentFont
.
mbHasUnderlineAttr
=
true
;
}
void
ScOrcusStyles
::
set_font_underline_color
(
orcus
::
spreadsheet
::
color_elem_t
alpha
,
...
...
@@ -1082,16 +1152,19 @@ void ScOrcusStyles::set_fill_count(size_t /*n*/)
void
ScOrcusStyles
::
set_fill_pattern_type
(
const
char
*
s
,
size_t
n
)
{
maCurrentFill
.
maPattern
=
OUString
(
s
,
n
,
RTL_TEXTENCODING_UTF8
);
maCurrentFill
.
mbHasFillAttr
=
true
;
}
void
ScOrcusStyles
::
set_fill_fg_color
(
orcus
::
spreadsheet
::
color_elem_t
alpha
,
orcus
::
spreadsheet
::
color_elem_t
red
,
orcus
::
spreadsheet
::
color_elem_t
green
,
orcus
::
spreadsheet
::
color_elem_t
blue
)
{
maCurrentFill
.
maFgColor
=
Color
(
alpha
,
red
,
green
,
blue
);
maCurrentFill
.
mbHasFillAttr
=
true
;
}
void
ScOrcusStyles
::
set_fill_bg_color
(
orcus
::
spreadsheet
::
color_elem_t
alpha
,
orcus
::
spreadsheet
::
color_elem_t
red
,
orcus
::
spreadsheet
::
color_elem_t
green
,
orcus
::
spreadsheet
::
color_elem_t
blue
)
{
maCurrentFill
.
maBgColor
=
Color
(
alpha
,
red
,
green
,
blue
);
maCurrentFill
.
mbHasFillAttr
=
true
;
}
size_t
ScOrcusStyles
::
commit_fill
()
...
...
@@ -1157,6 +1230,7 @@ void ScOrcusStyles::set_border_style(
default
:
;
}
maCurrentBorder
.
mbHasBorderAttr
=
true
;
}
void
ScOrcusStyles
::
set_border_color
(
orcus
::
spreadsheet
::
border_direction_t
dir
,
...
...
@@ -1187,21 +1261,25 @@ size_t ScOrcusStyles::commit_border()
void
ScOrcusStyles
::
set_cell_hidden
(
bool
b
)
{
maCurrentProtection
.
mbHidden
=
b
;
maCurrentProtection
.
mbHasProtectionAttr
=
true
;
}
void
ScOrcusStyles
::
set_cell_locked
(
bool
b
)
{
maCurrentProtection
.
mbLocked
=
b
;
maCurrentProtection
.
mbHasProtectionAttr
=
true
;
}
void
ScOrcusStyles
::
set_cell_print_content
(
bool
b
)
{
maCurrentProtection
.
mbPrintContent
=
b
;
maCurrentProtection
.
mbHasProtectionAttr
=
true
;
}
void
ScOrcusStyles
::
set_cell_formula_hidden
(
bool
b
)
{
maCurrentProtection
.
mbFormulaHidden
=
b
;
maCurrentProtection
.
mbHasProtectionAttr
=
true
;
}
size_t
ScOrcusStyles
::
commit_cell_protection
()
...
...
@@ -1224,6 +1302,7 @@ void ScOrcusStyles::set_number_format_code(const char* s, size_t n)
{
OUString
aCode
(
s
,
n
,
RTL_TEXTENCODING_UTF8
);
maCurrentNumberFormat
.
maCode
=
aCode
;
maCurrentNumberFormat
.
mbHasNumberFormatAttr
=
true
;
}
size_t
ScOrcusStyles
::
commit_number_format
()
...
...
@@ -1355,6 +1434,10 @@ size_t ScOrcusStyles::commit_cell_style()
SAL_WARN
(
"sc.orcus.style"
,
"invalid xf id for commit cell style"
);
return
0
;
}
if
(
maCurrentCellStyle
.
mnXFId
==
0
)
{
return
0
;
}
ScStyleSheetPool
*
pPool
=
mrDoc
.
GetStyleSheetPool
();
SfxStyleSheetBase
&
rBase
=
pPool
->
Make
(
maCurrentCellStyle
.
maName
,
SfxStyleFamily
::
Para
);
...
...
@@ -1363,6 +1446,9 @@ size_t ScOrcusStyles::commit_cell_style()
xf
&
rXf
=
maCellStyleXfs
[
maCurrentCellStyle
.
mnXFId
];
applyXfToItemSet
(
rSet
,
rXf
);
maCurrentXF
=
ScOrcusStyles
::
xf
();
maCurrentCellStyle
=
ScOrcusStyles
::
cell_style
();
return
0
;
}
...
...
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