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 <res_Titles.hxx>
21 #include <TitleDialogData.hxx>
22 #include <svtools/controldims.hxx>
27 TitleResources::TitleResources( VclBuilderContainer
& rBuilder
, bool bShowSecondaryAxesTitle
)
29 rBuilder
.get( m_pFT_Main
, "labelMainTitle" );
30 rBuilder
.get( m_pFT_Sub
, "labelSubTitle" );
31 rBuilder
.get( m_pEd_Main
, "maintitle" );
32 rBuilder
.get( m_pEd_Sub
, "subtitle" );
34 rBuilder
.get( m_pFT_XAxis
, "labelPrimaryXaxis" );
35 rBuilder
.get( m_pFT_YAxis
, "labelPrimaryYaxis" );
36 rBuilder
.get( m_pFT_ZAxis
, "labelPrimaryZaxis" );
37 rBuilder
.get( m_pEd_XAxis
, "primaryXaxis" );
38 rBuilder
.get( m_pEd_YAxis
, "primaryYaxis" );
39 rBuilder
.get( m_pEd_ZAxis
, "primaryZaxis" );
41 rBuilder
.get( m_pFT_SecondaryXAxis
, "labelSecondaryXAxis" );
42 rBuilder
.get( m_pFT_SecondaryYAxis
, "labelSecondaryYAxis" );
43 rBuilder
.get( m_pEd_SecondaryXAxis
, "secondaryXaxis" );
44 rBuilder
.get( m_pEd_SecondaryYAxis
, "secondaryYaxis" );
46 m_pFT_SecondaryXAxis
->Show( bShowSecondaryAxesTitle
);
47 m_pFT_SecondaryYAxis
->Show( bShowSecondaryAxesTitle
);
48 m_pEd_SecondaryXAxis
->Show( bShowSecondaryAxesTitle
);
49 m_pEd_SecondaryYAxis
->Show( bShowSecondaryAxesTitle
);
52 TitleResources::~TitleResources()
56 void TitleResources::SetUpdateDataHdl( const Link
<Edit
&,void>& rLink
)
58 sal_uLong nTimeout
= 4*EDIT_UPDATEDATA_TIMEOUT
;
60 m_pEd_Main
->EnableUpdateData( nTimeout
);
61 m_pEd_Main
->SetUpdateDataHdl( rLink
);
63 m_pEd_Sub
->EnableUpdateData( nTimeout
);
64 m_pEd_Sub
->SetUpdateDataHdl( rLink
);
66 m_pEd_XAxis
->EnableUpdateData( nTimeout
);
67 m_pEd_XAxis
->SetUpdateDataHdl( rLink
);
69 m_pEd_YAxis
->EnableUpdateData( nTimeout
);
70 m_pEd_YAxis
->SetUpdateDataHdl( rLink
);
72 m_pEd_ZAxis
->EnableUpdateData( nTimeout
);
73 m_pEd_ZAxis
->SetUpdateDataHdl( rLink
);
75 m_pEd_SecondaryXAxis
->EnableUpdateData( nTimeout
);
76 m_pEd_SecondaryXAxis
->SetUpdateDataHdl( rLink
);
78 m_pEd_SecondaryYAxis
->EnableUpdateData( nTimeout
);
79 m_pEd_SecondaryYAxis
->SetUpdateDataHdl( rLink
);
82 bool TitleResources::IsModified()
84 return m_pEd_Main
->IsModified()
85 || m_pEd_Sub
->IsModified()
86 || m_pEd_XAxis
->IsModified()
87 || m_pEd_YAxis
->IsModified()
88 || m_pEd_ZAxis
->IsModified()
89 || m_pEd_SecondaryXAxis
->IsModified()
90 || m_pEd_SecondaryYAxis
->IsModified();
93 void TitleResources::ClearModifyFlag()
95 m_pEd_Main
->ClearModifyFlag();
96 m_pEd_Sub
->ClearModifyFlag();
97 m_pEd_XAxis
->ClearModifyFlag();
98 m_pEd_YAxis
->ClearModifyFlag();
99 m_pEd_ZAxis
->ClearModifyFlag();
100 m_pEd_SecondaryXAxis
->ClearModifyFlag();
101 m_pEd_SecondaryYAxis
->ClearModifyFlag();
104 void TitleResources::writeToResources( const TitleDialogData
& rInput
)
106 m_pFT_Main
->Enable( rInput
.aPossibilityList
[0] );
107 m_pFT_Sub
->Enable( rInput
.aPossibilityList
[1] );
108 m_pFT_XAxis
->Enable( rInput
.aPossibilityList
[2] );
109 m_pFT_YAxis
->Enable( rInput
.aPossibilityList
[3] );
110 m_pFT_ZAxis
->Enable( rInput
.aPossibilityList
[4] );
111 m_pFT_SecondaryXAxis
->Enable( rInput
.aPossibilityList
[5] );
112 m_pFT_SecondaryYAxis
->Enable( rInput
.aPossibilityList
[6] );
114 m_pEd_Main
->Enable( rInput
.aPossibilityList
[0] );
115 m_pEd_Sub
->Enable( rInput
.aPossibilityList
[1] );
116 m_pEd_XAxis
->Enable( rInput
.aPossibilityList
[2] );
117 m_pEd_YAxis
->Enable( rInput
.aPossibilityList
[3] );
118 m_pEd_ZAxis
->Enable( rInput
.aPossibilityList
[4] );
119 m_pEd_SecondaryXAxis
->Enable( rInput
.aPossibilityList
[5] );
120 m_pEd_SecondaryYAxis
->Enable( rInput
.aPossibilityList
[6] );
122 m_pEd_Main
->SetText(rInput
.aTextList
[0]);
123 m_pEd_Sub
->SetText(rInput
.aTextList
[1]);
124 m_pEd_XAxis
->SetText(rInput
.aTextList
[2]);
125 m_pEd_YAxis
->SetText(rInput
.aTextList
[3]);
126 m_pEd_ZAxis
->SetText(rInput
.aTextList
[4]);
127 m_pEd_SecondaryXAxis
->SetText(rInput
.aTextList
[5]);
128 m_pEd_SecondaryYAxis
->SetText(rInput
.aTextList
[6]);
131 void TitleResources::readFromResources( TitleDialogData
& rOutput
)
133 rOutput
.aExistenceList
[0] = !m_pEd_Main
->GetText().isEmpty();
134 rOutput
.aExistenceList
[1] = !m_pEd_Sub
->GetText().isEmpty();
135 rOutput
.aExistenceList
[2] = !m_pEd_XAxis
->GetText().isEmpty();
136 rOutput
.aExistenceList
[3] = !m_pEd_YAxis
->GetText().isEmpty();
137 rOutput
.aExistenceList
[4] = !m_pEd_ZAxis
->GetText().isEmpty();
138 rOutput
.aExistenceList
[5] = !m_pEd_SecondaryXAxis
->GetText().isEmpty();
139 rOutput
.aExistenceList
[6] = !m_pEd_SecondaryYAxis
->GetText().isEmpty();
141 rOutput
.aTextList
[0] = m_pEd_Main
->GetText();
142 rOutput
.aTextList
[1] = m_pEd_Sub
->GetText();
143 rOutput
.aTextList
[2] = m_pEd_XAxis
->GetText();
144 rOutput
.aTextList
[3] = m_pEd_YAxis
->GetText();
145 rOutput
.aTextList
[4] = m_pEd_ZAxis
->GetText();
146 rOutput
.aTextList
[5] = m_pEd_SecondaryXAxis
->GetText();
147 rOutput
.aTextList
[6] = m_pEd_SecondaryYAxis
->GetText();
152 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */