View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0011277 | Scribus | Story Editor / Text Frames | public | 2012-12-18 14:44 | 2019-09-24 13:21 |
Reporter | cezaryece | Assigned To | |||
Priority | normal | Severity | feature | Reproducibility | N/A |
Status | closed | Resolution | fixed | ||
Product Version | 1.5.0svn | ||||
Summary | 0011277: [OBSOLETE][patch] numeration and bullets | ||||
Description | New file numeration.patch fixing the problems that have been raised. | ||||
Additional Information | My kids urgently need the patch applied to the trunk for writing their whishes list to Santa! Please, review and if well then apply! | ||||
Tags | No tags attached. | ||||
Patch | Yes | ||||
related to | 0011228 | closed | cezaryece | Scribus | [PATCH] bulleted and numbered lists |
related to | 0014347 | confirmed | Scribus | PP displays incorrect informations for numerated lists | |
related to | 0015827 | new | Scribus | lists: remove the limit for the maximum effect | |
related to | 0015828 | new | Scribus | correctly show the number type when first setting the numerated lists |
|
I have the patch applied here. I found a first issue : - new doc, new text frame - enter text edit mode - enable bullets - type a few lines - try to return to "No Paragraph effect" - doesn't work... |
|
Cezary, if you are going to submit new bugs and close old ones, please at least relate them. If not, then please just use existing bugs, but ensure you use logical naming with numbers or dates in the patch file names. Thanks! |
|
Second issue : applying bullets (or any other paragraph effects) directly at frame level doesn't work either. |
|
@Second issue: - open scribus - create a new file - create a text frame and don't unselect it and don't enter edit modus - go to the PP and try to apply the bullets - you can choose the corresponding radio button but the details are not activated this only happens the first time you go to the "paragraph effects" tab after starting scribus. if you create a new file and have already tried to apply the effect the problem does not show up. you have to restart scribus. p.s.: directly entering the edit mode shows the same problem, it's not related to applying the formatting to the whole frame |
|
No the second issue is this one : - new doc, new text frame - insert sample text - go to the PP and try to apply bullets (or drop cap...) - ... no effects |
|
@First issue: this issue seems to be related to an "aberration" in the way the values are shown in the PP for the last character in the frame. if you move the cursor to another place in the frame, it works correctly. if you are the end of the frame, the effect gets changed when you click on the corresponding radio button, but the display in the PP is not correct. |
|
@jghali && second issue: try to create a second frame after having tried on the first frame: - new doc, new text frame - insert sample text - go to the PP and try to apply bullets (or drop cap...) - ... no effects - new text frame - insert sample text - apply bullets (or drop cap...) - ... effects this also works: - new doc, new text frame - insert sample text - go to the PP and try to apply bullets (or drop cap...) - ... no effects - new doc new text frame - insert sample text - apply bullets (or drop cap...) - ... effects this also works: - new doc, new text frame - insert sample text - go to the PP and try to apply bullets (or drop cap...) - ... no effects - unselect text frame - reselect text frame - apply bullets (or drop cap...) - ... effects it really seem to bug the first time you apply the effect after having started scribus. |
|
I have upload new patch fixing second issue reported above (and some others found in the meantime). About first issue: as ale wrote there is some bug in properly reading paragraph style properties at the end of text. Notice that there is problem with others paragraph style properties too. If cursor is after last character in story you are able to change all paragraph style property from PP (line spacing, orphans/widows or optic margins) but any of these changes are shown in PP until cursor is at the end of text. |
|
i like the idea of have common settings for those effects. it seems to work well for what i've seen now. I think the ui could be more condensed using buttons instead of radio buttons. in paragraph effects widget : - use buttons to say which effect the user wants - display only this one + settings - instead of a dropdown, display most common bullet in a grid (like in glyph window) - should have the same ui in style dialog |
|
|
|
Are there other issues that need fixing? |
|
Craig, I think there are any issues blocking merging of feature. Changes in UI is polishing only and can be done in the future after wider discus with users using this feature. numeration3.patch is diff against current trunk code. Commit it, please!!! |
|
i somewhat agree with cezaryece, most thing i'd have to say are more requests. Only small things : 1. When I use standard dotted bullet, and want to switch to a custom glyph, the glyph i select in the caracter window is added after the dot, not in place of. So that i at the end have 2 bullets on each line. I guess this is not what most people will be waiting for. Is done in style too. 2. when using numbering, switch from <local block> option to the other, get crash (happens only when changing in PP, it seems to work when using from para style) : #0 0xb7fdd424 in __kernel_vsyscall () 0000001 0xb50021df in raise () from /lib/i386-linux-gnu/libc.so.6 0000002 0xb5005825 in abort () from /lib/i386-linux-gnu/libc.so.6 0000003 0xb56ac616 in qt_message_output ( msgType=QtFatalMsg, buf=0x9c432e0 "ASSERT: \"numS\" in file /home/cedric/sources/scribus/Scribus/scribus/ui/propertywidget_pareffect.cpp, line 406") at global/qglobal.cpp:2276 0000004 0xb56aca4b in qt_message (msgType=QtFatalMsg, msg=0xb5839138 "ASSERT: \"%s\" in file %s, line %d", ap=0xbfffdc84 "\215\255\337\b@\255\337\b\226\001") at global/qglobal.cpp:2322 0000005 0xb56acb68 in qFatal ( msg=0xb5839138 "ASSERT: \"%s\" in file %s, line %d") at global/qglobal.cpp:2505 0000006 0xb56acbf5 in qt_assert ( assertion=0x8dfad8d "numS", file=0x8dfad40 "/home/cedric/sources/scribus/Scribus/scribus/ui/propertywidget_pareffect.cpp", line=406) at global/qglobal.cpp:2002 0000007 0x08b42312 in ?? () 0000008 0x08322d05 in ?? () 0000009 0xb57e36b1 in QMetaObject::activate ( sender=0x9c86e68, m=0xb6571c04, local_signal_index=2, argv=0xbfffe058) at kernel/qobject.cpp:3547 0000010 0xb603e7d5 in QComboBox::activated ( this=0x9c86e68, _t1=...) at .moc/release-shared/moc_qcombobox.cpp:295 0000011 0xb603e850 in QComboBoxPrivate::emitActivated ( this=0x9c86e80, index=...) at widgets/qcombobox.cpp:1262 0000012 0xb603fcd2 in QComboBoxPrivate::_q_itemSelected ( this=0x9c86e80, item=...) at widgets/qcombobox.cpp:1252 0000013 0xb57e36b1 in QMetaObject::activate ( sender=0xa099068, m=0xb6580f94, local_signal_index=0, argv=0xbfffe1c8) at kernel/qobject.cpp:3547 0000014 0xb632e025 in QComboBoxPrivateContainer::itemSelected (this=0xa099068, _t1=...) at .moc/release-shared/moc_qcombobox_p.cpp:253 0000015 0xb6038f8f in QComboBoxPrivateContainer::eventFilter (this=0xa099068, o=0x9c86dc0, e=0xbfffe284) at widgets/qcombobox.cpp:691 0000016 0xb57ccb16 in QCoreApplicationPrivate::sendThroughObjectEventFilters (this=0x90be618, receiver=0x9c86dc0, event=0xbfffe714) at kernel/qcoreapplication.cpp:986 0000017 0xb5bf4ea2 in notify_helper (e=0xbfffe714, ---Type <return> to continue, or q <return> to quit--- receiver=0x9c86dc0, this=0x90be618) at kernel/qapplication.cpp:4555 0000018 QApplicationPrivate::notify_helper ( this=0x90be618, receiver=0x9c86dc0, e=0xbfffe714) at kernel/qapplication.cpp:4531 0000019 0xb5bfb024 in QApplication::notify ( this=0x90be618, receiver=0x9c86dc0, e=0xbfffe714) at kernel/qapplication.cpp:4102 0000020 0xb57cc97e in QCoreApplication::notifyInternal ( this=0xbfffef24, receiver=0x9c86dc0, event=0xbfffe714) at kernel/qcoreapplication.cpp:876 0000021 0xb5bf5e95 in sendEvent (event=<optimized out>, receiver=<optimized out>) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:231 0000022 QApplicationPrivate::sendMouseEvent (receiver= 0x9c86dc0, event=0xbfffe714, alienWidget=0x9c86dc0, nativeWidget=0xa099068, buttonDown=0xb6589cf4, lastMouseReceiver=..., spontaneous=true) at kernel/qapplication.cpp:3170 0000023 0xb5c827d2 in QETWidget::translateMouseEvent ( this=0xa099068, event=0xbfffebcc) at kernel/qapplication_x11.cpp:4551 0000024 0xb5c80c0d in QApplication::x11ProcessEvent ( this=0xbfffef24, event=0xbfffebcc) at kernel/qapplication_x11.cpp:3732 0000025 0xb5cadeac in x11EventSourceDispatch ( s=0x90c16e8, callback=0, user_data=0x0) at kernel/qguieventdispatcher_glib.cpp:146 0000026 0xb4a39d86 in g_main_context_dispatch () from /lib/i386-linux-gnu/libglib-2.0.so.0 0000027 0xb4a3a125 in ?? () from /lib/i386-linux-gnu/libglib-2.0.so.0 0000028 0xb4a3a201 in g_main_context_iteration () from /lib/i386-linux-gnu/libglib-2.0.so.0 0000029 0xb57ff887 in QEventDispatcherGlib::processEvents (this=0x90bf0e0, flags=...) at kernel/qeventdispatcher_glib.cpp:424 0000030 0xb5cadaaa in QGuiEventDispatcherGlib::processEvents (this=0x90bf0e0, flags=...) at kernel/qguieventdispatcher_glib.cpp:204 0000031 0xb57cb50d in QEventLoop::processEvents (this= 0xbfffeec4, flags=...) at kernel/qeventloop.cpp:149 0000032 0xb57cb7a9 in QEventLoop::exec (this=0xbfffeec4, flags=...) at kernel/qeventloop.cpp:204 0000033 0xb57d0eba in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1148 0000034 0xb5bf2a74 in QApplication::exec () at kernel/qapplication.cpp:3820 0000035 0x08c4d7ba in ?? () ---Type <return> to continue, or q <return> to quit--- 0000036 0x08c4d743 in ?? () 0000037 0xb4fed4d3 in __libc_start_main () from /lib/i386-linux-gnu/libc.so.6 0000038 0x082e6ba1 in ?? () |
|
Any crash is a blocker. Waiting for the next patch. Pygmee's first issue is a blocker for me too. |
|
Pygmee`s issue 0000001 changed in numeration4.patch Issue 0000002 was unreproducable with numerataion3.patch. It is my fault not pushing branch to git and only create and upload patch. Pygmee fault is not checking patch and using outdated branch. Craig fault is not checking patch at all. But all faults starts from me, so... mea culpa. |
|
The more we keep going with git, the less it seems workable to me. I will check patches once they are ready for submission. |
|
ok cezaryece i couldn't apply patch4 so i pulled from git. bug 1 looks ok. But it still crash + I can't reproduce but i once saw that the radio button was kept on 'paragraph effect' even i tried to switch to some effect. This makes the effect to be applied but none options available. I'll try to find more on it. |
|
pygmee - it can happen when cursor is at the end of text - there is problem with properly show paragraph style properties if cursor is after last character in story text. Give me more info about crashes with current numeration branch. And... do not use old files. Create new for testing. |
|
I cannot reproduce GUI problem, so i guess it is ok on that side. About the crash, i just created a new document, added a text frame + 3 lines of text, select them, and change in PP to numbering. ASSERT: "numS" in file /home/cedric/sources/scribus_git/scribus/Scribus/scribus/ui/propertywidget_pareffect.cpp, line 406 Program received signal SIGABRT, Aborted. 0xb7fdd424 in __kernel_vsyscall () (gdb) bt #0 0xb7fdd424 in __kernel_vsyscall () 0000001 0xb50021df in raise () from /lib/i386-linux-gnu/libc.so.6 0000002 0xb5005825 in abort () from /lib/i386-linux-gnu/libc.so.6 0000003 0xb56ac616 in qt_message_output ( msgType=QtFatalMsg, buf=0xa100b98 "ASSERT: \"numS\" in file /home/cedric/sources/scribus_git/scribus/Scribus/scribus/ui/propertywidget_pareffect.cpp, line 406") at global/qglobal.cpp:2276 0000004 0xb56aca4b in qt_message (msgType=QtFatalMsg, msg=0xb5839138 "ASSERT: \"%s\" in file %s, line %d", ap=0xbfffdc54 "\321\335\340\bx\335\340\b\226\001") at global/qglobal.cpp:2322 0000005 0xb56acb68 in qFatal ( msg=0xb5839138 "ASSERT: \"%s\" in file %s, line %d") at global/qglobal.cpp:2505 0000006 0xb56acbf5 in qt_assert ( assertion=0x8e0ddd1 "numS", file=0x8e0dd78 "/home/cedric/sources/scribus_git/scribus/Scribus/scribus/ui/propertywidget_pareffect.cpp", line=406) at global/qglobal.cpp:2002 0000007 0x08b45e0a in PropertyWidget_ParEffect::handleNumName (this=0x9c89e70, numName=...) at /home/cedric/sources/scribus_git/scribus/Scribus/scribus/ui/propertywidget_pareffect.cpp:406 0000008 0x08323245 in PropertyWidget_ParEffect::qt_static_metacall (_o=0x9c89e70, _c=QMetaObject::InvokeMetaMethod, _id=10, _a=0xbfffe028) at /home/cedric/sources/scribus_git/build/numeration/scribus/ui/moc_propertywidget_pareffect.cxx:94 0000009 0xb57e36b1 in QMetaObject::activate ( sender=0x9c9cac0, m=0xb6571c04, local_signal_index=2, argv=0xbfffe028) at kernel/qobject.cpp:3547 0000010 0xb603e7d5 in QComboBox::activated ( this=0x9c9cac0, _t1=...) at .moc/release-shared/moc_qcombobox.cpp:295 0000011 0xb603e850 in QComboBoxPrivate::emitActivated ( this=0x9c9cad8, index=...) at widgets/qcombobox.cpp:1262 0000012 0xb603fcd2 in QComboBoxPrivate::_q_itemSelected ( this=0x9c9cad8, item=...) at widgets/qcombobox.cpp:1252 0000013 0xb57e36b1 in QMetaObject::activate ( sender=0xa0afcb0, m=0xb6580f94, local_signal_index=0, argv=0xbfffe198) at kernel/qobject.cpp:3547 0000014 0xb632e025 in QComboBoxPrivateContainer::itemSelected (this=0xa0afcb0, _t1=...) ---Type <return> to continue, or q <return> to quit--- at .moc/release-shared/moc_qcombobox_p.cpp:253 0000015 0xb6038f8f in QComboBoxPrivateContainer::eventFilter (this=0xa0afcb0, o=0x9c88060, e=0xbfffe254) at widgets/qcombobox.cpp:691 0000016 0xb57ccb16 in QCoreApplicationPrivate::sendThroughObjectEventFilters (this=0x90d7618, receiver=0x9c88060, event=0xbfffe6e4) at kernel/qcoreapplication.cpp:986 0000017 0xb5bf4ea2 in notify_helper (e=0xbfffe6e4, receiver=0x9c88060, this=0x90d7618) at kernel/qapplication.cpp:4555 0000018 QApplicationPrivate::notify_helper ( this=0x90d7618, receiver=0x9c88060, e=0xbfffe6e4) at kernel/qapplication.cpp:4531 0000019 0xb5bfb024 in QApplication::notify ( this=0x90d7618, receiver=0x9c88060, e=0xbfffe6e4) at kernel/qapplication.cpp:4102 0000020 0xb57cc97e in QCoreApplication::notifyInternal ( this=0xbfffeef4, receiver=0x9c88060, event=0xbfffe6e4) at kernel/qcoreapplication.cpp:876 0000021 0xb5bf5e95 in sendEvent (event=<optimized out>, receiver=<optimized out>) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:231 0000022 QApplicationPrivate::sendMouseEvent (receiver= 0x9c88060, event=0xbfffe6e4, alienWidget=0x9c88060, nativeWidget=0xa0afcb0, buttonDown=0xb6589cf4, lastMouseReceiver=..., spontaneous=true) at kernel/qapplication.cpp:3170 0000023 0xb5c827d2 in QETWidget::translateMouseEvent ( this=0xa0afcb0, event=0xbfffeb9c) at kernel/qapplication_x11.cpp:4551 0000024 0xb5c80c0d in QApplication::x11ProcessEvent ( this=0xbfffeef4, event=0xbfffeb9c) at kernel/qapplication_x11.cpp:3732 0000025 0xb5cadeac in x11EventSourceDispatch ( s=0x90da6e8, callback=0, user_data=0x0) at kernel/qguieventdispatcher_glib.cpp:146 0000026 0xb4a39d86 in g_main_context_dispatch () from /lib/i386-linux-gnu/libglib-2.0.so.0 0000027 0xb4a3a125 in ?? () from /lib/i386-linux-gnu/libglib-2.0.so.0 0000028 0xb4a3a201 in g_main_context_iteration () from /lib/i386-linux-gnu/libglib-2.0.so.0 0000029 0xb57ff887 in QEventDispatcherGlib::processEvents (this=0x90d80e0, flags=...) at kernel/qeventdispatcher_glib.cpp:424 0000030 0xb5cadaaa in QGuiEventDispatcherGlib::processEvents (this=0x90d80e0, flags=...) at kernel/qguieventdispatcher_glib.cpp:204 0000031 0xb57cb50d in QEventLoop::processEvents (this= ---Type <return> to continue, or q <return> to quit--- 0xbfffee94, flags=...) at kernel/qeventloop.cpp:149 0000032 0xb57cb7a9 in QEventLoop::exec (this=0xbfffee94, flags=...) at kernel/qeventloop.cpp:204 0000033 0xb57d0eba in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1148 0000034 0xb5bf2a74 in QApplication::exec () at kernel/qapplication.cpp:3820 0000035 0x08c5124a in mainApp (argc=1, argv=0xbfffefe4) at /home/cedric/sources/scribus_git/scribus/Scribus/scribus/main_nix.cpp:86 0000036 0x08c511d3 in main (argc=1, argv=0xbfffefe4) at /home/cedric/sources/scribus_git/scribus/Scribus/scribus/main_nix.cpp:54 |
|
Something strange, as place where assertion occurs is called on changing numeration set and is not called on applying numeration. I cant reproduce this assertion. Try to do clean compilation and clean install. 1. with local numeration branch do "git reset --hard origin/numeration" 2. clear build and install directories 3. rebuild Scribus |
|
I have upload new patch (numeration5.patch) which brings condensed UI for PropertyWidget_ParEffect where now only are visible widgets with properties for current effect. |
|
Pygmee, can you please see if you can cleanly rebuild and check for this crash again? |
|
#11315 proposes a patch to improve "paragraph effects" subtab of "text" tab in the PP. |
|
New patch (numeration6.patch) brings fix for crash due to missing "default" numeration reported by Pygmee and UI changes proposed by JLuc. Branch is updated too. |
|
it works with the new patch. the crash doesn't happen anymore. good job cezaryece |
|
Well... another portion of fixes in numeration7.patch. |
|
Cezary.. can you please rename the XML tags to be CamelCase and more descriptive? eg + docu.writeAttribute("NUMSUFFIX", style.numSuffix()); + if ( ! style.isInhNumStart()) + docu.writeAttribute("NUMSTART", style.numStart()); NumerationSuffix and NumerationStart should be used. + docu.writeAttribute("PECHSTYLE", style.peCharStyleName()); + if ( ! style.isInhParEffectOffset()) + docu.writeAttribute("PEDIST", style.parEffectOffset()); PECHSTYLE and PEDIST are not intelligible at all. Please do not use the old style Scribus ones as an example but use this newer style. Thanks Craig |
|
Cezary, I cannot apply your v7 patch : patch: **** malformed patch at line 2170 |
|
My fault - I dont removed unwanted part with Scribus.pro file. Now it should be OK. Patch contains also refactored names of XML tags. |
|
Thanks for the renaming. Here seems to be one combined issue: a) The reference strings in the code still use all caps b) the write attribute call writes different strings to the hasAttribute checks for. This might just be a one off. + static const QString BULLETSTR("BulletString"); + if (attrs.hasAttribute(BULLETSTR)) + newStyle.setBulletStr(attrs.valueAsString(BULLETSTR)); + if ( ! style.isInhBulletStr()) + docu.writeAttribute("BulletStr", style.bulletStr()); I'd also recommend renaming these to match: +++ b/Scribus/scribus/gtparagraphstyle.h @@ -64,6 +64,14 @@ protected: QList<ParagraphStyle::TabRecord> tabValues; bool dropCap; int dropCapHeight; + bool bullet; + QString bulletStr; + bool numeration; + int numlevel; + int numformat; + int numstart; + QString numprefix; + QString numsuffix; in format m_numerationSuffix style. Adding comments in doxygen format like: QString m_numerationSuffix; ///< Numeration suffix of style |
|
Done, Craig |
|
numeration8.diff (242,862 bytes)
diff --git a/Scribus/scribus/CMakeLists.txt b/Scribus/scribus/CMakeLists.txt index eaf201a..32f4e08 100644 --- a/Scribus/scribus/CMakeLists.txt +++ b/Scribus/scribus/CMakeLists.txt @@ -143,7 +143,7 @@ SET(SCRIBUS_UI_SRC ui/propertiespalette_xyzbase.ui ui/propertywidget_advancedbase.ui ui/propertywidget_distancebase.ui - ui/propertywidget_dropcapbase.ui + ui/propertywidget_pareffectbase.ui ui/propertywidget_flopbase.ui ui/propertywidget_optmarginsbase.ui ui/propertywidget_orphansbase.ui @@ -216,6 +216,7 @@ SET(SCRIBUS_MOC_CLASSES latexhelpers.h loadsaveplugin.h menumanager.h + numeration.h navigator.h notesstyles.h observable.h @@ -409,7 +410,7 @@ SET(SCRIBUS_MOC_CLASSES ui/propertiespalette_xyz.h ui/propertywidget_advanced.h ui/propertywidget_distance.h - ui/propertywidget_dropcap.h + ui/propertywidget_pareffect.h ui/propertywidget_flop.h ui/propertywidget_optmargins.h ui/propertywidget_orphans.h @@ -579,6 +580,7 @@ SET(SCRIBUS_SOURCES menumanager.cpp mesh.cpp navigator.cpp + numeration.cpp observable.cpp nftrcreader.cpp nftsettings.cpp @@ -852,7 +854,7 @@ SET(SCRIBUS_SOURCES ui/propertiespalette_xyz.cpp ui/propertywidget_advanced.cpp ui/propertywidget_distance.cpp - ui/propertywidget_dropcap.cpp + ui/propertywidget_pareffect.cpp ui/propertywidget_flop.cpp ui/propertywidget_optmargins.cpp ui/propertywidget_orphans.cpp diff --git a/Scribus/scribus/actionmanager.cpp b/Scribus/scribus/actionmanager.cpp index ef1af60..322731d 100644 --- a/Scribus/scribus/actionmanager.cpp +++ b/Scribus/scribus/actionmanager.cpp @@ -910,9 +910,12 @@ void ActionManager::initExtrasMenuActions() scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow)); name="extrasGenerateTableOfContents"; scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow)); + name="extrasUpdateDocument"; + scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow)); connect( (*scrActions)["extrasManageImages"], SIGNAL(triggered()), mainWindow, SLOT(StatusPic()) ); connect( (*scrActions)["extrasGenerateTableOfContents"], SIGNAL(triggered()), mainWindow, SLOT(generateTableOfContents()) ); + connect( (*scrActions)["extrasUpdateDocument"], SIGNAL(triggered()), mainWindow, SLOT(updateDocument()) ); } @@ -1667,6 +1670,7 @@ void ActionManager::languageChange() (*scrActions)["extrasHyphenateText"]->setTexts( tr("&Hyphenate Text")); (*scrActions)["extrasDeHyphenateText"]->setTexts( tr("Dehyphenate Text")); (*scrActions)["extrasGenerateTableOfContents"]->setTexts( tr("&Generate Table Of Contents")); + (*scrActions)["extrasUpdateDocument"]->setTexts( tr("&Update Document")); //Windows Menu (*scrActions)["windowsCascade"]->setText( tr("&Cascade")); @@ -2194,7 +2198,8 @@ void ActionManager::createDefaultMenus() << "extrasManageImages" << "extrasHyphenateText" << "extrasDeHyphenateText" - << "extrasGenerateTableOfContents"; + << "extrasGenerateTableOfContents" + << "extrasUpdateDocument"; //Windows ++itmenu; itmenu->second diff --git a/Scribus/scribus/fileloader.cpp b/Scribus/scribus/fileloader.cpp index b458798..e6ad94a 100644 --- a/Scribus/scribus/fileloader.cpp +++ b/Scribus/scribus/fileloader.cpp @@ -320,9 +320,11 @@ void FileLoader::readParagraphStyle(ParagraphStyle& vg, const QDomElement& pg, S vg.charStyle().setFont((*currDoc->AllFonts)[tmpf]); vg.charStyle().setFontSize(qRound(ScCLocale::toDoubleC(pg.attribute("FONTSIZE"), 12.0) * 10.0)); vg.setHasDropCap(static_cast<bool>(pg.attribute("DROP", "0").toInt())); - vg.setDcCharStyleName(pg.attribute("DROPCHSTYLE", "")); + vg.setPeCharStyleName(pg.attribute("DROPCHSTYLE", "")); + vg.setPeCharStyleName(pg.attribute("PECHSTYLE", "")); vg.setDropCapLines(pg.attribute("DROPLIN", "2").toInt()); - vg.setDropCapOffset(ScCLocale::toDoubleC(pg.attribute("DROPDIST"), 0.0)); + vg.setParEffectOffset(ScCLocale::toDoubleC(pg.attribute("DROPDIST"), 0.0)); + vg.setParEffectOffset(ScCLocale::toDoubleC(pg.attribute("PEDIST"), 0.0)); vg.charStyle().setFeatures(static_cast<StyleFlag>(pg.attribute("EFFECT", "0").toInt()).featureList()); vg.charStyle().setFillColor(pg.attribute("FCOLOR", currDoc->itemToolPrefs().shapeFillColor)); vg.charStyle().setFillShade(pg.attribute("FSHADE", "100").toInt()); diff --git a/Scribus/scribus/gtaction.cpp b/Scribus/scribus/gtaction.cpp index d9a34b0..0c17130 100644 --- a/Scribus/scribus/gtaction.cpp +++ b/Scribus/scribus/gtaction.cpp @@ -394,6 +394,10 @@ void gtAction::getFrameStyle(gtFrameStyle *fstyle) fstyle->setDropCap(vg.hasDropCap()); if (!vg.isInhDropCapLines()) fstyle->setDropCapHeight(vg.dropCapLines()); + if (!vg.isInhHasBullet()) + fstyle->setBullet(vg.hasBullet(), vg.bulletStr()); + if (!vg.isInhHasNum()) + fstyle->setNum(vg.hasNum(),vg.numFormat(),vg.numLevel(), vg.numStart(), vg.numPrefix(), vg.numSuffix()); gtFont font; getFrameFont(&font); @@ -490,6 +494,24 @@ void gtAction::setParaStyleAttributes(gtParagraphStyle *pstyle, ParagraphStyle& style.setHasDropCap(pstyle->hasDropCap()); if (flags & gtParagraphStyle::dropCapHeightWasSet) style.setDropCapLines(pstyle->getDropCapHeight()); + if (flags & gtParagraphStyle::bulletWasSet) + { + style.setHasBullet(pstyle->hasBullet()); + style.setBulletStr(pstyle->getBullet()); + } + if (flags & gtParagraphStyle::numWasSet) + { + style.setHasNum(pstyle->hasNum()); + style.setNumName(pstyle->getName()); + style.setNumFormat(pstyle->getNumFormat()); + style.setNumLevel(pstyle->getNumLevel()); + style.setNumStart(pstyle->getNumStart()); + style.setNumHigher(true); + style.setNumOther(true); + style.setNumPrefix(pstyle->getNumPrefix()); + style.setNumSuffix(pstyle->getNumSuffix()); + } + /*vg.setDropCapOffset(0);*/ } diff --git a/Scribus/scribus/gtparagraphstyle.cpp b/Scribus/scribus/gtparagraphstyle.cpp index 9a486d6..f5a2548 100644 --- a/Scribus/scribus/gtparagraphstyle.cpp +++ b/Scribus/scribus/gtparagraphstyle.cpp @@ -42,7 +42,15 @@ gtParagraphStyle::gtParagraphStyle(const gtParagraphStyle& p) : gtStyle(p) spaceAbove = p.spaceAbove; spaceBelow = p.spaceBelow; dropCap = p.dropCap; + m_bullet = p.m_bullet; + m_bulletStr = p.m_bulletStr; dropCapHeight = p.dropCapHeight; + m_numeration = p.m_numeration; + m_numFormat = p.m_numFormat; + m_numLevel = p.m_numLevel; + m_numStart = p.m_numStart; + m_numPrefix = p.m_numPrefix; + m_numSuffix = p.m_numSuffix; adjToBaseline = p.adjToBaseline; autoLineSpacing = p.autoLineSpacing; isVisible = p.isVisible; @@ -65,6 +73,14 @@ void gtParagraphStyle::init() spaceBelow = 0; dropCap = false; dropCapHeight = 2; + m_bullet = false; + m_bulletStr = QString(QChar(0x2022)); + m_numeration = false; + m_numFormat = 0; + m_numLevel = 0; + m_numStart = 1; + m_numPrefix = QString(); + m_numSuffix = QString(); adjToBaseline = false; autoLineSpacing = false; isVisible = true; @@ -221,6 +237,67 @@ void gtParagraphStyle::setDropCapHeight(int newHeight) flags |= dropCapHeightWasSet; } +bool gtParagraphStyle::hasBullet() +{ + return m_bullet; +} + +QString gtParagraphStyle::getBullet() +{ + return m_bulletStr; +} + +void gtParagraphStyle::setBullet(bool newBullet, QString str) +{ + m_bullet = newBullet; + m_bulletStr = str; + flags |= bulletWasSet; +} + +bool gtParagraphStyle::hasNum() +{ + return m_numeration; +} + +void gtParagraphStyle::setNum(bool newNum, int format, int level, int start, QString prefix, QString suffix) +{ + m_numeration = newNum; + if (newNum) + { + m_numFormat = format; + m_numLevel = level; + m_numStart = start; + m_numPrefix = prefix; + m_numSuffix = suffix; + } + flags |= numWasSet; +} + +int gtParagraphStyle::getNumLevel() +{ + return m_numLevel; +} + +int gtParagraphStyle::getNumFormat() +{ + return m_numFormat; +} + +int gtParagraphStyle::getNumStart() +{ + return m_numStart; +} + +QString gtParagraphStyle::getNumPrefix() +{ + return m_numPrefix; +} + +QString gtParagraphStyle::getNumSuffix() +{ + return m_numSuffix; +} + bool gtParagraphStyle::isAdjToBaseline() { return adjToBaseline; diff --git a/Scribus/scribus/gtparagraphstyle.h b/Scribus/scribus/gtparagraphstyle.h index 344f14d..4165fdb 100644 --- a/Scribus/scribus/gtparagraphstyle.h +++ b/Scribus/scribus/gtparagraphstyle.h @@ -64,6 +64,14 @@ protected: QList<ParagraphStyle::TabRecord> tabValues; bool dropCap; int dropCapHeight; + bool m_bullet; ///< Is style using bullet? + QString m_bulletStr; ///< String used as bullet + bool m_numeration; ///< Is style using numeration? + int m_numLevel; ///< Level in hierarchical numbering + int m_numFormat; ///< 1_2_3, i_ii_ii, a_b_c + int m_numStart; ///< Numeration starts at number + QString m_numPrefix; ///< Numeration prefix of style + QString m_numSuffix; ///< Numeration sufffix of style bool adjToBaseline; bool autoLineSpacing; bool isVisible; @@ -83,6 +91,8 @@ public: dropCapHeightWasSet = 512, adjToBaselineWasSet = 1024, autoLineSpacingWasSet = 2048, + bulletWasSet = 4096, + numWasSet = 8192 } wasSetFlags; int getFlags(); @@ -118,6 +128,16 @@ public: gtParagraphStyle(const gtStyle& s); ~gtParagraphStyle(); QString target(); + bool hasBullet(); + void setBullet(bool newBullet, QString str = QString(QChar(0x2022))); + QString getBullet(); + bool hasNum(); + void setNum(bool newNum, int format=0, int level=0, int start = 1, QString prefix = "", QString suffix = ""); + int getNumLevel(); + int getNumFormat(); + int getNumStart(); + QString getNumPrefix(); + QString getNumSuffix(); }; #endif // GTPARAGRAPHSTYLE_H diff --git a/Scribus/scribus/marks.h b/Scribus/scribus/marks.h index e6988f7..376fcf6 100644 --- a/Scribus/scribus/marks.h +++ b/Scribus/scribus/marks.h @@ -19,7 +19,8 @@ enum MarkType MARKVariableTextType = 3,//mark contain dynamic text MARKNoteMasterType = 4, //mark contain footnote reference MARKNoteFrameType = 5, //mark used internally in note frame at beginning of note`s text - MARKIndexType = 6 // index entry + MARKIndexType = 6, // index entry + MARKBullNumType = 7 }; struct MarkData @@ -40,6 +41,7 @@ class SCRIBUS_API Mark { friend class ScribusDoc; friend class ScribusMainWindow; + friend class BulNumMark; //only ScribusDoc && ScribusMainWindow can create and delete marks private: Mark() : label(""), OwnPage(-1), typ(MARKNoType), data() {} @@ -86,7 +88,7 @@ public: bool hasItemPtr() { return data.itemPtr != NULL; } bool hasString() { return !data.strtxt.isEmpty(); } bool hasMark() { return data.destmarkName != ""; } - bool isUnique() { return ((typ != MARKVariableTextType) && (typ != MARKIndexType)); } + bool isUnique() { return ((typ != MARKVariableTextType) && (typ != MARKIndexType) && (typ != MARKBullNumType)); } bool isNoteType() { return ((typ == MARKNoteMasterType) || (typ==MARKNoteFrameType)); } bool isType(const MarkType t) { return t==typ; } @@ -95,4 +97,11 @@ protected: MarkData data; }; +class SCRIBUS_API BulNumMark : public Mark +{ +public: + BulNumMark() : Mark() { label = "BullNumMark"; typ = MARKBullNumType; } + ~BulNumMark() {} +}; + #endif // MARKS_H diff --git a/Scribus/scribus/notesstyles.h b/Scribus/scribus/notesstyles.h index 9bd101f..792b50f 100644 --- a/Scribus/scribus/notesstyles.h +++ b/Scribus/scribus/notesstyles.h @@ -5,6 +5,7 @@ #include <QObject> #include <QString> #include <QList> +#include "numeration.h" #include "pagestructs.h" #include "scpage.h" #include "styles/charstyle.h" @@ -16,25 +17,6 @@ class ScribusDoc; class PageItem_NoteFrame; class PageItem_TextFrame; -class Numeration -{ -public: - Numeration() : numType(Type_1_2_3) {} - void setType(NumerationType type) { numType = type; } - const NumerationType type() { return numType; } - const QString numString(const int num) { return getStringFromSequence(numType, num); } -private: - NumerationType numType; -}; - -typedef enum { - NSRdocument, - NSRsection, - NSRstory, - NSRpage, - NSRframe -} NumerationRange; - //used for map with endnotes frames maped with range item typedef union { @@ -65,8 +47,8 @@ public: void setSuffix (const QString str) { suffixStr = str; } const QString numString(const int num) { return numeration.numString(num); } - void setType(const NumerationType type) { numeration.setType(type); } - const NumerationType getType() { return numeration.type(); } + void setType(const NumFormat type) { numeration.numFormat = type; } + const NumFormat getType() { return numeration.numFormat; } bool isEndNotes() { return m_endNotesStyle; } bool isAutoNotesHeight() { return autoNotesHeight; } diff --git a/Scribus/scribus/numeration.cpp b/Scribus/scribus/numeration.cpp new file mode 100644 index 0000000..61e7268 --- /dev/null +++ b/Scribus/scribus/numeration.cpp @@ -0,0 +1,53 @@ +#include "numeration.h" +#include "util.h" + +const QString getStringFromNum(NumFormat format, int num, const QChar leadingChar, const int charsLen) +{ + QString str = getStringFromSequence(format, num); + if (charsLen > str.length()) + str = str.rightJustified(charsLen, leadingChar); + return str; +} + +const QString getAsterixStringFromNum(int num, QString asterix, const QChar leadingChar, const int charsLen) +{ + QString str = getStringFromSequence(Type_asterix, num, asterix); + if (charsLen > str.length()) + str = str.rightJustified(charsLen, leadingChar); + return str; +} + +const QString getFormatName(int format) +{ + QString name = QString(); + if (format == Type_1_2_3) + name = "1_2_3"; + else if (format == Type_i_ii_iii) + name = "i_ii_iii"; + else if (format == Type_I_II_III) + name = "I_II_III"; + else if (format == Type_a_b_c) + name = "a_b_c"; + else if (format == Type_A_B_C) + name = "A_B_C"; + else if (format == Type_asterix) + name = "*"; + Q_ASSERT(!name.isEmpty()); + return name; +} + +const QStringList getFormatList() +{ + QStringList list; + list << "1_2_3" << "i_ii_iii" << "I_II_III" << "a_b_c" << "A_B_C" << "*"; + return list; +} + +const QString Numeration::numString(const int num) +{ + if (numFormat == Type_asterix) + return getAsterixStringFromNum(num, asterix, lead, len); + + return getStringFromNum(numFormat, num, lead, len); + +} diff --git a/Scribus/scribus/numeration.h b/Scribus/scribus/numeration.h new file mode 100644 index 0000000..e94f9fb --- /dev/null +++ b/Scribus/scribus/numeration.h @@ -0,0 +1,62 @@ +#ifndef NUMERATION_H +#define NUMERATION_H + +#include <QString> +#include <QStringList> +#include <QMap> + +typedef enum +{ + Type_1_2_3, + Type_i_ii_iii, + Type_I_II_III, + Type_a_b_c, + Type_A_B_C, + Type_asterix, + Type_None=99 +} NumFormat; + +typedef enum { + NSRdocument, + NSRsection, + NSRstory, + NSRpage, + NSRframe +// NSRblock //used for contignous numeration eg. paragraphs - paragraph without numbering reset counter +} NumerationRange; + +class Numeration +{ +public: + Numeration() : numFormat(Type_1_2_3), asterix(QString()), lead('0'), len(0), range(NSRdocument), prefix(QString()), suffix(QString()), start(1) {} + Numeration(NumFormat f) : numFormat(f), asterix("*") {} + const QString numString(const int num); + + NumFormat numFormat; + QString asterix; + QChar lead; + int len; + NumerationRange range; + QString prefix; + QString suffix; + int start; +}; + +//struct used by ScribusDoc for storing numerations used in document +typedef struct { + QString m_name; + QList<Numeration> m_nums; + QList<int> m_counters; + int m_lastlevel; +} NumStruct; + +//util functions for use without Numeration class +//convert passed num to string using numeration style +const QString getStringFromNum(NumFormat format, int num, const QChar leadingChar='0', const int charsLen=0); +//convert passed num to string with custom chars +const QString getAsterixStringFromNum(int num, QString asterix, const QChar leadingChar='_', const int charsLen=0); +//return numeration name from type +const QString getFormatName(int format); +const QStringList getFormatList(); + +#endif // NUMERATION_H diff --git a/Scribus/scribus/pageitem.cpp b/Scribus/scribus/pageitem.cpp index 5825f68..d0ab699 100644 --- a/Scribus/scribus/pageitem.cpp +++ b/Scribus/scribus/pageitem.cpp @@ -48,9 +48,9 @@ for which a new license (GPL+exception) is in place. #include "pageitem_group.h" #include "pageitem_regularpolygon.h" #include "pageitem_arc.h" -#include "pageitem_noteframe.h" #include "pageitem_spiral.h" #include "pageitem_textframe.h" +#include "pageitem_noteframe.h" #include "pageitem_latexframe.h" #include "prefsmanager.h" @@ -841,7 +841,8 @@ PageItem::~PageItem() if (itemText.item(pos)->hasMark()) { Mark* mrk = itemText.item(pos)->mark; - m_Doc->eraseMark(mrk); + if (!mrk->isType(MARKBullNumType)) + m_Doc->eraseMark(mrk); } } } @@ -5026,6 +5027,8 @@ void PageItem::restore(UndoState *state, bool isUndo) restoreWeldItems(ss, isUndo); else if (ss->contains("UNWELD_ITEM")) restoreUnWeldItem(ss, isUndo); + else if (ss->contains("CLEARMARKSTRING")) + restoreMarkString(ss, isUndo); } if (!OnMasterPage.isEmpty()) m_Doc->setCurrentPage(oldCurrentPage); @@ -5101,6 +5104,18 @@ void PageItem::restoreWeldItems(SimpleState *state, bool isUndo) m_Doc->regionsChanged()->update(QRectF()); } +void PageItem::restoreMarkString(SimpleState *state, bool isUndo) +{ + ScItemState< QPair<int,QString> > *is = dynamic_cast<ScItemState< QPair<int,QString> >*>(state); + ScText * hl = itemText.item(is->getItem().first); + if (!hl->hasMark()) + return; + if (isUndo) + hl->mark->setString(is->getItem().second); + else + hl->mark->setString(QString()); +} + bool PageItem::checkGradientUndoRedo(SimpleState *ss, bool isUndo) { if (ss->contains("SNAP_TO_PATCH")) diff --git a/Scribus/scribus/pageitem.h b/Scribus/scribus/pageitem.h index 2b02de6..b6f6258 100644 --- a/Scribus/scribus/pageitem.h +++ b/Scribus/scribus/pageitem.h @@ -1525,6 +1525,7 @@ protected: // Start protected functions void restoreWeldItems(SimpleState *state, bool isUndo); void restoreUnWeldItem(SimpleState *state, bool isUndo); + void restoreMarkString(SimpleState *state, bool isUndo); /*@}*/ diff --git a/Scribus/scribus/pageitem_textframe.cpp b/Scribus/scribus/pageitem_textframe.cpp index 3f69bed..ac3e199 100644 --- a/Scribus/scribus/pageitem_textframe.cpp +++ b/Scribus/scribus/pageitem_textframe.cpp @@ -35,12 +35,13 @@ for which a new license (GPL+exception) is in place. #include "canvas.h" #include "commonstrings.h" #include "hyphenator.h" +#include "numeration.h" #include "marks.h" #include "notesstyles.h" #include "pageitem.h" #include "pageitem_group.h" -#include "pageitem_noteframe.h" #include "pageitem_textframe.h" +#include "pageitem_noteframe.h" #include "prefsmanager.h" #include "scpage.h" #include "scpainter.h" @@ -1354,6 +1355,7 @@ void PageItem_TextFrame::layout() QList<ParagraphStyle::TabRecord> tTabValues; tTabValues.clear(); + bool BulNumMode = false; //when bullet or counter should be inserted bool DropCmode = false, FlopBaseline = false; double desc=0, asce=0, realAsce=0, realDesc = 0, offset = 0; double maxDY=0, maxDX=0; @@ -1501,6 +1503,7 @@ void PageItem_TextFrame::layout() itemText.blockSignals(true); setMaxY(-1); double maxYAsc = 0.0, maxYDesc = 0.0; + double autoLeftIndent = 0.0; for (int a = firstInFrame(); a < itLen; ++a) { @@ -1566,17 +1569,78 @@ void PageItem_TextFrame::layout() } } } + BulNumMode = false; + if (a==0 || itemText.text(a-1) == SpecialChars::PARSEP) + { + autoLeftIndent = 0.0; + style = itemText.paragraphStyle(a); + if (style.hasBullet() || style.hasNum()) + { + BulNumMode = true; + if (hl->mark == NULL || !hl->mark->isType(MARKBullNumType)) + { + BulNumMark* bnMark = new BulNumMark(); + itemText.insertMark(bnMark,a); + a--; + itLen = itemText.length(); + continue; + } + if (style.hasBullet()) + hl->mark->setString(style.bulletStr()); + else if (style.hasNum()) + { + if (hl->mark->getString().isEmpty()) + { + hl->mark->setString("?"); + m_Doc->flag_Renumber = true; + } + } + } + } + if (!BulNumMode && hl->mark && hl->mark->isType(MARKBullNumType)) + { + delete (BulNumMark*) hl->mark; + hl->mark = NULL; + itemText.removeChars(a,1); + a--; + itLen = itemText.length(); + continue; + } + if (current.itemsInLine == 0) + opticalMargins = style.opticalMargins(); + CharStyle charStyle = ((hl->ch != SpecialChars::PARSEP) ? itemText.charStyle(a) : style.charStyle()); chstr = ExpandToken(a); int chstrLen = chstr.length(); if (chstr.isEmpty()) chstr = SpecialChars::ZWNBSPACE; curStat = SpecialChars::getCJKAttr(hl->ch); - if (a > 0 && itemText.text(a-1) == SpecialChars::PARSEP) - style = itemText.paragraphStyle(a); - if (current.itemsInLine == 0) - opticalMargins = style.opticalMargins(); - CharStyle charStyle = (hl->ch != SpecialChars::PARSEP? itemText.charStyle(a) : style.charStyle()); + + //set style for paragraph effects + if (a == 0 || itemText.text(a-1) == SpecialChars::PARSEP) + { + if (style.hasDropCap() || style.hasBullet() || style.hasNum()) + { + const QString& curParent(style.hasParent() ? style.parent() : style.name()); + CharStyle newStyle; + if (style.peCharStyleName() == tr("No Style") || style.peCharStyleName().isEmpty()) + newStyle.setParent(m_Doc->paragraphStyle(curParent).charStyle().name()); + else if (charStyle.name() != style.peCharStyleName()) + newStyle.setParent(m_Doc->charStyle(style.peCharStyleName()).name()); + newStyle.applyCharStyle(charStyle); + charStyle.setStyle(newStyle); + itemText.setCharStyle(a, 1 , charStyle); + } + else if (style.peCharStyleName() != tr("No Style") && !style.peCharStyleName().isEmpty()) + //par effect is cleared but is set dcCharStyleName = clear drop cap char style + { + const QString& curParent(style.hasParent() ? style.parent() : style.name()); + charStyle.eraseCharStyle(m_Doc->charStyle(style.peCharStyleName())); + charStyle.setParent(m_Doc->paragraphStyle(curParent).charStyle().name()); + itemText.setCharStyle(a, 1,charStyle); + } + } + double hlcsize10 = charStyle.fontSize() / 10.0; double scaleV = charStyle.scaleV() / 1000.0; double scaleH = charStyle.scaleH() / 1000.0; @@ -1599,31 +1663,6 @@ void PageItem_TextFrame::layout() DropCmode = false; } } - if (a == 0 || itemText.text(a-1) == SpecialChars::PARSEP) - { - if (style.hasDropCap()) - { - if (style.dcCharStyleName() == tr("No Style") || style.dcCharStyleName().isEmpty()) - { - const QString& curParent(style.hasParent() ? style.parent() : style.name()); - CharStyle newStyle; - newStyle.setParent(m_Doc->paragraphStyle(curParent).charStyle().name()); - charStyle.setStyle(newStyle); - } - else if (charStyle.name() != style.dcCharStyleName()) - charStyle.setStyle(m_Doc->charStyle(style.dcCharStyleName())); - itemText.setCharStyle(a, chstrLen ,charStyle); - } - else if (style.dcCharStyleName() != tr("No Style") && !style.dcCharStyleName().isEmpty()) - //hasDropCap is cleared but is set dcCharStyleName = clear drop cap char style - { - const QString& curParent(style.hasParent() ? style.parent() : style.name()); - CharStyle newStyle; - newStyle.setParent(m_Doc->paragraphStyle(curParent).charStyle().name()); - charStyle.setStyle(newStyle); - itemText.setCharStyle(a, chstr.length(),charStyle); - } - } const ScFace font = charStyle.font(); @@ -1699,7 +1738,7 @@ void PageItem_TextFrame::layout() // find charsize factors if (DropCmode) { - DropCapDrop = calculateLineSpacing (style, this) * (DropLines - 1); +// DropCapDrop = calculateLineSpacing (style, this) * (DropLines - 1); // FIXME : we should ensure that fonts are loaded before calls to layout() // ScFace::realCharHeight()/Ascent() ensure font is loaded thanks to an indirect call to char2CMap() @@ -1738,7 +1777,7 @@ void PageItem_TextFrame::layout() // set StartOfLine (and find tracking?) if (current.itemsInLine == 0) { - itemText.item(a)->setEffects(itemText.item(a)->effects() | ScStyle_StartOfLine); + hl->setEffects(hl->effects() | ScStyle_StartOfLine); kernVal = 0; } else @@ -1748,6 +1787,7 @@ void PageItem_TextFrame::layout() } hl->glyph.yadvance = 0; layoutGlyphs(*hl, chstr, hl->glyph); + // find out width, ascent and descent of char if (HasObject) { @@ -1761,9 +1801,9 @@ void PageItem_TextFrame::layout() if (a+1 < itemText.length()) { uint glyph2 = font.char2CMap(itemText.text(a+1)); - double kern= font.glyphKerning(hl->glyph.glyph, glyph2, chs / 10.0) * hl->glyph.scaleH; + double kern= font.glyphKerning(hl->glyph.last()->glyph, glyph2, chs / 10.0) * hl->glyph.scaleH; wide += kern; - hl->glyph.xadvance += kern; + hl->glyph.last()->xadvance += kern; // change xadvance, xoffset according to JIS X4051 ScText *hl2 = itemText.item(a+1); int nextStat = SpecialChars::getCJKAttr(hl2->ch); @@ -1777,7 +1817,7 @@ void PageItem_TextFrame::layout() case SpecialChars::CJK_NOTOP: kern = wide / 4; wide += kern; - hl->glyph.xadvance += kern; + hl->glyph.last()->xadvance += kern; } } else { // next char is CJK, too switch(curStat & SpecialChars::CJK_CHAR_MASK){ @@ -1790,7 +1830,7 @@ void PageItem_TextFrame::layout() case SpecialChars::CJK_MIDPOINT: kern = -wide / 2; wide += kern; - hl->glyph.xadvance += kern; + hl->glyph.last()->xadvance += kern; } break; case SpecialChars::CJK_COMMA: @@ -1800,7 +1840,7 @@ void PageItem_TextFrame::layout() case SpecialChars::CJK_FENCE_END: kern = -wide / 2; wide += kern; - hl->glyph.xadvance += kern; + hl->glyph.last()->xadvance += kern; } break; case SpecialChars::CJK_MIDPOINT: @@ -1808,7 +1848,7 @@ void PageItem_TextFrame::layout() case SpecialChars::CJK_FENCE_BEGIN: kern = -wide / 2; wide += kern; - hl->glyph.xadvance += kern; + hl->glyph.last()->xadvance += kern; } break; case SpecialChars::CJK_FENCE_BEGIN: @@ -1821,8 +1861,8 @@ void PageItem_TextFrame::layout() if(prevStat == SpecialChars::CJK_FENCE_BEGIN){ kern = -wide / 2; wide += kern; - hl->glyph.xadvance += kern; - hl->glyph.xoffset += kern; + hl->glyph.last()->xadvance += kern; + hl->glyph.last()->xoffset += kern; } break; } @@ -1836,7 +1876,7 @@ void PageItem_TextFrame::layout() case SpecialChars::CJK_NOTOP: kern = hl2->glyph.wide() / 4; wide += kern; - hl->glyph.xadvance += kern; + hl->glyph.last()->xadvance += kern; } } } @@ -1861,7 +1901,6 @@ void PageItem_TextFrame::layout() { double realCharHeight = 0.0; wide = 0.0; realAsce = 0.0; - // for (int i = 0; i < chstrLen; ++i) { realCharHeight = qMax(realCharHeight, font.realCharHeight(chstr[i], charStyle.fontSize() / 10.0)); @@ -1914,7 +1953,7 @@ void PageItem_TextFrame::layout() else { asce = font.ascent(hlcsize10); - if (HasMark) + if (HasMark && !BulNumMode) realAsce = asce * scaleV + offset; else { @@ -1923,7 +1962,8 @@ void PageItem_TextFrame::layout() } } } - +// if (BulNumMode) +// hl->glyph.last()->xadvance += style.parEffectOffset(); //check for Y position at beginning of line if (current.itemsInLine == 0 && !current.afterOverflow) { @@ -1982,21 +2022,33 @@ void PageItem_TextFrame::layout() } //set left indentation current.leftIndent = 0.0; - if (current.addLeftIndent && (maxDX == 0 || DropCmode)) + if (current.addLeftIndent && (maxDX == 0 || DropCmode || BulNumMode)) { - current.leftIndent = style.leftMargin(); - if (current.hasDropCap) - current.leftIndent = 0; + current.leftIndent = style.leftMargin() + autoLeftIndent; if (a==0 || (a > 0 && (itemText.text(a-1) == SpecialChars::PARSEP))) + { current.leftIndent += style.firstIndent(); + if (BulNumMode || DropCmode) + { + if(style.parEffectIndent()) + { + current.leftIndent -= style.parEffectOffset() + wide; + if (current.leftIndent < 0.0) + { + autoLeftIndent = abs(current.leftIndent); + current.leftIndent = 0.0; + } + } + } + } current.addLeftIndent = false; } } current.recalculateY = true; maxYAsc = 0.0, maxYDesc = 0.0; + double addAsce = 0.0; if (current.startOfCol) { - double addAsce; if (DropCmode) addAsce = qMax(realAsce, asce + offset); else @@ -2085,18 +2137,18 @@ void PageItem_TextFrame::layout() lastLineY = maxYAsc; if (current.startOfCol) { - double addAsce; - if (DropCmode) - addAsce = qMax(realAsce, asce + offset); - else - addAsce = asce + offset; - if (style.lineSpacingMode() != ParagraphStyle::BaselineGridLineSpacing) - { - if (firstLineOffset() == FLOPRealGlyphHeight) - addAsce = realAsce; - else if (firstLineOffset() == FLOPLineSpacing) - addAsce = style.lineSpacing() + offset; - } +// double addAsce; +// if (DropCmode) +// addAsce = qMax(realAsce, asce + offset); +// else +// addAsce = asce + offset; +// if (style.lineSpacingMode() != ParagraphStyle::BaselineGridLineSpacing) +// { +// if (firstLineOffset() == FLOPRealGlyphHeight) +// addAsce = realAsce; +// else if (firstLineOffset() == FLOPLineSpacing) +// addAsce = style.lineSpacing() + offset; +// } maxYAsc = current.yPos - addAsce; } else @@ -2298,7 +2350,7 @@ void PageItem_TextFrame::layout() current.rememberBreak(a, breakPos, style.rightMargin()); } } - if ((hl->ch == SpecialChars::OBJECT) && (hl->hasObject(m_Doc))) + if (hl->hasObject(m_Doc)) current.rememberBreak(a, breakPos, style.rightMargin()); // CJK break if(a > current.line.firstItem) @@ -2556,21 +2608,23 @@ void PageItem_TextFrame::layout() tabs.status = TabNONE; } } - - if (DropCmode && !outs) + if ((DropCmode || BulNumMode) && !outs) { - DropCmode = false; - DropLinesCount = 0; - maxDY = current.yPos; - current.hasDropCap = true; - current.xPos += style.dropCapOffset(); - hl->glyph.xadvance += style.dropCapOffset(); - maxDX = current.xPos; - double spacing = calculateLineSpacing (style, this); - current.yPos -= spacing * (DropLines-1); - if (style.lineSpacingMode() == ParagraphStyle::BaselineGridLineSpacing) - current.yPos = adjustToBaselineGrid (current, this, OwnPage); - current.recalculateY = false; + current.xPos += style.parEffectOffset(); + hl->glyph.last()->xadvance += style.parEffectOffset(); + if (DropCmode) + { + DropCmode = false; + DropLinesCount = 0; + maxDY = current.yPos; + current.hasDropCap = true; + maxDX = current.xPos; + double spacing = calculateLineSpacing (style, this); + current.yPos -= spacing * (DropLines-1); + if (style.lineSpacingMode() == ParagraphStyle::BaselineGridLineSpacing) + current.yPos = adjustToBaselineGrid (current, this, OwnPage); + current.recalculateY = false; + } } // end of line if (outs) @@ -5523,7 +5577,7 @@ QString PageItem_TextFrame::infoDescription() return QString(); } -bool PageItem_TextFrame::hasMark(NotesStyle *NS) +bool PageItem_TextFrame::hasNoteMark(NotesStyle *NS) { if (isNoteFrame()) return (asNoteFrame()->notesStyle() == NS); @@ -5666,6 +5720,8 @@ Mark* PageItem_TextFrame::selectedMark(bool onlySelection) { if (omitNotes && (hl->mark->isType(MARKNoteMasterType) || hl->mark->isType(MARKNoteFrameType))) continue; + if (hl->mark->isType(MARKBullNumType)) + continue; return hl->mark; } } @@ -5918,12 +5974,14 @@ int PageItem_TextFrame::removeMarksFromText(bool doUndo) Mark* mrk = selectedMark(true); while (mrk != NULL) { - Q_ASSERT(!mrk->isNoteType()); - if (doUndo) - m_Doc->setUndoDelMark(mrk); - m_Doc->eraseMark(mrk, true, this); + if (!mrk->isType(MARKBullNumType)) + { + if (doUndo) + m_Doc->setUndoDelMark(mrk); + m_Doc->eraseMark(mrk, true, this); + ++num; + } mrk = selectedMark(true); - ++num; } return num; } diff --git a/Scribus/scribus/pageitem_textframe.h b/Scribus/scribus/pageitem_textframe.h index 4766ea6..70a73ab 100644 --- a/Scribus/scribus/pageitem_textframe.h +++ b/Scribus/scribus/pageitem_textframe.h @@ -142,7 +142,7 @@ private slots: public: //for footnotes/endnotes - bool hasMark(NotesStyle* NS = NULL); + bool hasNoteMark(NotesStyle* NS = NULL); bool hasNoteFrame(NotesStyle* NS, bool inChain = false); //bool hasNoteFrame(PageItem_NoteFrame* nF) { return m_notesFramesMap.contains(nF); } void delAllNoteFrames(bool doUpdate = false); diff --git a/Scribus/scribus/pagestructs.h b/Scribus/scribus/pagestructs.h index 74571ed..2cf2a96 100644 --- a/Scribus/scribus/pagestructs.h +++ b/Scribus/scribus/pagestructs.h @@ -10,6 +10,7 @@ for which a new license (GPL+exception) is in place. #include <QMap> #include <QList> #include <QString> +#include "numeration.h" struct ObjectAttribute { @@ -40,27 +41,13 @@ struct ToCSetup typedef QList<ToCSetup> ToCSetupVector; - -typedef enum -{ - Type_1_2_3, - Type_i_ii_iii, - Type_I_II_III, - Type_a_b_c, - Type_A_B_C, - Type_asterix, - Type_None=99 -} DocumentSectionType; - -typedef DocumentSectionType NumerationType; - struct DocumentSection { uint number; //Just an index in the section list QString name; //User defined name for the section uint fromindex; //First page _index_ of the section in the document (old page number) uint toindex; //Last page _index_ of the section in the document (old page number) - DocumentSectionType type; //Type of section numbering, ie i,ii,iii or a,b,c or 1,2,3, etc + NumFormat type; //Type of section numbering, ie i,ii,iii or a,b,c or 1,2,3, etc uint sectionstartindex; // Start of section, an index in the range of type, eg for type i,ii,iii, this would be 2 for "ii". bool reversed; // Counting 10-1 ? bool active; // Is the section active, ie, if the fromindex is 10, and theres 5 pages, this should be inactive. diff --git a/Scribus/scribus/plugins/fileloader/scribus12format/scribus12format.cpp b/Scribus/scribus/plugins/fileloader/scribus12format/scribus12format.cpp index 829dd75..ed7be13 100644 --- a/Scribus/scribus/plugins/fileloader/scribus12format/scribus12format.cpp +++ b/Scribus/scribus/plugins/fileloader/scribus12format/scribus12format.cpp @@ -2218,7 +2218,7 @@ void Scribus12Format::GetStyle(QDomElement *pg, ParagraphStyle *vg, StyleSet<Par vg->charStyle().setFontSize(qRound(ScCLocale::toDoubleC(pg->attribute("FONTSIZE"), 12.0) * 10.0)); vg->setHasDropCap(static_cast<bool>(pg->attribute("DROP", "0").toInt())); vg->setDropCapLines(pg->attribute("DROPLIN", "2").toInt()); - vg->setDropCapOffset(ScCLocale::toDoubleC(pg->attribute("DROPDIST"), 0.0)); + vg->setParEffectOffset(ScCLocale::toDoubleC(pg->attribute("DROPDIST"), 0.0)); vg->charStyle().setFeatures(static_cast<StyleFlag>((pg->attribute("EFFECT", "0").toInt())).featureList()); fColor = pg->attribute("FCOLOR", doc->itemToolPrefs().shapeFillColor); fShade = pg->attribute("FSHADE", "100").toInt(); diff --git a/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp b/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp index cd94e77..74c01b4 100644 --- a/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp +++ b/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp @@ -813,8 +813,8 @@ namespace { pstyle.resetGapAfter(); if (pstyle.dropCapLines() < 0) pstyle.resetDropCapLines(); - if (pstyle.dropCapOffset() <= -16000) - pstyle.resetDropCapOffset(); + if (pstyle.parEffectOffset() <= -16000) + pstyle.resetParEffectOffset(); fixLegacyCharStyle(pstyle.charStyle()); } @@ -1324,7 +1324,7 @@ void Scribus134Format::readParagraphStyle(ScribusDoc *doc, ScXmlStreamReader& re static const QString DROPDIST("DROPDIST"); if (attrs.hasAttribute(DROPDIST)) - newStyle.setDropCapOffset(attrs.valueAsDouble(DROPDIST)); + newStyle.setParEffectOffset(attrs.valueAsDouble(DROPDIST)); static const QString PSHORTCUT("PSHORTCUT"); if (attrs.hasAttribute(PSHORTCUT)) diff --git a/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp b/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp index f03c4a1..6772f34 100644 --- a/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp +++ b/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp @@ -1173,7 +1173,7 @@ bool Scribus13Format::loadFile(const QString & fileName, const FileFormat & /* f if (m_Doc->autoSave() && ScCore->usingGUI()) m_Doc->restartAutoSaveTimer(); // m_Doc->autoSaveTimer->start(m_Doc->autoSaveTime()); - + if (m_mwProgressBar!=0) m_mwProgressBar->setValue(DOC.childNodes().count()); @@ -1384,7 +1384,7 @@ void Scribus13Format::readParagraphStyle(ParagraphStyle& vg, const QDomElement& vg.charStyle().setFontSize(qRound(ScCLocale::toDoubleC(pg.attribute("FONTSIZE"), 12.0) * 10.0)); vg.setHasDropCap(static_cast<bool>(pg.attribute("DROP", "0").toInt())); vg.setDropCapLines(pg.attribute("DROPLIN", "2").toInt()); - vg.setDropCapOffset(ScCLocale::toDoubleC(pg.attribute("DROPDIST"), 0.0)); + vg.setParEffectOffset(ScCLocale::toDoubleC(pg.attribute("DROPDIST"), 0.0)); vg.charStyle().setFeatures(static_cast<StyleFlag>(pg.attribute("EFFECT", "0").toInt()).featureList()); QString fColor = pg.attribute("FCOLOR", doc->itemToolPrefs().shapeFillColor); int fShade = pg.attribute("FSHADE", "100").toInt(); diff --git a/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp b/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp index 94e7473..e9bb8b2 100644 --- a/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp +++ b/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp @@ -1886,9 +1886,9 @@ bool Scribus150Format::loadFile(const QString & fileName, const FileFormat & /* } // start auto save timer if needed - if (m_Doc->autoSave() && ScCore->usingGUI()) + if (m_Doc->autoSave() && ScCore->usingGUI()) m_Doc->restartAutoSaveTimer(); -// m_Doc->autoSaveTimer->start(m_Doc->autoSaveTime()); +// m_Doc->autoSaveTimer->start(m_Doc->autoSaveTime()); if (m_mwProgressBar!=0) m_mwProgressBar->setValue(reader.characterOffset()); @@ -1977,8 +1977,8 @@ namespace { pstyle.resetGapAfter(); if (pstyle.dropCapLines() < 0) pstyle.resetDropCapLines(); - if (pstyle.dropCapOffset() <= -16000) - pstyle.resetDropCapOffset(); + if (pstyle.parEffectOffset() <= -16000) + pstyle.resetParEffectOffset(); fixLegacyCharStyle(pstyle.charStyle()); } @@ -2556,13 +2556,25 @@ void Scribus150Format::readParagraphStyle(ScribusDoc *doc, ScXmlStreamReader& re if (attrs.hasAttribute(NACH)) newStyle.setGapAfter(attrs.valueAsDouble(NACH)); + static const QString ParagraphEffectCharStyle("ParagraphEffectCharStyle"); + if (attrs.hasAttribute(ParagraphEffectCharStyle)) + newStyle.setPeCharStyleName(attrs.valueAsString(ParagraphEffectCharStyle)); + + static const QString ParagraphEffectOffset("ParagraphEffectOffset"); + if (attrs.hasAttribute(ParagraphEffectOffset)) + newStyle.setParEffectOffset(attrs.valueAsDouble(ParagraphEffectOffset)); + + static const QString ParagraphEffectIndent("ParagraphEffectIndent"); + if (attrs.hasAttribute(ParagraphEffectIndent)) + newStyle.setParEffectIndent(attrs.valueAsDouble(ParagraphEffectIndent)); + static const QString DROP("DROP"); if (attrs.hasAttribute(DROP)) newStyle.setHasDropCap(static_cast<bool>(attrs.valueAsInt(DROP))); static const QString DROPCHSTYLE("DROPCHSTYLE"); if (attrs.hasAttribute(DROPCHSTYLE)) - newStyle.setDcCharStyleName(attrs.valueAsString(DROPCHSTYLE)); + newStyle.setPeCharStyleName(attrs.valueAsString(DROPCHSTYLE)); static const QString DROPLIN("DROPLIN"); if (attrs.hasAttribute(DROPLIN)) @@ -2570,7 +2582,55 @@ void Scribus150Format::readParagraphStyle(ScribusDoc *doc, ScXmlStreamReader& re static const QString DROPDIST("DROPDIST"); if (attrs.hasAttribute(DROPDIST)) - newStyle.setDropCapOffset(attrs.valueAsDouble(DROPDIST)); + newStyle.setParEffectOffset(attrs.valueAsDouble(DROPDIST)); + + static const QString Bullet("Bullet"); + if (attrs.hasAttribute(Bullet)) + newStyle.setHasBullet(static_cast<bool>(attrs.valueAsInt(Bullet))); + + static const QString BulletStr("BulletStr"); + if (attrs.hasAttribute(BulletStr)) + newStyle.setBulletStr(attrs.valueAsString(BulletStr)); + + static const QString Numeration("Numeration"); + if (attrs.hasAttribute(Numeration)) + newStyle.setHasNum(static_cast<bool>(attrs.valueAsInt(Numeration))); + + static const QString NumerationName("NumerationName"); + if (attrs.hasAttribute(NumerationName)) + newStyle.setNumName(attrs.valueAsString(NumerationName)); + + static const QString NumerationFormat("NumerationFormat"); + if (attrs.hasAttribute(NumerationFormat)) + newStyle.setNumFormat(attrs.valueAsInt(NumerationFormat)); + + static const QString NumerationLevel("NumerationLevel"); + if (attrs.hasAttribute(NumerationLevel)) + newStyle.setNumLevel(attrs.valueAsInt(NumerationLevel)); + + static const QString NumerationStart("NumerationStart"); + if (attrs.hasAttribute(NumerationStart)) + newStyle.setNumStart(attrs.valueAsInt(NumerationStart)); + + static const QString NumearationPrefix("NumerationPrefix"); + if (attrs.hasAttribute(NumearationPrefix)) + newStyle.setNumPrefix(attrs.valueAsString(NumearationPrefix)); + + static const QString NumerationSuffix("NumerationSuffix"); + if (attrs.hasAttribute(NumerationSuffix)) + newStyle.setNumSuffix(attrs.valueAsString(NumerationSuffix)); + + static const QString NumerationRestart("NumerationRestart"); + if (attrs.hasAttribute(NumerationRestart)) + newStyle.setNumRestart(attrs.valueAsInt(NumerationRestart)); + + static const QString NumerationOther("NumeartionOther"); + if (attrs.hasAttribute(NumerationOther)) + newStyle.setNumOther(static_cast<bool>(attrs.valueAsInt(NumerationOther))); + + static const QString NumearationHigher("NumerationHigher"); + if (attrs.hasAttribute(NumearationHigher)) + newStyle.setNumHigher(static_cast<bool>(attrs.valueAsInt(NumearationHigher))); static const QString PSHORTCUT("PSHORTCUT"); if (attrs.hasAttribute(PSHORTCUT)) diff --git a/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp b/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp index cb25884..c0e6453 100644 --- a/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp +++ b/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp @@ -639,14 +639,40 @@ void Scribus150Format::putPStyle(ScXmlStreamWriter & docu, const ParagraphStyle docu.writeAttribute("VOR", style.gapBefore()); if ( ! style.isInhGapAfter()) docu.writeAttribute("NACH", style.gapAfter()); + if ( ! style.isInhPeCharStyleName()) + docu.writeAttribute("ParagraphEffectCharStyle", style.peCharStyleName()); + if ( ! style.isInhParEffectOffset()) + docu.writeAttribute("ParagraphEffectOffset", style.parEffectOffset()); + if ( ! style.isInhParEffectIndent()) + docu.writeAttribute("ParagraphEffectIndent", static_cast<int>(style.parEffectIndent())); if ( ! style.isInhHasDropCap()) docu.writeAttribute("DROP", static_cast<int>(style.hasDropCap())); - if ( ! style.isInhDcCharStyleName()) - docu.writeAttribute("DROPCHSTYLE", style.dcCharStyleName()); if ( ! style.isInhDropCapLines()) docu.writeAttribute("DROPLIN", style.dropCapLines()); - if ( ! style.isInhDropCapOffset()) - docu.writeAttribute("DROPDIST", style.dropCapOffset()); + if ( ! style.isInhHasBullet()) + docu.writeAttribute("Bullet", static_cast<int>(style.hasBullet())); + if ( ! style.isInhBulletStr()) + docu.writeAttribute("BulletStr", style.bulletStr()); + if ( ! style.isInhHasNum()) + docu.writeAttribute("Numeration", static_cast<int>(style.hasNum())); + if ( ! style.isInhNumFormat()) + docu.writeAttribute("NumerationFormat", style.numFormat()); + if ( ! style.isInhNumName()) + docu.writeAttribute("NumerationName", style.numName()); + if ( ! style.isInhNumLevel()) + docu.writeAttribute("NumerationLevel", style.numLevel()); + if ( ! style.isInhNumPrefix()) + docu.writeAttribute("NumerationPrefix", style.numPrefix()); + if ( ! style.isInhNumSuffix()) + docu.writeAttribute("NumerationSuffix", style.numSuffix()); + if ( ! style.isInhNumStart()) + docu.writeAttribute("NumerationStart", style.numStart()); + if ( ! style.isInhNumRestart()) + docu.writeAttribute("NumerationRestart", style.numRestart()); + if ( ! style.isInhNumOther()) + docu.writeAttribute("NumerationOther", static_cast<int>(style.numOther())); + if ( ! style.isInhNumHigher()) + docu.writeAttribute("NumerationHigher", static_cast<int>(style.numHigher())); if ( ! style.isInhOpticalMargins()) docu.writeAttribute("OpticalMargins", style.opticalMargins()); if ( ! style.isInhHyphenationMode()) @@ -1566,9 +1592,12 @@ void Scribus150Format::writeITEXTs(ScribusDoc *doc, ScXmlStreamWriter &docu, Pag else if (ch == SpecialChars::OBJECT && item->itemText.item(k)->mark != NULL) { Mark* mark = item->itemText.item(k)->mark; - docu.writeEmptyElement("MARK"); - docu.writeAttribute("label", mark->label); - docu.writeAttribute("type", mark->getType()); + if (!mark->isType(MARKBullNumType)) + { //dont save marks for bullets and numbering + docu.writeEmptyElement("MARK"); + docu.writeAttribute("label", mark->label); + docu.writeAttribute("type", mark->getType()); + } } else if (ch == SpecialChars::PARSEP) // stores also the paragraphstyle for preceding chars putPStyle(docu, item->itemText.paragraphStyle(k), "para"); diff --git a/Scribus/scribus/plugins/gettext/odtim/contentreader.cpp b/Scribus/scribus/plugins/gettext/odtim/contentreader.cpp index 65b675a..a6ff041 100644 --- a/Scribus/scribus/plugins/gettext/odtim/contentreader.cpp +++ b/Scribus/scribus/plugins/gettext/odtim/contentreader.cpp @@ -130,7 +130,7 @@ bool ContentReader::startElement(const QString&, const QString&, const QString & if (currentListStyle) { currentListStyle->advance(); - write(currentListStyle->bullet()); + //write(currentListStyle->bullet()); } } else if (name == "office:annotation") diff --git a/Scribus/scribus/plugins/gettext/odtim/stylereader.cpp b/Scribus/scribus/plugins/gettext/odtim/stylereader.cpp index 6c2ea96..d9a0866 100644 --- a/Scribus/scribus/plugins/gettext/odtim/stylereader.cpp +++ b/Scribus/scribus/plugins/gettext/odtim/stylereader.cpp @@ -167,6 +167,16 @@ StyleReader::StyleReader(QString documentName, gtWriter *w, ListLevel *llevel = new ListLevel(ulevel, bstyle, prefix, suffix, bullet, displayLevels, startAt); currentListStyle->addLevel(ulevel, llevel); readProperties = true; + + gtParagraphStyle* s = dynamic_cast<gtParagraphStyle*>(currentStyle); + assert(s != NULL); + if (bstyle == Bullet || bstyle == Graphic) + s->setBullet(true); + else + { + Q_ASSERT(((int) bstyle > 0) && ((int) bstyle < 6)); + s->setNum(true, (int) bstyle -1, 0, startAt+1, prefix, suffix); + } } else if ((name == "style:drop-cap") && (readProperties)) { @@ -498,6 +508,18 @@ StyleReader::StyleReader(QString documentName, gtWriter *w, (name == "text:list-level-style-number") || (name == "text:list-level-style-image")) && (currentStyle != NULL)) { +// if ((name == "text:list-level-style-bullet")) +// { +// gtParagraphStyle* s = dynamic_cast<gtParagraphStyle*>(currentStyle); +// if (s) +// s->setBullet(true); +// } +// else if ((name == "text:list-level-style-number")) +// { +// gtParagraphStyle* s = dynamic_cast<gtParagraphStyle*>(currentStyle); +// if (s) +// s->setNum(true); +// } setStyle(currentStyle->getName(), currentStyle); currentStyle = NULL; parentStyle = NULL; @@ -572,6 +594,7 @@ StyleReader::StyleReader(QString documentName, gtWriter *w, nameByAttrs += QString("%1-").arg(s->getFirstLineIndent()); nameByAttrs += QString("%1-").arg(s->getAlignment()); nameByAttrs += QString("%1-").arg(s->hasDropCap()); + nameByAttrs += QString("%1-").arg(s->hasBullet()); nameByAttrs += QString("%1-").arg(s->getFont()->getColor()); nameByAttrs += QString("%1-").arg(s->getFont()->getStrokeColor()); // TODO is this important ?? diff --git a/Scribus/scribus/plugins/gettext/xtgim/xtgscanner.cpp b/Scribus/scribus/plugins/gettext/xtgim/xtgscanner.cpp index 35d1ee6..c5748f2 100755 --- a/Scribus/scribus/plugins/gettext/xtgim/xtgscanner.cpp +++ b/Scribus/scribus/plugins/gettext/xtgim/xtgscanner.cpp @@ -731,7 +731,7 @@ void XtgScanner::setDropCap() { flushText(); currentParagraphStyle.setDropCapLines(lineCount); - currentParagraphStyle.setDropCapOffset(charCount); + currentParagraphStyle.setParEffectOffset(charCount); currentParagraphStyle.setHasDropCap(true); writer->setStyle(currentParagraphStyle); currentParagraphStyle = writer->getCurrentStyle(); @@ -741,7 +741,7 @@ void XtgScanner::setDropCap() if (define == 2) { defParagraphStyle.setDropCapLines(lineCount); - defParagraphStyle.setDropCapOffset(charCount); + defParagraphStyle.setParEffectOffset(charCount); defParagraphStyle.setHasDropCap(true); } } diff --git a/Scribus/scribus/plugins/scriptplugin/cmdstyle.cpp b/Scribus/scribus/plugins/scriptplugin/cmdstyle.cpp index 1152d68..fc1967b 100644 --- a/Scribus/scribus/plugins/scriptplugin/cmdstyle.cpp +++ b/Scribus/scribus/plugins/scriptplugin/cmdstyle.cpp @@ -22,6 +22,7 @@ for which a new license (GPL+exception) is in place. Special thanks go to avox for helping me! */ PyObject *scribus_createparagraphstyle(PyObject* /* self */, PyObject* args, PyObject* keywords) { + //TODO - new paragraph properties for bullets and numbering char* keywordargs[] = { const_cast<char*>("name"), const_cast<char*>("linespacingmode"), @@ -40,11 +41,11 @@ PyObject *scribus_createparagraphstyle(PyObject* /* self */, PyObject* args, PyO char *Name = const_cast<char*>(""), *CharStyle = const_cast<char*>(""); int LineSpacingMode = 0, Alignment = 0, DropCapLines = 2, HasDropCap = 0; double LineSpacing = 15.0, LeftMargin = 0.0, RightMargin = 0.0; - double GapBefore = 0.0, GapAfter = 0.0, FirstIndent = 0.0, DropCapOffset = 0; + double GapBefore = 0.0, GapAfter = 0.0, FirstIndent = 0.0, PEOffset = 0; if (!PyArg_ParseTupleAndKeywords(args, keywords, "es|ididddddiides", keywordargs, "utf-8", &Name, &LineSpacingMode, &LineSpacing, &Alignment, &LeftMargin, &RightMargin, &GapBefore, &GapAfter, &FirstIndent, - &HasDropCap, &DropCapLines, &DropCapOffset, "utf-8", &CharStyle)) + &HasDropCap, &DropCapLines, &PEOffset, "utf-8", &CharStyle)) return NULL; if(!checkHaveDocument()) return NULL; @@ -74,7 +75,7 @@ PyObject *scribus_createparagraphstyle(PyObject* /* self */, PyObject* args, PyO return NULL; } TmpParagraphStyle.setDropCapLines(DropCapLines); - TmpParagraphStyle.setDropCapOffset(DropCapOffset); + TmpParagraphStyle.setParEffectOffset(PEOffset); TmpParagraphStyle.charStyle().setParent(CharStyle); StyleSet<ParagraphStyle> TmpStyleSet; diff --git a/Scribus/scribus/sampleitem.cpp b/Scribus/scribus/sampleitem.cpp index 9a18a8d..1d60fd5 100644 --- a/Scribus/scribus/sampleitem.cpp +++ b/Scribus/scribus/sampleitem.cpp @@ -47,8 +47,10 @@ SampleItem::SampleItem() : QObject() tmpStyle.charStyle().setFontSize(m_Doc->itemToolPrefs().textSize); // tmpStyle.tabValues().clear(); tmpStyle.setHasDropCap(false); + tmpStyle.setHasBullet(false); + tmpStyle.setHasNum(false); tmpStyle.setDropCapLines(0);//2; - tmpStyle.setDropCapOffset(0); + tmpStyle.setParEffectOffset(0); tmpStyle.charStyle().setFeatures(QStringList(CharStyle::INHERIT)); tmpStyle.charStyle().setFillColor("__blackforpreview__"); tmpStyle.charStyle().setFillShade(100); //m_Doc->toolSettings.dShade; @@ -178,9 +180,19 @@ void SampleItem::setDropLin(int dropLin) tmpStyle.setDropCapLines(dropLin); } -void SampleItem::setDropDist(double dropDist) +void SampleItem::setParEffectDist(double dist) { - tmpStyle.setDropCapOffset(dropDist); + tmpStyle.setParEffectOffset(dist); +} + +void SampleItem::setBullet(bool bul) +{ + tmpStyle.setHasBullet(bul); +} + +void SampleItem::setNum(bool num) +{ + tmpStyle.setHasNum(num); } void SampleItem::setFontEffect(int fontEffect) diff --git a/Scribus/scribus/sampleitem.h b/Scribus/scribus/sampleitem.h index 18a15a2..bbcd552 100644 --- a/Scribus/scribus/sampleitem.h +++ b/Scribus/scribus/sampleitem.h @@ -67,8 +67,10 @@ class SCRIBUS_API SampleItem : QObject void setFontSize(int fontSize, bool autoLineSpa=false); //void setTabValues(QValueList<PageItem::TabRecord> tabValues); void setDrop(bool drop); + void setBullet(bool bul); + void setNum(bool num); void setDropLin(int dropLin); - void setDropDist(double dropDist); + void setParEffectDist(double dropDist); void setFontEffect(int fontEffect); void setFColor(QString fColor); void setFShade(int fShade); diff --git a/Scribus/scribus/scribus.cpp b/Scribus/scribus/scribus.cpp index 054676d..3e64d9c 100644 --- a/Scribus/scribus/scribus.cpp +++ b/Scribus/scribus/scribus.cpp @@ -105,9 +105,9 @@ for which a new license (GPL+exception) is in place. #include "pageitem_group.h" #include "pageitem_imageframe.h" #include "pageitem_latexframe.h" -#include "pageitem_noteframe.h" #include "pageitem_table.h" #include "pageitem_textframe.h" +#include "pageitem_noteframe.h" #include "pagesize.h" #include "pdflib.h" #include "pdfoptions.h" @@ -1081,6 +1081,7 @@ void ScribusMainWindow::initMenuBar() scrMenuMgr->addMenuItem(scrActions["extrasHyphenateText"], "Extras", false); scrMenuMgr->addMenuItem(scrActions["extrasDeHyphenateText"], "Extras", false); scrMenuMgr->addMenuItem(scrActions["extrasGenerateTableOfContents"], "Extras", false); + scrMenuMgr->addMenuItem(scrActions["extrasUpdateDocument"], "Extras", false); connect(scrMenuMgr->getLocalPopupMenu("Extras"), SIGNAL(aboutToShow()), this, SLOT(extrasMenuAboutToShow())); //Window menu @@ -1697,7 +1698,7 @@ void ScribusMainWindow::keyPressEvent(QKeyEvent *k) currItem->handleModeEditKey(k, keyrep); } //FIXME:av view->oldCp = currItem->CPos; - if (currItem->itemType() == PageItem::TextFrame) + if (currItem->isTextFrame()) { bool kr=keyrep; view->canvasMode()->keyPressEvent(k); //Hack for 1.4.x for stopping the cursor blinking while moving about @@ -1712,7 +1713,8 @@ void ScribusMainWindow::keyPressEvent(QKeyEvent *k) } keyrep=kr; } - slotDocCh(false); + if (!currItem->isTextFrame() || (currItem->isAutoNoteFrame() && currItem->asNoteFrame()->notesList().isEmpty())) + slotDocCh(false); doc->regionsChanged()->update(QRectF()); } } @@ -2353,6 +2355,7 @@ void ScribusMainWindow::newActWin(QMdiSubWindow *w) scrActions["viewShowRulers"]->setChecked(doc->guidesPrefs().rulersShown); scrActions["viewRulerMode"]->setChecked(doc->guidesPrefs().rulerMode); scrActions["extrasGenerateTableOfContents"]->setEnabled(doc->hasTOCSetup()); + scrActions["extrasUpdateDocument"]->setEnabled(true); if (!doc->masterPageMode()) pagePalette->Rebuild(); outlinePalette->setDoc(doc); @@ -3431,6 +3434,17 @@ void ScribusMainWindow::slotDocCh(bool /*reb*/) Q_ASSERT(plugin); // all the returned names should represent loaded plugins plugin->changedDoc(doc); } + if (doc->flag_NumUpdateRequest) + { + doc->setupNumerations(); + emit UpdateRequest(reqNumUpdate); + } + while (doc->flag_Renumber) + { + doc->updateNumbers(); + if (!doc->flag_Renumber) + doc->regionsChanged()->update(QRect()); + } if (m_marksCount != doc->marksList().count() || doc->notesChanged() || doc->flag_updateEndNotes || doc->flag_updateMarksLabels) { bool sendUpdateReqest = false; @@ -4264,6 +4278,7 @@ bool ScribusMainWindow::loadDoc(QString fileName) /*QTime t; t.start();*/ int docItemsCount=doc->Items->count(); + doc->flag_Renumber = false; for (int azz=0; azz<docItemsCount; ++azz) { PageItem *ite = doc->Items->at(azz); @@ -4310,6 +4325,8 @@ bool ScribusMainWindow::loadDoc(QString fileName) // Seems to fix crash on loading ActWin = NULL; newActWin(w->getSubWin()); + doc->updateNumbers(true); + emit UpdateRequest(reqNumUpdate); doc->setCurrentPage(doc->DocPages.at(0)); view->cmsToolbarButton->setChecked(doc->HasCMS); view->zoom(); @@ -4417,6 +4434,8 @@ void ScribusMainWindow::slotGetContent() if (doc->Items->at(a)->isBookmark) bookmarkPalette->BView->ChangeText(doc->Items->at(a)); } + if (!impsetup.textOnly) + doc->flag_NumUpdateRequest = true; view->DrawNew(); slotDocCh(); styleManager->setDoc(doc); @@ -8052,6 +8071,7 @@ void ScribusMainWindow::slotDocSetup() scrActions["viewShowRulers"]->setChecked(doc->guidesPrefs().rulersShown); scrActions["viewRulerMode"]->setChecked(doc->guidesPrefs().rulerMode); scrActions["extrasGenerateTableOfContents"]->setEnabled(doc->hasTOCSetup()); + scrActions["extrasUpdateDocument"]->setEnabled(true); view->cmsToolbarButton->setChecked(doc->HasCMS); //doc emits changed() via this doc->setMasterPageMode(true); @@ -9986,6 +10006,17 @@ void ScribusMainWindow::generateTableOfContents() tocGenerator->generateDefault(); } +void ScribusMainWindow::updateDocument() +{ + if (HaveDoc) + { + doc->updateNumbers(true); + doc->updateMarks(true); + doc->regionsChanged()->update(QRect()); + emit UpdateRequest(reqNumUpdate); + } +} + void ScribusMainWindow::insertSampleText() { LoremManager m(doc, this); diff --git a/Scribus/scribus/scribus.h b/Scribus/scribus/scribus.h index c49a3b8..afcbc2b 100644 --- a/Scribus/scribus/scribus.h +++ b/Scribus/scribus/scribus.h @@ -446,6 +446,7 @@ public slots: void objectAttributes(); void getImageInfo(); void generateTableOfContents(); + void updateDocument(); // void saveStyles(StilFormate *dia); //still required for style save from SE void setNewAlignment(int a); diff --git a/Scribus/scribus/scribusdoc.cpp b/Scribus/scribus/scribusdoc.cpp index 40c7f58..f9b804d 100644 --- a/Scribus/scribus/scribusdoc.cpp +++ b/Scribus/scribus/scribusdoc.cpp @@ -55,6 +55,7 @@ for which a new license (GPL+exception) is in place. #include "ui/inserttablecolumnsdialog.h" #include "ui/inserttablerowsdialog.h" #include "notesstyles.h" +#include "numeration.h" #include "ui/notesstyleseditor.h" #include "pageitem.h" #include "pageitem_imageframe.h" @@ -276,7 +277,9 @@ ScribusDoc::ScribusDoc() : UndoObject( tr("Document")), Observable<ScribusDoc>(N flag_restartMarksRenumbering(false), flag_updateMarksLabels(false), flag_updateEndNotes(false), - flag_layoutNotesFrames(true) + flag_layoutNotesFrames(true), + flag_Renumber(false), + flag_NumUpdateRequest(false) { docUnitRatio=unitGetRatioFromIndex(docPrefsData.docSetupPrefs.docUnitIndex); docPrefsData.docSetupPrefs.pageHeight=0; @@ -292,6 +295,15 @@ ScribusDoc::ScribusDoc() : UndoObject( tr("Document")), Observable<ScribusDoc>(N editOnPreview = false; previewVisual = -1; dontResize = false; + //create default numeration + NumStruct * numS = new NumStruct; + numS->m_name = "default"; + Numeration newNum; + numS->m_nums.insert(0, newNum); + numS->m_counters.insert(0, 0); + numS->m_lastlevel = -1; + numerations.insert("default", numS); + currentEditedTextframe = NULL; } @@ -380,7 +392,9 @@ ScribusDoc::ScribusDoc(const QString& docName, int unitindex, const PageSize& pa flag_restartMarksRenumbering(false), flag_updateMarksLabels(false), flag_updateEndNotes(false), - flag_layoutNotesFrames(true) + flag_layoutNotesFrames(true), + flag_Renumber(false), + flag_NumUpdateRequest(false) { docPrefsData.docSetupPrefs.docUnitIndex=unitindex; docPrefsData.docSetupPrefs.pageHeight=pagesize.height(); @@ -489,8 +503,10 @@ void ScribusDoc::init() pstyle.setGapBefore(0); pstyle.setGapAfter(0); pstyle.setHasDropCap(false); + pstyle.setHasBullet(false); + pstyle.setHasNum(false); pstyle.setDropCapLines(2); - pstyle.setDropCapOffset(0); + pstyle.setParEffectOffset(0); pstyle.charStyle().setParent(""); CharStyle cstyle; @@ -688,6 +704,9 @@ ScribusDoc::~ScribusDoc() delete m_docNotesStylesList.takeFirst(); docPatterns.clear(); docGradients.clear(); + foreach (NumStruct* ns, numerations.values()) + delete ns; + numerations.clear(); while (!DocItems.isEmpty()) { delete DocItems.takeFirst(); @@ -1487,6 +1506,11 @@ void ScribusDoc::redefineStyles(const StyleSet<ParagraphStyle>& newStyles, bool } } docParagraphStyles.invalidate(); + if (!isLoading()) + { + flag_Renumber = true; + flag_NumUpdateRequest = true; + } } void ScribusDoc::redefineCharStyles(const StyleSet<CharStyle>& newStyles, bool removeUnused) @@ -1867,7 +1891,7 @@ void ScribusDoc::restore(UndoState* state, bool isUndo) NS->setName(ss->get("name")); NS->setStart(ss->getInt("start")); NS->setEndNotes(ss->getBool("endNotes")); - NS->setType((NumerationType) ss->getInt("numStyle")); + NS->setType((NumFormat) ss->getInt("numFormat")); NS->setRange((NumerationRange) ss->getInt("range")); NS->setPrefix(ss->get("prefix")); NS->setSuffix(ss->get("suffix")); @@ -1908,7 +1932,7 @@ void ScribusDoc::restore(UndoState* state, bool isUndo) NS->setStart(ss->getInt("start")); NS->setRange((NumerationRange) ss->getInt("range")); NS->setEndNotes(ss->getBool("endNotes")); - NS->setType((NumerationType) ss->getInt("numStyle")); + NS->setType((NumFormat) ss->getInt("numFormat")); NS->setPrefix(ss->get("prefix")); NS->setSuffix(ss->get("suffix")); NS->setAutoNotesHeight(ss->getBool("autoH")); @@ -1926,7 +1950,7 @@ void ScribusDoc::restore(UndoState* state, bool isUndo) NS->setStart(ss->getInt("NEWstart")); NS->setRange((NumerationRange) ss->getInt("NEWrange")); NS->setEndNotes(ss->getBool("NEWendNotes")); - NS->setType((NumerationType) ss->getInt("NEWnumStyle")); + NS->setType((NumFormat) ss->getInt("NEWnumFormat")); NS->setPrefix(ss->get("NEWprefix")); NS->setSuffix(ss->get("NEWsuffix")); NS->setAutoNotesHeight(ss->getBool("NEWautoH")); @@ -4446,10 +4470,25 @@ void ScribusDoc::checkItemForFonts(PageItem *it, QMap<QString, QMap<uint, FPoint int stop = it->isTextFrame() ? it->lastInFrame() + 1 : it->itemText.length(); for (int e = start; e < stop; ++e) { - if (! Really.contains(it->itemText.charStyle(e).font().replacementName()) ) + const ScFace* font = &it->itemText.charStyle(e).font(); + if (it->itemText.item(e)->mark) { - if (!it->itemText.charStyle(e).font().replacementName().isEmpty()) - Really.insert(it->itemText.charStyle(e).font().replacementName(), QMap<uint, FPointArray>()); + QString mrkStr = it->itemText.item(e)->mark->getString(); + for (int i=0;i<mrkStr.length(); ++i) + { + if (font->canRender(mrkStr[i].unicode())) + { + uint gl = font->char2CMap(mrkStr[i]); + FPointArray gly(font->glyphOutline(gl)); + if (!font->replacementName().isEmpty()) + Really[font->replacementName()].insert(gl, gly); + } + } + } + if (! Really.contains(font->replacementName()) ) + { + if (!font->replacementName().isEmpty()) + Really.insert(font->replacementName(), QMap<uint, FPointArray>()); } uint chr = it->itemText.text(e).unicode(); if ((chr == 13) || (chr == 32) || ((chr >= 26) && (chr <= 29))) @@ -4467,10 +4506,10 @@ void ScribusDoc::checkItemForFonts(PageItem *it, QMap<QString, QMap<uint, FPoint chstr = chstr.toUpper(); } chr = chstr.unicode(); - uint gl = it->itemText.charStyle(e).font().char2CMap(chstr); - gly = it->itemText.charStyle(e).font().glyphOutline(gl); - if (!it->itemText.charStyle(e).font().replacementName().isEmpty()) - Really[it->itemText.charStyle(e).font().replacementName()].insert(gl, gly); + uint gl = font->char2CMap(chstr); + gly = font->glyphOutline(gl); + if (!font->replacementName().isEmpty()) + Really[font->replacementName()].insert(gl, gly); } for (int t1 = 0; t1 < it->itemText.defaultStyle().tabValues().count(); t1++) { @@ -4483,10 +4522,10 @@ void ScribusDoc::checkItemForFonts(PageItem *it, QMap<QString, QMap<uint, FPoint chstr = chstr.toUpper(); } chr = chstr.unicode(); - uint gl = it->itemText.charStyle(e).font().char2CMap(chstr); - gly = it->itemText.charStyle(e).font().glyphOutline(gl); - if (!it->itemText.charStyle(e).font().replacementName().isEmpty()) - Really[it->itemText.charStyle(e).font().replacementName()].insert(gl, gly); + uint gl = font->char2CMap(chstr); + gly = font->glyphOutline(gl); + if (!font->replacementName().isEmpty()) + Really[font->replacementName()].insert(gl, gly); } continue; } @@ -4562,16 +4601,17 @@ void ScribusDoc::checkItemForFonts(PageItem *it, QMap<QString, QMap<uint, FPoint for (int pnti=0;pnti<pageNumberText.length(); ++pnti) { uint chr = pageNumberText[pnti].unicode(); - if (it->itemText.charStyle(e).font().canRender(chr)) + if (font->canRender(chr)) { - uint gl = it->itemText.charStyle(e).font().char2CMap(pageNumberText[pnti]); - FPointArray gly(it->itemText.charStyle(e).font().glyphOutline(gl)); - if (!it->itemText.charStyle(e).font().replacementName().isEmpty()) - Really[it->itemText.charStyle(e).font().replacementName()].insert(gl, gly); + uint gl = font->char2CMap(pageNumberText[pnti]); + FPointArray gly(font->glyphOutline(gl)); + if (!font->replacementName().isEmpty()) + Really[font->replacementName()].insert(gl, gly); } } continue; } + if (it->itemText.charStyle(e).effects() & ScStyle_SoftHyphenVisible) { uint gl = it->itemText.charStyle(e).font().char2CMap(QChar('-')); @@ -6810,7 +6850,7 @@ void ScribusDoc::setInlineEditMode(bool mode, int id) } } -void ScribusDoc::addSection(const int number, const QString& name, const uint fromindex, const uint toindex, const DocumentSectionType type, const uint sectionstartindex, const bool reversed, const bool active, const QChar fillChar, int fieldWidth) +void ScribusDoc::addSection(const int number, const QString& name, const uint fromindex, const uint toindex, const NumFormat type, const uint sectionstartindex, const bool reversed, const bool active, const QChar fillChar, int fieldWidth) { struct DocumentSection newSection; uint docPageCount=DocPages.count(); @@ -9085,6 +9125,69 @@ void ScribusDoc::itemSelection_EraseParagraphStyle(Selection* customSelection) regionsChanged()->update(QRectF()); } +void ScribusDoc::itemSelection_ClearBulNumStrings(Selection* customSelection) +{ + Selection* itemSelection = (customSelection!=0) ? customSelection : m_Selection; + assert(itemSelection!=0); + uint selectedItemCount=itemSelection->count(); + if (selectedItemCount == 0) + return; + for (uint aa = 0; aa < selectedItemCount; ++aa) + { + PageItem *currItem = itemSelection->itemAt(aa); + if (currItem->itemText.length() == 0) + continue; + int currItemTextCount = currItem->itemText.length(); + if ((appMode != modeEdit) && (appMode != modeEditTable)) + { + for (int pos = 0; pos < currItemTextCount; ++pos) + { + ScText* hl = currItem->itemText.item(pos); + if (hl->hasMark() && hl->mark->isType(MARKBullNumType)) + { + if (UndoManager::undoEnabled()) + { + ScItemState<QPair<int,QString> > *is = new ScItemState<QPair <int,QString> >(Um::SetStyle); + is->set("CLEARMARK", "clear_mark_string"); + is->setItem(qMakePair(pos, hl->mark->getString())); + undoManager->action(currItem, is); + } + hl->mark->setString(QString()); + } + } + } + else + { + int start; + int stop; + start = stop = currItem->itemText.normalizedCursorPosition(); + if (currItem->HasSel) + { + start = currItem->itemText.startOfSelection(); + stop = currItem->itemText.endOfSelection(); + } + start = currItem->itemText.startOfParagraph(currItem->itemText.nrOfParagraph(start)); + stop = currItem->itemText.endOfParagraph(currItem->itemText.nrOfParagraph(stop)); + for (int pos=start; pos < stop; ++pos) + { + ScText* hl = currItem->itemText.item(pos); + if (hl->hasMark() && hl->mark->isType(MARKBullNumType)) + { + if (UndoManager::undoEnabled()) + { + ScItemState<QPair<int,QString> > *is = new ScItemState<QPair <int,QString> >(Um::SetStyle); + is->set("CLEARMARKSTRING", "clear_mark_string"); + is->setItem(qMakePair(pos, hl->mark->getString())); + undoManager->action(currItem, is); + } + hl->mark->setString(QString()); + } + } + } + } + flag_Renumber = true; +} + void ScribusDoc::itemSelection_ApplyParagraphStyle(const ParagraphStyle & newStyle, Selection* customSelection, bool rmDirectFormatting) { Selection* itemSelection = (customSelection!=0) ? customSelection : m_Selection; @@ -9092,6 +9195,7 @@ void ScribusDoc::itemSelection_ApplyParagraphStyle(const ParagraphStyle & newSty uint selectedItemCount=itemSelection->count(); if (selectedItemCount == 0) return; + itemSelection_ClearBulNumStrings(itemSelection); UndoTransaction* activeTransaction = NULL; if (UndoManager::undoEnabled() && selectedItemCount > 1) activeTransaction = new UndoTransaction(undoManager->beginTransaction(Um::SelectionGroup, Um::IGroup, Um::ApplyTextStyle, newStyle.displayName(), Um::IFont)); @@ -16239,6 +16343,7 @@ Serializer *ScribusDoc::textSerializer() return m_tserializer; } + void ScribusDoc::RotMode(const int& val) { rotMode = val; @@ -16277,7 +16382,7 @@ void ScribusDoc::setNewPrefs(const ApplicationPrefs& prefsData, const Applicatio */ docHyphenator->slotNewSettings(docPrefsData.hyphPrefs.MinWordLen, - docPrefsData.hyphPrefs.Automatic, + !docPrefsData.hyphPrefs.Automatic, docPrefsData.hyphPrefs.AutoCheck, docPrefsData.hyphPrefs.HyCount); docHyphenator->ignoredWords = docPrefsData.hyphPrefs.ignoredWords; @@ -16632,7 +16737,7 @@ void ScribusDoc::checkItemForFrames(PageItem *it, int fIndex) for (int e = start; e < stop; ++e) { ScText *hl = it->itemText.item(e); - if ((hl->ch == SpecialChars::OBJECT) && (hl->hasObject(this))) + if (hl->hasObject(this)) { if (hl->getItem(this)->inlineCharID == fIndex) deleteList.prepend(e); @@ -16697,6 +16802,314 @@ void ScribusDoc::restartAutoSaveTimer() emit updateAutoSaveClock(); } +void ScribusDoc::setupNumerations() +{ + QList<NumStruct*> numList = numerations.values(); + while (!numList.isEmpty()) + delete numList.takeFirst(); + numerations.clear(); + + Numeration num; + NumStruct * numS = NULL; + for (int i=0; i < docParagraphStyles.count(); ++i) + { + if (docParagraphStyles[i].hasNum()) + { + ParagraphStyle &style = docParagraphStyles[i]; + QString name = style.numName(); + if (numerations.contains(name)) + numS = numerations.value(name); + else + { + numS = new NumStruct; + numS->m_name = name; + } + num.numFormat = (NumFormat) style.numFormat(); + num.prefix = style.numPrefix(); + num.suffix = style.numSuffix(); + num.start = style.numStart(); + int level = style.numLevel(); + if (level >= numS->m_counters.count()) + { + for (int i=numS->m_counters.count(); i <= level; ++i) + { + numS->m_nums.insert(i,num); + numS->m_counters.insert(i, 0); + } + } + numS->m_nums.replace(level, num); + numS->m_counters.replace(level, num.start -1); + numS->m_lastlevel = -1; + numerations.insert(numS->m_name, numS); + } + } + + if (!numerations.contains("default")) + { + //create default numeration + numS = new NumStruct; + numS->m_name = "default"; + Numeration newNum; + numS->m_nums.insert(0, newNum); + numS->m_counters.insert(0, 0); + numS->m_lastlevel = -1; + numerations.insert("default", numS); + } + + flag_NumUpdateRequest = false; + if (orgNumNames != numerations.keys()) + { + orgNumNames = numerations.keys(); + flag_NumUpdateRequest = true; + } + flag_Renumber = true; +} + +QString ScribusDoc::getNumberStr(QString numName, int level, bool reset, ParagraphStyle &style) +{ + Q_ASSERT(numerations.contains(numName)); + NumStruct * numS = numerations.value(numName); + numS->m_lastlevel = level; + + Numeration num = numS->m_nums[level]; + num.numFormat = (NumFormat) style.numFormat(); + num.start = style.numStart(); + num.prefix = style.numPrefix(); + num.suffix = style.numSuffix(); + numS->m_nums.replace(level, num); + + int currNum = numS->m_counters.at(level); + if (reset) + currNum = numS->m_nums[level].start -1; + ++currNum; + setNumerationCounter(numName, level, currNum); + + QString result = QString(); + for (int i=0; i <= level; ++i) + { + Numeration num = numS->m_nums[i]; + result.append(num.prefix); + result.append(num.numString(numS->m_counters.at(i))); + result.append(num.suffix); + } + return result; +} + +void ScribusDoc::setNumerationCounter(QString numName, int level, int number) +{ + NumStruct * numS = numerations.value(numName); + if (level > numS->m_counters.count()) + numS->m_counters.insert(level, number); + else + numS->m_counters.replace(level, number); +} + +bool ScribusDoc::updateLocalNums(StoryText& itemText) +{ + QList<Numeration> m_nums; + QList<int> m_counters; + bool needUpdate = false; + for (int pos = 0; pos < itemText.length(); ++pos) + { + if (pos != 0 && itemText.text(pos-1) != SpecialChars::PARSEP) + continue; + ScText* hl = itemText.item(pos); + if (hl->mark != NULL && hl->mark->isType(MARKBullNumType) && itemText.paragraphStyle(pos).hasNum()) + { + ParagraphStyle style = itemText.paragraphStyle(pos); + if (style.numName() == "<local block>") + { + int level = style.numLevel(); + while (m_counters.count() < (level + 1)) + { + m_counters.append(0); + Numeration num((NumFormat) style.numFormat()); + m_nums.append(num); + } + Numeration num = m_nums.at(level); + num.prefix = style.numPrefix(); + num.suffix = style.numSuffix(); + num.start = style.numStart(); + num.numFormat = (NumFormat) style.numFormat(); + m_nums.replace(level, num); + int count = m_counters.at(level); + bool reset = false; + if (pos == 0) + reset = true; + else if (pos > 0) + { + ParagraphStyle prevStyle; + prevStyle = itemText.paragraphStyle(pos -1); + reset = !prevStyle.hasNum() + || prevStyle.numName() != "<local block>" + || prevStyle.numLevel() < level + || prevStyle.numFormat() != style.numFormat(); + } + if ((level == 0) && (style.numFormat() != (int) num.numFormat)) + { + reset = true; + m_counters.clear(); + m_counters.append(0); + m_nums.clear(); + m_nums.append(num); + } + if (reset) + count = style.numStart(); + else + count++; + m_counters.replace(level, count); + //m_nums.insert(level, num); + QString result = QString(); + for (int i=0; i <= level; ++i) + { + result.append(m_nums.at(i).prefix); + result.append(getStringFromNum(m_nums.at(i).numFormat, m_counters.at(i))); + result.append(m_nums.at(i).suffix); + } + if (hl->mark->getString() != result) + { + hl->mark->setString(result); + needUpdate = true; + } + } + } + } + return needUpdate; +} + +void ScribusDoc::updateNumbers(bool updateNumerations) +{ + if (updateNumerations) + //after styles change reset all numerations settings + setupNumerations(); + //reset ALL counters + foreach (NumStruct * numS, numerations.values()) + for (int l = 0; l < numS->m_nums.count(); ++l) + numS->m_counters[l] = numS->m_nums[l].start -1; + + flag_Renumber = false; + //renumbering for doc, sections, page and frame range + for (int sec = 0; sec < sections().count(); ++sec) + { + //reset section range counters + foreach (NumStruct * numS, numerations.values()) + for (int l = 0; l < numS->m_nums.count(); ++l) + if (numS->m_nums[l].range == NSRsection) + numS->m_counters[l] = numS->m_nums[l].start -1; + + int start = sections().value(sec).fromindex; + int stop = sections().value(sec).toindex; + for (int page = start; page <= stop; ++page) + { + //reset page range counters + foreach (NumStruct * numS, numerations.values()) + for (int l = 0; l < numS->m_nums.count(); ++l) + if (numS->m_nums[l].range == NSRpage) + numS->m_counters[l] = numS->m_nums[l].start -1; + for (int i=0; i < DocItems.count(); ++i) + { + PageItem* item = DocItems.at(i); + if (item->OwnPage != page) + continue; + if (!item->isTextFrame()) + continue; + if (item->invalid) + continue; + + //reset items and stories range counters + foreach (NumStruct * numS, numerations.values()) + for (int l = 0; l < numS->m_nums.count(); ++l) + if ((numS->m_nums[l].range == NSRframe) || ((numS->m_nums[l].range == NSRstory) && (item->prevInChain() == NULL))) + numS->m_counters[l] = numS->m_nums[l].start -1; + + int pos = item->firstInFrame(); + if ((pos != 0) && (item->itemText.text(pos-1) != SpecialChars::PARSEP)) + pos = item->itemText.nextParagraph(pos)+1; + int last = item->lastInFrame(); + int len = item->itemText.length(); + while (pos <= last) + { + if ((pos == 0) || (item->itemText.text(pos - 1) == SpecialChars::PARSEP)) + { + ParagraphStyle style = item->itemText.paragraphStyle(pos); + if (style.hasNum() && style.numName() != "<local block>") + { + if (!numerations.contains(style.numName())) + { + ParagraphStyle newStyle; + newStyle.setNumName("<local block>"); + Selection tempSelection(this, false); + tempSelection.addItem(item, true); + itemSelection_ApplyParagraphStyle(newStyle, &tempSelection); + continue; + } + ScText * hl = item->itemText.item(pos); + bool resetNums = false; + if (numerations.value(style.numName())->m_lastlevel == -1) + resetNums = true; + else if (style.numOther()) + { + ParagraphStyle preStyle = item->itemText.paragraphStyle(pos -1); + //reset counter if prev style hasnt numeration or has other numeration + if (!preStyle.hasNum() || (preStyle.numName() != style.numName())) + resetNums = true; + } + else if (style.numHigher() && (style.numLevel() > numerations.value(style.numName())->m_lastlevel)) + resetNums = true; + + QString prefixStr = getNumberStr(style.numName(), style.numLevel(), resetNums, style); + numerations.value(style.numName())->m_lastlevel = style.numLevel(); + if (hl->mark == NULL) + { + BulNumMark* bnMark = new BulNumMark; + item->itemText.insertMark(bnMark,pos); + hl = item->itemText.item(pos); + hl->applyCharStyle(item->itemText.paragraphStyle(pos).charStyle()); + hl->setEffects(ScStyle_Default); + const StyleContext* cStyleContext = item->itemText.paragraphStyle(pos).charStyleContext(); + hl->setContext(cStyleContext); + } + if (hl->mark->getString() != prefixStr) + { + hl->mark->setString(prefixStr); + item->invalid = true; + flag_Renumber = true; + } + } + if (pos == last) + break; + if (item->itemText.text(pos) == SpecialChars::PARSEP) + ++pos; + else + { + pos = item->itemText.nextParagraph(pos)+1; + if (pos == len) + break; + } + } + } + } + } + } + + //update local numbering + foreach (PageItem* item, DocItems) + { + if (item->itemText.length() > 0) + { + PageItem* itemFirst = item->firstInChain(); + if (updateLocalNums(itemFirst->itemText)) + { + if (itemFirst->isTextFrame()) + itemFirst->asTextFrame()->invalidateLayout(true); + else + itemFirst->invalidateLayout(); + } + } + } + +} + QStringList ScribusDoc::marksLabelsList(MarkType type) { QStringList nameList; @@ -17040,7 +17453,7 @@ bool ScribusDoc::updateMarks(bool updateNotesMarks) { PageItem* mItem = findFirstMarkItem(mrk); mrk->OwnPage =(mItem != NULL) ? mItem->OwnPage : -1; - mrk->setItemName((mItem != NULL) ? mItem->itemName() : ""); + mrk->setItemName((mItem != NULL) ? mItem->itemName() : QString("")); } } } @@ -17230,7 +17643,7 @@ void ScribusDoc::undoSetNotesStyle(SimpleState* ss, NotesStyle *NS) ss->set("name", NS->name()); ss->set("start", NS->start()); ss->set("endNotes", NS->isEndNotes()); - ss->set("numStyle", (int) NS->getType()); + ss->set("numFormat", (int) NS->getType()); ss->set("range", (int) NS->range()); ss->set("prefix", NS->prefix()); ss->set("suffix", NS->suffix()); diff --git a/Scribus/scribus/scribusdoc.h b/Scribus/scribus/scribusdoc.h index 42ce843..0abdfd8 100644 --- a/Scribus/scribus/scribusdoc.h +++ b/Scribus/scribus/scribusdoc.h @@ -41,6 +41,7 @@ for which a new license (GPL+exception) is in place. #include "scribusapi.h" #include "colormgmt/sccolormgmtengine.h" #include "documentinformation.h" +#include "numeration.h" #include "marks.h" #include "notesstyles.h" #include "observable.h" @@ -938,7 +939,7 @@ public: * @brief Add a section to the document sections list * Set number to -1 to add in the default section if the map is empty */ - void addSection(const int number=0, const QString& name=QString::null, const uint fromindex=0, const uint toindex=0, const DocumentSectionType type=Type_1_2_3, const uint sectionstartindex=0, const bool reversed=false, const bool active=true, const QChar fillChar=QChar(), int fieldWidth=0); + void addSection(const int number=0, const QString& name=QString::null, const uint fromindex=0, const uint toindex=0, const NumFormat type=Type_1_2_3, const uint sectionstartindex=0, const bool reversed=false, const bool active=true, const QChar fillChar=QChar(), int fieldWidth=0); /** * @brief Delete a section from the document sections list */ @@ -1773,6 +1774,19 @@ public slots: void itemSelection_EditWeld(); void restartAutoSaveTimer(); +//auto-numerations +public: + QMap<QString, NumStruct*> numerations; + QStringList orgNumNames; //orgNumerations keeps original settings read from paragraph styles for reset settings overrided localy + void setupNumerations(); //read styles for used auto-numerations, initialize numCounters + QString getNumberStr(QString numName, int level, bool reset, ParagraphStyle &style); + void setNumerationCounter(QString numName, int level, int number); + bool flag_Renumber; + bool flag_NumUpdateRequest; + // for local numeration of paragraphs + bool updateLocalNums(StoryText& itemText); //return true if any num strings were updated and item need s invalidation + void updateNumbers(bool updateNumerations = false); + void itemSelection_ClearBulNumStrings(Selection *customSelection); /* Functions for PDF Form Actions */ public: diff --git a/Scribus/scribus/scribusstructs.h b/Scribus/scribus/scribusstructs.h index dd91125..2323e98 100644 --- a/Scribus/scribus/scribusstructs.h +++ b/Scribus/scribus/scribusstructs.h @@ -149,6 +149,20 @@ struct SingleLine } }; +struct Bullet //used by style reader while importing ODT files +{ + QString name; + QString charStr; + double indent; + double firstLineIndent; + double tabPosition; + CharStyle* style; + Bullet() : name(""), charStr(""), indent(0.0), firstLineIndent(0.0), tabPosition(0.0), style(NULL) {} + Bullet(QString n, QString ch) : name(n), charStr(ch), indent(0.0), firstLineIndent(0.0), tabPosition(0.0), style(NULL) {} + Bullet(QString n, QString ch, double first, double ind, double tab, CharStyle* chStyle) + { name = n; charStr = ch, firstLineIndent = first; indent = ind; tabPosition = tab; style = chStyle; } +}; + struct ArrowDesc { QString name; @@ -348,6 +362,7 @@ enum UpdateRequests reqCustomShapeUpdate = 1024, reqInlinePalUpdate = 2048, reqMarksUpdate = 4096, + reqNumUpdate = 8192, reqUpdateAll = 65535 }; diff --git a/Scribus/scribus/styles/charstyle.cpp b/Scribus/scribus/styles/charstyle.cpp index 0c17d3c..2160778 100644 --- a/Scribus/scribus/styles/charstyle.cpp +++ b/Scribus/scribus/styles/charstyle.cpp @@ -148,7 +148,7 @@ void CharStyle::eraseDirectFormatting() bool CharStyle::equiv(const Style & other) const { other.validate(); - const CharStyle * oth = dynamic_cast<const CharStyle*> ( & other ); + const CharStyle * oth = reinterpret_cast<const CharStyle*> ( & other ); return oth && parent() == oth->parent() #define ATTRDEF(attr_TYPE, attr_GETTER, attr_NAME, attr_DEFAULT) \ @@ -267,7 +267,7 @@ QStringList StyleFlag::featureList() const void CharStyle::updateFeatures() { m_Effects &= ~ScStyle_UserStyles; - runFeatures(m_Features, dynamic_cast<const CharStyle*>(parentStyle())); + runFeatures(m_Features, reinterpret_cast<const CharStyle*>(parentStyle())); /* need to access global fontlist :-/ if (!font().name().endsWith(fontVariant())) { @@ -280,13 +280,14 @@ void CharStyle::updateFeatures() void CharStyle::runFeatures(const QStringList& featureList, const CharStyle* parent) { QStringList::ConstIterator it; - for (it = featureList.begin(); it != featureList.end(); ++it) + QStringList::ConstIterator itEnd = featureList.end(); + for (it = featureList.begin(); it != itEnd; ++it) { QString feature = it->trimmed(); if (feature == INHERIT) { if (parent) - runFeatures(parent->features(), dynamic_cast<const CharStyle*>(parent->parentStyle())); + runFeatures(parent->features(), reinterpret_cast<const CharStyle*>(parent->parentStyle())); continue; } int set = feature.startsWith('-') ? 0 : 1; @@ -294,15 +295,16 @@ void CharStyle::runFeatures(const QStringList& featureList, const CharStyle* par if (invert) feature = feature.mid(1); - if (feature == BOLD) - { - // (de)select bolder font - } - else if (feature == ITALIC) - { - // (de)select italic font - } - else if (feature == UNDERLINE) +// if (feature == BOLD) +// { +// // (de)select bolder font +// } +// else if (feature == ITALIC) +// { +// // (de)select italic font +// } +// else + if (feature == UNDERLINE) { m_Effects &= ~(invert * ScStyle_Underline); m_Effects |= set * ScStyle_Underline; diff --git a/Scribus/scribus/styles/paragraphstyle.attrdefs.cxx b/Scribus/scribus/styles/paragraphstyle.attrdefs.cxx index 0e0d150..1a78584 100644 --- a/Scribus/scribus/styles/paragraphstyle.attrdefs.cxx +++ b/Scribus/scribus/styles/paragraphstyle.attrdefs.cxx @@ -31,13 +31,26 @@ ATTRDEF(double, firstIndent, FirstIndent, 0.0) ATTRDEF(double, gapBefore, GapBefore, 0.0) ATTRDEF(double, gapAfter, GapAfter, 0.0) ATTRDEF(QList<TabRecord>, tabValues, TabValues, QList<TabRecord>()) -ATTRDEF(int, dropCapLines, DropCapLines, 0) -ATTRDEF(bool, hasDropCap, HasDropCap, false) -ATTRDEF(double, dropCapOffset, DropCapOffset, 0.0) ATTRDEF(bool, useBaselineGrid, UseBaselineGrid, false) ATTRDEF(int, keepLinesStart, KeepLinesStart, 0) ATTRDEF(int, keepLinesEnd, KeepLinesEnd, 0) ATTRDEF(bool, keepWithNext, KeepWithNext, false) ATTRDEF(bool, keepTogether, KeepTogether, false) -ATTRDEF(QString, dcCharStyleName, DcCharStyleName,"") +ATTRDEF(bool, hasDropCap, HasDropCap, false) +ATTRDEF(int, dropCapLines, DropCapLines, 2) +ATTRDEF(double, parEffectOffset, ParEffectOffset, 0.0) +ATTRDEF(bool, parEffectIndent, ParEffectIndent, false) +ATTRDEF(QString, peCharStyleName, PeCharStyleName,"") +ATTRDEF(bool, hasBullet, HasBullet, false) +ATTRDEF(QString, bulletStr, BulletStr, QString(QChar(0x2022))) +ATTRDEF(bool, hasNum, HasNum, false) +ATTRDEF(QString, numName, NumName, "") +ATTRDEF(int, numFormat, NumFormat, 0) +ATTRDEF(QString, numPrefix, NumPrefix, "") +ATTRDEF(QString, numSuffix, NumSuffix, ".") +ATTRDEF(int, numLevel, NumLevel, 0) +ATTRDEF(int, numStart, NumStart, 1) +ATTRDEF(int, numRestart, NumRestart, 0) +ATTRDEF(bool, numOther, NumOther, false) +ATTRDEF(bool, numHigher, NumHigher, true) diff --git a/Scribus/scribus/styles/paragraphstyle.cpp b/Scribus/scribus/styles/paragraphstyle.cpp index 390392e..a6ab610 100644 --- a/Scribus/scribus/styles/paragraphstyle.cpp +++ b/Scribus/scribus/styles/paragraphstyle.cpp @@ -81,7 +81,7 @@ QString ParagraphStyle::displayName() const bool ParagraphStyle::equiv(const Style& other) const { other.validate(); - const ParagraphStyle* oth = dynamic_cast<const ParagraphStyle*> ( & other ); + const ParagraphStyle* oth = reinterpret_cast<const ParagraphStyle*> ( & other ); return oth && parent() == oth->parent() && cstyle.equiv(oth->charStyle()) #define ATTRDEF(attr_TYPE, attr_GETTER, attr_NAME, attr_DEFAULT) \ @@ -123,7 +123,7 @@ ParagraphStyle& ParagraphStyle::operator=(const ParagraphStyle& other) if (cstyleContextIsInh) { - const ParagraphStyle * parent = dynamic_cast<const ParagraphStyle*> ( parentStyle() ); + const ParagraphStyle * parent = reinterpret_cast<const ParagraphStyle*> ( parentStyle() ); cstyle.setContext(parent ? parent->charStyleContext() : NULL); } else @@ -150,7 +150,7 @@ void ParagraphStyle::setContext(const StyleContext* context) void ParagraphStyle::repairImplicitCharStyleInheritance() { if (cstyleContextIsInh) { - const ParagraphStyle * newParent = dynamic_cast<const ParagraphStyle*> ( parentStyle() ); + const ParagraphStyle * newParent = reinterpret_cast<const ParagraphStyle*> ( parentStyle() ); cstyle.setContext(newParent ? newParent->charStyleContext() : NULL); } } @@ -172,7 +172,7 @@ void ParagraphStyle::update(const StyleContext* context) cstyle.validate(); cstyleContext.invalidate(); - const ParagraphStyle * oth = dynamic_cast<const ParagraphStyle*> ( parentStyle() ); + const ParagraphStyle * oth = reinterpret_cast<const ParagraphStyle*> ( parentStyle() ); // qDebug() << QString("ParagraphStyle::update(%1) parent=%2").arg((unsigned long int)context).arg((unsigned long int)oth); if (oth) { #define ATTRDEF(attr_TYPE, attr_GETTER, attr_NAME, attr_DEFAULT) \ @@ -248,6 +248,8 @@ void ParagraphStyle::replaceNamedResources(ResourceCollection& newNames) setParent(it.value()); repairImplicitCharStyleInheritance(); } + if ((it = (newNames.charStyles().find(peCharStyleName()))) != newNames.charStyles().end()) + setPeCharStyleName(it.value()); cstyle.replaceNamedResources(newNames); } diff --git a/Scribus/scribus/text/storytext.cpp b/Scribus/scribus/text/storytext.cpp index 435bfb2..6d61555 100644 --- a/Scribus/scribus/text/storytext.cpp +++ b/Scribus/scribus/text/storytext.cpp @@ -1939,11 +1939,32 @@ void StoryText::saxx(SaxHandler& handler, const Xml_string& elemtag) const { Mark* mrk = mark(i); if ((doc->m_Selection->itemAt(0)->isNoteFrame() && mrk->isType(MARKNoteMasterType)) - || (!doc->m_Selection->itemAt(0)->isTextFrame() && mrk->isType(MARKNoteFrameType))) + || (!doc->m_Selection->itemAt(0)->isTextFrame() && mrk->isType(MARKNoteFrameType)) + || mrk->isType(MARKBullNumType)) continue; //do not insert notes marks into text frames nad vice versa Xml_attr mark_attr; mark_attr.insert("label", mrk->label); mark_attr.insert("typ", QString::number((int )mrk->getType())); +// if (!mrk->isType(MARKBullNumType)) +// { +// mark_attr.insert("strtxt", mrk->getString()); +// ParagraphStyle pstyle = this->paragraphStyle(i); +// mark_attr.insert("style_peoffset", QString::number(pstyle.parEffectOffset(),'f',2)); +// mark_attr.insert("style_peindent", QString::number(pstyle.parEffectIndent(),'f',2)); +// mark_attr.insert("style_pecharstyle", pstyle.peCharStyleName()); +// mark_attr.insert("style_hasbul", pstyle.hasBullet() ? "1" : "0"); +// mark_attr.insert("style_bulletstr", pstyle.bulletStr()); +// mark_attr.insert("style_hasnum", pstyle.hasNum() ? "1" : "0"); +// mark_attr.insert("style_numname", pstyle.numName()); +// mark_attr.insert("style_numformat", QString::number( (int)pstyle.numFormat())); +// mark_attr.insert("style_numprefix", pstyle.numPrefix()); +// mark_attr.insert("style_numsuffix", pstyle.numSuffix()); +// mark_attr.insert("style_numlevel", QString::number(pstyle.numLevel())); +// mark_attr.insert("style_numstart", QString::number(pstyle.numStart())); +// mark_attr.insert("style_numrestart", QString::number((int) pstyle.numRestart())); +// mark_attr.insert("style_numother", pstyle.numOther() ? "1" : "0"); +// mark_attr.insert("style_numhigher", pstyle.numHigher() ? "1" : "0"); +// } if (mrk->isType(MARK2ItemType) && (mrk->getItemPtr() != NULL)) mark_attr.insert("item", mrk->getItemPtr()->itemName()); else if (mrk->isType(MARK2MarkType)) @@ -2145,69 +2166,136 @@ public: { Xml_attr::iterator lIt = attr.find("label"); Xml_attr::iterator tIt = attr.find("typ"); - Xml_attr::iterator iIt = attr.find("item"); - Xml_attr::iterator m_lIt = attr.find("mark_l"); - Xml_attr::iterator m_tIt = attr.find("mark_t"); - Xml_attr::iterator nf_It = attr.find("noteframe"); + // Xml_attr::iterator nf_It = attr.find("noteframe"); if (lIt != attr.end()) l = Xml_data(lIt); if (tIt != attr.end()) t = (MarkType) parseInt(Xml_data(tIt)); - ScribusDoc* doc = this->dig->lookup<ScribusDoc>("<scribusdoc>"); - if (t == MARKVariableTextType) - mrk = doc->getMarkDefinied(l,t); - else + if (t != MARKBullNumType) { - mrk = doc->newMark(); - getUniqueName(l,doc->marksLabelsList(t), "_"); - mrk->label = l; - mrk->OwnPage = doc->currentPage()->pageNr(); - mrk->setType(t); - if (mrk->isType(MARK2ItemType) && (iIt != attr.end())) - { - PageItem* item = doc->getItemFromName(Xml_data(iIt)); - mrk->setItemPtr(item); - if (item == NULL) - mrk->setString("0"); - else - mrk->setString(QString::number(item->OwnPage)); - mrk->setItemName(Xml_data(iIt)); - } - if (mrk->isType(MARK2MarkType) && (m_lIt != attr.end()) && (m_tIt != attr.end())) - { - Mark* targetMark = doc->getMarkDefinied(Xml_data(m_lIt), (MarkType) parseInt(Xml_data(m_tIt))); - mrk->setMark(targetMark); - if (targetMark == NULL) - mrk->setString("0"); - else - mrk->setString(QString::number(targetMark->OwnPage)); - mrk->setItemName(Xml_data(m_lIt)); - } - if (mrk->isType(MARKNoteMasterType)) + ScribusDoc* doc = this->dig->lookup<ScribusDoc>("<scribusdoc>"); + // ParagraphStyle* pstyle = NULL; + if (t == MARKVariableTextType) + mrk = doc->getMarkDefinied(l,t); + // else if (t == MARKBullNumType) + // { + // mrk = (Mark*) new BulNumMark(); + // Xml_attr::iterator str_It = attr.find("strtxt"); + // mrk->setString(Xml_data(str_It)); + // pstyle = new ParagraphStyle(); + // Xml_attr::iterator ite; + // ite = attr.find("style_peoffset"); + // if (ite != attr.end()) + // pstyle->setParEffectOffset(parseDouble(Xml_data(ite))); + // ite = attr.find("style_peindent"); + // if (ite != attr.end()) + // pstyle->setParEffectIndent(parseDouble(Xml_data(ite))); + // ite = attr.find("style_pecharstyle"); + // if (ite != attr.end()) + // pstyle->setPeCharStyleName(Xml_data(ite)); + // ite = attr.find("style_hasbul"); + // if (ite != attr.end()) + // pstyle->setHasBullet(parseInt(Xml_data(ite)) == 1); + // ite = attr.find("style_bulletstr"); + // if (ite != attr.end()) + // pstyle->setBulletStr(Xml_data(ite)); + // ite = attr.find("style_hasnum"); + // if (ite != attr.end()) + // pstyle->setHasNum(parseInt(Xml_data(ite)) == 1); + // ite = attr.find("style_numname"); + // if (ite != attr.end()) + // pstyle->setNumName(Xml_data(ite)); + // ite = attr.find("style_numformat"); + // if (ite != attr.end()) + // pstyle->setNumFormat(parseInt(Xml_data(ite))); + // ite = attr.find("style_numprefix"); + // if (ite != attr.end()) + // pstyle->setNumPrefix(Xml_data(ite)); + // ite = attr.find("style_numsuffix"); + // if (ite != attr.end()) + // pstyle->setNumSuffix(Xml_data(ite)); + // ite = attr.find("style_numlevel"); + // if (ite != attr.end()) + // pstyle->setNumLevel(parseInt(Xml_data(ite))); + // ite = attr.find("style_numstart"); + // if (ite != attr.end()) + // pstyle->setNumStart(parseInt(Xml_data(ite))); + // ite = attr.find("style_numrestart"); + // if (ite != attr.end()) + // pstyle->setNumRestart(parseInt(Xml_data(ite))); + // ite = attr.find("style_numother"); + // if (ite != attr.end()) + // pstyle->setNumOther(parseInt(Xml_data(ite)) == 1); + // ite = attr.find("style_numhigher"); + // if (ite != attr.end()) + // pstyle->setNumHigher(parseInt(Xml_data(ite)) == 1); + // } + else { - Xml_attr::iterator nIt = attr.find("note"); - Xml_attr::iterator nsIt = attr.find("nStyle"); - NotesStyle* NS; - if (nsIt == attr.end()) - NS = doc->m_docNotesStylesList.at(0); - else - NS = doc->getNotesStyle(Xml_data(nsIt)); - TextNote* note = doc->newNote(NS); - note->setMasterMark(mrk); - if (nIt != attr.end()) - note->setSaxedText(Xml_data(nIt)); -// if (!NS->isAutoRemoveEmptyNotesFrames() && (nf_It != attr.end())) -// { -// PageItem_NoteFrame* nF = (PageItem_NoteFrame*) doc->getItemFromName(Xml_data(nf_It)); -// if (nF != NULL) -// doc->m_Selection->itemAt(0)->asTextFrame()->setNoteFrame(nF); -// } - mrk->setNotePtr(note); - doc->setNotesChanged(true); + mrk = doc->newMark(); + getUniqueName(l,doc->marksLabelsList(t), "_"); + mrk->label = l; + mrk->OwnPage = doc->currentPage()->pageNr(); + mrk->setType(t); + Xml_attr::iterator iIt = attr.find("item"); + Xml_attr::iterator m_lIt = attr.find("mark_l"); + Xml_attr::iterator m_tIt = attr.find("mark_t"); + if (mrk->isType(MARK2ItemType) && (iIt != attr.end())) + { + PageItem* item = doc->getItemFromName(Xml_data(iIt)); + mrk->setItemPtr(item); + if (item == NULL) + mrk->setString("0"); + else + mrk->setString(QString::number(item->OwnPage)); + mrk->setItemName(Xml_data(iIt)); + } + if (mrk->isType(MARK2MarkType) && (m_lIt != attr.end()) && (m_tIt != attr.end())) + { + Mark* targetMark = doc->getMarkDefinied(Xml_data(m_lIt), (MarkType) parseInt(Xml_data(m_tIt))); + mrk->setMark(targetMark); + if (targetMark == NULL) + mrk->setString("0"); + else + mrk->setString(QString::number(targetMark->OwnPage)); + mrk->setItemName(Xml_data(m_lIt)); + } + if (mrk->isType(MARKNoteMasterType)) + { + Xml_attr::iterator nIt = attr.find("note"); + Xml_attr::iterator nsIt = attr.find("nStyle"); + NotesStyle* NS; + if (nsIt == attr.end()) + NS = doc->m_docNotesStylesList.at(0); + else + NS = doc->getNotesStyle(Xml_data(nsIt)); + TextNote* note = doc->newNote(NS); + note->setMasterMark(mrk); + if (nIt != attr.end()) + note->setSaxedText(Xml_data(nIt)); + // if (!NS->isAutoRemoveEmptyNotesFrames() && (nf_It != attr.end())) + // { + // PageItem_NoteFrame* nF = (PageItem_NoteFrame*) doc->getItemFromName(Xml_data(nf_It)); + // if (nF != NULL) + // doc->m_Selection->itemAt(0)->asTextFrame()->setNoteFrame(nF); + // } + mrk->setNotePtr(note); + doc->setNotesChanged(true); + } + doc->newMark(mrk); } - doc->newMark(mrk); + story->insertMark(mrk); + // if (pstyle != NULL) + // { + // int i = story->cursorPosition() -1; + // if (story->item(i)->parstyle == NULL) { + // story->item(i)->parstyle = new ParagraphStyle(*pstyle); + // story->item(i)->parstyle->setContext( &doc->paragraphStyles()); + // } + // else + // story->item(i)->parstyle->applyStyle(*pstyle); + // } } - story->insertMark(mrk); } } }; diff --git a/Scribus/scribus/ui/notesstyleseditor.cpp b/Scribus/scribus/ui/notesstyleseditor.cpp index 4ffd17b..22ee10d 100644 --- a/Scribus/scribus/ui/notesstyleseditor.cpp +++ b/Scribus/scribus/ui/notesstyleseditor.cpp @@ -314,7 +314,7 @@ void NotesStylesEditor::on_ApplyButton_clicked() ss->set("NEWname", NS->name()); ss->set("NEWstart", NS->start()); ss->set("NEWendNotes", NS->isEndNotes()); - ss->set("NEWnumStyle", (int) NS->getType()); + ss->set("NEWnumFormat", (int) NS->getType()); ss->set("NEWrange", (int) NS->range()); ss->set("NEWprefix", NS->prefix()); ss->set("NEWsuffix", NS->suffix()); @@ -331,7 +331,7 @@ void NotesStylesEditor::on_ApplyButton_clicked() //invalidate all text frames with marks from current changed notes style foreach (PageItem* item, m_Doc->DocItems) { - if (item->isTextFrame() && !item->isNoteFrame() && item->asTextFrame()->hasMark(NS)) + if (item->isTextFrame() && !item->isNoteFrame() && item->asTextFrame()->hasNoteMark(NS)) item->invalid = true; } m_Doc->updateNotesNums(NS); @@ -479,7 +479,7 @@ void NotesStylesEditor::on_EndRadio_toggled(bool checked) void NotesStylesEditor::on_NumberingBox_currentIndexChanged(int index) { NotesStyle ns = changesMap.value(NSlistBox->currentText()); - ns.setType((NumerationType) index); + ns.setType((NumFormat) index); changesMap.insert(NSlistBox->currentText(), ns); ApplyButton->setEnabled(true); diff --git a/Scribus/scribus/ui/prefs_documentsections.cpp b/Scribus/scribus/ui/prefs_documentsections.cpp index f2be423..ca31d7c 100644 --- a/Scribus/scribus/ui/prefs_documentsections.cpp +++ b/Scribus/scribus/ui/prefs_documentsections.cpp @@ -148,7 +148,7 @@ void Prefs_DocumentSections::tableItemChanged( int row, int col ) { int index=qcti->currentIndex(); if (index<styles.count()-1) - localSections[row].type=(DocumentSectionType)index; + localSections[row].type=(NumFormat)index; else if (index==styles.count()-1) localSections[row].type=Type_None; diff --git a/Scribus/scribus/ui/propertiespalette_text.cpp b/Scribus/scribus/ui/propertiespalette_text.cpp index 4ae518a..e72e489 100644 --- a/Scribus/scribus/ui/propertiespalette_text.cpp +++ b/Scribus/scribus/ui/propertiespalette_text.cpp @@ -20,7 +20,7 @@ for which a new license (GPL+exception) is in place. #include "propertiespalette_utils.h" #include "propertywidget_advanced.h" #include "propertywidget_distance.h" -#include "propertywidget_dropcap.h" +#include "propertywidget_pareffect.h" #include "propertywidget_flop.h" #include "propertywidget_optmargins.h" #include "propertywidget_orphans.h" @@ -77,8 +77,8 @@ PropertiesPalette_Text::PropertiesPalette_Text( QWidget* parent) : QWidget(paren orphanBox = new PropertyWidget_Orphans(textTree); orphanItem = textTree->addWidget( tr("Orphans and Widows"), orphanBox); - dropcapsBox = new PropertyWidget_DropCap(textTree); - dropcapsItem = textTree->addWidget( tr("Drop Cap"), dropcapsBox); + parEffectWidgets = new PropertyWidget_ParEffect(textTree); + parEffectItem = textTree->addWidget( tr("Paragraph Effects"), parEffectWidgets); distanceWidgets = new PropertyWidget_Distance(textTree); distanceItem = textTree->addWidget( tr("Columns && Text Distances"), distanceWidgets); @@ -120,7 +120,7 @@ void PropertiesPalette_Text::setMainWindow(ScribusMainWindow* mw) advancedWidgets->setMainWindow(mw); colorWidgets->setMainWindow(mw); distanceWidgets->setMainWindow(mw); - dropcapsBox->setMainWindow(mw); + parEffectWidgets->setMainWindow(mw); optMargins->setMainWindow(mw); pathTextWidgets->setMainWindow(mw); @@ -156,7 +156,7 @@ void PropertiesPalette_Text::setDoc(ScribusDoc *d) advancedWidgets->setDoc(m_doc); colorWidgets->setDoc(m_doc); distanceWidgets->setDoc(m_doc); - dropcapsBox->setDoc(m_doc); + parEffectWidgets->setDoc(m_doc); flopBox->setDoc(m_doc); optMargins->setDoc(m_doc); orphanBox->setDoc(m_doc); @@ -192,7 +192,7 @@ void PropertiesPalette_Text::unsetDoc() flopBox->setDoc(0); optMargins->setDoc(0); orphanBox->setDoc(0); - dropcapsBox->setDoc(0); + parEffectWidgets->setDoc(0); pathTextWidgets->setDoc(0); m_haveItem = false; @@ -276,7 +276,7 @@ void PropertiesPalette_Text::handleUpdateRequest(int updateFlags) if (updateFlags & reqCharStylesUpdate) { charStyleCombo->updateFormatList(); - dropcapsBox->updateCharStyles(); + parEffectWidgets->updateCharStyles(); } if (updateFlags & reqParaStylesUpdate) paraStyleCombo->updateFormatList(); @@ -288,7 +288,7 @@ void PropertiesPalette_Text::handleUpdateRequest(int updateFlags) { paraStyleCombo->setDoc(m_haveDoc ? m_doc : 0); charStyleCombo->setDoc(m_haveDoc ? m_doc : 0); - dropcapsBox->setDoc(m_haveDoc ? m_doc : 0); + parEffectWidgets->setDoc(m_haveDoc ? m_doc : 0); } } @@ -320,7 +320,7 @@ void PropertiesPalette_Text::setCurrentItem(PageItem *i) flopItem->setHidden(true); distanceItem->setHidden(true); orphanItem->setHidden(true); - dropcapsItem->setHidden(true); + parEffectItem->setHidden(true); pathTextItem->setHidden(false); } else if (m_item->asTextFrame() || m_item->asTable()) @@ -328,7 +328,7 @@ void PropertiesPalette_Text::setCurrentItem(PageItem *i) flopItem->setHidden(false); distanceItem->setHidden(false); orphanItem->setHidden(false); - dropcapsItem->setHidden(false); + parEffectItem->setHidden(false); pathTextItem->setHidden(true); } else @@ -336,7 +336,7 @@ void PropertiesPalette_Text::setCurrentItem(PageItem *i) flopItem->setHidden(false); distanceItem->setHidden(false); orphanItem->setHidden(false); - dropcapsItem->setHidden(false); + parEffectItem->setHidden(false); pathTextItem->setHidden(true); } @@ -374,7 +374,7 @@ void PropertiesPalette_Text::unitChange() flopBox->unitChange(); optMargins->unitChange(); pathTextWidgets->unitChange(); - dropcapsBox->unitChange(); + parEffectWidgets->unitChange(); m_haveItem = tmp; } @@ -496,7 +496,7 @@ void PropertiesPalette_Text::updateStyle(const ParagraphStyle& newCurrent) colorWidgets->updateStyle(newCurrent); optMargins->updateStyle(newCurrent); orphanBox->updateStyle (newCurrent); - dropcapsBox->updateStyle(newCurrent); + parEffectWidgets->updateStyle(newCurrent); displayFontFace(charStyle.font().scName()); displayFontSize(charStyle.fontSize()); @@ -514,14 +514,14 @@ void PropertiesPalette_Text::updateStyle(const ParagraphStyle& newCurrent) void PropertiesPalette_Text::updateCharStyles() { charStyleCombo->updateFormatList(); - dropcapsBox->updateCharStyles(); + parEffectWidgets->updateCharStyles(); } void PropertiesPalette_Text::updateParagraphStyles() { paraStyleCombo->updateFormatList(); charStyleCombo->updateFormatList(); - dropcapsBox->updateCharStyles(); + parEffectWidgets->updateCharStyles(); } void PropertiesPalette_Text::updateTextStyles() @@ -643,6 +643,7 @@ void PropertiesPalette_Text::doClearPStyle() { Selection tempSelection(this, false); tempSelection.addItem(i2, true); + m_doc->itemSelection_ClearBulNumStrings(&tempSelection); m_doc->itemSelection_EraseParagraphStyle(&tempSelection); CharStyle emptyCStyle; m_doc->itemSelection_SetCharStyle(emptyCStyle, &tempSelection); diff --git a/Scribus/scribus/ui/propertiespalette_text.h b/Scribus/scribus/ui/propertiespalette_text.h index d4c73db..b15b840 100644 --- a/Scribus/scribus/ui/propertiespalette_text.h +++ b/Scribus/scribus/ui/propertiespalette_text.h @@ -25,7 +25,7 @@ for which a new license (GPL+exception) is in place. class PageItem; class PropertyWidget_Advanced; class PropertyWidget_Distance; -class PropertyWidget_DropCap; +class PropertyWidget_ParEffect; class PropertyWidget_Flop; class PropertyWidget_OptMargins; class PropertyWidget_Orphans; @@ -134,8 +134,8 @@ protected: PropertyWidget_Orphans* orphanBox; QTreeWidgetItem* orphanItem; - PropertyWidget_DropCap* dropcapsBox; - QTreeWidgetItem* dropcapsItem; + PropertyWidget_ParEffect* parEffectWidgets; + QTreeWidgetItem* parEffectItem; PropertyWidget_PathText* pathTextWidgets; QTreeWidgetItem* pathTextItem; diff --git a/Scribus/scribus/ui/propertywidget_dropcap.cpp b/Scribus/scribus/ui/propertywidget_dropcap.cpp deleted file mode 100644 index 9c6fbb7..0000000 --- a/Scribus/scribus/ui/propertywidget_dropcap.cpp +++ /dev/null @@ -1,285 +0,0 @@ -/* -For general Scribus (>=1.3.2) copyright and licensing information please refer -to the COPYING file provided with the program. Following this notice may exist -a copyright and/or license notice that predates the release of Scribus 1.3.2 -for which a new license (GPL+exception) is in place. -*/ - -#include "pageitem.h" -#include "pageitem_table.h" -#include "propertywidget_dropcap.h" -#include "scribus.h" -#include "selection.h" -#include "units.h" -#include "util.h" - -PropertyWidget_DropCap::PropertyWidget_DropCap(QWidget *parent) : QFrame(parent) -{ - m_item = 0; - m_ScMW = 0; - - setupUi(this); - setFrameStyle(QFrame::Box | QFrame::Plain); - setLineWidth(1); - layout()->setAlignment( Qt::AlignTop ); - - languageChange(); - dropCapLines->setDecimals(0); - - if (!m_doc) return; - dropCapCharStyleCombo->updateFormatList(); -} - -void PropertyWidget_DropCap::setMainWindow(ScribusMainWindow* mw) -{ - m_ScMW = mw; - - connect(m_ScMW, SIGNAL(AppModeChanged(int, int)), this, SLOT(handleAppModeChanged(int, int))); - connect(m_ScMW, SIGNAL(UpdateRequest(int)), this , SLOT(handleUpdateRequest(int))); -} - -void PropertyWidget_DropCap::setDoc(ScribusDoc *doc) -{ - if(doc == (ScribusDoc*) m_doc) - return; - - if (m_doc) - { - disconnect(m_doc->m_Selection, SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged())); - disconnect(m_doc , SIGNAL(docChanged()) , this, SLOT(handleSelectionChanged())); - } - - m_doc = doc; - dropCapCharStyleCombo->setDoc(doc); - - if (m_doc.isNull()) - { - disconnectSignals(); - return; - } - - m_unitRatio = m_doc->unitRatio(); - m_unitIndex = m_doc->unitIndex(); - dropCapOffset->setSuffix(unitGetSuffixFromIndex(0)); - - connect(m_doc->m_Selection, SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged())); - connect(m_doc , SIGNAL(docChanged()) , this, SLOT(handleSelectionChanged())); -} - -void PropertyWidget_DropCap::setCurrentItem(PageItem *item) -{ - if (item && m_doc.isNull()) - setDoc(item->doc()); - - m_item = item; - - disconnectSignals(); - configureWidgets(); - - if (!m_item) return; - - if (m_item->asTextFrame() || m_item->asPathText() || m_item->asTable()) - { - ParagraphStyle parStyle = m_item->itemText.defaultStyle(); - if (m_doc->appMode == modeEdit) - m_item->currentTextProps(parStyle); - else if (m_doc->appMode == modeEditTable) - m_item->asTable()->activeCell().textFrame()->currentTextProps(parStyle); - updateStyle(parStyle); - - connectSignals(); - } -} - -void PropertyWidget_DropCap::unitChange() -{ - if (!m_doc) - return; - - m_unitRatio = m_doc->unitRatio(); - m_unitIndex = m_doc->unitIndex(); - - dropCapOffset->blockSignals(true); - dropCapOffset->setNewUnit( m_unitIndex ); - dropCapOffset->blockSignals(false); -} - -void PropertyWidget_DropCap::updateCharStyles() -{ - dropCapCharStyleCombo->updateFormatList(); -} - -void PropertyWidget_DropCap::displayCharStyle(const QString& name) -{ - bool blocked = dropCapCharStyleCombo->blockSignals(true); - dropCapCharStyleCombo->setFormat(name); - dropCapCharStyleCombo->blockSignals(blocked); -} - -void PropertyWidget_DropCap::enableDropCap(bool enable) -{ - dropCapLines->setEnabled(enable); - dropCapOffset->setEnabled(enable); - dropCapCharStyleCombo->setEnabled(enable); -} - -void PropertyWidget_DropCap::updateStyle(const ParagraphStyle& newCurrent) -{ - disconnectSignals (); - dropCapBox->setChecked(newCurrent.hasDropCap()); - dropCapLines->setValue(newCurrent.dropCapLines()); - dropCapOffset->setValue(newCurrent.dropCapOffset() * m_unitRatio); - displayCharStyle(newCurrent.dcCharStyleName()); - connectSignals (); -} - -void PropertyWidget_DropCap::connectSignals() -{ - connect(dropCapBox, SIGNAL(stateChanged(int)), this, SLOT(handleDropCapUse()), Qt::UniqueConnection); - connect(dropCapLines, SIGNAL(valueChanged(double)), this, SLOT(handleDropCapLines()), Qt::UniqueConnection); - connect(dropCapOffset, SIGNAL(valueChanged(double)), this, SLOT(handleDropCapOffset()), Qt::UniqueConnection); - connect(dropCapCharStyleCombo, SIGNAL(activated(int)), this, SLOT(handleDropCapCharStyle()), Qt::UniqueConnection); -} - -void PropertyWidget_DropCap::disconnectSignals() -{ - disconnect(dropCapBox, SIGNAL(stateChanged(int)), this, SLOT(handleDropCapUse())); - disconnect(dropCapLines, SIGNAL(valueChanged(double)), this, SLOT(handleDropCapLines())); - disconnect(dropCapOffset, SIGNAL(valueChanged(double)), this, SLOT(handleDropCapOffset())); - disconnect(dropCapCharStyleCombo, SIGNAL(activated(int)), this, SLOT(handleDropCapCharStyle())); -} - -void PropertyWidget_DropCap::configureWidgets(void) -{ - bool enabled = false; - if (m_item && m_doc) - { - PageItem_TextFrame *textItem = m_item->asTextFrame(); - if (m_doc->appMode == modeEditTable) - textItem = m_item->asTable()->activeCell().textFrame(); - if (textItem || m_item->asPathText()) - enabled = true; - } - setEnabled(enabled); -} - -void PropertyWidget_DropCap::handleAppModeChanged(int oldMode, int mode) -{ - if (oldMode == modeEditTable || mode == modeEditTable) - { - setCurrentItem(m_item); - } -} - -void PropertyWidget_DropCap::handleSelectionChanged() -{ - if (!m_doc || !m_ScMW || m_ScMW->scriptIsRunning()) - return; - - PageItem* currItem = currentItemFromSelection(); - setCurrentItem(currItem); - updateGeometry(); - repaint(); -} - -void PropertyWidget_DropCap::handleUpdateRequest(int updateFlags) -{ - if (updateFlags & reqCharStylesUpdate) - updateCharStyles(); - if (updateFlags & reqStyleComboDocUpdate) - setDoc(m_doc ? m_doc : 0); -} - -void PropertyWidget_DropCap::handleDropCapUse() -{ - if (!m_doc || !m_item) - return; - ParagraphStyle newStyle; - newStyle.setHasDropCap(dropCapBox->isChecked()); - PageItem *item = m_item; - if (m_doc->appMode == modeEditTable) - item = item->asTable()->activeCell().textFrame(); - if (item != NULL) - { - Selection tempSelection(this, false); - tempSelection.addItem(item, true); - m_doc->itemSelection_ApplyParagraphStyle(newStyle, &tempSelection); - } - enableDropCap(dropCapBox->isChecked()); -} - -void PropertyWidget_DropCap::handleDropCapLines() -{ - if (!m_doc || !m_item) - return; - ParagraphStyle newStyle; - newStyle.setDropCapLines(static_cast<int>(dropCapLines->value())); - newStyle.setHasDropCap(dropCapBox->isChecked()); - PageItem *item = m_doc->m_Selection->itemAt(0); - if (m_doc->appMode == modeEditTable) - item = item->asTable()->activeCell().textFrame(); - if (item != NULL) - { - Selection tempSelection(this, false); - tempSelection.addItem(item, true); - m_doc->itemSelection_ApplyParagraphStyle(newStyle, &tempSelection); - } -} - -void PropertyWidget_DropCap::handleDropCapOffset() -{ - if (!m_doc || !m_item) - return; - ParagraphStyle newStyle; - newStyle.setDropCapOffset(dropCapOffset->value()); - newStyle.setHasDropCap(dropCapBox->isChecked()); - PageItem *item = m_item; - if (m_doc->appMode == modeEditTable) - item = item->asTable()->activeCell().textFrame(); - if (item != NULL) - { - Selection tempSelection(this, false); - tempSelection.addItem(item, true); - m_doc->itemSelection_ApplyParagraphStyle(newStyle, &tempSelection); - } -} - -void PropertyWidget_DropCap::handleDropCapCharStyle() -{ - if (!m_doc || !m_item) - return; - ParagraphStyle newStyle; - QString name = dropCapCharStyleCombo->currentText(); - if (!name.isEmpty()) - newStyle.setDcCharStyleName(name); - newStyle.setHasDropCap(dropCapBox->isChecked()); - PageItem *item = m_item; - if (m_doc->appMode == modeEditTable) - item = item->asTable()->activeCell().textFrame(); - if (item != NULL) - { - Selection tempSelection(this, false); - tempSelection.addItem(item, true); - m_doc->itemSelection_ApplyParagraphStyle(newStyle, &tempSelection); - } -} - -void PropertyWidget_DropCap::changeEvent(QEvent *e) -{ - if (e->type() == QEvent::LanguageChange) - { - languageChange(); - return; - } - QWidget::changeEvent(e); -} - -void PropertyWidget_DropCap::languageChange() -{ - dropCapBox->setText(tr("Use Drop Caps")); - dropCapLinesLabel->setText(tr("Drop Caps lines")); - dropCapOffsetLabel->setText(tr("Drop Caps offset")); - dropCapCharStyleLabel->setText(tr("Drop Cap use character style...")); - dropCapCharStyleCombo->setToolTip("<qt>" + tr("Choose character style or leave blank for use default paragraph style")); -} - diff --git a/Scribus/scribus/ui/propertywidget_dropcap.h b/Scribus/scribus/ui/propertywidget_dropcap.h deleted file mode 100644 index 9f43245..0000000 --- a/Scribus/scribus/ui/propertywidget_dropcap.h +++ /dev/null @@ -1,59 +0,0 @@ -#ifndef PROPERTYWIDGET_DropCap_H -#define PROPERTYWIDGET_DropCap_H - -#include "ui_propertywidget_dropcapbase.h" - -#include "propertywidgetbase.h" - -class PageItem; -class ParagraphStyle; -class ScribusMainWindow; - -class PropertyWidget_DropCap : public QFrame, private Ui::PropertyWidget_DropCapBase, public PropertyWidgetBase -{ - Q_OBJECT - -public: - PropertyWidget_DropCap(QWidget *parent = 0); - ~PropertyWidget_DropCap() {} - - void updateStyle(const ParagraphStyle& newCurrent); - void updateCharStyles(); - - void displayCharStyle(const QString& name); - -protected: - double m_unitRatio; - int m_unitIndex; - - PageItem * m_item; - ScribusMainWindow* m_ScMW; - - void configureWidgets(); - void setCurrentItem(PageItem *item); - - virtual void changeEvent(QEvent *e); - -public slots: - void setMainWindow(ScribusMainWindow *mw); - void setDoc(ScribusDoc *doc); - - void handleAppModeChanged(int oldMode, int mode); - void handleSelectionChanged(); - void handleUpdateRequest(int); - - void languageChange(); - void unitChange(); - - void handleDropCapUse(); - void handleDropCapLines(); - void handleDropCapOffset(); - void handleDropCapCharStyle(); - -private: - void connectSignals(); - void disconnectSignals(); - void enableDropCap(bool); -}; - -#endif // PROPERTYWIDGET_DropCap_H diff --git a/Scribus/scribus/ui/propertywidget_dropcapbase.ui b/Scribus/scribus/ui/propertywidget_dropcapbase.ui deleted file mode 100644 index af1c28d..0000000 --- a/Scribus/scribus/ui/propertywidget_dropcapbase.ui +++ /dev/null @@ -1,84 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>PropertyWidget_DropCapBase</class> - <widget class="QFrame" name="PropertyWidget_DropCapBase"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>211</width> - <height>142</height> - </rect> - </property> - <property name="windowTitle"> - <string>Form</string> - </property> - <layout class="QGridLayout" name="gridLayout" columnstretch="0,0"> - <item row="1" column="0"> - <widget class="QLabel" name="dropCapLinesLabel"> - <property name="toolTip"> - <string>Number of lines used by the drop cap</string> - </property> - <property name="text"> - <string>Height</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="ScrSpinBox" name="dropCapLines"> - <property name="suffix"> - <string> lines</string> - </property> - <property name="maximum"> - <number>10</number> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="dropCapOffsetLabel"> - <property name="text"> - <string>Offset</string> - </property> - </widget> - </item> - <item row="0" column="0"> - <widget class="QCheckBox" name="dropCapBox"> - <property name="text"> - <string>use Drop Caps</string> - </property> - </widget> - </item> - <item row="3" column="0" colspan="2"> - <widget class="QLabel" name="dropCapCharStyleLabel"> - <property name="text"> - <string>Use Character Style</string> - </property> - </widget> - </item> - <item row="4" column="0" colspan="2"> - <widget class="CharStyleComboBox" name="dropCapCharStyleCombo"/> - </item> - <item row="2" column="1"> - <widget class="ScrSpinBox" name="dropCapOffset"> - <property name="minimum"> - <double>-99.989999999999995</double> - </property> - </widget> - </item> - </layout> - </widget> - <customwidgets> - <customwidget> - <class>ScrSpinBox</class> - <extends>QDoubleSpinBox</extends> - <header>ui/scrspinbox.h</header> - </customwidget> - <customwidget> - <class>CharStyleComboBox</class> - <extends>QComboBox</extends> - <header>ui/spalette.h</header> - </customwidget> - </customwidgets> - <resources/> - <connections/> -</ui> diff --git a/Scribus/scribus/ui/propertywidget_pareffect.cpp b/Scribus/scribus/ui/propertywidget_pareffect.cpp new file mode 100644 index 0000000..fbda053 --- /dev/null +++ b/Scribus/scribus/ui/propertywidget_pareffect.cpp @@ -0,0 +1,612 @@ +/* +For general Scribus (>=1.3.2) copyright and licensing information please refer +to the COPYING file provided with the program. Following this notice may exist +a copyright and/or license notice that predates the release of Scribus 1.3.2 +for which a new license (GPL+exception) is in place. +*/ + +#include "pageitem.h" +#include "pageitem_table.h" +#include "propertywidget_pareffect.h" +#include "scribus.h" +#include "scribusdoc.h" +#include "selection.h" +#include "units.h" +#include "util.h" +#include "util_icon.h" +#include "ui/sctreewidget.h" + +PropertyWidget_ParEffect::PropertyWidget_ParEffect(QWidget *parent) : QFrame(parent), m_enhanced(NULL), m_item(NULL), m_ScMW(NULL) +{ + setupUi(this); + setFrameStyle(QFrame::Box | QFrame::Plain); + setLineWidth(1); + layout()->setAlignment( Qt::AlignTop ); + + languageChange(); + dropCapLines->setValue(2); + + if (m_doc) + peCharStyleCombo->updateFormatList(); + fillBulletStrEditCombo(); + fillNumFormatCombo(); + enableParEffect(false); + bulletCharTableButton_->setIcon(loadIcon("22/insert-table.png")); + numStart->setMinimum(1); + numStart->setMaximum(9999); + numLevelSpin->setMinimum(1); + numLevelSpin->setMaximum(3); + dropCapLines->setMinimum(2); + dropCapLines->setMaximum(99); +} + +void PropertyWidget_ParEffect::setMainWindow(ScribusMainWindow* mw) +{ + m_ScMW = mw; + + connect(m_ScMW, SIGNAL(AppModeChanged(int, int)), this, SLOT(handleAppModeChanged(int, int))); + connect(m_ScMW, SIGNAL(UpdateRequest(int)), this , SLOT(handleUpdateRequest(int))); +} + +void PropertyWidget_ParEffect::setDoc(ScribusDoc *doc) +{ + if(doc == (ScribusDoc*) m_doc) + return; + + if (m_doc) + { + disconnect(m_doc->m_Selection, SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged())); + disconnect(m_doc , SIGNAL(docChanged()) , this, SLOT(handleSelectionChanged())); + } + + m_doc = doc; + peCharStyleCombo->setDoc(doc); + + if (m_doc.isNull()) + { + disconnectSignals(); + return; + } + fillNumerationsCombo(); + + m_unitRatio = m_doc->unitRatio(); + m_unitIndex = m_doc->unitIndex(); + peOffset_->setSuffix(unitGetSuffixFromIndex(0)); + + connect(m_doc->m_Selection, SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged())); + connect(m_doc , SIGNAL(docChanged()) , this, SLOT(handleSelectionChanged())); + connectSignals(); +} + +void PropertyWidget_ParEffect::setCurrentItem(PageItem *item) +{ + if (item && m_doc.isNull()) + setDoc(item->doc()); + + m_item = item; + + if (!m_item) return; + + if (m_item->asTextFrame() || m_item->asPathText() || m_item->asTable()) + { + configureWidgets(); + ParagraphStyle parStyle = m_item->itemText.defaultStyle(); + if (m_doc->appMode == modeEdit) + m_item->currentTextProps(parStyle); + else if (m_doc->appMode == modeEditTable) + m_item->asTable()->activeCell().textFrame()->currentTextProps(parStyle); + updateStyle(parStyle); + } +} + +void PropertyWidget_ParEffect::unitChange() +{ + if (!m_doc) + return; + + m_unitRatio = m_doc->unitRatio(); + m_unitIndex = m_doc->unitIndex(); + + peOffset_->blockSignals(true); + peOffset_->setNewUnit( m_unitIndex ); + peOffset_->blockSignals(false); +} + +void PropertyWidget_ParEffect::fillNumerationsCombo() +{ + QStringList numNames; + if (m_doc) + { + foreach (QString numName, m_doc->numerations.keys()) + numNames.append(numName); + numNames.sort(); + } + numNames.prepend("<local block>"); + numComboBox->clear(); + numComboBox->insertItems(0, numNames); +} + +void PropertyWidget_ParEffect::updateCharStyles() +{ + peCharStyleCombo->updateFormatList(); +} + +void PropertyWidget_ParEffect::displayCharStyle(const QString& name) +{ + bool blocked = peCharStyleCombo->blockSignals(true); + peCharStyleCombo->setFormat(name); + peCharStyleCombo->blockSignals(blocked); +} + +void PropertyWidget_ParEffect::enableDropCap(bool enable) +{ +// dropCapRadio_->setChecked(enable); + dropCapLines->setEnabled(enable); + if (enable) + { + dropCapsGroup->show(); + enableBullet(false); + enableNum(false); + } + else + dropCapsGroup->hide(); +} +void PropertyWidget_ParEffect::enableBullet(bool enable) +{ + bulletStrEdit_->setVisible(enable); + bulletCharTableButton_->setVisible(enable); + bullGroup->setVisible(enable); + if (enable) + { + enableDropCap(false); + enableNum(false); + } +} +void PropertyWidget_ParEffect::enableNum(bool enable) +{ + numComboBox->setVisible(enable); + numLevelSpin->setVisible(enable); + numStart->setVisible(enable); + numPrefix->setVisible(enable); + numSuffix->setVisible(enable); + numFormatCombo->setVisible(enable); + numGroup->setVisible(enable); + if (enable) + { + enableBullet(false); + enableDropCap(false); + } +} +void PropertyWidget_ParEffect::enableParEffect(bool enable) +{ + peOffset_->setVisible(enable); + peCharStyleCombo->setVisible(enable); + peIndent_->setVisible(enable); + peGroup->setVisible(enable); + if (!enable) + { + enableBullet(false); + enableDropCap(false); + enableNum(false); + peCombo->setCurrentIndex(0); + } +} + +void PropertyWidget_ParEffect::updateStyle(const ParagraphStyle& newPStyle) +{ + if (peCombo->currentIndex() && !newPStyle.hasBullet() && !newPStyle.hasDropCap() && !newPStyle.hasNum()) + { + enableParEffect(false); + return; + } + disconnectSignals (); + + bool enablePE = true; + if (newPStyle.hasDropCap()) + { + peCombo->setCurrentIndex(1); + enableDropCap(true); + } + else if (newPStyle.hasBullet()) + { + peCombo->setCurrentIndex(2); + enableBullet(true); + } + else if (newPStyle.hasNum()) + { + peCombo->setCurrentIndex(3); + enableNum(true); + } + else + enablePE = false; + + QString numName = numComboBox->currentText(); + int nFormat = 0; + dropCapLines->setValue(newPStyle.dropCapLines()); + bulletStrEdit_->setEditText(newPStyle.bulletStr()); + numName = newPStyle.numName(); + if (numName == "") + numName = "<local block>"; + numComboBox->setCurrentIndex(numComboBox->findText(numName)); + NumStruct * numS = m_doc->numerations.value(numName); + if (numS) + numLevelSpin->setMaximum(numS->m_counters.count()+1); + else + numLevelSpin->setMaximum(3); + numLevelSpin->setValue(newPStyle.numLevel() +1); + numPrefix->setText(newPStyle.numPrefix()); + numSuffix->setText(newPStyle.numSuffix()); + numStart->setValue(newPStyle.numStart()); + + nFormat = newPStyle.numFormat(); + numFormatCombo->setCurrentIndex(nFormat); + peOffset_->setValue(newPStyle.parEffectOffset() * m_unitRatio); + peIndent_->setChecked(newPStyle.parEffectIndent()); + displayCharStyle(newPStyle.peCharStyleName()); + + enableParEffect(enablePE); + connectSignals (); +} + +void PropertyWidget_ParEffect::connectSignals() +{ + connect(peCombo, SIGNAL(activated(int)), this, SLOT(handleParEffectUse()), Qt::UniqueConnection); + connect(dropCapLines, SIGNAL(valueChanged(int)), this, SLOT(handleDropCapLines(int)), Qt::UniqueConnection); + connect(bulletStrEdit_, SIGNAL(editTextChanged(QString)), this, SLOT(handleBulletStr(QString)), Qt::UniqueConnection); + connect(numComboBox, SIGNAL(activated(QString)), this, SLOT(handleNumName(QString)), Qt::UniqueConnection); + connect(numLevelSpin, SIGNAL(valueChanged(int)), this, SLOT(handleNumLevel(int)), Qt::UniqueConnection); + connect(numFormatCombo, SIGNAL(activated(int)), this, SLOT(handleNumFormat(int)), Qt::UniqueConnection); + connect(numPrefix, SIGNAL(textChanged(QString)), this, SLOT(handleNumPrefix(QString)), Qt::UniqueConnection); + connect(numSuffix, SIGNAL(textChanged(QString)), this, SLOT(handleNumSuffix(QString)), Qt::UniqueConnection); + connect(numStart, SIGNAL(valueChanged(int)), this, SLOT(handleNumStart(int)), Qt::UniqueConnection); + connect(peOffset_, SIGNAL(valueChanged(double)), this, SLOT(handlePEOffset(double)), Qt::UniqueConnection); + connect(peIndent_, SIGNAL(toggled(bool)), this, SLOT(handlePEIndent(bool)), Qt::UniqueConnection); + connect(peCharStyleCombo, SIGNAL(activated(QString)), this, SLOT(handlePECharStyle(QString)), Qt::UniqueConnection); +} + +void PropertyWidget_ParEffect::disconnectSignals() +{ + disconnect(peCombo, SIGNAL(activated(int)), this, SLOT(handleParEffectUse())); + disconnect(dropCapLines, SIGNAL(valueChanged(int)), this, SLOT(handleDropCapLines(int))); + disconnect(bulletStrEdit_, SIGNAL(editTextChanged(QString)), this, SLOT(handleBulletStr(QString))); + disconnect(numComboBox, SIGNAL(activated(QString)), this, SLOT(handleNumName(QString))); + disconnect(numLevelSpin, SIGNAL(valueChanged(int)), this, SLOT(handleNumLevel(int))); + disconnect(numFormatCombo, SIGNAL(activated(int)), this, SLOT(handleNumFormat(int))); + disconnect(numPrefix, SIGNAL(textChanged(QString)), this, SLOT(handleNumPrefix(QString))); + disconnect(numSuffix, SIGNAL(textChanged(QString)), this, SLOT(handleNumSuffix(QString))); + disconnect(numStart, SIGNAL(valueChanged(int)), this, SLOT(handleNumStart(int))); + disconnect(peOffset_, SIGNAL(valueChanged(double)), this, SLOT(handlePEOffset(double))); + disconnect(peIndent_, SIGNAL(toggled(bool)), this, SLOT(handlePEIndent(bool))); + disconnect(peCharStyleCombo, SIGNAL(activated(QString)), this, SLOT(handlePECharStyle(QString))); +} + +void PropertyWidget_ParEffect::configureWidgets(void) +{ + bool enabled = false; + if (m_item && m_doc) + { + PageItem_TextFrame *textItem = m_item->asTextFrame(); + if (m_doc->appMode == modeEditTable) + textItem = m_item->asTable()->activeCell().textFrame(); + if (textItem || m_item->asPathText()) + enabled = true; + } + setEnabled(enabled); +} + +void PropertyWidget_ParEffect::handleAppModeChanged(int oldMode, int mode) +{ + if (oldMode == modeEditTable || mode == modeEditTable) + { + setCurrentItem(m_item); + } +} + +void PropertyWidget_ParEffect::handleSelectionChanged() +{ + if (!m_doc || !m_ScMW || m_ScMW->scriptIsRunning()) + return; + + PageItem* currItem = currentItemFromSelection(); + setCurrentItem(currItem); + updateGeometry(); + repaint(); +} + +void PropertyWidget_ParEffect::handleUpdateRequest(int updateFlags) +{ + if (updateFlags & reqCharStylesUpdate) + updateCharStyles(); + if (updateFlags & reqStyleComboDocUpdate) + setDoc(m_doc ? m_doc : 0); + if (updateFlags & reqNumUpdate) + fillNumerationsCombo(); +} + +void PropertyWidget_ParEffect::handleParEffectUse() +{ + if (!m_doc || !m_item) + return; + ParagraphStyle newStyle; + enableParEffect(peCombo->currentIndex() != 0); + if (peCombo->currentIndex() == 1) + { + enableDropCap(true); + newStyle.setDropCapLines(dropCapLines->value()); + newStyle.setHasDropCap(true); + newStyle.setHasBullet(false); + newStyle.setHasNum(false); + } + else if (peCombo->currentIndex() == 2) + { + enableBullet(true); + newStyle.setHasBullet(true); + QString bStr = bulletStrEdit_->currentText(); + if (bStr.isEmpty()) + bStr = QChar(0x2022); + newStyle.setBulletStr(bStr); + newStyle.setHasNum(false); + newStyle.setHasDropCap(false); + } + else if (peCombo->currentIndex() == 3) + { + enableNum(true); + newStyle.setHasDropCap(false); + newStyle.setHasBullet(false); + newStyle.setHasNum(true); + newStyle.setNumName(numComboBox->currentText()); + newStyle.setNumFormat(numFormatCombo->currentIndex()); + newStyle.setNumLevel(numLevelSpin->value() -1); + newStyle.setNumStart(numStart->value()); + newStyle.setNumPrefix(numPrefix->text()); + newStyle.setNumSuffix(numSuffix->text()); + if (newStyle.numName() == "<local block>") + { + newStyle.setNumOther(true); + newStyle.setNumHigher(true); + } + } + else + { + newStyle.setHasDropCap(false); + newStyle.setHasBullet(false); + newStyle.setHasNum(false); + } + newStyle.setParEffectOffset(peOffset_->value()); + newStyle.setParEffectIndent(peIndent_->isChecked()); + handleChanges(m_item, newStyle); +} + +void PropertyWidget_ParEffect::handleBulletStr(QString bulStr) +{ + if (!m_doc || !m_item) + return; + ParagraphStyle newStyle; + if (bulStr.isEmpty()) + bulStr = QChar(0x2022); + newStyle.setBulletStr(bulStr); + handleChanges(m_item, newStyle); +} + +void PropertyWidget_ParEffect::handleDropCapLines(int dcLines) +{ + if (!m_doc || !m_item) + return; + ParagraphStyle newStyle; + newStyle.setDropCapLines(dcLines); + handleChanges(m_item, newStyle); +} + +void PropertyWidget_ParEffect::handleNumName(QString numName) +{ + if (!m_doc || !m_item) + return; + disconnectSignals(); + ParagraphStyle newStyle; + if (numName == "<local block>") + { + newStyle.setNumOther(true); + newStyle.setNumHigher(true); + newStyle.setNumRestart(NSRstory); + } + else + { + NumStruct * numS = m_doc->numerations.value(numName); + Q_ASSERT(numS); + int level = qMin(numLevelSpin->value(), numS->m_counters.count()) -1; + numLevelSpin->setValue(level +1); + newStyle.setNumLevel(level); + Numeration num = numS->m_nums[level]; + numFormatCombo->setCurrentIndex((int) num.numFormat); + numStart->setValue(num.start); + numPrefix->setText(num.prefix); + numSuffix->setText(num.suffix); + } + newStyle.setNumPrefix(numPrefix->text()); + newStyle.setNumSuffix(numSuffix->text()); + newStyle.setNumName(numName); + newStyle.setNumFormat((NumFormat) numFormatCombo->currentIndex()); + handleChanges(m_item, newStyle); + connectSignals(); +} + +void PropertyWidget_ParEffect::handleNumFormat(int style) +{ + if (!m_doc || !m_item) + return; + ParagraphStyle newStyle; + newStyle.setNumFormat(style); + handleChanges(m_item, newStyle); +} + +void PropertyWidget_ParEffect::handleNumLevel(int level) +{ + if (!m_doc || !m_item) + return; + if ((numComboBox->currentText() != "<local block>") && level == numLevelSpin->maximum()) + { + NumStruct * numS = m_doc->numerations.value(numComboBox->currentText()); + Q_ASSERT(numS); + while (level > numS->m_counters.count()) + { + numS->m_counters.append(0); + Numeration num; + num.numFormat = (NumFormat) numFormatCombo->currentIndex(); + num.prefix = numPrefix->text(); + num.suffix = numSuffix->text(); + num.start = numStart->value(); + numS->m_nums.append(num); + } + } + ParagraphStyle newStyle; + newStyle.setNumLevel(level -1); + handleChanges(m_item, newStyle); +} + +void PropertyWidget_ParEffect::handleNumPrefix(QString prefix) +{ + if (!m_doc || !m_item) + return; + ParagraphStyle newStyle; + newStyle.setNumPrefix(prefix); + handleChanges(m_item, newStyle); +} + +void PropertyWidget_ParEffect::handleNumSuffix(QString suffix) +{ + if (!m_doc || !m_item) + return; + ParagraphStyle newStyle; + newStyle.setNumSuffix(suffix); + handleChanges(m_item, newStyle); +} + +void PropertyWidget_ParEffect::handleNumStart(int start) +{ + if (!m_doc || !m_item) + return; + ParagraphStyle newStyle; + newStyle.setNumStart(start); + handleChanges(m_item, newStyle); +} + +void PropertyWidget_ParEffect::handlePEOffset(double offset) +{ + if (!m_doc || !m_item) + return; + ParagraphStyle newStyle; + newStyle.setParEffectOffset(offset); + handleChanges(m_item, newStyle); +} + +void PropertyWidget_ParEffect::handlePEIndent(bool indent) +{ + if (!m_doc || !m_item) + return; + ParagraphStyle newStyle; + newStyle.setParEffectIndent(indent); + handleChanges(m_item, newStyle); +} + +void PropertyWidget_ParEffect::handlePECharStyle(QString name) +{ + if (!m_doc || !m_item) + return; + ParagraphStyle newStyle; + if (!name.isEmpty()) + newStyle.setPeCharStyleName(name); + handleChanges(m_item, newStyle); +} + +void PropertyWidget_ParEffect::changeEvent(QEvent *e) +{ + if (e->type() == QEvent::LanguageChange) + { + languageChange(); + return; + } + QWidget::changeEvent(e); +} + +void PropertyWidget_ParEffect::handleChanges(PageItem *item, ParagraphStyle &newStyle) +{ + if (m_doc->appMode == modeEditTable) + item = item->asTable()->activeCell().textFrame(); + if (item != NULL) + { + disconnect(m_doc->m_Selection, SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged())); + disconnect(m_doc , SIGNAL(docChanged()) , this, SLOT(handleSelectionChanged())); + + Selection tempSelection(this, false); + tempSelection.addItem(item, true); + m_doc->itemSelection_ApplyParagraphStyle(newStyle, &tempSelection); + m_doc->updateNumbers(); + + connect(m_doc->m_Selection, SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged())); + connect(m_doc , SIGNAL(docChanged()) , this, SLOT(handleSelectionChanged())); + } +} + +void PropertyWidget_ParEffect::languageChange() +{ + fillPECombo(); + dropCapLinesLabel->setText(tr("Lines")); + dropCapsGroup->setTitle(tr("Drop Caps")); + bullGroup->setTitle(tr("Bulleted List")); + bulletCharLabel->setText(tr("Bullet Char(s)")); + bulletCharTableButton_->setToolTip(tr("Enhanced char table to choose bullet chars")); + bulletCharTableButton_->setText(tr("Char Table")); + numGroup->setTitle(tr("Numbered List")); + numLevelLabel->setText(tr("Level")); + numComboLabel->setText(tr("Set")); + numFormatLabel->setText(tr("Format")); + numStartLabel->setText(tr("Start")); + numPrefixLabel->setText(tr("Prefix")); + numSuffixLabel->setText(tr("Suffix")); + peOffsetLabel->setText(tr("Offset")); + peIndent_->setText(tr("Auto-Indent")); + peCharStyleLabel->setText(tr("Char Style")); + peCharStyleCombo->setToolTip(tr("Choose chracter style or leave blank for use default paragraph style")); +} + +void PropertyWidget_ParEffect::openEnhanced() +{ + if (m_enhanced) + return; + + QApplication::changeOverrideCursor(QCursor(Qt::WaitCursor)); + m_enhanced = new CharSelectEnhanced(this); + m_enhanced->setModal(true); + connect(m_enhanced, SIGNAL(insertSpecialChars(const QString &)), this, SLOT(insertSpecialChars(const QString &))); + connect(m_enhanced, SIGNAL(paletteShown(bool)), bulletCharTableButton_, SLOT(setChecked(bool))); + m_enhanced->setDoc(m_doc); + m_enhanced->setEnabled(true); + QString styleName = peCharStyleCombo->currentText(); + setCurrentComboItem(m_enhanced->fontSelector, m_item->currentStyle().charStyle().font().scName()); + m_enhanced->newFont(m_enhanced->fontSelector->currentIndex()); + m_enhanced->show(); + QApplication::changeOverrideCursor(Qt::ArrowCursor); +} + +void PropertyWidget_ParEffect::closeEnhanced(bool show) +{ + if (!m_enhanced || show) + return; + disconnect(m_enhanced, SIGNAL(insertSpecialChars(const QString &)), this, SLOT(insertSpecialChars(const QString &))); + disconnect(m_enhanced, SIGNAL(paletteShown(bool)), bulletCharTableButton_, SLOT(setChecked(bool))); + m_enhanced->close(); + delete m_enhanced; + m_enhanced = NULL; +} + +void PropertyWidget_ParEffect::on_bulletCharTableButton__toggled(bool checked) +{ + if (m_enhanced && !checked) + closeEnhanced(); + else if (!m_enhanced && checked) + openEnhanced(); +} +void PropertyWidget_ParEffect::insertSpecialChars(const QString &chars) +{ + bulletStrEdit_->lineEdit()->setText(chars); +} diff --git a/Scribus/scribus/ui/propertywidget_pareffect.h b/Scribus/scribus/ui/propertywidget_pareffect.h new file mode 100644 index 0000000..4bdbaa0 --- /dev/null +++ b/Scribus/scribus/ui/propertywidget_pareffect.h @@ -0,0 +1,115 @@ +#ifndef PROPERTYWIDGET_PAREFFECT_H +#define PROPERTYWIDGET_PAREFFECT_H + +#include "ui_propertywidget_pareffectbase.h" +#include "numeration.h" +#include "propertywidgetbase.h" +#include "ui/charselectenhanced.h" + +class PageItem; +class ParagraphStyle; +class ScribusMainWindow; + +class PropertyWidget_ParEffect : public QFrame, private Ui::PropertyWidget_ParEffectBase, public PropertyWidgetBase +{ + Q_OBJECT + +public: + PropertyWidget_ParEffect(QWidget *parent = 0); + ~PropertyWidget_ParEffect() {} + + void updateStyle(const ParagraphStyle& newPStyle); + void updateCharStyles(); + + void displayCharStyle(const QString& name); + void connectSignals(); + void disconnectSignals(); + CharSelectEnhanced * m_enhanced; + + void fillNumerationsCombo(); +protected: + double m_unitRatio; + int m_unitIndex; + + PageItem * m_item; + ScribusMainWindow* m_ScMW; + + void configureWidgets(); + void setCurrentItem(PageItem *item); + + virtual void changeEvent(QEvent *e); + void handleChanges(PageItem* item, ParagraphStyle& newStyle); + +public slots: + void setMainWindow(ScribusMainWindow *mw); + void setDoc(ScribusDoc *doc); + + void handleAppModeChanged(int oldMode, int mode); + void handleSelectionChanged(); + void handleUpdateRequest(int); + + void languageChange(); + void unitChange(); + + void handleParEffectUse(); + void handleBulletStr(QString); + void handleDropCapLines(int); + void handleNumName(QString); + void handleNumFormat(int); + void handleNumLevel(int); + void handleNumPrefix(QString); + void handleNumSuffix(QString); + void handleNumStart(int); + void handlePEOffset(double); + void handlePEIndent(bool); + void handlePECharStyle(QString); + +private slots: + void on_bulletCharTableButton__toggled(bool checked); + void insertSpecialChars(const QString &chars); + +private: + void openEnhanced(); + void closeEnhanced(bool show = false); + void enableDropCap(bool); + void enableBullet(bool); + void enableNum(bool); + void enableParEffect(bool); + void fillBulletStrEditCombo() + { + bulletStrEdit_->clear(); + bulletStrEdit_->addItem(QChar(0x2022)); + bulletStrEdit_->addItem("*"); + bulletStrEdit_->addItem(QChar(0x2013)); + bulletStrEdit_->setMinimumWidth(50); + if (bulletStrEdit_->currentText().isEmpty()) + bulletStrEdit_->setEditText(QChar(0x2022)); + } + + void fillNumFormatCombo() + { + numFormatCombo->clear(); + numFormatCombo->addItems(getFormatList()); + } + + void fillPECombo() + { + peCombo->clear(); + peCombo->addItem(tr("No Paragraph Effects")); + peCombo->addItem(tr("Drop Caps")); + peCombo->addItem(tr("Bulleted List")); + peCombo->addItem(tr("Numerated List")); + } + +// void SMPStyleWidget::fillNumRestartCombo() +// { +// numRestartCombo->clear(); +// numRestartCombo->addItem(tr("Document")); +// numRestartCombo->addItem(tr("Section")); +// numRestartCombo->addItem(tr("Story")); +// numRestartCombo->addItem(tr("Page")); +// numRestartCombo->addItem(tr("Frame")); +// } +}; + +#endif // PROPERTYWIDGET_PAREFFECT_H diff --git a/Scribus/scribus/ui/propertywidget_pareffectbase.ui b/Scribus/scribus/ui/propertywidget_pareffectbase.ui new file mode 100644 index 0000000..4199964 --- /dev/null +++ b/Scribus/scribus/ui/propertywidget_pareffectbase.ui @@ -0,0 +1,349 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>PropertyWidget_ParEffectBase</class> + <widget class="QFrame" name="PropertyWidget_ParEffectBase"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>270</width> + <height>429</height> + </rect> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <layout class="QGridLayout" name="gridLayout" columnstretch="0,0"> + <item row="12" column="0" colspan="2"> + <widget class="QGroupBox" name="peGroup"> + <property name="title"> + <string>Effect Parameters</string> + </property> + <layout class="QGridLayout" name="gridLayout_4"> + <item row="6" column="0"> + <widget class="QLabel" name="peCharStyleLabel"> + <property name="text"> + <string>Char Style</string> + </property> + <property name="buddy"> + <cstring>peCharStyleCombo</cstring> + </property> + </widget> + </item> + <item row="6" column="1"> + <widget class="CharStyleComboBox" name="peCharStyleCombo"/> + </item> + <item row="1" column="0" colspan="2"> + <layout class="QHBoxLayout" name="horizontalLayout_5"> + <item> + <widget class="QCheckBox" name="peIndent_"> + <property name="text"> + <string>AutoIndent</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_5"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QLabel" name="peOffsetLabel"> + <property name="text"> + <string>Offset</string> + </property> + <property name="buddy"> + <cstring>peOffset_</cstring> + </property> + </widget> + </item> + <item> + <widget class="ScrSpinBox" name="peOffset_"> + <property name="minimum"> + <double>-999.990000000000009</double> + </property> + <property name="maximum"> + <double>999.990000000000009</double> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + </item> + <item row="4" column="0" colspan="2"> + <widget class="QGroupBox" name="dropCapsGroup"> + <property name="title"> + <string>Drop Caps</string> + </property> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QLabel" name="dropCapLinesLabel"> + <property name="toolTip"> + <string>Number of lines used by the drop cap</string> + </property> + <property name="text"> + <string>Lines</string> + </property> + </widget> + </item> + <item> + <widget class="QSpinBox" name="dropCapLines"> + <property name="minimum"> + <number>2</number> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> + </item> + <item row="8" column="0" rowspan="2" colspan="2"> + <widget class="QGroupBox" name="numGroup"> + <property name="title"> + <string>Numbered List</string> + </property> + <layout class="QGridLayout" name="gridLayout_2"> + <item row="3" column="0" colspan="2"> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <item> + <widget class="QLabel" name="numLevelLabel"> + <property name="text"> + <string>Level</string> + </property> + <property name="buddy"> + <cstring>numLevelSpin</cstring> + </property> + </widget> + </item> + <item> + <widget class="QSpinBox" name="numLevelSpin"> + <property name="minimum"> + <number>1</number> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_2"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QLabel" name="numStartLabel"> + <property name="text"> + <string>Start</string> + </property> + </widget> + </item> + <item> + <widget class="QSpinBox" name="numStart"> + <property name="minimum"> + <number>1</number> + </property> + <property name="maximum"> + <number>999</number> + </property> + </widget> + </item> + </layout> + </item> + <item row="0" column="0" colspan="2"> + <layout class="QHBoxLayout" name="horizontalLayout_3"> + <item> + <widget class="QLabel" name="numComboLabel"> + <property name="text"> + <string>Set</string> + </property> + </widget> + </item> + <item> + <widget class="QComboBox" name="numComboBox"> + <property name="currentIndex"> + <number>-1</number> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_3"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QLabel" name="numFormatLabel"> + <property name="text"> + <string>Format</string> + </property> + <property name="buddy"> + <cstring>numFormatCombo</cstring> + </property> + </widget> + </item> + <item> + <widget class="QComboBox" name="numFormatCombo"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </item> + </layout> + </item> + <item row="4" column="0" colspan="2"> + <layout class="QHBoxLayout" name="horizontalLayout_4"> + <item> + <widget class="QLabel" name="numPrefixLabel"> + <property name="text"> + <string>Prefix</string> + </property> + <property name="buddy"> + <cstring>numPrefix</cstring> + </property> + </widget> + </item> + <item> + <widget class="QLineEdit" name="numPrefix"/> + </item> + <item> + <spacer name="horizontalSpacer_4"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QLabel" name="numSuffixLabel"> + <property name="text"> + <string>Suffix</string> + </property> + <property name="buddy"> + <cstring>numSuffix</cstring> + </property> + </widget> + </item> + <item> + <widget class="QLineEdit" name="numSuffix"/> + </item> + </layout> + </item> + </layout> + </widget> + </item> + <item row="2" column="0" colspan="2"> + <widget class="QComboBox" name="peCombo"/> + </item> + <item row="7" column="0" colspan="2"> + <widget class="QGroupBox" name="bullGroup"> + <property name="title"> + <string>Bulleted List</string> + </property> + <layout class="QGridLayout" name="gridLayout_3"> + <item row="0" column="1"> + <widget class="QComboBox" name="bulletStrEdit_"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>50</width> + <height>0</height> + </size> + </property> + <property name="editable"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="0" column="0"> + <widget class="QLabel" name="bulletCharLabel"> + <property name="text"> + <string>Bullet Char(s)</string> + </property> + <property name="buddy"> + <cstring>bulletStrEdit_</cstring> + </property> + </widget> + </item> + <item row="0" column="2"> + <widget class="QPushButton" name="bulletCharTableButton_"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Char Table</string> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </widget> + </item> + </layout> + </widget> + <customwidgets> + <customwidget> + <class>ScrSpinBox</class> + <extends>QDoubleSpinBox</extends> + <header location="global">ui/scrspinbox.h</header> + </customwidget> + <customwidget> + <class>CharStyleComboBox</class> + <extends>QComboBox</extends> + <header location="global">ui/spalette.h</header> + </customwidget> + </customwidgets> + <resources/> + <connections/> +</ui> diff --git a/Scribus/scribus/ui/smpstylewidget.cpp b/Scribus/scribus/ui/smpstylewidget.cpp index 7bade6a..fa0afbe 100644 --- a/Scribus/scribus/ui/smpstylewidget.cpp +++ b/Scribus/scribus/ui/smpstylewidget.cpp @@ -7,11 +7,13 @@ for which a new license (GPL+exception) is in place. #include <QEvent> +#include "numeration.h" #include "smpstylewidget.h" +#include "scribus.h" #include "units.h" #include "util.h" #include "util_icon.h" - +#include "ui/charselectenhanced.h" static bool isEqual(double a, double b) { @@ -22,8 +24,9 @@ static bool isEqual(double a, double b) } -SMPStyleWidget::SMPStyleWidget() : QWidget() +SMPStyleWidget::SMPStyleWidget(ScribusDoc* doc) : QWidget() { + m_Doc = doc; setupUi(this); //Not used yet // optMarginCheckLeftProtruding->setVisible(false); @@ -47,14 +50,27 @@ SMPStyleWidget::SMPStyleWidget() : QWidget() // optMarginCombo->addItem(tr("Right Hanging Punctuation"), ParagraphStyle::OM_RightHangingPunct); // optMarginCombo->addItem(tr("Default"), ParagraphStyle::OM_Default); - dropCapOffset_->setSuffix(unitGetSuffixFromIndex(0)); + parEffectOffset_->setSuffix(unitGetSuffixFromIndex(0)); + fillBulletStrEditCombo(); + bulletCharTableButton_->setIcon(loadIcon("22/insert-table.png")); + fillNumFormatCombo(); + numStartSpin->setMinimum(1); + numStartSpin->setMaximum(9999); + numLevelSpin->setMinimum(1); + numLevelSpin->setMaximum(1); + fillNumRestartCombo(); + dropCapLines_->setMinimum(2); + dropCapLines_->setMaximum(99); + minSpaceSpin->setSuffix(unitGetSuffixFromIndex(SC_PERCENT)); minGlyphExtSpin->setSuffix(unitGetSuffixFromIndex(SC_PERCENT)); maxGlyphExtSpin->setSuffix(unitGetSuffixFromIndex(SC_PERCENT)); connect(optMarginDefaultButton, SIGNAL(clicked()), this, SLOT(slotDefaultOpticalMargins())); - + if (m_Doc) + connect(m_Doc->scMW(), SIGNAL(UpdateRequest(int)), this , SLOT(handleUpdateRequest(int))); + m_enhanced = NULL; } void SMPStyleWidget::slotLineSpacingModeChanged(int i) @@ -92,8 +108,10 @@ void SMPStyleWidget::languageChange() //CB Unneeded, gets in the way of single widget tooltips //dropCapsBox->setToolTip( tr("Enable or disable drop cap")); dropCapLines_->setToolTip( tr("Drop Cap Lines")); - dropCapOffset_->setToolTip( tr("Drop Cap Offset")); - dropCapCharStyleCombo->setToolTip("<qt>" + tr("Choose chracter style or leave blank for use default paragraph style")); + bulletCharTableButton_->setToolTip(tr("Enhanced Char Table for inserting customs chars as bullets")); + parEffectOffset_->setToolTip( tr("Paragraph Effects Chars Offset")); + parEffectIndentBox->setToolTip( tr("Hang Paragraph Effect before paragraph indent")); + parEffectCharStyleCombo->setToolTip("<qt>" + tr("Choose chracter style or leave blank for use default paragraph style")); alignement_->setToolTip( tr("Alignment")); tabList_->first_->setToolTip( tr("First Line Indent")); tabList_->left_->setToolTip( tr("Left Indent")); @@ -115,7 +133,6 @@ void SMPStyleWidget::languageChange() keepTogether->setToolTip ("<qt>" + tr ("If checked, ensures that the paragraph won't be split across multiple pages or columns") + "</qt>"); keepWithNext->setToolTip ("<qt>" + tr ("If checked, automatically moves the paragraph to the next column or page if the next paragraph isn't on the same page or column") + "</qt>"); - /***********************************/ /* End Tooltips */ /***********************************/ @@ -135,14 +152,39 @@ void SMPStyleWidget::languageChange() // // optMarginLabel->setText(tr("Optical Margins:")); - dropCapsLineLabel->setText( tr("Lines:")); - distFromTextLabel->setText( tr("Distance from Text:")); lineSpacing_->setSuffix(unitGetSuffixFromIndex(0)); spaceAbove_->setSuffix(unitGetSuffixFromIndex(0)); spaceBelow_->setSuffix(unitGetSuffixFromIndex(0)); parentLabel->setText( tr("Based On:")); distancesBox->setTitle( tr("Distances and Alignment")); + + parEffectsBox->setTitle(tr("Paragraph Effects")); dropCapsBox->setTitle( tr("Drop Caps")); + bulletBox->setTitle(tr("Bullets")); + numBox->setTitle(tr("Numeration")); + dropCapsLineLabel->setText( tr("Lines:")); + bulletCharLabel->setText(tr("Bullet Char/String")); + bulletCharTableButton_->setText(tr("Char Table")); + numFormatLabel->setText(tr("Numbering Style")); + numLevelLabel->setText(tr("Level")); + numPrefixLabel->setText(tr("Prefix")); + numSuffixLabel->setText(tr("Suffix")); + numStartLabel->setText(tr("Start with")); + numRestartOtherBox->setText(tr("Restart after other format")); + numRestartHigherBox->setText(tr("Restart after higher level")); + + parEffectCharStyleComboLabel->setText(tr("Character Style for Effect:")); + distFromTextLabel->setText(tr("Distance from Text:")); + parentParEffectsButton->setText(tr("Use Parent`s Values")); + + QFont font1; + if (font1.pointSize()) + font1.setPointSize(font1.pointSize() *2); + else if (font1.pixelSize()) + font1.setPixelSize(font1.pixelSize() *2); + ((QComboBox*) bulletStrEdit_)->setFont(font1); + (bulletStrEdit_->lineEdit())->setFont(font1); + tabsBox->setTitle( tr("Tabulators and Indentation")); tabWidget->setTabText(0, tr("Properties")); tabWidget->setTabText(1, tr("Character Style")); @@ -165,12 +207,74 @@ void SMPStyleWidget::languageChange() void SMPStyleWidget::unitChange(double oldRatio, double newRatio, int unitIndex) { - dropCapOffset_->setNewUnit(unitIndex); + parEffectOffset_->setNewUnit(unitIndex); tabList_->unitChange(unitIndex); } +void SMPStyleWidget::setDoc(ScribusDoc *doc) +{ + if (m_Doc) + disconnect(m_Doc->scMW(), SIGNAL(UpdateRequest(int)), this , SLOT(handleUpdateRequest(int))); + m_Doc = doc; + if (m_Doc) + { + connect(m_Doc->scMW(), SIGNAL(UpdateRequest(int)), this , SLOT(handleUpdateRequest(int))); + fillNumerationsCombo(); + } +} + +void SMPStyleWidget::fillBulletStrEditCombo() +{ + bulletStrEdit_->clear(); + bulletStrEdit_->addItem(QChar(0x2022)); + bulletStrEdit_->addItem("*"); + bulletStrEdit_->addItem(QChar(0x2013)); + bulletStrEdit_->setMinimumWidth(50); + if (bulletStrEdit_->currentText().isEmpty()) + bulletStrEdit_->setEditText(QChar(0x2022)); +} + +void SMPStyleWidget::fillNumFormatCombo() +{ + numFormatCombo->clear(); + numFormatCombo->addItems(getFormatList()); +} + +void SMPStyleWidget::fillNumerationsCombo() +{ + QStringList numNames; + foreach (QString numName, m_Doc->numerations.keys()) + numNames.append(numName); + numNames.sort(); + numComboBox->clear(); + numComboBox->insertItems(0, numNames); + numComboBox->setCurrentItem(0); +} + +void SMPStyleWidget::fillNumRestartCombo() +{ + numRestartCombo->clear(); + numRestartCombo->addItem(tr("Document")); + numRestartCombo->addItem(tr("Section")); + numRestartCombo->addItem(tr("Story")); + numRestartCombo->addItem(tr("Page")); + numRestartCombo->addItem(tr("Frame")); +} + +void SMPStyleWidget::checkParEffectState() +{ + bool enable = false; + if (dropCapsBox->isChecked() || bulletBox->isChecked() || numBox->isChecked()) + enable = true; + + parEffectCharStyleCombo->setEnabled(enable); + parEffectOffset_->setEnabled(enable); + parEffectIndentBox->setEnabled(enable); +} + void SMPStyleWidget::show(ParagraphStyle *pstyle, QList<ParagraphStyle> &pstyles, QList<CharStyle> &cstyles, int unitIndex, const QString &defLang) { + currPStyle = pstyle; double unitRatio = unitGetRatioFromIndex(unitIndex); parentCombo->setEnabled(!pstyle->isDefaultStyle()); const ParagraphStyle *parent = dynamic_cast<const ParagraphStyle*>(pstyle->parentStyle()); @@ -194,6 +298,10 @@ void SMPStyleWidget::show(ParagraphStyle *pstyle, QList<ParagraphStyle> &pstyles minGlyphExtSpin->setRange(90.0,100.0); maxGlyphExtSpin->setRange(100.0,110.0); + //fillBulletStrEditCombo(); + //fillNumFormatCombo(); + //fillNumerationsCombo(); + //fillNumRestartCombo(); if (hasParent_) { @@ -221,20 +329,6 @@ void SMPStyleWidget::show(ParagraphStyle *pstyle, QList<ParagraphStyle> &pstyles spaceBelow_->setValue(pstyle->gapAfter(), pstyle->isInhGapAfter()); spaceBelow_->setParentValue(parent->gapAfter()); - dropCapsBox->setChecked(pstyle->hasDropCap());; - parentDropCap_ = parent->hasDropCap(); - if (pstyle->isInhHasDropCap()) - parentDropCapButton->hide(); - else - parentDropCapButton->show(); - - connect(parentDropCapButton, SIGNAL(clicked()), this, SLOT(slotParentDropCap())); - - dropCapLines_->setValue(pstyle->dropCapLines(), pstyle->isInhDropCapLines()); - dropCapLines_->setParentValue(parent->dropCapLines()); - - dropCapOffset_->setValue(pstyle->dropCapOffset() * unitRatio, pstyle->isInhDropCapOffset()); - dropCapOffset_->setParentValue(parent->dropCapOffset() * unitRatio); alignement_->setStyle(pstyle->alignment(), pstyle->isInhAlignment()); alignement_->setParentItem(parent->alignment()); @@ -266,6 +360,71 @@ void SMPStyleWidget::show(ParagraphStyle *pstyle, QList<ParagraphStyle> &pstyles keepLinesEnd->setParentValue (parent->keepLinesEnd()); keepTogether->setParentValue (parent->keepTogether()); keepWithNext->setParentValue (parent->keepWithNext()); + +//Effects Gropup Box + parentDC_ = parent->hasDropCap(); + parentBul_ = parent->hasBullet(); + parentNum_ = parent->hasNum(); + //parentParEffects_ = (parentDC_ || parentBul_ || parentNum_); + if (pstyle->isInhHasDropCap() && pstyle->isInhHasBullet() && pstyle->isInhHasNum()) + { + parentParEffectsButton->hide(); + disconnect(parentParEffectsButton, SIGNAL(clicked()), this, SLOT(slotParentParEffects())); + } + else + { + parentParEffectsButton->show(); + QFont f(font()); + f.setBold(true); + parentParEffectsButton->setFont(f); + } + connect(parentParEffectsButton, SIGNAL(clicked()), this, SLOT(slotParentParEffects())); + + dropCapsBox->setChecked(pstyle->hasDropCap()); + setWidgetBoldFont(dropCapsBox, !pstyle->isInhHasDropCap()); + dropCapLines_->setValue(pstyle->dropCapLines(), pstyle->isInhDropCapLines()); + dropCapLines_->setParentValue(parent->dropCapLines()); + + parEffectOffset_->setValue(pstyle->parEffectOffset() * unitRatio, pstyle->isInhParEffectOffset()); + parEffectOffset_->setParentValue(parent->parEffectOffset() * unitRatio); + parEffectIndentBox->setChecked(pstyle->parEffectIndent(),pstyle->isInhParEffectIndent()); + parEffectIndentBox->setParentValue(parent->parEffectIndent()); + + bulletBox->setChecked(pstyle->hasBullet()); + setWidgetBoldFont(bulletBox, !pstyle->isInhHasBullet()); + bulletStrEdit_->setEditText(pstyle->bulletStr()); + setWidgetBoldFont(bulletCharLabel, !pstyle->isInhBulletStr()); + numBox->setChecked(pstyle->hasNum()); + setWidgetBoldFont(numBox, !pstyle->isInhHasNum()); + QString numName = pstyle->numName(); + if (numName.isEmpty()) + numName = "default"; + numComboBox->setCurrentItem(numComboBox->findText(numName), pstyle->isInhNumName()); + if (!parent->numName().isEmpty()) + numComboBox->setParentItem(numComboBox->findText(parent->numName())); + else + numComboBox->setParentItem(0); + numFormatCombo->setCurrentItem(pstyle->numFormat()); + numFormatCombo->setParentItem(parent->numFormat()); + numLevelSpin->setValue(pstyle->numLevel() +1, pstyle->isInhNumLevel()); + NumStruct * numS = m_Doc->numerations.value(pstyle->numName()); + if (numS) + numLevelSpin->setMaximum(numS->m_counters.count()+1); + else + numLevelSpin->setMaximum(1); + numLevelSpin->setParentValue(parent->numLevel()+1); + numPrefix->setText(pstyle->numPrefix()); + setWidgetBoldFont(numPrefixLabel, !pstyle->isInhNumPrefix()); + numSuffix->setText(pstyle->numSuffix()); + setWidgetBoldFont(numSuffixLabel, !pstyle->isInhNumSuffix()); + numStartSpin->setValue(pstyle->numStart(), pstyle->isInhNumStart()); + numStartSpin->setParentValue(parent->numStart()); + numRestartCombo->setCurrentItem(pstyle->numRestart(), pstyle->isInhNumRestart()); + numRestartCombo->setParentItem(parent->numRestart()); + numRestartOtherBox->setChecked(pstyle->numOther(), pstyle->isInhNumOther()); + numRestartOtherBox->setParentValue(parent->numOther()); + numRestartHigherBox->setChecked(pstyle->numHigher(), pstyle->isInhNumHigher()); + numRestartHigherBox->setParentValue(parent->numHigher()); } else { @@ -279,12 +438,41 @@ void SMPStyleWidget::show(ParagraphStyle *pstyle, QList<ParagraphStyle> &pstyles minSpaceSpin->setValue(pstyle->minWordTracking() * 100.0); minGlyphExtSpin->setValue(pstyle->minGlyphExtension() * 100.0); maxGlyphExtSpin->setValue(pstyle->maxGlyphExtension() * 100.0); + + parEffectOffset_->setValue(pstyle->parEffectOffset() * unitRatio); + parEffectIndentBox->setChecked(pstyle->parEffectIndent()); + parentParEffectsButton->hide(); + disconnect(parentParEffectsButton, SIGNAL(clicked()), this, SLOT(slotParentParEffects())); dropCapsBox->setChecked(pstyle->hasDropCap()); - parentDropCapButton->hide(); - disconnect(parentDropCapButton, SIGNAL(clicked()), this, SLOT(slotParentDropCap())); + setWidgetBoldFont(dropCapsBox, false); dropCapLines_->setValue(pstyle->dropCapLines()); - dropCapOffset_->setValue(pstyle->dropCapOffset() * unitRatio); - parentDropCapButton->hide(); + bulletBox->setChecked(pstyle->hasBullet()); + setWidgetBoldFont(bulletBox, false); + bulletStrEdit_->setEditText(pstyle->bulletStr()); + setWidgetBoldFont(bulletCharLabel, false); + numBox->setChecked(pstyle->hasNum()); + setWidgetBoldFont(numBox, false); + QString numName = pstyle->numName(); + if (numName.isEmpty()) + numName = "default"; + numComboBox->setCurrentItem(numComboBox->findText(numName)); + numNewLineEdit->clear(); + numFormatCombo->setCurrentIndex(pstyle->numFormat()); + numLevelSpin->setValue(pstyle->numLevel()+1); + NumStruct * numS = m_Doc->numerations.value(pstyle->numName()); + if (numS) + numLevelSpin->setMaximum(numS->m_counters.count()+1); + else + numLevelSpin->setMaximum(1); + numPrefix->setText(pstyle->numPrefix()); + setWidgetBoldFont(numPrefixLabel, false); + numSuffix->setText(pstyle->numSuffix()); + setWidgetBoldFont(numSuffixLabel, false); + numStartSpin->setValue(pstyle->numStart()); + numRestartCombo->setCurrentItem(pstyle->numRestart()); + numRestartOtherBox->setChecked(pstyle->numOther()); + numRestartHigherBox->setChecked(pstyle->numHigher()); + alignement_->setStyle(pstyle->alignment()); tabList_->setTabs(pstyle->tabValues(), unitIndex); tabList_->setLeftIndentValue(pstyle->leftMargin() * unitRatio); @@ -299,17 +487,13 @@ void SMPStyleWidget::show(ParagraphStyle *pstyle, QList<ParagraphStyle> &pstyles lineSpacing_->setEnabled(pstyle->lineSpacingMode() == ParagraphStyle::FixedLineSpacing); dropCapLines_->setEnabled(pstyle->hasDropCap()); - dropCapOffset_->setEnabled(pstyle->hasDropCap()); - dropCapCharStyleCombo->setEnabled(pstyle->hasDropCap()); - dropCapCharStyleCombo->clear(); - dropCapCharStyleCombo->addItem(tr("No Style")); - for (int i =0; i < cstyles.count(); i++) - dropCapCharStyleCombo->addItem(cstyles.at(i).name()); - setCurrentComboItem(dropCapCharStyleCombo, pstyle->dcCharStyleName().isEmpty() ? tr("No Style") : pstyle->dcCharStyleName()); - QFont f(font()); - f.setBold(true); - parentDropCapButton->setFont(f); + checkParEffectState(); + parEffectCharStyleCombo->clear(); + parEffectCharStyleCombo->addItem(tr("No Style")); + for (int i =0; i < cstyles.count(); i++) + parEffectCharStyleCombo->addItem(cstyles.at(i).name()); + setCurrentComboItem(parEffectCharStyleCombo, pstyle->peCharStyleName().isEmpty() ? tr("No Style") : pstyle->peCharStyleName()); cpage->parentLabel->setText( tr("Based On:")); cpage->show(&pstyle->charStyle(), cstyles, defLang, unitIndex); @@ -341,6 +525,8 @@ void SMPStyleWidget::show(ParagraphStyle *pstyle, QList<ParagraphStyle> &pstyles } connect(dropCapsBox, SIGNAL(toggled(bool)), this, SLOT(slotDropCap(bool))); + connect(bulletBox, SIGNAL(toggled(bool)), this, SLOT(slotBullets(bool))); + connect(numBox, SIGNAL(toggled(bool)), this, SLOT(slotNumbering(bool))); } void SMPStyleWidget::show(QList<ParagraphStyle*> &pstyles, QList<ParagraphStyle> &pstylesAll, QList<CharStyle> &cstyles, int unitIndex, const QString &defLang) @@ -349,9 +535,12 @@ void SMPStyleWidget::show(QList<ParagraphStyle*> &pstyles, QList<ParagraphStyle> show(pstyles[0], pstylesAll, cstyles, unitIndex, defLang); else if (pstyles.count() > 1) { + currPStyle = pstyles[0]; showLineSpacing(pstyles); showSpaceAB(pstyles, unitIndex); showDropCap(pstyles, cstyles, unitIndex); + showBullet(pstyles, cstyles, unitIndex); + showNumeration(pstyles, cstyles, unitIndex); showAlignment(pstyles); showOpticalMargin(pstyles); showMinSpace(pstyles); @@ -360,6 +549,7 @@ void SMPStyleWidget::show(QList<ParagraphStyle*> &pstyles, QList<ParagraphStyle> showTabs(pstyles, unitIndex); showCStyle(pstyles, cstyles, defLang, unitIndex); showParent(pstyles); + checkParEffectState(); } } @@ -447,10 +637,7 @@ void SMPStyleWidget::showSpaceAB(QList<ParagraphStyle*> &pstyles, int unitIndex) void SMPStyleWidget::showDropCap(QList<ParagraphStyle*> &pstyles, QList<CharStyle> &cstyles, int unitIndex) { - double unitRatio = unitGetRatioFromIndex(unitIndex); - parentDropCapButton->hide(); - disconnect(parentDropCapButton, SIGNAL(clicked()), this, SLOT(slotParentDropCap())); - + disconnectPESignals(); bool dc = pstyles[0]->hasDropCap(); for (int i = 0; i < pstyles.count(); ++i) { @@ -478,33 +665,76 @@ void SMPStyleWidget::showDropCap(QList<ParagraphStyle*> &pstyles, QList<CharStyl else dropCapLines_->setValue(lines); - double dco = -4000.0; + dropCapsBox->setEnabled(true); + dropCapLines_->setEnabled(true); + connectPESignals(); +} + +void SMPStyleWidget::showBullet(QList<ParagraphStyle *> &pstyles, QList<CharStyle> &cstyles, int unitIndex) +{ +// double unitRatio = unitGetRatioFromIndex(unitIndex); + + disconnectPESignals(); + bool hb = pstyles[0]->hasBullet(); + for (int i = 0; i < pstyles.count(); ++i) + { + if (hb != pstyles[i]->hasBullet()) + { + hb = false; + break; + } + } + bulletBox->setChecked(hb); + + QString chStr = pstyles[0]->bulletStr(); for (int i = 0; i < pstyles.count(); ++i) { - if (dco > -3980.0 && !isEqual(pstyles[i]->dropCapOffset(), dco)) + if (chStr != pstyles[i]->bulletStr()) { - dco = -4000.0; + chStr.clear(); break; } else - dco = pstyles[i]->dropCapOffset(); + chStr = pstyles[i]->bulletStr(); } + bulletStrEdit_->setEditText(chStr); - if (dco < -3800.0) - dropCapOffset_->clear(); - else - dropCapOffset_->setValue(dco * unitRatio); + connectPESignals(); + bulletCharTableButton_->setEnabled(true); +} - dropCapCharStyleCombo->clear(); - dropCapCharStyleCombo->addItem(tr("No Style")); - for (int i=0; i < cstyles.count(); i++) - dropCapCharStyleCombo->addItem(cstyles.at(i).name()); +void SMPStyleWidget::showNumeration(QList<ParagraphStyle *> &pstyles, QList<CharStyle> &cstyles, int unitIndex) +{ + disconnectPESignals(); + QString prefix = pstyles[0]->numPrefix(); + for (int i = 0; i < pstyles.count(); ++i) + { + if (prefix != pstyles[i]->numPrefix()) + { + prefix.clear(); + break; + } + else + prefix = pstyles[i]->numPrefix(); + } + numPrefix->setText(prefix); + + QString suffix = pstyles[0]->numSuffix(); + for (int i = 0; i < pstyles.count(); ++i) + { + if (suffix != pstyles[i]->numSuffix()) + { + suffix.clear(); + break; + } + else + suffix = pstyles[i]->numSuffix(); + } + numSuffix->setText(suffix); - connect(dropCapsBox, SIGNAL(toggled(bool)), this, SLOT(slotDropCap(bool))); - dropCapsBox->setEnabled(true); - dropCapLines_->setEnabled(true); - dropCapOffset_->setEnabled(true); - dropCapCharStyleCombo->setEnabled(true); + numFormatCombo->setEnabled(true); + numLevelSpin->setEnabled(true); + connectPESignals(); } void SMPStyleWidget::showAlignment(QList<ParagraphStyle*> &pstyles) @@ -771,45 +1001,12 @@ void SMPStyleWidget::setOpticalMargins(int o, bool inhO, const ParagraphStyle *p optMarginRadioLeft->setParentValue(parent->opticalMargins() == ParagraphStyle::OM_LeftHangingPunct); optMarginRadioRight->setParentValue(parent->opticalMargins() == ParagraphStyle::OM_RightHangingPunct); optMarginRadioNone->setParentValue(parent->opticalMargins() == ParagraphStyle::OM_None); -// optMarginCheckLeftProtruding->setChecked(om & ParagraphStyle::OM_LeftProtruding, (om & ParagraphStyle::OM_LeftProtruding)==(parent->opticalMargins() & ParagraphStyle::OM_LeftProtruding)); -// optMarginCheckRightProtruding->setChecked(om & ParagraphStyle::OM_RightProtruding, (om & ParagraphStyle::OM_RightProtruding)==(parent->opticalMargins() & ParagraphStyle::OM_RightProtruding)); -// optMarginCheckLeftHangPunct->setChecked(om & ParagraphStyle::OM_LeftHangingPunct, (om & ParagraphStyle::OM_LeftHangingPunct)==(parent->opticalMargins() & ParagraphStyle::OM_LeftHangingPunct)); -// optMarginCheckRightHangPunct->setChecked(om & ParagraphStyle::OM_RightHangingPunct, (om & ParagraphStyle::OM_RightHangingPunct)==(parent->opticalMargins() & ParagraphStyle::OM_RightHangingPunct)); -// -// optMarginCheckLeftProtruding->setParentValue(parent->opticalMargins() & ParagraphStyle::OM_LeftProtruding); -// optMarginCheckRightProtruding->setParentValue(parent->opticalMargins() & ParagraphStyle::OM_RightProtruding); -// optMarginCheckLeftHangPunct->setParentValue(parent->opticalMargins() & ParagraphStyle::OM_LeftHangingPunct); -// optMarginCheckRightHangPunct->setParentValue(parent->opticalMargins() & ParagraphStyle::OM_RightHangingPunct); -// optMarginCheckLeftProtruding->setFont(false); -// optMarginCheckRightProtruding->setFont(false); -// optMarginCheckLeftHangPunct->setFont(false); -// optMarginCheckRightHangPunct->setFont(false); -// -// if ((om & ParagraphStyle::OM_LeftProtruding)!=(parent->opticalMargins() & ParagraphStyle::OM_LeftProtruding)) -// { -// optMarginCheckLeftProtruding->setFont(true); -// } -// if ((om & ParagraphStyle::OM_RightProtruding)!=(parent->opticalMargins() & ParagraphStyle::OM_RightProtruding)) -// { -// optMarginCheckRightProtruding->setFont(true); -// } -// if ((om & ParagraphStyle::OM_LeftHangingPunct)!=(parent->opticalMargins() & ParagraphStyle::OM_LeftHangingPunct)) -// { -// optMarginCheckLeftHangPunct->setFont(true); -// } -// if ((om & ParagraphStyle::OM_RightHangingPunct)!=(parent->opticalMargins() & ParagraphStyle::OM_LeftProtruding)) -// { -// optMarginCheckRightHangPunct->setFont(true); -// } } } + void SMPStyleWidget::slotDefaultOpticalMargins() { -// optMarginCheckLeftProtruding->setChecked(false); -// optMarginCheckRightProtruding->setChecked(true); -// optMarginCheckLeftHangPunct->setChecked(true); -// optMarginCheckRightHangPunct->setChecked(true); optMarginRadioNone->setChecked(true); if (hasParent_) optMarginParentButton->show(); @@ -818,12 +1015,9 @@ void SMPStyleWidget::slotDefaultOpticalMargins() void SMPStyleWidget::slotParentOpticalMargins() { disconnect(optMarginParentButton, SIGNAL(clicked()), this, SLOT(slotParentOpticalMargins())); -// disconnect(dropCapsBox, SIGNAL(toggled(bool)), this, SLOT(slotDropCap(bool))); optMarginParentButton->hide(); -// dropCapsBox->setChecked(parentDropCap_); emit useParentOptMargins(); connect(optMarginParentButton, SIGNAL(clicked()), this, SLOT(slotParentOpticalMargins())); -// connect(dropCapsBox, SIGNAL(toggled(bool)), this, SLOT(slotDropCap(bool))); } void SMPStyleWidget::clearAll() @@ -833,33 +1027,106 @@ void SMPStyleWidget::clearAll() void SMPStyleWidget::slotDropCap(bool isOn) { + disconnectPESignals(); if (isOn) { - dropCapsBox->setEnabled(true); dropCapLines_->setEnabled(true); - dropCapOffset_->setEnabled(true); - dropCapCharStyleCombo->setEnabled(true); + + bulletBox->setChecked(false); + bulletStrEdit_->setEnabled(false); + bulletCharTableButton_->setEnabled(false); + + numBox->setChecked(false); + numFormatCombo->setEnabled(false); + numLevelSpin->setEnabled(false); + numComboBox->setEnabled(false); + numRestartCombo->setEnabled(false); + numNewLineEdit->setEnabled(false); } else + dropCapLines_->setEnabled(false); + if (hasParent_) + parentParEffectsButton->show(); + checkParEffectState(); + connectPESignals(); +} + +void SMPStyleWidget::slotBullets(bool isOn) +{ + disconnectPESignals(); + if (isOn) { - dropCapsBox->setEnabled(true); + bulletStrEdit_->setEnabled(true); + if (bulletStrEdit_->currentText().isEmpty()) + bulletStrEdit_->setEditText(bulletStrEdit_->itemText(0)); + bulletCharTableButton_->setEnabled(true); + + numBox->setChecked(false); + numFormatCombo->setEnabled(false); + numLevelSpin->setEnabled(false); + numComboBox->setEnabled(false); + numRestartCombo->setEnabled(false); + numNewLineEdit->setEnabled(false); + + dropCapsBox->setChecked(false); dropCapLines_->setEnabled(false); - dropCapOffset_->setEnabled(false); - dropCapCharStyleCombo->setEnabled(false); + } + else + { + bulletStrEdit_->setEnabled(false); + bulletCharTableButton_->setEnabled(false); } if (hasParent_) - parentDropCapButton->show(); + parentParEffectsButton->show(); + checkParEffectState(); + connectPESignals(); } -void SMPStyleWidget::slotParentDropCap() +void SMPStyleWidget::insertSpecialChars(const QString &chars) { - disconnect(parentDropCapButton, SIGNAL(clicked()), this, SLOT(slotParentDropCap())); - disconnect(dropCapsBox, SIGNAL(toggled(bool)), this, SLOT(slotDropCap(bool))); - parentDropCapButton->hide(); - dropCapsBox->setChecked(parentDropCap_); - emit useParentDropCap(); - connect(parentDropCapButton, SIGNAL(clicked()), this, SLOT(slotParentDropCap())); - connect(dropCapsBox, SIGNAL(toggled(bool)), this, SLOT(slotDropCap(bool))); + bulletStrEdit_->lineEdit()->setText(chars); +} + +void SMPStyleWidget::slotNumbering(bool isOn) +{ + disconnectPESignals(); + if (isOn) + { + numFormatCombo->setEnabled(true); + numLevelSpin->setEnabled(true); + numComboBox->setEnabled(true); + if (numComboBox->currentIndex() < 0) + numComboBox->setCurrentIndex(0); + numRestartCombo->setEnabled(true); + numNewLineEdit->setEnabled(true); + + bulletBox->setChecked(false); + bulletStrEdit_->setEnabled(false); + bulletCharTableButton_->setEnabled(false); + + dropCapsBox->setChecked(false); + dropCapLines_->setEnabled(false); + } + else + { + numFormatCombo->setEnabled(false); + numLevelSpin->setEnabled(false); + } + if (hasParent_) + parentParEffectsButton->show(); + checkParEffectState(); + connectPESignals(); +} + +void SMPStyleWidget::slotParentParEffects() +{ + disconnectPESignals(); + parentParEffectsButton->hide(); + dropCapsBox->setChecked(parentDC_); + bulletBox->setChecked(parentBul_); + numBox->setChecked(parentNum_); + emit useParentParaEffects(); + connectPESignals(); } SMPStyleWidget::~SMPStyleWidget() @@ -867,5 +1134,68 @@ SMPStyleWidget::~SMPStyleWidget() } +void SMPStyleWidget::openEnhanced() +{ + if (m_enhanced) + return; + QApplication::changeOverrideCursor(QCursor(Qt::WaitCursor)); + m_enhanced = new CharSelectEnhanced(this); + m_enhanced->setModal(true); + connect(m_enhanced, SIGNAL(insertSpecialChars(const QString &)), this, SLOT(insertSpecialChars(const QString &))); + connect(m_enhanced, SIGNAL(paletteShown(bool)), bulletCharTableButton_, SLOT(setChecked(bool))); + m_enhanced->setDoc(m_Doc); + m_enhanced->setEnabled(true); + QString styleName = parEffectCharStyleCombo->currentText(); + if (styleName != tr("No Style") && !styleName.isEmpty()) + { + CharStyle chStyle = m_Doc->charStyle(styleName); + setCurrentComboItem(m_enhanced->fontSelector, chStyle.font().scName()); + } + else if (currPStyle) + setCurrentComboItem(m_enhanced->fontSelector, currPStyle->charStyle().font().scName()); + m_enhanced->newFont(m_enhanced->fontSelector->currentIndex()); + m_enhanced->show(); + QApplication::changeOverrideCursor(Qt::ArrowCursor); +} + +void SMPStyleWidget::closeEnhanced(bool show) +{ + if (!m_enhanced || show) + return; + disconnect(m_enhanced, SIGNAL(insertSpecialChars(const QString &)), this, SLOT(insertSpecialChars(const QString &))); + disconnect(m_enhanced, SIGNAL(paletteShown(bool)), bulletCharTableButton_, SLOT(setChecked(bool))); + m_enhanced->close(); + delete m_enhanced; + m_enhanced = NULL; +} + +void SMPStyleWidget::connectPESignals() +{ + connect(parentParEffectsButton, SIGNAL(clicked()), this, SLOT(slotParentParEffects())); + connect(bulletBox, SIGNAL(toggled(bool)), this, SLOT(slotBullets(bool))); + connect(numBox, SIGNAL(toggled(bool)), this, SLOT(slotNumbering(bool))); + connect(dropCapsBox, SIGNAL(toggled(bool)), this, SLOT(slotDropCap(bool))); +} +void SMPStyleWidget::disconnectPESignals() +{ + disconnect(parentParEffectsButton, SIGNAL(clicked()), this, SLOT(slotParentParEffects())); + disconnect(bulletBox, SIGNAL(toggled(bool)), this, SLOT(slotBullets(bool))); + disconnect(numBox, SIGNAL(toggled(bool)), this, SLOT(slotNumbering(bool))); + disconnect(dropCapsBox, SIGNAL(toggled(bool)), this, SLOT(slotDropCap(bool))); +} + +void SMPStyleWidget::on_bulletCharTableButton__toggled(bool checked) +{ + if (m_enhanced && !checked) + closeEnhanced(); + else if (!m_enhanced && checked) + openEnhanced(); +} + +void SMPStyleWidget::handleUpdateRequest(int updateFlags) +{ + if (updateFlags & reqNumUpdate) + fillNumerationsCombo(); +} diff --git a/Scribus/scribus/ui/smpstylewidget.h b/Scribus/scribus/ui/smpstylewidget.h index 4cd688b..b46e016 100644 --- a/Scribus/scribus/ui/smpstylewidget.h +++ b/Scribus/scribus/ui/smpstylewidget.h @@ -9,9 +9,9 @@ for which a new license (GPL+exception) is in place. #define SMPSTYLEWIDGET_H class QEvent; - #include "ui_smpstylewidget.h" +#include "ui/charselectenhanced.h" // #include "styles/styleset.h" @@ -19,7 +19,7 @@ class SMPStyleWidget : public QWidget, Ui::SMPStyleWidget { Q_OBJECT public: - SMPStyleWidget(); + SMPStyleWidget(ScribusDoc *doc); ~SMPStyleWidget(); virtual void changeEvent(QEvent *e); @@ -30,14 +30,27 @@ public: void clearAll(); void languageChange(); void unitChange(double oldRatio, double newRatio, int unitIndex); + void setDoc(ScribusDoc* doc); private: bool hasParent_; - bool parentDropCap_; + //bool parentParEffects_; + bool parentDC_, parentBul_, parentNum_; + CharSelectEnhanced * m_enhanced; + ScribusDoc * m_Doc; + QString currFontName; + ParagraphStyle* currPStyle; + void fillBulletStrEditCombo(); + void fillNumFormatCombo(); + void fillNumerationsCombo(); + void fillNumRestartCombo(); + void checkParEffectState(); void showLineSpacing(QList<ParagraphStyle*> &pstyles); void showSpaceAB(QList<ParagraphStyle*> &pstyles, int unitIndex); void showDropCap(QList<ParagraphStyle*> &pstyles, QList<CharStyle> &cstyles, int unitIndex); + void showBullet(QList<ParagraphStyle*> &pstyles, QList<CharStyle> &cstyles, int unitIndex); + void showNumeration(QList<ParagraphStyle*> &pstyles, QList<CharStyle> &cstyles, int unitIndex); void showAlignment(QList<ParagraphStyle*> &pstyles); void showOpticalMargin(QList<ParagraphStyle*> &pstyles); void showMinSpace(QList<ParagraphStyle*> &pstyles); @@ -48,19 +61,28 @@ private: void showParent(QList<ParagraphStyle*> &pstyles); void setOpticalMargins(int o, bool inhO=false, const ParagraphStyle *parent=NULL); + void openEnhanced(); + void closeEnhanced(bool show = false); + void connectPESignals(); + void disconnectPESignals(); + friend class SMParagraphStyle; private slots: void slotLineSpacingModeChanged(int); void slotDropCap(bool isOn); - void slotParentDropCap(); + void slotBullets(bool isOn); + void insertSpecialChars(const QString &); + void slotNumbering(bool isOn); + void slotParentParEffects(); void slotDefaultOpticalMargins(); void slotParentOpticalMargins(); // void slotUpdateOpticalMarginsFromCheckBoxes(int); - + void on_bulletCharTableButton__toggled(bool checked); + void handleUpdateRequest(int); signals: - void useParentDropCap(); + void useParentParaEffects(); void useParentOptMargins(); }; diff --git a/Scribus/scribus/ui/smpstylewidget.ui b/Scribus/scribus/ui/smpstylewidget.ui index 00654ac..fea9615 100644 --- a/Scribus/scribus/ui/smpstylewidget.ui +++ b/Scribus/scribus/ui/smpstylewidget.ui @@ -6,8 +6,8 @@ <rect> <x>0</x> <y>0</y> - <width>792</width> - <height>717</height> + <width>798</width> + <height>755</height> </rect> </property> <layout class="QVBoxLayout"> @@ -234,47 +234,25 @@ </widget> </item> <item> - <widget class="QGroupBox" name="dropCapsBox"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> + <widget class="QGroupBox" name="parEffectsBox"> <property name="title"> - <string>Drop Caps</string> + <string>Paragraph Effects</string> </property> - <property name="checkable"> - <bool>true</bool> - </property> - <property name="checked"> - <bool>true</bool> - </property> - <layout class="QVBoxLayout"> + <layout class="QVBoxLayout" name="verticalLayout_6"> <item> - <layout class="QHBoxLayout"> + <layout class="QHBoxLayout" name="horizontalLayout_13"> <item> - <widget class="QLabel" name="dropCapsLineLabel"> + <widget class="QLabel" name="parEffectCharStyleComboLabel"> <property name="text"> - <string>&Lines:</string> - </property> - <property name="buddy"> - <cstring>dropCapLines_</cstring> + <string>Character Style for Effect:</string> </property> </widget> </item> <item> - <widget class="SMSpinBox" name="dropCapLines_"> - <property name="minimum"> - <number>2</number> - </property> - <property name="maximum"> - <number>20</number> - </property> - </widget> + <widget class="SMScComboBox" name="parEffectCharStyleCombo"/> </item> <item> - <spacer name="horizontalSpacer_2"> + <spacer name="spacer_6"> <property name="orientation"> <enum>Qt::Horizontal</enum> </property> @@ -292,12 +270,12 @@ <string>Distance from Text:</string> </property> <property name="buddy"> - <cstring>dropCapOffset_</cstring> + <cstring>parEffectOffset_</cstring> </property> </widget> </item> <item> - <widget class="SMScrSpinBox" name="dropCapOffset_"> + <widget class="SMScrSpinBox" name="parEffectOffset_"> <property name="minimum"> <number>-3000</number> </property> @@ -319,86 +297,368 @@ </property> </spacer> </item> + <item> + <widget class="SMCheckBox" name="parEffectIndentBox"> + <property name="text"> + <string>AutoIndent</string> + </property> + </widget> + </item> </layout> </item> <item> - <widget class="QLabel" name="dropCapCharStyleComboLabel"> - <property name="text"> - <string>Character Style for Drop Cap:</string> - </property> - </widget> - </item> - <item> - <widget class="SMScComboBox" name="dropCapCharStyleCombo"/> + <layout class="QHBoxLayout" name="horizontalLayout_12"> + <item> + <spacer name="spacer_10"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QToolButton" name="parentParEffectsButton"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="text"> + <string>Use Parent`s Values</string> + </property> + </widget> + </item> + </layout> </item> <item> - <widget class="QToolButton" name="parentDropCapButton"> - <property name="enabled"> - <bool>true</bool> + <widget class="QGroupBox" name="bulletBox"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> </property> - <property name="text"> - <string>Use Parent Value</string> + <property name="title"> + <string>Bullets</string> </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <widget class="QGroupBox" name="textFlowBox"> - <property name="title"> - <string>Orphans and Widows</string> - </property> - <layout class="QGridLayout" name="gridLayout_2"> - <item row="0" column="0"> - <widget class="QLabel" name="keepLabelStart"> - <property name="toolTip"> - <string>Ensure that first lines of a paragraph won't end up separated from the rest (known as widow/orphan control)</string> + <property name="checkable"> + <bool>true</bool> </property> - <property name="text"> - <string>Don't separate first</string> + <property name="checked"> + <bool>false</bool> </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_7"> + <item> + <widget class="QLabel" name="bulletCharLabel"> + <property name="text"> + <string>Bullet Char/String</string> + </property> + </widget> + </item> + <item> + <widget class="SMScComboBox" name="bulletStrEdit_"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>50</width> + <height>0</height> + </size> + </property> + <property name="editable"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <spacer name="spacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QPushButton" name="bulletCharTableButton_"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Char Table</string> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <spacer name="spacer_2"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + </layout> </widget> </item> - <item row="0" column="1"> - <widget class="SMSpinBox" name="keepLinesStart"> - <property name="suffix"> - <string> lines</string> + <item> + <widget class="QGroupBox" name="numBox"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> </property> - <property name="maximum"> - <number>10</number> + <property name="title"> + <string>Numeration</string> </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="keepLabelEnd"> - <property name="text"> - <string>Don't separate last</string> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="checked"> + <bool>false</bool> </property> + <layout class="QVBoxLayout" name="verticalLayout_5"> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_9"> + <item> + <widget class="QLabel" name="numComboLabel"> + <property name="text"> + <string>Set:</string> + </property> + </widget> + </item> + <item> + <widget class="SMScComboBox" name="numComboBox"> + <property name="currentIndex"> + <number>-1</number> + </property> + <property name="minimumContentsLength"> + <number>10</number> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="numLevelLabel"> + <property name="text"> + <string>Level</string> + </property> + </widget> + </item> + <item> + <widget class="SMSpinBox" name="numLevelSpin"/> + </item> + <item> + <spacer name="horizontalSpacer_4"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QLabel" name="numNewLabel"> + <property name="text"> + <string>Create New Set:</string> + </property> + </widget> + </item> + <item> + <widget class="QLineEdit" name="numNewLineEdit"/> + </item> + </layout> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_10"> + <item> + <widget class="QLabel" name="numFormatLabel"> + <property name="text"> + <string>Nums Format</string> + </property> + <property name="buddy"> + <cstring>numFormatCombo</cstring> + </property> + </widget> + </item> + <item> + <widget class="SMScComboBox" name="numFormatCombo"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="numStartLabel"> + <property name="text"> + <string>Start with</string> + </property> + </widget> + </item> + <item> + <widget class="SMSpinBox" name="numStartSpin"> + <property name="maximum"> + <number>99999</number> + </property> + <property name="value"> + <number>1</number> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="numPrefixLabel"> + <property name="text"> + <string>Prefix</string> + </property> + </widget> + </item> + <item> + <widget class="QLineEdit" name="numPrefix"/> + </item> + <item> + <widget class="QLabel" name="numSuffixLabel"> + <property name="text"> + <string>Suffix</string> + </property> + </widget> + </item> + <item> + <widget class="QLineEdit" name="numSuffix"/> + </item> + </layout> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_8"> + <item> + <widget class="QLabel" name="numRestartLabel"> + <property name="text"> + <string>Restart</string> + </property> + </widget> + </item> + <item> + <widget class="SMScComboBox" name="numRestartCombo"/> + </item> + <item> + <spacer name="horizontalSpacer_3"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="SMCheckBox" name="numRestartOtherBox"> + <property name="text"> + <string>Restart after other format</string> + </property> + </widget> + </item> + <item> + <widget class="SMCheckBox" name="numRestartHigherBox"> + <property name="text"> + <string>Restart after higher level</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> </widget> </item> - <item row="1" column="1"> - <widget class="SMSpinBox" name="keepLinesEnd"> - <property name="suffix"> - <string> lines</string> + <item> + <widget class="QGroupBox" name="dropCapsBox"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> </property> - <property name="maximum"> - <number>10</number> + <property name="title"> + <string>Drop Caps</string> </property> - </widget> - </item> - <item row="2" column="0" colspan="2"> - <widget class="SMCheckBox" name="keepTogether"> - <property name="text"> - <string>Do not split paragraph</string> + <property name="checkable"> + <bool>true</bool> </property> - </widget> - </item> - <item row="3" column="0" colspan="2"> - <widget class="SMCheckBox" name="keepWithNext"> - <property name="text"> - <string>Keep with next paragraph</string> + <property name="checked"> + <bool>true</bool> </property> + <layout class="QVBoxLayout"> + <item> + <layout class="QHBoxLayout"> + <item> + <widget class="QLabel" name="dropCapsLineLabel"> + <property name="text"> + <string>&Lines:</string> + </property> + <property name="buddy"> + <cstring>dropCapLines_</cstring> + </property> + </widget> + </item> + <item> + <widget class="SMSpinBox" name="dropCapLines_"> + <property name="minimum"> + <number>2</number> + </property> + <property name="maximum"> + <number>20</number> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_2"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + </layout> </widget> </item> </layout> @@ -415,7 +675,7 @@ <property name="sizeHint" stdset="0"> <size> <width>272</width> - <height>0</height> + <height>13</height> </size> </property> </spacer> @@ -627,6 +887,79 @@ </widget> </item> <item> + <widget class="Line" name="line"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + </widget> + </item> + <item> + <widget class="QGroupBox" name="textFlowBox"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string>Orphans and Widows</string> + </property> + <layout class="QGridLayout" name="gridLayout_2"> + <item row="1" column="1"> + <widget class="SMSpinBox" name="keepLinesEnd"> + <property name="suffix"> + <string> lines</string> + </property> + <property name="maximum"> + <number>10</number> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="keepLabelEnd"> + <property name="text"> + <string>Don't separate last</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="SMSpinBox" name="keepLinesStart"> + <property name="suffix"> + <string> lines</string> + </property> + <property name="maximum"> + <number>10</number> + </property> + </widget> + </item> + <item row="0" column="0"> + <widget class="QLabel" name="keepLabelStart"> + <property name="toolTip"> + <string>Ensure that first lines of a paragraph won't end up separated from the rest (known as widow/orphan control)</string> + </property> + <property name="text"> + <string>Don't separate first</string> + </property> + </widget> + </item> + <item row="2" column="0" colspan="2"> + <widget class="SMCheckBox" name="keepTogether"> + <property name="text"> + <string>Do not split paragraph</string> + </property> + </widget> + </item> + <item row="3" column="0" colspan="2"> + <widget class="SMCheckBox" name="keepWithNext"> + <property name="text"> + <string>Keep with next paragraph</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> <spacer> <property name="orientation"> <enum>Qt::Vertical</enum> @@ -749,6 +1082,16 @@ <header>ui/smsccombobox.h</header> </customwidget> <customwidget> + <class>SMRadioButton</class> + <extends>QRadioButton</extends> + <header>ui/smradiobutton.h</header> + </customwidget> + <customwidget> + <class>SMCheckBox</class> + <extends>QCheckBox</extends> + <header>ui/smcheckbox.h</header> + </customwidget> + <customwidget> <class>SMScrSpinBox</class> <extends>QSpinBox</extends> <header>ui/smscrspinbox.h</header> @@ -776,16 +1119,6 @@ <header>ui/smcstylewidget.h</header> <container>1</container> </customwidget> - <customwidget> - <class>SMRadioButton</class> - <extends>QRadioButton</extends> - <header>ui/smradiobutton.h</header> - </customwidget> - <customwidget> - <class>SMCheckBox</class> - <extends>QCheckBox</extends> - <header>ui/smcheckbox.h</header> - </customwidget> </customwidgets> <resources/> <connections/> diff --git a/Scribus/scribus/ui/smtextstyles.cpp b/Scribus/scribus/ui/smtextstyles.cpp index e5cbf48..ad41c30 100644 --- a/Scribus/scribus/ui/smtextstyles.cpp +++ b/Scribus/scribus/ui/smtextstyles.cpp @@ -45,7 +45,7 @@ SMParagraphStyle::SMParagraphStyle(StyleSet<CharStyle> *cstyles) : StyleItem(), pwidget_(0), doc_(0), selectionIsDirty_(false), unitRatio_(1.0), cstyles_(cstyles) { Q_ASSERT(cstyles_); - pwidget_ = new SMPStyleWidget(); + pwidget_ = new SMPStyleWidget(doc_); Q_CHECK_PTR(pwidget_); } @@ -87,6 +87,8 @@ void SMParagraphStyle::setCurrentDoc(ScribusDoc *doc) tmpStyles_.clear(); deleted_.clear(); } + if (pwidget_) + pwidget_->setDoc(doc); } StyleSet<ParagraphStyle>* SMParagraphStyle::tmpStyles() @@ -512,11 +514,27 @@ void SMParagraphStyle::setupConnections() connect(pwidget_->minGlyphExtSpin, SIGNAL(valueChanged(double)),this,SLOT(slotMinGlyphExt())); connect(pwidget_->maxGlyphExtSpin, SIGNAL(valueChanged(double)),this,SLOT(slotMaxGlyphExt())); - connect(pwidget_, SIGNAL(useParentDropCap()), this, SLOT(slotParentDropCap())); + connect(pwidget_, SIGNAL(useParentParaEffects()), this, SLOT(slotParentParaEffects())); connect(pwidget_->dropCapsBox, SIGNAL(toggled(bool)), this, SLOT(slotDropCap(bool))); connect(pwidget_->dropCapLines_, SIGNAL(valueChanged(int)), this, SLOT(slotDropCapLines(int))); - connect(pwidget_->dropCapOffset_, SIGNAL(valueChanged(double)), this, SLOT(slotDropCapOffset())); - connect(pwidget_->dropCapCharStyleCombo, SIGNAL(activated(const QString&)), this, SLOT(slotDropCapCharStyle(const QString&))); + connect(pwidget_->parEffectOffset_, SIGNAL(valueChanged(double)), this, SLOT(slotParEffectOffset())); + connect(pwidget_->parEffectIndentBox, SIGNAL(toggled(bool)), this, SLOT(slotParEffectIndent(bool))); + connect(pwidget_->parEffectCharStyleCombo, SIGNAL(activated(const QString&)), this, SLOT(slotParEffectCharStyle(const QString&))); + + connect(pwidget_->bulletBox, SIGNAL(toggled(bool)), this, SLOT(slotBullet(bool))); + connect(pwidget_->bulletStrEdit_, SIGNAL(editTextChanged(QString)), this, SLOT(slotBulletStr(QString))); + connect(pwidget_->numBox, SIGNAL(toggled(bool)), this, SLOT(slotNumeration(bool))); + connect(pwidget_->numComboBox, SIGNAL(activated(QString)), this, SLOT(slotNumName(QString))); + connect(pwidget_->numLevelSpin, SIGNAL(valueChanged(int)), this, SLOT(slotNumLevel(int))); + connect(pwidget_->numFormatCombo, SIGNAL(activated(int)), this, SLOT(slotNumFormat(int))); + connect(pwidget_->numStartSpin, SIGNAL(valueChanged(int)), this, SLOT(slotNumStart(int))); + connect(pwidget_->numRestartCombo, SIGNAL(activated(int)), this, SLOT(slotNumRestart(int))); + connect(pwidget_->numRestartOtherBox, SIGNAL(toggled(bool)), this, SLOT(slotNumOther(bool))); + connect(pwidget_->numRestartHigherBox, SIGNAL(toggled(bool)), this, SLOT(slotNumHigher(bool))); + connect(pwidget_->numPrefix, SIGNAL(textChanged(QString)), this, SLOT(slotNumPrefix(QString))); + connect(pwidget_->numSuffix, SIGNAL(textChanged(QString)), this, SLOT(slotNumSuffix(QString))); + connect(pwidget_->numNewLineEdit, SIGNAL(editingFinished()), this, SLOT(slotNumNew())); + connect(pwidget_->numNewLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotSelectionDirty())); connect(pwidget_->keepLinesStart, SIGNAL(valueChanged(int)), this, SLOT(handleKeepLinesStart())); connect(pwidget_->keepLinesEnd, SIGNAL(valueChanged(int)), this, SLOT(handleKeepLinesEnd())); @@ -529,26 +547,18 @@ void SMParagraphStyle::setupConnections() connect(pwidget_->tabList_->right_, SIGNAL(valueChanged(double)), this, SLOT(slotRightIndent())); connect(pwidget_->tabList_->first_, SIGNAL(valueChanged(double)), this, SLOT(slotFirstLine())); - connect(pwidget_->parentCombo, SIGNAL(activated(const QString&)), - this, SLOT(slotParentChanged(const QString&))); + connect(pwidget_->parentCombo, SIGNAL(activated(const QString&)), this, SLOT(slotParentChanged(const QString&))); // character attributes connect(pwidget_->cpage->fontFace_, SIGNAL(fontSelected(QString)), this, SLOT(slotFont(QString))); connect(pwidget_->cpage->effects_, SIGNAL(State(int)), this, SLOT(slotEffects(int))); - connect(pwidget_->cpage->effects_->ShadowVal->Xoffset, SIGNAL(valueChanged(double)), - this, SLOT(slotEffectProperties())); - connect(pwidget_->cpage->effects_->ShadowVal->Yoffset, SIGNAL(valueChanged(double)), - this, SLOT(slotEffectProperties())); - connect(pwidget_->cpage->effects_->OutlineVal->LWidth, SIGNAL(valueChanged(double)), - this, SLOT(slotEffectProperties())); - connect(pwidget_->cpage->effects_->UnderlineVal->LPos, SIGNAL(valueChanged(double)), - this, SLOT(slotEffectProperties())); - connect(pwidget_->cpage->effects_->UnderlineVal->LWidth, SIGNAL(valueChanged(double)), - this, SLOT(slotEffectProperties())); - connect(pwidget_->cpage->effects_->StrikeVal->LPos, SIGNAL(valueChanged(double)), - this, SLOT(slotEffectProperties())); - connect(pwidget_->cpage->effects_->StrikeVal->LWidth, SIGNAL(valueChanged(double)), - this, SLOT(slotEffectProperties())); + connect(pwidget_->cpage->effects_->ShadowVal->Xoffset, SIGNAL(valueChanged(double)), this, SLOT(slotEffectProperties())); + connect(pwidget_->cpage->effects_->ShadowVal->Yoffset, SIGNAL(valueChanged(double)), this, SLOT(slotEffectProperties())); + connect(pwidget_->cpage->effects_->OutlineVal->LWidth, SIGNAL(valueChanged(double)), this, SLOT(slotEffectProperties())); + connect(pwidget_->cpage->effects_->UnderlineVal->LPos, SIGNAL(valueChanged(double)), this, SLOT(slotEffectProperties())); + connect(pwidget_->cpage->effects_->UnderlineVal->LWidth, SIGNAL(valueChanged(double)), this, SLOT(slotEffectProperties())); + connect(pwidget_->cpage->effects_->StrikeVal->LPos, SIGNAL(valueChanged(double)), this, SLOT(slotEffectProperties())); + connect(pwidget_->cpage->effects_->StrikeVal->LWidth, SIGNAL(valueChanged(double)), this, SLOT(slotEffectProperties())); connect(pwidget_->cpage->fillColor_, SIGNAL(activated(const QString&)), this, SLOT(slotFillColor())); connect(pwidget_->cpage->fillShade_, SIGNAL(clicked()), this, SLOT(slotFillShade())); connect(pwidget_->cpage->strokeColor_, SIGNAL(activated(const QString&)), this, SLOT(slotStrokeColor())); @@ -561,8 +571,7 @@ void SMParagraphStyle::setupConnections() connect(pwidget_->cpage->widthSpaceSpin, SIGNAL(valueChanged(double)), this, SLOT(slotWordTracking())); connect(pwidget_->cpage->baselineOffset_, SIGNAL(valueChanged(double)), this, SLOT(slotBaselineOffset())); connect(pwidget_->cpage->fontFace_, SIGNAL(fontSelected(QString)), this, SLOT(slotFont(QString))); - connect(pwidget_->cpage->parentCombo, SIGNAL(activated(const QString&)), - this, SLOT(slotCharParentChanged(const QString&))); + connect(pwidget_->cpage->parentCombo, SIGNAL(activated(const QString&)), this, SLOT(slotCharParentChanged(const QString&))); } void SMParagraphStyle::removeConnections() @@ -590,14 +599,29 @@ void SMParagraphStyle::removeConnections() disconnect(pwidget_->minGlyphExtSpin, SIGNAL(valueChanged(double)),this,SLOT(slotMinGlyphExt())); disconnect(pwidget_->maxGlyphExtSpin, SIGNAL(valueChanged(double)),this,SLOT(slotMaxGlyphExt())); - disconnect(pwidget_, SIGNAL(useParentDropCap()), this, SLOT(slotParentDropCap())); + disconnect(pwidget_, SIGNAL(useParentParaEffects()), this, SLOT(slotParentParaEffects())); disconnect(pwidget_->dropCapsBox, SIGNAL(toggled(bool)), this, SLOT(slotDropCap(bool))); disconnect(pwidget_->dropCapLines_, SIGNAL(valueChanged(int)), this, SLOT(slotDropCapLines(int))); - disconnect(pwidget_->dropCapOffset_, SIGNAL(valueChanged(double)), this, SLOT(slotDropCapOffset())); - disconnect(pwidget_->dropCapCharStyleCombo, SIGNAL(activated(const QString&)), this, SLOT(slotDropCapCharStyle(const QString&))); - - disconnect(pwidget_->parentCombo, SIGNAL(activated(const QString&)), - this, SLOT(slotParentChanged(const QString&))); + disconnect(pwidget_->parEffectOffset_, SIGNAL(valueChanged(double)), this, SLOT(slotParEffectOffset())); + disconnect(pwidget_->parEffectIndentBox, SIGNAL(toggled(bool)), this, SLOT(slotParEffectIndent(bool))); + disconnect(pwidget_->parEffectCharStyleCombo, SIGNAL(activated(const QString&)), this, SLOT(slotParEffectCharStyle(const QString&))); + + disconnect(pwidget_->bulletBox, SIGNAL(toggled(bool)), this, SLOT(slotBullet(bool))); + disconnect(pwidget_->bulletStrEdit_, SIGNAL(editTextChanged(QString)), this, SLOT(slotBulletStr(QString))); + disconnect(pwidget_->numBox, SIGNAL(toggled(bool)), this, SLOT(slotNumeration(bool))); + disconnect(pwidget_->numComboBox, SIGNAL(activated(QString)), this, SLOT(slotNumName(QString))); + disconnect(pwidget_->numFormatCombo, SIGNAL(activated(int)), this, SLOT(slotNumFormat(int))); + disconnect(pwidget_->numLevelSpin, SIGNAL(valueChanged(int)), this, SLOT(slotNumLevel(int))); + disconnect(pwidget_->numStartSpin, SIGNAL(valueChanged(int)), this, SLOT(slotNumStart(int))); + disconnect(pwidget_->numRestartCombo, SIGNAL(activated(int)), this, SLOT(slotNumRestart(int))); + disconnect(pwidget_->numRestartOtherBox, SIGNAL(toggled(bool)), this, SLOT(slotNumOther(bool))); + disconnect(pwidget_->numRestartHigherBox, SIGNAL(toggled(bool)), this, SLOT(slotNumHigher(bool))); + disconnect(pwidget_->numPrefix, SIGNAL(textChanged(QString)), this, SLOT(slotNumPrefix(QString))); + disconnect(pwidget_->numSuffix, SIGNAL(textChanged(QString)), this, SLOT(slotNumSuffix(QString))); + disconnect(pwidget_->numNewLineEdit, SIGNAL(editingFinished()), this, SLOT(slotNumNew())); + disconnect(pwidget_->numNewLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotSelectionDirty())); + + disconnect(pwidget_->parentCombo, SIGNAL(activated(const QString&)), this, SLOT(slotParentChanged(const QString&))); disconnect(pwidget_->keepLinesStart, SIGNAL(valueChanged(int)), this, SLOT(handleKeepLinesStart())); disconnect(pwidget_->keepLinesEnd, SIGNAL(valueChanged(int)), this, SLOT(handleKeepLinesEnd())); @@ -611,20 +635,13 @@ void SMParagraphStyle::removeConnections() disconnect(pwidget_->cpage->fontFace_, SIGNAL(fontSelected(QString)), this, SLOT(slotFont(QString))); disconnect(pwidget_->cpage->effects_, SIGNAL(State(int)), this, SLOT(slotEffects(int))); - disconnect(pwidget_->cpage->effects_->ShadowVal->Xoffset, SIGNAL(valueChanged(double)), - this, SLOT(slotEffectProperties())); - disconnect(pwidget_->cpage->effects_->ShadowVal->Yoffset, SIGNAL(valueChanged(double)), - this, SLOT(slotEffectProperties())); - disconnect(pwidget_->cpage->effects_->OutlineVal->LWidth, SIGNAL(valueChanged(double)), - this, SLOT(slotEffectProperties())); - disconnect(pwidget_->cpage->effects_->UnderlineVal->LPos, SIGNAL(valueChanged(double)), - this, SLOT(slotEffectProperties())); - disconnect(pwidget_->cpage->effects_->UnderlineVal->LWidth, SIGNAL(valueChanged(double)), - this, SLOT(slotEffectProperties())); - disconnect(pwidget_->cpage->effects_->StrikeVal->LPos, SIGNAL(valueChanged(double)), - this, SLOT(slotEffectProperties())); - disconnect(pwidget_->cpage->effects_->StrikeVal->LWidth, SIGNAL(valueChanged(double)), - this, SLOT(slotEffectProperties())); + disconnect(pwidget_->cpage->effects_->ShadowVal->Xoffset, SIGNAL(valueChanged(double)), this, SLOT(slotEffectProperties())); + disconnect(pwidget_->cpage->effects_->ShadowVal->Yoffset, SIGNAL(valueChanged(double)), this, SLOT(slotEffectProperties())); + disconnect(pwidget_->cpage->effects_->OutlineVal->LWidth, SIGNAL(valueChanged(double)), this, SLOT(slotEffectProperties())); + disconnect(pwidget_->cpage->effects_->UnderlineVal->LPos, SIGNAL(valueChanged(double)), this, SLOT(slotEffectProperties())); + disconnect(pwidget_->cpage->effects_->UnderlineVal->LWidth, SIGNAL(valueChanged(double)), this, SLOT(slotEffectProperties())); + disconnect(pwidget_->cpage->effects_->StrikeVal->LPos, SIGNAL(valueChanged(double)), this, SLOT(slotEffectProperties())); + disconnect(pwidget_->cpage->effects_->StrikeVal->LWidth, SIGNAL(valueChanged(double)), this, SLOT(slotEffectProperties())); disconnect(pwidget_->cpage->fillColor_, SIGNAL(activated(const QString&)), this, SLOT(slotFillColor())); disconnect(pwidget_->cpage->fillShade_, SIGNAL(clicked()), this, SLOT(slotFillShade())); disconnect(pwidget_->cpage->strokeColor_, SIGNAL(activated(const QString&)), this, SLOT(slotStrokeColor())); @@ -637,8 +654,7 @@ void SMParagraphStyle::removeConnections() disconnect(pwidget_->cpage->widthSpaceSpin, SIGNAL(valueChanged(double)), this, SLOT(slotWordTracking())); disconnect(pwidget_->cpage->baselineOffset_, SIGNAL(valueChanged(double)), this, SLOT(slotBaselineOffset())); disconnect(pwidget_->cpage->fontFace_, SIGNAL(fontSelected(QString)), this, SLOT(slotFont(QString))); - disconnect(pwidget_->cpage->parentCombo, SIGNAL(activated(const QString&)), - this, SLOT(slotCharParentChanged(const QString&))); + disconnect(pwidget_->cpage->parentCombo, SIGNAL(activated(const QString&)), this, SLOT(slotCharParentChanged(const QString&))); } void SMParagraphStyle::slotLineSpacingMode(int mode) @@ -854,8 +870,15 @@ void SMParagraphStyle::slotMaxGlyphExt() void SMParagraphStyle::slotDropCap(bool isOn) { for (int i = 0; i < selection_.count(); ++i) + { selection_[i]->setHasDropCap(isOn); - + if (isOn) + { + selection_[i]->setHasBullet(false); + selection_[i]->setHasNum(false); + } + } + if (!selectionIsDirty_) { selectionIsDirty_ = true; @@ -863,11 +886,15 @@ void SMParagraphStyle::slotDropCap(bool isOn) } } -void SMParagraphStyle::slotParentDropCap() +void SMParagraphStyle::slotParentParaEffects() { for (int i = 0; i < selection_.count(); ++i) + { selection_[i]->resetHasDropCap(); - + selection_[i]->resetHasBullet(); + selection_[i]->resetHasNum(); + } + if (!selectionIsDirty_) { selectionIsDirty_ = true; @@ -891,20 +918,38 @@ void SMParagraphStyle::slotDropCapLines(int lines) } } -void SMParagraphStyle::slotDropCapOffset() +void SMParagraphStyle::slotParEffectOffset() { - if (pwidget_->dropCapOffset_->useParentValue()) + if (pwidget_->parEffectOffset_->useParentValue()) for (int i = 0; i < selection_.count(); ++i) - selection_[i]->resetDropCapOffset(); + selection_[i]->resetParEffectOffset(); else { double a, b, value; int c; - pwidget_->dropCapOffset_->getValues(&a, &b, &c, &value); + pwidget_->parEffectOffset_->getValues(&a, &b, &c, &value); value = value / unitRatio_; for (int i = 0; i < selection_.count(); ++i) - selection_[i]->setDropCapOffset(value); + selection_[i]->setParEffectOffset(value); + } + + if (!selectionIsDirty_) + { + selectionIsDirty_ = true; + emit selectionDirty(); + } +} + +void SMParagraphStyle::slotParEffectIndent(bool isOn) +{ + if (pwidget_->parEffectIndentBox->useParentValue()) + for (int i = 0; i < selection_.count(); ++i) + selection_[i]->resetParEffectIndent(); + else + { + for (int i = 0; i < selection_.count(); ++i) + selection_[i]->setParEffectIndent(isOn); } if (!selectionIsDirty_) @@ -914,15 +959,250 @@ void SMParagraphStyle::slotDropCapOffset() } } -void SMParagraphStyle::slotDropCapCharStyle(const QString& name) +void SMParagraphStyle::slotParEffectCharStyle(const QString& name) { - if (pwidget_->dropCapCharStyleCombo->useParentValue()) + if (pwidget_->parEffectCharStyleCombo->useParentValue()) for (int i = 0; i < selection_.count(); ++i) - selection_[i]->resetDcCharStyleName(); + selection_[i]->resetPeCharStyleName(); else for (int i = 0; i < selection_.count(); ++i) - selection_[i]->setDcCharStyleName(name); + selection_[i]->setPeCharStyleName(name); + + if (!selectionIsDirty_) + { + selectionIsDirty_ = true; + emit selectionDirty(); + } +} + +void SMParagraphStyle::slotBullet(bool isOn) +{ + for (int i = 0; i < selection_.count(); ++i) + { + selection_[i]->setHasBullet(isOn); + if (isOn) + { + selection_[i]->setBulletStr(pwidget_->bulletStrEdit_->currentText()); + selection_[i]->setHasDropCap(false); + selection_[i]->setHasNum(false); + } + } + + if (!selectionIsDirty_) + { + selectionIsDirty_ = true; + emit selectionDirty(); + } +} + +void SMParagraphStyle::slotBulletStr(const QString &str) +{ + QString bstr(str); + if (bstr.isEmpty()) + { + bstr = pwidget_->bulletStrEdit_->itemText(0); + pwidget_->bulletStrEdit_->setEditText(bstr); + } + for (int i = 0; i < selection_.count(); ++i) + selection_[i]->setBulletStr(bstr); + + if (!selectionIsDirty_) + { + selectionIsDirty_ = true; + emit selectionDirty(); + } +} + +void SMParagraphStyle::slotNumeration(bool isOn) +{ + for (int i = 0; i < selection_.count(); ++i) + { + selection_[i]->setHasNum(isOn); + if (isOn) + { + selection_[i]->setHasDropCap(false); + selection_[i]->setHasBullet(false); + } + } + + if (!selectionIsDirty_) + { + selectionIsDirty_ = true; + emit selectionDirty(); + } +} + +void SMParagraphStyle::slotNumName(const QString &str) +{ + QString bstr(str); + if (!str.isEmpty()) + { + for (int i = 0; i < selection_.count(); ++i) + selection_[i]->setNumName(bstr); + pwidget_->numComboBox->setCurrentItem(pwidget_->numComboBox->findText(selection_[0]->numName())); + pwidget_->numLevelSpin->setValue(selection_[0]->numLevel()+1); + NumStruct * numS = doc_->numerations.value(selection_[0]->numName()); + if (numS) + pwidget_->numLevelSpin->setMaximum(numS->m_counters.count()+1); + else + pwidget_->numLevelSpin->setMaximum(1); + doc_->flag_NumUpdateRequest = true; + } + + if (!selectionIsDirty_) + { + selectionIsDirty_ = true; + emit selectionDirty(); + } +} + +void SMParagraphStyle::slotNumNew() +{ + QString newName = pwidget_->numNewLineEdit->text(); + if (!newName.isEmpty()) + { + for (int i = 0; i < selection_.count(); ++i) + selection_[i]->setNumName(newName); + doc_->flag_NumUpdateRequest = true; + } + + if (!selectionIsDirty_) + { + selectionIsDirty_ = true; + emit selectionDirty(); + } +} +void SMParagraphStyle::slotSelectionDirty() +{ + if (!selectionIsDirty_) + { + selectionIsDirty_ = true; + emit selectionDirty(); + } +} + +void SMParagraphStyle::slotNumFormat(int numFormat) +{ + if (pwidget_->numFormatCombo->useParentValue()) + for (int i = 0; i < selection_.count(); ++i) + selection_[i]->resetNumFormat(); + else + for (int i = 0; i < selection_.count(); ++i) + selection_[i]->setNumFormat(numFormat); + + if (!selectionIsDirty_) + { + selectionIsDirty_ = true; + emit selectionDirty(); + } +} + +void SMParagraphStyle::slotNumLevel(int level) +{ + if (pwidget_->numLevelSpin->useParentValue()) + for (int i = 0; i < selection_.count(); ++i) + selection_[i]->resetNumLevel(); + else + for (int i = 0; i < selection_.count(); ++i) + { + selection_[i]->setNumLevel(level-1); + } + + if (level == 0) + slotNumHigher(false); + if (!selectionIsDirty_) + { + selectionIsDirty_ = true; + emit selectionDirty(); + } +} + +void SMParagraphStyle::slotNumPrefix(const QString &str) +{ + for (int i = 0; i < selection_.count(); ++i) + selection_[i]->setNumPrefix(str); + + if (!selectionIsDirty_) + { + selectionIsDirty_ = true; + emit selectionDirty(); + } +} + +void SMParagraphStyle::slotNumSuffix(const QString &str) +{ + for (int i = 0; i < selection_.count(); ++i) + selection_[i]->setNumSuffix(str); + + if (!selectionIsDirty_) + { + selectionIsDirty_ = true; + emit selectionDirty(); + } +} + +void SMParagraphStyle::slotNumStart(int start) +{ + if (pwidget_->numStartSpin->useParentValue()) + for (int i = 0; i < selection_.count(); ++i) + selection_[i]->resetNumStart(); + else + for (int i = 0; i < selection_.count(); ++i) + selection_[i]->setNumStart(start); + + if (!selectionIsDirty_) + { + selectionIsDirty_ = true; + emit selectionDirty(); + } +} + +void SMParagraphStyle::slotNumRestart(int restart) +{ + if (pwidget_->numRestartCombo->useParentValue()) + for (int i = 0; i < selection_.count(); ++i) + selection_[i]->resetNumRestart(); + else + for (int i = 0; i < selection_.count(); ++i) + selection_[i]->setNumRestart(restart); + + if (!selectionIsDirty_) + { + selectionIsDirty_ = true; + emit selectionDirty(); + } +} + +void SMParagraphStyle::slotNumOther(bool isOn) +{ + if (pwidget_->numRestartOtherBox->useParentValue()) + for (int i = 0; i < selection_.count(); ++i) + selection_[i]->resetNumOther(); + else + { + for (int i = 0; i < selection_.count(); ++i) + selection_[i]->setNumOther(isOn); + } + + if (!selectionIsDirty_) + { + selectionIsDirty_ = true; + emit selectionDirty(); + } +} + +void SMParagraphStyle::slotNumHigher(bool isOn) +{ + if (pwidget_->numRestartHigherBox->useParentValue()) + for (int i = 0; i < selection_.count(); ++i) + selection_[i]->resetNumHigher(); + else + { + for (int i = 0; i < selection_.count(); ++i) + selection_[i]->setNumHigher(isOn); + } + if (!selectionIsDirty_) { selectionIsDirty_ = true; diff --git a/Scribus/scribus/ui/smtextstyles.h b/Scribus/scribus/ui/smtextstyles.h index 002600d..1dfa578 100644 --- a/Scribus/scribus/ui/smtextstyles.h +++ b/Scribus/scribus/ui/smtextstyles.h @@ -71,11 +71,26 @@ private slots: // pstyle void slotLineSpacingMode(int mode); void slotLineSpacing(); - void slotParentDropCap(); + void slotParentParaEffects(); void slotDropCap(bool isOn); void slotDropCapLines(int lines); - void slotDropCapOffset(); - void slotDropCapCharStyle(const QString &name); + void slotParEffectOffset(); + void slotParEffectIndent(bool); + void slotParEffectCharStyle(const QString &name); + void slotBullet(bool isOn); + void slotBulletStr(const QString &str); + void slotNumeration(bool isOn); + void slotNumName(const QString &str); + void slotNumNew(); + void slotSelectionDirty(); + void slotNumFormat(int numFormat); + void slotNumLevel(int level); + void slotNumPrefix(const QString &str); + void slotNumSuffix(const QString &str); + void slotNumStart(int start); + void slotNumRestart(int restart); + void slotNumOther(bool isOn); + void slotNumHigher(bool isOn); void slotSpaceAbove(); void slotSpaceBelow(); void slotAlignment(); diff --git a/Scribus/scribus/util.cpp b/Scribus/scribus/util.cpp index 5cb3819..fc750a2 100644 --- a/Scribus/scribus/util.cpp +++ b/Scribus/scribus/util.cpp @@ -539,7 +539,7 @@ QString getFileNameByPage(ScribusDoc* currDoc, uint pageNo, QString extension) return QString("%1-%2%3.%4").arg(defaultName).arg(QObject::tr("page", "page export")).arg(number, 3, 10, QChar('0')).arg(extension); } -const QString getStringFromSequence(DocumentSectionType type, uint position, QString asterix) +const QString getStringFromSequence(NumFormat type, uint position, QString asterix) { QString retVal(""); switch( type ) @@ -1131,6 +1131,13 @@ void convertOldTable(ScribusDoc *m_Doc, PageItem* gItem, QList<PageItem*> &gpL, delete gItem; } +void setWidgetBoldFont(QWidget* w, bool wantBold) +{ + QFont f(w->font()); + f.setBold(wantBold); + w->setFont(f); +} + void getUniqueName(QString &name, QStringList list, QString separator, bool prepend) { if (!list.contains(name)) diff --git a/Scribus/scribus/util.h b/Scribus/scribus/util.h index c62da88..28a16f4 100644 --- a/Scribus/scribus/util.h +++ b/Scribus/scribus/util.h @@ -131,7 +131,7 @@ QString SCRIBUS_API getFileNameByPage(ScribusDoc* currDoc, uint pageNo, QString void SCRIBUS_API sDebug(QString message); //asterix is QString used in numeration when number is presented as few chars, like *, **, *** etc //default is '*' but can be used any string -const QString SCRIBUS_API getStringFromSequence(DocumentSectionType type, uint position, QString asterix="*"); +const QString SCRIBUS_API getStringFromSequence(NumFormat type, uint position, QString asterix="*"); const QString SCRIBUS_API arabicToRoman(uint i); const QString SCRIBUS_API numberToLetterSequence(uint i); void SCRIBUS_API parsePagesString(QString pages, std::vector<int>* pageNs, int sourcePageCount); @@ -154,6 +154,7 @@ void SCRIBUS_API getDashArray(int dashtype, double linewidth, QVector<float> void SCRIBUS_API printBacktrace(int nFrames); void SCRIBUS_API convertOldTable(ScribusDoc *m_Doc, PageItem* gItem, QList<PageItem*> &gpL, QStack< QList<PageItem*> > *groupStackT = NULL, QList<PageItem *> *target = NULL); +void SCRIBUS_API setWidgetBoldFont(QWidget* w, bool wantBold); /*! *\brief * check if name exists in list |
|
numeration8.diff is patch against current trunk. |
|
Patch committed. Some issues noted: in PP: - the maximum effect parameter value for bullet seems to be 0.545mm.. we should have no obvious maximum here really.. - when you first set a numerated list, the numbers show as ?s not numbers (type 1_2_3) |
|
AMOF I've once had about the same "the maximum effect parameter value for bullet seems to be 0.545mm". Its the value for offset. If I remember well, the max value was not 0.5xx but 0.3xx mm in my case. This problem disappeared after a little bit of further testing. |
|
Its still very much there. |
|
can we close this? i'm opening two tickets for craig's issues. |
Date Modified | Username | Field | Change |
---|---|---|---|
2012-12-18 14:44 | cezaryece | New Issue | |
2012-12-18 14:44 | cezaryece | File Added: numeration.patch | |
2012-12-18 22:33 | jghali | Note Added: 0029445 | |
2012-12-18 22:36 | cbradney | Relationship added | related to 0011228 |
2012-12-18 22:37 | cbradney | Note Added: 0029446 | |
2012-12-18 23:09 | jghali | Note Added: 0029447 | |
2012-12-19 07:55 | ale | Note Added: 0029449 | |
2012-12-19 07:57 | ale | Note Edited: 0029449 | |
2012-12-19 08:01 | jghali | Note Added: 0029450 | |
2012-12-19 08:03 | ale | Note Added: 0029451 | |
2012-12-19 08:11 | ale | Note Added: 0029452 | |
2012-12-19 12:49 | cezaryece | File Added: numeration2.patch | |
2012-12-19 13:10 | cezaryece | Note Added: 0029454 | |
2012-12-20 21:35 | pygmee | Note Added: 0029467 | |
2012-12-20 21:35 | pygmee | File Added: propertywidget_pareffectbase_pygmee.png | |
2012-12-25 08:02 | cbradney | Note Added: 0029485 | |
2012-12-26 09:26 | cezaryece | Note Added: 0029487 | |
2012-12-26 09:40 | cezaryece | File Added: numeration3.patch | |
2012-12-26 09:41 | cezaryece | Note Edited: 0029487 | |
2012-12-27 07:10 | cezaryece | File Deleted: numeration.patch | |
2012-12-27 07:10 | cezaryece | File Deleted: numeration2.patch | |
2012-12-27 09:42 | pygmee | Note Added: 0029491 | |
2012-12-27 12:18 | cbradney | Note Added: 0029492 | |
2012-12-27 15:56 | cezaryece | File Added: numeration4.patch | |
2012-12-27 16:04 | cezaryece | Note Added: 0029494 | |
2012-12-27 17:31 | cbradney | Note Added: 0029496 | |
2012-12-28 11:46 | pygmee | Note Added: 0029504 | |
2012-12-28 16:15 | cezaryece | Note Added: 0029507 | |
2012-12-28 21:14 | pygmee | Note Added: 0029509 | |
2012-12-28 22:50 | cezaryece | Note Added: 0029510 | |
2012-12-29 11:01 | cezaryece | File Added: numeration5.patch | |
2012-12-29 11:01 | cezaryece | File Deleted: numeration3.patch | |
2012-12-29 11:01 | cezaryece | File Deleted: numeration4.patch | |
2012-12-29 11:04 | cezaryece | Note Added: 0029513 | |
2012-12-29 22:22 | cbradney | Note Added: 0029520 | |
2012-12-31 09:48 | cezaryece | Assigned To | => pygmee |
2012-12-31 09:48 | cezaryece | Status | new => assigned |
2012-12-31 09:48 | cezaryece | Status | assigned => feedback |
2012-12-31 14:01 | JLuc | Note Added: 0029560 | |
2013-01-02 12:17 | cezaryece | File Added: numeration6.patch | |
2013-01-02 12:17 | cezaryece | File Deleted: numeration5.patch | |
2013-01-02 12:18 | cezaryece | Note Added: 0029577 | |
2013-01-02 12:18 | cezaryece | Status | feedback => assigned |
2013-01-02 12:19 | cezaryece | Assigned To | pygmee => |
2013-01-02 12:49 | cezaryece | File Deleted: numeration6.patch | |
2013-01-02 12:49 | cezaryece | File Added: numeration6.patch | |
2013-01-02 12:50 | cezaryece | Note Edited: 0029577 | |
2013-01-02 13:20 | pygmee | Note Added: 0029579 | |
2013-01-02 14:46 | cezaryece | File Added: numeration7.patch | |
2013-01-02 14:46 | cezaryece | File Deleted: numeration7.patch | |
2013-01-02 14:47 | cezaryece | File Added: numeration7.patch | |
2013-01-02 14:47 | cezaryece | File Deleted: numeration6.patch | |
2013-01-02 14:48 | cezaryece | Note Added: 0029580 | |
2013-01-02 21:58 | cbradney | Note Added: 0029582 | |
2013-01-02 22:34 | jghali | Note Added: 0029583 | |
2013-01-03 00:11 | cezaryece | File Added: numeration7b.patch | |
2013-01-03 00:22 | cezaryece | File Deleted: numeration7b.patch | |
2013-01-03 00:23 | cezaryece | File Added: numeration7b.patch | |
2013-01-03 00:24 | cezaryece | Note Added: 0029584 | |
2013-01-03 06:39 | cbradney | Note Added: 0029585 | |
2013-01-03 07:59 | cezaryece | File Added: numeration7c.patch | |
2013-01-03 08:00 | cezaryece | File Deleted: numeration7.patch | |
2013-01-03 08:00 | cezaryece | Note Added: 0029586 | |
2013-01-04 13:02 | cezaryece | File Added: numeration8.diff | |
2013-01-04 13:03 | cezaryece | Note Added: 0029593 | |
2013-01-05 09:29 | cbradney | Note Added: 0029597 | |
2013-01-05 09:30 | cbradney | File Deleted: numeration7b.patch | |
2013-01-05 09:31 | cbradney | File Deleted: numeration7c.patch | |
2013-01-05 17:33 | JLuc | Note Added: 0029599 | |
2013-01-05 18:36 | cbradney | Note Added: 0029600 | |
2014-10-24 23:00 | Kunda | Patch | => Yes |
2015-09-17 20:08 | Kunda | Category | Story Editor / Text Frames => Story Ed/Txt Frames |
2015-09-17 20:12 | Kunda | Category | Story Ed/Txt Frames => Story Editor / Text Frames |
2016-11-14 11:41 | Kunda | Relationship added | related to 0014347 |
2019-09-24 13:16 | ale | Relationship added | related to 0015827 |
2019-09-24 13:17 | ale | Relationship added | related to 0015828 |
2019-09-24 13:17 | ale | Note Added: 0046697 | |
2019-09-24 13:17 | ale | Summary | [patch] numeration and bullets => [OBSOLETE][patch] numeration and bullets |
2019-09-24 13:21 | JLuc | Status | assigned => resolved |
2019-09-24 13:21 | JLuc | Status | resolved => closed |
2019-09-24 13:21 | JLuc | Resolution | open => fixed |