[Libreoffice-commits] core.git: embeddedobj/source

2023-10-19 Thread Stephan Bergmann (via logerrit)
 embeddedobj/source/commonembedding/persistence.cxx |   12 ++--
 embeddedobj/source/general/intercept.cxx   |   12 ++--
 embeddedobj/source/msole/ownview.cxx   |2 +-
 3 files changed, 13 insertions(+), 13 deletions(-)

New commits:
commit 93c0780392758f783592f030aa2d4e824d57bb2f
Author: Stephan Bergmann 
AuthorDate: Thu Oct 19 10:30:13 2023 +0200
Commit: Stephan Bergmann 
CommitDate: Thu Oct 19 20:32:23 2023 +0200

Extended loplugin:ostr: Automatic rewrite O[U]StringLiteral: embeddedobj

Change-Id: I2761e0a093aff75c5660b2b78012277c67eb8e17
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158191
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/embeddedobj/source/commonembedding/persistence.cxx 
b/embeddedobj/source/commonembedding/persistence.cxx
index 4bb8d19123a3..6859de216c24 100644
--- a/embeddedobj/source/commonembedding/persistence.cxx
+++ b/embeddedobj/source/commonembedding/persistence.cxx
@@ -178,7 +178,7 @@ static void TransferMediaType( const uno::Reference< 
embed::XStorage >& i_rSourc
 {
 const uno::Reference< beans::XPropertySet > xSourceProps( i_rSource, 
uno::UNO_QUERY_THROW );
 const uno::Reference< beans::XPropertySet > xTargetProps( i_rTarget, 
uno::UNO_QUERY_THROW );
-static constexpr OUStringLiteral sMediaTypePropName( u"MediaType" );
+static constexpr OUString sMediaTypePropName( u"MediaType"_ustr );
 xTargetProps->setPropertyValue( sMediaTypePropName, 
xSourceProps->getPropertyValue( sMediaTypePropName ) );
 }
 catch( const uno::Exception& )
@@ -784,11 +784,11 @@ void OCommonEmbeddedObject::StoreDocToStorage_Impl(
 if ( aFilterName.isEmpty() )
 throw io::IOException(); // TODO:
 
-static constexpr OUStringLiteral sFilterName = u"FilterName";
-static constexpr OUStringLiteral sHierarchicalDocumentName = 
u"HierarchicalDocumentName";
-static constexpr OUStringLiteral sDocumentBaseURL = u"DocumentBaseURL";
-static constexpr OUStringLiteral sSourceShellID = u"SourceShellID";
-static constexpr OUStringLiteral sDestinationShellID = 
u"DestinationShellID";
+static constexpr OUString sFilterName = u"FilterName"_ustr;
+static constexpr OUString sHierarchicalDocumentName = 
u"HierarchicalDocumentName"_ustr;
+static constexpr OUString sDocumentBaseURL = u"DocumentBaseURL"_ustr;
+static constexpr OUString sSourceShellID = u"SourceShellID"_ustr;
+static constexpr OUString sDestinationShellID = 
u"DestinationShellID"_ustr;
 uno::Sequence aArgs{
 comphelper::makePropertyValue(sFilterName, aFilterName),
 comphelper::makePropertyValue(sHierarchicalDocumentName, 
aHierarchName),
diff --git a/embeddedobj/source/general/intercept.cxx 
b/embeddedobj/source/general/intercept.cxx
index 58a7ed49bcc0..db16a59b9d68 100644
--- a/embeddedobj/source/general/intercept.cxx
+++ b/embeddedobj/source/general/intercept.cxx
@@ -26,12 +26,12 @@
 
 using namespace ::com::sun::star;
 
-constexpr OUStringLiteral IU0 = u".uno:Save";
-constexpr OUStringLiteral IU1 = u".uno:SaveAll";
-constexpr OUStringLiteral IU2 = u".uno:CloseDoc";
-constexpr OUStringLiteral IU3 = u".uno:CloseWin";
-constexpr OUStringLiteral IU4 = u".uno:CloseFrame";
-constexpr OUStringLiteral IU5 = u".uno:SaveAs";
+constexpr OUString IU0 = u".uno:Save"_ustr;
+constexpr OUString IU1 = u".uno:SaveAll"_ustr;
+constexpr OUString IU2 = u".uno:CloseDoc"_ustr;
+constexpr OUString IU3 = u".uno:CloseWin"_ustr;
+constexpr OUString IU4 = u".uno:CloseFrame"_ustr;
+constexpr OUString IU5 = u".uno:SaveAs"_ustr;
 const uno::Sequence< OUString > Interceptor::m_aInterceptedURL{ IU0, IU1, IU2, 
IU3, IU4, IU5 };
 
 class StatusChangeListenerContainer
diff --git a/embeddedobj/source/msole/ownview.cxx 
b/embeddedobj/source/msole/ownview.cxx
index e4684d6d29bf..5576f8633cce 100644
--- a/embeddedobj/source/msole/ownview.cxx
+++ b/embeddedobj/source/msole/ownview.cxx
@@ -401,7 +401,7 @@ void OwnView_Impl::CreateNative()
 aArgs, m_xContext ),
 uno::UNO_QUERY_THROW );
 
-static constexpr OUStringLiteral aSubStreamName(u"\1Ole10Native");
+static constexpr OUString aSubStreamName(u"\1Ole10Native"_ustr);
 uno::Reference< embed::XClassifiedObject > xStor( xNameAccess, 
uno::UNO_QUERY_THROW );
 uno::Sequence< sal_Int8 > aStorClassID = xStor->getClassID();
 


[Libreoffice-commits] core.git: embeddedobj/source

2023-10-17 Thread Caolán McNamara (via logerrit)
 embeddedobj/source/commonembedding/persistence.cxx |   22 +
 1 file changed, 14 insertions(+), 8 deletions(-)

New commits:
commit 7273de2730022deb37a8c7f2fedbe7fc4551f9b5
Author: Caolán McNamara 
AuthorDate: Mon Oct 16 15:21:03 2023 +0100
Commit: Caolán McNamara 
CommitDate: Tue Oct 17 10:24:59 2023 +0200

check earlier on loading ole objects if parent doc is untrusted referer

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

diff --git a/embeddedobj/source/commonembedding/persistence.cxx 
b/embeddedobj/source/commonembedding/persistence.cxx
index ce77c9531db0..4bb8d19123a3 100644
--- a/embeddedobj/source/commonembedding/persistence.cxx
+++ b/embeddedobj/source/commonembedding/persistence.cxx
@@ -54,11 +54,12 @@
 #include 
 #include 
 #include 
+#include 
 #include 
+#include 
 
 #include 
 #include 
-#include 
 #include "persistence.hxx"
 
 using namespace ::com::sun::star;
@@ -361,14 +362,8 @@ uno::Reference< util::XCloseable > 
OCommonEmbeddedObject::InitNewDocument_Impl()
 return xDocument;
 }
 
-
 uno::Reference< util::XCloseable > OCommonEmbeddedObject::LoadLink_Impl()
 {
-uno::Reference< util::XCloseable > xDocument( CreateDocument( m_xContext, 
GetDocumentServiceName(),
-m_bEmbeddedScriptSupport, 
m_bDocumentRecoverySupport ) );
-
-uno::Reference< frame::XLoadable > xLoadable( xDocument, 
uno::UNO_QUERY_THROW );
-
 sal_Int32 nLen = m_bLinkHasPassword ? 3 : 2;
 uno::Sequence< beans::PropertyValue > aArgs( 
m_aDocMediaDescriptor.getLength() + nLen );
 auto pArgs = aArgs.getArray();
@@ -390,10 +385,22 @@ uno::Reference< util::XCloseable > 
OCommonEmbeddedObject::LoadLink_Impl()
 
 for ( sal_Int32 nInd = 0; nInd < m_aDocMediaDescriptor.getLength(); nInd++ 
)
 {
+// return early if this document is not trusted to open links
+if (m_aDocMediaDescriptor[nInd].Name == 
utl::MediaDescriptor::PROP_REFERRER)
+{
+OUString referer;
+m_aDocMediaDescriptor[nInd].Value >>= referer;
+if (SvtSecurityOptions::isUntrustedReferer(referer))
+return nullptr;
+}
 pArgs[nInd+nLen].Name = m_aDocMediaDescriptor[nInd].Name;
 pArgs[nInd+nLen].Value = m_aDocMediaDescriptor[nInd].Value;
 }
 
+uno::Reference< util::XCloseable > xDocument( CreateDocument( m_xContext, 
GetDocumentServiceName(),
+m_bEmbeddedScriptSupport, 
m_bDocumentRecoverySupport ) );
+uno::Reference< frame::XLoadable > xLoadable( xDocument, 
uno::UNO_QUERY_THROW );
+
 try
 {
 handleLinkedOLE(CopyBackToOLELink::CopyLinkToTemp);
@@ -437,7 +444,6 @@ uno::Reference< util::XCloseable > 
OCommonEmbeddedObject::LoadLink_Impl()
 
 }
 
-
 OUString OCommonEmbeddedObject::GetFilterName( sal_Int32 nVersion ) const
 {
 OUString aFilterName = GetPresetFilterName();


[Libreoffice-commits] core.git: embeddedobj/source svx/source

2023-10-16 Thread Caolán McNamara (via logerrit)
 embeddedobj/source/commonembedding/persistence.cxx |2 +-
 svx/source/unodraw/unoshap4.cxx|2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 267be127f2899f2e1b1f15b5a06707a9b83fcab4
Author: Caolán McNamara 
AuthorDate: Mon Oct 16 13:25:29 2023 +0100
Commit: Caolán McNamara 
CommitDate: Mon Oct 16 17:52:18 2023 +0200

retain Referer information available in OCommonEmbeddedObject ctor

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

diff --git a/embeddedobj/source/commonembedding/persistence.cxx 
b/embeddedobj/source/commonembedding/persistence.cxx
index 2fdc6af47d08..ce77c9531db0 100644
--- a/embeddedobj/source/commonembedding/persistence.cxx
+++ b/embeddedobj/source/commonembedding/persistence.cxx
@@ -79,7 +79,7 @@ uno::Sequence< beans::PropertyValue > GetValuableArgs_Impl( 
const uno::Sequence<
   || prop.Name == "StartPresentation" || prop.Name == "RepairPackage"
   || prop.Name == "StatusIndicator" || prop.Name == "ViewData"
   || prop.Name == "ViewId" || prop.Name == "MacroExecutionMode"
-  || prop.Name == "UpdateDocMode"
+  || prop.Name == "UpdateDocMode" || prop.Name == "Referer"
   || (prop.Name == "DocumentBaseURL" && bCanUseDocumentBaseURL) )
 {
 aResult.realloc( ++nResLen );
diff --git a/svx/source/unodraw/unoshap4.cxx b/svx/source/unodraw/unoshap4.cxx
index 9e1f265dce2b..faff6e4ba6b7 100644
--- a/svx/source/unodraw/unoshap4.cxx
+++ b/svx/source/unodraw/unoshap4.cxx
@@ -480,7 +480,7 @@ void SvxOle2Shape::createLink( const OUString& aLinkURL )
 awt::Size aSz = xObj->getVisualAreaSize( pOle2Obj->GetAspect() );
 aRect.SetSize( Size( aSz.Width, aSz.Height ) );
 }
-catch( embed::NoVisualAreaSizeException& )
+catch (const uno::Exception&)
 {}
 pOle2Obj->SetLogicRect( aRect );
 }


[Libreoffice-commits] core.git: embeddedobj/source include/svtools sfx2/source svtools/source

2023-09-28 Thread Mike Kaganski (via logerrit)
 embeddedobj/source/msole/olecomponent.cxx |   24 ++--
 include/svtools/ehdl.hxx  |5 +
 sfx2/source/view/ipclient.cxx |3 ++-
 svtools/source/misc/ehdl.cxx  |   12 
 4 files changed, 41 insertions(+), 3 deletions(-)

New commits:
commit 11aa86140eaac3d1d67db1f337fc1c76a511778f
Author: Mike Kaganski 
AuthorDate: Thu Sep 28 15:15:53 2023 +0300
Commit: Mike Kaganski 
CommitDate: Thu Sep 28 16:02:55 2023 +0200

Improve OleRun error reporting

1. Pass its error message up the call stack as the exception's message.
2. In case of REGDB_E_CLASSNOTREG, also obtain the object's class name
   and append it to the message.
3. Show this information in the message displayed for OLE activation
   error.

This introduces a new SetExtendedMessage method in SfxErrorContext to
store extra information for specific errors.

Change-Id: Id3863276266d992ae407fbfa5568acf5c57aa96f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157372
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/embeddedobj/source/msole/olecomponent.cxx 
b/embeddedobj/source/msole/olecomponent.cxx
index fcd659e369a3..f981a4304656 100644
--- a/embeddedobj/source/msole/olecomponent.cxx
+++ b/embeddedobj/source/msole/olecomponent.cxx
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -883,10 +884,29 @@ void OleComponent::RunObject()
 
 if ( FAILED( hr ) )
 {
+OUString error = WindowsErrorStringFromHRESULT(hr);
 if ( hr == REGDB_E_CLASSNOTREG )
-throw embed::UnreachableStateException(); // the object server 
is not installed
+{
+if (auto pOleObj
+= 
m_pNativeImpl->m_pObj.QueryInterface(sal::systools::COM_QUERY))
+{
+LPOLESTR lpUserType = nullptr;
+if (SUCCEEDED(pOleObj->GetUserType(USERCLASSTYPE_FULL, 
)))
+{
+error += OUString::Concat("\n") + 
o3tl::toU(lpUserType);
+sal::systools::COMReference pMalloc;
+hr = CoGetMalloc(1, ); // if fails there will 
be a memory leak
+SAL_WARN_IF(FAILED(hr) || !pMalloc, "embeddedobj.ole", 
"CoGetMalloc() failed");
+if (pMalloc)
+pMalloc->Free(lpUserType);
+}
+}
+throw embed::UnreachableStateException(
+error, getXWeak(), -1,
+css::embed::EmbedStates::RUNNING); // the object server is 
not installed
+}
 else
-throw io::IOException();
+throw io::IOException(error, getXWeak());
 }
 }
 }
diff --git a/include/svtools/ehdl.hxx b/include/svtools/ehdl.hxx
index d67f094f818e..78bcf1723dfe 100644
--- a/include/svtools/ehdl.hxx
+++ b/include/svtools/ehdl.hxx
@@ -23,6 +23,8 @@
 #include 
 #include 
 
+#include 
+
 typedef std::pair ErrMsgCode;
 SVT_DLLPUBLIC extern const ErrMsgCode RID_ERRHDL[];
 SVT_DLLPUBLIC extern const ErrMsgCode RID_ERRCTX[];
@@ -40,11 +42,14 @@ public:
 const ErrMsgCode* pIds = nullptr, const std::locale& rResLocaleP = 
SvtResLocale());
 bool GetString(ErrCode nErrId, OUString ) override;
 
+void SetExtendedMessage(ErrCode nErrId, const OUString& rStr);
+
 private:
 sal_uInt16 nCtxId;
 const ErrMsgCode* pIds;
 std::locale aResLocale;
 OUString aArg1;
+std::unordered_map m_extMessages;
 };
 
 class SVT_DLLPUBLIC SfxErrorHandler : private ErrorHandler
diff --git a/sfx2/source/view/ipclient.cxx b/sfx2/source/view/ipclient.cxx
index 367d3070938b..260bdff77f34 100644
--- a/sfx2/source/view/ipclient.cxx
+++ b/sfx2/source/view/ipclient.cxx
@@ -970,7 +970,7 @@ ErrCode SfxInPlaceClient::DoVerb(sal_Int32 nVerb)
 
 m_xImp->m_xObject->doVerb( nVerb );
 }
-catch ( embed::UnreachableStateException& )
+catch ( embed::UnreachableStateException& e )
 {
 if (nVerb == embed::EmbedVerbs::MS_OLEVERB_PRIMARY || 
nVerb == embed::EmbedVerbs::MS_OLEVERB_OPEN || nVerb == 
embed::EmbedVerbs::MS_OLEVERB_SHOW)
 {
@@ -997,6 +997,7 @@ ErrCode SfxInPlaceClient::DoVerb(sal_Int32 nVerb)
 {
 TOOLS_WARN_EXCEPTION("embeddedobj", 
"SfxInPlaceClient::DoVerb: -9 fallback path");
 nError = ERRCODE_SO_GENERALERROR;
+aEc.SetExtendedMessage(ERRCODE_SO_GENERALERROR, 
e.Message);
 }
 }
 }
diff --git a/svtools/source/misc/ehdl.cxx b/svtools/source/misc/ehdl.cxx
index a2cd3ef63323..ef35b3975fca 100644
--- a/svtools/source/misc/ehdl.cxx
+++ 

[Libreoffice-commits] core.git: embeddedobj/source

2023-09-27 Thread Mike Kaganski (via logerrit)
 embeddedobj/source/msole/ownview.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 3ae9860b9c4c9cbf4b5b7c47617303f29042783d
Author: Mike Kaganski 
AuthorDate: Wed Sep 27 09:18:51 2023 +0300
Commit: Mike Kaganski 
CommitDate: Wed Sep 27 10:29:32 2023 +0200

OUString -> OUStringLiteral

Change-Id: I80b6c736960badf1a6e3af89740a80f46a651f9f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157305
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/embeddedobj/source/msole/ownview.cxx 
b/embeddedobj/source/msole/ownview.cxx
index 322bd9f5b3c6..e4684d6d29bf 100644
--- a/embeddedobj/source/msole/ownview.cxx
+++ b/embeddedobj/source/msole/ownview.cxx
@@ -401,7 +401,7 @@ void OwnView_Impl::CreateNative()
 aArgs, m_xContext ),
 uno::UNO_QUERY_THROW );
 
-OUString aSubStreamName = "\1Ole10Native";
+static constexpr OUStringLiteral aSubStreamName(u"\1Ole10Native");
 uno::Reference< embed::XClassifiedObject > xStor( xNameAccess, 
uno::UNO_QUERY_THROW );
 uno::Sequence< sal_Int8 > aStorClassID = xStor->getClassID();
 


[Libreoffice-commits] core.git: embeddedobj/source

2023-07-25 Thread Noel Grandin (via logerrit)
 embeddedobj/source/general/docholder.cxx |8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

New commits:
commit 05d1790f746dfb7367a4c79aa43b00457b7b2cc9
Author: Noel Grandin 
AuthorDate: Tue Jul 25 15:25:48 2023 +0200
Commit: Noel Grandin 
CommitDate: Tue Jul 25 18:26:32 2023 +0200

tdf#156463 crash on exit after editing a chart (gtk3)

regression from
commit 1ed765c818af2186e459c5ad0eff24dc39a20d34
tdf#155235 workaround gtk3 accessiblibility crashes on close

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

diff --git a/embeddedobj/source/general/docholder.cxx 
b/embeddedobj/source/general/docholder.cxx
index fe48ec5b2d45..bcac2d08c9e5 100644
--- a/embeddedobj/source/general/docholder.cxx
+++ b/embeddedobj/source/general/docholder.cxx
@@ -233,8 +233,12 @@ void DocumentHolder::CloseFrame()
 
 void DocumentHolder::FreeOffice()
 {
-uno::Reference< frame::XDesktop2 > xDesktop = frame::Desktop::create( 
m_xContext );
-xDesktop->removeTerminateListener( this );
+try {
+uno::Reference< frame::XDesktop2 > xDesktop = frame::Desktop::create( 
m_xContext );
+xDesktop->removeTerminateListener( this );
+} catch (const css::uno::DeploymentException&) {
+// if this happens, the desktop is already gone
+}
 
 // the following code is commented out since for now there is still no 
completely correct way to detect
 // whether the office can be terminated, so it is better to have 
unnecessary process running than


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

2023-04-14 Thread Caolán McNamara (via logerrit)
 embeddedobj/source/commonembedding/specialobject.cxx |9 +
 embeddedobj/source/inc/specialobject.hxx |6 +
 sw/inc/ndole.hxx |4 
 sw/source/core/ole/ndole.cxx |   89 +--
 4 files changed, 97 insertions(+), 11 deletions(-)

New commits:
commit 8b8a2844addbd262befb1a2d193dfb590dfa20be
Author: Caolán McNamara 
AuthorDate: Thu Apr 13 14:13:36 2023 +0100
Commit: Caolán McNamara 
CommitDate: Fri Apr 14 11:53:54 2023 +0200

add a route to get writer Floating Frame links under 'manage links'

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

diff --git a/embeddedobj/source/commonembedding/specialobject.cxx 
b/embeddedobj/source/commonembedding/specialobject.cxx
index 809ffce1f2c4..3dc1eb7e47ef 100644
--- a/embeddedobj/source/commonembedding/specialobject.cxx
+++ b/embeddedobj/source/commonembedding/specialobject.cxx
@@ -48,6 +48,7 @@ uno::Any SAL_CALL OSpecialEmbeddedObject::queryInterface( 
const uno::Type& rType
 uno::Any aReturn = ::cppu::queryInterface( rType,
 static_cast< embed::XEmbeddedObject* 
>( this ),
 static_cast< embed::XInplaceObject* >( 
this ),
+static_cast< 
embed::XCommonEmbedPersist* >( static_cast< embed::XEmbedPersist* >( this ) ),
 static_cast< embed::XVisualObject* >( 
this ),
 static_cast< embed::XClassifiedObject* 
>( this ),
 static_cast< 
embed::XComponentSupplier* >( this ),
@@ -163,6 +164,14 @@ void SAL_CALL OSpecialEmbeddedObject::doVerb( sal_Int32 
nVerbID )
 OCommonEmbeddedObject::doVerb( nVerbID );
 }
 
+void SAL_CALL OSpecialEmbeddedObject::reload(
+const uno::Sequence< beans::PropertyValue >&,
+const uno::Sequence< beans::PropertyValue >&)
+{
+// Allow IFrames to reload their content
+SetInplaceActiveState();
+}
+
 OUString SAL_CALL OSpecialEmbeddedObject::getImplementationName()
 {
 return "com.sun.star.comp.embed.OSpecialEmbeddedObject";
diff --git a/embeddedobj/source/inc/specialobject.hxx 
b/embeddedobj/source/inc/specialobject.hxx
index 48d1d872a2a2..9ec0d7d86465 100644
--- a/embeddedobj/source/inc/specialobject.hxx
+++ b/embeddedobj/source/inc/specialobject.hxx
@@ -48,6 +48,12 @@ public:
 
 virtual void SAL_CALL doVerb( sal_Int32 nVerbID ) override;
 
+// XCommonEmbedPersist
+
+virtual void SAL_CALL reload(
+const css::uno::Sequence< css::beans::PropertyValue >& 
lArguments,
+const css::uno::Sequence< css::beans::PropertyValue >& 
lObjArgs ) override;
+
 // XServiceInfo
 OUString SAL_CALL getImplementationName() override;
 sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
diff --git a/sw/inc/ndole.hxx b/sw/inc/ndole.hxx
index acac9307e496..5caa29ab43bf 100644
--- a/sw/inc/ndole.hxx
+++ b/sw/inc/ndole.hxx
@@ -28,7 +28,7 @@ class SwGrfFormatColl;
 class SwDoc;
 class SwOLENode;
 class SwOLEListener_Impl;
-class SwEmbedObjectLink;
+namespace sfx2 { class SvBaseLink; }
 class DeflateData;
 
 class SW_DLLPUBLIC SwOLEObj
@@ -94,7 +94,7 @@ class SW_DLLPUBLIC SwOLENode final: public SwNoTextNode
 bool   mbOLESizeInvalid; /**< Should be considered at SwDoc::PrtOLENotify
(e.g. copied). Is not persistent. */
 
-SwEmbedObjectLink*  mpObjectLink;
+sfx2::SvBaseLink*  mpObjectLink;
 OUString maLinkURL;
 
 SwOLENode(  SwNode& rWhere,
diff --git a/sw/source/core/ole/ndole.cxx b/sw/source/core/ole/ndole.cxx
index 831dcaef6faf..de94986797f3 100644
--- a/sw/source/core/ole/ndole.cxx
+++ b/sw/source/core/ole/ndole.cxx
@@ -149,6 +149,8 @@ void SAL_CALL SwOLEListener_Impl::disposing( const 
lang::EventObject& )
 // TODO/LATER: actually SwEmbedObjectLink should be used here, but because 
different objects are used to control
 // embedded object different link objects with the same 
functionality had to be implemented
 
+namespace {
+
 class SwEmbedObjectLink : public sfx2::SvBaseLink
 {
 SwOLENode* m_pOleNode;
@@ -211,6 +213,44 @@ void SwEmbedObjectLink::Closed()
 SvBaseLink::Closed();
 }
 
+class SwIFrameLink : public sfx2::SvBaseLink
+{
+SwOLENode* m_pOleNode;
+
+public:
+explicit SwIFrameLink(SwOLENode* pNode)
+: ::sfx2::SvBaseLink(::SfxLinkUpdateMode::ONCALL, 
SotClipboardFormatId::SVXB)
+, m_pOleNode(pNode)
+{
+SetSynchron( false );
+}
+
+::sfx2::SvBaseLink::UpdateResult DataChanged(
+const OUString&, const uno::Any& )
+{
+uno::Reference xObject = 
m_pOleNode->GetOLEObj().GetOleRef();
+uno::Reference xPersObj(xObject, 
uno::UNO_QUERY);
+

[Libreoffice-commits] core.git: embeddedobj/source

2023-04-13 Thread Caolán McNamara (via logerrit)
 embeddedobj/source/commonembedding/embedobj.cxx |   60 
 embeddedobj/source/inc/commonembobj.hxx |3 +
 2 files changed, 35 insertions(+), 28 deletions(-)

New commits:
commit 183e34a3f8c429c0698951e24c17844e416a3825
Author: Caolán McNamara 
AuthorDate: Thu Apr 13 11:31:17 2023 +0100
Commit: Caolán McNamara 
CommitDate: Thu Apr 13 16:44:49 2023 +0200

extract a OCommonEmbeddedObject::SetInplaceActiveState for reuse

no behaviour change intended

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

diff --git a/embeddedobj/source/commonembedding/embedobj.cxx 
b/embeddedobj/source/commonembedding/embedobj.cxx
index 0b1cb5785dac..ef627941921e 100644
--- a/embeddedobj/source/commonembedding/embedobj.cxx
+++ b/embeddedobj/source/commonembedding/embedobj.cxx
@@ -216,6 +216,37 @@ void OCommonEmbeddedObject::StateChangeNotification_Impl( 
bool bBeforeChange, sa
 rGuard.reset();
 }
 
+void OCommonEmbeddedObject::SetInplaceActiveState()
+{
+if ( !m_xClientSite.is() )
+throw embed::WrongStateException( "client site not set, yet", *this );
+
+uno::Reference< embed::XInplaceClient > xInplaceClient( m_xClientSite, 
uno::UNO_QUERY );
+if ( !xInplaceClient.is() || !xInplaceClient->canInplaceActivate() )
+throw embed::WrongStateException(); //TODO: can't activate inplace
+xInplaceClient->activatingInplace();
+
+uno::Reference< embed::XWindowSupplier > xClientWindowSupplier( 
xInplaceClient, uno::UNO_QUERY_THROW );
+
+m_xClientWindow = xClientWindowSupplier->getWindow();
+m_aOwnRectangle = xInplaceClient->getPlacement();
+m_aClipRectangle = xInplaceClient->getClipRectangle();
+awt::Rectangle aRectangleToShow = GetRectangleInterception( 
m_aOwnRectangle, m_aClipRectangle );
+
+// create own window based on the client window
+// place and resize the window according to the rectangles
+uno::Reference< awt::XWindowPeer > xClientWindowPeer( m_xClientWindow, 
uno::UNO_QUERY_THROW );
+
+// dispatch provider may not be provided
+uno::Reference< frame::XDispatchProvider > xContainerDP = 
xInplaceClient->getInplaceDispatchProvider();
+bool bOk = m_xDocHolder->ShowInplace( xClientWindowPeer, aRectangleToShow, 
xContainerDP );
+m_nObjectState = embed::EmbedStates::INPLACE_ACTIVE;
+if ( !bOk )
+{
+SwitchStateTo_Impl( embed::EmbedStates::RUNNING );
+throw embed::WrongStateException(); //TODO: can't activate inplace
+}
+}
 
 void OCommonEmbeddedObject::SwitchStateTo_Impl( sal_Int32 nNextState )
 {
@@ -289,34 +320,7 @@ void OCommonEmbeddedObject::SwitchStateTo_Impl( sal_Int32 
nNextState )
 {
 if ( nNextState == embed::EmbedStates::INPLACE_ACTIVE )
 {
-if ( !m_xClientSite.is() )
-throw embed::WrongStateException( "client site not set, 
yet", *this );
-
-uno::Reference< embed::XInplaceClient > xInplaceClient( 
m_xClientSite, uno::UNO_QUERY );
-if ( !xInplaceClient.is() || 
!xInplaceClient->canInplaceActivate() )
-throw embed::WrongStateException(); //TODO: can't activate 
inplace
-xInplaceClient->activatingInplace();
-
-uno::Reference< embed::XWindowSupplier > 
xClientWindowSupplier( xInplaceClient, uno::UNO_QUERY_THROW );
-
-m_xClientWindow = xClientWindowSupplier->getWindow();
-m_aOwnRectangle = xInplaceClient->getPlacement();
-m_aClipRectangle = xInplaceClient->getClipRectangle();
-awt::Rectangle aRectangleToShow = GetRectangleInterception( 
m_aOwnRectangle, m_aClipRectangle );
-
-// create own window based on the client window
-// place and resize the window according to the rectangles
-uno::Reference< awt::XWindowPeer > xClientWindowPeer( 
m_xClientWindow, uno::UNO_QUERY_THROW );
-
-// dispatch provider may not be provided
-uno::Reference< frame::XDispatchProvider > xContainerDP = 
xInplaceClient->getInplaceDispatchProvider();
-bool bOk = m_xDocHolder->ShowInplace( xClientWindowPeer, 
aRectangleToShow, xContainerDP );
-m_nObjectState = nNextState;
-if ( !bOk )
-{
-SwitchStateTo_Impl( embed::EmbedStates::RUNNING );
-throw embed::WrongStateException(); //TODO: can't activate 
inplace
-}
+SetInplaceActiveState();
 }
 else if ( nNextState == embed::EmbedStates::ACTIVE )
 {
diff --git a/embeddedobj/source/inc/commonembobj.hxx 
b/embeddedobj/source/inc/commonembobj.hxx
index 64ce9ae0f9f5..bbd2de63ec70 100644
--- a/embeddedobj/source/inc/commonembobj.hxx
+++ 

[Libreoffice-commits] core.git: embeddedobj/source sc/source

2023-04-03 Thread Caolán McNamara (via logerrit)
 embeddedobj/source/commonembedding/miscobj.cxx |7 +++
 embeddedobj/source/inc/commonembobj.hxx|3 +++
 sc/source/ui/drawfunc/fusel.cxx|4 
 3 files changed, 10 insertions(+), 4 deletions(-)

New commits:
commit dd56b1c4980bea867286880bd0ac194b6106c968
Author: Caolán McNamara 
AuthorDate: Mon Apr 3 17:24:25 2023 +0100
Commit: Caolán McNamara 
CommitDate: Mon Apr 3 21:01:51 2023 +0200

set a parent for embedded object warning dialog

calc does a lot of "CaptureMouse" which then leads to a lot of
"ReleaseMouse", I'm somewhat unconvinced that there should be any
CaptureMouse calls in there.

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

diff --git a/embeddedobj/source/commonembedding/miscobj.cxx 
b/embeddedobj/source/commonembedding/miscobj.cxx
index ecd149b8bb17..9fb1de15830b 100644
--- a/embeddedobj/source/commonembedding/miscobj.cxx
+++ b/embeddedobj/source/commonembedding/miscobj.cxx
@@ -37,7 +37,6 @@
 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -346,7 +345,7 @@ void OCommonEmbeddedObject::PostEvent_Impl( const OUString& 
aEventName )
 }
 
 
-static int ShowMsgDialog( TranslateId Msg, const OUString& sFileName )
+int OCommonEmbeddedObject::ShowMsgDialog(TranslateId Msg, const OUString& 
sFileName)
 {
 std::locale aResLocale = Translate::Create( "emo" );
 OUString aMsg  = Translate::get( Msg, aResLocale );
@@ -356,7 +355,7 @@ static int ShowMsgDialog( TranslateId Msg, const OUString& 
sFileName )
 osl::FileBase::getSystemPathFromFileURL( sFileName, aTemp );
 
 aMsg = aMsg.replaceFirst( "%{filename}", aTemp );
-weld::Window* pParent = Application::GetFrameWeld( nullptr );
+weld::Window* pParent = Application::GetFrameWeld(m_xClientWindow);
 
 std::unique_ptr xQueryBox 
(Application::CreateMessageDialog( pParent,
 VclMessageType::Warning, VclButtonsType::NONE, aMsg ) );
@@ -431,7 +430,7 @@ void OCommonEmbeddedObject::handleLinkedOLE( 
CopyBackToOLELink eState )
 OUString aMsg;
 osl::FileBase::getSystemPathFromFileURL( SrcName, aMsg );
 aMsg = ex.Message + "\n\n" + aMsg;
-weld::Window* pParent = Application::GetFrameWeld( nullptr );
+weld::Window* pParent = Application::GetFrameWeld(m_xClientWindow);
 std::unique_ptr xQueryBox( 
Application::CreateMessageDialog( pParent,
  VclMessageType::Error, 
VclButtonsType::Ok, aMsg ) );
 
diff --git a/embeddedobj/source/inc/commonembobj.hxx 
b/embeddedobj/source/inc/commonembobj.hxx
index 8f0a685c22c3..64ce9ae0f9f5 100644
--- a/embeddedobj/source/inc/commonembobj.hxx
+++ b/embeddedobj/source/inc/commonembobj.hxx
@@ -41,6 +41,7 @@
 #include 
 #include 
 #include 
+#include 
 
 namespace com::sun::star {
 namespace embed {
@@ -251,6 +252,8 @@ private:
 const css::uno::Sequence< css::beans::PropertyValue >& 
lArguments,
 const css::uno::Sequence< css::beans::PropertyValue >& 
lObjArgs );
 
+int ShowMsgDialog(TranslateId Msg, const OUString& sFileName);
+
 public:
 OCommonEmbeddedObject(
 css::uno::Reference< css::uno::XComponentContext > xContext,
diff --git a/sc/source/ui/drawfunc/fusel.cxx b/sc/source/ui/drawfunc/fusel.cxx
index 2fd8a9dc3fd6..d95f810308fa 100644
--- a/sc/source/ui/drawfunc/fusel.cxx
+++ b/sc/source/ui/drawfunc/fusel.cxx
@@ -489,6 +489,10 @@ bool FuSelection::MouseButtonUp(const MouseEvent& rMEvt)
 {
 if 
(static_cast(pObj)->GetObjRef().is())
 {
+// release so if ActivateObject launches a 
warning dialog, then that dialog
+// can get mouse events
+if (pWindow->IsMouseCaptured())
+pWindow->ReleaseMouse();
 
rViewShell.ActivateObject(static_cast(pObj), 
css::embed::EmbedVerbs::MS_OLEVERB_PRIMARY);
 }
 }


[Libreoffice-commits] core.git: embeddedobj/source

2023-03-23 Thread Jani Saranpää (via logerrit)
 embeddedobj/source/msole/oleembed.cxx |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 6dfa9c7c0db91a71f3787226636864161d5367ca
Author: Jani Saranpää 
AuthorDate: Wed Mar 22 23:50:16 2023 +0200
Commit: Ilmari Lauhakangas 
CommitDate: Thu Mar 23 06:33:24 2023 +

tdf#42982 Improve UNO API error reporting

Change-Id: If8c8e96c2d8365f10a191868e76e75d6fc7c5db9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149357
Tested-by: Jenkins
Tested-by: Ilmari Lauhakangas 
Reviewed-by: Ilmari Lauhakangas 

diff --git a/embeddedobj/source/msole/oleembed.cxx 
b/embeddedobj/source/msole/oleembed.cxx
index d06969925109..2bc6cdb6066b 100644
--- a/embeddedobj/source/msole/oleembed.cxx
+++ b/embeddedobj/source/msole/oleembed.cxx
@@ -217,7 +217,7 @@ uno::Reference< embed::XStorage > 
OleEmbeddedObject::CreateTemporarySubstorage(
 if ( !xResult.is() )
 {
 o_aStorageName.clear();
-throw uno::RuntimeException();
+throw uno::RuntimeException("Failed to create temporary storage for 
OLE embed object");
 }
 
 return xResult;
@@ -238,7 +238,7 @@ OUString OleEmbeddedObject::MoveToTemporarySubstream()
 }
 
 if ( aResult.isEmpty() )
-throw uno::RuntimeException();
+throw uno::RuntimeException("Failed to rename temporary storage for 
OLE embed object");
 
 return aResult;
 }
@@ -326,7 +326,7 @@ bool OleEmbeddedObject::TryToConvertToOOo( const 
uno::Reference< io::XStream >&
 aEmbedFactory = aConfigHelper.GetFactoryNameByMediaType( 
aMediaType );
 
 if ( aEmbedFactory.isEmpty() )
-throw uno::RuntimeException();
+throw uno::RuntimeException("Failed to get OLE embedded 
object factory");
 
 uno::Reference< uno::XInterface > xFact = 
m_xContext->getServiceManager()->createInstanceWithContext( aEmbedFactory, 
m_xContext );
 
@@ -858,7 +858,7 @@ void SAL_CALL OleEmbeddedObject::doVerb( sal_Int32 nVerbID )
 
 try {
 if ( !m_pOleComponent )
-throw uno::RuntimeException();
+throw uno::RuntimeException("Null reference to OLE component");
 
 //  the STAMPIT related solution =
 m_aVerbExecutionController.StartControlExecution();


[Libreoffice-commits] core.git: embeddedobj/source include/embeddedobj include/svtools svtools/Library_svt.mk svtools/source

2022-12-22 Thread Stephan Bergmann (via logerrit)
 embeddedobj/source/commonembedding/miscobj.cxx |7 +++
 embeddedobj/source/inc/commonembobj.hxx|7 ++-
 include/svtools/embeddedupdate.hxx |8 ++--
 svtools/Library_svt.mk |1 +
 svtools/source/misc/embeddedupdate.cxx |   22 ++
 svtools/source/misc/embedhlp.cxx   |5 +++--
 6 files changed, 45 insertions(+), 5 deletions(-)

New commits:
commit 73df933f5fa5932f94e5a1b338a3eda00a9ce354
Author: Stephan Bergmann 
AuthorDate: Mon Dec 12 13:23:05 2022 +0100
Commit: Stephan Bergmann 
CommitDate: Thu Dec 22 13:47:26 2022 +

loplugin:unocast (css::embed::EmbeddedUpdate)

(See the upcoming commit introducing that loplugin:unocast on why such
dynamic_casts from UNO types are dangerous.)

Change-Id: Ia0f628be9adf749ffdd9ad36ca9b1e8c98e29936
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144755
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/embeddedobj/source/commonembedding/miscobj.cxx 
b/embeddedobj/source/commonembedding/miscobj.cxx
index ecd149b8bb17..a0cce3c6f34b 100644
--- a/embeddedobj/source/commonembedding/miscobj.cxx
+++ b/embeddedobj/source/commonembedding/miscobj.cxx
@@ -25,11 +25,13 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -762,6 +764,7 @@ uno::Sequence SAL_CALL 
OCommonEmbeddedObject::getTypes()
 cppu::UnoType::get(),
 cppu::UnoType::get(),
 cppu::UnoType::get(),
+cppu::UnoType::get(),
 };
 return aTypes;
 }
@@ -771,6 +774,10 @@ uno::Sequence SAL_CALL 
OCommonEmbeddedObject::getImplementationId()
 return uno::Sequence();
 }
 
+sal_Int64 OCommonEmbeddedObject::getSomething(css::uno::Sequence 
const & aIdentifier) {
+return comphelper::getSomethingImpl(aIdentifier, 
static_cast(this));
+}
+
 void SAL_CALL OCommonEmbeddedObject::initialize(const uno::Sequence& 
rArguments)
 {
 if (!rArguments.hasElements())
diff --git a/embeddedobj/source/inc/commonembobj.hxx 
b/embeddedobj/source/inc/commonembobj.hxx
index 8f0a685c22c3..330dbe7ad829 100644
--- a/embeddedobj/source/inc/commonembobj.hxx
+++ b/embeddedobj/source/inc/commonembobj.hxx
@@ -35,11 +35,12 @@
 #include 
 #include 
 #include 
+#include 
 #include 
-#include 
 #include 
 #include 
 #include 
+#include 
 #include 
 
 namespace com::sun::star {
@@ -87,6 +88,7 @@ class OCommonEmbeddedObject : public 
css::embed::XEmbeddedObject
 , public css::lang::XServiceInfo
 , public css::lang::XInitialization
 , public css::lang::XTypeProvider
+, public css::lang::XUnoTunnel
 , public ::cppu::OWeakObject
 {
 protected:
@@ -434,6 +436,9 @@ public:
 // XTypeProvider
 css::uno::Sequence SAL_CALL getTypes() override;
 css::uno::Sequence SAL_CALL getImplementationId() override;
+
+// XUnoTunnel
+sal_Int64 SAL_CALL getSomething(css::uno::Sequence const & 
aIdentifier) override;
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/embeddedobj/embeddedupdate.hxx 
b/include/svtools/embeddedupdate.hxx
similarity index 87%
rename from include/embeddedobj/embeddedupdate.hxx
rename to include/svtools/embeddedupdate.hxx
index 63e7bf4464c8..95d49d35764a 100644
--- a/include/embeddedobj/embeddedupdate.hxx
+++ b/include/svtools/embeddedupdate.hxx
@@ -9,7 +9,9 @@
 
 #pragma once
 
-#include 
+#include 
+#include 
+#include 
 
 namespace com
 {
@@ -24,7 +26,7 @@ namespace embed
 
 @since LibreOffice 7.4
  */
-class EMBOBJ_DLLPUBLIC SAL_LOPLUGIN_ANNOTATE("crosscast") EmbeddedUpdate
+class SVT_DLLPUBLIC EmbeddedUpdate
 {
 /** By "Refresh all" is used to perform an OLE update and a link update.
 In the case of a link update, the class OCommonEmbeddedObject is
@@ -40,6 +42,8 @@ public:
 EmbeddedUpdate() = default;
 virtual ~EmbeddedUpdate() = default;
 
+static css::uno::Sequence const& getUnoTunnelId();
+
 private:
 EmbeddedUpdate(const EmbeddedUpdate&) = delete;
 EmbeddedUpdate& operator=(const EmbeddedUpdate&) = delete;
diff --git a/svtools/Library_svt.mk b/svtools/Library_svt.mk
index ec2405d65636..94c34808d3df 100644
--- a/svtools/Library_svt.mk
+++ b/svtools/Library_svt.mk
@@ -125,6 +125,7 @@ $(eval $(call gb_Library_add_exception_objects,svt,\
 svtools/source/misc/cliplistener \
 svtools/source/misc/dialogclosedlistener \
 svtools/source/misc/ehdl \
+svtools/source/misc/embeddedupdate \
 svtools/source/misc/embedhlp \
 svtools/source/misc/embedtransfer \
 svtools/source/misc/filechangedchecker \
diff --git a/svtools/source/misc/embeddedupdate.cxx 
b/svtools/source/misc/embeddedupdate.cxx
new file mode 100644
index ..e763ef08e7fd
--- /dev/null
+++ b/svtools/source/misc/embeddedupdate.cxx
@@ -0,0 +1,22 @@

[Libreoffice-commits] core.git: embeddedobj/source extensions/source filter/source

2022-10-18 Thread OmkarAcharekar (via logerrit)
 embeddedobj/source/msole/oleembed.cxx  |2 +-
 extensions/source/abpilot/fieldmappingimpl.cxx |4 ++--
 filter/source/config/cache/typedetection.cxx   |2 +-
 filter/source/msfilter/countryid.cxx   |2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 75e6ffe31d74ac36d8864b018008d4208a7efe73
Author: OmkarAcharekar 
AuthorDate: Tue Oct 18 02:15:51 2022 +0530
Commit: Ilmari Lauhakangas 
CommitDate: Tue Oct 18 14:24:06 2022 +0200

tdf#147021 Use std::size() instead of SAL_N_ELEMENTS() macro

Change-Id: I35c883a1b05a797e83a41698fa205796e681d7c8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141482
Tested-by: Jenkins
Tested-by: Ilmari Lauhakangas 
Reviewed-by: Ilmari Lauhakangas 

diff --git a/embeddedobj/source/msole/oleembed.cxx 
b/embeddedobj/source/msole/oleembed.cxx
index da9b17d8a141..d06969925109 100644
--- a/embeddedobj/source/msole/oleembed.cxx
+++ b/embeddedobj/source/msole/oleembed.cxx
@@ -706,7 +706,7 @@ namespace
 };
 
 bool bCopied = false;
-for (size_t i = 0; i < SAL_N_ELEMENTS(aStreamNames) && !bCopied; ++i)
+for (size_t i = 0; i < std::size(aStreamNames) && !bCopied; ++i)
 {
 uno::Reference xEmbeddedFile;
 try
diff --git a/extensions/source/abpilot/fieldmappingimpl.cxx 
b/extensions/source/abpilot/fieldmappingimpl.cxx
index a60c41b235f2..64197737150e 100644
--- a/extensions/source/abpilot/fieldmappingimpl.cxx
+++ b/extensions/source/abpilot/fieldmappingimpl.cxx
@@ -162,10 +162,10 @@ namespace abp
 _rxContext, sDriverAliasesNodeName, -1, 
OConfigurationTreeRoot::CM_READONLY);
 
 // loop through all programmatic pairs
-DBG_ASSERT( 0 == SAL_N_ELEMENTS( pMappingProgrammatics ) % 2,
+DBG_ASSERT( 0 == std::size( pMappingProgrammatics ) % 2,
 "fieldmapping::defaultMapping: invalid programmatic map!" 
);
 // number of pairs
-sal_Int32 const nIntersectedProgrammatics = SAL_N_ELEMENTS( 
pMappingProgrammatics ) / 2;
+sal_Int32 const nIntersectedProgrammatics =  std::size( 
pMappingProgrammatics ) / 2;
 
 const char** pProgrammatic = pMappingProgrammatics;
 OUString sAddressProgrammatic;
diff --git a/filter/source/config/cache/typedetection.cxx 
b/filter/source/config/cache/typedetection.cxx
index 5acaf88ed5fe..0aaa2ffa6c3d 100644
--- a/filter/source/config/cache/typedetection.cxx
+++ b/filter/source/config/cache/typedetection.cxx
@@ -284,7 +284,7 @@ int getFlatTypeRank(std::u16string_view rType)
 "math_MathType_3x", // MathType equation embedded in Word doc.
 };
 
-size_t n = SAL_N_ELEMENTS(ranks);
+size_t n =  std::size(ranks);
 
 for (size_t i = 0; i < n; ++i)
 {
diff --git a/filter/source/msfilter/countryid.cxx 
b/filter/source/msfilter/countryid.cxx
index 9ad504ab3272..a6f72001db17 100644
--- a/filter/source/msfilter/countryid.cxx
+++ b/filter/source/msfilter/countryid.cxx
@@ -243,7 +243,7 @@ const CountryEntry pTable[] =
 { COUNTRY_UZBEKISTAN,   LANGUAGE_UZBEK_LATIN,   
false   }
 };
 
-const CountryEntry * const pEnd = pTable + SAL_N_ELEMENTS( pTable );
+const CountryEntry * const pEnd = pTable +  std::size( pTable );
 
 /** Predicate comparing a country ID with the member of a CountryEntry. */
 struct CountryEntryPred_Country


[Libreoffice-commits] core.git: embeddedobj/source

2022-09-12 Thread Andrea Gelmini (via logerrit)
 embeddedobj/source/msole/olecomponent.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit b9c37f62bf4e60ddde3925137727e4394be85cbb
Author: Andrea Gelmini 
AuthorDate: Mon Sep 12 10:32:02 2022 +0200
Commit: Julien Nabet 
CommitDate: Mon Sep 12 21:01:34 2022 +0200

Fix typo

Change-Id: I7c98360de8f476ddb5e9eaa9c3c7e8bf0f5cdc2e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139788
Tested-by: Julien Nabet 
Reviewed-by: Julien Nabet 

diff --git a/embeddedobj/source/msole/olecomponent.cxx 
b/embeddedobj/source/msole/olecomponent.cxx
index f3111302355f..fcd659e369a3 100644
--- a/embeddedobj/source/msole/olecomponent.cxx
+++ b/embeddedobj/source/msole/olecomponent.cxx
@@ -595,7 +595,7 @@ namespace
 // Workaround it here to avoid crash in smart COM pointer destructor 
that
 // would try to release already released object. Since we don't know if
 // the bug appears each time STG_E_FILENOTFOUND is returned, this might
-// potentially leak the storge object.
+// potentially leak the storage object.
 if (pIStorage)
 pIStorage->AddRef();
 


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

2022-09-10 Thread Mike Kaganski (via logerrit)
 embeddedobj/source/msole/olecomponent.cxx  |   15 
+-
 sw/qa/extras/ooxmlimport/data/tdf119039_bad_embedded_compound.docx |binary
 sw/qa/extras/ooxmlimport/ooxmlimport2.cxx  |7 
 3 files changed, 21 insertions(+), 1 deletion(-)

New commits:
commit b31992ea518cec906a65ef971a637d0529302a2c
Author: Mike Kaganski 
AuthorDate: Sat Sep 10 22:56:17 2022 +0300
Commit: Mike Kaganski 
CommitDate: Sat Sep 10 23:38:24 2022 +0200

tdf#119039: workaround an OleLoad bug releasing passed storage unexpectedly

See https://developercommunity.visualstudio.com/t/10144795

Change-Id: I75ee88c1dd50e0772c358967ac09b7788156d9f0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139756
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/embeddedobj/source/msole/olecomponent.cxx 
b/embeddedobj/source/msole/olecomponent.cxx
index 1aec0c704926..f3111302355f 100644
--- a/embeddedobj/source/msole/olecomponent.cxx
+++ b/embeddedobj/source/msole/olecomponent.cxx
@@ -589,11 +589,24 @@ namespace
 HRESULT OleLoadSeh(LPSTORAGE pIStorage, LPVOID* ppObj)
 {
 HRESULT hr = E_FAIL;
+// tdf#119039: there is a nasty bug in OleLoad, that may call an 
unpaired
+// IUnknown::Release on pIStorage on STG_E_FILENOTFOUND: see
+// https://developercommunity.visualstudio.com/t/10144795
+// Workaround it here to avoid crash in smart COM pointer destructor 
that
+// would try to release already released object. Since we don't know if
+// the bug appears each time STG_E_FILENOTFOUND is returned, this might
+// potentially leak the storge object.
+if (pIStorage)
+pIStorage->AddRef();
+
 __try {
 hr = OleLoad(pIStorage, IID_IUnknown, nullptr, ppObj);
 } __except( EXCEPTION_EXECUTE_HANDLER ) {
-return E_FAIL;
+hr = E_FAIL;
 }
+if (pIStorage && hr != STG_E_FILENOTFOUND)
+pIStorage->Release();
+
 return hr;
 }
 }
diff --git a/sw/qa/extras/ooxmlimport/data/tdf119039_bad_embedded_compound.docx 
b/sw/qa/extras/ooxmlimport/data/tdf119039_bad_embedded_compound.docx
new file mode 100644
index ..c0cda280d447
Binary files /dev/null and 
b/sw/qa/extras/ooxmlimport/data/tdf119039_bad_embedded_compound.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
index fd148cd8db49..62ae3250af73 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
@@ -934,6 +934,13 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf126426)
 CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), getProperty(xRun, 
"CharColor"));
 }
 }
+
+CPPUNIT_TEST_FIXTURE(Test, testTdf119039)
+{
+load(mpTestDocumentPath, "tdf119039_bad_embedded_compound.docx");
+// Should not crash/hang because of problematic embedded compound
+}
+
 // tests should only be added to ooxmlIMPORT *if* they fail round-tripping in 
ooxmlEXPORT
 
 CPPUNIT_PLUGIN_IMPLEMENT();


[Libreoffice-commits] core.git: embeddedobj/source ucbhelper/source

2022-05-24 Thread Noel Grandin (via logerrit)
 embeddedobj/source/commonembedding/persistence.cxx |   17 +++--
 ucbhelper/source/client/content.cxx|3 ++-
 2 files changed, 13 insertions(+), 7 deletions(-)

New commits:
commit b4ae96a261ccb7bbaaa2f7bc844a6a0e973755d5
Author: Noel Grandin 
AuthorDate: Tue May 24 09:58:54 2022 +0200
Commit: Noel Grandin 
CommitDate: Tue May 24 13:13:00 2022 +0200

elide some OUString allocation

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

diff --git a/embeddedobj/source/commonembedding/persistence.cxx 
b/embeddedobj/source/commonembedding/persistence.cxx
index e49e5169cc79..65e88266a78f 100644
--- a/embeddedobj/source/commonembedding/persistence.cxx
+++ b/embeddedobj/source/commonembedding/persistence.cxx
@@ -778,14 +778,19 @@ void OCommonEmbeddedObject::StoreDocToStorage_Impl(
 if ( aFilterName.isEmpty() )
 throw io::IOException(); // TODO:
 
+static constexpr OUStringLiteral sFilterName = u"FilterName";
+static constexpr OUStringLiteral sHierarchicalDocumentName = 
u"HierarchicalDocumentName";
+static constexpr OUStringLiteral sDocumentBaseURL = u"DocumentBaseURL";
+static constexpr OUStringLiteral sSourceShellID = u"SourceShellID";
+static constexpr OUStringLiteral sDestinationShellID = 
u"DestinationShellID";
 uno::Sequence aArgs{
-comphelper::makePropertyValue("FilterName", aFilterName),
-comphelper::makePropertyValue("HierarchicalDocumentName", 
aHierarchName),
-comphelper::makePropertyValue("DocumentBaseURL", aBaseURL),
-comphelper::makePropertyValue("SourceShellID",
-  getStringPropertyValue(rObjArgs, 
u"SourceShellID")),
+comphelper::makePropertyValue(sFilterName, aFilterName),
+comphelper::makePropertyValue(sHierarchicalDocumentName, 
aHierarchName),
+comphelper::makePropertyValue(sDocumentBaseURL, aBaseURL),
+comphelper::makePropertyValue(sSourceShellID,
+  getStringPropertyValue(rObjArgs, 
sSourceShellID)),
 comphelper::makePropertyValue(
-"DestinationShellID", getStringPropertyValue(rObjArgs, 
u"DestinationShellID"))
+sDestinationShellID, getStringPropertyValue(rObjArgs, 
sDestinationShellID))
 };
 
 xDoc->storeToStorage( xStorage, aArgs );
diff --git a/ucbhelper/source/client/content.cxx 
b/ucbhelper/source/client/content.cxx
index 7f3268c41754..4eeeab2008d6 100644
--- a/ucbhelper/source/client/content.cxx
+++ b/ucbhelper/source/client/content.cxx
@@ -491,8 +491,9 @@ Reference< XRow > Content::getPropertyValuesInterface(
 //rProp.Attributes = ;
 }
 
+static constexpr OUStringLiteral sgetPropertyValues = u"getPropertyValues";
 Command aCommand;
-aCommand.Name = "getPropertyValues";
+aCommand.Name = sgetPropertyValues;
 aCommand.Handle   = -1; // n/a
 aCommand.Argument <<= aProps;
 


[Libreoffice-commits] core.git: embeddedobj/source

2022-05-24 Thread Noel Grandin (via logerrit)
 embeddedobj/source/commonembedding/embedobj.cxx |   72 +---
 embeddedobj/source/commonembedding/miscobj.cxx  |   36 
 embeddedobj/source/inc/commonembobj.hxx |2 
 3 files changed, 64 insertions(+), 46 deletions(-)

New commits:
commit c59ede12ff06f7c10670d9ea8a631b25237e9f02
Author: Noel Grandin 
AuthorDate: Mon May 23 17:18:32 2022 +0200
Commit: Noel Grandin 
CommitDate: Tue May 24 08:07:49 2022 +0200

this data does not need to be per-object

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

diff --git a/embeddedobj/source/commonembedding/embedobj.cxx 
b/embeddedobj/source/commonembedding/embedobj.cxx
index 240112b2483e..0b1cb5785dac 100644
--- a/embeddedobj/source/commonembedding/embedobj.cxx
+++ b/embeddedobj/source/commonembedding/embedobj.cxx
@@ -48,6 +48,7 @@
 #include 
 #include "embedobj.hxx"
 #include 
+#include 
 
 using namespace ::com::sun::star;
 
@@ -71,6 +72,60 @@ awt::Rectangle GetRectangleInterception( const 
awt::Rectangle& aRect1, const awt
 return aResult;
 }
 
+namespace
+{
+using IntermediateStatesMap = std::array, NUM_SUPPORTED_STATES>, NUM_SUPPORTED_STATES>;
+const IntermediateStatesMap & getIntermediateStatesMap()
+{
+static const IntermediateStatesMap map = [] () {
+IntermediateStatesMap tmp;
+
+// intermediate states
+// In the following table the first index points to starting state,
+// the second one to the target state, and the sequence referenced 
by
+// first two indexes contains intermediate states, that should be
+// passed by object to reach the target state.
+// If the sequence is empty that means that indirect switch from 
start
+// state to the target state is forbidden, only if direct switch 
is possible
+// the state can be reached.
+
+tmp[0][2] = { embed::EmbedStates::RUNNING };
+
+tmp[0][3] = { embed::EmbedStates::RUNNING,
+
embed::EmbedStates::INPLACE_ACTIVE };
+
+tmp[0][4] = {embed::EmbedStates::RUNNING};
+
+tmp[1][3] = { embed::EmbedStates::INPLACE_ACTIVE };
+
+tmp[2][0] = { embed::EmbedStates::RUNNING };
+
+tmp[3][0] = { embed::EmbedStates::INPLACE_ACTIVE,
+embed::EmbedStates::RUNNING };
+
+tmp[3][1] = { embed::EmbedStates::INPLACE_ACTIVE };
+
+tmp[4][0] = { embed::EmbedStates::RUNNING };
+
+return tmp;
+}();
+return map;
+}
+
+// accepted states
+const css::uno::Sequence< sal_Int32 > & getAcceptedStates()
+{
+static const css::uno::Sequence< sal_Int32 > states {
+/* [0] */ embed::EmbedStates::LOADED,
+  /* [1] */ embed::EmbedStates::RUNNING,
+  /* [2] */ embed::EmbedStates::INPLACE_ACTIVE,
+  /* [3] */ embed::EmbedStates::UI_ACTIVE,
+  /* [4] */ embed::EmbedStates::ACTIVE };
+assert(states.getLength() == NUM_SUPPORTED_STATES);
+return states;
+}
+
+}
 
 sal_Int32 OCommonEmbeddedObject::ConvertVerbToState_Impl( sal_Int32 nVerb )
 {
@@ -389,27 +444,28 @@ void OCommonEmbeddedObject::SwitchStateTo_Impl( sal_Int32 
nNextState )
 uno::Sequence< sal_Int32 > const & 
OCommonEmbeddedObject::GetIntermediateStatesSequence_Impl( sal_Int32 nNewState )
 {
 sal_Int32 nCurInd = 0;
-for ( nCurInd = 0; nCurInd < m_aAcceptedStates.getLength(); nCurInd++ )
-if ( m_aAcceptedStates[nCurInd] == m_nObjectState )
+auto & rAcceptedStates = getAcceptedStates();
+for ( nCurInd = 0; nCurInd < rAcceptedStates.getLength(); nCurInd++ )
+if ( rAcceptedStates[nCurInd] == m_nObjectState )
 break;
 
-if ( nCurInd == m_aAcceptedStates.getLength() )
+if ( nCurInd == rAcceptedStates.getLength() )
 throw embed::WrongStateException( "The object is in unacceptable 
state!",
   static_cast< ::cppu::OWeakObject* 
>(this) );
 
 sal_Int32 nDestInd = 0;
-for ( nDestInd = 0; nDestInd < m_aAcceptedStates.getLength(); nDestInd++ )
-if ( m_aAcceptedStates[nDestInd] == nNewState )
+for ( nDestInd = 0; nDestInd < rAcceptedStates.getLength(); nDestInd++ )
+if ( rAcceptedStates[nDestInd] == nNewState )
 break;
 
-if ( nDestInd == m_aAcceptedStates.getLength() )
+if ( nDestInd == rAcceptedStates.getLength() )
 throw embed::UnreachableStateException(
 "The state either not reachable, or the object allows the state 
only as an intermediate one!",
 static_cast< ::cppu::OWeakObject* >(this),
 m_nObjectState,
 nNewState );
 
-return 

[Libreoffice-commits] core.git: embeddedobj/source include/svtools

2022-05-11 Thread Andrea Gelmini (via logerrit)
 embeddedobj/source/commonembedding/miscobj.cxx |2 +-
 include/svtools/embedhlp.hxx   |2 +-
 include/svtools/filechangedchecker.hxx |2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

New commits:
commit c61a88d9d23366274d4d2283a961a578911e5ddc
Author: Andrea Gelmini 
AuthorDate: Tue May 10 10:17:41 2022 +0200
Commit: Bartosz Kosiorek 
CommitDate: Wed May 11 10:25:52 2022 +0200

Fix typos

Change-Id: Ie15016f4cbed703f15d7d47c25b7bfc2b41dbadb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134106
Tested-by: Jenkins
Reviewed-by: Bartosz Kosiorek 

diff --git a/embeddedobj/source/commonembedding/miscobj.cxx 
b/embeddedobj/source/commonembedding/miscobj.cxx
index f41d35957b5d..d8d9a74700c1 100644
--- a/embeddedobj/source/commonembedding/miscobj.cxx
+++ b/embeddedobj/source/commonembedding/miscobj.cxx
@@ -436,7 +436,7 @@ void OCommonEmbeddedObject::handleLinkedOLE( 
CopyBackToOLELink eState )
 else if ( ( eState == CopyBackToOLELink::CopyLinkToTemp ) && bTmpFileChg )
 {
 // Refresh pressed,  but the Temp-file is changed, question to user 
for overwrite
-// it is not importent it has bLnkFileChg, always overwite the 
temp-file
+// it is not important it has bLnkFileChg, always overwrite the 
temp-file
 if ( ShowMsgDialog( STR_OVERWRITE_TEMP, m_aLinkURL ) == RET_CANCEL )
 eState = CopyBackToOLELink::NoCopy;
 }
diff --git a/include/svtools/embedhlp.hxx b/include/svtools/embedhlp.hxx
index 4930e5b7630b..e87ebfbf9b6e 100644
--- a/include/svtools/embedhlp.hxx
+++ b/include/svtools/embedhlp.hxx
@@ -102,7 +102,7 @@ public:
 const css::uno::Reference< css::io::XInputStream >& 
xInGrStream,
 const OUString& rMediaType );
 
-// bUpdateOle = false udate the Link-Objects
+// bUpdateOle = false update the Link-Objects
 //= true  update the OLE-Objects
 voidUpdateReplacement( bool bUpdateOle = false );
 voidUpdateReplacementOnDemand();
diff --git a/include/svtools/filechangedchecker.hxx 
b/include/svtools/filechangedchecker.hxx
index 9800654678fa..d50fea631a92 100644
--- a/include/svtools/filechangedchecker.hxx
+++ b/include/svtools/filechangedchecker.hxx
@@ -40,6 +40,6 @@ public:
 bool hasFileChanged(bool bUpdate = true);
 FileChangedChecker(const OUString& rFilename,
 const ::std::function& rCallback);
-// with out Timer function
+// without Timer function
 FileChangedChecker(const OUString& rFilename);
 };


[Libreoffice-commits] core.git: embeddedobj/source

2022-05-04 Thread Stephan Bergmann (via logerrit)
 embeddedobj/source/general/docholder.cxx |2 +-
 embeddedobj/source/msole/oleembed.cxx|2 +-
 embeddedobj/source/msole/olepersist.cxx  |8 
 3 files changed, 6 insertions(+), 6 deletions(-)

New commits:
commit 5c1c4402809eebb092f9bba812fa0b07a3196343
Author: Stephan Bergmann 
AuthorDate: Wed May 4 12:02:34 2022 +0200
Commit: Stephan Bergmann 
CommitDate: Wed May 4 14:39:24 2022 +0200

Just use Any ctor instead of makeAny in embeddedobj

Change-Id: I7e00a4b17b9fc3ccfb360ae5737d253a7d31d02b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133819
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/embeddedobj/source/general/docholder.cxx 
b/embeddedobj/source/general/docholder.cxx
index 78f73b88a5a6..ee1a8dfa6ad1 100644
--- a/embeddedobj/source/general/docholder.cxx
+++ b/embeddedobj/source/general/docholder.cxx
@@ -144,7 +144,7 @@ static void InsertMenu_Impl( const uno::Reference< 
container::XIndexContainer >&
 pTargetProps[nInd-1].Value <<= xSourceDisp;
 }
 
-xTargetMenu->insertByIndex( nTargetIndex, uno::makeAny( aTargetProps ) );
+xTargetMenu->insertByIndex( nTargetIndex, uno::Any( aTargetProps ) );
 }
 
 
diff --git a/embeddedobj/source/msole/oleembed.cxx 
b/embeddedobj/source/msole/oleembed.cxx
index b3e4db405015..6a3f4e9264e7 100644
--- a/embeddedobj/source/msole/oleembed.cxx
+++ b/embeddedobj/source/msole/oleembed.cxx
@@ -286,7 +286,7 @@ bool OleEmbeddedObject::TryToConvertToOOo( const 
uno::Reference< io::XStream >&
 {
 // create the model
 uno::Sequence< uno::Any > aArguments{ uno::Any(
-beans::NamedValue( "EmbeddedObject", uno::makeAny( true 
))) };
+beans::NamedValue( "EmbeddedObject", uno::Any( true ))) };
 
 uno::Reference< util::XCloseable > xDocument( 
m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext( 
aDocServiceName, aArguments, m_xContext ), uno::UNO_QUERY_THROW );
 uno::Reference< frame::XLoadable > xLoadable( xDocument, 
uno::UNO_QUERY_THROW );
diff --git a/embeddedobj/source/msole/olepersist.cxx 
b/embeddedobj/source/msole/olepersist.cxx
index 4394486c21b2..86403f41bb3e 100644
--- a/embeddedobj/source/msole/olepersist.cxx
+++ b/embeddedobj/source/msole/olepersist.cxx
@@ -188,7 +188,7 @@ static OUString GetNewFilledTempFile_Impl( const 
uno::Reference< embed::XOptimiz
 static void SetStreamMediaType_Impl( const uno::Reference< io::XStream >& 
xStream, const OUString& aMediaType )
 {
 uno::Reference< beans::XPropertySet > xPropSet( xStream, 
uno::UNO_QUERY_THROW );
-xPropSet->setPropertyValue("MediaType", uno::makeAny( aMediaType ) );
+xPropSet->setPropertyValue("MediaType", uno::Any( aMediaType ) );
 }
 #endif
 
@@ -196,7 +196,7 @@ static void LetCommonStoragePassBeUsed_Impl( const 
uno::Reference< io::XStream >
 {
 uno::Reference< beans::XPropertySet > xPropSet( xStream, 
uno::UNO_QUERY_THROW );
 xPropSet->setPropertyValue("UseCommonStoragePasswordEncryption",
-uno::makeAny( true ) );
+uno::Any( true ) );
 }
 #ifdef _WIN32
 
@@ -485,9 +485,9 @@ void OleEmbeddedObject::InsertVisualCache_Impl( const 
uno::Reference< io::XStrea
 // insert the result file as replacement image
 OUString aCacheName = "\002OlePres000";
 if ( xNameContainer->hasByName( aCacheName ) )
-xNameContainer->replaceByName( aCacheName, uno::makeAny( xTempFile ) );
+xNameContainer->replaceByName( aCacheName, uno::Any( xTempFile ) );
 else
-xNameContainer->insertByName( aCacheName, uno::makeAny( xTempFile ) );
+xNameContainer->insertByName( aCacheName, uno::Any( xTempFile ) );
 
 uno::Reference< embed::XTransactedObject > xTransacted( xNameContainer, 
uno::UNO_QUERY_THROW );
 xTransacted->commit();


[Libreoffice-commits] core.git: embeddedobj/source

2022-05-02 Thread Stephan Bergmann (via logerrit)
 embeddedobj/source/msole/graphconvert.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 8e08e6c0ce6a7e5190cd9db7dc76e9774e9bb5a8
Author: Stephan Bergmann 
AuthorDate: Mon May 2 08:51:29 2022 +0200
Commit: Stephan Bergmann 
CommitDate: Mon May 2 17:51:11 2022 +0200

loplugin:stringview

Change-Id: I266dc947f9590f869ca7245d776263c692f02be5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133688
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/embeddedobj/source/msole/graphconvert.cxx 
b/embeddedobj/source/msole/graphconvert.cxx
index cadc1f946de9..f853f03dc19b 100644
--- a/embeddedobj/source/msole/graphconvert.cxx
+++ b/embeddedobj/source/msole/graphconvert.cxx
@@ -54,7 +54,7 @@ bool ConvertBufferToFormat( void* pBuf,
 SvMemoryStream aMemoryStream(pBuf, nBufSize, StreamMode::READ);
 GraphicFilter& rFilter = GraphicFilter::GetGraphicFilter();
 sal_uInt16 nRetFormat = 0;
-if (rFilter.CanImportGraphic(OUString(), aMemoryStream, 
GRFILTER_FORMAT_DONTKNOW, ) == ERRCODE_NONE &&
+if (rFilter.CanImportGraphic(u"", aMemoryStream, 
GRFILTER_FORMAT_DONTKNOW, ) == ERRCODE_NONE &&
 rFilter.GetImportFormatMediaType(nRetFormat) == aMimeType)
 {
 aResult <<= uno::Sequence< sal_Int8 >( static_cast< const 
sal_Int8* >( aMemoryStream.GetData() ), aMemoryStream.TellEnd() );


[Libreoffice-commits] core.git: embeddedobj/source

2022-03-21 Thread Juergen Funk (via logerrit)
 embeddedobj/source/commonembedding/miscobj.cxx |8 
 embeddedobj/source/commonembedding/persistence.cxx |   11 +--
 2 files changed, 9 insertions(+), 10 deletions(-)

New commits:
commit 0498c522724bbfd789261cb1562b3bfe1a81bb3e
Author: Juergen Funk 
AuthorDate: Wed Feb 23 05:49:46 2022 +0100
Commit: Thorsten Behrens 
CommitDate: Mon Mar 21 10:25:03 2022 +0100

tdf#147589 In document with OLE link, don't show temp-file is in use

Regression from 218f36dd614cf828e949f605faaf6a6fd615da26
change the handling in OTempFileService::closeOutput
That was the problem in the OLE-Link handling

Change-Id: I5a7fa74b4a731f758e1c405dfb9cd298b30086a3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130408
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens 

diff --git a/embeddedobj/source/commonembedding/miscobj.cxx 
b/embeddedobj/source/commonembedding/miscobj.cxx
index d65380cdc87e..a5d5573416d1 100644
--- a/embeddedobj/source/commonembedding/miscobj.cxx
+++ b/embeddedobj/source/commonembedding/miscobj.cxx
@@ -231,14 +231,14 @@ void OCommonEmbeddedObject::LinkInit_Impl(
 {
 // create temporary file
 m_aLinkTempFile = io::TempFile::create(m_xContext);
+uno::Reference< ucb::XSimpleFileAccess > 
xTempOutAccess(ucb::SimpleFileAccess::create(m_xContext));
+// if the temp stream is used, then the temp file remains locked
+uno::Reference< io::XOutputStream > 
xOutStream(xTempOutAccess->openFileWrite(m_aLinkTempFile->getUri()));
 
 if(m_aLinkTempFile.is())
 {
 // completely copy content of original OLE data
-uno::Reference < io::XOutputStream > xTempOut = 
m_aLinkTempFile->getOutputStream();
-::comphelper::OStorageHelper::CopyInputToOutput( xInStream, 
xTempOut );
-xTempOut->flush();
-xTempOut->closeOutput();
+::comphelper::OStorageHelper::CopyInputToOutput(xInStream, 
xOutStream);
 
 // reset flag m_bLinkTempFileChanged, so it will also work for 
multiple
 // save op's of the containing file/document
diff --git a/embeddedobj/source/commonembedding/persistence.cxx 
b/embeddedobj/source/commonembedding/persistence.cxx
index 2aeb60e8eda0..77bc947650af 100644
--- a/embeddedobj/source/commonembedding/persistence.cxx
+++ b/embeddedobj/source/commonembedding/persistence.cxx
@@ -1284,18 +1284,17 @@ void SAL_CALL OCommonEmbeddedObject::storeAsEntry( 
const uno::Reference< embed::
 // tdf#141529 if we have a changed copy of the original OLE data 
we now
 // need to write it back 'over' the original OLE data
 uno::Reference < ucb::XSimpleFileAccess2 > 
xFileAccess(ucb::SimpleFileAccess::create( m_xContext ));
-uno::Reference < io::XInputStream > xTempIn = 
m_aLinkTempFile->getInputStream();
 
+uno::Reference< ucb::XSimpleFileAccess > 
xTempAccess(ucb::SimpleFileAccess::create(m_xContext));
+// if the temp stream is used, then the temp file remains locked
+uno::Reference< io::XInputStream > 
xInStream(xTempAccess->openFileRead(m_aLinkTempFile->getUri()));
 // This is *needed* since OTempFileService calls 
OTempFileService::readBytes which
 // ensures the SvStream mpStream gets/is opened, *but* also sets 
the mnCachedPos from
 // OTempFileService which still points to the end-of-file (from 
write-cc'ing).
-uno::Reference < io::XSeekable > xSeek( xTempIn, 
uno::UNO_QUERY_THROW );
+uno::Reference < io::XSeekable > xSeek( xInStream, 
uno::UNO_QUERY_THROW );
 xSeek->seek(0);
 
-xFileAccess->writeFile(m_aLinkURL, xTempIn);
-
-// Do *not* close input, that would remove the temporary file too 
early
-// xTempIn->closeInput();
+xFileAccess->writeFile(m_aLinkURL, xInStream);
 
 // reset flag m_bLinkTempFileChanged
 m_bLinkTempFileChanged = false;


[Libreoffice-commits] core.git: embeddedobj/source

2021-12-06 Thread Noel Grandin (via logerrit)
 embeddedobj/source/general/intercept.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 4539ffe350ebe28ff6d0f5cd4a6c3d45c1424fba
Author: Noel Grandin 
AuthorDate: Wed Dec 1 22:00:10 2021 +0200
Commit: Noel Grandin 
CommitDate: Sat Dec 4 13:32:05 2021 +0100

use OMultiTypeInterfaceContainerHelperVar3 in Interceptor

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

diff --git a/embeddedobj/source/general/intercept.cxx 
b/embeddedobj/source/general/intercept.cxx
index 68e9af7e4334..3c4990031376 100644
--- a/embeddedobj/source/general/intercept.cxx
+++ b/embeddedobj/source/general/intercept.cxx
@@ -18,7 +18,7 @@
  */
 
 #include 
-#include 
+#include 
 
 #include 
 #include 
@@ -35,11 +35,11 @@ constexpr OUStringLiteral IU5 = u".uno:SaveAs";
 const uno::Sequence< OUString > Interceptor::m_aInterceptedURL{ IU0, IU1, IU2, 
IU3, IU4, IU5 };
 
 class StatusChangeListenerContainer
-: public comphelper::OMultiTypeInterfaceContainerHelperVar2
+: public 
comphelper::OMultiTypeInterfaceContainerHelperVar3
 {
 public:
 explicit StatusChangeListenerContainer(osl::Mutex& aMutex)
-:  comphelper::OMultiTypeInterfaceContainerHelperVar2(aMutex)
+:  
comphelper::OMultiTypeInterfaceContainerHelperVar3(aMutex)
 {
 }
 };


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

2021-11-26 Thread Miklos Vajna (via logerrit)
 embeddedobj/source/commonembedding/miscobj.cxx |   22 +
 embeddedobj/source/commonembedding/persistence.cxx |5 
 embeddedobj/source/inc/commonembobj.hxx|5 
 sw/source/uibase/wrtsh/wrtsh1.cxx  |   10 +
 4 files changed, 42 insertions(+)

New commits:
commit 32842d4bf250bcab281eb71a218d618485c60290
Author: Miklos Vajna 
AuthorDate: Fri Nov 26 08:45:24 2021 +0100
Commit: Miklos Vajna 
CommitDate: Fri Nov 26 09:33:49 2021 +0100

sw, viewing OLE objects: also protect "common" embeded objects

Commit 4f9f1ac33366817df61c488a9f36b09c592ee939 (sw: allow viewing OLE
objects in protected sections, 2021-11-25) allowed launching OLE objects
in protected sections, and then made sure that changes done in "real"
OLE editors (on Windows) are discarded: both the native data and
preview.

Extend this mechanism to also handle common embedded objects (i.e. when
we load the data into an own document model, like Calc-in-Writer on
Linux): there we can simply load the data read-only, so there will be no
need to discard anything.

This requires some way to pass down the read-only flag from sw/ to
embeddedobj, implement XInitialization on OCommonEmbeddedObject to do
that.

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

diff --git a/embeddedobj/source/commonembedding/miscobj.cxx 
b/embeddedobj/source/commonembedding/miscobj.cxx
index 9c24185ed184..538e0b72e3da 100644
--- a/embeddedobj/source/commonembedding/miscobj.cxx
+++ b/embeddedobj/source/commonembedding/miscobj.cxx
@@ -39,6 +39,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "persistence.hxx"
 
@@ -398,6 +399,11 @@ uno::Any SAL_CALL OCommonEmbeddedObject::queryInterface( 
const uno::Type& rType
 void* p = static_cast(this);
 return uno::Any(, rType);
 }
+else if (rType == cppu::UnoType::get())
+{
+void* p = static_cast(this);
+return uno::Any(, rType);
+}
 else if (rType == cppu::UnoType::get())
 {
 void* p = static_cast(this);
@@ -671,6 +677,7 @@ uno::Sequence SAL_CALL 
OCommonEmbeddedObject::getTypes()
 cppu::UnoType::get(),
 cppu::UnoType::get(),
 cppu::UnoType::get(),
+cppu::UnoType::get(),
 cppu::UnoType::get(),
 };
 return aTypes;
@@ -681,4 +688,19 @@ uno::Sequence SAL_CALL 
OCommonEmbeddedObject::getImplementationId()
 return uno::Sequence();
 }
 
+void SAL_CALL OCommonEmbeddedObject::initialize(const uno::Sequence& 
rArguments)
+{
+if (!rArguments.hasElements())
+{
+return;
+}
+
+comphelper::SequenceAsHashMap aMap(rArguments[0]);
+auto it = aMap.find("ReadOnly");
+if (it != aMap.end())
+{
+it->second >>= m_bReadOnly;
+}
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/embeddedobj/source/commonembedding/persistence.cxx 
b/embeddedobj/source/commonembedding/persistence.cxx
index 2ed891d33ced..faf3209e1f32 100644
--- a/embeddedobj/source/commonembedding/persistence.cxx
+++ b/embeddedobj/source/commonembedding/persistence.cxx
@@ -534,6 +534,11 @@ uno::Reference< util::XCloseable > 
OCommonEmbeddedObject::LoadDocumentFromStorag
 // set the document mode to embedded as the first step!!!
 EmbedAndReparentDoc_Impl( xDocument );
 
+if (m_bReadOnly)
+{
+aLoadArgs.put("ReadOnly", true);
+}
+
 if ( xDoc.is() )
 {
 xDoc->loadFromStorage( xSourceStorage, 
aLoadArgs.getPropertyValues() );
diff --git a/embeddedobj/source/inc/commonembobj.hxx 
b/embeddedobj/source/inc/commonembobj.hxx
index fab8ccbc717e..785a28eaf0fd 100644
--- a/embeddedobj/source/inc/commonembobj.hxx
+++ b/embeddedobj/source/inc/commonembobj.hxx
@@ -34,6 +34,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -81,6 +82,7 @@ class OCommonEmbeddedObject : public 
css::embed::XEmbeddedObject
 , public css::container::XChild
 , public css::chart2::XDefaultSizeTransmitter
 , public css::lang::XServiceInfo
+, public css::lang::XInitialization
 , public css::lang::XTypeProvider
 , public ::cppu::OWeakObject
 {
@@ -408,6 +410,9 @@ public:
 sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
 css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() 
override;
 
+// XInitialization
+void SAL_CALL initialize(const css::uno::Sequence& 
rArguments) override;
+
 // XTypeProvider
 css::uno::Sequence SAL_CALL getTypes() override;
 css::uno::Sequence SAL_CALL getImplementationId() override;
diff --git 

[Libreoffice-commits] core.git: embeddedobj/source filter/source sd/source sw/source testtools/source

2021-11-12 Thread Caolán McNamara (via logerrit)
 embeddedobj/source/msole/ownview.cxx |1 +
 filter/source/msfilter/mscodec.cxx   |1 +
 sd/source/filter/eppt/eppt.cxx   |1 +
 sw/source/filter/ww8/docxattributeoutput.cxx |4 
 testtools/source/bridgetest/bridgetest.cxx   |1 +
 5 files changed, 8 insertions(+)

New commits:
commit 9871789e0f9256ac27ea7bc4590ba910d6e4c373
Author: Caolán McNamara 
AuthorDate: Thu Nov 11 21:08:58 2021 +
Commit: Caolán McNamara 
CommitDate: Fri Nov 12 09:36:29 2021 +0100

coverity: annotate with markup so they will stay silenced

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

diff --git a/embeddedobj/source/msole/ownview.cxx 
b/embeddedobj/source/msole/ownview.cxx
index ed794a74e07a..4aaf35499124 100644
--- a/embeddedobj/source/msole/ownview.cxx
+++ b/embeddedobj/source/msole/ownview.cxx
@@ -412,6 +412,7 @@ void OwnView_Impl::CreateNative()
 {
 sal_uInt8 const aClassID[] =
 { 0x00, 0x03, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x46 };
+// coverity[overrun-buffer-arg : FALSE] - coverity has difficulty 
with css::uno::Sequence
 uno::Sequence< sal_Int8 > aPackageClassID( 
reinterpret_cast(aClassID), 16 );
 
 uno::Reference< io::XStream > xSubStream;
diff --git a/filter/source/msfilter/mscodec.cxx 
b/filter/source/msfilter/mscodec.cxx
index b59b7dc73ad9..7aad72ba2dc7 100644
--- a/filter/source/msfilter/mscodec.cxx
+++ b/filter/source/msfilter/mscodec.cxx
@@ -185,6 +185,7 @@ bool MSCodec_Xor95::InitCodec( const uno::Sequence< 
beans::NamedValue >& aData )
 uno::Sequence< beans::NamedValue > MSCodec_Xor95::GetEncryptionData()
 {
 ::comphelper::SequenceAsHashMap aHashData;
+// coverity[overrun-buffer-arg : FALSE] - coverity has difficulty with 
css::uno::Sequence
 aHashData[ OUString( "XOR95EncryptionKey" ) ] <<= uno::Sequence( 
reinterpret_cast(mpnKey), 16 );
 aHashData[ OUString( "XOR95BaseKey" ) ] <<= static_cast(mnKey);
 aHashData[ OUString( "XOR95PasswordHash" ) ] <<= 
static_cast(mnHash);
diff --git a/sd/source/filter/eppt/eppt.cxx b/sd/source/filter/eppt/eppt.cxx
index 423a90f3a65a..117c39d34453 100644
--- a/sd/source/filter/eppt/eppt.cxx
+++ b/sd/source/filter/eppt/eppt.cxx
@@ -506,6 +506,7 @@ void PPTWriter::ImplCreateDocumentSummaryInformation()
 'A',0,'1',0,'E',0,'F',0,'-',0,'0',0,'0',0,'6',0,'0',0,'9',0,
 '7',0,'D',0,'A',0,'5',0,'6',0,'8',0,'9',0,'}',0
 };
+// coverity[overrun-buffer-arg : FALSE] - coverity has difficulty with 
css::uno::Sequence
 uno::Sequence aGuidSeq(aGuid, 0x52);
 
 SvMemoryStream  aHyperBlob;
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index b2b7a047b0f2..de61bb748814 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -1140,6 +1140,7 @@ void 
DocxAttributeOutput::InitCollectedParagraphProperties()
 
 // postpone the output so that we can later [in EndParagraphProperties()]
 // prepend the properties before the run
+// coverity[overrun-buffer-arg : FALSE] - coverity has difficulty with 
css::uno::Sequence
 m_pSerializer->mark(Tag_InitCollectedParagraphProperties, 
comphelper::containerToSequence(aOrder));
 }
 
@@ -2538,6 +2539,7 @@ void DocxAttributeOutput::InitCollectedRunProperties()
 
 // postpone the output so that we can later [in EndParagraphProperties()]
 // prepend the properties before the run
+// coverity[overrun-buffer-arg : FALSE] - coverity has difficulty with 
css::uno::Sequence
 m_pSerializer->mark(Tag_InitCollectedRunProperties, 
comphelper::containerToSequence(aOrder));
 }
 
@@ -3930,6 +3932,7 @@ void DocxAttributeOutput::TableDefinition( 
ww8::WW8TableNodeInfoInner::Pointer_t
 
 // postpone the output so that we can later []
 // prepend the properties before the run
+// coverity[overrun-buffer-arg : FALSE] - coverity has difficulty with 
css::uno::Sequence
 m_pSerializer->mark(Tag_TableDefinition, 
comphelper::containerToSequence(aOrder));
 
 tools::Long nPageSize = 0;
@@ -6848,6 +6851,7 @@ void DocxAttributeOutput::StartSection()
 
 // postpone the output so that we can later [in EndParagraphProperties()]
 // prepend the properties before the run
+// coverity[overrun-buffer-arg : FALSE] - coverity has difficulty with 
css::uno::Sequence
 m_pSerializer->mark(Tag_StartSection, 
comphelper::containerToSequence(aOrder));
 m_bHadSectPr = true;
 }
diff --git a/testtools/source/bridgetest/bridgetest.cxx 
b/testtools/source/bridgetest/bridgetest.cxx
index 5860708695d2..7c646b59a257 100644
--- a/testtools/source/bridgetest/bridgetest.cxx
+++ b/testtools/source/bridgetest/bridgetest.cxx
@@ -774,6 +774,7 @@ static bool performTest(
   

[Libreoffice-commits] core.git: embeddedobj/source

2021-10-24 Thread 4k5h1t (via logerrit)
 embeddedobj/source/commonembedding/persistence.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 0776e75fbc09201052e27a33cbc9e8f117b43596
Author: 4k5h1t 
AuthorDate: Sun Oct 24 17:28:36 2021 +0530
Commit: Hossein 
CommitDate: Sun Oct 24 16:46:07 2021 +0200

tdf#42982: improve UNO API error reporting

Change-Id: I9300b4e6eb9ee3ff2b9bfd32efdf0c8ceedc9d3c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124113
Tested-by: Jenkins
Reviewed-by: Hossein 

diff --git a/embeddedobj/source/commonembedding/persistence.cxx 
b/embeddedobj/source/commonembedding/persistence.cxx
index 38f6f1909145..7d7ec8aa8a57 100644
--- a/embeddedobj/source/commonembedding/persistence.cxx
+++ b/embeddedobj/source/commonembedding/persistence.cxx
@@ -587,13 +587,13 @@ uno::Reference< io::XInputStream > 
OCommonEmbeddedObject::StoreDocumentToTempStr
 }
 
 if( !xStorable.is() )
-throw uno::RuntimeException(); // TODO:
+throw uno::RuntimeException("No storage is provided for storing!"); // 
TODO:
 
 OUString aFilterName = GetFilterName( nStorageFormat );
 
 SAL_WARN_IF( aFilterName.isEmpty(), "embeddedobj.common", "Wrong document 
service name!" );
 if ( aFilterName.isEmpty() )
-throw io::IOException(); // TODO:
+throw io::IOException("No filter name provided / Wrong document 
service name"); // TODO:
 
 uno::Sequence< beans::PropertyValue > aArgs( 4 );
 aArgs[0].Name = "FilterName";


[Libreoffice-commits] core.git: embeddedobj/source

2021-10-16 Thread Mike Kaganski (via logerrit)
 embeddedobj/source/msole/oleembed.cxx |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

New commits:
commit 8133aa39939bd65c7c4078ff002ab88675e84ccc
Author: Mike Kaganski 
AuthorDate: Sat Oct 16 19:33:20 2021 +0300
Commit: Mike Kaganski 
CommitDate: Sat Oct 16 20:51:17 2021 +0200

Fix a forgotten return of the value

... ever since its introduction in commit
5ea5c0afebd272d5f44e6524c0f67b5317639919

Change-Id: Ic2f082db43c961185921137c6b64b2e1abef28e1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123704
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/embeddedobj/source/msole/oleembed.cxx 
b/embeddedobj/source/msole/oleembed.cxx
index ba678d4dfb87..01cf44b9fcaa 100644
--- a/embeddedobj/source/msole/oleembed.cxx
+++ b/embeddedobj/source/msole/oleembed.cxx
@@ -110,8 +110,7 @@ uno::Sequence< sal_Int32 > 
OleEmbeddedObject::GetIntermediateVerbsSequence_Impl(
 // actually there will be only one verb
 if ( m_nObjectState == embed::EmbedStates::RUNNING && nNewState == 
embed::EmbedStates::ACTIVE )
 {
-uno::Sequence< sal_Int32 > aVerbs( 1 );
-aVerbs[0] = embed::EmbedVerbs::MS_OLEVERB_OPEN;
+return { embed::EmbedVerbs::MS_OLEVERB_OPEN };
 }
 
 return uno::Sequence< sal_Int32 >();


[Libreoffice-commits] core.git: embeddedobj/source include/systools

2021-10-16 Thread Mike Kaganski (via logerrit)
 embeddedobj/source/msole/olecomponent.cxx |  206 +-
 include/systools/win32/comtools.hxx   |   52 ---
 2 files changed, 67 insertions(+), 191 deletions(-)

New commits:
commit a8a07cea28fd79e240c3abb084b88f4e23674fd6
Author: Mike Kaganski 
AuthorDate: Sat Oct 16 13:04:02 2021 +0300
Commit: Mike Kaganski 
CommitDate: Sat Oct 16 17:24:08 2021 +0200

Use sal::systools::COMReference and drop ComSmart

Change-Id: Ic6e0c87f607264629cdec1fdcd0c3144d8fbf8e6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123695
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/embeddedobj/source/msole/olecomponent.cxx 
b/embeddedobj/source/msole/olecomponent.cxx
index f57d0f1d85b8..4c44d36636fc 100644
--- a/embeddedobj/source/msole/olecomponent.cxx
+++ b/embeddedobj/source/msole/olecomponent.cxx
@@ -40,6 +40,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include "graphconvert.hxx"
@@ -57,123 +58,6 @@ using namespace ::comphelper;
 #define MAX_ENUM_ELE 20
 #define FORMATS_NUM  3
 
-//  class ComSmart =
-namespace {
-
-template< class T > class ComSmart
-{
-T* m_pInterface;
-
-void OwnRelease()
-{
-if ( m_pInterface )
-{
-T* pInterface = m_pInterface;
-m_pInterface = nullptr;
-pInterface->Release();
-}
-}
-
-public:
-ComSmart()
-: m_pInterface( nullptr )
-{}
-
-ComSmart( const ComSmart& rObj )
-: m_pInterface( rObj.m_pInterface )
-{
-if ( m_pInterface != NULL )
-m_pInterface->AddRef();
-}
-
-ComSmart( T* pInterface )
-: m_pInterface( pInterface )
-{
- if ( m_pInterface != NULL )
-m_pInterface->AddRef();
-}
-
-~ComSmart()
-{
-OwnRelease();
-}
-
-ComSmart& operator=( const ComSmart& rObj )
-{
-if(this == )
-return *this;
-
-OwnRelease();
-
-m_pInterface = rObj.m_pInterface;
-
-if ( m_pInterface != NULL )
-m_pInterface->AddRef();
-
-return *this;
-}
-
-ComSmart& operator=( T* pInterface )
-{
-OwnRelease();
-
-m_pInterface = pInterface;
-
-if ( m_pInterface != NULL )
-m_pInterface->AddRef();
-
-return *this;
-}
-
-operator T*() const
-{
-return m_pInterface;
-}
-
-T& operator*() const
-{
-return *m_pInterface;
-}
-
-T** operator&()
-{
-OwnRelease();
-
-m_pInterface = nullptr;
-
-return _pInterface;
-}
-
-T* operator->() const
-{
-return m_pInterface;
-}
-
-bool operator==( const ComSmart& rObj ) const
-{
-return ( m_pInterface == rObj.m_pInterface );
-}
-
-bool operator!=( const ComSmart& rObj ) const
-{
-return ( m_pInterface != rObj.m_pInterface );
-}
-
-bool operator==( const T* pInterface ) const
-{
-return ( m_pInterface == pInterface );
-}
-
-bool operator!=( const T* pInterface ) const
-{
-return ( m_pInterface != pInterface );
-}
-};
-
-}
-
-//  class ComSmart =
-
 typedef std::vector< FORMATETC* > FormatEtcList;
 
 FORMATETC const pFormatTemplates[FORMATS_NUM] = {
@@ -183,10 +67,10 @@ FORMATETC const pFormatTemplates[FORMATS_NUM] = {
 
 
 struct OleComponentNative_Impl {
-ComSmart< IUnknown > m_pObj;
-ComSmart< IOleObject > m_pOleObject;
-ComSmart< IViewObject2 > m_pViewObject2;
-ComSmart< IStorage > m_pIStorage;
+sal::systools::COMReference< IUnknown > m_pObj;
+sal::systools::COMReference< IOleObject > m_pOleObject;
+sal::systools::COMReference< IViewObject2 > m_pViewObject2;
+sal::systools::COMReference< IStorage > m_pIStorage;
 FormatEtcList m_aFormatsList;
 uno::Sequence< datatransfer::DataFlavor > m_aSupportedGraphFormats;
 
@@ -599,12 +483,11 @@ void OleComponent::RetrieveObjectDataFlavors_Impl()
 
 if ( !m_aDataFlavors.getLength() )
 {
-ComSmart< IDataObject > pDataObject;
-HRESULT hr = m_pNativeImpl->m_pObj->QueryInterface( IID_IDataObject, 
reinterpret_cast() );
-if ( SUCCEEDED( hr ) && pDataObject )
+sal::systools::COMReference< IDataObject > 
pDataObject(m_pNativeImpl->m_pObj, sal::systools::COM_QUERY);
+if ( pDataObject )
 {
-ComSmart< IEnumFORMATETC > pFormatEnum;
-hr = pDataObject->EnumFormatEtc( DATADIR_GET,  );
+sal::systools::COMReference< IEnumFORMATETC > pFormatEnum;
+HRESULT hr = pDataObject->EnumFormatEtc( DATADIR_GET,  
);
 if ( SUCCEEDED( hr ) && pFormatEnum )
 {
 FORMATETC pElem[ MAX_ENUM_ELE ];
@@ -651,20 +534,15 @@ bool OleComponent::InitializeObject_Impl()
 return false;
 
 // the linked object will be detected here
-ComSmart< IOleLink > pOleLink;

[Libreoffice-commits] core.git: embeddedobj/source

2021-10-16 Thread Mike Kaganski (via logerrit)
 embeddedobj/source/msole/olecomponent.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 314fbd4cfa3a2f4125c9badc9033758b720db0f7
Author: Mike Kaganski 
AuthorDate: Sat Oct 16 08:27:57 2021 +0200
Commit: Julien Nabet 
CommitDate: Sat Oct 16 10:20:26 2021 +0200

Fix the copypaste error

... ever since commit 6eea9416a3a5be2d2f6aab6c58ab4e6d4b085ea8

Change-Id: Ic3f6f6876d398cd48cd480518d99a516cea95a31
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123636
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/embeddedobj/source/msole/olecomponent.cxx 
b/embeddedobj/source/msole/olecomponent.cxx
index 6122bdd6a156..f57d0f1d85b8 100644
--- a/embeddedobj/source/msole/olecomponent.cxx
+++ b/embeddedobj/source/msole/olecomponent.cxx
@@ -215,7 +215,7 @@ struct OleComponentNative_Impl {
 "PNG",
 cppu::UnoType>::get() );
 
-m_aSupportedGraphFormats[0] = datatransfer::DataFlavor(
+m_aSupportedGraphFormats[4] = datatransfer::DataFlavor(
 
"application/x-openoffice-gdimetafile;windows_formatname=\"GDIMetaFile\"",
 "GDIMetafile",
 cppu::UnoType>::get() );


[Libreoffice-commits] core.git: embeddedobj/source

2021-09-30 Thread Stephan Bergmann (via logerrit)
 embeddedobj/source/msole/olepersist.cxx |3 +--
 embeddedobj/source/msole/xdialogcreator.cxx |3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

New commits:
commit 89732e5bbf659694c63a2eb16019a23c7a64ba64
Author: Stephan Bergmann 
AuthorDate: Thu Sep 30 12:45:33 2021 +0200
Commit: Stephan Bergmann 
CommitDate: Thu Sep 30 16:00:19 2021 +0200

Extended loplugin:referencecasting/redundantcast (clang-cl): embeddedobj

Change-Id: I345b6535df2df4770191dc1aae0ca024b747a50a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122887
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/embeddedobj/source/msole/olepersist.cxx 
b/embeddedobj/source/msole/olepersist.cxx
index 0ef23a096af4..7811566b7965 100644
--- a/embeddedobj/source/msole/olepersist.cxx
+++ b/embeddedobj/source/msole/olepersist.cxx
@@ -966,8 +966,7 @@ void OleEmbeddedObject::CreateOleComponent_Impl(
 m_pOleComponent = pOleComponent ? pOleComponent : new OleComponent( 
m_xContext, this );
 
 if ( !m_xClosePreventer.is() )
-m_xClosePreventer.set( static_cast< ::cppu::OWeakObject* >( new 
OClosePreventer ),
-   uno::UNO_QUERY );
+m_xClosePreventer = new OClosePreventer;
 
 m_pOleComponent->addCloseListener( m_xClosePreventer );
 }
diff --git a/embeddedobj/source/msole/xdialogcreator.cxx 
b/embeddedobj/source/msole/xdialogcreator.cxx
index d5ecdf587909..b6bae52f1e49 100644
--- a/embeddedobj/source/msole/xdialogcreator.cxx
+++ b/embeddedobj/source/msole/xdialogcreator.cxx
@@ -307,8 +307,7 @@ embed::InsertedObjectInfo SAL_CALL 
MSOLEDialogObjectCreator::createInstanceInitF
 2 );
 
 uno::Reference< embed::XEmbeddedObject > xResult(
-static_cast< ::cppu::OWeakObject* > ( new 
OleEmbeddedObject( m_xContext ) ),
-uno::UNO_QUERY );
+new OleEmbeddedObject( m_xContext ) );
 
 uno::Reference< embed::XEmbedPersist > xPersist( xResult, 
uno::UNO_QUERY_THROW );
 xPersist->setPersistentEntry( xStorage,


[Libreoffice-commits] core.git: embeddedobj/source emfio/source extensions/source filter/source

2021-08-31 Thread Noel Grandin (via logerrit)
 embeddedobj/source/commonembedding/miscobj.cxx|2 -
 emfio/source/reader/mtftools.cxx  |   27 --
 emfio/source/reader/wmfreader.cxx |1 
 extensions/source/logging/filehandler.cxx |2 -
 extensions/source/propctrlr/defaultforminspection.cxx |3 --
 extensions/source/propctrlr/formgeometryhandler.cxx   |1 
 extensions/source/propctrlr/objectinspectormodel.cxx  |1 
 extensions/source/scanner/grid.cxx|1 
 filter/source/config/cache/basecontainer.cxx  |1 
 filter/source/config/cache/cacheitem.cxx  |1 
 filter/source/msfilter/escherex.cxx   |2 -
 filter/source/msfilter/msdffimp.cxx   |1 
 filter/source/msfilter/svdfppt.cxx|1 
 filter/source/pdf/impdialog.cxx   |1 
 filter/source/svg/svgfilter.cxx   |9 --
 filter/source/svg/svgwriter.cxx   |   13 
 16 files changed, 5 insertions(+), 62 deletions(-)

New commits:
commit 8508873a24387fefacd95e11e2ed9f2a0027ad43
Author: Noel Grandin 
AuthorDate: Tue Aug 31 14:54:07 2021 +0200
Commit: Noel Grandin 
CommitDate: Tue Aug 31 17:28:58 2021 +0200

clang-tidy:readability-redundant-member-init

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

diff --git a/embeddedobj/source/commonembedding/miscobj.cxx 
b/embeddedobj/source/commonembedding/miscobj.cxx
index 9427e0639b92..1e107e36c491 100644
--- a/embeddedobj/source/commonembedding/miscobj.cxx
+++ b/embeddedobj/source/commonembedding/miscobj.cxx
@@ -61,7 +61,6 @@ OCommonEmbeddedObject::OCommonEmbeddedObject( const 
uno::Reference< uno::XCompon
 , m_bIsLinkURL( false )
 , m_bLinkTempFileChanged( false )
 , m_bLinkHasPassword( false )
-, m_aLinkTempFile( )
 , m_bHasClonedSize( false )
 , m_nClonedMapUnit( 0 )
 {
@@ -88,7 +87,6 @@ OCommonEmbeddedObject::OCommonEmbeddedObject(
 , m_bIsLinkURL( true )
 , m_bLinkTempFileChanged( false )
 , m_bLinkHasPassword( false )
-, m_aLinkTempFile( )
 , m_bHasClonedSize( false )
 , m_nClonedMapUnit( 0 )
 {
diff --git a/emfio/source/reader/mtftools.cxx b/emfio/source/reader/mtftools.cxx
index ebc849430adc..93615d2c87d8 100644
--- a/emfio/source/reader/mtftools.cxx
+++ b/emfio/source/reader/mtftools.cxx
@@ -300,10 +300,6 @@ namespace emfio
 
 // tdf#127471
 ScaledFontDetectCorrectHelper::ScaledFontDetectCorrectHelper()
-:   maCurrentMetaFontAction(),
-maAlternativeFontScales(),
-maPositiveIdentifiedCases(),
-maNegativeIdentifiedCases()
 {
 }
 
@@ -1098,21 +1094,8 @@ namespace emfio
 }
 
 MtfTools::MtfTools( GDIMetaFile& rGDIMetaFile, SvStream& rStreamWMF)
-:   maPathObj(),
-maClipPath(),
-maLatestLineStyle(),
-maLineStyle(),
-maNopLineStyle(),
-maLatestFillStyle(),
-maFillStyle(),
-maNopFillStyle(),
-maPalette(),
-maLatestFont(),
-maFont(),
-mnLatestTextAlign(90),
+:   mnLatestTextAlign(90),
 mnTextAlign(TA_LEFT | TA_TOP | TA_NOUPDATECP),
-maLatestTextColor(),
-maTextColor(),
 maLatestBkColor(ColorTransparency, 0x12345678),
 maBkColor(COL_WHITE),
 mnLatestTextLayoutMode(ComplexTextLayoutFlags::Default),
@@ -1121,13 +1104,9 @@ namespace emfio
 mnBkMode(BkMode::OPAQUE),
 meLatestRasterOp(RasterOp::Invert),
 meRasterOp(RasterOp::OverPaint),
-mvGDIObj(),
-maActPos(),
 mnRop(),
-mvSaveStack(),
 mnGfxMode(GM_COMPATIBLE),
 mnMapMode(MM_TEXT),
-maXForm(),
 mnDevOrgX(0),
 mnDevOrgY(0),
 mnDevWidth(1),
@@ -1140,14 +1119,10 @@ namespace emfio
 mnPixY(100),
 mnMillX(1),
 mnMillY(1),
-mrclFrame(),
-mrclBounds(),
 mpGDIMetaFile(),
 mpInputStream(),
 mnStartPos(0),
 mnEndPos(0),
-maBmpSaveList(),
-maScaledFontHelper(),
 mbNopMode(false),
 mbFillStyleSelected(false),
 mbClipNeedsUpdate(true),
diff --git a/emfio/source/reader/wmfreader.cxx 
b/emfio/source/reader/wmfreader.cxx
index afabb795f8e0..6ef7003c42bd 100644
--- a/emfio/source/reader/wmfreader.cxx
+++ b/emfio/source/reader/wmfreader.cxx
@@ -2015,7 +2015,6 @@ namespace emfio
 : MtfTools(rGDIMetaFile, rStreamWMF)
 , mnUnitsPerInch(96)
 , mnRecSize(0)
-, mpEMFStream()
 , mnEMFRecCount(0)
 , mnEMFRec(0)
 , mnEMFSize(0)
diff --git a/extensions/source/logging/filehandler.cxx 
b/extensions/source/logging/filehandler.cxx
index 222146b0b4d2..200a3a64bbd0 100644
--- a/extensions/source/logging/filehandler.cxx
+++ b/extensions/source/logging/filehandler.cxx
@@ -130,8 +130,6 @@ 

[Libreoffice-commits] core.git: embeddedobj/source

2021-08-10 Thread Miklos Vajna (via logerrit)
 embeddedobj/source/commonembedding/miscobj.cxx   |   46 +++
 embeddedobj/source/commonembedding/specialobject.cxx |   18 +++
 embeddedobj/source/general/dummyobject.cxx   |   16 ++
 embeddedobj/source/inc/commonembobj.hxx  |   12 
 embeddedobj/source/inc/dummyobject.hxx   |8 ++-
 embeddedobj/source/inc/oleembobj.hxx |9 +++
 embeddedobj/source/inc/specialobject.hxx |5 ++
 embeddedobj/source/msole/olemisc.cxx |   16 ++
 8 files changed, 128 insertions(+), 2 deletions(-)

New commits:
commit 15a524a1ed2bf464b0b727e628bb5af9685f49b9
Author: Miklos Vajna 
AuthorDate: Tue Aug 10 16:37:15 2021 +0200
Commit: Miklos Vajna 
CommitDate: Tue Aug 10 22:02:00 2021 +0200

embeddedobj: implement XServiceInfo in the various embedded obj 
implementations

This gives UNO clients a reliable way to detect e.g.
OSpecialEmbeddedObject, where it's expected that double-clicking on the
object doesn't do anything.

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

diff --git a/embeddedobj/source/commonembedding/miscobj.cxx 
b/embeddedobj/source/commonembedding/miscobj.cxx
index 8d2cb7332a40..9427e0639b92 100644
--- a/embeddedobj/source/commonembedding/miscobj.cxx
+++ b/embeddedobj/source/commonembedding/miscobj.cxx
@@ -38,6 +38,7 @@
 
 #include 
 #include 
+#include 
 
 #include "persistence.hxx"
 
@@ -400,6 +401,16 @@ uno::Any SAL_CALL OCommonEmbeddedObject::queryInterface( 
const uno::Type& rType
 void* p = static_cast(this);
 return uno::Any(, rType);
 }
+else if (rType == cppu::UnoType::get())
+{
+void* p = static_cast(this);
+return uno::Any(, rType);
+}
+else if (rType == cppu::UnoType::get())
+{
+void* p = static_cast(this);
+return uno::Any(, rType);
+}
 else
 aReturn = ::cppu::queryInterface(
 rType,
@@ -643,4 +654,39 @@ void SAL_CALL OCommonEmbeddedObject::removeEventListener( 
const uno::Reference<
 xListener );
 }
 
+OUString SAL_CALL OCommonEmbeddedObject::getImplementationName()
+{
+return "com.sun.star.comp.embed.OCommonEmbeddedObject";
+}
+
+sal_Bool SAL_CALL OCommonEmbeddedObject::supportsService(const OUString& 
ServiceName)
+{
+return cppu::supportsService(this, ServiceName);
+}
+
+uno::Sequence SAL_CALL 
OCommonEmbeddedObject::getSupportedServiceNames()
+{
+return { "com.sun.star.comp.embed.OCommonEmbeddedObject" };
+}
+
+uno::Sequence SAL_CALL OCommonEmbeddedObject::getTypes()
+{
+static const uno::Sequence aTypes{
+cppu::UnoType::get(),
+cppu::UnoType::get(),
+cppu::UnoType::get(),
+cppu::UnoType::get(),
+cppu::UnoType::get(),
+cppu::UnoType::get(),
+cppu::UnoType::get(),
+cppu::UnoType::get(),
+};
+return aTypes;
+}
+
+uno::Sequence SAL_CALL OCommonEmbeddedObject::getImplementationId()
+{
+return uno::Sequence();
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/embeddedobj/source/commonembedding/specialobject.cxx 
b/embeddedobj/source/commonembedding/specialobject.cxx
index 683fe0aab3f2..809ffce1f2c4 100644
--- a/embeddedobj/source/commonembedding/specialobject.cxx
+++ b/embeddedobj/source/commonembedding/specialobject.cxx
@@ -28,6 +28,7 @@
 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -51,6 +52,8 @@ uno::Any SAL_CALL OSpecialEmbeddedObject::queryInterface( 
const uno::Type& rType
 static_cast< embed::XClassifiedObject* 
>( this ),
 static_cast< 
embed::XComponentSupplier* >( this ),
 static_cast< util::XCloseable* >( this 
),
+static_cast< lang::XServiceInfo* >( 
this ),
+static_cast< lang::XTypeProvider* >( 
this ),
 static_cast< 
document::XEventBroadcaster* >( this ) );
 if ( aReturn.hasValue() )
 return aReturn;
@@ -160,4 +163,19 @@ void SAL_CALL OSpecialEmbeddedObject::doVerb( sal_Int32 
nVerbID )
 OCommonEmbeddedObject::doVerb( nVerbID );
 }
 
+OUString SAL_CALL OSpecialEmbeddedObject::getImplementationName()
+{
+return "com.sun.star.comp.embed.OSpecialEmbeddedObject";
+}
+
+sal_Bool SAL_CALL OSpecialEmbeddedObject::supportsService(const OUString& 
ServiceName)
+{
+return cppu::supportsService(this, ServiceName);
+}
+
+uno::Sequence SAL_CALL 
OSpecialEmbeddedObject::getSupportedServiceNames()
+{
+return { "com.sun.star.comp.embed.OSpecialEmbeddedObject" };
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/embeddedobj/source/general/dummyobject.cxx 

[Libreoffice-commits] core.git: embeddedobj/source sfx2/source

2021-07-14 Thread Miklos Vajna (via logerrit)
 embeddedobj/source/msole/olecomponent.cxx |8 +++-
 sfx2/source/control/unoctitm.cxx  |   21 -
 2 files changed, 27 insertions(+), 2 deletions(-)

New commits:
commit 19d473da14ac877cb0721063c7b18e16cb6f2b76
Author: Miklos Vajna 
AuthorDate: Wed Jul 14 10:32:46 2021 +0200
Commit: Miklos Vajna 
CommitDate: Wed Jul 14 11:52:00 2021 +0200

sfx2: handle OnMainThread=true in SfxOfficeDispatch::dispatch()

This is needed when an out of process Java UNO client registers their
command dispatch interceptor, Windows OleInitialize() has been called
already on the main thread and then dispatching e.g. uno:Paste (which
would interact with OLE) would call OLE functions on a thread, which
would fail with RPC_E_CHANGED_MODE.

In other words, a situation similar to commit
22aa6508e0a65e65a6f9410b498fe4fd6c236639 (framework: allow dispatching a
command on the main thread, 2019-01-29), but that one was for
DispatchHelper, this one is for XDispatch implementations.

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

diff --git a/embeddedobj/source/msole/olecomponent.cxx 
b/embeddedobj/source/msole/olecomponent.cxx
index cbcc1f6e79d7..b0c4fc62c1ac 100644
--- a/embeddedobj/source/msole/olecomponent.cxx
+++ b/embeddedobj/source/msole/olecomponent.cxx
@@ -35,6 +35,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -445,9 +446,14 @@ OleComponent::OleComponent( const uno::Reference< 
uno::XComponentContext >& xCon
 OSL_ENSURE( m_pUnoOleObject, "No owner object is provided!" );
 
 HRESULT hr = OleInitialize( nullptr );
-OSL_ENSURE( hr == S_OK || hr == S_FALSE, "The ole can not be successfully 
initialized" );
 if ( hr == S_OK || hr == S_FALSE )
 m_bOleInitialized = true;
+else
+{
+SAL_WARN("embeddedobj.ole", "OleComponent ctor: OleInitialize() failed 
with 0x"
+<< 
OUString::number(static_cast(hr), 16) << ": "
+<< WindowsErrorStringFromHRESULT(hr));
+}
 
 m_pOleWrapClientSite = new OleWrapperClientSite( this );
 m_pOleWrapClientSite->AddRef();
diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx
index 0a98f806d708..bc07f2af71d3 100644
--- a/sfx2/source/control/unoctitm.cxx
+++ b/sfx2/source/control/unoctitm.cxx
@@ -78,6 +78,8 @@
 #include 
 
 #include 
+#include 
+#include 
 
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
@@ -233,7 +235,24 @@ void SAL_CALL SfxOfficeDispatch::dispatch( const 
css::util::URL& aURL, const css
 #if HAVE_FEATURE_JAVA
 std::unique_ptr< css::uno::ContextLayer > layer(EnsureJavaContext());
 #endif
-pImpl->dispatch( aURL, aArgs, css::uno::Reference < 
css::frame::XDispatchResultListener >() );
+utl::MediaDescriptor aDescriptor(aArgs);
+bool bOnMainThread = 
aDescriptor.getUnpackedValueOrDefault("OnMainThread", false);
+if (bOnMainThread)
+{
+// Make sure that we own the solar mutex, otherwise later
+// vcl::SolarThreadExecutor::execute() will release the solar 
mutex, even if it's owned by
+// an other thread, leading to an std::abort() at the end.
+SolarMutexGuard aGuard;
+vcl::solarthread::syncExecute([this, , ]() {
+pImpl->dispatch(aURL, aArgs,
+
css::uno::Reference());
+});
+}
+else
+{
+pImpl->dispatch(aURL, aArgs,
+
css::uno::Reference());
+}
 }
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: embeddedobj/source extensions/source hwpfilter/source jvmfwk/plugins sal/osl winaccessibility/source

2021-07-09 Thread Stephan Bergmann (via logerrit)
 embeddedobj/source/msole/olecomponent.cxx |   12 -
 extensions/source/ole/unoobjw.cxx |2 
 hwpfilter/source/hcode.cxx|4 
 jvmfwk/plugins/sunmajor/pluginlib/util.cxx|2 
 sal/osl/w32/profile.cxx   |6 
 sal/osl/w32/salinit.cxx   |6 
 winaccessibility/source/service/AccComponentEventListener.cxx |   68 +-
 7 files changed, 50 insertions(+), 50 deletions(-)

New commits:
commit 010cf46e04907fa2503477ce4c0c85f465747034
Author: Stephan Bergmann 
AuthorDate: Fri Jul 9 08:34:31 2021 +0200
Commit: Stephan Bergmann 
CommitDate: Fri Jul 9 09:15:52 2021 +0200

loplugin:indentation (clang-cl)

Change-Id: Iae559ca8bee9650c01167a4d1b918e18cbf03c28
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118660
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/embeddedobj/source/msole/olecomponent.cxx 
b/embeddedobj/source/msole/olecomponent.cxx
index da5b02874b07..cbcc1f6e79d7 100644
--- a/embeddedobj/source/msole/olecomponent.cxx
+++ b/embeddedobj/source/msole/olecomponent.cxx
@@ -360,13 +360,13 @@ bool OleComponentNative_Impl::ConvertDataForFlavor( const 
STGMEDIUM& aMedium,
 if ( pBuf && !bAnyIsReady )
 {
 for ( auto const & supportedFormat : 
std::as_const(m_aSupportedGraphFormats) )
- if ( aFlavor.MimeType.match( supportedFormat.MimeType )
+if ( aFlavor.MimeType.match( supportedFormat.MimeType )
   && aFlavor.DataType == supportedFormat.DataType
   && aFlavor.DataType == cppu::UnoType>::get() )
-{
-bAnyIsReady = ConvertBufferToFormat( pBuf.get(), nBufSize, 
aFormat, aResult );
-break;
-}
+{
+bAnyIsReady = ConvertBufferToFormat( pBuf.get(), nBufSize, 
aFormat, aResult );
+break;
+}
 }
 }
 
@@ -612,7 +612,7 @@ void OleComponent::RetrieveObjectDataFlavors_Impl()
 if( hr2 == S_OK || hr2 == S_FALSE )
 {
 for( sal_uInt32 nInd = 0; nInd < FORMATS_NUM; nInd++ )
-{
+{
 if ( pElem[nInd].cfFormat == 
pFormatTemplates[nInd].cfFormat
   && pElem[nInd].tymed == 
pFormatTemplates[nInd].tymed )
 nSupportedAspects |= pElem[nInd].dwAspect;
diff --git a/extensions/source/ole/unoobjw.cxx 
b/extensions/source/ole/unoobjw.cxx
index 2d935f8d9583..595d4276e3c4 100644
--- a/extensions/source/ole/unoobjw.cxx
+++ b/extensions/source/ole/unoobjw.cxx
@@ -1731,7 +1731,7 @@ static bool writeBackOutParameter(VARIANTARG* pDest, 
VARIANT* pSource)
 else
 {
 // variantarg and variant must have same type
-  if ((V_VT(pDest) & oleTypeFlags) == oleTypeFlags)
+if ((V_VT(pDest) & oleTypeFlags) == oleTypeFlags)
 {
 if ((oleTypeFlags & VT_ARRAY) != 0)
 {
diff --git a/hwpfilter/source/hcode.cxx b/hwpfilter/source/hcode.cxx
index dfd9af78b4b8..ff133cebd25a 100644
--- a/hwpfilter/source/hcode.cxx
+++ b/hwpfilter/source/hcode.cxx
@@ -1352,10 +1352,10 @@ char *hcolor2str(uchar color, uchar shade, char *buf, 
bool bIsChar)
 {
 std::string ret;
 if( !_strnicmp(src, "http", 4))
- {
+{
 // nothing special here, just copy
 }
- else
+else
 {
 unsigned int srclen = strlen(src);
 if (3 < srclen)
diff --git a/jvmfwk/plugins/sunmajor/pluginlib/util.cxx 
b/jvmfwk/plugins/sunmajor/pluginlib/util.cxx
index df14c0841bf9..bc66d68de052 100644
--- a/jvmfwk/plugins/sunmajor/pluginlib/util.cxx
+++ b/jvmfwk/plugins/sunmajor/pluginlib/util.cxx
@@ -614,7 +614,7 @@ static void addJavaInfoFromWinReg(
 {
 getAndAddJREInfoByPath(javaHome, allInfos, addedInfos);
 }
-   }
+}
 
 vecJavaHome.clear();
 if (getJavaInfoFromRegistry(L"Software\\JavaSoft\\JDK", vecJavaHome)) {
diff --git a/sal/osl/w32/profile.cxx b/sal/osl/w32/profile.cxx
index 17540f65e424..a0790c3de632 100644
--- a/sal/osl/w32/profile.cxx
+++ b/sal/osl/w32/profile.cxx
@@ -1977,10 +1977,10 @@ static bool releaseProfile(osl_TProfileImpl* pProfile)
 else
 {
 #ifdef DEBUG_OSL_PROFILE
-SAL_INFO("sal.osl", "DEFAULT MODE");
+SAL_INFO("sal.osl", "DEFAULT MODE");
 #endif
-if (! (pProfile->m_Flags & (osl_Profile_READLOCK |
-osl_Profile_WRITELOCK | 
osl_Profile_FLUSHWRITE)))
+if (! (pProfile->m_Flags & (osl_Profile_READLOCK |
+osl_Profile_WRITELOCK | 
osl_Profile_FLUSHWRITE)))
 {
 if (pProfile->m_Flags & FLG_MODIFIED)
  

[Libreoffice-commits] core.git: embeddedobj/source

2021-05-18 Thread Stephan Bergmann (via logerrit)
 embeddedobj/source/msole/olevisual.cxx |   12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

New commits:
commit c02295e5c4026e3093612a93fb4a28d94755c55f
Author: Stephan Bergmann 
AuthorDate: Tue May 18 14:43:58 2021 +0200
Commit: Stephan Bergmann 
CommitDate: Tue May 18 16:14:01 2021 +0200

loplugin:logexceptionnicely (clang-cl)

Change-Id: I56a944dbc13d4f2d4ce5b691789e6144a3e13945
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115746
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/embeddedobj/source/msole/olevisual.cxx 
b/embeddedobj/source/msole/olevisual.cxx
index b56357ddbb29..4f76cde853a8 100644
--- a/embeddedobj/source/msole/olevisual.cxx
+++ b/embeddedobj/source/msole/olevisual.cxx
@@ -225,9 +225,9 @@ awt::Size SAL_CALL OleEmbeddedObject::getVisualAreaSize( 
sal_Int64 nAspect )
 aSize = m_pOleComponent->GetExtent( nAspect ); // will 
throw an exception in case of failure
 bSuccess = true;
 }
-catch( const uno::Exception& rException )
+catch( const uno::Exception& )
 {
-SAL_WARN("embeddedobj.ole", 
"OleEmbeddedObject::getVisualAreaSize: GetExtent() failed: " << rException);
+TOOLS_WARN_EXCEPTION("embeddedobj.ole", 
"OleEmbeddedObject::getVisualAreaSize: GetExtent() failed:");
 }
 
 if (bBackToLoaded)
@@ -250,9 +250,9 @@ awt::Size SAL_CALL OleEmbeddedObject::getVisualAreaSize( 
sal_Int64 nAspect )
 aSize = m_pOleComponent->GetCachedExtent( nAspect ); 
// will throw an exception in case of failure
 bSuccess = true;
 }
-catch( const uno::Exception& rException )
+catch( const uno::Exception& )
 {
-SAL_WARN("embeddedobj.ole", 
"OleEmbeddedObject::getVisualAreaSize: GetCachedExtent() failed: " << 
rException);
+TOOLS_WARN_EXCEPTION("embeddedobj.ole", 
"OleEmbeddedObject::getVisualAreaSize: GetCachedExtent() failed:");
 }
 }
 
@@ -264,9 +264,9 @@ awt::Size SAL_CALL OleEmbeddedObject::getVisualAreaSize( 
sal_Int64 nAspect )
 aSize = m_pOleComponent->GetRecommendedExtent( nAspect 
); // will throw an exception in case of failure
 bSuccess = true;
 }
-catch( const uno::Exception& rException )
+catch( const uno::Exception& )
 {
-SAL_WARN("embeddedobj.ole", 
"OleEmbeddedObject::getVisualAreaSize: GetRecommendedExtent() failed: " << 
rException);
+TOOLS_WARN_EXCEPTION("embeddedobj.ole", 
"OleEmbeddedObject::getVisualAreaSize: GetRecommendedExtent() failed:");
 }
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: embeddedobj/source

2021-04-23 Thread Miklos Vajna (via logerrit)
 embeddedobj/source/msole/olepersist.cxx |   16 
 1 file changed, 16 insertions(+)

New commits:
commit 02298dbdfde3432ef757fdc1a28f7e6341254179
Author: Miklos Vajna 
AuthorDate: Fri Apr 23 12:19:49 2021 +0200
Commit: Miklos Vajna 
CommitDate: Fri Apr 23 14:56:58 2021 +0200

embeddedobj: fix lost native data when updating it via OLE fails, take 2

How to reproduce the problem:

1) Create an ODT file which has an OLE object, where the native data is
an OLE2 container, containing a Package stream, containing a DOCX file

2) Install some external application on Windows which registers itself
as a handler for the DOCX CSLID [ this is where writing a testcase for
this bug is challenging ].

3) Open this document via Java, using URP. Load the document with
Hidden=true and OnMainThread=true.

4) Save the document using XStorable.store().

Expected result: the native data is there.

Actual result: the native data is sometimes missing (0 bytes).

The root cause is that GetUserClassID() Win32 API call in
OleComponent::StoreOwnTmpIfNecessary() fails in some cases, and
re-trying a few times after a small sleep doesn't help.

Handle this error better by doing what
OleEmbeddedObject::SwitchOwnPersistence(XStorage, OUString) already
does: discard the old native data only if we have non-empty new native
data.

A result of the above was that an export to reqif-xhtml (sw HTML export
with FilterOptions set to xhtmlns=reqif-xhtml) wrote empty \objdata.

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

diff --git a/embeddedobj/source/msole/olepersist.cxx 
b/embeddedobj/source/msole/olepersist.cxx
index fddf46d6e658..c4d80bb404fd 100644
--- a/embeddedobj/source/msole/olepersist.cxx
+++ b/embeddedobj/source/msole/olepersist.cxx
@@ -743,6 +743,22 @@ void OleEmbeddedObject::SwitchOwnPersistence( const 
uno::Reference< embed::XStor
 return;
 }
 
+uno::Reference xNewSeekable(xNewObjectStream, 
uno::UNO_QUERY);
+if (xNewSeekable.is() && xNewSeekable->getLength() == 0)
+{
+uno::Reference xOldSeekable(m_xObjectStream, 
uno::UNO_QUERY);
+if (xOldSeekable.is() && xOldSeekable->getLength() > 0)
+{
+SAL_WARN("embeddedobj.ole", 
"OleEmbeddedObject::SwitchOwnPersistence(stream version): "
+"empty new stream, reusing old one");
+uno::Reference xInput = 
m_xObjectStream->getInputStream();
+uno::Reference xOutput = 
xNewObjectStream->getOutputStream();
+xOldSeekable->seek(0);
+comphelper::OStorageHelper::CopyInputToOutput(xInput, xOutput);
+xNewSeekable->seek(0);
+}
+}
+
 try {
 uno::Reference< lang::XComponent > xComponent( m_xObjectStream, 
uno::UNO_QUERY );
 OSL_ENSURE( !m_xObjectStream.is() || xComponent.is(), "Wrong stream 
implementation!" );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-04-08 Thread Miklos Vajna (via logerrit)
 embeddedobj/source/msole/olecomponent.cxx |3 +++
 embeddedobj/source/msole/olepersist.cxx   |   15 +++
 sw/source/filter/html/htmlreqifreader.cxx |9 +
 3 files changed, 27 insertions(+)

New commits:
commit fb4dc0f1786e0a036fc224393e91a3f1fdbff1b3
Author: Miklos Vajna 
AuthorDate: Thu Apr 8 17:03:21 2021 +0200
Commit: Miklos Vajna 
CommitDate: Thu Apr 8 19:18:09 2021 +0200

embeddedobj: fix lost native data when updating it via OLE fails

How to reproduce the problem:

1) Create an ODT file which has an OLE object, where the native data is
an OLE2 container, containing a Package stream, containing a DOCX file.

2) Install some external application on Windows which registers itself
as a handler for the DOCX CSLID [ this is where writing a testcase for
this bug is challenging ].

3) Open this document via Java, using URP. Load the document with
Hidden=true and OnMainThread=true.

4) Dispatch .uno:UpdateAll

5) Save the document using XStorable.store()

Expected result: the native data is there.

Actual result: the native data is sometimes missing (0 bytes). Typically
happens at least once if you perform the steps 4 times in a row.

The root cause is that GetUserClassID() Win32 API fails in some cases,
and re-trying a few times after a small sleep doesn't help.

Handle this error better by detecting this situation in
OleEmbeddedObject::SwitchOwnPersistence() and reusing the old native
data, similar to how svt::EmbeddedObjectRef::GetReplacement() updates
the preview image in a transactional way (only delete the old one when
we have a one one).

Finally, detect a broken OLE2 preview during reqif export, this way the
reqif export result's embedded object is editable in Word, while
\objdata was simply empty previously.

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

diff --git a/embeddedobj/source/msole/olecomponent.cxx 
b/embeddedobj/source/msole/olecomponent.cxx
index 9fe827bb00d9..9843e4999f44 100644
--- a/embeddedobj/source/msole/olecomponent.cxx
+++ b/embeddedobj/source/msole/olecomponent.cxx
@@ -1299,7 +1299,10 @@ void OleComponent::StoreOwnTmpIfNecessary()
 GUID aCLSID;
 hr = m_pNativeImpl->m_pOleObject->GetUserClassID(  );
 if ( FAILED( hr ) )
+{
+SAL_WARN("embeddedobj.ole", 
"OleComponent::StoreOwnTmpIfNecessary: GetUserClassID() failed");
 throw io::IOException(); // TODO
+}
 
 hr = WriteClassStg( m_pNativeImpl->m_pIStorage, aCLSID );
 if ( FAILED( hr ) )
diff --git a/embeddedobj/source/msole/olepersist.cxx 
b/embeddedobj/source/msole/olepersist.cxx
index 7f5002ec2772..fddf46d6e658 100644
--- a/embeddedobj/source/msole/olepersist.cxx
+++ b/embeddedobj/source/msole/olepersist.cxx
@@ -768,6 +768,21 @@ void OleEmbeddedObject::SwitchOwnPersistence( const 
uno::Reference< embed::XStor
 sal_Int32 nStreamMode = m_bReadOnly ? embed::ElementModes::READ : 
embed::ElementModes::READWRITE;
 
 uno::Reference< io::XStream > xNewOwnStream = 
xNewParentStorage->openStreamElement( aNewName, nStreamMode );
+
+uno::Reference xNewSeekable (xNewOwnStream, uno::UNO_QUERY);
+if (xNewSeekable.is() && xNewSeekable->getLength() == 0)
+{
+uno::Reference xOldSeekable(m_xObjectStream, 
uno::UNO_QUERY);
+if (xOldSeekable.is() && xOldSeekable->getLength() > 0)
+{
+SAL_WARN("embeddedobj.ole", 
"OleEmbeddedObject::SwitchOwnPersistence: empty new stream, reusing old one");
+uno::Reference xInput = 
m_xObjectStream->getInputStream();
+uno::Reference xOutput = 
xNewOwnStream->getOutputStream();
+comphelper::OStorageHelper::CopyInputToOutput(xInput, xOutput);
+xNewSeekable->seek(0);
+}
+}
+
 SAL_WARN_IF( !xNewOwnStream.is(), "embeddedobj.ole", "The method can not 
return empty reference!" );
 
 SwitchOwnPersistence( xNewParentStorage, xNewOwnStream, aNewName );
diff --git a/sw/source/filter/html/htmlreqifreader.cxx 
b/sw/source/filter/html/htmlreqifreader.cxx
index 40c932ad6332..c0a3196bb018 100644
--- a/sw/source/filter/html/htmlreqifreader.cxx
+++ b/sw/source/filter/html/htmlreqifreader.cxx
@@ -142,6 +142,15 @@ bool ParseOLE2Presentation(SvStream& rOle2, sal_uInt32& 
nWidth, sal_uInt32& nHei
 // Read Data.
 if (nSize > xOle2Presentation->remainingSize())
 return false;
+
+if (nSize <= 64)
+{
+SAL_WARN("sw.html",
+ "ParseOLE2Presentation: ignoring potentially broken small 
preview: size is "
+ << nSize);
+return false;
+}
+
 std::vector aBuffer(nSize);
 xOle2Presentation->ReadBytes(aBuffer.data(), 

[Libreoffice-commits] core.git: embeddedobj/source

2021-04-08 Thread Armin Le Grand (Allotropia) (via logerrit)
 embeddedobj/source/commonembedding/embedobj.cxx|8 +-
 embeddedobj/source/commonembedding/miscobj.cxx |   68 +-
 embeddedobj/source/commonembedding/persistence.cxx |   78 +++--
 embeddedobj/source/commonembedding/visobj.cxx  |8 +-
 embeddedobj/source/inc/commonembobj.hxx|7 +
 5 files changed, 141 insertions(+), 28 deletions(-)

New commits:
commit f4c66a2272d890eaa7a6d7429e5bfa7bdb1f7162
Author: Armin Le Grand (Allotropia) 
AuthorDate: Thu Apr 8 10:30:15 2021 +0200
Commit: Armin Le Grand 
CommitDate: Thu Apr 8 13:22:09 2021 +0200

tdf#141529 sync linked OLE save(s) with hosting file save(s)

Before deactivating a linked OLE saved it and overwrote the
original, even when not saving the hosting document at all.
This is not intuitive from user perspective and may lead
to unexpected data loss (of the OLE content).
Reported case was especially about closing the hosted document
without saving in the understandable believe that that way the
changed OLE will not be changed on external medium.
Added mechanism for linked OLE to hold data in a hidden local
temp file, synching/writing back on hosting file save. Most
complicated was adapting the 'break link' case and ensuring
other cases to work, but looks good now from my POV

Change-Id: I7f63d667820b2d9725abc598a9dd7360be1f8d5a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113793
Tested-by: Armin Le Grand 
Reviewed-by: Armin Le Grand 

diff --git a/embeddedobj/source/commonembedding/embedobj.cxx 
b/embeddedobj/source/commonembedding/embedobj.cxx
index dcba248ca4f7..5b4c1da23fd5 100644
--- a/embeddedobj/source/commonembedding/embedobj.cxx
+++ b/embeddedobj/source/commonembedding/embedobj.cxx
@@ -100,6 +100,12 @@ void OCommonEmbeddedObject::Deactivate()
 {
 try {
 xClientSite->saveObject();
+
+// tdf#141529 take note that an eventually used linked file
+// got changed/saved/written and that we need to copy it back if 
the
+// hosting file/document gets saved
+if(m_aLinkTempFile.is())
+m_bLinkTempFileChanged = true;
 }
 catch( const embed::ObjectSaveVetoException& )
 {
@@ -168,7 +174,7 @@ void OCommonEmbeddedObject::SwitchStateTo_Impl( sal_Int32 
nNextState )
 // after the object reaches the running state the cloned size is 
not necessary any more
 m_bHasClonedSize = false;
 
-if ( m_bIsLink )
+if ( m_bIsLinkURL )
 {
 m_xDocHolder->SetComponent( LoadLink_Impl(), m_bReadOnly );
 }
diff --git a/embeddedobj/source/commonembedding/miscobj.cxx 
b/embeddedobj/source/commonembedding/miscobj.cxx
index c30a4bc64168..7336df5455e3 100644
--- a/embeddedobj/source/commonembedding/miscobj.cxx
+++ b/embeddedobj/source/commonembedding/miscobj.cxx
@@ -27,6 +27,10 @@
 #include 
 #include 
 
+#include 
+#include 
+#include 
+
 #include 
 #include 
 #include 
@@ -52,8 +56,10 @@ OCommonEmbeddedObject::OCommonEmbeddedObject( const 
uno::Reference< uno::XCompon
 , m_bEmbeddedScriptSupport( true )
 , m_bDocumentRecoverySupport( true )
 , m_bWaitSaveCompleted( false )
-, m_bIsLink( false )
+, m_bIsLinkURL( false )
+, m_bLinkTempFileChanged( false )
 , m_bLinkHasPassword( false )
+, m_aLinkTempFile( )
 , m_bHasClonedSize( false )
 , m_nClonedMapUnit( 0 )
 {
@@ -77,8 +83,10 @@ OCommonEmbeddedObject::OCommonEmbeddedObject(
 , m_bEmbeddedScriptSupport( true )
 , m_bDocumentRecoverySupport( true )
 , m_bWaitSaveCompleted( false )
-, m_bIsLink( true )
+, m_bIsLinkURL( true )
+, m_bLinkTempFileChanged( false )
 , m_bLinkHasPassword( false )
+, m_aLinkTempFile( )
 , m_bHasClonedSize( false )
 , m_nClonedMapUnit( 0 )
 {
@@ -213,7 +221,61 @@ void OCommonEmbeddedObject::LinkInit_Impl(
 m_bReadOnly = aExportFilterName != m_aLinkFilterName;
 }
 
-m_aDocMediaDescriptor = GetValuableArgs_Impl( aMediaDescr, false );
+if(m_bIsLinkURL && !m_bReadOnly)
+{
+// tdf#141529 we have a linked OLE object. To prevent the original OLE
+// data to be changed each time the OLE gets changed (at deactivate), 
copy it to
+// a temporary file. That file will be changed on activated OLE 
changes then.
+// The moment the original gets changed itself will now be associated 
with the
+// file/document embedding the OLE being changed (see other additions 
to the
+// task-ID above)
+//
+// open OLE original data as read input file
+uno::Reference< ucb::XSimpleFileAccess3 > xTempAccess( 
ucb::SimpleFileAccess::create( m_xContext ) );
+uno::Reference< io::XInputStream > xInStream( 
xTempAccess->openFileRead( m_aLinkURL ) );
+
+if(xInStream.is())
+{
+// create temporary file
+m_aLinkTempFile = io::TempFile::create(m_xContext);
+
+

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

2021-04-08 Thread Andrea Gelmini (via logerrit)
 embeddedobj/source/commonembedding/persistence.cxx |2 +-
 sw/source/core/crsr/crstrvl.cxx|4 ++--
 wizards/source/scriptforge/SF_Exception.xba|4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 78eaf6489a6542378ffab7eef39ec0a2c5f1a10a
Author: Andrea Gelmini 
AuthorDate: Wed Apr 7 16:02:15 2021 +0200
Commit: Andrea Gelmini 
CommitDate: Thu Apr 8 08:22:47 2021 +0200

Fix typos

Change-Id: I41f5c964a289a88b3f6fc637797fe77d17aaab38
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113737
Reviewed-by: Julien Nabet 
Tested-by: Jenkins

diff --git a/embeddedobj/source/commonembedding/persistence.cxx 
b/embeddedobj/source/commonembedding/persistence.cxx
index d1235fdfa1c8..129036988f31 100644
--- a/embeddedobj/source/commonembedding/persistence.cxx
+++ b/embeddedobj/source/commonembedding/persistence.cxx
@@ -1795,7 +1795,7 @@ void SAL_CALL OCommonEmbeddedObject::breakLink( const 
uno::Reference< embed::XSt
 {
 // tdf#141528 m_xDocHolder->GetComponent() may be not set, so add 
it
 // to the try path to not get thrown out of the local context to 
the next
-// highter try...catch on the stack. To make breakLink work it is
+// higher try...catch on the stack. To make breakLink work it is
 // *necessary* to execute the code below that resets the linked 
state,
 // esp. the *.clear stuff and resetting m_bIsLink.
 uno::Reference< util::XModifiable > xModif( 
m_xDocHolder->GetComponent(), uno::UNO_QUERY_THROW );
diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx
index 529ab1efe032..a08e0f4c3fba 100644
--- a/sw/source/core/crsr/crstrvl.cxx
+++ b/sw/source/core/crsr/crstrvl.cxx
@@ -2211,7 +2211,7 @@ const SwRangeRedline* SwCursorShell::SelNextRedline()
 NormalizePam(false);
 pFnd = GetDoc()->getIDocumentRedlineAccess().SelNextRedline( 
*m_pCurrentCursor );
 
-// at the end of the document, go the the start of the document, and 
try again
+// at the end of the document, go to the start of the document, and 
try again
 if ( !pFnd )
 {
 GetDoc()->GetDocShell()->GetWrtShell()->StartOfSection();
@@ -2239,7 +2239,7 @@ const SwRangeRedline* SwCursorShell::SelPrevRedline()
 NormalizePam(true);
 pFnd = GetDoc()->getIDocumentRedlineAccess().SelPrevRedline( 
*m_pCurrentCursor );
 
-// at the start of the document, go the the end of the document, and 
try again
+// at the start of the document, go to the end of the document, and 
try again
 if ( !pFnd )
 {
 GetDoc()->GetDocShell()->GetWrtShell()->EndOfSection();
diff --git a/wizards/source/scriptforge/SF_Exception.xba 
b/wizards/source/scriptforge/SF_Exception.xba
index ba9ce109ecc8..d2ee476c6430 100644
--- a/wizards/source/scriptforge/SF_Exception.xba
+++ b/wizards/source/scriptforge/SF_Exception.xba
@@ -307,7 +307,7 @@ Public Sub ConsoleClear(Optional ByVal Keep)
  Clear the console keeping an optional number of recent 
messages
  Args:
  Keep: the number of messages to keep
- If Keep is bigger than the the 
number of messages stored in the console,
+ If Keep is bigger than the 
number of messages stored in the console,
  the console is not cleared
  Example:
  SF_Exception.ConsoleClear(5)
@@ -1173,4 +1173,4 @@ Private Function _Repr() As String
 End Function ScriptForge.SF_Exception._Repr
 
 REM  END OF 
SCRIPTFORGE.SF_EXCEPTION
-
\ No newline at end of file
+
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: embeddedobj/source

2021-04-07 Thread Armin Le Grand (Allotropia) (via logerrit)
 embeddedobj/source/commonembedding/persistence.cxx |   15 +--
 1 file changed, 13 insertions(+), 2 deletions(-)

New commits:
commit 2f665daa29dd5509b4ceb0461e76292e2262fa56
Author: Armin Le Grand (Allotropia) 
AuthorDate: Wed Apr 7 11:15:04 2021 +0200
Commit: Armin Le Grand 
CommitDate: Wed Apr 7 14:40:04 2021 +0200

tdf#141528 ensure that reset of linked state is executed

Take m_xDocHolder->GetComponent() and xModif->setModified
inside the local try..catch expression to ensure that the
reset of the linked state below (m_bIsLink and .clear())
is executed

Change-Id: I52d49569a43fd2c23dd997c7217f7552cbdcfb82
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113722
Tested-by: Armin Le Grand 
Reviewed-by: Armin Le Grand 

diff --git a/embeddedobj/source/commonembedding/persistence.cxx 
b/embeddedobj/source/commonembedding/persistence.cxx
index dd7099c01a77..d1235fdfa1c8 100644
--- a/embeddedobj/source/commonembedding/persistence.cxx
+++ b/embeddedobj/source/commonembedding/persistence.cxx
@@ -1789,10 +1789,21 @@ void SAL_CALL OCommonEmbeddedObject::breakLink( const 
uno::Reference< embed::XSt
 // TODO/LATER: handle the case when temp doc can not be created
 // the document is a new embedded object so it must be marked as modified
 uno::Reference< util::XCloseable > xDocument = 
CreateTempDocFromLink_Impl();
-uno::Reference< util::XModifiable > xModif( m_xDocHolder->GetComponent(), 
uno::UNO_QUERY_THROW );
 try
 {
-xModif->setModified( true );
+if(m_xDocHolder.is() && m_xDocHolder->GetComponent().is())
+{
+// tdf#141528 m_xDocHolder->GetComponent() may be not set, so add 
it
+// to the try path to not get thrown out of the local context to 
the next
+// highter try...catch on the stack. To make breakLink work it is
+// *necessary* to execute the code below that resets the linked 
state,
+// esp. the *.clear stuff and resetting m_bIsLink.
+uno::Reference< util::XModifiable > xModif( 
m_xDocHolder->GetComponent(), uno::UNO_QUERY_THROW );
+
+// all other locations in this file check for xModif.is(), so do 
it here, too
+if ( xModif.is() )
+xModif->setModified( true );
+}
 }
 catch( const uno::Exception& )
 {}
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: embeddedobj/source

2021-03-02 Thread Stephan Bergmann (via logerrit)
 embeddedobj/source/inc/oleembobj.hxx  |6 +++---
 embeddedobj/source/msole/olecomponent.cxx |2 +-
 embeddedobj/source/msole/olecomponent.hxx |4 ++--
 embeddedobj/source/msole/olemisc.cxx  |   20 +++-
 embeddedobj/source/msole/olepersist.cxx   |   12 ++--
 5 files changed, 19 insertions(+), 25 deletions(-)

New commits:
commit 097fcd045e99edcf418e8b34ccb6d6b0b8b8de4b
Author: Stephan Bergmann 
AuthorDate: Tue Mar 2 10:51:50 2021 +0100
Commit: Stephan Bergmann 
CommitDate: Wed Mar 3 08:49:48 2021 +0100

loplugin:refcounting (clang-cl)

Change-Id: Ifa54eed0a772b658d266e9e42be5f5232e7a6b79
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111812
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/embeddedobj/source/inc/oleembobj.hxx 
b/embeddedobj/source/inc/oleembobj.hxx
index a4cc71c0f8d8..bc75a5af9c4c 100644
--- a/embeddedobj/source/inc/oleembobj.hxx
+++ b/embeddedobj/source/inc/oleembobj.hxx
@@ -120,7 +120,7 @@ class OleEmbeddedObject : public ::cppu::WeakImplHelper
 
 ::osl::Mutexm_aMutex;
 
-OleComponent*   m_pOleComponent;
+rtl::Reference m_pOleComponent;
 
 std::unique_ptr<::cppu::OMultiTypeInterfaceContainerHelper> 
m_pInterfaceContainer;
 
@@ -274,8 +274,8 @@ protected:
 #ifdef _WIN32
 bool SaveObject_Impl();
 bool OnShowWindow_Impl( bool bShow );
-void CreateOleComponent_Impl( OleComponent* pOleComponent = nullptr );
-void CreateOleComponentAndLoad_Impl( OleComponent* pOleComponent = nullptr 
);
+void CreateOleComponent_Impl( rtl::Reference const & 
pOleComponent = {} );
+void CreateOleComponentAndLoad_Impl( rtl::Reference const & 
pOleComponent = {} );
 void CreateOleComponentFromClipboard_Impl( OleComponent* pOleComponent = 
nullptr );
 OUString CreateTempURLEmpty_Impl();
 OUString GetTempURL_Impl();
diff --git a/embeddedobj/source/msole/olecomponent.cxx 
b/embeddedobj/source/msole/olecomponent.cxx
index 4a123d5ca0ab..9fe827bb00d9 100644
--- a/embeddedobj/source/msole/olecomponent.cxx
+++ b/embeddedobj/source/msole/olecomponent.cxx
@@ -881,7 +881,7 @@ void OleComponent::CreateLinkFromFile( const OUString& 
aFileURL )
 }
 
 
-void OleComponent::InitEmbeddedCopyOfLink( OleComponent const * 
pOleLinkComponent )
+void OleComponent::InitEmbeddedCopyOfLink( rtl::Reference const 
& pOleLinkComponent )
 {
 if ( !pOleLinkComponent || !pOleLinkComponent->m_pNativeImpl->m_pObj )
 throw lang::IllegalArgumentException(); // TODO
diff --git a/embeddedobj/source/msole/olecomponent.hxx 
b/embeddedobj/source/msole/olecomponent.hxx
index 3ff53291c01f..63547c321adc 100644
--- a/embeddedobj/source/msole/olecomponent.hxx
+++ b/embeddedobj/source/msole/olecomponent.hxx
@@ -32,7 +32,7 @@
 #include 
 #include 
 #include 
-
+#include 
 
 namespace cppu {
 class OMultiTypeInterfaceContainerHelper;
@@ -103,7 +103,7 @@ public:
 const css::uno::Reference< 
css::datatransfer::XTransferable >& xTransfer );
 void CreateObjectFromFile( const OUString& aFileName );
 void CreateLinkFromFile( const OUString& aFileName );
-void InitEmbeddedCopyOfLink( OleComponent const * pOleLinkComponent );
+void InitEmbeddedCopyOfLink( rtl::Reference const & 
pOleLinkComponent );
 
 
 void RunObject(); // switch OLE object to running state
diff --git a/embeddedobj/source/msole/olemisc.cxx 
b/embeddedobj/source/msole/olemisc.cxx
index 90041729d03d..f85c845e31a8 100644
--- a/embeddedobj/source/msole/olemisc.cxx
+++ b/embeddedobj/source/msole/olemisc.cxx
@@ -36,9 +36,7 @@
 
 #include "ownview.hxx"
 
-#if defined(_WIN32)
 #include "olecomponent.hxx"
-#endif
 
 using namespace ::com::sun::star;
 
@@ -46,8 +44,7 @@ using namespace ::com::sun::star;
 OleEmbeddedObject::OleEmbeddedObject( const uno::Reference< 
uno::XComponentContext >& xContext,
   const uno::Sequence< sal_Int8 >& 
aClassID,
   const OUString& aClassName )
-: m_pOleComponent( nullptr )
-, m_bReadOnly( false )
+: m_bReadOnly( false )
 , m_bDisposed( false )
 , m_nObjectState( -1 )
 , m_nTargetState( -1 )
@@ -78,8 +75,7 @@ OleEmbeddedObject::OleEmbeddedObject( const uno::Reference< 
uno::XComponentConte
 // In case of loading from persistent entry the classID of the object
 // will be retrieved from the entry, during construction it is unknown
 OleEmbeddedObject::OleEmbeddedObject( const uno::Reference< 
uno::XComponentContext >& xContext, bool bLink )
-: m_pOleComponent( nullptr )
-, m_bReadOnly( false )
+: m_bReadOnly( false )
 , m_bDisposed( false )
 , m_nObjectState( -1 )
 , m_nTargetState( -1 )
@@ -107,8 +103,7 @@ OleEmbeddedObject::OleEmbeddedObject( const uno::Reference< 
uno::XComponentConte
 
 // this constructor let object be initialized from clipboard
 OleEmbeddedObject::OleEmbeddedObject( const uno::Reference< 
uno::XComponentContext >& xContext )
-: m_pOleComponent( nullptr )
-, m_bReadOnly( false )
+: 

[Libreoffice-commits] core.git: embeddedobj/source

2021-02-02 Thread Caolán McNamara (via logerrit)
 embeddedobj/source/msole/oleembed.cxx |7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

New commits:
commit 2d084836102fdf3a486bd8c01f55ae0a5a673d10
Author: Caolán McNamara 
AuthorDate: Tue Feb 2 12:58:47 2021 +
Commit: Caolán McNamara 
CommitDate: Tue Feb 2 21:16:34 2021 +0100

tdf#140079 Claim support for the OleEmbeddedObject::doVerb -9 fallback

So in SfxViewFrame::GetState_Impl in case SID_OBJECT hasVerbs is not
empty, so that the doVerb attempt with -9 fallback is attempted

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

diff --git a/embeddedobj/source/msole/oleembed.cxx 
b/embeddedobj/source/msole/oleembed.cxx
index 890457af909f..926f5b9e9393 100644
--- a/embeddedobj/source/msole/oleembed.cxx
+++ b/embeddedobj/source/msole/oleembed.cxx
@@ -1004,7 +1004,12 @@ uno::Sequence< embed::VerbDescriptor > SAL_CALL 
OleEmbeddedObject::getSupportedV
 else
 #endif
 {
-return uno::Sequence< embed::VerbDescriptor >();
+// tdf#140079 Claim support for the OleEmbeddedObject::doVerb -9 
fallback.
+// So in SfxViewFrame::GetState_Impl in case SID_OBJECT hasVerbs is not
+// empty, so that the doVerb attempt with -9 fallback is attempted
+uno::Sequence aRet(1);
+aRet[0].VerbID = -9;
+return aRet;
 }
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: embeddedobj/source package/source sfx2/source svl/source xmloff/source

2021-01-12 Thread Bayram Çiçek (via logerrit)
 embeddedobj/source/msole/olepersist.cxx   |2 +-
 package/source/xstor/owriteablestream.cxx |2 +-
 sfx2/source/doc/doctemplateslocal.cxx |2 +-
 svl/source/fsstor/fsfactory.cxx   |2 +-
 xmloff/source/meta/xmlversion.cxx |2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 32676270d194b68d7dd811511feb0903876b5c06
Author: Bayram Çiçek 
AuthorDate: Sun Jan 10 21:47:43 2021 +
Commit: Michael Stahl 
CommitDate: Tue Jan 12 19:24:51 2021 +0100

tdf#42982: Improve UNO API error reporting

Change-Id: I78c6fed4e94f1ebfc772db4dec9955da7230bc3f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109071
Reviewed-by: Michael Stahl 
Tested-by: Jenkins

diff --git a/embeddedobj/source/msole/olepersist.cxx 
b/embeddedobj/source/msole/olepersist.cxx
index 2d5dfbf59a4d..04d5b6433c07 100644
--- a/embeddedobj/source/msole/olepersist.cxx
+++ b/embeddedobj/source/msole/olepersist.cxx
@@ -102,7 +102,7 @@ OUString GetNewTempFileURL_Impl( const uno::Reference< 
uno::XComponentContext >&
 }
 
 if ( aResult.isEmpty() )
-throw uno::RuntimeException(); // TODO: can not create tempfile
+throw uno::RuntimeException("Cannot create tempfile.");
 
 return aResult;
 }
diff --git a/package/source/xstor/owriteablestream.cxx 
b/package/source/xstor/owriteablestream.cxx
index 9655240c4602..77a34c533653 100644
--- a/package/source/xstor/owriteablestream.cxx
+++ b/package/source/xstor/owriteablestream.cxx
@@ -237,7 +237,7 @@ OUString GetNewTempFileURL( const uno::Reference< 
uno::XComponentContext >& rCon
 }
 
 if ( aTempURL.isEmpty() )
-throw uno::RuntimeException(); // TODO: can not create tempfile
+throw uno::RuntimeException("Cannot create tempfile.");
 
 return aTempURL;
 }
diff --git a/sfx2/source/doc/doctemplateslocal.cxx 
b/sfx2/source/doc/doctemplateslocal.cxx
index d7c24934f89a..e72b74eb8efe 100644
--- a/sfx2/source/doc/doctemplateslocal.cxx
+++ b/sfx2/source/doc/doctemplateslocal.cxx
@@ -122,7 +122,7 @@ DocTemplLocaleHelper::~DocTemplLocaleHelper()
 std::vector< beans::StringPair > const & 
DocTemplLocaleHelper::GetParsingResult() const
 {
 if ( !m_aElementsSeq.empty() )
-throw uno::RuntimeException(); // the parsing has still not finished!
+throw uno::RuntimeException("The parsing has still not finished!");
 
 return m_aResultSeq;
 }
diff --git a/svl/source/fsstor/fsfactory.cxx b/svl/source/fsstor/fsfactory.cxx
index 91fe8d35f983..455e1b6ce590 100644
--- a/svl/source/fsstor/fsfactory.cxx
+++ b/svl/source/fsstor/fsfactory.cxx
@@ -40,7 +40,7 @@ uno::Reference< uno::XInterface > SAL_CALL 
FSStorageFactory::createInstance()
 OUString aTempURL = ::utl::TempFile( nullptr, true ).GetURL();
 
 if ( aTempURL.isEmpty() )
-throw uno::RuntimeException(); // TODO: can not create tempfile
+throw uno::RuntimeException("Cannot create tempfile.");
 
 ::ucbhelper::Content aResultContent(
 aTempURL, uno::Reference< ucb::XCommandEnvironment >(),
diff --git a/xmloff/source/meta/xmlversion.cxx 
b/xmloff/source/meta/xmlversion.cxx
index 7776ea876427..1276e0e6fcdf 100644
--- a/xmloff/source/meta/xmlversion.cxx
+++ b/xmloff/source/meta/xmlversion.cxx
@@ -325,7 +325,7 @@ void SAL_CALL XMLVersionListPersistence::store( const 
uno::Reference< embed::XSt
 
 Reference< io::XOutputStream > xOut = xVerStream->getOutputStream();
 if ( !xOut.is() )
-throw uno::RuntimeException(); // the stream was successfully 
opened for writing already
+throw uno::RuntimeException("The stream was successfully opened 
for writing already!");
 
 xWriter->setOutputStream(xOut);
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: embeddedobj/source

2020-11-25 Thread Stephan Bergmann (via logerrit)
 embeddedobj/source/msole/olecomponent.cxx |3 +--
 embeddedobj/source/msole/olecomponent.hxx |2 +-
 embeddedobj/source/msole/oleembed.cxx |2 +-
 3 files changed, 3 insertions(+), 4 deletions(-)

New commits:
commit c638985dd3a63cdf76b2af67cd890f656a9c38eb
Author: Stephan Bergmann 
AuthorDate: Wed Nov 25 09:50:15 2020 +0100
Commit: Stephan Bergmann 
CommitDate: Wed Nov 25 11:27:00 2020 +0100

Remove unused OleComponent::SetHostName aContName parameter

Unused ever since the code was introduced in
5ea5c0afebd272d5f44e6524c0f67b5317639919 "#112923# embedded object for MS 
OLE".
(The accompanying

  // TODO: use aContName and aEmbDocName in m_pOleObject->SetHostNames()

comment was removed when a307ad7ae029a0a62404996a63954e7026001ce3 "OLE: show
title of parent document in MSO" started to use the aEmbDocName parameter, 
which
had previously been unused too.)

Change-Id: I0fbb20dbf526a3fdbdc4a3e76e64fa80e8460480
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106571
Reviewed-by: Szymon Kłos 
Reviewed-by: Stephan Bergmann 
Tested-by: Jenkins

diff --git a/embeddedobj/source/msole/olecomponent.cxx 
b/embeddedobj/source/msole/olecomponent.cxx
index ea5bb265aa2c..4a123d5ca0ab 100644
--- a/embeddedobj/source/msole/olecomponent.cxx
+++ b/embeddedobj/source/msole/olecomponent.cxx
@@ -1079,8 +1079,7 @@ void OleComponent::ExecuteVerb( sal_Int32 nVerbID )
 }
 
 
-void OleComponent::SetHostName( const OUString&,
-const OUString& aEmbDocName )
+void OleComponent::SetHostName( const OUString& aEmbDocName )
 {
 if ( !m_pNativeImpl->m_pOleObject )
 throw embed::WrongStateException(); // TODO: the object is in wrong 
state
diff --git a/embeddedobj/source/msole/olecomponent.hxx 
b/embeddedobj/source/msole/olecomponent.hxx
index 7cfcce4fd13a..3ff53291c01f 100644
--- a/embeddedobj/source/msole/olecomponent.hxx
+++ b/embeddedobj/source/msole/olecomponent.hxx
@@ -112,7 +112,7 @@ public:
 css::uno::Sequence< css::embed::VerbDescriptor > GetVerbList();
 
 void ExecuteVerb( sal_Int32 nVerbID );
-void SetHostName( const OUString& aContName, const OUString& aEmbDocName );
+void SetHostName( const OUString& aEmbDocName );
 void SetExtent( const css::awt::Size& aVisAreaSize, sal_Int64 nAspect );
 
 css::awt::Size GetExtent( sal_Int64 nAspect );
diff --git a/embeddedobj/source/msole/oleembed.cxx 
b/embeddedobj/source/msole/oleembed.cxx
index b22ece2f7cea..91b19bcdd78c 100644
--- a/embeddedobj/source/msole/oleembed.cxx
+++ b/embeddedobj/source/msole/oleembed.cxx
@@ -875,7 +875,7 @@ void SAL_CALL OleEmbeddedObject::doVerb( sal_Int32 nVerbID )
 
 
 m_pOleComponent->ExecuteVerb( nVerbID );
-m_pOleComponent->SetHostName( OUString(), m_aContainerName );
+m_pOleComponent->SetHostName( m_aContainerName );
 
 //  the STAMPIT related solution =
 bool bModifiedOnExecution = 
m_aVerbExecutionController.EndControlExecution_WasModified();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: embeddedobj/source solenv/clang-format

2020-11-12 Thread Philipp Hofer (via logerrit)
 embeddedobj/source/msole/advisesink.hxx |   12 ++--
 embeddedobj/source/msole/closepreventer.cxx |   10 +-
 solenv/clang-format/excludelist |2 --
 3 files changed, 11 insertions(+), 13 deletions(-)

New commits:
commit 2c771b7b79a206987241b595712b9026fdcb5e89
Author: Philipp Hofer 
AuthorDate: Thu Nov 12 12:55:22 2020 +0100
Commit: Mike Kaganski 
CommitDate: Fri Nov 13 08:17:42 2020 +0100

tdf#123936 Formatting files in module embeddedobj with clang-format

Change-Id: If177567a6e5ac934dec11a4b873005f563d77689
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105664
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/embeddedobj/source/msole/advisesink.hxx 
b/embeddedobj/source/msole/advisesink.hxx
index 1d54c20a14f0..cd1bc3892865 100644
--- a/embeddedobj/source/msole/advisesink.hxx
+++ b/embeddedobj/source/msole/advisesink.hxx
@@ -32,7 +32,7 @@ protected:
 OleComponent* m_pOleComp;
 
 public:
-OleWrapperAdviseSink( OleComponent* pOleComp );
+OleWrapperAdviseSink(OleComponent* pOleComp);
 OleWrapperAdviseSink();
 virtual ~OleWrapperAdviseSink();
 
@@ -41,11 +41,11 @@ public:
 STDMETHODIMP_(ULONG) AddRef() override;
 STDMETHODIMP_(ULONG) Release() override;
 
-STDMETHODIMP_(void)  OnDataChange(FORMATETC *, STGMEDIUM *) override;
-STDMETHODIMP_(void)  OnViewChange(DWORD, LONG) override;
-STDMETHODIMP_(void)  OnRename(IMoniker *) override;
-STDMETHODIMP_(void)  OnSave() override;
-STDMETHODIMP_(void)  OnClose() override;
+STDMETHODIMP_(void) OnDataChange(FORMATETC*, STGMEDIUM*) override;
+STDMETHODIMP_(void) OnViewChange(DWORD, LONG) override;
+STDMETHODIMP_(void) OnRename(IMoniker*) override;
+STDMETHODIMP_(void) OnSave() override;
+STDMETHODIMP_(void) OnClose() override;
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/embeddedobj/source/msole/closepreventer.cxx 
b/embeddedobj/source/msole/closepreventer.cxx
index 00596030ace9..4669758982f8 100644
--- a/embeddedobj/source/msole/closepreventer.cxx
+++ b/embeddedobj/source/msole/closepreventer.cxx
@@ -22,21 +22,21 @@
 #include 
 #include 
 
-void SAL_CALL OClosePreventer::queryClosing( const css::lang::EventObject&, 
sal_Bool  )
+void SAL_CALL OClosePreventer::queryClosing(const css::lang::EventObject&, 
sal_Bool)
 {
 throw css::util::CloseVetoException();
 }
 
-void SAL_CALL OClosePreventer::notifyClosing( const css::lang::EventObject& )
+void SAL_CALL OClosePreventer::notifyClosing(const css::lang::EventObject&)
 {
 // just a disaster
-OSL_FAIL( "The object can not be prevented from closing!" );
+OSL_FAIL("The object can not be prevented from closing!");
 }
 
-void SAL_CALL OClosePreventer::disposing( const css::lang::EventObject& )
+void SAL_CALL OClosePreventer::disposing(const css::lang::EventObject&)
 {
 // just a disaster
-OSL_FAIL( "The object can not be prevented from closing!" );
+OSL_FAIL("The object can not be prevented from closing!");
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist
index 18e31bee0169..82f1cb4b4dc2 100644
--- a/solenv/clang-format/excludelist
+++ b/solenv/clang-format/excludelist
@@ -3831,8 +3831,6 @@ embeddedobj/source/inc/specialobject.hxx
 embeddedobj/source/inc/targetstatecontrol.hxx
 embeddedobj/source/inc/xcreator.hxx
 embeddedobj/source/msole/advisesink.cxx
-embeddedobj/source/msole/advisesink.hxx
-embeddedobj/source/msole/closepreventer.cxx
 embeddedobj/source/msole/graphconvert.cxx
 embeddedobj/source/msole/graphconvert.hxx
 embeddedobj/source/msole/mtnotification.hxx
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: embeddedobj/source embeddedobj/util

2020-10-02 Thread Stephan Bergmann (via logerrit)
 embeddedobj/source/commonembedding/xfactory.cxx  |9 +++--
 embeddedobj/source/general/xcreator.cxx  |6 ++
 embeddedobj/source/msole/emboleobj.component |3 ++-
 embeddedobj/source/msole/emboleobj.windows.component |6 --
 embeddedobj/source/msole/xdialogcreator.cxx  |5 ++---
 embeddedobj/source/msole/xolefactory.cxx |5 ++---
 embeddedobj/util/embobj.component|9 ++---
 7 files changed, 21 insertions(+), 22 deletions(-)

New commits:
commit a2b256df787e76c90c110f363cf7a3b84b54947f
Author: Stephan Bergmann 
AuthorDate: Fri Oct 2 14:26:51 2020 +0200
Commit: Stephan Bergmann 
CommitDate: Fri Oct 2 20:43:58 2020 +0200

Use the new single-instance="true" attribute in embeddedobj

Change-Id: Icead3bb5715a08bc2a2dfbb16c074d1b19e316a9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103855
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/embeddedobj/source/commonembedding/xfactory.cxx 
b/embeddedobj/source/commonembedding/xfactory.cxx
index a4ef74d08ee4..3f7cb8fde98f 100644
--- a/embeddedobj/source/commonembedding/xfactory.cxx
+++ b/embeddedobj/source/commonembedding/xfactory.cxx
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include "xfactory.hxx"
@@ -367,9 +368,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
 embeddedobj_OOoEmbeddedObjectFactory_get_implementation(
 css::uno::XComponentContext* context, css::uno::Sequence 
const&)
 {
-static rtl::Reference g_Instance(new 
OOoEmbeddedObjectFactory(context));
-g_Instance->acquire();
-return static_cast(g_Instance.get());
+return cppu::acquire(static_cast(new 
OOoEmbeddedObjectFactory(context)));
 }
 
 
@@ -413,8 +412,6 @@ extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
 embeddedobj_OOoSpecialEmbeddedObjectFactory_get_implementation(
 css::uno::XComponentContext* context, css::uno::Sequence 
const&)
 {
-static rtl::Reference g_Instance(new 
OOoSpecialEmbeddedObjectFactory(context));
-g_Instance->acquire();
-return static_cast(g_Instance.get());
+return cppu::acquire(static_cast(new 
OOoSpecialEmbeddedObjectFactory(context)));
 }
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/embeddedobj/source/general/xcreator.cxx 
b/embeddedobj/source/general/xcreator.cxx
index 9e9bb0934603..a54295895190 100644
--- a/embeddedobj/source/general/xcreator.cxx
+++ b/embeddedobj/source/general/xcreator.cxx
@@ -28,9 +28,9 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
-#include 
 
 #include 
 #include 
@@ -410,9 +410,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
 embeddedobj_UNOEmbeddedObjectCreator_get_implementation(
 css::uno::XComponentContext* context, css::uno::Sequence 
const&)
 {
-static rtl::Reference g_Instance(new 
UNOEmbeddedObjectCreator(context));
-g_Instance->acquire();
-return static_cast(g_Instance.get());
+return cppu::acquire(static_cast(new 
UNOEmbeddedObjectCreator(context)));
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/embeddedobj/source/msole/emboleobj.component 
b/embeddedobj/source/msole/emboleobj.component
index bf7e128f04e5..ac09d3a6d32d 100644
--- a/embeddedobj/source/msole/emboleobj.component
+++ b/embeddedobj/source/msole/emboleobj.component
@@ -20,7 +20,8 @@
 http://openoffice.org/2010/uno-components;>
   
+   constructor="embeddedobj_OleEmbeddedObjectFactory_get_implementation"
+   single-instance="true">
 
 
   
diff --git a/embeddedobj/source/msole/emboleobj.windows.component 
b/embeddedobj/source/msole/emboleobj.windows.component
index e41c81d33048..89b644fc79b0 100644
--- a/embeddedobj/source/msole/emboleobj.windows.component
+++ b/embeddedobj/source/msole/emboleobj.windows.component
@@ -20,12 +20,14 @@
 http://openoffice.org/2010/uno-components;>
   
+   constructor="embeddedobj_MSOLEDialogObjectCreator_get_implementation"
+   single-instance="true">
 
 
   
   
+   constructor="embeddedobj_OleEmbeddedObjectFactory_get_implementation"
+   single-instance="true">
 
 
   
diff --git a/embeddedobj/source/msole/xdialogcreator.cxx 
b/embeddedobj/source/msole/xdialogcreator.cxx
index 49e9c0c925e4..415039c3f1fc 100644
--- a/embeddedobj/source/msole/xdialogcreator.cxx
+++ b/embeddedobj/source/msole/xdialogcreator.cxx
@@ -35,6 +35,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "xdialogcreator.hxx"
 #include 
@@ -323,9 +324,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
 embeddedobj_MSOLEDialogObjectCreator_get_implementation(
 css::uno::XComponentContext* context, css::uno::Sequence 
const&)
 {
-static rtl::Reference g_Instance(new 
MSOLEDialogObjectCreator(context));
-g_Instance->acquire();
-return static_cast(g_Instance.get());
+return cppu::acquire(static_cast(new 
MSOLEDialogObjectCreator(context)));
 }
 
 /* vim:set shiftwidth=4 

[Libreoffice-commits] core.git: embeddedobj/source embeddedobj/test

2020-09-13 Thread George Bateman (via logerrit)
 embeddedobj/source/commonembedding/embedobj.hxx|5 +
 embeddedobj/source/commonembedding/persistence.hxx |5 +
 embeddedobj/source/commonembedding/xfactory.hxx|5 +
 embeddedobj/source/inc/closepreventer.hxx  |5 +
 embeddedobj/source/inc/commonembobj.hxx|5 +
 embeddedobj/source/inc/docholder.hxx   |5 +
 embeddedobj/source/inc/dummyobject.hxx |5 +
 embeddedobj/source/inc/intercept.hxx   |5 +
 embeddedobj/source/inc/oleembobj.hxx   |5 +
 embeddedobj/source/inc/specialobject.hxx   |5 +
 embeddedobj/source/inc/targetstatecontrol.hxx  |5 +
 embeddedobj/source/inc/xcreator.hxx|5 +
 embeddedobj/source/msole/advisesink.hxx|5 +
 embeddedobj/source/msole/graphconvert.hxx  |5 +
 embeddedobj/source/msole/mtnotification.hxx|5 +
 embeddedobj/source/msole/olecomponent.hxx  |5 +
 embeddedobj/source/msole/olepersist.hxx|5 +
 embeddedobj/source/msole/olewrapclient.hxx |5 +
 embeddedobj/source/msole/ownview.hxx   |5 +
 embeddedobj/source/msole/platform.h|5 +
 embeddedobj/source/msole/xdialogcreator.hxx|5 +
 embeddedobj/source/msole/xolefactory.hxx   |5 +
 embeddedobj/test/MainThreadExecutor/xexecutor.hxx  |5 +
 embeddedobj/test/mtexecutor/bitmapcreator.hxx  |5 +
 embeddedobj/test/mtexecutor/mainthreadexecutor.hxx |5 +
 25 files changed, 25 insertions(+), 100 deletions(-)

New commits:
commit 3d7e089a3def73d45d60de4db4b3fe4a3bbeb453
Author: George Bateman 
AuthorDate: Sun Sep 13 12:16:53 2020 +
Commit: Julien Nabet 
CommitDate: Sun Sep 13 17:52:50 2020 +0200

tdf#124176 Use #pragma once in embeddedobj

This commit was carried out by a Python script, source of which
is at https://bugs.documentfoundation.org/show_bug.cgi?id=124176#c97.

Change-Id: Ia481a860be174b817106ac13eccb5e53ee070aec
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102577
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/embeddedobj/source/commonembedding/embedobj.hxx 
b/embeddedobj/source/commonembedding/embedobj.hxx
index 6778238d2f59..5b1d8b235765 100644
--- a/embeddedobj/source/commonembedding/embedobj.hxx
+++ b/embeddedobj/source/commonembedding/embedobj.hxx
@@ -17,13 +17,10 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_EMBEDDEDOBJ_SOURCE_COMMONEMBEDDING_EMBEDOBJ_HXX
-#define INCLUDED_EMBEDDEDOBJ_SOURCE_COMMONEMBEDDING_EMBEDOBJ_HXX
+#pragma once
 
 #include 
 
 css::awt::Rectangle GetRectangleInterception( const css::awt::Rectangle& 
aRect1, const css::awt::Rectangle& aRect2 );
 
-#endif // INCLUDED_EMBEDDEDOBJ_SOURCE_COMMONEMBEDDING_EMBEDOBJ_HXX
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/embeddedobj/source/commonembedding/persistence.hxx 
b/embeddedobj/source/commonembedding/persistence.hxx
index a6ef252629fd..d24aee5e46e6 100644
--- a/embeddedobj/source/commonembedding/persistence.hxx
+++ b/embeddedobj/source/commonembedding/persistence.hxx
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_EMBEDDEDOBJ_SOURCE_COMMONEMBEDDING_PERSISTENCE_HXX
-#define INCLUDED_EMBEDDEDOBJ_SOURCE_COMMONEMBEDDING_PERSISTENCE_HXX
+#pragma once
 
 #include 
 
@@ -26,6 +25,4 @@ css::uno::Sequence< css::beans::PropertyValue > 
GetValuableArgs_Impl( const css:
 bool 
bCanUseDocumentBaseURL );
 
 
-#endif // INCLUDED_EMBEDDEDOBJ_SOURCE_COMMONEMBEDDING_PERSISTENCE_HXX
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/embeddedobj/source/commonembedding/xfactory.hxx 
b/embeddedobj/source/commonembedding/xfactory.hxx
index 87ff4886a20c..056f50705ef9 100644
--- a/embeddedobj/source/commonembedding/xfactory.hxx
+++ b/embeddedobj/source/commonembedding/xfactory.hxx
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_EMBEDDEDOBJ_SOURCE_COMMONEMBEDDING_XFACTORY_HXX
-#define INCLUDED_EMBEDDEDOBJ_SOURCE_COMMONEMBEDDING_XFACTORY_HXX
+#pragma once
 
 #include 
 #include 
@@ -92,6 +91,4 @@ public:
 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() 
override;
 };
 
-#endif
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/embeddedobj/source/inc/closepreventer.hxx 
b/embeddedobj/source/inc/closepreventer.hxx
index 009c8c7a133a..fa8e548b8cdf 100644
--- a/embeddedobj/source/inc/closepreventer.hxx
+++ b/embeddedobj/source/inc/closepreventer.hxx
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_EMBEDDEDOBJ_SOURCE_INC_CLOSEPREVENTER_HXX
-#define 

[Libreoffice-commits] core.git: embeddedobj/source

2020-05-07 Thread Noel Grandin (via logerrit)
 embeddedobj/source/commonembedding/embedobj.cxx |6 ++--
 embeddedobj/source/commonembedding/miscobj.cxx  |   31 
 embeddedobj/source/inc/commonembobj.hxx |3 +-
 3 files changed, 11 insertions(+), 29 deletions(-)

New commits:
commit 8544e0a20bd8f8d8c918f91f90768019fa8099d7
Author: Noel Grandin 
AuthorDate: Thu May 7 15:34:12 2020 +0200
Commit: Noel Grandin 
CommitDate: Thu May 7 19:28:23 2020 +0200

m_aVerbTable can be a std::map

instead of using the heavyweight Sequence datastructures

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

diff --git a/embeddedobj/source/commonembedding/embedobj.cxx 
b/embeddedobj/source/commonembedding/embedobj.cxx
index 6250555e05ec..abc43f42736f 100644
--- a/embeddedobj/source/commonembedding/embedobj.cxx
+++ b/embeddedobj/source/commonembedding/embedobj.cxx
@@ -74,9 +74,9 @@ awt::Rectangle GetRectangleInterception( const 
awt::Rectangle& aRect1, const awt
 
 sal_Int32 OCommonEmbeddedObject::ConvertVerbToState_Impl( sal_Int32 nVerb )
 {
-for ( sal_Int32 nInd = 0; nInd < m_aVerbTable.getLength(); nInd++ )
-if ( m_aVerbTable[nInd][0] == nVerb )
-return m_aVerbTable[nInd][1];
+auto it = m_aVerbTable.find( nVerb );
+if (it != m_aVerbTable.end())
+return it->second;
 
 throw lang::IllegalArgumentException(); // TODO: unexpected verb provided
 }
diff --git a/embeddedobj/source/commonembedding/miscobj.cxx 
b/embeddedobj/source/commonembedding/miscobj.cxx
index 71f79fabd96d..3363a02bfd02 100644
--- a/embeddedobj/source/commonembedding/miscobj.cxx
+++ b/embeddedobj/source/commonembedding/miscobj.cxx
@@ -161,50 +161,31 @@ void OCommonEmbeddedObject::CommonInit_Impl( const 
uno::Sequence< beans::NamedVa
 m_pIntermediateStatesSeqs[4][0][0] = embed::EmbedStates::RUNNING;
 
 // verbs table
-sal_Int32 nVerbTableSize = 0;
 for ( sal_Int32 nVerbInd = 0; nVerbInd < m_aObjectVerbs.getLength(); 
nVerbInd++ )
 {
 if ( m_aObjectVerbs[nVerbInd].VerbID == 
embed::EmbedVerbs::MS_OLEVERB_PRIMARY )
 {
-m_aVerbTable.realloc( ++nVerbTableSize );
-m_aVerbTable[nVerbTableSize - 1].realloc( 2 );
-m_aVerbTable[nVerbTableSize - 1][0] = 
m_aObjectVerbs[nVerbInd].VerbID;
-m_aVerbTable[nVerbTableSize - 1][1] = 
embed::EmbedStates::UI_ACTIVE;
+m_aVerbTable.insert( { m_aObjectVerbs[nVerbInd].VerbID, 
embed::EmbedStates::UI_ACTIVE } );
 }
 else if ( m_aObjectVerbs[nVerbInd].VerbID == 
embed::EmbedVerbs::MS_OLEVERB_SHOW )
 {
-m_aVerbTable.realloc( ++nVerbTableSize );
-m_aVerbTable[nVerbTableSize - 1].realloc( 2 );
-m_aVerbTable[nVerbTableSize - 1][0] = 
m_aObjectVerbs[nVerbInd].VerbID;
-m_aVerbTable[nVerbTableSize - 1][1] = 
embed::EmbedStates::UI_ACTIVE;
+m_aVerbTable.insert( { m_aObjectVerbs[nVerbInd].VerbID, 
embed::EmbedStates::UI_ACTIVE } );
 }
 else if ( m_aObjectVerbs[nVerbInd].VerbID == 
embed::EmbedVerbs::MS_OLEVERB_OPEN )
 {
-m_aVerbTable.realloc( ++nVerbTableSize );
-m_aVerbTable[nVerbTableSize - 1].realloc( 2 );
-m_aVerbTable[nVerbTableSize - 1][0] = 
m_aObjectVerbs[nVerbInd].VerbID;
-m_aVerbTable[nVerbTableSize - 1][1] = embed::EmbedStates::ACTIVE;
+m_aVerbTable.insert( { m_aObjectVerbs[nVerbInd].VerbID, 
embed::EmbedStates::ACTIVE } );
 }
 else if ( m_aObjectVerbs[nVerbInd].VerbID == 
embed::EmbedVerbs::MS_OLEVERB_IPACTIVATE )
 {
-m_aVerbTable.realloc( ++nVerbTableSize );
-m_aVerbTable[nVerbTableSize - 1].realloc( 2 );
-m_aVerbTable[nVerbTableSize - 1][0] = 
m_aObjectVerbs[nVerbInd].VerbID;
-m_aVerbTable[nVerbTableSize - 1][1] = 
embed::EmbedStates::INPLACE_ACTIVE;
+m_aVerbTable.insert( { m_aObjectVerbs[nVerbInd].VerbID, 
embed::EmbedStates::INPLACE_ACTIVE } );
 }
 else if ( m_aObjectVerbs[nVerbInd].VerbID == 
embed::EmbedVerbs::MS_OLEVERB_UIACTIVATE )
 {
-m_aVerbTable.realloc( ++nVerbTableSize );
-m_aVerbTable[nVerbTableSize - 1].realloc( 2 );
-m_aVerbTable[nVerbTableSize - 1][0] = 
m_aObjectVerbs[nVerbInd].VerbID;
-m_aVerbTable[nVerbTableSize - 1][1] = 
embed::EmbedStates::UI_ACTIVE;
+m_aVerbTable.insert( { m_aObjectVerbs[nVerbInd].VerbID, 
embed::EmbedStates::UI_ACTIVE } );
 }
 else if ( m_aObjectVerbs[nVerbInd].VerbID == 
embed::EmbedVerbs::MS_OLEVERB_HIDE )
 {
-m_aVerbTable.realloc( ++nVerbTableSize );
-m_aVerbTable[nVerbTableSize - 1].realloc( 2 );
-m_aVerbTable[nVerbTableSize - 1][0] = 
m_aObjectVerbs[nVerbInd].VerbID;
-m_aVerbTable[nVerbTableSize - 1][1] = 

[Libreoffice-commits] core.git: embeddedobj/source emfio/source

2020-04-14 Thread Noel Grandin (via logerrit)
 embeddedobj/source/commonembedding/embedobj.cxx|   54 +-
 embeddedobj/source/commonembedding/miscobj.cxx |  124 +++---
 embeddedobj/source/commonembedding/persistence.cxx |  116 ++---
 embeddedobj/source/general/docholder.cxx   |   70 +--
 embeddedobj/source/general/dummyobject.cxx |   52 +-
 embeddedobj/source/general/intercept.cxx   |   99 ++--
 embeddedobj/source/msole/oleembed.cxx  |   96 ++--
 embeddedobj/source/msole/olemisc.cxx   |   34 -
 embeddedobj/source/msole/ownview.cxx   |   34 -
 emfio/source/reader/emfreader.cxx  |   32 -
 emfio/source/reader/mtftools.cxx   |  422 ++---
 emfio/source/reader/wmfreader.cxx  |   64 +--
 12 files changed, 599 insertions(+), 598 deletions(-)

New commits:
commit 1c3929a0a1645e802ee18f9c3d3d380375500c72
Author: Noel Grandin 
AuthorDate: Tue Apr 14 15:48:35 2020 +0200
Commit: Noel Grandin 
CommitDate: Tue Apr 14 20:39:00 2020 +0200

loplugin:flatten in embeddedobj,emfio

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

diff --git a/embeddedobj/source/commonembedding/embedobj.cxx 
b/embeddedobj/source/commonembedding/embedobj.cxx
index e6e5bec2a316..6250555e05ec 100644
--- a/embeddedobj/source/commonembedding/embedobj.cxx
+++ b/embeddedobj/source/commonembedding/embedobj.cxx
@@ -120,39 +120,39 @@ void OCommonEmbeddedObject::Deactivate()
 
 void OCommonEmbeddedObject::StateChangeNotification_Impl( bool bBeforeChange, 
sal_Int32 nOldState, sal_Int32 nNewState ,::osl::ResettableMutexGuard& rGuard )
 {
-if ( m_pInterfaceContainer )
-{
-::cppu::OInterfaceContainerHelper* pContainer = 
m_pInterfaceContainer->getContainer(
-cppu::UnoType::get());
-if ( pContainer != nullptr )
-{
-lang::EventObject aSource( static_cast< ::cppu::OWeakObject* >( 
this ) );
-::cppu::OInterfaceIteratorHelper pIterator(*pContainer);
+if ( !m_pInterfaceContainer )
+return;
 
-// should be locked after the method is finished successfully
-rGuard.clear();
+::cppu::OInterfaceContainerHelper* pContainer = 
m_pInterfaceContainer->getContainer(
+cppu::UnoType::get());
+if ( pContainer == nullptr )
+return;
 
-while (pIterator.hasMoreElements())
-{
-try
-{
-if ( bBeforeChange )
-
static_cast(pIterator.next())->changingState( 
aSource, nOldState, nNewState );
-else
-
static_cast(pIterator.next())->stateChanged( 
aSource, nOldState, nNewState );
-}
-catch( const uno::Exception& )
-{
-// even if the listener complains ignore it for now
-   }
+lang::EventObject aSource( static_cast< ::cppu::OWeakObject* >( this ) );
+::cppu::OInterfaceIteratorHelper pIterator(*pContainer);
 
-if ( m_bDisposed )
-return;
-}
+// should be locked after the method is finished successfully
+rGuard.clear();
 
-rGuard.reset();
+while (pIterator.hasMoreElements())
+{
+try
+{
+if ( bBeforeChange )
+
static_cast(pIterator.next())->changingState( 
aSource, nOldState, nNewState );
+else
+
static_cast(pIterator.next())->stateChanged( 
aSource, nOldState, nNewState );
 }
+catch( const uno::Exception& )
+{
+// even if the listener complains ignore it for now
+   }
+
+if ( m_bDisposed )
+return;
 }
+
+rGuard.reset();
 }
 
 
diff --git a/embeddedobj/source/commonembedding/miscobj.cxx 
b/embeddedobj/source/commonembedding/miscobj.cxx
index 5947fef7aca0..71f79fabd96d 100644
--- a/embeddedobj/source/commonembedding/miscobj.cxx
+++ b/embeddedobj/source/commonembedding/miscobj.cxx
@@ -256,34 +256,34 @@ void OCommonEmbeddedObject::LinkInit_Impl(
 
 OCommonEmbeddedObject::~OCommonEmbeddedObject()
 {
-if ( m_pInterfaceContainer || m_xDocHolder.is() )
-{
-osl_atomic_increment(_refCount);
-try {
-lang::EventObject aSource( static_cast< ::cppu::OWeakObject* >( 
this ) );
+if ( !(m_pInterfaceContainer || m_xDocHolder.is()) )
+return;
 
-if ( m_pInterfaceContainer )
-{
-m_pInterfaceContainer->disposeAndClear( aSource );
+osl_atomic_increment(_refCount);
+try {
+lang::EventObject aSource( static_cast< ::cppu::OWeakObject* >( this ) 
);
 
-delete m_pInterfaceContainer;
-m_pInterfaceContainer = nullptr;
-}
-} catch( const 

[Libreoffice-commits] core.git: embeddedobj/source

2020-03-06 Thread Serge Krot (via logerrit)
 embeddedobj/source/commonembedding/embedobj.cxx |6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit a91e19e30833c2743c1c2ce010a2d0f06aad7706
Author: Serge Krot 
AuthorDate: Thu Mar 5 10:59:35 2020 +0100
Commit: Thorsten Behrens 
CommitDate: Fri Mar 6 16:26:14 2020 +0100

tdf#131146 Linked Calc: changes are lost in last edited cell

Change-Id: I768ccc1d98a0785806986a6ffc70de057991e08a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90009
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens 

diff --git a/embeddedobj/source/commonembedding/embedobj.cxx 
b/embeddedobj/source/commonembedding/embedobj.cxx
index 641253008580..e6e5bec2a316 100644
--- a/embeddedobj/source/commonembedding/embedobj.cxx
+++ b/embeddedobj/source/commonembedding/embedobj.cxx
@@ -91,6 +91,10 @@ void OCommonEmbeddedObject::Deactivate()
 if ( !xClientSite.is() )
 throw embed::WrongStateException(); //TODO: client site is not set!
 
+// tdf#131146 close frame before saving of the document
+// (during CloseFrame() call some changes could be detected not registered 
in util::XModifiable)
+m_xDocHolder->CloseFrame();
+
 // store document if it is modified
 if ( xModif.is() && xModif->isModified() )
 {
@@ -110,8 +114,6 @@ void OCommonEmbeddedObject::Deactivate()
 }
 }
 
-m_xDocHolder->CloseFrame();
-
 xClientSite->visibilityChanged( false );
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: embeddedobj/source

2019-12-14 Thread Andrea Gelmini (via logerrit)
 embeddedobj/source/msole/olepersist.cxx |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit e26d89371f0e4f41476c9a99be01d98dedb76776
Author: Andrea Gelmini 
AuthorDate: Sat Dec 14 22:00:01 2019 +0100
Commit: Julien Nabet 
CommitDate: Sat Dec 14 23:00:40 2019 +0100

Fix typo

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

diff --git a/embeddedobj/source/msole/olepersist.cxx 
b/embeddedobj/source/msole/olepersist.cxx
index 8dee4adc8704..36a6a84b4614 100644
--- a/embeddedobj/source/msole/olepersist.cxx
+++ b/embeddedobj/source/msole/olepersist.cxx
@@ -708,7 +708,7 @@ uno::Reference< io::XStream > 
OleEmbeddedObject::TryToRetrieveCachedVisualRepres
 try
 {
 CreateOleComponentAndLoad_Impl();
-m_aClassID = 
m_pOleComponent->GetCLSID(); // was not set during consruction
+m_aClassID = 
m_pOleComponent->GetCLSID(); // was not set during construction
 }
 catch( const uno::Exception& )
 {
@@ -1332,7 +1332,7 @@ void SAL_CALL OleEmbeddedObject::setPersistentEntry(
 // the object should be initialized from clipboard
 // impossibility to initialize the object means error here
 CreateOleComponentFromClipboard_Impl();
-m_aClassID = m_pOleComponent->GetCLSID(); // was not set during 
consruction
+m_aClassID = m_pOleComponent->GetCLSID(); // was not set during 
construction
 m_pOleComponent->RunObject();
 m_nObjectState = embed::EmbedStates::RUNNING;
 }
@@ -1344,7 +1344,7 @@ void SAL_CALL OleEmbeddedObject::setPersistentEntry(
 try
 {
 CreateOleComponentAndLoad_Impl();
-m_aClassID = m_pOleComponent->GetCLSID(); // was not set 
during consruction
+m_aClassID = m_pOleComponent->GetCLSID(); // was not set 
during construction
 }
 catch( const uno::Exception& )
 {
@@ -1407,7 +1407,7 @@ void SAL_CALL OleEmbeddedObject::setPersistentEntry(
 m_pOleComponent->CreateLinkFromFile( aURL );
 
 m_pOleComponent->RunObject();
-m_aClassID = m_pOleComponent->GetCLSID(); // was not set during 
consruction
+m_aClassID = m_pOleComponent->GetCLSID(); // was not set during 
construction
 
 m_nObjectState = embed::EmbedStates::RUNNING;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: embeddedobj/source include/rtl sc/source sd/source svl/source svx/source sw/source unoidl/source

2019-10-19 Thread Stephan Bergmann (via logerrit)
 embeddedobj/source/msole/ownview.cxx |2 +-
 include/rtl/stringutils.hxx  |3 +++
 sc/source/core/tool/editutil.cxx |2 +-
 sc/source/filter/qpro/qpro.cxx   |2 +-
 sd/source/core/drawdoc4.cxx  |4 ++--
 sd/source/core/stlsheet.cxx  |2 +-
 svl/source/numbers/zformat.cxx   |2 +-
 svx/source/unodraw/UnoGraphicExporter.cxx|4 ++--
 sw/source/core/edit/autofmt.cxx  |4 ++--
 sw/source/core/table/swtable.cxx |4 ++--
 sw/source/filter/ww8/docxattributeoutput.cxx |2 +-
 sw/source/ui/vba/vbatablehelper.cxx  |4 ++--
 sw/source/uibase/dbui/mmconfigitem.cxx   |2 +-
 unoidl/source/sourceprovider-scanner.l   |6 --
 14 files changed, 24 insertions(+), 19 deletions(-)

New commits:
commit 7320d7a4a4dd0657f2d650a6f580ad399529f0f1
Author: Stephan Bergmann 
AuthorDate: Sat Oct 19 15:41:59 2019 +0200
Commit: Stephan Bergmann 
CommitDate: Sat Oct 19 16:52:22 2019 +0200

OUStringChar must either take a sal_Unicode or an ASCII char

...so forbid anything else, to avoid issues like the one described in
766cdd869d7d983e9e171a3eae0629cb9a0206ff "This code wants to add the numeric
SvxRotateMode value".  Some remaining places that apparently do want to 
convert
some numeric value to sal_Unicode have been augmented with an explicit cast.

Change-Id: I6200a84e250e697bc88694bd71142ca1d9a13651
Reviewed-on: https://gerrit.libreoffice.org/81132
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/embeddedobj/source/msole/ownview.cxx 
b/embeddedobj/source/msole/ownview.cxx
index 244ab320e270..7d938cfd15ba 100644
--- a/embeddedobj/source/msole/ownview.cxx
+++ b/embeddedobj/source/msole/ownview.cxx
@@ -289,7 +289,7 @@ bool OwnView_Impl::ReadContentsAndGenerateTempFile( const 
uno::Reference< io::XI
 aReadSeq[0] == '.'
)
 {
-aFileSuffix += OUStringChar( aReadSeq[0] );
+aFileSuffix += OUStringChar( sal_Unicode(aReadSeq[0]) );
 }
 
 } while( aReadSeq[0] );
diff --git a/include/rtl/stringutils.hxx b/include/rtl/stringutils.hxx
index 6ea44c72d8be..a043f753ccce 100644
--- a/include/rtl/stringutils.hxx
+++ b/include/rtl/stringutils.hxx
@@ -12,6 +12,7 @@
 
 #include "sal/config.h"
 
+#include 
 #include 
 
 #include "sal/types.h"
@@ -79,6 +80,8 @@ namespace rtl
 */
 struct SAL_WARN_UNUSED OUStringChar_ {
 constexpr OUStringChar_(sal_Unicode theC): c(theC) {}
+constexpr OUStringChar_(char theC): c(theC) { assert(c <= 0x7F); }
+template OUStringChar_(T &&) = delete;
 sal_Unicode const c;
 };
 using OUStringChar = OUStringChar_ const;
diff --git a/sc/source/core/tool/editutil.cxx b/sc/source/core/tool/editutil.cxx
index dbbda0548754..03543f2f0b6e 100644
--- a/sc/source/core/tool/editutil.cxx
+++ b/sc/source/core/tool/editutil.cxx
@@ -735,7 +735,7 @@ static OUString lcl_GetCharStr( sal_Int32 nNo )
 nCalc = nNo % coDiff;
 if( !nCalc )
 nCalc = coDiff;
-aStr = OUStringChar( 'a' - 1 + nCalc ) + aStr;
+aStr = OUStringChar( sal_Unicode('a' - 1 + nCalc) ) + aStr;
 nNo = sal::static_int_cast( nNo - nCalc );
 if( nNo )
 nNo /= coDiff;
diff --git a/sc/source/filter/qpro/qpro.cxx b/sc/source/filter/qpro/qpro.cxx
index 116304c5ad7e..b59ce7f664ab 100644
--- a/sc/source/filter/qpro/qpro.cxx
+++ b/sc/source/filter/qpro/qpro.cxx
@@ -182,7 +182,7 @@ ErrCode ScQProReader::parse( ScDocument *pDoc )
 if( nTab < 26 )
 {
 OUString aName;
-aName += OUStringChar( 'A' + nTab );
+aName += OUStringChar( sal_Unicode('A' + nTab) );
 if (!nTab)
 pDoc->RenameTab( nTab, aName );
 else
diff --git a/sd/source/core/drawdoc4.cxx b/sd/source/core/drawdoc4.cxx
index 8820252853d4..be447edcef72 100644
--- a/sd/source/core/drawdoc4.cxx
+++ b/sd/source/core/drawdoc4.cxx
@@ -1075,10 +1075,10 @@ OUString SdDrawDocument::CreatePageNumValue(sal_uInt16 
nNum) const
 switch (mePageNumType)
 {
 case css::style::NumberingType::CHARS_UPPER_LETTER:
-aPageNumValue += OUStringChar( (nNum - 1) % 26 + 'A' );
+aPageNumValue += OUStringChar( sal_Unicode((nNum - 1) % 26 + 'A') 
);
 break;
 case css::style::NumberingType::CHARS_LOWER_LETTER:
-aPageNumValue += OUStringChar( (nNum - 1) % 26 + 'a' );
+aPageNumValue += OUStringChar( sal_Unicode((nNum - 1) % 26 + 'a') 
);
 break;
 case css::style::NumberingType::ROMAN_UPPER:
 bUpper = true;
diff --git a/sd/source/core/stlsheet.cxx b/sd/source/core/stlsheet.cxx
index 77f7908337bc..9d097c01f633 100644
--- a/sd/source/core/stlsheet.cxx
+++ 

[Libreoffice-commits] core.git: embeddedobj/source extensions/Library_WinUserInfoBe.mk extensions/source vcl/source

2019-10-01 Thread Stephan Bergmann (via logerrit)
 embeddedobj/source/msole/olevisual.cxx |5 +++--
 extensions/Library_WinUserInfoBe.mk|1 +
 extensions/source/config/WinUserInfo/WinUserInfoBe.cxx |8 
 vcl/source/app/svdata.cxx  |6 +++---
 4 files changed, 11 insertions(+), 9 deletions(-)

New commits:
commit e25758ac95380965aba486e1eae62f144d389185
Author: Stephan Bergmann 
AuthorDate: Tue Oct 1 10:29:56 2019 +0200
Commit: Stephan Bergmann 
CommitDate: Tue Oct 1 23:03:19 2019 +0200

loplugin:logexceptionnicely (clang-cl)

Change-Id: I2da126a38db61d2a0f36f8f2d38b0dddeb26c9d4
Reviewed-on: https://gerrit.libreoffice.org/79929
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/embeddedobj/source/msole/olevisual.cxx 
b/embeddedobj/source/msole/olevisual.cxx
index 879d0b0ce9ec..5a12ac3588ba 100644
--- a/embeddedobj/source/msole/olevisual.cxx
+++ b/embeddedobj/source/msole/olevisual.cxx
@@ -31,6 +31,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #if defined(_WIN32)
 #include "olecomponent.hxx"
@@ -234,9 +235,9 @@ awt::Size SAL_CALL OleEmbeddedObject::getVisualAreaSize( 
sal_Int64 nAspect )
 {
 changeState(embed::EmbedStates::LOADED);
 }
-catch( const uno::Exception& e )
+catch( const uno::Exception& )
 {
-SAL_WARN("embeddedobj.ole", "ignoring " << e);
+TOOLS_WARN_EXCEPTION("embeddedobj.ole", "ignoring ");
 }
 }
 
diff --git a/extensions/Library_WinUserInfoBe.mk 
b/extensions/Library_WinUserInfoBe.mk
index 6fdad389a480..8d9835db5000 100644
--- a/extensions/Library_WinUserInfoBe.mk
+++ b/extensions/Library_WinUserInfoBe.mk
@@ -25,6 +25,7 @@ $(eval $(call gb_Library_use_libraries,WinUserInfoBe,\
cppuhelper \
cppu \
sal \
+   tl \
 ))
 
 $(eval $(call gb_Library_use_system_win32_libs,WinUserInfoBe,\
diff --git a/extensions/source/config/WinUserInfo/WinUserInfoBe.cxx 
b/extensions/source/config/WinUserInfo/WinUserInfoBe.cxx
index d8959264af20..a7732fa196fd 100644
--- a/extensions/source/config/WinUserInfo/WinUserInfoBe.cxx
+++ b/extensions/source/config/WinUserInfo/WinUserInfoBe.cxx
@@ -18,7 +18,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #include 
 #include 
@@ -249,10 +249,10 @@ private:
 
css::uno::UNO_QUERY_THROW);
 xChangesBatch->commitChanges();
 }
-catch (const css::uno::Exception& e)
+catch (const css::uno::Exception&)
 {
-SAL_WARN("extensions.config",
- "ADsUserAccess: access to configuration data failed: " << 
e);
+TOOLS_WARN_EXCEPTION("extensions.config",
+ "ADsUserAccess: access to configuration data 
failed:");
 }
 }
 
diff --git a/vcl/source/app/svdata.cxx b/vcl/source/app/svdata.cxx
index d88afef8a40c..877f3011d536 100644
--- a/vcl/source/app/svdata.cxx
+++ b/vcl/source/app/svdata.cxx
@@ -334,10 +334,10 @@ bool ImplInitAccessBridge()
  = css::accessibility::MSAAService::create(xContext);
  SAL_INFO("vcl", "got IAccessible2 bridge");
  return true;
- } catch (css::uno::DeploymentException & e) {
- SAL_WARN(
+ } catch (css::uno::DeploymentException &) {
+ TOOLS_WARN_EXCEPTION(
 "vcl",
-"got no IAccessible2 bridge" << e);
+"got no IAccessible2 bridge");
  return false;
  }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: embeddedobj/source emfio/inc extensions/source

2019-09-26 Thread Noel Grandin (via logerrit)
 embeddedobj/source/inc/commonembobj.hxx|2 +-
 embeddedobj/source/inc/docholder.hxx   |2 +-
 emfio/inc/mtftools.hxx |4 ++--
 extensions/source/abpilot/abspage.cxx  |2 +-
 extensions/source/abpilot/abspage.hxx  |2 +-
 extensions/source/abpilot/abspilot.hxx |2 +-
 extensions/source/bibliography/bibbeam.cxx |2 +-
 extensions/source/bibliography/bibbeam.hxx |2 +-
 extensions/source/bibliography/bibconfig.hxx   |2 +-
 extensions/source/bibliography/bibmod.hxx  |2 +-
 extensions/source/bibliography/bibview.cxx |2 +-
 extensions/source/bibliography/bibview.hxx |2 +-
 extensions/source/bibliography/datman.cxx  |   14 +++---
 extensions/source/bibliography/datman.hxx  |   22 +++---
 extensions/source/dbpilots/controlwizard.cxx   |2 +-
 extensions/source/dbpilots/controlwizard.hxx   |2 +-
 extensions/source/dbpilots/listcombowizard.cxx |2 +-
 extensions/source/dbpilots/listcombowizard.hxx |2 +-
 extensions/source/propctrlr/browserline.cxx|2 +-
 extensions/source/propctrlr/browserline.hxx|2 +-
 extensions/source/propctrlr/browserlistbox.cxx |2 +-
 extensions/source/propctrlr/browserlistbox.hxx |2 +-
 extensions/source/propctrlr/browserpage.cxx|2 +-
 extensions/source/propctrlr/browserpage.hxx|2 +-
 extensions/source/propctrlr/browserview.cxx|2 +-
 extensions/source/propctrlr/browserview.hxx|2 +-
 extensions/source/propctrlr/commoncontrol.hxx  |6 +++---
 extensions/source/propctrlr/propertyeditor.cxx |6 +++---
 extensions/source/propctrlr/propertyeditor.hxx |6 +++---
 extensions/source/scanner/sane.hxx |4 ++--
 extensions/source/scanner/sanedlg.cxx  |2 +-
 extensions/source/scanner/sanedlg.hxx  |2 +-
 extensions/source/update/feed/updatefeed.cxx   |4 ++--
 33 files changed, 58 insertions(+), 58 deletions(-)

New commits:
commit 7b171dbfb5b50b684eb221270759482fe49b4e15
Author: Noel Grandin 
AuthorDate: Wed Sep 25 13:29:49 2019 +0200
Commit: Noel Grandin 
CommitDate: Thu Sep 26 09:18:39 2019 +0200

loplugin:constmethod in embeddedobj..extensions

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

diff --git a/embeddedobj/source/inc/commonembobj.hxx 
b/embeddedobj/source/inc/commonembobj.hxx
index c00fbdc096be..9ea5c5629424 100644
--- a/embeddedobj/source/inc/commonembobj.hxx
+++ b/embeddedobj/source/inc/commonembobj.hxx
@@ -252,7 +252,7 @@ public:
 // not a real listener and should not be
 void PostEvent_Impl( const OUString& aEventName );
 
-OUString const & getContainerName() { return m_aContainerName; }
+OUString const & getContainerName() const { return m_aContainerName; }
 // XInterface
 
 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& rType 
) override ;
diff --git a/embeddedobj/source/inc/docholder.hxx 
b/embeddedobj/source/inc/docholder.hxx
index 974a762a995a..abe49ff9475e 100644
--- a/embeddedobj/source/inc/docholder.hxx
+++ b/embeddedobj/source/inc/docholder.hxx
@@ -169,7 +169,7 @@ public:
 m_xOutplaceInterceptor = xOutplaceInterceptor;
 }
 
-const css::uno::Reference< css::util::XCloseable >& GetComponent() { 
return m_xComponent; }
+const css::uno::Reference< css::util::XCloseable >& GetComponent() const { 
return m_xComponent; }
 
 // XEventListener
 virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) 
override;
diff --git a/emfio/inc/mtftools.hxx b/emfio/inc/mtftools.hxx
index 54c18a26be62..736b1da2fe74 100644
--- a/emfio/inc/mtftools.hxx
+++ b/emfio/inc/mtftools.hxx
@@ -583,13 +583,13 @@ namespace emfio
 
 voidDeleteObject(sal_Int32 nIndex);
 voidSelectObject(sal_Int32 nIndex);
-rtl_TextEncodingGetCharSet() { return maFont.GetCharSet(); };
+rtl_TextEncodingGetCharSet() const { return maFont.GetCharSet(); };
 const vcl::Font&GetFont() const { return maFont; }
 voidSetTextLayoutMode(ComplexTextLayoutFlags 
nLayoutMode);
 
 voidClearPath() { maPathObj.Init(); };
 voidClosePath() { maPathObj.ClosePath(); };
-const tools::PolyPolygon& GetPathObj() { return maPathObj; };
+const tools::PolyPolygon& GetPathObj() const { return maPathObj; };
 
 voidMoveTo(const Point& rPoint, bool bRecordPath = 
false);
 voidLineTo(const Point& rPoint, bool bRecordPath = 
false);
diff --git a/extensions/source/abpilot/abspage.cxx 
b/extensions/source/abpilot/abspage.cxx
index 33770402a664..646bec495186 100644
--- a/extensions/source/abpilot/abspage.cxx
+++ b/extensions/source/abpilot/abspage.cxx
@@ -67,7 +67,7 @@ 

[Libreoffice-commits] core.git: embeddedobj/source

2019-08-29 Thread Tamás Zolnai (via logerrit)
 embeddedobj/source/commonembedding/embedobj.cxx |7 +++
 1 file changed, 7 insertions(+)

New commits:
commit e56d143c36af028825a8e824201a3aa193862af4
Author: Tamás Zolnai 
AuthorDate: Tue Jul 30 15:15:16 2019 +0200
Commit: Miklos Vajna 
CommitDate: Thu Aug 29 15:49:19 2019 +0200

lok: Disable chart editing on mobile

Disabled editing of all embedded objects.

[ Miklos: motivation is that the UI is complex and the small mobile
screen is not suitable to expose this functionality as-is. Disable till
a more compact UI can be exposed. ]

Change-Id: Id1c598c84adc12b8b52d006992d85dcae5601ad9
Reviewed-on: https://gerrit.libreoffice.org/78270
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/embeddedobj/source/commonembedding/embedobj.cxx 
b/embeddedobj/source/commonembedding/embedobj.cxx
index 3370c273dc6a..7bed8710ba2c 100644
--- a/embeddedobj/source/commonembedding/embedobj.cxx
+++ b/embeddedobj/source/commonembedding/embedobj.cxx
@@ -227,6 +227,13 @@ void OCommonEmbeddedObject::SwitchStateTo_Impl( sal_Int32 
nNextState )
 }
 else
 {
+if(comphelper::LibreOfficeKit::isActive() && 
comphelper::LibreOfficeKit::isMobile())
+{
+// Disable embedded object editing (e.g. chart) on mobile
+if(nNextState == embed::EmbedStates::INPLACE_ACTIVE || 
nNextState == embed::EmbedStates::UI_ACTIVE)
+return;
+}
+
 if ( nNextState == embed::EmbedStates::INPLACE_ACTIVE )
 {
 if ( !m_xClientSite.is() )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: embeddedobj/source

2019-08-16 Thread Noel Grandin (via logerrit)
 embeddedobj/source/commonembedding/embedobj.cxx |   31 +++-
 1 file changed, 25 insertions(+), 6 deletions(-)

New commits:
commit 23f60bbf283414bae6f649992c18253c9d0ac2ab
Author: Noel Grandin 
AuthorDate: Fri Aug 16 14:16:36 2019 +0200
Commit: Noel Grandin 
CommitDate: Fri Aug 16 19:35:43 2019 +0200

tdf#126877 crash on inserting floating frame

regression from
commit 5043421fdc527d18d18121ec5fe2d4e009c8191a
Date:   Fri Jul 19 14:05:10 2019 +0200
loplugin:referencecasting in embeddedobj

OSpecialEmbeddedObject is playing games and effectively "unimplementing"
an interface it's superclass implements by doing custom stuff in
OSpecialEmbeddedObject::queryInterface.

So lets rather implement this in a more direct and obvious way.

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

diff --git a/embeddedobj/source/commonembedding/embedobj.cxx 
b/embeddedobj/source/commonembedding/embedobj.cxx
index a34020d354e1..3370c273dc6a 100644
--- a/embeddedobj/source/commonembedding/embedobj.cxx
+++ b/embeddedobj/source/commonembedding/embedobj.cxx
@@ -50,6 +50,7 @@
 #include 
 #include 
 #include "embedobj.hxx"
+#include 
 
 using namespace ::com::sun::star;
 
@@ -174,13 +175,31 @@ void OCommonEmbeddedObject::SwitchStateTo_Impl( sal_Int32 
nNextState )
 }
 else
 {
-// in case embedded object is in loaded state the contents must
-// be stored in the related storage and the storage
-// must be created already
-if ( !m_xObjectStorage.is() )
-   throw io::IOException(); //TODO: access denied
+if ( !dynamic_cast(this) )
+{
+// in case embedded object is in loaded state the contents 
must
+// be stored in the related storage and the storage
+// must be created already
+if ( !m_xObjectStorage.is() )
+throw io::IOException(); //TODO: access denied
 
-m_xDocHolder->SetComponent( LoadDocumentFromStorage_Impl(), 
m_bReadOnly );
+m_xDocHolder->SetComponent( 
LoadDocumentFromStorage_Impl(), m_bReadOnly );
+}
+else
+{
+// objects without persistence will be initialized 
internally
+uno::Sequence < uno::Any > aArgs(1);
+aArgs[0] <<= uno::Reference < embed::XEmbeddedObject >( 
this );
+uno::Reference< util::XCloseable > xDocument(
+
m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext( 
GetDocumentServiceName(), aArgs, m_xContext),
+uno::UNO_QUERY );
+
+uno::Reference < container::XChild > xChild( xDocument, 
uno::UNO_QUERY );
+if ( xChild.is() )
+xChild->setParent( m_xParent );
+
+m_xDocHolder->SetComponent( xDocument, m_bReadOnly );
+}
 }
 
 if ( !m_xDocHolder->GetComponent().is() )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: embeddedobj/source

2019-07-19 Thread Noel Grandin (via logerrit)
 embeddedobj/source/commonembedding/embedobj.cxx|   31 ++---
 embeddedobj/source/commonembedding/miscobj.cxx |   14 +
 embeddedobj/source/commonembedding/persistence.cxx |   50 +++--
 embeddedobj/source/commonembedding/xfactory.cxx|5 --
 embeddedobj/source/general/docholder.cxx   |   36 +--
 embeddedobj/source/general/xcreator.cxx|5 --
 embeddedobj/source/msole/oleembed.cxx  |   15 ++
 embeddedobj/source/msole/olemisc.cxx   |   10 +---
 8 files changed, 56 insertions(+), 110 deletions(-)

New commits:
commit 5043421fdc527d18d18121ec5fe2d4e009c8191a
Author: Noel Grandin 
AuthorDate: Fri Jul 19 14:05:10 2019 +0200
Commit: Noel Grandin 
CommitDate: Fri Jul 19 21:49:20 2019 +0200

loplugin:referencecasting in embeddedobj

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

diff --git a/embeddedobj/source/commonembedding/embedobj.cxx 
b/embeddedobj/source/commonembedding/embedobj.cxx
index 8c888df48a9e..a34020d354e1 100644
--- a/embeddedobj/source/commonembedding/embedobj.cxx
+++ b/embeddedobj/source/commonembedding/embedobj.cxx
@@ -174,32 +174,13 @@ void OCommonEmbeddedObject::SwitchStateTo_Impl( sal_Int32 
nNextState )
 }
 else
 {
-uno::Reference < embed::XEmbedPersist > xPersist( static_cast 
< embed::XClassifiedObject* > (this), uno::UNO_QUERY );
-if ( xPersist.is() )
-{
-// in case embedded object is in loaded state the contents 
must
-// be stored in the related storage and the storage
-// must be created already
-if ( !m_xObjectStorage.is() )
-throw io::IOException(); //TODO: access denied
+// in case embedded object is in loaded state the contents must
+// be stored in the related storage and the storage
+// must be created already
+if ( !m_xObjectStorage.is() )
+   throw io::IOException(); //TODO: access denied
 
-m_xDocHolder->SetComponent( 
LoadDocumentFromStorage_Impl(), m_bReadOnly );
-}
-else
-{
-// objects without persistence will be initialized 
internally
-uno::Sequence < uno::Any > aArgs(1);
-aArgs[0] <<= uno::Reference < embed::XEmbeddedObject >( 
this );
-uno::Reference< util::XCloseable > xDocument(
-
m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext( 
GetDocumentServiceName(), aArgs, m_xContext),
-uno::UNO_QUERY );
-
-uno::Reference < container::XChild > xChild( xDocument, 
uno::UNO_QUERY );
-if ( xChild.is() )
-xChild->setParent( m_xParent );
-
-m_xDocHolder->SetComponent( xDocument, m_bReadOnly );
-}
+m_xDocHolder->SetComponent( LoadDocumentFromStorage_Impl(), 
m_bReadOnly );
 }
 
 if ( !m_xDocHolder->GetComponent().is() )
diff --git a/embeddedobj/source/commonembedding/miscobj.cxx 
b/embeddedobj/source/commonembedding/miscobj.cxx
index 48da9abdeaf7..557e21e2646a 100644
--- a/embeddedobj/source/commonembedding/miscobj.cxx
+++ b/embeddedobj/source/commonembedding/miscobj.cxx
@@ -439,7 +439,7 @@ uno::Reference< util::XCloseable > SAL_CALL 
OCommonEmbeddedObject::getComponent(
  static_cast< ::cppu::OWeakObject* >(this) 
);
 }
 
-return uno::Reference< util::XCloseable >( m_xDocHolder->GetComponent(), 
uno::UNO_QUERY );
+return m_xDocHolder->GetComponent();
 }
 
 
@@ -550,15 +550,9 @@ void SAL_CALL OCommonEmbeddedObject::close( sal_Bool 
bDeliverOwnership )
 // will use the storage, the storage will be disposed by the document and 
recreated by the object
 if ( m_xObjectStorage.is() )
 {
-uno::Reference< lang::XComponent > xComp( m_xObjectStorage, 
uno::UNO_QUERY );
-OSL_ENSURE( xComp.is(), "Storage does not support XComponent!" );
-
-if ( xComp.is() )
-{
-try {
-xComp->dispose();
-} catch ( const uno::Exception& ) {}
-}
+try {
+m_xObjectStorage->dispose();
+} catch ( const uno::Exception& ) {}
 
 m_xObjectStorage.clear();
 m_xRecoveryStorage.clear();
diff --git a/embeddedobj/source/commonembedding/persistence.cxx 
b/embeddedobj/source/commonembedding/persistence.cxx
index cba1be7c4d19..b4a4de81f3c5 100644
--- a/embeddedobj/source/commonembedding/persistence.cxx
+++ b/embeddedobj/source/commonembedding/persistence.cxx
@@ -149,10 +149,8 @@ static 

[Libreoffice-commits] core.git: embeddedobj/source

2019-05-22 Thread Andrea Gelmini (via logerrit)
 embeddedobj/source/msole/olepersist.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit e5cb863bb9c8e59f6c8251342ba6f48915fb46fa
Author: Andrea Gelmini 
AuthorDate: Wed May 22 10:42:34 2019 +
Commit: Julien Nabet 
CommitDate: Wed May 22 15:31:43 2019 +0200

Fix typo

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

diff --git a/embeddedobj/source/msole/olepersist.cxx 
b/embeddedobj/source/msole/olepersist.cxx
index 763ced642655..9f7f41235f60 100644
--- a/embeddedobj/source/msole/olepersist.cxx
+++ b/embeddedobj/source/msole/olepersist.cxx
@@ -1420,7 +1420,7 @@ void SAL_CALL OleEmbeddedObject::setPersistentEntry(
 3 );
 }
 #else
-// On unix the ole object can not do anything except storing itself 
somewere
+// On Unix the OLE object can not do anything except storing itself 
somewhere
 if ( nEntryConnectionMode == embed::EntryInitModes::DEFAULT_INIT && 
bElExists )
 {
 // TODO/LATER: detect classID of the object
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: embeddedobj/source

2019-05-21 Thread Andrea Gelmini (via logerrit)
 embeddedobj/source/general/docholder.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 40556d4309195ed20ed9c0afa86a89723ba2b93b
Author: Andrea Gelmini 
AuthorDate: Tue May 14 21:25:18 2019 +
Commit: Julien Nabet 
CommitDate: Wed May 22 07:22:56 2019 +0200

Fix typo

Change-Id: I257313aa1744f8c70ea9888cd19adde149c1ce64
Reviewed-on: https://gerrit.libreoffice.org/72716
Reviewed-by: Julien Nabet 
Tested-by: Julien Nabet 

diff --git a/embeddedobj/source/general/docholder.cxx 
b/embeddedobj/source/general/docholder.cxx
index 0c426d71e5e8..f7b1044fff12 100644
--- a/embeddedobj/source/general/docholder.cxx
+++ b/embeddedobj/source/general/docholder.cxx
@@ -960,7 +960,7 @@ bool DocumentHolder::LoadDocToFrame( bool bInPlace )
 uno::Reference < frame::XModel > xDoc( m_xComponent, uno::UNO_QUERY );
 if ( xDoc.is() )
 {
-// load new document in to the frame
+// load new document into the frame
 uno::Reference< frame::XComponentLoader > xComponentLoader( 
m_xFrame, uno::UNO_QUERY_THROW );
 
 ::comphelper::NamedValueCollection aArgs;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: embeddedobj/source

2019-05-21 Thread Andrea Gelmini (via logerrit)
 embeddedobj/source/commonembedding/embedobj.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 13e6b438869546db563df713108fc6e67a119417
Author: Andrea Gelmini 
AuthorDate: Tue May 14 21:25:20 2019 +
Commit: Julien Nabet 
CommitDate: Wed May 22 07:08:53 2019 +0200

Fix typo

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

diff --git a/embeddedobj/source/commonembedding/embedobj.cxx 
b/embeddedobj/source/commonembedding/embedobj.cxx
index 98f6a3d11d2b..8c888df48a9e 100644
--- a/embeddedobj/source/commonembedding/embedobj.cxx
+++ b/embeddedobj/source/commonembedding/embedobj.cxx
@@ -653,7 +653,7 @@ void SAL_CALL OCommonEmbeddedObject::setParent( const 
css::uno::Reference< css::
 // XDefaultSizeTransmitter
 void SAL_CALL OCommonEmbeddedObject::setDefaultSize( const css::awt::Size& 
rSize_100TH_MM )
 {
-//#i103460# charts do not necessaryly have an own size within ODF files, 
in this case they need to use the size settings from the surrounding frame, 
which is made available with this method
+//#i103460# charts do not necessarily have an own size within ODF files, 
in this case they need to use the size settings from the surrounding frame, 
which is made available with this method
 m_aDefaultSizeForChart_In_100TH_MM = rSize_100TH_MM;
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: embeddedobj/source

2019-05-21 Thread Andrea Gelmini (via logerrit)
 embeddedobj/source/inc/commonembobj.hxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit f545ee280053f8b7804e748bd41fe0cbb1cc07d9
Author: Andrea Gelmini 
AuthorDate: Tue May 14 21:25:17 2019 +
Commit: Julien Nabet 
CommitDate: Wed May 22 07:08:25 2019 +0200

Fix typo

Change-Id: I627d0d9899226eb39a19bde1ecf79f04ca26e633
Reviewed-on: https://gerrit.libreoffice.org/72717
Reviewed-by: Julien Nabet 
Tested-by: Julien Nabet 

diff --git a/embeddedobj/source/inc/commonembobj.hxx 
b/embeddedobj/source/inc/commonembobj.hxx
index 868bcc296631..c00fbdc096be 100644
--- a/embeddedobj/source/inc/commonembobj.hxx
+++ b/embeddedobj/source/inc/commonembobj.hxx
@@ -156,7 +156,7 @@ protected:
 bool m_bHasClonedSize; // the object has cached size
 css::awt::Size m_aClonedSize;
 sal_Int32 m_nClonedMapUnit;
-css::awt::Size m_aDefaultSizeForChart_In_100TH_MM;//#i103460# charts do 
not necessaryly have an own size within ODF files, in this case they need to 
use the size settings from the surrounding frame, which is made available with 
this member
+css::awt::Size m_aDefaultSizeForChart_In_100TH_MM;//#i103460# charts do 
not necessarily have an own size within ODF files, in this case they need to 
use the size settings from the surrounding frame, which is made available with 
this member
 
 private:
 void CommonInit_Impl( const css::uno::Sequence< css::beans::NamedValue >& 
aObjectProps );
@@ -396,7 +396,7 @@ public:
 virtual void SAL_CALL setParent( const css::uno::Reference< 
css::uno::XInterface >& Parent ) override;
 
 // XDefaultSizeTransmitter
-//#i103460# charts do not necessaryly have an own size within ODF files, 
in this case they need to use the size settings from the surrounding frame, 
which is made available with this method
+//#i103460# charts do not necessarily have an own size within ODF files, 
in this case they need to use the size settings from the surrounding frame, 
which is made available with this method
 virtual void SAL_CALL setDefaultSize( const css::awt::Size& rSize_100TH_MM 
) override;
 };
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: embeddedobj/source

2019-05-21 Thread Andrea Gelmini (via logerrit)
 embeddedobj/source/commonembedding/persistence.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 73e58a91bcae4238cf44b1c927fec2f993022a6d
Author: Andrea Gelmini 
AuthorDate: Tue May 14 21:25:19 2019 +
Commit: Julien Nabet 
CommitDate: Wed May 22 07:07:46 2019 +0200

Fix typo

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

diff --git a/embeddedobj/source/commonembedding/persistence.cxx 
b/embeddedobj/source/commonembedding/persistence.cxx
index aae1180f8d8b..b0decc28bd6a 100644
--- a/embeddedobj/source/commonembedding/persistence.cxx
+++ b/embeddedobj/source/commonembedding/persistence.cxx
@@ -1399,7 +1399,7 @@ void SAL_CALL OCommonEmbeddedObject::storeAsEntry( const 
uno::Reference< embed::
 m_aNewEntryName = sEntName;
 m_aNewDocMediaDescriptor = GetValuableArgs_Impl( lArguments, true );
 
-// TODO: register listeners for storages above, in case thay are disposed
+// TODO: register listeners for storages above, in case they are disposed
 //   an exception will be thrown on saveCompleted( true )
 
 // TODO: should the listener notification be done here or in saveCompleted?
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: embeddedobj/source embedserv/source formula/source hwpfilter/source sc/source svl/source sw/source vcl/source vcl/unx

2019-04-09 Thread Tamás Zolnai (via logerrit)
 embeddedobj/source/msole/olecomponent.cxx|3 +++
 embedserv/source/inprocserv/smartpointer.hxx |3 +++
 formula/source/core/api/token.cxx|3 +++
 hwpfilter/source/mzstring.cxx|3 +++
 sc/source/core/data/subtotalparam.cxx|3 +++
 sc/source/core/tool/refreshtimer.cxx |3 +++
 svl/source/misc/sharedstring.cxx |3 +++
 sw/source/core/attr/format.cxx   |3 +++
 sw/source/core/crsr/pam.cxx  |3 +++
 sw/source/core/layout/atrfrm.cxx |3 +++
 sw/source/core/layout/pagedesc.cxx   |3 +++
 sw/source/core/txtnode/fmtatr2.cxx   |3 +++
 vcl/source/app/scheduler.cxx |3 +++
 vcl/source/window/accel.cxx  |2 ++
 vcl/source/window/menu.cxx   |3 +++
 vcl/unx/generic/printer/jobdata.cxx  |3 +++
 16 files changed, 47 insertions(+)

New commits:
commit 3a5d78365dd172881c16c03e67f2d170ffc6d7d4
Author: Tamás Zolnai 
AuthorDate: Tue Apr 9 16:44:34 2019 +0200
Commit: Tamás Zolnai 
CommitDate: Wed Apr 10 01:06:19 2019 +0200

clang-tidy: Fix suspicious catches of WIP unhandled-self-assignment check

Change-Id: I1cb16b180f4cc5bf4d65485f03c44a06414d3580
Reviewed-on: https://gerrit.libreoffice.org/70481
Tested-by: Jenkins
Reviewed-by: Tamás Zolnai 

diff --git a/embeddedobj/source/msole/olecomponent.cxx 
b/embeddedobj/source/msole/olecomponent.cxx
index 06f24c9b080c..33b9586173d8 100644
--- a/embeddedobj/source/msole/olecomponent.cxx
+++ b/embeddedobj/source/msole/olecomponent.cxx
@@ -96,6 +96,9 @@ public:
 
 ComSmart& operator=( const ComSmart& rObj )
 {
+if(this == )
+return *this;
+
 OwnRelease();
 
 m_pInterface = rObj.m_pInterface;
diff --git a/embedserv/source/inprocserv/smartpointer.hxx 
b/embedserv/source/inprocserv/smartpointer.hxx
index 2cd19610762c..38750e79ae6d 100644
--- a/embedserv/source/inprocserv/smartpointer.hxx
+++ b/embedserv/source/inprocserv/smartpointer.hxx
@@ -64,6 +64,9 @@ public:
 
 ComSmart& operator=( const ComSmart& rObj )
 {
+if(this == )
+return *this;
+
 OwnRelease();
 
 m_pInterface = rObj.m_pInterface;
diff --git a/formula/source/core/api/token.cxx 
b/formula/source/core/api/token.cxx
index a80897c280fb..8069863ca503 100644
--- a/formula/source/core/api/token.cxx
+++ b/formula/source/core/api/token.cxx
@@ -644,6 +644,9 @@ void FormulaTokenArray::Assign( sal_uInt16 nCode, 
FormulaToken **pTokens )
 
 FormulaTokenArray& FormulaTokenArray::operator=( const FormulaTokenArray& rArr 
)
 {
+if(this == )
+return *this;
+
 Clear();
 Assign( rArr );
 return *this;
diff --git a/hwpfilter/source/mzstring.cxx b/hwpfilter/source/mzstring.cxx
index 96250aa45774..1ffba2d6558d 100644
--- a/hwpfilter/source/mzstring.cxx
+++ b/hwpfilter/source/mzstring.cxx
@@ -62,6 +62,9 @@ MzString::~MzString()
 
 MzString ::operator=(const MzString )
 {
+if(this == )
+return *this;
+
 int n = s.length();
 if (allocate(n))
 {
diff --git a/sc/source/core/data/subtotalparam.cxx 
b/sc/source/core/data/subtotalparam.cxx
index b4a36aaaf748..5b91e1580f21 100644
--- a/sc/source/core/data/subtotalparam.cxx
+++ b/sc/source/core/data/subtotalparam.cxx
@@ -80,6 +80,9 @@ void ScSubTotalParam::Clear()
 
 ScSubTotalParam& ScSubTotalParam::operator=( const ScSubTotalParam& r )
 {
+if(this == )
+return *this;
+
 nCol1   = r.nCol1;
 nRow1   = r.nRow1;
 nCol2   = r.nCol2;
diff --git a/sc/source/core/tool/refreshtimer.cxx 
b/sc/source/core/tool/refreshtimer.cxx
index 72ff16679af6..c466febcee24 100644
--- a/sc/source/core/tool/refreshtimer.cxx
+++ b/sc/source/core/tool/refreshtimer.cxx
@@ -69,6 +69,9 @@ ScRefreshTimer::~ScRefreshTimer()
 
 ScRefreshTimer& ScRefreshTimer::operator=( const ScRefreshTimer& r )
 {
+if(this == )
+return *this;
+
 SetRefreshControl(nullptr);
 AutoTimer::operator=( r );
 return *this;
diff --git a/svl/source/misc/sharedstring.cxx b/svl/source/misc/sharedstring.cxx
index d3b10af4ddb4..97c22aa72942 100644
--- a/svl/source/misc/sharedstring.cxx
+++ b/svl/source/misc/sharedstring.cxx
@@ -60,6 +60,9 @@ SharedString::~SharedString()
 
 SharedString& SharedString::operator= ( const SharedString& r )
 {
+if(this == )
+return *this;
+
 if (mpData)
 rtl_uString_release(mpData);
 if (mpDataIgnoreCase)
diff --git a/sw/source/core/attr/format.cxx b/sw/source/core/attr/format.cxx
index da052acfef0d..af0ebc16bc1c 100644
--- a/sw/source/core/attr/format.cxx
+++ b/sw/source/core/attr/format.cxx
@@ -104,6 +104,9 @@ SwFormat::SwFormat( const SwFormat& rFormat ) :
 
 SwFormat ::operator=(const SwFormat& rFormat)
 {
+if(this == )
+return *this;
+
 m_nWhichId = rFormat.m_nWhichId;
 m_nPoolFormatId = rFormat.GetPoolFormatId();
 m_nPoolHelpId = 

[Libreoffice-commits] core.git: embeddedobj/source

2019-04-01 Thread Andrea Gelmini (via logerrit)
 embeddedobj/source/msole/olecomponent.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit cbe9516536615c5b5896682815f83931cc085af3
Author: Andrea Gelmini 
AuthorDate: Sun Mar 31 22:23:33 2019 +
Commit: Julien Nabet 
CommitDate: Mon Apr 1 09:04:28 2019 +0200

Fix typo

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

diff --git a/embeddedobj/source/msole/olecomponent.cxx 
b/embeddedobj/source/msole/olecomponent.cxx
index f1511d696f7b..2fa50bd452e0 100644
--- a/embeddedobj/source/msole/olecomponent.cxx
+++ b/embeddedobj/source/msole/olecomponent.cxx
@@ -1519,7 +1519,7 @@ uno::Any SAL_CALL OleComponent::getTransferData( const 
datatransfer::DataFlavor&
 
 // The following optimization does not make much sense currently just 
because
 // only one aspect is supported, and only three formats for the aspect 
are supported
-// and moreover it is not guarantied that the once returned format 
will be supported further
+// and moreover it is not guaranteed that the once returned format 
will be supported further
 // example - i52106
 // TODO/LATER: bring the optimization back when other aspects are 
supported
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: embeddedobj/source

2019-03-31 Thread Mike Kaganski (via logerrit)
 embeddedobj/source/msole/olecomponent.cxx |8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

New commits:
commit 5e30823e8a25066aa7bbaa801583dbfa7db55a72
Author: Mike Kaganski 
AuthorDate: Sun Mar 31 18:11:27 2019 +0300
Commit: Mike Kaganski 
CommitDate: Sun Mar 31 18:10:42 2019 +0200

tdf#120703 PVS: GetBitmapBits does not return required buffer size

... unlike GetMetaFileBitsEx or GetEnhMetaFileBits, which are used
in the other branches. The implementation is trying to pass nullptr
to the function since commit 41e72962df83a410986fb48250aaaf1adc827c13

Just calculate the required buffer size using BITMAP struct filled
by GetObject call.

V575 The null pointer is passed into 'GetBitmapBits' function.
 Inspect the third argument.

Change-Id: I0d164694c99d805fd59b65ea1b4df4919a89e130
Reviewed-on: https://gerrit.libreoffice.org/70012
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/embeddedobj/source/msole/olecomponent.cxx 
b/embeddedobj/source/msole/olecomponent.cxx
index a8fad97a35a7..f1511d696f7b 100644
--- a/embeddedobj/source/msole/olecomponent.cxx
+++ b/embeddedobj/source/msole/olecomponent.cxx
@@ -334,7 +334,13 @@ bool OleComponentNative_Impl::ConvertDataForFlavor( const 
STGMEDIUM& aMedium,
 else if ( aMedium.tymed == TYMED_GDI ) // Bitmap
 {
 aFormat = "image/x-MS-bmp";
-nBufSize = GetBitmapBits( aMedium.hBitmap, 0, nullptr );
+
+// Find out size of buffer: deprecated GetBitmapBits does not have 
a mode to return
+// required buffer size
+BITMAP aBmp;
+GetObjectW(aMedium.hBitmap, sizeof(aBmp), );
+nBufSize = aBmp.bmWidthBytes * aBmp.bmHeight;
+
 pBuf.reset(new sal_Int8[nBufSize]);
 if ( nBufSize && nBufSize == sal::static_int_cast< ULONG >( 
GetBitmapBits( aMedium.hBitmap, nBufSize, pBuf.get() ) ) )
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: embeddedobj/source sdext/source soltools/mkdepend sw/source

2018-12-01 Thread Libreoffice Gerrit user
 embeddedobj/source/commonembedding/persistence.cxx |   10 +-
 sdext/source/pdfimport/test/pdfunzip.cxx   |   10 --
 soltools/mkdepend/pr.c |2 +-
 sw/source/core/text/porlay.cxx |6 +++---
 4 files changed, 9 insertions(+), 19 deletions(-)

New commits:
commit fff501a3393b459c512ec155e2d2cd935e7885a2
Author: Mike Kaganski 
AuthorDate: Mon Nov 26 10:36:52 2018 +0300
Commit: Mike Kaganski 
CommitDate: Sat Dec 1 18:20:24 2018 +0100

tdf#120703 PVS: V560 A part of conditional expression is always true/false

Change-Id: I38f3e3243f8cb891c9a0fe2f4c68bc76acd1ef44
Reviewed-on: https://gerrit.libreoffice.org/64020
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/embeddedobj/source/commonembedding/persistence.cxx 
b/embeddedobj/source/commonembedding/persistence.cxx
index 06562ac39682..aae1180f8d8b 100644
--- a/embeddedobj/source/commonembedding/persistence.cxx
+++ b/embeddedobj/source/commonembedding/persistence.cxx
@@ -1771,7 +1771,7 @@ void SAL_CALL OCommonEmbeddedObject::breakLink( const 
uno::Reference< embed::XSt
 if ( m_bDisposed )
 throw lang::DisposedException(); // TODO
 
-if ( !m_bIsLink )
+if (!m_bIsLink || m_nObjectState == -1)
 {
 // it must be a linked initialized object
 throw embed::WrongStateException(
@@ -1791,14 +1791,6 @@ void SAL_CALL OCommonEmbeddedObject::breakLink( const 
uno::Reference< embed::XSt
 static_cast< ::cppu::OWeakObject* 
>(this),
 2 );
 
-if ( !m_bIsLink || m_nObjectState == -1 )
-{
-// it must be a linked initialized object
-throw embed::WrongStateException(
-"The object is not a valid linked object!",
-static_cast< ::cppu::OWeakObject* >(this) );
-}
-
 if ( m_bWaitSaveCompleted )
 throw embed::WrongStateException(
 "The object waits for saveCompleted() call!",
diff --git a/sdext/source/pdfimport/test/pdfunzip.cxx 
b/sdext/source/pdfimport/test/pdfunzip.cxx
index 17807af628d6..ca7e5afa0b1a 100644
--- a/sdext/source/pdfimport/test/pdfunzip.cxx
+++ b/sdext/source/pdfimport/test/pdfunzip.cxx
@@ -311,9 +311,8 @@ static int write_addStreams( const char* pInFile, const 
char* pOutFile, PDFFile*
 
 static int write_fonts( const char* i_pInFile, const char* i_pOutFile, 
PDFFile* i_pPDFFile )
 {
-int nRet = 0;
 unsigned int nElements = i_pPDFFile->m_aSubElements.size();
-for( unsigned i = 0; i < nElements && nRet == 0; i++ )
+for (unsigned i = 0; i < nElements; i++)
 {
 // search FontDescriptors
 PDFObject* pObj = 
dynamic_cast(i_pPDFFile->m_aSubElements[i].get());
@@ -390,16 +389,15 @@ static int write_fonts( const char* i_pInFile, const 
char* i_pOutFile, PDFFile*
 aContext.m_bDecrypt = i_pPDFFile->isEncrypted();
 pStream->writeStream( aContext, i_pPDFFile );
 }
-return nRet;
+return 0;
 }
 
 static std::vector< std::pair< sal_Int32, sal_Int32 > > s_aEmitObjects;
 
 static int write_objects( const char* i_pInFile, const char* i_pOutFile, 
PDFFile* i_pPDFFile )
 {
-int nRet = 0;
 unsigned int nElements = s_aEmitObjects.size();
-for( unsigned i = 0; i < nElements && nRet == 0; i++ )
+for (unsigned i = 0; i < nElements; i++)
 {
 sal_Int32 nObject = s_aEmitObjects[i].first;
 sal_Int32 nGeneration = s_aEmitObjects[i].second;
@@ -419,7 +417,7 @@ static int write_objects( const char* i_pInFile, const 
char* i_pOutFile, PDFFile
 aContext.m_bDecrypt = i_pPDFFile->isEncrypted();
 pStream->writeStream( aContext, i_pPDFFile );
 }
-return nRet;
+return 0;
 }
 
 SAL_IMPLEMENT_MAIN_WITH_ARGS( argc, argv )
diff --git a/soltools/mkdepend/pr.c b/soltools/mkdepend/pr.c
index 4fe0b4ada2fa..391e39dfcd20 100644
--- a/soltools/mkdepend/pr.c
+++ b/soltools/mkdepend/pr.c
@@ -59,7 +59,7 @@ void add_include(struct filepointer *filep, struct inclist 
*file, struct inclist
 if (newfile) {
 
 /* Only add new dependency files if they don't have "/usr/include" in 
them. */
-if (!(newfile && newfile->i_file && strstr(newfile->i_file, "/usr/"))) 
{
+if (!(newfile->i_file && strstr(newfile->i_file, "/usr/"))) {
 included_by(file, newfile);
 }
 
diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx
index 02900e9e5d79..781c8aef5302 100644
--- a/sw/source/core/text/porlay.cxx
+++ b/sw/source/core/text/porlay.cxx
@@ -1510,7 +1510,7 @@ sal_Int32 SwScriptInfo::MaskHiddenRanges( const 
SwTextNode& rNode, OUStringBuffe
 
 while ( nHiddenStart < nHiddenEnd && nHiddenStart < nEnd )
 {
-if ( nHiddenStart >= nStt && nHiddenStart < nEnd )
+if (nHiddenStart >= nStt)
 {
 rText[nHiddenStart] = cChar;
 

[Libreoffice-commits] core.git: embeddedobj/source

2018-11-14 Thread Libreoffice Gerrit user
 embeddedobj/source/inc/oleembobj.hxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 50b858b96b1c252b3190bda0210e9df016016c1f
Author: Andrea Gelmini 
AuthorDate: Wed Nov 14 21:58:44 2018 +0100
Commit: Jens Carl 
CommitDate: Thu Nov 15 01:21:50 2018 +0100

Fix typo

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

diff --git a/embeddedobj/source/inc/oleembobj.hxx 
b/embeddedobj/source/inc/oleembobj.hxx
index d9b75d2a9836..25194c87d0f8 100644
--- a/embeddedobj/source/inc/oleembobj.hxx
+++ b/embeddedobj/source/inc/oleembobj.hxx
@@ -207,7 +207,7 @@ class OleEmbeddedObject : public ::cppu::WeakImplHelper
 
 css::uno::Reference< css::uno::XInterface > m_xParent;
 
-/// If it is allowed to modify entires in the stream of the OLE storage.
+/// If it is allowed to modify entries in the stream of the OLE storage.
 bool m_bStreamReadOnly = false;
 
 protected:
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-11-14 Thread Libreoffice Gerrit user
 embeddedobj/source/inc/oleembobj.hxx|   10 +-
 embeddedobj/source/msole/olemisc.cxx|   14 ++
 embeddedobj/source/msole/olepersist.cxx |3 ++-
 sw/qa/extras/htmlexport/htmlexport.cxx  |7 ++-
 sw/source/filter/html/htmlplug.cxx  |   19 +++
 5 files changed, 50 insertions(+), 3 deletions(-)

New commits:
commit 72e6269b88a32a672e00d2c25f0d0400038d1360
Author: Miklos Vajna 
AuthorDate: Wed Nov 14 17:17:46 2018 +0100
Commit: Miklos Vajna 
CommitDate: Wed Nov 14 19:20:43 2018 +0100

sw: fix modification of ole obj native data during HTML import

It is expected that if you load an OLE2 storage (from reqif-xhtml) and
you save it as ODT, the OLE2 data is not modified. This was almost the
case, but we insisted on removing the OLE2 preview from the storage.

Add a new flag to OleEmbeddedObject, so import filters can opt in for
not modifying the OLE2 data.

[ The nice situation is that we already had a test file which had a
preview stream in the OLE2 storage, so we can easily assert there that
the size doesn't change. ]

Change-Id: I9b8b29f015dd4f2513e51a1066767218580cb5d8
Reviewed-on: https://gerrit.libreoffice.org/63381
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/embeddedobj/source/inc/oleembobj.hxx 
b/embeddedobj/source/inc/oleembobj.hxx
index b1f44fbbd429..d9b75d2a9836 100644
--- a/embeddedobj/source/inc/oleembobj.hxx
+++ b/embeddedobj/source/inc/oleembobj.hxx
@@ -37,6 +37,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -117,7 +118,8 @@ class OleEmbeddedObject : public ::cppu::WeakImplHelper
 , css::embed::XLinkageSupport
 , css::embed::XInplaceObject
 , css::container::XChild
-, css::io::XActiveDataStreamer >
+, css::io::XActiveDataStreamer
+, css::lang::XInitialization >
 {
 friend class OleComponent;
 
@@ -205,6 +207,9 @@ class OleEmbeddedObject : public ::cppu::WeakImplHelper
 
 css::uno::Reference< css::uno::XInterface > m_xParent;
 
+/// If it is allowed to modify entires in the stream of the OLE storage.
+bool m_bStreamReadOnly = false;
+
 protected:
 /// @throws css::uno::Exception
 css::uno::Reference< css::io::XStream > TryToGetAcceptableFormat_Impl(
@@ -441,6 +446,9 @@ public:
 // XActiveDataStreamer
 void SAL_CALL setStream(const css::uno::Reference& 
xStream) override;
 css::uno::Reference SAL_CALL getStream() override;
+
+// XInitialization
+void SAL_CALL initialize(const css::uno::Sequence& 
rArguments) override;
 };
 
 #endif
diff --git a/embeddedobj/source/msole/olemisc.cxx 
b/embeddedobj/source/msole/olemisc.cxx
index 83485c89d768..2d757a594533 100644
--- a/embeddedobj/source/msole/olemisc.cxx
+++ b/embeddedobj/source/msole/olemisc.cxx
@@ -29,6 +29,7 @@
 #include 
 
 #include 
+#include 
 
 #include 
 #include "olepersist.hxx"
@@ -676,4 +677,17 @@ css::uno::Reference 
OleEmbeddedObject::getStream()
 return m_xObjectStream;
 }
 
+void OleEmbeddedObject::initialize(const uno::Sequence& rArguments)
+{
+if (!rArguments.hasElements())
+return;
+
+comphelper::SequenceAsHashMap aValues(rArguments[0]);
+for (const auto& rValue : aValues)
+{
+if (rValue.first == "StreamReadOnly")
+rValue.second >>= m_bStreamReadOnly;
+}
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/embeddedobj/source/msole/olepersist.cxx 
b/embeddedobj/source/msole/olepersist.cxx
index eedc8c4fe63b..df78e09291ce 100644
--- a/embeddedobj/source/msole/olepersist.cxx
+++ b/embeddedobj/source/msole/olepersist.cxx
@@ -1201,7 +1201,8 @@ void OleEmbeddedObject::StoreToLocation_Impl(
 if ( !xCachedVisualRepresentation.is() )
 xCachedVisualRepresentation = 
TryToRetrieveCachedVisualRepresentation_Impl( xTargetStream );
 
-RemoveVisualCache_Impl( xTargetStream );
+if (!m_bStreamReadOnly)
+RemoveVisualCache_Impl(xTargetStream);
 }
 }
 
diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx 
b/sw/qa/extras/htmlexport/htmlexport.cxx
index d1db894519b0..81d851a7f831 100644
--- a/sw/qa/extras/htmlexport/htmlexport.cxx
+++ b/sw/qa/extras/htmlexport/htmlexport.cxx
@@ -555,7 +555,12 @@ DECLARE_HTMLEXPORT_ROUNDTRIP_TEST(testReqIfOle2, 
"reqif-ole2.xhtml")
 uno::Reference xStream(xEmbeddedObject->getStream(), 
uno::UNO_QUERY);
 // This was 80913, the RTF hexdump -> OLE1 binary -> OLE2 conversion was
 // missing.
-CPPUNIT_ASSERT_EQUAL(static_cast(38912), xStream->getLength());
+// Also, this was 38912 when we re-generated the OLE2 preview, which is
+// wrong, the OLE2 data is 38375 bytes in the ole2.ole (referenced by
+// reqif-ole2.xhtml). To see that this is the correct value, convert the
+// hexdump in ole2.ole 

[Libreoffice-commits] core.git: embeddedobj/source sd/source sfx2/source

2018-11-09 Thread Libreoffice Gerrit user
 embeddedobj/source/general/docholder.cxx |   30 +++---
 sd/source/ui/view/ToolBarManager.cxx |   10 ++
 sfx2/source/appl/workwin.cxx |1 +
 3 files changed, 22 insertions(+), 19 deletions(-)

New commits:
commit ea3fc61f29f6d53c4c65cf6026267f7a37ef1a87
Author: Jan-Marek Glogowski 
AuthorDate: Fri Nov 9 17:33:22 2018 +
Commit: Jan-Marek Glogowski 
CommitDate: Fri Nov 9 20:42:28 2018 +0100

Fix sd toolbar manager lock underflows

Regressions from commit 45519023aa44 ("Resolves: tdf#119997
toolbar layout unlock doesn't refresh ui"), commit c5977a89c28b
("Resolves: tdf#96451 do magic to enable embedded chart sidebar
only for chart") and commit faed29cac93f ("for now show chart
sidebar").

It also adds an assert for the underflow, as nobody cared for
the underflow warnings since some years.

Change-Id: I86bb093987f084c85a7b640a846dfe0aefea9e48
Reviewed-on: https://gerrit.libreoffice.org/63204
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 

diff --git a/embeddedobj/source/general/docholder.cxx 
b/embeddedobj/source/general/docholder.cxx
index 6afbba4aa50c..75f61282fcc2 100644
--- a/embeddedobj/source/general/docholder.cxx
+++ b/embeddedobj/source/general/docholder.cxx
@@ -691,8 +691,8 @@ bool DocumentHolder::ShowUI( const uno::Reference< 
css::frame::XLayoutManager >&
 if ( xOwnLM.is() && xDocAreaAcc.is() )
 {
 // make sure that lock state of LM is correct even if an exception 
is thrown in between
-bool bUnlock = false;
-bool bLock = false;
+bool bUnlockContainerLM = false;
+bool bLockOwnLM = false;
 try
 {
 // take over the control over the containers window
@@ -706,18 +706,14 @@ bool DocumentHolder::ShowUI( const uno::Reference< 
css::frame::XLayoutManager >&
 // this must be done after merging menus as we won't get 
the container menu otherwise
 xContainerLM->setDockingAreaAcceptor( uno::Reference < 
ui::XDockingAreaAcceptor >() );
 
-bool bIsChart = false;
 uno::Reference< lang::XServiceInfo> 
xServiceInfo(m_xComponent, uno::UNO_QUERY);
-if (xServiceInfo.is() && 
xServiceInfo->supportsService("com.sun.star.chart2.ChartDocument"))
-bIsChart = true;
-// prevent further changes at this LM
-// TODO: moggi: why is this necessary?
-if (!bIsChart)
+if (!xServiceInfo.is() || 
!xServiceInfo->supportsService("com.sun.star.chart2.ChartDocument"))
 {
-xContainerLM->setVisible( false );
+// prevent further changes at this LM
+xContainerLM->setVisible(false);
 xContainerLM->lock();
+bUnlockContainerLM = true;
 }
-bUnlock = true;
 
 // by unlocking the LM each layout change will now resize 
the containers window; pending layouts will be processed now
 xOwnLM->setVisible( true );
@@ -727,7 +723,7 @@ bool DocumentHolder::ShowUI( const uno::Reference< 
css::frame::XLayoutManager >&
 xSupp->setActiveFrame( m_xFrame );
 
 xOwnLM->unlock();
-bLock = true;
+bLockOwnLM = true;
 bResult = true;
 
 // TODO/LATER: The following action should be done only if 
the window is not hidden
@@ -746,7 +742,7 @@ bool DocumentHolder::ShowUI( const uno::Reference< 
css::frame::XLayoutManager >&
 xSupp->setActiveFrame( nullptr );
 
 // remove control about containers window from own LM
-if ( bLock )
+if (bLockOwnLM)
 xOwnLM->lock();
 xOwnLM->setVisible( false );
 xOwnLM->setDockingAreaAcceptor( uno::Reference< 
css::ui::XDockingAreaAcceptor >() );
@@ -762,7 +758,7 @@ bool DocumentHolder::ShowUI( const uno::Reference< 
css::frame::XLayoutManager >&
 // reestablish control of containers window
 xContainerLM->setDockingAreaAcceptor( xDocAreaAcc );
 xContainerLM->setVisible( true );
-if ( bUnlock )
+if (bUnlockContainerLM)
 xContainerLM->unlock();
 }
 catch( const uno::Exception& ) {}
@@ -805,8 +801,12 @@ bool DocumentHolder::HideUI( const uno::Reference< 
css::frame::XLayoutManager >&
 xMerge->removeMergedMenuBar();
 
 xContainerLM->setDockingAreaAcceptor( xDocAreaAcc );
-xContainerLM->setVisible( true );
-

[Libreoffice-commits] core.git: embeddedobj/source

2018-11-07 Thread Libreoffice Gerrit user
 embeddedobj/source/msole/olecomponent.cxx |   11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

New commits:
commit fe83001574b4c8dbab166d8abb8014f78424278a
Author: Miklos Vajna 
AuthorDate: Wed Nov 7 12:24:47 2018 +0100
Commit: Miklos Vajna 
CommitDate: Wed Nov 7 17:32:33 2018 +0100

embeddedobj win32: avoid owning a lock while calling out to event listeners

The deadlock happens from time to time, when converting documents
containing OLE objects via remote UNO (from Java) -- after the
conversion, when closing the document.

The relevant stacktraces are:

>Debug.ListCallStack /ShowLineOffset /AllThreads
Callstack for Thread 8 (Thread Id: 32912 (0x8090)):
...
 6  sal3.dll!osl_acquireMutex(_oslMutexImpl * Mutex) Line 75
 7  [Inline Frame] emboleobj.dll!osl::Mutex::acquire() Line 56
 8  [Inline Frame] 
emboleobj.dll!osl::Guard::{ctor}(osl::Mutex &) Line 129
 9  emboleobj.dll!OleComponent::OnClose_Impl() Line 1399
 10 emboleobj.dll!OleWrapperAdviseSink::OnClose() Line 119

Callstack for Thread 11 (Thread Id: 21088 (0x5260)):
...
 11 ole32.dll!7fffc5e44e83()
 12 [Inline Frame] emboleobj.dll!OleComponent::CloseObject() Line 1012
 13 emboleobj.dll!OleComponent::Dispose() Line 484
 14 emboleobj.dll!OleComponent::close(unsigned char bDeliverOwnership) 
Line 1463
 15 emboleobj.dll!OleEmbeddedObject::GetRidOfComponent() Line 239
 16 emboleobj.dll!OleEmbeddedObject::Dispose() Line 275
 17 emboleobj.dll!OleEmbeddedObject::close(unsigned char 
bDeliverOwnership) Line 497
...
 26 swlo.dll!SwXTextDocument::close(unsigned char bDeliverOwnership) 
Line 617

OleComponent::OnClose_Impl() taking a lock is fine, but
OleComponent::close() takes a lock and then later it still calls out
(via OleComponent::CloseObject()), which is a no-go.

Fix the problem by making sure that callers of Dispose() own no lock at
the time of the function call, and taking the lock in Dispose() only
after the CloseObject() call (which invokes event listeners).

Change-Id: I53befee21478188c7f79723b7d7596e66077d1c2
Reviewed-on: https://gerrit.libreoffice.org/63014
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/embeddedobj/source/msole/olecomponent.cxx 
b/embeddedobj/source/msole/olecomponent.cxx
index f9440f651bb2..a8fad97a35a7 100644
--- a/embeddedobj/source/msole/olecomponent.cxx
+++ b/embeddedobj/source/msole/olecomponent.cxx
@@ -454,8 +454,9 @@ OleComponent::~OleComponent()
 
 if ( m_pOleWrapClientSite || m_pImplAdviseSink || m_pInterfaceContainer || 
m_bOleInitialized )
 {
-::osl::MutexGuard aGuard( m_aMutex );
+::osl::ClearableMutexGuard aGuard( m_aMutex );
 m_refCount++;
+aGuard.clear();
 try {
 Dispose();
 } catch( const uno::Exception& ) {}
@@ -472,12 +473,15 @@ OleComponent::~OleComponent()
 
 void OleComponent::Dispose()
 {
-// the mutex must be locked before this method is called
 if ( m_bDisposed )
 return;
 
+// Call CloseObject() without m_aMutex locked, since it will call
+// IOleObject::Close(), which can call event listeners, which can run on a
+// different thread.
 CloseObject();
 
+osl::MutexGuard aGuard(m_aMutex);
 if ( m_pOleWrapClientSite )
 {
 m_pOleWrapClientSite->disconnectOleComponent();
@@ -1408,7 +1412,7 @@ void OleComponent::OnClose_Impl()
 
 void SAL_CALL OleComponent::close( sal_Bool bDeliverOwnership )
 {
-::osl::MutexGuard aGuard( m_aMutex );
+::osl::ClearableMutexGuard aGuard( m_aMutex );
 if ( m_bDisposed )
 throw lang::DisposedException(); // TODO
 
@@ -1453,6 +1457,7 @@ void SAL_CALL OleComponent::close( sal_Bool 
bDeliverOwnership )
 }
 }
 }
+aGuard.clear();
 
 Dispose();
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: embeddedobj/source

2018-10-28 Thread Libreoffice Gerrit user
 embeddedobj/source/msole/olepersist.cxx |  103 +++-
 1 file changed, 49 insertions(+), 54 deletions(-)

New commits:
commit c026807d8d4654090bccefc6d70ceb1819c2092a
Author: Mike Kaganski 
AuthorDate: Sun Oct 28 02:59:43 2018 +0300
Commit: Mike Kaganski 
CommitDate: Sun Oct 28 07:56:24 2018 +0100

tdf#120703 PVS: V547 Expression is always true/false

Fixed the logic broken since commit 5d64757c7a5df2d3cb9b36d18f44932df15e5b3f
with what seems to be the original idea.

Change-Id: I1a25cfb27d7d9a1af4e024c2989ea4959014455f
Reviewed-on: https://gerrit.libreoffice.org/62462
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/embeddedobj/source/msole/olepersist.cxx 
b/embeddedobj/source/msole/olepersist.cxx
index 286f24b709fc..eedc8c4fe63b 100644
--- a/embeddedobj/source/msole/olepersist.cxx
+++ b/embeddedobj/source/msole/olepersist.cxx
@@ -1878,72 +1878,67 @@ void SAL_CALL OleEmbeddedObject::breakLink( const 
uno::Reference< embed::XStorag
 
 
 #ifdef _WIN32
-if ( m_pOleComponent )
-{
-// TODO: create an object based on the link
-
-// disconnect the old temporary URL
-OUString aOldTempURL = m_aTempURL;
-m_aTempURL.clear();
+// TODO: create an object based on the link
 
-OleComponent* pNewOleComponent = new OleComponent( m_xFactory, this );
-try {
-pNewOleComponent->InitEmbeddedCopyOfLink( m_pOleComponent );
-}
-catch ( const uno::Exception& )
-{
-delete pNewOleComponent;
-if ( !m_aTempURL.isEmpty() )
-   KillFile_Impl( m_aTempURL, m_xFactory );
-m_aTempURL = aOldTempURL;
-throw;
-}
+// disconnect the old temporary URL
+OUString aOldTempURL = m_aTempURL;
+m_aTempURL.clear();
 
-try {
-GetRidOfComponent();
-}
-catch( const uno::Exception& )
-{
-delete pNewOleComponent;
-if ( !m_aTempURL.isEmpty() )
-   KillFile_Impl( m_aTempURL, m_xFactory );
-m_aTempURL = aOldTempURL;
-throw;
-}
+OleComponent* pNewOleComponent = new OleComponent(m_xFactory, this);
+try {
+pNewOleComponent->InitEmbeddedCopyOfLink(m_pOleComponent);
+}
+catch (const uno::Exception&)
+{
+delete pNewOleComponent;
+if (!m_aTempURL.isEmpty())
+KillFile_Impl(m_aTempURL, m_xFactory);
+m_aTempURL = aOldTempURL;
+throw;
+}
 
-   KillFile_Impl( aOldTempURL, m_xFactory );
+try {
+GetRidOfComponent();
+}
+catch (const uno::Exception&)
+{
+delete pNewOleComponent;
+if (!m_aTempURL.isEmpty())
+KillFile_Impl(m_aTempURL, m_xFactory);
+m_aTempURL = aOldTempURL;
+throw;
+}
 
-CreateOleComponent_Impl( pNewOleComponent );
+KillFile_Impl(aOldTempURL, m_xFactory);
 
-if ( m_xParentStorage != xStorage || !m_aEntryName.equals( sEntName ) )
-SwitchOwnPersistence( xStorage, sEntName );
+CreateOleComponent_Impl(pNewOleComponent);
 
-if ( m_nObjectState != embed::EmbedStates::LOADED )
-{
-// TODO: should we activate the new object if the link was 
activated?
+if (m_xParentStorage != xStorage || !m_aEntryName.equals(sEntName))
+SwitchOwnPersistence(xStorage, sEntName);
 
-sal_Int32 nTargetState = m_nObjectState;
-m_nObjectState = embed::EmbedStates::LOADED;
+if (m_nObjectState != embed::EmbedStates::LOADED)
+{
+// TODO: should we activate the new object if the link was activated?
 
-if ( m_nObjectState == embed::EmbedStates::RUNNING )
-m_pOleComponent->RunObject(); // the object already was in 
running state, the server must be installed
-else // m_nObjectState == embed::EmbedStates::ACTIVE
-{
-m_pOleComponent->RunObject(); // the object already was in 
running state, the server must be installed
-m_pOleComponent->ExecuteVerb( 
embed::EmbedVerbs::MS_OLEVERB_OPEN );
-}
+const sal_Int32 nTargetState = m_nObjectState;
+m_nObjectState = embed::EmbedStates::LOADED;
 
-m_nObjectState = nTargetState;
+if (nTargetState == embed::EmbedStates::RUNNING)
+m_pOleComponent->RunObject(); // the object already was in running 
state, the server must be installed
+else // nTargetState == embed::EmbedStates::ACTIVE
+{
+m_pOleComponent->RunObject(); // the object already was in running 
state, the server must be installed
+m_pOleComponent->ExecuteVerb(embed::EmbedVerbs::MS_OLEVERB_OPEN);
 }
 
-m_bIsLink = false;
-m_aLinkURL.clear();
-}
-else
-#endif
-{
-throw io::IOException(); //TODO:
+m_nObjectState = nTargetState;
 }
+
+ 

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

2018-10-20 Thread Libreoffice Gerrit user
 embeddedobj/source/msole/oleembed.cxx |5 +
 sw/source/core/view/vnew.cxx  |8 
 2 files changed, 5 insertions(+), 8 deletions(-)

New commits:
commit 27b0d7237a7e2f32897fa52820c3aa382f6683e9
Author: Caolán McNamara 
AuthorDate: Fri Oct 19 14:34:17 2018 +0100
Commit: Caolán McNamara 
CommitDate: Sat Oct 20 14:29:59 2018 +0200

clarify this code a little

Change-Id: I10a9f29add5cefa866cbe87e5c6164738ca57d04
Reviewed-on: https://gerrit.libreoffice.org/62019
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/embeddedobj/source/msole/oleembed.cxx 
b/embeddedobj/source/msole/oleembed.cxx
index 7f84b91ead18..72fb031d84a1 100644
--- a/embeddedobj/source/msole/oleembed.cxx
+++ b/embeddedobj/source/msole/oleembed.cxx
@@ -837,11 +837,8 @@ void SAL_CALL OleEmbeddedObject::doVerb( sal_Int32 nVerbID 
)
 uno::Reference< embed::XEmbeddedObject > xWrappedObject = m_xWrappedObject;
 if ( xWrappedObject.is() )
 {
-// open content in the window not in-place
-nVerbID = embed::EmbedVerbs::MS_OLEVERB_OPEN;
-
 // the object was converted to OOo embedded object, the current 
implementation is now only a wrapper
-xWrappedObject->doVerb( nVerbID );
+xWrappedObject->doVerb(embed::EmbedVerbs::MS_OLEVERB_OPEN); // open 
content in the window not in-place
 return;
 }
 // end wrapping related part 
diff --git a/sw/source/core/view/vnew.cxx b/sw/source/core/view/vnew.cxx
index f3ae2154993e..ba029c6c9f77 100644
--- a/sw/source/core/view/vnew.cxx
+++ b/sw/source/core/view/vnew.cxx
@@ -178,9 +178,9 @@ SwViewShell::SwViewShell( SwDoc& rDocument, vcl::Window 
*pWindow,
 // i#38810 Do not reset modified state of document,
 // if it's already been modified.
 const bool bIsDocModified( mxDoc->getIDocumentState().IsModified() );
-pOutput = mpOut;
+OutputDevice* pOrigOut = mpOut;
 Init( pNewOpt );// may change the Outdev (InitPrt())
-mpOut = pOutput;
+mpOut = pOrigOut;
 
 // initialize print preview layout after layout
 // is created in  - called above.
@@ -253,9 +253,9 @@ SwViewShell::SwViewShell( SwViewShell& rShell, vcl::Window 
*pWindow,
 
 bool bModified = mxDoc->getIDocumentState().IsModified();
 
-pOutput = mpOut;
+OutputDevice* pOrigOut = mpOut;
 Init( rShell.GetViewOptions() ); // might change Outdev (InitPrt())
-mpOut = pOutput;
+mpOut = pOrigOut;
 
 if ( mbPreview )
 mpImp->InitPagePreviewLayout();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: embeddedobj/source

2018-07-25 Thread Libreoffice Gerrit user
 embeddedobj/source/msole/oleembed.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 1ac55de4674035c7306df4d66db088c3b8f99438
Author: Caolán McNamara 
AuthorDate: Wed Jul 25 09:09:15 2018 +0100
Commit: Caolán McNamara 
CommitDate: Wed Jul 25 12:42:26 2018 +0200

Resolves: tdf#118919 crash on double click ole object

Change-Id: Id7b3df447db56f6f80d6255dabdcc7f6ab149e95
Reviewed-on: https://gerrit.libreoffice.org/57953
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/embeddedobj/source/msole/oleembed.cxx 
b/embeddedobj/source/msole/oleembed.cxx
index f117496a6ef4..b9854a076f58 100644
--- a/embeddedobj/source/msole/oleembed.cxx
+++ b/embeddedobj/source/msole/oleembed.cxx
@@ -663,7 +663,7 @@ namespace
 {
 bool lcl_CopyStream(const uno::Reference& xIn, const 
uno::Reference& xOut, sal_Int32 nMaxCopy = SAL_MAX_INT32)
 {
-if (nMaxCopy == 0)
+if (nMaxCopy <= 0)
 return false;
 
 const sal_Int32 nChunkSize = 4096;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: embeddedobj/source libreofficekit/qa libreofficekit/source unotools/source

2018-06-28 Thread Andrea Gelmini
 embeddedobj/source/commonembedding/visobj.cxx|2 +-
 libreofficekit/qa/gtktiledviewer/gtv-helpers.cxx |2 +-
 libreofficekit/source/gtk/lokdocview.cxx |2 +-
 unotools/source/i18n/resmgr.cxx  |2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

New commits:
commit c44668a6c12d35552dde8c6ebcc14feb2ffdd37d
Author: Andrea Gelmini 
Date:   Thu Jun 28 13:27:16 2018 +0200

Fix typos

Change-Id: I1b966b636f67a549718ca19c00c2820e8d168c7a
Reviewed-on: https://gerrit.libreoffice.org/56589
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt 

diff --git a/embeddedobj/source/commonembedding/visobj.cxx 
b/embeddedobj/source/commonembedding/visobj.cxx
index 28df7ed0f583..968d3a584808 100644
--- a/embeddedobj/source/commonembedding/visobj.cxx
+++ b/embeddedobj/source/commonembedding/visobj.cxx
@@ -166,7 +166,7 @@ embed::VisualRepresentation SAL_CALL 
OCommonEmbeddedObject::getPreferredVisualRe
 awt::Size aOrigSize = getVisualAreaSize(nAspect);
 changeState(embed::EmbedStates::RUNNING);
 const bool bIsChart = GetDocumentServiceName() == 
"com.sun.star.chart2.ChartDocument";
-// tdf#108643 unless its a chart, cause those are weird (#i103460#)
+// tdf#108643 unless it's a chart, cause those are weird (#i103460#)
 if (!bIsChart && aOrigSize != getVisualAreaSize(nAspect))
 setVisualAreaSize(nAspect, aOrigSize);
 
diff --git a/libreofficekit/qa/gtktiledviewer/gtv-helpers.cxx 
b/libreofficekit/qa/gtktiledviewer/gtv-helpers.cxx
index d2fcb979e3d3..d810170dc675 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-helpers.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-helpers.cxx
@@ -101,7 +101,7 @@ GtkWidget* GtvHelpers::createCommentBox(const 
boost::property_tree::ptree& aComm
 gchar *id = g_strndup(aComment.get("id").c_str(), 20);
 g_object_set_data_full(G_OBJECT(pCommentVBox), "id", id, g_free);
 
-// Set background if its a reply comment
+// Set background if it's a reply comment
 if (aComment.get("parent", -1) > 0)
 {
 GtkStyleContext* pStyleContext = 
gtk_widget_get_style_context(pCommentVBox);
diff --git a/libreofficekit/source/gtk/lokdocview.cxx 
b/libreofficekit/source/gtk/lokdocview.cxx
index e55592e9c1da..4589a46ffa6b 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -3227,7 +3227,7 @@ static void lok_doc_view_class_init (LOKDocViewClass* 
pClass)
  * 'action' can be 'Add', 'Remove' or 'Modify' depending on whether
  *  comment has been added, removed or modified.
  * 'parent' is a non-zero comment id if this comment is a reply comment,
- *  otherwise its a root comment.
+ *  otherwise it's a root comment.
  */
 doc_view_signals[COMMENT] =
 g_signal_new("comment",
diff --git a/unotools/source/i18n/resmgr.cxx b/unotools/source/i18n/resmgr.cxx
index f756575bc5bb..f93aaa00b226 100644
--- a/unotools/source/i18n/resmgr.cxx
+++ b/unotools/source/i18n/resmgr.cxx
@@ -208,7 +208,7 @@ namespace Translate
 ++pId;
 }
 
-//if its a key id locale, generate it here
+//if it's a key id locale, generate it here
 if (std::use_facet(loc).language() == "qtz")
 {
 OString sKeyId(genKeyId(OString(pContextAndId).replace('\004', 
'|')));
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: embeddedobj/source filter/source include/filter sw/qa sw/source

2018-05-30 Thread Miklos Vajna
 embeddedobj/source/inc/oleembobj.hxx |4 
 filter/source/msfilter/msdffimp.cxx  |   14 +-
 include/filter/msfilter/msdffimp.hxx |6 
 sw/qa/extras/htmlexport/data/reqif-ole-odg.ole   |  146 +++
 sw/qa/extras/htmlexport/data/reqif-ole-odg.png   |binary
 sw/qa/extras/htmlexport/data/reqif-ole-odg.xhtml |9 +
 sw/qa/extras/htmlexport/htmlexport.cxx   |   15 ++
 sw/source/filter/html/htmlplug.cxx   |   70 ---
 sw/source/filter/html/htmlreqifreader.cxx|   36 -
 sw/source/filter/html/htmlreqifreader.hxx|8 -
 10 files changed, 284 insertions(+), 24 deletions(-)

New commits:
commit 0258bcdedd710d78de99c9cefc9d8c3e2ca85fdf
Author: Miklos Vajna 
Date:   Wed May 30 17:32:45 2018 +0200

sw HTML filter: handle embedded ODF content in xhtml/reqif mode

Embedded native data (what we don't parse just carry on) and real OLE2
embedding already worked, this adds the case where the actual content is
ODF, just inside OLE2.

The DOC import/export had support for handleing ODF content inside OLE2,
so reuse that code: add new functions to SvxMSDffManager for import
purposes and reuse SvxMSExportOLEObjects for export purposes.

Change-Id: I0acf65d4bf29af896b8f1dd625e8672050aae350
Reviewed-on: https://gerrit.libreoffice.org/55088
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins 

diff --git a/embeddedobj/source/inc/oleembobj.hxx 
b/embeddedobj/source/inc/oleembobj.hxx
index 59a3782fb7f4..b1f44fbbd429 100644
--- a/embeddedobj/source/inc/oleembobj.hxx
+++ b/embeddedobj/source/inc/oleembobj.hxx
@@ -106,6 +106,10 @@ public:
 
 class OleComponent;
 class OwnView_Impl;
+/**
+ * Represents an OLE object that has native data and we try to let an external
+ * application handle that data.
+ */
 class OleEmbeddedObject : public ::cppu::WeakImplHelper
 < css::embed::XEmbeddedObject
 , css::embed::XEmbeddedOleObject
diff --git a/filter/source/msfilter/msdffimp.cxx 
b/filter/source/msfilter/msdffimp.cxx
index f37fa69dffd7..17b8273b908f 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -6936,7 +6936,7 @@ const char* GetInternalServerName_Impl( const 
SvGlobalName& aGlobName )
 return nullptr;
 }
 
-OUString GetFilterNameFromClassID_Impl( const SvGlobalName& aGlobName )
+OUString SvxMSDffManager::GetFilterNameFromClassID( const SvGlobalName& 
aGlobName )
 {
 if ( aGlobName == SvGlobalName( SO3_SW_OLE_EMBED_CLASSID_60 ) )
 return OUString( "StarOffice XML (Writer)" );
@@ -6977,6 +6977,13 @@ OUString GetFilterNameFromClassID_Impl( const 
SvGlobalName& aGlobName )
 return OUString();
 }
 
+void SvxMSDffManager::ExtractOwnStream(SotStorage& rSrcStg, SvMemoryStream& 
rMemStream)
+{
+tools::SvRef xStr
+= rSrcStg.OpenSotStream("package_stream", StreamMode::STD_READ);
+xStr->ReadStream(rMemStream);
+}
+
 css::uno::Reference < css::embed::XEmbeddedObject >  
SvxMSDffManager::CheckForConvertToSOObj( sal_uInt32 nConvertFlags,
 SotStorage& rSrcStg, const uno::Reference < 
embed::XStorage >& rDestStorage,
 const Graphic& rGrf,
@@ -7041,8 +7048,7 @@ css::uno::Reference < css::embed::XEmbeddedObject >  
SvxMSDffManager::CheckForCo
 if ( pName )
 {
 // TODO/LATER: perhaps we need to retrieve VisArea and Metafile 
from the storage also
-tools::SvRef xStr = rSrcStg.OpenSotStream( 
"package_stream", StreamMode::STD_READ );
-xStr->ReadStream( *xMemStream );
+SvxMSDffManager::ExtractOwnStream(rSrcStg, *xMemStream);
 }
 else
 {
@@ -7077,7 +7083,7 @@ css::uno::Reference < css::embed::XEmbeddedObject >  
SvxMSDffManager::CheckForCo
 if ( pFilter )
 aFilterName = pFilter->GetName();
 else
-aFilterName = GetFilterNameFromClassID_Impl( aStgNm );
+aFilterName = SvxMSDffManager::GetFilterNameFromClassID( 
aStgNm );
 
 uno::Sequence aMedium(aFilterName.isEmpty() 
? 3 : 4);
 aMedium[0].Name = "InputStream";
diff --git a/include/filter/msfilter/msdffimp.hxx 
b/include/filter/msfilter/msdffimp.hxx
index 41f5ce32ae0f..164c08406327 100644
--- a/include/filter/msfilter/msdffimp.hxx
+++ b/include/filter/msfilter/msdffimp.hxx
@@ -65,6 +65,7 @@ struct SvxMSDffShapeOrder;
 class SvxMSDffManager;
 class SfxItemSet;
 struct DffObjData;
+class SvGlobalName;
 
 namespace com { namespace sun { namespace star {
 namespace beans { class XPropertySet; }
@@ -735,6 +736,11 @@ public:
 const OUString& rPropertyName
 );
 
+/// Determines an ODF filter name (if there is one) for aGlobName.
+static OUString GetFilterNameFromClassID(const SvGlobalName& aGlobName);
+/// Extracts ODF data from rSrcStg.
+static void ExtractOwnStream(SotStorage& 

[Libreoffice-commits] core.git: embeddedobj/source

2018-05-30 Thread Miklos Vajna
 embeddedobj/source/inc/commonembobj.hxx |4 
 embeddedobj/source/inc/dummyobject.hxx  |4 
 2 files changed, 8 insertions(+)

New commits:
commit 5f4d499493c68e52977543c3abc6713518e5e000
Author: Miklos Vajna 
Date:   Tue May 29 16:38:18 2018 +0200

embeddedobj: document OCommon/DummyEmbeddedObject

Change-Id: Ia0024945fa88c14dce4da571ddfd3281e1e41da7
Reviewed-on: https://gerrit.libreoffice.org/55022
Tested-by: Jenkins 
Reviewed-by: Miklos Vajna 

diff --git a/embeddedobj/source/inc/commonembobj.hxx 
b/embeddedobj/source/inc/commonembobj.hxx
index 0ae22154959e..868bcc296631 100644
--- a/embeddedobj/source/inc/commonembobj.hxx
+++ b/embeddedobj/source/inc/commonembobj.hxx
@@ -72,6 +72,10 @@ namespace comphelper {
 
 class Interceptor;
 
+/**
+ * Represents an OLE object that has native data and we loaded that data into a
+ * document model successfully.
+ */
 class OCommonEmbeddedObject : public css::embed::XEmbeddedObject
 , public css::embed::XEmbedPersist2
 , public css::embed::XLinkageSupport
diff --git a/embeddedobj/source/inc/dummyobject.hxx 
b/embeddedobj/source/inc/dummyobject.hxx
index 30505a2b0244..67795190a27a 100644
--- a/embeddedobj/source/inc/dummyobject.hxx
+++ b/embeddedobj/source/inc/dummyobject.hxx
@@ -48,6 +48,10 @@ namespace cppu {
 class OMultiTypeInterfaceContainerHelper;
 }
 
+/**
+ * Represents an OLE object that has native data (next to the replacement
+ * image), but we don't understand that data.
+ */
 class ODummyEmbeddedObject : public ::cppu::WeakImplHelper
 < css::embed::XEmbeddedObject
 , css::embed::XEmbedPersist >
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: embeddedobj/source sw/Library_sw.mk sw/qa sw/source

2018-03-23 Thread Miklos Vajna
 embeddedobj/source/inc/oleembobj.hxx  |7 
 embeddedobj/source/msole/olemisc.cxx  |   10 
 sw/Library_sw.mk  |1 
 sw/qa/extras/htmlimport/data/ole2.ole | 1014 ++
 sw/qa/extras/htmlimport/data/ole2.png |binary
 sw/qa/extras/htmlimport/data/reqif-ole2.xhtml |5 
 sw/qa/extras/htmlimport/htmlimport.cxx|   19 
 sw/source/filter/html/htmlplug.cxx|   26 
 sw/source/filter/html/htmlreqifreader.cxx |  146 +++
 sw/source/filter/html/htmlreqifreader.hxx |   22 
 10 files changed, 1248 insertions(+), 2 deletions(-)

New commits:
commit 781c1181718c295e0f7c0c2169d0f6d539f685df
Author: Miklos Vajna 
Date:   Fri Mar 23 10:58:46 2018 +0100

sw XHTML import: support OLE2-in-RTF objects

If you like layering things on top of each other, then this commit
message is for you. So it's possible to have a PPTX file in the
following wrappers:

- wrap PPTX in a binary OLE2 container
- wrap that in an OLE1 container
- wrap that in an RTF fragment
- wrap that in an XHTML fragment (in a ReqIF file)

Turns out that only the RTF and OLE1 unwrapping was missing, the rest
worked already, so implement the missing piece in a new SwReqIfReader
namespace.

Finally extend OleEmbeddedObject to be able to read its native data
stream when the object is opened, reading it from the storage would
fail, as the object already opened the storage stream.

Change-Id: I2934c9fb7474e981ff6bb2f7eb253a3a86cfd98b
Reviewed-on: https://gerrit.libreoffice.org/51772
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins 

diff --git a/embeddedobj/source/inc/oleembobj.hxx 
b/embeddedobj/source/inc/oleembobj.hxx
index 5df00c5e0a16..e944c6cfd842 100644
--- a/embeddedobj/source/inc/oleembobj.hxx
+++ b/embeddedobj/source/inc/oleembobj.hxx
@@ -36,6 +36,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -110,7 +111,8 @@ class OleEmbeddedObject : public ::cppu::WeakImplHelper
 , css::embed::XEmbedPersist
 , css::embed::XLinkageSupport
 , css::embed::XInplaceObject
-, css::container::XChild >
+, css::container::XChild
+, css::io::XActiveDataStreamer >
 {
 friend class OleComponent;
 
@@ -431,6 +433,9 @@ public:
 virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getParent(  ) 
override;
 virtual void SAL_CALL setParent( const css::uno::Reference< 
css::uno::XInterface >& Parent ) override;
 
+// XActiveDataStreamer
+void SAL_CALL setStream(const css::uno::Reference& 
xStream) override;
+css::uno::Reference SAL_CALL getStream() override;
 };
 
 #endif
diff --git a/embeddedobj/source/msole/olemisc.cxx 
b/embeddedobj/source/msole/olemisc.cxx
index ad348f468c98..4ae70b745a7a 100644
--- a/embeddedobj/source/msole/olemisc.cxx
+++ b/embeddedobj/source/msole/olemisc.cxx
@@ -670,4 +670,14 @@ void SAL_CALL OleEmbeddedObject::setParent( const 
css::uno::Reference< css::uno:
 m_xParent = xParent;
 }
 
+void OleEmbeddedObject::setStream(const css::uno::Reference& 
xStream)
+{
+m_xObjectStream = xStream;
+}
+
+css::uno::Reference OleEmbeddedObject::getStream()
+{
+return m_xObjectStream;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk
index 7ca75085cc74..f70ef0b76b27 100644
--- a/sw/Library_sw.mk
+++ b/sw/Library_sw.mk
@@ -521,6 +521,7 @@ $(eval $(call gb_Library_add_exception_objects,sw,\
 sw/source/filter/html/htmlnumreader \
 sw/source/filter/html/htmlnumwriter \
 sw/source/filter/html/htmlplug \
+sw/source/filter/html/htmlreqifreader \
 sw/source/filter/html/htmlsect \
 sw/source/filter/html/htmltab \
 sw/source/filter/html/htmltabw \
diff --git a/sw/qa/extras/htmlimport/data/ole2.ole 
b/sw/qa/extras/htmlimport/data/ole2.ole
new file mode 100644
index ..96407e88fa3d
--- /dev/null
+++ b/sw/qa/extras/htmlimport/data/ole2.ole
@@ -0,0 +1,1014 @@
+{\object\objemb{\*\objclass PowerPoint.Show.12}\objw10020\objh5638{\*\objdata 
+0105
+0200
+1300
+506f776572506f696e742e53686f772e313200
+
+
+0094
+d0cf11e0a1b11ae13e000300feff090006
+000100011002000100feff
+ff
+ff
+ff
+ff
+ff

[Libreoffice-commits] core.git: embeddedobj/source embedserv/source formula/source

2018-03-17 Thread Julien Nabet
 embeddedobj/source/msole/olecomponent.cxx   |7 ++-
 embedserv/source/embed/ed_ioleobject.cxx|   25 +
 embedserv/source/embed/ed_ipersiststr.cxx   |6 +++---
 formula/source/core/api/FormulaCompiler.cxx |6 +++---
 formula/source/ui/dlg/funcpage.cxx  |   10 +++---
 5 files changed, 20 insertions(+), 34 deletions(-)

New commits:
commit c6994fb815624d31bc2570bdcdc5991fd1195792
Author: Julien Nabet 
Date:   Sat Mar 17 11:59:25 2018 +0100

Use for-range loops in embeddedobj, embedserv and formula

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

diff --git a/embeddedobj/source/msole/olecomponent.cxx 
b/embeddedobj/source/msole/olecomponent.cxx
index df3b0131b07b..cd9ac6e142f8 100644
--- a/embeddedobj/source/msole/olecomponent.cxx
+++ b/embeddedobj/source/msole/olecomponent.cxx
@@ -462,12 +462,9 @@ OleComponent::~OleComponent()
 } catch( const uno::Exception& ) {}
 }
 
-for ( FormatEtcList::iterator aIter = 
m_pNativeImpl->m_aFormatsList.begin();
-  aIter != m_pNativeImpl->m_aFormatsList.end();
-  ++aIter )
+for (auto const& format : m_pNativeImpl->m_aFormatsList)
 {
-delete *aIter;
-(*aIter) = nullptr;
+delete format;
 }
 m_pNativeImpl->m_aFormatsList.clear();
 
diff --git a/embedserv/source/embed/ed_ioleobject.cxx 
b/embedserv/source/embed/ed_ioleobject.cxx
index 82a39b8b583a..ed1e734b45ac 100644
--- a/embedserv/source/embed/ed_ioleobject.cxx
+++ b/embedserv/source/embed/ed_ioleobject.cxx
@@ -90,11 +90,10 @@ HRESULT EmbedDocument_Impl::OLENotifyClosing()
 {
 AdviseSinkHashMap aAHM(m_aAdviseHashMap);
 
-for ( AdviseSinkHashMapIterator iAdvise = aAHM.begin();
-  iAdvise != aAHM.end(); iAdvise++ )
+for (auto const& advise : aAHM)
 {
-if ( iAdvise->second )
-iAdvise->second->OnClose();
+if (advise.second)
+advise.second->OnClose();
 }
 
 return S_OK;
@@ -405,12 +404,9 @@ HRESULT EmbedDocument_Impl::SaveObject()
 if(m_pClientSite) {
 hr = m_pClientSite->SaveObject();
 
-for ( AdviseSinkHashMapIterator iAdvise =
-  m_aAdviseHashMap.begin();
-  iAdvise != m_aAdviseHashMap.end();
-  iAdvise++ )
-if ( iAdvise->second )
-iAdvise->second->OnSave( );
+for (auto const& advise : m_aAdviseHashMap)
+if (advise.second)
+advise.second->OnSave();
 }
 else if ( m_aFileName.getLength() && IsDirty() == S_OK )
 {
@@ -440,12 +436,9 @@ HRESULT EmbedDocument_Impl::ShowObject()
 
 void EmbedDocument_Impl::notify( bool bDataChanged )
 {
-for ( AdviseSinkHashMapIterator iAdvise =
-  m_aAdviseHashMap.begin();
-  iAdvise != m_aAdviseHashMap.end();
-  iAdvise++ )
-if ( iAdvise->second )
-iAdvise->second->OnViewChange( DVASPECT_CONTENT, -1 );
+for (auto const& advise : m_aAdviseHashMap)
+if (advise.second)
+advise.second->OnViewChange( DVASPECT_CONTENT, -1 );
 
 if ( m_pDAdviseHolder && bDataChanged )
 m_pDAdviseHolder->SendOnDataChange( static_cast(this), 
0, 0 );
diff --git a/embedserv/source/embed/ed_ipersiststr.cxx 
b/embedserv/source/embed/ed_ipersiststr.cxx
index 3b817ceb3138..632297274451 100644
--- a/embedserv/source/embed/ed_ipersiststr.cxx
+++ b/embedserv/source/embed/ed_ipersiststr.cxx
@@ -702,10 +702,10 @@ STDMETHODIMP EmbedDocument_Impl::SaveCompleted( IStorage 
*pStgNew )
 _pExtStream );
 if ( FAILED( hr ) || !m_pExtStream ) return E_OUTOFMEMORY;
 
-for ( AdviseSinkHashMapIterator iAdvise = m_aAdviseHashMap.begin(); 
iAdvise != m_aAdviseHashMap.end(); iAdvise++ )
+for (auto const& advise : m_aAdviseHashMap)
 {
-if ( iAdvise->second )
-iAdvise->second->OnSave();
+if ( advise.second )
+advise.second->OnSave();
 }
 
 return S_OK;
diff --git a/formula/source/core/api/FormulaCompiler.cxx 
b/formula/source/core/api/FormulaCompiler.cxx
index 537f8f74f074..d16e08068b94 100644
--- a/formula/source/core/api/FormulaCompiler.cxx
+++ b/formula/source/core/api/FormulaCompiler.cxx
@@ -577,11 +577,11 @@ uno::Sequence< sheet::FormulaOpCodeMapEntry > 
FormulaCompiler::OpCodeMap::create
 // If AddIn functions are present in this mapping, use them, and 
only those.
 if (hasExternals())
 {
-for (ExternalHashMap::const_iterator it( 
maExternalHashMap.begin());it != maExternalHashMap.end(); ++it)
+for (auto const& elem : maExternalHashMap)
 {
 FormulaOpCodeMapEntry aEntry;
-aEntry.Name = (*it).first;
-  

[Libreoffice-commits] core.git: embeddedobj/source

2018-03-02 Thread Marco Cecchetti
 embeddedobj/source/commonembedding/embedobj.cxx |   34 +---
 1 file changed, 19 insertions(+), 15 deletions(-)

New commits:
commit a3646b25ac4c976b891d69759035345630c4f1a2
Author: Marco Cecchetti 
Date:   Mon Feb 26 13:55:21 2018 +0100

lok - chart - state switch issue triggers an OLE general error msg box

Change-Id: I6addd95d1ad3461b6e21328512cbd1301a36cd19
Reviewed-on: https://gerrit.libreoffice.org/50368
Reviewed-by: Jan Holesovsky 
Tested-by: Jan Holesovsky 
Reviewed-on: https://gerrit.libreoffice.org/50482
Tested-by: Jenkins 
Reviewed-by: Marco Cecchetti 

diff --git a/embeddedobj/source/commonembedding/embedobj.cxx 
b/embeddedobj/source/commonembedding/embedobj.cxx
index 9aefab91ae79..5357d21a88e6 100644
--- a/embeddedobj/source/commonembedding/embedobj.cxx
+++ b/embeddedobj/source/commonembedding/embedobj.cxx
@@ -40,6 +40,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -312,22 +313,25 @@ void OCommonEmbeddedObject::SwitchStateTo_Impl( sal_Int32 
nNextState )
 catch( const uno::Exception& )
 {}
 
-// if currently another object is UIactive it will be 
deactivated; usually this will activate the LM of
-// the container. Locking the LM will prevent flicker.
-xContainerLM->lock();
-xInplaceClient->activatingUI();
-bool bOk = m_xDocHolder->ShowUI( xContainerLM, xContainerDP, 
aModuleName );
-xContainerLM->unlock();
-
-if ( bOk )
-{
-m_nObjectState = nNextState;
-m_xDocHolder->ResizeHatchWindow();
-}
-else
+if (!comphelper::LibreOfficeKit::isActive())
 {
-xInplaceClient->deactivatedUI();
-throw embed::WrongStateException(); //TODO: can't activate 
UI
+// if currently another object is UIactive it will be 
deactivated; usually this will activate the LM of
+// the container. Locking the LM will prevent flicker.
+xContainerLM->lock();
+xInplaceClient->activatingUI();
+bool bOk = m_xDocHolder->ShowUI( xContainerLM, 
xContainerDP, aModuleName );
+xContainerLM->unlock();
+
+if ( bOk )
+{
+m_nObjectState = nNextState;
+m_xDocHolder->ResizeHatchWindow();
+}
+else
+{
+xInplaceClient->deactivatedUI();
+   throw embed::WrongStateException(); //TODO: can't 
activate UI
+}
 }
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: embeddedobj/source

2018-01-29 Thread Szymon Kłos
 embeddedobj/source/general/docholder.cxx |   13 +
 1 file changed, 5 insertions(+), 8 deletions(-)

New commits:
commit 077e0f3b6439dbe9d63aa438b8b076f5d93baf43
Author: Szymon Kłos 
Date:   Mon Jan 29 10:50:39 2018 +0100

tdf#114677 Correct title in Base forms cleanup

Change-Id: I224858ffce50b00273d80f915831ec7789cfa64a
Reviewed-on: https://gerrit.libreoffice.org/48819
Tested-by: Jenkins 
Reviewed-by: Szymon Kłos 

diff --git a/embeddedobj/source/general/docholder.cxx 
b/embeddedobj/source/general/docholder.cxx
index d7c40a109a3d..798b4c3c59f5 100644
--- a/embeddedobj/source/general/docholder.cxx
+++ b/embeddedobj/source/general/docholder.cxx
@@ -969,17 +969,14 @@ bool DocumentHolder::LoadDocToFrame( bool bInPlace )
 
 // set document title to show in the title bar
 css::uno::Reference< css::frame::XTitle > xModelTitle( xDoc, 
css::uno::UNO_QUERY );
-if( xModelTitle.is() )
+if( xModelTitle.is() && m_pEmbedObj && 
!m_pEmbedObj->getContainerName().isEmpty() )
 {
 std::locale aResLoc = Translate::Create("sfx");
 OUString sEmbedded = Translate::get(STR_EMBEDDED_TITLE, 
aResLoc);
-if( !m_pEmbedObj->getContainerName().isEmpty() )
-{
-xModelTitle->setTitle( m_pEmbedObj->getContainerName() + 
sEmbedded );
-m_aContainerName = m_pEmbedObj->getContainerName();
-// TODO: get real m_aDocumentNamePart
-m_aDocumentNamePart = sEmbedded;
-}
+xModelTitle->setTitle( m_pEmbedObj->getContainerName() + 
sEmbedded );
+m_aContainerName = m_pEmbedObj->getContainerName();
+// TODO: get real m_aDocumentNamePart
+m_aDocumentNamePart = sEmbedded;
 }
 
 if ( bInPlace )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: embeddedobj/source

2018-01-29 Thread Szymon Kłos
 embeddedobj/source/general/docholder.cxx |   11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

New commits:
commit 5426a14e39660bde0dece27cf5ec26b9938bd962
Author: Szymon Kłos 
Date:   Sun Jan 28 18:18:32 2018 +0100

tdf#114677 Correct title in Base forms

Change-Id: I07bdb46cce88e876583e1d4217dff3f77f2f3814
Reviewed-on: https://gerrit.libreoffice.org/48801
Tested-by: Jenkins 
Reviewed-by: Szymon Kłos 

diff --git a/embeddedobj/source/general/docholder.cxx 
b/embeddedobj/source/general/docholder.cxx
index 18fbd91641c8..d7c40a109a3d 100644
--- a/embeddedobj/source/general/docholder.cxx
+++ b/embeddedobj/source/general/docholder.cxx
@@ -973,10 +973,13 @@ bool DocumentHolder::LoadDocToFrame( bool bInPlace )
 {
 std::locale aResLoc = Translate::Create("sfx");
 OUString sEmbedded = Translate::get(STR_EMBEDDED_TITLE, 
aResLoc);
-xModelTitle->setTitle( m_pEmbedObj->getContainerName() + 
sEmbedded);
-m_aContainerName = m_pEmbedObj->getContainerName();
-// TODO: get real m_aDocumentNamePart
-m_aDocumentNamePart = sEmbedded;
+if( !m_pEmbedObj->getContainerName().isEmpty() )
+{
+xModelTitle->setTitle( m_pEmbedObj->getContainerName() + 
sEmbedded );
+m_aContainerName = m_pEmbedObj->getContainerName();
+// TODO: get real m_aDocumentNamePart
+m_aDocumentNamePart = sEmbedded;
+}
 }
 
 if ( bInPlace )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: embeddedobj/source

2018-01-22 Thread Stephan Bergmann
 embeddedobj/source/msole/olecomponent.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 587b6906d5b9ae1ac9368f1e48d84285cebaece3
Author: Stephan Bergmann 
Date:   Mon Jan 22 13:01:39 2018 +0100

loplugin:unnecessaryparen (clang-cl)

Change-Id: Iff2b28120e0c43f13d4fb21a75746f2a289214c7
Reviewed-on: https://gerrit.libreoffice.org/48312
Tested-by: Jenkins 
Reviewed-by: Stephan Bergmann 

diff --git a/embeddedobj/source/msole/olecomponent.cxx 
b/embeddedobj/source/msole/olecomponent.cxx
index 738d87fa6452..290318a4d109 100644
--- a/embeddedobj/source/msole/olecomponent.cxx
+++ b/embeddedobj/source/msole/olecomponent.cxx
@@ -466,7 +466,7 @@ OleComponent::~OleComponent()
   aIter != m_pNativeImpl->m_aFormatsList.end();
   ++aIter )
 {
-delete (*aIter);
+delete *aIter;
 (*aIter) = nullptr;
 }
 m_pNativeImpl->m_aFormatsList.clear();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: embeddedobj/source

2018-01-04 Thread Mike Kaganski
 embeddedobj/source/msole/olevisual.cxx |6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

New commits:
commit d86d3caf9853e930eb686b63309a7cc6c29cc0d2
Author: Mike Kaganski 
Date:   Thu Jan 4 14:11:05 2018 +0100

Remove redundant control flow branch

Change-Id: I5f63f2a7ad6eb6bf85b21b6936a1488ce13ccc93
Reviewed-on: https://gerrit.libreoffice.org/47394
Tested-by: Jenkins 
Reviewed-by: Mike Kaganski 

diff --git a/embeddedobj/source/msole/olevisual.cxx 
b/embeddedobj/source/msole/olevisual.cxx
index a9faa3a83eeb..820e39c2f7f0 100644
--- a/embeddedobj/source/msole/olevisual.cxx
+++ b/embeddedobj/source/msole/olevisual.cxx
@@ -345,12 +345,8 @@ embed::VisualRepresentation SAL_CALL 
OleEmbeddedObject::getPreferredVisualRepres
 SetVisReplInStream( m_xCachedVisualRepresentation.is() );
 }
 
-if ( m_xCachedVisualRepresentation.is() )
-{
-return GetVisualRepresentationInNativeFormat_Impl( 
m_xCachedVisualRepresentation );
-}
 #ifdef _WIN32
-else if ( m_pOleComponent )
+if ( !m_xCachedVisualRepresentation.is() && m_pOleComponent )
 {
 try
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: embeddedobj/source

2017-11-22 Thread Stephan Bergmann
 embeddedobj/source/commonembedding/persistence.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 2da9e6836926ff9b767f0ad603407acbdae2bb67
Author: Stephan Bergmann 
Date:   Wed Nov 22 16:40:57 2017 +0100

Help old GCC

Change-Id: I29093aa7975394b74952a4856632e8e657b33ae0

diff --git a/embeddedobj/source/commonembedding/persistence.cxx 
b/embeddedobj/source/commonembedding/persistence.cxx
index ab171e3a478b..6c820f851ab2 100644
--- a/embeddedobj/source/commonembedding/persistence.cxx
+++ b/embeddedobj/source/commonembedding/persistence.cxx
@@ -445,7 +445,7 @@ OUString OCommonEmbeddedObject::GetFilterName( sal_Int32 
nVersion ) const
 if (utl::ConfigManager::IsFuzzing() && nVersion == 
SOFFICE_FILEFORMAT_CURRENT &&
 sDocumentServiceName == "com.sun.star.chart2.ChartDocument")
 {
-return "chart8";
+return OUString("chart8");
 }
 try {
 ::comphelper::MimeConfigurationHelper aHelper( m_xContext );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: embeddedobj/source

2017-11-22 Thread Caolán McNamara
 embeddedobj/source/commonembedding/persistence.cxx |9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

New commits:
commit 366e35799d8c4d9ef871edbb592747b0f4d7ef70
Author: Caolán McNamara 
Date:   Wed Nov 22 13:19:26 2017 +

fuzzing: common case of embedded charts in docx

Change-Id: Idc6fdc221ce60e33e6b9fcb1689840dd96570d6b
Reviewed-on: https://gerrit.libreoffice.org/45089
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/embeddedobj/source/commonembedding/persistence.cxx 
b/embeddedobj/source/commonembedding/persistence.cxx
index 07bc635a44a4..ab171e3a478b 100644
--- a/embeddedobj/source/commonembedding/persistence.cxx
+++ b/embeddedobj/source/commonembedding/persistence.cxx
@@ -56,6 +56,7 @@
 #include 
 
 #include 
+#include 
 #include "persistence.hxx"
 
 using namespace ::com::sun::star;
@@ -440,9 +441,15 @@ OUString OCommonEmbeddedObject::GetFilterName( sal_Int32 
nVersion ) const
 OUString aFilterName = GetPresetFilterName();
 if ( aFilterName.isEmpty() )
 {
+OUString sDocumentServiceName = GetDocumentServiceName();
+if (utl::ConfigManager::IsFuzzing() && nVersion == 
SOFFICE_FILEFORMAT_CURRENT &&
+sDocumentServiceName == "com.sun.star.chart2.ChartDocument")
+{
+return "chart8";
+}
 try {
 ::comphelper::MimeConfigurationHelper aHelper( m_xContext );
-aFilterName = aHelper.GetDefaultFilterFromServiceName( 
GetDocumentServiceName(), nVersion );
+aFilterName = 
aHelper.GetDefaultFilterFromServiceName(sDocumentServiceName, nVersion);
 
 // If no filter is found, fall back to the FileFormatVersion=6200 
filter, Base only has that.
 if (aFilterName.isEmpty() && nVersion == 
SOFFICE_FILEFORMAT_CURRENT)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: embeddedobj/source

2017-10-05 Thread Stephan Bergmann
 embeddedobj/source/msole/olecomponent.cxx   |   20 +--
 embeddedobj/source/msole/xdialogcreator.cxx |  146 +---
 2 files changed, 81 insertions(+), 85 deletions(-)

New commits:
commit be8bbd297e8eada7658783fef727b690fda5f224
Author: Stephan Bergmann 
Date:   Thu Oct 5 09:41:18 2017 +0200

loplugin:flatten (clang-cl, embeddedobj)

Change-Id: Ic870347b3dc0ce6b7ad223c47a36b54843a26613

diff --git a/embeddedobj/source/msole/olecomponent.cxx 
b/embeddedobj/source/msole/olecomponent.cxx
index 8fbe0aa6b121..48cba783fcfd 100644
--- a/embeddedobj/source/msole/olecomponent.cxx
+++ b/embeddedobj/source/msole/olecomponent.cxx
@@ -1563,19 +1563,17 @@ uno::Any SAL_CALL OleComponent::getTransferData( const 
datatransfer::DataFlavor&
 
 uno::Reference< io::XOutputStream > xTempOutStream = 
xTempFileStream->getOutputStream();
 uno::Reference< io::XInputStream > xTempInStream = 
xTempFileStream->getInputStream();
-if ( xTempOutStream.is() && xTempInStream.is() )
-{
-OSL_ENSURE( m_pUnoOleObject, "Unexpected object absence!" );
-if ( !m_pUnoOleObject )
-throw uno::RuntimeException();
+if ( !(xTempOutStream.is() && xTempInStream.is()) )
+throw io::IOException(); // TODO:
 
-m_pUnoOleObject->StoreObjectToStream( xTempOutStream );
+OSL_ENSURE( m_pUnoOleObject, "Unexpected object absence!" );
+if ( !m_pUnoOleObject )
+throw uno::RuntimeException();
 
-xTempOutStream->closeOutput();
-xTempOutStream.clear();
-}
-else
-throw io::IOException(); // TODO:
+m_pUnoOleObject->StoreObjectToStream( xTempOutStream );
+
+xTempOutStream->closeOutput();
+xTempOutStream.clear();
 
 aResult <<= xTempInStream;
 }
diff --git a/embeddedobj/source/msole/xdialogcreator.cxx 
b/embeddedobj/source/msole/xdialogcreator.cxx
index b2d564be8dd6..f701268464d6 100644
--- a/embeddedobj/source/msole/xdialogcreator.cxx
+++ b/embeddedobj/source/msole/xdialogcreator.cxx
@@ -176,92 +176,90 @@ embed::InsertedObjectInfo SAL_CALL 
MSOLEDialogObjectCreator::createInstanceByDia
 
 uTemp=pInsertFct();
 
-if ( OLEUI_OK == uTemp )
+if ( OLEUI_OK != uTemp )
+throw ucb::CommandAbortedException();
+
+if (io.dwFlags & IOF_SELECTCREATENEW)
 {
-if (io.dwFlags & IOF_SELECTCREATENEW)
-{
-uno::Reference< embed::XEmbeddedObjectCreator > xEmbCreator = 
embed::EmbeddedObjectCreator::create( 
comphelper::getComponentContext(m_xFactory) );
-
-uno::Sequence< sal_Int8 > aClassID = 
MimeConfigurationHelper::GetSequenceClassID( io.clsid.Data1,
- 
io.clsid.Data2,
- 
io.clsid.Data3,
- 
io.clsid.Data4[0],
- 
io.clsid.Data4[1],
- 
io.clsid.Data4[2],
- 
io.clsid.Data4[3],
- 
io.clsid.Data4[4],
- 
io.clsid.Data4[5],
- 
io.clsid.Data4[6],
- 
io.clsid.Data4[7] );
-
-aClassID = GetRelatedInternalID_Impl( aClassID );
-
-//TODO: retrieve ClassName
-aObjectInfo.Object.set( xEmbCreator->createInstanceInitNew( 
aClassID, OUString(), xStorage, sEntName, aObjArgs ),
-uno::UNO_QUERY );
-}
-else
-{
-OUString aFileName = OStringToOUString( OString( szFile ), 
osl_getThreadTextEncoding() );
-OUString aFileURL;
-if ( osl::FileBase::getFileURLFromSystemPath( aFileName, aFileURL 
) != osl::FileBase::E_None )
-throw uno::RuntimeException();
+uno::Reference< embed::XEmbeddedObjectCreator > xEmbCreator = 
embed::EmbeddedObjectCreator::create( 
comphelper::getComponentContext(m_xFactory) );
+
+uno::Sequence< sal_Int8 > aClassID = 
MimeConfigurationHelper::GetSequenceClassID( io.clsid.Data1,
+   
   io.clsid.Data2,
+   
   io.clsid.Data3,
+   
   io.clsid.Data4[0],
+   
   io.clsid.Data4[1],
+ 

[Libreoffice-commits] core.git: embeddedobj/source

2017-09-30 Thread Stephan Bergmann
 embeddedobj/source/msole/oleembed.cxx   |   31 ++-
 embeddedobj/source/msole/olepersist.cxx |   16 
 2 files changed, 22 insertions(+), 25 deletions(-)

New commits:
commit d2978f03bd57e5fe530eb55accc8c5f39b602ff2
Author: Stephan Bergmann 
Date:   Sat Sep 30 22:43:59 2017 +0200

loplugin:flatten (clang-cl, embeddedobj)

Change-Id: I842ab53693f87fc9b5151ce9b8b385a9dbd53e11
Reviewed-on: https://gerrit.libreoffice.org/42977
Tested-by: Jenkins 
Reviewed-by: Stephan Bergmann 

diff --git a/embeddedobj/source/msole/oleembed.cxx 
b/embeddedobj/source/msole/oleembed.cxx
index e8139480b39d..43dcfa865662 100644
--- a/embeddedobj/source/msole/oleembed.cxx
+++ b/embeddedobj/source/msole/oleembed.cxx
@@ -63,26 +63,23 @@ using namespace ::com::sun::star;
 
 void OleEmbeddedObject::SwitchComponentToRunningState_Impl()
 {
-if ( m_pOleComponent )
+if ( !m_pOleComponent )
 {
-try
-{
-m_pOleComponent->RunObject();
-}
-catch( const embed::UnreachableStateException& )
-{
-GetRidOfComponent();
-throw;
-}
-catch( const embed::WrongStateException& )
-{
-GetRidOfComponent();
-throw;
-}
+throw embed::UnreachableStateException();
 }
-else
+try
 {
-throw embed::UnreachableStateException();
+m_pOleComponent->RunObject();
+}
+catch( const embed::UnreachableStateException& )
+{
+GetRidOfComponent();
+throw;
+}
+catch( const embed::WrongStateException& )
+{
+GetRidOfComponent();
+throw;
 }
 }
 
diff --git a/embeddedobj/source/msole/olepersist.cxx 
b/embeddedobj/source/msole/olepersist.cxx
index b8a42b373bc2..92a493ed59b2 100644
--- a/embeddedobj/source/msole/olepersist.cxx
+++ b/embeddedobj/source/msole/olepersist.cxx
@@ -1013,16 +1013,16 @@ void OleEmbeddedObject::StoreObjectToStream( 
uno::Reference< io::XOutputStream >
 
 // TODO: use bStoreVisReplace
 
-if ( xTempInStream.is() )
+if ( !xTempInStream.is() )
 {
-// write all the contents to XOutStream
-uno::Reference< io::XTruncate > xTrunc( xOutStream, 
uno::UNO_QUERY_THROW );
-xTrunc->truncate();
-
-::comphelper::OStorageHelper::CopyInputToOutput( xTempInStream, 
xOutStream );
-}
-else
 throw io::IOException(); // TODO:
+}
+
+// write all the contents to XOutStream
+uno::Reference< io::XTruncate > xTrunc( xOutStream, uno::UNO_QUERY_THROW );
+xTrunc->truncate();
+
+::comphelper::OStorageHelper::CopyInputToOutput( xTempInStream, xOutStream 
);
 
 // TODO: should the view replacement be in the stream ???
 //   probably it must be specified on storing
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: embeddedobj/source libreofficekit/qa sw/source vcl/source xmloff/source xmlsecurity/source

2017-07-18 Thread Andrea Gelmini
 embeddedobj/source/msole/olepersist.cxx |2 +-
 libreofficekit/qa/gtktiledviewer/gtv-application-window.cxx |2 +-
 sw/source/filter/html/htmltab.cxx   |2 +-
 vcl/source/gdi/impgraph.cxx |2 +-
 xmloff/source/forms/propertyimport.cxx  |2 +-
 xmlsecurity/source/component/documentdigitalsignatures.cxx  |2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)

New commits:
commit e56596e009c11ec6118a126ac560e87d754ae15b
Author: Andrea Gelmini 
Date:   Tue Jul 18 10:00:15 2017 +0200

Fix typos

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

diff --git a/embeddedobj/source/msole/olepersist.cxx 
b/embeddedobj/source/msole/olepersist.cxx
index 3e1f39e7e722..35ddeb1b9be6 100644
--- a/embeddedobj/source/msole/olepersist.cxx
+++ b/embeddedobj/source/msole/olepersist.cxx
@@ -1838,7 +1838,7 @@ void SAL_CALL OleEmbeddedObject::reload(
 // TODO:
 // throw away current document
 // load new document from current storage
-// use meaningfull part of lArguments
+// use meaningful part of lArguments
 }
 
 
diff --git a/libreofficekit/qa/gtktiledviewer/gtv-application-window.cxx 
b/libreofficekit/qa/gtktiledviewer/gtv-application-window.cxx
index 6863c65e3f32..dae6821600e7 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-application-window.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-application-window.cxx
@@ -85,7 +85,7 @@ gtv_application_window_init(GtvApplicationWindow* win)
 win->columnbar = gtv_calc_header_bar_new();
 
gtv_calc_header_bar_set_type_and_width(GTV_CALC_HEADER_BAR(win->columnbar), 
CalcHeaderType::COLUMN);
 
-// attach row/colum/corner to the container
+// attach row/column/corner to the container
 gtk_grid_attach(GTK_GRID(priv->gridcontainer), win->cornerarea, 0, 0, 1, 
1);
 gtk_grid_attach(GTK_GRID(priv->gridcontainer), win->rowbar, 0, 1, 1, 1);
 gtk_grid_attach(GTK_GRID(priv->gridcontainer), win->columnbar, 1, 0, 1, 1);
diff --git a/sw/source/filter/html/htmltab.cxx 
b/sw/source/filter/html/htmltab.cxx
index 78266380d0fd..6fd697426cb4 100644
--- a/sw/source/filter/html/htmltab.cxx
+++ b/sw/source/filter/html/htmltab.cxx
@@ -1992,7 +1992,7 @@ void HTMLTable::InsertCell( HTMLTableCnts *pCnts,
 sal_uInt16 nRowsReq = m_nCurrentRow + nRowSpan;
 sal_uInt16 i, j;
 
-// if we need more colums than we currently have, we need to add cells for 
all rows
+// if we need more columns than we currently have, we need to add cells 
for all rows
 if( m_nCols < nColsReq )
 {
 for( i=m_nCols; igetCertificate( 

[Libreoffice-commits] core.git: embeddedobj/source

2017-07-18 Thread Szymon Kłos
 embeddedobj/source/general/docholder.cxx |7 +--
 embeddedobj/source/general/intercept.cxx |2 +-
 embeddedobj/source/inc/docholder.hxx |7 ++-
 3 files changed, 12 insertions(+), 4 deletions(-)

New commits:
commit 00b506ff03708e30daa7c2f3df89bb5c06a9cdde
Author: Szymon Kłos 
Date:   Mon Jul 17 19:45:16 2017 +0200

Embedded documents: show title in menu entries

Change-Id: I478d81798e6f1e2d96e570cb6788a438c6a0be62
Reviewed-on: https://gerrit.libreoffice.org/40079
Tested-by: Jenkins 
Reviewed-by: Szymon Kłos 

diff --git a/embeddedobj/source/general/docholder.cxx 
b/embeddedobj/source/general/docholder.cxx
index 13fb5335d4d1..f85414f7c43b 100644
--- a/embeddedobj/source/general/docholder.cxx
+++ b/embeddedobj/source/general/docholder.cxx
@@ -973,8 +973,11 @@ bool DocumentHolder::LoadDocToFrame( bool bInPlace )
 {
 LanguageTag aLocale( 
Application::GetSettings().GetUILanguageTag() );
 ResMgr* pResMgr = ResMgr::SearchCreateResMgr( "sfx", aLocale );
-OUString nTitle = ResId( STR_EMBEDDED_TITLE, *pResMgr );
-xModelTitle->setTitle( m_pEmbedObj->getContainerName() + 
nTitle );
+OUString sEmbedded = ResId( STR_EMBEDDED_TITLE, *pResMgr );
+xModelTitle->setTitle( m_pEmbedObj->getContainerName() + 
sEmbedded);
+m_aContainerName = m_pEmbedObj->getContainerName();
+// TODO: get real m_aDocumentNamePart
+m_aDocumentNamePart = sEmbedded;
 }
 
 if ( bInPlace )
diff --git a/embeddedobj/source/general/intercept.cxx 
b/embeddedobj/source/general/intercept.cxx
index 1a8cce8212c0..4aeb9d1ab560 100644
--- a/embeddedobj/source/general/intercept.cxx
+++ b/embeddedobj/source/general/intercept.cxx
@@ -155,7 +155,7 @@ Interceptor::addStatusListener(
 aStateEvent.FeatureDescriptor = "Close and Return";
 aStateEvent.IsEnabled = true;
 aStateEvent.Requery = false;
-aStateEvent.State <<= ( "($2) " + m_pDocHolder->GetTitle() );
+aStateEvent.State <<= ( "($2)" + m_pDocHolder->GetContainerName() );
 Control->statusChanged(aStateEvent);
 
 
diff --git a/embeddedobj/source/inc/docholder.hxx 
b/embeddedobj/source/inc/docholder.hxx
index efbb664c6659..410b9f73161e 100644
--- a/embeddedobj/source/inc/docholder.hxx
+++ b/embeddedobj/source/inc/docholder.hxx
@@ -128,7 +128,12 @@ public:
 
 OUString GetTitle() const
 {
-return m_aContainerName + " - " + m_aDocumentNamePart;
+return m_aContainerName + ( m_aDocumentNamePart.isEmpty() ? OUString() 
: ( " - " + m_aDocumentNamePart ) );
+}
+
+OUString GetContainerName() const
+{
+return m_aContainerName;
 }
 
 void SetOutplaceFrameProperties( const css::uno::Sequence< css::uno::Any 
>& aProps )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: embeddedobj/source

2017-07-17 Thread Szymon Kłos
 embeddedobj/source/general/docholder.cxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit e16304c46fddfb73e4aef85333d881ba5350b58d
Author: Szymon Kłos 
Date:   Mon Jul 17 14:52:28 2017 +0200

Embedded obj: resize to avoid rendering issue

Force resize, before sidebar wasn't rendered correctly.

Change-Id: I0aeec50751a165bf4ab1aeefeda079ff97feb990
Reviewed-on: https://gerrit.libreoffice.org/40065
Tested-by: Jenkins 
Reviewed-by: Szymon Kłos 

diff --git a/embeddedobj/source/general/docholder.cxx 
b/embeddedobj/source/general/docholder.cxx
index affd65fc1231..13fb5335d4d1 100644
--- a/embeddedobj/source/general/docholder.cxx
+++ b/embeddedobj/source/general/docholder.cxx
@@ -868,7 +868,6 @@ uno::Reference< frame::XFrame > const & 
DocumentHolder::GetDocFrame()
 
 // TODO/LATER: get it for the real aspect
 awt::Size aSize;
-GetExtent( embed::Aspects::MSOLE_CONTENT,  );
 LoadDocToFrame(false);
 
 if ( xOwnLM.is() )
@@ -877,6 +876,9 @@ uno::Reference< frame::XFrame > const & 
DocumentHolder::GetDocFrame()
 xOwnLM->lock();
 }
 
+GetExtent(embed::Aspects::MSOLE_CONTENT, );
+SetExtent(embed::Aspects::MSOLE_CONTENT, aSize);
+
 if ( xOwnLM.is() )
 xOwnLM->unlock();
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: embeddedobj/source

2017-07-17 Thread Stephan Bergmann
 embeddedobj/source/msole/xdialogcreator.cxx |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

New commits:
commit ddbf256f8ae8f3bcd02b01719c163602b17205fd
Author: Stephan Bergmann 
Date:   Mon Jul 17 17:20:15 2017 +0200

loplugin:oncevar: embeddedobj (clang-cl)

Change-Id: I22797d4e914e6033142628d1b37abab6c1901423

diff --git a/embeddedobj/source/msole/xdialogcreator.cxx 
b/embeddedobj/source/msole/xdialogcreator.cxx
index 0954f73672f4..b2d564be8dd6 100644
--- a/embeddedobj/source/msole/xdialogcreator.cxx
+++ b/embeddedobj/source/msole/xdialogcreator.cxx
@@ -197,8 +197,7 @@ embed::InsertedObjectInfo SAL_CALL 
MSOLEDialogObjectCreator::createInstanceByDia
 aClassID = GetRelatedInternalID_Impl( aClassID );
 
 //TODO: retrieve ClassName
-OUString aClassName;
-aObjectInfo.Object.set( xEmbCreator->createInstanceInitNew( 
aClassID, aClassName, xStorage, sEntName, aObjArgs ),
+aObjectInfo.Object.set( xEmbCreator->createInstanceInitNew( 
aClassID, OUString(), xStorage, sEntName, aObjArgs ),
 uno::UNO_QUERY );
 }
 else
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: embeddedobj/source

2017-07-14 Thread Szymon Kłos
 embeddedobj/source/general/docholder.cxx |2 --
 1 file changed, 2 deletions(-)

New commits:
commit f9d5877f41b54882a7f364f33b314cbaeb3b44c0
Author: Szymon Kłos 
Date:   Fri Jul 14 16:11:40 2017 +0200

Embedded obj: don't change new window size

Change-Id: Idc5e1e26fa1a98c6f96a1f0f15b6e5c3c9398402
Reviewed-on: https://gerrit.libreoffice.org/39957
Tested-by: Jenkins 
Reviewed-by: Szymon Kłos 

diff --git a/embeddedobj/source/general/docholder.cxx 
b/embeddedobj/source/general/docholder.cxx
index 60ac61682ae1..affd65fc1231 100644
--- a/embeddedobj/source/general/docholder.cxx
+++ b/embeddedobj/source/general/docholder.cxx
@@ -877,8 +877,6 @@ uno::Reference< frame::XFrame > const & 
DocumentHolder::GetDocFrame()
 xOwnLM->lock();
 }
 
-SetExtent( embed::Aspects::MSOLE_CONTENT, aSize );
-
 if ( xOwnLM.is() )
 xOwnLM->unlock();
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-07-13 Thread Szymon Kłos
 embeddedobj/source/msole/oleembed.cxx |6 +++---
 sw/source/core/unocore/unoframe.cxx   |   23 ++-
 2 files changed, 25 insertions(+), 4 deletions(-)

New commits:
commit d15d3d92a7297a57fafd9ed11c959bb8ec322b3a
Author: Szymon Kłos 
Date:   Wed Jul 12 12:17:03 2017 +0200

tdf#108545 editable DOC/XLS embeddings inside DOCX

Change-Id: Ia6cbe829f94b3f27e4ea633c02d6b1ec6e98e984
Reviewed-on: https://gerrit.libreoffice.org/39860
Tested-by: Jenkins 
Reviewed-by: Szymon Kłos 

diff --git a/embeddedobj/source/msole/oleembed.cxx 
b/embeddedobj/source/msole/oleembed.cxx
index 182d0a459548..b00cea109890 100644
--- a/embeddedobj/source/msole/oleembed.cxx
+++ b/embeddedobj/source/msole/oleembed.cxx
@@ -268,9 +268,9 @@ bool OleEmbeddedObject::TryToConvertToOOo( const 
uno::Reference< io::XStream >&
 xSeekable->seek( 0 );
 m_aFilterName = OwnView_Impl::GetFilterNameFromExtentionAndInStream( 
m_xFactory, OUString(), xStream->getInputStream() );
 
-// use the solution only for OOXML format currently
 if ( !m_aFilterName.isEmpty()
-  && ( m_aFilterName == "Calc MS Excel 2007 XML" || m_aFilterName == 
"Impress MS PowerPoint 2007 XML" || m_aFilterName == "MS Word 2007 XML" ) )
+  && ( m_aFilterName == "Calc MS Excel 2007 XML" || m_aFilterName == 
"Impress MS PowerPoint 2007 XML" || m_aFilterName == "MS Word 2007 XML"
+  || m_aFilterName == "MS Excel 97 Vorlage/Template" || 
m_aFilterName == "MS Word 97 Vorlage" ) )
 {
 uno::Reference< container::XNameAccess > xFilterFactory(
 
m_xFactory->createInstance("com.sun.star.document.FilterFactory"),
@@ -913,7 +913,7 @@ void SAL_CALL OleEmbeddedObject::doVerb( sal_Int32 nVerbID )
 m_bTriedConversion = true;
 if ( TryToConvertToOOo( m_xObjectStream ) )
 {
-changeState( embed::EmbedStates::UI_ACTIVE );
+changeState( embed::EmbedStates::ACTIVE );
 return;
 }
 }
diff --git a/sw/source/core/unocore/unoframe.cxx 
b/sw/source/core/unocore/unoframe.cxx
index e666726b06dc..162f9f7102be 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -2986,7 +2986,28 @@ void SwXFrame::attachToRange(const uno::Reference< 
text::XTextRange > & xTextRan
 pDoc->GetIDocumentUndoRedo().StartUndo(SwUndoId::INSERT, 
nullptr);
 
 SwFlyFrameFormat* pFrameFormat = nullptr;
-pFrameFormat = 
pDoc->getIDocumentContentOperations().InsertOLE( aPam, sStreamName, 
embed::Aspects::MSOLE_CONTENT, , nullptr );
+pFrameFormat = 
pDoc->getIDocumentContentOperations().InsertOLE( aPam, sStreamName, 
m_nDrawAspect, , nullptr );
+
+// store main document name to show in the title bar
+SwOLENode* pNd = nullptr;
+const SwNodeIndex* pIdx = 
pFrameFormat->GetContent().GetContentIdx();
+if( pIdx )
+{
+SwNodeIndex aIdx( *pIdx, 1 );
+SwNoTextNode* pNoText = aIdx.GetNode().GetNoTextNode();
+pNd = pNoText->GetOLENode();
+}
+if( pNd )
+{
+uno::Reference < embed::XEmbeddedObject > xObj = 
pNd->GetOLEObj().GetOleRef();
+if( xObj.is() )
+{
+uno::Reference< frame::XTitle > xModelTitle( 
pDoc->GetDocShell()->GetModel(), css::uno::UNO_QUERY );
+if( xModelTitle.is() )
+xObj->setContainerName( xModelTitle->getTitle() );
+}
+}
+
 pDoc->GetIDocumentUndoRedo().EndUndo(SwUndoId::INSERT, 
nullptr);
 pFrameFormat->Add(this);
 if(!m_sName.isEmpty())
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: embeddedobj/source

2017-07-13 Thread Szymon Kłos
 embeddedobj/source/msole/olecomponent.cxx |7 ++-
 embeddedobj/source/msole/oleembed.cxx |1 +
 2 files changed, 3 insertions(+), 5 deletions(-)

New commits:
commit a307ad7ae029a0a62404996a63954e7026001ce3
Author: Szymon Kłos 
Date:   Fri Jul 7 19:15:11 2017 +0200

OLE: show title of parent document in MSO

Change-Id: I5eee6568e0805eb0c609640923a77ebc4244cb12
Reviewed-on: https://gerrit.libreoffice.org/39859
Tested-by: Jenkins 
Reviewed-by: Szymon Kłos 

diff --git a/embeddedobj/source/msole/olecomponent.cxx 
b/embeddedobj/source/msole/olecomponent.cxx
index 8c2dd853adfd..26a5d350e6ea 100644
--- a/embeddedobj/source/msole/olecomponent.cxx
+++ b/embeddedobj/source/msole/olecomponent.cxx
@@ -1067,19 +1067,16 @@ void OleComponent::ExecuteVerb( sal_Int32 nVerbID )
 
 if ( FAILED( hr ) )
 throw io::IOException(); // TODO
-
-// TODO/LATER: the real names should be used here
-m_pNativeImpl->m_pOleObject->SetHostNames( L"app name", L"untitled" );
 }
 
 
 void OleComponent::SetHostName( const OUString&,
-const OUString& )
+const OUString& aEmbDocName )
 {
 if ( !m_pNativeImpl->m_pOleObject )
 throw embed::WrongStateException(); // TODO: the object is in wrong 
state
 
-// TODO: use aContName and aEmbDocName in 
m_pNativeImpl->m_pOleObject->SetHostNames()
+m_pNativeImpl->m_pOleObject->SetHostNames( L"app name", 
reinterpret_cast( aEmbDocName.getStr() ) );
 }
 
 
diff --git a/embeddedobj/source/msole/oleembed.cxx 
b/embeddedobj/source/msole/oleembed.cxx
index 2a075c8da812..182d0a459548 100644
--- a/embeddedobj/source/msole/oleembed.cxx
+++ b/embeddedobj/source/msole/oleembed.cxx
@@ -877,6 +877,7 @@ void SAL_CALL OleEmbeddedObject::doVerb( sal_Int32 nVerbID )
 
 
 m_pOleComponent->ExecuteVerb( nVerbID );
+m_pOleComponent->SetHostName( OUString(), m_aContainerName );
 
 //  the STAMPIT related solution =
 bool bModifiedOnExecution = 
m_aVerbExecutionController.EndControlExecution_WasModified();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: embeddedobj/source

2017-07-13 Thread Szymon Kłos
 embeddedobj/source/inc/oleembobj.hxx  |2 -
 embeddedobj/source/msole/oleembed.cxx |   65 --
 2 files changed, 48 insertions(+), 19 deletions(-)

New commits:
commit 427c763a1ad0ebc85383625f019b405c30828374
Author: Szymon Kłos 
Date:   Mon Jul 10 18:47:49 2017 +0200

tdf#108545 tdf#108544: DOCX, XLSX embedded in DOC

When on Windows the MSO wasn't installed DOCX and XLSX
embedded documents weren't accessible. General OLE error
was shown after doubleclick on the object.

Linux solution is reused, OLE storage is extracted to
get the document inside.

Change-Id: If4d00fddad8e127fcf1a222836896d2907549d0c
Reviewed-on: https://gerrit.libreoffice.org/39814
Tested-by: Jenkins 
Reviewed-by: Miklos Vajna 

diff --git a/embeddedobj/source/inc/oleembobj.hxx 
b/embeddedobj/source/inc/oleembobj.hxx
index 2beb08e242fc..5df00c5e0a16 100644
--- a/embeddedobj/source/inc/oleembobj.hxx
+++ b/embeddedobj/source/inc/oleembobj.hxx
@@ -279,7 +279,7 @@ protected:
 void MoveListeners();
 css::uno::Reference< css::embed::XStorage > CreateTemporarySubstorage( 
OUString& o_aStorageName );
 OUString MoveToTemporarySubstream();
-bool TryToConvertToOOo();
+bool TryToConvertToOOo( const css::uno::Reference< css::io::XStream >& 
xStream );
 
 public:
 // in case a new object must be created the class ID must be specified
diff --git a/embeddedobj/source/msole/oleembed.cxx 
b/embeddedobj/source/msole/oleembed.cxx
index f8c2c9903a73..c3acbb687e8b 100644
--- a/embeddedobj/source/msole/oleembed.cxx
+++ b/embeddedobj/source/msole/oleembed.cxx
@@ -248,7 +248,7 @@ OUString OleEmbeddedObject::MoveToTemporarySubstream()
 }
 
 
-bool OleEmbeddedObject::TryToConvertToOOo()
+bool OleEmbeddedObject::TryToConvertToOOo( const uno::Reference< io::XStream 
>& xStream )
 {
 bool bResult = false;
 
@@ -264,9 +264,9 @@ bool OleEmbeddedObject::TryToConvertToOOo()
 changeState( embed::EmbedStates::LOADED );
 
 // the stream must be seekable
-uno::Reference< io::XSeekable > xSeekable( m_xObjectStream, 
uno::UNO_QUERY_THROW );
+uno::Reference< io::XSeekable > xSeekable( xStream, 
uno::UNO_QUERY_THROW );
 xSeekable->seek( 0 );
-m_aFilterName = OwnView_Impl::GetFilterNameFromExtentionAndInStream( 
m_xFactory, OUString(), m_xObjectStream->getInputStream() );
+m_aFilterName = OwnView_Impl::GetFilterNameFromExtentionAndInStream( 
m_xFactory, OUString(), xStream->getInputStream() );
 
 // use the solution only for OOXML format currently
 if ( !m_aFilterName.isEmpty()
@@ -314,7 +314,7 @@ bool OleEmbeddedObject::TryToConvertToOOo()
 aArgs[3].Name = "URL";
 aArgs[3].Value <<= OUString( "private:stream" );
 aArgs[4].Name = "InputStream";
-aArgs[4].Value <<= m_xObjectStream->getInputStream();
+aArgs[4].Value <<= xStream->getInputStream();
 
 xSeekable->seek( 0 );
 xLoadable->load( aArgs );
@@ -657,7 +657,6 @@ sal_Int32 SAL_CALL OleEmbeddedObject::getCurrentState()
 
 namespace
 {
-#ifndef _WIN32
 bool lcl_CopyStream(const uno::Reference& xIn, const 
uno::Reference& xOut, sal_Int32 nMaxCopy = SAL_MAX_INT32)
 {
 if (nMaxCopy == 0)
@@ -679,18 +678,11 @@ namespace
 } while (nRead == nChunkSize && nTotalRead <= nMaxCopy);
 return nTotalRead != 0;
 }
-#endif
 
-//Dump the objects content to a tempfile, just the "CONTENTS" stream if
-//there is one for non-compound documents, otherwise the whole content.
-//On success a file is returned which must be removed by the caller
-OUString lcl_ExtractObject(const css::uno::Reference< 
css::lang::XMultiServiceFactory >& xFactory,
-const css::uno::Reference< css::io::XStream >& xObjectStream)
+uno::Reference < io::XStream > lcl_GetExtractedStream( OUString& rUrl,
+const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory,
+const css::uno::Reference< css::io::XStream >& xObjectStream )
 {
-OUString sUrl;
-
-// the solution is only active for Unix systems
-#ifndef _WIN32
 uno::Reference  xNativeTempFile(
 io::TempFile::create(comphelper::getComponentContext(xFactory)),
 uno::UNO_QUERY_THROW);
@@ -789,26 +781,48 @@ namespace
 xNativeTempFile->setPropertyValue("RemoveFile",
 uno::makeAny(false));
 uno::Any aUrl = xNativeTempFile->getPropertyValue("Uri");
-aUrl >>= sUrl;
+aUrl >>= rUrl;
 
 xNativeTempFile.clear();
 
 uno::Reference < ucb::XSimpleFileAccess3 > xSimpleFileAccess(
 ucb::SimpleFileAccess::create( 
comphelper::getComponentContext(xFactory) ) );
 
-xSimpleFileAccess->setReadOnly(sUrl, true);
+

[Libreoffice-commits] core.git: embeddedobj/source

2017-06-26 Thread Caolán McNamara
 embeddedobj/source/commonembedding/visobj.cxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 59d93d41537fa806219d705a6d06ed26bf09f2f3
Author: Caolán McNamara 
Date:   Mon Jun 26 14:35:24 2017 +0100

Resolves: tdf#108643 don't restore orig size on first chart activate

Change-Id: Ibe51eb81ea1b0874fc1a9018871f07c9af38e8d2
Reviewed-on: https://gerrit.libreoffice.org/39268
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/embeddedobj/source/commonembedding/visobj.cxx 
b/embeddedobj/source/commonembedding/visobj.cxx
index de4d61700f05..7ed1bdcc029e 100644
--- a/embeddedobj/source/commonembedding/visobj.cxx
+++ b/embeddedobj/source/commonembedding/visobj.cxx
@@ -165,7 +165,9 @@ embed::VisualRepresentation SAL_CALL 
OCommonEmbeddedObject::getPreferredVisualRe
 // themselves to a default size OLESIZE
 awt::Size aOrigSize = getVisualAreaSize(nAspect);
 changeState(embed::EmbedStates::RUNNING);
-if (aOrigSize != getVisualAreaSize(nAspect))
+const bool bIsChart = GetDocumentServiceName() == 
"com.sun.star.chart2.ChartDocument";
+// tdf#108643 unless its a chart, cause those are weird (#i103460#)
+if (!bIsChart && aOrigSize != getVisualAreaSize(nAspect))
 setVisualAreaSize(nAspect, aOrigSize);
 
 // the links should be switched back to loaded state for now to avoid 
locking problems
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: embeddedobj/source

2017-05-09 Thread Caolán McNamara
 embeddedobj/source/msole/oleembed.cxx |   32 +---
 1 file changed, 17 insertions(+), 15 deletions(-)

New commits:
commit 013e34d875aeb75d9660af7c18967c2d468cbd74
Author: Caolán McNamara 
Date:   Tue May 9 09:32:45 2017 +0100

Related: tdf#62702 also try various other known streams for object content

Change-Id: I5b5fa61e9930ba0eaa5ac86e4231050c9ebebf8a

diff --git a/embeddedobj/source/msole/oleembed.cxx 
b/embeddedobj/source/msole/oleembed.cxx
index fd9bb68ecc1c..8dd202d16ea1 100644
--- a/embeddedobj/source/msole/oleembed.cxx
+++ b/embeddedobj/source/msole/oleembed.cxx
@@ -704,29 +704,31 @@ namespace
 "com.sun.star.embed.OLESimpleStorage",
 aArgs ), uno::UNO_QUERY_THROW );
 
-uno::Reference< io::XStream > xCONTENTS;
-try
+//various stream names that can contain the real document contents for
+//this object in a straightforward direct way
+const OUStringLiteral aStreamNames[] =
 {
-xNameContainer->getByName("CONTENTS") >>= xCONTENTS;
-}
-catch (container::NoSuchElementException const&)
+"CONTENTS",
+"Package",
+"EmbeddedOdf",
+"WordDocument",
+"Workbook",
+"PowerPoint Document"
+};
+
+bool bCopied = false;
+for (size_t i = 0; i < SAL_N_ELEMENTS(aStreamNames) && !bCopied; ++i)
 {
-// ignore
-}
-
-bool bCopied = xCONTENTS.is() && 
lcl_CopyStream(xCONTENTS->getInputStream(), xStream->getOutputStream());
-if (!bCopied)
-{
-uno::Reference< io::XStream > xEmbeddedOdf;
+uno::Reference xEmbeddedFile;
 try
 {
-xNameContainer->getByName("EmbeddedOdf") >>= xEmbeddedOdf;
+xNameContainer->getByName(aStreamNames[i]) >>= xEmbeddedFile;
 }
-catch (container::NoSuchElementException const&)
+catch (const container::NoSuchElementException&)
 {
 // ignore
 }
-bCopied = xEmbeddedOdf.is() && 
lcl_CopyStream(xEmbeddedOdf->getInputStream(), xStream->getOutputStream());
+bCopied = xEmbeddedFile.is() && 
lcl_CopyStream(xEmbeddedFile->getInputStream(), xStream->getOutputStream());
 }
 
 if (!bCopied)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: embeddedobj/source

2017-05-09 Thread Caolán McNamara
 embeddedobj/source/msole/oleembed.cxx |   13 +
 1 file changed, 13 insertions(+)

New commits:
commit 8db9cfd2973b3e6f0c682fe8961540d528e6d493
Author: Caolán McNamara 
Date:   Tue May 9 09:24:11 2017 +0100

Related: tdf#62702 handle EmbeddedOdf like CONTENTS on ole activate attempt

Change-Id: I11f1d6ad049cada1cadfe97a440b7ae562ba4ced

diff --git a/embeddedobj/source/msole/oleembed.cxx 
b/embeddedobj/source/msole/oleembed.cxx
index e5bd8646aac9..fd9bb68ecc1c 100644
--- a/embeddedobj/source/msole/oleembed.cxx
+++ b/embeddedobj/source/msole/oleembed.cxx
@@ -715,6 +715,19 @@ namespace
 }
 
 bool bCopied = xCONTENTS.is() && 
lcl_CopyStream(xCONTENTS->getInputStream(), xStream->getOutputStream());
+if (!bCopied)
+{
+uno::Reference< io::XStream > xEmbeddedOdf;
+try
+{
+xNameContainer->getByName("EmbeddedOdf") >>= xEmbeddedOdf;
+}
+catch (container::NoSuchElementException const&)
+{
+// ignore
+}
+bCopied = xEmbeddedOdf.is() && 
lcl_CopyStream(xEmbeddedOdf->getInputStream(), xStream->getOutputStream());
+}
 
 if (!bCopied)
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: embeddedobj/source

2017-02-13 Thread Stephan Bergmann
 embeddedobj/source/commonembedding/persistence.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit ea5fffddcfc6d8741c5492b227daddae1874f100
Author: Stephan Bergmann 
Date:   Mon Feb 13 22:13:42 2017 +0100

Remove misguided comment

...introduced with 7757a18cfd77996f4ce8aef2cbb8c70425ae92da "INTEGRATION: 
CWS
oj14", but for one !xDoc.is() is explicitly handled below, and for another
xLoadable is only used if !xDoc.is().  So the requirement is apparently 
that not
both are null, indeed.

Change-Id: I1b59e99c86c88c5266b33e9ff782054fa40dd34d

diff --git a/embeddedobj/source/commonembedding/persistence.cxx 
b/embeddedobj/source/commonembedding/persistence.cxx
index 6acde54..26faa84 100644
--- a/embeddedobj/source/commonembedding/persistence.cxx
+++ b/embeddedobj/source/commonembedding/persistence.cxx
@@ -498,7 +498,7 @@ uno::Reference< util::XCloseable > 
OCommonEmbeddedObject::LoadDocumentFromStorag
 
 uno::Reference< frame::XLoadable > xLoadable( xDocument, uno::UNO_QUERY );
 uno::Reference< document::XStorageBasedDocument > xDoc( xDocument, 
uno::UNO_QUERY );
-if ( !xDoc.is() && !xLoadable.is() ) ///BUG: This should be || instead of 
&& ?
+if ( !xDoc.is() && !xLoadable.is() )
 throw uno::RuntimeException();
 
 ::comphelper::NamedValueCollection aLoadArgs;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: embeddedobj/source

2017-01-23 Thread Caolán McNamara
 embeddedobj/source/msole/oleembed.cxx |   10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

New commits:
commit da55a0e5158e14c3743b186d3b1d4022a278e4d5
Author: Caolán McNamara 
Date:   Mon Jan 23 10:50:10 2017 +

Ole10Native payload truncated

Change-Id: If2c0c2788e54eb01a1b6998c81df016061a0ad6b

diff --git a/embeddedobj/source/msole/oleembed.cxx 
b/embeddedobj/source/msole/oleembed.cxx
index 2f8d3fa..a28786f 100644
--- a/embeddedobj/source/msole/oleembed.cxx
+++ b/embeddedobj/source/msole/oleembed.cxx
@@ -759,11 +759,11 @@ namespace
 } while (nRead == 1 && aData[0] != 0);  // Actual string 
representing the file path
 uno::Sequence< sal_Int8 > aLenData(4);
 xIn->readBytes(aLenData, 4); //len of attachment
-sal_uInt32 nLen = static_cast
-  ((sal_uInt32)aLenData[0]
-+ ((sal_uInt32)aLenData[1] <<  8)
-+ ((sal_uInt32)aLenData[2] << 16)
-+ ((sal_uInt32)aLenData[3] << 24));
+sal_uInt32 nLen = static_cast(
+  (aLenData[0] & 0xFF) |
+  ((aLenData[1] & 0xFF) <<  8) |
+  ((aLenData[2] & 0xFF) << 16) |
+  ((aLenData[3] & 0xFF) << 24));
 
 bCopied = lcl_CopyStream(xIn, xStream->getOutputStream(), 
nLen);
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: embeddedobj/source

2017-01-19 Thread Noel Grandin
 embeddedobj/source/msole/olemisc.cxx |1 -
 1 file changed, 1 deletion(-)

New commits:
commit 5e58ea581e330680ce0a6695b86fd909d7b5fcb0
Author: Noel Grandin 
Date:   Thu Jan 19 13:32:41 2017 +0200

fix windows build

Change-Id: I69da07e0e12d9bd03534b60a2ecd9a6c0cc61239

diff --git a/embeddedobj/source/msole/olemisc.cxx 
b/embeddedobj/source/msole/olemisc.cxx
index c8288b3..a6d9a1a 100644
--- a/embeddedobj/source/msole/olemisc.cxx
+++ b/embeddedobj/source/msole/olemisc.cxx
@@ -128,7 +128,6 @@ OleEmbeddedObject::OleEmbeddedObject( const uno::Reference< 
lang::XMultiServiceF
 , m_bGotStatus( false )
 , m_nStatus( 0 )
 , m_nStatusAspect( 0 )
-, m_pOwnView( nullptr )
 , m_bFromClipboard( true )
 , m_bTriedConversion( false )
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: embeddedobj/source

2017-01-16 Thread Noel Grandin
 embeddedobj/source/general/intercept.cxx |   10 +++---
 embeddedobj/source/inc/intercept.hxx |3 ++-
 2 files changed, 5 insertions(+), 8 deletions(-)

New commits:
commit 53f21cde330de4f0ad054a106e7a15654d79b7ee
Author: Noel Grandin 
Date:   Mon Jan 16 09:57:51 2017 +0200

new loplugin: useuniqueptr: embeddedobj

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

diff --git a/embeddedobj/source/general/intercept.cxx 
b/embeddedobj/source/general/intercept.cxx
index 96e3595..982ae51 100644
--- a/embeddedobj/source/general/intercept.cxx
+++ b/embeddedobj/source/general/intercept.cxx
@@ -61,7 +61,6 @@ Interceptor::Interceptor( DocumentHolder* pDocHolder )
 
 Interceptor::~Interceptor()
 {
-delete m_pStatCL;
 }
 
 //XDispatch
@@ -143,8 +142,7 @@ Interceptor::addStatusListener(
 {
 osl::MutexGuard aGuard(m_aMutex);
 if(!m_pStatCL)
-m_pStatCL =
-new StatusChangeListenerContainer(m_aMutex);
+m_pStatCL.reset(new StatusChangeListenerContainer(m_aMutex));
 }
 
 m_pStatCL->addInterface(URL.Complete,Control);
@@ -168,8 +166,7 @@ Interceptor::addStatusListener(
 {
 osl::MutexGuard aGuard(m_aMutex);
 if(!m_pStatCL)
-m_pStatCL =
-new StatusChangeListenerContainer(m_aMutex);
+m_pStatCL.reset(new StatusChangeListenerContainer(m_aMutex));
 }
 
 m_pStatCL->addInterface(URL.Complete,Control);
@@ -189,8 +186,7 @@ Interceptor::addStatusListener(
 {
 osl::MutexGuard aGuard(m_aMutex);
 if(!m_pStatCL)
-m_pStatCL =
-new StatusChangeListenerContainer(m_aMutex);
+m_pStatCL.reset(new StatusChangeListenerContainer(m_aMutex));
 }
 
 m_pStatCL->addInterface(URL.Complete,Control);
diff --git a/embeddedobj/source/inc/intercept.hxx 
b/embeddedobj/source/inc/intercept.hxx
index 35ad43f..0eee717 100644
--- a/embeddedobj/source/inc/intercept.hxx
+++ b/embeddedobj/source/inc/intercept.hxx
@@ -26,6 +26,7 @@
 #include 
 #include 
 #include 
+#include 
 
 
 class StatusChangeListenerContainer;
@@ -140,7 +141,7 @@ private:
 
 static css::uno::Sequence< OUString > m_aInterceptedURL;
 
-StatusChangeListenerContainer*m_pStatCL;
+std::unique_ptrm_pStatCL;
 };
 
 #endif
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


  1   2   >