[Libreoffice-commits] core.git: 3 commits - include/connectivity officecfg/registry oox/source sd/inc sd/source
Stephan Bergmann (via logerrit)
logerrit at kemper.freedesktop.org
Sat Nov 30 14:01:34 UTC 2019
include/connectivity/sqlerror.hxx | 2
officecfg/registry/data/org/openoffice/Office/UI/Effects.xcu | 15 +++++
oox/source/drawingml/table/tableproperties.cxx | 9 +--
oox/source/drawingml/table/tablestyletextstylecontext.cxx | 8 +-
sd/inc/CustomAnimationEffect.hxx | 4 -
sd/source/core/CustomAnimationEffect.cxx | 32 ++++++++---
sd/source/core/EffectMigration.cxx | 2
sd/source/ui/animations/CustomAnimationPane.cxx | 11 +++
sd/source/ui/func/fuconbez.cxx | 17 +++++
9 files changed, 79 insertions(+), 21 deletions(-)
New commits:
commit d0e040698de6a88793f4ddd3b257a3dde0644b2f
Author: Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Sat Nov 30 14:01:46 2019 +0100
Commit: Stephan Bergmann <sbergman at redhat.com>
CommitDate: Sat Nov 30 15:00:29 2019 +0100
Assign bool directly to boost::optional<bool>
...instead of going via boost::optional<sal_Bool>. (In preparation of replacing
boost::optional with std::optional, which doesn't support implicit conversion
from std::optional<sal_Bool> to std::optional<bool>.)
Change-Id: I5dd74dd1c6346c99bd3e2a9b1156c9fce56db77c
Reviewed-on: https://gerrit.libreoffice.org/84116
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
diff --git a/oox/source/drawingml/table/tableproperties.cxx b/oox/source/drawingml/table/tableproperties.cxx
index b6f9a8a59cfc..b6d8bf378127 100644
--- a/oox/source/drawingml/table/tableproperties.cxx
+++ b/oox/source/drawingml/table/tableproperties.cxx
@@ -135,11 +135,10 @@ static void SetTableStyleProperties(const std::unique_ptr<TableStyle> &pTableSty
pTableStyle->getBand1V().getFillProperties() = pBand1HFillProperties;
//tet bold for 1st row/last row/column
- ::boost::optional< sal_Bool > textBoldStyle(true);
- pTableStyle->getFirstRow().getTextBoldStyle() = textBoldStyle;
- pTableStyle->getLastRow().getTextBoldStyle() = textBoldStyle;
- pTableStyle->getFirstCol().getTextBoldStyle() = textBoldStyle;
- pTableStyle->getLastCol().getTextBoldStyle() = textBoldStyle;
+ pTableStyle->getFirstRow().getTextBoldStyle() = true;
+ pTableStyle->getLastRow().getTextBoldStyle() = true;
+ pTableStyle->getFirstCol().getTextBoldStyle() = true;
+ pTableStyle->getLastCol().getTextBoldStyle() = true;
}
static std::unique_ptr<TableStyle> CreateTableStyle(const OUString& styleId)
diff --git a/oox/source/drawingml/table/tablestyletextstylecontext.cxx b/oox/source/drawingml/table/tablestyletextstylecontext.cxx
index 5b93f25d9ca3..7567ac4c8130 100644
--- a/oox/source/drawingml/table/tablestyletextstylecontext.cxx
+++ b/oox/source/drawingml/table/tablestyletextstylecontext.cxx
@@ -39,17 +39,17 @@ TableStyleTextStyleContext::TableStyleTextStyleContext( ContextHandler2Helper co
if( rAttribs.hasAttribute( XML_b ) ) {
sal_Int32 nB = rAttribs.getToken( XML_b, XML_def );
if ( nB == XML_on )
- mrTableStylePart.getTextBoldStyle() = ::boost::optional< sal_Bool >( true );
+ mrTableStylePart.getTextBoldStyle() = true;
else if ( nB == XML_off )
- mrTableStylePart.getTextBoldStyle() = ::boost::optional< sal_Bool >( false );
+ mrTableStylePart.getTextBoldStyle() = false;
}
if( rAttribs.hasAttribute( XML_i ) ) {
sal_Int32 nI = rAttribs.getToken( XML_i, XML_def );
if ( nI == XML_on )
- mrTableStylePart.getTextItalicStyle() = ::boost::optional< sal_Bool >( true );
+ mrTableStylePart.getTextItalicStyle() = true;
else if ( nI == XML_off )
- mrTableStylePart.getTextItalicStyle() = ::boost::optional< sal_Bool >( false );
+ mrTableStylePart.getTextItalicStyle() = false;
}
}
commit d86cfcaf709638d73fcb0de5067b902dab7a7f2f
Author: Mark Hung <marklh9 at gmail.com>
AuthorDate: Mon Nov 18 00:49:03 2019 +0800
Commit: Mark Hung <marklh9 at gmail.com>
CommitDate: Sat Nov 30 15:00:09 2019 +0100
tdf#94947 Set preset-id for user defined motion paths.
User defined motion paths ( curve, polygon, freeform line )
did not have preset-id. Set the preset-id so that the
preset type will be highlighted in the custom animation
pane after editing.
"libo-motionpath-curve", "libo-motionpath-polygon",
and "libo-motionpath-freeform-line" are used for the three
user defined motion paths.
This patch is related to tdf#94947, though it doesn't
make the original document display correctly by guessing
the missing preset-id, but it prevent empty preset-id
to be generated when creating those three motion path
animation.
Change-Id: I50c0133bea32e022b07e5d8c0a024810844f124d
Reviewed-on: https://gerrit.libreoffice.org/83079
Tested-by: Jenkins
Reviewed-by: Mark Hung <marklh9 at gmail.com>
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/Effects.xcu b/officecfg/registry/data/org/openoffice/Office/UI/Effects.xcu
index c635e0387517..1f385b61c540 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/Effects.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/Effects.xcu
@@ -700,6 +700,21 @@
<value xml:lang="en-US">Whip</value>
</prop>
</node>
+ <node oor:name="libo-motionpath-curve" oor:op="replace">
+ <prop oor:name="Label" oor:type="xs:string">
+ <value xml:lang="en-US">Curve</value>
+ </prop>
+ </node>
+ <node oor:name="libo-motionpath-polygon" oor:op="replace">
+ <prop oor:name="Label" oor:type="xs:string">
+ <value xml:lang="en-US">Polygon</value>
+ </prop>
+ </node>
+ <node oor:name="libo-motionpath-freeform-line" oor:op="replace">
+ <prop oor:name="Label" oor:type="xs:string">
+ <value xml:lang="en-US">Freeform Line</value>
+ </prop>
+ </node>
<node oor:name="ooo-motionpath-4-point-star" oor:op="replace">
<prop oor:name="Label" oor:type="xs:string">
<value xml:lang="en-US">4 Point Star</value>
diff --git a/sd/inc/CustomAnimationEffect.hxx b/sd/inc/CustomAnimationEffect.hxx
index cf2cfe7cb7a4..962ce9b995d9 100644
--- a/sd/inc/CustomAnimationEffect.hxx
+++ b/sd/inc/CustomAnimationEffect.hxx
@@ -71,7 +71,7 @@ public:
SAL_DLLPRIVATE const OUString& getProperty() const { return maProperty; }
SAL_DLLPRIVATE sal_Int16 getPresetClass() const { return mnPresetClass; }
- SAL_DLLPRIVATE void setPresetClass( sal_Int16 nPresetClass );
+ SAL_DLLPRIVATE void setPresetClassAndId( sal_Int16 nPresetClass, const OUString& rPresetId );
SAL_DLLPRIVATE sal_Int16 getNodeType() const { return mnNodeType; }
void setNodeType( sal_Int16 nNodeType );
@@ -271,7 +271,7 @@ public:
SAL_DLLPRIVATE virtual css::uno::Reference< css::animations::XAnimationNode > getRootNode();
SAL_DLLPRIVATE CustomAnimationEffectPtr append( const CustomAnimationPresetPtr& pDescriptor, const css::uno::Any& rTarget, double fDuration );
- SAL_DLLPRIVATE CustomAnimationEffectPtr append( const SdrPathObj& rPathObj, const css::uno::Any& rTarget, double fDuration );
+ SAL_DLLPRIVATE CustomAnimationEffectPtr append( const SdrPathObj& rPathObj, const css::uno::Any& rTarget, double fDuration, const OUString& rPresetId );
void append( const CustomAnimationEffectPtr& pEffect );
SAL_DLLPRIVATE void replace( const CustomAnimationEffectPtr& pEffect, const CustomAnimationPresetPtr& pDescriptor, double fDuration );
SAL_DLLPRIVATE void replace( const CustomAnimationEffectPtr& pEffect, const CustomAnimationPresetPtr& pDescriptor, const OUString& rPresetSubType, double fDuration );
diff --git a/sd/source/core/CustomAnimationEffect.cxx b/sd/source/core/CustomAnimationEffect.cxx
index f940e44645ae..a4b1d647f3dc 100644
--- a/sd/source/core/CustomAnimationEffect.cxx
+++ b/sd/source/core/CustomAnimationEffect.cxx
@@ -397,12 +397,13 @@ sal_Int32 CustomAnimationEffect::get_node_type( const Reference< XAnimationNode
return nNodeType;
}
-void CustomAnimationEffect::setPresetClass( sal_Int16 nPresetClass )
+void CustomAnimationEffect::setPresetClassAndId( sal_Int16 nPresetClass, const OUString& rPresetId )
{
- if( mnPresetClass == nPresetClass )
+ if( mnPresetClass == nPresetClass && maPresetId == rPresetId )
return;
mnPresetClass = nPresetClass;
+ maPresetId = rPresetId;
if( !mxNode.is() )
return;
@@ -410,7 +411,8 @@ void CustomAnimationEffect::setPresetClass( sal_Int16 nPresetClass )
// and change it
Sequence< NamedValue > aUserData( mxNode->getUserData() );
sal_Int32 nLength = aUserData.getLength();
- bool bFound = false;
+ bool bFoundPresetClass = false;
+ bool bFoundPresetId = false;
if( nLength )
{
NamedValue* pProp = std::find_if(aUserData.begin(), aUserData.end(),
@@ -418,16 +420,32 @@ void CustomAnimationEffect::setPresetClass( sal_Int16 nPresetClass )
if (pProp != aUserData.end())
{
pProp->Value <<= mnPresetClass;
- bFound = true;
+ bFoundPresetClass = true;
+ }
+
+ pProp = std::find_if(aUserData.begin(), aUserData.end(),
+ [](const NamedValue& rProp) { return rProp.Name == "preset-id"; });
+ if (pProp != aUserData.end())
+ {
+ pProp->Value <<= mnPresetClass;
+ bFoundPresetId = true;
}
}
// no "preset-class" entry inside user data, so add it
- if( !bFound )
+ if( !bFoundPresetClass )
{
aUserData.realloc( nLength + 1);
aUserData[nLength].Name = "preset-class";
aUserData[nLength].Value <<= mnPresetClass;
+ ++nLength;
+ }
+
+ if( !bFoundPresetId && maPresetId.getLength() > 0 )
+ {
+ aUserData.realloc( nLength + 1);
+ aUserData[nLength].Name = "preset-id";
+ aUserData[nLength].Value <<= maPresetId;
}
mxNode->setUserData( aUserData );
@@ -1687,7 +1705,7 @@ CustomAnimationEffectPtr EffectSequenceHelper::append( const CustomAnimationPres
return pEffect;
}
-CustomAnimationEffectPtr EffectSequenceHelper::append( const SdrPathObj& rPathObj, const Any& rTarget, double fDuration /* = -1.0 */ )
+CustomAnimationEffectPtr EffectSequenceHelper::append( const SdrPathObj& rPathObj, const Any& rTarget, double fDuration /* = -1.0 */, const OUString& rPresetId )
{
CustomAnimationEffectPtr pEffect;
@@ -1713,7 +1731,7 @@ CustomAnimationEffectPtr EffectSequenceHelper::append( const SdrPathObj& rPathOb
pEffect->setTarget( rTarget );
pEffect->setTargetSubItem( nSubItem );
pEffect->setNodeType( css::presentation::EffectNodeType::ON_CLICK );
- pEffect->setPresetClass( css::presentation::EffectPresetClass::MOTIONPATH );
+ pEffect->setPresetClassAndId( css::presentation::EffectPresetClass::MOTIONPATH, rPresetId );
pEffect->setAcceleration( 0.5 );
pEffect->setDecelerate( 0.5 );
pEffect->setFill( AnimationFill::HOLD );
diff --git a/sd/source/core/EffectMigration.cxx b/sd/source/core/EffectMigration.cxx
index cac5a8896fd0..5bc0809fc6a6 100644
--- a/sd/source/core/EffectMigration.cxx
+++ b/sd/source/core/EffectMigration.cxx
@@ -1281,7 +1281,7 @@ void EffectMigration::SetAnimationPath( SvxShape* pShape, SdrPathObj const * pPa
{
std::shared_ptr< sd::MainSequence > pMainSequence( pPage->getMainSequence() );
if( pMainSequence.get() )
- CustomAnimationEffectPtr pCreated( pMainSequence->append( *pPathObj, makeAny( xShape ), -1.0 ) );
+ CustomAnimationEffectPtr pCreated( pMainSequence->append( *pPathObj, makeAny( xShape ), -1.0, "" ) );
}
}
}
diff --git a/sd/source/ui/animations/CustomAnimationPane.cxx b/sd/source/ui/animations/CustomAnimationPane.cxx
index c63e4d0e8712..42b5055b0e5a 100644
--- a/sd/source/ui/animations/CustomAnimationPane.cxx
+++ b/sd/source/ui/animations/CustomAnimationPane.cxx
@@ -637,6 +637,17 @@ void CustomAnimationPane::updateControls()
}
}
+ // If preset id is missing and category is motion path.
+ if (nAnimationPos < 0 && nCategoryPos == 3)
+ {
+ if (rsPresetId == "libo-motionpath-curve")
+ mpLBAnimation->SelectEntryPos(mnCurvePathPos);
+ else if (rsPresetId == "libo-motionpath-polygon")
+ mpLBAnimation->SelectEntryPos(mnPolygonPathPos);
+ else if (rsPresetId == "libo-motionpath-freeform-line")
+ mpLBAnimation->SelectEntryPos(mnFreeformPathPos);
+ }
+
sal_uInt16 nPos = 0xffff;
sal_Int16 nNodeType = pEffect->getNodeType();
diff --git a/sd/source/ui/func/fuconbez.cxx b/sd/source/ui/func/fuconbez.cxx
index 072d743fb843..7630ea02304e 100644
--- a/sd/source/ui/func/fuconbez.cxx
+++ b/sd/source/ui/func/fuconbez.cxx
@@ -242,9 +242,24 @@ bool FuConstructBezierPolygon::MouseButtonUp(const MouseEvent& rMEvt )
double fDuration = 0.0;
*pTarget++ >>= fDuration;
bool bFirst = true;
+
+ OUString sPresetId;
+ switch(nSlotId)
+ {
+ case SID_DRAW_BEZIER_NOFILL:
+ sPresetId = "libo-motionpath-curve";
+ break;
+ case SID_DRAW_POLYGON_NOFILL:
+ sPresetId = "libo-motionpath-polygon";
+ break;
+ case SID_DRAW_FREELINE_NOFILL:
+ sPresetId = "libo-motionpath-freeform-line";
+ break;
+ }
+
while( --nTCount )
{
- CustomAnimationEffectPtr pCreated( pMainSequence->append( *pPathObj, *pTarget++, fDuration ) );
+ CustomAnimationEffectPtr pCreated( pMainSequence->append( *pPathObj, *pTarget++, fDuration, sPresetId) );
if( bFirst )
bFirst = false;
else
commit aeed331f7307612fbc4ebac4764cd39f6f2352e9
Author: Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Sat Nov 30 13:54:48 2019 +0100
Commit: Stephan Bergmann <sbergman at redhat.com>
CommitDate: Sat Nov 30 15:00:01 2019 +0100
Rewrite ParamValue::is
...without using boost::optional<>::operator! (in preparation for replacing
boost::optional with std::optional, which doesn't have an operator! using
is_initialized() would not be helpful, as std::optional doesn't have it either;
using has_value() would arguably be even cleaner, but boost::optional only has
it since Boost 1.68, so some --with-system-boost builds might not have it)
Change-Id: Iee3c71c8e6ea93fb25221768880442f42f410b83
Reviewed-on: https://gerrit.libreoffice.org/84115
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
diff --git a/include/connectivity/sqlerror.hxx b/include/connectivity/sqlerror.hxx
index be1112bda46f..9b4c60c49476 100644
--- a/include/connectivity/sqlerror.hxx
+++ b/include/connectivity/sqlerror.hxx
@@ -72,7 +72,7 @@ namespace connectivity
ParamValue( OUString const& val ) : base_type( val ) { }
ParamValue( ParamValue const& rhs ) : base_type( static_cast<base_type const&>( rhs ) ) { }
- bool is() const { return !base_type::operator!(); }
+ bool is() const { return bool(*this); }
};
More information about the Libreoffice-commits
mailing list