~ubuntu-branches/debian/sid/scribus/sid

« back to all changes in this revision

Viewing changes to scribus/pageitem.cpp

  • Committer: Package Import Robot
  • Author(s): Oleksandr Moskalenko
  • Date: 2012-02-09 21:50:56 UTC
  • mfrom: (1.1.6)
  • Revision ID: package-import@ubuntu.com-20120209215056-2wrx1ara0jbm7fi5
Tags: 1.4.0.dfsg+r17287-1
* New upstream stable release upload into Debian (Closes: #654703).
* Applied the Ubuntu armel patch.
* Removed non-free color swatches from resources.
* debian/control:
  - Moved icc-profiles from Recommends to Suggests (Closes: #655885).
  - Updated Standards-Version to 3.9.2.
  - Updated extended description per lintian warning.
* debian/rules:
  - Update mailcap (Closes: #630751). A request for mime.types update has
    been sent to the mime-support maintainer.
  - Added build-arch and build-indep targets per lintian warning.
* debian/patches:
  - top_cmakelists.patch - don't copy extra docs and changelogs.
  - scribus_cmakelists.patch - don't copy extra docs and changelogs.
  - scribus_cmakelists.patch - don't install the non-free "doc" dir.
  - profiles_cmakelists.patch - don't install non-free sRGB profile.
* debian/copyright: 
  - Converted to the DEP5 machine readable foramt.
  - Added licenses for free color swatches.

Show diffs side-by-side

added added

removed removed

Lines of Context:
134
134
        BBoxH(other.BBoxH),
135
135
        CurX(other.CurX),
136
136
        CurY(other.CurY),
137
 
        CPos(other.CPos),
138
137
        itemText(other.itemText),
139
138
        isBookmark(other.isBookmark),
140
139
        HasSel(other.HasSel),
331
330
        FrameType = 0;
332
331
        CurX = 0;
333
332
        CurY = 0;
334
 
        CPos = 0;
335
333
        oldCPos = 0;
336
334
        Extra = 0;
337
335
        TExtra = 0;
695
693
{
696
694
        if (dX==0.0 && dY==0.0)
697
695
                return;
698
 
        if (dX!=0.0)
699
 
                LocalX+=dX;
700
 
        if (dY!=0.0)
701
 
                LocalY+=dY;
 
696
        if (dX != 0.0)
 
697
                LocalX += dX;
 
698
        if (dY != 0.0)
 
699
                LocalY += dY;
702
700
        checkChanges();
703
701
        emit imageOffsetScale(LocalScX, LocalScY, LocalX, LocalY);
704
702
}
705
703
 
706
704
void PageItem::setReversed(bool newReversed)
707
705
{
708
 
        Reverse=newReversed;
 
706
        if (Reverse == newReversed)
 
707
                return;
 
708
        if (UndoManager::undoEnabled())
 
709
        {
 
710
                SimpleState *ss = new SimpleState(Um::FlipH, 0, Um::IFlipH);
 
711
                ss->set("REVERSE_TEXT", newReversed);
 
712
                undoManager->action(this, ss);
 
713
        }
 
714
        Reverse = newReversed;
709
715
}
710
716
 
 
717
//return frame where is text end
 
718
PageItem * PageItem::frameTextEnd()
 
719
{
 
720
        PageItem * LastBox = this;
 
721
        if (frameOverflows() && NextBox)
 
722
        { // text ending in some next frame
 
723
                LastBox = NextBox;
 
724
                while (LastBox != 0 && !LastBox->frameDisplays(itemText.length()-1))
 
725
                        LastBox = LastBox->nextInChain();
 
726
        }
 
727
        else if (frameUnderflows() && BackBox)
 
728
        { //text ending in some previous frame
 
729
                LastBox = BackBox;
 
730
                while (LastBox != 0 && !LastBox->frameDisplays(itemText.length()-1))
 
731
                        LastBox = LastBox->prevInChain();
 
732
        }
 
733
        return LastBox;
 
734
}
711
735
 
712
736
/// returns true if text overflows
713
737
bool PageItem::frameOverflows() const
726
750
#endif
727
751
}
728
752
 
 
753
/// returns true if text is ending before that frame
 
754
bool PageItem::frameUnderflows() const
 
755
{
 
756
        if (BackBox == NULL)
 
757
                return false;
 
758
        //FIX ME - I have found that condition if frame is empty
 
759
        //and has been linked with previous frame
 
760
        //if you will find any better solution - fix that function
 
761
        return (firstInFrame() > lastInFrame());
 
762
}
 
763
 
729
764
int PageItem::firstInFrame() const
730
765
{
731
766
        return firstChar;
739
774
#endif
740
775
}
741
776
 
 
777
bool PageItem::testLinkCandidate(PageItem* nxt)
 
778
{
 
779
        if (this->nextInChain() )
 
780
                return false;
 
781
        if (nxt->prevInChain() )
 
782
                return false;
 
783
        for (PageItem* ff=nxt; ff; ff=ff->nextInChain())
 
784
        {
 
785
                if (ff == this) return false;
 
786
        }
 
787
        return true;
 
788
}
742
789
 
743
790
void PageItem::link(PageItem* nxt)
744
791
{
895
942
/// returns the style at the current charpos
896
943
const ParagraphStyle& PageItem::currentStyle() const
897
944
{
898
 
        if (frameDisplays(CPos))
899
 
                return itemText.paragraphStyle(CPos);
 
945
        if (frameDisplays(itemText.cursorPosition()))
 
946
                return itemText.paragraphStyle();
900
947
        else
901
948
                return itemText.defaultStyle();
902
949
}
904
951
/// returns the style at the current charpos for changing
905
952
ParagraphStyle& PageItem::changeCurrentStyle()
906
953
{
907
 
        if (frameDisplays(CPos))
908
 
                return const_cast<ParagraphStyle&>(itemText.paragraphStyle(CPos));
 
954
        if (frameDisplays(itemText.cursorPosition()))
 
955
                return const_cast<ParagraphStyle&>(itemText.paragraphStyle());
909
956
        else
910
957
                return const_cast<ParagraphStyle&>(itemText.defaultStyle());
911
958
}
913
960
/// returns the style at the current charpos
914
961
const CharStyle& PageItem::currentCharStyle() const
915
962
{
916
 
        if (frameDisplays(CPos))
917
 
                return itemText.charStyle(CPos);
 
963
        if (frameDisplays(itemText.cursorPosition()))
 
964
                return itemText.charStyle();
918
965
        else
919
966
                return itemText.defaultStyle().charStyle();
920
967
}
1029
1076
        }
1030
1077
        else
1031
1078
        {
1032
 
        if (!isGroupControl)
1033
 
        {
1034
 
                if (fillBlendmode() != 0)
1035
 
                        p->beginLayer(1.0 - fillTransparency(), fillBlendmode());
 
1079
                if (!isGroupControl)
 
1080
                {
 
1081
                        if (fillBlendmode() != 0)
 
1082
                                p->beginLayer(1.0 - fillTransparency(), fillBlendmode());
1036
1083
 
1037
 
                p->setLineWidth(m_lineWidth);
1038
 
                if (GrType != 0)
1039
 
                {
1040
 
                        if (GrType == 8)
1041
 
                        {
1042
 
                                if ((patternVal.isEmpty()) || (!m_Doc->docPatterns.contains(patternVal)))
1043
 
                                {
1044
 
                                        p->fill_gradient = VGradient(VGradient::linear);
1045
 
                                        if (fillColor() != CommonStrings::None)
1046
 
                                        {
1047
 
                                                p->setBrush(fillQColor);
1048
 
                                                p->setFillMode(ScPainter::Solid);
1049
 
                                        }
1050
 
                                        else
1051
 
                                                p->setFillMode(ScPainter::None);
1052
 
                                        if ((!patternVal.isEmpty()) && (!m_Doc->docPatterns.contains(patternVal)))
1053
 
                                        {
1054
 
                                                GrType = 0;
1055
 
                                                patternVal = "";
1056
 
                                        }
1057
 
                                }
1058
 
                                else
1059
 
                                {
1060
 
                                        p->setPattern(&m_Doc->docPatterns[patternVal], patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation);
1061
 
                                        p->setFillMode(ScPainter::Pattern);
1062
 
                                }
1063
 
                        }
1064
 
                        else
1065
 
                        {
1066
 
                                if (fill_gradient.Stops() < 2) // fall back to solid filling if there are not enough colorstops in the gradient.
1067
 
                                {
1068
 
                                        if (fillColor() != CommonStrings::None)
1069
 
                                        {
1070
 
                                                p->setBrush(fillQColor);
1071
 
                                                p->setFillMode(ScPainter::Solid);
1072
 
                                        }
1073
 
                                        else
1074
 
                                                p->setFillMode(ScPainter::None);
1075
 
                                }
1076
 
                                else
1077
 
                                {
1078
 
                                        p->setFillMode(ScPainter::Gradient);
1079
 
                                        p->fill_gradient = fill_gradient;
1080
 
                                        QMatrix grm;
1081
 
                                        grm.rotate(Rot);
1082
 
                                        FPointArray gra;
1083
 
                                        switch (GrType)
1084
 
                                        {
1085
 
                                                case 1:
1086
 
                                                case 2:
1087
 
                                                case 3:
1088
 
                                                case 4:
1089
 
                                                case 6:
1090
 
                                                        p->setGradient(VGradient::linear, FPoint(GrStartX, GrStartY), FPoint(GrEndX, GrEndY));
1091
 
                                                        break;
1092
 
                                                case 5:
1093
 
                                                case 7:
1094
 
                                                        gra.setPoints(2, GrStartX, GrStartY, GrEndX, GrEndY);
1095
 
                                                        p->setGradient(VGradient::radial, gra.point(0), gra.point(1), gra.point(0));
1096
 
                                                        break;
1097
 
                                        }
1098
 
                                }
1099
 
                        }
1100
 
                }
1101
 
                else
1102
 
                {
1103
 
                        p->fill_gradient = VGradient(VGradient::linear);
1104
 
                        if (fillColor() != CommonStrings::None)
1105
 
                        {
1106
 
                                p->setBrush(fillQColor);
1107
 
                                p->setFillMode(ScPainter::Solid);
1108
 
                        }
1109
 
                        else
1110
 
                                p->setFillMode(ScPainter::None);
1111
 
                }
1112
 
                if (lineColor() != CommonStrings::None)
1113
 
                {
1114
 
//                      if ((m_lineWidth == 0) && ! asLine())
1115
 
//                              p->setLineWidth(0);
1116
 
//                      else
1117
 
//                      {
1118
 
                                p->setPen(strokeQColor, m_lineWidth, PLineArt, PLineEnd, PLineJoin);
1119
 
                                if (DashValues.count() != 0)
1120
 
                                        p->setDash(DashValues, DashOffset);
1121
 
//                      }
1122
 
                }
1123
 
                else
1124
 
                        p->setLineWidth(0);
1125
 
                if (fillBlendmode() == 0)
1126
 
                        p->setBrushOpacity(1.0 - fillTransparency());
1127
 
                if (lineBlendmode() == 0)
1128
 
                        p->setPenOpacity(1.0 - lineTransparency());
1129
 
                p->setFillRule(fillRule);
 
1084
                        p->setLineWidth(m_lineWidth);
 
1085
                        if (GrType != 0)
 
1086
                        {
 
1087
                                if (GrType == 8)
 
1088
                                {
 
1089
                                        if ((patternVal.isEmpty()) || (!m_Doc->docPatterns.contains(patternVal)))
 
1090
                                        {
 
1091
                                                p->fill_gradient = VGradient(VGradient::linear);
 
1092
                                                if (fillColor() != CommonStrings::None)
 
1093
                                                {
 
1094
                                                        p->setBrush(fillQColor);
 
1095
                                                        p->setFillMode(ScPainter::Solid);
 
1096
                                                }
 
1097
                                                else
 
1098
                                                        p->setFillMode(ScPainter::None);
 
1099
                                                if ((!patternVal.isEmpty()) && (!m_Doc->docPatterns.contains(patternVal)))
 
1100
                                                {
 
1101
                                                        GrType = 0;
 
1102
                                                        patternVal = "";
 
1103
                                                }
 
1104
                                        }
 
1105
                                        else
 
1106
                                        {
 
1107
                                                p->setPattern(&m_Doc->docPatterns[patternVal], patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation);
 
1108
                                                p->setFillMode(ScPainter::Pattern);
 
1109
                                        }
 
1110
                                }
 
1111
                                else
 
1112
                                {
 
1113
                                        if (fill_gradient.Stops() < 2) // fall back to solid filling if there are not enough colorstops in the gradient.
 
1114
                                        {
 
1115
                                                if (fillColor() != CommonStrings::None)
 
1116
                                                {
 
1117
                                                        p->setBrush(fillQColor);
 
1118
                                                        p->setFillMode(ScPainter::Solid);
 
1119
                                                }
 
1120
                                                else
 
1121
                                                        p->setFillMode(ScPainter::None);
 
1122
                                        }
 
1123
                                        else
 
1124
                                        {
 
1125
                                                p->setFillMode(ScPainter::Gradient);
 
1126
                                                p->fill_gradient = fill_gradient;
 
1127
                                                QMatrix grm;
 
1128
                                                grm.rotate(Rot);
 
1129
                                                FPointArray gra;
 
1130
                                                switch (GrType)
 
1131
                                                {
 
1132
                                                        case 1:
 
1133
                                                        case 2:
 
1134
                                                        case 3:
 
1135
                                                        case 4:
 
1136
                                                        case 6:
 
1137
                                                                p->setGradient(VGradient::linear, FPoint(GrStartX, GrStartY), FPoint(GrEndX, GrEndY));
 
1138
                                                                break;
 
1139
                                                        case 5:
 
1140
                                                        case 7:
 
1141
                                                                gra.setPoints(2, GrStartX, GrStartY, GrEndX, GrEndY);
 
1142
                                                                p->setGradient(VGradient::radial, gra.point(0), gra.point(1), gra.point(0));
 
1143
                                                                break;
 
1144
                                                }
 
1145
                                        }
 
1146
                                }
 
1147
                        }
 
1148
                        else
 
1149
                        {
 
1150
                                p->fill_gradient = VGradient(VGradient::linear);
 
1151
                                if (fillColor() != CommonStrings::None)
 
1152
                                {
 
1153
                                        p->setBrush(fillQColor);
 
1154
                                        p->setFillMode(ScPainter::Solid);
 
1155
                                }
 
1156
                                else
 
1157
                                        p->setFillMode(ScPainter::None);
 
1158
                        }
 
1159
                        if (lineColor() != CommonStrings::None)
 
1160
                        {
 
1161
//                              if ((m_lineWidth == 0) && ! asLine())
 
1162
//                                      p->setLineWidth(0);
 
1163
//                              else
 
1164
//                              {
 
1165
                                        p->setPen(strokeQColor, m_lineWidth, PLineArt, PLineEnd, PLineJoin);
 
1166
                                        if (DashValues.count() != 0)
 
1167
                                                p->setDash(DashValues, DashOffset);
 
1168
//                              }
 
1169
                        }
 
1170
                        else
 
1171
                                p->setLineWidth(0);
 
1172
                        if (fillBlendmode() == 0)
 
1173
                                p->setBrushOpacity(1.0 - fillTransparency());
 
1174
                        if (lineBlendmode() == 0)
 
1175
                                p->setPenOpacity(1.0 - lineTransparency());
 
1176
                        p->setFillRule(fillRule);
1130
1177
                }
1131
1178
        }
1132
1179
}
1991
2038
                                if (style.underlineWidth() != -1)
1992
2039
                                        lw = (style.underlineWidth() / 1000.0) * (style.fontSize() / 10.0);
1993
2040
                                else
1994
 
                                        lw = qMax(style.font().strokeWidth(style.fontSize() / 10.0), qreal(1.0));
 
2041
                                lw = qMax(style.font().strokeWidth(style.fontSize() / 10.0), qreal(1.0));
1995
2042
                        }
1996
2043
                        else
1997
2044
                        {
2109
2156
                                if (style.strikethruWidth() != -1)
2110
2157
                                        lw = (style.strikethruWidth() / 1000.0) * (style.fontSize() / 10.0);
2111
2158
                                else
2112
 
                                        lw = qMax(style.font().strokeWidth(style.fontSize() / 10.0), qreal(1.0));
 
2159
                                lw = qMax(style.font().strokeWidth(style.fontSize() / 10.0), qreal(1.0));
2113
2160
                        }
2114
2161
                        else
2115
2162
                        {
2720
2767
                if (freeScale != ScaleType)
2721
2768
                {
2722
2769
                        ss->set("SCALE_TYPE", freeScale);
2723
 
                        if (!freeScale)
2724
 
                        {
2725
 
                                //if switching from free scaling to frame size
2726
 
                                //in undo must be offset and scale saved
2727
 
                                ss->set("OLD_IMAGEXOFFSET", LocalX);
2728
 
                                ss->set("OLD_IMAGEYOFFSET", LocalY);
2729
 
                                ss->set("OLD_IMAGEXSCALE", LocalScX);
2730
 
                                ss->set("OLD_IMAGEYSCALE", LocalScY);
2731
 
                        }
 
2770
                        ss->set("OLD_IMAGEXOFFSET", LocalX);
 
2771
                        ss->set("OLD_IMAGEYOFFSET", LocalY);
 
2772
                        ss->set("OLD_IMAGEXSCALE", LocalScX);
 
2773
                        ss->set("OLD_IMAGEYSCALE", LocalScY);
2732
2774
                }
2733
2775
                if (keepRatio != AspectRatio)
2734
2776
                        ss->set("ASPECT_RATIO", keepRatio);
3255
3297
                else if (ss->contains("LINK_TEXT_FRAME"))
3256
3298
                        restoreLinkTextFrame(ss,isUndo);
3257
3299
                else if (ss->contains("UNLINK_TEXT_FRAME"))
3258
 
                        restoreUnlinkTextFrame(ss,isUndo);
 
3300
                        restoreUnlinkTextFrame(ss, isUndo);
 
3301
                else if (ss->contains("REVERSE_TEXT"))
 
3302
                        restoreReverseText(ss, isUndo);
3259
3303
        }
3260
3304
        if (!OnMasterPage.isEmpty())
3261
3305
                m_Doc->setCurrentPage(oldCurrentPage);
3671
3715
        }
3672
3716
}
3673
3717
 
 
3718
void PageItem::restoreReverseText(UndoState *state, bool /*isUndo*/)
 
3719
{
 
3720
        if (!isTextFrame())
 
3721
                return;
 
3722
        Reverse = !Reverse;
 
3723
}
3674
3724
 
3675
3725
void PageItem::restorePoly(SimpleState *state, bool isUndo, bool isContour)
3676
3726
{
3884
3934
                                itemText.select(SelStart, story->length());
3885
3935
                                HasSel = true;
3886
3936
                        }
3887
 
                        CPos = itemText.endOfSelection();
 
3937
                        itemText.setCursorPosition( itemText.endOfSelection() );
3888
3938
                        delete story;
3889
3939
                }
3890
3940
                else { qDebug() << "UNDO buffer EMPTY";}
3922
3972
                itemText.insert(pos,*story);
3923
3973
                itemText.select(pos, story->length());
3924
3974
                HasSel = true;
3925
 
                CPos = pos + story->length();
3926
3975
                delete story;
3927
3976
        }
3928
3977
        else if (action == INSSAX || action == DELSAX)
3947
3996
                {
3948
3997
                        //undo for DELSAX, redo for INSSAX
3949
3998
                        itemText.insert(pos, *story);
3950
 
                        CPos = pos + story->length();
3951
3999
                }
3952
4000
                delete story;
3953
4001
        }
3963
4011
                else
3964
4012
                {
3965
4013
                        itemText.insertChars(pos, str, true);
3966
 
                        CPos = pos + str.length();
3967
4014
                }
3968
4015
        }
3969
4016
        // after Undo or Redo new actions should create new undoStates
3982
4029
                iT.insert(0, itemText);
3983
4030
        else
3984
4031
        {
3985
 
                int StartOldSel = -1, LenOldSel = -1;
 
4032
                int StartOldSel = 0, LenOldSel = 0;
 
4033
                if (HasSel)
 
4034
                {
 
4035
                        StartOldSel = itemText.startOfSelection();
 
4036
                        LenOldSel = itemText.lengthOfSelection();
 
4037
                }
3986
4038
                if (undoItem == PARAGRAPH)
3987
 
                {
3988
 
                        LenOldSel = 0;
3989
 
                        if (HasSel)
3990
 
                        {
3991
 
                                StartOldSel = itemText.startOfSelection();
3992
 
                                LenOldSel = itemText.lengthOfSelection();
3993
 
                        }
3994
4039
                        asTextFrame()->expandParaSelection(true);
3995
 
                }
3996
 
                else if (undoItem == CHAR || (undoItem == SELECTION && !HasSel))
 
4040
                else if (undoItem == CHAR || !HasSel)
3997
4041
                {
3998
 
                        LenOldSel = itemText.lengthOfSelection();
3999
 
                        if (LenOldSel > 0)
4000
 
                                StartOldSel = itemText.startOfSelection();
4001
 
                        if (CPos >= itemText.length())
 
4042
                        if (itemText.cursorPosition() >= itemText.length())
4002
4043
                                return  "";
4003
 
                        itemText.select(CPos,1);
4004
 
                        HasSel = true;
 
4044
                        itemText.select(itemText.cursorPosition(), 1);
4005
4045
                }
4006
4046
                //is SELECTION
4007
 
                iT.insert(0, itemText, HasSel);
 
4047
                iT.insert(0, itemText, true);
 
4048
                itemText.deselectAll();
4008
4049
                if (LenOldSel > 0) //restoring old selection if undoItem was PARAPGRAPH
4009
 
                {
4010
4050
                        itemText.select(StartOldSel, LenOldSel);
4011
 
                        HasSel = true;
4012
 
                }
4013
 
                else if (LenOldSel == 0)
4014
 
                {
4015
 
                        itemText.deselectAll();
4016
 
                        HasSel = false;
4017
 
                }
4018
4051
        }
4019
4052
        //saxing text
4020
4053
        std::ostringstream xmlString;
4034
4067
        StoryText it(m_Doc);
4035
4068
        it.setDefaultStyle(itemText.defaultStyle());
4036
4069
 
4037
 
        int oldSelStart = -1, oldSelLength = -1;
4038
 
        oldSelStart  = itemText.startOfSelection();
4039
 
        oldSelLength = itemText.lengthOfSelection();
4040
 
 
4041
4070
        itemText.select(selStart, selLength);
4042
4071
        it.insert(0, itemText, (selLength > 0));
4043
 
        
4044
 
        if (oldSelLength > 0) //restoring old selection if undoItem was PARAPGRAPH
4045
 
        {
4046
 
                itemText.select(oldSelStart, oldSelLength);
4047
 
                HasSel = true;
4048
 
        }
4049
 
        else if (oldSelLength == 0)
4050
 
        {
4051
 
                itemText.deselectAll();
4052
 
                HasSel = false;
4053
 
        }
4054
4072
 
4055
4073
        //saxing text
4056
4074
        std::ostringstream xmlString;
4090
4108
        return &pageItemAttributes;
4091
4109
}
4092
4110
 
 
4111
QList<ObjectAttribute> PageItem::getObjectAttributes(QString attributeName) const
 
4112
{
 
4113
        QList<ObjectAttribute> attributes;
 
4114
        for(ObjAttrVector::const_iterator objAttrIt = pageItemAttributes.begin() ; objAttrIt != pageItemAttributes.end(); ++objAttrIt )
 
4115
        {
 
4116
                if (objAttrIt->name == attributeName)
 
4117
                {
 
4118
                        attributes.append(*objAttrIt);
 
4119
                }
 
4120
        }
 
4121
        return attributes;
 
4122
}
 
4123
 
4093
4124
ObjectAttribute PageItem::getObjectAttribute(QString attributeName) const
4094
4125
{
4095
 
        int countFound=0;
 
4126
        int countFound = 0;
4096
4127
        ObjAttrVector::const_iterator foundIt = pageItemAttributes.begin();
4097
 
        for(ObjAttrVector::const_iterator objAttrIt = pageItemAttributes.begin() ; objAttrIt != pageItemAttributes.end(); ++objAttrIt )
 
4128
        for(ObjAttrVector::const_iterator objAttrIt = pageItemAttributes.begin(); objAttrIt != pageItemAttributes.end(); ++objAttrIt )
4098
4129
        {
4099
 
                if ((*objAttrIt).name==attributeName)
 
4130
                if (objAttrIt->name == attributeName)
4100
4131
                {
4101
4132
                        ++countFound;
4102
 
                        foundIt=objAttrIt;
 
4133
                        foundIt = objAttrIt;
4103
4134
                }
4104
4135
        }
4105
4136
        ObjectAttribute returnAttribute;
4106
 
        if(countFound==1)
4107
 
                returnAttribute=(*foundIt);
 
4137
        if(countFound == 1)
 
4138
                returnAttribute = (*foundIt);
4108
4139
        else
4109
 
                returnAttribute.name=QString::null;
 
4140
                returnAttribute.name = QString::null;
4110
4141
        return returnAttribute;
4111
4142
}
4112
4143
 
4811
4842
        if (NamedLStyle.isEmpty())
4812
4843
        {
4813
4844
                if (lineColor() != CommonStrings::None)
4814
 
                        extraSpace = m_lineWidth / 2.0;
 
4845
                {
 
4846
                        if ((itemType() == Line) && (PLineEnd == Qt::FlatCap))
 
4847
                                extraSpace = 0.0;
 
4848
                        else
 
4849
                                extraSpace = m_lineWidth / 2.0;
 
4850
                }
4815
4851
        }
4816
4852
        else
4817
4853
        {
5477
5513
                QString test = Pfile;
5478
5514
                if (QDir::isRelativePath(test))
5479
5515
                        test = QDir::homePath()+"/"+Pfile;
5480
 
                test = QDir::cleanPath(QDir::convertSeparators(test));
 
5516
                test = QDir::cleanPath(QDir::toNativeSeparators(test));
5481
5517
                QFileInfo pfi2(test);
5482
5518
                Pfile = pfi2.absoluteFilePath();
5483
5519
        }
5488
5524
        Pfile2 = val;
5489
5525
        if (!Pfile2.isEmpty())
5490
5526
        {
5491
 
                QString test = QDir::cleanPath(QDir::convertSeparators(QDir::homePath()+"/"+Pfile2));
 
5527
                QString test = QDir::cleanPath(QDir::toNativeSeparators(QDir::homePath()+"/"+Pfile2));
5492
5528
                QFileInfo pfi2(test);
5493
5529
                Pfile2 = pfi2.absoluteFilePath();
5494
5530
        }
5499
5535
        Pfile3 = val;
5500
5536
        if (!Pfile3.isEmpty())
5501
5537
        {
5502
 
                QString test = QDir::cleanPath(QDir::convertSeparators(QDir::homePath()+"/"+Pfile3));
 
5538
                QString test = QDir::cleanPath(QDir::toNativeSeparators(QDir::homePath()+"/"+Pfile3));
5503
5539
                QFileInfo pfi2(test);
5504
5540
                Pfile3 = pfi2.absoluteFilePath();
5505
5541
        }
5792
5828
        {
5793
5829
                m_Doc->constants().insert("pagewidth", m_Doc->Pages->at(OwnPage)->width());
5794
5830
                m_Doc->constants().insert("pageheight", m_Doc->Pages->at(OwnPage)->height());
 
5831
                m_Doc->constants().insert("marginleft", m_Doc->Pages->at(OwnPage)->Margins.Left);
 
5832
                m_Doc->constants().insert("marginright", m_Doc->Pages->at(OwnPage)->width() - m_Doc->Pages->at(OwnPage)->Margins.Right);
 
5833
                m_Doc->constants().insert("margintop", m_Doc->Pages->at(OwnPage)->Margins.Top);
 
5834
                m_Doc->constants().insert("marginbottom", m_Doc->Pages->at(OwnPage)->height() - m_Doc->Pages->at(OwnPage)->Margins.Bottom);
5795
5835
        }
5796
5836
        m_Doc->constants().insert("width", Width);
5797
5837
        m_Doc->constants().insert("height", Height);