summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--package/source/zippackage/zipfileaccess.cxx38
-rw-r--r--pyuno/source/module/pyuno.cxx36
-rw-r--r--pyuno/source/module/pyuno_module.cxx45
-rw-r--r--registry/source/regimpl.cxx88
-rw-r--r--registry/tools/fileurl.cxx35
-rw-r--r--registry/tools/options.cxx52
-rw-r--r--reportdesign/source/core/sdr/RptObject.cxx39
-rw-r--r--reportdesign/source/filter/xml/xmlfilter.cxx102
-rw-r--r--reportdesign/source/ui/dlg/GroupsSorting.cxx124
-rw-r--r--reportdesign/source/ui/report/ReportController.cxx46
10 files changed, 298 insertions, 307 deletions
diff --git a/package/source/zippackage/zipfileaccess.cxx b/package/source/zippackage/zipfileaccess.cxx
index a02d416286f1..85a674ef6e50 100644
--- a/package/source/zippackage/zipfileaccess.cxx
+++ b/package/source/zippackage/zipfileaccess.cxx
@@ -134,34 +134,32 @@ bool OZipFileAccess::StringGoodForPattern_Impl( const OUString& aString,
sal_Int32 nBeginInd = aPattern[0].getLength();
sal_Int32 nEndInd = aString.getLength() - aPattern[nInd].getLength();
- if ( nEndInd >= nBeginInd
- && ( nEndInd == aString.getLength() || aString.subView( nEndInd ) == aPattern[nInd] )
- && ( nBeginInd == 0 || aString.subView( 0, nBeginInd ) == aPattern[0] ) )
- {
- for ( sal_Int32 nCurInd = aPattern.getLength() - 2; nCurInd > 0; nCurInd-- )
- {
- if ( aPattern[nCurInd].isEmpty() )
- continue;
+ if ( nEndInd < nBeginInd
+ || ( nEndInd != aString.getLength() && aString.subView( nEndInd ) != aPattern[nInd] )
+ || ( nBeginInd != 0 && aString.subView( 0, nBeginInd ) != aPattern[0] ) )
+ return false;
- if ( nEndInd == nBeginInd )
- return false;
+ for ( sal_Int32 nCurInd = aPattern.getLength() - 2; nCurInd > 0; nCurInd-- )
+ {
+ if ( aPattern[nCurInd].isEmpty() )
+ continue;
- // check that search does not use nEndInd position
- sal_Int32 nLastInd = aString.lastIndexOf( aPattern[nCurInd], nEndInd - 1 );
+ if ( nEndInd == nBeginInd )
+ return false;
- if ( nLastInd == -1 )
- return false;
+ // check that search does not use nEndInd position
+ sal_Int32 nLastInd = aString.lastIndexOf( aPattern[nCurInd], nEndInd - 1 );
- if ( nLastInd < nBeginInd )
- return false;
+ if ( nLastInd == -1 )
+ return false;
- nEndInd = nLastInd;
- }
+ if ( nLastInd < nBeginInd )
+ return false;
- return true;
+ nEndInd = nLastInd;
}
- return false;
+ return true;
}
// XInitialization
diff --git a/pyuno/source/module/pyuno.cxx b/pyuno/source/module/pyuno.cxx
index cdd5e417feeb..c3de37b82a88 100644
--- a/pyuno/source/module/pyuno.cxx
+++ b/pyuno/source/module/pyuno.cxx
@@ -739,32 +739,30 @@ static PyObject* lcl_getitem_slice( PyUNO const *me, PyObject *pKey )
nLen = xIndexAccess->getCount();
}
- if ( xIndexAccess.is() )
+ if ( !xIndexAccess )
+ return nullptr;
+
+ sal_Int32 nStart = 0, nStop = 0, nStep = 0, nSliceLength = 0;
+ int nSuccess = lcl_PySlice_GetIndicesEx(pKey, nLen, &nStart, &nStop, &nStep, &nSliceLength);
+ if ( nSuccess == -1 && PyErr_Occurred() )
+ return nullptr;
+
+ PyRef rTuple( PyTuple_New( nSliceLength ), SAL_NO_ACQUIRE, NOT_NULL );
+ sal_Int32 nCur, i;
+ for ( nCur = nStart, i = 0; i < nSliceLength; nCur += nStep, i++ )
{
- sal_Int32 nStart = 0, nStop = 0, nStep = 0, nSliceLength = 0;
- int nSuccess = lcl_PySlice_GetIndicesEx(pKey, nLen, &nStart, &nStop, &nStep, &nSliceLength);
- if ( nSuccess == -1 && PyErr_Occurred() )
- return nullptr;
+ Any aRet;
- PyRef rTuple( PyTuple_New( nSliceLength ), SAL_NO_ACQUIRE, NOT_NULL );
- sal_Int32 nCur, i;
- for ( nCur = nStart, i = 0; i < nSliceLength; nCur += nStep, i++ )
{
- Any aRet;
-
- {
- PyThreadDetach antiguard;
+ PyThreadDetach antiguard;
- aRet = xIndexAccess->getByIndex( nCur );
- }
- PyRef rRet = runtime.any2PyObject( aRet );
- PyTuple_SetItem( rTuple.get(), i, rRet.getAcquired() );
+ aRet = xIndexAccess->getByIndex( nCur );
}
-
- return rTuple.getAcquired();
+ PyRef rRet = runtime.any2PyObject( aRet );
+ PyTuple_SetItem( rTuple.get(), i, rRet.getAcquired() );
}
- return nullptr;
+ return rTuple.getAcquired();
}
static PyObject* lcl_getitem_string( PyUNO const *me, PyObject *pKey, Runtime const & runtime )
diff --git a/pyuno/source/module/pyuno_module.cxx b/pyuno/source/module/pyuno_module.cxx
index a5167ef09919..81a8b7919db9 100644
--- a/pyuno/source/module/pyuno_module.cxx
+++ b/pyuno/source/module/pyuno_module.cxx
@@ -708,31 +708,30 @@ static PyObject * fileUrlToSystemPath(
static PyObject * absolutize( SAL_UNUSED_PARAMETER PyObject *, PyObject * args )
{
- if( PyTuple_Check( args ) && PyTuple_Size( args ) == 2 )
- {
- OUString ouPath = pyString2ustring( PyTuple_GetItem( args , 0 ) );
- OUString ouRel = pyString2ustring( PyTuple_GetItem( args, 1 ) );
- OUString ret;
- oslFileError e = osl_getAbsoluteFileURL( ouPath.pData, ouRel.pData, &(ret.pData) );
- if( e != osl_File_E_None )
- {
- OUString buf =
- "Couldn't absolutize " +
- ouRel +
- " using root " +
- ouPath +
- " for reason (" +
- OUString::number(static_cast<sal_Int32>(e) ) +
- ")";
+ if( !PyTuple_Check( args ) || PyTuple_Size( args ) != 2 )
+ return nullptr;
- PyErr_SetString(
- PyExc_OSError,
- OUStringToOString(buf,osl_getThreadTextEncoding()).getStr());
- return nullptr;
- }
- return ustring2PyUnicode( ret ).getAcquired();
+ OUString ouPath = pyString2ustring( PyTuple_GetItem( args , 0 ) );
+ OUString ouRel = pyString2ustring( PyTuple_GetItem( args, 1 ) );
+ OUString ret;
+ oslFileError e = osl_getAbsoluteFileURL( ouPath.pData, ouRel.pData, &(ret.pData) );
+ if( e != osl_File_E_None )
+ {
+ OUString buf =
+ "Couldn't absolutize " +
+ ouRel +
+ " using root " +
+ ouPath +
+ " for reason (" +
+ OUString::number(static_cast<sal_Int32>(e) ) +
+ ")";
+
+ PyErr_SetString(
+ PyExc_OSError,
+ OUStringToOString(buf,osl_getThreadTextEncoding()).getStr());
+ return nullptr;
}
- return nullptr;
+ return ustring2PyUnicode( ret ).getAcquired();
}
static PyObject * invoke(SAL_UNUSED_PARAMETER PyObject *, PyObject *args)
diff --git a/registry/source/regimpl.cxx b/registry/source/regimpl.cxx
index 5976d0a1a219..7a32772b2f38 100644
--- a/registry/source/regimpl.cxx
+++ b/registry/source/regimpl.cxx
@@ -1122,61 +1122,61 @@ RegError ORegistry::mergeModuleValue(OStoreStream& rTargetValue,
std::set< OUString > nameSet;
sal_uInt32 count = checkTypeReaders(reader, reader2, nameSet);
- if (count != reader.getFieldCount())
- {
- sal_uInt16 index = 0;
+ if (count == reader.getFieldCount())
+ return RegError::NO_ERROR;
+
+ sal_uInt16 index = 0;
- RegistryTypeWriter writer(reader.getTypeClass(),
- reader.getTypeName(),
- reader.getSuperTypeName(),
- static_cast<sal_uInt16>(count));
+ RegistryTypeWriter writer(reader.getTypeClass(),
+ reader.getTypeName(),
+ reader.getSuperTypeName(),
+ static_cast<sal_uInt16>(count));
- for (sal_uInt32 i=0 ; i < reader.getFieldCount(); i++)
+ for (sal_uInt32 i=0 ; i < reader.getFieldCount(); i++)
+ {
+ writer.setFieldData(index,
+ reader.getFieldName(i),
+ reader.getFieldType(i),
+ reader.getFieldDoku(i),
+ reader.getFieldFileName(i),
+ reader.getFieldAccess(i),
+ reader.getFieldConstValue(i));
+ index++;
+ }
+ for (sal_uInt32 i=0 ; i < reader2.getFieldCount(); i++)
+ {
+ if (nameSet.find(reader2.getFieldName(i)) == nameSet.end())
{
writer.setFieldData(index,
- reader.getFieldName(i),
- reader.getFieldType(i),
- reader.getFieldDoku(i),
- reader.getFieldFileName(i),
- reader.getFieldAccess(i),
- reader.getFieldConstValue(i));
+ reader2.getFieldName(i),
+ reader2.getFieldType(i),
+ reader2.getFieldDoku(i),
+ reader2.getFieldFileName(i),
+ reader2.getFieldAccess(i),
+ reader2.getFieldConstValue(i));
index++;
}
- for (sal_uInt32 i=0 ; i < reader2.getFieldCount(); i++)
- {
- if (nameSet.find(reader2.getFieldName(i)) == nameSet.end())
- {
- writer.setFieldData(index,
- reader2.getFieldName(i),
- reader2.getFieldType(i),
- reader2.getFieldDoku(i),
- reader2.getFieldFileName(i),
- reader2.getFieldAccess(i),
- reader2.getFieldConstValue(i));
- index++;
- }
- }
+ }
- const sal_uInt8* pBlop = writer.getBlop();
- sal_uInt32 aBlopSize = writer.getBlopSize();
+ const sal_uInt8* pBlop = writer.getBlop();
+ sal_uInt32 aBlopSize = writer.getBlopSize();
- sal_uInt8 type = sal_uInt8(RegValueType::BINARY);
- std::vector<sal_uInt8> aBuffer(VALUE_HEADERSIZE + aBlopSize);
+ sal_uInt8 type = sal_uInt8(RegValueType::BINARY);
+ std::vector<sal_uInt8> aBuffer(VALUE_HEADERSIZE + aBlopSize);
- memcpy(aBuffer.data(), &type, 1);
- writeUINT32(aBuffer.data() + VALUE_TYPEOFFSET, aBlopSize);
- memcpy(aBuffer.data() + VALUE_HEADEROFFSET, pBlop, aBlopSize);
+ memcpy(aBuffer.data(), &type, 1);
+ writeUINT32(aBuffer.data() + VALUE_TYPEOFFSET, aBlopSize);
+ memcpy(aBuffer.data() + VALUE_HEADEROFFSET, pBlop, aBlopSize);
- sal_uInt32 rwBytes;
- if (rTargetValue.writeAt(0, aBuffer.data(), VALUE_HEADERSIZE+aBlopSize, rwBytes))
- {
- return RegError::INVALID_VALUE;
- }
+ sal_uInt32 rwBytes;
+ if (rTargetValue.writeAt(0, aBuffer.data(), VALUE_HEADERSIZE+aBlopSize, rwBytes))
+ {
+ return RegError::INVALID_VALUE;
+ }
- if (rwBytes != VALUE_HEADERSIZE+aBlopSize)
- {
- return RegError::INVALID_VALUE;
- }
+ if (rwBytes != VALUE_HEADERSIZE+aBlopSize)
+ {
+ return RegError::INVALID_VALUE;
}
return RegError::NO_ERROR;
}
diff --git a/registry/tools/fileurl.cxx b/registry/tools/fileurl.cxx
index 155995115b92..ce99be5a198b 100644
--- a/registry/tools/fileurl.cxx
+++ b/registry/tools/fileurl.cxx
@@ -46,28 +46,27 @@ OUString convertToFileUrl(char const* filename, sal_Int32 length)
}
OUString uFileUrl;
- if (length > 0)
+ if (length <= 0)
+ return uFileUrl;
+ if (filename[0] != SEPARATOR)
{
- if (filename[0] != SEPARATOR)
+ // relative path name.
+ OUString uWorkingDir;
+ if (osl_getProcessWorkingDir(&uWorkingDir.pData) != osl_Process_E_None)
{
- // relative path name.
- OUString uWorkingDir;
- if (osl_getProcessWorkingDir(&uWorkingDir.pData) != osl_Process_E_None)
- {
- assert(false);
- }
- if (FileBase::getAbsoluteFileURL(uWorkingDir, uFileName, uFileUrl) != FileBase::E_None)
- {
- assert(false);
- }
+ assert(false);
}
- else
+ if (FileBase::getAbsoluteFileURL(uWorkingDir, uFileName, uFileUrl) != FileBase::E_None)
{
- // absolute path name.
- if (FileBase::getFileURLFromSystemPath(uFileName, uFileUrl) != FileBase::E_None)
- {
- assert(false);
- }
+ assert(false);
+ }
+ }
+ else
+ {
+ // absolute path name.
+ if (FileBase::getFileURLFromSystemPath(uFileName, uFileUrl) != FileBase::E_None)
+ {
+ assert(false);
}
}
return uFileUrl;
diff --git a/registry/tools/options.cxx b/registry/tools/options.cxx
index 81d1131f75c2..0212c94e9f55 100644
--- a/registry/tools/options.cxx
+++ b/registry/tools/options.cxx
@@ -38,37 +38,37 @@ bool Options::checkArgument(std::vector< std::string> & rArgs, char const * arg,
{
bool result = ((arg != nullptr) && (len > 0));
OSL_PRECOND(result, "registry::tools::Options::checkArgument(): invalid arguments");
- if (result)
+ if (!result)
+ return false;
+
+ switch (arg[0])
{
- switch (arg[0])
+ case '@':
+ result = len > 1;
+ if (result)
{
- case '@':
- result = len > 1;
- if (result)
- {
- // "@<cmdfile>"
- result = Options::checkCommandFile(rArgs, &(arg[1]));
- }
- break;
- case '-':
- result = len > 1;
- if (result)
+ // "@<cmdfile>"
+ result = Options::checkCommandFile(rArgs, &(arg[1]));
+ }
+ break;
+ case '-':
+ result = len > 1;
+ if (result)
+ {
+ // "-<option>"
+ std::string option (&(arg[0]), 2);
+ rArgs.push_back(option);
+ if (len > 2)
{
- // "-<option>"
- std::string option (&(arg[0]), 2);
- rArgs.push_back(option);
- if (len > 2)
- {
- // "-<option><param>"
- std::string param(&(arg[2]), len - 2);
- rArgs.push_back(param);
- }
+ // "-<option><param>"
+ std::string param(&(arg[2]), len - 2);
+ rArgs.push_back(param);
}
- break;
- default:
- rArgs.push_back(std::string(arg, len));
- break;
}
+ break;
+ default:
+ rArgs.push_back(std::string(arg, len));
+ break;
}
return result;
}
diff --git a/reportdesign/source/core/sdr/RptObject.cxx b/reportdesign/source/core/sdr/RptObject.cxx
index 8bb3246639db..e3cfb19d9037 100644
--- a/reportdesign/source/core/sdr/RptObject.cxx
+++ b/reportdesign/source/core/sdr/RptObject.cxx
@@ -62,28 +62,27 @@ SdrObjKind OObjectBase::getObjectType(const uno::Reference< report::XReportCompo
{
uno::Reference< lang::XServiceInfo > xServiceInfo( _xComponent , uno::UNO_QUERY );
OSL_ENSURE(xServiceInfo.is(),"Who deletes the XServiceInfo interface!");
- if ( xServiceInfo.is() )
+ if ( !xServiceInfo )
+ return OBJ_NONE;
+
+ if ( xServiceInfo->supportsService( SERVICE_FIXEDTEXT ))
+ return OBJ_RD_FIXEDTEXT;
+ if ( xServiceInfo->supportsService( SERVICE_FIXEDLINE ))
{
- if ( xServiceInfo->supportsService( SERVICE_FIXEDTEXT ))
- return OBJ_RD_FIXEDTEXT;
- if ( xServiceInfo->supportsService( SERVICE_FIXEDLINE ))
- {
- uno::Reference< report::XFixedLine> xFixedLine(_xComponent,uno::UNO_QUERY);
- return xFixedLine->getOrientation() ? OBJ_RD_HFIXEDLINE : OBJ_RD_VFIXEDLINE;
- }
- if ( xServiceInfo->supportsService( SERVICE_IMAGECONTROL))
- return OBJ_RD_IMAGECONTROL;
- if ( xServiceInfo->supportsService( SERVICE_FORMATTEDFIELD ))
- return OBJ_RD_FORMATTEDFIELD;
- if ( xServiceInfo->supportsService("com.sun.star.drawing.OLE2Shape") )
- return OBJ_OLE2;
- if ( xServiceInfo->supportsService( SERVICE_SHAPE ))
- return OBJ_CUSTOMSHAPE;
- if ( xServiceInfo->supportsService( SERVICE_REPORTDEFINITION ) )
- return OBJ_RD_SUBREPORT;
- return OBJ_OLE2;
+ uno::Reference< report::XFixedLine> xFixedLine(_xComponent,uno::UNO_QUERY);
+ return xFixedLine->getOrientation() ? OBJ_RD_HFIXEDLINE : OBJ_RD_VFIXEDLINE;
}
- return OBJ_NONE;
+ if ( xServiceInfo->supportsService( SERVICE_IMAGECONTROL))
+ return OBJ_RD_IMAGECONTROL;
+ if ( xServiceInfo->supportsService( SERVICE_FORMATTEDFIELD ))
+ return OBJ_RD_FORMATTEDFIELD;
+ if ( xServiceInfo->supportsService("com.sun.star.drawing.OLE2Shape") )
+ return OBJ_OLE2;
+ if ( xServiceInfo->supportsService( SERVICE_SHAPE ))
+ return OBJ_CUSTOMSHAPE;
+ if ( xServiceInfo->supportsService( SERVICE_REPORTDEFINITION ) )
+ return OBJ_RD_SUBREPORT;
+ return OBJ_OLE2;
}
SdrObject* OObjectBase::createObject(
diff --git a/reportdesign/source/filter/xml/xmlfilter.cxx b/reportdesign/source/filter/xml/xmlfilter.cxx
index b725e57259ee..49bba943ffa8 100644
--- a/reportdesign/source/filter/xml/xmlfilter.cxx
+++ b/reportdesign/source/filter/xml/xmlfilter.cxx
@@ -178,65 +178,63 @@ static ErrCode ReadThroughComponent(
OSL_ENSURE( xStorage.is(), "Need storage!");
OSL_ENSURE(nullptr != pStreamName, "Please, please, give me a name!");
- if ( xStorage.is() )
- {
- uno::Reference< io::XStream > xDocStream;
+ if ( !xStorage )
+ // TODO/LATER: better error handling
+ return ErrCode(1);
- try
- {
- // open stream (and set parser input)
- OUString sStreamName = OUString::createFromAscii(pStreamName);
- if ( !xStorage->hasByName( sStreamName ) || !xStorage->isStreamElement( sStreamName ) )
- {
- // stream name not found! return immediately with OK signal
- return ERRCODE_NONE;
- }
+ uno::Reference< io::XStream > xDocStream;
- // get input stream
- xDocStream = xStorage->openStreamElement( sStreamName, embed::ElementModes::READ );
- }
- catch (const packages::WrongPasswordException&)
- {
- return ERRCODE_SFX_WRONGPASSWORD;
- }
- catch (const uno::Exception&)
+ try
+ {
+ // open stream (and set parser input)
+ OUString sStreamName = OUString::createFromAscii(pStreamName);
+ if ( !xStorage->hasByName( sStreamName ) || !xStorage->isStreamElement( sStreamName ) )
{
- return ErrCode(1); // TODO/LATER: error handling
+ // stream name not found! return immediately with OK signal
+ return ERRCODE_NONE;
}
- sal_Int32 nArgs = 0;
- if (rxGraphicStorageHandler.is())
- nArgs++;
- if( _xEmbeddedObjectResolver.is())
- nArgs++;
- if ( _xProp.is() )
- nArgs++;
-
- uno::Sequence< uno::Any > aFilterCompArgs( nArgs );
- auto aFilterCompArgsRange = asNonConstRange(aFilterCompArgs);
-
- nArgs = 0;
- if (rxGraphicStorageHandler.is())
- aFilterCompArgsRange[nArgs++] <<= rxGraphicStorageHandler;
- if( _xEmbeddedObjectResolver.is())
- aFilterCompArgsRange[ nArgs++ ] <<= _xEmbeddedObjectResolver;
- if ( _xProp.is() )
- aFilterCompArgsRange[ nArgs++ ] <<= _xProp;
-
- // the underlying SvXMLImport implements XFastParser, XImporter, XFastDocumentHandler
- Reference< XFastParser > xFastParser(
- rxContext->getServiceManager()->createInstanceWithArgumentsAndContext(_sFilterName, aFilterCompArgs, rxContext),
- uno::UNO_QUERY_THROW );
- uno::Reference< XInputStream > xInputStream = xDocStream->getInputStream();
- // read from the stream
- return ReadThroughComponent( xInputStream
- ,xModelComponent
- ,rxContext
- ,xFastParser );
+ // get input stream
+ xDocStream = xStorage->openStreamElement( sStreamName, embed::ElementModes::READ );
+ }
+ catch (const packages::WrongPasswordException&)
+ {
+ return ERRCODE_SFX_WRONGPASSWORD;
+ }
+ catch (const uno::Exception&)
+ {
+ return ErrCode(1); // TODO/LATER: error handling
}
- // TODO/LATER: better error handling
- return ErrCode(1);
+ sal_Int32 nArgs = 0;
+ if (rxGraphicStorageHandler.is())
+ nArgs++;
+ if( _xEmbeddedObjectResolver.is())
+ nArgs++;
+ if ( _xProp.is() )
+ nArgs++;
+
+ uno::Sequence< uno::Any > aFilterCompArgs( nArgs );
+ auto aFilterCompArgsRange = asNonConstRange(aFilterCompArgs);
+
+ nArgs = 0;
+ if (rxGraphicStorageHandler.is())
+ aFilterCompArgsRange[nArgs++] <<= rxGraphicStorageHandler;
+ if( _xEmbeddedObjectResolver.is())
+ aFilterCompArgsRange[ nArgs++ ] <<= _xEmbeddedObjectResolver;
+ if ( _xProp.is() )
+ aFilterCompArgsRange[ nArgs++ ] <<= _xProp;
+
+ // the underlying SvXMLImport implements XFastParser, XImporter, XFastDocumentHandler
+ Reference< XFastParser > xFastParser(
+ rxContext->getServiceManager()->createInstanceWithArgumentsAndContext(_sFilterName, aFilterCompArgs, rxContext),
+ uno::UNO_QUERY_THROW );
+ uno::Reference< XInputStream > xInputStream = xDocStream->getInputStream();
+ // read from the stream
+ return ReadThroughComponent( xInputStream
+ ,xModelComponent
+ ,rxContext
+ ,xFastParser );
}
diff --git a/reportdesign/source/ui/dlg/GroupsSorting.cxx b/reportdesign/source/ui/dlg/GroupsSorting.cxx
index 5bb161d8b5d4..38036939adda 100644
--- a/reportdesign/source/ui/dlg/GroupsSorting.cxx
+++ b/reportdesign/source/ui/dlg/GroupsSorting.cxx
@@ -407,78 +407,78 @@ bool OFieldExpressionControl::IsTabAllowed(bool /*bForward*/) const
bool OFieldExpressionControl::SaveModified()
{
sal_Int32 nRow = GetCurRow();
- if ( nRow != BROWSER_ENDOFSELECTION )
+ if ( nRow == BROWSER_ENDOFSELECTION )
+ return true;
+
+ try
{
- try
+ bool bAppend = false;
+ uno::Reference< report::XGroup> xGroup;
+ if ( m_aGroupPositions[nRow] == NO_GROUP )
{
- bool bAppend = false;
- uno::Reference< report::XGroup> xGroup;
- if ( m_aGroupPositions[nRow] == NO_GROUP )
- {
- bAppend = true;
- OUString sUndoAction(RptResId(RID_STR_UNDO_APPEND_GROUP));
- m_pParent->m_pController->getUndoManager().EnterListAction( sUndoAction, OUString(), 0, ViewShellId(-1) );
- xGroup = m_pParent->getGroups()->createGroup();
- xGroup->setHeaderOn(true);
-
- // find position where to insert the new group
- sal_Int32 nGroupPos = 0;
- ::std::vector<sal_Int32>::iterator aIter = m_aGroupPositions.begin();
- ::std::vector<sal_Int32>::const_iterator aEnd = m_aGroupPositions.begin() + nRow;
- for(;aIter != aEnd;++aIter)
- if ( *aIter != NO_GROUP )
- nGroupPos = *aIter + 1;
- uno::Sequence< beans::PropertyValue > aArgs{
- comphelper::makePropertyValue(PROPERTY_GROUP, xGroup),
- comphelper::makePropertyValue(PROPERTY_POSITIONY, nGroupPos)
- };
- m_bIgnoreEvent = true;
- m_pParent->m_pController->executeChecked(SID_GROUP_APPEND,aArgs);
- m_bIgnoreEvent = false;
- OSL_ENSURE(*aIter == NO_GROUP ,"Illegal iterator!");
- *aIter++ = nGroupPos;
-
- aEnd = m_aGroupPositions.end();
- for(;aIter != aEnd;++aIter)
- if ( *aIter != NO_GROUP )
- ++*aIter;
- }
+ bAppend = true;
+ OUString sUndoAction(RptResId(RID_STR_UNDO_APPEND_GROUP));
+ m_pParent->m_pController->getUndoManager().EnterListAction( sUndoAction, OUString(), 0, ViewShellId(-1) );
+ xGroup = m_pParent->getGroups()->createGroup();
+ xGroup->setHeaderOn(true);
+
+ // find position where to insert the new group
+ sal_Int32 nGroupPos = 0;
+ ::std::vector<sal_Int32>::iterator aIter = m_aGroupPositions.begin();
+ ::std::vector<sal_Int32>::const_iterator aEnd = m_aGroupPositions.begin() + nRow;
+ for(;aIter != aEnd;++aIter)
+ if ( *aIter != NO_GROUP )
+ nGroupPos = *aIter + 1;
+ uno::Sequence< beans::PropertyValue > aArgs{
+ comphelper::makePropertyValue(PROPERTY_GROUP, xGroup),
+ comphelper::makePropertyValue(PROPERTY_POSITIONY, nGroupPos)
+ };
+ m_bIgnoreEvent = true;
+ m_pParent->m_pController->executeChecked(SID_GROUP_APPEND,aArgs);
+ m_bIgnoreEvent = false;
+ OSL_ENSURE(*aIter == NO_GROUP ,"Illegal iterator!");
+ *aIter++ = nGroupPos;
+
+ aEnd = m_aGroupPositions.end();
+ for(;aIter != aEnd;++aIter)
+ if ( *aIter != NO_GROUP )
+ ++*aIter;
+ }
+ else
+ xGroup = m_pParent->getGroup(m_aGroupPositions[nRow]);
+ if ( xGroup.is() )
+ {
+ weld::ComboBox& rComboBox = m_pComboCell->get_widget();
+ sal_Int32 nPos = rComboBox.get_active();
+ OUString sExpression;
+ if (nPos == -1)
+ sExpression = rComboBox.get_active_text();
else
- xGroup = m_pParent->getGroup(m_aGroupPositions[nRow]);
- if ( xGroup.is() )
{
- weld::ComboBox& rComboBox = m_pComboCell->get_widget();
- sal_Int32 nPos = rComboBox.get_active();
- OUString sExpression;
- if (nPos == -1)
- sExpression = rComboBox.get_active_text();
- else
- {
- sExpression = m_aColumnInfo[nPos].sColumnName;
- }
- xGroup->setExpression( sExpression );
-
- ::rptui::adjustSectionName(xGroup,nPos);
-
- if ( bAppend )
- m_pParent->m_pController->getUndoManager().LeaveListAction();
+ sExpression = m_aColumnInfo[nPos].sColumnName;
}
+ xGroup->setExpression( sExpression );
- if (Controller().is())
- Controller()->SaveValue();
- if ( GetRowCount() == m_pParent->getGroups()->getCount() )
- {
- RowInserted( GetRowCount()-1);
- m_aGroupPositions.push_back(NO_GROUP);
- }
+ ::rptui::adjustSectionName(xGroup,nPos);
- GoToRow(nRow);
- m_pParent->DisplayData(nRow);
+ if ( bAppend )
+ m_pParent->m_pController->getUndoManager().LeaveListAction();
}
- catch(uno::Exception&)
+
+ if (Controller().is())
+ Controller()->SaveValue();
+ if ( GetRowCount() == m_pParent->getGroups()->getCount() )
{
- TOOLS_WARN_EXCEPTION( "reportdesign", "OFieldExpressionControl::SaveModified");
+ RowInserted( GetRowCount()-1);
+ m_aGroupPositions.push_back(NO_GROUP);
}
+
+ GoToRow(nRow);
+ m_pParent->DisplayData(nRow);
+ }
+ catch(uno::Exception&)
+ {
+ TOOLS_WARN_EXCEPTION( "reportdesign", "OFieldExpressionControl::SaveModified");
}
return true;
diff --git a/reportdesign/source/ui/report/ReportController.cxx b/reportdesign/source/ui/report/ReportController.cxx
index af893f91d253..d81d100bc129 100644
--- a/reportdesign/source/ui/report/ReportController.cxx
+++ b/reportdesign/source/ui/report/ReportController.cxx
@@ -3023,38 +3023,38 @@ void OReportController::insertGraphic()
sal_Bool SAL_CALL OReportController::select( const Any& aSelection )
{
::osl::MutexGuard aGuard( getMutex() );
- if ( getDesignView() )
- {
- getDesignView()->unmarkAllObjects();
- getDesignView()->SetMode(DlgEdMode::Select);
+ if ( !getDesignView() )
+ return true;
- uno::Sequence< uno::Reference<report::XReportComponent> > aElements;
- if ( aSelection >>= aElements )
+ getDesignView()->unmarkAllObjects();
+ getDesignView()->SetMode(DlgEdMode::Select);
+
+ uno::Sequence< uno::Reference<report::XReportComponent> > aElements;
+ if ( aSelection >>= aElements )
+ {
+ if ( aElements.hasElements() )
+ getDesignView()->showProperties(uno::Reference<uno::XInterface>(aElements[0],uno::UNO_QUERY));
+ getDesignView()->setMarked(aElements, true);
+ }
+ else
+ {
+ uno::Reference<uno::XInterface> xObject(aSelection,uno::UNO_QUERY);
+ uno::Reference<report::XReportComponent> xProp(xObject,uno::UNO_QUERY);
+ if ( xProp.is() )
{
- if ( aElements.hasElements() )
- getDesignView()->showProperties(uno::Reference<uno::XInterface>(aElements[0],uno::UNO_QUERY));
+ getDesignView()->showProperties(xObject);
+ aElements = { xProp };
getDesignView()->setMarked(aElements, true);
}
else
{
- uno::Reference<uno::XInterface> xObject(aSelection,uno::UNO_QUERY);
- uno::Reference<report::XReportComponent> xProp(xObject,uno::UNO_QUERY);
- if ( xProp.is() )
- {
+ uno::Reference<report::XSection> xSection(aSelection,uno::UNO_QUERY);
+ if ( !xSection.is() && xObject.is() )
getDesignView()->showProperties(xObject);
- aElements = { xProp };
- getDesignView()->setMarked(aElements, true);
- }
- else
- {
- uno::Reference<report::XSection> xSection(aSelection,uno::UNO_QUERY);
- if ( !xSection.is() && xObject.is() )
- getDesignView()->showProperties(xObject);
- getDesignView()->setMarked(xSection,xSection.is());
- }
+ getDesignView()->setMarked(xSection,xSection.is());
}
- InvalidateAll();
}
+ InvalidateAll();
return true;
}