20 #include <config_features.h>
23 #include <osl/diagnose.h>
31 #include <com/sun/star/document/XEventsSupplier.hpp>
32 #include <com/sun/star/uno/Reference.hxx>
33 #include <com/sun/star/script/XLibraryContainer.hpp>
34 #include <com/sun/star/container/XNameContainer.hpp>
55 {
nullptr,
nullptr, SvMacroItemId::NONE }
72 bool bInsIntoBasic =
false,
73 bInsSrcIntoField =
false;
77 case HTMLScriptLanguage::StarBasic:
81 bInsSrcIntoField =
true;
102 bInsIntoBasic && IsNewDoc() )
114 aLibName =
"Standard";
119 if ( xModLibContainer.is() )
122 if ( xModLibContainer->hasByName( aLibName ) )
125 Any aElement = xModLibContainer->getByName( aLibName );
126 aElement >>= xModLib;
131 xModLib = xModLibContainer->createLibrary( aLibName );
149 if ( !xModLib->hasByName( aModName ) )
153 xModLib->insertByName( aModName , aElement );
161 if ( xDlgLibContainer.is() )
163 if ( !xDlgLibContainer->hasByName( aLibName ) )
166 xDlgLibContainer->createLibrary( aLibName );
182 if( aToken.getLength() > 2 &&
183 (HTMLScriptLanguage::StarBasic==
m_eScriptLang && aToken[ 0 ] ==
'\'') )
228 const OUString& rScrType )
230 OSL_ENSURE( !rName.isEmpty(),
"InsertBasicDocEvent() called without macro" );
231 if( rName.isEmpty() )
235 OSL_ENSURE( pDocSh,
"Where is the DocShell?" );
240 OUString sScriptType;
242 sScriptType = rScrType;
250 #if !HAVE_FEATURE_SCRIPTING
257 OSL_ENSURE( pBasicMan,
"Where is the Basic-Manager?" );
266 for( sal_uInt16
i=0;
i<pBasicMan->GetLibCount();
i++ )
269 const OUString& rLibName = pBasic->
GetName();
270 for(
const auto& pModule: pBasic->
GetModules() )
272 OUString sLang(SVX_MACRO_LANGUAGE_STARBASIC);
291 const OUString& rModName = pModule->GetName();
295 &rLibName, &rModName );
303 "OnLoad",
"OnPrepareUnload",
"OnFocus",
"OnUnfocus"
314 uno::Reference< document::XEventsSupplier > xSup( pDocSh->
GetModel(), uno::UNO_QUERY );
315 uno::Reference < container::XNameReplace > xEvents = xSup->getEvents();
316 for ( sal_Int32
i=0;
i<4;
i++ )
325 if( !aDocTable.
empty() )
#define OOO_STRING_SVTOOLS_HTML_O_onload
static std::unique_ptr< SvxMacro > ConvertToMacro(const css::uno::Any &rElement, SfxObjectShell *pDoc)
HTMLOutEvent const aBodyEventTable[]
SvxMacro & Insert(SvMacroItemId nEvent, const SvxMacro &rMacro)
const OUString & GetBaseURL() const
TOOLS_DLLPUBLIC OString convertLineEnd(const OString &rIn, LineEnd eLineEnd)
void OutBasicBodyEvents()
#define OOO_STRING_SVTOOLS_HTML_O_onblur
const OUString & GetName(SbxNameType=SbxNameType::NONE) const
SwDocShell * GetDocShell()
#define OOO_STRING_SVTOOLS_HTML_META_content_script_type
#define OOO_STRING_SVTOOLS_HTML_meta
css::uno::Reference< css::frame::XModel3 > GetModel() const
static SVT_DLLPUBLIC SvStream & OutScript(SvStream &rStrm, const OUString &rBaseURL, std::u16string_view rSource, const OUString &rLanguage, ScriptType eScriptType, const OUString &rSrc, const OUString *pSBLibrary, const OUString *pSBModule, OUString *pNonConvertableChars=nullptr)
static void ConfigureEvent(const OUString &aName, const SvxMacro &, SfxObjectShell const *pObjSh)
SvStream & WriteCharPtr(const char *pBuf)
void InsertBasicDocEvent(const OUString &aEventName, const OUString &rName, ScriptType eScrType, const OUString &rScrType)
void OutNewLine(bool bCheck=false)
static const char * aEventNames[]
LineEnd GetSystemLineEnd()
void OutBasic(const SwHTMLWriter &rHTMLWrt)
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
void InsertAttr(const SfxPoolItem &rItem, bool bInsAtStart)
css::uno::Reference< css::script::XLibraryContainer > GetDialogContainer()
#define OOO_STRING_SVTOOLS_HTML_O_SDonunload
#define OOO_STRING_SVTOOLS_HTML_O_SDonblur
#define OOO_STRING_SVTOOLS_HTML_SB_module
HTMLScriptLanguage m_eScriptLang
bool m_bIgnoreHTMLComments
static BasicManager * GetBasicManager()
#define OOO_STRING_SVTOOLS_HTML_O_SDonfocus
SvStream & WriteOString(std::string_view rStr)
#define OOO_STRING_SVTOOLS_HTML_SB_library
#define OOO_STRING_SVTOOLS_HTML_O_onunload
OString strip(const OString &rIn, char c)
OString GetNamespace() const
Determines the prefix string needed to respect the requested namespace alias.
#define OOO_STRING_SVTOOLS_HTML_O_content
#define OOO_STRING_SVTOOLS_HTML_O_SDonload
static SVT_DLLPUBLIC SvStream & Out_Events(SvStream &, const SvxMacroTableDtor &, const HTMLOutEvent *, bool bOutStarBasic, OUString *pNonConvertableChars=nullptr)
sal_uInt16 m_nSBModuleCnt
#define OOO_STRING_SVTOOLS_HTML_O_onfocus
rtl::Reference< SwDoc > m_xDoc
#define OOO_STRING_SVTOOLS_HTML_O_httpequiv
#define SAL_NEWLINE_STRING
BasicManager * GetBasicManager() const
css::uno::Reference< css::script::XLibraryContainer > GetBasicContainer()