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
06e696a0
Kaydet (Commit)
06e696a0
authored
Tem 10, 2014
tarafından
Miklos Vajna
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
DOCX export: write <w:alias> inside <w:sdtPr>
Change-Id: Iaa020c00ddb3f9c6e6a9a6b2bc248a47c01a89d4
üst
bd98c467
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
6 deletions
+37
-6
sdt-alias.docx
sw/qa/extras/ooxmlexport/data/sdt-alias.docx
+0
-0
ooxmlexport.cxx
sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+11
-0
docxattributeoutput.cxx
sw/source/filter/ww8/docxattributeoutput.cxx
+20
-5
docxattributeoutput.hxx
sw/source/filter/ww8/docxattributeoutput.hxx
+6
-1
No files found.
sw/qa/extras/ooxmlexport/data/sdt-alias.docx
0 → 100644
Dosyayı görüntüle @
06e696a0
File added
sw/qa/extras/ooxmlexport/ooxmlexport.cxx
Dosyayı görüntüle @
06e696a0
...
...
@@ -3749,6 +3749,17 @@ DECLARE_OOXMLEXPORT_TEST(testSdt2Run, "sdt-2-run.docx")
assertXPathContent
(
pXmlDoc
,
"/w:document/w:body/w:p/w:sdt/w:sdtContent/w:r[1]/w:t"
,
"first"
);
assertXPathContent
(
pXmlDoc
,
"/w:document/w:body/w:p/w:sdt/w:sdtContent/w:r[2]/w:t"
,
"second"
);
}
DECLARE_OOXMLEXPORT_TEST
(
testSdtAlias
,
"sdt-alias.docx"
)
{
xmlDocPtr
pXmlDoc
=
parseExport
();
if
(
!
pXmlDoc
)
return
;
// <w:alias> was completely missing.
assertXPath
(
pXmlDoc
,
"/w:document/w:body/w:p/w:sdt/w:sdtPr/w:alias"
,
"val"
,
"Subtitle"
);
}
CPPUNIT_PLUGIN_IMPLEMENT
();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sw/source/filter/ww8/docxattributeoutput.cxx
Dosyayı görüntüle @
06e696a0
...
...
@@ -291,7 +291,7 @@ void DocxAttributeOutput::StartParagraph( ww8::WW8TableNodeInfo::Pointer_t pText
m_bIsFirstParagraph
=
false
;
}
static
void
lcl_deleteAndResetTheLists
(
::
sax_fastparser
::
FastAttributeList
*
&
pSdtPrTokenChildren
,
::
sax_fastparser
::
FastAttributeList
*
&
pSdtPrDataBindingAttrs
)
static
void
lcl_deleteAndResetTheLists
(
::
sax_fastparser
::
FastAttributeList
*
&
pSdtPrTokenChildren
,
::
sax_fastparser
::
FastAttributeList
*
&
pSdtPrDataBindingAttrs
,
OUString
&
rSdtPrAlias
)
{
if
(
pSdtPrTokenChildren
)
{
...
...
@@ -303,6 +303,8 @@ static void lcl_deleteAndResetTheLists( ::sax_fastparser::FastAttributeList* &pS
delete
pSdtPrDataBindingAttrs
;
pSdtPrDataBindingAttrs
=
NULL
;
}
if
(
!
rSdtPrAlias
.
isEmpty
())
rSdtPrAlias
=
""
;
}
void
DocxAttributeOutput
::
PopulateFrameProperties
(
const
SwFrmFmt
*
pFrmFmt
,
const
Size
&
rSize
)
...
...
@@ -516,14 +518,15 @@ void DocxAttributeOutput::EndParagraph( ww8::WW8TableNodeInfoInner::Pointer_t pT
}
m_pSerializer
->
endElementNS
(
XML_w
,
XML_p
);
OUString
aParagraphSdtPrAlias
;
if
(
!
m_bAnchorLinkedToNode
)
WriteSdtBlock
(
m_nParagraphSdtPrToken
,
m_pParagraphSdtPrTokenChildren
,
m_pParagraphSdtPrDataBindingAttrs
,
/*bPara=*/
true
);
WriteSdtBlock
(
m_nParagraphSdtPrToken
,
m_pParagraphSdtPrTokenChildren
,
m_pParagraphSdtPrDataBindingAttrs
,
aParagraphSdtPrAlias
,
/*bPara=*/
true
);
else
{
//These should be written out to the actual Node and not to the anchor.
//Clear them as they will be repopulated when the node is processed.
m_nParagraphSdtPrToken
=
0
;
lcl_deleteAndResetTheLists
(
m_pParagraphSdtPrTokenChildren
,
m_pParagraphSdtPrDataBindingAttrs
);
lcl_deleteAndResetTheLists
(
m_pParagraphSdtPrTokenChildren
,
m_pParagraphSdtPrDataBindingAttrs
,
aParagraphSdtPrAlias
);
}
//sdtcontent is written so Set m_bParagraphHasDrawing to false
...
...
@@ -559,6 +562,7 @@ void DocxAttributeOutput::EndParagraph( ww8::WW8TableNodeInfoInner::Pointer_t pT
void
DocxAttributeOutput
::
WriteSdtBlock
(
sal_Int32
&
nSdtPrToken
,
::
sax_fastparser
::
FastAttributeList
*&
pSdtPrTokenChildren
,
::
sax_fastparser
::
FastAttributeList
*&
pSdtPrDataBindingAttrs
,
OUString
&
rSdtPrAlias
,
bool
bPara
)
{
if
(
nSdtPrToken
>
0
||
pSdtPrDataBindingAttrs
)
...
...
@@ -598,6 +602,11 @@ void DocxAttributeOutput::WriteSdtBlock( sal_Int32& nSdtPrToken,
m_pSerializer
->
singleElementNS
(
XML_w
,
XML_dataBinding
,
xAttrList
);
}
if
(
!
rSdtPrAlias
.
isEmpty
())
m_pSerializer
->
singleElementNS
(
XML_w
,
XML_alias
,
FSNS
(
XML_w
,
XML_val
),
OUStringToOString
(
rSdtPrAlias
,
RTL_TEXTENCODING_UTF8
).
getStr
(),
FSEND
);
m_pSerializer
->
endElementNS
(
XML_w
,
XML_sdtPr
);
// sdt contents start tag
...
...
@@ -621,6 +630,7 @@ void DocxAttributeOutput::WriteSdtBlock( sal_Int32& nSdtPrToken,
// do not delete yet; it's in xAttrList inside the parser
pSdtPrDataBindingAttrs
=
NULL
;
}
rSdtPrAlias
=
""
;
}
}
...
...
@@ -1082,13 +1092,13 @@ void DocxAttributeOutput::EndRun()
// enclose in a sdt block, if necessary: if one is already started, then don't do it for now
// (so on export sdt blocks are never nested ATM)
if
(
!
m_bAnchorLinkedToNode
&&
!
m_bStartedCharSdt
)
WriteSdtBlock
(
m_nRunSdtPrToken
,
m_pRunSdtPrTokenChildren
,
m_pRunSdtPrDataBindingAttrs
,
/*bPara=*/
false
);
WriteSdtBlock
(
m_nRunSdtPrToken
,
m_pRunSdtPrTokenChildren
,
m_pRunSdtPrDataBindingAttrs
,
m_aRunSdtPrAlias
,
/*bPara=*/
false
);
else
{
//These should be written out to the actual Node and not to the anchor.
//Clear them as they will be repopulated when the node is processed.
m_nRunSdtPrToken
=
0
;
lcl_deleteAndResetTheLists
(
m_pRunSdtPrTokenChildren
,
m_pRunSdtPrDataBindingAttrs
);
lcl_deleteAndResetTheLists
(
m_pRunSdtPrTokenChildren
,
m_pRunSdtPrDataBindingAttrs
,
m_aRunSdtPrAlias
);
}
m_pSerializer
->
mergeTopMarks
();
...
...
@@ -7776,6 +7786,11 @@ void DocxAttributeOutput::CharGrabBag( const SfxGrabBagItem& rItem )
rtl
::
OUStringToOString
(
sValue
,
RTL_TEXTENCODING_UTF8
).
getStr
()
);
}
}
else
if
(
aPropertyValue
.
Name
==
"ooxml:CT_SdtPr_alias"
&&
m_aRunSdtPrAlias
.
isEmpty
())
{
if
(
!
(
aPropertyValue
.
Value
>>=
m_aRunSdtPrAlias
))
SAL_WARN
(
"sw.ww8"
,
"DocxAttributeOutput::CharGrabBag: unexpected sdt alias value"
);
}
//do not overwrite the parent node.
else
if
(
aPropertyValue
.
Name
==
"ooxml:CT_SdtPr_text"
&&
!
m_pRunSdtPrTokenChildren
)
m_nRunSdtPrToken
=
FSNS
(
XML_w
,
XML_text
);
...
...
sw/source/filter/ww8/docxattributeoutput.hxx
Dosyayı görüntüle @
06e696a0
...
...
@@ -691,7 +691,11 @@ private:
void
WritePostponedDMLDrawing
();
void
WritePostponedCustomShape
();
void
WriteSdtBlock
(
sal_Int32
&
nSdtPrToken
,
::
sax_fastparser
::
FastAttributeList
*
&
pSdtPrTokenChildren
,
::
sax_fastparser
::
FastAttributeList
*
&
pSdtPrDataBindingAttrs
,
bool
bPara
);
void
WriteSdtBlock
(
sal_Int32
&
nSdtPrToken
,
::
sax_fastparser
::
FastAttributeList
*&
pSdtPrTokenChildren
,
::
sax_fastparser
::
FastAttributeList
*&
pSdtPrDataBindingAttrs
,
OUString
&
rSdtPrAlias
,
bool
bPara
);
/// Closes a currently open SDT block.
void
EndSdtBlock
();
...
...
@@ -892,6 +896,7 @@ private:
sal_Int32
m_nRunSdtPrToken
;
::
sax_fastparser
::
FastAttributeList
*
m_pRunSdtPrTokenChildren
;
::
sax_fastparser
::
FastAttributeList
*
m_pRunSdtPrDataBindingAttrs
;
OUString
m_aRunSdtPrAlias
;
std
::
map
<
sal_uInt16
,
css
::
table
::
BorderLine2
>
m_aTableStyleConf
;
...
...
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