1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
21 #include <com/sun/star/uno/Reference.h>
22 #include <com/sun/star/embed/XEmbeddedObject.hpp>
23 #include <com/sun/star/embed/XStorage.hpp>
25 #include <svtools/insdlg.hxx>
26 #include <vcl/weld.hxx>
27 #include <comphelper/embeddedobjectcontainer.hxx>
31 class InsertObjectDialog_Impl
: public weld::GenericDialogController
34 css::uno::Reference
< css::embed::XEmbeddedObject
> m_xObj
;
35 const css::uno::Reference
< css::embed::XStorage
> m_xStorage
;
36 comphelper::EmbeddedObjectContainer aCnt
;
38 InsertObjectDialog_Impl(weld::Window
* pParent
,
39 const OUString
& rUIXMLDescription
, const OUString
& rID
,
40 css::uno::Reference
< css::embed::XStorage
> xStorage
);
42 const css::uno::Reference
<css::embed::XEmbeddedObject
>& GetObject() const { return m_xObj
; }
43 virtual css::uno::Reference
<css::io::XInputStream
> GetIconIfIconified(OUString
* pGraphicMediaType
);
44 void SetHelpId(const OUString
& rHelpId
) { m_xDialog
->set_help_id(rHelpId
); }
45 virtual bool IsCreateNew() const;
48 class SvInsertOleDlg
: public InsertObjectDialog_Impl
50 const SvObjectServerList
* m_pServers
;
52 css::uno::Sequence
< sal_Int8
> m_aIconMetaFile
;
53 OUString m_aIconMediaType
;
55 std::unique_ptr
<weld::RadioButton
> m_xRbNewObject
;
56 std::unique_ptr
<weld::RadioButton
> m_xRbObjectFromfile
;
57 std::unique_ptr
<weld::Frame
> m_xObjectTypeFrame
;
58 std::unique_ptr
<weld::TreeView
> m_xLbObjecttype
;
59 std::unique_ptr
<weld::Frame
> m_xFileFrame
;
60 std::unique_ptr
<weld::Entry
> m_xEdFilepath
;
61 std::unique_ptr
<weld::Button
> m_xBtnFilepath
;
62 std::unique_ptr
<weld::CheckButton
> m_xCbFilelink
;
63 std::unique_ptr
<weld::CheckButton
> m_xCbAsIcon
;
65 DECL_LINK(DoubleClickHdl
, weld::TreeView
&, bool);
66 DECL_LINK(BrowseHdl
, weld::Button
&, void);
67 DECL_LINK(RadioHdl
, weld::Toggleable
&, void);
68 bool IsCreateNew() const override
{ return m_xRbNewObject
->get_active(); }
71 SvInsertOleDlg(weld::Window
* pParent
,
72 const css::uno::Reference
< css::embed::XStorage
>& xStorage
,
73 const SvObjectServerList
* pServers
);
74 virtual short run() override
;
76 /// get replacement for the iconified embedded object and the mediatype of the replacement
77 css::uno::Reference
< css::io::XInputStream
> GetIconIfIconified( OUString
* pGraphicMediaType
) override
;
80 class SfxInsertFloatingFrameDialog
: public InsertObjectDialog_Impl
83 std::unique_ptr
<weld::Entry
> m_xEDName
;
84 std::unique_ptr
<weld::Entry
> m_xEDURL
;
85 std::unique_ptr
<weld::Button
> m_xBTOpen
;
87 std::unique_ptr
<weld::RadioButton
> m_xRBScrollingOn
;
88 std::unique_ptr
<weld::RadioButton
> m_xRBScrollingOff
;
89 std::unique_ptr
<weld::RadioButton
> m_xRBScrollingAuto
;
91 std::unique_ptr
<weld::RadioButton
> m_xRBFrameBorderOn
;
92 std::unique_ptr
<weld::RadioButton
> m_xRBFrameBorderOff
;
94 std::unique_ptr
<weld::Label
> m_xFTMarginWidth
;
95 std::unique_ptr
<weld::SpinButton
> m_xNMMarginWidth
;
96 std::unique_ptr
<weld::CheckButton
> m_xCBMarginWidthDefault
;
97 std::unique_ptr
<weld::Label
> m_xFTMarginHeight
;
98 std::unique_ptr
<weld::SpinButton
> m_xNMMarginHeight
;
99 std::unique_ptr
<weld::CheckButton
> m_xCBMarginHeightDefault
;
101 DECL_LINK(OpenHdl
, weld::Button
&, void);
102 DECL_LINK(CheckHdl
, weld::Toggleable
&, void);
107 SfxInsertFloatingFrameDialog(weld::Window
*pParent
,
108 const css::uno::Reference
<css::embed::XStorage
>& xStorage
);
109 SfxInsertFloatingFrameDialog(weld::Window
* pParent
,
110 const css::uno::Reference
<css::embed::XEmbeddedObject
>& xObj
);
111 virtual short run() override
;
114 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */