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
11699eb8
Kaydet (Commit)
11699eb8
authored
Eki 08, 2013
tarafından
Markus Mohrhard
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
no createInstance calls any more in chart2/source/view creating shapes
Change-Id: I7978d607ecd9170fff37ff0be02cdfbec7ebb89b
üst
a66097b7
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
221 additions
and
160 deletions
+221
-160
AbstractShapeFactory.hxx
chart2/source/view/inc/AbstractShapeFactory.hxx
+14
-2
DummyShapeFactory.hxx
chart2/source/view/inc/DummyShapeFactory.hxx
+9
-0
ShapeFactory.hxx
chart2/source/view/inc/ShapeFactory.hxx
+9
-0
DummyShapeFactory.cxx
chart2/source/view/main/DummyShapeFactory.cxx
+11
-0
ShapeFactory.cxx
chart2/source/view/main/ShapeFactory.cxx
+159
-0
VTitle.cxx
chart2/source/view/main/VTitle.cxx
+19
-158
No files found.
chart2/source/view/inc/AbstractShapeFactory.hxx
Dosyayı görüntüle @
11699eb8
...
...
@@ -13,19 +13,22 @@
#include "PropertyMapper.hxx"
#include "VLineProperties.hxx"
#include "BaseGFXHelper.hxx"
#include <com/sun/star/awt/Size.hpp>
#include <com/sun/star/awt/Point.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/chart2/XFormattedString.hpp>
#include <com/sun/star/drawing/Direction3D.hpp>
#include <com/sun/star/drawing/HomogenMatrix.hpp>
#include <com/sun/star/drawing/PointSequenceSequence.hpp>
#include <com/sun/star/drawing/PolyPolygonShape3D.hpp>
#include <com/sun/star/drawing/Position3D.hpp>
#include <com/sun/star/awt/Size.hpp>
#include <com/sun/star/awt/Point.hpp>
#include <com/sun/star/drawing/XDrawPage.hpp>
#include <com/sun/star/drawing/XShapes.hpp>
#include <com/sun/star/graphic/XGraphic.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <rtl/ustring.hxx>
namespace
chart
{
...
...
@@ -189,6 +192,15 @@ public:
,
const
::
com
::
sun
::
star
::
uno
::
Any
&
rATransformation
)
=
0
;
virtual
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
drawing
::
XShape
>
createText
(
const
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
drawing
::
XShapes
>&
xTarget2D
,
const
com
::
sun
::
star
::
awt
::
Size
&
rSize
,
const
com
::
sun
::
star
::
awt
::
Point
&
rPosition
,
com
::
sun
::
star
::
uno
::
Sequence
<
com
::
sun
::
star
::
uno
::
Reference
<
com
::
sun
::
star
::
chart2
::
XFormattedString
>
>
xFormattedString
,
const
com
::
sun
::
star
::
uno
::
Reference
<
com
::
sun
::
star
::
beans
::
XPropertySet
>
xTextProperties
,
double
nRotation
,
const
OUString
&
aName
)
=
0
;
virtual
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
drawing
::
XShape
>
createInvisibleRectangle
(
const
::
com
::
sun
::
star
::
uno
::
Reference
<
...
...
chart2/source/view/inc/DummyShapeFactory.hxx
Dosyayı görüntüle @
11699eb8
...
...
@@ -145,6 +145,15 @@ public:
,
const
::
com
::
sun
::
star
::
uno
::
Any
&
rATransformation
);
virtual
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
drawing
::
XShape
>
createText
(
const
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
drawing
::
XShapes
>&
xTarget2D
,
const
com
::
sun
::
star
::
awt
::
Size
&
rSize
,
const
com
::
sun
::
star
::
awt
::
Point
&
rPosition
,
com
::
sun
::
star
::
uno
::
Sequence
<
com
::
sun
::
star
::
uno
::
Reference
<
com
::
sun
::
star
::
chart2
::
XFormattedString
>
>
xFormattedString
,
const
com
::
sun
::
star
::
uno
::
Reference
<
com
::
sun
::
star
::
beans
::
XPropertySet
>
xTextProperties
,
double
nRotation
,
const
OUString
&
aName
);
virtual
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
drawing
::
XShape
>
createInvisibleRectangle
(
const
::
com
::
sun
::
star
::
uno
::
Reference
<
...
...
chart2/source/view/inc/ShapeFactory.hxx
Dosyayı görüntüle @
11699eb8
...
...
@@ -160,6 +160,15 @@ public:
,
const
::
com
::
sun
::
star
::
uno
::
Any
&
rATransformation
);
virtual
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
drawing
::
XShape
>
createText
(
const
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
drawing
::
XShapes
>&
xTarget2D
,
const
com
::
sun
::
star
::
awt
::
Size
&
rSize
,
const
com
::
sun
::
star
::
awt
::
Point
&
rPosition
,
com
::
sun
::
star
::
uno
::
Sequence
<
com
::
sun
::
star
::
uno
::
Reference
<
com
::
sun
::
star
::
chart2
::
XFormattedString
>
>
xFormattedString
,
const
com
::
sun
::
star
::
uno
::
Reference
<
com
::
sun
::
star
::
beans
::
XPropertySet
>
xTextProperties
,
double
nRotation
,
const
OUString
&
aName
);
virtual
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
drawing
::
XShape
>
createInvisibleRectangle
(
const
::
com
::
sun
::
star
::
uno
::
Reference
<
...
...
chart2/source/view/main/DummyShapeFactory.cxx
Dosyayı görüntüle @
11699eb8
...
...
@@ -269,6 +269,17 @@ uno::Reference< drawing::XShape >
return
new
DummyXShape
();
}
uno
::
Reference
<
drawing
::
XShape
>
DummyShapeFactory
::
createText
(
const
uno
::
Reference
<
drawing
::
XShapes
>&
,
const
awt
::
Size
&
,
const
awt
::
Point
&
,
uno
::
Sequence
<
uno
::
Reference
<
chart2
::
XFormattedString
>
>
,
const
uno
::
Reference
<
beans
::
XPropertySet
>
,
double
,
const
OUString
&
)
{
return
new
DummyXShape
();
}
}
//namespace dummy
}
//namespace chart
...
...
chart2/source/view/main/ShapeFactory.cxx
Dosyayı görüntüle @
11699eb8
...
...
@@ -22,6 +22,7 @@
#include "Stripe.hxx"
#include "CommonConverters.hxx"
#include "macros.hxx"
#include "RelativeSizeHelper.hxx"
#include "PropertyMapper.hxx"
#include <comphelper/InlineContainer.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
...
...
@@ -37,7 +38,9 @@
#include <com/sun/star/drawing/ProjectionMode.hpp>
#include <com/sun/star/drawing/ShadeMode.hpp>
#include <com/sun/star/drawing/TextFitToSizeType.hpp>
#include <com/sun/star/drawing/TextHorizontalAdjust.hpp>
#include <com/sun/star/drawing/TextureProjectionMode.hpp>
#include <com/sun/star/drawing/TextVerticalAdjust.hpp>
#include <com/sun/star/text/XText.hpp>
#include <com/sun/star/uno/Any.hxx>
...
...
@@ -2116,6 +2119,162 @@ uno::Reference< drawing::XShape >
return
xShape
;
}
uno
::
Reference
<
drawing
::
XShape
>
ShapeFactory
::
createText
(
const
uno
::
Reference
<
drawing
::
XShapes
>&
xTarget
,
const
awt
::
Size
&
rSize
,
const
awt
::
Point
&
rPos
,
uno
::
Sequence
<
uno
::
Reference
<
chart2
::
XFormattedString
>
>
xFormattedString
,
const
uno
::
Reference
<
beans
::
XPropertySet
>
xTextProperties
,
double
nRotation
,
const
OUString
&
aName
)
{
//create shape and add to page
uno
::
Reference
<
drawing
::
XShape
>
xShape
(
m_xShapeFactory
->
createInstance
(
"com.sun.star.drawing.TextShape"
),
uno
::
UNO_QUERY
);
try
{
xTarget
->
add
(
xShape
);
//set text and text properties
uno
::
Reference
<
text
::
XText
>
xText
(
xShape
,
uno
::
UNO_QUERY
);
uno
::
Reference
<
text
::
XTextCursor
>
xTextCursor
(
xText
->
createTextCursor
()
);
uno
::
Reference
<
text
::
XTextRange
>
xTextRange
(
xTextCursor
,
uno
::
UNO_QUERY
);
uno
::
Reference
<
beans
::
XPropertySet
>
xShapeProp
(
xShape
,
uno
::
UNO_QUERY
);
if
(
!
xText
.
is
()
||
!
xTextRange
.
is
()
||
!
xTextCursor
.
is
()
||
!
xShapeProp
.
is
()
||
!
xTextProperties
.
is
()
)
return
xShape
;
tPropertyNameValueMap
aValueMap
;
//fill line-, fill- and paragraph-properties into the ValueMap
{
tMakePropertyNameMap
aNameMap
=
PropertyMapper
::
getPropertyNameMapForParagraphProperties
();
aNameMap
(
PropertyMapper
::
getPropertyNameMapForFillAndLineProperties
()
);
PropertyMapper
::
getValueMap
(
aValueMap
,
aNameMap
,
xTextProperties
);
}
//fill some more shape properties into the ValueMap
{
drawing
::
TextHorizontalAdjust
eHorizontalAdjust
=
drawing
::
TextHorizontalAdjust_CENTER
;
drawing
::
TextVerticalAdjust
eVerticalAdjust
=
drawing
::
TextVerticalAdjust_CENTER
;
aValueMap
.
insert
(
tPropertyNameValueMap
::
value_type
(
"TextHorizontalAdjust"
,
uno
::
makeAny
(
eHorizontalAdjust
)
)
);
// drawing::TextHorizontalAdjust
aValueMap
.
insert
(
tPropertyNameValueMap
::
value_type
(
"TextVerticalAdjust"
,
uno
::
makeAny
(
eVerticalAdjust
)
)
);
//drawing::TextVerticalAdjust
aValueMap
.
insert
(
tPropertyNameValueMap
::
value_type
(
"TextAutoGrowHeight"
,
uno
::
makeAny
(
sal_True
)
)
);
// sal_Bool
aValueMap
.
insert
(
tPropertyNameValueMap
::
value_type
(
"TextAutoGrowWidth"
,
uno
::
makeAny
(
sal_True
)
)
);
// sal_Bool
//set name/classified ObjectID (CID)
if
(
!
aName
.
isEmpty
()
)
aValueMap
.
insert
(
tPropertyNameValueMap
::
value_type
(
"Name"
,
uno
::
makeAny
(
aName
)
)
);
//CID OUString
}
//set global title properties
{
tNameSequence
aPropNames
;
tAnySequence
aPropValues
;
PropertyMapper
::
getMultiPropertyListsFromValueMap
(
aPropNames
,
aPropValues
,
aValueMap
);
PropertyMapper
::
setMultiProperties
(
aPropNames
,
aPropValues
,
xShapeProp
);
}
sal_Bool
bStackCharacters
(
sal_False
);
try
{
xTextProperties
->
getPropertyValue
(
"StackCharacters"
)
>>=
bStackCharacters
;
}
catch
(
const
uno
::
Exception
&
e
)
{
ASSERT_EXCEPTION
(
e
);
}
if
(
bStackCharacters
)
{
//if the characters should be stacked we use only the first character properties for code simplicity
if
(
xFormattedString
.
getLength
()
>
0
)
{
OUString
aLabel
;
for
(
sal_Int32
nN
=
0
;
nN
<
xFormattedString
.
getLength
();
nN
++
)
aLabel
+=
xFormattedString
[
nN
]
->
getString
();
aLabel
=
ShapeFactory
::
getStackedString
(
aLabel
,
bStackCharacters
);
xTextCursor
->
gotoEnd
(
false
);
xText
->
insertString
(
xTextRange
,
aLabel
,
false
);
xTextCursor
->
gotoEnd
(
true
);
uno
::
Reference
<
beans
::
XPropertySet
>
xTargetProps
(
xShape
,
uno
::
UNO_QUERY
);
uno
::
Reference
<
beans
::
XPropertySet
>
xSourceProps
(
xFormattedString
[
0
],
uno
::
UNO_QUERY
);
PropertyMapper
::
setMappedProperties
(
xTargetProps
,
xSourceProps
,
PropertyMapper
::
getPropertyNameMapForCharacterProperties
()
);
// adapt font size according to page size
awt
::
Size
aOldRefSize
;
if
(
xTextProperties
->
getPropertyValue
(
"ReferencePageSize"
)
>>=
aOldRefSize
)
{
RelativeSizeHelper
::
adaptFontSizes
(
xTargetProps
,
aOldRefSize
,
rSize
);
}
}
}
else
{
uno
::
Sequence
<
uno
::
Reference
<
text
::
XTextCursor
>
>
aCursorList
(
xFormattedString
.
getLength
()
);
sal_Int32
nN
=
0
;
for
(
nN
=
0
;
nN
<
xFormattedString
.
getLength
();
nN
++
)
{
xTextCursor
->
gotoEnd
(
false
);
xText
->
insertString
(
xTextRange
,
xFormattedString
[
nN
]
->
getString
(),
false
);
xTextCursor
->
gotoEnd
(
true
);
aCursorList
[
nN
]
=
xText
->
createTextCursorByRange
(
uno
::
Reference
<
text
::
XTextRange
>
(
xTextCursor
,
uno
::
UNO_QUERY
)
);
}
awt
::
Size
aOldRefSize
;
bool
bHasRefPageSize
=
(
xTextProperties
->
getPropertyValue
(
"ReferencePageSize"
)
>>=
aOldRefSize
);
if
(
xFormattedString
.
getLength
()
>
0
)
{
uno
::
Reference
<
beans
::
XPropertySet
>
xTargetProps
(
xShape
,
uno
::
UNO_QUERY
);
uno
::
Reference
<
beans
::
XPropertySet
>
xSourceProps
(
xFormattedString
[
0
],
uno
::
UNO_QUERY
);
PropertyMapper
::
setMappedProperties
(
xTargetProps
,
xSourceProps
,
PropertyMapper
::
getPropertyNameMapForCharacterProperties
()
);
// adapt font size according to page size
if
(
bHasRefPageSize
)
{
RelativeSizeHelper
::
adaptFontSizes
(
xTargetProps
,
aOldRefSize
,
rSize
);
}
}
}
// #i109336# Improve auto positioning in chart
float
fFontHeight
=
0.0
;
if
(
xShapeProp
.
is
()
&&
(
xShapeProp
->
getPropertyValue
(
"CharHeight"
)
>>=
fFontHeight
)
)
{
fFontHeight
*=
(
2540.0
f
/
72.0
f
);
// pt -> 1/100 mm
float
fXFraction
=
0.18
f
;
sal_Int32
nXDistance
=
static_cast
<
sal_Int32
>
(
::
rtl
::
math
::
round
(
fFontHeight
*
fXFraction
)
);
float
fYFraction
=
0.30
f
;
sal_Int32
nYDistance
=
static_cast
<
sal_Int32
>
(
::
rtl
::
math
::
round
(
fFontHeight
*
fYFraction
)
);
xShapeProp
->
setPropertyValue
(
"TextLeftDistance"
,
uno
::
makeAny
(
nXDistance
)
);
xShapeProp
->
setPropertyValue
(
"TextRightDistance"
,
uno
::
makeAny
(
nXDistance
)
);
xShapeProp
->
setPropertyValue
(
"TextUpperDistance"
,
uno
::
makeAny
(
nYDistance
)
);
xShapeProp
->
setPropertyValue
(
"TextLowerDistance"
,
uno
::
makeAny
(
nYDistance
)
);
}
sal_Int32
nXPos
=
rPos
.
X
;
sal_Int32
nYPos
=
rPos
.
Y
;
//set position matrix
//the matrix needs to be set at the end behind autogrow and such position influencing properties
::
basegfx
::
B2DHomMatrix
aM
;
aM
.
rotate
(
-
nRotation
*
F_PI
/
180.0
);
//#i78696#->#i80521#
aM
.
translate
(
nXPos
,
nYPos
);
xShapeProp
->
setPropertyValue
(
"Transformation"
,
uno
::
makeAny
(
B2DHomMatrixToHomogenMatrix3
(
aM
)
)
);
}
catch
(
const
uno
::
Exception
&
e
)
{
ASSERT_EXCEPTION
(
e
);
}
return
xShape
;
}
}
//namespace chart
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
chart2/source/view/main/VTitle.cxx
Dosyayı görüntüle @
11699eb8
...
...
@@ -21,13 +21,10 @@
#include "CommonConverters.hxx"
#include "macros.hxx"
#include "PropertyMapper.hxx"
#include "ShapeFactory.hxx"
#include "RelativeSizeHelper.hxx"
#include "AbstractShapeFactory.hxx"
#include <com/sun/star/chart2/XFormattedString.hpp>
#include <rtl/math.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/drawing/TextVerticalAdjust.hpp>
#include <com/sun/star/drawing/TextHorizontalAdjust.hpp>
#include <com/sun/star/text/ControlCharacter.hpp>
#include <com/sun/star/text/XText.hpp>
#include <com/sun/star/text/XTextCursor.hpp>
...
...
@@ -78,7 +75,7 @@ awt::Size VTitle::getUnrotatedSize() const //size before rotation
awt
::
Size
VTitle
::
getFinalSize
()
const
//size after rotation
{
return
ShapeFactory
::
getSizeAfterRotation
(
return
Abstract
ShapeFactory
::
getSizeAfterRotation
(
m_xShape
,
m_fRotationAngleDegree
);
}
...
...
@@ -111,168 +108,32 @@ void VTitle::createShapes(
const
awt
::
Point
&
rPos
,
const
awt
::
Size
&
rReferenceSize
)
{
try
{
if
(
!
m_xTitle
.
is
())
return
;
uno
::
Sequence
<
uno
::
Reference
<
XFormattedString
>
>
aStringList
=
m_xTitle
->
getText
();
if
(
aStringList
.
getLength
()
<=
0
)
return
;
//create shape and add to page
uno
::
Reference
<
drawing
::
XShape
>
xShape
(
m_xShapeFactory
->
createInstance
(
"com.sun.star.drawing.TextShape"
),
uno
::
UNO_QUERY
);
m_xTarget
->
add
(
xShape
);
m_xShape
=
xShape
;
//set text and text properties
uno
::
Reference
<
text
::
XText
>
xText
(
xShape
,
uno
::
UNO_QUERY
);
uno
::
Reference
<
text
::
XTextCursor
>
xTextCursor
(
xText
->
createTextCursor
()
);
uno
::
Reference
<
text
::
XTextRange
>
xTextRange
(
xTextCursor
,
uno
::
UNO_QUERY
);
uno
::
Reference
<
beans
::
XPropertySet
>
xShapeProp
(
xShape
,
uno
::
UNO_QUERY
);
uno
::
Reference
<
beans
::
XPropertySet
>
xTitleProperties
(
m_xTitle
,
uno
::
UNO_QUERY
);
if
(
!
xText
.
is
()
||
!
xTextRange
.
is
()
||
!
xTextCursor
.
is
()
||
!
xShapeProp
.
is
()
||
!
xTitleProperties
.
is
()
)
return
;
tPropertyNameValueMap
aValueMap
;
//fill line-, fill- and paragraph-properties into the ValueMap
{
tMakePropertyNameMap
aNameMap
=
PropertyMapper
::
getPropertyNameMapForParagraphProperties
();
aNameMap
(
PropertyMapper
::
getPropertyNameMapForFillAndLineProperties
()
);
PropertyMapper
::
getValueMap
(
aValueMap
,
aNameMap
,
xTitleProperties
);
}
//fill some more shape properties into the ValueMap
{
drawing
::
TextHorizontalAdjust
eHorizontalAdjust
=
drawing
::
TextHorizontalAdjust_CENTER
;
drawing
::
TextVerticalAdjust
eVerticalAdjust
=
drawing
::
TextVerticalAdjust_CENTER
;
aValueMap
.
insert
(
tPropertyNameValueMap
::
value_type
(
"TextHorizontalAdjust"
,
uno
::
makeAny
(
eHorizontalAdjust
)
)
);
// drawing::TextHorizontalAdjust
aValueMap
.
insert
(
tPropertyNameValueMap
::
value_type
(
"TextVerticalAdjust"
,
uno
::
makeAny
(
eVerticalAdjust
)
)
);
//drawing::TextVerticalAdjust
aValueMap
.
insert
(
tPropertyNameValueMap
::
value_type
(
"TextAutoGrowHeight"
,
uno
::
makeAny
(
sal_True
)
)
);
// sal_Bool
aValueMap
.
insert
(
tPropertyNameValueMap
::
value_type
(
"TextAutoGrowWidth"
,
uno
::
makeAny
(
sal_True
)
)
);
// sal_Bool
//set name/classified ObjectID (CID)
if
(
!
m_aCID
.
isEmpty
()
)
aValueMap
.
insert
(
tPropertyNameValueMap
::
value_type
(
"Name"
,
uno
::
makeAny
(
m_aCID
)
)
);
//CID OUString
}
//set global title properties
{
tNameSequence
aPropNames
;
tAnySequence
aPropValues
;
PropertyMapper
::
getMultiPropertyListsFromValueMap
(
aPropNames
,
aPropValues
,
aValueMap
);
PropertyMapper
::
setMultiProperties
(
aPropNames
,
aPropValues
,
xShapeProp
);
}
sal_Bool
bStackCharacters
(
sal_False
);
try
{
xTitleProperties
->
getPropertyValue
(
"StackCharacters"
)
>>=
bStackCharacters
;
}
catch
(
const
uno
::
Exception
&
e
)
{
ASSERT_EXCEPTION
(
e
);
}
if
(
bStackCharacters
)
{
//if the characters should be stacked we use only the first character properties for code simplicity
if
(
aStringList
.
getLength
()
>
0
)
{
OUString
aLabel
;
for
(
sal_Int32
nN
=
0
;
nN
<
aStringList
.
getLength
();
nN
++
)
aLabel
+=
aStringList
[
nN
]
->
getString
();
aLabel
=
ShapeFactory
::
getStackedString
(
aLabel
,
bStackCharacters
);
xTextCursor
->
gotoEnd
(
false
);
xText
->
insertString
(
xTextRange
,
aLabel
,
false
);
xTextCursor
->
gotoEnd
(
true
);
uno
::
Reference
<
beans
::
XPropertySet
>
xTargetProps
(
xShape
,
uno
::
UNO_QUERY
);
uno
::
Reference
<
beans
::
XPropertySet
>
xSourceProps
(
aStringList
[
0
],
uno
::
UNO_QUERY
);
PropertyMapper
::
setMappedProperties
(
xTargetProps
,
xSourceProps
,
PropertyMapper
::
getPropertyNameMapForCharacterProperties
()
);
// adapt font size according to page size
awt
::
Size
aOldRefSize
;
if
(
xTitleProperties
->
getPropertyValue
(
"ReferencePageSize"
)
>>=
aOldRefSize
)
{
RelativeSizeHelper
::
adaptFontSizes
(
xTargetProps
,
aOldRefSize
,
rReferenceSize
);
}
}
}
else
{
uno
::
Sequence
<
uno
::
Reference
<
text
::
XTextCursor
>
>
aCursorList
(
aStringList
.
getLength
()
);
sal_Int32
nN
=
0
;
for
(
nN
=
0
;
nN
<
aStringList
.
getLength
();
nN
++
)
{
xTextCursor
->
gotoEnd
(
false
);
xText
->
insertString
(
xTextRange
,
aStringList
[
nN
]
->
getString
(),
false
);
xTextCursor
->
gotoEnd
(
true
);
aCursorList
[
nN
]
=
xText
->
createTextCursorByRange
(
uno
::
Reference
<
text
::
XTextRange
>
(
xTextCursor
,
uno
::
UNO_QUERY
)
);
}
awt
::
Size
aOldRefSize
;
bool
bHasRefPageSize
=
(
xTitleProperties
->
getPropertyValue
(
"ReferencePageSize"
)
>>=
aOldRefSize
);
if
(
!
m_xTitle
.
is
())
return
;
if
(
aStringList
.
getLength
()
>
0
)
{
uno
::
Reference
<
beans
::
XPropertySet
>
xTargetProps
(
xShape
,
uno
::
UNO_QUERY
);
uno
::
Reference
<
beans
::
XPropertySet
>
xSourceProps
(
aStringList
[
0
],
uno
::
UNO_QUERY
);
PropertyMapper
::
setMappedProperties
(
xTargetProps
,
xSourceProps
,
PropertyMapper
::
getPropertyNameMapForCharacterProperties
()
);
uno
::
Sequence
<
uno
::
Reference
<
XFormattedString
>
>
aStringList
=
m_xTitle
->
getText
();
if
(
aStringList
.
getLength
()
<=
0
)
return
;
// adapt font size according to page size
if
(
bHasRefPageSize
)
{
RelativeSizeHelper
::
adaptFontSizes
(
xTargetProps
,
aOldRefSize
,
rReferenceSize
);
}
}
}
m_nXPos
=
rPos
.
X
;
m_nYPos
=
rPos
.
Y
;
// #i109336# Improve auto positioning in chart
float
fFontHeight
=
0.0
;
if
(
xShapeProp
.
is
()
&&
(
xShapeProp
->
getPropertyValue
(
"CharHeight"
)
>>=
fFontHeight
)
)
{
fFontHeight
*=
(
2540.0
f
/
72.0
f
);
// pt -> 1/100 mm
float
fXFraction
=
0.18
f
;
sal_Int32
nXDistance
=
static_cast
<
sal_Int32
>
(
::
rtl
::
math
::
round
(
fFontHeight
*
fXFraction
)
);
float
fYFraction
=
0.30
f
;
sal_Int32
nYDistance
=
static_cast
<
sal_Int32
>
(
::
rtl
::
math
::
round
(
fFontHeight
*
fYFraction
)
);
xShapeProp
->
setPropertyValue
(
"TextLeftDistance"
,
uno
::
makeAny
(
nXDistance
)
);
xShapeProp
->
setPropertyValue
(
"TextRightDistance"
,
uno
::
makeAny
(
nXDistance
)
);
xShapeProp
->
setPropertyValue
(
"TextUpperDistance"
,
uno
::
makeAny
(
nYDistance
)
);
xShapeProp
->
setPropertyValue
(
"TextLowerDistance"
,
uno
::
makeAny
(
nYDistance
)
);
}
uno
::
Reference
<
beans
::
XPropertySet
>
xTitleProperties
(
m_xTitle
,
uno
::
UNO_QUERY
);
try
{
double
fAngleDegree
=
0
;
xTitleProperties
->
getPropertyValue
(
"TextRotation"
)
>>=
fAngleDegree
;
m_fRotationAngleDegree
+=
fAngleDegree
;
}
catch
(
const
uno
::
Exception
&
e
)
{
ASSERT_EXCEPTION
(
e
);
}
m_nXPos
=
rPos
.
X
;
m_nYPos
=
rPos
.
Y
;
//set position matrix
//the matrix needs to be set at the end behind autogrow and such position influencing properties
::
basegfx
::
B2DHomMatrix
aM
;
aM
.
rotate
(
-
m_fRotationAngleDegree
*
F_PI
/
180.0
);
//#i78696#->#i80521#
aM
.
translate
(
m_nXPos
,
m_nYPos
);
xShapeProp
->
setPropertyValue
(
"Transformation"
,
uno
::
makeAny
(
B2DHomMatrixToHomogenMatrix3
(
aM
)
)
);
try
{
double
fAngleDegree
=
0
;
xTitleProperties
->
getPropertyValue
(
"TextRotation"
)
>>=
fAngleDegree
;
m_fRotationAngleDegree
+=
fAngleDegree
;
}
catch
(
const
uno
::
Exception
&
e
)
{
ASSERT_EXCEPTION
(
e
);
}
AbstractShapeFactory
*
pShapeFactory
=
AbstractShapeFactory
::
getOrCreateShapeFactory
(
m_xShapeFactory
);
m_xShape
=
pShapeFactory
->
createText
(
m_xTarget
,
rReferenceSize
,
rPos
,
aStringList
,
xTitleProperties
,
m_fRotationAngleDegree
,
m_aCID
);
}
}
//namespace chart
...
...
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