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 "impsvgdialog.hxx"
25 using namespace com::sun::star::uno
;
26 using namespace com::sun::star::beans
;
29 inline sal_Int32
implMap( vcl::Window
& /*rWnd*/, sal_Int32 nVal
)
35 ImpSVGDialog::ImpSVGDialog( vcl::Window
* pParent
, Sequence
< PropertyValue
>& rFilterData
) :
36 ModalDialog( pParent
),
37 maFI( VclPtr
<FixedLine
>::Create(this) ),
38 maCBTinyProfile( VclPtr
<CheckBox
>::Create(this) ),
39 maCBEmbedFonts( VclPtr
<CheckBox
>::Create(this) ),
40 maCBUseNativeDecoration( VclPtr
<CheckBox
>::Create(this) ),
41 maBTOK( VclPtr
<OKButton
>::Create(this, WB_DEF_OK
) ),
42 maBTCancel( VclPtr
<CancelButton
>::Create(this) ),
43 maBTHelp( VclPtr
<HelpButton
>::Create(this) ),
44 maConfigItem( SVG_EXPORTFILTER_CONFIGPATH
, &rFilterData
),
45 mbOldNativeDecoration( false )
47 SetText( "SVG Export Options" );
48 SetOutputSizePixel( Size( implMap( *this, 177 ), implMap( *this, 77 ) ) );
50 maFI
->SetText( "Export" );
51 maFI
->SetPosSizePixel( Point( implMap( *this, 6 ), implMap( *this, 3 ) ),
52 Size( implMap( *this, 165 ), implMap( *this, 8 ) ) );
54 maCBTinyProfile
->SetText( "Use SVG Tiny profile" );
55 maCBTinyProfile
->SetPosSizePixel( Point( implMap( *this, 12 ), implMap( *this, 14 ) ),
56 Size( implMap( *this, 142 ), implMap( *this, 10 ) ) );
58 maCBEmbedFonts
->SetText( "Embed fonts" );
59 maCBEmbedFonts
->SetPosSizePixel( Point( implMap( *this, 12 ), implMap( *this, 27 ) ),
60 Size( implMap( *this, 142 ), implMap( *this, 10 ) ) );
62 maCBUseNativeDecoration
->SetText( "Use SVG native text decoration" );
63 maCBUseNativeDecoration
->SetPosSizePixel( Point( implMap( *this, 12 ), implMap( *this, 41 ) ),
64 Size( implMap( *this, 142 ), implMap( *this, 10 ) ) );
66 maCBTinyProfile
->Check( maConfigItem
.ReadBool( SVG_PROP_TINYPROFILE
, false ) );
67 maCBEmbedFonts
->Check( maConfigItem
.ReadBool( SVG_PROP_EMBEDFONTS
, true ) );
68 maCBUseNativeDecoration
->Check( maConfigItem
.ReadBool( SVG_PROP_NATIVEDECORATION
, true ) );
70 maBTOK
->SetPosSizePixel( Point( implMap( *this, 12 ), implMap( *this, 57 ) ),
71 Size( implMap( *this, 50 ), implMap( *this, 14 ) ) );
72 maBTCancel
->SetPosSizePixel( Point( implMap( *this, 65 ), implMap( *this, 57 ) ),
73 Size( implMap( *this, 50 ), implMap( *this, 14 ) ) );
74 maBTHelp
->SetPosSizePixel( Point( implMap( *this, 121 ), implMap( *this, 57 ) ),
75 Size( implMap( *this, 50 ), implMap( *this, 14 ) ) );
77 maCBTinyProfile
->SetToggleHdl( LINK( this, ImpSVGDialog
, OnToggleCheckbox
) );
78 OnToggleCheckbox( *maCBTinyProfile
.get() );
82 maCBTinyProfile
->Show();
83 maCBEmbedFonts
->Show();
84 maCBUseNativeDecoration
->Show();
92 ImpSVGDialog::~ImpSVGDialog()
98 void ImpSVGDialog::dispose()
100 maFI
.disposeAndClear();
101 maCBTinyProfile
.disposeAndClear();
102 maCBEmbedFonts
.disposeAndClear();
103 maCBUseNativeDecoration
.disposeAndClear();
104 maBTOK
.disposeAndClear();
105 maBTCancel
.disposeAndClear();
106 maBTHelp
.disposeAndClear();
107 maConfigItem
.WriteModifiedConfig();
108 ModalDialog::dispose();
112 Sequence
< PropertyValue
> ImpSVGDialog::GetFilterData()
114 maConfigItem
.WriteBool( SVG_PROP_TINYPROFILE
, maCBTinyProfile
->IsChecked() );
115 maConfigItem
.WriteBool( SVG_PROP_EMBEDFONTS
, maCBEmbedFonts
->IsChecked() );
116 maConfigItem
.WriteBool( SVG_PROP_NATIVEDECORATION
, maCBUseNativeDecoration
->IsChecked() );
118 return( maConfigItem
.GetFilterData() );
122 IMPL_LINK( ImpSVGDialog
, OnToggleCheckbox
, CheckBox
&, rBox
, void )
124 if( &rBox
== maCBTinyProfile
.get() )
126 if( rBox
.IsChecked() )
128 mbOldNativeDecoration
= maCBUseNativeDecoration
->IsChecked();
130 maCBUseNativeDecoration
->Check( false );
131 maCBUseNativeDecoration
->Disable();
135 maCBUseNativeDecoration
->Enable();
136 maCBUseNativeDecoration
->Check( mbOldNativeDecoration
);
141 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */