30 #include <osl/diagnose.h>
43 #include <strings.hrc>
45 #include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
46 #include <com/sun/star/ui/dialogs/XFilePicker3.hpp>
53 #include <svx/dialogs.hrc>
58 using namespace ::
sfx2;
63 "CharacterPropertiesDialog", &rCoreSet, pStr != nullptr)
65 , m_nDialogMode(nDialogMode)
112 else if (rId ==
"fonteffects")
118 else if (rId ==
"position")
123 else if (rId ==
"asianlayout")
128 else if (rId ==
"background")
132 eFlags = SvxBackgroundTabFlags::SHOW_CHAR_BKGCOLOR;
139 :
SfxTabPage(pPage, pController,
"modules/swriter/ui/charurlpage.ui",
"CharURLPage", &rCoreSet)
141 , m_xURLED(m_xBuilder->weld_entry(
"urled"))
142 , m_xTextFT(m_xBuilder->weld_label(
"textft"))
143 , m_xTextED(m_xBuilder->weld_entry(
"texted"))
144 , m_xNameED(m_xBuilder->weld_entry(
"nameed"))
145 , m_xTargetFrameLB(m_xBuilder->weld_combo_box(
"targetfrmlb"))
146 , m_xURLPB(m_xBuilder->weld_button(
"urlpb"))
147 , m_xEventPB(m_xBuilder->weld_button(
"eventpb"))
148 , m_xVisitedLB(m_xBuilder->weld_combo_box(
"visitedlb"))
149 , m_xNotVisitedLB(m_xBuilder->weld_combo_box(
"unvisitedlb"))
150 , m_xCharStyleContainer(m_xBuilder->weld_widget(
"charstyle"))
153 const int nMaxWidth(
m_xVisitedLB->get_approximate_digit_width() * 50);
161 pItem = pShell->GetItem(SID_HTML_MODE);
165 sal_uInt16 nHtmlMode = pItem->
GetValue();
185 size_t nCount = aList.size();
186 for (
size_t i = 0;
i < nCount; ++
i)
204 m_xNameED->set_text(pINetFormat->GetName());
207 OUString sEntry = pINetFormat->GetVisitedFormat();
208 if (sEntry.isEmpty())
210 OSL_ENSURE(
false,
"<SwCharURLPage::Reset(..)> - missing visited character format at hyperlink attribute" );
215 sEntry = pINetFormat->GetINetFormat();
216 if (sEntry.isEmpty())
218 OSL_ENSURE(
false,
"<SwCharURLPage::Reset(..)> - missing unvisited character format at hyperlink attribute" );
229 if( pINetFormat->GetMacroTable() )
242 OUString sURL =
m_xURLED->get_text();
253 bool bURLModified =
m_xURLED->get_value_changed_from_saved();
254 bool bNameModified =
m_xNameED->get_value_changed_from_saved();
256 bModified = bURLModified || bNameModified || bTargetModified;
261 aINetFormat.SetVisitedFormatAndId( sEntry, nId );
265 aINetFormat.SetINetFormatAndId( sEntry, nId );
282 rSet->
Put(aINetFormat);
288 return std::make_unique<SwCharURLPage>(pPage, pController, *rAttrSet);
293 FileDialogHelper aDlgHelper(TemplateDescription::FILEOPEN_SIMPLE,
295 aDlgHelper.SetContext(FileDialogHelper::WriterInsertHyperlink);
298 const Reference<XFilePicker3>& xFP = aDlgHelper.GetFilePicker();
299 m_xURLED->set_text(xFP->getSelectedFiles().getConstArray()[0]);
#define LINK(Instance, Class, Member)
virtual void Reset(const SfxItemSet *rSet) override
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
virtual void PageCreated(const SfxAllItemSet &aSet)
static SfxAbstractDialogFactory * Create()
static void GetDefaultTargetList(TargetList &)
static void FillUIName(const OUString &rName, OUString &rFillName, SwGetPoolIdFromName)
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rAttrSet)
std::unique_ptr< weld::Button > m_xEventPB
sal_uInt16 GetValue() const
void RemoveTabPage(const OString &rName)
SfxItemSet * GetInputSetImpl()
static SfxObjectShell * Current()
std::unique_ptr< weld::ComboBox > m_xNotVisitedLB
std::unique_ptr< weld::Entry > m_xNameED
static OUString decode(std::u16string_view rText, DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)
virtual bool FillItemSet(SfxItemSet *rSet) override
SVL_DLLPUBLIC OUString simpleNormalizedMakeRelative(OUString const &baseUriReference, OUString const &uriReference)
OUString SwResId(TranslateId aId)
virtual CreateTabPage GetTabPageCreatorFunc(sal_uInt16 nId)=0
virtual ~SwCharDlg() override
#define SVX_PREVIEW_CHARACTER
static SW_DLLPUBLIC sal_uInt16 GetPoolIdFromUIName(const OUString &rName, SwGetPoolIdFromName)
std::unique_ptr< weld::Button > m_xURLPB
SwCharURLPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
bool IsDoubleLinesEnabled()
constexpr TypedWhichId< SwFormatINetFormat > RES_TXTATR_INETFMT(51)
std::optional< SvxMacroTableDtor > m_oINetMacroTable
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
const SfxPoolItem * GetItem(sal_uInt16 nSlotId) const
std::unique_ptr< weld::Entry > m_xTextED
SwCharDlgMode m_nDialogMode
std::unique_ptr< weld::Entry > m_xURLED
IMPL_LINK_NOARG(SwCharURLPage, InsertFileHdl, weld::Button &, void)
SwDocShell * GetDocShell()
std::unique_ptr< weld::Label > m_xTextFT
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
#define FN_PARAM_SELECTION
COMPHELPER_DLLPUBLIC bool isFileUrl(OUString const &url)
void AddTabPage(const OString &rName, CreateTabPage pCreateFunc, GetTabPageRanges pRangesFunc)
virtual void PageCreated(const OString &rId, SfxTabPage &rPage) override
Reference< XExecutableDialog > m_xDialog
static bool INetFormatDlg(weld::Window *pParent, SwWrtShell &rSh, std::optional< SvxMacroTableDtor > &rpINetItem)
virtual ~SwCharURLPage() override
std::unique_ptr< weld::Widget > m_xCharStyleContainer
std::unique_ptr< weld::ComboBox > m_xTargetFrameLB
SwCharDlg(weld::Window *pParent, SwView &pVw, const SfxItemSet &rCoreSet, SwCharDlgMode nDialogMode, const OUString *pFormatStr)
#define SVX_ENABLE_CHAR_TRANSPARENCY
std::unique_ptr< weld::ComboBox > m_xVisitedLB
::std::vector< OUString > TargetList
bool m_bDetectedRangeSegmentation false
SVL_DLLPUBLIC OUString SmartRel2Abs(INetURLObject const &rTheBaseURIRef, OUString const &rTheRelURIRef, Link< OUString *, bool > const &rMaybeFileHdl=Link< OUString *, bool >(), bool bCheckFileExists=true, bool bIgnoreFragment=false, INetURLObject::EncodeMechanism eEncodeMechanism=INetURLObject::EncodeMechanism::WasEncoded, INetURLObject::DecodeMechanism eDecodeMechanism=INetURLObject::DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8, FSysStyle eStyle=FSysStyle::Detect)