[Libreoffice-commits] core.git: 5 commits - sw/source writerfilter/source
Miklos Vajna
vmiklos at collabora.co.uk
Tue May 27 13:14:29 PDT 2014
sw/source/core/doc/doctxm.cxx | 3
sw/source/core/doc/textboxhelper.cxx | 18 +++
sw/source/core/docnode/nodedump.cxx | 14 ++
writerfilter/source/ooxml/attrsprm.xsl | 160 ---------------------------------
4 files changed, 31 insertions(+), 164 deletions(-)
New commits:
commit d9a1d2179e59b17f50e9a2f44053bcff99ae5d81
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Tue May 27 22:00:50 2014 +0200
coverity#704873 Unchecked dynamic_cast
Change-Id: I03580779ba69a71e51e9e4e1349fe2f5d77956d5
diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx
index 2a04550..c723102 100644
--- a/sw/source/core/doc/doctxm.cxx
+++ b/sw/source/core/doc/doctxm.cxx
@@ -417,7 +417,8 @@ const SwTOXBaseSection* SwDoc::InsertTableOf( sal_uLong nSttNd, sal_uLong nEndNd
SwTOXBaseSection *const pNewSection(
dynamic_cast<SwTOXBaseSection*>(& pNewSectionNode->GetSection()));
- pNewSection->SetTOXName(sSectNm); // rTOX may have had no name...
+ if (pNewSection)
+ pNewSection->SetTOXName(sSectNm); // rTOX may have had no name...
return pNewSection;
}
commit 051361a9a9e38d3fb42d021a5d025e12b96425a6
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Tue May 27 21:54:54 2014 +0200
writerfilter: remove unused attrsprm.xsl
Change-Id: I71e7e1fbab6ec2ecc525f7d637199f6f7a69f8ea
diff --git a/writerfilter/source/ooxml/attrsprm.xsl b/writerfilter/source/ooxml/attrsprm.xsl
deleted file mode 100644
index f61a4c6..0000000
--- a/writerfilter/source/ooxml/attrsprm.xsl
+++ /dev/null
@@ -1,160 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
--->
-
-<xsl:stylesheet
- version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:rng="http://relaxng.org/ns/structure/1.0"
- xmlns:xalan="http://xml.apache.org/xalan"
- exclude-result-prefixes = "xalan"
- xml:indent="true">
- <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" omit-xml-declaration="no"/>
-
- <xsl:include href="factorytools.xsl"/>
-
- <xsl:template match="/">
- <class>
- <xsl:for-each select="//rng:define[@name='CT_FFData']">
- <xsl:call-template name="sprm"/>
- <xsl:call-template name="attribute"/>
- </xsl:for-each>
- </class>
- </xsl:template>
-
- <xsl:template name="sprminner">
- <xsl:variable name="defname" select="@name"/>
- <xsl:for-each select=".//rng:ref[not(ancestor::rng:element or ancestor::rng:attribute)]">
- <xsl:call-template name="sprminner"/>
- </xsl:for-each>
- <xsl:for-each select=".//rng:element">
- <xsl:for-each select="rng:ref">
- <xsl:variable name="refname" select="@name"/>
- <xsl:for-each select="ancestor::namespace/rng:grammar/rng:define[@name=$refname]">
- <xsl:call-template name="sprminner"/>
- </xsl:for-each>
- </xsl:for-each>
- <element>
- <xsl:variable name="elementname" select="@name"/>
- <xsl:attribute name="name">
- <xsl:value-of select="@name"/>
- </xsl:attribute>
- <xsl:for-each select="rng:ref">
- <xsl:variable name="refname" select="@name"/>
- <xsl:for-each select="ancestor::namespace/resource[@name=$refname]">
- <xsl:attribute name="action">
- <xsl:choose>
- <xsl:when test="@resource='Properties'">
- <xsl:text>resolve</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>set</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
- </xsl:for-each>
- <xsl:for-each select="ancestor::namespace/resource[@name=$defname]">
- <xsl:for-each select="element[@name=$elementname]">
- <xsl:attribute name="id">
- <xsl:call-template name="idtoqname">
- <xsl:with-param name="id">
- <xsl:value-of select="@tokenid"/>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:attribute>
- </xsl:for-each>
- </xsl:for-each>
- </xsl:for-each>
- </element>
- </xsl:for-each>
- </xsl:template>
-
- <xsl:template name="sprm">
- <sprm>
- <xsl:call-template name="sprminner"/>
- </sprm>
- </xsl:template>
-
- <xsl:template name="attributeinner">
- <xsl:param name="parent"/>
- <xsl:for-each select=".//rng:ref[not(ancestor::rng:element or ancestor::rng:attribute)]">
- <xsl:variable name="refname" select="@name"/>
- <xsl:comment><xsl:value-of select="$newparent"/></xsl:comment>
- <xsl:for-each select="ancestor::namespace/rng:grammar/rng:define[@name=$refname]">
- <xsl:call-template name="attributeinner">
- <xsl:with-param name="parent" select="$parent"/>
- </xsl:call-template>
- </xsl:for-each>
- </xsl:for-each>
- <xsl:for-each select=".//rng:element">
- <xsl:variable name="newparent">
- <xsl:if test="string-length($parent)">
- <xsl:value-of select="$parent"/>
- <xsl:text>:</xsl:text>
- </xsl:if>
- <xsl:value-of select="@name"/>
- </xsl:variable>
- <xsl:for-each select="rng:ref">
- <xsl:variable name="refname" select="@name"/>
- <xsl:for-each select="ancestor::namespace/rng:grammar/rng:define[@name=$refname]">
- <xsl:call-template name="attributeinner">
- <xsl:with-param name="parent" select="$newparent"/>
- </xsl:call-template>
- </xsl:for-each>
- </xsl:for-each>
- </xsl:for-each>
- <xsl:variable name="defname" select="@name"/>
- <xsl:variable name="resource">
- <xsl:for-each select="ancestor::namespace/resource[@name=$defname]">
- <xsl:value-of select="@resource"/>
- </xsl:for-each>
- </xsl:variable>
- <xsl:if test="$resource='Properties'">
- <xsl:for-each select=".//rng:attribute">
- <xsl:variable name="attrname" select="@name"/>
- <attribute>
- <xsl:attribute name="name">
- <xsl:if test="string-length($parent) > 0">
- <xsl:value-of select="$parent"/>
- <xsl:text>:</xsl:text>
- </xsl:if>
- <xsl:value-of select="$attrname"/>
- </xsl:attribute>
- <xsl:for-each select="ancestor::namespace/resource[@name=$defname]">
- <xsl:for-each select="attribute[@name=$attrname]">
- <xsl:attribute name="id">
- <xsl:call-template name="idtoqname">
- <xsl:with-param name="id">
- <xsl:value-of select="@tokenid"/>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:attribute>
- </xsl:for-each>
- </xsl:for-each>
- </attribute>
- </xsl:for-each>
- </xsl:if>
- </xsl:template>
-
- <xsl:template name="attribute">
- <attribute>
- <xsl:call-template name="attributeinner"/>
- </attribute>
- </xsl:template>
-
-</xsl:stylesheet>
\ No newline at end of file
commit 18504a6b0fba700423a0260b1af90ab73c51f1ad
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Tue May 27 16:24:26 2014 +0200
sw doc model dump: handle content of SwFmtHori/VertOrient
Change-Id: I67237267be5ac4071ecdb480cacf51b4a2fb4f1f
diff --git a/sw/source/core/docnode/nodedump.cxx b/sw/source/core/docnode/nodedump.cxx
index 2a2ae30..3266c1f 100644
--- a/sw/source/core/docnode/nodedump.cxx
+++ b/sw/source/core/docnode/nodedump.cxx
@@ -17,6 +17,7 @@
#include "txatbase.hxx"
#include "fmtautofmt.hxx"
#include "fmtcntnt.hxx"
+#include "fmtornt.hxx"
#include "charfmt.hxx"
#include "frmfmt.hxx"
#include "fmtanchr.hxx"
@@ -412,11 +413,15 @@ void lcl_dumpSfxItemSet(WriterHelper& writer, const SfxItemSet* pSet)
case RES_VERT_ORIENT:
{
pWhich = "frame vertical orientation";
+ const SwFmtVertOrient* pOrient = static_cast<const SwFmtVertOrient*>(pItem);
+ oValue = "orient: " + OString::number(pOrient->GetVertOrient()) + ", relation: " + OString::number(pOrient->GetRelationOrient()) + ", position: " + OString::number(pOrient->GetPos());
break;
}
case RES_HORI_ORIENT:
{
pWhich = "frame horizontal orientation";
+ const SwFmtHoriOrient* pOrient = static_cast<const SwFmtHoriOrient*>(pItem);
+ oValue = "orient: " + OString::number(pOrient->GetHoriOrient()) + ", relation: " + OString::number(pOrient->GetRelationOrient()) + ", position: " + OString::number(pOrient->GetPos());
break;
}
case RES_ANCHOR:
commit 6971e5f32d95361f6575f9fe75cbfd7b6d89ef60
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Tue May 27 15:25:34 2014 +0200
SwTextBoxHelper: set textbox Surround for inline shapes
Change-Id: I25167b28397db185cdf9fe5844feecb5a16cc13e
diff --git a/sw/source/core/doc/textboxhelper.cxx b/sw/source/core/doc/textboxhelper.cxx
index 56b4e0e..3e64261 100644
--- a/sw/source/core/doc/textboxhelper.cxx
+++ b/sw/source/core/doc/textboxhelper.cxx
@@ -26,6 +26,8 @@
#include <com/sun/star/table/BorderLine2.hpp>
#include <com/sun/star/text/SizeType.hpp>
+#include <com/sun/star/text/TextContentAnchorType.hpp>
+#include <com/sun/star/text/WrapTextMode.hpp>
#include <com/sun/star/text/XTextContent.hpp>
#include <com/sun/star/text/XTextDocument.hpp>
@@ -196,6 +198,7 @@ void SwTextBoxHelper::syncProperty(SwFrmFmt* pShape, sal_uInt16 nWID, sal_uInt8
if (!pShape)
return;
+ OUString aPropertyName = rPropertyName;
uno::Any aValue(rValue);
nMemberId &= ~CONVERT_TWIPS;
@@ -237,6 +240,19 @@ void SwTextBoxHelper::syncProperty(SwFrmFmt* pShape, sal_uInt16 nWID, sal_uInt8
bSync = true;
bAdjustSize = true;
break;
+ case RES_ANCHOR:
+ switch (nMemberId)
+ {
+ case MID_ANCHOR_ANCHORTYPE:
+ if (aValue.get<text::TextContentAnchorType>() == text::TextContentAnchorType_AS_CHARACTER)
+ {
+ uno::Reference<beans::XPropertySet> xPropertySet(static_cast<cppu::OWeakObject*>(SwXFrames::GetObject(*pFmt, FLYCNTTYPE_FRM)), uno::UNO_QUERY);
+ xPropertySet->setPropertyValue("Surround", uno::makeAny(text::WrapTextMode_THROUGHT));
+ return;
+ }
+ break;
+ }
+ break;
}
if (bSync)
@@ -271,7 +287,7 @@ void SwTextBoxHelper::syncProperty(SwFrmFmt* pShape, sal_uInt16 nWID, sal_uInt8
}
uno::Reference<beans::XPropertySet> xPropertySet(static_cast<cppu::OWeakObject*>(SwXFrames::GetObject(*pFmt, FLYCNTTYPE_FRM)), uno::UNO_QUERY);
- xPropertySet->setPropertyValue(rPropertyName, aValue);
+ xPropertySet->setPropertyValue(aPropertyName, aValue);
}
}
}
commit 6505b4fefc6a65906686d2a99ef503b20a94c4a9
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Tue May 27 11:51:50 2014 +0200
SwTxtNode::dumpAsXml(): handle RES_TXTATR_FLYCNT
Change-Id: Idaa9a057bb17af2642706b144544df92139a1fce
diff --git a/sw/source/core/docnode/nodedump.cxx b/sw/source/core/docnode/nodedump.cxx
index f0c5447..2a2ae30 100644
--- a/sw/source/core/docnode/nodedump.cxx
+++ b/sw/source/core/docnode/nodedump.cxx
@@ -704,8 +704,9 @@ void SwTxtNode::dumpAsXml( xmlTextWriterPtr w )
writer.writeFormatAttribute("start", TMP_FORMAT, *pHint->GetStart());
if (pHint->GetEnd())
writer.writeFormatAttribute("end", TMP_FORMAT, *pHint->GetEnd());
+ writer.writeFormatAttribute("whichId", TMP_FORMAT, pHint->Which());
- const char* pWhich = "???";
+ const char* pWhich = 0;
switch (pHint->Which())
{
case RES_TXTATR_AUTOFMT:
@@ -714,10 +715,14 @@ void SwTxtNode::dumpAsXml( xmlTextWriterPtr w )
case RES_TXTATR_ANNOTATION:
pWhich = "annotation";
break;
+ case RES_TXTATR_FLYCNT:
+ pWhich = "fly content";
+ break;
default:
break;
}
- writer.writeFormatAttribute("which", "%s", BAD_CAST(pWhich));
+ if (pWhich)
+ writer.writeFormatAttribute("which", "%s", BAD_CAST(pWhich));
if (pHint->Which() == RES_TXTATR_AUTOFMT)
{
More information about the Libreoffice-commits
mailing list