[Libreoffice-commits] core.git: sw/source xmloff/source

2023-11-09 Thread Skyler Grey (via logerrit)
 sw/source/filter/ww8/ww8atr.cxx |3 +++
 xmloff/source/text/txtfldi.cxx  |3 +++
 2 files changed, 6 insertions(+)

New commits:
commit 7924d8fc274bb611c829443e0eb1a53d883cc9a3
Author: Skyler Grey 
AuthorDate: Thu Nov 9 16:57:50 2023 +
Commit: Miklos Vajna 
CommitDate: Fri Nov 10 08:12:28 2023 +0100

Fix STYLEREF crashes and forwards-compatibility

This commit fixes a crash in STYLEREF caused by a dereferenced nullptr
when serializing chapter fields for .doc export. Along with the STYLEREF
changes, I also changed the chapter export logic to allow exporting
chapter fields when they were in document text, and to use the style of
the thing they pointed to. Unfortunately, in some cases that would be
null. This commit makes us fall back to previous behavior in those
cases.

This commit also adds import logic for styleref on the TEXT namespace in
addition to LO_EXT. This is important as if/when the STYLEREF field is
no longer LO_EXT we want to be able to open new documents in old
versions of libreoffice. This was erroneously missed when we changed
TEXT references to LO_EXT in our export logic.

Change-Id: I383828c9409afc8545af379307f528cee2e1a960
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159226
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index 79446939957e..4949c7ffe6fd 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -3456,6 +3456,9 @@ void AttributeOutputBase::TextField( const SwFormatField& 
rField )
 // Otherwise, get the style of the text and use it as the 
style name
 const SwTextNode* pOutlineNd = 
pTextNd->FindOutlineNodeOfLevel(aCopy.GetLevel());
 
+if (!pOutlineNd) break;
+// Sometimes we can't find the outline node, in that case 
let's just fallback to exporting the text
+
 sStr = FieldString(ww::eSTYLEREF)
  + 
GetExport().GetStyleRefName(pOutlineNd->GetFormatColl()->GetName());
 }
diff --git a/xmloff/source/text/txtfldi.cxx b/xmloff/source/text/txtfldi.cxx
index e0f6a01ecca6..1228e232d328 100644
--- a/xmloff/source/text/txtfldi.cxx
+++ b/xmloff/source/text/txtfldi.cxx
@@ -408,6 +408,7 @@ XMLTextFieldImportContext::CreateTextFieldImportContext(
 case XML_ELEMENT(TEXT, XML_BOOKMARK_REF):
 case XML_ELEMENT(TEXT, XML_NOTE_REF):
 case XML_ELEMENT(TEXT, XML_SEQUENCE_REF):
+case XML_ELEMENT(TEXT, XML_STYLE_REF):
 case XML_ELEMENT(LO_EXT, XML_STYLE_REF):
 pContext = new XMLReferenceFieldImportContext( rImport, rHlp, 
nToken );
 break;
@@ -2512,6 +2513,7 @@ void XMLReferenceFieldImportContext::startFastElement(
 case XML_ELEMENT(TEXT, XML_SEQUENCE_REF):
 nSource = ReferenceFieldSource::SEQUENCE_FIELD;
 break;
+case XML_ELEMENT(TEXT, XML_STYLE_REF):
 case XML_ELEMENT(LO_EXT, XML_STYLE_REF):
 nSource = ReferenceFieldSource::STYLE;
 break;
@@ -2593,6 +2595,7 @@ void XMLReferenceFieldImportContext::PrepareField(
 {
 case XML_ELEMENT(TEXT, XML_REFERENCE_REF):
 case XML_ELEMENT(TEXT, XML_BOOKMARK_REF):
+case XML_ELEMENT(TEXT, XML_STYLE_REF):
 case XML_ELEMENT(LO_EXT, XML_STYLE_REF):
 xPropertySet->setPropertyValue("SourceName", Any(sName));
 xPropertySet->setPropertyValue("ReferenceFieldFlags", Any(nFlags));


[Libreoffice-commits] core.git: sw/source xmloff/source

2022-12-08 Thread Noel Grandin (via logerrit)
 sw/source/core/doc/list.cxx|   12 +
 xmloff/source/text/XMLTextListBlockContext.cxx |  172 +
 2 files changed, 101 insertions(+), 83 deletions(-)

New commits:
commit da798460e370a97597ecc9a06634f400c4b2e0cc
Author: Noel Grandin 
AuthorDate: Thu Dec 8 14:50:54 2022 +0200
Commit: Noel Grandin 
CommitDate: Thu Dec 8 18:24:22 2022 +

crashtesting ooo84576-1.odt

prevent the OOM by detecting cycles in SwList::SwList and throwing an
exception.

(1) However, that means we need to catch the exception in
XMLTextListBlockContext::XMLTextListBlockContext
and undo some registration, otherwise we will get a use-after-free.

The need to catch it is why I'm using an UNO exception here,
it seemed like a bad idea to throw and then catch and std::foo
exception.

(2) this is still not the end of the story, a further exception
is thrown during SwDoc destruction, for which I don't have a
solution.

Change-Id: I48be3d8acbdc0f9ca948a958f1124b158ba77ac0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143820
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sw/source/core/doc/list.cxx b/sw/source/core/doc/list.cxx
index aa4c06f473aa..5095d4e6c9a9 100644
--- a/sw/source/core/doc/list.cxx
+++ b/sw/source/core/doc/list.cxx
@@ -33,8 +33,18 @@ SwList::SwList( OUString sListId,
 {
 // create empty list trees for the document ranges
 const SwNode* pNode = rNodes[SwNodeOffset(0)];
+std::vector aVisited(static_cast(rNodes.Count()), false);
 do
 {
+SwNodeOffset nIndex = pNode->GetIndex();
+if (aVisited[static_cast(nIndex)])
+{
+// crashtesting ooo84576-1.odt, which manages to trigger a broken 
document structure
+// in our code. This is just a workaround to prevent an infinite 
loop leading to OOM.
+SAL_WARN("sw.core", "corrupt document structure, bailing out of 
infinite loop");
+throw css::uno::RuntimeException("corrupt document structure, 
bailing out of infinite loop");
+}
+aVisited[static_cast(nIndex)] = true;
 SwPaM aPam( *pNode, *pNode->EndOfSectionNode() );
 
 maListTrees.emplace_back(
@@ -46,7 +56,7 @@ SwList::SwList( OUString sListId,
 pNode = pNode->EndOfSectionNode();
 if (pNode != ())
 {
-SwNodeOffset nIndex = pNode->GetIndex();
+nIndex = pNode->GetIndex();
 nIndex++;
 pNode = rNodes[nIndex];
 }
diff --git a/xmloff/source/text/XMLTextListBlockContext.cxx 
b/xmloff/source/text/XMLTextListBlockContext.cxx
index 7c688f4c5e6c..c22eb2e221f2 100644
--- a/xmloff/source/text/XMLTextListBlockContext.cxx
+++ b/xmloff/source/text/XMLTextListBlockContext.cxx
@@ -110,113 +110,121 @@ XMLTextListBlockContext::XMLTextListBlockContext(
 
 // Remember this list block.
 mrTxtImport.GetTextListHelper().PushListContext( this );
+try
+{
+mxNumRules = XMLTextListsHelper::MakeNumRule(GetImport(), mxNumRules,
+sParentListStyleName, msListStyleName,
+mnLevel, ,  );
+if( !mxNumRules.is() )
+return;
 
-mxNumRules = XMLTextListsHelper::MakeNumRule(GetImport(), mxNumRules,
-sParentListStyleName, msListStyleName,
-mnLevel, ,  );
-if( !mxNumRules.is() )
-return;
-
-if ( mnLevel != 0 ) // root  element
-return;
+if ( mnLevel != 0 ) // root  element
+return;
 
-XMLTextListsHelper& rTextListsHelper( mrTxtImport.GetTextListHelper() );
-// Inconsistent behavior regarding lists (#i92811#)
-OUString sListStyleDefaultListId;
-{
-uno::Reference< beans::XPropertySet > xNumRuleProps( mxNumRules, 
UNO_QUERY );
-if ( xNumRuleProps.is() )
+XMLTextListsHelper& rTextListsHelper( mrTxtImport.GetTextListHelper() 
);
+// Inconsistent behavior regarding lists (#i92811#)
+OUString sListStyleDefaultListId;
 {
-uno::Reference< beans::XPropertySetInfo > xNumRulePropSetInfo(
-xNumRuleProps->getPropertySetInfo());
-if (xNumRulePropSetInfo.is() &&
-xNumRulePropSetInfo->hasPropertyByName(
- s_PropNameDefaultListId))
+uno::Reference< beans::XPropertySet > xNumRuleProps( mxNumRules, 
UNO_QUERY );
+if ( xNumRuleProps.is() )
 {
-xNumRuleProps->getPropertyValue(s_PropNameDefaultListId)
->>= sListStyleDefaultListId;
-SAL_WARN_IF( sListStyleDefaultListId.isEmpty(), "xmloff",
-"no default list id found at numbering rules 
instance. Serious defect." );
+uno::Reference< beans::XPropertySetInfo > xNumRulePropSetInfo(
+
xNumRuleProps->getPropertySetInfo());
+if 

[Libreoffice-commits] core.git: sw/source xmloff/source

2021-08-23 Thread Samuel Mehrbrodt (via logerrit)
 sw/source/uibase/shells/drwbassh.cxx|   32 +---
 xmloff/source/text/XMLTextFrameHyperlinkContext.cxx |   11 ++
 2 files changed, 39 insertions(+), 4 deletions(-)

New commits:
commit 75cd2b0fa71c73ae815b80d8e42328024ea63555
Author: Samuel Mehrbrodt 
AuthorDate: Mon Aug 23 10:17:56 2021 +0200
Commit: Samuel Mehrbrodt 
CommitDate: Mon Aug 23 11:58:48 2021 +0200

tdf#143736 Load hyperlink from more shapes

And limit the shape types which can have a hyperlink to those known to work.

Change-Id: I3d3522bea1e756dad8ddc2041e6588a367f42a7c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120861
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt 

diff --git a/sw/source/uibase/shells/drwbassh.cxx 
b/sw/source/uibase/shells/drwbassh.cxx
index f6e077520719..d0f1a5900e5d 100644
--- a/sw/source/uibase/shells/drwbassh.cxx
+++ b/sw/source/uibase/shells/drwbassh.cxx
@@ -856,11 +856,35 @@ void SwDrawBaseShell::GetState(SfxItemSet& rSet)
 {
 if (pSdrView->GetMarkedObjectCount() != 1)
 rSet.DisableItem(nWhich);
-else if (nWhich == SID_OPEN_HYPERLINK || nWhich == 
SID_REMOVE_HYPERLINK
- || nWhich == SID_EDIT_HYPERLINK || nWhich == 
SID_COPY_HYPERLINK_LOCATION)
+
+const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
+SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
+sal_uInt16 nObjType = pObj->GetObjIdentifier();
+
+// Only enable hyperlink for the following types
+switch (nObjType)
+{
+case OBJ_PATHFILL:
+case OBJ_SECT:
+case OBJ_LINE:
+case OBJ_CUSTOMSHAPE:
+case OBJ_TEXT:
+case OBJ_RECT:
+case OBJ_CAPTION:
+case OBJ_POLY:
+case OBJ_PLIN:
+case E3D_SCENE_ID:
+case OBJ_MEASURE:
+case OBJ_EDGE:
+break;
+default:
+rSet.DisableItem(nWhich);
+break;
+}
+
+if (nWhich == SID_OPEN_HYPERLINK || nWhich == 
SID_REMOVE_HYPERLINK
+|| nWhich == SID_EDIT_HYPERLINK || nWhich == 
SID_COPY_HYPERLINK_LOCATION)
 {
-const SdrMarkList& rMarkList = 
pSdrView->GetMarkedObjectList();
-SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
 if (pObj->getHyperlink().isEmpty())
 rSet.DisableItem(nWhich);
 }
diff --git a/xmloff/source/text/XMLTextFrameHyperlinkContext.cxx 
b/xmloff/source/text/XMLTextFrameHyperlinkContext.cxx
index 7a1146ac8125..64e16f1470d6 100644
--- a/xmloff/source/text/XMLTextFrameHyperlinkContext.cxx
+++ b/xmloff/source/text/XMLTextFrameHyperlinkContext.cxx
@@ -115,6 +115,17 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > 
XMLTextFrameHyperlinkC
 case XML_ELEMENT(DRAW, XML_PATH):
 case XML_ELEMENT(DRAW, XML_ELLIPSE):
 case XML_ELEMENT(DRAW, XML_LINE):
+case XML_ELEMENT(DRAW, XML_RECT):
+case XML_ELEMENT(DRAW, XML_CAPTION):
+case XML_ELEMENT(DRAW, XML_POLYGON):
+case XML_ELEMENT(DRAW, XML_POLYLINE):
+case XML_ELEMENT(DRAW, XML_MEASURE):
+case XML_ELEMENT(DRAW, XML_CIRCLE):
+case XML_ELEMENT(DRAW, XML_CONNECTOR):
+case XML_ELEMENT(DRAW, XML_CONTROL):
+case XML_ELEMENT(DRAW, XML_PAGE_THUMBNAIL):
+case XML_ELEMENT(DRAW, XML_G):
+case XML_ELEMENT(DR3D, XML_SCENE):
 {
 Reference xShapes;
 SvXMLShapeContext* pShapeContext = 
XMLShapeImportHelper::CreateGroupChildContext(


[Libreoffice-commits] core.git: sw/source xmloff/source

2021-04-19 Thread Miklos Vajna (via logerrit)
 sw/source/ui/index/swuiidxmrk.cxx |   38 ++
 xmloff/source/text/txtflde.cxx|7 ++-
 xmloff/source/text/txtfldi.cxx|7 ++-
 3 files changed, 14 insertions(+), 38 deletions(-)

New commits:
commit 02ac62846ee82d7005733bf2396b25a5688362e0
Author: Miklos Vajna 
AuthorDate: Mon Apr 19 14:26:59 2021 +0200
Commit: Miklos Vajna 
CommitDate: Mon Apr 19 17:08:04 2021 +0200

sw bibliography, relative URLs: switch to absolute URLs in the doc model

Interestingly at least on Linux, our click handler doesn't know how to
open "test.pdf", but "test.pdf#page=2" works. If these URLs are normal
hyperlinks (and not biblio source URLs) then both work.

It turns out the hyperlink case works because the doc model deals with
absolute URLs and only ODF import/export converts to relative ones. Do
the same for



and that way the click handler gets an absolute URL even for "test.pdf",
which then works.

Change-Id: If8282f444d0f6e6defe4282e2753ae8b37b5b09a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114266
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/sw/source/ui/index/swuiidxmrk.cxx 
b/sw/source/ui/index/swuiidxmrk.cxx
index a8c8df620753..c16eacf36fab 100644
--- a/sw/source/ui/index/swuiidxmrk.cxx
+++ b/sw/source/ui/index/swuiidxmrk.cxx
@@ -51,8 +51,6 @@
 #include 
 #include 
 #include 
-#include 
-#include 
 #include 
 #include 
 #include 
@@ -72,20 +70,6 @@ using namespace com::sun::star::lang;
 using namespace com::sun::star::util;
 using namespace ::comphelper;
 
-namespace
-{
-/// Similar to comphelper::isFileUrl(), but handles relative URLs as well.
-bool IsFileUrl(SwWrtShell& rWrtSh, const OUString& rUrl)
-{
-SwDocShell* pDocShell = rWrtSh.GetDoc()->GetDocShell();
-OUString aBaseUrl = pDocShell->getDocumentBaseURL();
-OUString aAbs = INetURLObject::GetAbsURL(aBaseUrl, rUrl,
-INetURLObject::EncodeMechanism::WasEncoded,
-INetURLObject::DecodeMechanism::WithCharset);
-return comphelper::isFileUrl(aAbs);
-}
-}
-
 // dialog to insert a directory selection
 SwIndexMarkPane::SwIndexMarkPane(const std::shared_ptr& rDialog, 
weld::Builder& rBuilder, bool bNewDlg,
 SwWrtShell* pWrtShell)
@@ -1571,7 +1555,7 @@ 
SwCreateAuthEntryDlg_Impl::SwCreateAuthEntryDlg_Impl(weld::Window* pParent,
 if(!pFields[aCurInfo.nToxField].isEmpty())
 {
 int nPos = pFields[aCurInfo.nToxField].toInt32();
-if (nPos == AUTH_TYPE_WWW && IsFileUrl(rWrtSh, 
pFields[AUTH_FIELD_URL]))
+if (nPos == AUTH_TYPE_WWW && 
comphelper::isFileUrl(pFields[AUTH_FIELD_URL]))
 {
 // Map file URL to local file.
 nPos = AUTH_TYPE_END;
@@ -1645,7 +1629,7 @@ 
SwCreateAuthEntryDlg_Impl::SwCreateAuthEntryDlg_Impl(weld::Window* pParent,
 }
 }
 else if (aCurInfo.nToxField == AUTH_FIELD_URL
- && IsFileUrl(rWrtSh, pFields[aCurInfo.nToxField]))
+ && comphelper::isFileUrl(pFields[aCurInfo.nToxField]))
 {
 m_xBrowseButton->show();
 }
@@ -1751,18 +1735,8 @@ IMPL_LINK_NOARG(SwCreateAuthEntryDlg_Impl, BrowseHdl, 
weld::Button&, void)
 sfx2::FileDialogHelper 
aFileDlg(ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE,
 FileDialogFlags::NONE, getDialog());
 OUString aPath = GetEntryText(AUTH_FIELD_URL);
-bool bSaveRelFSys = 
officecfg::Office::Common::Save::URL::FileSystem::get();
 if (!aPath.isEmpty())
 {
-if (bSaveRelFSys && !IsFileUrl(rWrtSh, aPath))
-{
-SwDocShell* pDocShell = rWrtSh.GetDoc()->GetDocShell();
-OUString aBasePath = pDocShell->getDocumentBaseURL();
-aPath = INetURLObject::GetAbsURL(aBasePath, aPath,
- 
INetURLObject::EncodeMechanism::WasEncoded,
- 
INetURLObject::DecodeMechanism::WithCharset);
-}
-
 aFileDlg.SetDisplayDirectory(aPath);
 }
 
@@ -1772,14 +1746,6 @@ IMPL_LINK_NOARG(SwCreateAuthEntryDlg_Impl, BrowseHdl, 
weld::Button&, void)
 }
 
 aPath = aFileDlg.GetPath();
-if (bSaveRelFSys)
-{
-SwDocShell* pDocShell = rWrtSh.GetDoc()->GetDocShell();
-OUString aBasePath = pDocShell->getDocumentBaseURL();
-aPath
-= INetURLObject::GetRelURL(aBasePath, aPath, 
INetURLObject::EncodeMechanism::WasEncoded,
-   
INetURLObject::DecodeMechanism::WithCharset);
-}
 
 for (int nIndex = 0; nIndex < AUTH_FIELD_END; nIndex++)
 {
diff --git a/xmloff/source/text/txtflde.cxx b/xmloff/source/text/txtflde.cxx
index 50d072b6b2a9..111df2f0a7bf 100644
--- a/xmloff/source/text/txtflde.cxx
+++ b/xmloff/source/text/txtflde.cxx
@@ -2731,8 +2731,13 

[Libreoffice-commits] core.git: sw/source xmloff/source

2020-08-21 Thread Noel Grandin (via logerrit)
 sw/source/filter/xml/xmlfmt.cxx  |4 
 xmloff/source/draw/ximpstyl.cxx  |8 
 xmloff/source/style/XMLFontStylesContext.cxx |4 ++--
 xmloff/source/style/prstylei.cxx |4 
 xmloff/source/text/XMLFootnoteConfigurationImportContext.cxx |   11 +--
 xmloff/source/text/XMLTextMasterPageContext.cxx  |5 -
 6 files changed, 3 insertions(+), 33 deletions(-)

New commits:
commit 48291e148c97cf48d25425e81b045e7feddd5b50
Author: Noel Grandin 
AuthorDate: Fri Aug 21 09:46:48 2020 +0200
Commit: Noel Grandin 
CommitDate: Fri Aug 21 16:01:58 2020 +0200

no need to call superclass here

there is no CreateChildContext in the superclass
(and the next implementation of that method that is actually called is
not going to do anything useful here)

Change-Id: I503924eaaef8f450549c2eaa2195661ce0de8c2f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101136
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sw/source/filter/xml/xmlfmt.cxx b/sw/source/filter/xml/xmlfmt.cxx
index 5bd4debc2d27..49e1224cdb83 100644
--- a/sw/source/filter/xml/xmlfmt.cxx
+++ b/sw/source/filter/xml/xmlfmt.cxx
@@ -651,10 +651,6 @@ SvXMLImportContextRef 
SwXMLItemSetStyleContext_Impl::CreateChildContext(
 }
 }
 
-if (!xContext)
-xContext = SvXMLStyleContext::CreateChildContext( nPrefix, rLocalName,
-  xAttrList );
-
 return xContext;
 }
 
diff --git a/xmloff/source/draw/ximpstyl.cxx b/xmloff/source/draw/ximpstyl.cxx
index 6aee9df7f8ac..4e638adc1c5b 100644
--- a/xmloff/source/draw/ximpstyl.cxx
+++ b/xmloff/source/draw/ximpstyl.cxx
@@ -430,10 +430,6 @@ SvXMLImportContextRef 
SdXMLPageMasterContext::CreateChildContext(
 xContext = mxPageMasterStyle.get();
 }
 
-// call base class
-if (!xContext)
-xContext = SvXMLStyleContext::CreateChildContext(nPrefix, rLocalName, 
xAttrList);
-
 return xContext;
 }
 
@@ -467,10 +463,6 @@ SvXMLImportContextRef 
SdXMLPresentationPageLayoutContext::CreateChildContext(
 maList.push_back(xLclContext);
 }
 
-// call base class
-if (!xContext)
-xContext = SvXMLStyleContext::CreateChildContext(nPrefix, rLocalName, 
xAttrList);
-
 return xContext;
 }
 
diff --git a/xmloff/source/style/XMLFontStylesContext.cxx 
b/xmloff/source/style/XMLFontStylesContext.cxx
index 450525fe795c..e17b79bd6ecb 100644
--- a/xmloff/source/style/XMLFontStylesContext.cxx
+++ b/xmloff/source/style/XMLFontStylesContext.cxx
@@ -179,11 +179,11 @@ void XMLFontStyleContextFontFace::FillProperties(
 SvXMLImportContextRef XMLFontStyleContextFontFace::CreateChildContext(
 sal_uInt16 nPrefix,
 const OUString& rLocalName,
-const css::uno::Reference< css::xml::sax::XAttributeList > & xAttrList 
)
+const css::uno::Reference< css::xml::sax::XAttributeList > &  )
 {
 if( nPrefix == XML_NAMESPACE_SVG && IsXMLToken( rLocalName, 
XML_FONT_FACE_SRC ))
 return new XMLFontStyleContextFontFaceSrc( GetImport(), nPrefix, 
rLocalName, *this );
-return SvXMLStyleContext::CreateChildContext( nPrefix, rLocalName, 
xAttrList );
+return nullptr;
 }
 
 OUString XMLFontStyleContextFontFace::familyName() const
diff --git a/xmloff/source/style/prstylei.cxx b/xmloff/source/style/prstylei.cxx
index 1222fbd50ca7..02362142ee41 100644
--- a/xmloff/source/style/prstylei.cxx
+++ b/xmloff/source/style/prstylei.cxx
@@ -220,10 +220,6 @@ SvXMLImportContextRef 
XMLPropStyleContext::CreateChildContext(
 xImpPrMap );
 }
 
-if (!xContext)
-xContext = SvXMLStyleContext::CreateChildContext( nPrefix, rLocalName,
-  xAttrList );
-
 return xContext;
 }
 
diff --git a/xmloff/source/text/XMLFootnoteConfigurationImportContext.cxx 
b/xmloff/source/text/XMLFootnoteConfigurationImportContext.cxx
index 7897ce908e20..ea03a0589969 100644
--- a/xmloff/source/text/XMLFootnoteConfigurationImportContext.cxx
+++ b/xmloff/source/text/XMLFootnoteConfigurationImportContext.cxx
@@ -277,7 +277,7 @@ void XMLFootnoteConfigurationImportContext::SetAttribute( 
sal_uInt16 nPrefixKey,
 SvXMLImportContextRef 
XMLFootnoteConfigurationImportContext::CreateChildContext(
 sal_uInt16 nPrefix,
 const OUString& rLocalName,
-const Reference & xAttrList )
+const Reference &  )
 {
 SvXMLImportContextRef xContext;
 
@@ -303,15 +303,6 @@ SvXMLImportContextRef 
XMLFootnoteConfigurationImportContext::CreateChildContext(
 }
 // else: unknown namespace -> default context
 }
-// else: endnote -> default context
-
-if (!xContext)
-{
-// default: delegate to super class
-xContext = SvXMLStyleContext::CreateChildContext(nPrefix,
- 

[Libreoffice-commits] core.git: sw/source xmloff/source

2018-03-06 Thread Noel Grandin
 sw/source/core/unocore/unomap1.cxx |3 +--
 sw/source/uibase/utlui/uiitems.cxx |   11 +++
 xmloff/source/style/XMLFootnoteSeparatorExport.cxx |3 +--
 3 files changed, 9 insertions(+), 8 deletions(-)

New commits:
commit 2407c183092d6559771738891d57d6375c4212ab
Author: Noel Grandin 
Date:   Tue Mar 6 14:16:48 2018 +0100

Revert "tdf#115432 footnote separator position remain in the left side"

This reverts commit d4a8d91abd40dee7f7bd739a678a502a6e34cb59.

because it changes the type of an UNO property defined in a published IDL 
file

Change-Id: I4d3db3532b27552a30f34fcd4201856565eb0a3b
Reviewed-on: https://gerrit.libreoffice.org/50825
Tested-by: Jenkins 
Reviewed-by: Noel Grandin 

diff --git a/sw/source/core/unocore/unomap1.cxx 
b/sw/source/core/unocore/unomap1.cxx
index 522a9bc8610e..fbe12b66844e 100644
--- a/sw/source/core/unocore/unomap1.cxx
+++ b/sw/source/core/unocore/unomap1.cxx
@@ -58,7 +58,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -584,7 +583,7 @@ const SfxItemPropertyMapEntry*  
SwUnoPropertyMapProvider::GetPageStylePropertyMa
 { OUString(UNO_NAME_FOOTNOTE_LINE_COLOR), FN_PARAM_FTN_INFO,
cppu::UnoType::get(),   PROPERTY_NONE , MID_LINE_COLOR},
 { OUString(UNO_NAME_FOOTNOTE_LINE_STYLE), FN_PARAM_FTN_INFO,
cppu::UnoType::get(),PROPERTY_NONE , MID_FTN_LINE_STYLE},
 { OUString(UNO_NAME_FOOTNOTE_LINE_RELATIVE_WIDTH), FN_PARAM_FTN_INFO,  
 cppu::UnoType::get(),PROPERTY_NONE , 
MID_LINE_RELWIDTH},
-{ OUString(UNO_NAME_FOOTNOTE_LINE_ADJUST), FN_PARAM_FTN_INFO,   
cppu::UnoType::get(),   PROPERTY_NONE , 
MID_LINE_ADJUST },
+{ OUString(UNO_NAME_FOOTNOTE_LINE_ADJUST), FN_PARAM_FTN_INFO,   
cppu::UnoType::get(),   PROPERTY_NONE , MID_LINE_ADJUST },
 { OUString(UNO_NAME_FOOTNOTE_LINE_TEXT_DISTANCE), FN_PARAM_FTN_INFO,   
 cppu::UnoType::get(),   PROPERTY_NONE , MID_LINE_TEXT_DIST  
 |CONVERT_TWIPS },
 { OUString(UNO_NAME_FOOTNOTE_LINE_DISTANCE), FN_PARAM_FTN_INFO,
 cppu::UnoType::get(),   PROPERTY_NONE , 
MID_LINE_FOOTNOTE_DIST|CONVERT_TWIPS},
 { OUString(UNO_NAME_WRITING_MODE), RES_FRAMEDIR, 
cppu::UnoType::get(), PROPERTY_NONE, 0 },
diff --git a/sw/source/uibase/utlui/uiitems.cxx 
b/sw/source/uibase/utlui/uiitems.cxx
index eb1d80be738f..8b3f02a74b8a 100644
--- a/sw/source/uibase/utlui/uiitems.cxx
+++ b/sw/source/uibase/utlui/uiitems.cxx
@@ -18,7 +18,6 @@
  */
 
 #include 
-#include 
 #include 
 
 #include 
@@ -87,7 +86,7 @@ bool SwPageFootnoteInfoItem::QueryValue( Any& rVal, sal_uInt8 
nMemberId ) const
 rVal <<= static_cast(static_cast(aTmp));
 }
 break;
-case MID_LINE_ADJUST   : rVal <<= 
aFootnoteInfo.GetAdj();break;//text::HorizontalAdjust
+case MID_LINE_ADJUST   : rVal <<= 
static_cast(aFootnoteInfo.GetAdj());break;//text::HorizontalAdjust
 case MID_LINE_TEXT_DIST: rVal <<= 
static_cast(convertTwipToMm100(aFootnoteInfo.GetTopDist()));break;
 case MID_LINE_FOOTNOTE_DIST: rVal <<= 
static_cast(convertTwipToMm100(aFootnoteInfo.GetBottomDist()));break;
 case MID_FTN_LINE_STYLE:
@@ -157,8 +156,12 @@ bool SwPageFootnoteInfoItem::PutValue(const Any& rVal, 
sal_uInt8 nMemberId)
 break;
 case MID_LINE_ADJUST   :
 {
-text::HorizontalAdjust nSet = 
*o3tl::forceAccess(rVal);
-aFootnoteInfo.SetAdj(nSet);
+sal_Int16 nSet = 0;
+rVal >>= nSet;
+if(nSet >= 0 && nSet < 3) //text::HorizontalAdjust
+
aFootnoteInfo.SetAdj(static_cast(nSet));
+else
+bRet = false;
 }
 break;
 case MID_FTN_LINE_STYLE:
diff --git a/xmloff/source/style/XMLFootnoteSeparatorExport.cxx 
b/xmloff/source/style/XMLFootnoteSeparatorExport.cxx
index edf57dd3a6bd..5446398e5e72 100644
--- a/xmloff/source/style/XMLFootnoteSeparatorExport.cxx
+++ b/xmloff/source/style/XMLFootnoteSeparatorExport.cxx
@@ -31,7 +31,6 @@
 #include 
 #include 
 #include 
-#include 
 
 
 using namespace ::com::sun::star;
@@ -76,7 +75,7 @@ void XMLFootnoteSeparatorExport::exportXML(
 switch (rMapper->GetEntryContextId(rState.mnIndex))
 {
 case CTF_PM_FTN_LINE_ADJUST:
-eLineAdjust = 
*o3tl::forceAccess(rState.maValue);
+rState.maValue >>= eLineAdjust;
 break;
 case CTF_PM_FTN_LINE_COLOR:
 rState.maValue >>= nLineColor;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sw/source xmloff/source

2018-02-27 Thread Noel Grandin
 sw/source/core/unocore/unomap1.cxx |3 ++-
 sw/source/uibase/utlui/uiitems.cxx |   11 ---
 xmloff/source/style/XMLFootnoteSeparatorExport.cxx |3 ++-
 3 files changed, 8 insertions(+), 9 deletions(-)

New commits:
commit d4a8d91abd40dee7f7bd739a678a502a6e34cb59
Author: Noel Grandin 
Date:   Tue Feb 27 13:06:31 2018 +0200

tdf#115432 footnote separator position remain in the left side

regression from
commit 7e9857c2935bb2533806db4e71c6cd1e171c3478
"templatize SvXMLEnumMapEntry"

Change-Id: Id29e7c07be637adcdc7fe624a1673beca9829d4d
Reviewed-on: https://gerrit.libreoffice.org/50420
Reviewed-by: Noel Grandin 
Tested-by: Noel Grandin 

diff --git a/sw/source/core/unocore/unomap1.cxx 
b/sw/source/core/unocore/unomap1.cxx
index fbe12b66844e..522a9bc8610e 100644
--- a/sw/source/core/unocore/unomap1.cxx
+++ b/sw/source/core/unocore/unomap1.cxx
@@ -58,6 +58,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -583,7 +584,7 @@ const SfxItemPropertyMapEntry*  
SwUnoPropertyMapProvider::GetPageStylePropertyMa
 { OUString(UNO_NAME_FOOTNOTE_LINE_COLOR), FN_PARAM_FTN_INFO,
cppu::UnoType::get(),   PROPERTY_NONE , MID_LINE_COLOR},
 { OUString(UNO_NAME_FOOTNOTE_LINE_STYLE), FN_PARAM_FTN_INFO,
cppu::UnoType::get(),PROPERTY_NONE , MID_FTN_LINE_STYLE},
 { OUString(UNO_NAME_FOOTNOTE_LINE_RELATIVE_WIDTH), FN_PARAM_FTN_INFO,  
 cppu::UnoType::get(),PROPERTY_NONE , 
MID_LINE_RELWIDTH},
-{ OUString(UNO_NAME_FOOTNOTE_LINE_ADJUST), FN_PARAM_FTN_INFO,   
cppu::UnoType::get(),   PROPERTY_NONE , MID_LINE_ADJUST },
+{ OUString(UNO_NAME_FOOTNOTE_LINE_ADJUST), FN_PARAM_FTN_INFO,   
cppu::UnoType::get(),   PROPERTY_NONE , 
MID_LINE_ADJUST },
 { OUString(UNO_NAME_FOOTNOTE_LINE_TEXT_DISTANCE), FN_PARAM_FTN_INFO,   
 cppu::UnoType::get(),   PROPERTY_NONE , MID_LINE_TEXT_DIST  
 |CONVERT_TWIPS },
 { OUString(UNO_NAME_FOOTNOTE_LINE_DISTANCE), FN_PARAM_FTN_INFO,
 cppu::UnoType::get(),   PROPERTY_NONE , 
MID_LINE_FOOTNOTE_DIST|CONVERT_TWIPS},
 { OUString(UNO_NAME_WRITING_MODE), RES_FRAMEDIR, 
cppu::UnoType::get(), PROPERTY_NONE, 0 },
diff --git a/sw/source/uibase/utlui/uiitems.cxx 
b/sw/source/uibase/utlui/uiitems.cxx
index 8b3f02a74b8a..eb1d80be738f 100644
--- a/sw/source/uibase/utlui/uiitems.cxx
+++ b/sw/source/uibase/utlui/uiitems.cxx
@@ -18,6 +18,7 @@
  */
 
 #include 
+#include 
 #include 
 
 #include 
@@ -86,7 +87,7 @@ bool SwPageFootnoteInfoItem::QueryValue( Any& rVal, sal_uInt8 
nMemberId ) const
 rVal <<= static_cast(static_cast(aTmp));
 }
 break;
-case MID_LINE_ADJUST   : rVal <<= 
static_cast(aFootnoteInfo.GetAdj());break;//text::HorizontalAdjust
+case MID_LINE_ADJUST   : rVal <<= 
aFootnoteInfo.GetAdj();break;//text::HorizontalAdjust
 case MID_LINE_TEXT_DIST: rVal <<= 
static_cast(convertTwipToMm100(aFootnoteInfo.GetTopDist()));break;
 case MID_LINE_FOOTNOTE_DIST: rVal <<= 
static_cast(convertTwipToMm100(aFootnoteInfo.GetBottomDist()));break;
 case MID_FTN_LINE_STYLE:
@@ -156,12 +157,8 @@ bool SwPageFootnoteInfoItem::PutValue(const Any& rVal, 
sal_uInt8 nMemberId)
 break;
 case MID_LINE_ADJUST   :
 {
-sal_Int16 nSet = 0;
-rVal >>= nSet;
-if(nSet >= 0 && nSet < 3) //text::HorizontalAdjust
-
aFootnoteInfo.SetAdj(static_cast(nSet));
-else
-bRet = false;
+text::HorizontalAdjust nSet = 
*o3tl::forceAccess(rVal);
+aFootnoteInfo.SetAdj(nSet);
 }
 break;
 case MID_FTN_LINE_STYLE:
diff --git a/xmloff/source/style/XMLFootnoteSeparatorExport.cxx 
b/xmloff/source/style/XMLFootnoteSeparatorExport.cxx
index 5446398e5e72..edf57dd3a6bd 100644
--- a/xmloff/source/style/XMLFootnoteSeparatorExport.cxx
+++ b/xmloff/source/style/XMLFootnoteSeparatorExport.cxx
@@ -31,6 +31,7 @@
 #include 
 #include 
 #include 
+#include 
 
 
 using namespace ::com::sun::star;
@@ -75,7 +76,7 @@ void XMLFootnoteSeparatorExport::exportXML(
 switch (rMapper->GetEntryContextId(rState.mnIndex))
 {
 case CTF_PM_FTN_LINE_ADJUST:
-rState.maValue >>= eLineAdjust;
+eLineAdjust = 
*o3tl::forceAccess(rState.maValue);
 break;
 case CTF_PM_FTN_LINE_COLOR:
 rState.maValue >>= nLineColor;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sw/source xmloff/source

2017-09-20 Thread Michael Stahl
 sw/source/filter/xml/xmlfmt.cxx |   40 +++-
 sw/source/uibase/chrdlg/ccoll.cxx   |2 +
 xmloff/source/style/prstylecond.cxx |   21 +-
 xmloff/source/style/styleexp.cxx|   17 +++
 4 files changed, 42 insertions(+), 38 deletions(-)

New commits:
commit 0ae13c77b6b20c2b58131fd21fea0ffce2a7a825
Author: Michael Stahl 
Date:   Wed Sep 20 14:29:10 2017 +0200

xmloff,sw: some stylistic cleanup to conditional styles

Change-Id: I1722a0b3d67a7c8740daa5a131d7800319ee2373

diff --git a/sw/source/filter/xml/xmlfmt.cxx b/sw/source/filter/xml/xmlfmt.cxx
index 8f60091126c1..904a102722b1 100644
--- a/sw/source/filter/xml/xmlfmt.cxx
+++ b/sw/source/filter/xml/xmlfmt.cxx
@@ -311,36 +311,40 @@ SwXMLTextStyleContext_Impl::Finish( bool bOverwrite )
 
 if( pConditions && XML_STYLE_FAMILY_TEXT_PARAGRAPH == GetFamily() && 
xNewStyle.is() )
 {
-CommandStruct const *aCommands = SwCondCollItem::GetCmds();
+CommandStruct const*const pCommands = SwCondCollItem::GetCmds();
 
 Reference< XPropertySet > xPropSet( xNewStyle, UNO_QUERY );
 
 uno::Sequence< beans::NamedValue > aSeq( pConditions->size() );
 
-std::vector::size_type i;
-unsigned j;
-
-for( i = 0; i < pConditions->size(); ++i )
+for 
(std::vector::size_type i = 0;
+i < pConditions->size(); ++i)
 {
-if( (*pConditions)[i]->IsValid() )
-{
-Master_CollCondition nCond = (*pConditions)[i]->getCondition();
-sal_uInt32 nSubCond = (*pConditions)[i]->getSubCondition();
+assert((*pConditions)[i]->IsValid()); // checked before inserting
+Master_CollCondition nCond = (*pConditions)[i]->getCondition();
+sal_uInt32 nSubCond = (*pConditions)[i]->getSubCondition();
 
-for( j = 0; j < COND_COMMAND_COUNT; ++j )
+for (size_t j = 0; j < COND_COMMAND_COUNT; ++j)
+{
+if (pCommands[j].nCnd == nCond &&
+pCommands[j].nSubCond == nSubCond)
 {
-if( aCommands[j].nCnd == nCond &&
-aCommands[j].nSubCond == nSubCond )
-{
-aSeq[i].Name = GetCommandContextByIndex( j );
-aSeq[i].Value <<= GetImport().GetStyleDisplayName( 
GetFamily(), (*pConditions)[i]->getApplyStyle() );
-break;
-}
+aSeq[i].Name = GetCommandContextByIndex( j );
+aSeq[i].Value <<= GetImport().GetStyleDisplayName(
+GetFamily(), (*pConditions)[i]->getApplyStyle() );
+break;
 }
 }
 }
 
-xPropSet->setPropertyValue( UNO_NAME_PARA_STYLE_CONDITIONS, 
uno::makeAny( aSeq )  );
+try
+{
+xPropSet->setPropertyValue(UNO_NAME_PARA_STYLE_CONDITIONS, 
uno::makeAny(aSeq));
+}
+catch (uno::Exception const& e)
+{
+SAL_WARN("sw.xml", "exception when setting ParaStyleConditions: " 
<< e.Message);
+}
 }
 XMLTextStyleContext::Finish( bOverwrite );
 }
diff --git a/sw/source/uibase/chrdlg/ccoll.cxx 
b/sw/source/uibase/chrdlg/ccoll.cxx
index d4b617b12d9b..58f77f5770db 100644
--- a/sw/source/uibase/chrdlg/ccoll.cxx
+++ b/sw/source/uibase/chrdlg/ccoll.cxx
@@ -41,6 +41,8 @@
 //!! order of entries has to be the same as in
 //!! CommandStruct SwCondCollItem::aCmds[]
 
+// note: also keep this in sync with the list of conditions in 
xmloff/source/style/prstylecond.cxx
+
 const char * const aCommandContext[COND_COMMAND_COUNT] =
 {
 "TableHeader",
diff --git a/xmloff/source/style/prstylecond.cxx 
b/xmloff/source/style/prstylecond.cxx
index 4568c6bc88b2..63b7e3ace250 100644
--- a/xmloff/source/style/prstylecond.cxx
+++ b/xmloff/source/style/prstylecond.cxx
@@ -23,12 +23,14 @@
 
 using namespace ::xmloff::token;
 
-static struct ConditionMap
+// note: keep this in sync with the list of conditions in 
sw/source/uibase/chrdlg/ccoll.cxx
+
+static const struct ConditionMap
 {
 char const* aInternal;
 XMLTokenEnum nExternal;
 int aValue;
-} aConditionMap[] =
+} g_ConditionMap[] =
 {
 { "TableHeader",XML_TABLE_HEADER,   -1 },
 { "Table",  XML_TABLE,  -1 },
@@ -60,27 +62,24 @@ static struct ConditionMap
 { "NumberingLevel10",   XML_LIST_LEVEL, 10 }
 };
 
-#define CONDITION_COUNT (sizeof(aConditionMap) / sizeof(aConditionMap[0]))
-
 OUString GetParaStyleCondExternal( OUString const )
 {
-unsigned i;
-
-for(i = 0; i < CONDITION_COUNT; ++i)
+for (size_t i = 0; i < SAL_N_ELEMENTS(g_ConditionMap); ++i)
 {
-if(internal.compareToAscii( aConditionMap[i].aInternal ) == 0)
+if 

[Libreoffice-commits] core.git: sw/source xmloff/source

2017-07-26 Thread Takeshi Abe
 sw/source/filter/xml/xmlbrsh.cxx  |2 +-
 sw/source/filter/xml/xmlimp.cxx   |2 +-
 xmloff/source/draw/XMLImageMapContext.cxx |2 +-
 xmloff/source/style/DashStyle.cxx |2 +-
 xmloff/source/style/xmlstyle.cxx  |2 +-
 xmloff/source/style/xmltabi.cxx   |2 +-
 xmloff/source/xforms/TokenContext.cxx |2 +-
 xmloff/source/xforms/TokenContext.hxx |3 ++-
 8 files changed, 9 insertions(+), 8 deletions(-)

New commits:
commit f30530229bb47c373fb99bb3f90bac77d5c8a116
Author: Takeshi Abe 
Date:   Mon Jul 24 23:33:29 2017 +0900

Mark SvXMLTokenMapEntry arrays as constant

Change-Id: I37565540ec5dc3bfddf6cdeb20447f837e3014b6
Reviewed-on: https://gerrit.libreoffice.org/40374
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/sw/source/filter/xml/xmlbrsh.cxx b/sw/source/filter/xml/xmlbrsh.cxx
index f5bdd520c1f3..a8530e4dd172 100644
--- a/sw/source/filter/xml/xmlbrsh.cxx
+++ b/sw/source/filter/xml/xmlbrsh.cxx
@@ -51,7 +51,7 @@ enum SvXMLTokenMapAttrs
 XML_TOK_BGIMG_FILTER,
 };
 
-static SvXMLTokenMapEntry aBGImgAttributesAttrTokenMap[] =
+static const SvXMLTokenMapEntry aBGImgAttributesAttrTokenMap[] =
 {
 { XML_NAMESPACE_XLINK, XML_HREF,XML_TOK_BGIMG_HREF  },
 { XML_NAMESPACE_XLINK, XML_TYPE,XML_TOK_BGIMG_TYPE  },
diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx
index 34fc6afeaa54..41172c2bda21 100644
--- a/sw/source/filter/xml/xmlimp.cxx
+++ b/sw/source/filter/xml/xmlimp.cxx
@@ -99,7 +99,7 @@ enum SwXMLDocTokens
 XML_TOK_DOC_XFORMS,
 };
 
-static SvXMLTokenMapEntry aDocTokenMap[] =
+static const SvXMLTokenMapEntry aDocTokenMap[] =
 {
 { XML_NAMESPACE_OFFICE, XML_FONT_FACE_DECLS, XML_TOK_DOC_FONTDECLS  },
 { XML_NAMESPACE_OFFICE, XML_STYLES, XML_TOK_DOC_STYLES  },
diff --git a/xmloff/source/draw/XMLImageMapContext.cxx 
b/xmloff/source/draw/XMLImageMapContext.cxx
index d7d967bd2202..fdc1f145be60 100644
--- a/xmloff/source/draw/XMLImageMapContext.cxx
+++ b/xmloff/source/draw/XMLImageMapContext.cxx
@@ -73,7 +73,7 @@ enum XMLImageMapToken: decltype(XML_TOK_UNKNOWN)
 XML_TOK_IMAP_TARGET
 };
 
-static SvXMLTokenMapEntry aImageMapObjectTokenMap[] =
+static const SvXMLTokenMapEntry aImageMapObjectTokenMap[] =
 {
 { XML_NAMESPACE_XLINK,  XML_HREF,   XML_TOK_IMAP_URL},
 { XML_NAMESPACE_OFFICE, XML_NAME,   XML_TOK_IMAP_NAME   },
diff --git a/xmloff/source/style/DashStyle.cxx 
b/xmloff/source/style/DashStyle.cxx
index bbb49ba29945..f68e535d7ebc 100644
--- a/xmloff/source/style/DashStyle.cxx
+++ b/xmloff/source/style/DashStyle.cxx
@@ -50,7 +50,7 @@ enum SvXMLTokenMapAttrs
 XML_TOK_DASH_DISTANCE,
 };
 
-static SvXMLTokenMapEntry aDashStyleAttrTokenMap[] =
+static const SvXMLTokenMapEntry aDashStyleAttrTokenMap[] =
 {
 { XML_NAMESPACE_DRAW, XML_NAME, XML_TOK_DASH_NAME },
 { XML_NAMESPACE_DRAW, XML_DISPLAY_NAME, XML_TOK_DASH_DISPLAY_NAME },
diff --git a/xmloff/source/style/xmlstyle.cxx b/xmloff/source/style/xmlstyle.cxx
index a44a04321b62..40014f2c6bbe 100644
--- a/xmloff/source/style/xmlstyle.cxx
+++ b/xmloff/source/style/xmlstyle.cxx
@@ -63,7 +63,7 @@ using namespace ::com::sun::star::container;
 using namespace ::com::sun::star::style;
 using namespace ::xmloff::token;
 
-static SvXMLTokenMapEntry aStyleStylesElemTokenMap[] =
+static const SvXMLTokenMapEntry aStyleStylesElemTokenMap[] =
 {
 { XML_NAMESPACE_STYLE,  XML_STYLE,  XML_TOK_STYLE_STYLE
},
 { XML_NAMESPACE_STYLE,  XML_PAGE_LAYOUT,XML_TOK_STYLE_PAGE_MASTER  
},
diff --git a/xmloff/source/style/xmltabi.cxx b/xmloff/source/style/xmltabi.cxx
index 0e4c1ca665b5..b7efacba6027 100644
--- a/xmloff/source/style/xmltabi.cxx
+++ b/xmloff/source/style/xmltabi.cxx
@@ -43,7 +43,7 @@ enum SvXMLTokenMapAttrs
 XML_TOK_TABSTOP_LEADER_TEXT
 };
 
-static SvXMLTokenMapEntry aTabsAttributesAttrTokenMap[] =
+static const SvXMLTokenMapEntry aTabsAttributesAttrTokenMap[] =
 {
 { XML_NAMESPACE_STYLE, XML_POSITION, XML_TOK_TABSTOP_POSITION },
 { XML_NAMESPACE_STYLE, XML_TYPE, XML_TOK_TABSTOP_TYPE },
diff --git a/xmloff/source/xforms/TokenContext.cxx 
b/xmloff/source/xforms/TokenContext.cxx
index 2b3fb58f1f11..22dd5747c895 100644
--- a/xmloff/source/xforms/TokenContext.cxx
+++ b/xmloff/source/xforms/TokenContext.cxx
@@ -30,7 +30,7 @@
 using com::sun::star::uno::Reference;
 using com::sun::star::xml::sax::XAttributeList;
 
-struct SvXMLTokenMapEntry aEmptyMap[1] =
+const SvXMLTokenMapEntry aEmptyMap[1] =
 {
 XML_TOKEN_MAP_END
 };
diff --git a/xmloff/source/xforms/TokenContext.hxx 
b/xmloff/source/xforms/TokenContext.hxx
index a19b8503758e..fe26c740488a 100644
--- a/xmloff/source/xforms/TokenContext.hxx
+++ b/xmloff/source/xforms/TokenContext.hxx
@@ -21,6 +21,7 @@
 #define 

[Libreoffice-commits] core.git: sw/source xmloff/source

2017-03-10 Thread dennisroczek
 sw/source/core/layout/layact.cxx  |   23 ++-
 xmloff/source/transform/Oasis2OOo.cxx |   11 +--
 2 files changed, 15 insertions(+), 19 deletions(-)

New commits:
commit 8636e2462d9a8f7ed092246cc152030467d96515
Author: dennisroczek 
Date:   Fri Mar 10 18:57:55 2017 +

fix typo: savety --> safety

Change-Id: I6fab05c05c8f79607b75429f32be0497b54b3cb7
Reviewed-on: https://gerrit.libreoffice.org/35059
Tested-by: Jenkins 
Reviewed-by: Julien Nabet 

diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx
index 33d5334..26ae76b 100644
--- a/sw/source/core/layout/layact.cxx
+++ b/sw/source/core/layout/layact.cxx
@@ -1579,7 +1579,7 @@ bool SwLayAction::FormatLayoutTab( SwTabFrame *pTab, bool 
bAddRect )
 if ( IsAgain() )
 return false;
 
-// for savety reasons:
+// for safety reasons:
 // check page number before formatting lowers.
 if ( pOldPage->GetPhyPageNum() > (pTab->FindPageFrame()->GetPhyPageNum() + 
1) )
 SetNextCycle( true );
@@ -1608,7 +1608,7 @@ bool SwLayAction::FormatContent( const SwPageFrame *pPage 
)
 
 while ( pContent && pPage->IsAnLower( pContent ) )
 {
-// If the Content didn't change, we can use a few shortcuts.
+// If the content didn't change, we can use a few shortcuts.
 const bool bFull = !pContent->IsValid() || pContent->IsCompletePaint() 
||
pContent->IsRetouche() || pContent->GetDrawObjs();
 if ( bFull )
@@ -1676,7 +1676,7 @@ bool SwLayAction::FormatContent( const SwPageFrame *pPage 
)
 if (  nCurNum < pPage->GetPhyPageNum() )
 m_nPreInvaPage = nCurNum;
 
-// If the Frame flowed backwards more than one page, we need to
+// If the frame flowed backwards more than one page, we need to
 // start over again from the beginning, so nothing gets left 
out.
 if ( !IsCalcLayout() && pPage->GetPhyPageNum() > nCurNum+1 )
 {
@@ -1688,7 +1688,7 @@ bool SwLayAction::FormatContent( const SwPageFrame *pPage 
)
 }
 }
 }
-// If the Frame moved forwards to the next page, we re-run through
+// If the frame moved forwards to the next page, we re-run through
 // the predecessor.
 // This way, we catch predecessors which are now responsible for
 // retouching, but the footers will be touched also.
@@ -1742,7 +1742,7 @@ bool SwLayAction::FormatContent( const SwPageFrame *pPage 
)
 m_pImp->GetShell()->AddPaintRect( pContent->Frame() );
 }
 
-// Do this if the Frame has been formatted before.
+// Do this if the frame has been formatted before.
 if ( pContent->IsTextFrame() && static_cast(pContent)->HasRepaint() &&
   IsPaint() )
 PaintContent( pContent, pPage, pContent->Frame(), 
pContent->Frame().Bottom());
@@ -1811,8 +1811,8 @@ void SwLayAction::FormatContent_( const SwContentFrame 
*pContent,
 }
 }
 
-/// Returns true if all Contents of the Fly have been processed completely.
-/// Returns false if processing has been interrupted prematurely.
+// Returns true if all Contents of the Fly have been processed completely.
+// Returns false if processing has been interrupted prematurely.
 bool SwLayAction::FormatFlyContent( const SwFlyFrame *pFly )
 {
 const SwContentFrame *pContent = pFly->ContainsContent();
@@ -1821,10 +1821,8 @@ bool SwLayAction::FormatFlyContent( const SwFlyFrame 
*pFly )
 {
 FormatContent_( pContent, pContent->FindPageFrame() );
 
-// format floating screen objects
-// at content text frame
-// pass correct page frame
-// to the object formatter.
+// format floating screen objects at content text frame
+// pass correct page frame to the object formatter.
 if ( pContent->IsTextFrame() &&
  !SwObjectFormatter::FormatObjsAtFrame(
 
*(const_cast(pContent)),
@@ -1851,7 +1849,7 @@ bool SwLayAction::FormatFlyContent( const SwFlyFrame 
*pFly )
 if ( !pFly->IsFlyInContentFrame() )
 {
 CheckIdleEnd();
-// OD 14.04.2003 #106346# - consider interrupt formatting.
+// consider interrupt formatting.
 if ( IsInterrupt() && !mbFormatContentOnInterrupt )
 return false;
 }
@@ -2191,7 +2189,6 @@ SwLayIdle::SwLayIdle( SwRootFrame *pRt, SwViewShellImp 
*pI ) :
 // If there are accrued paints, it's best to simply invalidate
 // the whole window. Otherwise there would arise paint 
problems whose
 // solution would be disproportionally expensive.
-

[Libreoffice-commits] core.git: sw/source xmloff/source

2016-01-18 Thread Peter Foley
 sw/source/core/text/inftxt.hxx  |2 +-
 xmloff/source/core/xmltoken.cxx |6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 8633e6b3f5882508f23ed4dba2b3651ef7a4e524
Author: Peter Foley 
Date:   Sun Jan 17 14:28:29 2016 -0500

Convert NULL/0 to nullptr

Change-Id: Iee6bb0867afd8aebe36e62b507f1332e3a581838
Reviewed-on: https://gerrit.libreoffice.org/21549
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/sw/source/core/text/inftxt.hxx b/sw/source/core/text/inftxt.hxx
index 3753bbd..c463bd3 100644
--- a/sw/source/core/text/inftxt.hxx
+++ b/sw/source/core/text/inftxt.hxx
@@ -385,7 +385,7 @@ protected:
 #ifdef DBG_UTIL
 , pBrushItem(reinterpret_cast(-1))
 #else
-, pBrushItem(0)
+, pBrushItem(nullptr)
 #endif
 , nSpaceIdx(0)
 {}
diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx
index 1570301..d3af42f 100644
--- a/xmloff/source/core/xmltoken.cxx
+++ b/xmloff/source/core/xmltoken.cxx
@@ -45,7 +45,7 @@ namespace xmloff { namespace token {
 #if OSL_DEBUG_LEVEL > 0
 #define TOKEN( s, e ) { sizeof(s)-1, s, nullptr, e }
 #else
-#define TOKEN( s, e ) { sizeof(s)-1, s, NULL }
+#define TOKEN( s, e ) { sizeof(s)-1, s, nullptr }
 #endif
 
 struct XMLTokenEntry aTokenList[] =
@@ -53,7 +53,7 @@ namespace xmloff { namespace token {
 #if OSL_DEBUG_LEVEL > 0
 { 0, nullptr, nullptr, XML_TOKEN_START },
 #else
-{ 0, NULL, NULL },// XML_TOKEN_START
+{ 0, nullptr, nullptr },// XML_TOKEN_START
 #endif
 
 // common XML
@@ -3260,7 +3260,7 @@ namespace xmloff { namespace token {
 #if OSL_DEBUG_LEVEL > 0
 { 0, nullptr, nullptr,   XML_TOKEN_END }
 #else
-{ 0, NULL, NULL   /* XML_TOKEN_END */ }
+{ 0, nullptr, nullptr   /* XML_TOKEN_END */ }
 #endif
 };
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sw/source xmloff/source

2013-12-17 Thread Michael Stahl
 sw/source/core/layout/atrfrm.cxx  |6 +-
 sw/source/filter/xml/xmlexpit.cxx |2 +-
 xmloff/source/style/xmlbahdl.cxx  |5 +++--
 xmloff/source/style/xmlbahdl.hxx  |4 ++--
 4 files changed, 11 insertions(+), 6 deletions(-)

New commits:
commit 22355042a6fc7aecf3caab69b3fa3be1430b697f
Author: Michael Stahl mst...@redhat.com
Date:   Tue Dec 17 23:44:38 2013 +0100

fdo#72452: ODF import/export: fix handling of style:page-number

Class XMLNumberWithAutoInsteadZeroPropHdl (which appears to be used only
for this attribute) needs to be adapted to the change that
PageNumberOffset value 0 is no longer invalid; use void value for
invalid instead, which appears more appropriate anyway.

Unfortunately the type of style:page-number is positiveInteger so
writing 0 would be invalid; write auto instead for now.

Change-Id: I9621ea201fd928087b863c562607c3d77a3b0269

diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx
index eb540b4..2434150 100644
--- a/sw/source/core/layout/atrfrm.cxx
+++ b/sw/source/core/layout/atrfrm.cxx
@@ -710,7 +710,11 @@ bool SwFmtPageDesc::PutValue( const uno::Any rVal, 
sal_uInt8 nMemberId )
 case MID_PAGEDESC_PAGENUMOFFSET:
 {
 sal_Int16 nOffset = 0;
-if(rVal = nOffset)
+if (!rVal.hasValue())
+{
+SetNumOffset(boost::none);
+}
+else if (rVal = nOffset)
 SetNumOffset( nOffset );
 else
 bRet = false;
diff --git a/sw/source/filter/xml/xmlexpit.cxx 
b/sw/source/filter/xml/xmlexpit.cxx
index abe355d..b1e5182 100644
--- a/sw/source/filter/xml/xmlexpit.cxx
+++ b/sw/source/filter/xml/xmlexpit.cxx
@@ -1005,7 +1005,7 @@ bool SvXMLExportItemMapper::QueryXMLValue(
 if( MID_PAGEDESC_PAGENUMOFFSET==nMemberId )
 {
 ::boost::optionalsal_uInt16 oNumOffset = 
pPageDesc-GetNumOffset();
-if (oNumOffset)
+if (oNumOffset  oNumOffset.get()  0)
 {
 // #i114163# positiveInteger only!
 sal_Int32 const number(oNumOffset.get());
diff --git a/xmloff/source/style/xmlbahdl.cxx b/xmloff/source/style/xmlbahdl.cxx
index 3397e47..0a797e5 100644
--- a/xmloff/source/style/xmlbahdl.cxx
+++ b/xmloff/source/style/xmlbahdl.cxx
@@ -879,7 +879,7 @@ bool XMLNumberWithAutoInsteadZeroPropHdl::importXML(
 lcl_xmloff_setAny( rValue, nValue, 2 );
 else if( rStrImpValue == GetXMLToken( XML_AUTO ) )
 {
-rValue = (sal_Int16)nValue;
+rValue.clear(); // void
 bRet = true;
 }
 return bRet;
@@ -891,7 +891,8 @@ bool XMLNumberWithAutoInsteadZeroPropHdl::exportXML( 
OUString rStrExpValue, con
 sal_Int32 nValue = 0;
 lcl_xmloff_getAny( rValue, nValue, 2 );
 
-if( 0 == nValue )
+// FIXME: 0 is not a valid value - write auto instead
+if (0 == nValue || !rValue.hasValue())
 rStrExpValue = GetXMLToken( XML_AUTO );
 else
 {
diff --git a/xmloff/source/style/xmlbahdl.hxx b/xmloff/source/style/xmlbahdl.hxx
index 58c6dc1..8b57ccb 100644
--- a/xmloff/source/style/xmlbahdl.hxx
+++ b/xmloff/source/style/xmlbahdl.hxx
@@ -306,8 +306,8 @@ public:
 
 /**
 PropertyHandler for the XML-data-type: XML_TYPE_NUMBER16_AUTO
-Reads/writes numeric properties with special handling for the value zero
-(i.e., a value 0 property will be written as auto)
+Reads/writes numeric properties with special handling for void value
+(i.e., void property will be written as auto)
 */
 class XMLNumberWithAutoInsteadZeroPropHdl : public XMLNumberWithoutZeroPropHdl
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sw/source xmloff/source

2013-12-02 Thread Andras Timar
 sw/source/filter/xml/xmlithlp.cxx |2 +-
 xmloff/source/style/bordrhdl.cxx  |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit d9a5a84e6d60b9a674d600107a3b23c3ffbbcd5b
Author: Andras Timar andras.ti...@collabora.com
Date:   Mon Dec 2 19:56:17 2013 +0100

typo: intarnal - internal

Change-Id: Ib7803de02d41440668b1e7410dfe0fa40ca2a536

diff --git a/sw/source/filter/xml/xmlithlp.cxx 
b/sw/source/filter/xml/xmlithlp.cxx
index 259d2fe..4907c07 100644
--- a/sw/source/filter/xml/xmlithlp.cxx
+++ b/sw/source/filter/xml/xmlithlp.cxx
@@ -78,7 +78,7 @@ const struct SvXMLEnumMapEntry psXML_NamedBorderWidths[] =
 { XML_THICK,SVX_XML_BORDER_WIDTH_THICK  },
 { XML_TOKEN_INVALID, 0 }
 };
-// mapping tables to map external xml input to intarnal box line widths
+// mapping tables to map external xml input to internal box line widths
 
 
 const sal_uInt16 aBorderWidths[] =
diff --git a/xmloff/source/style/bordrhdl.cxx b/xmloff/source/style/bordrhdl.cxx
index 36c4dea..2f3863a 100644
--- a/xmloff/source/style/bordrhdl.cxx
+++ b/xmloff/source/style/bordrhdl.cxx
@@ -76,7 +76,7 @@ SvXMLEnumMapEntry pXML_NamedBorderWidths[] =
 { XML_THICK,SVX_XML_BORDER_WIDTH_THICK  },
 { XML_TOKEN_INVALID,0 }
 };
-// mapping tables to map external xml input to intarnal box line widths
+// mapping tables to map external xml input to internal box line widths
 
 static sal_uInt16 const aBorderWidths[] =
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sw/source xmloff/source

2013-09-17 Thread Takeshi Abe
 sw/source/filter/xml/xmlexp.cxx|2 -
 xmloff/source/chart/PropertyMaps.cxx   |   26 +++---
 xmloff/source/chart/SchXMLChartContext.cxx |6 +--
 xmloff/source/chart/SchXMLChartContext.hxx |2 -
 xmloff/source/core/DocumentSettingsContext.cxx |   46 -
 xmloff/source/core/RDFaImportHelper.cxx|4 +-
 xmloff/source/core/xmlexp.cxx  |4 +-
 xmloff/source/core/xmltkmap.cxx|4 +-
 xmloff/source/core/xmluconv.cxx|   18 -
 9 files changed, 56 insertions(+), 56 deletions(-)

New commits:
commit 2ef38f3739aff407f6cdfe4ea9c46591c18dd2f8
Author: Takeshi Abe t...@fixedpoint.jp
Date:   Tue Sep 17 23:22:55 2013 +0900

sal_Bool to bool

Change-Id: I81767fda35b52e73bc78c07b660244a6808a0409

diff --git a/sw/source/filter/xml/xmlexp.cxx b/sw/source/filter/xml/xmlexp.cxx
index 84ab097..d26eb60 100644
--- a/sw/source/filter/xml/xmlexp.cxx
+++ b/sw/source/filter/xml/xmlexp.cxx
@@ -444,7 +444,7 @@ void SwXMLExport::SetBodyAttributes()
 if( pDoc-GetCurrentViewShell() 
 pDoc-GetCurrentViewShell()-GetPageCount()  1 )
 {
-sal_Bool bValue = sal_True;
+bool bValue = true;
 OUStringBuffer sBuffer;
 ::sax::Converter::convertBool(sBuffer, bValue);
 AddAttribute(XML_NAMESPACE_TEXT, XML_USE_SOFT_PAGE_BREAKS,
diff --git a/xmloff/source/chart/PropertyMaps.cxx 
b/xmloff/source/chart/PropertyMaps.cxx
index 6970d59..f712aeb 100644
--- a/xmloff/source/chart/PropertyMaps.cxx
+++ b/xmloff/source/chart/PropertyMaps.cxx
@@ -195,7 +195,7 @@ void XMLChartExportPropertyMapper::ContextFilter(
 uno::Reference beans::XPropertySet  rPropSet ) const
 {
 OUString aAutoPropName;
-sal_Bool bCheckAuto = sal_False;
+bool bCheckAuto = false;
 
 // filter properties
 for( std::vector XMLPropertyState ::iterator property = 
rProperties.begin();
@@ -208,24 +208,24 @@ void XMLChartExportPropertyMapper::ContextFilter(
 {
 // if Auto... is set the corresponding properties mustn't be 
exported
 case XML_SCH_CONTEXT_MIN:
-bCheckAuto = sal_True;
+bCheckAuto = true;
 aAutoPropName = AutoMin;
 break;
 case XML_SCH_CONTEXT_MAX:
-bCheckAuto = sal_True;
+bCheckAuto = true;
 aAutoPropName = AutoMax;
 break;
 case XML_SCH_CONTEXT_STEP_MAIN:
-bCheckAuto = sal_True;
+bCheckAuto = true;
 aAutoPropName = AutoStepMain;
 break;
 case XML_SCH_CONTEXT_STEP_HELP_COUNT:
-bCheckAuto = sal_True;
+bCheckAuto = true;
 aAutoPropName = AutoStepHelp;
 break;
 
 case XML_SCH_CONTEXT_ORIGIN:
-bCheckAuto = sal_True;
+bCheckAuto = true;
 aAutoPropName = AutoOrigin;
 break;
 
@@ -262,7 +262,7 @@ void XMLChartExportPropertyMapper::ContextFilter(
 {
 }
 }
-bCheckAuto = sal_False;
+bCheckAuto = false;
 }
 }
 
@@ -359,13 +359,13 @@ void XMLChartExportPropertyMapper::handleSpecialItem(
 const ::std::vector XMLPropertyState  *pProperties,
 sal_uInt32 nIdx ) const
 {
-sal_Bool bHandled = sal_False;
+bool bHandled = false;
 
 sal_Int32 nContextId = getPropertySetMapper()-GetEntryContextId( 
rProperty.mnIndex );
 
 if( nContextId )
 {
-bHandled = sal_True;
+bHandled = true;
 
 OUString sAttrName = getPropertySetMapper()-GetEntryXMLName( 
rProperty.mnIndex );
 sal_uInt16 nNameSpace = getPropertySetMapper()-GetEntryNameSpace( 
rProperty.mnIndex );
@@ -373,7 +373,7 @@ void XMLChartExportPropertyMapper::handleSpecialItem(
 OUString sValue;
 
 sal_Int32 nValue = 0;
-sal_Bool bValue = sal_False;
+bool bValue = false;
 
 switch( nContextId )
 {
@@ -475,7 +475,7 @@ void XMLChartExportPropertyMapper::handleSpecialItem(
 break;
 
 default:
-bHandled = sal_False;
+bHandled = false;
 break;
 }
 
@@ -532,7 +532,7 @@ bool XMLChartImportPropertyMapper::handleSpecialItem(
 const SvXMLNamespaceMap rNamespaceMap ) const
 {
 sal_Int32 nContextId = maPropMapper-GetEntryContextId( rProperty.mnIndex 
);
-sal_Bool bRet = (nContextId != 0);
+bool bRet = (nContextId != 0);
 
 if( nContextId )
 {
@@ -648,7 +648,7 @@ bool XMLChartImportPropertyMapper::handleSpecialItem(
 break;
 
 default:
-bRet = sal_False;
+bRet = false;
 break;
 }
 }
diff --git a/xmloff/source/chart/SchXMLChartContext.cxx 
b/xmloff/source/chart/SchXMLChartContext.cxx