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 .
20 #include <inspagob.hxx>
22 #include <strings.hrc>
24 #include <bitmaps.hlst>
25 #include <sdresid.hxx>
26 #include <drawdoc.hxx>
27 #include <DrawDocShell.hxx>
28 #include <ViewShell.hxx>
30 SdInsertPagesObjsDlg::SdInsertPagesObjsDlg(
31 vcl::Window
* pWindow
, const SdDrawDocument
* pInDoc
,
32 SfxMedium
* pSfxMedium
, const OUString
& rFileName
)
33 : ModalDialog(pWindow
, "InsertSlidesDialog",
34 "modules/sdraw/ui/insertslidesdialog.ui")
39 get(m_pLbTree
, "tree");
40 get(m_pCbxMasters
, "backgrounds");
41 get(m_pCbxLink
, "links");
43 m_pLbTree
->set_width_request(m_pLbTree
->approximate_char_width() * 50);
44 m_pLbTree
->set_height_request(m_pLbTree
->GetTextHeight() * 12);
46 m_pLbTree
->SetViewFrame( pInDoc
->GetDocSh()->GetViewShell()->GetViewFrame() );
48 m_pLbTree
->SetSelectHdl( LINK( this, SdInsertPagesObjsDlg
, SelectObjectHdl
) );
52 SetText( SdResId( STR_INSERT_TEXT
) );
57 SdInsertPagesObjsDlg::~SdInsertPagesObjsDlg()
62 void SdInsertPagesObjsDlg::dispose()
66 m_pCbxMasters
.clear();
67 ModalDialog::dispose();
71 * Fills the TreeLB dependent on the medium. Is not medium available, then
72 * it is a text and not a draw document.
74 void SdInsertPagesObjsDlg::Reset()
78 m_pLbTree
->SetSelectionMode( SelectionMode::Multiple
);
80 // transfer ownership of Medium
81 m_pLbTree
->Fill( mpDoc
, pMedium
, rName
);
85 BitmapEx
aBmpText(BMP_DOC_TEXT
);
86 //to-do, check if this is already transparent and remove intermedia bitmapex if it is
87 Image
aImgText(BitmapEx(aBmpText
.GetBitmap(), COL_WHITE
));
88 m_pLbTree
->InsertEntry( rName
, aImgText
, aImgText
);
91 m_pCbxMasters
->Check();
94 std::vector
<OUString
> SdInsertPagesObjsDlg::GetList( const sal_uInt16 nType
)
96 // With Draw documents, we have to return NULL on selection of the document
99 // to ensure that bookmarks are opened
100 // (when the whole document is selected)
101 m_pLbTree
->GetBookmarkDoc();
103 // If the document is selected (too) or nothing is selected,
104 // the whole document is inserted (but not more!)
105 if( m_pLbTree
->GetSelectionCount() == 0 ||
106 ( m_pLbTree
->IsSelected( m_pLbTree
->First() ) ) )
107 return std::vector
<OUString
>();
110 return m_pLbTree
->GetSelectEntryList( nType
);
116 bool SdInsertPagesObjsDlg::IsLink()
118 return m_pCbxLink
->IsChecked();
124 bool SdInsertPagesObjsDlg::IsRemoveUnnessesaryMasterPages() const
126 return m_pCbxMasters
->IsChecked();
130 * Enabled and selects end-color-LB
132 IMPL_LINK_NOARG(SdInsertPagesObjsDlg
, SelectObjectHdl
, SvTreeListBox
*, void)
134 if( m_pLbTree
->IsLinkableSelected() )
135 m_pCbxLink
->Enable();
137 m_pCbxLink
->Disable();
140 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */