summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorMathias Bauer <mba@openoffice.org>2010-06-02 10:58:04 +0200
committerMathias Bauer <mba@openoffice.org>2010-06-02 10:58:04 +0200
commit5d1f79da2038d3020b82f27234f535559ec877ab (patch)
tree944ccfaf5057b5642dcac293f7147483f313da07 /sfx2
parentd707723ca0e19f724667185203c4d79893e0b4e9 (diff)
parent44ada130c3857b167e954b63c7a5490268b72c5b (diff)
CWS mba33issues01: merge to m80
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/inc/sfx2/Metadatable.hxx4
-rw-r--r--sfx2/inc/sfx2/app.hxx4
-rw-r--r--sfx2/inc/sfx2/objsh.hxx6
-rw-r--r--sfx2/qa/complex/DocumentMetadataAccessTest.java125
-rw-r--r--sfx2/qa/unoapi/sfx.sce2
-rw-r--r--sfx2/source/dialog/about.cxx50
-rw-r--r--sfx2/source/doc/Metadatable.cxx68
-rw-r--r--sfx2/source/doc/SfxDocumentMetaData.cxx37
-rw-r--r--sfx2/source/doc/guisaveas.cxx89
-rwxr-xr-x[-rw-r--r--]sfx2/source/doc/objmisc.cxx10
10 files changed, 217 insertions, 178 deletions
diff --git a/sfx2/inc/sfx2/Metadatable.hxx b/sfx2/inc/sfx2/Metadatable.hxx
index fb5c2cce13..6896fd689f 100644
--- a/sfx2/inc/sfx2/Metadatable.hxx
+++ b/sfx2/inc/sfx2/Metadatable.hxx
@@ -98,8 +98,8 @@ public:
const bool i_bCopyPrecedesSource = false);
/** create an Undo Metadatable, which remembers this' reference */
- ::boost::shared_ptr<MetadatableUndo> CreateUndo(
- const bool i_isDelete = false);
+ ::boost::shared_ptr<MetadatableUndo> CreateUndo() const;
+ ::boost::shared_ptr<MetadatableUndo> CreateUndoForDelete();
/** restore this from Undo Metadatable */
void RestoreMetadata(::boost::shared_ptr<MetadatableUndo> const& i_pUndo);
diff --git a/sfx2/inc/sfx2/app.hxx b/sfx2/inc/sfx2/app.hxx
index 3e11e34256..6c330b023a 100644
--- a/sfx2/inc/sfx2/app.hxx
+++ b/sfx2/inc/sfx2/app.hxx
@@ -33,6 +33,7 @@
#include <tools/solar.h>
#include <svl/smplhint.hxx>
#include <svl/poolitem.hxx>
+#include <vcl/image.hxx>
#include <tools/ref.hxx>
#include <com/sun/star/uno/Reference.hxx>
#include <com/sun/star/script/XLibraryContainer.hpp>
@@ -316,6 +317,9 @@ public:
SAL_DLLPRIVATE SfxModule* GetModule_Impl();
SAL_DLLPRIVATE ResMgr* GetOffResManager_Impl();
//#endif
+
+ /** loads the application logo as used in the about dialog and impress slideshow pause screen */
+ static Image GetApplicationLogo();
};
#define SFX_APP() SfxGetpApp()
diff --git a/sfx2/inc/sfx2/objsh.hxx b/sfx2/inc/sfx2/objsh.hxx
index 97196ad3c4..42021778b4 100644
--- a/sfx2/inc/sfx2/objsh.hxx
+++ b/sfx2/inc/sfx2/objsh.hxx
@@ -398,7 +398,8 @@ public:
const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aParams,
::com::sun::star::uno::Any& aRet,
::com::sun::star::uno::Sequence< sal_Int16 >& aOutParamIndex,
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aOutParam
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aOutParam,
+ bool bRaiseError = true
);
static ErrCode CallXScript(
@@ -407,7 +408,8 @@ public:
const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aParams,
::com::sun::star::uno::Any& aRet,
::com::sun::star::uno::Sequence< sal_Int16 >& aOutParamIndex,
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aOutParam
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aOutParam,
+ bool bRaiseError = true
);
/** adjusts the internal macro mode, according to the current security settings
diff --git a/sfx2/qa/complex/DocumentMetadataAccessTest.java b/sfx2/qa/complex/DocumentMetadataAccessTest.java
index 767d74dd23..da9cfd6cf7 100644
--- a/sfx2/qa/complex/DocumentMetadataAccessTest.java
+++ b/sfx2/qa/complex/DocumentMetadataAccessTest.java
@@ -42,6 +42,7 @@ import com.sun.star.lang.WrappedTargetException;
import com.sun.star.lang.WrappedTargetRuntimeException;
import com.sun.star.beans.XPropertySet;
import com.sun.star.beans.PropertyValue;
+import com.sun.star.beans.Pair;
import com.sun.star.beans.StringPair;
import com.sun.star.container.XEnumerationAccess;
import com.sun.star.container.XEnumeration;
@@ -689,23 +690,25 @@ public class DocumentMetadataAccessTest extends ComplexTestCase
log.println("Checking RDFa in loaded test document...");
XMetadatable xPara;
- Statement[] stmts;
+ Pair<Statement[], Boolean> result;
Statement x_FooBarLit1 = new Statement(foo, bar, mkLit("1"), null);
xPara = (XMetadatable) UnoRuntime.queryInterface(
XMetadatable.class, xEnum.nextElement());
- stmts = xRep.getStatementRDFa(xPara);
+ result = xRep.getStatementRDFa(xPara);
assure("RDFa: 1",
- eq(stmts, new Statement[] {
+ !result.Second &&
+ eq(result.First, new Statement[] {
x_FooBarLit1
}));
Statement x_FooBarLit2 = new Statement(foo, bar, mkLit("2"), null);
xPara = (XMetadatable) UnoRuntime.queryInterface(
XMetadatable.class, xEnum.nextElement());
- stmts = xRep.getStatementRDFa(xPara);
+ result = xRep.getStatementRDFa(xPara);
assure("RDFa: 2",
- eq(stmts, new Statement[] {
+ !result.Second &&
+ eq(result.First, new Statement[] {
x_FooBarLit2
}));
@@ -713,37 +716,40 @@ public class DocumentMetadataAccessTest extends ComplexTestCase
new Statement(blank1, bar, mkLit("3"), null);
xPara = (XMetadatable) UnoRuntime.queryInterface(
XMetadatable.class, xEnum.nextElement());
- stmts = xRep.getStatementRDFa(xPara);
+ result = xRep.getStatementRDFa(xPara);
assure("RDFa: 3",
- eq(stmts, new Statement[] {
+ !result.Second &&
+ eq(result.First, new Statement[] {
x_BlankBarLit3
}));
XBlankNode b3 = (XBlankNode) UnoRuntime.queryInterface(
- XBlankNode.class, stmts[0].Subject);
+ XBlankNode.class, result.First[0].Subject);
Statement x_BlankBarLit4 =
new Statement(blank2, bar, mkLit("4"), null);
xPara = (XMetadatable) UnoRuntime.queryInterface(
XMetadatable.class, xEnum.nextElement());
- stmts = xRep.getStatementRDFa(xPara);
+ result = xRep.getStatementRDFa(xPara);
assure("RDFa: 4",
- eq(stmts, new Statement[] {
+ !result.Second &&
+ eq(result.First, new Statement[] {
x_BlankBarLit4
}));
XBlankNode b4 = (XBlankNode) UnoRuntime.queryInterface(
- XBlankNode.class, stmts[0].Subject);
+ XBlankNode.class, result.First[0].Subject);
Statement x_BlankBarLit5 =
new Statement(blank1, bar, mkLit("5"), null);
xPara = (XMetadatable) UnoRuntime.queryInterface(
XMetadatable.class, xEnum.nextElement());
- stmts = xRep.getStatementRDFa(xPara);
+ result = xRep.getStatementRDFa(xPara);
assure("RDFa: 5",
- eq(stmts, new Statement[] {
+ !result.Second &&
+ eq(result.First, new Statement[] {
x_BlankBarLit5
}));
XBlankNode b5 = (XBlankNode) UnoRuntime.queryInterface(
- XBlankNode.class, stmts[0].Subject);
+ XBlankNode.class, result.First[0].Subject);
assure("RDFa: 3 != 4",
!b3.getStringValue().equals(b4.getStringValue()));
@@ -754,9 +760,10 @@ public class DocumentMetadataAccessTest extends ComplexTestCase
Statement x_FooBazLit6 = new Statement(foo, baz, mkLit("6"), null);
xPara = (XMetadatable) UnoRuntime.queryInterface(
XMetadatable.class, xEnum.nextElement());
- stmts = xRep.getStatementRDFa(xPara);
+ result = xRep.getStatementRDFa(xPara);
assure("RDFa: 6",
- eq(stmts, new Statement[] {
+ !result.Second &&
+ eq(result.First, new Statement[] {
x_FooBarLit6, x_FooBazLit6
}));
@@ -765,9 +772,10 @@ public class DocumentMetadataAccessTest extends ComplexTestCase
Statement x_FooFooLit7 = new Statement(foo, foo, mkLit("7"), null);
xPara = (XMetadatable) UnoRuntime.queryInterface(
XMetadatable.class, xEnum.nextElement());
- stmts = xRep.getStatementRDFa(xPara);
+ result = xRep.getStatementRDFa(xPara);
assure("RDFa: 7",
- eq(stmts, new Statement[] {
+ !result.Second &&
+ eq(result.First, new Statement[] {
x_FooBarLit7, x_FooBazLit7, x_FooFooLit7
}));
@@ -776,43 +784,41 @@ public class DocumentMetadataAccessTest extends ComplexTestCase
Statement x_FooBarLit = new Statement(foo, bar, lit, null);
Statement x_FooBarLittype = new Statement(foo, bar, lit_type, null);
- Statement x_FooLabelLit8 =
- new Statement(foo, rdfs_label, mkLit("8"), null);
xPara = (XMetadatable) UnoRuntime.queryInterface(
XMetadatable.class, xEnum.nextElement());
- stmts = xRep.getStatementRDFa(xPara);
+ result = xRep.getStatementRDFa(xPara);
assure("RDFa: 8",
- eq(stmts, new Statement[] {
- x_FooBarLit, x_FooLabelLit8
+ result.Second &&
+ eq(result.First, new Statement[] {
+ x_FooBarLit
}));
- Statement x_FooLabelLit9 =
- new Statement(foo, rdfs_label, mkLit("9"), null);
xPara = (XMetadatable) UnoRuntime.queryInterface(
XMetadatable.class, xEnum.nextElement());
- stmts = xRep.getStatementRDFa(xPara);
+ result = xRep.getStatementRDFa(xPara);
assure("RDFa: 9",
- eq(stmts, new Statement[] {
- x_FooBarLit, x_FooLabelLit9
+ result.Second &&
+ eq(result.First, new Statement[] {
+ x_FooBarLit
}));
- Statement x_FooLabelLit10 =
- new Statement(foo, rdfs_label, mkLit("10"), null);
xPara = (XMetadatable) UnoRuntime.queryInterface(
XMetadatable.class, xEnum.nextElement());
- stmts = xRep.getStatementRDFa(xPara);
+ result = xRep.getStatementRDFa(xPara);
assure("RDFa: 10",
- eq(stmts, new Statement[] {
- x_FooBarLittype, x_FooLabelLit10
+ result.Second &&
+ eq(result.First, new Statement[] {
+ x_FooBarLittype
}));
Statement x_FooBarLit11
= new Statement(foo, bar, mkLit("11", bar), null);
xPara = (XMetadatable) UnoRuntime.queryInterface(
XMetadatable.class, xEnum.nextElement());
- stmts = xRep.getStatementRDFa(xPara);
+ result = xRep.getStatementRDFa(xPara);
assure("RDFa: 11",
- eq(stmts, new Statement[] {
+ !result.Second &&
+ eq(result.First, new Statement[] {
x_FooBarLit11
}));
@@ -821,66 +827,67 @@ public class DocumentMetadataAccessTest extends ComplexTestCase
new Statement(xFile, bar, mkLit("12"), null);
xPara = (XMetadatable) UnoRuntime.queryInterface(
XMetadatable.class, xEnum.nextElement());
- stmts = xRep.getStatementRDFa(xPara);
+ result = xRep.getStatementRDFa(xPara);
assure("RDFa: 12",
- eq(stmts, new Statement[] {
+ !result.Second &&
+ eq(result.First, new Statement[] {
x_FileBarLit12
}));
- Statement x_FooLabelLit13 =
- new Statement(foo, rdfs_label, mkLit("13"), null);
xPara = (XMetadatable) UnoRuntime.queryInterface(
XMetadatable.class, xEnum.nextElement());
- stmts = xRep.getStatementRDFa(xPara);
+ result = xRep.getStatementRDFa(xPara);
assure("RDFa: 13",
- eq(stmts, new Statement[] {
- x_FooBarLit, x_FooLabelLit13
+ result.Second &&
+ eq(result.First, new Statement[] {
+ x_FooBarLit
}));
Statement x_FooLabelLit14 =
new Statement(foo, rdfs_label, mkLit("14"), null);
xPara = (XMetadatable) UnoRuntime.queryInterface(
XMetadatable.class, xEnum.nextElement());
- stmts = xRep.getStatementRDFa(xPara);
+ result = xRep.getStatementRDFa(xPara);
assure("RDFa: 14",
- eq(stmts, new Statement[] {
- x_FooBarLit, x_FooLabelLit14
+ result.Second &&
+ eq(result.First, new Statement[] {
+ x_FooBarLit
}));
xPara = (XMetadatable) UnoRuntime.queryInterface(
XMetadatable.class, xEnum.nextElement());
- stmts = xRep.getStatementRDFa(xPara);
- assure("RDFa: 15", eq(stmts, new Statement[] { } ));
+ result = xRep.getStatementRDFa(xPara);
+ assure("RDFa: 15", eq(result.First, new Statement[] { } ));
xPara = (XMetadatable) UnoRuntime.queryInterface(
XMetadatable.class, xEnum.nextElement());
- stmts = xRep.getStatementRDFa(xPara);
- assure("RDFa: 16", eq(stmts, new Statement[] { } ));
+ result = xRep.getStatementRDFa(xPara);
+ assure("RDFa: 16", eq(result.First, new Statement[] { } ));
xPara = (XMetadatable) UnoRuntime.queryInterface(
XMetadatable.class, xEnum.nextElement());
- stmts = xRep.getStatementRDFa(xPara);
- assure("RDFa: 17", eq(stmts, new Statement[] { } ));
+ result = xRep.getStatementRDFa(xPara);
+ assure("RDFa: 17", eq(result.First, new Statement[] { } ));
xPara = (XMetadatable) UnoRuntime.queryInterface(
XMetadatable.class, xEnum.nextElement());
- stmts = xRep.getStatementRDFa(xPara);
- assure("RDFa: 18", eq(stmts, new Statement[] { } ));
+ result = xRep.getStatementRDFa(xPara);
+ assure("RDFa: 18", eq(result.First, new Statement[] { } ));
xPara = (XMetadatable) UnoRuntime.queryInterface(
XMetadatable.class, xEnum.nextElement());
- stmts = xRep.getStatementRDFa(xPara);
- assure("RDFa: 19", eq(stmts, new Statement[] { } ));
+ result = xRep.getStatementRDFa(xPara);
+ assure("RDFa: 19", eq(result.First, new Statement[] { } ));
xPara = (XMetadatable) UnoRuntime.queryInterface(
XMetadatable.class, xEnum.nextElement());
- stmts = xRep.getStatementRDFa(xPara);
- assure("RDFa: 20", eq(stmts, new Statement[] { } ));
+ result = xRep.getStatementRDFa(xPara);
+ assure("RDFa: 20", eq(result.First, new Statement[] { } ));
xPara = (XMetadatable) UnoRuntime.queryInterface(
XMetadatable.class, xEnum.nextElement());
- stmts = xRep.getStatementRDFa(xPara);
- assure("RDFa: 21", eq(stmts, new Statement[] { } ));
+ result = xRep.getStatementRDFa(xPara);
+ assure("RDFa: 21", eq(result.First, new Statement[] { } ));
log.println("...done");
diff --git a/sfx2/qa/unoapi/sfx.sce b/sfx2/qa/unoapi/sfx.sce
index 2aaf12c259..6176c06687 100644
--- a/sfx2/qa/unoapi/sfx.sce
+++ b/sfx2/qa/unoapi/sfx.sce
@@ -2,4 +2,4 @@
-o sfx.DocumentTemplates
-o sfx.FrameLoader
-o sfx.SfxMacroLoader
--o sfx.StandaloneDocumentInfo
+#i111283 -o sfx.StandaloneDocumentInfo
diff --git a/sfx2/source/dialog/about.cxx b/sfx2/source/dialog/about.cxx
index 9a391bb01c..fba842e129 100644
--- a/sfx2/source/dialog/about.cxx
+++ b/sfx2/source/dialog/about.cxx
@@ -109,28 +109,11 @@ static bool impl_loadBitmap(
return false;
}
-AboutDialog::AboutDialog( Window* pParent, const ResId& rId, const String& rVerStr ) :
-
- SfxModalDialog ( pParent, rId ),
-
- aOKButton ( this, ResId( ABOUT_BTN_OK, *rId.GetResMgr() ) ),
- aVersionText ( this, ResId( ABOUT_FTXT_VERSION, *rId.GetResMgr() ) ),
- aCopyrightText ( this, ResId( ABOUT_FTXT_COPYRIGHT, *rId.GetResMgr() ) ),
- aBuildData ( this ),
- aDeveloperAry ( ResId( ABOUT_STR_DEVELOPER_ARY, *rId.GetResMgr() ) ),
- aDevVersionStr ( rVerStr ),
- aAccelStr ( ResId( ABOUT_STR_ACCEL, *rId.GetResMgr() ) ),
- aCopyrightTextStr( ResId( ABOUT_STR_COPYRIGHT, *rId.GetResMgr() ) ),
- aTimer (),
- nOff ( 0 ),
- m_nDeltaWidth ( 0 ),
- m_nPendingScrolls( 0 ),
- bNormal ( TRUE )
+/** loads the application logo as used in the about dialog and impress slideshow pause screen */
+Image SfxApplication::GetApplicationLogo()
{
- rtl::OUString sProduct;
- utl::ConfigManager::GetDirectConfigProperty(utl::ConfigManager::PRODUCTNAME) >>= sProduct;
+ Image aAppLogo;
- // load image from module path
rtl::OUString aAbouts( RTL_CONSTASCII_USTRINGPARAM( ABOUT_BITMAP_STRINGLIST ) );
bool bLoaded = false;
sal_Int32 nIndex = 0;
@@ -165,6 +148,33 @@ AboutDialog::AboutDialog( Window* pParent, const ResId& rId, const String& rVerS
rtl::OUString::createFromAscii( "about.bmp" ), aAppLogo );
}
+ return aAppLogo;
+}
+
+AboutDialog::AboutDialog( Window* pParent, const ResId& rId, const String& rVerStr ) :
+
+ SfxModalDialog ( pParent, rId ),
+
+ aOKButton ( this, ResId( ABOUT_BTN_OK, *rId.GetResMgr() ) ),
+ aVersionText ( this, ResId( ABOUT_FTXT_VERSION, *rId.GetResMgr() ) ),
+ aCopyrightText ( this, ResId( ABOUT_FTXT_COPYRIGHT, *rId.GetResMgr() ) ),
+ aBuildData ( this ),
+ aDeveloperAry ( ResId( ABOUT_STR_DEVELOPER_ARY, *rId.GetResMgr() ) ),
+ aDevVersionStr ( rVerStr ),
+ aAccelStr ( ResId( ABOUT_STR_ACCEL, *rId.GetResMgr() ) ),
+ aCopyrightTextStr( ResId( ABOUT_STR_COPYRIGHT, *rId.GetResMgr() ) ),
+ aTimer (),
+ nOff ( 0 ),
+ m_nDeltaWidth ( 0 ),
+ m_nPendingScrolls( 0 ),
+ bNormal ( TRUE )
+{
+ rtl::OUString sProduct;
+ utl::ConfigManager::GetDirectConfigProperty(utl::ConfigManager::PRODUCTNAME) >>= sProduct;
+
+ // load image from module path
+ aAppLogo = SfxApplication::GetApplicationLogo();
+
// Transparenter Font
Font aFont = GetFont();
aFont.SetTransparent( TRUE );
diff --git a/sfx2/source/doc/Metadatable.cxx b/sfx2/source/doc/Metadatable.cxx
index f14be1db2c..b21e0c2a7e 100644
--- a/sfx2/source/doc/Metadatable.cxx
+++ b/sfx2/source/doc/Metadatable.cxx
@@ -33,6 +33,8 @@
#include <vos/mutex.hxx>
#include <vcl/svapp.hxx> // solarmutex
+#include <rtl/random.h>
+
#include <boost/bind.hpp>
#include <memory>
@@ -401,14 +403,16 @@ template< typename T >
/*static*/ ::rtl::OUString create_id(const
::std::hash_map< ::rtl::OUString, T, ::rtl::OUStringHash > & i_rXmlIdMap)
{
+ static rtlRandomPool s_Pool( rtl_random_createPool() );
const ::rtl::OUString prefix( ::rtl::OUString::createFromAscii(s_prefix) );
typename ::std::hash_map< ::rtl::OUString, T, ::rtl::OUStringHash >
::const_iterator iter;
::rtl::OUString id;
do
{
- const int n( rand() );
- id = prefix + ::rtl::OUString::valueOf(static_cast<sal_Int64>(n));
+ sal_Int32 n;
+ rtl_random_getBytes(s_Pool, & n, sizeof(n));
+ id = prefix + ::rtl::OUString::valueOf(static_cast<sal_Int32>(abs(n)));
iter = i_rXmlIdMap.find(id);
}
while (iter != i_rXmlIdMap.end());
@@ -1488,8 +1492,7 @@ Metadatable::RegisterAsCopyOf(Metadatable const & i_rSource,
}
}
-::boost::shared_ptr<MetadatableUndo> Metadatable::CreateUndo(
- const bool i_isDelete)
+::boost::shared_ptr<MetadatableUndo> Metadatable::CreateUndo() const
{
OSL_ENSURE(!IsInUndo(), "CreateUndo called for object in undo?");
OSL_ENSURE(!IsInClipboard(), "CreateUndo called for object in clipboard?");
@@ -1503,11 +1506,6 @@ Metadatable::RegisterAsCopyOf(Metadatable const & i_rSource,
pRegDoc->CreateUndo(*this) );
pRegDoc->RegisterCopy(*this, *pUndo, false);
pUndo->m_pReg = pRegDoc;
-
- if (i_isDelete)
- {
- RemoveMetadataReference();
- }
return pUndo;
}
}
@@ -1518,6 +1516,13 @@ Metadatable::RegisterAsCopyOf(Metadatable const & i_rSource,
return ::boost::shared_ptr<MetadatableUndo>();
}
+::boost::shared_ptr<MetadatableUndo> Metadatable::CreateUndoForDelete()
+{
+ ::boost::shared_ptr<MetadatableUndo> const pUndo( CreateUndo() );
+ RemoveMetadataReference();
+ return pUndo;
+}
+
void Metadatable::RestoreMetadata(
::boost::shared_ptr<MetadatableUndo> const& i_pUndo)
{
@@ -1624,15 +1629,16 @@ MetadatableMixin::getMetadataReference()
throw (uno::RuntimeException)
{
::vos::OGuard aGuard( Application::GetSolarMutex() );
- Metadatable* pObject( GetCoreObject() );
- if (pObject)
- {
- return pObject->GetMetadataReference();
- }
- else
+
+ Metadatable *const pObject( GetCoreObject() );
+ if (!pObject)
{
- throw uno::RuntimeException();
+ throw uno::RuntimeException(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "MetadatableMixin: cannot get core object; not inserted?")),
+ *this);
}
+ return pObject->GetMetadataReference();
}
void SAL_CALL
@@ -1641,30 +1647,32 @@ MetadatableMixin::setMetadataReference(
throw (uno::RuntimeException, lang::IllegalArgumentException)
{
::vos::OGuard aGuard( Application::GetSolarMutex() );
- Metadatable* pObject( GetCoreObject() );
- if (pObject)
- {
- return pObject->SetMetadataReference(i_rReference);
- }
- else
+
+ Metadatable *const pObject( GetCoreObject() );
+ if (!pObject)
{
- throw uno::RuntimeException();
+ throw uno::RuntimeException(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "MetadatableMixin: cannot get core object; not inserted?")),
+ *this);
}
+ return pObject->SetMetadataReference(i_rReference);
}
void SAL_CALL MetadatableMixin::ensureMetadataReference()
throw (uno::RuntimeException)
{
::vos::OGuard aGuard( Application::GetSolarMutex() );
- Metadatable* pObject( GetCoreObject() );
- if (pObject)
- {
- return pObject->EnsureMetadataReference();
- }
- else
+
+ Metadatable *const pObject( GetCoreObject() );
+ if (!pObject)
{
- throw uno::RuntimeException();
+ throw uno::RuntimeException(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "MetadatableMixin: cannot get core object; not inserted?")),
+ *this);
}
+ return pObject->EnsureMetadataReference();
}
} // namespace sfx2
diff --git a/sfx2/source/doc/SfxDocumentMetaData.cxx b/sfx2/source/doc/SfxDocumentMetaData.cxx
index 6f9c9d0bd5..95fe000709 100644
--- a/sfx2/source/doc/SfxDocumentMetaData.cxx
+++ b/sfx2/source/doc/SfxDocumentMetaData.cxx
@@ -38,7 +38,6 @@
#include "com/sun/star/util/XModifiable.hpp"
#include "com/sun/star/xml/sax/XSAXSerializable.hpp"
-#include "com/sun/star/lang/NullPointerException.hpp"
#include "com/sun/star/lang/WrappedTargetRuntimeException.hpp"
#include "com/sun/star/lang/EventObject.hpp"
#include "com/sun/star/beans/XPropertySet.hpp"
@@ -248,25 +247,21 @@ public:
const css::uno::Sequence< css::beans::PropertyValue > & Medium)
throw (css::uno::RuntimeException, css::lang::IllegalArgumentException,
css::io::WrongFormatException,
- css::lang::WrappedTargetException, css::io::IOException,
- css::uno::Exception);
+ css::lang::WrappedTargetException, css::io::IOException);
virtual void SAL_CALL loadFromMedium(const ::rtl::OUString & URL,
const css::uno::Sequence< css::beans::PropertyValue > & Medium)
throw (css::uno::RuntimeException,
css::io::WrongFormatException,
- css::lang::WrappedTargetException, css::io::IOException,
- css::uno::Exception);
+ css::lang::WrappedTargetException, css::io::IOException);
virtual void SAL_CALL storeToStorage(
const css::uno::Reference< css::embed::XStorage > & Storage,
const css::uno::Sequence< css::beans::PropertyValue > & Medium)
throw (css::uno::RuntimeException, css::lang::IllegalArgumentException,
- css::lang::WrappedTargetException, css::io::IOException,
- css::uno::Exception);
+ css::lang::WrappedTargetException, css::io::IOException);
virtual void SAL_CALL storeToMedium(const ::rtl::OUString & URL,
const css::uno::Sequence< css::beans::PropertyValue > & Medium)
throw (css::uno::RuntimeException,
- css::lang::WrappedTargetException, css::io::IOException,
- css::uno::Exception);
+ css::lang::WrappedTargetException, css::io::IOException);
// ::com::sun::star::lang::XInitialization:
virtual void SAL_CALL initialize(
@@ -1869,8 +1864,7 @@ SfxDocumentMetaData::loadFromStorage(
const css::uno::Sequence< css::beans::PropertyValue > & Medium)
throw (css::uno::RuntimeException, css::lang::IllegalArgumentException,
css::io::WrongFormatException,
- css::lang::WrappedTargetException, css::io::IOException,
- css::uno::Exception)
+ css::lang::WrappedTargetException, css::io::IOException)
{
if (!xStorage.is()) throw css::lang::IllegalArgumentException(
::rtl::OUString::createFromAscii("SfxDocumentMetaData::loadFromStorage:"
@@ -1882,10 +1876,10 @@ SfxDocumentMetaData::loadFromStorage(
xStorage->openStreamElement(
::rtl::OUString::createFromAscii(s_metaXml),
css::embed::ElementModes::READ) );
- if (!xStream.is()) throw css::lang::NullPointerException();
+ if (!xStream.is()) throw css::uno::RuntimeException();
css::uno::Reference<css::io::XInputStream> xInStream =
xStream->getInputStream();
- if (!xInStream.is()) throw css::lang::NullPointerException();
+ if (!xInStream.is()) throw css::uno::RuntimeException();
// create DOM parser service
css::uno::Reference<css::lang::XMultiComponentFactory> xMsf (
@@ -1949,8 +1943,7 @@ SfxDocumentMetaData::storeToStorage(
const css::uno::Reference< css::embed::XStorage > & xStorage,
const css::uno::Sequence< css::beans::PropertyValue > & Medium)
throw (css::uno::RuntimeException, css::lang::IllegalArgumentException,
- css::lang::WrappedTargetException, css::io::IOException,
- css::uno::Exception)
+ css::lang::WrappedTargetException, css::io::IOException)
{
if (!xStorage.is()) throw css::lang::IllegalArgumentException(
::rtl::OUString::createFromAscii("SfxDocumentMetaData::storeToStorage:"
@@ -1966,7 +1959,7 @@ SfxDocumentMetaData::storeToStorage(
xStorage->openStreamElement(::rtl::OUString::createFromAscii(s_metaXml),
css::embed::ElementModes::WRITE
| css::embed::ElementModes::TRUNCATE);
- if (!xStream.is()) throw css::lang::NullPointerException();
+ if (!xStream.is()) throw css::uno::RuntimeException();
css::uno::Reference< css::beans::XPropertySet > xStreamProps(xStream,
css::uno::UNO_QUERY_THROW);
xStreamProps->setPropertyValue(
@@ -1980,7 +1973,7 @@ SfxDocumentMetaData::storeToStorage(
css::uno::makeAny(static_cast<sal_Bool> (sal_False)));
css::uno::Reference<css::io::XOutputStream> xOutStream =
xStream->getOutputStream();
- if (!xOutStream.is()) throw css::lang::NullPointerException();
+ if (!xOutStream.is()) throw css::uno::RuntimeException();
css::uno::Reference<css::lang::XMultiComponentFactory> xMsf (
m_xContext->getServiceManager());
css::uno::Reference<css::io::XActiveDataSource> xSaxWriter(
@@ -2028,8 +2021,7 @@ void SAL_CALL
SfxDocumentMetaData::loadFromMedium(const ::rtl::OUString & URL,
const css::uno::Sequence< css::beans::PropertyValue > & Medium)
throw (css::uno::RuntimeException, css::io::WrongFormatException,
- css::lang::WrappedTargetException, css::io::IOException,
- css::uno::Exception)
+ css::lang::WrappedTargetException, css::io::IOException)
{
css::uno::Reference<css::io::XInputStream> xIn;
::comphelper::MediaDescriptor md(Medium);
@@ -2063,7 +2055,7 @@ SfxDocumentMetaData::loadFromMedium(const ::rtl::OUString & URL,
css::uno::makeAny(e));
}
if (!xStorage.is()) {
- throw css::lang::NullPointerException(::rtl::OUString::createFromAscii(
+ throw css::uno::RuntimeException(::rtl::OUString::createFromAscii(
"SfxDocumentMetaData::loadFromMedium: cannot get Storage"),
*this);
}
@@ -2074,8 +2066,7 @@ void SAL_CALL
SfxDocumentMetaData::storeToMedium(const ::rtl::OUString & URL,
const css::uno::Sequence< css::beans::PropertyValue > & Medium)
throw (css::uno::RuntimeException,
- css::lang::WrappedTargetException, css::io::IOException,
- css::uno::Exception)
+ css::lang::WrappedTargetException, css::io::IOException)
{
::comphelper::MediaDescriptor md(Medium);
if (!URL.equalsAscii("")) {
@@ -2087,7 +2078,7 @@ SfxDocumentMetaData::storeToMedium(const ::rtl::OUString & URL,
if (!xStorage.is()) {
- throw css::lang::NullPointerException(::rtl::OUString::createFromAscii(
+ throw css::uno::RuntimeException(::rtl::OUString::createFromAscii(
"SfxDocumentMetaData::storeToMedium: cannot get Storage"),
*this);
}
diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx
index cbbed369fc..1f0e56cbfc 100644
--- a/sfx2/source/doc/guisaveas.cxx
+++ b/sfx2/source/doc/guisaveas.cxx
@@ -836,9 +836,16 @@ sal_Bool ModelData_Impl::OutputFileDialog( sal_Int8 nStoreMode,
::rtl::OUString aAdjustToType;
- // bSetStandardName == true means that user agreed to store document in the default (default default ;-)) format
- if ( !(( nStoreMode & EXPORT_REQUESTED ) && !( nStoreMode & WIDEEXPORT_REQUESTED )) &&
- ( bSetStandardName || GetStorable()->hasLocation() ))
+ if ( ( nStoreMode & EXPORT_REQUESTED ) && !( nStoreMode & WIDEEXPORT_REQUESTED ) )
+ {
+ // it is export, set the preselected filter
+ ::rtl::OUString aFilterUIName = aPreselectedFilterPropsHM.getUnpackedValueOrDefault(
+ ::rtl::OUString::createFromAscii( "UIName" ),
+ ::rtl::OUString() );
+ pFileDlg->SetCurrentFilter( aFilterUIName );
+ }
+ // it is no export, bSetStandardName == true means that user agreed to store document in the default (default default ;-)) format
+ else if ( bSetStandardName || GetStorable()->hasLocation() )
{
uno::Sequence< beans::PropertyValue > aOldFilterProps;
::rtl::OUString aOldFilterName = GetDocProps().getUnpackedValueOrDefault(
@@ -1238,6 +1245,7 @@ sal_Bool SfxStoringHelper::GUIStoreModel( const uno::Reference< frame::XModel >&
// parse the slot name
sal_Int8 nStoreMode = getStoreModeFromSlotName( aSlotName );
+ sal_Int8 nStatusSave = STATUS_NO_ACTION;
// handle the special cases
if ( nStoreMode & SAVEAS_REQUESTED )
@@ -1259,7 +1267,7 @@ sal_Bool SfxStoringHelper::GUIStoreModel( const uno::Reference< frame::XModel >&
else if ( nStoreMode & SAVE_REQUESTED )
{
// if saving is not acceptable by the configuration the warning must be shown
- sal_Int8 nStatusSave = aModelData.CheckSaveAcceptable( STATUS_SAVE );
+ nStatusSave = aModelData.CheckSaveAcceptable( STATUS_SAVE );
if ( nStatusSave == STATUS_NO_ACTION )
throw task::ErrorCodeIOException( ::rtl::OUString(), uno::Reference< uno::XInterface >(), ERRCODE_IO_ABORT );
@@ -1273,32 +1281,7 @@ sal_Bool SfxStoringHelper::GUIStoreModel( const uno::Reference< frame::XModel >&
{
throw task::ErrorCodeIOException( ::rtl::OUString(), uno::Reference< uno::XInterface >(), ERRCODE_IO_ABORT );
}
- else if ( nStatusSave == STATUS_SAVE )
- {
- // Document properties can contain streams that should be freed before storing
- aModelData.FreeDocumentProps();
-
- if ( aModelData.GetStorable2().is() )
- {
- try
- {
- aModelData.GetStorable2()->storeSelf( aModelData.GetMediaDescr().getAsConstPropertyValueList() );
- }
- catch( lang::IllegalArgumentException& )
- {
- OSL_ENSURE( sal_False, "ModelData didn't handle illegal parameters, all the parameters are ignored!\n" );
- aModelData.GetStorable()->store();
- }
- }
- else
- {
- OSL_ENSURE( sal_False, "XStorable2 is not supported by the model!\n" );
- aModelData.GetStorable()->store();
- }
-
- return sal_False;
- }
- else
+ else if ( nStatusSave != STATUS_SAVE )
{
// this should be a usual SaveAs operation
nStoreMode = SAVEAS_REQUESTED;
@@ -1325,6 +1308,32 @@ sal_Bool SfxStoringHelper::GUIStoreModel( const uno::Reference< frame::XModel >&
}
}
+ if ( nStoreMode & SAVE_REQUESTED && nStatusSave == STATUS_SAVE )
+ {
+ // Document properties can contain streams that should be freed before storing
+ aModelData.FreeDocumentProps();
+
+ if ( aModelData.GetStorable2().is() )
+ {
+ try
+ {
+ aModelData.GetStorable2()->storeSelf( aModelData.GetMediaDescr().getAsConstPropertyValueList() );
+ }
+ catch( lang::IllegalArgumentException& )
+ {
+ OSL_ENSURE( sal_False, "ModelData didn't handle illegal parameters, all the parameters are ignored!\n" );
+ aModelData.GetStorable()->store();
+ }
+ }
+ else
+ {
+ OSL_ENSURE( sal_False, "XStorable2 is not supported by the model!\n" );
+ aModelData.GetStorable()->store();
+ }
+
+ return sal_False;
+ }
+
// preselect a filter for the storing process
uno::Sequence< beans::PropertyValue > aFilterProps = aModelData.GetPreselectedFilter_Impl( nStoreMode );
@@ -1419,13 +1428,13 @@ sal_Bool SfxStoringHelper::GUIStoreModel( const uno::Reference< frame::XModel >&
::rtl::OUString aSelFilterName = aModelData.GetMediaDescr().getUnpackedValueOrDefault(
aFilterNameString,
::rtl::OUString() );
- sal_Int8 nStatusSave = aModelData.CheckFilter( aSelFilterName );
- if ( nStatusSave == STATUS_SAVEAS_STANDARDNAME )
+ sal_Int8 nStatusFilterSave = aModelData.CheckFilter( aSelFilterName );
+ if ( nStatusFilterSave == STATUS_SAVEAS_STANDARDNAME )
{
// switch to best filter
bSetStandardName = sal_True;
}
- else if ( nStatusSave == STATUS_SAVE )
+ else if ( nStatusFilterSave == STATUS_SAVE )
{
// user confirmed alien filter or "good" filter is used
bExit = sal_True;
@@ -1570,8 +1579,10 @@ uno::Sequence< beans::PropertyValue > SfxStoringHelper::SearchForFilter(
uno::Reference< container::XEnumeration > xFilterEnum =
xFilterQuery->createSubSetEnumerationByProperties( aSearchRequest );
- // use the first filter that is found
+ // the first default filter will be taken,
+ // if there is no filter with flag default the first acceptable filter will be taken
if ( xFilterEnum.is() )
+ {
while ( xFilterEnum->hasMoreElements() )
{
uno::Sequence< beans::PropertyValue > aProps;
@@ -1582,11 +1593,17 @@ uno::Sequence< beans::PropertyValue > SfxStoringHelper::SearchForFilter(
(sal_Int32)0 );
if ( ( ( nFlags & nMustFlags ) == nMustFlags ) && !( nFlags & nDontFlags ) )
{
- aFilterProps = aProps;
- break;
+ if ( ( nFlags & SFX_FILTER_DEFAULT ) == SFX_FILTER_DEFAULT )
+ {
+ aFilterProps = aProps;
+ break;
+ }
+ else if ( !aFilterProps.getLength() )
+ aFilterProps = aProps;
}
}
}
+ }
return aFilterProps;
}
diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx
index 3cb2177833..af93a1217c 100644..100755
--- a/sfx2/source/doc/objmisc.cxx
+++ b/sfx2/source/doc/objmisc.cxx
@@ -1681,7 +1681,7 @@ namespace
}
ErrCode SfxObjectShell::CallXScript( const Reference< XInterface >& _rxScriptContext, const ::rtl::OUString& _rScriptURL,
- const Sequence< Any >& aParams, Any& aRet, Sequence< sal_Int16 >& aOutParamIndex, Sequence< Any >& aOutParam )
+ const Sequence< Any >& aParams, Any& aRet, Sequence< sal_Int16 >& aOutParamIndex, Sequence< Any >& aOutParam, bool bRaiseError )
{
OSL_TRACE( "in CallXScript" );
ErrCode nErr = ERRCODE_NONE;
@@ -1722,7 +1722,7 @@ ErrCode SfxObjectShell::CallXScript( const Reference< XInterface >& _rxScriptCon
nErr = ERRCODE_BASIC_INTERNAL_ERROR;
}
- if ( bCaughtException )
+ if ( bCaughtException && bRaiseError )
{
::std::auto_ptr< VclAbstractDialog > pScriptErrDlg;
SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
@@ -1745,10 +1745,10 @@ ErrCode SfxObjectShell::CallXScript( const String& rScriptURL,
aParams,
::com::sun::star::uno::Any& aRet,
::com::sun::star::uno::Sequence< sal_Int16 >& aOutParamIndex,
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >&
- aOutParam)
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aOutParam
+ , bool bRaiseError )
{
- return CallXScript( GetModel(), rScriptURL, aParams, aRet, aOutParamIndex, aOutParam );
+ return CallXScript( GetModel(), rScriptURL, aParams, aRet, aOutParamIndex, aOutParam, bRaiseError );
}
//-------------------------------------------------------------------------