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
374d581a
Kaydet (Commit)
374d581a
authored
Eki 22, 2014
tarafından
Kohei Yoshida
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Some code sharing.
Change-Id: If80c4b0ceec5e0afd55d12ebe7511fb4f40b4797
üst
519634b3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
64 additions
and
62 deletions
+64
-62
VAxisProperties.cxx
chart2/source/view/axes/VAxisProperties.cxx
+7
-0
VAxisProperties.hxx
chart2/source/view/axes/VAxisProperties.hxx
+2
-0
VCartesianAxis.cxx
chart2/source/view/axes/VCartesianAxis.cxx
+55
-62
No files found.
chart2/source/view/axes/VAxisProperties.cxx
Dosyayı görüntüle @
374d581a
...
...
@@ -412,6 +412,13 @@ bool AxisLabelProperties::isStaggered() const
return
(
STAGGER_ODD
==
eStaggering
||
STAGGER_EVEN
==
eStaggering
);
}
void
AxisLabelProperties
::
autoRotate45
()
{
fRotationAngleDegree
=
45
;
bLineBreakAllowed
=
false
;
eStaggering
=
SIDE_BY_SIDE
;
}
}
//namespace chart
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
chart2/source/view/axes/VAxisProperties.hxx
Dosyayı görüntüle @
374d581a
...
...
@@ -82,6 +82,8 @@ struct AxisLabelProperties SAL_FINAL
::
com
::
sun
::
star
::
chart2
::
XAxis
>&
xAxisModel
);
bool
isStaggered
()
const
;
void
autoRotate45
();
};
struct
AxisLabelAlignment
...
...
chart2/source/view/axes/VCartesianAxis.cxx
Dosyayı görüntüle @
374d581a
...
...
@@ -365,6 +365,47 @@ bool lcl_hasWordBreak( const Reference<drawing::XShape>& xShape )
return
false
;
}
OUString
getTextLabelString
(
const
FixedNumberFormatter
&
rFixedNumberFormatter
,
const
uno
::
Sequence
<
OUString
>*
pCategories
,
const
TickInfo
*
pTickInfo
,
bool
bComplexCat
,
sal_Int32
&
rExtraColor
,
bool
&
rHasExtraColor
)
{
if
(
pCategories
)
{
// This is a normal category axis. Get the label string from the
// label string array.
sal_Int32
nIndex
=
static_cast
<
sal_Int32
>
(
pTickInfo
->
getUnscaledTickValue
())
-
1
;
//first category (index 0) matches with real number 1.0
if
(
nIndex
>=
0
&&
nIndex
<
pCategories
->
getLength
()
)
return
(
*
pCategories
)[
nIndex
];
return
OUString
();
}
else
if
(
bComplexCat
)
{
// This is a complex category axis. The label is stored in the tick.
return
pTickInfo
->
aText
;
}
// This is a numeric axis. Format the original tick value per number format.
return
rFixedNumberFormatter
.
getFormattedString
(
pTickInfo
->
getUnscaledTickValue
(),
rExtraColor
,
rHasExtraColor
);
}
void
getAxisLabelProperties
(
tNameSequence
&
rPropNames
,
tAnySequence
&
rPropValues
,
const
AxisProperties
&
rAxisProp
,
const
AxisLabelProperties
&
rAxisLabelProp
,
sal_Int32
nLimitedSpaceForText
,
bool
bLimitedHeight
)
{
Reference
<
beans
::
XPropertySet
>
xProps
(
rAxisProp
.
m_xAxisModel
,
uno
::
UNO_QUERY
);
PropertyMapper
::
getTextLabelMultiPropertyLists
(
xProps
,
rPropNames
,
rPropValues
,
false
,
nLimitedSpaceForText
,
bLimitedHeight
);
LabelPositionHelper
::
doDynamicFontResize
(
rPropValues
,
rPropNames
,
xProps
,
rAxisLabelProp
.
m_aFontReferenceSize
);
LabelPositionHelper
::
changeTextAdjustment
(
rPropValues
,
rPropNames
,
rAxisProp
.
maLabelAlignment
.
meAlignment
);
}
/**
* Iterate through only the first 2 and last 2 tick info items, and the tick
* that has the longest text (in terms of character length) in case it's not
...
...
@@ -644,17 +685,12 @@ bool VCartesianAxis::createTextShapes(
const
TickInfo
*
pPREPreviousVisibleTickInfo
=
NULL
;
const
TickInfo
*
pLastVisibleNeighbourTickInfo
=
NULL
;
bool
bLimitedHeight
=
fabs
(
aTextToTickDistance
.
getX
())
>
fabs
(
aTextToTickDistance
.
getY
());
//prepare properties for multipropertyset-interface of shape
tNameSequence
aPropNames
;
tAnySequence
aPropValues
;
bool
bLimitedHeight
=
fabs
(
aTextToTickDistance
.
getX
())
>
fabs
(
aTextToTickDistance
.
getY
());
Reference
<
beans
::
XPropertySet
>
xProps
(
m_aAxisProperties
.
m_xAxisModel
,
uno
::
UNO_QUERY
);
PropertyMapper
::
getTextLabelMultiPropertyLists
(
xProps
,
aPropNames
,
aPropValues
,
false
,
nLimitedSpaceForText
,
bLimitedHeight
);
LabelPositionHelper
::
doDynamicFontResize
(
aPropValues
,
aPropNames
,
xProps
,
m_aAxisLabelProperties
.
m_aFontReferenceSize
);
LabelPositionHelper
::
changeTextAdjustment
(
aPropValues
,
aPropNames
,
m_aAxisProperties
.
maLabelAlignment
.
meAlignment
);
getAxisLabelProperties
(
aPropNames
,
aPropValues
,
m_aAxisProperties
,
rAxisLabelProperties
,
nLimitedSpaceForText
,
bLimitedHeight
);
uno
::
Any
*
pColorAny
=
PropertyMapper
::
getValuePointer
(
aPropValues
,
aPropNames
,
"CharColor"
);
sal_Int32
nColor
=
Color
(
COL_AUTO
).
GetColor
();
...
...
@@ -725,25 +761,9 @@ bool VCartesianAxis::createTextShapes(
bool
bHasExtraColor
=
false
;
sal_Int32
nExtraColor
=
0
;
OUString
aLabel
;
if
(
pCategories
)
{
// This is a normal category axis. Get the label string from the
// label string array.
sal_Int32
nIndex
=
static_cast
<
sal_Int32
>
(
pTickInfo
->
getUnscaledTickValue
())
-
1
;
//first category (index 0) matches with real number 1.0
if
(
nIndex
>=
0
&&
nIndex
<
pCategories
->
getLength
()
)
aLabel
=
(
*
pCategories
)[
nIndex
];
}
else
if
(
m_aAxisProperties
.
m_bComplexCategories
)
{
// This is a complex category axis. The label is stored in the tick.
aLabel
=
pTickInfo
->
aText
;
}
else
{
// This is a numeric axis. Format the original tick value per number format.
aLabel
=
aFixedNumberFormatter
.
getFormattedString
(
pTickInfo
->
getUnscaledTickValue
(),
nExtraColor
,
bHasExtraColor
);
}
OUString
aLabel
=
getTextLabelString
(
aFixedNumberFormatter
,
pCategories
,
pTickInfo
,
isComplexCategoryAxis
(),
nExtraColor
,
bHasExtraColor
);
if
(
pColorAny
)
*
pColorAny
=
uno
::
makeAny
(
bHasExtraColor
?
nExtraColor
:
nColor
);
...
...
@@ -810,10 +830,7 @@ bool VCartesianAxis::createTextShapes(
// Try auto-rotating the labels at 45 degrees and
// start over. This rotation angle will be stored for
// all future text shape creation runs.
rAxisLabelProperties
.
fRotationAngleDegree
=
45
;
rAxisLabelProperties
.
bLineBreakAllowed
=
false
;
rAxisLabelProperties
.
eStaggering
=
SIDE_BY_SIDE
;
rAxisLabelProperties
.
autoRotate45
();
m_aAxisLabelProperties
.
fRotationAngleDegree
=
rAxisLabelProperties
.
fRotationAngleDegree
;
// Store it for future runs.
removeTextShapesFromTicks
();
return
false
;
...
...
@@ -862,17 +879,12 @@ bool VCartesianAxis::createTextShapesSimple(
const
TickInfo
*
pPreviousVisibleTickInfo
=
NULL
;
const
TickInfo
*
pLastVisibleNeighbourTickInfo
=
NULL
;
bool
bLimitedHeight
=
fabs
(
aTextToTickDistance
.
getX
())
>
fabs
(
aTextToTickDistance
.
getY
());
//prepare properties for multipropertyset-interface of shape
tNameSequence
aPropNames
;
tAnySequence
aPropValues
;
bool
bLimitedHeight
=
fabs
(
aTextToTickDistance
.
getX
())
>
fabs
(
aTextToTickDistance
.
getY
());
Reference
<
beans
::
XPropertySet
>
xProps
(
m_aAxisProperties
.
m_xAxisModel
,
uno
::
UNO_QUERY
);
PropertyMapper
::
getTextLabelMultiPropertyLists
(
xProps
,
aPropNames
,
aPropValues
,
false
,
-
1
,
bLimitedHeight
);
LabelPositionHelper
::
doDynamicFontResize
(
aPropValues
,
aPropNames
,
xProps
,
m_aAxisLabelProperties
.
m_aFontReferenceSize
);
LabelPositionHelper
::
changeTextAdjustment
(
aPropValues
,
aPropNames
,
m_aAxisProperties
.
maLabelAlignment
.
meAlignment
);
getAxisLabelProperties
(
aPropNames
,
aPropValues
,
m_aAxisProperties
,
rAxisLabelProperties
,
-
1
,
bLimitedHeight
);
uno
::
Any
*
pColorAny
=
PropertyMapper
::
getValuePointer
(
aPropValues
,
aPropNames
,
"CharColor"
);
sal_Int32
nColor
=
Color
(
COL_AUTO
).
GetColor
();
...
...
@@ -921,25 +933,9 @@ bool VCartesianAxis::createTextShapesSimple(
bool
bHasExtraColor
=
false
;
sal_Int32
nExtraColor
=
0
;
OUString
aLabel
;
if
(
pCategories
)
{
// This is a normal category axis. Get the label string from the
// label string array.
sal_Int32
nIndex
=
static_cast
<
sal_Int32
>
(
pTickInfo
->
getUnscaledTickValue
())
-
1
;
//first category (index 0) matches with real number 1.0
if
(
nIndex
>=
0
&&
nIndex
<
pCategories
->
getLength
()
)
aLabel
=
(
*
pCategories
)[
nIndex
];
}
else
if
(
m_aAxisProperties
.
m_bComplexCategories
)
{
// This is a complex category axis. The label is stored in the tick.
aLabel
=
pTickInfo
->
aText
;
}
else
{
// This is a numeric axis. Format the original tick value per number format.
aLabel
=
aFixedNumberFormatter
.
getFormattedString
(
pTickInfo
->
getUnscaledTickValue
(),
nExtraColor
,
bHasExtraColor
);
}
OUString
aLabel
=
getTextLabelString
(
aFixedNumberFormatter
,
pCategories
,
pTickInfo
,
isComplexCategoryAxis
(),
nExtraColor
,
bHasExtraColor
);
if
(
pColorAny
)
*
pColorAny
=
uno
::
makeAny
(
bHasExtraColor
?
nExtraColor
:
nColor
);
...
...
@@ -975,10 +971,7 @@ bool VCartesianAxis::createTextShapesSimple(
// Try auto-rotating the labels at 45 degrees and
// start over. This rotation angle will be stored for
// all future text shape creation runs.
rAxisLabelProperties
.
fRotationAngleDegree
=
45
;
rAxisLabelProperties
.
bLineBreakAllowed
=
false
;
rAxisLabelProperties
.
eStaggering
=
SIDE_BY_SIDE
;
rAxisLabelProperties
.
autoRotate45
();
m_aAxisLabelProperties
.
fRotationAngleDegree
=
rAxisLabelProperties
.
fRotationAngleDegree
;
// Store it for future runs.
removeTextShapesFromTicks
();
return
false
;
...
...
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