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
55131d40
Kaydet (Commit)
55131d40
authored
Nis 10, 2013
tarafından
Miklos Vajna
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
add msfilter::util::ConvertColor to avoid copy&paste
Change-Id: Ia5507f8d1ec18a45d3128c809d03f8f41849f93c
üst
24ee3df3
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
35 additions
and
54 deletions
+35
-54
util.hxx
filter/inc/filter/msfilter/util.hxx
+4
-0
rtfutil.cxx
filter/source/msfilter/rtfutil.cxx
+0
-1
util.cxx
filter/source/msfilter/util.cxx
+19
-0
docxattributeoutput.cxx
sw/source/filter/ww8/docxattributeoutput.cxx
+10
-31
rtfsdrimport.cxx
writerfilter/source/rtftok/rtfsdrimport.cxx
+2
-22
No files found.
filter/inc/filter/msfilter/util.hxx
Dosyayı görüntüle @
55131d40
...
@@ -31,6 +31,7 @@
...
@@ -31,6 +31,7 @@
#include <rtl/textenc.h>
#include <rtl/textenc.h>
#include <tools/datetime.hxx>
#include <tools/datetime.hxx>
#include <tools/color.hxx>
#include <com/sun/star/lang/Locale.hpp>
#include <com/sun/star/lang/Locale.hpp>
#include "filter/msfilter/msfilterdllapi.h"
#include "filter/msfilter/msfilterdllapi.h"
...
@@ -88,6 +89,9 @@ enum TextCategory
...
@@ -88,6 +89,9 @@ enum TextCategory
*/
*/
MSFILTER_DLLPUBLIC
TextCategory
categorizeCodePoint
(
sal_uInt32
codePoint
,
const
OUString
&
rBcp47LanguageTag
);
MSFILTER_DLLPUBLIC
TextCategory
categorizeCodePoint
(
sal_uInt32
codePoint
,
const
OUString
&
rBcp47LanguageTag
);
/// Converts tools Color to HTML color (without leading hashmark).
MSFILTER_DLLPUBLIC
OString
ConvertColor
(
const
Color
&
rColor
);
}
}
}
}
...
...
filter/source/msfilter/rtfutil.cxx
Dosyayı görüntüle @
55131d40
...
@@ -181,7 +181,6 @@ OString OutStringUpr(const sal_Char *pToken, const String &rStr, rtl_TextEncodin
...
@@ -181,7 +181,6 @@ OString OutStringUpr(const sal_Char *pToken, const String &rStr, rtl_TextEncodin
aRet
.
append
(
"}}}"
);
aRet
.
append
(
"}}}"
);
return
aRet
.
makeStringAndClear
();
return
aRet
.
makeStringAndClear
();
}
}
}
}
}
}
...
...
filter/source/msfilter/util.cxx
Dosyayı görüntüle @
55131d40
...
@@ -306,6 +306,25 @@ TextCategory categorizeCodePoint(sal_uInt32 codePoint, const OUString &rBcp47Lan
...
@@ -306,6 +306,25 @@ TextCategory categorizeCodePoint(sal_uInt32 codePoint, const OUString &rBcp47Lan
return
eRet
;
return
eRet
;
}
}
OString
ConvertColor
(
const
Color
&
rColor
)
{
OString
color
(
"auto"
);
if
(
rColor
.
GetColor
()
!=
COL_AUTO
)
{
const
char
pHexDigits
[]
=
"0123456789ABCDEF"
;
char
pBuffer
[]
=
"000000"
;
pBuffer
[
0
]
=
pHexDigits
[
(
rColor
.
GetRed
()
>>
4
)
&
0x0F
];
pBuffer
[
1
]
=
pHexDigits
[
rColor
.
GetRed
()
&
0x0F
];
pBuffer
[
2
]
=
pHexDigits
[
(
rColor
.
GetGreen
()
>>
4
)
&
0x0F
];
pBuffer
[
3
]
=
pHexDigits
[
rColor
.
GetGreen
()
&
0x0F
];
pBuffer
[
4
]
=
pHexDigits
[
(
rColor
.
GetBlue
()
>>
4
)
&
0x0F
];
pBuffer
[
5
]
=
pHexDigits
[
rColor
.
GetBlue
()
&
0x0F
];
color
=
OString
(
pBuffer
);
}
return
color
;
}
}
}
}
}
...
...
sw/source/filter/ww8/docxattributeoutput.cxx
Dosyayı görüntüle @
55131d40
...
@@ -191,7 +191,6 @@ class FieldMarkParamsHelper
...
@@ -191,7 +191,6 @@ class FieldMarkParamsHelper
return
bResult
;
return
bResult
;
}
}
};
};
static
OString
impl_ConvertColor
(
const
Color
&
rColor
);
void
DocxAttributeOutput
::
RTLAndCJKState
(
bool
bIsRTL
,
sal_uInt16
/*nScript*/
)
void
DocxAttributeOutput
::
RTLAndCJKState
(
bool
bIsRTL
,
sal_uInt16
/*nScript*/
)
{
{
if
(
bIsRTL
)
if
(
bIsRTL
)
...
@@ -276,7 +275,7 @@ void lcl_TextFrameShadow(FSHelperPtr pSerializer, const SwFrmFmt& rFrmFmt)
...
@@ -276,7 +275,7 @@ void lcl_TextFrameShadow(FSHelperPtr pSerializer, const SwFrmFmt& rFrmFmt)
if
(
aOffset
.
isEmpty
())
if
(
aOffset
.
isEmpty
())
return
;
return
;
OString
aShadowColor
=
impl_
ConvertColor
(
aShadowItem
.
GetColor
());
OString
aShadowColor
=
msfilter
::
util
::
ConvertColor
(
aShadowItem
.
GetColor
());
pSerializer
->
singleElementNS
(
XML_v
,
XML_shadow
,
pSerializer
->
singleElementNS
(
XML_v
,
XML_shadow
,
XML_on
,
"t"
,
XML_on
,
"t"
,
XML_color
,
"#"
+
aShadowColor
,
XML_color
,
"#"
+
aShadowColor
,
...
@@ -1400,26 +1399,6 @@ void DocxAttributeOutput::ParagraphStyle( sal_uInt16 nStyle )
...
@@ -1400,26 +1399,6 @@ void DocxAttributeOutput::ParagraphStyle( sal_uInt16 nStyle )
m_pSerializer
->
singleElementNS
(
XML_w
,
XML_pStyle
,
FSNS
(
XML_w
,
XML_val
),
aStyleId
.
getStr
(),
FSEND
);
m_pSerializer
->
singleElementNS
(
XML_w
,
XML_pStyle
,
FSNS
(
XML_w
,
XML_val
),
aStyleId
.
getStr
(),
FSEND
);
}
}
static
OString
impl_ConvertColor
(
const
Color
&
rColor
)
{
OString
color
(
"auto"
);
if
(
rColor
.
GetColor
()
!=
COL_AUTO
)
{
const
char
pHexDigits
[]
=
"0123456789ABCDEF"
;
char
pBuffer
[]
=
"000000"
;
pBuffer
[
0
]
=
pHexDigits
[
(
rColor
.
GetRed
()
>>
4
)
&
0x0F
];
pBuffer
[
1
]
=
pHexDigits
[
rColor
.
GetRed
()
&
0x0F
];
pBuffer
[
2
]
=
pHexDigits
[
(
rColor
.
GetGreen
()
>>
4
)
&
0x0F
];
pBuffer
[
3
]
=
pHexDigits
[
rColor
.
GetGreen
()
&
0x0F
];
pBuffer
[
4
]
=
pHexDigits
[
(
rColor
.
GetBlue
()
>>
4
)
&
0x0F
];
pBuffer
[
5
]
=
pHexDigits
[
rColor
.
GetBlue
()
&
0x0F
];
color
=
OString
(
pBuffer
);
}
return
color
;
}
static
void
impl_borderLine
(
FSHelperPtr
pSerializer
,
sal_Int32
elementToken
,
const
SvxBorderLine
*
pBorderLine
,
sal_uInt16
nDist
)
static
void
impl_borderLine
(
FSHelperPtr
pSerializer
,
sal_Int32
elementToken
,
const
SvxBorderLine
*
pBorderLine
,
sal_uInt16
nDist
)
{
{
FastAttributeList
*
pAttr
=
pSerializer
->
createAttrList
();
FastAttributeList
*
pAttr
=
pSerializer
->
createAttrList
();
...
@@ -1512,7 +1491,7 @@ static void impl_borderLine( FSHelperPtr pSerializer, sal_Int32 elementToken, co
...
@@ -1512,7 +1491,7 @@ static void impl_borderLine( FSHelperPtr pSerializer, sal_Int32 elementToken, co
pAttr
->
add
(
FSNS
(
XML_w
,
XML_space
),
OString
::
valueOf
(
sal_Int32
(
nDist
/
20
)
)
);
pAttr
->
add
(
FSNS
(
XML_w
,
XML_space
),
OString
::
valueOf
(
sal_Int32
(
nDist
/
20
)
)
);
// Get the color code as an RRGGBB hex value
// Get the color code as an RRGGBB hex value
OString
sColor
(
impl_
ConvertColor
(
pBorderLine
->
GetColor
(
)
)
);
OString
sColor
(
msfilter
::
util
::
ConvertColor
(
pBorderLine
->
GetColor
(
)
)
);
pAttr
->
add
(
FSNS
(
XML_w
,
XML_color
),
sColor
);
pAttr
->
add
(
FSNS
(
XML_w
,
XML_color
),
sColor
);
}
}
...
@@ -1932,7 +1911,7 @@ void DocxAttributeOutput::TableBackgrounds( ww8::WW8TableNodeInfoInner::Pointer_
...
@@ -1932,7 +1911,7 @@ void DocxAttributeOutput::TableBackgrounds( ww8::WW8TableNodeInfoInner::Pointer_
else
else
aColor
=
COL_AUTO
;
aColor
=
COL_AUTO
;
OString
sColor
=
impl_
ConvertColor
(
aColor
);
OString
sColor
=
msfilter
::
util
::
ConvertColor
(
aColor
);
m_pSerializer
->
singleElementNS
(
XML_w
,
XML_shd
,
m_pSerializer
->
singleElementNS
(
XML_w
,
XML_shd
,
FSNS
(
XML_w
,
XML_fill
),
sColor
.
getStr
(
),
FSNS
(
XML_w
,
XML_fill
),
sColor
.
getStr
(
),
FSNS
(
XML_w
,
XML_val
),
"clear"
,
FSNS
(
XML_w
,
XML_val
),
"clear"
,
...
@@ -2397,7 +2376,7 @@ void DocxAttributeOutput::FlyFrameGraphic( const SwGrfNode* pGrfNode, const Size
...
@@ -2397,7 +2376,7 @@ void DocxAttributeOutput::FlyFrameGraphic( const SwGrfNode* pGrfNode, const Size
// Distance is measured diagonally from corner
// Distance is measured diagonally from corner
double
nShadowDist
=
sqrt
((
aShadowItem
.
GetWidth
()
*
aShadowItem
.
GetWidth
())
*
2.0
);
double
nShadowDist
=
sqrt
((
aShadowItem
.
GetWidth
()
*
aShadowItem
.
GetWidth
())
*
2.0
);
OString
aShadowDist
(
OString
::
valueOf
(
TwipsToEMU
(
nShadowDist
)
)
);
OString
aShadowDist
(
OString
::
valueOf
(
TwipsToEMU
(
nShadowDist
)
)
);
OString
aShadowColor
=
impl_
ConvertColor
(
aShadowItem
.
GetColor
()
);
OString
aShadowColor
=
msfilter
::
util
::
ConvertColor
(
aShadowItem
.
GetColor
()
);
sal_uInt32
nShadowDir
=
0
;
sal_uInt32
nShadowDir
=
0
;
switch
(
aShadowItem
.
GetLocation
()
)
switch
(
aShadowItem
.
GetLocation
()
)
{
{
...
@@ -3356,7 +3335,7 @@ void DocxAttributeOutput::CharColor( const SvxColorItem& rColor )
...
@@ -3356,7 +3335,7 @@ void DocxAttributeOutput::CharColor( const SvxColorItem& rColor )
const
Color
aColor
(
rColor
.
GetValue
()
);
const
Color
aColor
(
rColor
.
GetValue
()
);
OString
aColorString
;
OString
aColorString
;
aColorString
=
impl_
ConvertColor
(
aColor
);
aColorString
=
msfilter
::
util
::
ConvertColor
(
aColor
);
m_pSerializer
->
singleElementNS
(
XML_w
,
XML_color
,
m_pSerializer
->
singleElementNS
(
XML_w
,
XML_color
,
FSNS
(
XML_w
,
XML_val
),
aColorString
.
getStr
(),
FSEND
);
FSNS
(
XML_w
,
XML_val
),
aColorString
.
getStr
(),
FSEND
);
...
@@ -3553,7 +3532,7 @@ void DocxAttributeOutput::CharAnimatedText( const SvxBlinkItem& rBlink )
...
@@ -3553,7 +3532,7 @@ void DocxAttributeOutput::CharAnimatedText( const SvxBlinkItem& rBlink )
void
DocxAttributeOutput
::
CharBackground
(
const
SvxBrushItem
&
rBrush
)
void
DocxAttributeOutput
::
CharBackground
(
const
SvxBrushItem
&
rBrush
)
{
{
m_pSerializer
->
singleElementNS
(
XML_w
,
XML_shd
,
m_pSerializer
->
singleElementNS
(
XML_w
,
XML_shd
,
FSNS
(
XML_w
,
XML_fill
),
impl_
ConvertColor
(
rBrush
.
GetColor
()
).
getStr
(),
FSNS
(
XML_w
,
XML_fill
),
msfilter
::
util
::
ConvertColor
(
rBrush
.
GetColor
()
).
getStr
(),
FSNS
(
XML_w
,
XML_val
),
"clear"
,
FSNS
(
XML_w
,
XML_val
),
"clear"
,
FSEND
);
FSEND
);
}
}
...
@@ -4623,7 +4602,7 @@ void DocxAttributeOutput::FormatAnchor( const SwFmtAnchor& )
...
@@ -4623,7 +4602,7 @@ void DocxAttributeOutput::FormatAnchor( const SwFmtAnchor& )
void
DocxAttributeOutput
::
FormatBackground
(
const
SvxBrushItem
&
rBrush
)
void
DocxAttributeOutput
::
FormatBackground
(
const
SvxBrushItem
&
rBrush
)
{
{
OString
sColor
=
impl_
ConvertColor
(
rBrush
.
GetColor
(
)
);
OString
sColor
=
msfilter
::
util
::
ConvertColor
(
rBrush
.
GetColor
(
)
);
if
(
m_bTextFrameSyntax
)
if
(
m_bTextFrameSyntax
)
m_pFlyAttrList
->
add
(
XML_fillcolor
,
"#"
+
sColor
);
m_pFlyAttrList
->
add
(
XML_fillcolor
,
"#"
+
sColor
);
else
if
(
!
m_rExport
.
bOutPageDescs
)
else
if
(
!
m_rExport
.
bOutPageDescs
)
...
@@ -4648,9 +4627,9 @@ void DocxAttributeOutput::FormatFillGradient( const XFillGradientItem& rFillGrad
...
@@ -4648,9 +4627,9 @@ void DocxAttributeOutput::FormatFillGradient( const XFillGradientItem& rFillGrad
m_pFlyFillAttrList
->
add
(
XML_type
,
"gradient"
);
m_pFlyFillAttrList
->
add
(
XML_type
,
"gradient"
);
const
XGradient
&
rGradient
=
rFillGradient
.
GetGradientValue
();
const
XGradient
&
rGradient
=
rFillGradient
.
GetGradientValue
();
OString
sStartColor
=
impl_
ConvertColor
(
rGradient
.
GetStartColor
());
OString
sStartColor
=
msfilter
::
util
::
ConvertColor
(
rGradient
.
GetStartColor
());
m_pFlyFillAttrList
->
add
(
XML_color2
,
"#"
+
sStartColor
);
m_pFlyFillAttrList
->
add
(
XML_color2
,
"#"
+
sStartColor
);
OString
sEndColor
=
impl_
ConvertColor
(
rGradient
.
GetEndColor
());
OString
sEndColor
=
msfilter
::
util
::
ConvertColor
(
rGradient
.
GetEndColor
());
m_pFlyAttrList
->
add
(
XML_fillcolor
,
"#"
+
sEndColor
);
m_pFlyAttrList
->
add
(
XML_fillcolor
,
"#"
+
sEndColor
);
switch
(
rGradient
.
GetGradientStyle
())
switch
(
rGradient
.
GetGradientStyle
())
...
@@ -4679,7 +4658,7 @@ void DocxAttributeOutput::FormatBox( const SvxBoxItem& rBox )
...
@@ -4679,7 +4658,7 @@ void DocxAttributeOutput::FormatBox( const SvxBoxItem& rBox )
if
(
pLeft
&&
pRight
&&
pTop
&&
pBottom
&&
if
(
pLeft
&&
pRight
&&
pTop
&&
pBottom
&&
*
pLeft
==
*
pRight
&&
*
pLeft
==
*
pTop
&&
*
pLeft
==
*
pBottom
)
*
pLeft
==
*
pRight
&&
*
pLeft
==
*
pTop
&&
*
pLeft
==
*
pBottom
)
{
{
OString
sColor
(
"#"
+
impl_
ConvertColor
(
pTop
->
GetColor
()));
OString
sColor
(
"#"
+
msfilter
::
util
::
ConvertColor
(
pTop
->
GetColor
()));
m_pFlyAttrList
->
add
(
XML_strokecolor
,
sColor
);
m_pFlyAttrList
->
add
(
XML_strokecolor
,
sColor
);
double
const
fConverted
(
editeng
::
ConvertBorderWidthToWord
(
pTop
->
GetBorderLineStyle
(),
pTop
->
GetWidth
()));
double
const
fConverted
(
editeng
::
ConvertBorderWidthToWord
(
pTop
->
GetBorderLineStyle
(),
pTop
->
GetWidth
()));
...
...
writerfilter/source/rtftok/rtfsdrimport.cxx
Dosyayı görüntüle @
55131d40
...
@@ -121,26 +121,6 @@ void RTFSdrImport::resolveFLine(uno::Reference<beans::XPropertySet> xPropertySet
...
@@ -121,26 +121,6 @@ void RTFSdrImport::resolveFLine(uno::Reference<beans::XPropertySet> xPropertySet
xPropertySet
->
setPropertyValue
(
"LineStyle"
,
uno
::
makeAny
(
drawing
::
LineStyle_NONE
));
xPropertySet
->
setPropertyValue
(
"LineStyle"
,
uno
::
makeAny
(
drawing
::
LineStyle_NONE
));
}
}
static
OString
impl_ConvertColor
(
const
Color
&
rColor
)
{
OString
color
(
"auto"
);
if
(
rColor
.
GetColor
()
!=
COL_AUTO
)
{
const
char
pHexDigits
[]
=
"0123456789ABCDEF"
;
char
pBuffer
[]
=
"000000"
;
pBuffer
[
0
]
=
pHexDigits
[
(
rColor
.
GetRed
()
>>
4
)
&
0x0F
];
pBuffer
[
1
]
=
pHexDigits
[
rColor
.
GetRed
()
&
0x0F
];
pBuffer
[
2
]
=
pHexDigits
[
(
rColor
.
GetGreen
()
>>
4
)
&
0x0F
];
pBuffer
[
3
]
=
pHexDigits
[
rColor
.
GetGreen
()
&
0x0F
];
pBuffer
[
4
]
=
pHexDigits
[
(
rColor
.
GetBlue
()
>>
4
)
&
0x0F
];
pBuffer
[
5
]
=
pHexDigits
[
rColor
.
GetBlue
()
&
0x0F
];
color
=
OString
(
pBuffer
);
}
return
color
;
}
void
RTFSdrImport
::
resolve
(
RTFShape
&
rShape
)
void
RTFSdrImport
::
resolve
(
RTFShape
&
rShape
)
{
{
int
nType
=
-
1
;
int
nType
=
-
1
;
...
@@ -224,13 +204,13 @@ void RTFSdrImport::resolve(RTFShape& rShape)
...
@@ -224,13 +204,13 @@ void RTFSdrImport::resolve(RTFShape& rShape)
xPropertySet
->
setPropertyValue
(
"FillColor"
,
aAny
);
xPropertySet
->
setPropertyValue
(
"FillColor"
,
aAny
);
// fillType will decide, possible it'll be the start color of a gradient.
// fillType will decide, possible it'll be the start color of a gradient.
aFillModel
.
moColor
.
set
(
OUString
(
"#"
)
+
OStringToOUString
(
impl_
ConvertColor
(
aAny
.
get
<
sal_Int32
>
()),
RTL_TEXTENCODING_UTF8
));
aFillModel
.
moColor
.
set
(
OUString
(
"#"
)
+
OStringToOUString
(
msfilter
::
util
::
ConvertColor
(
aAny
.
get
<
sal_Int32
>
()),
RTL_TEXTENCODING_UTF8
));
xPropertySet
->
setPropertyValue
(
"BackColorTransparency"
,
uno
::
makeAny
(
sal_Int32
(
0
)));
xPropertySet
->
setPropertyValue
(
"BackColorTransparency"
,
uno
::
makeAny
(
sal_Int32
(
0
)));
}
}
else
if
(
i
->
first
==
"fillBackColor"
)
else
if
(
i
->
first
==
"fillBackColor"
)
// fillType will decide, possible it'll be the end color of a gradient.
// fillType will decide, possible it'll be the end color of a gradient.
aFillModel
.
moColor2
.
set
(
OUString
(
"#"
)
+
OStringToOUString
(
impl_
ConvertColor
(
msfilter
::
util
::
BGRToRGB
(
i
->
second
.
toInt32
())),
RTL_TEXTENCODING_UTF8
));
aFillModel
.
moColor2
.
set
(
OUString
(
"#"
)
+
OStringToOUString
(
msfilter
::
util
::
ConvertColor
(
msfilter
::
util
::
BGRToRGB
(
i
->
second
.
toInt32
())),
RTL_TEXTENCODING_UTF8
));
else
if
(
i
->
first
==
"lineColor"
)
else
if
(
i
->
first
==
"lineColor"
)
aLineColor
<<=
msfilter
::
util
::
BGRToRGB
(
i
->
second
.
toInt32
());
aLineColor
<<=
msfilter
::
util
::
BGRToRGB
(
i
->
second
.
toInt32
());
else
if
(
i
->
first
==
"lineBackColor"
)
else
if
(
i
->
first
==
"lineBackColor"
)
...
...
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