summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sc/source/core/data/global.cxx15
-rw-r--r--sc/source/ui/app/inputhdl.cxx200
-rw-r--r--scripting/source/provider/MasterScriptProvider.cxx22
-rw-r--r--sfx2/source/doc/objstor.cxx14
-rw-r--r--sw/source/uibase/utlui/glbltree.cxx3
-rw-r--r--ucb/source/ucp/ftp/ftpcontent.cxx18
6 files changed, 112 insertions, 160 deletions
diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx
index 1bb038b4d437..441c95ef8412 100644
--- a/sc/source/core/data/global.cxx
+++ b/sc/source/core/data/global.cxx
@@ -523,18 +523,13 @@ void ScGlobal::InitTextHeight(const SfxItemPool* pPool)
return;
}
- const ScPatternAttr* pPattern = &pPool->GetDefaultItem(ATTR_PATTERN);
- if (!pPattern)
- {
- OSL_FAIL("ScGlobal::InitTextHeight: No default pattern");
- return;
- }
+ const ScPatternAttr& rPattern = pPool->GetDefaultItem(ATTR_PATTERN);
OutputDevice* pDefaultDev = Application::GetDefaultDevice();
ScopedVclPtrInstance< VirtualDevice > pVirtWindow( *pDefaultDev );
pVirtWindow->SetMapMode(MapMode(MapUnit::MapPixel));
vcl::Font aDefFont;
- pPattern->GetFont(aDefFont, SC_AUTOCOL_BLACK, pVirtWindow); // Font color doesn't matter here
+ rPattern.GetFont(aDefFont, SC_AUTOCOL_BLACK, pVirtWindow); // Font color doesn't matter here
pVirtWindow->SetFont(aDefFont);
sal_uInt16 nTest = static_cast<sal_uInt16>(
pVirtWindow->PixelToLogic(Size(0, pVirtWindow->GetTextHeight()), MapMode(MapUnit::MapTwip)).Height());
@@ -542,10 +537,10 @@ void ScGlobal::InitTextHeight(const SfxItemPool* pPool)
if (nTest > nDefFontHeight)
nDefFontHeight = nTest;
- const SvxMarginItem* pMargin = &pPattern->GetItem(ATTR_MARGIN);
+ const SvxMarginItem& rMargin = rPattern.GetItem(ATTR_MARGIN);
- nTest = static_cast<sal_uInt16>(
- nDefFontHeight + pMargin->GetTopMargin() + pMargin->GetBottomMargin() - STD_ROWHEIGHT_DIFF);
+ nTest = static_cast<sal_uInt16>(nDefFontHeight + rMargin.GetTopMargin()
+ + rMargin.GetBottomMargin() - STD_ROWHEIGHT_DIFF);
if (nTest > nStdRowHeight)
nStdRowHeight = nTest;
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 4706b8f21e22..36af4bd5979c 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -3633,131 +3633,127 @@ void ScInputHandler::NotifyChange( const ScInputHdlState* pState,
{
ScModule* pScMod = SC_MOD();
- if ( pState )
+ // Also take foreign reference input into account here (e.g. FunctionsAutoPilot),
+ // FormEditData, if we're switching from Help to Calc:
+ if ( !bFormulaMode && !pScMod->IsFormulaMode() && !pScMod->GetFormEditData() )
{
+ bool bIgnore = false;
+ if ( bModified )
+ {
+ if (pState->GetPos() != aCursorPos)
+ {
+ if (!bProtected)
+ EnterHandler();
+ }
+ else
+ bIgnore = true;
+ }
- // Also take foreign reference input into account here (e.g. FunctionsAutoPilot),
- // FormEditData, if we're switching from Help to Calc:
- if ( !bFormulaMode && !pScMod->IsFormulaMode() && !pScMod->GetFormEditData() )
+ if ( !bIgnore )
{
- bool bIgnore = false;
- if ( bModified )
+ const ScAddress& rSPos = pState->GetStartPos();
+ const ScAddress& rEPos = pState->GetEndPos();
+ const EditTextObject* pData = pState->GetEditData();
+ OUString aString = pState->GetString();
+ bool bTxtMod = false;
+ ScDocShell* pDocSh = pActiveViewSh->GetViewData().GetDocShell();
+ ScDocument& rDoc = pDocSh->GetDocument();
+
+ aCursorPos = pState->GetPos();
+
+ if ( pData )
+ bTxtMod = true;
+ else if ( bHadObject )
+ bTxtMod = true;
+ else if ( bTextValid )
+ bTxtMod = ( aString != aCurrentText );
+ else
+ bTxtMod = ( aString != GetEditText(mpEditEngine.get()) );
+
+ if ( bTxtMod || bForce )
{
- if (pState->GetPos() != aCursorPos)
+ if (pData)
{
- if (!bProtected)
- EnterHandler();
+ mpEditEngine->SetText( *pData );
+ if (pInputWin)
+ aString = ScEditUtil::GetMultilineString(*mpEditEngine);
+ else
+ aString = GetEditText(mpEditEngine.get());
+ lcl_RemoveTabs(aString);
+ bTextValid = false;
+ aCurrentText.clear();
}
else
- bIgnore = true;
+ {
+ aCurrentText = aString;
+ bTextValid = true; //! To begin with remember as a string
+ }
+
+ if ( pInputWin )
+ pInputWin->SetTextString(aString);
+ else if (comphelper::LibreOfficeKit::isActive())
+ {
+ if (pActiveViewSh)
+ pActiveViewSh->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_FORMULA, aString.toUtf8().getStr());
+ }
}
- if ( !bIgnore )
+ if ( pInputWin || comphelper::LibreOfficeKit::isActive()) // Named range input
{
- const ScAddress& rSPos = pState->GetStartPos();
- const ScAddress& rEPos = pState->GetEndPos();
- const EditTextObject* pData = pState->GetEditData();
- OUString aString = pState->GetString();
- bool bTxtMod = false;
- ScDocShell* pDocSh = pActiveViewSh->GetViewData().GetDocShell();
- ScDocument& rDoc = pDocSh->GetDocument();
-
- aCursorPos = pState->GetPos();
-
- if ( pData )
- bTxtMod = true;
- else if ( bHadObject )
- bTxtMod = true;
- else if ( bTextValid )
- bTxtMod = ( aString != aCurrentText );
- else
- bTxtMod = ( aString != GetEditText(mpEditEngine.get()) );
+ OUString aPosStr;
+ const ScAddress::Details aAddrDetails( &rDoc, aCursorPos );
- if ( bTxtMod || bForce )
+ // Is the range a name?
+ //! Find by Timer?
+ if ( pActiveViewSh )
+ pActiveViewSh->GetViewData().GetDocument()->
+ GetRangeAtBlock( ScRange( rSPos, rEPos ), &aPosStr );
+
+ if ( aPosStr.isEmpty() ) // Not a name -> format
{
- if (pData)
+ ScRefFlags nFlags = ScRefFlags::ZERO;
+ if( aAddrDetails.eConv == formula::FormulaGrammar::CONV_XL_R1C1 )
+ nFlags |= ScRefFlags::COL_ABS | ScRefFlags::ROW_ABS;
+ if ( rSPos != rEPos )
{
- mpEditEngine->SetText( *pData );
- if (pInputWin)
- aString = ScEditUtil::GetMultilineString(*mpEditEngine);
- else
- aString = GetEditText(mpEditEngine.get());
- lcl_RemoveTabs(aString);
- bTextValid = false;
- aCurrentText.clear();
+ ScRange r(rSPos, rEPos);
+ applyStartToEndFlags(nFlags);
+ aPosStr = r.Format(ScRefFlags::VALID | nFlags, &rDoc, aAddrDetails);
}
else
- {
- aCurrentText = aString;
- bTextValid = true; //! To begin with remember as a string
- }
-
- if ( pInputWin )
- pInputWin->SetTextString(aString);
- else if (comphelper::LibreOfficeKit::isActive())
- {
- if (pActiveViewSh)
- pActiveViewSh->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_FORMULA, aString.toUtf8().getStr());
- }
+ aPosStr = aCursorPos.Format(ScRefFlags::VALID | nFlags, &rDoc, aAddrDetails);
}
- if ( pInputWin || comphelper::LibreOfficeKit::isActive()) // Named range input
+ if (pInputWin)
{
- OUString aPosStr;
- const ScAddress::Details aAddrDetails( &rDoc, aCursorPos );
-
- // Is the range a name?
- //! Find by Timer?
- if ( pActiveViewSh )
- pActiveViewSh->GetViewData().GetDocument()->
- GetRangeAtBlock( ScRange( rSPos, rEPos ), &aPosStr );
-
- if ( aPosStr.isEmpty() ) // Not a name -> format
- {
- ScRefFlags nFlags = ScRefFlags::ZERO;
- if( aAddrDetails.eConv == formula::FormulaGrammar::CONV_XL_R1C1 )
- nFlags |= ScRefFlags::COL_ABS | ScRefFlags::ROW_ABS;
- if ( rSPos != rEPos )
- {
- ScRange r(rSPos, rEPos);
- applyStartToEndFlags(nFlags);
- aPosStr = r.Format(ScRefFlags::VALID | nFlags, &rDoc, aAddrDetails);
- }
- else
- aPosStr = aCursorPos.Format(ScRefFlags::VALID | nFlags, &rDoc, aAddrDetails);
- }
-
- if (pInputWin)
- {
- // Disable the accessible VALUE_CHANGE event
- bool bIsSuppressed = pInputWin->IsAccessibilityEventsSuppressed(false);
- pInputWin->SetAccessibilityEventsSuppressed(true);
- pInputWin->SetPosString(aPosStr);
- pInputWin->SetAccessibilityEventsSuppressed(bIsSuppressed);
- pInputWin->SetSumAssignMode();
- }
- else if (pActiveViewSh)
- {
- pActiveViewSh->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_ADDRESS, aPosStr.toUtf8().getStr());
- }
+ // Disable the accessible VALUE_CHANGE event
+ bool bIsSuppressed = pInputWin->IsAccessibilityEventsSuppressed(false);
+ pInputWin->SetAccessibilityEventsSuppressed(true);
+ pInputWin->SetPosString(aPosStr);
+ pInputWin->SetAccessibilityEventsSuppressed(bIsSuppressed);
+ pInputWin->SetSumAssignMode();
}
+ else if (pActiveViewSh)
+ {
+ pActiveViewSh->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_ADDRESS, aPosStr.toUtf8().getStr());
+ }
+ }
- if (bStopEditing)
- SfxGetpApp()->Broadcast( SfxHint( SfxHintId::ScKillEditView ) );
+ if (bStopEditing)
+ SfxGetpApp()->Broadcast( SfxHint( SfxHintId::ScKillEditView ) );
- // As long as the content is not edited, turn off online spelling.
- // Online spelling is turned back on in StartTable, after setting
- // the right language from cell attributes.
+ // As long as the content is not edited, turn off online spelling.
+ // Online spelling is turned back on in StartTable, after setting
+ // the right language from cell attributes.
- EEControlBits nCntrl = mpEditEngine->GetControlWord();
- if ( nCntrl & EEControlBits::ONLINESPELLING )
- mpEditEngine->SetControlWord( nCntrl & ~EEControlBits::ONLINESPELLING );
+ EEControlBits nCntrl = mpEditEngine->GetControlWord();
+ if ( nCntrl & EEControlBits::ONLINESPELLING )
+ mpEditEngine->SetControlWord( nCntrl & ~EEControlBits::ONLINESPELLING );
- bModified = false;
- bSelIsRef = false;
- bProtected = false;
- bCommandErrorShown = false;
- }
+ bModified = false;
+ bSelIsRef = false;
+ bProtected = false;
+ bCommandErrorShown = false;
}
}
diff --git a/scripting/source/provider/MasterScriptProvider.cxx b/scripting/source/provider/MasterScriptProvider.cxx
index fa4b53100fa8..6854d6283dc0 100644
--- a/scripting/source/provider/MasterScriptProvider.cxx
+++ b/scripting/source/provider/MasterScriptProvider.cxx
@@ -398,8 +398,6 @@ MasterScriptProvider::getName()
Sequence< Reference< browse::XBrowseNode > > SAL_CALL
MasterScriptProvider::getChildNodes()
{
- if ( !providerCache() )
- throw RuntimeException( "MasterScriptProvider::getAllProviders, cache not initialised" );
Sequence< Reference< provider::XScriptProvider > > providers = providerCache()->getAllProviders();
sal_Int32 size = providers.getLength();
@@ -525,12 +523,6 @@ MasterScriptProvider::insertByName( const OUString& aName, const Any& aElement )
// TODO for library package parse the language, for the moment will try
// to get each provider to process the new Package, the first one the succeeds
// will terminate processing
- if ( !providerCache() )
- {
- throw RuntimeException(
- "insertByName cannot instantiate "
- "child script providers." );
- }
const bool bSuccess = FindProviderAndApply(
*providerCache(), [&aName, &aElement](Reference<container::XNameContainer>& xCont) {
xCont->insertByName(aName, aElement);
@@ -570,13 +562,6 @@ MasterScriptProvider::removeByName( const OUString& Name )
// TODO for Script library package url parse the language,
// for the moment will just try to get each provider to process remove/revoke
// request, the first one the succeeds will terminate processing
-
- if ( !providerCache() )
- {
- throw RuntimeException(
- "removeByName() cannot instantiate "
- "child script providers." );
- }
const bool bSuccess = FindProviderAndApply(
*providerCache(), [&Name](Reference<container::XNameContainer>& xCont) {
xCont->removeByName(Name);
@@ -637,13 +622,6 @@ MasterScriptProvider::hasByName( const OUString& aName )
// for the moment will just try to get each provider to see if the
// package exists in any provider, first one that succeed will
// terminate the loop
-
- if ( !providerCache() )
- {
- throw RuntimeException(
- "removeByName() cannot instantiate "
- "child script providers." );
- }
result = FindProviderAndApply(
*providerCache(), [&aName](Reference<container::XNameContainer>& xCont) {
return xCont->hasByName(aName);
diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx
index af28e43a7185..78f00adceb57 100644
--- a/sfx2/source/doc/objstor.cxx
+++ b/sfx2/source/doc/objstor.cxx
@@ -1512,14 +1512,12 @@ bool SfxObjectShell::SaveTo_Impl
aInfo.TimeStamp.Minutes = aTime.GetMin();
aInfo.TimeStamp.Seconds = aTime.GetSec();
- if ( bOk )
- {
- // add new version information into the versionlist and save the versionlist
- // the version list must have been transferred from the "old" medium before
- rMedium.AddVersion_Impl( aInfo );
- rMedium.SaveVersionList_Impl();
- bOk = PutURLContentsToVersionStream_Impl( aTmpVersionURL, xMedStorage, aInfo.Identifier );
- }
+ // add new version information into the versionlist and save the versionlist
+ // the version list must have been transferred from the "old" medium before
+ rMedium.AddVersion_Impl(aInfo);
+ rMedium.SaveVersionList_Impl();
+ bOk = PutURLContentsToVersionStream_Impl(aTmpVersionURL, xMedStorage,
+ aInfo.Identifier);
}
else if ( bOk && ( pImpl->bIsSaving || pImpl->bPreserveVersions ) )
{
diff --git a/sw/source/uibase/utlui/glbltree.cxx b/sw/source/uibase/utlui/glbltree.cxx
index 737fd2f1b1e2..53a69ea6f2ac 100644
--- a/sw/source/uibase/utlui/glbltree.cxx
+++ b/sw/source/uibase/utlui/glbltree.cxx
@@ -1085,8 +1085,7 @@ void SwGlobalTree::ExecCommand(const OUString &rCmd)
}
else if (rCmd == "up")
{
- if(nSource)
- bMove = 0 != nSource;
+ bMove = 0 != nSource;
nDest--;
}
if( bMove && m_pActiveShell->MoveGlobalDocContent(
diff --git a/ucb/source/ucp/ftp/ftpcontent.cxx b/ucb/source/ucp/ftp/ftpcontent.cxx
index 5279a74aa1b2..67767892b816 100644
--- a/ucb/source/ucp/ftp/ftpcontent.cxx
+++ b/ucb/source/ucp/ftp/ftpcontent.cxx
@@ -450,10 +450,9 @@ Any SAL_CALL FTPContent::execute( const Command& aCommand,
else if(xOutputStream.is()) {
Reference<XInputStream> xStream(
new ucbhelper::FdInputStream(m_aFTPURL.open()));
- Sequence<sal_Int8> byte_seq(4096);
- sal_Int32 n = 1000; // value does not matter here
for (;;) {
- n = xStream->readBytes(byte_seq,4096);
+ Sequence<sal_Int8> byte_seq(4096);
+ sal_Int32 n = xStream->readBytes(byte_seq, 4096);
if (n == 0) {
break;
}
@@ -469,19 +468,6 @@ Any SAL_CALL FTPContent::execute( const Command& aCommand,
}
}
- if(n) {
- Sequence<Any> seq(1);
- PropertyValue value;
- value.Name = "Uri";
- value.Handle = -1;
- value.Value <<= m_aFTPURL.ident(false,false);
- value.State = PropertyState_DIRECT_VALUE;
- seq[0] <<= value;
- ucbhelper::cancelCommandExecution(
- IOErrorCode_UNKNOWN,
- seq,
- Environment);
- }
}
else {
aRet <<= UnsupportedDataSinkException(