Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Office
Calligra
Commits
5662eec8
Commit
5662eec8
authored
Jan 18, 2012
by
C. Boemann
Browse files
Make printing not show textselections or formatting characters
BUG:288341
parent
9c4c3bef
Changes
5
Hide whitespace changes
Inline
Side-by-side
libs/flake/KoShapePaintingContext.cpp
View file @
5662eec8
...
...
@@ -27,6 +27,7 @@ KoShapePaintingContext::KoShapePaintingContext()
,
showTextShapeOutlines
(
false
)
,
showTableBorders
(
true
)
,
showSpellChecking
(
false
)
,
showSelections
(
true
)
{
}
...
...
@@ -37,6 +38,7 @@ KoShapePaintingContext::KoShapePaintingContext(KoCanvasBase *canvas, bool forPri
showFormattingCharacters
=
rm
->
boolResource
(
KoCanvasResourceManager
::
ShowFormattingCharacters
);
if
(
forPrint
)
{
showTextShapeOutlines
=
false
;
showFormattingCharacters
=
false
;
}
else
{
showTextShapeOutlines
=
rm
->
boolResource
(
KoCanvasResourceManager
::
ShowTextShapeOutlines
);
}
...
...
@@ -46,6 +48,7 @@ KoShapePaintingContext::KoShapePaintingContext(KoCanvasBase *canvas, bool forPri
showTableBorders
=
true
;
}
showSpellChecking
=
!
forPrint
;
showSelections
=
!
forPrint
;
}
KoShapePaintingContext
::~
KoShapePaintingContext
()
...
...
libs/flake/KoShapePaintingContext.h
View file @
5662eec8
...
...
@@ -43,6 +43,7 @@ public:
bool
showTextShapeOutlines
;
bool
showTableBorders
;
bool
showSpellChecking
;
bool
showSelections
;
};
#endif
/* KOSHAPEPAINTINGCONTEXT_H */
libs/textlayout/KoTextDocumentLayout.h
View file @
5662eec8
...
...
@@ -70,6 +70,7 @@ public:
,
imageCollection
(
0
)
,
showFormattingCharacters
(
false
)
,
showSpellChecking
(
false
)
,
showSelections
(
true
)
,
background
(
Qt
::
white
)
{
}
...
...
@@ -83,6 +84,7 @@ public:
bool
showFormattingCharacters
;
bool
showTableBorders
;
bool
showSpellChecking
;
bool
showSelections
;
QColor
background
;
};
...
...
libs/textlayout/KoTextLayoutArea_paint.cpp
View file @
5662eec8
...
...
@@ -217,32 +217,33 @@ void KoTextLayoutArea::paint(QPainter *painter, const KoTextDocumentLayout::Pain
painter
->
restore
();
QVector
<
QTextLayout
::
FormatRange
>
selections
;
foreach
(
const
QAbstractTextDocumentLayout
::
Selection
&
selection
,
context
.
textContext
.
selections
)
{
QTextCursor
cursor
=
selection
.
cursor
;
int
begin
=
cursor
.
position
();
int
end
=
cursor
.
anchor
();
if
(
begin
>
end
)
qSwap
(
begin
,
end
);
if
(
end
<
block
.
position
()
||
begin
>
block
.
position
()
+
block
.
length
())
continue
;
// selection does not intersect this block.
if
(
selection
.
cursor
.
hasComplexSelection
())
{
continue
;
// selections of several table cells are covered by the within drawBorders above.
}
if
(
m_documentLayout
->
changeTracker
()
&&
!
m_documentLayout
->
changeTracker
()
->
displayChanges
()
&&
m_documentLayout
->
changeTracker
()
->
containsInlineChanges
(
selection
.
format
)
&&
m_documentLayout
->
changeTracker
()
->
elementById
(
selection
.
format
.
property
(
KoCharacterStyle
::
ChangeTrackerId
).
toInt
())
->
isEnabled
()
&&
m_documentLayout
->
changeTracker
()
->
elementById
(
selection
.
format
.
property
(
KoCharacterStyle
::
ChangeTrackerId
).
toInt
())
->
getChangeType
()
==
KoGenChange
::
DeleteChange
)
{
continue
;
// Deletions should not be shown.
if
(
context
.
showSelections
)
{
foreach
(
const
QAbstractTextDocumentLayout
::
Selection
&
selection
,
context
.
textContext
.
selections
)
{
QTextCursor
cursor
=
selection
.
cursor
;
int
begin
=
cursor
.
position
();
int
end
=
cursor
.
anchor
();
if
(
begin
>
end
)
qSwap
(
begin
,
end
);
if
(
end
<
block
.
position
()
||
begin
>
block
.
position
()
+
block
.
length
())
continue
;
// selection does not intersect this block.
if
(
selection
.
cursor
.
hasComplexSelection
())
{
continue
;
// selections of several table cells are covered by the within drawBorders above.
}
if
(
m_documentLayout
->
changeTracker
()
&&
!
m_documentLayout
->
changeTracker
()
->
displayChanges
()
&&
m_documentLayout
->
changeTracker
()
->
containsInlineChanges
(
selection
.
format
)
&&
m_documentLayout
->
changeTracker
()
->
elementById
(
selection
.
format
.
property
(
KoCharacterStyle
::
ChangeTrackerId
).
toInt
())
->
isEnabled
()
&&
m_documentLayout
->
changeTracker
()
->
elementById
(
selection
.
format
.
property
(
KoCharacterStyle
::
ChangeTrackerId
).
toInt
())
->
getChangeType
()
==
KoGenChange
::
DeleteChange
)
{
continue
;
// Deletions should not be shown.
}
QTextLayout
::
FormatRange
fr
;
fr
.
start
=
begin
-
block
.
position
();
fr
.
length
=
end
-
begin
;
fr
.
format
=
selection
.
format
;
selections
.
append
(
fr
);
}
QTextLayout
::
FormatRange
fr
;
fr
.
start
=
begin
-
block
.
position
();
fr
.
length
=
end
-
begin
;
fr
.
format
=
selection
.
format
;
selections
.
append
(
fr
);
}
// this is a workaround to fix text getting cut of when format ranges are used. There
// is a bug in Qt that can hit when text lines overlap each other. In case a format range
// is used for formating it can clip the lines above/below as Qt creates a clip rect for
...
...
plugins/textshape/TextShape.cpp
View file @
5662eec8
...
...
@@ -152,6 +152,7 @@ void TextShape::paintComponent(QPainter &painter, const KoViewConverter &convert
pc
.
showFormattingCharacters
=
paintContext
.
showFormattingCharacters
;
pc
.
showTableBorders
=
paintContext
.
showTableBorders
;
pc
.
showSpellChecking
=
paintContext
.
showSpellChecking
;
pc
.
showSelections
=
paintContext
.
showSelections
;
// When clipping the painter we need to make sure not to cutoff cosmetic pens which
// may used to draw e.g. table-borders for user convenience when on screen (but not
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment