[Libreoffice-commits] .: Branch 'libreoffice-3-5' - 3 commits - svx/inc svx/source sw/inc sw/source
Michael Stahl
mst at kemper.freedesktop.org
Thu Jan 5 07:12:32 PST 2012
svx/inc/svx/xmleohlp.hxx | 5 ++
svx/source/xml/xmleohlp.cxx | 78 +++++++++++++++++++-----------------
svx/source/xml/xmlgrhlp.cxx | 21 ++-------
sw/inc/cmdid.h | 6 +-
sw/source/core/doc/docnew.cxx | 17 ++++---
sw/source/core/unocore/unoframe.cxx | 4 -
6 files changed, 68 insertions(+), 63 deletions(-)
New commits:
commit 3e146690d527d1c736685640e9f11172c7d087ba
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Jan 4 16:45:34 2012 +0000
Resolves: fdo#43867 collection of problems causing loss of ole2 previews
a) factor out part of SvXMLEmbeddedObjectHelper::ImplGetStorageNames as
splitObjectURL to reuse in SvXMLGraphicHelper::ImplGetStreamNames to get better
url splitting logic to handle "./ObjectReplacements/foo"
b) FN_UNO_REPLACEMENT_GRAPHIC_URL and FN_UNO_GRAPHIC ids collide
urls incorrectly treated as graphics
c) imported preview images for objects set on a temporary
svt::EmbeddedObjectRef *copy* of the object, not the real object.
(cherry picked from commit ef17be8b006737c078a59635ae334a03301727ea)
Signed-off-by: Michael Stahl <mstahl at redhat.com>
Conflicts:
svx/source/xml/xmlgrhlp.cxx
diff --git a/svx/inc/svx/xmleohlp.hxx b/svx/inc/svx/xmleohlp.hxx
index 88d9651..247038b 100644
--- a/svx/inc/svx/xmleohlp.hxx
+++ b/svx/inc/svx/xmleohlp.hxx
@@ -145,6 +145,11 @@ public:
// XNameAccess
virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw (::com::sun::star::uno::RuntimeException);
virtual sal_Bool SAL_CALL hasElements( ) throw (::com::sun::star::uno::RuntimeException);
+
+
+ static void splitObjectURL(::rtl::OUString aURLNoPar,
+ ::rtl::OUString& rContainerStorageName,
+ ::rtl::OUString& rObjectStorageName);
};
#endif
diff --git a/svx/source/xml/xmleohlp.cxx b/svx/source/xml/xmleohlp.cxx
index 83bf464..f20158c 100644
--- a/svx/source/xml/xmleohlp.cxx
+++ b/svx/source/xml/xmleohlp.cxx
@@ -206,6 +206,48 @@ void SAL_CALL SvXMLEmbeddedObjectHelper::disposing()
Flush();
}
+
+void SvXMLEmbeddedObjectHelper::splitObjectURL(::rtl::OUString aURLNoPar,
+ ::rtl::OUString& rContainerStorageName,
+ ::rtl::OUString& rObjectStorageName)
+{
+ DBG_ASSERT( '#' != aURLNoPar[0], "invalid object URL" );
+
+ sal_Int32 _nPos = aURLNoPar.lastIndexOf( '/' );
+ if( -1 == _nPos )
+ {
+ rContainerStorageName = ::rtl::OUString();
+ rObjectStorageName = aURLNoPar;
+ }
+ else
+ {
+ //eliminate 'superfluous' slashes at start and end
+ //#i103076# load objects with all allowed xlink:href syntaxes
+ {
+ //eliminate './' at start
+ sal_Int32 nStart = 0;
+ sal_Int32 nCount = aURLNoPar.getLength();
+ if( 0 == aURLNoPar.compareToAscii( "./", 2 ) )
+ {
+ nStart = 2;
+ nCount -= 2;
+ }
+
+ //eliminate '/' at end
+ sal_Int32 nEnd = aURLNoPar.lastIndexOf( '/' );
+ if( nEnd == aURLNoPar.getLength()-1 && nEnd != (nStart-1) )
+ nCount--;
+
+ aURLNoPar = aURLNoPar.copy( nStart, nCount );
+ }
+
+ _nPos = aURLNoPar.lastIndexOf( '/' );
+ if( _nPos >= 0 )
+ rContainerStorageName = aURLNoPar.copy( 0, _nPos );
+ rObjectStorageName = aURLNoPar.copy( _nPos+1 );
+ }
+}
+
// -----------------------------------------------------------------------------
sal_Bool SvXMLEmbeddedObjectHelper::ImplGetStorageNames(
@@ -308,41 +350,7 @@ sal_Bool SvXMLEmbeddedObjectHelper::ImplGetStorageNames(
}
else
{
- DBG_ASSERT( '#' != aURLNoPar[0], "invalid object URL" );
-
- sal_Int32 _nPos = aURLNoPar.lastIndexOf( '/' );
- if( -1 == _nPos )
- {
- rContainerStorageName = ::rtl::OUString();
- rObjectStorageName = aURLNoPar;
- }
- else
- {
- //eliminate 'superfluous' slashes at start and end
- //#i103076# load objects with all allowed xlink:href syntaxes
- {
- //eliminate './' at start
- sal_Int32 nStart = 0;
- sal_Int32 nCount = aURLNoPar.getLength();
- if( 0 == aURLNoPar.compareToAscii( "./", 2 ) )
- {
- nStart = 2;
- nCount -= 2;
- }
-
- //eliminate '/' at end
- sal_Int32 nEnd = aURLNoPar.lastIndexOf( '/' );
- if( nEnd == aURLNoPar.getLength()-1 && nEnd != (nStart-1) )
- nCount--;
-
- aURLNoPar = aURLNoPar.copy( nStart, nCount );
- }
-
- _nPos = aURLNoPar.lastIndexOf( '/' );
- if( _nPos >= 0 )
- rContainerStorageName = aURLNoPar.copy( 0, _nPos );
- rObjectStorageName = aURLNoPar.copy( _nPos+1 );
- }
+ splitObjectURL(aURLNoPar, rContainerStorageName, rObjectStorageName);
}
if( -1 != rContainerStorageName.indexOf( '/' ) )
diff --git a/svx/source/xml/xmlgrhlp.cxx b/svx/source/xml/xmlgrhlp.cxx
index 110618f..2f57a9e 100644
--- a/svx/source/xml/xmlgrhlp.cxx
+++ b/svx/source/xml/xmlgrhlp.cxx
@@ -49,6 +49,7 @@
#include "svtools/filter.hxx"
#include "svx/xmlgrhlp.hxx"
+#include "svx/xmleohlp.hxx"
#include <algorithm>
@@ -439,23 +440,12 @@ sal_Bool SvXMLGraphicHelper::ImplGetStreamNames( const ::rtl::OUString& rURLStr,
{
rPictureStorageName = String( RTL_CONSTASCII_USTRINGPARAM( XML_GRAPHICSTORAGE_NAME ) );
rPictureStreamName = aURLStr;
- bRet = sal_True;
- }
- else if( 2 == nTokenCount )
- {
- rPictureStorageName = aURLStr.GetToken( 0, '/' );
-
- DBG_ASSERT( rPictureStorageName.getLength() &&
- rPictureStorageName.getStr()[ 0 ] != '#',
- "invalid relative URL" );
-
- rPictureStreamName = aURLStr.GetToken( 1, '/' );
- bRet = sal_True;
}
else
- {
- SAL_WARN("svx", "SvXMLGraphicHelper::ImplInsertGraphicURL: invalid scheme: " << rURLStr);
- }
+ SvXMLEmbeddedObjectHelper::splitObjectURL(aURLStr, rPictureStorageName, rPictureStreamName);
+
+ bRet = !rPictureStreamName.isEmpty();
+ SAL_WARN_IF(!bRet, "svx", "SvXMLGraphicHelper::ImplInsertGraphicURL: invalid scheme: " << rURLStr);
}
return bRet;
diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h
index 33c287b..7802db7 100644
--- a/sw/inc/cmdid.h
+++ b/sw/inc/cmdid.h
@@ -842,10 +842,10 @@ included in c-context files, so c++ style stuff will cause problems.
#define FN_UNO_COMPONENT (FN_EXTRA2 + 97)
#define FN_WORDCOUNT_DIALOG (FN_EXTRA2 + 98)
-#define FN_XFORMS_DESIGN_MODE (FN_EXTRA2 + 100)
+#define FN_XFORMS_DESIGN_MODE (FN_EXTRA2 + 99)
-#define FN_UNO_PARA_STYLE_CONDITIONS (FN_EXTRA2 + 101)
-#define FN_UNO_GRAPHIC (FN_EXTRA2 + 102)
+#define FN_UNO_PARA_STYLE_CONDITIONS (FN_EXTRA2 + 100)
+#define FN_UNO_GRAPHIC (FN_EXTRA2 + 101)
#define FN_UNO_REPLACEMENT_GRAPHIC_URL (FN_EXTRA2 + 102)
#define FN_UNO_CELL_ROW_SPAN (FN_EXTRA2 + 103)
diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
index 2091ac6..141dabf 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -1211,10 +1211,10 @@ void SwXFrame::setPropertyValue(const :: OUString& rPropertyName, const :: uno::
if ( pOleNode )
{
- svt::EmbeddedObjectRef xObj = pOleNode->GetOLEObj().GetObject();
+ svt::EmbeddedObjectRef &rObj = pOleNode->GetOLEObj().GetObject();
::rtl::OUString aMediaType;
- xObj.SetGraphic( aGraphic, aMediaType );
+ rObj.SetGraphic( aGraphic, aMediaType );
}
}
}
commit 8d4d879eaadfdabf9ec00a223750dce20f95e158
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Jan 3 09:35:37 2012 +0000
don't make it a secret what the invalid url was
(cherry picked from commit 06580064d7b20a59fb269539ddc58387c43b076a)
Signed-off-by: Michael Stahl <mstahl at redhat.com>
diff --git a/svx/source/xml/xmlgrhlp.cxx b/svx/source/xml/xmlgrhlp.cxx
index 3fc611c..110618f 100644
--- a/svx/source/xml/xmlgrhlp.cxx
+++ b/svx/source/xml/xmlgrhlp.cxx
@@ -27,6 +27,7 @@
************************************************************************/
#include <sal/macros.h>
+#include <rtl/oustringostreaminserter.hxx>
#include <rtl/strbuf.hxx>
#include <com/sun/star/embed/XTransactedObject.hpp>
#include <com/sun/star/embed/ElementModes.hpp>
@@ -453,7 +454,7 @@ sal_Bool SvXMLGraphicHelper::ImplGetStreamNames( const ::rtl::OUString& rURLStr,
}
else
{
- OSL_FAIL( "SvXMLGraphicHelper::ImplInsertGraphicURL: invalid scheme" );
+ SAL_WARN("svx", "SvXMLGraphicHelper::ImplInsertGraphicURL: invalid scheme: " << rURLStr);
}
}
commit 44091b94ded66836b33e380afe04b73ece0cd318
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Jan 3 09:05:09 2012 +0000
Related: fdo#43867 header styles contain content like document body
If we have to acquire before inserting content into a document, then we also
need to acquire before copying styles into a document, seeing as header styles
contain content, so whatever can happen during content insertion can happen
during the content insertion of the contents of a header style.
(cherry picked from commit 7dc25878c1310a1de6d3c87c88404b151bad21fc)
Signed-off-by: Michael Stahl <mstahl at redhat.com>
diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index cba7694..cdf5def 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -1110,14 +1110,9 @@ SfxObjectShell* SwDoc::CreateCopy(bool bCallInitNew ) const
{
SwDoc* pRet = new SwDoc;
- pRet->ReplaceDefaults(*this);
-
- pRet->ReplaceCompatabilityOptions(*this);
-
- pRet->ReplaceStyles(*this);
-
- // we have to use pointer here, since the callee has to decide whether SfxObjectShellLock or SfxObjectShellRef should be used
- // sometimes the object will be returned with refcount set to 0 ( if no DoInitNew is done )
+ // we have to use pointer here, since the callee has to decide whether
+ // SfxObjectShellLock or SfxObjectShellRef should be used sometimes the
+ // object will be returned with refcount set to 0 ( if no DoInitNew is done )
SfxObjectShell* pRetShell = new SwDocShell( pRet, SFX_CREATE_MODE_STANDARD );
if( bCallInitNew )
{
@@ -1127,6 +1122,12 @@ SfxObjectShell* SwDoc::CreateCopy(bool bCallInitNew ) const
pRet->acquire();
+ pRet->ReplaceDefaults(*this);
+
+ pRet->ReplaceCompatabilityOptions(*this);
+
+ pRet->ReplaceStyles(*this);
+
//copy content
pRet->Paste( *this );
More information about the Libreoffice-commits
mailing list