Line data Source code
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 <svl/itemset.hxx>
21 : #include <vcl/layout.hxx>
22 :
23 : #include "strings.hrc"
24 : #include "sdattr.hxx"
25 : #include "sdresid.hxx"
26 : #include "layeroptionsdlg.hxx"
27 :
28 0 : SdInsertLayerDlg::SdInsertLayerDlg( vcl::Window* pWindow, const SfxItemSet& rInAttrs,
29 : bool bDeletable, const OUString& rStr )
30 : : ModalDialog(pWindow, "InsertLayerDialog", "modules/sdraw/ui/insertlayer.ui")
31 0 : , mrOutAttrs(rInAttrs)
32 : {
33 0 : SetText(rStr);
34 :
35 0 : get(m_pEdtName, "name");
36 0 : get(m_pEdtTitle, "title");
37 0 : get(m_pEdtDesc, "textview");
38 0 : get(m_pCbxVisible, "visible");
39 0 : get(m_pCbxPrintable, "printable");
40 0 : get(m_pCbxLocked, "locked");
41 :
42 0 : m_pEdtName->SetText( static_cast<const SdAttrLayerName&>( mrOutAttrs.Get( ATTR_LAYER_NAME ) ).GetValue() );
43 0 : m_pEdtTitle->SetText( static_cast<const SdAttrLayerTitle&>( mrOutAttrs.Get( ATTR_LAYER_TITLE ) ).GetValue() );
44 0 : m_pEdtDesc->SetText( static_cast<const SdAttrLayerDesc&>( mrOutAttrs.Get( ATTR_LAYER_DESC ) ).GetValue() );
45 0 : m_pEdtDesc->set_height_request(4 * m_pEdtDesc->GetTextHeight());
46 0 : m_pCbxVisible->Check( static_cast<const SdAttrLayerVisible&>( mrOutAttrs.Get( ATTR_LAYER_VISIBLE ) ).GetValue() );
47 0 : m_pCbxPrintable->Check( static_cast<const SdAttrLayerPrintable&>( mrOutAttrs.Get( ATTR_LAYER_PRINTABLE ) ).GetValue() );
48 0 : m_pCbxLocked->Check( static_cast<const SdAttrLayerLocked&>( mrOutAttrs.Get( ATTR_LAYER_LOCKED ) ).GetValue() );
49 :
50 0 : get<VclContainer>("nameframe")->Enable(bDeletable);
51 0 : }
52 :
53 0 : SdInsertLayerDlg::~SdInsertLayerDlg()
54 : {
55 0 : disposeOnce();
56 0 : }
57 :
58 0 : void SdInsertLayerDlg::dispose()
59 : {
60 0 : m_pEdtName.clear();
61 0 : m_pEdtTitle.clear();
62 0 : m_pEdtDesc.clear();
63 0 : m_pCbxVisible.clear();
64 0 : m_pCbxPrintable.clear();
65 0 : m_pCbxLocked.clear();
66 0 : ModalDialog::dispose();
67 0 : }
68 :
69 0 : void SdInsertLayerDlg::GetAttr( SfxItemSet& rAttrs )
70 : {
71 0 : rAttrs.Put( SdAttrLayerName( m_pEdtName->GetText() ) );
72 0 : rAttrs.Put( SdAttrLayerTitle( m_pEdtTitle->GetText() ) );
73 0 : rAttrs.Put( SdAttrLayerDesc( m_pEdtDesc->GetText() ) );
74 0 : rAttrs.Put( SdAttrLayerVisible( m_pCbxVisible->IsChecked() ) );
75 0 : rAttrs.Put( SdAttrLayerPrintable( m_pCbxPrintable->IsChecked() ) );
76 0 : rAttrs.Put( SdAttrLayerLocked( m_pCbxLocked->IsChecked() ) );
77 66 : }
78 :
79 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|