summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-08-09 11:51:00 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-08-09 13:28:29 +0200
commitf97077c5fe41195bf2054892ae08e3307983e6dc (patch)
tree885b746b298e9a66e0e5e8847d0e72d8760f32b7
parentf4ca7ea13102dfbc0a62e925b6fe4dbe6fd0bf99 (diff)
loplugin:flatten sc/miscdlgs
Change-Id: I41bb4eb1ea06aef2f4e58e0f00d275dcf8879154 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100397 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--sc/source/ui/miscdlgs/acredlin.cxx180
-rw-r--r--sc/source/ui/miscdlgs/anyrefdg.cxx370
-rw-r--r--sc/source/ui/miscdlgs/autofmt.cxx361
-rw-r--r--sc/source/ui/miscdlgs/conflictsdlg.cxx32
-rw-r--r--sc/source/ui/miscdlgs/crnrdlg.cxx214
-rw-r--r--sc/source/ui/miscdlgs/datafdlg.cxx58
-rw-r--r--sc/source/ui/miscdlgs/instbdlg.cxx26
-rw-r--r--sc/source/ui/miscdlgs/linkarea.cxx32
-rw-r--r--sc/source/ui/miscdlgs/optsolver.cxx80
-rw-r--r--sc/source/ui/miscdlgs/redcom.cxx54
-rw-r--r--sc/source/ui/miscdlgs/retypepassdlg.cxx78
-rw-r--r--sc/source/ui/miscdlgs/scuiautofmt.cxx80
-rw-r--r--sc/source/ui/miscdlgs/simpref.cxx56
-rw-r--r--sc/source/ui/miscdlgs/solverutil.cxx76
-rw-r--r--sc/source/ui/miscdlgs/solvrdlg.cxx30
-rw-r--r--sc/source/ui/miscdlgs/tabopdlg.cxx52
16 files changed, 889 insertions, 890 deletions
diff --git a/sc/source/ui/miscdlgs/acredlin.cxx b/sc/source/ui/miscdlgs/acredlin.cxx
index 3ea6c43dc74e..70821153bf73 100644
--- a/sc/source/ui/miscdlgs/acredlin.cxx
+++ b/sc/source/ui/miscdlgs/acredlin.cxx
@@ -251,27 +251,27 @@ void ScAcceptChgDlg::Init()
}
// init filter
- if(pTPFilter->IsDate()||pTPFilter->IsRange()||
- pTPFilter->IsAuthor()||pTPFilter->IsComment())
- {
- pTheView->SetFilterDate(pTPFilter->IsDate());
- pTheView->SetDateTimeMode(pTPFilter->GetDateMode());
- pTheView->SetFirstDate(pTPFilter->GetFirstDate());
- pTheView->SetLastDate(pTPFilter->GetLastDate());
- pTheView->SetFirstTime(pTPFilter->GetFirstTime());
- pTheView->SetLastTime(pTPFilter->GetLastTime());
- pTheView->SetFilterAuthor(pTPFilter->IsAuthor());
- pTheView->SetAuthor(pTPFilter->GetSelectedAuthor());
+ if(!(pTPFilter->IsDate()||pTPFilter->IsRange()||
+ pTPFilter->IsAuthor()||pTPFilter->IsComment()))
+ return;
- pTheView->SetFilterComment(pTPFilter->IsComment());
+ pTheView->SetFilterDate(pTPFilter->IsDate());
+ pTheView->SetDateTimeMode(pTPFilter->GetDateMode());
+ pTheView->SetFirstDate(pTPFilter->GetFirstDate());
+ pTheView->SetLastDate(pTPFilter->GetLastDate());
+ pTheView->SetFirstTime(pTPFilter->GetFirstTime());
+ pTheView->SetLastTime(pTPFilter->GetLastTime());
+ pTheView->SetFilterAuthor(pTPFilter->IsAuthor());
+ pTheView->SetAuthor(pTPFilter->GetSelectedAuthor());
- utl::SearchParam aSearchParam( pTPFilter->GetComment(),
- utl::SearchParam::SearchType::Regexp,false );
+ pTheView->SetFilterComment(pTPFilter->IsComment());
- pTheView->SetCommentParams(&aSearchParam);
+ utl::SearchParam aSearchParam( pTPFilter->GetComment(),
+ utl::SearchParam::SearchType::Regexp,false );
- pTheView->UpdateFilterTest();
- }
+ pTheView->SetCommentParams(&aSearchParam);
+
+ pTheView->UpdateFilterTest();
}
void ScAcceptChgDlg::ClearView()
@@ -1329,74 +1329,74 @@ IMPL_LINK(ScAcceptChgDlg, ExpandingHandle, const weld::TreeIter&, rEntry, bool)
void ScAcceptChgDlg::AppendChanges(const ScChangeTrack* pChanges,sal_uLong nStartAction,
sal_uLong nEndAction)
{
- if(pChanges!=nullptr)
- {
- std::unique_ptr<weld::TreeIter> xParent;
- m_xDialog->set_busy_cursor(true);
- weld::TreeView& rTreeView = pTheView->GetWidget();
- rTreeView.freeze();
+ if(pChanges==nullptr)
+ return;
- bool bTheFlag = false;
+ std::unique_ptr<weld::TreeIter> xParent;
+ m_xDialog->set_busy_cursor(true);
+ weld::TreeView& rTreeView = pTheView->GetWidget();
+ rTreeView.freeze();
- bool bFilterFlag = pTPFilter->IsDate() || pTPFilter->IsRange() ||
- pTPFilter->IsAuthor() || pTPFilter->IsComment();
+ bool bTheFlag = false;
- bUseColor = bFilterFlag;
+ bool bFilterFlag = pTPFilter->IsDate() || pTPFilter->IsRange() ||
+ pTPFilter->IsAuthor() || pTPFilter->IsComment();
- for(sal_uLong i=nStartAction;i<=nEndAction;i++)
- {
- const ScChangeAction* pScChangeAction=pChanges->GetAction(i);
- if(pScChangeAction==nullptr) continue;
+ bUseColor = bFilterFlag;
- switch (pScChangeAction->GetState())
- {
- case SC_CAS_VIRGIN:
+ for(sal_uLong i=nStartAction;i<=nEndAction;i++)
+ {
+ const ScChangeAction* pScChangeAction=pChanges->GetAction(i);
+ if(pScChangeAction==nullptr) continue;
- if (pScChangeAction->IsDialogRoot())
- {
- bool bOnDemandChildren = !bFilterFlag && pScChangeAction->IsDialogParent();
- if (pScChangeAction->IsDialogParent())
- xParent = AppendChangeAction(pScChangeAction, bOnDemandChildren);
- else
- xParent = AppendFilteredAction(pScChangeAction, SC_CAS_VIRGIN, bOnDemandChildren);
- }
+ switch (pScChangeAction->GetState())
+ {
+ case SC_CAS_VIRGIN:
+
+ if (pScChangeAction->IsDialogRoot())
+ {
+ bool bOnDemandChildren = !bFilterFlag && pScChangeAction->IsDialogParent();
+ if (pScChangeAction->IsDialogParent())
+ xParent = AppendChangeAction(pScChangeAction, bOnDemandChildren);
else
- xParent.reset();
+ xParent = AppendFilteredAction(pScChangeAction, SC_CAS_VIRGIN, bOnDemandChildren);
+ }
+ else
+ xParent.reset();
- bTheFlag=true;
- break;
+ bTheFlag=true;
+ break;
- case SC_CAS_ACCEPTED:
- xParent.reset();
- nAcceptCount++;
- break;
+ case SC_CAS_ACCEPTED:
+ xParent.reset();
+ nAcceptCount++;
+ break;
- case SC_CAS_REJECTED:
- xParent.reset();
- nRejectCount++;
- break;
- }
+ case SC_CAS_REJECTED:
+ xParent.reset();
+ nRejectCount++;
+ break;
+ }
- if (xParent && pScChangeAction->IsDialogParent() && bFilterFlag)
- {
- bool bTestFlag = bHasFilterEntry;
- bHasFilterEntry = false;
- if (Expand(pChanges,pScChangeAction,*xParent,!bTestFlag)&&!bTestFlag)
- rTreeView.remove(*xParent);
- }
+ if (xParent && pScChangeAction->IsDialogParent() && bFilterFlag)
+ {
+ bool bTestFlag = bHasFilterEntry;
+ bHasFilterEntry = false;
+ if (Expand(pChanges,pScChangeAction,*xParent,!bTestFlag)&&!bTestFlag)
+ rTreeView.remove(*xParent);
}
+ }
- if( bTheFlag && (!pDoc->IsDocEditable() || pChanges->IsProtected()) )
- bTheFlag=false;
+ if( bTheFlag && (!pDoc->IsDocEditable() || pChanges->IsProtected()) )
+ bTheFlag=false;
- pTPView->EnableAccept(bTheFlag);
- pTPView->EnableAcceptAll(bTheFlag);
- pTPView->EnableReject(bTheFlag);
- pTPView->EnableRejectAll(bTheFlag);
+ pTPView->EnableAccept(bTheFlag);
+ pTPView->EnableAcceptAll(bTheFlag);
+ pTPView->EnableReject(bTheFlag);
+ pTPView->EnableRejectAll(bTheFlag);
- rTreeView.thaw();
- m_xDialog->set_busy_cursor(false);
- }
+ rTreeView.thaw();
+ m_xDialog->set_busy_cursor(false);
}
void ScAcceptChgDlg::RemoveEntries(sal_uLong nStartAction,sal_uLong nEndAction)
@@ -1692,30 +1692,30 @@ void ScAcceptChgDlg::Initialize(SfxChildWinInfo* pInfo)
SfxModelessDialogController::Initialize(pInfo);
- if (!aStr.isEmpty())
- {
- int nCount = aStr.toInt32();
- if (nCount > 2)
- {
- std::vector<int> aEndPos;
+ if (aStr.isEmpty())
+ return;
- for (int i = 0; i < nCount; ++i)
- {
- sal_Int32 n1 = aStr.indexOf(';');
- aStr = aStr.copy( n1+1 );
- aEndPos.push_back(aStr.toInt32());
- }
+ int nCount = aStr.toInt32();
+ if (nCount <= 2)
+ return;
- std::vector<int> aWidths;
- for (int i = 1; i < nCount; ++i)
- aWidths.push_back(aEndPos[i] - aEndPos[i - 1]);
+ std::vector<int> aEndPos;
- // turn column end points back to column widths, ignoring the small
- // value used for the expander column
- weld::TreeView& rTreeView = pTheView->GetWidget();
- rTreeView.set_column_fixed_widths(aWidths);
- }
+ for (int i = 0; i < nCount; ++i)
+ {
+ sal_Int32 n1 = aStr.indexOf(';');
+ aStr = aStr.copy( n1+1 );
+ aEndPos.push_back(aStr.toInt32());
}
+
+ std::vector<int> aWidths;
+ for (int i = 1; i < nCount; ++i)
+ aWidths.push_back(aEndPos[i] - aEndPos[i - 1]);
+
+ // turn column end points back to column widths, ignoring the small
+ // value used for the expander column
+ weld::TreeView& rTreeView = pTheView->GetWidget();
+ rTreeView.set_column_fixed_widths(aWidths);
}
void ScAcceptChgDlg::FillInfo(SfxChildWinInfo& rInfo) const
diff --git a/sc/source/ui/miscdlgs/anyrefdg.cxx b/sc/source/ui/miscdlgs/anyrefdg.cxx
index e9663dc3ff9c..1f3a98560d8f 100644
--- a/sc/source/ui/miscdlgs/anyrefdg.cxx
+++ b/sc/source/ui/miscdlgs/anyrefdg.cxx
@@ -109,30 +109,30 @@ void ScFormulaReferenceHelper::enableInput( bool bEnable )
void ScFormulaReferenceHelper::ShowSimpleReference(const OUString& rStr)
{
- if (m_bEnableColorRef)
- {
- m_bHighlightRef = true;
- ScViewData* pViewData=ScDocShell::GetViewData();
- if ( pViewData )
- {
- ScDocument* pDoc=pViewData->GetDocument();
- ScTabViewShell* pTabViewShell=pViewData->GetViewShell();
+ if (!m_bEnableColorRef)
+ return;
- ScRangeList aRangeList;
+ m_bHighlightRef = true;
+ ScViewData* pViewData=ScDocShell::GetViewData();
+ if ( !pViewData )
+ return;
- pTabViewShell->DoneRefMode();
- pTabViewShell->ClearHighlightRanges();
+ ScDocument* pDoc=pViewData->GetDocument();
+ ScTabViewShell* pTabViewShell=pViewData->GetViewShell();
- if( ParseWithNames( aRangeList, rStr, *pDoc ) )
- {
- for ( size_t i = 0, nRanges = aRangeList.size(); i < nRanges; ++i )
- {
- ScRange const & rRangeEntry = aRangeList[ i ];
- Color aColName = ScRangeFindList::GetColorName( i );
- pTabViewShell->AddHighlightRange( rRangeEntry, aColName );
- }
- }
- }
+ ScRangeList aRangeList;
+
+ pTabViewShell->DoneRefMode();
+ pTabViewShell->ClearHighlightRanges();
+
+ if( ParseWithNames( aRangeList, rStr, *pDoc ) )
+ {
+ for ( size_t i = 0, nRanges = aRangeList.size(); i < nRanges; ++i )
+ {
+ ScRange const & rRangeEntry = aRangeList[ i ];
+ Color aColName = ScRangeFindList::GetColorName( i );
+ pTabViewShell->AddHighlightRange( rRangeEntry, aColName );
+ }
}
}
@@ -173,58 +173,58 @@ bool ScFormulaReferenceHelper::ParseWithNames( ScRangeList& rRanges, const OUStr
void ScFormulaReferenceHelper::ShowFormulaReference(const OUString& rStr)
{
- if( m_bEnableColorRef)
- {
- m_bHighlightRef=true;
- ScViewData* pViewData=ScDocShell::GetViewData();
- if ( pViewData && m_pRefComp )
- {
- ScTabViewShell* pTabViewShell=pViewData->GetViewShell();
- SCCOL nCol = pViewData->GetCurX();
- SCROW nRow = pViewData->GetCurY();
- SCTAB nTab = pViewData->GetTabNo();
- ScAddress aPos( nCol, nRow, nTab );
+ if( !m_bEnableColorRef)
+ return;
- std::unique_ptr<ScTokenArray> pScTokA(m_pRefComp->CompileString(rStr));
+ m_bHighlightRef=true;
+ ScViewData* pViewData=ScDocShell::GetViewData();
+ if ( !(pViewData && m_pRefComp) )
+ return;
- if (pTabViewShell && pScTokA)
- {
- const ScViewData& rViewData = pTabViewShell->GetViewData();
- ScDocument* pDoc = rViewData.GetDocument();
- pTabViewShell->DoneRefMode();
- pTabViewShell->ClearHighlightRanges();
+ ScTabViewShell* pTabViewShell=pViewData->GetViewShell();
+ SCCOL nCol = pViewData->GetCurX();
+ SCROW nRow = pViewData->GetCurY();
+ SCTAB nTab = pViewData->GetTabNo();
+ ScAddress aPos( nCol, nRow, nTab );
- formula::FormulaTokenArrayPlainIterator aIter(*pScTokA);
- const formula::FormulaToken* pToken = aIter.GetNextReference();
+ std::unique_ptr<ScTokenArray> pScTokA(m_pRefComp->CompileString(rStr));
- sal_uInt16 nIndex=0;
+ if (!(pTabViewShell && pScTokA))
+ return;
- while(pToken!=nullptr)
- {
- bool bDoubleRef=(pToken->GetType()==formula::svDoubleRef);
+ const ScViewData& rViewData = pTabViewShell->GetViewData();
+ ScDocument* pDoc = rViewData.GetDocument();
+ pTabViewShell->DoneRefMode();
+ pTabViewShell->ClearHighlightRanges();
- if(pToken->GetType()==formula::svSingleRef || bDoubleRef)
- {
- ScRange aRange;
- if(bDoubleRef)
- {
- ScComplexRefData aRef( *pToken->GetDoubleRef() );
- aRange = aRef.toAbs(pDoc, aPos);
- }
- else
- {
- ScSingleRefData aRef( *pToken->GetSingleRef() );
- aRange.aStart = aRef.toAbs(pDoc, aPos);
- aRange.aEnd = aRange.aStart;
- }
- Color aColName=ScRangeFindList::GetColorName(nIndex++);
- pTabViewShell->AddHighlightRange(aRange, aColName);
- }
+ formula::FormulaTokenArrayPlainIterator aIter(*pScTokA);
+ const formula::FormulaToken* pToken = aIter.GetNextReference();
- pToken = aIter.GetNextReference();
- }
+ sal_uInt16 nIndex=0;
+
+ while(pToken!=nullptr)
+ {
+ bool bDoubleRef=(pToken->GetType()==formula::svDoubleRef);
+
+ if(pToken->GetType()==formula::svSingleRef || bDoubleRef)
+ {
+ ScRange aRange;
+ if(bDoubleRef)
+ {
+ ScComplexRefData aRef( *pToken->GetDoubleRef() );
+ aRange = aRef.toAbs(pDoc, aPos);
+ }
+ else
+ {
+ ScSingleRefData aRef( *pToken->GetSingleRef() );
+ aRange.aStart = aRef.toAbs(pDoc, aPos);
+ aRange.aEnd = aRange.aStart;
}
+ Color aColName=ScRangeFindList::GetColorName(nIndex++);
+ pTabViewShell->AddHighlightRange(aRange, aColName);
}
+
+ pToken = aIter.GetNextReference();
}
}
@@ -232,51 +232,51 @@ void ScFormulaReferenceHelper::HideReference( bool bDoneRefMode )
{
ScViewData* pViewData=ScDocShell::GetViewData();
- if( pViewData && m_bHighlightRef && m_bEnableColorRef)
- {
- ScTabViewShell* pTabViewShell=pViewData->GetViewShell();
+ if( !(pViewData && m_bHighlightRef && m_bEnableColorRef))
+ return;
- if(pTabViewShell!=nullptr)
- {
- // bDoneRefMode is sal_False when called from before SetReference.
- // In that case, RefMode was just started and must not be ended now.
+ ScTabViewShell* pTabViewShell=pViewData->GetViewShell();
- if ( bDoneRefMode )
- pTabViewShell->DoneRefMode();
- pTabViewShell->ClearHighlightRanges();
+ if(pTabViewShell!=nullptr)
+ {
+ // bDoneRefMode is sal_False when called from before SetReference.
+ // In that case, RefMode was just started and must not be ended now.
- if( comphelper::LibreOfficeKit::isActive() )
- {
- // Clear
- std::vector<ReferenceMark> aReferenceMarks;
- ScInputHandler::SendReferenceMarks( pTabViewShell, aReferenceMarks );
- }
+ if ( bDoneRefMode )
+ pTabViewShell->DoneRefMode();
+ pTabViewShell->ClearHighlightRanges();
+
+ if( comphelper::LibreOfficeKit::isActive() )
+ {
+ // Clear
+ std::vector<ReferenceMark> aReferenceMarks;
+ ScInputHandler::SendReferenceMarks( pTabViewShell, aReferenceMarks );
}
- m_bHighlightRef=false;
}
+ m_bHighlightRef=false;
}
void ScFormulaReferenceHelper::ShowReference(const OUString& rStr)
{
- if( m_bEnableColorRef )
+ if( !m_bEnableColorRef )
+ return;
+
+ if( rStr.indexOf('(') != -1 ||
+ rStr.indexOf('+') != -1 ||
+ rStr.indexOf('*') != -1 ||
+ rStr.indexOf('-') != -1 ||
+ rStr.indexOf('/') != -1 ||
+ rStr.indexOf('&') != -1 ||
+ rStr.indexOf('<') != -1 ||
+ rStr.indexOf('>') != -1 ||
+ rStr.indexOf('=') != -1 ||
+ rStr.indexOf('^') != -1 )
{
- if( rStr.indexOf('(') != -1 ||
- rStr.indexOf('+') != -1 ||
- rStr.indexOf('*') != -1 ||
- rStr.indexOf('-') != -1 ||
- rStr.indexOf('/') != -1 ||
- rStr.indexOf('&') != -1 ||
- rStr.indexOf('<') != -1 ||
- rStr.indexOf('>') != -1 ||
- rStr.indexOf('=') != -1 ||
- rStr.indexOf('^') != -1 )
- {
- ShowFormulaReference(rStr);
- }
- else
- {
- ShowSimpleReference(rStr);
- }
+ ShowFormulaReference(rStr);
+ }
+ else
+ {
+ ShowSimpleReference(rStr);
}
}
@@ -288,48 +288,48 @@ void ScFormulaReferenceHelper::ReleaseFocus( formula::RefEdit* pEdit )
}
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
- if( pViewShell )
+ if( !pViewShell )
+ return;
+
+ pViewShell->ActiveGrabFocus();
+ if( !m_pRefEdit )
+ return;
+
+ const ScViewData& rViewData = pViewShell->GetViewData();
+ ScDocument* pDoc = rViewData.GetDocument();
+ ScRangeList aRangeList;
+ if( !ParseWithNames( aRangeList, m_pRefEdit->GetText(), *pDoc ) )
+ return;
+
+ if ( !aRangeList.empty() )
{
- pViewShell->ActiveGrabFocus();
- if( m_pRefEdit )
- {
- const ScViewData& rViewData = pViewShell->GetViewData();
- ScDocument* pDoc = rViewData.GetDocument();
- ScRangeList aRangeList;
- if( ParseWithNames( aRangeList, m_pRefEdit->GetText(), *pDoc ) )
- {
- if ( !aRangeList.empty() )
- {
- const ScRange & rRange = aRangeList.front();
- pViewShell->SetTabNo( rRange.aStart.Tab() );
- pViewShell->MoveCursorAbs( rRange.aStart.Col(),
- rRange.aStart.Row(), SC_FOLLOW_JUMP, false, false );
- pViewShell->MoveCursorAbs( rRange.aEnd.Col(),
- rRange.aEnd.Row(), SC_FOLLOW_JUMP, true, false );
- m_pDlg->SetReference( rRange, *pDoc );
- }
- }
- }
+ const ScRange & rRange = aRangeList.front();
+ pViewShell->SetTabNo( rRange.aStart.Tab() );
+ pViewShell->MoveCursorAbs( rRange.aStart.Col(),
+ rRange.aStart.Row(), SC_FOLLOW_JUMP, false, false );
+ pViewShell->MoveCursorAbs( rRange.aEnd.Col(),
+ rRange.aEnd.Row(), SC_FOLLOW_JUMP, true, false );
+ m_pDlg->SetReference( rRange, *pDoc );
}
}
void ScFormulaReferenceHelper::Init()
{
ScViewData* pViewData=ScDocShell::GetViewData(); //! use pScViewShell?
- if ( pViewData )
- {
- ScDocument* pDoc = pViewData->GetDocument();
- SCCOL nCol = pViewData->GetCurX();
- SCROW nRow = pViewData->GetCurY();
- SCTAB nTab = pViewData->GetTabNo();
- ScAddress aCursorPos( nCol, nRow, nTab );
+ if ( !pViewData )
+ return;
- m_pRefComp.reset( new ScCompiler( pDoc, aCursorPos, pDoc->GetGrammar()) );
- m_pRefComp->EnableJumpCommandReorder(false);
- m_pRefComp->EnableStopOnError(false);
+ ScDocument* pDoc = pViewData->GetDocument();
+ SCCOL nCol = pViewData->GetCurX();
+ SCROW nRow = pViewData->GetCurY();
+ SCTAB nTab = pViewData->GetTabNo();
+ ScAddress aCursorPos( nCol, nRow, nTab );
- m_nRefTab = nTab;
- }
+ m_pRefComp.reset( new ScCompiler( pDoc, aCursorPos, pDoc->GetGrammar()) );
+ m_pRefComp->EnableJumpCommandReorder(false);
+ m_pRefComp->EnableStopOnError(false);
+
+ m_nRefTab = nTab;
}
IMPL_LINK_NOARG(ScFormulaReferenceHelper, ActivateHdl, weld::Widget&, bool)
@@ -342,79 +342,79 @@ IMPL_LINK_NOARG(ScFormulaReferenceHelper, ActivateHdl, weld::Widget&, bool)
void ScFormulaReferenceHelper::RefInputDone( bool bForced )
{
- if ( CanInputDone( bForced ) )
- {
- if (m_pDialog)
- {
- // Adjust window title
- m_pDialog->set_title(m_sOldDialogText);
+ if ( !CanInputDone( bForced ) )
+ return;
- if (m_pRefEdit)
- m_pRefEdit->SetActivateHdl(Link<weld::Widget&, bool>());
+ if (!m_pDialog)
+ return;
- // set button image
- if (m_pRefBtn)
- {
- m_pRefBtn->SetActivateHdl(Link<weld::Widget&, bool>());
- m_pRefBtn->SetStartImage();
- }
+ // Adjust window title
+ m_pDialog->set_title(m_sOldDialogText);
- m_pDialog->undo_collapse();
+ if (m_pRefEdit)
+ m_pRefEdit->SetActivateHdl(Link<weld::Widget&, bool>());
- m_pRefEdit = nullptr;
- m_pRefBtn = nullptr;
- }
+ // set button image
+ if (m_pRefBtn)
+ {
+ m_pRefBtn->SetActivateHdl(Link<weld::Widget&, bool>());
+ m_pRefBtn->SetStartImage();
}
+
+ m_pDialog->undo_collapse();
+
+ m_pRefEdit = nullptr;
+ m_pRefBtn = nullptr;
}
void ScFormulaReferenceHelper::RefInputStart( formula::RefEdit* pEdit, formula::RefButton* pButton )
{
- if (!m_pRefEdit)
- {
- m_pRefEdit = pEdit;
- m_pRefBtn = pButton;
+ if (m_pRefEdit)
+ return;
- // Save and adjust window title
- m_sOldDialogText = m_pDialog->get_title();
- if (weld::Label *pLabel = m_pRefEdit->GetLabelWidgetForShrinkMode())
+ m_pRefEdit = pEdit;
+ m_pRefBtn = pButton;
+
+ // Save and adjust window title
+ m_sOldDialogText = m_pDialog->get_title();
+ if (weld::Label *pLabel = m_pRefEdit->GetLabelWidgetForShrinkMode())
+ {
+ const OUString sLabel = pLabel->get_label();
+ if (!sLabel.isEmpty())
{
- const OUString sLabel = pLabel->get_label();
- if (!sLabel.isEmpty())
- {
- const OUString sNewDialogText = m_sOldDialogText + ": " + comphelper::string::stripEnd(sLabel, ':');
- m_pDialog->set_title(pLabel->strip_mnemonic(sNewDialogText));
- }
+ const OUString sNewDialogText = m_sOldDialogText + ": " + comphelper::string::stripEnd(sLabel, ':');
+ m_pDialog->set_title(pLabel->strip_mnemonic(sNewDialogText));
}
+ }
- m_pDialog->collapse(pEdit->GetWidget(), pButton ? pButton->GetWidget() : nullptr);
+ m_pDialog->collapse(pEdit->GetWidget(), pButton ? pButton->GetWidget() : nullptr);
- // set button image
- if (pButton)
- pButton->SetEndImage();
+ // set button image
+ if (pButton)
+ pButton->SetEndImage();
- m_pRefEdit->SetActivateHdl(LINK(this, ScFormulaReferenceHelper, ActivateHdl));
- if (m_pRefBtn)
- m_pRefBtn->SetActivateHdl(LINK(this, ScFormulaReferenceHelper, ActivateHdl));
- }
+ m_pRefEdit->SetActivateHdl(LINK(this, ScFormulaReferenceHelper, ActivateHdl));
+ if (m_pRefBtn)
+ m_pRefBtn->SetActivateHdl(LINK(this, ScFormulaReferenceHelper, ActivateHdl));
}
void ScFormulaReferenceHelper::ToggleCollapsed( formula::RefEdit* pEdit, formula::RefButton* pButton )
{
- if( pEdit )
+ if( !pEdit )
+ return;
+
+ if( m_pRefEdit == pEdit ) // is this the active ref edit field?
{
- if( m_pRefEdit == pEdit ) // is this the active ref edit field?
- {
- m_pRefEdit->GrabFocus(); // before RefInputDone()
- m_pDlg->RefInputDone( true ); // finish ref input
- }
- else
- {
- m_pDlg->RefInputDone( true ); // another active ref edit?
- m_pDlg->RefInputStart( pEdit, pButton ); // start ref input
- // pRefEdit might differ from pEdit after RefInputStart() (i.e. ScFormulaDlg)
- if( m_pRefEdit )
- m_pRefEdit->GrabFocus();
- }
+ m_pRefEdit->GrabFocus(); // before RefInputDone()
+ m_pDlg->RefInputDone( true ); // finish ref input
+ }
+ else
+ {
+ m_pDlg->RefInputDone( true ); // another active ref edit?
+ m_pDlg->RefInputStart( pEdit, pButton ); // start ref input
+ // pRefEdit might differ from pEdit after RefInputStart() (i.e. ScFormulaDlg)
+ if( m_pRefEdit )
+ m_pRefEdit->GrabFocus();
}
}
diff --git a/sc/source/ui/miscdlgs/autofmt.cxx b/sc/source/ui/miscdlgs/autofmt.cxx
index f0031987e0c3..8fe7084643b9 100644
--- a/sc/source/ui/miscdlgs/autofmt.cxx
+++ b/sc/source/ui/miscdlgs/autofmt.cxx
@@ -107,49 +107,49 @@ static void lcl_SetFontProperties(
void ScAutoFmtPreview::MakeFonts(vcl::RenderContext const& rRenderContext, sal_uInt16 nIndex, vcl::Font& rFont, vcl::Font& rCJKFont, vcl::Font& rCTLFont)
{
- if ( pCurData )
- {
- rFont = rCJKFont = rCTLFont = rRenderContext.GetFont();
- Size aFontSize(rFont.GetFontSize().Width(), 10 * rRenderContext.GetDPIScaleFactor());
-
- const SvxFontItem* pFontItem = pCurData->GetItem( nIndex, ATTR_FONT );
- const SvxWeightItem* pWeightItem = pCurData->GetItem( nIndex, ATTR_FONT_WEIGHT );
- const SvxPostureItem* pPostureItem = pCurData->GetItem( nIndex, ATTR_FONT_POSTURE );
- const SvxFontItem* pCJKFontItem = pCurData->GetItem( nIndex, ATTR_CJK_FONT );
- const SvxWeightItem* pCJKWeightItem = pCurData->GetItem( nIndex, ATTR_CJK_FONT_WEIGHT );
- const SvxPostureItem* pCJKPostureItem = pCurData->GetItem( nIndex, ATTR_CJK_FONT_POSTURE );
- const SvxFontItem* pCTLFontItem = pCurData->GetItem( nIndex, ATTR_CTL_FONT );
- const SvxWeightItem* pCTLWeightItem = pCurData->GetItem( nIndex, ATTR_CTL_FONT_WEIGHT );
- const SvxPostureItem* pCTLPostureItem = pCurData->GetItem( nIndex, ATTR_CTL_FONT_POSTURE );
- const SvxUnderlineItem* pUnderlineItem = pCurData->GetItem( nIndex, ATTR_FONT_UNDERLINE );
- const SvxOverlineItem* pOverlineItem = pCurData->GetItem( nIndex, ATTR_FONT_OVERLINE );
- const SvxCrossedOutItem* pCrossedOutItem = pCurData->GetItem( nIndex, ATTR_FONT_CROSSEDOUT );
- const SvxContourItem* pContourItem = pCurData->GetItem( nIndex, ATTR_FONT_CONTOUR );
- const SvxShadowedItem* pShadowedItem = pCurData->GetItem( nIndex, ATTR_FONT_SHADOWED );
- const SvxColorItem* pColorItem = pCurData->GetItem( nIndex, ATTR_FONT_COLOR );
-
- lcl_SetFontProperties( rFont, *pFontItem, *pWeightItem, *pPostureItem );
- lcl_SetFontProperties( rCJKFont, *pCJKFontItem, *pCJKWeightItem, *pCJKPostureItem );
- lcl_SetFontProperties( rCTLFont, *pCTLFontItem, *pCTLWeightItem, *pCTLPostureItem );
-
- Color aColor( pColorItem->GetValue() );
- if( aColor == COL_TRANSPARENT )
- aColor = Application::GetSettings().GetStyleSettings().GetWindowTextColor();
+ if ( !pCurData )
+ return;
+
+ rFont = rCJKFont = rCTLFont = rRenderContext.GetFont();
+ Size aFontSize(rFont.GetFontSize().Width(), 10 * rRenderContext.GetDPIScaleFactor());
+
+ const SvxFontItem* pFontItem = pCurData->GetItem( nIndex, ATTR_FONT );
+ const SvxWeightItem* pWeightItem = pCurData->GetItem( nIndex, ATTR_FONT_WEIGHT );
+ const SvxPostureItem* pPostureItem = pCurData->GetItem( nIndex, ATTR_FONT_POSTURE );
+ const SvxFontItem* pCJKFontItem = pCurData->GetItem( nIndex, ATTR_CJK_FONT );
+ const SvxWeightItem* pCJKWeightItem = pCurData->GetItem( nIndex, ATTR_CJK_FONT_WEIGHT );
+ const SvxPostureItem* pCJKPostureItem = pCurData->GetItem( nIndex, ATTR_CJK_FONT_POSTURE );
+ const SvxFontItem* pCTLFontItem = pCurData->GetItem( nIndex, ATTR_CTL_FONT );
+ const SvxWeightItem* pCTLWeightItem = pCurData->GetItem( nIndex, ATTR_CTL_FONT_WEIGHT );
+ const SvxPostureItem* pCTLPostureItem = pCurData->GetItem( nIndex, ATTR_CTL_FONT_POSTURE );
+ const SvxUnderlineItem* pUnderlineItem = pCurData->GetItem( nIndex, ATTR_FONT_UNDERLINE );
+ const SvxOverlineItem* pOverlineItem = pCurData->GetItem( nIndex, ATTR_FONT_OVERLINE );
+ const SvxCrossedOutItem* pCrossedOutItem = pCurData->GetItem( nIndex, ATTR_FONT_CROSSEDOUT );
+ const SvxContourItem* pContourItem = pCurData->GetItem( nIndex, ATTR_FONT_CONTOUR );
+ const SvxShadowedItem* pShadowedItem = pCurData->GetItem( nIndex, ATTR_FONT_SHADOWED );
+ const SvxColorItem* pColorItem = pCurData->GetItem( nIndex, ATTR_FONT_COLOR );
+
+ lcl_SetFontProperties( rFont, *pFontItem, *pWeightItem, *pPostureItem );
+ lcl_SetFontProperties( rCJKFont, *pCJKFontItem, *pCJKWeightItem, *pCJKPostureItem );
+ lcl_SetFontProperties( rCTLFont, *pCTLFontItem, *pCTLWeightItem, *pCTLPostureItem );
+
+ Color aColor( pColorItem->GetValue() );
+ if( aColor == COL_TRANSPARENT )
+ aColor = Application::GetSettings().GetStyleSettings().GetWindowTextColor();
#define SETONALLFONTS( MethodName, Value ) \
rFont.MethodName( Value ); rCJKFont.MethodName( Value ); rCTLFont.MethodName( Value );
- SETONALLFONTS( SetUnderline, pUnderlineItem->GetValue() )
- SETONALLFONTS( SetOverline, pOverlineItem->GetValue() )
- SETONALLFONTS( SetStrikeout, pCrossedOutItem->GetValue() )
- SETONALLFONTS( SetOutline, pContourItem->GetValue() )
- SETONALLFONTS( SetShadow, pShadowedItem->GetValue() )
- SETONALLFONTS( SetColor, aColor )
- SETONALLFONTS( SetFontSize, aFontSize )
- SETONALLFONTS( SetTransparent, true )
+ SETONALLFONTS( SetUnderline, pUnderlineItem->GetValue() )
+ SETONALLFONTS( SetOverline, pOverlineItem->GetValue() )
+ SETONALLFONTS( SetStrikeout, pCrossedOutItem->GetValue() )
+ SETONALLFONTS( SetOutline, pContourItem->GetValue() )
+ SETONALLFONTS( SetShadow, pShadowedItem->GetValue() )
+ SETONALLFONTS( SetColor, aColor )
+ SETONALLFONTS( SetFontSize, aFontSize )
+ SETONALLFONTS( SetTransparent, true )
#undef SETONALLFONTS
- }
}
sal_uInt16 ScAutoFmtPreview::GetFormatIndex( size_t nCol, size_t nRow ) const
@@ -239,175 +239,174 @@ void ScAutoFmtPreview::DrawString(vcl::RenderContext& rRenderContext, size_t nCo
break;
}
- if (!cellString.isEmpty())
- {
-
- Size aStrSize;
- sal_uInt16 nFmtIndex = GetFormatIndex( nCol, nRow );
- const basegfx::B2DRange cellRange(maArray.GetCellRange( nCol, nRow, true ));
- Point aPos(basegfx::fround(cellRange.getMinX()), basegfx::fround(cellRange.getMinY()));
- sal_uInt16 nRightX = 0;
- bool bJustify = pCurData->GetIncludeJustify();
- SvxCellHorJustify eJustification;
+ if (cellString.isEmpty())
+ return;
- SvtScriptedTextHelper aScriptedText(rRenderContext);
+ Size aStrSize;
+ sal_uInt16 nFmtIndex = GetFormatIndex( nCol, nRow );
+ const basegfx::B2DRange cellRange(maArray.GetCellRange( nCol, nRow, true ));
+ Point aPos(basegfx::fround(cellRange.getMinX()), basegfx::fround(cellRange.getMinY()));
+ sal_uInt16 nRightX = 0;
+ bool bJustify = pCurData->GetIncludeJustify();
+ SvxCellHorJustify eJustification;
- // Justification:
+ SvtScriptedTextHelper aScriptedText(rRenderContext);
- eJustification = mbRTL ? SvxCellHorJustify::Right : bJustify ?
- pCurData->GetItem(nFmtIndex, ATTR_HOR_JUSTIFY)->GetValue() :
- SvxCellHorJustify::Standard;
+ // Justification:
- if (pCurData->GetIncludeFont())
- {
- vcl::Font aFont, aCJKFont, aCTLFont;
- Size theMaxStrSize;
+ eJustification = mbRTL ? SvxCellHorJustify::Right : bJustify ?
+ pCurData->GetItem(nFmtIndex, ATTR_HOR_JUSTIFY)->GetValue() :
+ SvxCellHorJustify::Standard;
- MakeFonts(rRenderContext, nFmtIndex, aFont, aCJKFont, aCTLFont);
+ if (pCurData->GetIncludeFont())
+ {
+ vcl::Font aFont, aCJKFont, aCTLFont;
+ Size theMaxStrSize;
- theMaxStrSize = Size(basegfx::fround(cellRange.getWidth()), basegfx::fround(cellRange.getHeight()));
- theMaxStrSize.AdjustWidth( -(FRAME_OFFSET) );
- theMaxStrSize.AdjustHeight( -(FRAME_OFFSET) );
+ MakeFonts(rRenderContext, nFmtIndex, aFont, aCJKFont, aCTLFont);
- aScriptedText.SetFonts( &aFont, &aCJKFont, &aCTLFont );
- aScriptedText.SetText(cellString, xBreakIter);
- aStrSize = aScriptedText.GetTextSize();
+ theMaxStrSize = Size(basegfx::fround(cellRange.getWidth()), basegfx::fround(cellRange.getHeight()));
+ theMaxStrSize.AdjustWidth( -(FRAME_OFFSET) );
+ theMaxStrSize.AdjustHeight( -(FRAME_OFFSET) );
- if (theMaxStrSize.Height() < aStrSize.Height())
- {
- // if the string does not fit in the row using this font,
- // the default font is used
- aScriptedText.SetDefaultFont();
- aStrSize = aScriptedText.GetTextSize();
- }
- while((theMaxStrSize.Width() <= aStrSize.Width()) && (cellString.getLength() > 1))
- {
- if( eJustification == SvxCellHorJustify::Right )
- cellString = cellString.copy(1);
- else
- cellString = cellString.copy(0, cellString.getLength() - 1 );
+ aScriptedText.SetFonts( &aFont, &aCJKFont, &aCTLFont );
+ aScriptedText.SetText(cellString, xBreakIter);
+ aStrSize = aScriptedText.GetTextSize();
- aScriptedText.SetText( cellString, xBreakIter );
- aStrSize = aScriptedText.GetTextSize();
- }
- }
- else
+ if (theMaxStrSize.Height() < aStrSize.Height())
{
+ // if the string does not fit in the row using this font,
+ // the default font is used
aScriptedText.SetDefaultFont();
+ aStrSize = aScriptedText.GetTextSize();
+ }
+ while((theMaxStrSize.Width() <= aStrSize.Width()) && (cellString.getLength() > 1))
+ {
+ if( eJustification == SvxCellHorJustify::Right )
+ cellString = cellString.copy(1);
+ else
+ cellString = cellString.copy(0, cellString.getLength() - 1 );
+
aScriptedText.SetText( cellString, xBreakIter );
aStrSize = aScriptedText.GetTextSize();
}
+ }
+ else
+ {
+ aScriptedText.SetDefaultFont();
+ aScriptedText.SetText( cellString, xBreakIter );
+ aStrSize = aScriptedText.GetTextSize();
+ }
- nRightX = sal_uInt16(basegfx::fround(cellRange.getWidth()) - aStrSize.Width() - FRAME_OFFSET);
+ nRightX = sal_uInt16(basegfx::fround(cellRange.getWidth()) - aStrSize.Width() - FRAME_OFFSET);
- // vertical (always center):
+ // vertical (always center):
- aPos.AdjustY((mnRowHeight - static_cast<sal_uInt16>(aStrSize.Height())) / 2 );
+ aPos.AdjustY((mnRowHeight - static_cast<sal_uInt16>(aStrSize.Height())) / 2 );
- // horizontal
+ // horizontal
- if (eJustification != SvxCellHorJustify::Standard)
+ if (eJustification != SvxCellHorJustify::Standard)
+ {
+ sal_uInt16 nHorPos = sal_uInt16((basegfx::fround(cellRange.getWidth())-aStrSize.Width()) / 2);
+ //sal_uInt16 nHorPos = sal_uInt16((basegfx::fround(cellRange.getWidth())-aStrSize.Width()) / 2);
+
+ switch (eJustification)
{
- sal_uInt16 nHorPos = sal_uInt16((basegfx::fround(cellRange.getWidth())-aStrSize.Width()) / 2);
- //sal_uInt16 nHorPos = sal_uInt16((basegfx::fround(cellRange.getWidth())-aStrSize.Width()) / 2);
+ case SvxCellHorJustify::Left:
+ aPos.AdjustX(FRAME_OFFSET );
+ break;
+ case SvxCellHorJustify::Right:
+ aPos.AdjustX(nRightX );
+ break;
+ case SvxCellHorJustify::Block:
+ case SvxCellHorJustify::Repeat:
+ case SvxCellHorJustify::Center:
+ aPos.AdjustX(nHorPos );
+ break;
+ // coverity[dead_error_line] - following conditions exist to avoid compiler warning
+ case SvxCellHorJustify::Standard:
+ default:
+ // Standard is not handled here
+ break;
+ }
+ }
+ else
+ {
- switch (eJustification)
- {
- case SvxCellHorJustify::Left:
- aPos.AdjustX(FRAME_OFFSET );
- break;
- case SvxCellHorJustify::Right:
- aPos.AdjustX(nRightX );
- break;
- case SvxCellHorJustify::Block:
- case SvxCellHorJustify::Repeat:
- case SvxCellHorJustify::Center:
- aPos.AdjustX(nHorPos );
- break;
- // coverity[dead_error_line] - following conditions exist to avoid compiler warning
- case SvxCellHorJustify::Standard:
- default:
- // Standard is not handled here
- break;
- }
+ // Standard justification
+
+ if (nCol == 0 || nRow == 0)
+ {
+ // Text label to the left or sum left adjusted
+ aPos.AdjustX(FRAME_OFFSET );
}
else
{
-
- // Standard justification
-
- if (nCol == 0 || nRow == 0)
- {
- // Text label to the left or sum left adjusted
- aPos.AdjustX(FRAME_OFFSET );
- }
- else
- {
- // Numbers/Dates right adjusted
- aPos.AdjustX(nRightX );
- }
+ // Numbers/Dates right adjusted
+ aPos.AdjustX(nRightX );
}
- aScriptedText.DrawText(aPos);
}
+ aScriptedText.DrawText(aPos);
}
#undef FRAME_OFFSET
void ScAutoFmtPreview::DrawBackground(vcl::RenderContext& rRenderContext)
{
- if (pCurData)
+ if (!pCurData)
+ return;
+
+ for(size_t nRow = 0; nRow < 5; ++nRow)
{
- for(size_t nRow = 0; nRow < 5; ++nRow)
+ for(size_t nCol = 0; nCol < 5; ++nCol)
{
- for(size_t nCol = 0; nCol < 5; ++nCol)
- {
- const SvxBrushItem* pItem =
- pCurData->GetItem( GetFormatIndex( nCol, nRow ), ATTR_BACKGROUND );
+ const SvxBrushItem* pItem =
+ pCurData->GetItem( GetFormatIndex( nCol, nRow ), ATTR_BACKGROUND );
- rRenderContext.Push( PushFlags::LINECOLOR | PushFlags::FILLCOLOR );
- rRenderContext.SetLineColor();
- rRenderContext.SetFillColor( pItem->GetColor() );
+ rRenderContext.Push( PushFlags::LINECOLOR | PushFlags::FILLCOLOR );
+ rRenderContext.SetLineColor();
+ rRenderContext.SetFillColor( pItem->GetColor() );
- const basegfx::B2DRange aCellRange(maArray.GetCellRange( nCol, nRow, true ));
- rRenderContext.DrawRect(
- tools::Rectangle(
- basegfx::fround(aCellRange.getMinX()), basegfx::fround(aCellRange.getMinY()),
- basegfx::fround(aCellRange.getMaxX()), basegfx::fround(aCellRange.getMaxY())));
+ const basegfx::B2DRange aCellRange(maArray.GetCellRange( nCol, nRow, true ));
+ rRenderContext.DrawRect(
+ tools::Rectangle(
+ basegfx::fround(aCellRange.getMinX()), basegfx::fround(aCellRange.getMinY()),
+ basegfx::fround(aCellRange.getMaxX()), basegfx::fround(aCellRange.getMaxY())));
- rRenderContext.Pop();
- }
+ rRenderContext.Pop();
}
}
}
void ScAutoFmtPreview::PaintCells(vcl::RenderContext& rRenderContext)
{
- if (pCurData)
- {
- // 1) background
- if (pCurData->GetIncludeBackground())
- DrawBackground(rRenderContext);
+ if (!pCurData)
+ return;
- // 2) values
- for(size_t nRow = 0; nRow < 5; ++nRow)
- for(size_t nCol = 0; nCol < 5; ++nCol)
- DrawString(rRenderContext, nCol, nRow);
+ // 1) background
+ if (pCurData->GetIncludeBackground())
+ DrawBackground(rRenderContext);
- // 3) border
- if (pCurData->GetIncludeFrame())
- {
- const drawinglayer::geometry::ViewInformation2D aNewViewInformation2D;
- std::unique_ptr<drawinglayer::processor2d::BaseProcessor2D> pProcessor2D(
- drawinglayer::processor2d::createPixelProcessor2DFromOutputDevice(
- rRenderContext,
- aNewViewInformation2D));
+ // 2) values
+ for(size_t nRow = 0; nRow < 5; ++nRow)
+ for(size_t nCol = 0; nCol < 5; ++nCol)
+ DrawString(rRenderContext, nCol, nRow);
- if (pProcessor2D)
- {
- pProcessor2D->process(maArray.CreateB2DPrimitiveArray());
- pProcessor2D.reset();
- }
- }
+ // 3) border
+ if (!pCurData->GetIncludeFrame())
+ return;
+
+ const drawinglayer::geometry::ViewInformation2D aNewViewInformation2D;
+ std::unique_ptr<drawinglayer::processor2d::BaseProcessor2D> pProcessor2D(
+ drawinglayer::processor2d::createPixelProcessor2DFromOutputDevice(
+ rRenderContext,
+ aNewViewInformation2D));
+
+ if (pProcessor2D)
+ {
+ pProcessor2D->process(maArray.CreateB2DPrimitiveArray());
+ pProcessor2D.reset();
}
}
@@ -451,29 +450,29 @@ static void lclSetStyleFromBorder( svx::frame::Style& rStyle, const ::editeng::S
void ScAutoFmtPreview::CalcLineMap()
{
- if ( pCurData )
+ if ( !pCurData )
+ return;
+
+ for( size_t nRow = 0; nRow < 5; ++nRow )
{
- for( size_t nRow = 0; nRow < 5; ++nRow )
+ for( size_t nCol = 0; nCol < 5; ++nCol )
{
- for( size_t nCol = 0; nCol < 5; ++nCol )
- {
- svx::frame::Style aStyle;
-
- const SvxBoxItem& rItem = GetBoxItem( nCol, nRow );
- lclSetStyleFromBorder( aStyle, rItem.GetLeft() );
- maArray.SetCellStyleLeft( nCol, nRow, aStyle );
- lclSetStyleFromBorder( aStyle, rItem.GetRight() );
- maArray.SetCellStyleRight( nCol, nRow, aStyle );
- lclSetStyleFromBorder( aStyle, rItem.GetTop() );
- maArray.SetCellStyleTop( nCol, nRow, aStyle );
- lclSetStyleFromBorder( aStyle, rItem.GetBottom() );
- maArray.SetCellStyleBottom( nCol, nRow, aStyle );
-
- lclSetStyleFromBorder( aStyle, GetDiagItem( nCol, nRow, true ).GetLine() );
- maArray.SetCellStyleTLBR( nCol, nRow, aStyle );
- lclSetStyleFromBorder( aStyle, GetDiagItem( nCol, nRow, false ).GetLine() );
- maArray.SetCellStyleBLTR( nCol, nRow, aStyle );
- }
+ svx::frame::Style aStyle;
+
+ const SvxBoxItem& rItem = GetBoxItem( nCol, nRow );
+ lclSetStyleFromBorder( aStyle, rItem.GetLeft() );
+ maArray.SetCellStyleLeft( nCol, nRow, aStyle );
+ lclSetStyleFromBorder( aStyle, rItem.GetRight() );
+ maArray.SetCellStyleRight( nCol, nRow, aStyle );
+ lclSetStyleFromBorder( aStyle, rItem.GetTop() );
+ maArray.SetCellStyleTop( nCol, nRow, aStyle );
+ lclSetStyleFromBorder( aStyle, rItem.GetBottom() );
+ maArray.SetCellStyleBottom( nCol, nRow, aStyle );
+
+ lclSetStyleFromBorder( aStyle, GetDiagItem( nCol, nRow, true ).GetLine() );
+ maArray.SetCellStyleTLBR( nCol, nRow, aStyle );
+ lclSetStyleFromBorder( aStyle, GetDiagItem( nCol, nRow, false ).GetLine() );
+ maArray.SetCellStyleBLTR( nCol, nRow, aStyle );
}
}
}
diff --git a/sc/source/ui/miscdlgs/conflictsdlg.cxx b/sc/source/ui/miscdlgs/conflictsdlg.cxx
index f5b1d786443a..e2b935c54954 100644
--- a/sc/source/ui/miscdlgs/conflictsdlg.cxx
+++ b/sc/source/ui/miscdlgs/conflictsdlg.cxx
@@ -402,25 +402,25 @@ void ScConflictsDlg::SetActionString(const ScChangeAction* pAction, ScDocument*
{
OSL_ENSURE( pAction, "ScConflictsDlg::GetActionString(): pAction is null!" );
OSL_ENSURE( pDoc, "ScConflictsDlg::GetActionString(): pDoc is null!" );
- if (pAction && pDoc)
- {
- weld::TreeView& rTreeView = m_xLbConflicts->GetWidget();
- OUString aDesc;
- pAction->GetDescription(aDesc, pDoc, true, false);
- rTreeView.set_text(rEntry, aDesc, 0);
+ if (!(pAction && pDoc))
+ return;
- OUString aUser = comphelper::string::strip(pAction->GetUser(), ' ');
- if ( aUser.isEmpty() )
- {
- aUser = maStrUnknownUser;
- }
- rTreeView.set_text(rEntry, aUser, 1);
+ weld::TreeView& rTreeView = m_xLbConflicts->GetWidget();
+ OUString aDesc;
+ pAction->GetDescription(aDesc, pDoc, true, false);
+ rTreeView.set_text(rEntry, aDesc, 0);
- DateTime aDateTime = pAction->GetDateTime();
- OUString aString = ScGlobal::getLocaleDataPtr()->getDate( aDateTime ) + " " +
- ScGlobal::getLocaleDataPtr()->getTime( aDateTime, false );
- rTreeView.set_text(rEntry, aString, 2);
+ OUString aUser = comphelper::string::strip(pAction->GetUser(), ' ');
+ if ( aUser.isEmpty() )
+ {
+ aUser = maStrUnknownUser;
}
+ rTreeView.set_text(rEntry, aUser, 1);
+
+ DateTime aDateTime = pAction->GetDateTime();
+ OUString aString = ScGlobal::getLocaleDataPtr()->getDate( aDateTime ) + " " +
+ ScGlobal::getLocaleDataPtr()->getTime( aDateTime, false );
+ rTreeView.set_text(rEntry, aString, 2);
}
void ScConflictsDlg::HandleListBoxSelection()
diff --git a/sc/source/ui/miscdlgs/crnrdlg.cxx b/sc/source/ui/miscdlgs/crnrdlg.cxx
index 425ffb275934..0b0e6be31079 100644
--- a/sc/source/ui/miscdlgs/crnrdlg.cxx
+++ b/sc/source/ui/miscdlgs/crnrdlg.cxx
@@ -304,20 +304,20 @@ void ScColRowNameRangesDlg::AdjustColRowData( const ScRange& rDataRange, bool bR
// the selection form element
void ScColRowNameRangesDlg::SetReference( const ScRange& rRef, ScDocument& /* rDoc */ )
{
- if ( m_pEdActive )
- {
- if ( rRef.aStart != rRef.aEnd )
- RefInputStart( m_pEdActive );
+ if ( !m_pEdActive )
+ return;
- if (m_pEdActive == m_xEdAssign.get())
- SetColRowData( rRef, true );
- else
- AdjustColRowData( rRef, true );
- m_xBtnColHead->set_sensitive(true);
- m_xBtnRowHead->set_sensitive(true);
- m_xBtnAdd->set_sensitive(true);
- m_xBtnRemove->set_sensitive(false);
- }
+ if ( rRef.aStart != rRef.aEnd )
+ RefInputStart( m_pEdActive );
+
+ if (m_pEdActive == m_xEdAssign.get())
+ SetColRowData( rRef, true );
+ else
+ AdjustColRowData( rRef, true );
+ m_xBtnColHead->set_sensitive(true);
+ m_xBtnRowHead->set_sensitive(true);
+ m_xBtnAdd->set_sensitive(true);
+ m_xBtnRemove->set_sensitive(false);
}
void ScColRowNameRangesDlg::Close()
@@ -514,50 +514,50 @@ IMPL_LINK_NOARG(ScColRowNameRangesDlg, AddBtnHdl, weld::Button&, void)
OUString aNewArea( m_xEdAssign->GetText() );
OUString aNewData( m_xEdAssign2->GetText() );
- if ( !aNewArea.isEmpty() && !aNewData.isEmpty() )
+ if (aNewArea.isEmpty() || aNewData.isEmpty())
+ return;
+
+ const formula::FormulaGrammar::AddressConvention eConv = pDoc->GetAddressConvention();
+ ScRange aRange1, aRange2;
+ bool bOk1 = (aRange1.ParseAny( aNewArea, pDoc, eConv ) & ScRefFlags::VALID) == ScRefFlags::VALID;
+ if ( bOk1 && (aRange2.ParseAny( aNewData, pDoc, eConv ) & ScRefFlags::VALID) == ScRefFlags::VALID)
{
- const formula::FormulaGrammar::AddressConvention eConv = pDoc->GetAddressConvention();
- ScRange aRange1, aRange2;
- bool bOk1 = (aRange1.ParseAny( aNewArea, pDoc, eConv ) & ScRefFlags::VALID) == ScRefFlags::VALID;
- if ( bOk1 && (aRange2.ParseAny( aNewData, pDoc, eConv ) & ScRefFlags::VALID) == ScRefFlags::VALID)
+ theCurArea = aRange1;
+ AdjustColRowData( aRange2 );
+ ScRangePair* pPair;
+ if ( ( pPair = xColNameRanges->Find( theCurArea ) ) != nullptr )
{
- theCurArea = aRange1;
- AdjustColRowData( aRange2 );
- ScRangePair* pPair;
- if ( ( pPair = xColNameRanges->Find( theCurArea ) ) != nullptr )
- {
- xColNameRanges->Remove( *pPair );
- }
- if ( ( pPair = xRowNameRanges->Find( theCurArea ) ) != nullptr )
- {
- xRowNameRanges->Remove( *pPair );
- }
- if ( m_xBtnColHead->get_active() )
- xColNameRanges->Join( ScRangePair( theCurArea, theCurData ) );
- else
- xRowNameRanges->Join( ScRangePair( theCurArea, theCurData ) );
+ xColNameRanges->Remove( *pPair );
+ }
+ if ( ( pPair = xRowNameRanges->Find( theCurArea ) ) != nullptr )
+ {
+ xRowNameRanges->Remove( *pPair );
+ }
+ if ( m_xBtnColHead->get_active() )
+ xColNameRanges->Join( ScRangePair( theCurArea, theCurData ) );
+ else
+ xRowNameRanges->Join( ScRangePair( theCurArea, theCurData ) );
- UpdateNames();
+ UpdateNames();
+ m_xEdAssign->GrabFocus();
+ m_xBtnAdd->set_sensitive(false);
+ m_xBtnRemove->set_sensitive(false);
+ m_xEdAssign->SetText( EMPTY_OUSTRING );
+ m_xBtnColHead->set_active(true);
+ m_xBtnRowHead->set_active(false);
+ m_xEdAssign2->SetText( EMPTY_OUSTRING );
+ theCurArea = ScRange();
+ theCurData = theCurArea;
+ Range1SelectHdl( *m_xLbRange );
+ }
+ else
+ {
+ ERRORBOX(m_xDialog.get(), ScResId(STR_INVALIDTABNAME));
+ if ( !bOk1 )
m_xEdAssign->GrabFocus();
- m_xBtnAdd->set_sensitive(false);
- m_xBtnRemove->set_sensitive(false);
- m_xEdAssign->SetText( EMPTY_OUSTRING );
- m_xBtnColHead->set_active(true);
- m_xBtnRowHead->set_active(false);
- m_xEdAssign2->SetText( EMPTY_OUSTRING );
- theCurArea = ScRange();
- theCurData = theCurArea;
- Range1SelectHdl( *m_xLbRange );
- }
else
- {
- ERRORBOX(m_xDialog.get(), ScResId(STR_INVALIDTABNAME));
- if ( !bOk1 )
- m_xEdAssign->GrabFocus();
- else
- m_xEdAssign2->GrabFocus();
- }
+ m_xEdAssign2->GrabFocus();
}
}
@@ -577,44 +577,44 @@ IMPL_LINK_NOARG(ScColRowNameRangesDlg, RemoveBtnHdl, weld::Button&, void)
bFound = true;
else if ( !bColName && (pPair = xRowNameRanges->Find( rRange )) != nullptr )
bFound = true;
- if ( bFound )
- {
- OUString aStrDelMsg = ScResId( STR_QUERY_DELENTRY );
- OUString aMsg = aStrDelMsg.getToken( 0, '#' )
- + aRangeStr
- + aStrDelMsg.getToken( 1, '#' );
+ if ( !bFound )
+ return;
- if (RET_YES == QUERYBOX(m_xDialog.get(), aMsg))
- {
- if ( bColName )
- xColNameRanges->Remove( *pPair );
- else
- xRowNameRanges->Remove( *pPair );
+ OUString aStrDelMsg = ScResId( STR_QUERY_DELENTRY );
+ OUString aMsg = aStrDelMsg.getToken( 0, '#' )
+ + aRangeStr
+ + aStrDelMsg.getToken( 1, '#' );
- UpdateNames();
- const sal_Int32 nCnt = m_xLbRange->n_children();
- if ( nSelectPos >= nCnt )
- {
- if ( nCnt )
- nSelectPos = nCnt - 1;
- else
- nSelectPos = 0;
- }
- m_xLbRange->select(nSelectPos);
- if (nSelectPos && m_xLbRange->get_id(nSelectPos).toInt32() == nEntryDataDelim)
- m_xLbRange->select( --nSelectPos ); // ---Row---
+ if (RET_YES != QUERYBOX(m_xDialog.get(), aMsg))
+ return;
- m_xLbRange->grab_focus();
- m_xBtnAdd->set_sensitive(false);
- m_xBtnRemove->set_sensitive(false);
- m_xEdAssign->SetText( EMPTY_OUSTRING );
- theCurArea = theCurData = ScRange();
- m_xBtnColHead->set_active(true);
- m_xBtnRowHead->set_active(false);
- m_xEdAssign2->SetText( EMPTY_OUSTRING );
- Range1SelectHdl( *m_xLbRange );
- }
+ if ( bColName )
+ xColNameRanges->Remove( *pPair );
+ else
+ xRowNameRanges->Remove( *pPair );
+
+ UpdateNames();
+ const sal_Int32 nCnt = m_xLbRange->n_children();
+ if ( nSelectPos >= nCnt )
+ {
+ if ( nCnt )
+ nSelectPos = nCnt - 1;
+ else
+ nSelectPos = 0;
}
+ m_xLbRange->select(nSelectPos);
+ if (nSelectPos && m_xLbRange->get_id(nSelectPos).toInt32() == nEntryDataDelim)
+ m_xLbRange->select( --nSelectPos ); // ---Row---
+
+ m_xLbRange->grab_focus();
+ m_xBtnAdd->set_sensitive(false);
+ m_xBtnRemove->set_sensitive(false);
+ m_xEdAssign->SetText( EMPTY_OUSTRING );
+ theCurArea = theCurData = ScRange();
+ m_xBtnColHead->set_active(true);
+ m_xBtnRowHead->set_active(false);
+ m_xEdAssign2->SetText( EMPTY_OUSTRING );
+ Range1SelectHdl( *m_xLbRange );
}
// handler called when a row in the listbox is selected, updates form input fields
@@ -742,37 +742,37 @@ IMPL_LINK_NOARG(ScColRowNameRangesDlg, Range2DataModifyHdl, formula::RefEdit&, v
// handler for the radio button for columns, adjust ranges
IMPL_LINK_NOARG(ScColRowNameRangesDlg, ColClickHdl, weld::Button&, void)
{
- if (m_xBtnColHead->get_active())
+ if (!m_xBtnColHead->get_active())
+ return;
+
+ if ( theCurArea.aStart.Row() == 0 && theCurArea.aEnd.Row() == pDoc->MaxRow() )
{
- if ( theCurArea.aStart.Row() == 0 && theCurArea.aEnd.Row() == pDoc->MaxRow() )
- {
- theCurArea.aEnd.SetRow( pDoc->MaxRow() - 1 );
- OUString aStr(theCurArea.Format(*pDoc, ScRefFlags::RANGE_ABS_3D, pDoc->GetAddressConvention()));
- m_xEdAssign->SetText( aStr );
- }
- ScRange aRange( theCurData );
- aRange.aStart.SetRow( std::min( static_cast<long>(theCurArea.aEnd.Row() + 1), static_cast<long>(pDoc->MaxRow()) ) );
- aRange.aEnd.SetRow( pDoc->MaxRow() );
- AdjustColRowData( aRange );
+ theCurArea.aEnd.SetRow( pDoc->MaxRow() - 1 );
+ OUString aStr(theCurArea.Format(*pDoc, ScRefFlags::RANGE_ABS_3D, pDoc->GetAddressConvention()));
+ m_xEdAssign->SetText( aStr );
}
+ ScRange aRange( theCurData );
+ aRange.aStart.SetRow( std::min( static_cast<long>(theCurArea.aEnd.Row() + 1), static_cast<long>(pDoc->MaxRow()) ) );
+ aRange.aEnd.SetRow( pDoc->MaxRow() );
+ AdjustColRowData( aRange );
}
// handler for the radio button for columns, adjust range
IMPL_LINK_NOARG(ScColRowNameRangesDlg, RowClickHdl, weld::Button&, void)
{
- if (m_xBtnRowHead->get_active())
+ if (!m_xBtnRowHead->get_active())
+ return;
+
+ if ( theCurArea.aStart.Col() == 0 && theCurArea.aEnd.Col() == pDoc->MaxCol() )
{
- if ( theCurArea.aStart.Col() == 0 && theCurArea.aEnd.Col() == pDoc->MaxCol() )
- {
- theCurArea.aEnd.SetCol( pDoc->MaxCol() - 1 );
- OUString aStr(theCurArea.Format(*pDoc, ScRefFlags::RANGE_ABS_3D, pDoc->GetAddressConvention()));
- m_xEdAssign->SetText( aStr );
- }
- ScRange aRange( theCurData );
- aRange.aStart.SetCol( static_cast<SCCOL>(std::min( static_cast<long>(theCurArea.aEnd.Col() + 1), static_cast<long>(pDoc->MaxCol()) )) );
- aRange.aEnd.SetCol( pDoc->MaxCol() );
- AdjustColRowData( aRange );
+ theCurArea.aEnd.SetCol( pDoc->MaxCol() - 1 );
+ OUString aStr(theCurArea.Format(*pDoc, ScRefFlags::RANGE_ABS_3D, pDoc->GetAddressConvention()));
+ m_xEdAssign->SetText( aStr );
}
+ ScRange aRange( theCurData );
+ aRange.aStart.SetCol( static_cast<SCCOL>(std::min( static_cast<long>(theCurArea.aEnd.Col() + 1), static_cast<long>(pDoc->MaxCol()) )) );
+ aRange.aEnd.SetCol( pDoc->MaxCol() );
+ AdjustColRowData( aRange );
}
IMPL_LINK( ScColRowNameRangesDlg, GetEditFocusHdl, formula::RefEdit&, rCtrl, void )
diff --git a/sc/source/ui/miscdlgs/datafdlg.cxx b/sc/source/ui/miscdlgs/datafdlg.cxx
index 44f0ef4d7e00..d6026c8b7937 100644
--- a/sc/source/ui/miscdlgs/datafdlg.cxx
+++ b/sc/source/ui/miscdlgs/datafdlg.cxx
@@ -235,26 +235,26 @@ IMPL_LINK_NOARG(ScDataFormDlg, Impl_NewHdl, weld::Button&, void)
{
ScViewData& rViewData = pTabViewShell->GetViewData();
ScDocShell* pDocSh = rViewData.GetDocShell();
- if ( pDoc )
- {
- bool bHasData = std::any_of(m_aEntries.begin(), m_aEntries.end(),
- [](const std::unique_ptr<ScDataFormFragment>& rElem) { return (rElem != nullptr) && (!rElem->m_xEdit->get_text().isEmpty()); });
+ if ( !pDoc )
+ return;
- if ( bHasData )
- {
- pTabViewShell->DataFormPutData(nCurrentRow, nStartRow, nStartCol, nEndRow, nEndCol, m_aEntries, aColLength);
- nCurrentRow++;
- if (nCurrentRow >= nEndRow + 2)
- {
- nEndRow++;
- m_xSlider->vadjustment_set_upper(nEndRow - nStartRow + 1);
- }
- SetButtonState();
- FillCtrls();
- pDocSh->SetDocumentModified();
- pDocSh->PostPaintGridAll();
- }
+ bool bHasData = std::any_of(m_aEntries.begin(), m_aEntries.end(),
+ [](const std::unique_ptr<ScDataFormFragment>& rElem) { return (rElem != nullptr) && (!rElem->m_xEdit->get_text().isEmpty()); });
+
+ if ( !bHasData )
+ return;
+
+ pTabViewShell->DataFormPutData(nCurrentRow, nStartRow, nStartCol, nEndRow, nEndCol, m_aEntries, aColLength);
+ nCurrentRow++;
+ if (nCurrentRow >= nEndRow + 2)
+ {
+ nEndRow++;
+ m_xSlider->vadjustment_set_upper(nEndRow - nStartRow + 1);
}
+ SetButtonState();
+ FillCtrls();
+ pDocSh->SetDocumentModified();
+ pDocSh->PostPaintGridAll();
}
IMPL_LINK_NOARG(ScDataFormDlg, Impl_PrevHdl, weld::Button&, void)
@@ -293,19 +293,19 @@ IMPL_LINK_NOARG(ScDataFormDlg, Impl_DeleteHdl, weld::Button&, void)
{
ScViewData& rViewData = pTabViewShell->GetViewData();
ScDocShell* pDocSh = rViewData.GetDocShell();
- if (pDoc)
- {
- ScRange aRange(nStartCol, nCurrentRow, nTab, nEndCol, nCurrentRow, nTab);
- pDoc->DeleteRow(aRange);
- nEndRow--;
+ if (!pDoc)
+ return;
- SetButtonState();
- pDocSh->GetUndoManager()->Clear();
+ ScRange aRange(nStartCol, nCurrentRow, nTab, nEndCol, nCurrentRow, nTab);
+ pDoc->DeleteRow(aRange);
+ nEndRow--;
- FillCtrls();
- pDocSh->SetDocumentModified();
- pDocSh->PostPaintGridAll();
- }
+ SetButtonState();
+ pDocSh->GetUndoManager()->Clear();
+
+ FillCtrls();
+ pDocSh->SetDocumentModified();
+ pDocSh->PostPaintGridAll();
}
IMPL_LINK_NOARG(ScDataFormDlg, Impl_CloseHdl, weld::Button&, void)
diff --git a/sc/source/ui/miscdlgs/instbdlg.cxx b/sc/source/ui/miscdlgs/instbdlg.cxx
index 747cd524b70f..473646d227f9 100644
--- a/sc/source/ui/miscdlgs/instbdlg.cxx
+++ b/sc/source/ui/miscdlgs/instbdlg.cxx
@@ -126,20 +126,20 @@ short ScInsertTableDlg::run()
void ScInsertTableDlg::SetNewTable_Impl()
{
- if (m_xBtnNew->get_active() )
+ if (!m_xBtnNew->get_active() )
+ return;
+
+ m_xNfCount->set_sensitive(true);
+ m_xFtCount->set_sensitive(true);
+ m_xLbTables->set_sensitive(false);
+ m_xFtPath->set_sensitive(false);
+ m_xBtnBrowse->set_sensitive(false);
+ m_xBtnLink->set_sensitive(false);
+
+ if(nTableCount==1)
{
- m_xNfCount->set_sensitive(true);
- m_xFtCount->set_sensitive(true);
- m_xLbTables->set_sensitive(false);
- m_xFtPath->set_sensitive(false);
- m_xBtnBrowse->set_sensitive(false);
- m_xBtnLink->set_sensitive(false);
-
- if(nTableCount==1)
- {
- m_xEdName->set_sensitive(true);
- m_xFtName->set_sensitive(true);
- }
+ m_xEdName->set_sensitive(true);
+ m_xFtName->set_sensitive(true);
}
}
diff --git a/sc/source/ui/miscdlgs/linkarea.cxx b/sc/source/ui/miscdlgs/linkarea.cxx
index 87fd302ca9bc..a5e683e5dcbf 100644
--- a/sc/source/ui/miscdlgs/linkarea.cxx
+++ b/sc/source/ui/miscdlgs/linkarea.cxx
@@ -112,26 +112,26 @@ void ScLinkedAreaDlg::LoadDocument( const OUString& rFile, const OUString& rFilt
aSourceRef.clear();
}
- if ( !rFile.isEmpty() )
- {
- weld::WaitObject aWait(m_xDialog.get());
+ if ( rFile.isEmpty() )
+ return;
- OUString aNewFilter = rFilter;
- OUString aNewOptions = rOptions;
+ weld::WaitObject aWait(m_xDialog.get());
- SfxErrorContext aEc( ERRCTX_SFX_OPENDOC, rFile );
+ OUString aNewFilter = rFilter;
+ OUString aNewOptions = rOptions;
- ScDocumentLoader aLoader( rFile, aNewFilter, aNewOptions, 0, m_xDialog.get() ); // with interaction
- m_pSourceShell = aLoader.GetDocShell();
- if (m_pSourceShell)
- {
- ErrCode nErr = m_pSourceShell->GetErrorCode();
- if (nErr)
- ErrorHandler::HandleError( nErr ); // including warnings
+ SfxErrorContext aEc( ERRCTX_SFX_OPENDOC, rFile );
- aSourceRef = m_pSourceShell;
- aLoader.ReleaseDocRef(); // don't call DoClose in DocLoader dtor
- }
+ ScDocumentLoader aLoader( rFile, aNewFilter, aNewOptions, 0, m_xDialog.get() ); // with interaction
+ m_pSourceShell = aLoader.GetDocShell();
+ if (m_pSourceShell)
+ {
+ ErrCode nErr = m_pSourceShell->GetErrorCode();
+ if (nErr)
+ ErrorHandler::HandleError( nErr ); // including warnings
+
+ aSourceRef = m_pSourceShell;
+ aLoader.ReleaseDocRef(); // don't call DoClose in DocLoader dtor
}
}
diff --git a/sc/source/ui/miscdlgs/optsolver.cxx b/sc/source/ui/miscdlgs/optsolver.cxx
index e99f410b239d..1b4cb066afa7 100644
--- a/sc/source/ui/miscdlgs/optsolver.cxx
+++ b/sc/source/ui/miscdlgs/optsolver.cxx
@@ -448,53 +448,53 @@ void ScOptSolverDlg::SetActive()
void ScOptSolverDlg::SetReference( const ScRange& rRef, ScDocument& rDocP )
{
- if( mpEdActive )
- {
- if ( rRef.aStart != rRef.aEnd )
- RefInputStart(mpEdActive);
+ if( !mpEdActive )
+ return;
- // "target"/"value": single cell
- bool bSingle = ( mpEdActive == m_xEdObjectiveCell.get() || mpEdActive == m_xEdTargetValue.get() );
+ if ( rRef.aStart != rRef.aEnd )
+ RefInputStart(mpEdActive);
- OUString aStr;
- ScAddress aAdr = rRef.aStart;
- ScRange aNewRef( rRef );
- if ( bSingle )
- aNewRef.aEnd = aAdr;
+ // "target"/"value": single cell
+ bool bSingle = ( mpEdActive == m_xEdObjectiveCell.get() || mpEdActive == m_xEdTargetValue.get() );
- OUString aName;
- if ( rDocP.GetRangeAtBlock( aNewRef, &aName ) ) // named range: show name
- aStr = aName;
- else // format cell/range reference
- {
- ScRefFlags nFmt = ( aAdr.Tab() == mnCurTab ) ? ScRefFlags::ADDR_ABS : ScRefFlags::ADDR_ABS_3D;
- if ( bSingle )
- aStr = aAdr.Format(nFmt, &rDocP, rDocP.GetAddressConvention());
- else
- aStr = rRef.Format(rDocP, nFmt | ScRefFlags::RANGE_ABS, rDocP.GetAddressConvention());
- }
+ OUString aStr;
+ ScAddress aAdr = rRef.aStart;
+ ScRange aNewRef( rRef );
+ if ( bSingle )
+ aNewRef.aEnd = aAdr;
- // variable cells can be several ranges, so only the selection is replaced
- if ( mpEdActive == m_xEdVariableCells.get() )
- {
- OUString aVal = mpEdActive->GetText();
- Selection aSel = mpEdActive->GetSelection();
- aSel.Justify();
- aVal = aVal.replaceAt( aSel.Min(), aSel.Len(), aStr );
- Selection aNewSel( aSel.Min(), aSel.Min()+aStr.getLength() );
- mpEdActive->SetRefString( aVal );
- mpEdActive->SetSelection( aNewSel );
- }
+ OUString aName;
+ if ( rDocP.GetRangeAtBlock( aNewRef, &aName ) ) // named range: show name
+ aStr = aName;
+ else // format cell/range reference
+ {
+ ScRefFlags nFmt = ( aAdr.Tab() == mnCurTab ) ? ScRefFlags::ADDR_ABS : ScRefFlags::ADDR_ABS_3D;
+ if ( bSingle )
+ aStr = aAdr.Format(nFmt, &rDocP, rDocP.GetAddressConvention());
else
- mpEdActive->SetRefString( aStr );
-
- ReadConditions();
- EnableButtons();
+ aStr = rRef.Format(rDocP, nFmt | ScRefFlags::RANGE_ABS, rDocP.GetAddressConvention());
+ }
- // select "Value of" if a ref is input into "target" edit
- if ( mpEdActive == m_xEdTargetValue.get() )
- m_xRbValue->set_active(true);
+ // variable cells can be several ranges, so only the selection is replaced
+ if ( mpEdActive == m_xEdVariableCells.get() )
+ {
+ OUString aVal = mpEdActive->GetText();
+ Selection aSel = mpEdActive->GetSelection();
+ aSel.Justify();
+ aVal = aVal.replaceAt( aSel.Min(), aSel.Len(), aStr );
+ Selection aNewSel( aSel.Min(), aSel.Min()+aStr.getLength() );
+ mpEdActive->SetRefString( aVal );
+ mpEdActive->SetSelection( aNewSel );
}
+ else
+ mpEdActive->SetRefString( aStr );
+
+ ReadConditions();
+ EnableButtons();
+
+ // select "Value of" if a ref is input into "target" edit
+ if ( mpEdActive == m_xEdTargetValue.get() )
+ m_xRbValue->set_active(true);
}
bool ScOptSolverDlg::IsRefInputMode() const
diff --git a/sc/source/ui/miscdlgs/redcom.cxx b/sc/source/ui/miscdlgs/redcom.cxx
index 63b4332e2245..cd18917408d1 100644
--- a/sc/source/ui/miscdlgs/redcom.cxx
+++ b/sc/source/ui/miscdlgs/redcom.cxx
@@ -95,26 +95,26 @@ ScChangeAction *ScRedComDialog::FindNext(ScChangeAction *pAction)
void ScRedComDialog::ReInit(ScChangeAction *pAction)
{
pChangeAction=pAction;
- if(pChangeAction!=nullptr && pDocShell !=nullptr)
- {
- OUString aTitle;
- pChangeAction->GetDescription( aTitle, &pDocShell->GetDocument());
- pDlg->SetText(aTitle);
- aComment=pChangeAction->GetComment();
+ if(pChangeAction==nullptr || pDocShell ==nullptr)
+ return;
- bool bNext=FindNext(pChangeAction)!=nullptr;
- bool bPrev=FindPrev(pChangeAction)!=nullptr;
- pDlg->EnableTravel(bNext,bPrev);
+ OUString aTitle;
+ pChangeAction->GetDescription( aTitle, &pDocShell->GetDocument());
+ pDlg->SetText(aTitle);
+ aComment=pChangeAction->GetComment();
- OUString aAuthor = pChangeAction->GetUser();
+ bool bNext=FindNext(pChangeAction)!=nullptr;
+ bool bPrev=FindPrev(pChangeAction)!=nullptr;
+ pDlg->EnableTravel(bNext,bPrev);
- DateTime aDT = pChangeAction->GetDateTime();
- OUString aDate = ScGlobal::getLocaleDataPtr()->getDate( aDT ) + " " +
- ScGlobal::getLocaleDataPtr()->getTime( aDT, false );
+ OUString aAuthor = pChangeAction->GetUser();
- pDlg->ShowLastAuthor(aAuthor, aDate);
- pDlg->SetNote(aComment);
- }
+ DateTime aDT = pChangeAction->GetDateTime();
+ OUString aDate = ScGlobal::getLocaleDataPtr()->getDate( aDT ) + " " +
+ ScGlobal::getLocaleDataPtr()->getTime( aDT, false );
+
+ pDlg->ShowLastAuthor(aAuthor, aDate);
+ pDlg->SetNote(aComment);
}
void ScRedComDialog::Execute()
@@ -130,18 +130,18 @@ void ScRedComDialog::Execute()
void ScRedComDialog::SelectCell()
{
- if(pChangeAction!=nullptr)
- {
- const ScChangeAction* pAction=pChangeAction;
- const ScBigRange& rRange = pAction->GetBigRange();
+ if(pChangeAction==nullptr)
+ return;
- if(rRange.IsValid(&pDocShell->GetDocument()))
- {
- ScViewData* pViewData=ScDocShell::GetViewData();
- ScRange aRef=rRange.MakeRange();
- ScTabView* pTabView=pViewData->GetView();
- pTabView->MarkRange(aRef);
- }
+ const ScChangeAction* pAction=pChangeAction;
+ const ScBigRange& rRange = pAction->GetBigRange();
+
+ if(rRange.IsValid(&pDocShell->GetDocument()))
+ {
+ ScViewData* pViewData=ScDocShell::GetViewData();
+ ScRange aRef=rRange.MakeRange();
+ ScTabView* pTabView=pViewData->GetView();
+ pTabView->MarkRange(aRef);
}
}
diff --git a/sc/source/ui/miscdlgs/retypepassdlg.cxx b/sc/source/ui/miscdlgs/retypepassdlg.cxx
index f422915a26a2..a80afe1fbd68 100644
--- a/sc/source/ui/miscdlgs/retypepassdlg.cxx
+++ b/sc/source/ui/miscdlgs/retypepassdlg.cxx
@@ -159,33 +159,33 @@ void ScRetypePassDlg::SetDocData()
void ScRetypePassDlg::SetTableData(size_t nRowPos, SCTAB nTab)
{
- if (nRowPos < maSheets.size())
- {
- weld::Label& rName = *maSheets[nRowPos]->m_xName;
- weld::Label& rStatus = *maSheets[nRowPos]->m_xStatus;
- weld::Button& rBtn = *maSheets[nRowPos]->m_xButton;
+ if (nRowPos >= maSheets.size())
+ return;
- bool bBtnEnabled = false;
- rName.set_label(maTableItems[nTab].maName);
- const ScTableProtection* pTabProtect = maTableItems[nTab].mpProtect.get();
- if (pTabProtect && pTabProtect->isProtected())
+ weld::Label& rName = *maSheets[nRowPos]->m_xName;
+ weld::Label& rStatus = *maSheets[nRowPos]->m_xStatus;
+ weld::Button& rBtn = *maSheets[nRowPos]->m_xButton;
+
+ bool bBtnEnabled = false;
+ rName.set_label(maTableItems[nTab].maName);
+ const ScTableProtection* pTabProtect = maTableItems[nTab].mpProtect.get();
+ if (pTabProtect && pTabProtect->isProtected())
+ {
+ if (pTabProtect->isPasswordEmpty())
+ rStatus.set_label(maTextNotPassProtected);
+ else if (pTabProtect->hasPasswordHash(meDesiredHash))
+ rStatus.set_label(maTextHashGood);
+ else
{
- if (pTabProtect->isPasswordEmpty())
- rStatus.set_label(maTextNotPassProtected);
- else if (pTabProtect->hasPasswordHash(meDesiredHash))
- rStatus.set_label(maTextHashGood);
- else
- {
- // incompatible hash
- rStatus.set_label(maTextHashBad);
- bBtnEnabled = true;
- }
+ // incompatible hash
+ rStatus.set_label(maTextHashBad);
+ bBtnEnabled = true;
}
- else
- rStatus.set_label(maTextNotProtected);
-
- rBtn.set_sensitive(bBtnEnabled);
}
+ else
+ rStatus.set_label(maTextNotProtected);
+
+ rBtn.set_sensitive(bBtnEnabled);
}
static bool lcl_IsInGoodStatus(const ScPassHashProtectable* pProtected, ScPasswordHash eDesiredHash)
@@ -256,24 +256,24 @@ IMPL_LINK(ScRetypePassDlg, RetypeBtnHdl, weld::Button&, rBtn, void)
return;
ScRetypePassInputDlg aDlg(m_xDialog.get(), pProtected);
- if (aDlg.run() == RET_OK)
- {
- // OK is pressed. Update the protected item.
- if (aDlg.IsRemovePassword())
- {
- // Remove password from this item.
- pProtected->setPassword(OUString());
- }
- else
- {
- // Set a new password.
- OUString aNewPass = aDlg.GetNewPassword();
- pProtected->setPassword(aNewPass);
- }
+ if (aDlg.run() != RET_OK)
+ return;
- SetDocData();
- CheckHashStatus();
+ // OK is pressed. Update the protected item.
+ if (aDlg.IsRemovePassword())
+ {
+ // Remove password from this item.
+ pProtected->setPassword(OUString());
}
+ else
+ {
+ // Set a new password.
+ OUString aNewPass = aDlg.GetNewPassword();
+ pProtected->setPassword(aNewPass);
+ }
+
+ SetDocData();
+ CheckHashStatus();
}
ScRetypePassInputDlg::ScRetypePassInputDlg(weld::Window* pParent, ScPassHashProtectable* pProtected)
diff --git a/sc/source/ui/miscdlgs/scuiautofmt.cxx b/sc/source/ui/miscdlgs/scuiautofmt.cxx
index e4e18ab03384..274a819fe15a 100644
--- a/sc/source/ui/miscdlgs/scuiautofmt.cxx
+++ b/sc/source/ui/miscdlgs/scuiautofmt.cxx
@@ -180,62 +180,62 @@ IMPL_LINK(ScAutoFormatDlg, CheckHdl, weld::ToggleButton&, rBtn, void)
IMPL_LINK_NOARG(ScAutoFormatDlg, AddHdl, weld::Button&, void)
{
- if ( !bFmtInserted && pSelFmtData )
+ if ( bFmtInserted || !pSelFmtData )
+ return;
+
+ OUString aStrStandard( SfxResId(STR_STANDARD) );
+ OUString aFormatName;
+ bool bOk = false;
+
+ while ( !bOk )
{
- OUString aStrStandard( SfxResId(STR_STANDARD) );
- OUString aFormatName;
- bool bOk = false;
+ ScStringInputDlg aDlg(m_xDialog.get(), aStrTitle, aStrLabel, aFormatName,
+ HID_SC_ADD_AUTOFMT, HID_SC_AUTOFMT_NAME);
- while ( !bOk )
+ if (aDlg.run() == RET_OK)
{
- ScStringInputDlg aDlg(m_xDialog.get(), aStrTitle, aStrLabel, aFormatName,
- HID_SC_ADD_AUTOFMT, HID_SC_AUTOFMT_NAME);
+ aFormatName = aDlg.GetInputString();
- if (aDlg.run() == RET_OK)
+ if ( !aFormatName.isEmpty() && aFormatName != aStrStandard && pFormat->find(aFormatName) == pFormat->end() )
{
- aFormatName = aDlg.GetInputString();
+ std::unique_ptr<ScAutoFormatData> pNewData(
+ new ScAutoFormatData( *pSelFmtData ));
- if ( !aFormatName.isEmpty() && aFormatName != aStrStandard && pFormat->find(aFormatName) == pFormat->end() )
- {
- std::unique_ptr<ScAutoFormatData> pNewData(
- new ScAutoFormatData( *pSelFmtData ));
+ pNewData->SetName( aFormatName );
+ ScAutoFormat::iterator it = pFormat->insert(std::move(pNewData));
+ bFmtInserted = it != pFormat->end();
- pNewData->SetName( aFormatName );
- ScAutoFormat::iterator it = pFormat->insert(std::move(pNewData));
- bFmtInserted = it != pFormat->end();
+ if ( bFmtInserted )
+ {
+ size_t nPos = std::distance(pFormat->begin(), it);
+ m_xLbFormat->insert_text(nPos, aFormatName);
+ m_xLbFormat->select_text( aFormatName );
+ m_xBtnAdd->set_sensitive(false);
- if ( bFmtInserted )
+ if ( !bCoreDataChanged )
{
- size_t nPos = std::distance(pFormat->begin(), it);
- m_xLbFormat->insert_text(nPos, aFormatName);
- m_xLbFormat->select_text( aFormatName );
- m_xBtnAdd->set_sensitive(false);
-
- if ( !bCoreDataChanged )
- {
- m_xBtnCancel->set_label( aStrClose );
- bCoreDataChanged = true;
- }
-
- SelFmtHdl( *m_xLbFormat );
- bOk = true;
+ m_xBtnCancel->set_label( aStrClose );
+ bCoreDataChanged = true;
}
+
+ SelFmtHdl( *m_xLbFormat );
+ bOk = true;
}
+ }
- if ( !bFmtInserted )
- {
- std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(m_xDialog.get(),
- VclMessageType::Error, VclButtonsType::OkCancel,
- ScResId(STR_INVALID_AFNAME)));
+ if ( !bFmtInserted )
+ {
+ std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(m_xDialog.get(),
+ VclMessageType::Error, VclButtonsType::OkCancel,
+ ScResId(STR_INVALID_AFNAME)));
- sal_uInt16 nRet = xBox->run();
+ sal_uInt16 nRet = xBox->run();
- bOk = ( nRet == RET_CANCEL );
- }
+ bOk = ( nRet == RET_CANCEL );
}
- else
- bOk = true;
}
+ else
+ bOk = true;
}
}
diff --git a/sc/source/ui/miscdlgs/simpref.cxx b/sc/source/ui/miscdlgs/simpref.cxx
index da54b3c151ef..27e8e3bb6f26 100644
--- a/sc/source/ui/miscdlgs/simpref.cxx
+++ b/sc/source/ui/miscdlgs/simpref.cxx
@@ -68,36 +68,36 @@ void ScSimpleRefDlg::Init()
// shown as the new selection in the reference field.
void ScSimpleRefDlg::SetReference( const ScRange& rRef, ScDocument& rDocP )
{
- if (m_xEdAssign->GetWidget()->get_sensitive())
+ if (!m_xEdAssign->GetWidget()->get_sensitive())
+ return;
+
+ if ( rRef.aStart != rRef.aEnd )
+ RefInputStart(m_xEdAssign.get());
+
+ theCurArea = rRef;
+ OUString aRefStr;
+ if ( bSingleCell )
+ {
+ ScAddress aAdr = rRef.aStart;
+ aRefStr = aAdr.Format(ScRefFlags::ADDR_ABS_3D, &rDocP, rDocP.GetAddressConvention());
+ }
+ else
+ aRefStr = theCurArea.Format(rDocP, ScRefFlags::RANGE_ABS_3D, rDocP.GetAddressConvention());
+
+ if ( bMultiSelection )
{
- if ( rRef.aStart != rRef.aEnd )
- RefInputStart(m_xEdAssign.get());
-
- theCurArea = rRef;
- OUString aRefStr;
- if ( bSingleCell )
- {
- ScAddress aAdr = rRef.aStart;
- aRefStr = aAdr.Format(ScRefFlags::ADDR_ABS_3D, &rDocP, rDocP.GetAddressConvention());
- }
- else
- aRefStr = theCurArea.Format(rDocP, ScRefFlags::RANGE_ABS_3D, rDocP.GetAddressConvention());
-
- if ( bMultiSelection )
- {
- OUString aVal = m_xEdAssign->GetText();
- Selection aSel = m_xEdAssign->GetSelection();
- aSel.Justify();
- aVal = aVal.replaceAt( aSel.Min(), aSel.Len(), aRefStr );
- Selection aNewSel( aSel.Min(), aSel.Min()+aRefStr.getLength() );
- m_xEdAssign->SetRefString( aVal );
- m_xEdAssign->SetSelection( aNewSel );
- }
- else
- m_xEdAssign->SetRefString( aRefStr );
-
- aChangeHdl.Call( aRefStr );
+ OUString aVal = m_xEdAssign->GetText();
+ Selection aSel = m_xEdAssign->GetSelection();
+ aSel.Justify();
+ aVal = aVal.replaceAt( aSel.Min(), aSel.Len(), aRefStr );
+ Selection aNewSel( aSel.Min(), aSel.Min()+aRefStr.getLength() );
+ m_xEdAssign->SetRefString( aVal );
+ m_xEdAssign->SetSelection( aNewSel );
}
+ else
+ m_xEdAssign->SetRefString( aRefStr );
+
+ aChangeHdl.Call( aRefStr );
}
void ScSimpleRefDlg::Close()
diff --git a/sc/source/ui/miscdlgs/solverutil.cxx b/sc/source/ui/miscdlgs/solverutil.cxx
index c5f3752bdfb4..e46f1a5af7f6 100644
--- a/sc/source/ui/miscdlgs/solverutil.cxx
+++ b/sc/source/ui/miscdlgs/solverutil.cxx
@@ -47,48 +47,48 @@ void ScSolverUtil::GetImplementations( uno::Sequence<OUString>& rImplNames,
uno::Reference<container::XContentEnumerationAccess> xEnAc(
xCtx->getServiceManager(), uno::UNO_QUERY );
- if ( xEnAc.is() )
+ if ( !xEnAc.is() )
+ return;
+
+ uno::Reference<container::XEnumeration> xEnum =
+ xEnAc->createContentEnumeration( SCSOLVER_SERVICE );
+ if ( !xEnum.is() )
+ return;
+
+ sal_Int32 nCount = 0;
+ while ( xEnum->hasMoreElements() )
{
- uno::Reference<container::XEnumeration> xEnum =
- xEnAc->createContentEnumeration( SCSOLVER_SERVICE );
- if ( xEnum.is() )
+ uno::Any aAny = xEnum->nextElement();
+ uno::Reference<lang::XServiceInfo> xInfo;
+ aAny >>= xInfo;
+ if ( xInfo.is() )
{
- sal_Int32 nCount = 0;
- while ( xEnum->hasMoreElements() )
+ uno::Reference<lang::XSingleComponentFactory> xCFac( xInfo, uno::UNO_QUERY );
+ if ( xCFac.is() )
{
- uno::Any aAny = xEnum->nextElement();
- uno::Reference<lang::XServiceInfo> xInfo;
- aAny >>= xInfo;
- if ( xInfo.is() )
+ OUString sName = xInfo->getImplementationName();
+ OUString sDescription;
+
+ try
{
- uno::Reference<lang::XSingleComponentFactory> xCFac( xInfo, uno::UNO_QUERY );
- if ( xCFac.is() )
- {
- OUString sName = xInfo->getImplementationName();
- OUString sDescription;
-
- try
- {
- uno::Reference<sheet::XSolver> xSolver(
- xCFac->createInstanceWithContext(xCtx), uno::UNO_QUERY );
- uno::Reference<sheet::XSolverDescription> xDesc( xSolver, uno::UNO_QUERY );
- if ( xDesc.is() )
- sDescription = xDesc->getComponentDescription();
-
- if ( sDescription.isEmpty() )
- sDescription = sName; // use implementation name if no description available
-
- rImplNames.realloc( nCount+1 );
- rImplNames[nCount] = sName;
- rDescriptions.realloc( nCount+1 );
- rDescriptions[nCount] = sDescription;
- ++nCount;
- }
- catch (const css::uno::Exception&)
- {
- TOOLS_INFO_EXCEPTION("sc.ui", "ScSolverUtil::GetImplementations: cannot instantiate: " << sName);
- }
- }
+ uno::Reference<sheet::XSolver> xSolver(
+ xCFac->createInstanceWithContext(xCtx), uno::UNO_QUERY );
+ uno::Reference<sheet::XSolverDescription> xDesc( xSolver, uno::UNO_QUERY );
+ if ( xDesc.is() )
+ sDescription = xDesc->getComponentDescription();
+
+ if ( sDescription.isEmpty() )
+ sDescription = sName; // use implementation name if no description available
+
+ rImplNames.realloc( nCount+1 );
+ rImplNames[nCount] = sName;
+ rDescriptions.realloc( nCount+1 );
+ rDescriptions[nCount] = sDescription;
+ ++nCount;
+ }
+ catch (const css::uno::Exception&)
+ {
+ TOOLS_INFO_EXCEPTION("sc.ui", "ScSolverUtil::GetImplementations: cannot instantiate: " << sName);
}
}
}
diff --git a/sc/source/ui/miscdlgs/solvrdlg.cxx b/sc/source/ui/miscdlgs/solvrdlg.cxx
index 729d73fee034..e28d8625ab37 100644
--- a/sc/source/ui/miscdlgs/solvrdlg.cxx
+++ b/sc/source/ui/miscdlgs/solvrdlg.cxx
@@ -122,24 +122,24 @@ void ScSolverDlg::SetActive()
void ScSolverDlg::SetReference( const ScRange& rRef, ScDocument& rDocP )
{
- if( m_pEdActive )
- {
- if ( rRef.aStart != rRef.aEnd )
- RefInputStart(m_pEdActive);
+ if( !m_pEdActive )
+ return;
- ScAddress aAdr = rRef.aStart;
- ScRefFlags nFmt = ( aAdr.Tab() == nCurTab )
- ? ScRefFlags::ADDR_ABS
- : ScRefFlags::ADDR_ABS_3D;
+ if ( rRef.aStart != rRef.aEnd )
+ RefInputStart(m_pEdActive);
- OUString aStr(aAdr.Format(nFmt, &rDocP, rDocP.GetAddressConvention()));
- m_pEdActive->SetRefString( aStr );
+ ScAddress aAdr = rRef.aStart;
+ ScRefFlags nFmt = ( aAdr.Tab() == nCurTab )
+ ? ScRefFlags::ADDR_ABS
+ : ScRefFlags::ADDR_ABS_3D;
- if (m_pEdActive == m_xEdFormulaCell.get())
- theFormulaCell = aAdr;
- else if (m_pEdActive == m_xEdVariableCell.get())
- theVariableCell = aAdr;
- }
+ OUString aStr(aAdr.Format(nFmt, &rDocP, rDocP.GetAddressConvention()));
+ m_pEdActive->SetRefString( aStr );
+
+ if (m_pEdActive == m_xEdFormulaCell.get())
+ theFormulaCell = aAdr;
+ else if (m_pEdActive == m_xEdVariableCell.get())
+ theVariableCell = aAdr;
}
void ScSolverDlg::RaiseError( ScSolverErr eError )
diff --git a/sc/source/ui/miscdlgs/tabopdlg.cxx b/sc/source/ui/miscdlgs/tabopdlg.cxx
index 0dc518b37dd8..7bc5b37d7abe 100644
--- a/sc/source/ui/miscdlgs/tabopdlg.cxx
+++ b/sc/source/ui/miscdlgs/tabopdlg.cxx
@@ -125,37 +125,37 @@ void ScTabOpDlg::SetActive()
void ScTabOpDlg::SetReference( const ScRange& rRef, ScDocument& rDocP )
{
- if (m_pEdActive)
- {
- ScAddress::Details aDetails(rDocP.GetAddressConvention(), 0, 0);
+ if (!m_pEdActive)
+ return;
- if ( rRef.aStart != rRef.aEnd )
- RefInputStart(m_pEdActive);
+ ScAddress::Details aDetails(rDocP.GetAddressConvention(), 0, 0);
- OUString aStr;
- ScRefFlags nFmt = ( rRef.aStart.Tab() == nCurTab )
- ? ScRefFlags::RANGE_ABS
- : ScRefFlags::RANGE_ABS_3D;
+ if ( rRef.aStart != rRef.aEnd )
+ RefInputStart(m_pEdActive);
- if (m_pEdActive == m_xEdFormulaRange.get())
- {
- theFormulaCell.Set( rRef.aStart, false, false, false);
- theFormulaEnd.Set( rRef.aEnd, false, false, false);
- aStr = rRef.Format(rDocP, nFmt, aDetails);
- }
- else if (m_pEdActive == m_xEdRowCell.get())
- {
- theRowCell.Set( rRef.aStart, false, false, false);
- aStr = rRef.aStart.Format(nFmt, &rDocP, aDetails);
- }
- else if (m_pEdActive == m_xEdColCell.get())
- {
- theColCell.Set( rRef.aStart, false, false, false);
- aStr = rRef.aStart.Format(nFmt, &rDocP, aDetails);
- }
+ OUString aStr;
+ ScRefFlags nFmt = ( rRef.aStart.Tab() == nCurTab )
+ ? ScRefFlags::RANGE_ABS
+ : ScRefFlags::RANGE_ABS_3D;
- m_pEdActive->SetRefString( aStr );
+ if (m_pEdActive == m_xEdFormulaRange.get())
+ {
+ theFormulaCell.Set( rRef.aStart, false, false, false);
+ theFormulaEnd.Set( rRef.aEnd, false, false, false);
+ aStr = rRef.Format(rDocP, nFmt, aDetails);
+ }
+ else if (m_pEdActive == m_xEdRowCell.get())
+ {
+ theRowCell.Set( rRef.aStart, false, false, false);
+ aStr = rRef.aStart.Format(nFmt, &rDocP, aDetails);
}
+ else if (m_pEdActive == m_xEdColCell.get())
+ {
+ theColCell.Set( rRef.aStart, false, false, false);
+ aStr = rRef.aStart.Format(nFmt, &rDocP, aDetails);
+ }
+
+ m_pEdActive->SetRefString( aStr );
}
void ScTabOpDlg::RaiseError( ScTabOpErr eError )