1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 2 /* 3 * This file is part of the LibreOffice project. 4 * 5 * This Source Code Form is subject to the terms of the Mozilla Public 6 * License, v. 2.0. If a copy of the MPL was not distributed with this 7 * file, You can obtain one at http://mozilla.org/MPL/2.0/. 8 * 9 * This file incorporates work covered by the following license notice: 10 * 11 * Licensed to the Apache Software Foundation (ASF) under one or more 12 * contributor license agreements. See the NOTICE file distributed 13 * with this work for additional information regarding copyright 14 * ownership. The ASF licenses this file to you under the Apache 15 * License, Version 2.0 (the "License"); you may not use this file 16 * except in compliance with the License. You may obtain a copy of 17 * the License at http://www.apache.org/licenses/LICENSE-2.0 . 18 */ 19 #ifndef INCLUDED_CUI_SOURCE_INC_INSDLG_HXX 20 #define INCLUDED_CUI_SOURCE_INC_INSDLG_HXX 21 22 #include <com/sun/star/uno/Reference.h> 23 #include <com/sun/star/embed/XEmbeddedObject.hpp> 24 #include <com/sun/star/embed/XStorage.hpp> 25 26 #include <svtools/insdlg.hxx> 27 #include <vcl/weld.hxx> 28 #include <comphelper/embeddedobjectcontainer.hxx> 29 30 class INetURLObject; 31 32 class InsertObjectDialog_Impl : public weld::GenericDialogController 33 { 34 protected: 35 css::uno::Reference < css::embed::XEmbeddedObject > m_xObj; 36 const css::uno::Reference < css::embed::XStorage > m_xStorage; 37 comphelper::EmbeddedObjectContainer aCnt; 38 39 InsertObjectDialog_Impl(weld::Window * pParent, 40 const OUString& rUIXMLDescription, const OString& rID, 41 const css::uno::Reference < css::embed::XStorage >& xStorage); 42 public: GetObject() const43 const css::uno::Reference<css::embed::XEmbeddedObject>& GetObject() const { return m_xObj; } 44 virtual css::uno::Reference<css::io::XInputStream> GetIconIfIconified(OUString* pGraphicMediaType); SetHelpId(const OString & rHelpId)45 void SetHelpId(const OString& rHelpId) { m_xDialog->set_help_id(rHelpId); } 46 virtual bool IsCreateNew() const; 47 }; 48 49 class SvInsertOleDlg : public InsertObjectDialog_Impl 50 { 51 const SvObjectServerList* m_pServers; 52 53 css::uno::Sequence< sal_Int8 > m_aIconMetaFile; 54 OUString m_aIconMediaType; 55 56 std::unique_ptr<weld::RadioButton> m_xRbNewObject; 57 std::unique_ptr<weld::RadioButton> m_xRbObjectFromfile; 58 std::unique_ptr<weld::Frame> m_xObjectTypeFrame; 59 std::unique_ptr<weld::TreeView> m_xLbObjecttype; 60 std::unique_ptr<weld::Frame> m_xFileFrame; 61 std::unique_ptr<weld::Entry> m_xEdFilepath; 62 std::unique_ptr<weld::Button> m_xBtnFilepath; 63 std::unique_ptr<weld::CheckButton> m_xCbFilelink; 64 std::unique_ptr<weld::CheckButton> m_xCbAsIcon; 65 66 DECL_LINK(DoubleClickHdl, weld::TreeView&, bool); 67 DECL_LINK(BrowseHdl, weld::Button&, void); 68 DECL_LINK(RadioHdl, weld::Button&, void); IsCreateNew() const69 bool IsCreateNew() const override { return m_xRbNewObject->get_active(); } 70 71 public: 72 SvInsertOleDlg(weld::Window* pParent, 73 const css::uno::Reference < css::embed::XStorage >& xStorage, 74 const SvObjectServerList* pServers ); 75 virtual short run() override; 76 77 /// get replacement for the iconified embedded object and the mediatype of the replacement 78 css::uno::Reference< css::io::XInputStream > GetIconIfIconified( OUString* pGraphicMediaType ) override; 79 }; 80 81 class SfxInsertFloatingFrameDialog : public InsertObjectDialog_Impl 82 { 83 private: 84 std::unique_ptr<weld::Entry> m_xEDName; 85 std::unique_ptr<weld::Entry> m_xEDURL; 86 std::unique_ptr<weld::Button> m_xBTOpen; 87 88 std::unique_ptr<weld::RadioButton> m_xRBScrollingOn; 89 std::unique_ptr<weld::RadioButton> m_xRBScrollingOff; 90 std::unique_ptr<weld::RadioButton> m_xRBScrollingAuto; 91 92 std::unique_ptr<weld::RadioButton> m_xRBFrameBorderOn; 93 std::unique_ptr<weld::RadioButton> m_xRBFrameBorderOff; 94 95 std::unique_ptr<weld::Label> m_xFTMarginWidth; 96 std::unique_ptr<weld::SpinButton> m_xNMMarginWidth; 97 std::unique_ptr<weld::CheckButton> m_xCBMarginWidthDefault; 98 std::unique_ptr<weld::Label> m_xFTMarginHeight; 99 std::unique_ptr<weld::SpinButton> m_xNMMarginHeight; 100 std::unique_ptr<weld::CheckButton> m_xCBMarginHeightDefault; 101 102 DECL_LINK(OpenHdl, weld::Button&, void); 103 DECL_LINK(CheckHdl, weld::Button&, void); 104 105 void Init(); 106 107 public: 108 SfxInsertFloatingFrameDialog(weld::Window *pParent, 109 const css::uno::Reference<css::embed::XStorage>& xStorage); 110 SfxInsertFloatingFrameDialog(weld::Window* pParent, 111 const css::uno::Reference<css::embed::XEmbeddedObject>& xObj); 112 virtual short run() override; 113 }; 114 115 #endif // INCLUDED_CUI_SOURCE_INC_INSDLG_HXX 116 117 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 118