LibreOffice Module sd (master) 1
inspagob.cxx
Go to the documentation of this file.
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
20#include <inspagob.hxx>
21#include <sdtreelb.hxx>
22
23#include <strings.hrc>
24
25#include <bitmaps.hlst>
26#include <sdresid.hxx>
27#include <drawdoc.hxx>
28#include <DrawDocShell.hxx>
29#include <ViewShell.hxx>
30
32 weld::Window* pWindow, const SdDrawDocument* pInDoc,
33 SfxMedium* pSfxMedium, const OUString& rFileName )
34 : GenericDialogController(pWindow, "modules/sdraw/ui/insertslidesdialog.ui", "InsertSlidesDialog")
35 , m_pMedium(pSfxMedium)
36 , m_pDoc(pInDoc)
37 , m_rName(rFileName)
38 , m_xLbTree(new SdPageObjsTLV(m_xBuilder->weld_tree_view("tree")))
39 , m_xCbxLink(m_xBuilder->weld_check_button("links"))
40 , m_xCbxMasters(m_xBuilder->weld_check_button("backgrounds"))
41{
42 m_xLbTree->set_size_request(m_xLbTree->get_approximate_digit_width() * 48,
43 m_xLbTree->get_height_rows(12));
44
45 m_xLbTree->SetViewFrame( pInDoc->GetDocSh()->GetViewShell()->GetViewFrame() );
46
47 m_xLbTree->connect_changed(LINK(this, SdInsertPagesObjsDlg, SelectObjectHdl));
48
49 // insert text
50 if (!m_pMedium)
51 m_xDialog->set_title(SdResId(STR_INSERT_TEXT));
53 m_xDialog->set_title(SdResId(STR_INSERT_PAGES));
54
55 Reset();
56}
57
59{
60}
61
67{
68 if( m_pMedium )
69 {
70 m_xLbTree->set_selection_mode(SelectionMode::Multiple);
71
72 // transfer ownership of Medium
74 }
75 else
76 {
77 m_xLbTree->InsertEntry(m_rName, BMP_DOC_TEXT);
78 }
79
80 m_xCbxMasters->set_active(true);
81}
82
83std::vector<OUString> SdInsertPagesObjsDlg::GetList( const sal_uInt16 nType )
84{
85 // With Draw documents, we have to return NULL on selection of the document
86 if( m_pMedium )
87 {
88 // to ensure that bookmarks are opened
89 // (when the whole document is selected)
90 m_xLbTree->GetBookmarkDoc();
91
92 // If the document is selected (too) or nothing is selected,
93 // the whole document is inserted (but not more!)
94 std::unique_ptr<weld::TreeIter> xIter(m_xLbTree->make_iterator());
95 if (!m_xLbTree->get_iter_first(*xIter) || m_xLbTree->is_selected(*xIter))
96 return std::vector<OUString>();
97 }
98
99 return m_xLbTree->GetSelectEntryList( nType );
100}
101
106{
107 return m_xCbxLink->get_active();
108}
109
114{
115 return m_xCbxMasters->get_active();
116}
117
122{
123 m_xCbxLink->set_sensitive(m_xLbTree->IsLinkableSelected());
124}
125
126/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SAL_DLLPRIVATE::sd::DrawDocShell * GetDocSh() const
Definition: drawdoc.hxx:242
SAL_DLLPRIVATE DocumentType GetDocumentType() const
Definition: drawdoc.hxx:251
std::unique_ptr< SdPageObjsTLV > m_xLbTree
Definition: inspagob.hxx:35
bool IsLink() const
is link checked
Definition: inspagob.cxx:105
std::unique_ptr< weld::CheckButton > m_xCbxLink
Definition: inspagob.hxx:36
SfxMedium * m_pMedium
Definition: inspagob.hxx:31
std::unique_ptr< weld::CheckButton > m_xCbxMasters
Definition: inspagob.hxx:37
const OUString & m_rName
Definition: inspagob.hxx:33
bool IsRemoveUnnecessaryMasterPages() const
is link checked
Definition: inspagob.cxx:113
virtual ~SdInsertPagesObjsDlg() override
Definition: inspagob.cxx:58
SdInsertPagesObjsDlg(weld::Window *pParent, const SdDrawDocument *pDoc, SfxMedium *pSfxMedium, const OUString &rFileName)
Definition: inspagob.cxx:31
void Reset()
Fills the TreeLB dependent on the medium.
Definition: inspagob.cxx:66
std::vector< OUString > GetList(const sal_uInt16 nType)
returns the list nType == 0 -> pages nType == 1 -> objects
Definition: inspagob.cxx:83
const SdDrawDocument * m_pDoc
Definition: inspagob.hxx:32
std::shared_ptr< weld::Dialog > m_xDialog
IMPL_LINK_NOARG(SdInsertPagesObjsDlg, SelectObjectHdl, weld::TreeView &, void)
Enabled and selects end-color-LB.
Definition: inspagob.cxx:121
QPRO_FUNC_TYPE nType
OUString SdResId(TranslateId aId)
Definition: sdmod.cxx:83