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
bc5060b3
Kaydet (Commit)
bc5060b3
authored
Mar 26, 2014
tarafından
Miklos Vajna
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
RTF import: handle Relative{Height,Width}{,Relation}
Change-Id: Ic3a578af9c0808b188a4d196b1c132c0b23f15f7
üst
3952fab4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
108 additions
and
0 deletions
+108
-0
relsize.rtf
sw/qa/extras/rtfimport/data/relsize.rtf
+42
-0
rtfimport.cxx
sw/qa/extras/rtfimport/rtfimport.cxx
+9
-0
rtfsdrimport.cxx
writerfilter/source/rtftok/rtfsdrimport.cxx
+57
-0
No files found.
sw/qa/extras/rtfimport/data/relsize.rtf
0 → 100644
Dosyayı görüntüle @
bc5060b3
{\rtf1
\paperw12240\paperh15840\margl1417\margr1417\margt1417\margb1417
\pard\plain
{\rtlch
{\shp
{\*\shpinst\shpleft0\shptop0\shpright3739\shpbottom2211\shpwr2\shpwrk0\shpfblwtxt0\shpz0
{\sp
{\sn shapeType}
{\sv 202}
}
{\sp
{\sn posh}
{\sv 2}
}
{\sp
{\sn dhgt}
{\sv 251659264}
}
{\sp
{\sn fBehindDocument}
{\sv 0}
}
{\sp
{\sn pctHoriz}
{\sv 400}
}
{\sp
{\sn pctVert}
{\sv 200}
}
{\sp
{\sn sizerelv}
{\sv 0}
}
{\shptxt Textbox text.
\par}
}
}
}
{Relative height: 20%, margin.\par}
{Relative width: 40%, page.\par}
}
sw/qa/extras/rtfimport/rtfimport.cxx
Dosyayı görüntüle @
bc5060b3
...
@@ -1619,6 +1619,15 @@ DECLARE_RTFIMPORT_TEST(testDprectAnchor, "dprect-anchor.rtf")
...
@@ -1619,6 +1619,15 @@ DECLARE_RTFIMPORT_TEST(testDprectAnchor, "dprect-anchor.rtf")
CPPUNIT_ASSERT_EQUAL
(
text
::
TextContentAnchorType_AT_CHARACTER
,
getProperty
<
text
::
TextContentAnchorType
>
(
getShape
(
1
),
"AnchorType"
));
CPPUNIT_ASSERT_EQUAL
(
text
::
TextContentAnchorType_AT_CHARACTER
,
getProperty
<
text
::
TextContentAnchorType
>
(
getShape
(
1
),
"AnchorType"
));
}
}
DECLARE_RTFIMPORT_TEST
(
testRelsize
,
"relsize.rtf"
)
{
uno
::
Reference
<
drawing
::
XShape
>
xShape
=
getShape
(
1
);
CPPUNIT_ASSERT_EQUAL
(
sal_Int16
(
40
),
getProperty
<
sal_Int16
>
(
xShape
,
"RelativeWidth"
));
CPPUNIT_ASSERT_EQUAL
(
text
::
RelOrientation
::
PAGE_FRAME
,
getProperty
<
sal_Int16
>
(
xShape
,
"RelativeWidthRelation"
));
CPPUNIT_ASSERT_EQUAL
(
sal_Int16
(
20
),
getProperty
<
sal_Int16
>
(
xShape
,
"RelativeHeight"
));
CPPUNIT_ASSERT_EQUAL
(
text
::
RelOrientation
::
FRAME
,
getProperty
<
sal_Int16
>
(
xShape
,
"RelativeHeightRelation"
));
}
CPPUNIT_PLUGIN_IMPLEMENT
();
CPPUNIT_PLUGIN_IMPLEMENT
();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
writerfilter/source/rtftok/rtfsdrimport.cxx
Dosyayı görüntüle @
bc5060b3
...
@@ -242,6 +242,10 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose)
...
@@ -242,6 +242,10 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose)
bool
bOpaque
=
true
;
bool
bOpaque
=
true
;
boost
::
optional
<
sal_Int16
>
oRelativeWidth
,
oRelativeHeight
;
sal_Int16
nRelativeWidthRelation
=
text
::
RelOrientation
::
PAGE_FRAME
;
sal_Int16
nRelativeHeightRelation
=
text
::
RelOrientation
::
PAGE_FRAME
;
// The spec doesn't state what is the default for shapeType, Word seems to implement it as a rectangle.
// The spec doesn't state what is the default for shapeType, Word seems to implement it as a rectangle.
if
(
std
::
find_if
(
rShape
.
aProperties
.
begin
(),
if
(
std
::
find_if
(
rShape
.
aProperties
.
begin
(),
rShape
.
aProperties
.
end
(),
rShape
.
aProperties
.
end
(),
...
@@ -540,6 +544,49 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose)
...
@@ -540,6 +544,49 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose)
oRelBottom
.
reset
(
TWIP_TO_MM100
(
i
->
second
.
toInt32
()));
oRelBottom
.
reset
(
TWIP_TO_MM100
(
i
->
second
.
toInt32
()));
else
if
(
i
->
first
==
"fBehindDocument"
)
else
if
(
i
->
first
==
"fBehindDocument"
)
bOpaque
=
!
i
->
second
.
toInt32
();
bOpaque
=
!
i
->
second
.
toInt32
();
else
if
(
i
->
first
==
"pctHoriz"
||
i
->
first
==
"pctVert"
)
{
sal_Int16
nPercentage
=
rtl
::
math
::
round
(
i
->
second
.
toDouble
()
/
10
);
boost
::
optional
<
sal_Int16
>&
rPercentage
=
i
->
first
==
"pctHoriz"
?
oRelativeWidth
:
oRelativeHeight
;
if
(
nPercentage
)
rPercentage
=
nPercentage
;
}
else
if
(
i
->
first
==
"sizerelh"
)
{
if
(
xPropertySet
.
is
())
{
switch
(
i
->
second
.
toInt32
())
{
case
0
:
// margin
nRelativeWidthRelation
=
text
::
RelOrientation
::
FRAME
;
break
;
case
1
:
// page
nRelativeWidthRelation
=
text
::
RelOrientation
::
PAGE_FRAME
;
break
;
default:
SAL_WARN
(
"writerfilter"
,
"RTFSdrImport::resolve: unhandled sizerelh value: "
<<
i
->
second
);
break
;
}
}
}
else
if
(
i
->
first
==
"sizerelv"
)
{
if
(
xPropertySet
.
is
())
{
switch
(
i
->
second
.
toInt32
())
{
case
0
:
// margin
nRelativeHeightRelation
=
text
::
RelOrientation
::
FRAME
;
break
;
case
1
:
// page
nRelativeHeightRelation
=
text
::
RelOrientation
::
PAGE_FRAME
;
break
;
default:
SAL_WARN
(
"writerfilter"
,
"RTFSdrImport::resolve: unhandled sizerelv value: "
<<
i
->
second
);
break
;
}
}
}
else
else
SAL_INFO
(
"writerfilter"
,
"TODO handle shape property '"
<<
i
->
first
<<
"':'"
<<
i
->
second
<<
"'"
);
SAL_INFO
(
"writerfilter"
,
"TODO handle shape property '"
<<
i
->
first
<<
"':'"
<<
i
->
second
<<
"'"
);
}
}
...
@@ -675,6 +722,16 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose)
...
@@ -675,6 +722,16 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose)
}
}
xPropertySet
->
setPropertyValue
(
"AnchorType"
,
uno
::
makeAny
(
text
::
TextContentAnchorType_AT_CHARACTER
));
xPropertySet
->
setPropertyValue
(
"AnchorType"
,
uno
::
makeAny
(
text
::
TextContentAnchorType_AT_CHARACTER
));
xPropertySet
->
setPropertyValue
(
"Opaque"
,
uno
::
makeAny
(
bOpaque
));
xPropertySet
->
setPropertyValue
(
"Opaque"
,
uno
::
makeAny
(
bOpaque
));
if
(
oRelativeWidth
)
{
xPropertySet
->
setPropertyValue
(
"RelativeWidth"
,
uno
::
makeAny
(
*
oRelativeWidth
));
xPropertySet
->
setPropertyValue
(
"RelativeWidthRelation"
,
uno
::
makeAny
(
nRelativeWidthRelation
));
}
if
(
oRelativeHeight
)
{
xPropertySet
->
setPropertyValue
(
"RelativeHeight"
,
uno
::
makeAny
(
*
oRelativeHeight
));
xPropertySet
->
setPropertyValue
(
"RelativeHeightRelation"
,
uno
::
makeAny
(
nRelativeHeightRelation
));
}
}
}
if
(
m_rImport
.
isInBackground
())
if
(
m_rImport
.
isInBackground
())
...
...
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