[Libreoffice-commits] core.git: 2 commits - sw/qa sw/source
Miklos Vajna
vmiklos at collabora.co.uk
Sat Nov 8 05:09:29 PST 2014
sw/qa/extras/inc/swmodeltestbase.hxx | 84 -----------------------------------
sw/qa/extras/mailmerge/mailmerge.cxx | 84 +++++++++++++++++++++++++++++++++++
sw/source/ui/frmdlg/frmdlg.cxx | 2
sw/source/uibase/inc/frmpage.hxx | 4 -
4 files changed, 87 insertions(+), 87 deletions(-)
New commits:
commit 1da74e727d7f8703006cfe574b26621d5f674693
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Sat Nov 8 13:52:38 2014 +0100
CppunitTest_sw_mailmerge: move more methods from header file
Change-Id: Idecf7c2ec3b736ba1d9a2826773c95f26ef91990
diff --git a/sw/qa/extras/inc/swmodeltestbase.hxx b/sw/qa/extras/inc/swmodeltestbase.hxx
index 413d016..3452950 100644
--- a/sw/qa/extras/inc/swmodeltestbase.hxx
+++ b/sw/qa/extras/inc/swmodeltestbase.hxx
@@ -149,12 +149,6 @@ using namespace css;
CPPUNIT_TEST_SUITE_REGISTRATION(TestName); \
void TestName::verify()
-/**
- * Maps database URIs to the registered database names for quick lookups
- */
-typedef std::map<OUString, OUString> DBuriMap;
-DBuriMap aDBuriMap;
-
/// Base class for filter tests loading or roundtriping a document, then asserting the document model.
class SwModelTestBase : public test::BootstrapFixture, public unotest::MacrosTest, public XmlTestTools
{
@@ -802,84 +796,6 @@ protected:
xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("formx"), BAD_CAST("urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0"));
xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("css3t"), BAD_CAST("http://www.w3.org/TR/css3-text/"));
}
-
- virtual OUString registerDBsource( const OUString &aURI, const OUString &aWorkDir )
- {
- OUString aDBName;
- DBuriMap::const_iterator pos = aDBuriMap.find( aURI );
- if (pos == aDBuriMap.end())
- {
- aDBName = SwDBManager::LoadAndRegisterDataSource( aURI, NULL, &aWorkDir );
- aDBuriMap.insert( std::pair< OUString, OUString >( aURI, aDBName ) );
- std::cout << "New datasource name: '" << aDBName << "'" << std::endl;
- }
- else
- {
- aDBName = pos->second;
- std::cout << "Old datasource name: '" << aDBName << "'" << std::endl;
- }
- CPPUNIT_ASSERT(!aDBName.isEmpty());
- return aDBName;
- }
-
- virtual void initMailMergeJobAndArgs( const char* filename, const char* tablename, const OUString &aDBName,
- const OUString &aPrefix, const OUString &aWorkDir, bool file )
- {
- uno::Reference< task::XJob > xJob( getMultiServiceFactory()->createInstance( "com.sun.star.text.MailMerge" ), uno::UNO_QUERY_THROW );
- mxJob.set( xJob );
-
- int seq_id = 5;
- if (tablename) seq_id += 2;
- mSeqMailMergeArgs.realloc( seq_id );
-
- seq_id = 0;
- mSeqMailMergeArgs[ seq_id++ ] = beans::NamedValue( OUString( UNO_NAME_OUTPUT_TYPE ), uno::Any( file ? text::MailMergeType::FILE : text::MailMergeType::SHELL ) );
- mSeqMailMergeArgs[ seq_id++ ] = beans::NamedValue( OUString( UNO_NAME_DOCUMENT_URL ), uno::Any(
- ( OUString(getURLFromSrc(mpTestDocumentPath) + OUString::createFromAscii(filename)) ) ) );
- mSeqMailMergeArgs[ seq_id++ ] = beans::NamedValue( OUString( UNO_NAME_DATA_SOURCE_NAME ), uno::Any( aDBName ) );
- mSeqMailMergeArgs[ seq_id++ ] = beans::NamedValue( OUString( UNO_NAME_OUTPUT_URL ), uno::Any( aWorkDir ) );
- mSeqMailMergeArgs[ seq_id++ ] = beans::NamedValue( OUString( UNO_NAME_FILE_NAME_PREFIX ), uno::Any( aPrefix ));
- if (tablename)
- {
- mSeqMailMergeArgs[ seq_id++ ] = beans::NamedValue( OUString( UNO_NAME_DAD_COMMAND_TYPE ), uno::Any( sdb::CommandType::TABLE ) );
- mSeqMailMergeArgs[ seq_id++ ] = beans::NamedValue( OUString( UNO_NAME_DAD_COMMAND ), uno::Any( OUString::createFromAscii(tablename) ) );
- }
- }
-
- virtual void executeMailMerge()
- {
- uno::Any res = mxJob->execute( mSeqMailMergeArgs );
-
- const beans::NamedValue *pArguments = mSeqMailMergeArgs.getConstArray();
- bool bOk = true;
- sal_Int32 nArgs = mSeqMailMergeArgs.getLength();
-
- for (sal_Int32 i = 0; i < nArgs; ++i) {
- const OUString &rName = pArguments[i].Name;
- const uno::Any &rValue = pArguments[i].Value;
-
- // all error checking was already done by the MM job execution
- if (rName == UNO_NAME_OUTPUT_URL)
- bOk &= rValue >>= mailMergeOutputURL;
- else if (rName == UNO_NAME_FILE_NAME_PREFIX)
- bOk &= rValue >>= mailMergeOutputPrefix;
- else if (rName == UNO_NAME_OUTPUT_TYPE)
- bOk &= rValue >>= nCurOutputType;
- }
-
- CPPUNIT_ASSERT(bOk);
-
- if (nCurOutputType == text::MailMergeType::SHELL)
- {
- CPPUNIT_ASSERT(res >>= mxMMComponent);
- CPPUNIT_ASSERT(mxMMComponent.is());
- }
- else
- {
- CPPUNIT_ASSERT(res == true);
- loadMailMergeDocument( 0 );
- }
- }
};
/**
diff --git a/sw/qa/extras/mailmerge/mailmerge.cxx b/sw/qa/extras/mailmerge/mailmerge.cxx
index 15a4ea0..d17c835 100644
--- a/sw/qa/extras/mailmerge/mailmerge.cxx
+++ b/sw/qa/extras/mailmerge/mailmerge.cxx
@@ -31,6 +31,12 @@
#include <olmenu.hxx>
#include <cmdid.h>
+/**
+ * Maps database URIs to the registered database names for quick lookups
+ */
+typedef std::map<OUString, OUString> DBuriMap;
+DBuriMap aDBuriMap;
+
class MMTest : public SwModelTestBase
{
public:
@@ -64,6 +70,84 @@ public:
nCurOutputType = 0;
}
+ OUString registerDBsource( const OUString &aURI, const OUString &aWorkDir )
+ {
+ OUString aDBName;
+ DBuriMap::const_iterator pos = aDBuriMap.find( aURI );
+ if (pos == aDBuriMap.end())
+ {
+ aDBName = SwDBManager::LoadAndRegisterDataSource( aURI, NULL, &aWorkDir );
+ aDBuriMap.insert( std::pair< OUString, OUString >( aURI, aDBName ) );
+ std::cout << "New datasource name: '" << aDBName << "'" << std::endl;
+ }
+ else
+ {
+ aDBName = pos->second;
+ std::cout << "Old datasource name: '" << aDBName << "'" << std::endl;
+ }
+ CPPUNIT_ASSERT(!aDBName.isEmpty());
+ return aDBName;
+ }
+
+ void initMailMergeJobAndArgs( const char* filename, const char* tablename, const OUString &aDBName,
+ const OUString &aPrefix, const OUString &aWorkDir, bool file )
+ {
+ uno::Reference< task::XJob > xJob( getMultiServiceFactory()->createInstance( "com.sun.star.text.MailMerge" ), uno::UNO_QUERY_THROW );
+ mxJob.set( xJob );
+
+ int seq_id = 5;
+ if (tablename) seq_id += 2;
+ mSeqMailMergeArgs.realloc( seq_id );
+
+ seq_id = 0;
+ mSeqMailMergeArgs[ seq_id++ ] = beans::NamedValue( OUString( UNO_NAME_OUTPUT_TYPE ), uno::Any( file ? text::MailMergeType::FILE : text::MailMergeType::SHELL ) );
+ mSeqMailMergeArgs[ seq_id++ ] = beans::NamedValue( OUString( UNO_NAME_DOCUMENT_URL ), uno::Any(
+ ( OUString(getURLFromSrc(mpTestDocumentPath) + OUString::createFromAscii(filename)) ) ) );
+ mSeqMailMergeArgs[ seq_id++ ] = beans::NamedValue( OUString( UNO_NAME_DATA_SOURCE_NAME ), uno::Any( aDBName ) );
+ mSeqMailMergeArgs[ seq_id++ ] = beans::NamedValue( OUString( UNO_NAME_OUTPUT_URL ), uno::Any( aWorkDir ) );
+ mSeqMailMergeArgs[ seq_id++ ] = beans::NamedValue( OUString( UNO_NAME_FILE_NAME_PREFIX ), uno::Any( aPrefix ));
+ if (tablename)
+ {
+ mSeqMailMergeArgs[ seq_id++ ] = beans::NamedValue( OUString( UNO_NAME_DAD_COMMAND_TYPE ), uno::Any( sdb::CommandType::TABLE ) );
+ mSeqMailMergeArgs[ seq_id++ ] = beans::NamedValue( OUString( UNO_NAME_DAD_COMMAND ), uno::Any( OUString::createFromAscii(tablename) ) );
+ }
+ }
+
+ void executeMailMerge()
+ {
+ uno::Any res = mxJob->execute( mSeqMailMergeArgs );
+
+ const beans::NamedValue *pArguments = mSeqMailMergeArgs.getConstArray();
+ bool bOk = true;
+ sal_Int32 nArgs = mSeqMailMergeArgs.getLength();
+
+ for (sal_Int32 i = 0; i < nArgs; ++i) {
+ const OUString &rName = pArguments[i].Name;
+ const uno::Any &rValue = pArguments[i].Value;
+
+ // all error checking was already done by the MM job execution
+ if (rName == UNO_NAME_OUTPUT_URL)
+ bOk &= rValue >>= mailMergeOutputURL;
+ else if (rName == UNO_NAME_FILE_NAME_PREFIX)
+ bOk &= rValue >>= mailMergeOutputPrefix;
+ else if (rName == UNO_NAME_OUTPUT_TYPE)
+ bOk &= rValue >>= nCurOutputType;
+ }
+
+ CPPUNIT_ASSERT(bOk);
+
+ if (nCurOutputType == text::MailMergeType::SHELL)
+ {
+ CPPUNIT_ASSERT(res >>= mxMMComponent);
+ CPPUNIT_ASSERT(mxMMComponent.is());
+ }
+ else
+ {
+ CPPUNIT_ASSERT(res == true);
+ loadMailMergeDocument( 0 );
+ }
+ }
+
protected:
// Returns page number of the first page of a MM document inside the large MM document (used in the SHELL case).
int documentStartPageNumber( int document ) const;
commit 30f242e510e1a03cc47be115f4024a2e44f6db69
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Sat Nov 8 13:48:57 2014 +0100
SwFrmAddPage::SetFrmType: take an OUString
Change-Id: I0d18aeee953d07ae9287ec1bca7d8deca8453d88
diff --git a/sw/source/ui/frmdlg/frmdlg.cxx b/sw/source/ui/frmdlg/frmdlg.cxx
index 68257b0..4a4bdf7 100644
--- a/sw/source/ui/frmdlg/frmdlg.cxx
+++ b/sw/source/ui/frmdlg/frmdlg.cxx
@@ -153,7 +153,7 @@ void SwFrmDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage )
else if (nId == m_nAddId)
{
((SwFrmAddPage&)rPage).SetFormatUsed(m_bFormat);
- ((SwFrmAddPage&)rPage).SetFrmType(OUStringToOString(m_sDlgType, RTL_TEXTENCODING_UTF8));
+ ((SwFrmAddPage&)rPage).SetFrmType(m_sDlgType);
((SwFrmAddPage&)rPage).SetNewFrame(m_bNew);
((SwFrmAddPage&)rPage).SetShell(m_pWrtShell);
}
diff --git a/sw/source/uibase/inc/frmpage.hxx b/sw/source/uibase/inc/frmpage.hxx
index 556f7d1..e2eab71 100644
--- a/sw/source/uibase/inc/frmpage.hxx
+++ b/sw/source/uibase/inc/frmpage.hxx
@@ -294,7 +294,7 @@ class SwFrmAddPage : public SfxTabPage
SwWrtShell* pWrtSh;
- OString sDlgType;
+ OUString sDlgType;
bool bHtmlMode;
bool bFormat;
bool bNew;
@@ -314,7 +314,7 @@ public:
virtual void Reset(const SfxItemSet *rSet) SAL_OVERRIDE;
void SetFormatUsed(bool bFmt);
- void SetFrmType(const OString &rType) { sDlgType = rType; }
+ void SetFrmType(const OUString &rType) { sDlgType = rType; }
void SetNewFrame(bool bNewFrame) { bNew = bNewFrame; }
void SetShell(SwWrtShell* pSh) { pWrtSh = pSh; }
More information about the Libreoffice-commits
mailing list