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 :
21 : #include "impsvgdialog.hxx"
22 : #include <cstdio>
23 :
24 : using namespace rtl;
25 : using namespace com::sun::star::uno;
26 : using namespace com::sun::star::beans;
27 :
28 0 : inline sal_Int32 implMap( Window& /*rWnd*/, sal_Int32 nVal )
29 : {
30 : //return( rWnd.LogicToLogic( Size( nVal, nVal ) ).Height(), MAP_APPFONT, MAP_APPFONT );
31 0 : return( nVal << 1 );
32 : }
33 :
34 :
35 : // - ImpSVGDialog -
36 :
37 :
38 0 : ImpSVGDialog::ImpSVGDialog( Window* pParent, Sequence< PropertyValue >& rFilterData ) :
39 : ModalDialog( pParent ),
40 : maFI( this ),
41 : maCBTinyProfile( this ),
42 : maCBEmbedFonts( this ),
43 : maCBUseNativeDecoration( this ),
44 : maBTOK( this, WB_DEF_OK ),
45 : maBTCancel( this ),
46 : maBTHelp( this ),
47 : maConfigItem( SVG_EXPORTFILTER_CONFIGPATH, &rFilterData ),
48 0 : mbOldNativeDecoration( sal_False )
49 : {
50 0 : SetText( "SVG Export Options" );
51 0 : SetOutputSizePixel( Size( implMap( *this, 177 ), implMap( *this, 77 ) ) );
52 :
53 0 : maFI.SetText( "Export" );
54 : maFI.SetPosSizePixel( Point( implMap( *this, 6 ), implMap( *this, 3 ) ),
55 0 : Size( implMap( *this, 165 ), implMap( *this, 8 ) ) );
56 :
57 0 : maCBTinyProfile.SetText( "Use SVG Tiny profile" );
58 : maCBTinyProfile.SetPosSizePixel( Point( implMap( *this, 12 ), implMap( *this, 14 ) ),
59 0 : Size( implMap( *this, 142 ), implMap( *this, 10 ) ) );
60 :
61 0 : maCBEmbedFonts.SetText( "Embed fonts" );
62 : maCBEmbedFonts.SetPosSizePixel( Point( implMap( *this, 12 ), implMap( *this, 27 ) ),
63 0 : Size( implMap( *this, 142 ), implMap( *this, 10 ) ) );
64 :
65 0 : maCBUseNativeDecoration.SetText( "Use SVG native text decoration" );
66 : maCBUseNativeDecoration.SetPosSizePixel( Point( implMap( *this, 12 ), implMap( *this, 41 ) ),
67 0 : Size( implMap( *this, 142 ), implMap( *this, 10 ) ) );
68 :
69 0 : maCBTinyProfile.Check( maConfigItem.ReadBool( OUString( SVG_PROP_TINYPROFILE ), false ) );
70 0 : maCBEmbedFonts.Check( maConfigItem.ReadBool( OUString( SVG_PROP_EMBEDFONTS ), true ) );
71 0 : maCBUseNativeDecoration.Check( maConfigItem.ReadBool( OUString( SVG_PROP_NATIVEDECORATION ), true ) );
72 :
73 : maBTOK.SetPosSizePixel( Point( implMap( *this, 12 ), implMap( *this, 57 ) ),
74 0 : Size( implMap( *this, 50 ), implMap( *this, 14 ) ) );
75 : maBTCancel.SetPosSizePixel( Point( implMap( *this, 65 ), implMap( *this, 57 ) ),
76 0 : Size( implMap( *this, 50 ), implMap( *this, 14 ) ) );
77 : maBTHelp.SetPosSizePixel( Point( implMap( *this, 121 ), implMap( *this, 57 ) ),
78 0 : Size( implMap( *this, 50 ), implMap( *this, 14 ) ) );
79 :
80 0 : maCBTinyProfile.SetToggleHdl( LINK( this, ImpSVGDialog, OnToggleCheckbox ) );
81 0 : OnToggleCheckbox( &maCBTinyProfile );
82 :
83 0 : maFI.Show();
84 :
85 0 : maCBTinyProfile.Show();
86 0 : maCBEmbedFonts.Show();
87 0 : maCBUseNativeDecoration.Show();
88 :
89 0 : maBTOK.Show();
90 0 : maBTCancel.Show();
91 0 : maBTHelp.Show();
92 0 : }
93 :
94 :
95 :
96 0 : ImpSVGDialog::~ImpSVGDialog()
97 : {
98 0 : }
99 :
100 :
101 :
102 0 : Sequence< PropertyValue > ImpSVGDialog::GetFilterData()
103 : {
104 0 : maConfigItem.WriteBool( OUString( SVG_PROP_TINYPROFILE ), maCBTinyProfile.IsChecked() );
105 0 : maConfigItem.WriteBool( OUString( SVG_PROP_EMBEDFONTS ), maCBEmbedFonts.IsChecked() );
106 0 : maConfigItem.WriteBool( OUString( SVG_PROP_NATIVEDECORATION ), maCBUseNativeDecoration.IsChecked() );
107 :
108 0 : return( maConfigItem.GetFilterData() );
109 : }
110 :
111 :
112 :
113 0 : IMPL_LINK( ImpSVGDialog, OnToggleCheckbox, CheckBox*, pBox )
114 : {
115 0 : if( pBox == &maCBTinyProfile )
116 : {
117 0 : if( pBox->IsChecked() )
118 : {
119 0 : mbOldNativeDecoration = maCBUseNativeDecoration.IsChecked();
120 :
121 0 : maCBUseNativeDecoration.Check( false );
122 0 : maCBUseNativeDecoration.Disable();
123 : }
124 : else
125 : {
126 0 : maCBUseNativeDecoration.Enable();
127 0 : maCBUseNativeDecoration.Check( mbOldNativeDecoration );
128 : }
129 : }
130 :
131 0 : return 0;
132 : }
133 :
134 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|