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
fb350239
Kaydet (Commit)
fb350239
authored
Eki 09, 2013
tarafından
Miklos Vajna
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
DOCX export of CT_LatentStyles and CT_LsdException
Change-Id: I32a594464c71215ee7557823aadaa72b8b72b4e2
üst
57a8f39b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
97 additions
and
0 deletions
+97
-0
docxattributeoutput.cxx
sw/source/filter/ww8/docxattributeoutput.cxx
+94
-0
docxattributeoutput.hxx
sw/source/filter/ww8/docxattributeoutput.hxx
+3
-0
No files found.
sw/source/filter/ww8/docxattributeoutput.cxx
Dosyayı görüntüle @
fb350239
...
...
@@ -102,6 +102,7 @@
#include <txtftn.hxx>
#include <txtinet.hxx>
#include <fmtautofmt.hxx>
#include <docsh.hxx>
#include <osl/file.hxx>
#include <rtl/tencinfo.h>
...
...
@@ -2357,6 +2358,99 @@ void DocxAttributeOutput::StartStyles()
FSEND );
DocDefaults();
LatentStyles();
}
namespace {
struct StringTokenMap
{
const char* pToken;
sal_Int32 nToken;
};
StringTokenMap aDefaultTokens[] {
{"defQFormat", XML_defQFormat},
{"defUnhideWhenUsed", XML_defUnhideWhenUsed},
{"defSemiHidden", XML_defSemiHidden},
{"count", XML_count},
{"defUIPriority", XML_defUIPriority},
{"defLockedState", XML_defLockedState},
{0, 0}
};
StringTokenMap aExceptionTokens[] {
{"name", XML_name},
{"locked", XML_locked},
{"uiPriority", XML_uiPriority},
{"semiHidden", XML_semiHidden},
{"unhideWhenUsed", XML_unhideWhenUsed},
{"qFormat", XML_qFormat},
{0, 0}
};
sal_Int32 lcl_getToken(StringTokenMap* pMap, OUString aName)
{
OString sName = OUStringToOString(aName, RTL_TEXTENCODING_UTF8);
while (pMap->pToken)
{
if (sName == pMap->pToken)
return pMap->nToken;
++pMap;
}
return 0;
}
}
void DocxAttributeOutput::LatentStyles()
{
// Do we have latent styles available?
uno::Reference<beans::XPropertySet> xPropertySet(m_rExport.pDoc->GetDocShell()->GetBaseModel(), uno::UNO_QUERY_THROW);
uno::Sequence<beans::PropertyValue> aInteropGrabBag;
xPropertySet->getPropertyValue("InteropGrabBag") >>= aInteropGrabBag;
uno::Sequence<beans::PropertyValue> aLatentStyles;
for (sal_Int32 i = 0; i < aInteropGrabBag.getLength(); ++i)
{
if (aInteropGrabBag[i].Name == "latentStyles")
{
aInteropGrabBag[i].Value >>= aLatentStyles;
break;
}
}
if (!aLatentStyles.getLength())
return;
// Extract default attributes first.
sax_fastparser::FastAttributeList* pAttributeList = m_pSerializer->createAttrList();
uno::Sequence<beans::PropertyValue> aLsdExceptions;
for (sal_Int32 i = 0; i < aLatentStyles.getLength(); ++i)
{
if (sal_Int32 nToken = lcl_getToken(aDefaultTokens, aLatentStyles[i].Name))
pAttributeList->add(FSNS(XML_w, nToken), OUStringToOString(aLatentStyles[i].Value.get<OUString>(), RTL_TEXTENCODING_UTF8));
else if (aLatentStyles[i].Name == "lsdExceptions")
aLatentStyles[i].Value >>= aLsdExceptions;
}
XFastAttributeListRef xAttributeList(pAttributeList);
m_pSerializer->startElementNS(XML_w, XML_latentStyles, xAttributeList);
pAttributeList = 0;
// Then handle the exceptions.
for (sal_Int32 i = 0; i < aLsdExceptions.getLength(); ++i)
{
pAttributeList = m_pSerializer->createAttrList();
uno::Sequence<beans::PropertyValue> aAttributes;
aLsdExceptions[i].Value >>= aAttributes;
for (sal_Int32 j = 0; j < aAttributes.getLength(); ++j)
if (sal_Int32 nToken = lcl_getToken(aExceptionTokens, aAttributes[j].Name))
pAttributeList->add(FSNS(XML_w, nToken), OUStringToOString(aAttributes[j].Value.get<OUString>(), RTL_TEXTENCODING_UTF8));
xAttributeList = pAttributeList;
m_pSerializer->singleElementNS(XML_w, XML_lsdException, xAttributeList);
pAttributeList = 0;
}
m_pSerializer->endElementNS(XML_w, XML_latentStyles);
}
void DocxAttributeOutput::OutputDefaultItem(const SfxPoolItem& rHt)
...
...
sw/source/filter/ww8/docxattributeoutput.hxx
Dosyayı görüntüle @
fb350239
...
...
@@ -214,6 +214,9 @@ public:
/// Write Doc Defaults
void
DocDefaults
(
);
/// Write latent styles.
void
LatentStyles
();
/** Similar to OutputItem(), but write something only if it is not the default.
This is to output the docDefaults, and we should write something out
...
...
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