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