summaryrefslogtreecommitdiff
path: root/sc/source/ui/docshell/docsh.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source/ui/docshell/docsh.cxx')
-rw-r--r--sc/source/ui/docshell/docsh.cxx439
1 files changed, 226 insertions, 213 deletions
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 221b5d8a439c..6ad8123c3659 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -78,7 +78,6 @@
#include <com/sun/star/ui/XAcceleratorConfiguration.hpp>
#include <basic/sbstar.hxx>
#include <basic/basmgr.hxx>
-#include <vbahelper/vbaaccesshelper.hxx>
#include "scabstdlg.hxx"
#include <sot/formats.hxx>
@@ -268,7 +267,7 @@ sal_uInt16 ScDocShell::GetHiddenInformationState( sal_uInt16 nStates )
{
SCTAB nTableCount = aDocument.GetTableCount();
SCTAB nTable = 0;
- sal_Bool bFound(sal_False);
+ sal_Bool bFound(false);
while ( nTable < nTableCount && !bFound )
{
ScCellIterator aCellIter( &aDocument, 0,0, nTable, MAXCOL,MAXROW, nTable );
@@ -287,17 +286,17 @@ sal_uInt16 ScDocShell::GetHiddenInformationState( sal_uInt16 nStates )
void ScDocShell::BeforeXMLLoading()
{
- aDocument.DisableIdle( TRUE );
+ aDocument.DisableIdle( sal_True );
// prevent unnecessary broadcasts and updates
DBG_ASSERT(pModificator == NULL, "The Modificator should not exist");
pModificator = new ScDocShellModificator( *this );
- aDocument.SetImportingXML( TRUE );
+ aDocument.SetImportingXML( sal_True );
aDocument.EnableExecuteLink( false ); // #i101304# to be safe, prevent nested loading from external references
- aDocument.EnableUndo( FALSE );
+ aDocument.EnableUndo( false );
// prevent unnecessary broadcasts and "half way listeners"
- aDocument.SetInsertingFromOtherDoc( TRUE );
+ aDocument.SetInsertingFromOtherDoc( sal_True );
if (GetCreateMode() != SFX_CREATE_MODE_ORGANIZER)
ScColumn::bDoubleAlloc = sal_True;
@@ -309,7 +308,7 @@ void ScDocShell::AfterXMLLoading(sal_Bool bRet)
{
UpdateLinks();
// don't prevent establishing of listeners anymore
- aDocument.SetInsertingFromOtherDoc( FALSE );
+ aDocument.SetInsertingFromOtherDoc( false );
if ( bRet )
{
ScChartListenerCollection* pChartListener = aDocument.GetChartListenerCollection();
@@ -336,12 +335,12 @@ void ScDocShell::AfterXMLLoading(sal_Bool bRet)
ScGlobal::UnicodeStrChr( pNameBuffer, SC_COMPILER_FILE_TAB_SEP ) )
{
rtl::OUStringBuffer aDocURLBuffer;
- BOOL bQuote = TRUE; // Dokumentenname ist immer quoted
+ sal_Bool bQuote = sal_True; // Dokumentenname ist immer quoted
++pNameBuffer;
while ( bQuote && *pNameBuffer )
{
if ( *pNameBuffer == '\'' && *(pNameBuffer-1) != '\\' )
- bQuote = FALSE;
+ bQuote = false;
else if( !(*pNameBuffer == '\\' && *(pNameBuffer+1) == '\'') )
aDocURLBuffer.append(*pNameBuffer); // falls escaped Quote: nur Quote in den Namen
++pNameBuffer;
@@ -357,7 +356,7 @@ void ScDocShell::AfterXMLLoading(sal_Bool bRet)
!aINetURLObject.HasError()) // the docname should be a valid URL
{
aName = ScGlobal::GetDocTabName( aDocument.GetLinkDoc( i ), aDocument.GetLinkTab( i ) );
- aDocument.RenameTab(i, aName, TRUE, TRUE);
+ aDocument.RenameTab(i, aName, sal_True, sal_True);
}
// else; nothing has to happen, because it is a user given name
}
@@ -383,15 +382,15 @@ void ScDocShell::AfterXMLLoading(sal_Bool bRet)
}
}
}
- ScColumn::bDoubleAlloc = sal_False;
+ ScColumn::bDoubleAlloc = false;
}
else
- aDocument.SetInsertingFromOtherDoc( FALSE );
+ aDocument.SetInsertingFromOtherDoc( false );
- aDocument.SetImportingXML( FALSE );
+ aDocument.SetImportingXML( false );
aDocument.EnableExecuteLink( true );
- aDocument.EnableUndo( TRUE );
- bIsEmpty = FALSE;
+ aDocument.EnableUndo( sal_True );
+ bIsEmpty = false;
if (pModificator)
{
@@ -403,7 +402,7 @@ void ScDocShell::AfterXMLLoading(sal_Bool bRet)
OSL_FAIL("The Modificator should exist");
}
- aDocument.DisableIdle( FALSE );
+ aDocument.DisableIdle( false );
}
namespace {
@@ -427,7 +426,7 @@ private:
}
-BOOL ScDocShell::LoadXML( SfxMedium* pLoadMedium, const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStor )
+sal_Bool ScDocShell::LoadXML( SfxMedium* pLoadMedium, const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStor )
{
LoadMediumGuard aLoadGuard(&aDocument);
@@ -440,21 +439,21 @@ BOOL ScDocShell::LoadXML( SfxMedium* pLoadMedium, const ::com::sun::star::uno::R
// #i62677# BeforeXMLLoading is also called from ScXMLImport::startDocument when invoked
// from an external component. The XMLFromWrapper flag is only set here, when called
// through ScDocShell.
- aDocument.SetXMLFromWrapper( TRUE );
+ aDocument.SetXMLFromWrapper( sal_True );
ScXMLImportWrapper aImport( aDocument, pLoadMedium, xStor );
- sal_Bool bRet(sal_False);
+ sal_Bool bRet(false);
ErrCode nError = ERRCODE_NONE;
if (GetCreateMode() != SFX_CREATE_MODE_ORGANIZER)
- bRet = aImport.Import(sal_False, nError);
+ bRet = aImport.Import(false, nError);
else
bRet = aImport.Import(sal_True, nError);
if ( nError )
pLoadMedium->SetError( nError, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
- aDocument.SetXMLFromWrapper( FALSE );
+ aDocument.SetXMLFromWrapper( false );
AfterXMLLoading(bRet);
//! row heights...
@@ -462,25 +461,25 @@ BOOL ScDocShell::LoadXML( SfxMedium* pLoadMedium, const ::com::sun::star::uno::R
return bRet;
}
-BOOL ScDocShell::SaveXML( SfxMedium* pSaveMedium, const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStor )
+sal_Bool ScDocShell::SaveXML( SfxMedium* pSaveMedium, const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStor )
{
RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "sc", "sb99857", "ScDocShell::SaveXML" );
- aDocument.DisableIdle( TRUE );
+ aDocument.DisableIdle( sal_True );
ScXMLImportWrapper aImport( aDocument, pSaveMedium, xStor );
- sal_Bool bRet(sal_False);
+ sal_Bool bRet(false);
if (GetCreateMode() != SFX_CREATE_MODE_ORGANIZER)
- bRet = aImport.Export(sal_False);
+ bRet = aImport.Export(false);
else
bRet = aImport.Export(sal_True);
- aDocument.DisableIdle( FALSE );
+ aDocument.DisableIdle( false );
return bRet;
}
-BOOL ScDocShell::Load( SfxMedium& rMedium )
+sal_Bool ScDocShell::Load( SfxMedium& rMedium )
{
RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "sc", "nn93723", "ScDocShell::Load" );
LoadMediumGuard aLoadGuard(&aDocument);
@@ -492,12 +491,12 @@ BOOL ScDocShell::Load( SfxMedium& rMedium )
GetUndoManager()->Clear();
- BOOL bRet = SfxObjectShell::Load( rMedium );
+ sal_Bool bRet = SfxObjectShell::Load( rMedium );
if( bRet )
{
if (GetMedium())
{
- SFX_ITEMSET_ARG( rMedium.GetItemSet(), pUpdateDocItem, SfxUInt16Item, SID_UPDATEDOCMODE, sal_False);
+ SFX_ITEMSET_ARG( rMedium.GetItemSet(), pUpdateDocItem, SfxUInt16Item, SID_UPDATEDOCMODE, false);
nCanUpdate = pUpdateDocItem ? pUpdateDocItem->GetValue() : com::sun::star::document::UpdateDocMode::NO_UPDATE;
}
@@ -525,7 +524,7 @@ BOOL ScDocShell::Load( SfxMedium& rMedium )
if ( bRet )
aDocument.InvalidateTableArea();
- bIsEmpty = FALSE;
+ bIsEmpty = false;
FinishedLoading( SFX_LOADED_MAINDOCUMENT | SFX_LOADED_IMAGES );
return bRet;
}
@@ -548,7 +547,7 @@ void ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
}
else if ( rHint.ISA( SfxEventHint ) )
{
- ULONG nEventId = static_cast< const SfxEventHint& >( rHint ).GetEventId();
+ sal_uLong nEventId = static_cast< const SfxEventHint& >( rHint ).GetEventId();
switch ( nEventId )
{
case SFX_EVENT_ACTIVATEDOC:
@@ -587,6 +586,13 @@ void ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
xVbaEvents->processVbaEvent( WORKBOOK_AFTERSAVE, aArgs );
}
break;
+ case SFX_EVENT_CLOSEDOC:
+ {
+ // #163655# prevent event processing after model is disposed
+ aDocument.SetVbaEventProcessor( uno::Reference< script::vba::XVBAEventProcessor >() );
+ uno::Reference< lang::XEventListener >( xVbaEvents, uno::UNO_QUERY_THROW )->disposing( lang::EventObject() );
+ }
+ break;
}
}
}
@@ -596,7 +602,7 @@ void ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
if (rHint.ISA(SfxSimpleHint)) // ohne Parameter
{
- ULONG nSlot = ((const SfxSimpleHint&)rHint).GetId();
+ sal_uLong nSlot = ((const SfxSimpleHint&)rHint).GetId();
switch ( nSlot )
{
case SFX_HINT_TITLECHANGED:
@@ -620,7 +626,7 @@ void ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
ScRange aRange = rStlHint.GetRange();
String aName1 = rStlHint.GetStyle1();
String aName2 = rStlHint.GetStyle2();
- UINT32 nTimeout = rStlHint.GetTimeout();
+ sal_uInt32 nTimeout = rStlHint.GetTimeout();
if (!pAutoStyleList)
pAutoStyleList = new ScAutoStyleList(this);
@@ -628,7 +634,7 @@ void ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
}
else if ( rHint.ISA( SfxEventHint ) )
{
- ULONG nEventId = ((SfxEventHint&)rHint).GetEventId();
+ sal_uLong nEventId = ((SfxEventHint&)rHint).GetEventId();
switch ( nEventId )
{
case SFX_EVENT_LOADFINISHED:
@@ -636,7 +642,7 @@ void ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
// the readonly documents should not be opened in shared mode
if ( HasSharedXMLFlagSet() && !SC_MOD()->IsInSharedDocLoading() && !IsReadOnly() )
{
- if ( SwitchToShared( sal_True, sal_False ) )
+ if ( SwitchToShared( sal_True, false ) )
{
ScViewData* pViewData = GetViewData();
ScTabView* pTabView = ( pViewData ? dynamic_cast< ScTabView* >( pViewData->GetView() ) : NULL );
@@ -652,25 +658,6 @@ void ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
SetReadOnlyUI( sal_True );
}
}
-
- // VBA specific initialization
- if( aDocument.IsInVBAMode() ) try
- {
- uno::Reference< frame::XModel > xModel( GetModel(), uno::UNO_SET_THROW );
-
- // create VBAGlobals object if not yet done (this also creates the "ThisExcelDoc" symbol)
- uno::Reference< lang::XMultiServiceFactory > xFactory( xModel, uno::UNO_QUERY_THROW );
- xFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VBAGlobals" ) ) );
-
- // create the VBA document event processor
- uno::Sequence< uno::Any > aArgs( 1 );
- aArgs[ 0 ] <<= xModel;
- xVbaEvents.set( ooo::vba::createVBAUnoAPIServiceWithArgs( this, "com.sun.star.script.vba.VBASpreadsheetEventProcessor" , aArgs ), uno::UNO_QUERY );
- aDocument.SetVbaEventProcessor( xVbaEvents );
- }
- catch( uno::Exception& )
- {
- }
}
break;
case SFX_EVENT_VIEWCREATED:
@@ -684,7 +671,7 @@ void ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
ScGlobal::GetRscString( STR_SHARED_DOC_WARNING ) );
aBox.SetDefaultCheckBoxText();
aBox.Execute();
- BOOL bChecked = aBox.GetCheckBoxState();
+ sal_Bool bChecked = aBox.GetCheckBoxState();
if ( bChecked )
{
aAppOptions.SetShowSharedDocumentWarning( !bChecked );
@@ -841,8 +828,8 @@ void ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
ScChangeViewSettings* pChangeViewSet = aDocument.GetChangeViewSettings();
if ( pChangeViewSet && pChangeViewSet->ShowChanges() )
{
- pChangeViewSet->SetShowChanges( FALSE );
- pChangeViewSet->SetShowAccepted( FALSE );
+ pChangeViewSet->SetShowChanges( false );
+ pChangeViewSet->SetShowAccepted( false );
aDocument.SetChangeViewSettings( *pChangeViewSet );
bChangedViewSettings = true;
}
@@ -853,7 +840,7 @@ void ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
aValues[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "FilterName"));
aValues[0].Value <<= ::rtl::OUString( GetMedium()->GetFilter()->GetFilterName() );
- SFX_ITEMSET_ARG( GetMedium()->GetItemSet(), pPasswordItem, SfxStringItem, SID_PASSWORD, sal_False);
+ SFX_ITEMSET_ARG( GetMedium()->GetItemSet(), pPasswordItem, SfxStringItem, SID_PASSWORD, false);
if ( pPasswordItem && pPasswordItem->GetValue().Len() )
{
aValues.realloc( 2 );
@@ -867,8 +854,8 @@ void ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
if ( bChangedViewSettings )
{
- pChangeViewSet->SetShowChanges( TRUE );
- pChangeViewSet->SetShowAccepted( TRUE );
+ pChangeViewSet->SetShowChanges( sal_True );
+ pChangeViewSet->SetShowAccepted( sal_True );
aDocument.SetChangeViewSettings( *pChangeViewSet );
}
}
@@ -963,7 +950,7 @@ void ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
// Inhalte fuer Organizer laden
-BOOL ScDocShell::LoadFrom( SfxMedium& rMedium )
+sal_Bool ScDocShell::LoadFrom( SfxMedium& rMedium )
{
RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "sc", "nn93723", "ScDocShell::LoadFrom" );
LoadMediumGuard aLoadGuard(&aDocument);
@@ -971,11 +958,11 @@ BOOL ScDocShell::LoadFrom( SfxMedium& rMedium )
WaitObject aWait( GetActiveDialogParent() );
- BOOL bRet = FALSE;
+ sal_Bool bRet = false;
if (GetMedium())
{
- SFX_ITEMSET_ARG( rMedium.GetItemSet(), pUpdateDocItem, SfxUInt16Item, SID_UPDATEDOCMODE, sal_False);
+ SFX_ITEMSET_ARG( rMedium.GetItemSet(), pUpdateDocItem, SfxUInt16Item, SID_UPDATEDOCMODE, false);
nCanUpdate = pUpdateDocItem ? pUpdateDocItem->GetValue() : com::sun::star::document::UpdateDocMode::NO_UPDATE;
}
@@ -1018,13 +1005,13 @@ static void lcl_parseHtmlFilterOption(const OUString& rOption, LanguageType& rLa
rDateConvert = static_cast<bool>(aTokens[1].toInt32());
}
-BOOL ScDocShell::ConvertFrom( SfxMedium& rMedium )
+sal_Bool ScDocShell::ConvertFrom( SfxMedium& rMedium )
{
RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "sc", "nn93723", "ScDocShell::ConvertFrom" );
LoadMediumGuard aLoadGuard(&aDocument);
- BOOL bRet = FALSE; // FALSE heisst Benutzerabbruch !!
+ sal_Bool bRet = false; // sal_False heisst Benutzerabbruch !!
// bei Fehler: Fehler am Stream setzen!!
ScRefreshTimerProtector( aDocument.GetRefreshTimerControlAddress() );
@@ -1032,12 +1019,12 @@ BOOL ScDocShell::ConvertFrom( SfxMedium& rMedium )
GetUndoManager()->Clear();
// ob nach dem Import optimale Spaltenbreiten gesetzt werden sollen
- BOOL bSetColWidths = FALSE;
- BOOL bSetSimpleTextColWidths = FALSE;
+ sal_Bool bSetColWidths = false;
+ sal_Bool bSetSimpleTextColWidths = false;
ScColWidthParam aColWidthParam[MAXCOLCOUNT];
ScRange aColWidthRange;
// ob nach dem Import optimale Zeilenhoehen gesetzt werden sollen
- BOOL bSetRowHeights = FALSE;
+ sal_Bool bSetRowHeights = false;
vector<ScDocRowHeightUpdater::TabRanges> aRecalcRowRangesArray;
@@ -1048,7 +1035,7 @@ BOOL ScDocShell::ConvertFrom( SfxMedium& rMedium )
// Datei uebertragen wird.
rMedium.GetPhysicalName(); //! CreateFileStream direkt rufen, wenn verfuegbar
- SFX_ITEMSET_ARG( rMedium.GetItemSet(), pUpdateDocItem, SfxUInt16Item, SID_UPDATEDOCMODE, sal_False);
+ SFX_ITEMSET_ARG( rMedium.GetItemSet(), pUpdateDocItem, SfxUInt16Item, SID_UPDATEDOCMODE, false);
nCanUpdate = pUpdateDocItem ? pUpdateDocItem->GetValue() : com::sun::star::document::UpdateDocMode::NO_UPDATE;
const SfxFilter* pFilter = rMedium.GetFilter();
@@ -1058,10 +1045,10 @@ BOOL ScDocShell::ConvertFrom( SfxMedium& rMedium )
aConvFilterName=aFltName; //@ #BugId 54198
- BOOL bCalc3 = ( aFltName.EqualsAscii(pFilterSc30) );
- BOOL bCalc4 = ( aFltName.EqualsAscii(pFilterSc40) );
+ sal_Bool bCalc3 = ( aFltName.EqualsAscii(pFilterSc30) );
+ sal_Bool bCalc4 = ( aFltName.EqualsAscii(pFilterSc40) );
if (!bCalc3 && !bCalc4)
- aDocument.SetInsertingFromOtherDoc( TRUE );
+ aDocument.SetInsertingFromOtherDoc( sal_True );
if (aFltName.EqualsAscii(pFilterXML))
bRet = LoadXML( &rMedium, NULL );
@@ -1077,7 +1064,7 @@ BOOL ScDocShell::ConvertFrom( SfxMedium& rMedium )
SetError(eError, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ));
}
else
- bRet = TRUE;
+ bRet = sal_True;
}
}
else if (aFltName.EqualsAscii(pFilterLotus))
@@ -1086,7 +1073,7 @@ BOOL ScDocShell::ConvertFrom( SfxMedium& rMedium )
SfxItemSet* pSet = rMedium.GetItemSet();
const SfxPoolItem* pItem;
if ( pSet && SFX_ITEM_SET ==
- pSet->GetItemState( SID_FILE_FILTEROPTIONS, TRUE, &pItem ) )
+ pSet->GetItemState( SID_FILE_FILTEROPTIONS, sal_True, &pItem ) )
{
sItStr = ((const SfxStringItem*)pItem)->GetValue();
}
@@ -1098,22 +1085,22 @@ BOOL ScDocShell::ConvertFrom( SfxMedium& rMedium )
sItStr = ScGlobal::GetCharsetString( RTL_TEXTENCODING_IBM_437 );
}
- ScColumn::bDoubleAlloc = TRUE;
+ ScColumn::bDoubleAlloc = sal_True;
FltError eError = ScFormatFilter::Get().ScImportLotus123( rMedium, &aDocument,
ScGlobal::GetCharsetValue(sItStr));
- ScColumn::bDoubleAlloc = FALSE;
+ ScColumn::bDoubleAlloc = false;
if (eError != eERR_OK)
{
if (!GetError())
SetError(eError, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ));
if( ( eError & ERRCODE_WARNING_MASK ) == ERRCODE_WARNING_MASK )
- bRet = TRUE;
+ bRet = sal_True;
}
else
- bRet = TRUE;
- bSetColWidths = TRUE;
- bSetRowHeights = TRUE;
+ bRet = sal_True;
+ bSetColWidths = sal_True;
+ bSetRowHeights = sal_True;
}
else if ( aFltName.EqualsAscii(pFilterExcel4) || aFltName.EqualsAscii(pFilterExcel5) ||
aFltName.EqualsAscii(pFilterExcel95) || aFltName.EqualsAscii(pFilterExcel97) ||
@@ -1131,9 +1118,9 @@ BOOL ScDocShell::ConvertFrom( SfxMedium& rMedium )
MakeDrawLayer(); //! im Filter
CalcOutputFactor(); // prepare update of row height
- ScColumn::bDoubleAlloc = TRUE;
+ ScColumn::bDoubleAlloc = true;
FltError eError = ScFormatFilter::Get().ScImportExcel( rMedium, &aDocument, eFormat );
- ScColumn::bDoubleAlloc = FALSE;
+ ScColumn::bDoubleAlloc = false;
aDocument.UpdateFontCharSet();
if ( aDocument.IsChartListenerCollectionNeedsUpdate() )
aDocument.UpdateChartListenerCollection(); //! fuer alle Importe?
@@ -1145,7 +1132,7 @@ BOOL ScDocShell::ConvertFrom( SfxMedium& rMedium )
{
if (!GetError())
SetError(eError, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ));
- bRet = TRUE;
+ bRet = sal_True;
}
else if (eError != eERR_OK)
{
@@ -1153,20 +1140,20 @@ BOOL ScDocShell::ConvertFrom( SfxMedium& rMedium )
SetError(eError, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ));
}
else
- bRet = TRUE;
+ bRet = true;
}
else if (aFltName.EqualsAscii(pFilterAscii))
{
SfxItemSet* pSet = rMedium.GetItemSet();
const SfxPoolItem* pItem;
ScAsciiOptions aOptions;
- BOOL bOptInit = FALSE;
+ sal_Bool bOptInit = false;
if ( pSet && SFX_ITEM_SET ==
- pSet->GetItemState( SID_FILE_FILTEROPTIONS, TRUE, &pItem ) )
+ pSet->GetItemState( SID_FILE_FILTEROPTIONS, sal_True, &pItem ) )
{
aOptions.ReadFromString( ((const SfxStringItem*)pItem)->GetValue() );
- bOptInit = TRUE;
+ bOptInit = sal_True;
}
if ( !bOptInit )
@@ -1180,7 +1167,7 @@ BOOL ScDocShell::ConvertFrom( SfxMedium& rMedium )
}
FltError eError = eERR_OK;
- BOOL bOverflow = FALSE;
+ sal_Bool bOverflow = false;
if( ! rMedium.IsStorage() )
{
@@ -1214,8 +1201,8 @@ BOOL ScDocShell::ConvertFrom( SfxMedium& rMedium )
if (!GetError())
SetError(SCWARN_IMPORT_RANGE_OVERFLOW, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ));
}
- bSetColWidths = TRUE;
- bSetSimpleTextColWidths = TRUE;
+ bSetColWidths = sal_True;
+ bSetSimpleTextColWidths = sal_True;
}
else if (aFltName.EqualsAscii(pFilterDBase))
{
@@ -1223,7 +1210,7 @@ BOOL ScDocShell::ConvertFrom( SfxMedium& rMedium )
SfxItemSet* pSet = rMedium.GetItemSet();
const SfxPoolItem* pItem;
if ( pSet && SFX_ITEM_SET ==
- pSet->GetItemState( SID_FILE_FILTEROPTIONS, TRUE, &pItem ) )
+ pSet->GetItemState( SID_FILE_FILTEROPTIONS, sal_True, &pItem ) )
{
sItStr = ((const SfxStringItem*)pItem)->GetValue();
}
@@ -1237,7 +1224,7 @@ BOOL ScDocShell::ConvertFrom( SfxMedium& rMedium )
}
ScDocRowHeightUpdater::TabRanges aRecalcRanges(0);
- ULONG eError = DBaseImport( rMedium.GetPhysicalName(),
+ sal_uLong eError = DBaseImport( rMedium.GetPhysicalName(),
ScGlobal::GetCharsetValue(sItStr), aColWidthParam, *aRecalcRanges.mpRanges );
aRecalcRowRangesArray.push_back(aRecalcRanges);
@@ -1248,11 +1235,11 @@ BOOL ScDocShell::ConvertFrom( SfxMedium& rMedium )
bRet = ( eError == SCWARN_IMPORT_RANGE_OVERFLOW );
}
else
- bRet = TRUE;
+ bRet = sal_True;
aColWidthRange.aStart.SetRow( 1 ); // Spaltenheader nicht
- bSetColWidths = TRUE;
- bSetSimpleTextColWidths = TRUE;
+ bSetColWidths = true;
+ bSetSimpleTextColWidths = true;
}
else if (aFltName.EqualsAscii(pFilterDif))
{
@@ -1264,7 +1251,7 @@ BOOL ScDocShell::ConvertFrom( SfxMedium& rMedium )
SfxItemSet* pSet = rMedium.GetItemSet();
const SfxPoolItem* pItem;
if ( pSet && SFX_ITEM_SET ==
- pSet->GetItemState( SID_FILE_FILTEROPTIONS, TRUE, &pItem ) )
+ pSet->GetItemState( SID_FILE_FILTEROPTIONS, sal_True, &pItem ) )
{
sItStr = ((const SfxStringItem*)pItem)->GetValue();
}
@@ -1285,14 +1272,14 @@ BOOL ScDocShell::ConvertFrom( SfxMedium& rMedium )
SetError(eError, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ));
if( ( eError & ERRCODE_WARNING_MASK ) == ERRCODE_WARNING_MASK )
- bRet = TRUE;
+ bRet = sal_True;
}
else
- bRet = TRUE;
+ bRet = sal_True;
}
- bSetColWidths = TRUE;
- bSetSimpleTextColWidths = TRUE;
- bSetRowHeights = TRUE;
+ bSetColWidths = sal_True;
+ bSetSimpleTextColWidths = sal_True;
+ bSetRowHeights = sal_True;
}
else if (aFltName.EqualsAscii(pFilterSylk))
{
@@ -1318,29 +1305,29 @@ BOOL ScDocShell::ConvertFrom( SfxMedium& rMedium )
if ( eError != eERR_OK && !GetError() )
SetError(eError, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ));
- bSetColWidths = TRUE;
- bSetSimpleTextColWidths = TRUE;
- bSetRowHeights = TRUE;
+ bSetColWidths = sal_True;
+ bSetSimpleTextColWidths = sal_True;
+ bSetRowHeights = sal_True;
}
else if (aFltName.EqualsAscii(pFilterQPro6))
{
- ScColumn::bDoubleAlloc = TRUE;
+ ScColumn::bDoubleAlloc = sal_True;
FltError eError = ScFormatFilter::Get().ScImportQuattroPro( rMedium, &aDocument);
- ScColumn::bDoubleAlloc = FALSE;
+ ScColumn::bDoubleAlloc = false;
if (eError != eERR_OK)
{
if (!GetError())
SetError( eError, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
if( ( eError & ERRCODE_WARNING_MASK ) == ERRCODE_WARNING_MASK )
- bRet = TRUE;
+ bRet = sal_True;
}
else
- bRet = TRUE;
+ bRet = sal_True;
// TODO: Filter should set column widths. Not doing it here, it may
// result in very narrow or wide columns, depending on content.
// Setting row heights makes cells with font size attribution or
// wrapping enabled look nicer..
- bSetRowHeights = TRUE;
+ bSetRowHeights = sal_True;
}
else if (aFltName.EqualsAscii(pFilterRtf))
{
@@ -1359,14 +1346,14 @@ BOOL ScDocShell::ConvertFrom( SfxMedium& rMedium )
SetError(eError, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ));
if( ( eError & ERRCODE_WARNING_MASK ) == ERRCODE_WARNING_MASK )
- bRet = TRUE;
+ bRet = sal_True;
}
else
- bRet = TRUE;
+ bRet = sal_True;
aDocument.StartAllListeners();
aDocument.SetDirty();
- bSetColWidths = TRUE;
- bSetRowHeights = TRUE;
+ bSetColWidths = sal_True;
+ bSetRowHeights = sal_True;
}
else
{
@@ -1380,7 +1367,7 @@ BOOL ScDocShell::ConvertFrom( SfxMedium& rMedium )
else if (aFltName.EqualsAscii(pFilterHtml) || aFltName.EqualsAscii(pFilterHtmlWebQ))
{
FltError eError = SCERR_IMPORT_UNKNOWN;
- BOOL bWebQuery = aFltName.EqualsAscii(pFilterHtmlWebQ);
+ sal_Bool bWebQuery = aFltName.EqualsAscii(pFilterHtmlWebQ);
if( !rMedium.IsStorage() )
{
SvStream* pInStream = rMedium.GetInStream();
@@ -1391,7 +1378,7 @@ BOOL ScDocShell::ConvertFrom( SfxMedium& rMedium )
SfxItemSet* pSet = rMedium.GetItemSet();
const SfxPoolItem* pItem;
if ( pSet && SFX_ITEM_SET ==
- pSet->GetItemState( SID_FILE_FILTEROPTIONS, TRUE, &pItem ) )
+ pSet->GetItemState( SID_FILE_FILTEROPTIONS, sal_True, &pItem ) )
{
String aFilterOption = (static_cast<const SfxStringItem*>(pItem))->GetValue();
lcl_parseHtmlFilterOption(aFilterOption, eLang, bDateConvert);
@@ -1410,10 +1397,10 @@ BOOL ScDocShell::ConvertFrom( SfxMedium& rMedium )
SetError(eError, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ));
if( ( eError & ERRCODE_WARNING_MASK ) == ERRCODE_WARNING_MASK )
- bRet = TRUE;
+ bRet = sal_True;
}
else
- bRet = TRUE;
+ bRet = sal_True;
aDocument.StartAllListeners();
aDocument.SetDirty();
}
@@ -1433,7 +1420,7 @@ BOOL ScDocShell::ConvertFrom( SfxMedium& rMedium )
}
if (!bCalc3)
- aDocument.SetInsertingFromOtherDoc( FALSE );
+ aDocument.SetInsertingFromOtherDoc( false );
}
else
{
@@ -1469,11 +1456,11 @@ BOOL ScDocShell::ConvertFrom( SfxMedium& rMedium )
if (!bSetSimpleTextColWidths)
aColWidthParam[nCol].mbSimpleText = false;
- USHORT nWidth = aDocument.GetOptimalColWidth(
- nCol, nTab, &aVirtDev, nPPTX, nPPTY, aZoom, aZoom, FALSE, &aMark,
+ sal_uInt16 nWidth = aDocument.GetOptimalColWidth(
+ nCol, nTab, &aVirtDev, nPPTX, nPPTY, aZoom, aZoom, false, &aMark,
&aColWidthParam[nCol] );
aDocument.SetColWidth( nCol, nTab,
- nWidth + (USHORT)ScGlobal::nLastColWidthExtra );
+ nWidth + (sal_uInt16)ScGlobal::nLastColWidthExtra );
}
}
}
@@ -1500,7 +1487,7 @@ BOOL ScDocShell::ConvertFrom( SfxMedium& rMedium )
if ( bRet )
aDocument.InvalidateTableArea();
- bIsEmpty = FALSE;
+ bIsEmpty = false;
return bRet;
}
@@ -1544,7 +1531,7 @@ ScDocShell::PrepareSaveGuard::~PrepareSaveGuard()
}
-BOOL ScDocShell::Save()
+sal_Bool ScDocShell::Save()
{
RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "sc", "nn93723", "ScDocShell::Save" );
@@ -1553,14 +1540,14 @@ BOOL ScDocShell::Save()
PrepareSaveGuard aPrepareGuard( *this);
// wait cursor is handled with progress bar
- BOOL bRet = SfxObjectShell::Save();
+ sal_Bool bRet = SfxObjectShell::Save();
if( bRet )
bRet = SaveXML( GetMedium(), NULL );
return bRet;
}
-BOOL ScDocShell::SaveAs( SfxMedium& rMedium )
+sal_Bool ScDocShell::SaveAs( SfxMedium& rMedium )
{
RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "sc", "nn93723", "ScDocShell::SaveAs" );
@@ -1582,7 +1569,7 @@ BOOL ScDocShell::SaveAs( SfxMedium& rMedium )
PrepareSaveGuard aPrepareGuard( *this);
// wait cursor is handled with progress bar
- BOOL bRet = SfxObjectShell::SaveAs( rMedium );
+ sal_Bool bRet = SfxObjectShell::SaveAs( rMedium );
if( bRet )
bRet = SaveXML( &rMedium, NULL );
@@ -1590,7 +1577,7 @@ BOOL ScDocShell::SaveAs( SfxMedium& rMedium )
}
-BOOL ScDocShell::IsInformationLost()
+sal_Bool ScDocShell::IsInformationLost()
{
//!!! bei Gelegenheit ein korrekte eigene Behandlung einbauen
@@ -1599,7 +1586,7 @@ BOOL ScDocShell::IsInformationLost()
// Xcl-like column width measured in characters of standard font.
-xub_StrLen lcl_ScDocShell_GetColWidthInChars( USHORT nWidth )
+xub_StrLen lcl_ScDocShell_GetColWidthInChars( sal_uInt16 nWidth )
{
double f = nWidth;
f *= 1328.0 / 25.0;
@@ -1612,7 +1599,7 @@ xub_StrLen lcl_ScDocShell_GetColWidthInChars( USHORT nWidth )
void lcl_ScDocShell_GetFixedWidthString( String& rStr, const ScDocument& rDoc,
- SCTAB nTab, SCCOL nCol, BOOL bValue, SvxCellHorJustify eHorJust )
+ SCTAB nTab, SCCOL nCol, sal_Bool bValue, SvxCellHorJustify eHorJust )
{
xub_StrLen nLen = lcl_ScDocShell_GetColWidthInChars(
rDoc.GetColWidth( nCol, nTab ) );
@@ -1655,7 +1642,7 @@ void lcl_ScDocShell_WriteEmptyFixedWidthString( SvStream& rStream,
const ScDocument& rDoc, SCTAB nTab, SCCOL nCol )
{
String aString;
- lcl_ScDocShell_GetFixedWidthString( aString, rDoc, nTab, nCol, FALSE,
+ lcl_ScDocShell_GetFixedWidthString( aString, rDoc, nTab, nCol, false,
SVX_HOR_JUSTIFY_STANDARD );
rStream.WriteUnicodeOrByteText( aString );
}
@@ -1666,23 +1653,26 @@ void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt
sal_Unicode cDelim = rAsciiOpt.nFieldSepCode;
sal_Unicode cStrDelim = rAsciiOpt.nTextSepCode;
CharSet eCharSet = rAsciiOpt.eCharSet;
- BOOL bFixedWidth = rAsciiOpt.bFixedWidth;
- BOOL bSaveAsShown = rAsciiOpt.bSaveAsShown;
+ sal_Bool bFixedWidth = rAsciiOpt.bFixedWidth;
+ sal_Bool bSaveAsShown = rAsciiOpt.bSaveAsShown;
CharSet eOldCharSet = rStream.GetStreamCharSet();
rStream.SetStreamCharSet( eCharSet );
- USHORT nOldNumberFormatInt = rStream.GetNumberFormatInt();
+ sal_uInt16 nOldNumberFormatInt = rStream.GetNumberFormatInt();
ByteString aStrDelimEncoded; // only used if not Unicode
UniString aStrDelimDecoded; // only used if context encoding
- BOOL bContextOrNotAsciiEncoding;
+ ByteString aDelimEncoded;
+ UniString aDelimDecoded;
+ sal_Bool bContextOrNotAsciiEncoding;
if ( eCharSet == RTL_TEXTENCODING_UNICODE )
{
rStream.StartWritingUnicodeText();
- bContextOrNotAsciiEncoding = FALSE;
+ bContextOrNotAsciiEncoding = false;
}
else
{
aStrDelimEncoded = ByteString( cStrDelim, eCharSet );
+ aDelimEncoded = ByteString( cDelim, eCharSet );
rtl_TextEncodingInfo aInfo;
aInfo.StructSize = sizeof(aInfo);
if ( rtl_getTextEncodingInfo( eCharSet, &aInfo ) )
@@ -1691,10 +1681,13 @@ void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt
(((aInfo.Flags & RTL_TEXTENCODING_INFO_CONTEXT) != 0) ||
((aInfo.Flags & RTL_TEXTENCODING_INFO_ASCII) == 0));
if ( bContextOrNotAsciiEncoding )
+ {
aStrDelimDecoded = String( aStrDelimEncoded, eCharSet );
+ aDelimDecoded = String( aDelimEncoded, eCharSet );
+ }
}
else
- bContextOrNotAsciiEncoding = FALSE;
+ bContextOrNotAsciiEncoding = false;
}
SCCOL nStartCol = 0;
@@ -1712,8 +1705,8 @@ void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt
const ScViewOptions& rOpt = (pViewSh)
? pViewSh->GetViewData()->GetOptions()
: aDocument.GetViewOptions();
- BOOL bShowFormulas = rOpt.GetOption( VOPT_FORMULAS );
- BOOL bTabProtect = aDocument.IsTabProtected( nTab );
+ sal_Bool bShowFormulas = rOpt.GetOption( VOPT_FORMULAS );
+ sal_Bool bTabProtect = aDocument.IsTabProtected( nTab );
SCCOL nCol;
SCROW nRow;
@@ -1728,10 +1721,10 @@ void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt
ScBaseCell* pCell;
while ( ( pCell = aIter.GetNext( nCol, nRow ) ) != NULL )
{
- BOOL bProgress = FALSE; // only upon line change
+ sal_Bool bProgress = false; // only upon line change
if ( nNextRow < nRow )
{ // empty rows or/and empty columns up to end of row
- bProgress = TRUE;
+ bProgress = sal_True;
for ( nEmptyCol = nNextCol; nEmptyCol < nEndCol; nEmptyCol++ )
{ // remaining columns of last row
if ( bFixedWidth )
@@ -1777,7 +1770,7 @@ void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt
}
if ( nCol == nEndCol )
{
- bProgress = TRUE;
+ bProgress = sal_True;
nNextCol = nStartCol;
nNextRow = nRow + 1;
}
@@ -1795,26 +1788,26 @@ void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt
pProtAttr->GetHideFormula() ) )
eType = CELLTYPE_NONE; // hide
}
- BOOL bString;
+ sal_Bool bString;
switch ( eType )
{
case CELLTYPE_NOTE:
case CELLTYPE_NONE:
aString.Erase();
- bString = FALSE;
+ bString = false;
break;
case CELLTYPE_FORMULA :
{
- USHORT nErrCode;
+ sal_uInt16 nErrCode;
if ( bShowFormulas )
{
((ScFormulaCell*)pCell)->GetFormula( aString );
- bString = TRUE;
+ bString = sal_True;
}
else if ( ( nErrCode = ((ScFormulaCell*)pCell)->GetErrCode() ) != 0 )
{
aString = ScGlobal::GetErrorString( nErrCode );
- bString = TRUE;
+ bString = sal_True;
}
else if ( ((ScFormulaCell*)pCell)->IsValue() )
{
@@ -1829,7 +1822,7 @@ void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt
else
{
ScCellFormat::GetInputString( pCell, nFormat, aString, rFormatter );
- bString = FALSE;
+ bString = false;
}
}
else
@@ -1843,7 +1836,7 @@ void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt
}
else
((ScFormulaCell*)pCell)->GetString( aString );
- bString = TRUE;
+ bString = sal_True;
}
}
break;
@@ -1857,7 +1850,7 @@ void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt
}
else
((ScStringCell*)pCell)->GetString( aString );
- bString = TRUE;
+ bString = sal_True;
break;
case CELLTYPE_EDIT :
{
@@ -1866,7 +1859,7 @@ void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt
EditEngine& rEngine = aDocument.GetEditEngine();
rEngine.SetText( *pObj);
aString = rEngine.GetText(); // including LF
- bString = TRUE;
+ bString = sal_True;
}
break;
case CELLTYPE_VALUE :
@@ -1882,14 +1875,14 @@ void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt
else
{
ScCellFormat::GetInputString( pCell, nFormat, aString, rFormatter );
- bString = FALSE;
+ bString = false;
}
}
break;
default:
OSL_FAIL( "ScDocShell::AsciiSave: unknown CellType" );
aString.Erase();
- bString = FALSE;
+ bString = false;
}
if ( bFixedWidth )
@@ -1919,14 +1912,21 @@ void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt
if ( eCharSet == RTL_TEXTENCODING_UNICODE )
{
xub_StrLen nPos = aString.Search( cStrDelim );
+ // #i116636# quotes are needed if text delimiter (quote), field delimiter, or LF is in the cell text
+ bool bNeedQuotes = rAsciiOpt.bQuoteAllText ||
+ ( nPos != STRING_NOTFOUND ) ||
+ ( aString.Search( cDelim ) != STRING_NOTFOUND ) ||
+ ( aString.Search( sal_Unicode(_LF) ) != STRING_NOTFOUND );
while ( nPos != STRING_NOTFOUND )
{
aString.Insert( cStrDelim, nPos );
nPos = aString.Search( cStrDelim, nPos+2 );
}
- rStream.WriteUniOrByteChar( cStrDelim, eCharSet );
+ if ( bNeedQuotes )
+ rStream.WriteUniOrByteChar( cStrDelim, eCharSet );
rStream.WriteUnicodeText( aString );
- rStream.WriteUniOrByteChar( cStrDelim, eCharSet );
+ if ( bNeedQuotes )
+ rStream.WriteUniOrByteChar( cStrDelim, eCharSet );
}
else
{
@@ -1952,6 +1952,10 @@ void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt
UniString aStrDec( aStrEnc, eCharSet );
// search on re-decoded string
xub_StrLen nPos = aStrDec.Search( aStrDelimDecoded );
+ bool bNeedQuotes = rAsciiOpt.bQuoteAllText ||
+ ( nPos != STRING_NOTFOUND ) ||
+ ( aStrDec.Search( aDelimDecoded ) != STRING_NOTFOUND ) ||
+ ( aStrDec.Search( sal_Unicode(_LF) ) != STRING_NOTFOUND );
while ( nPos != STRING_NOTFOUND )
{
aStrDec.Insert( aStrDelimDecoded, nPos );
@@ -1959,15 +1963,21 @@ void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt
nPos+1+aStrDelimDecoded.Len() );
}
// write byte re-encoded
- rStream.WriteUniOrByteChar( cStrDelim, eCharSet );
+ if ( bNeedQuotes )
+ rStream.WriteUniOrByteChar( cStrDelim, eCharSet );
rStream.WriteUnicodeOrByteText( aStrDec, eCharSet );
- rStream.WriteUniOrByteChar( cStrDelim, eCharSet );
+ if ( bNeedQuotes )
+ rStream.WriteUniOrByteChar( cStrDelim, eCharSet );
}
else
{
ByteString aStrEnc( aString, eCharSet );
// search on encoded string
xub_StrLen nPos = aStrEnc.Search( aStrDelimEncoded );
+ bool bNeedQuotes = rAsciiOpt.bQuoteAllText ||
+ ( nPos != STRING_NOTFOUND ) ||
+ ( aStrEnc.Search( aDelimEncoded ) != STRING_NOTFOUND ) ||
+ ( aStrEnc.Search( sal_Char(_LF) ) != STRING_NOTFOUND );
while ( nPos != STRING_NOTFOUND )
{
aStrEnc.Insert( aStrDelimEncoded, nPos );
@@ -1975,11 +1985,13 @@ void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt
nPos+1+aStrDelimEncoded.Len() );
}
// write byte encoded
- rStream.Write( aStrDelimEncoded.GetBuffer(),
- aStrDelimEncoded.Len() );
+ if ( bNeedQuotes )
+ rStream.Write( aStrDelimEncoded.GetBuffer(),
+ aStrDelimEncoded.Len() );
rStream.Write( aStrEnc.GetBuffer(), aStrEnc.Len() );
- rStream.Write( aStrDelimEncoded.GetBuffer(),
- aStrDelimEncoded.Len() );
+ if ( bNeedQuotes )
+ rStream.Write( aStrDelimEncoded.GetBuffer(),
+ aStrDelimEncoded.Len() );
}
}
}
@@ -2033,7 +2045,7 @@ void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt
rStream.SetNumberFormatInt( nOldNumberFormatInt );
}
-BOOL ScDocShell::ConvertTo( SfxMedium &rMed )
+sal_Bool ScDocShell::ConvertTo( SfxMedium &rMed )
{
RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "sc", "nn93723", "ScDocShell::ConvertTo" );
@@ -2049,7 +2061,7 @@ BOOL ScDocShell::ConvertTo( SfxMedium &rMed )
DBG_ASSERT( rMed.GetFilter(), "Filter == 0" );
- BOOL bRet = FALSE;
+ sal_Bool bRet = false;
String aFltName = rMed.GetFilter()->GetFilterName();
if (aFltName.EqualsAscii(pFilterXML))
@@ -2123,7 +2135,7 @@ BOOL ScDocShell::ConvertTo( SfxMedium &rMed )
SfxItemSet* pSet = rMed.GetItemSet();
const SfxPoolItem* pItem;
if ( pSet && SFX_ITEM_SET ==
- pSet->GetItemState( SID_FILE_FILTEROPTIONS, TRUE, &pItem ) )
+ pSet->GetItemState( SID_FILE_FILTEROPTIONS, sal_True, &pItem ) )
{
sItStr = ((const SfxStringItem*)pItem)->GetValue();
}
@@ -2140,7 +2152,7 @@ BOOL ScDocShell::ConvertTo( SfxMedium &rMed )
WaitObject aWait( GetActiveDialogParent() );
ScImportOptions aOptions( sItStr );
AsciiSave( *pStream, aOptions );
- bRet = TRUE;
+ bRet = sal_True;
if (aDocument.GetTableCount() > 1)
if (!rMed.GetError())
@@ -2153,7 +2165,7 @@ BOOL ScDocShell::ConvertTo( SfxMedium &rMed )
SfxItemSet* pSet = rMed.GetItemSet();
const SfxPoolItem* pItem;
if ( pSet && SFX_ITEM_SET ==
- pSet->GetItemState( SID_FILE_FILTEROPTIONS, TRUE, &pItem ) )
+ pSet->GetItemState( SID_FILE_FILTEROPTIONS, sal_True, &pItem ) )
{
sCharSet = ((const SfxStringItem*)pItem)->GetValue();
}
@@ -2169,9 +2181,9 @@ BOOL ScDocShell::ConvertTo( SfxMedium &rMed )
WaitObject aWait( GetActiveDialogParent() );
// HACK damit Sba geoffnetes TempFile ueberschreiben kann
rMed.CloseOutStream();
- BOOL bHasMemo = FALSE;
+ sal_Bool bHasMemo = false;
- ULONG eError = DBaseExport( rMed.GetPhysicalName(),
+ sal_uLong eError = DBaseExport( rMed.GetPhysicalName(),
ScGlobal::GetCharsetValue(sCharSet), bHasMemo );
if ( eError != eERR_OK && (eError & ERRCODE_WARNING_MASK) )
@@ -2191,7 +2203,7 @@ BOOL ScDocShell::ConvertTo( SfxMedium &rMed )
}
else
{
- bRet = TRUE;
+ bRet = sal_True;
if ( bHasMemo )
{
SfxStringItem* pNameItem =
@@ -2199,9 +2211,9 @@ BOOL ScDocShell::ConvertTo( SfxMedium &rMed )
INetURLObject aDbtFile( pNameItem->GetValue(), INET_PROT_FILE );
aDbtFile.setExtension( String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("dbt")) );
if ( IsDocument( aDbtFile ) && !KillFile( aDbtFile ) )
- bRet = FALSE;
+ bRet = false;
if ( bRet && !MoveFile( aTmpFile, aDbtFile ) )
- bRet = FALSE;
+ bRet = false;
if ( !bRet )
{
KillFile( aTmpFile );
@@ -2220,7 +2232,7 @@ BOOL ScDocShell::ConvertTo( SfxMedium &rMed )
SfxItemSet* pSet = rMed.GetItemSet();
const SfxPoolItem* pItem;
if ( pSet && SFX_ITEM_SET ==
- pSet->GetItemState( SID_FILE_FILTEROPTIONS, TRUE, &pItem ) )
+ pSet->GetItemState( SID_FILE_FILTEROPTIONS, sal_True, &pItem ) )
{
sItStr = ((const SfxStringItem*)pItem)->GetValue();
}
@@ -2236,7 +2248,7 @@ BOOL ScDocShell::ConvertTo( SfxMedium &rMed )
WaitObject aWait( GetActiveDialogParent() );
ScFormatFilter::Get().ScExportDif( *pStream, &aDocument, ScAddress(0,0,0),
ScGlobal::GetCharsetValue(sItStr) );
- bRet = TRUE;
+ bRet = sal_True;
if (aDocument.GetTableCount() > 1)
if (!rMed.GetError())
@@ -2256,7 +2268,7 @@ BOOL ScDocShell::ConvertTo( SfxMedium &rMed )
ScRange aRange( 0,0,0, nEndCol,nEndRow,0 );
ScImportExport aImExport( &aDocument, aRange );
- aImExport.SetFormulas( TRUE );
+ aImExport.SetFormulas( sal_True );
bRet = aImExport.ExportStream( *pStream, rMed.GetBaseURL( true ), SOT_FORMATSTR_ID_SYLK );
}
}
@@ -2285,15 +2297,15 @@ BOOL ScDocShell::ConvertTo( SfxMedium &rMed )
}
-BOOL ScDocShell::SaveCompleted( const uno::Reference < embed::XStorage >& xStor )
+sal_Bool ScDocShell::SaveCompleted( const uno::Reference < embed::XStorage >& xStor )
{
return SfxObjectShell::SaveCompleted( xStor );
}
-BOOL ScDocShell::DoSaveCompleted( SfxMedium * pNewStor )
+sal_Bool ScDocShell::DoSaveCompleted( SfxMedium * pNewStor )
{
- BOOL bRet = SfxObjectShell::DoSaveCompleted( pNewStor );
+ sal_Bool bRet = SfxObjectShell::DoSaveCompleted( pNewStor );
// SC_HINT_DOC_SAVED fuer Wechsel ReadOnly -> Read/Write
Broadcast( SfxSimpleHint( SC_HINT_DOC_SAVED ) );
@@ -2301,7 +2313,7 @@ BOOL ScDocShell::DoSaveCompleted( SfxMedium * pNewStor )
}
-sal_Bool ScDocShell::QuerySlotExecutable( USHORT nSlotId )
+sal_Bool ScDocShell::QuerySlotExecutable( sal_uInt16 nSlotId )
{
// #i112634# ask VBA event handlers whether to save or print the document
@@ -2331,7 +2343,7 @@ sal_Bool ScDocShell::QuerySlotExecutable( USHORT nSlotId )
}
catch( util::VetoException& )
{
- bSlotExecutable = sal_False;
+ bSlotExecutable = false;
}
catch( uno::Exception& )
{
@@ -2340,7 +2352,7 @@ sal_Bool ScDocShell::QuerySlotExecutable( USHORT nSlotId )
}
-USHORT ScDocShell::PrepareClose( BOOL bUI, BOOL bForBrowsing )
+sal_uInt16 ScDocShell::PrepareClose( sal_Bool bUI, sal_Bool bForBrowsing )
{
if(SC_MOD()->GetCurRefDlgId()>0)
{
@@ -2356,12 +2368,12 @@ USHORT ScDocShell::PrepareClose( BOOL bUI, BOOL bForBrowsing )
}
}
- return FALSE;
+ return false;
}
if ( aDocument.IsInLinkUpdate() || aDocument.IsInInterpreter() )
{
ErrorMessage(STR_CLOSE_ERROR_LINK);
- return FALSE;
+ return false;
}
DoEnterHandler();
@@ -2378,7 +2390,7 @@ USHORT ScDocShell::PrepareClose( BOOL bUI, BOOL bForBrowsing )
catch( util::VetoException& )
{
// if event processor throws VetoException, macro has vetoed close
- return sal_False;
+ return false;
}
catch( uno::Exception& )
{
@@ -2386,9 +2398,9 @@ USHORT ScDocShell::PrepareClose( BOOL bUI, BOOL bForBrowsing )
}
// end handler code
- USHORT nRet = SfxObjectShell::PrepareClose( bUI, bForBrowsing );
- if (nRet == TRUE) // TRUE = schliessen
- aDocument.DisableIdle(TRUE); // nicht mehr drin rumpfuschen !!!
+ sal_uInt16 nRet = SfxObjectShell::PrepareClose( bUI, bForBrowsing );
+ if (nRet == sal_True) // sal_True = schliessen
+ aDocument.DisableIdle(sal_True); // nicht mehr drin rumpfuschen !!!
return nRet;
}
@@ -2442,9 +2454,9 @@ String ScDocShell::GetDifFilterName()
return String::CreateFromAscii(pFilterDif);
}
-BOOL ScDocShell::HasAutomaticTableName( const String& rFilter )
+sal_Bool ScDocShell::HasAutomaticTableName( const String& rFilter )
{
- // TRUE for those filters that keep the default table name
+ // sal_True for those filters that keep the default table name
// (which is language specific)
return rFilter.EqualsAscii( pFilterAscii )
@@ -2465,15 +2477,15 @@ BOOL ScDocShell::HasAutomaticTableName( const String& rFilter )
aDdeTextFmt(String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("TEXT"))), \
nPrtToScreenFactor( 1.0 ), \
pImpl ( new DocShell_Impl ), \
- bHeaderOn ( TRUE ), \
- bFooterOn ( TRUE ), \
- bNoInformLost ( TRUE ), \
- bIsEmpty ( TRUE ), \
- bIsInUndo ( FALSE ), \
- bDocumentModifiedPending( FALSE ), \
+ bHeaderOn ( sal_True ), \
+ bFooterOn ( sal_True ), \
+ bNoInformLost ( sal_True ), \
+ bIsEmpty ( sal_True ), \
+ bIsInUndo ( false ), \
+ bDocumentModifiedPending( false ), \
nDocumentLock ( 0 ), \
nCanUpdate (com::sun::star::document::UpdateDocMode::ACCORDING_TO_CONFIG), \
- bUpdateEnabled ( TRUE ), \
+ bUpdateEnabled ( sal_True ), \
pOldAutoDBRange ( NULL ), \
pDocHelper ( NULL ), \
pAutoStyleList ( NULL ), \
@@ -2588,7 +2600,7 @@ SfxUndoManager* ScDocShell::GetUndoManager()
return aDocument.GetUndoManager();
}
-void ScDocShell::SetModified( BOOL bModified )
+void ScDocShell::SetModified( sal_Bool bModified )
{
if ( SfxObjectShell::IsEnableSetModified() )
{
@@ -2598,7 +2610,7 @@ void ScDocShell::SetModified( BOOL bModified )
}
-void ScDocShell::SetDocumentModified( BOOL bIsModified /* = TRUE */ )
+void ScDocShell::SetDocumentModified( sal_Bool bIsModified /* = sal_True */ )
{
// BroadcastUno muss auch mit pPaintLockData sofort passieren
//! auch bei SetDrawModified, wenn Drawing angebunden ist
@@ -2607,6 +2619,7 @@ void ScDocShell::SetDocumentModified( BOOL bIsModified /* = TRUE */ )
if ( pPaintLockData && bIsModified )
{
//! BCA_BRDCST_ALWAYS etc. also needed here?
+ aDocument.InvalidateTableArea(); // #i105279# needed here
aDocument.BroadcastUno( SfxSimpleHint( SFX_HINT_DATACHANGED ) );
pPaintLockData->SetModified(); // spaeter...
@@ -2618,16 +2631,16 @@ void ScDocShell::SetDocumentModified( BOOL bIsModified /* = TRUE */ )
if ( bIsModified )
{
if ( aDocument.IsAutoCalcShellDisabled() )
- SetDocumentModifiedPending( TRUE );
+ SetDocumentModifiedPending( sal_True );
else
{
- SetDocumentModifiedPending( FALSE );
+ SetDocumentModifiedPending( false );
aDocument.InvalidateStyleSheetUsage();
aDocument.InvalidateTableArea();
aDocument.InvalidateLastTableOpParams();
aDocument.Broadcast( SC_HINT_DATACHANGED, BCA_BRDCST_ALWAYS, NULL );
if ( aDocument.IsForcedFormulaPending() && aDocument.GetAutoCalc() )
- aDocument.CalcFormulaTree( TRUE );
+ aDocument.CalcFormulaTree( sal_True );
PostDataChanged();
// Detective AutoUpdate:
@@ -2639,9 +2652,9 @@ void ScDocShell::SetDocumentModified( BOOL bIsModified /* = TRUE */ )
if ( pList && ( aDocument.IsDetectiveDirty() || pList->HasAddError() ) &&
pList->Count() && !IsInUndo() && SC_MOD()->GetAppOptions().GetDetectiveAuto() )
{
- GetDocFunc().DetectiveRefresh(TRUE); // TRUE = caused by automatic update
+ GetDocFunc().DetectiveRefresh(sal_True); // sal_True = caused by automatic update
}
- aDocument.SetDetectiveDirty(FALSE); // always reset, also if not refreshed
+ aDocument.SetDetectiveDirty(false); // always reset, also if not refreshed
}
// notify UNO objects after BCA_BRDCST_ALWAYS etc.
@@ -2653,9 +2666,9 @@ void ScDocShell::SetDocumentModified( BOOL bIsModified /* = TRUE */ )
// (Drawing muss auch beim normalen SetDocumentModified upgedated werden,
// z.B. bei Tabelle loeschen etc.)
-void ScDocShell::SetDrawModified( BOOL bIsModified /* = TRUE */ )
+void ScDocShell::SetDrawModified( sal_Bool bIsModified /* = sal_True */ )
{
- BOOL bUpdate = ( bIsModified != IsModified() );
+ sal_Bool bUpdate = ( bIsModified != IsModified() );
SetModified( bIsModified );
@@ -2690,7 +2703,7 @@ void ScDocShell::SetDrawModified( BOOL bIsModified /* = TRUE */ )
}
}
-void ScDocShell::SetInUndo(BOOL bSet)
+void ScDocShell::SetInUndo(sal_Bool bSet)
{
bIsInUndo = bSet;
}
@@ -2705,8 +2718,8 @@ void ScDocShell::GetDocStat( ScDocStat& rDocStat )
if ( pPrinter )
for ( SCTAB i=0; i<rDocStat.nTableCount; i++ )
- rDocStat.nPageCount = sal::static_int_cast<USHORT>( rDocStat.nPageCount +
- (USHORT) ScPrintFunc( this, pPrinter, i ).GetTotalPages() );
+ rDocStat.nPageCount = sal::static_int_cast<sal_uInt16>( rDocStat.nPageCount +
+ (sal_uInt16) ScPrintFunc( this, pPrinter, i ).GetTotalPages() );
}
@@ -2879,7 +2892,7 @@ void ScDocShell::UseSheetSaveEntries()
for (nTab = 0; nTab < nTabCount; ++nTab)
if (aDocument.IsStreamValid(nTab))
- aDocument.SetStreamValid(nTab, FALSE);
+ aDocument.SetStreamValid(nTab, false);
}
}
}
@@ -2894,8 +2907,8 @@ ScDocShellModificator::ScDocShellModificator( ScDocShell& rDS )
ScDocument* pDoc = rDocShell.GetDocument();
bAutoCalcShellDisabled = pDoc->IsAutoCalcShellDisabled();
bIdleDisabled = pDoc->IsIdleDisabled();
- pDoc->SetAutoCalcShellDisabled( TRUE );
- pDoc->DisableIdle( TRUE );
+ pDoc->SetAutoCalcShellDisabled( sal_True );
+ pDoc->DisableIdle( sal_True );
}
@@ -2915,7 +2928,7 @@ void ScDocShellModificator::SetDocumentModified()
if ( !pDoc->IsImportingXML() )
{
// AutoCalcShellDisabled temporaer restaurieren
- BOOL bDisabled = pDoc->IsAutoCalcShellDisabled();
+ sal_Bool bDisabled = pDoc->IsAutoCalcShellDisabled();
pDoc->SetAutoCalcShellDisabled( bAutoCalcShellDisabled );
rDocShell.SetDocumentModified();
pDoc->SetAutoCalcShellDisabled( bDisabled );
@@ -2936,7 +2949,7 @@ sal_Bool ScDocShell::AcceptStateUpdate() const
if( SC_MOD()->Find1RefWindow( SFX_APP()->GetTopWindow() ) )
return sal_True;
- return sal_False;
+ return false;
}
@@ -2965,7 +2978,7 @@ void ScDocShell::SetChangeRecording( bool bActivate )
{
aDocument.StartChangeTracking();
ScChangeViewSettings aChangeViewSet;
- aChangeViewSet.SetShowChanges(TRUE);
+ aChangeViewSet.SetShowChanges(sal_True);
aDocument.SetChangeViewSettings(aChangeViewSet);
}
else
@@ -2980,7 +2993,7 @@ void ScDocShell::SetChangeRecording( bool bActivate )
// Slots invalidieren
SfxBindings* pBindings = GetViewBindings();
if (pBindings)
- pBindings->InvalidateAll(FALSE);
+ pBindings->InvalidateAll(false);
}
}