/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
switch(aURLObj.GetProtocol())
{ case INetProtocol::File:
osl::FileBase::getSystemPathFromFileURL(aURLObj.GetMainURL(INetURLObject::DecodeMechanism::NONE), aStrUiURL); break; case INetProtocol::Ftp :
{ //remove password from name
INetURLObject aTmpURL(aURLObj);
aTmpURL.SetPass(u"");
aStrUiURL = aTmpURL.GetMainURL( INetURLObject::DecodeMechanism::Unambiguous );
} break; default :
{
aStrUiURL = aURLObj.GetMainURL(INetURLObject::DecodeMechanism::Unambiguous);
}
} if(aStrUiURL.isEmpty()) return aStrURL; return aStrUiURL;
}
}
// ComboBox-Control for URL's with History and Autocompletion
SvxHyperURLBox::SvxHyperURLBox(std::unique_ptr<weld::ComboBox> xControl)
: SvtURLBox(std::move(xControl))
, DropTargetHelper(getWidget()->get_drop_target())
{
SetSmartProtocol(INetProtocol::Http);
}
// Size of dialog-window in screen pixels
Point aDlgPos(pDialog->get_position());
Size aDlgSize(pDialog->get_size());
// Absolute size of the screen
::tools::Rectangle aScreen(pDialog->get_monitor_workarea());
// Size of Extrawindow
Size aExtraWndSize(mxMarkWnd->getDialog()->get_preferred_size());
// mxMarkWnd is a child of mpDialog, so coordinates for positioning must be relative to mpDialog if( aDlgPos.X()+(1.05*aDlgSize.Width())+aExtraWndSize.Width() > aScreen.Right() )
{ if( aDlgPos.X() - ( 0.05*aDlgSize.Width() ) - aExtraWndSize.Width() < 0 )
{ // Pos Extrawindow anywhere
MoveToExtraWnd( Point(10,10) ); // very unlikely
} else
{ // Pos Extrawindow on the left side of Dialog
MoveToExtraWnd( Point(0,0) - Point( tools::Long(0.05*aDlgSize.Width()), 0 ) - Point( aExtraWndSize.Width(), 0 ) );
}
} else
{ // Pos Extrawindow on the right side of Dialog
MoveToExtraWnd ( Point( tools::Long(1.05*aDlgSize.getWidth()), 0 ) );
}
// Set size of Extra-Window
mxMarkWnd->getDialog()->set_size_request(aExtraWndSize.Width(), aDlgSize.Height());
// Name
mxEdText->set_text( pHyperlinkItem->GetIntName() );
// Script-button if (!comphelper::LibreOfficeKit::isActive())
{ if ( pHyperlinkItem->GetMacroEvents() == HyperDialogEvent::NONE )
mxBtScript->set_sensitive(false); else
mxBtScript->set_sensitive(true);
} else
{
mxBtScript->hide();
}
}
// Any action to do after apply-button is pressed void SvxHyperlinkTabPageBase::DoApply ()
{ // default-implementation : do nothing
}
// This method would be called from bookmark-window to set new mark-string void SvxHyperlinkTabPageBase::SetMarkStr ( const OUString& /*aStrMark*/ )
{ // default-implementation : do nothing
}
// Set initial focus void SvxHyperlinkTabPageBase::SetInitFocus()
{
xContainer->grab_focus();
}
// try to detect the current protocol that is used in rStrURL
OUString SvxHyperlinkTabPageBase::GetSchemeFromURL( const OUString& rStrURL )
{
OUString aStrScheme;
sal_Int32 nPos = mxLbForm->get_active(); if (nPos == -1) // This happens when FillStandardDlgFields() hides mpLbForm.
nPos = 0;
eMode = static_cast<SvxLinkInsertMode>(nPos + 1);
// Ask dialog whether the current doc is a HTML-doc if (mpDialog->IsHTMLDoc())
eMode = static_cast<SvxLinkInsertMode>( sal_uInt16(eMode) | HLINK_HTMLMODE );
}
GetCurrentItemData ( aStrURL, aStrName, aStrIntName, aStrFrame, eMode); if ( aStrName.isEmpty() ) //automatically create a visible name if the link is created without name
aStrName = CreateUiNameFromURL(aStrURL);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.