[Libreoffice-commits] core.git: 4 commits - starmath/source sw/qa sw/source writerfilter/source
Miklos Vajna
vmiklos at collabora.co.uk
Sun Jun 7 22:58:39 PDT 2015
starmath/source/unofilter.cxx | 6
sw/qa/extras/ooxmlimport/data/tdf8255.docx |binary
sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 9
sw/source/filter/ww8/docxsdrexport.cxx | 1
sw/source/uibase/dbui/dbmgr.cxx | 520 +++++++++++------------
writerfilter/source/dmapper/NumberingManager.cxx | 36 -
writerfilter/source/dmapper/PropertyMap.cxx | 12
writerfilter/source/filter/WriterFilter.cxx | 1
writerfilter/source/rtftok/rtfdocumentimpl.cxx | 1
writerfilter/source/rtftok/rtftokenizer.cxx | 1
10 files changed, 284 insertions(+), 303 deletions(-)
New commits:
commit be8512f99bc9ab18e55aabe01cc0ab1e6baea9e6
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Mon Jun 8 07:57:42 2015 +0200
writerfilter: avoid manual realloc in ListDef::CreateNumberingRules()
Change-Id: Icc43c5236551b850908f631bca5583199415dd2c
diff --git a/writerfilter/source/dmapper/NumberingManager.cxx b/writerfilter/source/dmapper/NumberingManager.cxx
index 481dbdf..e7bc722 100644
--- a/writerfilter/source/dmapper/NumberingManager.cxx
+++ b/writerfilter/source/dmapper/NumberingManager.cxx
@@ -33,8 +33,8 @@
#include <osl/diagnose.h>
#include <rtl/ustring.hxx>
-#include <comphelper/sequenceashashmap.hxx>
#include <comphelper/sequence.hxx>
+#include <comphelper/propertyvalue.hxx>
using namespace com::sun::star;
@@ -573,11 +573,7 @@ void ListDef::CreateNumberingRules( DomainMapper& rDMapper,
ListLevel::Pointer pLevel = GetLevel( nLevel );
// Get the merged level properties
- uno::Sequence< beans::PropertyValue > aLvlProps = aProps[sal_Int32( nLevel )];
-
-#ifdef DEBUG_WRITERFILTER
- lcl_printProperties( aLvlProps );
-#endif
+ auto aLvlProps = comphelper::sequenceToContainer< std::vector<beans::PropertyValue> >(aProps[sal_Int32(nLevel)]);
// Get the char style
uno::Sequence< beans::PropertyValue > aAbsCharStyleProps = pAbsLevel->GetCharStyleProperties( );
@@ -602,9 +598,7 @@ void ListDef::CreateNumberingRules( DomainMapper& rDMapper,
//create (or find) a character style containing the character
// attributes of the symbol and apply it to the numbering level
OUString sStyle = rDMapper.getOrCreateCharStyle( aStyleProps );
- aLvlProps.realloc( aLvlProps.getLength() + 1);
- aLvlProps[sal::static_int_cast<sal_uInt32>(aLvlProps.getLength()) - 1].Name = aPropNameSupplier.GetName( PROP_CHAR_STYLE_NAME );
- aLvlProps[sal::static_int_cast<sal_uInt32>(aLvlProps.getLength()) - 1].Value <<= sStyle;
+ aLvlProps.push_back(comphelper::makePropertyValue(aPropNameSupplier.GetName(PROP_CHAR_STYLE_NAME), sStyle));
}
// Get the prefix / suffix / Parent numbering
@@ -621,31 +615,29 @@ void ListDef::CreateNumberingRules( DomainMapper& rDMapper,
sal_Int16 nParentNum = ListLevel::GetParentNumbering(
sText, nLevel, rPrefix, rSuffix );
- aLvlProps.realloc( aLvlProps.getLength( ) + 4 );
- aLvlProps[sal::static_int_cast<sal_uInt32>(aLvlProps.getLength()) - 4] = MAKE_PROPVAL( PROP_PREFIX, rPrefix );
+ aLvlProps.push_back(comphelper::makePropertyValue(aPropNameSupplier.GetName(PROP_PREFIX), rPrefix));
if (sText.isEmpty())
{
// Empty <w:lvlText>? Then put a Unicode "zero width space" as a suffix, so LabelFollowedBy is still shown, as in Word.
// With empty suffix, Writer does not show LabelFollowedBy, either.
- comphelper::SequenceAsHashMap aMap(aLvlProps);
- if (aMap.find("NumberingType") != aMap.end())
+ auto it = std::find_if(aLvlProps.begin(), aLvlProps.end(), [](const beans::PropertyValue& rValue) { return rValue.Name == "NumberingType"; });
+ if (it != aLvlProps.end())
{
- sal_Int16 nNumberFormat = aMap["NumberingType"].get<sal_Int16>();
+ sal_Int16 nNumberFormat = it->Value.get<sal_Int16>();
if (nNumberFormat == style::NumberingType::NUMBER_NONE)
rSuffix = OUString(static_cast<sal_Unicode>(0x200B));
}
}
- aLvlProps[sal::static_int_cast<sal_uInt32>(aLvlProps.getLength()) - 3] = MAKE_PROPVAL( PROP_SUFFIX, rSuffix );
- aLvlProps[sal::static_int_cast<sal_uInt32>(aLvlProps.getLength()) - 2] = MAKE_PROPVAL( PROP_PARENT_NUMBERING, nParentNum );
+ aLvlProps.push_back(comphelper::makePropertyValue(aPropNameSupplier.GetName(PROP_SUFFIX), rSuffix));
+ aLvlProps.push_back(comphelper::makePropertyValue(aPropNameSupplier.GetName(PROP_PARENT_NUMBERING), nParentNum));
- aLvlProps[sal::static_int_cast<sal_uInt32>(aLvlProps.getLength()) - 1] = MAKE_PROPVAL( PROP_POSITION_AND_SPACE_MODE,
- sal_Int16( text::PositionAndSpaceMode::LABEL_ALIGNMENT ) );
+ aLvlProps.push_back(comphelper::makePropertyValue(aPropNameSupplier.GetName(PROP_POSITION_AND_SPACE_MODE), sal_Int16(text::PositionAndSpaceMode::LABEL_ALIGNMENT)));
// Replace the numbering rules for the level
- m_xNumRules->replaceByIndex( nLevel, uno::makeAny( aLvlProps ) );
+ m_xNumRules->replaceByIndex(nLevel, uno::makeAny(comphelper::containerToSequence(aLvlProps)));
// Handle the outline level here
if ( pAbsLevel->isOutlineNumbering())
@@ -656,11 +648,9 @@ void ListDef::CreateNumberingRules( DomainMapper& rDMapper,
xOutlines->getChapterNumberingRules( );
StyleSheetEntryPtr pParaStyle = pAbsLevel->GetParaStyle( );
- aLvlProps.realloc( aLvlProps.getLength() + 1 );
- aLvlProps[sal::static_int_cast<sal_uInt32>(aLvlProps.getLength()) - 1] = MAKE_PROPVAL( PROP_HEADING_STYLE_NAME,
- pParaStyle->sConvertedStyleName );
+ aLvlProps.push_back(comphelper::makePropertyValue(aPropNameSupplier.GetName(PROP_HEADING_STYLE_NAME), pParaStyle->sConvertedStyleName));
- xOutlineRules->replaceByIndex( nLevel, uno::makeAny( aLvlProps ) );
+ xOutlineRules->replaceByIndex(nLevel, uno::makeAny(comphelper::containerToSequence(aLvlProps)));
}
nLevel++;
commit a15a816fc292eb841c294556de3dad221e8bbf66
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Mon Jun 8 07:52:38 2015 +0200
sw: clean up using namespace statements in dbmgr
Change-Id: I5072d8b24384982a445a4a1678d0269601206320
diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx
index a95fa52..f2c9e7a 100644
--- a/sw/source/uibase/dbui/dbmgr.cxx
+++ b/sw/source/uibase/dbui/dbmgr.cxx
@@ -144,23 +144,7 @@
#include <comphelper/propertysequence.hxx>
#include <officecfg/Office/Common.hxx>
-
-using namespace ::osl;
-using namespace ::svx;
-using namespace ::dbtools;
using namespace ::com::sun::star;
-using namespace ::com::sun::star::text;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::frame;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::sdb;
-using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::sdbcx;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::util;
-using namespace ::com::sun::star::task;
-using namespace ::com::sun::star::ui::dialogs;
#define DB_SEP_SPACE 0
#define DB_SEP_TAB 1
@@ -174,31 +158,29 @@ const sal_Char cDataSourceName[] = "DataSourceName";
const sal_Char cSelection[] = "Selection";
const sal_Char cActiveConnection[] = "ActiveConnection";
-// Use nameless namespace to avoid to rubbish the global namespace
-
namespace
{
-bool lcl_getCountFromResultSet( sal_Int32& rCount, const uno::Reference<XResultSet>& xResultSet )
+bool lcl_getCountFromResultSet( sal_Int32& rCount, const uno::Reference<sdbc::XResultSet>& xResultSet )
{
- uno::Reference<XPropertySet> xPrSet(xResultSet, UNO_QUERY);
+ uno::Reference<beans::XPropertySet> xPrSet(xResultSet, uno::UNO_QUERY);
if(xPrSet.is())
{
try
{
bool bFinal = false;
- Any aFinal = xPrSet->getPropertyValue("IsRowCountFinal");
+ uno::Any aFinal = xPrSet->getPropertyValue("IsRowCountFinal");
aFinal >>= bFinal;
if(!bFinal)
{
xResultSet->last();
xResultSet->first();
}
- Any aCount = xPrSet->getPropertyValue("RowCount");
+ uno::Any aCount = xPrSet->getPropertyValue("RowCount");
if( aCount >>= rCount )
return true;
}
- catch(const Exception&)
+ catch(const uno::Exception&)
{
}
}
@@ -212,7 +194,7 @@ class SwConnectionDisposedListener_Impl : public cppu::WeakImplHelper
private:
SwDBManager * m_pDBManager;
- virtual void SAL_CALL disposing( const EventObject& Source ) throw (RuntimeException, std::exception) SAL_OVERRIDE;
+ virtual void SAL_CALL disposing( const lang::EventObject& Source ) throw (uno::RuntimeException, std::exception) SAL_OVERRIDE;
public:
explicit SwConnectionDisposedListener_Impl(SwDBManager& rMgr);
@@ -240,25 +222,25 @@ struct SwDBManager_Impl
}
};
-static void lcl_InitNumberFormatter(SwDSParam& rParam, uno::Reference<XDataSource> xSource)
+static void lcl_InitNumberFormatter(SwDSParam& rParam, uno::Reference<sdbc::XDataSource> xSource)
{
- uno::Reference<XComponentContext> xContext = ::comphelper::getProcessComponentContext();
- rParam.xFormatter = uno::Reference<util::XNumberFormatter>(util::NumberFormatter::create(xContext), UNO_QUERY);
+ uno::Reference<uno::XComponentContext> xContext = ::comphelper::getProcessComponentContext();
+ rParam.xFormatter = uno::Reference<util::XNumberFormatter>(util::NumberFormatter::create(xContext), uno::UNO_QUERY);
if(!xSource.is())
xSource = SwDBManager::getDataSourceAsParent(rParam.xConnection, rParam.sDataSource);
- uno::Reference<XPropertySet> xSourceProps(xSource, UNO_QUERY);
+ uno::Reference<beans::XPropertySet> xSourceProps(xSource, uno::UNO_QUERY);
if(xSourceProps.is())
{
- Any aFormats = xSourceProps->getPropertyValue("NumberFormatsSupplier");
+ uno::Any aFormats = xSourceProps->getPropertyValue("NumberFormatsSupplier");
if(aFormats.hasValue())
{
- uno::Reference<XNumberFormatsSupplier> xSuppl;
+ uno::Reference<util::XNumberFormatsSupplier> xSuppl;
aFormats >>= xSuppl;
if(xSuppl.is())
{
- uno::Reference< XPropertySet > xSettings = xSuppl->getNumberFormatSettings();
- Any aNull = xSettings->getPropertyValue("NullDate");
+ uno::Reference< beans::XPropertySet > xSettings = xSuppl->getNumberFormatSettings();
+ uno::Any aNull = xSettings->getPropertyValue("NullDate");
aNull >>= rParam.aNullDate;
if(rParam.xFormatter.is())
rParam.xFormatter->attachNumberFormatsSupplier(xSuppl);
@@ -281,20 +263,20 @@ static bool lcl_MoveAbsolute(SwDSParam* pParam, long nAbsPos)
OSL_FAIL("no absolute positioning available");
}
}
- catch(const Exception&)
+ catch(const uno::Exception&)
{
}
return bRet;
}
static void lcl_GetColumnCnt(SwDSParam *pParam,
- const uno::Reference< XPropertySet > &rColumnProps,
+ const uno::Reference< beans::XPropertySet > &rColumnProps,
long nLanguage, OUString &rResult, double* pNumber)
{
SwDBFormatData aFormatData;
if(!pParam->xFormatter.is())
{
- uno::Reference<XDataSource> xSource = SwDBManager::getDataSourceAsParent(
+ uno::Reference<sdbc::XDataSource> xSource = SwDBManager::getDataSourceAsParent(
pParam->xConnection,pParam->sDataSource);
lcl_InitNumberFormatter(*pParam, xSource );
}
@@ -309,8 +291,8 @@ static void lcl_GetColumnCnt(SwDSParam *pParam,
static bool lcl_GetColumnCnt(SwDSParam* pParam, const OUString& rColumnName,
long nLanguage, OUString& rResult, double* pNumber)
{
- uno::Reference< XColumnsSupplier > xColsSupp( pParam->xResultSet, UNO_QUERY );
- uno::Reference<XNameAccess> xCols;
+ uno::Reference< sdbcx::XColumnsSupplier > xColsSupp( pParam->xResultSet, uno::UNO_QUERY );
+ uno::Reference<container::XNameAccess> xCols;
try
{
xCols = xColsSupp->getColumns();
@@ -320,8 +302,8 @@ static bool lcl_GetColumnCnt(SwDSParam* pParam, const OUString& rColumnName,
}
if(!xCols.is() || !xCols->hasByName(rColumnName))
return false;
- Any aCol = xCols->getByName(rColumnName);
- uno::Reference< XPropertySet > xColumnProps;
+ uno::Any aCol = xCols->getByName(rColumnName);
+ uno::Reference< beans::XPropertySet > xColumnProps;
aCol >>= xColumnProps;
lcl_GetColumnCnt( pParam, xColumnProps, nLanguage, rResult, pNumber );
return true;
@@ -333,21 +315,21 @@ bool SwDBManager::MergeNew( const SwMergeDescriptor& rMergeDesc, vcl::Window* pP
OSL_ENSURE(!bInMerge && !pImpl->pMergeData, "merge already activated!");
SwDBData aData;
- aData.nCommandType = CommandType::TABLE;
- uno::Reference<XResultSet> xResSet;
- Sequence<Any> aSelection;
- uno::Reference< XConnection> xConnection;
+ aData.nCommandType = sdb::CommandType::TABLE;
+ uno::Reference<sdbc::XResultSet> xResSet;
+ uno::Sequence<uno::Any> aSelection;
+ uno::Reference< sdbc::XConnection> xConnection;
aData.sDataSource = rMergeDesc.rDescriptor.getDataSource();
- rMergeDesc.rDescriptor[daCommand] >>= aData.sCommand;
- rMergeDesc.rDescriptor[daCommandType] >>= aData.nCommandType;
+ rMergeDesc.rDescriptor[svx::daCommand] >>= aData.sCommand;
+ rMergeDesc.rDescriptor[svx::daCommandType] >>= aData.nCommandType;
- if ( rMergeDesc.rDescriptor.has(daCursor) )
- rMergeDesc.rDescriptor[daCursor] >>= xResSet;
- if ( rMergeDesc.rDescriptor.has(daSelection) )
- rMergeDesc.rDescriptor[daSelection] >>= aSelection;
- if ( rMergeDesc.rDescriptor.has(daConnection) )
- rMergeDesc.rDescriptor[daConnection] >>= xConnection;
+ if ( rMergeDesc.rDescriptor.has(svx::daCursor) )
+ rMergeDesc.rDescriptor[svx::daCursor] >>= xResSet;
+ if ( rMergeDesc.rDescriptor.has(svx::daSelection) )
+ rMergeDesc.rDescriptor[svx::daSelection] >>= aSelection;
+ if ( rMergeDesc.rDescriptor.has(svx::daConnection) )
+ rMergeDesc.rDescriptor[svx::daConnection] >>= xConnection;
if(aData.sDataSource.isEmpty() || aData.sCommand.isEmpty() || !xResSet.is())
{
@@ -374,11 +356,11 @@ bool SwDBManager::MergeNew( const SwMergeDescriptor& rMergeDesc, vcl::Window* pP
aDataSourceParams.push_back(pInsert);
try
{
- uno::Reference<XComponent> xComponent(pInsert->xConnection, UNO_QUERY);
+ uno::Reference<lang::XComponent> xComponent(pInsert->xConnection, uno::UNO_QUERY);
if(xComponent.is())
xComponent->addEventListener(pImpl->m_xDisposeListener.get());
}
- catch(const Exception&)
+ catch(const uno::Exception&)
{
}
}
@@ -404,14 +386,14 @@ bool SwDBManager::MergeNew( const SwMergeDescriptor& rMergeDesc, vcl::Window* pP
pImpl->pMergeData->CheckEndOfDB();
}
}
- catch (const Exception& e)
+ catch (const uno::Exception& e)
{
pImpl->pMergeData->bEndOfDB = true;
pImpl->pMergeData->CheckEndOfDB();
SAL_WARN("sw.mailmerge", "exception in MergeNew(): " << e.Message);
}
- uno::Reference<XDataSource> xSource = SwDBManager::getDataSourceAsParent(xConnection,aData.sDataSource);
+ uno::Reference<sdbc::XDataSource> xSource = SwDBManager::getDataSourceAsParent(xConnection,aData.sDataSource);
lcl_InitNumberFormatter(*pImpl->pMergeData, xSource);
@@ -544,8 +526,8 @@ void SwDBManager::ImportDBEntry(SwWrtShell* pSh)
{
if(pImpl->pMergeData && !pImpl->pMergeData->bEndOfDB)
{
- uno::Reference< XColumnsSupplier > xColsSupp( pImpl->pMergeData->xResultSet, UNO_QUERY );
- uno::Reference<XNameAccess> xCols = xColsSupp->getColumns();
+ uno::Reference< sdbcx::XColumnsSupplier > xColsSupp( pImpl->pMergeData->xResultSet, uno::UNO_QUERY );
+ uno::Reference<container::XNameAccess> xCols = xColsSupp->getColumns();
OUString sFormatStr;
sal_uInt16 nFormatLen = sFormatStr.getLength();
if( nFormatLen )
@@ -559,8 +541,8 @@ void SwDBManager::ImportDBEntry(SwWrtShell* pSh)
{
if(!xCols->hasByName(sColumn))
return;
- Any aCol = xCols->getByName(sColumn);
- uno::Reference< XPropertySet > xColumnProp;
+ uno::Any aCol = xCols->getByName(sColumn);
+ uno::Reference< beans::XPropertySet > xColumnProp;
aCol >>= xColumnProp;
if(xColumnProp.is())
{
@@ -590,13 +572,13 @@ void SwDBManager::ImportDBEntry(SwWrtShell* pSh)
else
{
OUString sStr;
- Sequence<OUString> aColNames = xCols->getElementNames();
+ uno::Sequence<OUString> aColNames = xCols->getElementNames();
const OUString* pColNames = aColNames.getConstArray();
long nLength = aColNames.getLength();
for(long i = 0; i < nLength; i++)
{
- Any aCol = xCols->getByName(pColNames[i]);
- uno::Reference< XPropertySet > xColumnProp;
+ uno::Any aCol = xCols->getByName(pColNames[i]);
+ uno::Reference< beans::XPropertySet > xColumnProp;
aCol >>= xColumnProp;
SwDBFormatData aDBFormat;
sStr += GetDBField( xColumnProp, aDBFormat);
@@ -616,7 +598,7 @@ bool SwDBManager::GetTableNames(ListBox* pListBox, const OUString& rDBName)
OUString sOldTableName(pListBox->GetSelectEntry());
pListBox->Clear();
SwDSParam* pParam = FindDSConnection(rDBName, false);
- uno::Reference< XConnection> xConnection;
+ uno::Reference< sdbc::XConnection> xConnection;
if(pParam && pParam->xConnection.is())
xConnection = pParam->xConnection;
else
@@ -627,11 +609,11 @@ bool SwDBManager::GetTableNames(ListBox* pListBox, const OUString& rDBName)
}
if(xConnection.is())
{
- uno::Reference<XTablesSupplier> xTSupplier = uno::Reference<XTablesSupplier>(xConnection, UNO_QUERY);
+ uno::Reference<sdbcx::XTablesSupplier> xTSupplier = uno::Reference<sdbcx::XTablesSupplier>(xConnection, uno::UNO_QUERY);
if(xTSupplier.is())
{
- uno::Reference<XNameAccess> xTables = xTSupplier->getTables();
- Sequence<OUString> aTables = xTables->getElementNames();
+ uno::Reference<container::XNameAccess> xTables = xTSupplier->getTables();
+ uno::Sequence<OUString> aTables = xTables->getElementNames();
const OUString* pTables = aTables.getConstArray();
for(long i = 0; i < aTables.getLength(); i++)
{
@@ -639,11 +621,11 @@ bool SwDBManager::GetTableNames(ListBox* pListBox, const OUString& rDBName)
pListBox->SetEntryData(nEntry, (void*)0);
}
}
- uno::Reference<XQueriesSupplier> xQSupplier = uno::Reference<XQueriesSupplier>(xConnection, UNO_QUERY);
+ uno::Reference<sdb::XQueriesSupplier> xQSupplier = uno::Reference<sdb::XQueriesSupplier>(xConnection, uno::UNO_QUERY);
if(xQSupplier.is())
{
- uno::Reference<XNameAccess> xQueries = xQSupplier->getQueries();
- Sequence<OUString> aQueries = xQueries->getElementNames();
+ uno::Reference<container::XNameAccess> xQueries = xQSupplier->getQueries();
+ uno::Sequence<OUString> aQueries = xQueries->getElementNames();
const OUString* pQueries = aQueries.getConstArray();
for(long i = 0; i < aQueries.getLength(); i++)
{
@@ -669,7 +651,7 @@ void SwDBManager::GetColumnNames(ListBox* pListBox,
aData.sCommand = rTableName;
aData.nCommandType = -1;
SwDSParam* pParam = FindDSData(aData, false);
- uno::Reference< XConnection> xConnection;
+ uno::Reference< sdbc::XConnection> xConnection;
if(pParam && pParam->xConnection.is())
xConnection = pParam->xConnection;
else
@@ -677,11 +659,11 @@ void SwDBManager::GetColumnNames(ListBox* pListBox,
OUString sDBName(rDBName);
xConnection = RegisterConnection( sDBName );
}
- uno::Reference< XColumnsSupplier> xColsSupp = SwDBManager::GetColumnSupplier(xConnection, rTableName);
+ uno::Reference< sdbcx::XColumnsSupplier> xColsSupp = SwDBManager::GetColumnSupplier(xConnection, rTableName);
if(xColsSupp.is())
{
- uno::Reference<XNameAccess> xCols = xColsSupp->getColumns();
- const Sequence<OUString> aColNames = xCols->getElementNames();
+ uno::Reference<container::XNameAccess> xCols = xColsSupp->getColumns();
+ const uno::Sequence<OUString> aColNames = xCols->getElementNames();
const OUString* pColNames = aColNames.getConstArray();
for(int nCol = 0; nCol < aColNames.getLength(); nCol++)
{
@@ -692,16 +674,16 @@ void SwDBManager::GetColumnNames(ListBox* pListBox,
}
void SwDBManager::GetColumnNames(ListBox* pListBox,
- uno::Reference< XConnection> xConnection,
+ uno::Reference< sdbc::XConnection> xConnection,
const OUString& rTableName, bool bAppend)
{
if (!bAppend)
pListBox->Clear();
- uno::Reference< XColumnsSupplier> xColsSupp = SwDBManager::GetColumnSupplier(xConnection, rTableName);
+ uno::Reference< sdbcx::XColumnsSupplier> xColsSupp = SwDBManager::GetColumnSupplier(xConnection, rTableName);
if(xColsSupp.is())
{
- uno::Reference<XNameAccess> xCols = xColsSupp->getColumns();
- const Sequence<OUString> aColNames = xCols->getElementNames();
+ uno::Reference<container::XNameAccess> xCols = xColsSupp->getColumns();
+ const uno::Sequence<OUString> aColNames = xCols->getElementNames();
const OUString* pColNames = aColNames.getConstArray();
for(int nCol = 0; nCol < aColNames.getLength(); nCol++)
{
@@ -732,11 +714,11 @@ SwDBManager::~SwDBManager()
{
try
{
- uno::Reference<XComponent> xComp(pParam->xConnection, UNO_QUERY);
+ uno::Reference<lang::XComponent> xComp(pParam->xConnection, uno::UNO_QUERY);
if(xComp.is())
xComp->dispose();
}
- catch(const RuntimeException&)
+ catch(const uno::RuntimeException&)
{
//may be disposed already since multiple entries may have used the same connection
}
@@ -878,17 +860,17 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell,
sBodyMimeType = "text/plain; charset=UTF-8; format=flowed";
}
- uno::Reference< XPropertySet > xColumnProp;
+ uno::Reference< beans::XPropertySet > xColumnProp;
{
bool bColumnName = !sEMailAddrField.isEmpty();
if (bColumnName)
{
- uno::Reference< XColumnsSupplier > xColsSupp( pImpl->pMergeData->xResultSet, UNO_QUERY );
- uno::Reference<XNameAccess> xCols = xColsSupp->getColumns();
+ uno::Reference< sdbcx::XColumnsSupplier > xColsSupp( pImpl->pMergeData->xResultSet, uno::UNO_QUERY );
+ uno::Reference<container::XNameAccess> xCols = xColsSupp->getColumns();
if(!xCols->hasByName(sEMailAddrField))
return false;
- Any aCol = xCols->getByName(sEMailAddrField);
+ uno::Any aCol = xCols->getByName(sEMailAddrField);
aCol >>= xColumnProp;
}
@@ -1150,7 +1132,7 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell,
const SwXMailMerge *pEvtSrc = GetMailMergeEvtSrc();
if(pEvtSrc)
{
- uno::Reference< XInterface > xRef( (XMailMergeBroadcaster *) pEvtSrc );
+ uno::Reference< uno::XInterface > xRef( (text::XMailMergeBroadcaster *) pEvtSrc );
text::MailMergeEvent aEvt( xRef, xWorkDocSh->GetModel() );
pEvtSrc->LaunchMailMergeEvent( aEvt );
}
@@ -1262,7 +1244,7 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell,
if(pStoreToFilterOptions )
pDstMed->GetItemSet()->Put(SfxStringItem(SID_FILE_FILTEROPTIONS, *pStoreToFilterOptions));
if(rMergeDescriptor.aSaveToFilterData.getLength())
- pDstMed->GetItemSet()->Put(SfxUsrAnyItem(SID_FILTER_DATA, makeAny(rMergeDescriptor.aSaveToFilterData)));
+ pDstMed->GetItemSet()->Put(SfxUsrAnyItem(SID_FILTER_DATA, uno::makeAny(rMergeDescriptor.aSaveToFilterData)));
}
//convert fields to text if we are exporting to PDF
@@ -1437,7 +1419,7 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell,
if(pStoreToFilterOptions )
pDstMed->GetItemSet()->Put(SfxStringItem(SID_FILE_FILTEROPTIONS, *pStoreToFilterOptions));
if(rMergeDescriptor.aSaveToFilterData.getLength())
- pDstMed->GetItemSet()->Put(SfxUsrAnyItem(SID_FILTER_DATA, makeAny(rMergeDescriptor.aSaveToFilterData)));
+ pDstMed->GetItemSet()->Put(SfxUsrAnyItem(SID_FILTER_DATA, uno::makeAny(rMergeDescriptor.aSaveToFilterData)));
}
xTargetDocShell->DoSaveAs(*pDstMed);
@@ -1533,10 +1515,10 @@ sal_uLong SwDBManager::GetColumnFormat( const OUString& rDBName,
sal_uLong nRet = 0;
if(pNFormatr)
{
- uno::Reference< XDataSource> xSource;
- uno::Reference< XConnection> xConnection;
+ uno::Reference< sdbc::XDataSource> xSource;
+ uno::Reference< sdbc::XConnection> xConnection;
bool bUseMergeData = false;
- uno::Reference< XColumnsSupplier> xColsSupp;
+ uno::Reference< sdbcx::XColumnsSupplier> xColsSupp;
bool bDisposeConnection = false;
if(pImpl->pMergeData &&
pImpl->pMergeData->sDataSource.equals(rDBName) && pImpl->pMergeData->sCommand.equals(rTableName))
@@ -1574,19 +1556,19 @@ sal_uLong SwDBManager::GetColumnFormat( const OUString& rDBName,
}
if(xColsSupp.is())
{
- uno::Reference<XNameAccess> xCols;
+ uno::Reference<container::XNameAccess> xCols;
try
{
xCols = xColsSupp->getColumns();
}
- catch (const Exception& e)
+ catch (const uno::Exception& e)
{
SAL_WARN("sw.mailmerge", "Exception in getColumns(): " << e.Message);
}
if(!xCols.is() || !xCols->hasByName(rColNm))
return nRet;
- Any aCol = xCols->getByName(rColNm);
- uno::Reference< XPropertySet > xColumn;
+ uno::Any aCol = xCols->getByName(rColNm);
+ uno::Reference< beans::XPropertySet > xColumn;
aCol >>= xColumn;
nRet = GetColumnFormat(xSource, xConnection, xColumn, pNFormatr, nLanguage);
if(bDispose)
@@ -1604,9 +1586,9 @@ sal_uLong SwDBManager::GetColumnFormat( const OUString& rDBName,
return nRet;
}
-sal_uLong SwDBManager::GetColumnFormat( uno::Reference< XDataSource> xSource,
- uno::Reference< XConnection> xConnection,
- uno::Reference< XPropertySet> xColumn,
+sal_uLong SwDBManager::GetColumnFormat( uno::Reference< sdbc::XDataSource> xSource,
+ uno::Reference< sdbc::XConnection> xConnection,
+ uno::Reference< beans::XPropertySet> xColumn,
SvNumberFormatter* pNFormatr,
long nLanguage )
{
@@ -1615,28 +1597,28 @@ sal_uLong SwDBManager::GetColumnFormat( uno::Reference< XDataSource> xSource,
if(!xSource.is())
{
- uno::Reference<XChild> xChild(xConnection, UNO_QUERY);
+ uno::Reference<container::XChild> xChild(xConnection, uno::UNO_QUERY);
if ( xChild.is() )
- xSource = uno::Reference<XDataSource>(xChild->getParent(), UNO_QUERY);
+ xSource = uno::Reference<sdbc::XDataSource>(xChild->getParent(), uno::UNO_QUERY);
}
if(xSource.is() && xConnection.is() && xColumn.is() && pNFormatr)
{
SvNumberFormatsSupplierObj* pNumFormat = new SvNumberFormatsSupplierObj( pNFormatr );
uno::Reference< util::XNumberFormatsSupplier > xDocNumFormatsSupplier = pNumFormat;
- uno::Reference< XNumberFormats > xDocNumberFormats = xDocNumFormatsSupplier->getNumberFormats();
- uno::Reference< XNumberFormatTypes > xDocNumberFormatTypes(xDocNumberFormats, UNO_QUERY);
+ uno::Reference< util::XNumberFormats > xDocNumberFormats = xDocNumFormatsSupplier->getNumberFormats();
+ uno::Reference< util::XNumberFormatTypes > xDocNumberFormatTypes(xDocNumberFormats, uno::UNO_QUERY);
com::sun::star::lang::Locale aLocale( LanguageTag( (LanguageType)nLanguage ).getLocale());
//get the number formatter of the data source
- uno::Reference<XPropertySet> xSourceProps(xSource, UNO_QUERY);
- uno::Reference< XNumberFormats > xNumberFormats;
+ uno::Reference<beans::XPropertySet> xSourceProps(xSource, uno::UNO_QUERY);
+ uno::Reference< util::XNumberFormats > xNumberFormats;
if(xSourceProps.is())
{
- Any aFormats = xSourceProps->getPropertyValue("NumberFormatsSupplier");
+ uno::Any aFormats = xSourceProps->getPropertyValue("NumberFormatsSupplier");
if(aFormats.hasValue())
{
- uno::Reference<XNumberFormatsSupplier> xSuppl;
+ uno::Reference<util::XNumberFormatsSupplier> xSuppl;
aFormats >>= xSuppl;
if(xSuppl.is())
{
@@ -1647,7 +1629,7 @@ sal_uLong SwDBManager::GetColumnFormat( uno::Reference< XDataSource> xSource,
bool bUseDefault = true;
try
{
- Any aFormatKey = xColumn->getPropertyValue("FormatKey");
+ uno::Any aFormatKey = xColumn->getPropertyValue("FormatKey");
if(aFormatKey.hasValue())
{
sal_Int32 nFormat = 0;
@@ -1656,9 +1638,9 @@ sal_uLong SwDBManager::GetColumnFormat( uno::Reference< XDataSource> xSource,
{
try
{
- uno::Reference<XPropertySet> xNumProps = xNumberFormats->getByKey( nFormat );
- Any aFormatString = xNumProps->getPropertyValue("FormatString");
- Any aLocaleVal = xNumProps->getPropertyValue("Locale");
+ uno::Reference<beans::XPropertySet> xNumProps = xNumberFormats->getByKey( nFormat );
+ uno::Any aFormatString = xNumProps->getPropertyValue("FormatString");
+ uno::Any aLocaleVal = xNumProps->getPropertyValue("Locale");
OUString sFormat;
aFormatString >>= sFormat;
lang::Locale aLoc;
@@ -1669,19 +1651,19 @@ sal_uLong SwDBManager::GetColumnFormat( uno::Reference< XDataSource> xSource,
nRet = nFormat;
bUseDefault = false;
}
- catch (const Exception& e)
+ catch (const uno::Exception& e)
{
SAL_WARN("sw.mailmerge", "illegal number format key: " << e.Message);
}
}
}
}
- catch(const Exception&)
+ catch(const uno::Exception&)
{
SAL_WARN("sw.mailmerge", "no FormatKey property found");
}
if(bUseDefault)
- nRet = getDefaultNumberFormat(xColumn, xDocNumberFormatTypes, aLocale);
+ nRet = dbtools::getDefaultNumberFormat(xColumn, xDocNumberFormatTypes, aLocale);
}
return nRet;
}
@@ -1690,19 +1672,19 @@ sal_Int32 SwDBManager::GetColumnType( const OUString& rDBName,
const OUString& rTableName,
const OUString& rColNm )
{
- sal_Int32 nRet = DataType::SQLNULL;
+ sal_Int32 nRet = sdbc::DataType::SQLNULL;
SwDBData aData;
aData.sDataSource = rDBName;
aData.sCommand = rTableName;
aData.nCommandType = -1;
SwDSParam* pParam = FindDSData(aData, false);
- uno::Reference< XConnection> xConnection;
- uno::Reference< XColumnsSupplier > xColsSupp;
+ uno::Reference< sdbc::XConnection> xConnection;
+ uno::Reference< sdbcx::XColumnsSupplier > xColsSupp;
bool bDispose = false;
if(pParam && pParam->xConnection.is())
{
xConnection = pParam->xConnection;
- xColsSupp = uno::Reference< XColumnsSupplier >( pParam->xResultSet, UNO_QUERY );
+ xColsSupp = uno::Reference< sdbcx::XColumnsSupplier >( pParam->xResultSet, uno::UNO_QUERY );
}
else
{
@@ -1716,13 +1698,13 @@ sal_Int32 SwDBManager::GetColumnType( const OUString& rDBName,
}
if(xColsSupp.is())
{
- uno::Reference<XNameAccess> xCols = xColsSupp->getColumns();
+ uno::Reference<container::XNameAccess> xCols = xColsSupp->getColumns();
if(xCols->hasByName(rColNm))
{
- Any aCol = xCols->getByName(rColNm);
- uno::Reference<XPropertySet> xCol;
+ uno::Any aCol = xCols->getByName(rColNm);
+ uno::Reference<beans::XPropertySet> xCol;
aCol >>= xCol;
- Any aType = xCol->getPropertyValue("Type");
+ uno::Any aType = xCol->getPropertyValue("Type");
aType >>= nRet;
}
if(bDispose)
@@ -1732,21 +1714,21 @@ sal_Int32 SwDBManager::GetColumnType( const OUString& rDBName,
}
uno::Reference< sdbc::XConnection> SwDBManager::GetConnection(const OUString& rDataSource,
- uno::Reference<XDataSource>& rxSource)
+ uno::Reference<sdbc::XDataSource>& rxSource)
{
- Reference< sdbc::XConnection> xConnection;
- Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
+ uno::Reference< sdbc::XConnection> xConnection;
+ uno::Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
try
{
- Reference<XCompletedConnection> xComplConnection(getDataSource(rDataSource, xContext),UNO_QUERY);
+ uno::Reference<sdb::XCompletedConnection> xComplConnection(dbtools::getDataSource(rDataSource, xContext), uno::UNO_QUERY);
if ( xComplConnection.is() )
{
- rxSource.set(xComplConnection,UNO_QUERY);
- Reference< XInteractionHandler > xHandler( InteractionHandler::createWithParent(xContext, 0), UNO_QUERY_THROW );
+ rxSource.set(xComplConnection, uno::UNO_QUERY);
+ uno::Reference< task::XInteractionHandler > xHandler( task::InteractionHandler::createWithParent(xContext, 0), uno::UNO_QUERY_THROW );
xConnection = xComplConnection->connectWithCompletion( xHandler );
}
}
- catch(const Exception&)
+ catch(const uno::Exception&)
{
}
@@ -1757,41 +1739,41 @@ uno::Reference< sdbcx::XColumnsSupplier> SwDBManager::GetColumnSupplier(uno::Ref
const OUString& rTableOrQuery,
SwDBSelect eTableOrQuery)
{
- Reference< sdbcx::XColumnsSupplier> xRet;
+ uno::Reference< sdbcx::XColumnsSupplier> xRet;
try
{
if(eTableOrQuery == SwDBSelect::UNKNOWN)
{
//search for a table with the given command name
- Reference<XTablesSupplier> xTSupplier = Reference<XTablesSupplier>(xConnection, UNO_QUERY);
+ uno::Reference<sdbcx::XTablesSupplier> xTSupplier = uno::Reference<sdbcx::XTablesSupplier>(xConnection, uno::UNO_QUERY);
if(xTSupplier.is())
{
- Reference<XNameAccess> xTables = xTSupplier->getTables();
+ uno::Reference<container::XNameAccess> xTables = xTSupplier->getTables();
eTableOrQuery = xTables->hasByName(rTableOrQuery) ?
SwDBSelect::TABLE : SwDBSelect::QUERY;
}
}
sal_Int32 nCommandType = SwDBSelect::TABLE == eTableOrQuery ?
- CommandType::TABLE : CommandType::QUERY;
- Reference< XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() );
- Reference<XRowSet> xRowSet(xMgr->createInstance("com.sun.star.sdb.RowSet"), UNO_QUERY);
+ sdb::CommandType::TABLE : sdb::CommandType::QUERY;
+ uno::Reference< lang::XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() );
+ uno::Reference<sdbc::XRowSet> xRowSet(xMgr->createInstance("com.sun.star.sdb.RowSet"), uno::UNO_QUERY);
OUString sDataSource;
- Reference<XDataSource> xSource = SwDBManager::getDataSourceAsParent(xConnection, sDataSource);
- Reference<XPropertySet> xSourceProperties(xSource, UNO_QUERY);
+ uno::Reference<sdbc::XDataSource> xSource = SwDBManager::getDataSourceAsParent(xConnection, sDataSource);
+ uno::Reference<beans::XPropertySet> xSourceProperties(xSource, uno::UNO_QUERY);
if(xSourceProperties.is())
{
xSourceProperties->getPropertyValue("Name") >>= sDataSource;
}
- Reference<XPropertySet> xRowProperties(xRowSet, UNO_QUERY);
- xRowProperties->setPropertyValue("DataSourceName", makeAny(sDataSource));
- xRowProperties->setPropertyValue("Command", makeAny(OUString(rTableOrQuery)));
- xRowProperties->setPropertyValue("CommandType", makeAny(nCommandType));
- xRowProperties->setPropertyValue("FetchSize", makeAny((sal_Int32)10));
- xRowProperties->setPropertyValue("ActiveConnection", makeAny(xConnection));
+ uno::Reference<beans::XPropertySet> xRowProperties(xRowSet, uno::UNO_QUERY);
+ xRowProperties->setPropertyValue("DataSourceName", uno::makeAny(sDataSource));
+ xRowProperties->setPropertyValue("Command", uno::makeAny(OUString(rTableOrQuery)));
+ xRowProperties->setPropertyValue("CommandType", uno::makeAny(nCommandType));
+ xRowProperties->setPropertyValue("FetchSize", uno::makeAny((sal_Int32)10));
+ xRowProperties->setPropertyValue("ActiveConnection", uno::makeAny(xConnection));
xRowSet->execute();
- xRet = Reference<XColumnsSupplier>( xRowSet, UNO_QUERY );
+ xRet = uno::Reference<sdbcx::XColumnsSupplier>( xRowSet, uno::UNO_QUERY );
}
catch (const uno::Exception& e)
{
@@ -1801,52 +1783,52 @@ uno::Reference< sdbcx::XColumnsSupplier> SwDBManager::GetColumnSupplier(uno::Ref
return xRet;
}
-OUString SwDBManager::GetDBField(uno::Reference<XPropertySet> xColumnProps,
+OUString SwDBManager::GetDBField(uno::Reference<beans::XPropertySet> xColumnProps,
const SwDBFormatData& rDBFormatData,
double* pNumber)
{
- uno::Reference< XColumn > xColumn(xColumnProps, UNO_QUERY);
+ uno::Reference< sdb::XColumn > xColumn(xColumnProps, uno::UNO_QUERY);
OUString sRet;
OSL_ENSURE(xColumn.is(), "SwDBManager::::ImportDBField: illegal arguments");
if(!xColumn.is())
return sRet;
- Any aType = xColumnProps->getPropertyValue("Type");
- sal_Int32 eDataType = DataType::SQLNULL;
+ uno::Any aType = xColumnProps->getPropertyValue("Type");
+ sal_Int32 eDataType = sdbc::DataType::SQLNULL;
aType >>= eDataType;
switch(eDataType)
{
- case DataType::CHAR:
- case DataType::VARCHAR:
- case DataType::LONGVARCHAR:
+ case sdbc::DataType::CHAR:
+ case sdbc::DataType::VARCHAR:
+ case sdbc::DataType::LONGVARCHAR:
try
{
sRet = xColumn->getString();
sRet = sRet.replace( '\xb', '\n' ); // MSWord uses \xb as a newline
}
- catch(const SQLException&)
+ catch(const sdbc::SQLException&)
{
}
break;
- case DataType::BIT:
- case DataType::BOOLEAN:
- case DataType::TINYINT:
- case DataType::SMALLINT:
- case DataType::INTEGER:
- case DataType::BIGINT:
- case DataType::FLOAT:
- case DataType::REAL:
- case DataType::DOUBLE:
- case DataType::NUMERIC:
- case DataType::DECIMAL:
- case DataType::DATE:
- case DataType::TIME:
- case DataType::TIMESTAMP:
+ case sdbc::DataType::BIT:
+ case sdbc::DataType::BOOLEAN:
+ case sdbc::DataType::TINYINT:
+ case sdbc::DataType::SMALLINT:
+ case sdbc::DataType::INTEGER:
+ case sdbc::DataType::BIGINT:
+ case sdbc::DataType::FLOAT:
+ case sdbc::DataType::REAL:
+ case sdbc::DataType::DOUBLE:
+ case sdbc::DataType::NUMERIC:
+ case sdbc::DataType::DECIMAL:
+ case sdbc::DataType::DATE:
+ case sdbc::DataType::TIME:
+ case sdbc::DataType::TIMESTAMP:
{
try
{
- sRet = DBTypeConversion::getFormattedValue(
+ sRet = dbtools::DBTypeConversion::getFormattedValue(
xColumnProps,
rDBFormatData.xFormatter,
rDBFormatData.aLocale,
@@ -1860,7 +1842,7 @@ OUString SwDBManager::GetDBField(uno::Reference<XPropertySet> xColumnProps,
}
}
}
- catch (const Exception& e)
+ catch (const uno::Exception& e)
{
SAL_WARN("sw.mailmerge", "exception caught: " << e.Message);
}
@@ -1926,7 +1908,7 @@ bool SwDBManager::GetColumnCnt(const OUString& rSourceName, const OUString& rTab
if(pFound->aSelection.getLength())
{
//the destination has to be an element of the selection
- const Any* pSelection = pFound->aSelection.getConstArray();
+ const uno::Any* pSelection = pFound->aSelection.getConstArray();
bool bFound = false;
for(sal_Int32 nPos = 0; !bFound && nPos < pFound->aSelection.getLength(); nPos++)
{
@@ -1945,7 +1927,7 @@ bool SwDBManager::GetColumnCnt(const OUString& rSourceName, const OUString& rTab
{
nOldRow = pFound->xResultSet->getRow();
}
- catch(const Exception&)
+ catch(const uno::Exception&)
{
return false;
}
@@ -1989,11 +1971,11 @@ bool SwDBManager::FillCalcWithMergeData( SvNumberFormatter *pDocFormatter,
if (!(pImpl->pMergeData && pImpl->pMergeData->xResultSet.is()))
return false;
- uno::Reference< XColumnsSupplier > xColsSupp( pImpl->pMergeData->xResultSet, UNO_QUERY );
+ uno::Reference< sdbcx::XColumnsSupplier > xColsSupp( pImpl->pMergeData->xResultSet, uno::UNO_QUERY );
if(xColsSupp.is())
{
- uno::Reference<XNameAccess> xCols = xColsSupp->getColumns();
- const Sequence<OUString> aColNames = xCols->getElementNames();
+ uno::Reference<container::XNameAccess> xCols = xColsSupp->getColumns();
+ const uno::Sequence<OUString> aColNames = xCols->getElementNames();
const OUString* pColNames = aColNames.getConstArray();
OUString aString;
@@ -2011,11 +1993,11 @@ bool SwDBManager::FillCalcWithMergeData( SvNumberFormatter *pDocFormatter,
}
// get the column type
- sal_Int32 nColumnType = DataType::SQLNULL;
- Any aCol = xCols->getByName( pColNames[nCol] );
- uno::Reference<XPropertySet> xColumnProps;
+ sal_Int32 nColumnType = sdbc::DataType::SQLNULL;
+ uno::Any aCol = xCols->getByName( pColNames[nCol] );
+ uno::Reference<beans::XPropertySet> xColumnProps;
aCol >>= xColumnProps;
- Any aType = xColumnProps->getPropertyValue( "Type" );
+ uno::Any aType = xColumnProps->getPropertyValue( "Type" );
aType >>= nColumnType;
double aNumber = DBL_MAX;
@@ -2110,7 +2092,7 @@ bool SwDBManager::ToNextRecord(SwDSParam* pParam)
++pParam->nSelectionIndex;
}
}
- catch(const Exception&)
+ catch(const uno::Exception&)
{
}
return bRet;
@@ -2134,7 +2116,7 @@ sal_uInt32 SwDBManager::GetSelectedRecordId()
{
nRet = pImpl->pMergeData->xResultSet->getRow();
}
- catch(const Exception&)
+ catch(const uno::Exception&)
{
}
return nRet;
@@ -2166,11 +2148,11 @@ bool SwDBManager::OpenDataSource(const OUString& rDataSource, const OUString& rT
aData.nCommandType = nCommandType;
SwDSParam* pFound = FindDSData(aData, true);
- uno::Reference< XDataSource> xSource;
+ uno::Reference< sdbc::XDataSource> xSource;
if(pFound->xResultSet.is())
return true;
SwDSParam* pParam = FindDSConnection(rDataSource, false);
- uno::Reference< XConnection> xConnection;
+ uno::Reference< sdbc::XConnection> xConnection;
if(pParam && pParam->xConnection.is())
pFound->xConnection = pParam->xConnection;
else if(bCreate)
@@ -2186,9 +2168,9 @@ bool SwDBManager::OpenDataSource(const OUString& rDataSource, const OUString& rT
try
{
pFound->bScrollable = xMetaData
- ->supportsResultSetType((sal_Int32)ResultSetType::SCROLL_INSENSITIVE);
+ ->supportsResultSetType((sal_Int32)sdbc::ResultSetType::SCROLL_INSENSITIVE);
}
- catch(const Exception&)
+ catch(const uno::Exception&)
{
// DB driver may not be ODBC 3.0 compliant
pFound->bScrollable = true;
@@ -2208,7 +2190,7 @@ bool SwDBManager::OpenDataSource(const OUString& rDataSource, const OUString& rT
pFound->CheckEndOfDB();
++pFound->nSelectionIndex;
}
- catch (const Exception&)
+ catch (const uno::Exception&)
{
pFound->xResultSet = 0;
pFound->xStatement = 0;
@@ -2218,20 +2200,20 @@ bool SwDBManager::OpenDataSource(const OUString& rDataSource, const OUString& rT
return pFound->xResultSet.is();
}
-uno::Reference< XConnection> SwDBManager::RegisterConnection(OUString& rDataSource)
+uno::Reference< sdbc::XConnection> SwDBManager::RegisterConnection(OUString& rDataSource)
{
SwDSParam* pFound = SwDBManager::FindDSConnection(rDataSource, true);
- uno::Reference< XDataSource> xSource;
+ uno::Reference< sdbc::XDataSource> xSource;
if(!pFound->xConnection.is())
{
pFound->xConnection = SwDBManager::GetConnection(rDataSource, xSource );
try
{
- uno::Reference<XComponent> xComponent(pFound->xConnection, UNO_QUERY);
+ uno::Reference<lang::XComponent> xComponent(pFound->xConnection, uno::UNO_QUERY);
if(xComponent.is())
xComponent->addEventListener(pImpl->m_xDisposeListener.get());
}
- catch(const Exception&)
+ catch(const uno::Exception&)
{
}
}
@@ -2270,7 +2252,7 @@ sal_uInt32 SwDBManager::GetSelectedRecordId(
else
nRet = pFound->xResultSet->getRow();
}
- catch(const Exception&)
+ catch(const uno::Exception&)
{
}
}
@@ -2296,7 +2278,7 @@ void SwDBManager::CloseAll(bool bIncludingMerge)
if(!bInMerge && pParam->xResultSet.is())
pParam->xResultSet->first();
}
- catch(const Exception&)
+ catch(const uno::Exception&)
{}
}
}
@@ -2339,11 +2321,11 @@ SwDSParam* SwDBManager::FindDSData(const SwDBData& rData, bool bCreate)
aDataSourceParams.push_back(pFound);
try
{
- uno::Reference<XComponent> xComponent(pFound->xConnection, UNO_QUERY);
+ uno::Reference<lang::XComponent> xComponent(pFound->xConnection, uno::UNO_QUERY);
if(xComponent.is())
xComponent->addEventListener(pImpl->m_xDisposeListener.get());
}
- catch(const Exception&)
+ catch(const uno::Exception&)
{
}
}
@@ -2376,11 +2358,11 @@ SwDSParam* SwDBManager::FindDSConnection(const OUString& rDataSource, bool bCre
aDataSourceParams.push_back(pFound);
try
{
- uno::Reference<XComponent> xComponent(pFound->xConnection, UNO_QUERY);
+ uno::Reference<lang::XComponent> xComponent(pFound->xConnection, uno::UNO_QUERY);
if(xComponent.is())
xComponent->addEventListener(pImpl->m_xDisposeListener.get());
}
- catch(const Exception&)
+ catch(const uno::Exception&)
{
}
}
@@ -2392,22 +2374,22 @@ const SwDBData& SwDBManager::GetAddressDBName()
return SW_MOD()->GetDBConfig()->GetAddressSource();
}
-Sequence<OUString> SwDBManager::GetExistingDatabaseNames()
+uno::Sequence<OUString> SwDBManager::GetExistingDatabaseNames()
{
- Reference<XComponentContext> xContext( ::comphelper::getProcessComponentContext() );
- Reference<XDatabaseContext> xDBContext = DatabaseContext::create(xContext);
+ uno::Reference<uno::XComponentContext> xContext( ::comphelper::getProcessComponentContext() );
+ uno::Reference<sdb::XDatabaseContext> xDBContext = sdb::DatabaseContext::create(xContext);
return xDBContext->getElementNames();
}
OUString SwDBManager::LoadAndRegisterDataSource(SwDocShell* pDocShell)
{
- sfx2::FileDialogHelper aDlgHelper( TemplateDescription::FILEOPEN_SIMPLE, 0 );
- Reference < XFilePicker > xFP = aDlgHelper.GetFilePicker();
+ sfx2::FileDialogHelper aDlgHelper( ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, 0 );
+ uno::Reference < ui::dialogs::XFilePicker > xFP = aDlgHelper.GetFilePicker();
OUString sHomePath(SvtPathOptions().GetWorkPath());
aDlgHelper.SetDisplayDirectory( sHomePath );
- Reference<XFilterManager> xFltMgr(xFP, UNO_QUERY);
+ uno::Reference<ui::dialogs::XFilterManager> xFltMgr(xFP, uno::UNO_QUERY);
OUString sFilterAll(SW_RES(STR_FILTER_ALL));
OUString sFilterAllData(SW_RES(STR_FILTER_ALL_DATA));
@@ -2439,14 +2421,14 @@ OUString SwDBManager::LoadAndRegisterDataSource(SwDocShell* pDocShell)
OUString sFind;
if( ERRCODE_NONE == aDlgHelper.Execute() )
{
- Any aURLAny;
+ uno::Any aURLAny;
uno::Reference< beans::XPropertySet > aSettings;
const OUString aURI( xFP->getFiles().getConstArray()[0] );
const DBConnURITypes type = GetDBunoURI( aURI, aURLAny );
if( DBCONN_FLAT == type )
{
- Reference<XComponentContext> xContext( ::comphelper::getProcessComponentContext() );
+ uno::Reference<uno::XComponentContext> xContext( ::comphelper::getProcessComponentContext() );
uno::Reference < sdb::XTextConnectionSettings > xSettingsDlg = sdb::TextConnectionSettings::create(xContext);
if( xSettingsDlg->execute() )
aSettings.set( uno::Reference < beans::XPropertySet >( xSettingsDlg, uno::UNO_QUERY_THROW ) );
@@ -2456,7 +2438,7 @@ OUString SwDBManager::LoadAndRegisterDataSource(SwDocShell* pDocShell)
return sFind;
}
-SwDBManager::DBConnURITypes SwDBManager::GetDBunoURI(const OUString &rURI, Any &aURLAny)
+SwDBManager::DBConnURITypes SwDBManager::GetDBunoURI(const OUString &rURI, uno::Any &aURLAny)
{
INetURLObject aURL( rURI );
OUString sExt( aURL.GetExtension() );
@@ -2526,17 +2508,17 @@ OUString lcl_getOwnURL(SwDocShell* pDocShell)
return aRet;
}
-OUString SwDBManager::LoadAndRegisterDataSource(const DBConnURITypes type, const Any &aURLAny, const uno::Reference< beans::XPropertySet > *pSettings,
+OUString SwDBManager::LoadAndRegisterDataSource(const DBConnURITypes type, const uno::Any &aURLAny, const uno::Reference< beans::XPropertySet > *pSettings,
const OUString &rURI, const OUString *pPrefix, const OUString *pDestDir, SwDocShell* pDocShell)
{
INetURLObject aURL( rURI );
OUString sExt( aURL.GetExtension() );
- Any aTableFilterAny;
- Any aSuppressVersionsAny;
- Any aInfoAny;
+ uno::Any aTableFilterAny;
+ uno::Any aSuppressVersionsAny;
+ uno::Any aInfoAny;
bool bStore = true;
OUString sFind;
- Sequence<OUString> aFilters(1);
+ uno::Sequence<OUString> aFilters(1);
switch (type) {
case DBCONN_UNKNOWN:
@@ -2553,14 +2535,14 @@ OUString SwDBManager::LoadAndRegisterDataSource(const DBConnURITypes type, const
break;
case DBCONN_MSJET:
case DBCONN_MSACE:
- aSuppressVersionsAny <<= makeAny(true);
+ aSuppressVersionsAny <<= uno::makeAny(true);
break;
}
try
{
- Reference<XComponentContext> xContext( ::comphelper::getProcessComponentContext() );
- Reference<XDatabaseContext> xDBContext = DatabaseContext::create(xContext);
+ uno::Reference<uno::XComponentContext> xContext( ::comphelper::getProcessComponentContext() );
+ uno::Reference<sdb::XDatabaseContext> xDBContext = sdb::DatabaseContext::create(xContext);
OUString sNewName = INetURLObject::decode( aURL.getName(),
INetURLObject::DECODE_UNAMBIGUOUS,
@@ -2579,17 +2561,17 @@ OUString SwDBManager::LoadAndRegisterDataSource(const DBConnURITypes type, const
sFind += OUString::number(++nIndex);
}
- Reference<XInterface> xNewInstance;
+ uno::Reference<uno::XInterface> xNewInstance;
if(!bStore)
{
//odb-file
- Any aDataSource = xDBContext->getByName(aURL.GetMainURL(INetURLObject::NO_DECODE));
+ uno::Any aDataSource = xDBContext->getByName(aURL.GetMainURL(INetURLObject::NO_DECODE));
aDataSource >>= xNewInstance;
}
else
{
xNewInstance = xDBContext->createInstance();
- Reference<XPropertySet> xDataProperties(xNewInstance, UNO_QUERY);
+ uno::Reference<beans::XPropertySet> xDataProperties(xNewInstance, uno::UNO_QUERY);
if(aURLAny.hasValue())
xDataProperties->setPropertyValue("URL", aURLAny);
@@ -2609,8 +2591,8 @@ OUString SwDBManager::LoadAndRegisterDataSource(const DBConnURITypes type, const
xDSSettings->setPropertyValue( "Extension", uno::makeAny( sExt ));
}
- Reference<XDocumentDataSource> xDS(xNewInstance, UNO_QUERY_THROW);
- Reference<XStorable> xStore(xDS->getDatabaseDocument(), UNO_QUERY_THROW);
+ uno::Reference<sdb::XDocumentDataSource> xDS(xNewInstance, uno::UNO_QUERY_THROW);
+ uno::Reference<frame::XStorable> xStore(xDS->getDatabaseDocument(), uno::UNO_QUERY_THROW);
OUString sOutputExt = ".odb";
OUString aOwnURL = lcl_getOwnURL(pDocShell);
OUString sTmpName;
@@ -2649,7 +2631,7 @@ OUString SwDBManager::LoadAndRegisterDataSource(const DBConnURITypes type, const
}
xDBContext->registerObject( sFind, xNewInstance );
}
- catch(const Exception&)
+ catch(const uno::Exception&)
{
sFind.clear();
}
@@ -2659,7 +2641,7 @@ OUString SwDBManager::LoadAndRegisterDataSource(const DBConnURITypes type, const
OUString SwDBManager::LoadAndRegisterDataSource(const OUString &rURI, const OUString *pPrefix, const OUString *pDestDir,
const uno::Reference< beans::XPropertySet > *pSettings)
{
- Any aURLAny;
+ uno::Any aURLAny;
DBConnURITypes type = GetDBunoURI( rURI, aURLAny );
return LoadAndRegisterDataSource( type, aURLAny, pSettings, rURI, pPrefix, pDestDir );
}
@@ -2694,27 +2676,27 @@ void SwDBManager::LoadAndRegisterEmbeddedDataSource(const SwDBData& rData, const
}
void SwDBManager::ExecuteFormLetter( SwWrtShell& rSh,
- const Sequence<PropertyValue>& rProperties,
+ const uno::Sequence<beans::PropertyValue>& rProperties,
bool bWithDataSourceBrowser)
{
//prevent second call
if(pImpl->pMergeDialog)
return ;
OUString sDataSource, sDataTableOrQuery;
- Sequence<Any> aSelection;
+ uno::Sequence<uno::Any> aSelection;
- sal_Int32 nCmdType = CommandType::TABLE;
- uno::Reference< XConnection> xConnection;
+ sal_Int32 nCmdType = sdb::CommandType::TABLE;
+ uno::Reference< sdbc::XConnection> xConnection;
- ODataAccessDescriptor aDescriptor(rProperties);
+ svx::ODataAccessDescriptor aDescriptor(rProperties);
sDataSource = aDescriptor.getDataSource();
- OSL_VERIFY(aDescriptor[daCommand] >>= sDataTableOrQuery);
- OSL_VERIFY(aDescriptor[daCommandType] >>= nCmdType);
+ OSL_VERIFY(aDescriptor[svx::daCommand] >>= sDataTableOrQuery);
+ OSL_VERIFY(aDescriptor[svx::daCommandType] >>= nCmdType);
- if ( aDescriptor.has(daSelection) )
- aDescriptor[daSelection] >>= aSelection;
- if ( aDescriptor.has(daConnection) )
- aDescriptor[daConnection] >>= xConnection;
+ if ( aDescriptor.has(svx::daSelection) )
+ aDescriptor[svx::daSelection] >>= aSelection;
+ if ( aDescriptor.has(svx::daConnection) )
+ aDescriptor[svx::daConnection] >>= xConnection;
if(sDataSource.isEmpty() || sDataTableOrQuery.isEmpty())
{
@@ -2741,11 +2723,11 @@ void SwDBManager::ExecuteFormLetter( SwWrtShell& rSh,
OSL_ENSURE(pImpl->pMergeDialog, "Dialog creation failed!");
if(pImpl->pMergeDialog->Execute() == RET_OK)
{
- aDescriptor[daSelection] <<= pImpl->pMergeDialog->GetSelection();
+ aDescriptor[svx::daSelection] <<= pImpl->pMergeDialog->GetSelection();
- uno::Reference<XResultSet> xResSet = pImpl->pMergeDialog->GetResultSet();
+ uno::Reference<sdbc::XResultSet> xResSet = pImpl->pMergeDialog->GetResultSet();
if(xResSet.is())
- aDescriptor[daCursor] <<= xResSet;
+ aDescriptor[svx::daCursor] <<= xResSet;
// SfxObjectShellRef is ok, since there should be no control over the document lifetime here
SfxObjectShellRef xDocShell = rSh.GetView().GetViewFrame()->GetObjectShell();
@@ -2763,7 +2745,7 @@ void SwDBManager::ExecuteFormLetter( SwWrtShell& rSh,
beans::PropertyValue* pValues = aValues.getArray();
pValues[0].Name = "FilterName";
pValues[0].Value <<= OUString(pSfxFlt->GetFilterName());
- uno::Reference< XStorable > xStore( xDocShell->GetModel(), uno::UNO_QUERY);
+ uno::Reference< frame::XStorable > xStore( xDocShell->GetModel(), uno::UNO_QUERY);
sTempURL = URIHelper::SmartRel2Abs( INetURLObject(), utl::TempFile::CreateTempName() );
xStore->storeToURL( sTempURL, aValues );
}
@@ -2828,7 +2810,7 @@ void SwDBManager::ExecuteFormLetter( SwWrtShell& rSh,
// reset the cursor inside
xResSet = NULL;
- aDescriptor[daCursor] <<= xResSet;
+ aDescriptor[svx::daCursor] <<= xResSet;
}
if(pFound)
{
@@ -2839,11 +2821,11 @@ void SwDBManager::ExecuteFormLetter( SwWrtShell& rSh,
{
try
{
- uno::Reference<XComponent> xComp(pParam->xConnection, UNO_QUERY);
+ uno::Reference<lang::XComponent> xComp(pParam->xConnection, uno::UNO_QUERY);
if(xComp.is())
xComp->dispose();
}
- catch(const RuntimeException&)
+ catch(const uno::RuntimeException&)
{
//may be disposed already since multiple entries may have used the same connection
}
@@ -2857,14 +2839,14 @@ void SwDBManager::ExecuteFormLetter( SwWrtShell& rSh,
}
void SwDBManager::InsertText(SwWrtShell& rSh,
- const Sequence< PropertyValue>& rProperties)
+ const uno::Sequence< beans::PropertyValue>& rProperties)
{
OUString sDataSource, sDataTableOrQuery;
- uno::Reference<XResultSet> xResSet;
- Sequence<Any> aSelection;
- sal_Int16 nCmdType = CommandType::TABLE;
- const PropertyValue* pValues = rProperties.getConstArray();
- uno::Reference< XConnection> xConnection;
+ uno::Reference<sdbc::XResultSet> xResSet;
+ uno::Sequence<uno::Any> aSelection;
+ sal_Int16 nCmdType = sdb::CommandType::TABLE;
+ const beans::PropertyValue* pValues = rProperties.getConstArray();
+ uno::Reference< sdbc::XConnection> xConnection;
for(sal_Int32 nPos = 0; nPos < rProperties.getLength(); nPos++)
{
if ( pValues[nPos].Name == cDataSourceName )
@@ -2885,14 +2867,14 @@ void SwDBManager::InsertText(SwWrtShell& rSh,
OSL_FAIL("PropertyValues missing or unset");
return;
}
- Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
- uno::Reference<XDataSource> xSource;
- uno::Reference<XChild> xChild(xConnection, UNO_QUERY);
+ uno::Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
+ uno::Reference<sdbc::XDataSource> xSource;
+ uno::Reference<container::XChild> xChild(xConnection, uno::UNO_QUERY);
if(xChild.is())
- xSource = uno::Reference<XDataSource>(xChild->getParent(), UNO_QUERY);
+ xSource = uno::Reference<sdbc::XDataSource>(xChild->getParent(), uno::UNO_QUERY);
if(!xSource.is())
- xSource = getDataSource(sDataSource, xContext);
- uno::Reference< XColumnsSupplier > xColSupp( xResSet, UNO_QUERY );
+ xSource = dbtools::getDataSource(sDataSource, xContext);
+ uno::Reference< sdbcx::XColumnsSupplier > xColSupp( xResSet, uno::UNO_QUERY );
SwDBData aDBData;
aDBData.sDataSource = sDataSource;
aDBData.sCommand = sDataTableOrQuery;
@@ -2915,64 +2897,64 @@ void SwDBManager::InsertText(SwWrtShell& rSh,
{
pDlg->DataToDoc( aSelection , xSource, xConnection, xResSet);
}
- catch (const Exception& e)
+ catch (const uno::Exception& e)
{
SAL_WARN("sw.mailmerge", "exception caught: " << e.Message);
}
}
}
-uno::Reference<XDataSource> SwDBManager::getDataSourceAsParent(const uno::Reference< XConnection>& _xConnection,const OUString& _sDataSourceName)
+uno::Reference<sdbc::XDataSource> SwDBManager::getDataSourceAsParent(const uno::Reference< sdbc::XConnection>& _xConnection,const OUString& _sDataSourceName)
{
- uno::Reference<XDataSource> xSource;
+ uno::Reference<sdbc::XDataSource> xSource;
try
{
- uno::Reference<XChild> xChild(_xConnection, UNO_QUERY);
+ uno::Reference<container::XChild> xChild(_xConnection, uno::UNO_QUERY);
if ( xChild.is() )
- xSource = uno::Reference<XDataSource>(xChild->getParent(), UNO_QUERY);
+ xSource = uno::Reference<sdbc::XDataSource>(xChild->getParent(), uno::UNO_QUERY);
if ( !xSource.is() )
- xSource = getDataSource(_sDataSourceName, ::comphelper::getProcessComponentContext());
+ xSource = dbtools::getDataSource(_sDataSourceName, ::comphelper::getProcessComponentContext());
}
- catch (const Exception& e)
+ catch (const uno::Exception& e)
{
SAL_WARN("sw.mailmerge", "exception caught in getDataSourceAsParent(): " << e.Message);
}
return xSource;
}
-uno::Reference<XResultSet> SwDBManager::createCursor(const OUString& _sDataSourceName,
+uno::Reference<sdbc::XResultSet> SwDBManager::createCursor(const OUString& _sDataSourceName,
const OUString& _sCommand,
sal_Int32 _nCommandType,
- const uno::Reference<XConnection>& _xConnection
+ const uno::Reference<sdbc::XConnection>& _xConnection
)
{
- uno::Reference<XResultSet> xResultSet;
+ uno::Reference<sdbc::XResultSet> xResultSet;
try
{
- uno::Reference< XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() );
+ uno::Reference< lang::XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() );
if( xMgr.is() )
{
- uno::Reference<XInterface> xInstance = xMgr->createInstance("com.sun.star.sdb.RowSet");
- uno::Reference<XPropertySet> xRowSetPropSet(xInstance, UNO_QUERY);
+ uno::Reference<uno::XInterface> xInstance = xMgr->createInstance("com.sun.star.sdb.RowSet");
+ uno::Reference<beans::XPropertySet> xRowSetPropSet(xInstance, uno::UNO_QUERY);
if(xRowSetPropSet.is())
{
- xRowSetPropSet->setPropertyValue("DataSourceName", makeAny(_sDataSourceName));
- xRowSetPropSet->setPropertyValue("ActiveConnection", makeAny(_xConnection));
- xRowSetPropSet->setPropertyValue("Command", makeAny(_sCommand));
- xRowSetPropSet->setPropertyValue("CommandType", makeAny(_nCommandType));
+ xRowSetPropSet->setPropertyValue("DataSourceName", uno::makeAny(_sDataSourceName));
+ xRowSetPropSet->setPropertyValue("ActiveConnection", uno::makeAny(_xConnection));
+ xRowSetPropSet->setPropertyValue("Command", uno::makeAny(_sCommand));
+ xRowSetPropSet->setPropertyValue("CommandType", uno::makeAny(_nCommandType));
- uno::Reference< XCompletedExecution > xRowSet(xInstance, UNO_QUERY);
+ uno::Reference< sdb::XCompletedExecution > xRowSet(xInstance, uno::UNO_QUERY);
if ( xRowSet.is() )
{
- uno::Reference< XInteractionHandler > xHandler( InteractionHandler::createWithParent(comphelper::getComponentContext(xMgr), 0), UNO_QUERY_THROW );
+ uno::Reference< task::XInteractionHandler > xHandler( task::InteractionHandler::createWithParent(comphelper::getComponentContext(xMgr), 0), uno::UNO_QUERY_THROW );
xRowSet->executeWithCompletion(xHandler);
}
- xResultSet = uno::Reference<XResultSet>(xRowSet, UNO_QUERY);
+ xResultSet = uno::Reference<sdbc::XResultSet>(xRowSet, uno::UNO_QUERY);
}
}
}
- catch (const Exception& e)
+ catch (const uno::Exception& e)
{
SAL_WARN("sw.mailmerge", "Caught exception while creating a new RowSet: " << e.Message);
}
@@ -3009,14 +2991,14 @@ SwConnectionDisposedListener_Impl::~SwConnectionDisposedListener_Impl()
{
}
-void SwConnectionDisposedListener_Impl::disposing( const EventObject& rSource )
- throw (RuntimeException, std::exception)
+void SwConnectionDisposedListener_Impl::disposing( const lang::EventObject& rSource )
+ throw (uno::RuntimeException, std::exception)
{
::SolarMutexGuard aGuard;
if (!m_pDBManager) return; // we're disposed too!
- uno::Reference<XConnection> xSource(rSource.Source, UNO_QUERY);
+ uno::Reference<sdbc::XConnection> xSource(rSource.Source, uno::UNO_QUERY);
for (size_t nPos = m_pDBManager->aDataSourceParams.size(); nPos; nPos--)
{
SwDSParam* pParam = &m_pDBManager->aDataSourceParams[nPos - 1];
commit 292ec5fe8d01af6119325f1a426422bb42e58615
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Mon Jun 8 07:48:42 2015 +0200
tdf#82553 DOCX import: handle table margin when converting floattables
Change-Id: I7a3a233a34453153b3e1c0fe3d60bb0ede65dc86
diff --git a/sw/qa/extras/ooxmlimport/data/tdf8255.docx b/sw/qa/extras/ooxmlimport/data/tdf8255.docx
new file mode 100644
index 0000000..366e498
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf8255.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 89924e4..b16877d 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -2707,6 +2707,15 @@ DECLARE_OOXMLIMPORT_TEST(mathtype, "mathtype.docx")
CPPUNIT_ASSERT(xModel->supportsService("com.sun.star.formula.FormulaProperties"));
}
+DECLARE_OOXMLIMPORT_TEST(testTdf8255, "tdf8255.docx")
+{
+ uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
+ uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(xTextDocument, uno::UNO_QUERY);
+ uno::Reference<drawing::XDrawPage> xDrawPage = xDrawPageSupplier->getDrawPage();
+ // This was 1: a full-page-wide multi-page floating table was imported as a TextFrame.
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), xDrawPage->getCount());
+}
+
#endif
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx
index dcf4f3b..b9f46ff 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -1029,6 +1029,16 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
for (size_t i = 0; i < rPendingFloatingTables.size(); ++i)
{
FloatingTableInfo& rInfo = rPendingFloatingTables[i];
+
+ // Count the layout width of the table.
+ sal_Int32 nTableWidth = rInfo.m_nTableWidth;
+ sal_Int32 nLeftMargin = 0;
+ if (rInfo.getPropertyValue("LeftMargin") >>= nLeftMargin)
+ nTableWidth += nLeftMargin;
+ sal_Int32 nRightMargin = 0;
+ if (rInfo.getPropertyValue("RightMargin") >>= nRightMargin)
+ nTableWidth += nRightMargin;
+
// If the table is wider than the text area, then don't create a fly
// for the table: no wrapping will be performed anyway, but multi-page
// tables will be broken.
@@ -1037,7 +1047,7 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
// If there are columns, always create the fly, otherwise the columns would
// restrict geometry of the table.
if ( ( rInfo.getPropertyValue("HoriOrientRelation") == text::RelOrientation::PAGE_FRAME ) ||
- ( rInfo.m_nTableWidth < nTextAreaWidth ) || ColumnCount() + 1 >= 2 )
+ nTableWidth < nTextAreaWidth || ColumnCount() + 1 >= 2 )
xBodyText->convertToTextFrame(rInfo.m_xStart, rInfo.m_xEnd, rInfo.m_aFrameProperties);
}
rPendingFloatingTables.clear();
commit f89deaaf9a2bf433e209e91e4f9b01e0c4804a08
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Mon Jun 8 07:46:42 2015 +0200
Unused includes
Change-Id: Id8aa8edf775d27ad3ed9fd2370268faf2d7325a6
diff --git a/starmath/source/unofilter.cxx b/starmath/source/unofilter.cxx
index d87ce77..8d68f75 100644
--- a/starmath/source/unofilter.cxx
+++ b/starmath/source/unofilter.cxx
@@ -9,12 +9,6 @@
#include <memory>
-#include <com/sun/star/document/XFilter.hpp>
-#include <com/sun/star/document/XImporter.hpp>
-#include <com/sun/star/uno/XComponentContext.hpp>
-#include <cppuhelper/implbase.hxx>
-#include <sot/storage.hxx>
-#include <tools/stream.hxx>
#include <unotools/mediadescriptor.hxx>
#include <unotools/ucbstreamhelper.hxx>
diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx
index 5e1e94a..b7d1070 100644
--- a/sw/source/filter/ww8/docxsdrexport.cxx
+++ b/sw/source/filter/ww8/docxsdrexport.cxx
@@ -15,7 +15,6 @@
#include <editeng/unoprnms.hxx>
#include <editeng/charrotateitem.hxx>
#include <svx/svdogrp.hxx>
-#include <oox/token/tokens.hxx>
#include <oox/export/utils.hxx>
#include <oox/token/properties.hxx>
#include <textboxhelper.hxx>
diff --git a/writerfilter/source/filter/WriterFilter.cxx b/writerfilter/source/filter/WriterFilter.cxx
index a2f289a..4568cb9 100644
--- a/writerfilter/source/filter/WriterFilter.cxx
+++ b/writerfilter/source/filter/WriterFilter.cxx
@@ -26,7 +26,6 @@
#include <com/sun/star/document/XFilter.hpp>
#include <com/sun/star/document/XImporter.hpp>
#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
-#include <com/sun/star/io/WrongFormatException.hpp>
#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index b351bef..e25bb19 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -21,7 +21,6 @@
#include <unotools/streamwrap.hxx>
#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
#include <vcl/wmf.hxx>
-#include <vcl/settings.hxx>
#include <filter/msfilter/util.hxx>
#include <comphelper/string.hxx>
#include <tools/globname.hxx>
diff --git a/writerfilter/source/rtftok/rtftokenizer.cxx b/writerfilter/source/rtftok/rtftokenizer.cxx
index 1440854..416c6bb 100644
--- a/writerfilter/source/rtftok/rtftokenizer.cxx
+++ b/writerfilter/source/rtftok/rtftokenizer.cxx
@@ -10,7 +10,6 @@
#include <rtftokenizer.hxx>
#include <svx/dialogs.hrc>
#include <vcl/svapp.hxx>
-#include <vcl/settings.hxx>
#include <rtl/strbuf.hxx>
#include <rtfskipdestination.hxx>
#include <com/sun/star/io/BufferSizeExceededException.hpp>
More information about the Libreoffice-commits
mailing list