24#include <com/sun/star/frame/DocumentTemplates.hpp>
25#include <com/sun/star/frame/XStorable.hpp>
27#include <sfx2/strings.hrc>
37 : GenericDialogController(pParent,
"sfx/ui/saveastemplatedlg.ui",
"SaveAsTemplateDialog")
38 , m_xLBCategory(m_xBuilder->weld_tree_view(
"categorylb"))
39 , m_xCBXDefault(m_xBuilder->weld_check_button(
"defaultcb"))
40 , m_xTemplateNameEdit(m_xBuilder->weld_entry(
"name_entry"))
62 VclButtonsType::YesNo, OUString()));
63 if(!IsTemplateNameUnique())
65 OUString sQueryMsg(
SfxResId(STR_QMSG_TEMPLATE_OVERWRITE));
66 sQueryMsg = sQueryMsg.replaceFirst(
"$1",msTemplateName);
67 xQueryDlg->set_primary_text(sQueryMsg.replaceFirst(
"$2", msSelectedCategory));
69 if (xQueryDlg->run() ==
RET_NO)
77 OUString sText(
SfxResId(STR_ERROR_SAVEAS) );
79 VclButtonsType::Ok, sText.replaceFirst(
"$1", msTemplateName)));
87 SelectCategoryHdl(*m_xLBCategory);
92 if (m_xLBCategory->get_selected_index() == 0)
94 msSelectedCategory = OUString();
99 msSelectedCategory = m_xLBCategory->get_selected_text();
100 m_xOKButton->set_sensitive(!msTemplateName.isEmpty());
116 for (
size_t i = 0,
n = rFolderNames.size();
i <
n; ++
i)
127 for(sal_uInt16
i = 0;
i < nEntries;
i++)
139 uno::Reference< frame::XStorable > xStorable(
m_xModel, uno::UNO_QUERY_THROW );
155 OUString aServiceName;
158 uno::Reference< embed::XStorage > xStorage =
166 aServiceName = pFilter->GetServiceName();
168 catch( uno::Exception& )
171 if(!aServiceName.isEmpty())
SfxApplication * SfxGetpApp()
Reference< XExecutableDialog > m_xDialog
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, const ILibreOfficeKitNotifier *pNotifier=nullptr)
SfxFilterMatcher & GetFilterMatcher()
bool InsertTemplate(sal_uInt16 nSourceRegion, sal_uInt16 nIdx, const OUString &rName, const OUString &rPath)
void Update()
updates the configuration where the document templates structure is stored.
sal_uInt16 GetRegionCount() const
sal_uInt16 GetCount(sal_uInt16 nRegion) const
OUString GetFullRegionName(sal_uInt16 nIdx) const
OUString GetTemplateTargetURLFromComponent(std::u16string_view aGroupName, std::u16string_view aTitle)
OUString GetName(sal_uInt16 nRegion, sal_uInt16 nIdx) const
std::shared_ptr< const SfxFilter > GetFilter4ClipBoardId(SotClipboardFormatId nId, SfxFilterFlags nMust=SfxFilterFlags::IMPORT, SfxFilterFlags nDont=SFX_FILTER_NOTINSTALLED) const
static void SetStandardTemplate(const OUString &rServiceName, const OUString &rTemplateName)
std::unique_ptr< weld::TreeView > m_xLBCategory
std::vector< OUString > msCategories
SfxDocumentTemplates maDocTemplates
std::unique_ptr< weld::CheckButton > m_xCBXDefault
void SetCategoryLBEntries(const std::vector< OUString > &names)
bool IsTemplateNameUnique()
std::unique_ptr< weld::Entry > m_xTemplateNameEdit
css::uno::Reference< css::frame::XModel > m_xModel
OUString msSelectedCategory
std::unique_ptr< weld::Button > m_xOKButton
SfxSaveAsTemplateDialog(weld::Window *pParent, css::uno::Reference< css::frame::XModel > xModel)
static SotClipboardFormatId GetFormatID(css::uno::Reference< css::embed::XStorage > const &xStorage)
static css::uno::Reference< css::embed::XStorage > GetStorageFromURL(const OUString &aURL, sal_Int32 nStorageMode, const css::uno::Reference< css::uno::XComponentContext > &rxContext=css::uno::Reference< css::uno::XComponentContext >())
Reference< frame::XModel > m_xModel
std::unique_ptr< weld::Button > m_xOKButton
#define LINK(Instance, Class, Member)
OString strip(const OString &rIn, char c)
Reference< XComponentContext > getProcessComponentContext()
OSQLColumns::const_iterator find(const OSQLColumns::const_iterator &first, const OSQLColumns::const_iterator &last, std::u16string_view _rVal, const ::comphelper::UStringMixEqual &_rCase)
IMPL_LINK_NOARG(SfxSaveAsTemplateDialog, OkClickHdl, weld::Button &, void)
OUString SfxResId(TranslateId aId)
Reference< XModel > xModel