35#include <com/sun/star/script/XLibraryContainerPassword.hpp>
40#include <sfx2/sfxsids.hrc>
64 ,pShellHScrollBar( nullptr)
65 ,pShellVScrollBar( nullptr)
68 ,m_aLibName(
std::move( aLibName ))
116 DoScroll(pShellVScrollBar);
121 DoScroll(pShellHScrollBar);
136 if ( rNEvt.
GetType() == NotifyEventType::KEYINPUT )
140 sal_uInt16 nCode = aCode.
GetCode();
158 return bDone || Window::EventNotify( rNEvt );
239 aMsg =
IDEResId(RID_STR_MODULE_READONLY);
241 aMsg =
IDEResId(RID_STR_DIALOG_READONLY);
244 aMsg, InfobarType::INFO,
true);
267 return SearchOptionFlags::NONE;
286 std::u16string_view rLibName, std::u16string_view rName,
318 , m_xBuilder(
Application::CreateInterimBuilder(m_xBox.
get(), rUIXMLDescription, true))
491 pDispatcher->Execute( SID_BASICIDE_MODULEDLG );
506 Point aP = PixelToLogic( aPos );
511 pDispatcher->ExecutePopup(
"tabbar",
this, &aPos);
522 VclMessageType::Warning, VclButtonsType::Ok,
IDEResId(RID_STR_BADSBXNAME)));
537 pDispatcher->ExecuteList( SID_BASICIDE_NAMECHANGEDONTAB,
538 SfxCallMode::SYNCHRON, { &aID, &aNewName });
547struct TabBarSortHelper
552 bool operator < (TabBarSortHelper
const& rComp)
const
554 return aPageText.compareToIgnoreAsciiCase(rComp.aPageText) < 0;
567 TabBarSortHelper aTabBarSortHelper;
568 std::vector<TabBarSortHelper> aModuleList;
569 std::vector<TabBarSortHelper> aDialogList;
574 for (
i = 0;
i < nPageCount;
i++)
577 aTabBarSortHelper.nPageId =
nId;
583 aModuleList.push_back( aTabBarSortHelper );
587 aDialogList.push_back( aTabBarSortHelper );
592 std::sort( aModuleList.begin() , aModuleList.end() );
593 std::sort( aDialogList.begin() , aDialogList.end() );
596 sal_uInt16 nModules = sal::static_int_cast<sal_uInt16>( aModuleList.size() );
597 sal_uInt16 nDialogs = sal::static_int_cast<sal_uInt16>( aDialogList.size() );
600 for (
i = 0;
i < nModules;
i++)
606 for (
i = 0;
i < nDialogs;
i++)
612void CutLines( OUString& rStr, sal_Int32 nStartLine, sal_Int32 nLines )
614 sal_Int32 nStartPos = 0;
616 while ( nLine < nStartLine )
618 nStartPos =
searchEOL( rStr, nStartPos );
619 if( nStartPos == -1 )
625 SAL_WARN_IF( nStartPos == -1,
"basctl.basicide",
"CutLines: Start line not found!" );
627 if ( nStartPos == -1 )
630 sal_Int32 nEndPos = nStartPos;
632 for ( sal_Int32
i = 0;
i < nLines;
i++ )
636 nEndPos = rStr.getLength();
640 rStr = OUString::Concat(rStr.subView( 0, nStartPos )) + rStr.subView( nEndPos );
644 sal_Int32
n = nStartPos;
645 sal_Int32 nLen = rStr.getLength();
646 while ( (
n < nLen ) && ( rStr[
n ] ==
LINE_SEP ||
654 rStr = OUString::Concat(rStr.subView( 0, nStartPos )) + rStr.subView(
n );
667 while ( !rStream.
eof() )
671 else if ( c ==
'\r' )
694 OUString
const& rLibName,
695 OUString
const& rCurrentName,
699 Key aKey(rDocument, rLibName);
701 m_aMap.emplace(aKey,
Item(rCurrentName, eCurrentType));
706 Map::iterator it = std::find_if(
m_aMap.begin(),
m_aMap.end(),
707 [&rDocument](Map::reference rEntry) { return rEntry.first.GetDocument() == rDocument; });
716 Map::iterator it =
m_aMap.find(
Key(rDocument, rLibName));
717 return it !=
m_aMap.end() ? &it->second :
nullptr;
731 std::size_t seed = 0;
738 OUString aCurrentName,
741 m_aCurrentName(
std::move(aCurrentName)),
742 m_eCurrentType(eCurrentType)
747 OUString
aName = OUString::Concat(
"\'") + rName +
"\'";
748 OUString aQuery = rStr.replaceAll(
"XX",
aName);
750 VclMessageType::Question, VclButtonsType::YesNo, aQuery));
751 return (xQueryBox->run() ==
RET_YES);
771 return QueryDel( rName,
IDEResId( bRef ? RID_STR_QUERYDELLIBREF : RID_STR_QUERYDELLIB ), pParent );
793 OUString aTitle(
IDEResId(RID_STR_ENTERPASSWORD));
794 aTitle = aTitle.replaceAll(
"XX", rLibName);
795 aDlg.set_title(aTitle);
804 if ( xLibContainer.is() && xLibContainer->hasByName( rLibName ) )
807 if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( rLibName ) && !xPasswd->isLibraryPasswordVerified( rLibName ) )
810 bOK = xPasswd->verifyLibraryPassword( rLibName, rPassword );
815 VclMessageType::Warning, VclButtonsType::Ok,
IDEResId(RID_STR_WRONGPASSWORD)));
822 while ( bRepeat && !bOK && nRet ==
RET_OK );
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, const ILibreOfficeKitNotifier *pNotifier=nullptr)
CommandEventId GetCommand() const
const Point & GetMousePosPixel() const
bool IsMouseEvent() const
Point GetPosPixel() const override
bool IsFloatingMode() const
void SetFloatingMode(bool bFloatMode)
Size GetSizePixel() const override
virtual void EndDocking(const tools::Rectangle &rRect, bool bFloatMode)
const vcl::KeyCode & GetKeyCode() const
sal_uInt16 GetClicks() const
const KeyEvent * GetKeyEvent() const
NotifyEventType GetType() const
virtual void dispose() override
OUString GetPassword() const
virtual short run() override
void SetMinLen(sal_uInt16 Len)
void RemoveInfoBar(std::u16string_view sId)
VclPtr< SfxInfoBarWindow > AppendInfoBar(const OUString &sId, const OUString &sPrimaryMessage, const OUString &sSecondaryMessage, InfobarType aInfobarType, bool bShowCloseButton=true)
SfxViewFrame & GetViewFrame() const
SvStream & ReadChar(char &rChar)
sal_uInt64 Seek(sal_uInt64 nPos)
sal_uInt16 GetEditPageId() const
bool IsInEditMode() const
void MovePage(sal_uInt16 nPageId, sal_uInt16 nNewPos)
const OUString & GetEditText() const
bool IsEditModeCanceled() const
OUString GetPageText(sal_uInt16 nPageId) const
sal_uInt16 GetPageCount() const
sal_uInt16 GetPageId(sal_uInt16 nPos) const
virtual void MouseButtonDown(const MouseEvent &rMEvt) override
virtual void BasicStopped()
virtual ItemType GetType() const =0
virtual bool IsReadOnly()
virtual OUString GetTitle()
void GrabScrollBars(ScrollAdaptor *pHScroll, ScrollAdaptor *pVScroll)
virtual void dispose() override
virtual void DoScroll(Scrollable *pCurScrollBar)
ScriptDocument m_aDocument
virtual void SetReadOnly(bool bReadOnly)
OUString CreateQualifiedName()
VclPtr< ScrollAdaptor > pShellHScrollBar
void ShowShellScrollBars(bool bVisible=true)
VclPtr< ScrollAdaptor > pShellVScrollBar
virtual SearchOptionFlags GetSearchOptions()
virtual void UpdateData()
virtual bool HasActiveEditor() const
virtual void ExecuteGlobal(SfxRequest &)
virtual void ExecuteCommand(SfxRequest &)
virtual bool IsModified()
virtual bool EventNotify(NotifyEvent &rNEvt) override
BaseWindow(vcl::Window *pParent, ScriptDocument aDocument, OUString aLibName, OUString aName)
void ShowReadOnlyInfoBar()
virtual SfxUndoManager * GetUndoManager()
virtual void OnNewDocument()
virtual void BasicStarted()
virtual ~BaseWindow() override
void InsertLibInfo() const
virtual sal_uInt16 StartSearchAndReplace(SvxSearchItem const &, bool bFromStart=false)
bool Is(ScriptDocument const &, std::u16string_view, std::u16string_view, ItemType, bool bFindSuspended)
virtual void StartDocking() override
static WinBits const StyleBits
virtual void ToggleFloatingMode() override
std::unique_ptr< weld::Container > m_xContainer
void SetLayoutWindow(Layout *)
virtual bool Docking(const Point &rPos, tools::Rectangle &rRect) override
virtual ~DockingWindow() override
tools::Rectangle aFloatingRect
virtual bool PrepareToggleFloatingMode() override
std::unique_ptr< weld::Builder > m_xBuilder
virtual void EndDocking(const tools::Rectangle &rRect, bool bFloatMode) override
void ResizeIfDocking(Point const &, Size const &)
tools::Rectangle aDockingRect
virtual void dispose() override
Item(OUString aCurrentName, ItemType eCurrentType)
Key(ScriptDocument, OUString aLibName)
bool operator==(Key const &) const
ScriptDocument m_aDocument
void InsertInfo(ScriptDocument const &, OUString const &rLibName, OUString const &rCurrentName, ItemType eCurrentType)
Item const * GetInfo(ScriptDocument const &, OUString const &rLibName)
void RemoveInfoFor(ScriptDocument const &)
encapsulates a document which contains Basic scripts and dialogs
OUString getTitle(LibraryLocation _eLocation, LibraryType _eType=LibraryType::All) const
returns the title for the document
sal_Int32 hashCode() const
retrieves a (pretty simple) hash code for the document
LibraryLocation getLibraryLocation(const OUString &_rLibName) const
returns the location of a library given by name
std::map< sal_uInt16, VclPtr< BaseWindow > > WindowTable
WindowTable & GetWindowTable()
virtual void Command(const CommandEvent &rCEvt) override
TabBar(vcl::Window *pParent)
virtual void EndRenaming() override
virtual TabBarAllowRenamingReturnCode AllowRenaming() override
virtual void MouseButtonDown(const MouseEvent &rMEvt) override
sal_uInt16 GetCode() const
Point OutputToScreenPixel(const Point &rPos) const
virtual void dispose() override
vcl::Window * GetParent() const
friend friend class DockingWindow
void SetParent(vcl::Window *pNewParent)
void Show(bool bVisible=true, ShowFlags nFlags=ShowFlags::NONE)
Point ScreenToOutputPixel(const Point &rPos) const
virtual void SetPosSizePixel(const Point &rNewPos, const Size &rNewSize)
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
virtual void SetHelpId(const OUString &) override
constexpr OUStringLiteral HID_BASICIDE_TABBAR
constexpr sal_uInt16 KEY_PAGEDOWN
constexpr sal_uInt16 KEY_PAGEUP
#define LINK(Instance, Class, Member)
#define SAL_WARN_IF(condition, area, stream)
std::unique_ptr< sal_Int32[]> pData
constexpr auto LINE_SEP_CR
bool QueryReplaceMacro(std::u16string_view rName, weld::Widget *pParent)
static bool QueryDel(std::u16string_view rName, const OUString &rStr, weld::Widget *pParent)
bool QueryDelLib(std::u16string_view rName, bool bRef, weld::Widget *pParent)
bool IsValidSbxName(std::u16string_view rName)
bool QueryPassword(weld::Widget *pDialogParent, const Reference< script::XLibraryContainer > &xLibContainer, const OUString &rLibName, OUString &rPassword, bool bRepeat, bool bNewTitle)
sal_Int32 searchEOL(std::u16string_view rStr, sal_Int32 fromIndex)
ExtraData * GetExtraData()
SfxDispatcher * GetDispatcher()
sal_uInt32 CalcLineCount(SvStream &rStream)
bool QueryDelMacro(std::u16string_view rName, weld::Widget *pParent)
bool QueryDelDialog(std::u16string_view rName, weld::Widget *pParent)
IMPL_LINK_NOARG(EditorWindow, SetSourceInBasicHdl, void *, void)
OUString IDEResId(TranslateId aId)
void CutLines(OUString &rStr, sal_Int32 nStartLine, sal_Int32 nLines)
bool QueryDelModule(std::u16string_view rName, weld::Widget *pParent)
constexpr OUStringLiteral BASIC_IDE_READONLY_INFOBAR
std::enable_if_t<(sizeof(N)==4)> hash_combine(N &nSeed, T const *pValue, size_t nCount)
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
size_t operator()(Key const &) const
TabBarAllowRenamingReturnCode
WinBits const WB_MOVEABLE
WinBits const WB_DOCKABLE
WinBits const WB_SIZEABLE
WinBits const WB_CLIPCHILDREN