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
5a737fca
Kaydet (Commit)
5a737fca
authored
Tem 01, 2013
tarafından
Miklos Vajna
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
fdo#46361 oox: handle w:jc for groupshape textboxes
Change-Id: I21391d9a9f5b5173b599006287b33fdaab3c0c75
üst
6bf79576
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
60 additions
and
14 deletions
+60
-14
vmltextbox.hxx
include/oox/vml/vmltextbox.hxx
+9
-2
vmltextboxcontext.hxx
include/oox/vml/vmltextboxcontext.hxx
+4
-0
vmltextbox.cxx
oox/source/vml/vmltextbox.cxx
+18
-3
vmltextboxcontext.cxx
oox/source/vml/vmltextboxcontext.cxx
+29
-9
No files found.
include/oox/vml/vmltextbox.hxx
Dosyayı görüntüle @
5a737fca
...
...
@@ -37,6 +37,12 @@ struct ShapeTypeModel;
// ============================================================================
/// A text paragraph in a textbox.
struct
TextParagraphModel
{
OptValue
<
OUString
>
moParaAdjust
;
///< Paragraph adjust (left, center, right, etc.)
};
/** Font settings for a text portion in a textbox. */
struct
OOX_DLLPUBLIC
TextFontModel
{
...
...
@@ -57,10 +63,11 @@ struct OOX_DLLPUBLIC TextFontModel
/** A text portion in a textbox with the same formatting for all characters. */
struct
TextPortionModel
{
TextParagraphModel
maParagraph
;
TextFontModel
maFont
;
OUString
maText
;
explicit
TextPortionModel
(
const
TextFontModel
&
rFont
,
const
OUString
&
rText
);
explicit
TextPortionModel
(
const
Text
ParagraphModel
&
rParagraph
,
const
Text
FontModel
&
rFont
,
const
OUString
&
rText
);
};
// ============================================================================
...
...
@@ -72,7 +79,7 @@ public:
explicit
TextBox
(
ShapeTypeModel
&
rTypeModel
);
/** Appends a new text portion to the textbox. */
void
appendPortion
(
const
TextFontModel
&
rFont
,
const
OUString
&
rText
);
void
appendPortion
(
const
Text
ParagraphModel
&
rParagraph
,
const
Text
FontModel
&
rFont
,
const
OUString
&
rText
);
/** Returns the current number of text portions. */
inline
size_t
getPortionCount
()
const
{
return
maPortions
.
size
();
}
...
...
include/oox/vml/vmltextboxcontext.hxx
Dosyayı görüntüle @
5a737fca
...
...
@@ -36,6 +36,7 @@ public:
explicit
TextPortionContext
(
::
oox
::
core
::
ContextHandler2Helper
&
rParent
,
TextBox
&
rTextBox
,
TextParagraphModel
&
rParagraph
,
const
TextFontModel
&
rParentFont
,
sal_Int32
nElement
,
const
AttributeList
&
rAttribs
);
...
...
@@ -48,6 +49,7 @@ public:
private
:
TextBox
&
mrTextBox
;
TextParagraphModel
maParagraph
;
TextFontModel
maFont
;
size_t
mnInitialPortions
;
};
...
...
@@ -65,10 +67,12 @@ public:
virtual
::
oox
::
core
::
ContextHandlerRef
onCreateContext
(
sal_Int32
nElement
,
const
AttributeList
&
rAttribs
);
virtual
void
onStartElement
(
const
AttributeList
&
rAttribs
)
SAL_OVERRIDE
;
virtual
void
onEndElement
();
private
:
TextBox
&
mrTextBox
;
TextParagraphModel
maParagraph
;
};
// ============================================================================
...
...
oox/source/vml/vmltextbox.cxx
Dosyayı görüntüle @
5a737fca
...
...
@@ -24,6 +24,7 @@
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/text/XTextAppend.hpp>
#include <com/sun/star/text/WritingMode.hpp>
#include <com/sun/star/style/ParagraphAdjust.hpp>
namespace
oox
{
namespace
vml
{
...
...
@@ -34,7 +35,8 @@ TextFontModel::TextFontModel()
{
}
TextPortionModel
::
TextPortionModel
(
const
TextFontModel
&
rFont
,
const
OUString
&
rText
)
:
TextPortionModel
::
TextPortionModel
(
const
TextParagraphModel
&
rParagraph
,
const
TextFontModel
&
rFont
,
const
OUString
&
rText
)
:
maParagraph
(
rParagraph
),
maFont
(
rFont
),
maText
(
rText
)
{
...
...
@@ -50,9 +52,9 @@ TextBox::TextBox(ShapeTypeModel& rTypeModel)
{
}
void
TextBox
::
appendPortion
(
const
TextFontModel
&
rFont
,
const
OUString
&
rText
)
void
TextBox
::
appendPortion
(
const
Text
ParagraphModel
&
rParagraph
,
const
Text
FontModel
&
rFont
,
const
OUString
&
rText
)
{
maPortions
.
push_back
(
TextPortionModel
(
rFont
,
rText
)
);
maPortions
.
push_back
(
TextPortionModel
(
r
Paragraph
,
r
Font
,
rText
)
);
}
const
TextFontModel
*
TextBox
::
getFirstFont
()
const
...
...
@@ -75,6 +77,7 @@ void TextBox::convert(uno::Reference<drawing::XShape> xShape) const
{
beans
::
PropertyValue
aPropertyValue
;
std
::
vector
<
beans
::
PropertyValue
>
aPropVec
;
const
TextParagraphModel
&
rParagraph
=
aIt
->
maParagraph
;
const
TextFontModel
&
rFont
=
aIt
->
maFont
;
if
(
rFont
.
mobBold
.
has
())
{
...
...
@@ -88,6 +91,18 @@ void TextBox::convert(uno::Reference<drawing::XShape> xShape) const
aPropertyValue
.
Value
=
uno
::
makeAny
(
double
(
rFont
.
monSize
.
get
())
/
2.
);
aPropVec
.
push_back
(
aPropertyValue
);
}
if
(
rParagraph
.
moParaAdjust
.
has
())
{
style
::
ParagraphAdjust
eAdjust
=
style
::
ParagraphAdjust_LEFT
;
if
(
rParagraph
.
moParaAdjust
.
get
()
==
"center"
)
eAdjust
=
style
::
ParagraphAdjust_CENTER
;
else
if
(
rParagraph
.
moParaAdjust
.
get
()
==
"right"
)
eAdjust
=
style
::
ParagraphAdjust_RIGHT
;
aPropertyValue
.
Name
=
"ParaAdjust"
;
aPropertyValue
.
Value
=
uno
::
makeAny
(
eAdjust
);
aPropVec
.
push_back
(
aPropertyValue
);
}
uno
::
Sequence
<
beans
::
PropertyValue
>
aPropSeq
(
aPropVec
.
size
());
beans
::
PropertyValue
*
pValues
=
aPropSeq
.
getArray
();
for
(
std
::
vector
<
beans
::
PropertyValue
>::
iterator
i
=
aPropVec
.
begin
();
i
!=
aPropVec
.
end
();
++
i
)
...
...
oox/source/vml/vmltextboxcontext.cxx
Dosyayı görüntüle @
5a737fca
...
...
@@ -34,10 +34,11 @@ using ::oox::core::ContextHandlerRef;
// ============================================================================
TextPortionContext
::
TextPortionContext
(
ContextHandler2Helper
&
rParent
,
TextBox
&
rTextBox
,
const
TextFontModel
&
rParentFont
,
TextBox
&
rTextBox
,
TextParagraphModel
&
rParagraph
,
const
TextFontModel
&
rParentFont
,
sal_Int32
nElement
,
const
AttributeList
&
rAttribs
)
:
ContextHandler2
(
rParent
),
mrTextBox
(
rTextBox
),
maParagraph
(
rParagraph
),
maFont
(
rParentFont
),
mnInitialPortions
(
rTextBox
.
getPortionCount
()
)
{
...
...
@@ -96,7 +97,7 @@ ContextHandlerRef TextPortionContext::onCreateContext( sal_Int32 nElement, const
OSL_ENSURE
(
nElement
!=
XML_font
,
"TextPortionContext::onCreateContext - nested <font> elements"
);
if
(
getNamespace
(
getCurrentElement
())
==
NMSP_doc
)
return
this
;
return
new
TextPortionContext
(
*
this
,
mrTextBox
,
maFont
,
nElement
,
rAttribs
);
return
new
TextPortionContext
(
*
this
,
mrTextBox
,
ma
Paragraph
,
ma
Font
,
nElement
,
rAttribs
);
}
void
TextPortionContext
::
onCharacters
(
const
OUString
&
rChars
)
...
...
@@ -108,10 +109,10 @@ void TextPortionContext::onCharacters( const OUString& rChars )
{
case
XML_span
:
// replace all NBSP characters with SP
mrTextBox
.
appendPortion
(
maFont
,
rChars
.
replace
(
0xA0
,
' '
)
);
mrTextBox
.
appendPortion
(
ma
Paragraph
,
ma
Font
,
rChars
.
replace
(
0xA0
,
' '
)
);
break
;
default
:
mrTextBox
.
appendPortion
(
maFont
,
rChars
);
mrTextBox
.
appendPortion
(
ma
Paragraph
,
ma
Font
,
rChars
);
}
}
...
...
@@ -126,7 +127,7 @@ void TextPortionContext::onStartElement(const AttributeList& rAttribs)
maFont
.
monSize
=
rAttribs
.
getInteger
(
OOX_TOKEN
(
doc
,
val
)
);
break
;
case
OOX_TOKEN
(
doc
,
br
):
mrTextBox
.
appendPortion
(
maFont
,
"
\n
"
);
mrTextBox
.
appendPortion
(
ma
Paragraph
,
ma
Font
,
"
\n
"
);
break
;
}
}
...
...
@@ -153,7 +154,7 @@ void TextPortionContext::onEndElement()
meantime, the space character has to be added manually.
*/
if
(
mrTextBox
.
getPortionCount
()
==
mnInitialPortions
)
mrTextBox
.
appendPortion
(
maFont
,
OUString
(
sal_Unicode
(
' '
)
)
);
mrTextBox
.
appendPortion
(
ma
Paragraph
,
ma
Font
,
OUString
(
sal_Unicode
(
' '
)
)
);
}
// ============================================================================
...
...
@@ -207,22 +208,41 @@ ContextHandlerRef TextBoxContext::onCreateContext( sal_Int32 nElement, const Att
else
if
(
nElement
==
OOX_TOKEN
(
doc
,
txbxContent
))
return
this
;
break
;
case
XML_div
:
if
(
nElement
==
XML_font
)
return
new
TextPortionContext
(
*
this
,
mrTextBox
,
TextFontModel
(),
nElement
,
rAttribs
);
if
(
nElement
==
XML_font
)
return
new
TextPortionContext
(
*
this
,
mrTextBox
,
maParagraph
,
TextFontModel
(),
nElement
,
rAttribs
);
break
;
case
OOX_TOKEN
(
doc
,
txbxContent
):
if
(
nElement
==
OOX_TOKEN
(
doc
,
p
))
return
this
;
break
;
case
OOX_TOKEN
(
doc
,
p
):
if
(
nElement
==
OOX_TOKEN
(
doc
,
r
))
return
new
TextPortionContext
(
*
this
,
mrTextBox
,
TextFontModel
(),
nElement
,
rAttribs
);
if
(
nElement
==
OOX_TOKEN
(
doc
,
r
))
return
new
TextPortionContext
(
*
this
,
mrTextBox
,
maParagraph
,
TextFontModel
(),
nElement
,
rAttribs
);
else
return
this
;
break
;
case
OOX_TOKEN
(
doc
,
pPr
):
return
this
;
break
;
}
return
0
;
}
void
TextBoxContext
::
onStartElement
(
const
AttributeList
&
rAttribs
)
{
switch
(
getCurrentElement
())
{
case
OOX_TOKEN
(
doc
,
jc
):
maParagraph
.
moParaAdjust
=
rAttribs
.
getString
(
OOX_TOKEN
(
doc
,
val
)
);
break
;
}
}
void
TextBoxContext
::
onEndElement
()
{
if
(
getCurrentElement
()
==
OOX_TOKEN
(
doc
,
p
))
mrTextBox
.
appendPortion
(
TextFontModel
(),
"
\n
"
);
{
mrTextBox
.
appendPortion
(
maParagraph
,
TextFontModel
(),
"
\n
"
);
maParagraph
=
TextParagraphModel
();
}
}
// ============================================================================
...
...
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