[Libreoffice-commits] core.git: Branch 'private/jmux/libreoffice-4-1-6+backports' - 6 commits - desktop/source download.lst sw/source writerfilter/source
Andras Timar
andras.timar at collabora.com
Mon Feb 16 12:57:45 PST 2015
desktop/source/migration/migration.cxx | 33 ------
desktop/source/migration/migration_impl.hxx | 18 ++-
download.lst | 2
sw/source/filter/ww8/docxattributeoutput.cxx | 16 ++-
sw/source/filter/ww8/ww8atr.cxx | 2
writerfilter/source/dmapper/DomainMapper.cxx | 4
writerfilter/source/dmapper/DomainMapper_Impl.cxx | 89 ++++++++++++++++--
writerfilter/source/dmapper/DomainMapper_Impl.hxx | 7 +
writerfilter/source/ooxml/OOXMLFastContextHandler.cxx | 9 +
writerfilter/source/ooxml/OOXMLFastContextHandler.hxx | 1
writerfilter/source/ooxml/OOXMLPropertySetImpl.cxx | 22 ++++
writerfilter/source/ooxml/OOXMLPropertySetImpl.hxx | 14 ++
writerfilter/source/ooxml/factoryimpl_ns.xsl | 10 ++
writerfilter/source/ooxml/model.xml | 5 -
14 files changed, 177 insertions(+), 55 deletions(-)
New commits:
commit b30fb9593b5efdc0e4ae4889ed34bc3d5d42bf6d
Author: Andras Timar <andras.timar at collabora.com>
Date: Tue Jun 10 22:30:07 2014 +0200
openssl-0.9.8za -- fixes multiple CVEs
Change-Id: Id4a2d2af49518317511da194a582d3bb18c346f7
(cherry picked from commit 2f926a476b73a7c06a4579f422a4458ac3e789a1)
diff --git a/download.lst b/download.lst
index 789221f..b42968b 100644
--- a/download.lst
+++ b/download.lst
@@ -72,7 +72,7 @@ export NEON_TARBALL := ff369e69ef0f0143beb5626164e87ae2-neon-0.29.5.tar.gz
export NSS_TARBALL := a0a861f539f0e7a91d05e6b9457e4db1-nss-3.13.5-with-nspr-4.9.1.tar.gz
export ODFGEN_TARBALL := 8473296c671b6e3dd8197f4145e0854b-libodfgen-0.0.2.tar.bz2
export OPENLDAP_TARBALL := 804c6cb5698db30b75ad0ff1c25baefd-openldap-2.4.31.tgz
-export OPENSSL_TARBALL := 51a40a81b3b7abe8a5c33670bd3da0ce-openssl-0.9.8v.tar.gz
+export OPENSSL_TARBALL := 2f989915f8fea49aa1bc37aa58500cce-openssl-0.9.8za.tar.gz
export ORCUS_TARBALL := ea2acaf140ae40a87a952caa75184f4d-liborcus-0.5.1.tar.bz2
export PIXMAN_TARBALL := c63f411b3ad147db2bcce1bf262a0e02-pixman-0.24.4.tar.bz2
export PNG_TARBALL := 9e5d864bce8f06751bbd99962ecf4aad-libpng-1.5.10.tar.gz
commit aa7d1d64385aec1a1ecad3bff7158dec9fdf6abd
Author: Eilidh McAdam <eilidh.mcadam at itomig.de>
Date: Wed Dec 10 03:50:10 2014 +0000
Support for docx import of fixed date and time fields.
If a field is fixed, mark it as such and parse value to seed it.
This is the other half of the docx filter improvement for fdo#59886.
Reviewed on:
https://gerrit.libreoffice.org/13431
(cherry picked from commit 8826934016d60d0a4a1e824e3f1cff814d915515)
Conflicts:
writerfilter/source/dmapper/DomainMapper_Impl.cxx
writerfilter/source/dmapper/DomainMapper_Impl.hxx
writerfilter/source/ooxml/OOXMLPropertySetImpl.cxx
writerfilter/source/ooxml/OOXMLPropertySetImpl.hxx
writerfilter/source/ooxml/factoryimpl_ns.py
writerfilter/source/ooxml/model.xml
Change-Id: Id00c454921cd386589e04b9572f4040898625a6f
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index a9474a6..35df878 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -3596,6 +3596,10 @@ void DomainMapper::lcl_text(const sal_uInt8 * data_, size_t len)
switch(*data_)
{
case 0x02: return; //footnote character
+ case 0x08: // Lock field if in field context
+ if (m_pImpl->IsOpenField())
+ m_pImpl->SetFieldLocked();
+ return;
case 0x0c: //page break
m_pImpl->deferBreak(PAGE_BREAK);
return;
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 5528a9f..a051a9b 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -52,6 +52,8 @@
#include <com/sun/star/text/XTextFieldsSupplier.hpp>
#include <com/sun/star/style/DropCapFormat.hpp>
#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
+#include <com/sun/star/util/XNumberFormatter.hpp>
+#include <com/sun/star/util/NumberFormatter.hpp>
#include <com/sun/star/document/XViewDataSupplier.hpp>
#include <com/sun/star/container/XIndexContainer.hpp>
#include <com/sun/star/awt/XControlModel.hpp>
@@ -166,6 +168,7 @@ DomainMapper_Impl::DomainMapper_Impl(
m_xTextFactory( xModel, uno::UNO_QUERY ),
m_xComponentContext( xContext ),
m_bSetUserFieldContent( false ),
+ m_bSetDateValue( false ),
m_bIsFirstSection( true ),
m_bIsColumnBreakDeferred( false ),
m_bIsPageBreakDeferred( false ),
@@ -2144,10 +2147,17 @@ bool DomainMapper_Impl::IsOpenField() const
return !m_aFieldStack.empty();
}
+// Mark top field context as containing a fixed field
+void DomainMapper_Impl::SetFieldLocked()
+{
+ if (IsOpenField())
+ m_aFieldStack.top()->SetFieldLocked();
+}
-FieldContext::FieldContext(uno::Reference< text::XTextRange > xStart) :
- m_bFieldCommandCompleted( false )
- ,m_xStartRange( xStart )
+FieldContext::FieldContext(uno::Reference< text::XTextRange > xStart)
+ : m_bFieldCommandCompleted( false )
+ , m_xStartRange( xStart )
+ , m_bFieldLocked( false )
{
}
@@ -2824,6 +2834,7 @@ void DomainMapper_Impl::CloseFieldCommand()
if( pContext.get() )
{
m_bSetUserFieldContent = false;
+ m_bSetDateValue = false;
FieldConversionMap_t aFieldConversionMap = lcl_GetFieldConversion();
bool bCreateEnhancedField = false;
@@ -2921,10 +2932,19 @@ void DomainMapper_Impl::CloseFieldCommand()
case FIELD_DATE:
if (xFieldProperties.is())
{
- //not fixed,
- xFieldProperties->setPropertyValue(
- rPropNameSupplier.GetName(PROP_IS_FIXED),
- uno::makeAny( false ));
+ // Get field fixed property from the context handler
+ if (pContext->IsFieldLocked())
+ {
+ xFieldProperties->setPropertyValue(
+ rPropNameSupplier.GetName(PROP_IS_FIXED),
+ uno::makeAny( true ));
+ m_bSetDateValue = true;
+ }
+ else
+ xFieldProperties->setPropertyValue(
+ rPropNameSupplier.GetName(PROP_IS_FIXED),
+ uno::makeAny( false ));
+
xFieldProperties->setPropertyValue(
rPropNameSupplier.GetName(PROP_IS_DATE),
uno::makeAny( true ));
@@ -3292,7 +3312,16 @@ void DomainMapper_Impl::CloseFieldCommand()
case FIELD_SYMBOL : break;
case FIELD_TEMPLATE: break;
case FIELD_TIME :
+ {
+ if (pContext->IsFieldLocked())
+ {
+ xFieldProperties->setPropertyValue(
+ rPropNameSupplier.GetName(PROP_IS_FIXED),
+ uno::makeAny( true ));
+ m_bSetDateValue = true;
+ }
SetNumberFormat( pContext->GetCommand(), xFieldProperties );
+ }
break;
case FIELD_TITLE :
{
@@ -3378,6 +3407,28 @@ bool DomainMapper_Impl::IsFieldResultAsString()
return bRet;
}
+// Calculates css::DateTime based on ddddd.sssss since 1900-1-0
+::com::sun::star::util::DateTime lcl_dateTimeFromSerial(const double& dSerial)
+{
+ const sal_uInt32 secondsPerDay = 86400;
+ const sal_uInt16 secondsPerHour = 3600;
+
+ DateTime d(Date(30, 12, 1899));
+ d += (long)dSerial;
+
+ double frac = dSerial - (long)dSerial;
+ sal_uInt32 seconds = frac * secondsPerDay;
+
+ ::com::sun::star::util::DateTime date;
+ date.Year = d.GetYear();
+ date.Month = d.GetMonth();
+ date.Day = d.GetDay();
+ date.Hours = seconds / secondsPerHour;
+ date.Minutes = (seconds % secondsPerHour) / 60;
+ date.Seconds = seconds % 60;
+
+ return date;
+}
void DomainMapper_Impl::SetFieldResult( OUString& rResult )
{
@@ -3410,6 +3461,21 @@ void DomainMapper_Impl::SetFieldResult( OUString& rResult )
rPropNameSupplier.GetName(PROP_CONTENT),
uno::makeAny( rResult ));
}
+ else if ( m_bSetDateValue )
+ {
+ uno::Reference< util::XNumberFormatsSupplier > xNumberSupplier( m_xTextDocument, uno::UNO_QUERY_THROW );
+
+ uno::Reference< util::XNumberFormatter > xFormatter( ::com::sun::star::util::NumberFormatter::create( m_xComponentContext ), uno::UNO_QUERY_THROW );
+ xFormatter->attachNumberFormatsSupplier( xNumberSupplier );
+ sal_Int32 nKey = 0;
+
+ uno::Reference< beans::XPropertySet > xFieldProperties( xTextField, uno::UNO_QUERY_THROW);
+
+ xFieldProperties->getPropertyValue( "NumberFormat" ) >>= nKey;
+ xFieldProperties->setPropertyValue(
+ "DateTimeValue",
+ uno::makeAny( lcl_dateTimeFromSerial( xFormatter->convertStringToNumber( nKey, rResult ) ) ) );
+ }
else
{
uno::Reference< beans::XPropertySet > xFieldProperties( xTextField, uno::UNO_QUERY_THROW);
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
index 8bc422f..5048c2b 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -124,6 +124,7 @@ class FieldContext
::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > m_xStartRange;
OUString m_sCommand;
+ bool m_bFieldLocked;
::com::sun::star::uno::Reference< ::com::sun::star::text::XTextField > m_xTextField;
::com::sun::star::uno::Reference< ::com::sun::star::text::XFormField > m_xFormField;
@@ -145,6 +146,9 @@ public:
void SetCommandCompleted() { m_bFieldCommandCompleted = true; }
bool IsCommandCompleted() const { return m_bFieldCommandCompleted; }
+ void SetFieldLocked() { m_bFieldLocked = true; }
+ bool IsFieldLocked() { return m_bFieldLocked; }
+
::com::sun::star::uno::Reference< ::com::sun::star::text::XTextField > GetTextField() const { return m_xTextField;}
void SetTextField(::com::sun::star::uno::Reference< ::com::sun::star::text::XTextField > xTextField) { m_xTextField = xTextField;}
::com::sun::star::uno::Reference< ::com::sun::star::text::XFormField > GetFormField() const { return m_xFormField;}
@@ -322,6 +326,7 @@ private:
FieldStack m_aFieldStack;
bool m_bSetUserFieldContent;
+ bool m_bSetDateValue;
bool m_bIsFirstSection;
bool m_bIsColumnBreakDeferred;
bool m_bIsPageBreakDeferred;
@@ -560,6 +565,8 @@ public:
//the current field context waits for the completion of the command
bool IsOpenFieldCommand() const;
bool IsOpenField() const;
+ //mark field in current context as locked (fixed)
+ void SetFieldLocked();
//collect the pieces of the command
void AppendFieldCommand(OUString& rPartOfCommand);
void handleFieldAsk
diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
index 4f2b130..1c8bca0 100644
--- a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
+++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
@@ -51,6 +51,7 @@ static const sal_uInt8 cFtnEdnCont = 0x4;
static const sal_uInt8 cFieldStart = 0x13;
static const sal_uInt8 cFieldSep = 0x14;
static const sal_uInt8 cFieldEnd = 0x15;
+static const sal_uInt8 cFieldLock = 0x8;
namespace writerfilter {
namespace ooxml
@@ -752,6 +753,14 @@ void OOXMLFastContextHandler::endField()
endCharacterGroup();
}
+void OOXMLFastContextHandler::lockField()
+{
+ startCharacterGroup();
+ if (isForwardEvents())
+ mpStream->text(&cFieldLock, 1);
+ endCharacterGroup();
+}
+
void OOXMLFastContextHandler::ftnednref()
{
#ifdef DEBUG_CONTEXT_HANDLER
diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx
index 5a72be2..6f0d0fa 100644
--- a/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx
+++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx
@@ -190,6 +190,7 @@ public:
void startField();
void fieldSeparator();
void endField();
+ void lockField();
void ftnednref();
void ftnedncont();
void ftnednsep();
diff --git a/writerfilter/source/ooxml/OOXMLPropertySetImpl.cxx b/writerfilter/source/ooxml/OOXMLPropertySetImpl.cxx
index b8f5aa3..0bd4da1 100644
--- a/writerfilter/source/ooxml/OOXMLPropertySetImpl.cxx
+++ b/writerfilter/source/ooxml/OOXMLPropertySetImpl.cxx
@@ -801,6 +801,10 @@ const OUString & OOXMLPropertySetEntryToString::getString() const
return mStr;
}
+/*
+ class: OOXMLPropertySetEntryToInteger
+*/
+
OOXMLPropertySetEntryToInteger::OOXMLPropertySetEntryToInteger(Id nId)
: mnId(nId), mnValue(0)
{
@@ -825,6 +829,24 @@ int OOXMLPropertySetEntryToInteger::getValue() const
return mnValue;
}
+/*
+ class: OOXMLPropertySetEntryToBool
+*/
+
+OOXMLPropertySetEntryToBool::OOXMLPropertySetEntryToBool(Id nId)
+ : mnId(nId), mValue(false)
+{}
+
+OOXMLPropertySetEntryToBool::~OOXMLPropertySetEntryToBool() {}
+
+void OOXMLPropertySetEntryToBool::sprm(Sprm & /*rSprm*/) {}
+
+void OOXMLPropertySetEntryToBool::attribute(Id nId, Value & rValue)
+{
+ if (nId == mnId)
+ mValue = (rValue.getInt() != 0);
+}
+
}}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/ooxml/OOXMLPropertySetImpl.hxx b/writerfilter/source/ooxml/OOXMLPropertySetImpl.hxx
index 8ea8d85..c493e51 100644
--- a/writerfilter/source/ooxml/OOXMLPropertySetImpl.hxx
+++ b/writerfilter/source/ooxml/OOXMLPropertySetImpl.hxx
@@ -287,6 +287,20 @@ public:
int getValue() const;
};
+class OOXMLPropertySetEntryToBool : public Properties
+{
+ Id mnId;
+ bool mValue;
+public:
+ OOXMLPropertySetEntryToBool(Id nId);
+ virtual ~OOXMLPropertySetEntryToBool();
+
+ virtual void sprm(Sprm & rSprm) SAL_OVERRIDE;
+ virtual void attribute(Id nId, Value & rValue) SAL_OVERRIDE;
+
+ bool getValue() const { return mValue; }
+};
+
Sprm::Kind SprmKind(sal_uInt32 nSprmCode);
} // namespace ooxml
diff --git a/writerfilter/source/ooxml/factoryimpl_ns.xsl b/writerfilter/source/ooxml/factoryimpl_ns.xsl
index bd913d6..8bedd5e 100644
--- a/writerfilter/source/ooxml/factoryimpl_ns.xsl
+++ b/writerfilter/source/ooxml/factoryimpl_ns.xsl
@@ -494,6 +494,16 @@ CreateElementMapPointer </xsl:text>
<xsl:text>
pHandler->endField();</xsl:text>
</xsl:when>
+ <xsl:when test="@action='fieldlock'">
+ <xsl:text>
+ {
+ OOXMLPropertySetEntryToBool aHandler(NS_ooxml::LN_CT_FldChar_fldLock);
+ if (OOXMLFastContextHandlerStream* pStream = dynamic_cast<OOXMLFastContextHandlerStream*>(pHandler))
+ pStream->getPropertySetAttrs()->resolve(aHandler);
+ if (aHandler.getValue())
+ pHandler->lockField();
+ }</xsl:text>
+ </xsl:when>
<xsl:when test="@action='printproperty'">
<xsl:text>
dynamic_cast<OOXMLFastContextHandlerStream*>(pHandler)->sendProperty(</xsl:text>
diff --git a/writerfilter/source/ooxml/model.xml b/writerfilter/source/ooxml/model.xml
index a42ab94..18024d3 100644
--- a/writerfilter/source/ooxml/model.xml
+++ b/writerfilter/source/ooxml/model.xml
@@ -15162,7 +15162,7 @@
<xs:documentation>Field Codes</xs:documentation>
</attribute>
<attribute name="fldLock">
- <text/>
+ <ref name="ST_OnOff"/>
<xs:documentation>Field Should Not Be Recalculated</xs:documentation>
</attribute>
<attribute name="dirty">
@@ -15266,7 +15266,7 @@
<xs:documentation>Field Character Type</xs:documentation>
</attribute>
<attribute name="fldLock">
- <text/>
+ <ref name="ST_OnOff"/>
<xs:documentation>Field Should Not Be Recalculated</xs:documentation>
</attribute>
<attribute name="dirty">
@@ -22268,6 +22268,7 @@
<action name="start" action="fieldend">
<cond tokenid="ooxml:CT_FldChar_fldCharType" value="ooxml:Value_ST_FldCharType_end"/>
</action>
+ <action name="start" action="fieldlock"/>
</resource>
<resource xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" name="CT_Hyperlink" resource="Stream" tag="link">
<attribute name="tgtFrame" tokenid="ooxml:CT_Hyperlink_tgtFrame"/>
commit 0e964062c92e29d5dd17c4146057237d13893d9d
Author: Eilidh McAdam <eilidh.mcadam at itomig.de>
Date: Tue Dec 9 19:55:18 2014 +0000
Small fix for docx date field format import.
The standard allows for arbitrary amounts of whitespace between
tokens. MSO outputs with a space between \@ and ", LO doesn't.
To account for this, any whitespace between these tokens is
stripped and parsing assumes a command looks like:
DATE \@"some format".
Change-Id: I2620780da3ee873af6f35e236c7c34a073aebe73
Reviewed-on: https://gerrit.libreoffice.org/13430
Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos at collabora.co.uk>
(cherry picked from commit 3726737273e488ffab02f4a2dded5640521729cb)
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 21416e2..5528a9f 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1932,8 +1932,13 @@ style::NumberingType::
OUString lcl_ParseFormat( const OUString& rCommand )
{
- // The command looks like: " DATE \@ "dd MMMM yyyy"
- return msfilter::util::findQuotedText(rCommand, "\\@ \"", '\"');
+ // The command looks like: " DATE \@"dd MMMM yyyy"
+ // Remove whitespace permitted by standard between \@ and "
+ sal_Int32 delimPos = rCommand.indexOf("\\@");
+ sal_Int32 wsChars = rCommand.indexOf('\"') - delimPos - 2;
+ OUString command = rCommand.replaceAt(delimPos+2, wsChars, "");
+
+ return msfilter::util::findQuotedText(command, "\\@\"", '\"');
}
/*-------------------------------------------------------------------------
extract a parameter (with or without quotes) between the command and the following backslash
commit a2eea659c3fd9d8641a2fed366f89423a3303757
Author: Eilidh McAdam <eilidh.mcadam at itomig.de>
Date: Tue Dec 9 19:53:56 2014 +0000
fdo#59886 export fixed date and time fields to docx.
Fixed date and time fields are supported in OOXML by adding the
attribute fldLock="true" to the fldChar element. This applies only
to the first instance of fldChar in a field (i.e. when fldCharType
is "begin").
Reviewed-on: https://gerrit.libreoffice.org/13429
Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos at collabora.co.uk>
(cherry picked from commit a072b3533f44730565f42b45cfd9f77f44f506a9)
Conflicts:
sw/source/filter/ww8/ww8atr.cxx
Change-Id: Ibb84503b942ca20b53fe476e5006d64b2f3112e5
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 4299010..9c4c278 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -812,9 +812,19 @@ void DocxAttributeOutput::StartField_Impl( FieldInfos& rInfos, bool bWriteRun )
else
{
// Write the field start
- m_pSerializer->startElementNS( XML_w, XML_fldChar,
- FSNS( XML_w, XML_fldCharType ), "begin",
- FSEND );
+ if ( rInfos.pField && rInfos.pField->GetSubType() & FIXEDFLD )
+ {
+ m_pSerializer->startElementNS( XML_w, XML_fldChar,
+ FSNS( XML_w, XML_fldCharType ), "begin",
+ FSNS( XML_w, XML_fldLock ), "true",
+ FSEND );
+ }
+ else
+ {
+ m_pSerializer->startElementNS( XML_w, XML_fldChar,
+ FSNS( XML_w, XML_fldCharType ), "begin",
+ FSEND );
+ }
if ( rInfos.pFieldmark )
WriteFFData( rInfos );
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index fa1a3be..ebf6803 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -2704,7 +2704,7 @@ void AttributeOutputBase::TextField( const SwFmtFld& rField )
}
break;
case RES_DATETIMEFLD:
- if (FIXEDFLD & nSubType || !GetExport().GetNumberFmt(*pFld, sStr))
+ if (!GetExport().GetNumberFmt(*pFld, sStr))
bWriteExpand = true;
else
{
commit 936ab1659bf9535c05870b94fdae302cfa4fb202
Author: Juergen Funk <juergen.funk_ml at cib.de>
Date: Wed Dec 17 16:23:47 2014 +0100
fdo#88158 Display two "Open..." entries in the file-menu
Migration from Version 3 to 4 make this fail
Entry .uno:Open and .uno:OpenFromWriter are the same,
skip the entry .uno:OpenFrom
Change the operator, and a lot of comments
change the match in startWith for better reading
change test when old-cmd ".uno:Open"
change to the stephan solution
Signed-off-by: Stephan Bergmann <sbergman at redhat.com>
(cherry picked from commit b8918b363ea7242c304f438a64baf55d19eecddf)
Conflicts:
desktop/source/migration/migration_impl.hxx
Change-Id: I0861c1e7d30b861acc753e3258707f3b6a338768
diff --git a/desktop/source/migration/migration_impl.hxx b/desktop/source/migration/migration_impl.hxx
index 37ee8f0..e200cd1 100644
--- a/desktop/source/migration/migration_impl.hxx
+++ b/desktop/source/migration/migration_impl.hxx
@@ -114,12 +114,19 @@ struct MigrationItem
return *this;
}
+ sal_Bool areBothOpenFrom(OUString const & cmd1, OUString const & cmd2)
+ {
+ return cmd1 == ".uno:Open" && cmd2.startsWith(".uno:OpenFrom");
+ }
+
sal_Bool operator==(const MigrationItem& aMigrationItem)
{
- return ( aMigrationItem.m_sParentNodeName == m_sParentNodeName &&
- aMigrationItem.m_sPrevSibling == m_sPrevSibling &&
- aMigrationItem.m_sCommandURL == m_sCommandURL &&
- aMigrationItem.m_xPopupMenu.is() == m_xPopupMenu.is() );
+ return ((aMigrationItem.m_sCommandURL == m_sCommandURL
+ || (areBothOpenFrom(aMigrationItem.m_sCommandURL, m_sCommandURL)
+ || areBothOpenFrom(m_sCommandURL, aMigrationItem.m_sCommandURL)))
+ && aMigrationItem.m_sParentNodeName == m_sParentNodeName
+ && aMigrationItem.m_sPrevSibling == m_sPrevSibling
+ && aMigrationItem.m_xPopupMenu.is() == m_xPopupMenu.is() );
}
};
commit bdf60fe6c13c845d2e44524279585adcfe38c815
Author: Juergen Funk <juergen.funk_ml at cib.de>
Date: Tue Jan 20 13:32:11 2015 +0100
Remove unused code
- a inline function not use
- a variable will be set but not use
Change-Id: I67674a6cd05ddb058d11d46188d5c9d039ed40fb
Signed-off-by: Stephan Bergmann <sbergman at redhat.com>
(cherry picked from commit 282baa9012a4f43931be12fd429d15c081e7bf28)
diff --git a/desktop/source/migration/migration.cxx b/desktop/source/migration/migration.cxx
index 2b36113..73945a8 100644
--- a/desktop/source/migration/migration.cxx
+++ b/desktop/source/migration/migration.cxx
@@ -302,7 +302,6 @@ sal_Bool MigrationImpl::doMigration()
}
m_aOldVersionItemsHashMap.clear();
- m_aNewVersionItemsHashMap.clear();
}
// execute the migration items from Setup.xcu
@@ -1150,36 +1149,6 @@ void MigrationImpl::compareOldAndNewConfig(const OUString& sParent,
sSibling = it->m_sCommandURL;
}
-
- uno::Reference< container::XIndexContainer > xPopup;
- for (it = vNewItems.begin(); it!=vNewItems.end(); ++it)
- {
- ::std::vector< MigrationItem >::iterator pFound = ::std::find(vOldItems.begin(), vOldItems.end(), *it);
- if (pFound != vOldItems.end() && it->m_xPopupMenu.is())
- {
- OUString sName;
- if (!sParent.isEmpty())
- sName = sParent + MENU_SEPARATOR + it->m_sCommandURL;
- else
- sName = it->m_sCommandURL;
- compareOldAndNewConfig(sName, pFound->m_xPopupMenu, it->m_xPopupMenu, sResourceURL);
- }
- else if (::std::find(vOldItems.begin(), vOldItems.end(), *it) == vOldItems.end())
- {
- MigrationItem aMigrationItem(sParent, sSibling, it->m_sCommandURL, it->m_xPopupMenu);
- if (m_aNewVersionItemsHashMap.find(sResourceURL)==m_aNewVersionItemsHashMap.end())
- {
- ::std::vector< MigrationItem > vMigrationItems;
- m_aNewVersionItemsHashMap.insert(MigrationHashMap::value_type(sResourceURL, vMigrationItems));
- m_aNewVersionItemsHashMap[sResourceURL].push_back(aMigrationItem);
- }
- else
- {
- if (::std::find(m_aNewVersionItemsHashMap[sResourceURL].begin(), m_aNewVersionItemsHashMap[sResourceURL].end(), aMigrationItem)==m_aNewVersionItemsHashMap[sResourceURL].end())
- m_aNewVersionItemsHashMap[sResourceURL].push_back(aMigrationItem);
- }
- }
- }
}
void MigrationImpl::mergeOldToNewVersion(const uno::Reference< ui::XUIConfigurationManager >& xCfgManager,
@@ -1246,7 +1215,7 @@ void MigrationImpl::mergeOldToNewVersion(const uno::Reference< ui::XUIConfigurat
if (it->m_sPrevSibling.isEmpty())
xTemp->insertByIndex(0, uno::makeAny(aPropSeq));
- else if (!it->m_sPrevSibling.isEmpty())
+ else
{
sal_Int32 nCount = xTemp->getCount();
sal_Int32 i = 0;
diff --git a/desktop/source/migration/migration_impl.hxx b/desktop/source/migration/migration_impl.hxx
index a92de85..37ee8f0 100644
--- a/desktop/source/migration/migration_impl.hxx
+++ b/desktop/source/migration/migration_impl.hxx
@@ -121,8 +121,6 @@ struct MigrationItem
aMigrationItem.m_sCommandURL == m_sCommandURL &&
aMigrationItem.m_xPopupMenu.is() == m_xPopupMenu.is() );
}
-
- OUString GetPrevSibling() const { return m_sPrevSibling; }
};
typedef ::boost::unordered_map< OUString,
@@ -187,7 +185,6 @@ private:
install_info m_aInfo; // info about the version being migrated
strings_vr m_vrFileList; // final list of files to be copied
MigrationHashMap m_aOldVersionItemsHashMap;
- MigrationHashMap m_aNewVersionItemsHashMap;
OUString m_sModuleIdentifier;
// functions to control the migration process
More information about the Libreoffice-commits
mailing list