Rev 5184 | Rev 5447 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
4430 | cbradney | 1 | /* |
2 | For general Scribus (>=1.3.2) copyright and licensing information please refer |
||
3 | to the COPYING file provided with the program. Following this notice may exist |
||
4 | a copyright and/or license notice that predates the release of Scribus 1.3.2 |
||
5 | for which a new license (GPL+exception) is in place. |
||
6 | */ |
||
3 | paul | 7 | #include "editformats.h" |
8 | #include "editformats.moc" |
||
9 | #include "edit1format.h" |
||
10 | #include <qmessagebox.h> |
||
1884 | fschmid | 11 | #include <qheader.h> |
838 | cbradney | 12 | |
2952 | cbradney | 13 | #include "commonstrings.h" |
838 | cbradney | 14 | #include "scribusdoc.h" |
117 | Franz | 15 | #include "customfdialog.h" |
2856 | cbradney | 16 | #include "prefsmanager.h" |
415 | Franz | 17 | #include "prefsfile.h" |
1888 | fschmid | 18 | #include "scribusXml.h" |
3403 | fschmid | 19 | #include "page.h" |
3653 | fschmid | 20 | #include "sccombobox.h" |
4731 | subik | 21 | #include "util.h" |
410 | Franz | 22 | |
3 | paul | 23 | extern QPixmap loadIcon(QString nam); |
24 | |||
4731 | subik | 25 | |
3653 | fschmid | 26 | DelStyle::DelStyle(QWidget* parent, QValueList<ParagraphStyle> sty, QString styleName) |
4731 | subik | 27 | : QDialog( parent, "DelStyle", true, 0 ) |
3653 | fschmid | 28 | { |
4731 | subik | 29 | setName( "DelStyle" ); |
3653 | fschmid | 30 | setCaption( tr( "Delete Style" ) ); |
31 | setIcon(loadIcon("AppIcon.png")); |
||
32 | dialogLayout = new QVBoxLayout( this, 10, 5 ); |
||
33 | delStyleLayout = new QGridLayout; |
||
34 | delStyleLayout->setSpacing( 5 ); |
||
35 | delStyleLayout->setMargin( 5 ); |
||
36 | deleteLabel = new QLabel( tr( "Delete Style:" ), this, "deleteLabel" ); |
||
37 | delStyleLayout->addWidget( deleteLabel, 0, 0 ); |
||
38 | styleToDelLabel = new QLabel( styleName, this, "colorToDelLabel" ); |
||
39 | delStyleLayout->addWidget( styleToDelLabel, 0, 1 ); |
||
40 | replaceLabel = new QLabel( tr( "Replace With:" ), this, "replaceLabel" ); |
||
41 | delStyleLayout->addWidget( replaceLabel, 1, 0 ); |
||
42 | replacementStyleData = new ScComboBox(false, this); |
||
3850 | fschmid | 43 | replacementStyleData->insertItem( tr("No Style")); |
4731 | subik | 44 | |
45 | // sort the names in language specific order (PV) |
||
46 | QStringList existingStyles; |
||
3653 | fschmid | 47 | for (uint x = 5; x < sty.count(); ++x) |
48 | { |
||
5184 | avox | 49 | if (sty[x].name() != styleName) |
50 | existingStyles.append(sty[x].name()); |
||
3653 | fschmid | 51 | } |
4731 | subik | 52 | existingStyles = sortQStringList(existingStyles); |
53 | replacementStyleData->insertStringList(existingStyles); |
||
54 | |||
3653 | fschmid | 55 | delStyleLayout->addWidget( replacementStyleData, 1, 1 ); |
56 | replacementStyle = replacementStyleData->text(0); |
||
57 | dialogLayout->addLayout( delStyleLayout ); |
||
58 | okCancelLayout = new QHBoxLayout; |
||
59 | okCancelLayout->setSpacing( 6 ); |
||
60 | okCancelLayout->setMargin( 0 ); |
||
61 | QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); |
||
62 | okCancelLayout->addItem( spacer ); |
||
63 | okButton = new QPushButton( CommonStrings::tr_OK, this, "okButton" ); |
||
64 | okCancelLayout->addWidget( okButton ); |
||
65 | cancelButton = new QPushButton( CommonStrings::tr_Cancel, this, "PushButton13" ); |
||
66 | cancelButton->setDefault( true ); |
||
67 | okCancelLayout->addWidget( cancelButton ); |
||
68 | dialogLayout->addLayout( okCancelLayout ); |
||
69 | setMaximumSize(sizeHint()); |
||
70 | |||
71 | connect( okButton, SIGNAL( clicked() ), this, SLOT( accept() ) ); |
||
72 | connect( cancelButton, SIGNAL( clicked() ), this, SLOT( reject() ) ); |
||
73 | connect( replacementStyleData, SIGNAL(activated(int)), this, SLOT( ReplaceStyle(int) ) ); |
||
74 | } |
||
75 | |||
76 | void DelStyle::ReplaceStyle(int id) |
||
77 | { |
||
78 | replacementStyle = replacementStyleData->text(id); |
||
79 | } |
||
80 | |||
81 | const QString DelStyle::getReplacementStyle() |
||
82 | { |
||
83 | return replacementStyle; |
||
84 | } |
||
85 | |||
1884 | fschmid | 86 | ChooseStyles::ChooseStyles( QWidget* parent, QValueList<ParagraphStyle> *styleList, QValueList<ParagraphStyle> *styleOld) |
3653 | fschmid | 87 | : QDialog( parent, "ChooseStyles", true, 0 ) |
3 | paul | 88 | { |
1884 | fschmid | 89 | setCaption( tr( "Choose Styles" ) ); |
90 | setIcon(loadIcon("AppIcon.png")); |
||
91 | ChooseStylesLayout = new QVBoxLayout( this, 10, 5, "ChooseStylesLayout"); |
||
92 | StyleView = new QListView( this, "StyleView" ); |
||
93 | StyleView->clear(); |
||
94 | StyleView->addColumn( tr( "Available Styles" ) ); |
||
2680 | cbradney | 95 | StyleView->header()->setClickEnabled( false, StyleView->header()->count() - 1 ); |
96 | StyleView->header()->setResizeEnabled( false, StyleView->header()->count() - 1 ); |
||
1884 | fschmid | 97 | StyleView->setSorting(-1); |
98 | int counter = 5; |
||
2282 | fschmid | 99 | bool tabEQ = false; |
1884 | fschmid | 100 | for (uint x = 5; x < styleList->count(); ++x) |
101 | { |
||
5184 | avox | 102 | ParagraphStyle vg; |
103 | ParagraphStyle vg2; |
||
1884 | fschmid | 104 | vg = (*styleList)[x]; |
105 | bool found = false; |
||
106 | for (uint xx=0; xx<styleOld->count(); ++xx) |
||
107 | { |
||
108 | vg2 = (*styleOld)[xx]; |
||
5184 | avox | 109 | if (vg.name() == vg2.name()) |
1884 | fschmid | 110 | { |
5184 | avox | 111 | if (vg.equiv(vg2)) |
2282 | fschmid | 112 | { |
1884 | fschmid | 113 | found = true; |
114 | } |
||
115 | else |
||
116 | { |
||
5184 | avox | 117 | vg.setName("Copy of "+vg2.name()); |
1884 | fschmid | 118 | found = false; |
119 | } |
||
120 | break; |
||
121 | } |
||
122 | } |
||
123 | if (!found) |
||
124 | { |
||
5184 | avox | 125 | QCheckListItem *item = new QCheckListItem (StyleView, vg.name(), QCheckListItem::CheckBox); |
1884 | fschmid | 126 | item->setOn(true); |
127 | storedStyles.insert(item, counter); |
||
128 | } |
||
129 | counter++; |
||
130 | } |
||
1915 | fschmid | 131 | StyleView->setSorting(0); |
1884 | fschmid | 132 | ChooseStylesLayout->addWidget( StyleView ); |
133 | layout2 = new QHBoxLayout( 0, 0, 5, "layout2"); |
||
134 | QSpacerItem* spacer1 = new QSpacerItem( 71, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); |
||
135 | layout2->addItem( spacer1 ); |
||
3135 | cbradney | 136 | OkButton = new QPushButton( CommonStrings::tr_OK, this, "OkButton" ); |
1884 | fschmid | 137 | layout2->addWidget( OkButton ); |
3135 | cbradney | 138 | CancelButton = new QPushButton( CommonStrings::tr_Cancel, this, "CancelButton" ); |
1884 | fschmid | 139 | layout2->addWidget( CancelButton ); |
140 | ChooseStylesLayout->addLayout( layout2 ); |
||
141 | resize(230, 280); |
||
142 | clearWState( WState_Polished ); |
||
143 | connect(CancelButton, SIGNAL(clicked()), this, SLOT(reject())); |
||
144 | connect(OkButton, SIGNAL(clicked()), this, SLOT(accept())); |
||
145 | } |
||
146 | |||
2834 | cbradney | 147 | StilFormate::StilFormate( QWidget* parent, ScribusDoc *doc) : QDialog( parent, "Formate", true, 0) |
1884 | fschmid | 148 | { |
225 | Franz | 149 | resize( 327, 260 ); |
150 | setCaption( tr( "Edit Styles" ) ); |
||
151 | setIcon(loadIcon("AppIcon.png")); |
||
161 | Franz | 152 | Docu = doc; |
3642 | fschmid | 153 | ReplaceList.clear(); |
225 | Franz | 154 | StilFormateLayout = new QHBoxLayout( this ); |
155 | StilFormateLayout->setSpacing( 5 ); |
||
156 | StilFormateLayout->setMargin( 10 ); |
||
3 | paul | 157 | |
225 | Franz | 158 | ListBox1 = new QListBox( this, "ListBox1" ); |
159 | ListBox1->setMinimumSize( QSize( 200, 240 ) ); |
||
160 | StilFormateLayout->addWidget( ListBox1 ); |
||
3 | paul | 161 | |
225 | Franz | 162 | Layout15 = new QVBoxLayout; |
163 | Layout15->setSpacing( 6 ); |
||
164 | Layout15->setMargin( 0 ); |
||
3 | paul | 165 | |
2952 | cbradney | 166 | LoadS = new QPushButton( tr( "&Import" ), this, "LoadF" ); |
225 | Franz | 167 | Layout15->addWidget( LoadS ); |
117 | Franz | 168 | |
340 | Franz | 169 | NewB = new QPushButton( tr( "&New" ), this, "NewB" ); |
225 | Franz | 170 | Layout15->addWidget( NewB ); |
3 | paul | 171 | |
340 | Franz | 172 | EditB = new QPushButton( tr( "&Edit" ), this, "EditB" ); |
225 | Franz | 173 | EditB->setDefault( true ); |
174 | EditB->setEnabled(false); |
||
175 | Layout15->addWidget( EditB ); |
||
3 | paul | 176 | |
340 | Franz | 177 | DublicateB = new QPushButton( tr( "D&uplicate" ), this, "DublicateB" ); |
225 | Franz | 178 | DublicateB->setEnabled(false); |
179 | Layout15->addWidget( DublicateB ); |
||
3 | paul | 180 | |
340 | Franz | 181 | DeleteB = new QPushButton( tr( "&Delete" ), this, "DeleteB" ); |
225 | Franz | 182 | DeleteB->setEnabled(false); |
183 | Layout15->addWidget( DeleteB ); |
||
3 | paul | 184 | |
2952 | cbradney | 185 | SaveB = new QPushButton( CommonStrings::tr_Save, this, "SaveB" ); |
225 | Franz | 186 | Layout15->addWidget( SaveB ); |
3 | paul | 187 | |
2952 | cbradney | 188 | ExitB = new QPushButton( CommonStrings::tr_OK, this, "ExitB" ); |
225 | Franz | 189 | Layout15->addWidget( ExitB ); |
222 | Franz | 190 | |
2952 | cbradney | 191 | CancelB = new QPushButton( CommonStrings::tr_Cancel, this, "CancelB" ); |
225 | Franz | 192 | Layout15->addWidget( CancelB ); |
193 | QSpacerItem* spacer = new QSpacerItem( 0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding ); |
||
194 | Layout15->addItem( spacer ); |
||
195 | StilFormateLayout->addLayout( Layout15 ); |
||
3 | paul | 196 | |
225 | Franz | 197 | // signals and slots connections |
198 | connect(CancelB, SIGNAL(clicked()), this, SLOT(reject())); |
||
199 | connect(SaveB, SIGNAL(clicked()), this, SLOT(saveIt())); |
||
200 | connect(ExitB, SIGNAL(clicked()), this, SLOT(accept())); |
||
201 | connect(EditB, SIGNAL(clicked()), this, SLOT(editFormat())); |
||
202 | connect(NewB, SIGNAL(clicked()), this, SLOT(neuesFormat())); |
||
203 | connect(LoadS, SIGNAL(clicked()), this, SLOT(loadStyles())); |
||
204 | connect(DublicateB, SIGNAL(clicked()), this, SLOT(dupFormat())); |
||
205 | connect(DeleteB, SIGNAL(clicked()), this, SLOT(deleteFormat())); |
||
206 | connect(ListBox1, SIGNAL(highlighted(QListBoxItem*)), this, SLOT(selFormat(QListBoxItem*))); |
||
3135 | cbradney | 207 | connect(ListBox1, SIGNAL(selected(QListBoxItem*)), this, SLOT(selEditFormat(QListBoxItem*))); |
1065 | cbradney | 208 | TempVorl = doc->docParagraphStyles; |
225 | Franz | 209 | UpdateFList(); |
3 | paul | 210 | } |
211 | |||
222 | Franz | 212 | void StilFormate::saveIt() |
213 | { |
||
214 | emit saveStyle(this); |
||
215 | } |
||
216 | |||
3 | paul | 217 | void StilFormate::selFormat(QListBoxItem *c) |
218 | { |
||
175 | Franz | 219 | for (uint x = 5; x < TempVorl.count(); ++x) |
223 | Franz | 220 | { |
5184 | avox | 221 | if (TempVorl[x].name() == c->text()) |
175 | Franz | 222 | { |
223 | sFnumber = x; |
||
224 | break; |
||
225 | } |
||
223 | Franz | 226 | } |
225 | Franz | 227 | EditB->setEnabled(true); |
228 | DublicateB->setEnabled(true); |
||
229 | DeleteB->setEnabled(true); |
||
3 | paul | 230 | } |
231 | |||
271 | Franz | 232 | void StilFormate::selEditFormat(QListBoxItem *c) |
233 | { |
||
234 | for (uint x = 5; x < TempVorl.count(); ++x) |
||
235 | { |
||
5184 | avox | 236 | if (TempVorl[x].name() == c->text()) |
271 | Franz | 237 | { |
238 | sFnumber = x; |
||
239 | break; |
||
240 | } |
||
241 | } |
||
242 | EditB->setEnabled(true); |
||
243 | DublicateB->setEnabled(true); |
||
244 | DeleteB->setEnabled(true); |
||
245 | editFormat(); |
||
246 | } |
||
247 | |||
3 | paul | 248 | void StilFormate::dupFormat() |
249 | { |
||
5184 | avox | 250 | ParagraphStyle sty; // = TempVorl[sFnumber]; |
251 | sty.setName(tr("Copy of %1").arg(TempVorl[sFnumber].name())); |
||
252 | sty.setLineSpacingMode(static_cast<ParagraphStyle::LineSpacingMode>(TempVorl[sFnumber].lineSpacingMode())); |
||
253 | sty.setLineSpacing(TempVorl[sFnumber].lineSpacing()); |
||
254 | sty.setAlignment(TempVorl[sFnumber].alignment()); |
||
255 | sty.setLeftMargin(TempVorl[sFnumber].leftMargin()); |
||
256 | sty.setRightMargin(TempVorl[sFnumber].rightMargin()); |
||
257 | sty.setFirstIndent(TempVorl[sFnumber].firstIndent()); |
||
258 | sty.setGapBefore(TempVorl[sFnumber].gapBefore()); |
||
259 | sty.setGapAfter(TempVorl[sFnumber].gapAfter()); |
||
260 | sty.setHasDropCap(TempVorl[sFnumber].hasDropCap()); |
||
261 | sty.setDropCapLines(TempVorl[sFnumber].dropCapLines()); |
||
262 | sty.setDropCapOffset(TempVorl[sFnumber].dropCapOffset()); |
||
263 | sty.setUseBaselineGrid(TempVorl[sFnumber].useBaselineGrid()); |
||
264 | sty.tabValues() = TempVorl[sFnumber].tabValues(); |
||
265 | sty.charStyle() = TempVorl[sFnumber].charStyle(); |
||
225 | Franz | 266 | TempVorl.append(sty); |
267 | sFnumber = TempVorl.count()-1; |
||
3653 | fschmid | 268 | EditStyle* dia2 = new EditStyle(this, &TempVorl[sFnumber], TempVorl, true, |
2965 | cbradney | 269 | static_cast<double>(Docu->typographicSettings.autoLineSpacing), Docu->unitIndex(), Docu); |
161 | Franz | 270 | if (!dia2->exec()) |
271 | TempVorl.remove(TempVorl.fromLast()); |
||
225 | Franz | 272 | delete dia2; |
161 | Franz | 273 | UpdateFList(); |
3 | paul | 274 | } |
275 | |||
276 | void StilFormate::neuesFormat() |
||
277 | { |
||
4060 | cbradney | 278 | int selectedIndex=ListBox1->currentItem(); |
279 | int topIndex=ListBox1->topItem(); |
||
5215 | mrdocs | 280 | ParagraphStyle sty; |
5184 | avox | 281 | sty.setName(tr("New Style")); |
282 | sty.setLineSpacingMode(static_cast<ParagraphStyle::LineSpacingMode>(0)); |
||
283 | sty.setLineSpacing(((Docu->toolSettings.defSize / 10.0) * |
||
284 | static_cast<double>(Docu->typographicSettings.autoLineSpacing) / 100) |
||
285 | + (Docu->toolSettings.defSize / 10.0)); |
||
286 | sty.setAlignment(0); |
||
287 | sty.setLeftMargin(0); |
||
288 | sty.setRightMargin(0); |
||
289 | sty.setFirstIndent(0); |
||
290 | sty.setGapBefore(0); |
||
291 | sty.setGapAfter(0); |
||
292 | sty.charStyle() = CharStyle(PrefsManager::instance()->appPrefs.AvailFonts[Docu->toolSettings.defFont], |
||
293 | Docu->toolSettings.defSize); |
||
294 | sty.tabValues().clear(); |
||
295 | sty.setHasDropCap(false); |
||
296 | sty.setDropCapLines(2); |
||
297 | sty.setDropCapOffset(0); |
||
298 | sty.charStyle().ccolor = Docu->toolSettings.dBrush; |
||
299 | sty.charStyle().cshade = Docu->toolSettings.dShade; |
||
300 | sty.charStyle().cstroke = Docu->toolSettings.dPen; |
||
301 | sty.charStyle().cshade2 = Docu->toolSettings.dShade2; |
||
302 | sty.setUseBaselineGrid(false); |
||
303 | sty.charStyle().cshadowx = 50; |
||
304 | sty.charStyle().cshadowy = -50; |
||
305 | sty.charStyle().coutline = 10; |
||
306 | sty.charStyle().cunderpos = Docu->typographicSettings.valueUnderlinePos; |
||
307 | sty.charStyle().cunderwidth = Docu->typographicSettings.valueUnderlineWidth; |
||
308 | sty.charStyle().cstrikepos = Docu->typographicSettings.valueStrikeThruPos; |
||
309 | sty.charStyle().cstrikewidth = Docu->typographicSettings.valueStrikeThruPos; |
||
310 | sty.charStyle().cscale = 1000; |
||
311 | sty.charStyle().cscalev = 1000; |
||
312 | sty.charStyle().cbase = 0; |
||
313 | sty.charStyle().cextra = 0; |
||
225 | Franz | 314 | TempVorl.append(sty); |
315 | sFnumber = TempVorl.count()-1; |
||
2965 | cbradney | 316 | EditStyle* dia2 = new EditStyle(this, &TempVorl[sFnumber], TempVorl, true, static_cast<double>(Docu->typographicSettings.autoLineSpacing), Docu->unitIndex(), Docu); |
161 | Franz | 317 | if (!dia2->exec()) |
318 | TempVorl.remove(TempVorl.fromLast()); |
||
225 | Franz | 319 | delete dia2; |
161 | Franz | 320 | UpdateFList(); |
4060 | cbradney | 321 | ListBox1->setSelected(selectedIndex, true); |
322 | ListBox1->setTopItem(topIndex); |
||
3 | paul | 323 | } |
324 | |||
325 | void StilFormate::editFormat() |
||
326 | { |
||
4060 | cbradney | 327 | int selectedIndex=ListBox1->currentItem(); |
328 | int topIndex=ListBox1->topItem(); |
||
3653 | fschmid | 329 | EditStyle* dia = new EditStyle(this, &TempVorl[sFnumber], TempVorl, false, |
2965 | cbradney | 330 | static_cast<double>(Docu->typographicSettings.autoLineSpacing), Docu->unitIndex(), Docu); |
3 | paul | 331 | dia->exec(); |
332 | delete dia; |
||
333 | UpdateFList(); |
||
4060 | cbradney | 334 | ListBox1->setSelected(selectedIndex, true); |
335 | ListBox1->setTopItem(topIndex); |
||
3 | paul | 336 | } |
337 | |||
338 | void StilFormate::deleteFormat() |
||
339 | { |
||
3653 | fschmid | 340 | /* int exit=QMessageBox::warning(this, |
3510 | cbradney | 341 | CommonStrings::trWarning, |
3135 | cbradney | 342 | tr("Do you really want to delete this style?"), |
225 | Franz | 343 | tr("No"), |
344 | tr("Yes"), |
||
3653 | fschmid | 345 | 0, 0, 0); */ |
223 | Franz | 346 | /* PFJ - 29.02.04 - Altered to use the correct QMessageBox value. It was 1 */ |
232 | Franz | 347 | /* FS - 13.03.04 the 1 is correct in this version of QMessageBox, it returns the Nr of the clicked Button either 0 or 1 or 2 */ |
3653 | fschmid | 348 | // if (exit == 1) |
4060 | cbradney | 349 | int selectedIndex=ListBox1->currentItem(); |
350 | int topIndex=ListBox1->topItem(); |
||
5184 | avox | 351 | DelStyle *dia = new DelStyle(this, TempVorl, TempVorl[sFnumber].name()); |
3653 | fschmid | 352 | if (dia->exec()) |
161 | Franz | 353 | { |
5184 | avox | 354 | if (ReplaceList.values().contains(TempVorl[sFnumber].name())) |
3653 | fschmid | 355 | { |
356 | QMap<QString,QString>::Iterator it; |
||
357 | for (it = ReplaceList.begin(); it != ReplaceList.end(); ++it) |
||
358 | { |
||
5184 | avox | 359 | if (it.data() == TempVorl[sFnumber].name()) |
3653 | fschmid | 360 | it.data() = dia->getReplacementStyle(); |
361 | } |
||
362 | } |
||
5184 | avox | 363 | ReplaceList.insert(TempVorl[sFnumber].name(), dia->getReplacementStyle()); |
3 | paul | 364 | ListBox1->removeItem(sFnumber); |
365 | TempVorl.remove(TempVorl.at(sFnumber)); |
||
366 | UpdateFList(); |
||
161 | Franz | 367 | } |
3653 | fschmid | 368 | delete dia; |
4060 | cbradney | 369 | int listBoxCount=ListBox1->count(); |
370 | if (listBoxCount>selectedIndex) |
||
371 | ListBox1->setSelected(selectedIndex, true); |
||
372 | if (listBoxCount>topIndex) |
||
373 | ListBox1->setTopItem(topIndex); |
||
3 | paul | 374 | } |
375 | |||
117 | Franz | 376 | void StilFormate::loadStyles() |
377 | { |
||
2856 | cbradney | 378 | PrefsContext* dirs = PrefsManager::instance()->prefsFile->getContext("dirs"); |
415 | Franz | 379 | QString wdir = dirs->get("editformats", "."); |
117 | Franz | 380 | #ifdef HAVE_LIBZ |
415 | Franz | 381 | CustomFDialog dia(this, wdir, tr("Open"), tr("Documents (*.sla *.sla.gz *.scd *.scd.gz);;All Files (*)")); |
117 | Franz | 382 | #else |
415 | Franz | 383 | CustomFDialog dia(this, wdir, tr("Open"), tr("Documents (*.sla *.scd);;All Files (*)")); |
117 | Franz | 384 | #endif |
385 | if (dia.exec() == QDialog::Accepted) |
||
410 | Franz | 386 | { |
415 | Franz | 387 | QString selectedFile = dia.selectedFile(); |
388 | dirs->set("editformats", selectedFile.left(selectedFile.findRev("/"))); |
||
1884 | fschmid | 389 | QValueList<ParagraphStyle> TempVorl2; |
390 | for (uint x = 0; x < 5; ++x) |
||
391 | { |
||
392 | TempVorl2.append(TempVorl[x]); |
||
393 | } |
||
394 | Docu->loadStylesFromFile(selectedFile, &TempVorl2); |
||
395 | ChooseStyles* dia2 = new ChooseStyles(this, &TempVorl2, &TempVorl); |
||
396 | if (dia2->exec()) |
||
397 | { |
||
1888 | fschmid | 398 | QStringList neededColors; |
399 | neededColors.clear(); |
||
1884 | fschmid | 400 | QMap<QCheckListItem*, int>::Iterator it; |
401 | for (it = dia2->storedStyles.begin(); it != dia2->storedStyles.end(); ++it) |
||
402 | { |
||
5184 | avox | 403 | ParagraphStyle sty; |
1884 | fschmid | 404 | if (it.key()->isOn()) |
1888 | fschmid | 405 | { |
406 | sty = TempVorl2[it.data()]; |
||
407 | TempVorl.append(sty); |
||
5184 | avox | 408 | if ((!Docu->PageColors.contains(sty.charStyle().cstroke)) && (!neededColors.contains(sty.charStyle().cstroke))) |
409 | neededColors.append(sty.charStyle().cstroke); |
||
410 | if ((!Docu->PageColors.contains(sty.charStyle().ccolor)) && (!neededColors.contains(sty.charStyle().ccolor))) |
||
411 | neededColors.append(sty.charStyle().ccolor); |
||
1888 | fschmid | 412 | } |
1884 | fschmid | 413 | } |
1888 | fschmid | 414 | if (!neededColors.isEmpty()) |
415 | { |
||
416 | ScriXmlDoc *ss = new ScriXmlDoc(); |
||
417 | if (ss->ReadColors(selectedFile)) |
||
418 | { |
||
419 | ColorList LColors = ss->Farben; |
||
420 | ColorList::Iterator itc; |
||
421 | for (itc = LColors.begin(); itc != LColors.end(); ++itc) |
||
422 | { |
||
423 | if (neededColors.contains(itc.key())) |
||
424 | Docu->PageColors.insert(itc.key(), itc.data()); |
||
425 | } |
||
426 | } |
||
427 | delete ss; |
||
428 | } |
||
1884 | fschmid | 429 | } |
410 | Franz | 430 | UpdateFList(); |
431 | } |
||
117 | Franz | 432 | else |
433 | return; |
||
408 | Franz | 434 | } |
435 | |||
3 | paul | 436 | void StilFormate::UpdateFList() |
437 | { |
||
232 | Franz | 438 | ListBox1->clear(); |
3 | paul | 439 | if (TempVorl.count() < 6) |
440 | return; |
||
441 | for (uint x = 5; x < TempVorl.count(); ++x) |
||
5184 | avox | 442 | ListBox1->insertItem(TempVorl[x].name()); |
3 | paul | 443 | if (ListBox1->currentItem() == -1) |
225 | Franz | 444 | { |
445 | DublicateB->setEnabled(false); |
||
446 | EditB->setEnabled(false); |
||
161 | Franz | 447 | DeleteB->setEnabled(false); |
225 | Franz | 448 | } |
223 | Franz | 449 | ListBox1->sort( true ); |
3 | paul | 450 | ListBox1->setSelected(ListBox1->currentItem(), false); |
451 | } |