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

2023-12-04 Thread Caolán McNamara (via logerrit)
 sw/source/ui/vba/vbaformfields.cxx |2 +-
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)

New commits:
commit 3bf1c0d23afccaa84c3d4ecd701c20e60f9e2994
Author: Caolán McNamara 
AuthorDate: Sun Dec 3 19:44:47 2023 +
Commit: Caolán McNamara 
CommitDate: Mon Dec 4 10:47:26 2023 +0100

cid#1546495 COPY_INSTEAD_OF_MOVE

Change-Id: I8bc5ec6b9586a27e94164580ca7c1f785a08b04d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160273
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 4bc611992c88..76ab50135427 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -3718,8 +3718,7 @@ RTFError RTFDocumentImpl::handleEmbeddedObject()
 
 uno::Reference xInputStream(
 new utl::OSeekableInputStreamWrapper(pStream.release(), 
/*_bOwner=*/true));
-auto pStreamValue = new RTFValue(xInputStream);
-m_aOLEAttributes.set(NS_ooxml::LN_inputstream, pStreamValue);
+m_aOLEAttributes.set(NS_ooxml::LN_inputstream, new RTFValue(xInputStream));
 
 return RTFError::OK;
 }
commit 8c0ed1d92c128fa73b0441581a958bab317f6fa7
Author: Caolán McNamara 
AuthorDate: Sun Dec 3 19:43:33 2023 +
Commit: Caolán McNamara 
CommitDate: Mon Dec 4 10:47:14 2023 +0100

cid#1546497 COPY_INSTEAD_OF_MOVE

Change-Id: I9bcbbdef1521dc77ccaca2734c662c12ac188b60
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160272
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/sw/source/ui/vba/vbaformfields.cxx 
b/sw/source/ui/vba/vbaformfields.cxx
index 586393e35818..9c8af450d345 100644
--- a/sw/source/ui/vba/vbaformfields.cxx
+++ b/sw/source/ui/vba/vbaformfields.cxx
@@ -81,7 +81,7 @@ class FormFieldsEnumWrapper : public EnumerationHelper_BASE
 sal_Int32 mnIndex;
 
 public:
-explicit FormFieldsEnumWrapper(uno::Reference 
xIndexAccess)
+explicit FormFieldsEnumWrapper(const 
uno::Reference& xIndexAccess)
 : mxIndexAccess(xIndexAccess)
 , mnIndex(0)
 {


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

2023-05-12 Thread Noel Grandin (via logerrit)
 sw/source/filter/ascii/wrtasc.cxx |   14 
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |4 
 writerfilter/source/dmapper/NumberingManager.cxx  |   10 
 writerfilter/source/dmapper/PropertyIds.cxx   |  689 ++
 writerfilter/source/dmapper/PropertyIds.hxx   |2 
 writerfilter/source/dmapper/PropertyMap.cxx   |   20 
 6 files changed, 369 insertions(+), 370 deletions(-)

New commits:
commit 8be73da2284ffe963a464b4c65db4f2ff5d7f09f
Author: Noel Grandin 
AuthorDate: Fri May 12 10:59:44 2023 +0200
Commit: Noel Grandin 
CommitDate: Fri May 12 14:50:12 2023 +0200

avoid some OUString construction in SwASCWriter::WriteStream

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

diff --git a/sw/source/filter/ascii/wrtasc.cxx 
b/sw/source/filter/ascii/wrtasc.cxx
index 97f21d398bb8..59097fa9aa86 100644
--- a/sw/source/filter/ascii/wrtasc.cxx
+++ b/sw/source/filter/ascii/wrtasc.cxx
@@ -90,19 +90,23 @@ SwASCWriter::~SwASCWriter() {}
 
 ErrCode SwASCWriter::WriteStream()
 {
+static constexpr OUStringLiteral STR_CR = u"\015";
+static constexpr OUStringLiteral STR_LF = u"\012";
+static constexpr OUStringLiteral STR_CRLF = u"\015\012";
+static constexpr OUStringLiteral STR_BLANK = u" ";
 bool bIncludeBOM = GetAsciiOptions().GetIncludeBOM();
 bool bIncludeHidden = GetAsciiOptions().GetIncludeHidden();
 
 if( m_bASCII_ParaAsCR )   // If predefined
-m_sLineEnd = "\015";
+m_sLineEnd = STR_CR;
 else if( m_bASCII_ParaAsBlank )
-m_sLineEnd = " ";
+m_sLineEnd = STR_BLANK;
 else
 switch( GetAsciiOptions().GetParaFlags() )
 {
-case LINEEND_CR:m_sLineEnd = "\015"; break;
-case LINEEND_LF:m_sLineEnd = "\012"; break;
-case LINEEND_CRLF:  m_sLineEnd = "\015\012"; break;
+case LINEEND_CR:m_sLineEnd = STR_CR; break;
+case LINEEND_LF:m_sLineEnd = STR_LF; break;
+case LINEEND_CRLF:  m_sLineEnd = STR_CRLF; break;
 }
 
 SwNodeOffset nMaxNode = m_pDoc->GetNodes().Count();
commit 58208b97b972d6ddca5122893b3084c67b0c5ecd
Author: Noel Grandin 
AuthorDate: Fri May 12 11:00:47 2023 +0200
Commit: Noel Grandin 
CommitDate: Fri May 12 14:50:01 2023 +0200

avoid some OUString construction in writerfilter/

no need to repeatedly construct these

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

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 83ce570dcbab..7caa847e068e 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1571,7 +1571,7 @@ static void 
lcl_MoveBorderPropertiesToFrame(std::vector& r
 
 for( size_t nProperty = 0; nProperty < SAL_N_ELEMENTS( 
aBorderProperties ); ++nProperty)
 {
-OUString sPropertyName = 
getPropertyName(aBorderProperties[nProperty]);
+const OUString & sPropertyName = 
getPropertyName(aBorderProperties[nProperty]);
 beans::PropertyValue aValue;
 aValue.Name = sPropertyName;
 aValue.Value = 
xTextRangeProperties->getPropertyValue(sPropertyName);
@@ -4130,7 +4130,7 @@ void DomainMapper_Impl::PushShapeContext( const 
uno::Reference< drawing::XShape
 if ( bOnlyApplyCharHeight && eId != 
PROP_CHAR_HEIGHT )
 continue;
 
-const OUString sPropName = 
getPropertyName(eId);
+const OUString & sPropName = 
getPropertyName(eId);
 if ( beans::PropertyState_DEFAULT_VALUE == 
xShapePropertyState->getPropertyState(sPropName) )
 {
 const uno::Any aProp = 
GetPropertyFromStyleSheet(eId, pEntry, /*bDocDefaults=*/true, /*bPara=*/true);
diff --git a/writerfilter/source/dmapper/NumberingManager.cxx 
b/writerfilter/source/dmapper/NumberingManager.cxx
index a9535323b480..5b5ad07dce14 100644
--- a/writerfilter/source/dmapper/NumberingManager.cxx
+++ b/writerfilter/source/dmapper/NumberingManager.cxx
@@ -276,9 +276,9 @@ void ListLevel::AddParaProperties( uno::Sequence< 
beans::PropertyValue >* props
 {
 uno::Sequence< beans::PropertyValue >& aProps = *props;
 
-OUString sFirstLineIndent = getPropertyName(
+const OUString & sFirstLineIndent = getPropertyName(
 PROP_FIRST_LINE_INDENT );
-OUString sIndentAt = getPropertyName(
+const OUString & sIndentAt = getPropertyName(
 PROP_INDENT_AT );
 
 bool hasFirstLineIndent = lcl_findProperty( aProps, sFirstLineInd

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

2023-03-16 Thread Caolán McNamara (via logerrit)
 sw/source/ui/frmdlg/frmpage.cxx   |3 ++-
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 9a123a6e63600ba3998d22bbc300ac4b65b3da2c
Author: Caolán McNamara 
AuthorDate: Thu Mar 16 16:40:38 2023 +
Commit: Caolán McNamara 
CommitDate: Thu Mar 16 20:19:38 2023 +

cid#1522030 Uninitialized scalar field

Change-Id: Iaf8ad5edd483da25cad45d91afc27f9cc3aa9040
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149002
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 1c27e8ccfdc6..6f0c1dd0952f 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -339,6 +339,7 @@ DomainMapper_Impl::DomainMapper_Impl(
 m_bIsColumnBreakDeferred( false ),
 m_bIsPageBreakDeferred( false ),
 m_nLineBreaksDeferred( 0 ),
+m_bIsBreakDeferredByAnchor(false),
 m_bSdtEndDeferred(false),
 m_bParaSdtEndDeferred(false),
 m_bStartTOC(false),
commit aa252a2d019c350d90b7c4a090246451a6006b87
Author: Caolán McNamara 
AuthorDate: Thu Mar 16 14:36:18 2023 +
Commit: Caolán McNamara 
CommitDate: Thu Mar 16 20:19:31 2023 +

Resolves: tdf#152704 old image remains underneath when new image drawn

in this dialog preview widget

Change-Id: Id33995d9a9557d235178be0d12cc6b44e146ff4c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148997
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx
index e9cf9974d0ed..94c86e95df5e 100644
--- a/sw/source/ui/frmdlg/frmpage.cxx
+++ b/sw/source/ui/frmdlg/frmpage.cxx
@@ -2658,7 +2658,8 @@ void BmpWindow::SetDrawingArea(weld::DrawingArea* 
pDrawingArea)
 void BmpWindow::Paint(vcl::RenderContext& rRenderContext, const 
tools::Rectangle&)
 {
 // Setup
-rRenderContext.SetBackground();
+
rRenderContext.SetBackground(Wallpaper(Application::GetSettings().GetStyleSettings().GetDialogColor()));
+rRenderContext.Erase();
 // #i119307# the graphic might have transparency, set up white as the color
 // to use when drawing a rectangle under the image
 rRenderContext.SetLineColor(COL_WHITE);


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

2022-07-28 Thread Noel Grandin (via logerrit)
 sw/source/core/doc/docfmt.cxx  |7 +---
 sw/source/core/unocore/unocrsrhelper.cxx   |   41 -
 sw/source/core/unocore/unoobj.cxx  |2 -
 writerfilter/source/ooxml/OOXMLPropertySet.hxx |   34 ++--
 4 files changed, 48 insertions(+), 36 deletions(-)

New commits:
commit 156073b6ed57424da685bd141ee366bd4467c4e0
Author: Noel Grandin 
AuthorDate: Thu Jul 28 08:59:37 2022 +0200
Commit: Noel Grandin 
CommitDate: Thu Jul 28 13:03:43 2022 +0200

these classes can be final

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

diff --git a/writerfilter/source/ooxml/OOXMLPropertySet.hxx 
b/writerfilter/source/ooxml/OOXMLPropertySet.hxx
index b30fbaf61f9b..ceabfb586011 100644
--- a/writerfilter/source/ooxml/OOXMLPropertySet.hxx
+++ b/writerfilter/source/ooxml/OOXMLPropertySet.hxx
@@ -49,7 +49,7 @@ public:
 virtual OOXMLValue* clone() const;
 };
 
-class OOXMLProperty : public Sprm
+class OOXMLProperty final : public Sprm
 {
 public:
 typedef tools::SvRef Pointer_t;
@@ -79,7 +79,7 @@ public:
 void resolve(Properties& rProperties);
 };
 
-class OOXMLBinaryValue : public OOXMLValue
+class OOXMLBinaryValue final : public OOXMLValue
 {
 mutable OOXMLBinaryObjectReference::Pointer_t mpBinaryObj;
 
@@ -94,7 +94,7 @@ public:
 virtual OOXMLValue* clone() const override;
 };
 
-class OOXMLBooleanValue : public OOXMLValue
+class OOXMLBooleanValue final : public OOXMLValue
 {
 bool mbValue;
 explicit OOXMLBooleanValue(bool bValue);
@@ -118,7 +118,7 @@ public:
 virtual OOXMLValue* clone() const override;
 };
 
-class OOXMLStringValue : public OOXMLValue
+class OOXMLStringValue final : public OOXMLValue
 {
 OUString mStr;
 
@@ -139,7 +139,7 @@ public:
 virtual OOXMLValue* clone() const override;
 };
 
-class OOXMLInputStreamValue : public OOXMLValue
+class OOXMLInputStreamValue final : public OOXMLValue
 {
 css::uno::Reference mxInputStream;
 
@@ -154,7 +154,7 @@ public:
 virtual OOXMLValue* clone() const override;
 };
 
-class OOXMLPropertySet : public writerfilter::Reference
+class OOXMLPropertySet final : public writerfilter::Reference
 {
 public:
 typedef std::vector OOXMLProperties_t;
@@ -190,7 +190,7 @@ public:
 
 class OOXMLValue;
 
-class OOXMLTable : public writerfilter::Reference
+class OOXMLTable final : public writerfilter::Reference
 {
 public:
 typedef tools::SvRef ValuePointer_t;
@@ -211,7 +211,7 @@ private:
 PropertySets_t mPropertySets;
 };
 
-class OOXMLPropertySetValue : public OOXMLValue
+class OOXMLPropertySetValue final : public OOXMLValue
 {
 OOXMLPropertySet::Pointer_t mpPropertySet;
 
@@ -233,7 +233,7 @@ public:
 virtual OOXMLValue* clone() const override;
 };
 
-class OOXMLIntegerValue : public OOXMLValue
+class OOXMLIntegerValue final : public OOXMLValue
 {
 sal_Int32 mnValue;
 explicit OOXMLIntegerValue(sal_Int32 nValue);
@@ -277,7 +277,7 @@ public:
 virtual OOXMLValue* clone() const override;
 };
 
-class OOXMLHexColorValue : public OOXMLHexValue
+class OOXMLHexColorValue final : public OOXMLHexValue
 {
 public:
 explicit OOXMLHexColorValue(const char* pValue);
@@ -304,7 +304,7 @@ public:
 };
 
 /// npPt is quotient defining how much units are in 1 pt
-template  class OOXMLNthPtMeasureValue : public 
OOXMLUniversalMeasureValue
+template  class OOXMLNthPtMeasureValue final : public 
OOXMLUniversalMeasureValue
 {
 public:
 explicit OOXMLNthPtMeasureValue(const char* pValue)
@@ -320,7 +320,7 @@ typedef OOXMLNthPtMeasureValue<20> OOXMLTwipsMeasureValue;
 /// Handles OOXML's ST_HpsMeasure value.
 typedef OOXMLNthPtMeasureValue<2> OOXMLHpsMeasureValue;
 
-class OOXMLMeasurementOrPercentValue : public OOXMLValue
+class OOXMLMeasurementOrPercentValue final : public OOXMLValue
 {
 int mnValue;
 
@@ -334,7 +334,7 @@ public:
 #endif
 };
 
-class OOXMLShapeValue : public OOXMLValue
+class OOXMLShapeValue final : public OOXMLValue
 {
 css::uno::Reference mrShape;
 
@@ -349,7 +349,7 @@ public:
 virtual OOXMLValue* clone() const override;
 };
 
-class OOXMLStarMathValue : public OOXMLValue
+class OOXMLStarMathValue final : public OOXMLValue
 {
 css::uno::Reference component;
 
@@ -364,7 +364,7 @@ public:
 virtual OOXMLValue* clone() const override;
 };
 
-class OOXMLPropertySetEntryToString : public Properties
+class OOXMLPropertySetEntryToString final : public Properties
 {
 Id mnId;
 OUString mStr;
@@ -379,7 +379,7 @@ public:
 const OUString& getString() const { return mStr; }
 };
 
-class OOXMLPropertySetEntryToInteger : public Properties
+class OOXMLPropertySetEntryToInteger final : public Properties
 {
 Id mnId;
 int mnValue;
@@ -394,7 +394,7 @@ public:
 int getValue() const { return mnValue; }
 };
 
-class OOXMLPropertySetEntryToBool : public Properties
+class OOXMLPrope

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

2019-10-29 Thread Michael Stahl (via logerrit)
 sw/source/core/doc/docbm.cxx  |   12 
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |8 
 2 files changed, 20 insertions(+)

New commits:
commit e4ea1d08296755cb765e699325b895cac448e0df
Author: Michael Stahl 
AuthorDate: Tue Oct 29 13:58:13 2019 +0100
Commit: Michael Stahl 
CommitDate: Tue Oct 29 16:31:49 2019 +0100

sw: makeMark(): check position of point fieldmarks

A new point fieldmark must have an empty range, which is expanded when
the CH_TXT_ATR_FORMELEMENT is inserted.

A copied point fieldmark must contain exactly its
CH_TXT_ATR_FORMELEMENT.

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

diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index 68914f38c0b3..b3d0470a3124 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -581,6 +581,18 @@ namespace sw { namespace mark
 return nullptr;
 }
 
+if ((eType == MarkType::CHECKBOX_FIELDMARK || eType == 
MarkType::DROPDOWN_FIELDMARK)
+&& (eMode == InsertMode::New
+? *rPaM.GetPoint() != *rPaM.GetMark()
+// CopyText: pam covers CH_TXT_ATR_FORMELEMENT
+: (rPaM.GetPoint()->nNode != rPaM.GetMark()->nNode
+|| rPaM.Start()->nContent.GetIndex() + 1 != 
rPaM.End()->nContent.GetIndex(
+{
+SAL_WARN("sw.core", "MarkManager::makeMark(..)"
+" - invalid range on point fieldmark");
+return nullptr;
+}
+
 // create mark
 std::unique_ptr<::sw::mark::MarkBase> pMark;
 switch(eType)
commit b2fe67eb74cfa124d654815eb7897380602a2b66
Author: Michael Stahl 
AuthorDate: Tue Oct 29 13:56:50 2019 +0100
Commit: Michael Stahl 
CommitDate: Tue Oct 29 16:31:30 2019 +0100

writerfilter: assert that start position is before end position

As seen in fdo34663-1.docx; should find more bugs hopefully.

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

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 3ce2f1a37d04..276f408451f3 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -4352,6 +4352,14 @@ static auto 
InsertFieldmark(std::stack & rTextAppendStack,
 xTextAppend->createTextCursorByRange(xStartRange);
 if (rTextAppendStack.top().xInsertPosition.is())
 {
+uno::Reference const xCompare(
+rTextAppendStack.top().xTextAppend,
+uno::UNO_QUERY);
+if (xCompare->compareRegionStarts(xStartRange, 
rTextAppendStack.top().xInsertPosition) < 0)
+{
+SAL_WARN("writerfilter.dmapper", "invalid field mark positions");
+assert(false);
+}
 xCursor->gotoRange(rTextAppendStack.top().xInsertPosition, true);
 }
 else
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-09-23 Thread Michael Stahl (via logerrit)
 sw/source/filter/ww8/wrtw8num.cxx |   37 --
 sw/source/filter/ww8/wrtww8.hxx   |   10 +
 sw/source/filter/ww8/ww8atr.cxx   |   13 ++-
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   16 +++--
 writerfilter/source/dmapper/NumberingManager.cxx  |   25 +++---
 writerfilter/source/dmapper/NumberingManager.hxx  |7 +++-
 6 files changed, 93 insertions(+), 15 deletions(-)

New commits:
commit 1db6fb0f831e92ac3902af9c58e33f49ede5532b
Author: Michael Stahl 
AuthorDate: Fri Sep 20 19:42:16 2019 +0200
Commit: Michael Stahl 
CommitDate: Mon Sep 23 13:35:19 2019 +0200

writerfilter: fix assert importing fdo77404-1.docx

The problem is that StyleSheetTable::ApplyStyleSheets() inserts a
SwNumRule with name "WW8Num1" and then ListDef::CreateNumberingRule()
also wants to insert a SwNumRule with name "WW8Num1" but gets an
exception instead, leaving ListDef::m_xNumRules null, and then
finishParagraph thinks it's numbered but there's no ListId.

Try to avoid collisions of the generated names in
ListDef::GetStyleName(), by checking what styles actually exist in the
document (which works better in the Insert->File case), and
on the assumption that the initialising call always happens before
the using calls.

(regression from 7992bd73a2307edce96a145e954f8e4c3ab9f57d)

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

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 192b5ab70130..81acdf59ebce 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1237,9 +1237,10 @@ void DomainMapper_Impl::finishParagraph( const 
PropertyMapPtr& pPropertyMap, con
 {
 bool bNumberingFromBaseStyle = false;
 sal_Int32 nListId = pEntry ? lcl_getListId(pEntry, 
GetStyleSheetTable(), bNumberingFromBaseStyle) : -1;
-if (nListId >= 0 && !pParaContext->isSet(PROP_NUMBERING_STYLE_NAME))
+auto const pList(GetListTable()->GetList(nListId));
+if (pList && nListId >= 0 && 
!pParaContext->isSet(PROP_NUMBERING_STYLE_NAME))
 {
-pParaContext->Insert( PROP_NUMBERING_STYLE_NAME, uno::makeAny( 
ListDef::GetStyleName( nListId ) ), false);
+pParaContext->Insert( PROP_NUMBERING_STYLE_NAME, uno::makeAny( 
pList->GetStyleName(nListId) ), false);
 isNumberingViaStyle = true;
 
 // Indent properties from the paragraph style have priority
@@ -6075,7 +6076,12 @@ uno::Reference 
DomainMapper_Impl::GetCurrentNumberingRu
 *pListLevel = pStyleSheetProperties->GetListLevel();
 
 // So we are in a paragraph style and it has numbering. Look up the 
relevant numbering rules.
-OUString aListName = ListDef::GetStyleName(nListId);
+auto const pList(GetListTable()->GetList(nListId));
+OUString aListName;
+if (pList)
+{
+aListName = pList->GetStyleName(nListId);
+}
 uno::Reference< style::XStyleFamiliesSupplier > 
xStylesSupplier(GetTextDocument(), uno::UNO_QUERY_THROW);
 uno::Reference< container::XNameAccess > xStyleFamilies = 
xStylesSupplier->getStyleFamilies();
 uno::Reference xNumberingStyles;
@@ -6190,7 +6196,9 @@ sal_Int32 DomainMapper_Impl::getNumberingProperty(const 
sal_Int32 nListId, sal_I
 if (nNumberingLevel < 0) // It seems it's valid to omit numbering 
level, and in that case it means zero.
 nNumberingLevel = 0;
 
-const OUString aListName = ListDef::GetStyleName(nListId);
+auto const pList(GetListTable()->GetList(nListId));
+assert(pList);
+const OUString aListName = pList->GetStyleName(nListId);
 const uno::Reference< style::XStyleFamiliesSupplier > 
xStylesSupplier(GetTextDocument(), uno::UNO_QUERY_THROW);
 const uno::Reference< container::XNameAccess > xStyleFamilies = 
xStylesSupplier->getStyleFamilies();
 uno::Reference xNumberingStyles;
diff --git a/writerfilter/source/dmapper/NumberingManager.cxx 
b/writerfilter/source/dmapper/NumberingManager.cxx
index 1b8a8b283f99..8f7d05e5f4d0 100644
--- a/writerfilter/source/dmapper/NumberingManager.cxx
+++ b/writerfilter/source/dmapper/NumberingManager.cxx
@@ -447,12 +447,27 @@ ListDef::~ListDef( )
 {
 }
 
-OUString ListDef::GetStyleName( sal_Int32 nId )
+OUString ListDef::GetStyleName(sal_Int32 const nId,
+uno::Reference const& xStyles)
 {
-OUString sStyleName( "WWNum" );
-sStyleName += OUString::number( nId );
+if (xStyles.is())
+{
+OUString sStyleName( "WWNum" );
+sStyleName += OUString::number( nId );
+
+while (xStyles.is() && xStyles->hasByName(sStyleName)) // unique
+{
+ 

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

2016-09-19 Thread Caolán McNamara
 sw/source/core/crsr/bookmrk.cxx |3 ++-
 writerfilter/source/rtftok/rtftokenizer.cxx |   15 ---
 2 files changed, 6 insertions(+), 12 deletions(-)

New commits:
commit c708c9351bf2ef578e2f200ee834731c31d80261
Author: Caolán McNamara 
Date:   Mon Sep 19 15:57:02 2016 +0100

fftester: isAsciiLowerCase has a isUnicodeCodePoint assert

which is not helpful when the data is incoming from the outside
world

Change-Id: I00304ed0d577944a33f5fa6af155f1d130ab7d59

diff --git a/writerfilter/source/rtftok/rtftokenizer.cxx 
b/writerfilter/source/rtftok/rtftokenizer.cxx
index 8ca7433..5727b14 100644
--- a/writerfilter/source/rtftok/rtftokenizer.cxx
+++ b/writerfilter/source/rtftok/rtftokenizer.cxx
@@ -170,24 +170,17 @@ int RTFTokenizer::asHex(char ch)
 ret = ch - '0';
 else
 {
-if (rtl::isAsciiLowerCase(ch))
-{
-if (ch < 'a' || ch > 'f')
-return -1;
+if (ch >= 'a' && ch <= 'f')
 ret = ch - 'a';
-}
-else
-{
-if (ch < 'A' || ch > 'F')
-return -1;
+else if (ch >= 'A' && ch <= 'F')
 ret = ch - 'A';
-}
+else
+return -1;
 ret += 10;
 }
 return ret;
 }
 
-
 void RTFTokenizer::pushGroup()
 {
 m_nGroup++;
commit 8d5db645ca0c910fc624d3513be7d312aea4a49c
Author: Caolán McNamara 
Date:   Mon Sep 19 15:38:09 2016 +0100

fftester: only decrement if there's a valid position before it

Change-Id: I64bddeb805ac5c2ad6d76e2b3271ae8a216d603f

diff --git a/sw/source/core/crsr/bookmrk.cxx b/sw/source/core/crsr/bookmrk.cxx
index 08594bc..26ec9f9 100644
--- a/sw/source/core/crsr/bookmrk.cxx
+++ b/sw/source/core/crsr/bookmrk.cxx
@@ -133,7 +133,8 @@ namespace
 if ( ch_end == aEndMark )
 {
 SwPaM aEnd(rEnd, rEnd);
---aEnd.Start()->nContent;
+if (aEnd.Start()->nContent > 0)
+--aEnd.Start()->nContent;
 io_pDoc->getIDocumentContentOperations().DeleteRange(aEnd);
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2016-04-04 Thread Noel Grandin
 sw/source/core/access/accpara.cxx|   38 +--
 sw/source/core/access/accpara.hxx|2 
 sw/source/core/unocore/unofield.cxx  |   37 +++---
 writerfilter/source/ooxml/OOXMLBinaryObjectReference.cxx |8 +--
 writerfilter/source/ooxml/OOXMLBinaryObjectReference.hxx |3 -
 5 files changed, 30 insertions(+), 58 deletions(-)

New commits:
commit e72c80c01629798a93948d4419f109ac324de4ef
Author: Noel Grandin 
Date:   Sun Apr 3 17:56:12 2016 +0200

sequence->vector in writerfilter

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

diff --git a/writerfilter/source/ooxml/OOXMLBinaryObjectReference.cxx 
b/writerfilter/source/ooxml/OOXMLBinaryObjectReference.cxx
index 734e55a..2df5a17 100644
--- a/writerfilter/source/ooxml/OOXMLBinaryObjectReference.cxx
+++ b/writerfilter/source/ooxml/OOXMLBinaryObjectReference.cxx
@@ -50,9 +50,9 @@ void OOXMLBinaryObjectReference::read()
 {
 nOldSize = nSize;
 nSize += nBytesRead;
-mSequence.realloc(nSize);
+mSequence.resize(nSize);
 
-memcpy(&mSequence[nOldSize], aSeq.getArray(), nBytesRead);
+memcpy(&mSequence.data()[nOldSize], aSeq.getArray(), nBytesRead);
 }
 
 mbRead = true;
@@ -66,8 +66,8 @@ void OOXMLBinaryObjectReference::resolve(BinaryObj & rHandler)
 writerfilter::Reference::Pointer_t pRef =
 writerfilter::Reference::Pointer_t();
 
-rHandler.data(reinterpret_cast(&mSequence[0]),
-  mSequence.getLength(), pRef);
+rHandler.data(reinterpret_cast(mSequence.data()),
+  mSequence.size(), pRef);
 }
 
 }}
diff --git a/writerfilter/source/ooxml/OOXMLBinaryObjectReference.hxx 
b/writerfilter/source/ooxml/OOXMLBinaryObjectReference.hxx
index 3a1cc03..d77de26 100644
--- a/writerfilter/source/ooxml/OOXMLBinaryObjectReference.hxx
+++ b/writerfilter/source/ooxml/OOXMLBinaryObjectReference.hxx
@@ -21,6 +21,7 @@
 
 #include 
 #include 
+#include 
 
 namespace writerfilter {
 namespace ooxml
@@ -29,7 +30,7 @@ class OOXMLBinaryObjectReference :
 public writerfilter::Reference
 {
 OOXMLStream::Pointer_t mpStream;
-css::uno::Sequence mSequence;
+std::vector mSequence;
 bool mbRead;
 
 void read();
commit 55d146b732bf30f6a83a962b4394df8f2563a4b7
Author: Noel Grandin 
Date:   Sun Apr 3 16:40:26 2016 +0200

sequence->vector in sw

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

diff --git a/sw/source/core/access/accpara.cxx 
b/sw/source/core/access/accpara.cxx
index c825638..b30442f 100644
--- a/sw/source/core/access/accpara.cxx
+++ b/sw/source/core/access/accpara.cxx
@@ -1641,8 +1641,7 @@ uno::Sequence 
SwAccessibleParagraph::getCharacterAttributes(
 _getRunAttributesImpl( nIndex, aNames, aRunAttrSeq );
 
 // merge default and run attributes
-uno::Sequence< PropertyValue > aValues( aDefAttrSeq.size() );
-PropertyValue* pValues = aValues.getArray();
+std::vector< PropertyValue > aValues( aDefAttrSeq.size() );
 sal_Int32 i = 0;
 for ( tAccParaPropValMap::const_iterator aDefIter = aDefAttrSeq.begin();
   aDefIter != aDefAttrSeq.end();
@@ -1652,11 +1651,11 @@ uno::Sequence 
SwAccessibleParagraph::getCharacterAttributes(
 aRunAttrSeq.find( aDefIter->first );
 if ( aRunIter != aRunAttrSeq.end() )
 {
-pValues[i] = aRunIter->second;
+aValues[i] = aRunIter->second;
 }
 else
 {
-pValues[i] = aDefIter->second;
+aValues[i] = aDefIter->second;
 }
 ++i;
 }
@@ -1669,29 +1668,25 @@ uno::Sequence 
SwAccessibleParagraph::getCharacterAttributes(
 tAccParaPropValMap aSupplementalAttrSeq;
 _getSupplementalAttributesImpl( nIndex, aSupplementalNames, 
aSupplementalAttrSeq );
 
-aValues.realloc( aValues.getLength() + aSupplementalAttrSeq.size() );
-pValues = aValues.getArray();
+aValues.resize( aValues.size() + aSupplementalAttrSeq.size() );
 
 for ( tAccParaPropValMap::const_iterator aSupplementalIter = 
aSupplementalAttrSeq.begin();
 aSupplementalIter != aSupplementalAttrSeq.end();
 ++aSupplementalIter )
 {
-pValues[i] = aSupplementalIter->second;
+aValues[i] = aSupplementalIter->second;
 ++i;
 }
 
 _correctValues( nIndex, aValues );
 
-aValues.realloc( aValues.getLength() + 1 );
-
-pValues = aValues.getArray();
+aValues.resize( aValues.size() + 1 );
 
 OUString strTypeName = GetFieldTypeNameAtIndex(nIndex);
 if (!strTypeName.isEmpty())
 {
-aValues.realloc( aValues.getLengt

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

2015-03-14 Thread Miklos Vajna
 sw/source/filter/rtf/swparrtf.cxx|5 -
 sw/source/filter/ww8/docxattributeoutput.cxx |8 +++-
 sw/source/filter/ww8/docxsdrexport.cxx   |   18 --
 sw/source/filter/ww8/docxsdrexport.hxx   |3 +--
 writerfilter/source/dmapper/SdtHelper.cxx|1 -
 writerfilter/source/filter/WriterFilter.cxx  |5 -
 writerfilter/source/filter/WriterFilterDetection.cxx |3 ---
 7 files changed, 8 insertions(+), 35 deletions(-)

New commits:
commit f21e8575326430d29bfe3a5c17b923f8f38cc20c
Author: Miklos Vajna 
Date:   Sat Mar 14 10:41:49 2015 +0100

DocxSdrExport::Impl::m_pFlyAttrList: use unique_ptr

Change-Id: I3424af5e3c10eef454cb6a17ec6e84113fbe10f4

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 99b4fbc..6b125c0 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -845,8 +845,7 @@ void 
DocxAttributeOutput::WriteCollectedParagraphProperties()
 {
 if ( m_rExport.SdrExporter().getFlyAttrList() )
 {
-XFastAttributeListRef xAttrList( 
m_rExport.SdrExporter().getFlyAttrList() );
-m_rExport.SdrExporter().setFlyAttrList(NULL);
+XFastAttributeListRef xAttrList( 
m_rExport.SdrExporter().getFlyAttrList().release() );
 
 m_pSerializer->singleElementNS( XML_w, XML_framePr, xAttrList );
 }
@@ -2385,9 +2384,8 @@ void DocxAttributeOutput::Redline( const SwRedlineData* 
pRedlineData)
 // to the DOCX when the function 
'WriteCollectedParagraphProperties' gets called.
 // So we need to store the current status of these lists, 
so that we can revert back to them when
 // we are done exporting the redline attributes.
-::sax_fastparser::FastAttributeList *pFlyAttrList_Original 
 = m_rExport.SdrExporter().getFlyAttrList();
+std::unique_ptr 
pFlyAttrList_Original(m_rExport.SdrExporter().getFlyAttrList().release());
 std::unique_ptr 
pParagraphSpacingAttrList_Original(m_pParagraphSpacingAttrList.release());
-m_rExport.SdrExporter().setFlyAttrList(NULL);
 
 // Output the redline item set
 m_rExport.OutputItemSet( *pChangesSet, true, false, 
i18n::ScriptType::LATIN, m_rExport.mbExportModeRTF );
@@ -2396,7 +2394,7 @@ void DocxAttributeOutput::Redline( const SwRedlineData* 
pRedlineData)
 WriteCollectedParagraphProperties();
 
 // Revert back the original values that were stored in 
'm_rExport.SdrExporter().getFlyAttrList()', 'm_pParagraphSpacingAttrList'
-
m_rExport.SdrExporter().setFlyAttrList(pFlyAttrList_Original);
+
m_rExport.SdrExporter().getFlyAttrList().reset(pFlyAttrList_Original.release());
 
m_pParagraphSpacingAttrList.reset(pParagraphSpacingAttrList_Original.release());
 
 m_pSerializer->endElementNS( XML_w, XML_pPr );
diff --git a/sw/source/filter/ww8/docxsdrexport.cxx 
b/sw/source/filter/ww8/docxsdrexport.cxx
index 142e79c..a642b17 100644
--- a/sw/source/filter/ww8/docxsdrexport.cxx
+++ b/sw/source/filter/ww8/docxsdrexport.cxx
@@ -132,7 +132,7 @@ struct DocxSdrExport::Impl
 const Size* m_pFlyFrameSize;
 bool m_bTextFrameSyntax;
 bool m_bDMLTextFrameSyntax;
-sax_fastparser::FastAttributeList* m_pFlyAttrList;
+std::unique_ptr m_pFlyAttrList;
 sax_fastparser::FastAttributeList* m_pTextboxAttrList;
 OStringBuffer m_aTextFrameStyle;
 bool m_bFrameBtLr;
@@ -160,7 +160,6 @@ struct DocxSdrExport::Impl
   m_pFlyFrameSize(0),
   m_bTextFrameSyntax(false),
   m_bDMLTextFrameSyntax(false),
-  m_pFlyAttrList(0),
   m_pTextboxAttrList(0),
   m_bFrameBtLr(false),
   m_bDrawingOpen(false),
@@ -181,7 +180,6 @@ struct DocxSdrExport::Impl
 
 ~Impl()
 {
-delete m_pFlyAttrList, m_pFlyAttrList = NULL;
 delete m_pTextboxAttrList, m_pTextboxAttrList = NULL;
 }
 
@@ -220,16 +218,11 @@ bool DocxSdrExport::getDMLTextFrameSyntax()
 return m_pImpl->m_bDMLTextFrameSyntax;
 }
 
-sax_fastparser::FastAttributeList*& DocxSdrExport::getFlyAttrList()
+std::unique_ptr& 
DocxSdrExport::getFlyAttrList()
 {
 return m_pImpl->m_pFlyAttrList;
 }
 
-void DocxSdrExport::setFlyAttrList(sax_fastparser::FastAttributeList* 
pAttrList)
-{
-m_pImpl->m_pFlyAttrList = pAttrList;
-}
-
 sax_fastparser::FastAttributeList* DocxSdrExport::getTextboxAttrList()
 {
 return m_pImpl->m_pTextboxAttrList;
@@ -1592,7 +1585,7 @@ void DocxSdrExport::writeVMLTextFrame(sw::Frame* 
pParentFrame, bool bTextBoxOnly
 m_pImpl->m_pFlyFrameSize = &aSize;
 
 m_pImpl->m_bTextFrameSyntax = true;
-m_pImpl->m_pFlyAttrList = pFS->createAttrList();
+m_pImpl->m_pFlyAttrList.re

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

2015-02-21 Thread Miklos Vajna
 sw/source/core/doc/docredln.cxx  |   50 +++
 sw/source/core/docnode/nodedump.cxx  |  138 ---
 writerfilter/source/filter/RtfFilter.cxx |   84 --
 writerfilter/source/filter/RtfFilter.hxx |   82 --
 4 files changed, 107 insertions(+), 247 deletions(-)

New commits:
commit 76e974e078d8ad77eb316cfbe5a3e2323cac390a
Author: Miklos Vajna 
Date:   Sat Feb 21 11:16:07 2015 +0100

Extract SwRedlineTbl::dumpAsXml() from docnode

Change-Id: I336d7875bbd88dd1993993e0e049c264b87f2318

diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index 8d9cf08..20dcda5 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -17,6 +17,8 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -564,6 +566,54 @@ const SwRangeRedline* SwRedlineTbl::FindAtPosition( const 
SwPosition& rSttPos,
 return pFnd;
 }
 
+void SwRedlineTbl::dumpAsXml(xmlTextWriterPtr pWriter) const
+{
+xmlTextWriterStartElement(pWriter, BAD_CAST("swRedlineTbl"));
+xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this);
+
+for (sal_uInt16 nCurRedlinePos = 0; nCurRedlinePos < size(); 
++nCurRedlinePos)
+{
+const SwRangeRedline* pRedline = operator[](nCurRedlinePos);
+xmlTextWriterStartElement(pWriter, BAD_CAST("swRangeRedline"));
+
+xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", 
pRedline);
+xmlTextWriterWriteAttribute(pWriter, BAD_CAST("id"), 
BAD_CAST(OString::number(pRedline->GetSeqNo()).getStr()));
+xmlTextWriterWriteAttribute(pWriter, BAD_CAST("author"), 
BAD_CAST(SW_MOD()->GetRedlineAuthor(pRedline->GetAuthor()).toUtf8().getStr()));
+xmlTextWriterWriteAttribute(pWriter, BAD_CAST("date"), 
BAD_CAST(DateTimeToOString(pRedline->GetTimeStamp()).getStr()));
+
+OString sRedlineType;
+switch (pRedline->GetType())
+{
+case nsRedlineType_t::REDLINE_INSERT:
+sRedlineType = "REDLINE_INSERT";
+break;
+case nsRedlineType_t::REDLINE_DELETE:
+sRedlineType = "REDLINE_DELETE";
+break;
+case nsRedlineType_t::REDLINE_FORMAT:
+sRedlineType = "REDLINE_FORMAT";
+break;
+default:
+sRedlineType = "UNKNOWN";
+break;
+}
+xmlTextWriterWriteAttribute(pWriter, BAD_CAST("type"), 
BAD_CAST(sRedlineType.getStr()));
+
+xmlTextWriterStartElement(pWriter, BAD_CAST("point"));
+pRedline->GetPoint()->dumpAsXml(pWriter);
+xmlTextWriterEndElement(pWriter);
+xmlTextWriterStartElement(pWriter, BAD_CAST("mark"));
+pRedline->GetMark()->dumpAsXml(pWriter);
+xmlTextWriterEndElement(pWriter);
+
+const SwRedlineExtraData* pExtraRedlineData = pRedline->GetExtraData();
+xmlTextWriterStartElement(pWriter, BAD_CAST("swRedlineExtraData"));
+xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("symbol"), "%s", 
BAD_CAST(typeid(pExtraRedlineData).name()));
+xmlTextWriterEndElement(pWriter); // swRadlineExtraData
+xmlTextWriterEndElement(pWriter); // swRangeRedline
+}
+xmlTextWriterEndElement(pWriter); // swRedlineTbl
+}
 
 SwRedlineExtraData::~SwRedlineExtraData()
 {
diff --git a/sw/source/core/docnode/nodedump.cxx 
b/sw/source/core/docnode/nodedump.cxx
index 7ab7fe8..e485e33 100644
--- a/sw/source/core/docnode/nodedump.cxx
+++ b/sw/source/core/docnode/nodedump.cxx
@@ -95,7 +95,6 @@ void WriterHelper::writeFormatAttribute( const char* 
attribute, const char* form
 // Hack: somehow conversion from "..." to va_list does
 // bomb on two string litterals in the format.
 static const char* TMP_FORMAT = "%" SAL_PRIuUINTPTR;
-static const char* TMP_FORMAT_I32 = "%" SAL_PRIdINT32;
 
 }
 
@@ -340,143 +339,6 @@ void SwTxtNode::dumpAsXml( xmlTextWriterPtr w ) const
 writer.endElement();
 }
 
-void SwRedlineTbl::dumpAsXml( xmlTextWriterPtr w ) const
-{
-WriterHelper writer( w );
-
-writer.startElement( "swredlinetbl" );
-writer.writeFormatAttribute( "ptr", "%p", this );
-
-const SwRedlineTbl& redlineTbl = (*this);
-
-for( sal_uInt16 nCurRedlinePos = 0; nCurRedlinePos < size(); 
++nCurRedlinePos )
-{
-const SwRangeRedline* pRedline = redlineTbl[ nCurRedlinePos ];
-
-writer.startElement( "swredline" );
-writer.writeFormatAttribute( "ptr", "%p", pRedline );
-
-OString aId( OString::number( pRedline->GetSeqNo() ) );
-const OUString &rAuthor( SW_MOD()->GetRedlineAuthor( 
pRedline->GetAuthor() ) );
-OString aAuthor( OUStringToOString( rAuthor, RTL_TEXTENCODING_UTF8 ) );
-OString aDate( DateTimeToOString( pRedline->GetTimeStamp() ) );
-OString sRedlineType;
-switch( pRedline->GetType() )
-{
-  

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

2015-02-08 Thread Miklos Vajna
 sw/source/filter/ww8/docxsdrexport.cxx  |2 +-
 sw/source/filter/ww8/docxsdrexport.hxx  |6 ++
 sw/source/filter/ww8/rtfattributeoutput.cxx |2 +-
 sw/source/filter/ww8/rtfstringbuffer.cxx|2 +-
 writerfilter/source/dmapper/SdtHelper.cxx   |2 +-
 writerfilter/source/dmapper/SdtHelper.hxx   |4 +++-
 writerfilter/source/filter/RtfFilter.cxx|2 +-
 writerfilter/source/filter/RtfFilter.hxx|3 ++-
 writerfilter/source/rtftok/rtflookahead.cxx |2 +-
 writerfilter/source/rtftok/rtfsdrimport.cxx |2 +-
 writerfilter/source/rtftok/rtfsdrimport.hxx |4 +++-
 writerfilter/source/rtftok/rtftokenizer.cxx |2 +-
 writerfilter/source/rtftok/rtftokenizer.hxx |4 
 13 files changed, 26 insertions(+), 11 deletions(-)

New commits:
commit 9614183a33ec9cd658870755645ed64ae221
Author: Miklos Vajna 
Date:   Sun Feb 8 18:10:34 2015 +0100

sw: make sure that these headers are self-contained

Change-Id: Ifdfe85abe57b5873ab4641d3a592c4cf8d2e4e01

diff --git a/sw/source/filter/ww8/docxsdrexport.cxx 
b/sw/source/filter/ww8/docxsdrexport.cxx
index 98cdff3..d086500 100644
--- a/sw/source/filter/ww8/docxsdrexport.cxx
+++ b/sw/source/filter/ww8/docxsdrexport.cxx
@@ -7,6 +7,7 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
+#include 
 #include 
 #include 
 #include 
@@ -26,7 +27,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/sw/source/filter/ww8/docxsdrexport.hxx 
b/sw/source/filter/ww8/docxsdrexport.hxx
index fb25d38..b910ee4 100644
--- a/sw/source/filter/ww8/docxsdrexport.hxx
+++ b/sw/source/filter/ww8/docxsdrexport.hxx
@@ -11,7 +11,12 @@
 #define INCLUDED_SW_SOURCE_FILTER_WW8_DOCXSDREXPORT_HXX
 
 #include 
+
 #include 
+#include 
+#include 
+#include 
+
 namespace oox
 {
 namespace drawingml
@@ -22,6 +27,7 @@ class DrawingML;
 class Size;
 class Point;
 class SdrObject;
+class SvxBoxItem;
 
 namespace sw
 {
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx 
b/sw/source/filter/ww8/rtfattributeoutput.cxx
index beca882..d65c450 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -17,8 +17,8 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include 
 #include "rtfattributeoutput.hxx"
+#include 
 #include "rtfsdrexport.hxx"
 #include "writerwordglue.hxx"
 #include "ww8par.hxx"
diff --git a/sw/source/filter/ww8/rtfstringbuffer.cxx 
b/sw/source/filter/ww8/rtfstringbuffer.cxx
index 16535f7..aa7db28 100644
--- a/sw/source/filter/ww8/rtfstringbuffer.cxx
+++ b/sw/source/filter/ww8/rtfstringbuffer.cxx
@@ -6,8 +6,8 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#include "rtfattributeoutput.hxx"
 #include "rtfstringbuffer.hxx"
+#include "rtfattributeoutput.hxx"
 
 RtfStringBufferValue::RtfStringBufferValue()
 : m_aBuffer(),
commit 090e5f356a1da58c6bd4e2e8f84487a228ea11dc
Author: Miklos Vajna 
Date:   Sun Feb 8 12:26:26 2015 +0100

writerfilter: make sure that these headers are self-contained

Change-Id: I3486e8ba5f6d2a937176c9fe549d707a97eb5655

diff --git a/writerfilter/source/dmapper/SdtHelper.cxx 
b/writerfilter/source/dmapper/SdtHelper.cxx
index 4380374..f5a3bd1 100644
--- a/writerfilter/source/dmapper/SdtHelper.cxx
+++ b/writerfilter/source/dmapper/SdtHelper.cxx
@@ -7,13 +7,13 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
+#include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
-#include 
 #include 
 
 namespace writerfilter
diff --git a/writerfilter/source/dmapper/SdtHelper.hxx 
b/writerfilter/source/dmapper/SdtHelper.hxx
index 462f9a7..f22f306 100644
--- a/writerfilter/source/dmapper/SdtHelper.hxx
+++ b/writerfilter/source/dmapper/SdtHelper.hxx
@@ -10,12 +10,14 @@
 #ifndef INCLUDED_WRITERFILTER_SOURCE_DMAPPER_SDTHELPER_HXX
 #define INCLUDED_WRITERFILTER_SOURCE_DMAPPER_SDTHELPER_HXX
 
-#include 
 #include 
 
+#include 
+
 #include 
 #include 
 
+#include 
 
 namespace com
 {
diff --git a/writerfilter/source/filter/RtfFilter.cxx 
b/writerfilter/source/filter/RtfFilter.cxx
index b2de8d8..421e485 100644
--- a/writerfilter/source/filter/RtfFilter.cxx
+++ b/writerfilter/source/filter/RtfFilter.cxx
@@ -17,8 +17,8 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/writerfilter/source/filter/RtfFilter.hxx 
b/writerfilter/source/filter/RtfFilter.hxx
index d9814e0..bfe30c0 100644
--- a/writerfilter/source/filter/RtfFilter.hxx
+++ b/writerfilter/source/filter/RtfFilter.hxx
@@ -20,11 +20,12 @@
 #ifndef INCLUDED_WRITERFILTER_SOURCE_FILTER_RTFFILTER_HXX
 #define INCLUDED_WRITERFILTER_SOURCE_FILTER_RTFFILTER_HXX
 
+#include 
 #include 
 #include 
-#include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
diff --git a/writerfilter/source/rtftok/rtflookahead.cxx 
b/writerfilter/source/rtftok/rtflookahead.cxx
index 81253

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

2014-10-13 Thread Miklos Vajna
 sw/source/filter/ww8/wrtw8esh.cxx |2 +-
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   22 ++
 2 files changed, 7 insertions(+), 17 deletions(-)

New commits:
commit 3ded687bef4b72a9bb25ce8749c481809b9e04df
Author: Miklos Vajna 
Date:   Mon Oct 13 21:45:57 2014 +0200

SwBasicEscherEx::WritePictures: improve comment

Change-Id: I6763d18efb2b61462b0a92f847495884716f18bb

diff --git a/sw/source/filter/ww8/wrtw8esh.cxx 
b/sw/source/filter/ww8/wrtw8esh.cxx
index 1c5e838..a259e91 100644
--- a/sw/source/filter/ww8/wrtw8esh.cxx
+++ b/sw/source/filter/ww8/wrtw8esh.cxx
@@ -2236,7 +2236,7 @@ SwEscherEx::SwEscherEx(SvStream* pStrm, WW8Export& 
rWW8Wrt)
 
 for( ; i--; pSdrObjs = rWrt.pSdrObjs, pTxtBxs = rWrt.pTxtBxs )
 {
-// "dummy char" (or any Count ?) - why? This knows only M$
+// "dummy char" (or any Count ?) - why? Only Microsoft knows it.
 GetStream().WriteChar( i );
 
 OpenContainer( ESCHER_DgContainer );
commit 05874170fefb22ad1c461d5402ad30de2654453a
Author: Miklos Vajna 
Date:   Mon Oct 13 21:44:50 2014 +0200

Use comphelper::SequenceAsVector

Change-Id: I0af333551bdd32400b795d37de0d6240e68dd6b6

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index f49a14f..8bdf7f7 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -589,25 +589,15 @@ void DomainMapper_Impl::IncorporateTabStop( const 
DeletableTabStop &  rTabStop )
 
 uno::Sequence< style::TabStop > DomainMapper_Impl::GetCurrentTabStopAndClear()
 {
-uno::Sequence< style::TabStop > aRet( sal_Int32( m_aCurrentTabStops.size() 
) );
-style::TabStop* pArray = aRet.getArray();
-::std::vector::const_iterator aIt = 
m_aCurrentTabStops.begin();
-::std::vector::const_iterator aEndIt = 
m_aCurrentTabStops.end();
-sal_Int32 nDeleted = 0;
-for(sal_Int32 nIndex = 0; aIt != aEndIt; ++aIt)
-{
-if(!aIt->bDeleted)
-pArray[nIndex++] = *aIt;
-else
-++nDeleted;
+comphelper::SequenceAsVector aRet;
+for (DeletableTabStop& rStop : m_aCurrentTabStops)
+{
+if (!rStop.bDeleted)
+aRet.push_back(rStop);
 }
 m_aCurrentTabStops.clear();
 m_nCurrentTabStopIndex = 0;
-if(nDeleted)
-{
-aRet.realloc( aRet.getLength() - nDeleted);
-}
-return aRet;
+return aRet.getAsConstList();
 }
 
 /*-
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-10-02 Thread Luboš Luňák
 sw/source/core/inc/frmtool.hxx|2 +-
 sw/source/core/layout/frmtool.cxx |2 +-
 sw/source/core/layout/tabfrm.cxx  |4 ++--
 writerfilter/source/dmapper/DomainMapper_Impl.hxx |4 ++--
 4 files changed, 6 insertions(+), 6 deletions(-)

New commits:
commit cb0d80209534c42a1a0fa7ba3c65369a434a00ba
Author: Luboš Luňák 
Date:   Sun Sep 21 21:26:47 2014 +0200

do not use number-of-enum-items as an enum item itself

Because that breaks warning about all cases (not) being handled in switch.

Change-Id: I8fadccd4e5d125cc37b8e10087e9170f07e65440

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
index 2360a46..0407a08 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -104,9 +104,9 @@ enum ContextType
 CONTEXT_PARAGRAPH,
 CONTEXT_CHARACTER,
 CONTEXT_STYLESHEET,
-CONTEXT_LIST,
-NUMBER_OF_CONTEXTS
+CONTEXT_LIST
 };
+enum { NUMBER_OF_CONTEXTS = CONTEXT_LIST + 1 };
 
 enum BreakType
 {
commit baa06b23845cd266e2b9d456ce08b7c0b67ec00f
Author: Luboš Luňák 
Date:   Sun Sep 21 16:40:50 2014 +0200

fix typo

Change-Id: I08eff921ab2de64e5734807963c542818456dd8e

diff --git a/sw/source/core/inc/frmtool.hxx b/sw/source/core/inc/frmtool.hxx
index 1fdaee5..8df9df1 100644
--- a/sw/source/core/inc/frmtool.hxx
+++ b/sw/source/core/inc/frmtool.hxx
@@ -120,7 +120,7 @@ extern bool bSetCompletePaintOnInvalidate;
 
 // for table settings via keyboard
 long CalcRowRstHeight( SwLayoutFrm *pRow );
-long CalcHeightWidthFlys( const SwFrm *pFrm );
+long CalcHeightWithFlys( const SwFrm *pFrm );
 
 SwPageFrm *InsertNewPage( SwPageDesc &rDesc, SwFrm *pUpper,
   bool bOdd, bool bFirst, bool bInsertEmpty, bool bFtn,
diff --git a/sw/source/core/layout/frmtool.cxx 
b/sw/source/core/layout/frmtool.cxx
index ceacf4a..76a06b7 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -3137,7 +3137,7 @@ static SwTwips lcl_CalcCellRstHeight( SwLayoutFrm *pCell )
 else if( pLow->IsSctFrm() && ((SwSectionFrm*)pLow)->IsUndersized() 
)
 nLow += ((SwSectionFrm*)pLow)->Undersize();
 nFlyAdd = std::max( 0L, nFlyAdd - nLow );
-nFlyAdd = std::max( nFlyAdd, ::CalcHeightWidthFlys( pLow ) );
+nFlyAdd = std::max( nFlyAdd, ::CalcHeightWithFlys( pLow ) );
 nHeight += nLow;
 pLow = pLow->GetNext();
 } while ( pLow );
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index a946293..5ca1929 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -3577,7 +3577,7 @@ void SwRowFrm::MakeAll()
 SwLayoutFrm::MakeAll();
 }
 
-long CalcHeightWidthFlys( const SwFrm *pFrm )
+long CalcHeightWithFlys( const SwFrm *pFrm )
 {
 SWRECTFN( pFrm )
 long nHeight = 0;
@@ -3739,7 +3739,7 @@ static SwTwips lcl_CalcMinCellHeight( const SwLayoutFrm 
*_pCell,
 if ( _bConsiderObjs )
 {
 nFlyAdd = std::max( 0L, nFlyAdd - nLowHeight );
-nFlyAdd = std::max( nFlyAdd, ::CalcHeightWidthFlys( pLow ) 
);
+nFlyAdd = std::max( nFlyAdd, ::CalcHeightWithFlys( pLow ) 
);
 }
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-08-06 Thread Miklos Vajna
 sw/source/filter/ww8/docxattributeoutput.cxx  |3 +
 writerfilter/source/dmapper/DomainMapper.cxx  |   59 ++
 writerfilter/source/dmapper/DomainMapper_Impl.hxx |2 
 writerfilter/source/dmapper/PropertyIds.cxx   |2 
 writerfilter/source/dmapper/PropertyIds.hxx   |2 
 writerfilter/source/dmapper/PropertyMap.cxx   |   53 ++-
 writerfilter/source/dmapper/PropertyMap.hxx   |1 
 7 files changed, 117 insertions(+), 5 deletions(-)

New commits:
commit 942f1ed93c4e26e883b7d1d3ee6b729ef72cec67
Author: Miklos Vajna 
Date:   Wed Aug 6 13:20:19 2014 +0200

DOCX import: handle  cell property

Change-Id: I849daf0ddee370775fda73e04739e69acbc64246

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 051b6c1..6ab6bde 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -3290,6 +3290,9 @@ void DocxAttributeOutput::TableBackgrounds( 
ww8::WW8TableNodeInfoInner::Pointer_
 
 for( aGrabBagElement = aGrabBag.begin(); aGrabBagElement != 
aGrabBag.end(); ++aGrabBagElement )
 {
+if (!aGrabBagElement->second.has())
+continue;
+
 OString sValue = OUStringToOString( 
aGrabBagElement->second.get(), RTL_TEXTENCODING_UTF8 );
 if( aGrabBagElement->first == "themeFill")
 AddToAttrList( aAttrList, FSNS( XML_w, XML_themeFill ), 
sValue.getStr() );
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index c89395f..7864dd9 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -2504,6 +2504,18 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, 
PropertyMapPtr rContext )
 }
 }
 break;
+case NS_ooxml::LN_CT_TcPrBase_cnfStyle:
+{
+m_pImpl->enableInteropGrabBag("cnfStyle");
+resourcemodel::resolveSprmProps(*this, rSprm);
+
+TablePropertyMapPtr pPropMap(new TablePropertyMap());
+pPropMap->Insert(PROP_CELL_CNF_STYLE, 
uno::makeAny(uno::makeAny(m_pImpl->m_aInteropGrabBag.getAsConstList())), true, 
CELL_GRAB_BAG);
+m_pImpl->getTableManager().cellProps(pPropMap);
+
+m_pImpl->disableInteropGrabBag();
+}
+break;
 case NS_ooxml::LN_CT_PPrBase_cnfStyle:
 {
 m_pImpl->enableInteropGrabBag("cnfStyle");
diff --git a/writerfilter/source/dmapper/PropertyIds.cxx 
b/writerfilter/source/dmapper/PropertyIds.cxx
index 6d236c1..c12e97a 100644
--- a/writerfilter/source/dmapper/PropertyIds.cxx
+++ b/writerfilter/source/dmapper/PropertyIds.cxx
@@ -397,6 +397,7 @@ OUString PropertyNameSupplier::GetName( PropertyIds eId ) 
const
 case PROP_PARA_SDT_END_BEFORE: sName = "ParaSdtEndBefore"; break;
 case META_PROP_TABLE_LOOK: sName = "TableStyleLook"; break;
 case PROP_PARA_CNF_STYLE: sName = "ParaCnfStyle"; break;
+case PROP_CELL_CNF_STYLE: sName = "CellCnfStyle"; break;
 }
 ::std::pair aInsertIt =
 m_pImpl->aNameMap.insert( PropertyNameMap_t::value_type( eId, 
sName ));
diff --git a/writerfilter/source/dmapper/PropertyIds.hxx 
b/writerfilter/source/dmapper/PropertyIds.hxx
index 5814c34..0ff6ee3 100644
--- a/writerfilter/source/dmapper/PropertyIds.hxx
+++ b/writerfilter/source/dmapper/PropertyIds.hxx
@@ -369,6 +369,7 @@ enum PropertyIds
 ,PROP_PARA_SDT_END_BEFORE
 ,META_PROP_TABLE_LOOK
 ,PROP_PARA_CNF_STYLE
+,PROP_CELL_CNF_STYLE
 };
 struct PropertyNameSupplier_Impl;
 class PropertyNameSupplier
diff --git a/writerfilter/source/dmapper/PropertyMap.cxx 
b/writerfilter/source/dmapper/PropertyMap.cxx
index ab1d48d..62c5ba6 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -66,30 +66,50 @@ uno::Sequence< beans::PropertyValue > 
PropertyMap::GetPropertyValues(bool bCharG
 {
 size_t nCharGrabBag = 0;
 size_t nParaGrabBag = 0;
+size_t nCellGrabBag = 0;
+size_t nCellGrabBagSaved = 0; // How many entries do we save from the 
returned sequence.
 for (MapIterator i = m_vMap.begin(); i != m_vMap.end(); ++i)
 {
 if ( i->second.getGrabBagType() == CHAR_GRAB_BAG )
 nCharGrabBag++;
 else if ( i->second.getGrabBagType() == PARA_GRAB_BAG )
 nParaGrabBag++;
+else if ( i->second.getGrabBagType() == CELL_GRAB_BAG )
+{
+nCellGrabBag++;
+nCellGrabBagSaved++;
+}
+else if ( i->first == PROP_CELL_INTEROP_GRAB_BAG)
+{
+uno::Sequence aSeq;
+i->second.getValue() >>= aSeq;
+nCellGrabBag += aSeq.getLength();
+nCellGrabBagSaved++;
+}
 }
 
 // In case there ar

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

2014-07-15 Thread Matúš Kukan
 sw/source/core/inc/DocumentTimerManager.hxx   |2 +-
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 7321a659713aeb08cd3d2db13e0bfa17dc3da6aa
Author: Matúš Kukan 
Date:   Tue Jul 15 19:55:37 2014 +0200

-Werror,-Wheader-guard

Change-Id: I6b13c77975d8aeef63b424e418a4a4a98ced159f

diff --git a/sw/source/core/inc/DocumentTimerManager.hxx 
b/sw/source/core/inc/DocumentTimerManager.hxx
index 6bd7fcd..5becf1b 100644
--- a/sw/source/core/inc/DocumentTimerManager.hxx
+++ b/sw/source/core/inc/DocumentTimerManager.hxx
@@ -18,7 +18,7 @@
  */
 
 #ifndef INCLUDED_SW_SOURCE_CORE_INC_DOCUMENTTIMERMANAGER_HXX
-#define INCLUDED_SW_SOURCE_CORE_INC_DOCUMENTTIMERMANAGER_HX
+#define INCLUDED_SW_SOURCE_CORE_INC_DOCUMENTTIMERMANAGER_HXX
 
 #include 
 #include 
commit 6e6cbf44d806457512c142c64cf857eacfaa
Author: Matúš Kukan 
Date:   Tue Jul 15 19:52:43 2014 +0200

WaE: unused variable 'sMarker'

Change-Id: Idba194e9bafa17dcedd5d1d45c5e0b4e3db54cee

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 6645e23..9983b99 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1123,7 +1123,7 @@ void DomainMapper_Impl::finishParagraph( PropertyMapPtr 
pPropertyMap )
 if (xCursor.is())
 xCursor->gotoEnd(false);
 PropertyMapPtr pEmpty(new PropertyMap());
-appendTextPortion("X", pEmpty);
+appendTextPortion(sMarker, pEmpty);
 }
 
 xTextRange = xTextAppend->finishParagraph( aProperties );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-06-02 Thread Miklos Vajna
 sw/source/core/frmedt/fefly1.cxx   |2 
 writerfilter/source/dmapper/FFData.xml |   75 -
 2 files changed, 1 insertion(+), 76 deletions(-)

New commits:
commit 418c5f7a4911bb2f1a06858556131b1bc4ad54f6
Author: Miklos Vajna 
Date:   Mon Jun 2 22:13:32 2014 +0200

coverity#735904 Unchecked dynamic_cast

Change-Id: I784fa73c69a25ccf5d750b92c6aa8815385df0a9

diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx
index d7300e0..a20dceb 100644
--- a/sw/source/core/frmedt/fefly1.cxx
+++ b/sw/source/core/frmedt/fefly1.cxx
@@ -1920,7 +1920,7 @@ OUString SwFEShell::GetObjTitle() const
 const SwFrmFmt* pFmt = FindFrmFmt( pObj );
 if ( pFmt->Which() == RES_FLYFRMFMT )
 {
-return dynamic_cast(pFmt)->GetObjTitle();
+return static_cast(pFmt)->GetObjTitle();
 }
 return pObj->GetTitle();
 }
commit ec1ba489fa93297b18cc3a03954bf2048e04bbe0
Author: Miklos Vajna 
Date:   Mon Jun 2 22:03:43 2014 +0200

writerfilter: unused FFData.xml

Change-Id: Id30f35b8a357276c215b71e548ba46e86c51ad48

diff --git a/writerfilter/source/dmapper/FFData.xml 
b/writerfilter/source/dmapper/FFData.xml
deleted file mode 100644
index 6cfdade..000
--- a/writerfilter/source/dmapper/FFData.xml
+++ /dev/null
@@ -1,75 +0,0 @@
-
-
-  
-
-
-
-  
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-  
-  
-  
-  
-  
-  
-  
-  
-  
-  
-  
-  
-  
-  
-  
-  
-  
-  
-  
-  
-  
-
-
-  
-  
-  
-  
-
-  
-
\ No newline at end of file
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-05-03 Thread Miklos Vajna
 sw/source/core/access/accnotextframe.cxx  |6 --
 writerfilter/source/rtftok/rtfdocumentfactory.cxx |   16 +---
 2 files changed, 13 insertions(+), 9 deletions(-)

New commits:
commit dbbaa85d296d5c3ee9db42a132649570d977b429
Author: Miklos Vajna 
Date:   Sat May 3 21:00:15 2014 +0200

writerfilter: fix indentation in rtfdocumentfactory

Change-Id: I9cf6abaf091d358670bbe71de9abe832fa139f42

diff --git a/writerfilter/source/rtftok/rtfdocumentfactory.cxx 
b/writerfilter/source/rtftok/rtfdocumentfactory.cxx
index 5bbbc92..8771295 100644
--- a/writerfilter/source/rtftok/rtfdocumentfactory.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentfactory.cxx
@@ -9,14 +9,16 @@
 
 #include 
 
-namespace writerfilter {
-namespace rtftok {
+namespace writerfilter
+{
+namespace rtftok
+{
 
-RTFDocument::Pointer_t RTFDocumentFactory::createDocument(uno::Reference< 
uno::XComponentContext > const & xContext,
-uno::Reference< io::XInputStream > const & xInputStream,
-uno::Reference< lang::XComponent > const & xDstDoc,
-uno::Reference< frame::XFrame > const & xFrame,
-uno::Reference< task::XStatusIndicator > const & xStatusIndicator)
+RTFDocument::Pointer_t RTFDocumentFactory::createDocument(uno::Reference< 
uno::XComponentContext > const& xContext,
+uno::Reference< io::XInputStream > const& xInputStream,
+uno::Reference< lang::XComponent > const& xDstDoc,
+uno::Reference< frame::XFrame > const& xFrame,
+uno::Reference< task::XStatusIndicator > const& xStatusIndicator)
 {
 return RTFDocument::Pointer_t(new RTFDocumentImpl(xContext, xInputStream, 
xDstDoc, xFrame, xStatusIndicator));
 }
commit 26946775d73ee0b4f8fd3effa37549f463fde6db
Author: Miklos Vajna 
Date:   Sat May 3 20:53:02 2014 +0200

coverity#1078575 Unchecked dynamic_cast

Change-Id: Ie25c91ce0035c78629ebd8466baa717d62948503

diff --git a/sw/source/core/access/accnotextframe.cxx 
b/sw/source/core/access/accnotextframe.cxx
index 33d4b7a..7481b12 100644
--- a/sw/source/core/access/accnotextframe.cxx
+++ b/sw/source/core/access/accnotextframe.cxx
@@ -109,8 +109,10 @@ void SwAccessibleNoTextFrame::Modify( const SfxPoolItem* 
pOld, const SfxPoolItem
 // #i73249#
 case RES_TITLE_CHANGED:
 {
-const OUString& sOldTitle(
-dynamic_cast(pOld)->GetString() );
+OUString sOldTitle;
+const SwStringMsgPoolItem* pOldItem = dynamic_cast(pOld);
+if (pOldItem)
+sOldTitle = pOldItem->GetString();
 const OUString& sNewTitle(
 dynamic_cast(pNew)->GetString() );
 if ( sOldTitle == sNewTitle )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-04-27 Thread Miklos Vajna
 sw/source/core/view/vprint.cxx  |2 
 writerfilter/source/rtftok/rtftokenizer.cxx |  197 ++--
 writerfilter/source/rtftok/rtftokenizer.hxx |   82 +--
 3 files changed, 143 insertions(+), 138 deletions(-)

New commits:
commit df0dea0bf055fce59beedadbc8d20a2681c96bd6
Author: Miklos Vajna 
Date:   Sun Apr 27 21:31:10 2014 +0200

writerfilter: fix indentation in rtftokenizer

Change-Id: Ia9c609eabc39c3933479eae3d5c4499f11c58528

diff --git a/writerfilter/source/rtftok/rtftokenizer.cxx 
b/writerfilter/source/rtftok/rtftokenizer.cxx
index 2ddc714..a8587e7 100644
--- a/writerfilter/source/rtftok/rtftokenizer.cxx
+++ b/writerfilter/source/rtftok/rtftokenizer.cxx
@@ -20,8 +20,10 @@
 
 using namespace com::sun::star;
 
-namespace writerfilter {
-namespace rtftok {
+namespace writerfilter
+{
+namespace rtftok
+{
 
 std::vector RTFTokenizer::m_aRTFControlWords;
 bool RTFTokenizer::m_bControlWordsSorted;
@@ -30,12 +32,12 @@ bool RTFTokenizer::m_bMathControlWordsSorted;
 
 RTFTokenizer::RTFTokenizer(RTFListener& rImport, SvStream* pInStream, 
uno::Reference const& xStatusIndicator)
 : m_rImport(rImport),
-m_pInStream(pInStream),
-m_xStatusIndicator(xStatusIndicator),
-m_nGroup(0),
-m_nLineNumber(0),
-m_nLineStartPos(0),
-m_nGroupStart(0)
+  m_pInStream(pInStream),
+  m_xStatusIndicator(xStatusIndicator),
+  m_nGroup(0),
+  m_nLineNumber(0),
+  m_nLineStartPos(0),
+  m_nGroupStart(0)
 {
 if (!RTFTokenizer::m_bControlWordsSorted)
 {
@@ -62,7 +64,7 @@ SvStream& RTFTokenizer::Strm()
 
 int RTFTokenizer::resolveParse()
 {
-SAL_INFO( "writerfilter", OSL_THIS_FUNC );
+SAL_INFO("writerfilter", OSL_THIS_FUNC);
 char ch;
 int ret;
 // for hex chars
@@ -83,7 +85,7 @@ int RTFTokenizer::resolveParse()
 m_xStatusIndicator->setValue(nLastPos = nCurrentPos);
 }
 
-while ((Strm().ReadChar( ch ), !Strm().IsEof()))
+while ((Strm().ReadChar(ch), !Strm().IsEof()))
 {
 //SAL_INFO("writerfilter", OSL_THIS_FUNC << ": parsing character '" << 
ch << "'");
 
@@ -103,63 +105,63 @@ int RTFTokenizer::resolveParse()
 {
 switch (ch)
 {
-case '{':
-m_nGroupStart = Strm().Tell() - 1;
-ret = m_rImport.pushState();
-if (ret)
-return ret;
-break;
-case '}':
-ret = m_rImport.popState();
-if (ret)
-return ret;
-if (m_nGroup == 0)
-{
-if (m_rImport.isSubstream())
-m_rImport.finishSubstream();
-return 0;
-}
-break;
-case '\\':
-ret = resolveKeyword();
+case '{':
+m_nGroupStart = Strm().Tell() - 1;
+ret = m_rImport.pushState();
+if (ret)
+return ret;
+break;
+case '}':
+ret = m_rImport.popState();
+if (ret)
+return ret;
+if (m_nGroup == 0)
+{
+if (m_rImport.isSubstream())
+m_rImport.finishSubstream();
+return 0;
+}
+break;
+case '\\':
+ret = resolveKeyword();
+if (ret)
+return ret;
+break;
+case 0x0d:
+break; // ignore this
+case 0x0a:
+m_nLineNumber++;
+m_nLineStartPos = nCurrentPos;
+break;
+default:
+if (m_nGroup == 0)
+return ERROR_CHAR_OVER;
+if (m_rImport.getInternalState() == INTERNAL_NORMAL)
+{
+ret = m_rImport.resolveChars(ch);
 if (ret)
 return ret;
-break;
-case 0x0d:
-break; // ignore this
-case 0x0a:
-m_nLineNumber++;
-m_nLineStartPos = nCurrentPos;
-break;
-default:
-if (m_nGroup == 0)
-return ERROR_CHAR_OVER;
-if (m_rImport.getInternalState() == INTERNAL_NORMAL)
+}
+else
+{
+SAL_INFO("writerfilter", OSL_THIS_FUNC << ": hex internal 
state");
+b = b << 4;
+sal_Int8 parsed = asHex(ch);
+if (parsed == -1)
+return ERROR_HEX_INVALID;
+b += parsed;
+count--;
+if (

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

2014-03-23 Thread Miklos Vajna
 sw/source/filter/ww8/docxsdrexport.cxx|   20 
 writerfilter/source/ooxml/OOXMLStreamImpl.cxx |   32 +-
 2 files changed, 26 insertions(+), 26 deletions(-)

New commits:
commit 59698a4797101a286c177069c41d43762de6a4d5
Author: Miklos Vajna 
Date:   Sun Mar 23 15:49:12 2014 +0100

DocxSdrExport: fix indentation

Change-Id: I8318caf6a80fe5fd0dbe98ef5877103f9250f616

diff --git a/sw/source/filter/ww8/docxsdrexport.cxx 
b/sw/source/filter/ww8/docxsdrexport.cxx
index d4f63bf..1083477 100644
--- a/sw/source/filter/ww8/docxsdrexport.cxx
+++ b/sw/source/filter/ww8/docxsdrexport.cxx
@@ -73,7 +73,7 @@ OUString lclGetAnchorIdFromGrabBag(const SdrObject* pObj)
 OUString aResult;
 uno::Reference 
xShape(const_cast(pObj)->getUnoShape(), uno::UNO_QUERY);
 uno::Sequence< beans::PropertyValue > propList =
-lclGetProperty< uno::Sequence >(xShape, 
"FrameInteropGrabBag");
+lclGetProperty< uno::Sequence >(xShape, 
"FrameInteropGrabBag");
 for (sal_Int32 nProp = 0; nProp < propList.getLength(); ++nProp)
 {
 OUString aPropName = propList[nProp].Name;
@@ -91,19 +91,19 @@ void lclMovePositionWithRotation(awt::Point& aPos, 
sal_Int64 nRotation)
 // code from ImplEESdrWriter::ImplFlipBoundingBox 
(filter/source/msfilter/eschesdo.cxx)
 // TODO: refactor
 
-if ( nRotation == 0 )
+if (nRotation == 0)
 return;
 
-if ( nRotation < 0 )
-nRotation = ( 36000 + nRotation ) % 36000;
-if ( nRotation % 18000 == 0 )
+if (nRotation < 0)
+nRotation = (36000 + nRotation) % 36000;
+if (nRotation % 18000 == 0)
 nRotation = 0;
-while ( nRotation > 9000 )
-nRotation = ( 18000 - ( nRotation % 18000 ) );
+while (nRotation > 9000)
+nRotation = (18000 - (nRotation % 18000));
 
 double fVal = (double) nRotation * F_PI18000;
-double  fCos = cos( fVal );
-double  fSin = sin( fVal );
+double  fCos = cos(fVal);
+double  fSin = sin(fVal);
 
 double  nWidthHalf = (double) aPos.X / 2;
 double  nHeightHalf = (double) aPos.Y / 2;
@@ -609,7 +609,7 @@ void DocxSdrExport::writeDMLDrawing(const SdrObject* 
pSdrObject, const SwFrmFmt*
 
 bool bLockedCanvas = false;
 uno::Sequence< beans::PropertyValue > propList =
-lclGetProperty< uno::Sequence >(xShape, 
"InteropGrabBag");
+lclGetProperty< uno::Sequence >(xShape, 
"InteropGrabBag");
 for (sal_Int32 nProp=0; nProp < propList.getLength(); ++nProp)
 {
 OUString propName = propList[nProp].Name;
commit 5e01f04cf34970e8583858146c79380fa1bf7aba
Author: Miklos Vajna 
Date:   Sun Mar 23 15:43:22 2014 +0100

a -> r prefix for references

Change-Id: I62d54ba948a78dceef1d50fa684e205a9709

diff --git a/writerfilter/source/ooxml/OOXMLStreamImpl.cxx 
b/writerfilter/source/ooxml/OOXMLStreamImpl.cxx
index 6c6b2ee..6f639e6 100644
--- a/writerfilter/source/ooxml/OOXMLStreamImpl.cxx
+++ b/writerfilter/source/ooxml/OOXMLStreamImpl.cxx
@@ -243,42 +243,42 @@ bool 
OOXMLStreamImpl::lcl_getTarget(uno::Reference
 
 for (sal_Int32 j = 0; j < aSeqs.getLength(); j++)
 {
-const uno::Sequence< beans::StringPair > &aSeq = aSeqs[j];
+const uno::Sequence< beans::StringPair > &rSeq = aSeqs[j];
 
 bool bExternalTarget = false;
 OUString sMyTarget;
-for (sal_Int32 i = 0; i < aSeq.getLength(); i++)
+for (sal_Int32 i = 0; i < rSeq.getLength(); i++)
 {
-const beans::StringPair &aPair = aSeq[i];
+const beans::StringPair &rPair = rSeq[i];
 
-if (aPair.First.compareTo(sType) == 0 &&
-( aPair.Second.compareTo(sStreamType) == 0 ||
-  aPair.Second.compareTo(sStreamTypeStrict) == 0))
+if (rPair.First.compareTo(sType) == 0 &&
+( rPair.Second.compareTo(sStreamType) == 0 ||
+  rPair.Second.compareTo(sStreamTypeStrict) == 0))
 bFound = true;
-else if(aPair.First.compareTo(sType) == 0 &&
-((aPair.Second.compareTo(sOleObjectType) == 0 ||
-  aPair.Second.compareTo(sOleObjectTypeStrict) == 0) &&
+else if(rPair.First.compareTo(sType) == 0 &&
+((rPair.Second.compareTo(sOleObjectType) == 0 ||
+  rPair.Second.compareTo(sOleObjectTypeStrict) == 0) &&
   nStreamType == EMBEDDINGS))
 {
 bFound = true;
 }
-else if (aPair.First.compareTo(sId) == 0 &&
- aPair.Second.compareTo(rId) == 0)
+else if (rPair.First.compareTo(sId) == 0 &&
+ rPair.Second.compareTo(rId) == 0)
 bFound = true;
-else if (aPair.First.compareTo(sTarget) == 0)
+   

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

2014-03-18 Thread Miklos Vajna
 sw/source/filter/ww8/docxsdrexport.cxx|   16 +++-
 sw/source/filter/ww8/docxsdrexport.hxx|2 --
 writerfilter/source/dmapper/SdtHelper.cxx |4 ++--
 3 files changed, 5 insertions(+), 17 deletions(-)

New commits:
commit 2736674aa1eca906ba5f726e47279266cce2149e
Author: Miklos Vajna 
Date:   Tue Mar 18 14:32:43 2014 +0100

sw: not used getter / setter methods

Change-Id: Id357ee22d041cd191d06b0dc2dbf162312a4df0a

diff --git a/sw/source/filter/ww8/docxsdrexport.cxx 
b/sw/source/filter/ww8/docxsdrexport.cxx
index 72f5724..be0baa1 100644
--- a/sw/source/filter/ww8/docxsdrexport.cxx
+++ b/sw/source/filter/ww8/docxsdrexport.cxx
@@ -572,7 +572,7 @@ void DocxSdrExport::writeDMLDrawing(const SdrObject* 
pSdrObject, const SwFrmFmt*
  * was originally a Locked Canvas and is now inside a Text 
Frame.
  */
 
-bLockedCanvas = getIsInDMLTextFrame();
+bLockedCanvas = m_pImpl->m_bIsInDMLTextFrame;
 break;
 }
 }
@@ -1027,7 +1027,7 @@ void DocxSdrExport::writeDiagram(const SdrObject* 
sdrObject, const SwFrmFmt& rFr
 
 void DocxSdrExport::writeDMLTextFrame(sw::Frame* pParentFrame, int nAnchorId)
 {
-setIsInDMLTextFrame(true);
+m_pImpl->m_bIsInDMLTextFrame = true;
 sax_fastparser::FSHelperPtr pFS = m_pImpl->m_pSerializer;
 const SwFrmFmt& rFrmFmt = pParentFrame->GetFrmFmt();
 const SwNodeIndex* pNodeIndex = rFrmFmt.GetCntnt().GetCntntIdx();
@@ -1189,7 +1189,7 @@ void DocxSdrExport::writeDMLTextFrame(sw::Frame* 
pParentFrame, int nAnchorId)
 }
 
 endDMLAnchorInline(&rFrmFmt);
-setIsInDMLTextFrame(false);
+m_pImpl->m_bIsInDMLTextFrame = false;
 }
 
 void DocxSdrExport::writeVMLTextFrame(sw::Frame* pParentFrame)
@@ -1315,14 +1315,4 @@ bool DocxSdrExport::checkFrameBtlr(SwNode* pStartNode, 
sax_fastparser::FastAttri
 return false;
 }
 
-bool DocxSdrExport::getIsInDMLTextFrame()
-{
-return m_pImpl->m_bIsInDMLTextFrame;
-}
-
-void DocxSdrExport::setIsInDMLTextFrame(bool bIsInDMLTextFrame)
-{
-m_pImpl->m_bIsInDMLTextFrame = bIsInDMLTextFrame;
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/docxsdrexport.hxx 
b/sw/source/filter/ww8/docxsdrexport.hxx
index 73c981f..dced28c 100644
--- a/sw/source/filter/ww8/docxsdrexport.hxx
+++ b/sw/source/filter/ww8/docxsdrexport.hxx
@@ -90,8 +90,6 @@ public:
   com::sun::star::uno::Reference< 
com::sun::star::io::XOutputStream > xOutStream, const OUString& 
sGrabBagProperyName);
 /// Writes text frame in DML format.
 void writeDMLTextFrame(sw::Frame* pParentFrame, int nAnchorId);
-bool getIsInDMLTextFrame();
-void setIsInDMLTextFrame(bool bIsInDMLTextFrame);
 /// Writes text frame in VML format.
 void writeVMLTextFrame(sw::Frame* pParentFrame);
 /// Undo the text direction mangling done by the frame btLr handler in 
writerfilter::dmapper::DomainMapper::lcl_startCharacterGroup()
commit e584d38f75db115edf5e07e479665336ea7a4d54
Author: Miklos Vajna 
Date:   Tue Mar 18 14:30:44 2014 +0100

writerfilter: fix indentation in SdtHelper

Change-Id: I00773d4ac74d09aba9c75daf547eb1a16885ddde

diff --git a/writerfilter/source/dmapper/SdtHelper.cxx 
b/writerfilter/source/dmapper/SdtHelper.cxx
index af30b74..32691d9 100644
--- a/writerfilter/source/dmapper/SdtHelper.cxx
+++ b/writerfilter/source/dmapper/SdtHelper.cxx
@@ -190,7 +190,7 @@ bool SdtHelper::hasElements()
 
 void SdtHelper::appendToInteropGrabBag(const OUString& rName, const 
css::uno::Any& rValue)
 {
-if(isInteropGrabBagEnabled())
+if (isInteropGrabBagEnabled())
 {
 sal_Int32 nLength = m_aGrabBag.getLength();
 m_aGrabBag.realloc(nLength + 1);
@@ -202,7 +202,7 @@ void SdtHelper::appendToInteropGrabBag(const OUString& 
rName, const css::uno::An
 beans::PropertyValue SdtHelper::getInteropGrabBagAndClear()
 {
 beans::PropertyValue aProp;
-if(isInteropGrabBagEnabled())
+if (isInteropGrabBagEnabled())
 {
 aProp.Name = m_sGrabBagName;
 aProp.Value = uno::Any(m_aGrabBag);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2013-07-22 Thread Cédric Bosdonnat
 sw/source/core/tox/tox.cxx|8 +
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |  102 +-
 2 files changed, 69 insertions(+), 41 deletions(-)

New commits:
commit fb7b24dc5affb4f29f61a8716c97370951ccba80
Author: Cédric Bosdonnat 
Date:   Thu Jul 18 16:38:39 2013 +0200

n#825976: Table of Illustration has hyperlinks by default like TOC

...and that fixes the formatting of hyperlinks in docx Tableoof
Illustrations.

(cherry picked from commit c1fac43432891bf9f396ff1ec7a1c2ed042bce54)
(cherry picked from commit 49d077b80c15ec9d069435da08bbfe38cdd57c5a)

Change-Id: I990f31a8c9d0d56f58b7b87e368010576d8c8c0d

diff --git a/sw/source/core/tox/tox.cxx b/sw/source/core/tox/tox.cxx
index 677d84f..8b98989 100644
--- a/sw/source/core/tox/tox.cxx
+++ b/sw/source/core/tox/tox.cxx
@@ -310,11 +310,15 @@ SwForm::SwForm( TOXTypes eTyp ) // #i21237#
 }
 
 SwFormTokens aTokens;
-if (TOX_CONTENT == eType)
+if (TOX_CONTENT == eType || TOX_ILLUSTRATIONS == eType )
 {
 SwFormToken aLinkStt (TOKEN_LINK_START);
 aLinkStt.sCharStyleName = String(SW_RES(STR_POOLCHR_TOXJUMP));
 aTokens.push_back(aLinkStt);
+}
+
+if (TOX_CONTENT == eType)
+{
 aTokens.push_back(SwFormToken(TOKEN_ENTRY_NO));
 aTokens.push_back(SwFormToken(TOKEN_ENTRY_TEXT));
 }
@@ -334,7 +338,7 @@ SwForm::SwForm( TOXTypes eTyp ) // #i21237#
 aTokens.push_back(SwFormToken(TOKEN_PAGE_NUMS));
 }
 
-if (TOX_CONTENT == eType)
+if (TOX_CONTENT == eType || TOX_ILLUSTRATIONS == eType)
 aTokens.push_back(SwFormToken(TOKEN_LINK_END));
 
 SetTemplate( 0, SW_RESSTR( nPoolId++ ));
commit f494d9dfd1c0c40eae7aa69a86c3aa4c45971a29
Author: Cédric Bosdonnat 
Date:   Thu Jul 18 15:04:00 2013 +0200

n#825976: handle TOC \h field for illustrations tables in writerfilter

Change-Id: I9ebc91d5f0e706dc1e316e0aa8494af7aec4da4e
(cherry picked from commit 43f7bc96c0117a77610bfa5e1edfa870123f56f1)

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index fb7b8fc..7086c75 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -2573,6 +2573,53 @@ void DomainMapper_Impl::handleAuthor
 #undef SET_DATE
 }
 
+uno::Sequence< beans::PropertyValues > lcl_createTOXLevelHyperlinks( bool 
bHyperlinks, OUString sChapterNoSeparator,
+   uno::Sequence< beans::PropertyValues 
>aLevel,
+   PropertyNameSupplier& rPropNameSupplier )
+{
+//create a copy of the level and add two new entries - hyperlink start and 
end
+bool bChapterNoSeparator  = !sChapterNoSeparator.isEmpty();
+sal_Int32 nAdd = (bHyperlinks && bChapterNoSeparator) ? 4 : 2;
+uno::Sequence< beans::PropertyValues > aNewLevel( aLevel.getLength() + 
nAdd);
+beans::PropertyValues* pNewLevel = aNewLevel.getArray();
+if( bHyperlinks )
+{
+beans::PropertyValues aHyperlink(1);
+aHyperlink[0].Name = rPropNameSupplier.GetName( PROP_TOKEN_TYPE );
+aHyperlink[0].Value <<= rPropNameSupplier.GetName( 
PROP_TOKEN_HYPERLINK_START );
+pNewLevel[0] = aHyperlink;
+aHyperlink[0].Value <<= rPropNameSupplier.GetName( 
PROP_TOKEN_HYPERLINK_END );
+pNewLevel[aNewLevel.getLength() -1] = aHyperlink;
+}
+if( bChapterNoSeparator )
+{
+beans::PropertyValues aChapterNo(2);
+aChapterNo[0].Name = rPropNameSupplier.GetName( PROP_TOKEN_TYPE );
+aChapterNo[0].Value <<= rPropNameSupplier.GetName( 
PROP_TOKEN_CHAPTER_INFO );
+aChapterNo[1].Name = rPropNameSupplier.GetName( PROP_CHAPTER_FORMAT );
+//todo: is ChapterFormat::Number correct?
+aChapterNo[1].Value <<= (sal_Int16)text::ChapterFormat::NUMBER;
+pNewLevel[aNewLevel.getLength() - (bHyperlinks ? 4 : 2) ] = aChapterNo;
+
+beans::PropertyValues aChapterSeparator(2);
+aChapterSeparator[0].Name = rPropNameSupplier.GetName( PROP_TOKEN_TYPE 
);
+aChapterSeparator[0].Value <<= rPropNameSupplier.GetName( 
PROP_TOKEN_TEXT );
+aChapterSeparator[1].Name = rPropNameSupplier.GetName( PROP_TEXT );
+aChapterSeparator[1].Value <<= sChapterNoSeparator;
+pNewLevel[aNewLevel.getLength() - (bHyperlinks ? 3 : 1)] = 
aChapterSeparator;
+}
+//copy the 'old' entries except the last (page no)
+for( sal_Int32 nToken = 0; nToken < aLevel.getLength() - 1; ++nToken)
+{
+pNewLevel[nToken + 1] = aLevel[nToken];
+}
+//copy page no entry (last or last but one depending on bHyperlinks
+sal_Int32 nPageNo = aNewLevel.getLength() - (bHyperlinks ? 2 : 3);
+pNewLevel[nPageNo] = aLevel[aLevel.getLength() - 1];
+
+return aNewLevel;
+}
+
 void DomainMapper_Impl::handleToc
 (FieldContextPtr pContext,
 PropertyNameSupplier& rPropNameSuppli

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

2013-05-23 Thread Luboš Luňák
 sw/source/filter/ww8/docxattributeoutput.cxx   |  148 -
 writerfilter/source/dmapper/GraphicHelpers.cxx |   23 +++
 writerfilter/source/dmapper/GraphicHelpers.hxx |   11 +
 writerfilter/source/dmapper/GraphicImport.cxx  |   12 +-
 4 files changed, 133 insertions(+), 61 deletions(-)

New commits:
commit 9413f2124dff0c38fd52d318d5ac2f392a7d36e0
Author: Luboš Luňák 
Date:   Thu May 23 16:32:44 2013 +0200

improve exporting of picture alignment to docx

Basing this on anchoring is wrong, as SwFmt{Hori/Vert}Orient seems to 
provide
everything. Also try avoid hardcoding position if possible.

Change-Id: I880bc5c3eeabdde9e52c0c16d1033e44e203a8a3

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 549ed52..a062499 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -2143,65 +2143,113 @@ void DocxAttributeOutput::FlyFrameGraphic( const 
SwGrfNode* pGrfNode, const Size
 m_pSerializer->singleElementNS( XML_wp, XML_simplePos, XML_x, "0", 
XML_y, "0", FSEND ); // required, unused
 const char* relativeFromH;
 const char* relativeFromV;
-switch( pFrmFmt->GetAnchor().GetAnchorId())
+const char* alignH = NULL;
+const char* alignV = NULL;
+switch (pFrmFmt->GetVertOrient().GetRelationOrient() )
 {
-case FLY_AT_PAGE:
-relativeFromV = relativeFromH = "page";
+case text::RelOrientation::PAGE_PRINT_AREA:
+relativeFromV = "margin";
 break;
-case FLY_AT_PARA:
-relativeFromH = "column";
+case text::RelOrientation::PAGE_FRAME:
+relativeFromV = "page";
+break;
+case text::RelOrientation::FRAME:
 relativeFromV = "paragraph";
 break;
-case FLY_AT_CHAR:
+case text::RelOrientation::TEXT_LINE:
 default:
-// We apply the same conversion that we do in import
-// (see writerfilter/source/dmapper/GraphicHelper.cxx)
-switch (pFrmFmt->GetVertOrient().GetRelationOrient() )
-{
-case text::RelOrientation::PAGE_PRINT_AREA:
-relativeFromV = "margin";
-break;
-case text::RelOrientation::PAGE_FRAME:
-relativeFromV = "page";
-break;
-case text::RelOrientation::FRAME:
-relativeFromV = "paragraph";
-break;
-case text::RelOrientation::TEXT_LINE:
-default:
-relativeFromV = "line";
-}
-switch (pFrmFmt->GetHoriOrient().GetRelationOrient() )
-{
-case text::RelOrientation::PAGE_PRINT_AREA:
-relativeFromH = "margin";
-break;
-case text::RelOrientation::PAGE_FRAME:
-relativeFromH = "page";
-break;
-case text::RelOrientation::CHAR:
-relativeFromH = "character";
-break;
-case text::RelOrientation::FRAME:
-default:
-relativeFromH = "column";
-}
+relativeFromV = "line";
+break;
+}
+switch (pFrmFmt->GetVertOrient().GetVertOrient() )
+{
+case text::VertOrientation::TOP:
+case text::VertOrientation::CHAR_TOP:
+case text::VertOrientation::LINE_TOP:
+if( pFrmFmt->GetVertOrient().GetRelationOrient() == 
text::RelOrientation::TEXT_LINE)
+alignV = "bottom";
+else
+alignV = "top";
+break;
+case text::VertOrientation::BOTTOM:
+case text::VertOrientation::CHAR_BOTTOM:
+case text::VertOrientation::LINE_BOTTOM:
+if( pFrmFmt->GetVertOrient().GetRelationOrient() == 
text::RelOrientation::TEXT_LINE)
+alignV = "top";
+else
+alignV = "bottom";
+break;
+case text::VertOrientation::CENTER:
+case text::VertOrientation::CHAR_CENTER:
+case text::VertOrientation::LINE_CENTER:
+alignV = "center";
+break;
+default:
+break;
+}
+switch (pFrmFmt->GetHoriOrient().GetRelationOrient() )
+{
+case text::RelOrientation::PAGE_PRINT_AREA:
+relativeFromH = "margin";
+break;
+case text::RelOrientation::PAGE_FRAME:
+   

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

2013-04-12 Thread Miklos Vajna
 sw/source/filter/ww8/rtfattributeoutput.cxx |  124 
 sw/source/filter/ww8/rtfattributeoutput.hxx |5 +
 writerfilter/source/rtftok/rtfsdrimport.cxx |   22 
 3 files changed, 102 insertions(+), 49 deletions(-)

New commits:
commit d53dd70b15f0e3f7c8a05a93f8fcd70e1147c1f7
Author: Miklos Vajna 
Date:   Fri Apr 12 15:09:12 2013 +0200

sw: rework RTF export of text frames

Export these as new-style frames. Not counting future possibilities,
this commit finally fixes the following problems:

- borders: spacing to contents wasn't exported at all
- wrap: top/bottom and left/right spacing exported even in case they do
  not equal

Change-Id: I058e00e677e20bc9501b8de320f941f256e8b6f1

diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx 
b/sw/source/filter/ww8/rtfattributeoutput.cxx
index 5d95a56..bc13224 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -1497,18 +1497,35 @@ void RtfAttributeOutput::OutputFlyFrame_Impl( const 
sw::Frame& rFrame, const Poi
 switch ( rFrame.GetWriterType() )
 {
 case sw::Frame::eTxtBox:
+{
 OSL_ENSURE(m_aRunText.getLength() == 0, "m_aRunText is not empty");
 m_rExport.mpParentFrame = &rFrame;
+
+m_rExport.Strm() << "{" OOO_STRING_SVTOOLS_RTF_SHP;
+m_rExport.Strm() << "{" OOO_STRING_SVTOOLS_RTF_IGNORE 
OOO_STRING_SVTOOLS_RTF_SHPINST;
+
+// Shape properties.
+m_aFlyProperties.push_back(std::make_pair("shapeType", OString::number(ESCHER_ShpInst_TextBox)));
+
 m_rExport.bOutFlyFrmAttrs = m_rExport.bRTFFlySyntax = true;
 m_rExport.OutputFormat( rFrame.GetFrmFmt(), false, false, true );
 m_rExport.Strm() << m_aRunText.makeStringAndClear().getStr();
 m_rExport.Strm() << m_aStyles.makeStringAndClear().getStr();
 m_rExport.bOutFlyFrmAttrs = m_rExport.bRTFFlySyntax = false;
-m_rExport.Strm() << "{" OOO_STRING_SVTOOLS_RTF_IGNORE;
-m_rExport.OutputFormat( rFrame.GetFrmFmt(), false, false, true );
-m_rExport.Strm() << m_aRunText.makeStringAndClear().getStr();
-m_rExport.Strm() << m_aStyles.makeStringAndClear().getStr();
-m_rExport.Strm() << '}';
+m_pFmtFrmSize = 0;
+
+for (size_t i = 0; i < m_aFlyProperties.size(); ++i)
+{
+m_rExport.Strm() << "{" OOO_STRING_SVTOOLS_RTF_SP "{";
+m_rExport.Strm() << OOO_STRING_SVTOOLS_RTF_SN " ";
+m_rExport.Strm() << m_aFlyProperties[i].first.getStr();
+m_rExport.Strm() << "}{" OOO_STRING_SVTOOLS_RTF_SV " ";
+m_rExport.Strm() << m_aFlyProperties[i].second.getStr();
+m_rExport.Strm() << "}}";
+}
+m_aFlyProperties.clear();
+
+m_rExport.Strm() << "{" OOO_STRING_SVTOOLS_RTF_SHPTXT;
 
 {
 /*
@@ -1542,7 +1559,13 @@ void RtfAttributeOutput::OutputFlyFrame_Impl( const 
sw::Frame& rFrame, const Poi
 }
 
 m_rExport.mpParentFrame = NULL;
+
+m_rExport.Strm() << '}'; // shptxt
+m_rExport.Strm() << '}'; // shpinst
+m_rExport.Strm() << '}'; // shp
+
 m_rExport.Strm() << RtfExport::sNewLine;
+}
 break;
 case sw::Frame::eGraphic:
 if (!rFrame.IsInline())
@@ -2629,20 +2652,7 @@ void RtfAttributeOutput::FormatFrameSize( const 
SwFmtFrmSize& rSize )
 
 if ( m_rExport.bOutFlyFrmAttrs && m_rExport.bRTFFlySyntax )
 {
-if( rSize.GetWidth() )
-{
-m_aRunText->append(OOO_STRING_SVTOOLS_RTF_ABSW);
-m_aRunText->append((sal_Int32)rSize.GetWidth());
-}
-
-if( rSize.GetHeight() )
-{
-long nH = rSize.GetHeight();
-if( ATT_FIX_SIZE == rSize.GetHeightSizeType() )
-nH = -nH;
-m_aRunText->append(OOO_STRING_SVTOOLS_RTF_ABSH);
-m_aRunText->append((sal_Int32)nH);
-}
+m_pFmtFrmSize = &rSize;
 }
 else if (m_rExport.bOutPageDescs)
 {
@@ -2696,10 +2706,11 @@ void RtfAttributeOutput::FormatLRSpace( const 
SvxLRSpaceItem& rLRSpace )
 m_aStyles.append( (sal_Int32) rLRSpace.GetTxtFirstLineOfst() );
 }
 }
-else if (rLRSpace.GetLeft() == rLRSpace.GetRight() && 
m_rExport.bRTFFlySyntax)
+else if (m_rExport.bRTFFlySyntax)
 {
-m_rExport.Strm() << OOO_STRING_SVTOOLS_RTF_DFRMTXTX;
-m_rExport.OutLong( rLRSpace.GetLeft() );
+// Wrap: top and bottom spacing, convert from twips to EMUs.
+m_aFlyProperties.push_back(std::make_pair("dxWrapDistLeft", OString::number(rLRSpace.GetLeft() * 635)));
+m_aFlyProperties.push_back(std::make_pair("dxWrapDistRight", OString::number(rLRSpace.GetRight() * 635)));
 }
 }
 
@@ -2752,10 +2763,11