summaryrefslogtreecommitdiff
path: root/basctl/source
diff options
context:
space:
mode:
Diffstat (limited to 'basctl/source')
-rw-r--r--basctl/source/basicide/IDEComboBox.cxx14
-rw-r--r--basctl/source/basicide/baside2.cxx3
-rw-r--r--basctl/source/basicide/baside2.hxx12
-rw-r--r--basctl/source/basicide/baside2b.cxx74
-rw-r--r--basctl/source/basicide/baside3.cxx4
-rw-r--r--basctl/source/basicide/bastype2.cxx8
-rw-r--r--basctl/source/basicide/bastype3.cxx6
-rw-r--r--basctl/source/basicide/brkdlg.cxx6
-rw-r--r--basctl/source/basicide/docsignature.cxx4
-rw-r--r--basctl/source/basicide/localizationmgr.cxx6
-rw-r--r--basctl/source/basicide/moduldl2.cxx13
-rw-r--r--basctl/source/basicide/moduldlg.cxx59
-rw-r--r--basctl/source/dlged/dlged.cxx4
-rw-r--r--basctl/source/dlged/managelang.cxx8
-rw-r--r--basctl/source/dlged/propbrw.cxx2
-rw-r--r--basctl/source/inc/bastypes.hxx6
-rw-r--r--basctl/source/inc/dlged.hxx5
-rw-r--r--basctl/source/inc/docsignature.hxx1
18 files changed, 122 insertions, 113 deletions
diff --git a/basctl/source/basicide/IDEComboBox.cxx b/basctl/source/basicide/IDEComboBox.cxx
index e295e44ff1ed..423e5c5d1cda 100644
--- a/basctl/source/basicide/IDEComboBox.cxx
+++ b/basctl/source/basicide/IDEComboBox.cxx
@@ -222,7 +222,7 @@ void LibBox::FillBox()
// create list box entries
LibEntry* pEntry = new LibEntry(ScriptDocument::getApplicationScriptDocument(),
LIBRARY_LOCATION_UNKNOWN, OUString());
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pEntry)));
+ OUString sId(weld::toId(pEntry));
m_xWidget->append(sId, IDEResId(RID_STR_ALL));
InsertEntries(ScriptDocument::getApplicationScriptDocument(), LIBRARY_LOCATION_USER);
@@ -261,7 +261,7 @@ void LibBox::InsertEntries(const ScriptDocument& rDocument, LibraryLocation eLoc
OUString aName(rDocument.getTitle(eLocation));
OUString aEntryText(CreateMgrAndLibStr(aName, aLibName));
LibEntry* pEntry = new LibEntry(rDocument, eLocation, aLibName);
- m_xWidget->append(OUString::number(reinterpret_cast<sal_Int64>(pEntry)), aEntryText);
+ m_xWidget->append(weld::toId(pEntry), aEntryText);
}
}
}
@@ -320,7 +320,7 @@ void LibBox::Select()
void LibBox::NotifyIDE()
{
- LibEntry* pEntry = reinterpret_cast<LibEntry*>(m_xWidget->get_active_id().toInt64());
+ LibEntry* pEntry = weld::fromId<LibEntry*>(m_xWidget->get_active_id());
if (pEntry)
{
const ScriptDocument& aDocument(pEntry->GetDocument());
@@ -340,7 +340,7 @@ void LibBox::ClearBox()
sal_Int32 nCount = m_xWidget->get_count();
for (sal_Int32 i = 0; i < nCount; ++i)
{
- LibEntry* pEntry = reinterpret_cast<LibEntry*>(m_xWidget->get_id(i).toInt64());
+ LibEntry* pEntry = weld::fromId<LibEntry*>(m_xWidget->get_id(i));
delete pEntry;
}
m_xWidget->clear();
@@ -440,7 +440,7 @@ void LanguageBox::FillBox()
sLanguage += " " + msDefaultLanguageStr;
}
LanguageEntry* pEntry = new LanguageEntry(pLocale[i], bIsDefault);
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pEntry)));
+ OUString sId(weld::toId(pEntry));
m_xWidget->append(sId, sLanguage);
if (bIsCurrent)
@@ -467,7 +467,7 @@ void LanguageBox::ClearBox()
sal_Int32 nCount = m_xWidget->get_count();
for (sal_Int32 i = 0; i < nCount; ++i)
{
- LanguageEntry* pEntry = reinterpret_cast<LanguageEntry*>(m_xWidget->get_id(i).toInt64());
+ LanguageEntry* pEntry = weld::fromId<LanguageEntry*>(m_xWidget->get_id(i));
delete pEntry;
}
m_xWidget->clear();
@@ -475,7 +475,7 @@ void LanguageBox::ClearBox()
void LanguageBox::SetLanguage()
{
- LanguageEntry* pEntry = reinterpret_cast<LanguageEntry*>(m_xWidget->get_active_id().toInt64());
+ LanguageEntry* pEntry = weld::fromId<LanguageEntry*>(m_xWidget->get_active_id());
if (pEntry)
GetShell()->GetCurLocalizationMgr()->handleSetCurrentLocale(pEntry->m_aLocale);
}
diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx
index 52769276bacb..215ed0be3393 100644
--- a/basctl/source/basicide/baside2.cxx
+++ b/basctl/source/basicide/baside2.cxx
@@ -459,7 +459,6 @@ void ModulWindow::LoadBasic()
void ModulWindow::SaveBasicSource()
{
- Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
sfx2::FileDialogHelper aDlg(ui::dialogs::TemplateDescription::FILESAVE_AUTOEXTENSION_PASSWORD,
FileDialogFlags::NONE, this->GetFrameWeld());
aDlg.SetContext(sfx2::FileDialogHelper::BasicExportSource);
@@ -1584,7 +1583,7 @@ void ModulWindowLayout::SyntaxColors::NewConfig (bool bFirst)
}
bool bChanged = false;
- for (unsigned i = 0; i != SAL_N_ELEMENTS(vIds); ++i)
+ for (unsigned i = 0; i != std::size(vIds); ++i)
{
Color const aColor = aConfig.GetColorValue(vIds[i].eEntry).nColor;
Color& rMyColor = aColors[vIds[i].eTokenType];
diff --git a/basctl/source/basicide/baside2.hxx b/basctl/source/basicide/baside2.hxx
index 8d07cd81ddc1..2c9822610d64 100644
--- a/basctl/source/basicide/baside2.hxx
+++ b/basctl/source/basicide/baside2.hxx
@@ -94,7 +94,7 @@ private:
virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
- void ImpDoHighlight( sal_uLong nLineOff );
+ void ImpDoHighlight( sal_uInt32 nLineOff );
void ImplSetFont();
bool bHighlighting;
@@ -104,7 +104,7 @@ private:
virtual css::uno::Reference< css::awt::XWindowPeer > GetComponentInterface(bool bCreate = true) override;
CodeCompleteDataCache aCodeCompleteCache;
VclPtr<CodeCompleteWindow> pCodeCompleteWnd;
- OUString GetActualSubName( sal_uLong nLine ); // gets the actual subroutine name according to line number
+ OUString GetActualSubName( sal_uInt32 nLine ); // gets the actual subroutine name according to line number
void SetupAndShowCodeCompleteWnd(const std::vector< OUString >& aEntryVect, TextSelection aSel );
void HandleAutoCorrect();
void HandleAutoCloseParen();
@@ -123,7 +123,7 @@ private:
virtual void LoseFocus() override;
virtual void RequestHelp( const HelpEvent& rHEvt ) override;
- void DoSyntaxHighlight( sal_uLong nPara );
+ void DoSyntaxHighlight( sal_uInt32 nPara );
OUString GetWordAtCursor();
bool ImpCanModify();
@@ -138,8 +138,8 @@ public:
void CreateProgress( const OUString& rText, sal_uInt32 nRange );
void DestroyProgress();
- void ParagraphInsertedDeleted( sal_uLong nNewPara, bool bInserted );
- void DoDelayedSyntaxHighlight( sal_uLong nPara );
+ void ParagraphInsertedDeleted( sal_uInt32 nNewPara, bool bInserted );
+ void DoDelayedSyntaxHighlight( sal_uInt32 nPara );
void CreateEditEngine();
void SetScrollBarRanges();
@@ -153,7 +153,7 @@ public:
void ChangeFontColor( Color aColor );
void UpdateSyntaxHighlighting ();
- bool GetProcedureName(OUString const & rLine, OUString& rProcType, OUString& rProcName) const;
+ bool GetProcedureName(std::u16string_view rLine, OUString& rProcType, OUString& rProcName) const;
FactoryFunction GetUITestFactory() const override;
};
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index 9671d149ca2b..0315894b7d88 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -40,6 +40,7 @@
#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
#include <com/sun/star/script/XLibraryContainer2.hpp>
#include <comphelper/string.hxx>
+#include <o3tl/string_view.hxx>
#include <officecfg/Office/Common.hxx>
#include <sfx2/dispatch.hxx>
#include <sfx2/progress.hxx>
@@ -60,10 +61,12 @@
#include <vcl/svapp.hxx>
#include <vcl/taskpanelist.hxx>
#include <vcl/help.hxx>
+#include <o3tl/string_view.hxx>
#include <cppuhelper/implbase.hxx>
#include <vector>
#include <com/sun/star/reflection/theCoreReflection.hpp>
#include <unotools/charclass.hxx>
+#include <o3tl/string_view.hxx>
#include "textwindowpeer.hxx"
#include "uiobject.hxx"
@@ -467,8 +470,9 @@ void EditorWindow::MouseButtonUp( const MouseEvent &rEvt )
void EditorWindow::MouseButtonDown( const MouseEvent &rEvt )
{
GrabFocus();
- if ( pEditView )
- pEditView->MouseButtonDown( rEvt );
+ if (!pEditView)
+ return;
+ pEditView->MouseButtonDown(rEvt);
if( pCodeCompleteWnd->IsVisible() )
{
if (pEditView->GetSelection() != pCodeCompleteWnd->GetTextSelection())
@@ -792,17 +796,17 @@ void EditorWindow::HandleProcedureCompletion()
if( aCurrPortions.size() >= 3 )
{//at least 3 tokens: (sub|function) whitespace identifier...
HighlightPortion& r = aCurrPortions.front();
- OUString sStr = aCurrLine.copy(r.nBegin, r.nEnd - r.nBegin);
+ std::u16string_view sStr = aCurrLine.subView(r.nBegin, r.nEnd - r.nBegin);
if( r.tokenType == TokenType::Keywords )
{
- if( sStr.equalsIgnoreAsciiCase("sub") || sStr.equalsIgnoreAsciiCase("function") )
+ if( o3tl::equalsIgnoreAsciiCase(sStr, u"sub") || o3tl::equalsIgnoreAsciiCase(sStr, u"function") )
{
pEditView->InsertText( sText );//append to the end
GetEditView()->SetSelection(aSel);
break;
}
- if( sStr.equalsIgnoreAsciiCase("end") )
+ if( o3tl::equalsIgnoreAsciiCase(sStr, u"end") )
break;
}
}
@@ -810,7 +814,7 @@ void EditorWindow::HandleProcedureCompletion()
}
}
-bool EditorWindow::GetProcedureName(OUString const & rLine, OUString& rProcType, OUString& rProcName) const
+bool EditorWindow::GetProcedureName(std::u16string_view rLine, OUString& rProcType, OUString& rProcName) const
{
std::vector<HighlightPortion> aPortions;
aHighlighter.getHighlightPortions(rLine, aPortions);
@@ -823,10 +827,10 @@ bool EditorWindow::GetProcedureName(OUString const & rLine, OUString& rProcType,
for (auto const& portion : aPortions)
{
- OUString sTokStr = rLine.copy(portion.nBegin, portion.nEnd - portion.nBegin);
+ std::u16string_view sTokStr = rLine.substr(portion.nBegin, portion.nEnd - portion.nBegin);
- if( portion.tokenType == TokenType::Keywords && ( sTokStr.equalsIgnoreAsciiCase("sub")
- || sTokStr.equalsIgnoreAsciiCase("function")) )
+ if( portion.tokenType == TokenType::Keywords && ( o3tl::equalsIgnoreAsciiCase(sTokStr, u"sub")
+ || o3tl::equalsIgnoreAsciiCase(sTokStr, u"function")) )
{
rProcType = sTokStr;
bFoundType = true;
@@ -970,20 +974,14 @@ void EditorWindow::SetSourceInBasic()
// Returns the position of the last character of any of the following
// EOL char combinations: CR, CR/LF, LF, return -1 if no EOL is found
-sal_Int32 searchEOL( const OUString& rStr, sal_Int32 fromIndex )
+sal_Int32 searchEOL( std::u16string_view rStr, sal_Int32 fromIndex )
{
- sal_Int32 iRetPos = -1;
+ size_t iLF = rStr.find( LINE_SEP, fromIndex );
+ if( iLF != std::u16string_view::npos )
+ return iLF;
- sal_Int32 iLF = rStr.indexOf( LINE_SEP, fromIndex );
- if( iLF != -1 )
- {
- iRetPos = iLF;
- }
- else
- {
- iRetPos = rStr.indexOf( LINE_SEP_CR, fromIndex );
- }
- return iRetPos;
+ size_t iCR = rStr.find( LINE_SEP_CR, fromIndex );
+ return iCR == std::u16string_view::npos ? -1 : iCR;
}
void EditorWindow::CreateEditEngine()
@@ -1140,7 +1138,7 @@ void EditorWindow::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
}
}
-OUString EditorWindow::GetActualSubName( sal_uLong nLine )
+OUString EditorWindow::GetActualSubName( sal_uInt32 nLine )
{
SbxArrayRef pMethods = rModulWindow.GetSbModule()->GetMethods();
for (sal_uInt32 i = 0; i < pMethods->Count(); i++)
@@ -1194,7 +1192,7 @@ void EditorWindow::InitScrollBars()
}
}
-void EditorWindow::ImpDoHighlight( sal_uLong nLine )
+void EditorWindow::ImpDoHighlight( sal_uInt32 nLine )
{
if ( !bDoSyntaxHighlight )
return;
@@ -1258,7 +1256,7 @@ void EditorWindow::ImplSetFont()
}
}
-void EditorWindow::DoSyntaxHighlight( sal_uLong nPara )
+void EditorWindow::DoSyntaxHighlight( sal_uInt32 nPara )
{
// because of the DelayedSyntaxHighlight it's possible
// that this line does not exist anymore!
@@ -1271,7 +1269,7 @@ void EditorWindow::DoSyntaxHighlight( sal_uLong nPara )
}
}
-void EditorWindow::DoDelayedSyntaxHighlight( sal_uLong nPara )
+void EditorWindow::DoDelayedSyntaxHighlight( sal_uInt32 nPara )
{
// line is only added to list, processed in TimerHdl
// => don't manipulate breaks while EditEngine is formatting
@@ -1313,7 +1311,7 @@ IMPL_LINK_NOARG(EditorWindow, SyntaxTimerHdl, Timer *, void)
bHighlighting = false;
}
-void EditorWindow::ParagraphInsertedDeleted( sal_uLong nPara, bool bInserted )
+void EditorWindow::ParagraphInsertedDeleted( sal_uInt32 nPara, bool bInserted )
{
if ( pProgress )
pProgress->StepProgress();
@@ -1668,7 +1666,7 @@ void WatchWindow::dispose()
// Destroy user data
m_xTreeListBox->all_foreach([this](weld::TreeIter& rEntry){
- WatchItem* pItem = reinterpret_cast<WatchItem*>(m_xTreeListBox->get_id(rEntry).toInt64());
+ WatchItem* pItem = weld::fromId<WatchItem*>(m_xTreeListBox->get_id(rEntry));
delete pItem;
return false;
});
@@ -1729,7 +1727,7 @@ void WatchWindow::AddWatch( const OUString& rVName )
lcl_SeparateNameAndIndex( rVName, aVar, aIndex );
WatchItem* pWatchItem = new WatchItem(aVar);
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pWatchItem)));
+ OUString sId(weld::toId(pWatchItem));
std::unique_ptr<weld::TreeIter> xRet = m_xTreeListBox->make_iterator();
m_xTreeListBox->insert(nullptr, -1, &aVar, &sId, nullptr, nullptr, false, xRet.get());
m_xTreeListBox->set_text(*xRet, "", 1);
@@ -1752,7 +1750,7 @@ void WatchWindow::RemoveSelectedWatch()
m_xTreeListBox->remove(*xEntry);
bEntry = m_xTreeListBox->get_cursor(xEntry.get());
if (bEntry)
- m_xEdit->set_text(reinterpret_cast<WatchItem*>(m_xTreeListBox->get_id(*xEntry).toInt64())->maName);
+ m_xEdit->set_text(weld::fromId<WatchItem*>(m_xTreeListBox->get_id(*xEntry))->maName);
else
m_xEdit->set_text(OUString());
if ( !m_xTreeListBox->n_children() )
@@ -1772,7 +1770,7 @@ IMPL_LINK_NOARG(WatchWindow, TreeListHdl, weld::TreeView&, void)
bool bCurEntry = m_xTreeListBox->get_cursor(xCurEntry.get());
if (!bCurEntry)
return;
- WatchItem* pItem = reinterpret_cast<WatchItem*>(m_xTreeListBox->get_id(*xCurEntry).toInt64());
+ WatchItem* pItem = weld::fromId<WatchItem*>(m_xTreeListBox->get_id(*xCurEntry));
if (!pItem)
return;
m_xEdit->set_text(pItem->maName);
@@ -2069,7 +2067,7 @@ IMPL_LINK(WatchWindow, RequestingChildrenHdl, const weld::TreeIter&, rParent, bo
if (m_xTreeListBox->iter_has_child(rParent))
return true;
- WatchItem* pItem = reinterpret_cast<WatchItem*>(m_xTreeListBox->get_id(rParent).toInt64());
+ WatchItem* pItem = weld::fromId<WatchItem*>(m_xTreeListBox->get_id(rParent));
std::unique_ptr<weld::TreeIter> xRet = m_xTreeListBox->make_iterator();
SbxDimArray* pArray = pItem->mpArray.get();
@@ -2097,7 +2095,7 @@ IMPL_LINK(WatchWindow, RequestingChildrenHdl, const weld::TreeIter&, rParent, bo
OUString const& rName = pItem->maMemberList.back();
WatchItem* pWatchItem = new WatchItem(rName);
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pWatchItem)));
+ OUString sId(weld::toId(pWatchItem));
m_xTreeListBox->insert(&rParent, -1, &rName, &sId, nullptr, nullptr, false, xRet.get());
m_xTreeListBox->set_text(*xRet, "", 1);
@@ -2148,7 +2146,7 @@ IMPL_LINK(WatchWindow, RequestingChildrenHdl, const weld::TreeIter&, rParent, bo
aDisplayName += aIndexStr;
pChildItem->maDisplayName = aDisplayName;
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pChildItem)));
+ OUString sId(weld::toId(pChildItem));
m_xTreeListBox->insert(&rParent, -1, &aDisplayName, &sId, nullptr, nullptr, false,
xRet.get());
@@ -2178,12 +2176,12 @@ SbxBase* WatchWindow::ImplGetSBXForEntry(const weld::TreeIter& rEntry, bool& rbA
SbxBase* pSBX = nullptr;
rbArrayElement = false;
- WatchItem* pItem = reinterpret_cast<WatchItem*>(m_xTreeListBox->get_id(rEntry).toInt64());
+ WatchItem* pItem = weld::fromId<WatchItem*>(m_xTreeListBox->get_id(rEntry));
OUString aVName( pItem->maName );
std::unique_ptr<weld::TreeIter> xParentEntry = m_xTreeListBox->make_iterator(&rEntry);
bool bParentEntry = m_xTreeListBox->iter_parent(*xParentEntry);
- WatchItem* pParentItem = bParentEntry ? reinterpret_cast<WatchItem*>(m_xTreeListBox->get_id(*xParentEntry).toInt64()) : nullptr;
+ WatchItem* pParentItem = bParentEntry ? weld::fromId<WatchItem*>(m_xTreeListBox->get_id(*xParentEntry)) : nullptr;
if( pParentItem )
{
SbxObject* pObj = pParentItem->mpObject.get();
@@ -2216,7 +2214,7 @@ SbxBase* WatchWindow::ImplGetSBXForEntry(const weld::TreeIter& rEntry, bool& rbA
IMPL_LINK(WatchWindow, EditingEntryHdl, const weld::TreeIter&, rIter, bool)
{
- WatchItem* pItem = reinterpret_cast<WatchItem*>(m_xTreeListBox->get_id(rIter).toInt64());
+ WatchItem* pItem = weld::fromId<WatchItem*>(m_xTreeListBox->get_id(rIter));
bool bEdit = false;
if (StarBASIC::IsRunning() && StarBASIC::GetActiveMethod() && !SbxBase::IsError())
@@ -2293,7 +2291,7 @@ void implCollapseModifiedObjectEntry(const weld::TreeIter& rParent, weld::TreeVi
{
implCollapseModifiedObjectEntry(*xDeleteEntry, rTree);
- WatchItem* pItem = reinterpret_cast<WatchItem*>(rTree.get_id(*xDeleteEntry).toInt64());
+ WatchItem* pItem = weld::fromId<WatchItem*>(rTree.get_id(*xDeleteEntry));
delete pItem;
rTree.remove(*xDeleteEntry);
rTree.copy_iterator(rParent, *xDeleteEntry);
@@ -2352,7 +2350,7 @@ void WatchWindow::UpdateWatches(bool bBasicStopped)
setBasicWatchMode( true );
m_xTreeListBox->all_foreach([this, pCurMethod, bBasicStopped](weld::TreeIter& rEntry){
- WatchItem* pItem = reinterpret_cast<WatchItem*>(m_xTreeListBox->get_id(rEntry).toInt64());
+ WatchItem* pItem = weld::fromId<WatchItem*>(m_xTreeListBox->get_id(rEntry));
DBG_ASSERT( !pItem->maName.isEmpty(), "Var? - Must not be empty!" );
OUString aWatchStr;
OUString aTypeStr;
diff --git a/basctl/source/basicide/baside3.cxx b/basctl/source/basicide/baside3.cxx
index 6e20187055c9..1424573b0ea5 100644
--- a/basctl/source/basicide/baside3.cxx
+++ b/basctl/source/basicide/baside3.cxx
@@ -682,7 +682,7 @@ void DialogWindow::SaveDialog()
if( bResource )
{
- INetURLObject aURLObj("");
+ INetURLObject aURLObj(u"");
aURLObj.removeExtension();
OUString aDialogName( aURLObj.getName() );
aURLObj.removeSegment();
@@ -851,7 +851,7 @@ bool implImportDialog(weld::Window* pWin, const ScriptDocument& rDocument, const
xFP->appendFilter( IDEResId(RID_STR_FILTER_ALLFILES), FilterMask_All );
xFP->setCurrentFilter( aDialogStr );
- if( aDlg.Execute() != ERRCODE_NONE )
+ if( aDlg.Execute() == ERRCODE_NONE )
{
Sequence< OUString > aPaths = xFP->getSelectedFiles();
diff --git a/basctl/source/basicide/bastype2.cxx b/basctl/source/basicide/bastype2.cxx
index afff27b75dfd..d027c7dc6d2b 100644
--- a/basctl/source/basicide/bastype2.cxx
+++ b/basctl/source/basicide/bastype2.cxx
@@ -176,7 +176,7 @@ SbTreeListBox::~SbTreeListBox()
bool bValidIter = m_xControl->get_iter_first(*m_xScratchIter);
while (bValidIter)
{
- Entry* pBasicEntry = reinterpret_cast<Entry*>(m_xControl->get_id(*m_xScratchIter).toInt64());
+ Entry* pBasicEntry = weld::fromId<Entry*>(m_xControl->get_id(*m_xScratchIter));
delete pBasicEntry;
bValidIter = m_xControl->iter_next(*m_xScratchIter);
}
@@ -577,7 +577,7 @@ void SbTreeListBox::RemoveEntry(const weld::TreeIter& rIter)
}
// removing the associated user data
- Entry* pBasicEntry = reinterpret_cast<Entry*>(m_xControl->get_id(rIter).toInt64());
+ Entry* pBasicEntry = weld::fromId<Entry*>(m_xControl->get_id(rIter));
delete pBasicEntry;
// removing the entry
m_xControl->remove(rIter);
@@ -604,7 +604,7 @@ bool SbTreeListBox::FindEntry(std::u16string_view rText, EntryType eType, weld::
bool bValidIter = m_xControl->iter_children(rIter);
while (bValidIter)
{
- Entry* pBasicEntry = reinterpret_cast<Entry*>(m_xControl->get_id(rIter).toInt64());
+ Entry* pBasicEntry = weld::fromId<Entry*>(m_xControl->get_id(rIter));
assert(pBasicEntry && "FindEntry: no Entry ?!");
if (pBasicEntry->GetType() == eType && rText == m_xControl->get_text(rIter))
return true;
@@ -654,7 +654,7 @@ void SbTreeListBox::AddEntry(
std::unique_ptr<weld::TreeIter> xScratch = pRet ? nullptr : m_xControl->make_iterator();
if (!pRet)
pRet = xScratch.get();
- OUString sId(OUString::number(reinterpret_cast<sal_uInt64>(rUserData.release())));
+ OUString sId(weld::toId(rUserData.release()));
m_xControl->insert(pParent, -1, &rText, &sId, nullptr, nullptr, bChildrenOnDemand, pRet);
m_xControl->set_image(*pRet, rImage);
}
diff --git a/basctl/source/basicide/bastype3.cxx b/basctl/source/basicide/bastype3.cxx
index edf4c5bae04a..43f1b970209e 100644
--- a/basctl/source/basicide/bastype3.cxx
+++ b/basctl/source/basicide/bastype3.cxx
@@ -156,7 +156,7 @@ SbxVariable* SbTreeListBox::FindVariable(const weld::TreeIter* pEntry)
do
{
sal_uInt16 nDepth = m_xControl->get_iter_depth(*xIter);
- Entry* pBE = reinterpret_cast<Entry*>(m_xControl->get_id(*xIter).toInt64());
+ Entry* pBE = weld::fromId<Entry*>(m_xControl->get_id(*xIter));
switch (nDepth)
{
case 4:
@@ -257,7 +257,7 @@ EntryDescriptor SbTreeListBox::GetEntryDescriptor(const weld::TreeIter* pEntry)
do
{
sal_uInt16 nDepth = m_xControl->get_iter_depth(*xIter);
- Entry* pBE = reinterpret_cast<Entry*>(m_xControl->get_id(*xIter).toInt64());
+ Entry* pBE = weld::fromId<Entry*>(m_xControl->get_id(*xIter));
switch (nDepth)
{
case 4:
@@ -421,7 +421,7 @@ bool SbTreeListBox::FindRootEntry( const ScriptDocument& rDocument, LibraryLocat
bool bValidIter = m_xControl->get_iter_first(rIter);
while (bValidIter)
{
- DocumentEntry* pBDEntry = reinterpret_cast<DocumentEntry*>(m_xControl->get_id(rIter).toInt64());
+ DocumentEntry* pBDEntry = weld::fromId<DocumentEntry*>(m_xControl->get_id(rIter));
if (pBDEntry && pBDEntry->GetDocument() == rDocument && pBDEntry->GetLocation() == eLocation)
return true;
bValidIter = m_xControl->iter_next_sibling(rIter);
diff --git a/basctl/source/basicide/brkdlg.cxx b/basctl/source/basicide/brkdlg.cxx
index 6a79d0e1da54..37ba1dbb60ae 100644
--- a/basctl/source/basicide/brkdlg.cxx
+++ b/basctl/source/basicide/brkdlg.cxx
@@ -125,16 +125,14 @@ void BreakPointDialog::CheckButtons()
m_xNewButton->set_sensitive(true);
m_xOKButton->set_sensitive(false);
m_xDelButton->set_sensitive(false);
- m_xDelButton->set_has_default(false);
- m_xNewButton->set_has_default(true);
+ m_xDialog->change_default_widget(m_xDelButton.get(), m_xNewButton.get());
}
else
{
m_xNewButton->set_sensitive(false);
m_xOKButton->set_sensitive(true);
m_xDelButton->set_sensitive(true);
- m_xNewButton->set_has_default(false);
- m_xDelButton->set_has_default(true);
+ m_xDialog->change_default_widget(m_xNewButton.get(), m_xDelButton.get());
}
}
diff --git a/basctl/source/basicide/docsignature.cxx b/basctl/source/basicide/docsignature.cxx
index 701c9d478f1a..08d7a1ab9c13 100644
--- a/basctl/source/basicide/docsignature.cxx
+++ b/basctl/source/basicide/docsignature.cxx
@@ -51,10 +51,6 @@ namespace basctl
m_pShell = pShell;
}
- DocumentSignature::~DocumentSignature()
- {
- }
-
bool DocumentSignature::supportsSignatures() const
{
return ( m_pShell != nullptr );
diff --git a/basctl/source/basicide/localizationmgr.cxx b/basctl/source/basicide/localizationmgr.cxx
index 6dd07a021d32..279fd7555801 100644
--- a/basctl/source/basicide/localizationmgr.cxx
+++ b/basctl/source/basicide/localizationmgr.cxx
@@ -975,7 +975,7 @@ void LocalizationMgr::resetResourceForDialog( const Reference< container::XNameC
return;
// Dialog as control
- OUString aDummyName;
+ std::u16string_view aDummyName;
Any aDialogCtrl;
aDialogCtrl <<= xDialogModel;
Reference< XStringResourceResolver > xDummyStringResolver;
@@ -1002,7 +1002,7 @@ void LocalizationMgr::setResourceIDsForDialog( const Reference< container::XName
return;
// Dialog as control
- OUString aDummyName;
+ std::u16string_view aDummyName;
Any aDialogCtrl;
aDialogCtrl <<= xDialogModel;
Reference< XStringResourceResolver > xDummyStringResolver;
@@ -1084,7 +1084,7 @@ void LocalizationMgr::copyResourceForDialog(
if( !xDialogModel.is() || !xSourceStringResolver.is() || !xTargetStringResourceManager.is() )
return;
- OUString aDummyName;
+ std::u16string_view aDummyName;
Any aDialogCtrl;
aDialogCtrl <<= xDialogModel;
implHandleControlResourceProperties
diff --git a/basctl/source/basicide/moduldl2.cxx b/basctl/source/basicide/moduldl2.cxx
index 2515cace9800..57241bce7dde 100644
--- a/basctl/source/basicide/moduldl2.cxx
+++ b/basctl/source/basicide/moduldl2.cxx
@@ -63,6 +63,7 @@
#include <comphelper/processfactory.hxx>
#include <comphelper/propertysequence.hxx>
#include <cppuhelper/implbase.hxx>
+#include <o3tl/string_view.hxx>
#include <cassert>
@@ -102,12 +103,12 @@ public:
namespace
{
- int FindEntry(const weld::TreeView& rBox, const OUString& rName)
+ int FindEntry(const weld::TreeView& rBox, std::u16string_view rName)
{
int nCount = rBox.n_children();
for (int i = 0; i < nCount; ++i)
{
- if (rName.equalsIgnoreAsciiCase(rBox.get_text(i, 0)))
+ if (o3tl::equalsIgnoreAsciiCase(rName, rBox.get_text(i, 0)))
return i;
}
return -1;
@@ -345,7 +346,7 @@ LibPage::~LibPage()
const sal_Int32 nCount = m_xBasicsBox->get_count();
for (sal_Int32 i = 0; i < nCount; ++i)
{
- DocumentEntry* pEntry = reinterpret_cast<DocumentEntry*>(m_xBasicsBox->get_id(i).toInt64());
+ DocumentEntry* pEntry = weld::fromId<DocumentEntry*>(m_xBasicsBox->get_id(i));
delete pEntry;
}
}
@@ -1184,13 +1185,13 @@ void LibPage::FillListBox()
void LibPage::InsertListBoxEntry( const ScriptDocument& rDocument, LibraryLocation eLocation )
{
OUString aEntryText(rDocument.getTitle(eLocation));
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(new DocumentEntry(rDocument, eLocation))));
+ OUString sId(weld::toId(new DocumentEntry(rDocument, eLocation)));
m_xBasicsBox->append(sId, aEntryText);
}
void LibPage::SetCurLib()
{
- DocumentEntry* pEntry = reinterpret_cast<DocumentEntry*>(m_xBasicsBox->get_active_id().toInt64());
+ DocumentEntry* pEntry = weld::fromId<DocumentEntry*>(m_xBasicsBox->get_active_id());
if (!pEntry)
return;
@@ -1219,7 +1220,7 @@ void LibPage::SetCurLib()
ImpInsertLibEntry(aLibName, nEntry++);
}
- int nEntry_ = FindEntry(*m_xLibBox, "Standard");
+ int nEntry_ = FindEntry(*m_xLibBox, u"Standard");
if (nEntry_ == -1 && m_xLibBox->n_children())
nEntry_ = 0;
m_xLibBox->set_cursor(nEntry_);
diff --git a/basctl/source/basicide/moduldlg.cxx b/basctl/source/basicide/moduldlg.cxx
index 2e3c8c2530d1..dc46c7db0677 100644
--- a/basctl/source/basicide/moduldlg.cxx
+++ b/basctl/source/basicide/moduldlg.cxx
@@ -246,6 +246,10 @@ private:
if (!pSource)
return DND_ACTION_NONE;
+ // tdf#145722 only return a DND_ACTION_MOVE possibility if that
+ // is requested as an option
+ const bool bCheckForMove = rEvt.mnAction & DND_ACTION_MOVE;
+
sal_Int8 nMode = DND_ACTION_NONE;
std::unique_ptr<weld::TreeIter> xEntry(pSource->make_iterator());
@@ -255,28 +259,31 @@ private:
if (nDepth >= 2)
{
nMode = DND_ACTION_COPY;
- EntryDescriptor aDesc = m_rTreeView.GetEntryDescriptor(xEntry.get());
- const ScriptDocument& aDocument( aDesc.GetDocument() );
- const OUString& aLibName( aDesc.GetLibName() );
- // allow MOVE mode only for libraries, which are not readonly
- Reference< script::XLibraryContainer2 > xModLibContainer( aDocument.getLibraryContainer( E_SCRIPTS ), UNO_QUERY );
- Reference< script::XLibraryContainer2 > xDlgLibContainer( aDocument.getLibraryContainer( E_DIALOGS ), UNO_QUERY );
- if ( !( ( xModLibContainer.is() && xModLibContainer->hasByName( aLibName ) && xModLibContainer->isLibraryReadOnly( aLibName ) ) ||
- ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aLibName ) && xDlgLibContainer->isLibraryReadOnly( aLibName ) ) ) )
+ if (bCheckForMove)
{
- // Only allow copy for localized libraries
- bool bAllowMove = true;
- if ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aLibName ) )
+ EntryDescriptor aDesc = m_rTreeView.GetEntryDescriptor(xEntry.get());
+ const ScriptDocument& aDocument( aDesc.GetDocument() );
+ const OUString& aLibName( aDesc.GetLibName() );
+ // allow MOVE mode only for libraries, which are not readonly
+ Reference< script::XLibraryContainer2 > xModLibContainer( aDocument.getLibraryContainer( E_SCRIPTS ), UNO_QUERY );
+ Reference< script::XLibraryContainer2 > xDlgLibContainer( aDocument.getLibraryContainer( E_DIALOGS ), UNO_QUERY );
+ if ( !( ( xModLibContainer.is() && xModLibContainer->hasByName( aLibName ) && xModLibContainer->isLibraryReadOnly( aLibName ) ) ||
+ ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aLibName ) && xDlgLibContainer->isLibraryReadOnly( aLibName ) ) ) )
{
- // Get StringResourceManager
- Reference< container::XNameContainer > xDialogLib( aDocument.getLibrary( E_DIALOGS, aLibName, true ) );
- Reference< XStringResourceManager > xSourceMgr =
- LocalizationMgr::getStringResourceFromDialogLibrary( xDialogLib );
- if( xSourceMgr.is() )
- bAllowMove = ( xSourceMgr->getLocales().getLength() == 0 );
+ // Only allow copy for localized libraries
+ bool bAllowMove = true;
+ if ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aLibName ) )
+ {
+ // Get StringResourceManager
+ Reference< container::XNameContainer > xDialogLib( aDocument.getLibrary( E_DIALOGS, aLibName, true ) );
+ Reference< XStringResourceManager > xSourceMgr =
+ LocalizationMgr::getStringResourceFromDialogLibrary( xDialogLib );
+ if( xSourceMgr.is() )
+ bAllowMove = ( xSourceMgr->getLocales().getLength() == 0 );
+ }
+ if( bAllowMove )
+ nMode |= DND_ACTION_MOVE;
}
- if( bAllowMove )
- nMode |= DND_ACTION_MOVE;
}
}
}
@@ -496,6 +503,13 @@ private:
OUString sText(m_rTreeView.get_text(*xSelected));
OUString sId(m_rTreeView.get_id(*xSelected));
+ /// if copying then clone the userdata
+ if (Entry* pEntry = bMove ? nullptr : weld::fromId<Entry*>(sId))
+ {
+ assert(pEntry->GetType() != OBJ_TYPE_DOCUMENT);
+ std::unique_ptr<Entry> xNewUserData(std::make_unique<Entry>(*pEntry));
+ sId = weld::toId(xNewUserData.release());
+ }
std::unique_ptr<weld::TreeIter> xRet(m_rTreeView.make_iterator());
m_rTreeView.get_widget().insert(xNewParent.get(), nNewChildPos, &sText, &sId, nullptr, nullptr, false, xRet.get());
if (eType == OBJ_TYPE_MODULE)
@@ -562,6 +576,9 @@ ObjectPage::ObjectPage(weld::Container* pParent, const OString &rName, BrowseMod
}
m_xDropTarget.reset(new SbTreeListBoxDropTarget(*m_xBasicBox));
+ // tdf#145722 explicitly claim COPY and MOVE are options
+ rtl::Reference<TransferDataContainer> xHelper(new TransferDataContainer);
+ m_xBasicBox->get_widget().enable_drag_source(xHelper, DND_ACTION_COPYMOVE);
m_xBasicBox->connect_editing(LINK(this, ObjectPage, EditingEntryHdl),
LINK(this, ObjectPage, EditedEntryHdl));
@@ -685,7 +702,7 @@ IMPL_LINK(ObjectPage, ButtonHdl, weld::Button&, rButton, void)
std::unique_ptr<weld::TreeIter> xParentEntry(m_xBasicBox->make_iterator(xCurEntry.get()));
if (m_xBasicBox->iter_parent(*xParentEntry))
{
- DocumentEntry* pDocumentEntry = reinterpret_cast<DocumentEntry*>(m_xBasicBox->get_id(*xParentEntry).toInt64());
+ DocumentEntry* pDocumentEntry = weld::fromId<DocumentEntry*>(m_xBasicBox->get_id(*xParentEntry));
if (pDocumentEntry)
aDocument = pDocumentEntry->GetDocument();
}
@@ -843,6 +860,8 @@ void ObjectPage::DeleteCurrent()
if (!m_xBasicBox->get_cursor(xCurEntry.get()))
xCurEntry.reset();
DBG_ASSERT( xCurEntry, "No current entry!" );
+ if (!xCurEntry)
+ return;
EntryDescriptor aDesc( m_xBasicBox->GetEntryDescriptor( xCurEntry.get() ) );
const ScriptDocument& aDocument( aDesc.GetDocument() );
DBG_ASSERT( aDocument.isAlive(), "ObjectPage::DeleteCurrent: no document!" );
diff --git a/basctl/source/dlged/dlged.cxx b/basctl/source/dlged/dlged.cxx
index 69ffb81f3579..81fa3f14e837 100644
--- a/basctl/source/dlged/dlged.cxx
+++ b/basctl/source/dlged/dlged.cxx
@@ -789,7 +789,7 @@ void DlgEditor::Copy()
Sequence< Any > aSeqData
{
aNoResourceDialogModelBytesAny,
- makeAny(aCombinedData)
+ Any(aCombinedData)
};
pTrans = new DlgEdTransferableImpl( m_ClipboardDataFlavorsResource, aSeqData );
@@ -797,7 +797,7 @@ void DlgEditor::Copy()
else
{
// No resource, support only old format
- pTrans = new DlgEdTransferableImpl( m_ClipboardDataFlavors , { makeAny(DialogModelBytes) } );
+ pTrans = new DlgEdTransferableImpl( m_ClipboardDataFlavors , { Any(DialogModelBytes) } );
}
SolarMutexReleaser aReleaser;
xClipboard->setContents( pTrans , pTrans );
diff --git a/basctl/source/dlged/managelang.cxx b/basctl/source/dlged/managelang.cxx
index c7cd423cccee..0853f4ac86d3 100644
--- a/basctl/source/dlged/managelang.cxx
+++ b/basctl/source/dlged/managelang.cxx
@@ -113,7 +113,7 @@ void ManageLanguageDialog::FillLanguageBox()
sLanguage += " " + m_sDefLangStr;
}
LanguageEntry* pEntry = new LanguageEntry(pLocale[i], bIsDefault);
- m_xLanguageLB->append(OUString::number(reinterpret_cast<sal_Int64>(pEntry)), sLanguage);
+ m_xLanguageLB->append(weld::toId(pEntry), sLanguage);
}
}
else
@@ -125,7 +125,7 @@ void ManageLanguageDialog::ClearLanguageBox()
const sal_Int32 nCount = m_xLanguageLB->n_children();
for (sal_Int32 i = 0; i < nCount; ++i)
{
- LanguageEntry* pEntry = reinterpret_cast<LanguageEntry*>(m_xLanguageLB->get_id(i).toInt64());
+ LanguageEntry* pEntry = weld::fromId<LanguageEntry*>(m_xLanguageLB->get_id(i));
delete pEntry;
}
m_xLanguageLB->clear();
@@ -166,7 +166,7 @@ IMPL_LINK_NOARG(ManageLanguageDialog, DeleteHdl, weld::Button&, void)
for (int i = 0; i < nCount; ++i)
{
const sal_Int32 nSelPos = aSelection[i];
- LanguageEntry* pEntry = reinterpret_cast<LanguageEntry*>(m_xLanguageLB->get_id(nSelPos).toInt64());
+ LanguageEntry* pEntry = weld::fromId<LanguageEntry*>(m_xLanguageLB->get_id(nSelPos));
if ( pEntry )
aLocaleSeqRange[i] = pEntry->m_aLocale;
}
@@ -185,7 +185,7 @@ IMPL_LINK_NOARG(ManageLanguageDialog, DeleteHdl, weld::Button&, void)
IMPL_LINK_NOARG(ManageLanguageDialog, MakeDefHdl, weld::Button&, void)
{
const sal_Int32 nPos = m_xLanguageLB->get_selected_index();
- LanguageEntry* pSelectEntry = reinterpret_cast<LanguageEntry*>(m_xLanguageLB->get_id(nPos).toInt64());
+ LanguageEntry* pSelectEntry = weld::fromId<LanguageEntry*>(m_xLanguageLB->get_id(nPos));
if (pSelectEntry && !pSelectEntry->m_bIsDefault)
{
// set new default entry
diff --git a/basctl/source/dlged/propbrw.cxx b/basctl/source/dlged/propbrw.cxx
index 4a8481249640..d7ab2ee633ef 100644
--- a/basctl/source/dlged/propbrw.cxx
+++ b/basctl/source/dlged/propbrw.cxx
@@ -137,7 +137,7 @@ void PropBrw::ImplReCreateController()
::cppu::ContextEntry_Init( "ContextDocument", Any( m_xContextDocument ) )
};
Reference< XComponentContext > xInspectorContext(
- ::cppu::createComponentContext( aHandlerContextInfo, SAL_N_ELEMENTS( aHandlerContextInfo ), xOwnContext ) );
+ ::cppu::createComponentContext( aHandlerContextInfo, std::size( aHandlerContextInfo ), xOwnContext ) );
// create a property browser controller
Reference< XMultiComponentFactory > xFactory( xInspectorContext->getServiceManager(), UNO_SET_THROW );
diff --git a/basctl/source/inc/bastypes.hxx b/basctl/source/inc/bastypes.hxx
index e150635befb7..520d1a711992 100644
--- a/basctl/source/inc/bastypes.hxx
+++ b/basctl/source/inc/bastypes.hxx
@@ -49,11 +49,11 @@ class Layout;
class ModulWindow;
class DialogWindow;
-#define LINE_SEP_CR 0x0D
-#define LINE_SEP 0x0A
+constexpr auto LINE_SEP_CR = 0x0D;
+constexpr auto LINE_SEP = 0x0A;
// Implementation: baside2b.cxx
-sal_Int32 searchEOL( const OUString& rStr, sal_Int32 fromIndex );
+sal_Int32 searchEOL( std::u16string_view rStr, sal_Int32 fromIndex );
// Meaning of bToBeKilled:
// While being in a reschedule-loop, I may not destroy the window.
diff --git a/basctl/source/inc/dlged.hxx b/basctl/source/inc/dlged.hxx
index 82d3a14f605d..9e5147dfcfc2 100644
--- a/basctl/source/inc/dlged.hxx
+++ b/basctl/source/inc/dlged.hxx
@@ -48,9 +48,8 @@ namespace basctl
class DialogWindowLayout;
-#define DLGED_PAGE_WIDTH_MIN 1280
-#define DLGED_PAGE_HEIGHT_MIN 1024
-
+constexpr auto DLGED_PAGE_WIDTH_MIN = 1280;
+constexpr auto DLGED_PAGE_HEIGHT_MIN = 1024;
// DlgEdHint
diff --git a/basctl/source/inc/docsignature.hxx b/basctl/source/inc/docsignature.hxx
index 9dd66da678b8..1681807d390e 100644
--- a/basctl/source/inc/docsignature.hxx
+++ b/basctl/source/inc/docsignature.hxx
@@ -39,7 +39,6 @@ namespace basctl
which does not support being signed, the DocumentSignature instance is invalid afterwards.
*/
explicit DocumentSignature (ScriptDocument const&);
- ~DocumentSignature();
/** determines whether the instance is valid